blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
866ccd700ae2cd1e72a757b7f82fd6caf9681515 | 95ded305493e7fc927545b2226ec5a3f398b35b9 | /src/main/java/eje1/egg/spring/repositorios/AutorRepositorio.java | 66ee2ce0fec7ca77e44e8cb52ae7ed395da1a11b | [] | no_license | carlariossuarez/Ejercicio-1-Libreria-Spring-Egg | bc6fb08863a57be711a7470e1fa74a41cf37f8aa | 1d5fe7e3714cf75e43a0d68d8ffc6c8d28c69a20 | refs/heads/main | 2023-08-29T22:01:26.655523 | 2021-11-17T23:36:35 | 2021-11-17T23:36:35 | 422,365,097 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java |
package eje1.egg.spring.repositorios;
import eje1.egg.spring.entidades.Autor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface AutorRepositorio extends JpaRepository<Autor, String>{
}
| [
"[email protected]"
] | |
75f704e93dba32ca0abcef71653d0f6be13554e4 | 5af87c78fef8f90a5fcd99a580148a37645fa30b | /Docapp/Docapp/Docapp.Android/obj/Debug/81/android/src/md527a7103d6e2301228bd63a256515d332/GridViewRenderer.java | 9a7f02f63f57ab68bc224c950221bf7489c95d44 | [] | no_license | landrygears3/APPDOC | e86f94ad519030b50637f0511c68bbd1195107eb | 4659a80ed7ea6225b7e57c5e66debde6a939ba1f | refs/heads/master | 2021-06-26T02:13:48.617934 | 2019-03-17T23:28:48 | 2019-03-17T23:28:48 | 158,019,645 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,121 | java | package md527a7103d6e2301228bd63a256515d332;
public class GridViewRenderer
extends md51558244f76c53b6aeda52c8a337f2c37.ViewRenderer_2
implements
mono.android.IGCUserPeer
{
/** @hide */
public static final String __md_methods;
static {
__md_methods =
"n_onConfigurationChanged:(Landroid/content/res/Configuration;)V:GetOnConfigurationChanged_Landroid_content_res_Configuration_Handler\n" +
"";
mono.android.Runtime.register ("XLabs.Forms.Controls.GridViewRenderer, XLabs.Forms.Droid", GridViewRenderer.class, __md_methods);
}
public GridViewRenderer (android.content.Context p0, android.util.AttributeSet p1, int p2)
{
super (p0, p1, p2);
if (getClass () == GridViewRenderer.class)
mono.android.TypeManager.Activate ("XLabs.Forms.Controls.GridViewRenderer, XLabs.Forms.Droid", "Android.Content.Context, Mono.Android:Android.Util.IAttributeSet, Mono.Android:System.Int32, mscorlib", this, new java.lang.Object[] { p0, p1, p2 });
}
public GridViewRenderer (android.content.Context p0, android.util.AttributeSet p1)
{
super (p0, p1);
if (getClass () == GridViewRenderer.class)
mono.android.TypeManager.Activate ("XLabs.Forms.Controls.GridViewRenderer, XLabs.Forms.Droid", "Android.Content.Context, Mono.Android:Android.Util.IAttributeSet, Mono.Android", this, new java.lang.Object[] { p0, p1 });
}
public GridViewRenderer (android.content.Context p0)
{
super (p0);
if (getClass () == GridViewRenderer.class)
mono.android.TypeManager.Activate ("XLabs.Forms.Controls.GridViewRenderer, XLabs.Forms.Droid", "Android.Content.Context, Mono.Android", this, new java.lang.Object[] { p0 });
}
public void onConfigurationChanged (android.content.res.Configuration p0)
{
n_onConfigurationChanged (p0);
}
private native void n_onConfigurationChanged (android.content.res.Configuration p0);
private java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void monodroidClearReferences ()
{
if (refList != null)
refList.clear ();
}
}
| [
"[email protected]"
] | |
9e4704c11f49135bb6c2b7e75fad722f3444c8bb | 763d02a32a4323b7ca06d9f46ae6789248934b13 | /src/main/java/com/centel/ciclo3reto3/model/FincaDto.java | b3ef820e8e89d13d5fa839dd84c83fabfdff659a | [] | no_license | cpilargonzalez/reto3 | 9a0cdd2fd5320a68245587a4db846d1ad96a23e8 | 9f689e5c38db211fce1d36d4a9dc148508857c1f | refs/heads/master | 2023-08-25T12:53:30.811212 | 2021-10-25T22:51:59 | 2021-10-25T22:51:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,843 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.centel.ciclo3reto3.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
/**
*
* @author yeison
*/
@Entity
@Table(name="farm")
public class FincaDto implements Serializable {
private static final long serialVersionUID = 1L;
public FincaDto(){
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id_Farm")
private Integer id;
private String name;
private String address;
private int extension;
private String description;
@ManyToOne
@JoinColumn(name="id_Category", referencedColumnName = "id_Category")
@JsonIgnoreProperties("farms") //prevent infinite loop in Json
private CategoriaDto category;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "farm")
@JsonIgnoreProperties({"farm","client"})
private List<MensajeDto> messages;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "farm")
@JsonIgnoreProperties({"farm","client"})
private List<ReservaDto> reservations;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getExtension() {
return extension;
}
public void setExtension(int extension) {
this.extension = extension;
}
public CategoriaDto getCategory() {
return category;
}
public void setCategory(CategoriaDto category) {
this.category = category;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<ReservaDto> getReservations() {
return reservations;
}
public void setReservations(List<ReservaDto> reservations) {
this.reservations = reservations;
}
public List<MensajeDto> getMessages() {
return messages;
}
public void setMessages(List<MensajeDto> messages) {
this.messages = messages;
}
@Override
public String toString() {
return "FincaDto{" + "id=" + id + ", address=" + address + ", extension=" + extension + ", name=" + name + ", description=" + description + ", category=" + category + '}';
}
}
| [
"[email protected]"
] | |
71f16dc84c3bb7274eeecd278bf62b19987a3e0c | bd51b5965478244b799123db1710ce13b73215b9 | /src/main/java/eu/programisci/Test/user/api/KontrahentRestController.java | 119fcda60f229007974913851e1cb9c3c9b65335 | [] | no_license | zzzadrzzz/fakturer1 | 28a8d82f255a7a9f256ba101d43436ac1f487aa3 | 4ca96aaadaba182deefedbdbfa3e4b1c98664dca | refs/heads/master | 2021-01-20T15:10:41.668240 | 2017-05-08T13:05:13 | 2017-05-08T13:05:13 | 90,730,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,689 | java | package eu.programisci.Test.user.api;
import eu.programisci.Test.user.dto.KontrahentDTO;
import eu.programisci.Test.user.service.IKontrahentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/api/kontrahent")
@CrossOrigin(origins = "*", allowCredentials = "true", allowedHeaders = "*", methods = {RequestMethod.GET, RequestMethod.HEAD, RequestMethod.OPTIONS, RequestMethod.DELETE, RequestMethod.POST, RequestMethod.PUT})
public class KontrahentRestController {
@Autowired
private IKontrahentService KontrahentService;
@RequestMapping(value = "/findOne", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public KontrahentDTO findOne(@RequestParam("id") Long aId) {
return KontrahentService.findOne(aId);
}
@RequestMapping(value = "/findAll", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<KontrahentDTO> findAll() {
return (List<KontrahentDTO>) KontrahentService.findAll();
}
@RequestMapping(value = "/deleteOne", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void deleteOne(@RequestParam("id") Long aId) {
KontrahentService.deleteOne(aId);
}
@RequestMapping(value = "/save", method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public KontrahentDTO save(@RequestBody KontrahentDTO aUserDTO) {return KontrahentService.save(aUserDTO);
}
}
| [
"[email protected]"
] | |
2959395645232c1d54eb1c6bdfc901e6ea391b3e | c18ea820cdaea6c85c727e0652f811113d55e2eb | /src/main/java/com/kh/mhm/api/controller/ApiController.java | f87445b66f90024586ffa7d09f972f4a17f465a2 | [] | no_license | RMHM2/miniMap2 | f2a26b033c5d35a11b822f28baafa4bb4937e144 | 77fec0087a2d33ed7d1f1fb3d8fc697937b83af5 | refs/heads/master | 2020-04-17T18:01:13.233674 | 2019-02-09T03:35:09 | 2019-02-09T03:36:00 | 166,808,449 | 0 | 0 | null | 2019-02-09T03:36:01 | 2019-01-21T12:13:02 | JavaScript | UTF-8 | Java | false | false | 5,691 | java | package com.kh.mhm.api.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.ListUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.kh.mhm.api.JejuApi;
import com.kh.mhm.api.common.ConvLonLatToXY;
@Controller
public class ApiController {
private int num = 2018;
@RequestMapping("/event/eventCalendar.go")
public String eventCalendar() {
return "event/eventCalendar";
}
@RequestMapping("/jeju/jejuWeather.do")
@ResponseBody
public Object jejuWeather() {
Map<String, Object> result = new HashMap<String, Object>();
SimpleDateFormat sdf = new SimpleDateFormat();
ConvLonLatToXY conv = new ConvLonLatToXY();
String url = "http://data.jeju.go.kr/rest/JejuLdapsDataService/getForecastPointDataXY";
Map<String, Object> param = null;
String resultType = "xml";
sdf.applyPattern("HH");
int nowHour = Integer.parseInt(sdf.format(new Date()));
String baseTime = "";
String baseDate = "";
sdf.applyPattern("yyyMMdd");
if(nowHour>2&&nowHour<16) {
baseTime = "2100";
Calendar cal = new GregorianCalendar();
cal.add(Calendar.DATE, -1);
baseDate = sdf.format(cal.getTime());
} else if(nowHour<3) {
baseTime = "0900";
Calendar cal = new GregorianCalendar();
cal.add(Calendar.DATE, -1);
baseDate = sdf.format(cal.getTime());
} else if(nowHour>15) {
baseTime = "0900";
baseDate = sdf.format(new Date());
}
Map<String, Object> tmpMap = new HashMap<String, Object>();
// 제주시 좌표 33.499583, 126.531259
tmpMap.put("제주", conv.ll_to_ij(33.499583, 126.531259));
// 서귀포 좌표 33.253889, 126.559662
tmpMap.put("서귀포", conv.ll_to_ij(33.253889, 126.559662));
for(Object str : tmpMap.keySet().toArray()) {
int pageSize = 10;
List<Map<String, Object>> tmp = new ArrayList<Map<String, Object>>();
for(int i=1;;i++) {
param = new HashMap<String, Object>();
param.put("authApiKey", "DYYBJHVJQVVFAWT");
param.put("baseDate", baseDate);
param.put("baseTime", baseTime);
param.put("nx", ((int[])tmpMap.get(str))[0]);
param.put("ny", ((int[])tmpMap.get(str))[1]);
param.put("hgtLevel", 1);
param.put("startPage", i);
List<Map<String, Object>> list = new JejuApi().restAPi(url, param, resultType, "//data/list");
if(list==null || list.size()==0) break;
tmp = ListUtils.union(tmp, list);
if(list.size()<pageSize) break;
}
result.put((String)str, tmp);
}
return result;
}
@RequestMapping("/jeju/jejuContent.do")
@ResponseBody
public Map<String, List<Map<String, Object>>> jejuContent() {
// 공연전시 api
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
Map<String, List<Map<String, Object>>> resultMap = new HashMap<String, List<Map<String, Object>>>();
String url = "http://www.jeju.go.kr/rest/JejuExhibitionService/getJejucultureExhibitionList";
Map<String, Object> param = null;
String resultType = "xml";
int tYear = Calendar.getInstance().get(Calendar.YEAR);
// int tMonth = Calendar.getInstance().get(Calendar.MONTH);
int page = 212 + (tYear - num) * 3;
int pageSize = 30;
long st = new Date().getTime();
// 반복문 돌면서 정보 저장
while (true) {
List<Map<String, Object>> tmp = null;
param = new HashMap<String, Object>();
param.put("page", page);
param.put("pageSize", pageSize);
tmp = new JejuApi().restAPi(url, param, resultType, "//items/item");
if (tmp == null || tmp.size()==0) break;
int dataYear = Integer.parseInt(tmp.get(0).get("start").toString().substring(0, 4));
// int dataMonth =
// Integer.parseInt(tmp.get(0).get("start").toString().substring(5, 7));
if (tYear - dataYear > 1)
page += 5;
else {
resultList = ListUtils.union(resultList, tmp);
page++;
}
if (tmp == null || tmp.size() < 20) break;
}
// 임시 리스트 생성
List<Map<String, Object>> tmpList1 = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> tmpList2 = new ArrayList<Map<String, Object>>();
for (int i = 1; i < resultList.size(); i++) {
if (diffDate((String) resultList.get(i).get("end"), "today") < 8) {
if (resultList.get(i).get("categoryName").equals("공연")) {
tmpList1.add(resultList.get(i));
} else if (resultList.get(i).get("categoryName").equals("전시")) {
tmpList2.add(resultList.get(i));
}
}
}
resultMap.put("공연", tmpList1);
resultMap.put("전시", tmpList2);
long ed = new Date().getTime();
System.out.println("수행 시간 : " + (ed - st));
if (ed - st > 5000)
num--;
return resultMap;
}
// 날짜 차이구하기
public long diffDate(String stDate, String edDate) {
SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd");
String today = String.valueOf(Calendar.getInstance().get(Calendar.YEAR)) + "-"
+ String.valueOf(Calendar.getInstance().get(Calendar.MONTH) + 1) + "-"
+ String.valueOf(Calendar.getInstance().get(Calendar.DATE));
long gap = 0L;
long gapToDiff = 0L;
try {
Date start = sdt.parse(stDate);
Date end = sdt.parse((edDate.toLowerCase().equals("today")) ? today : edDate);
gap = end.getTime() - start.getTime();
gapToDiff = gap / (1000 * 60 * 60 * 24);
} catch (Exception e) {
System.out.println(e.getMessage());
}
return gapToDiff;
}
// 팝업창 보내기 임시
}
| [
"[email protected]"
] | |
bd7afbc1e6569045a228b5d9c84a060b077b67ab | f32b9906a5c3321187a4872d86d0a0fc4ec8df5a | /RetroBlaster/src/com/astromaze/retroblaster/RetroBlasterActivity.java | 43d4f0295156b957dbf3c27fceb2f519f0659d71 | [] | no_license | varunk08/AndroidProjects | 78583d853bc520b47069b1e79cdf29307935dcc8 | 2dfb312019eec4c1a2a7541fbf106f932d0562f1 | refs/heads/master | 2021-01-19T16:59:09.922504 | 2014-04-14T23:51:52 | 2014-04-14T23:51:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package com.astromaze.retroblaster;
import android.app.Activity;
import android.os.Bundle;
public class RetroBlasterActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
} | [
"[email protected]"
] | |
70b482685c0e31203e530773e68a7aa4fe9bccd9 | b5e2c59dc1b8627206a31b2d7bf074fc81fda2e4 | /live01.am/src/masteringthreads/ch3_the_secrets_of_concurrency/exercise_3_1/ThreadPool.java | b8f957f4f35e14f0140472905a609c684feb9d14 | [] | no_license | avi202020/MasteringThreads-LiveWorkshop | 0b65ab1cfb0f5e3e1c4dd632a17dd99626ad0237 | 2cfc41a32869f41b4c659218a311f4365bf948d8 | refs/heads/master | 2022-12-09T22:09:30.807960 | 2020-08-05T04:43:21 | 2020-08-05T04:43:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,623 | java | package masteringthreads.ch3_the_secrets_of_concurrency.exercise_3_1;
import java.util.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
public class ThreadPool {
private final ThreadGroup group = new ThreadGroup("ThreadPoolGroup");
private final List<Runnable> tasks = new LinkedList<>();
private final AtomicBoolean running = new AtomicBoolean(true);
public ThreadPool(int poolSize) {
for (int i = 0; i < poolSize; i++) {
var worker = new Worker(group, "worker-" + i);
worker.start();
}
}
private Runnable take() throws InterruptedException {
if (Thread.interrupted()) throw new InterruptedException();
synchronized (tasks) {
while (tasks.isEmpty()) tasks.wait();
return tasks.remove(0);
}
}
public void submit(Runnable job) {
synchronized (tasks) {
tasks.add(job);
tasks.notifyAll();
}
}
public int getRunQueueLength() {
synchronized (tasks) {
return tasks.size();
}
}
@SuppressWarnings("deprecation")
public void shutdown() {
running.set(false);
group.interrupt();
}
private class Worker extends Thread {
public Worker(ThreadGroup group, String name) {
super(group, name);
}
public void run() {
while(running.get()) {
try {
take().run();
} catch (InterruptedException e) {
break;
}
}
}
}
}
| [
"[email protected]"
] | |
ac125c0541be25638d02815448ca6bc28a7ba5a6 | 88db8775a263e1bef57efbdb08e1625664a29f66 | /app/src/main/java/com/wangyi/BaseFragment.java | 890f61dc8efe0acd5bc5132d9abffa5f5a38e4b8 | [] | no_license | 2223512468/WangYi | f9f761791705168b47d33112c95dcd09c12945c8 | 1e7621b328af8bcbc330c7f754bb10fea873ab52 | refs/heads/master | 2021-04-03T04:22:24.336927 | 2018-03-10T02:04:46 | 2018-03-10T02:04:46 | 124,613,240 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package com.wangyi;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class BaseFragment extends Fragment {
private String text="";
@Override
public void onCreate(Bundle savedInstanceState) {
Bundle args = getArguments();
text = args != null ? args.getString("text") : "";
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view =inflater.inflate(R.layout.layout_1, null);
TextView tv_fragment = (TextView) view.findViewById(R.id.tv_fragment);
tv_fragment.setText(text);
return view;
}
}
| [
"[email protected]"
] | |
80c4f7137557d2f07ffec8b565b1358ecc86dd23 | a6be4080a5438ae791f29a7ce646d16444748690 | /src/main/java/study/basiccrud/module/food/service/FoodService.java | ca604e1f8083283c7fad103cadbb255ccf0c67bb | [] | no_license | wangkdk/basic-crud | f60682fa53ccca80bb95b50d7c3ea4bb16183b31 | c2a9682b9474bab5d2258377f227294c27e421e4 | refs/heads/master | 2022-11-14T23:20:00.622758 | 2020-07-13T11:57:59 | 2020-07-13T11:57:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,944 | java | package study.basiccrud.module.food.service;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import study.basiccrud.module.food.dto.FoodSaveRequestDto;
import study.basiccrud.module.food.dto.FoodUpdateRequestDto;
import study.basiccrud.module.food.entity.Food;
import study.basiccrud.module.food.repository.FoodRepository;
@RequiredArgsConstructor
@Service
public class FoodService {
private final FoodRepository foodRepository;
@Transactional
public Long saveFood(FoodSaveRequestDto saveRequestDto) {
Food food = Food.builder()
.type(saveRequestDto.getType())
.name(saveRequestDto.getName())
.price(saveRequestDto.getPrice())
.desc(saveRequestDto.getDesc())
.build();
Food savedFood = foodRepository.save(food);
return savedFood.getId();
}
@Transactional
public Long updateFood(Long id, FoodUpdateRequestDto foodUpdateDto) {
// TODO : 모든 IllegalArgumentException 을 잡아서 ResponseEntity 로 return 할 수 없으니 custom exception 을 만들어서 사용해야할듯
// TODO : 더 나은 방법을 생각해봐야함
Food food = foodRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("해당 음식이 존재하지 않습니다 id=" + id));
food.updateFood(foodUpdateDto.getType(), foodUpdateDto.getName(), foodUpdateDto.getPrice(), foodUpdateDto.getDesc());
return food.getId();
}
@Transactional
public Long deleteFood(Long id) {
Food food = foodRepository.findById(id).orElseThrow(() -> new IllegalArgumentException("해당 음식이 존재하지 않습니다 id=" + id));
foodRepository.delete(food);
// flush 가 일어나기 전이니까 id가 살아있음
return food.getId();
}
}
| [
"[email protected]"
] | |
e7883fe756287e7a69e98e310216c338531204f9 | 12514c4642899f2084a4b31e4cd2025d580bbb82 | /gapic/src/main/com/google/gapid/perfetto/models/ProcessSummaryTrack.java | 6a0dcad876b148bf0be1957cf8a6c0131511c661 | [
"Apache-2.0"
] | permissive | afd/gapid | cbdd34f83994c619d4835219ff73a3f4f2fba5a6 | f36fdfb8b633d52aaf1bd873e14581d1ca16688e | refs/heads/master | 2020-11-25T21:50:46.200951 | 2019-12-18T13:47:38 | 2019-12-18T13:47:38 | 228,860,601 | 0 | 0 | Apache-2.0 | 2019-12-18T14:45:42 | 2019-12-18T14:45:41 | null | UTF-8 | Java | false | false | 5,200 | java | /*
* Copyright (C) 2019 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.gapid.perfetto.models;
import static com.google.gapid.perfetto.models.QueryEngine.createSpan;
import static com.google.gapid.perfetto.models.QueryEngine.createView;
import static com.google.gapid.perfetto.models.QueryEngine.createWindow;
import static com.google.gapid.perfetto.models.QueryEngine.dropTable;
import static com.google.gapid.perfetto.models.QueryEngine.dropView;
import static com.google.gapid.util.MoreFutures.transform;
import static com.google.gapid.util.MoreFutures.transformAsync;
import static java.lang.String.format;
import static java.util.stream.Collectors.joining;
import com.google.common.util.concurrent.ListenableFuture;
/**
* {@link Track} containing CPU usage data of all threads in a process.
*/
public class ProcessSummaryTrack extends Track<ProcessSummaryTrack.Data> {
// "where cpu < %numCpus%" is for performance reasons of the window table.
private static final String PROCESS_VIEW_SQL = "select * from sched where utid in (%s)";
private static final String SUMMARY_SQL =
"select quantum_ts, sum(dur)/cast(%d * %d as float) " +
"from %s group by quantum_ts";
private static final String SLICES_SQL = "select ts, dur, cpu, utid, row_id from %s";
private final int numCpus;
private final ProcessInfo process;
public ProcessSummaryTrack(int numCpus, ProcessInfo process) {
super("proc_" + process.upid + "_sum");
this.numCpus = numCpus;
this.process = process;
}
public ProcessInfo getProcess() {
return process;
}
@Override
protected ListenableFuture<?> initialize(QueryEngine qe) {
String sched = tableName("sched"), span = tableName("span"), window = tableName("window");
String tids = process.utids.stream()
.map(String::valueOf)
.collect(joining(","));
return qe.queries(
dropTable(span),
dropView(sched),
dropTable(window),
createWindow(window),
createView(sched, format(PROCESS_VIEW_SQL, tids)),
createSpan(span, sched + " PARTITIONED cpu, " + window));
}
@Override
protected ListenableFuture<Data> computeData(QueryEngine qe, DataRequest req) {
Window window = Window.compute(req, 10);
return transformAsync(window.update(qe, tableName("window")),
$ -> window.quantized ? computeSummary(qe, req, window) : computeSlices(qe, req));
}
private ListenableFuture<Data> computeSummary(QueryEngine qe, DataRequest req, Window w) {
return transform(qe.query(summarySql(w.bucketSize)), result -> {
Data data = new Data(req, w.bucketSize, new double[w.getNumberOfBuckets()]);
result.forEachRow(($, r) -> data.utilizations[r.getInt(0)] = r.getDouble(1));
return data;
});
}
private String summarySql(long ns) {
return format(SUMMARY_SQL, numCpus, ns, tableName("span"));
}
private ListenableFuture<Data> computeSlices(QueryEngine qe, DataRequest req) {
return transform(qe.query(slicesSql()), result -> {
int rows = result.getNumRows();
Data data = new Data(
req, new long[rows], new long[rows], new long[rows], new int[rows], new long[rows]);
result.forEachRow((i, r) -> {
long start = r.getLong(0);
data.starts[i] = start;
data.ends[i] = start + r.getLong(1);
data.cpus[i] = r.getInt(2);
data.utids[i] = r.getLong(3);
data.ids[i] = r.getLong(4);
});
return data;
});
}
private String slicesSql() {
return format(SLICES_SQL, tableName("span"));
}
public static class Data extends Track.Data {
public final Kind kind;
// Summary.
public final long bucketSize;
public final double[] utilizations;
// Slice.
public final long[] ids;
public final long[] starts;
public final long[] ends;
public final int[] cpus;
public final long[] utids;
public Data(DataRequest request, long bucketSize, double[] utilizations) {
super(request);
this.kind = Kind.summary;
this.bucketSize = bucketSize;
this.utilizations = utilizations;
this.ids = null;
this.starts = null;
this.ends = null;
this.cpus = null;
this.utids = null;
}
public Data(
DataRequest request, long[] ids, long[] starts, long[] ends, int[] cpus, long[] utids) {
super(request);
this.kind = Kind.slice;
this.ids = ids;
this.starts = starts;
this.ends = ends;
this.cpus = cpus;
this.utids = utids;
this.bucketSize = 0;
this.utilizations = null;
}
public static enum Kind {
summary, slice;
}
}
}
| [
"[email protected]"
] | |
3def937052bb9899189a187feb3356833f6f0db7 | 2a6766ed3780d6a5f994ee88addbc98a17f9852a | /src/jframe/componentes/ModeloDeArvore.java | 76b202b0b8be17d4d67c080f21f1b3876bfff8c2 | [] | no_license | ernandofvjr/Master-of-Works-V2 | 5bc3da8b2af5107ddc274b24c6c53d753dd94bf1 | b35e47635521da01c1353aabef53d3cf501fdf08 | refs/heads/master | 2020-04-26T21:28:19.732110 | 2019-03-05T00:33:41 | 2019-03-05T00:33:41 | 173,842,975 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,942 | java | package jframe.componentes;
import java.util.ArrayList;
import java.util.List;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import classes.Atividade;
import classes.Semana;
public class ModeloDeArvore implements TreeModel {
private String raiz = "ATIVIDADES";
private List<TreeModelListener> listeners = new ArrayList<TreeModelListener>();
private List<Semana> semanas;
public ModeloDeArvore(List<Semana> semanas) {
this.semanas = semanas;
}
public void addTreeModelListener(TreeModelListener l) {
}
public Object getChild(Object parent, int index) {
if (parent == raiz) // É o nó principal?
return semanas.get(index); // Pegamos da lista de livro
if (parent instanceof Semana) // O pai é um livro?
{
// Devolvemos um autor
return ((Semana) parent).getAtividades().get(index);
}
// Se o pai não é nenhum desses. Melhor dar erro.
throw new IllegalArgumentException("Invalid parent class"
+ parent.getClass().getSimpleName());
}
public int getChildCount(Object parent) {
// Mesma lógica.
if (parent == raiz)
return semanas.size();
if (parent instanceof Semana) // O pai é um livro?
return ((Semana) parent).getAtividades().size();
// Se o pai não é nenhum desses. Melhor dar erro.
throw new IllegalArgumentException("Invalid parent class"
+ parent.getClass().getSimpleName());
}
public int getIndexOfChild(Object parent, Object child) {
if (parent == raiz)
return semanas.indexOf(child);
if (parent instanceof Semana)
return ((Semana) parent).getAtividades().indexOf(child);
return 0;
}
public Object getRoot() {
return raiz;
}
public boolean isLeaf(Object node) {
return node instanceof Atividade;
}
public void removeTreeModelListener(TreeModelListener l) {
}
public void valueForPathChanged(TreePath path, Object newValue) {
}
} | [
"[email protected]"
] | |
e0e6bf5fd928e75aa84d95879e2065f7fb74d387 | 9b3dd01eb639d71ed3224f9b9b5b2870c825ca21 | /Rating/src/main/java/com/megatravel/validation/StaticData.java | cde8ea3d261b3d1ee2b86f33afa3c8ded85126ec | [] | no_license | AstralWatcher/megatravel-backend-microservices | 33a8a0d0291bae21f5a5764ee8681dd643965b4f | ca1137ba1245e7f380ad33d0530aa01bdcbe1889 | refs/heads/master | 2023-04-29T06:07:02.795153 | 2019-06-30T05:21:22 | 2019-06-30T05:21:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package com.megatravel.validation;
import java.util.regex.Pattern;
public class StaticData {
public static final int lengthValue = 30;
public static final int lengthDescription = 140;
public static final int minLength = 0;
public static final int minLengthEmail = 10;
public static final int maxLengthEmail = 60;
public static final Pattern VALID_EMAIL_ADDRESS_REGEX =
Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
public static final Pattern VALID_PASSWORD_NUMBERS = Pattern.compile("[0-9]+");
public static final Pattern VALID_PASSWORD_SPECIAL_CHARACTERS = Pattern.compile("[+-/*/.,!?+_#%^]+");
public static final Pattern VALID_PASSWORD_UPPER_CASE = Pattern.compile("[A-Z]+");
public static final Pattern VALID_PASSWORD_LOWER_CASE = Pattern.compile("[a-z]+");
}
| [
"[email protected]"
] | |
462b7bd275671848712817ca21d20121024f87c1 | 85f401ea5709b39fdb24058b3aab018da9d6543b | /spring-rabbitmq-cusomer-advanced/src/main/java/com/zhongjie/listener/AckListener.java | 56bb6b3c78f4a13216f5be1d022d00bae3736163 | [] | no_license | luzhongjie01/rabbitmq-test | 17729a69c4f7e067e1e75a791bd34922f8a7ada4 | 1170ed99ce7187e1a4b17f96e5f0c3dd8b402f6d | refs/heads/main | 2023-05-14T14:12:15.580312 | 2021-06-06T15:45:14 | 2021-06-06T15:45:14 | 374,382,967 | 1 | 0 | null | 2021-06-06T14:59:13 | 2021-06-06T14:35:58 | null | UTF-8 | Java | false | false | 1,035 | java | package com.zhongjie.listener;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
import org.springframework.stereotype.Component;
@Component
public class AckListener implements ChannelAwareMessageListener {
@Override
public void onMessage(Message message, Channel channel) throws Exception {
System.out.println("---ack监听器开始了---");
//获取消息id
long deliveryTag = message.getMessageProperties().getDeliveryTag();
try {
System.out.println("message:" + new String(message.getBody()));
System.out.println("业务处理");
int i = 5 / 0;
channel.basicAck(deliveryTag, true);
} catch (Exception e) {
//有异常,拒绝签收消息
//括号第三个参数(true表示消息重新放回队列)(false丢弃消息)
channel.basicNack(deliveryTag,true,false);
}
}
}
| [
"[email protected]"
] | |
969106b8a8979d3838db779700a40f821cb98766 | fe08c1d12d84fb91f2728316a5d96aa87932552b | /Week_04/erfenchazhao.java | 58f7453d7873140eaa82ad4651e6a58c50b2a184 | [] | no_license | fkccoding/algorithm011-class01 | ec97c87a903cfaa805916f7ac5b3e7e7b6875a25 | 360e596d4cd470ff163d2dd8d227644aaced2d64 | refs/heads/master | 2022-11-25T22:41:31.044888 | 2020-08-02T15:59:34 | 2020-08-02T15:59:34 | 273,913,234 | 0 | 0 | null | 2020-06-21T13:48:06 | 2020-06-21T13:48:05 | null | UTF-8 | Java | false | false | 624 | java | /**
* @author https://www.chuckfang.com
* @date Created on 2020/7/19 23:24
*/
public class erfenchazhao {
public static void main(String[] args) {
int[] arr = {4, 5, 6, 7, 0, 1, 2};
int max = getMax(arr);
System.out.println(max);
}
private static int getMax(int[] arr) {
int left = 0, right = arr.length - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (arr[mid] > left) {
left = mid + 1;
} else {
right = mid - 1;
}
}
return arr[left - 1];
}
}
| [
"[email protected]"
] | |
4429099df477fa888493a5ac05c417bb63abafa7 | 600bf07be795b2460d8f04c97717dbddf96e5649 | /micro-api/src/main/java/com/ydhl/micro/api/dto/admin/sys/NavTreeDTO.java | 4c94779b84867889fb47810271f830421a9967e7 | [] | no_license | it-yangll/ydhl-micro | 82fbfc7453208ab9b9c0c5c2cb2305251ae9171b | 156af4523ccdeb646a754cafba59c95839a9b935 | refs/heads/master | 2022-11-02T10:07:38.338430 | 2019-09-12T03:49:23 | 2019-09-12T03:49:23 | 207,952,781 | 0 | 0 | null | 2022-10-12T20:31:48 | 2019-09-12T03:01:26 | Java | UTF-8 | Java | false | false | 352 | java | package com.ydhl.micro.api.dto.admin.sys;
import lombok.Data;
import lombok.ToString;
import java.util.List;
/**
* @ClassName NavTreeDTO
* @Description TODO
* @Author Ly
* @Date 2019/4/25 12:41
* @Version 1.0
**/
@Data
@ToString
public class NavTreeDTO {
private Menu menu;
private List<NavTreeDTO> childs;
}
| [
"[email protected]"
] | |
c619032ca55cb4b43f206db26870b0e7006387e4 | 6b1511a3f83e589a07493fc78b0e4507fddaf0ee | /src/main/java/ru/khachalov/springannotation/annotHW/GeographyBook.java | 3773a66a2b9229542e047c02e4dfa8f9afc0806d | [] | no_license | omax39/Spring | 48c01125e8e4d4dd8de1ddea1777140c37d5f1e3 | d096e75d084374266402b765f16833e9ff89e6b1 | refs/heads/master | 2022-12-25T01:11:09.359272 | 2020-03-19T12:49:11 | 2020-03-19T12:49:11 | 240,196,177 | 0 | 0 | null | 2022-12-16T15:25:52 | 2020-02-13T06:53:06 | Java | UTF-8 | Java | false | false | 767 | java | package ru.khachalov.springannotation.annotHW;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.ArrayList;
import java.util.List;
@Component
public class GeographyBook implements Books {
private List<String> gBooks = new ArrayList<>();
public GeographyBook(){
gBooks.add("Africa");
gBooks.add("Europe");
gBooks.add("Asia");
}
@Override
public List<String> getBook() {
return gBooks;
}
@PostConstruct
public void myInit(){
System.out.println("Initialisation");
}
@PreDestroy
public void myDestroy(){
System.out.println("Destroy");
}
}
| [
"[email protected]"
] | |
e6defda3ab4f9667b9509cba07fd787733cc2f28 | 18a2de1a6bf41b3028f420f7d29206060abc9fee | /src/main/java/com/underarmour/assessment/repo/SimpleMessageHotRepository.java | ffd395ba209cf022ad74ac968aad33337d7acb04 | [] | no_license | neerajsu/UnderArmourAssessment | c204259c0ae9c2a180c033d623e8d7c8ebb47640 | 9473a99c0a00ca01a94f83406b73246b91e823ae | refs/heads/master | 2020-03-26T21:04:45.053644 | 2018-08-20T15:49:48 | 2018-08-20T15:49:48 | 145,364,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package com.underarmour.assessment.repo;
import java.util.List;
import com.underarmour.assessment.model.RedisMessage;
public interface SimpleMessageHotRepository {
void addMessage(final RedisMessage message);
List<RedisMessage> findAllByUserName(String userName);
void deleteMessage(final RedisMessage message);
}
| [
"[email protected]"
] | |
26b456f35b034a1e4bbb03313723c474c02e9b03 | 053e95c7b0c6abc108d1c59ac47f8dd76bb6305b | /src/com/corejava/java8/lamdaexpression/ConvertArrayListToHashMap.java | 6906108fc78b92dc336dd655bf68f4fe9b92dbc0 | [] | no_license | sagasoftech/core-java | 92b8eb35bd0e568fdd79f83f6470515284053e3b | 5b351265e70b9407e73be6951c63c2b462b02485 | refs/heads/main | 2023-08-17T05:33:32.927808 | 2023-08-17T03:26:36 | 2023-08-17T03:26:36 | 292,162,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.corejava.java8.lamdaexpression;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ConvertArrayListToHashMap {
public static void main(String[] args) {
List<String> arrList = new ArrayList<>();
arrList.add("One");
arrList.add("Two");
arrList.add("Three");
Map<Integer, String> arrMap = new HashMap<>();
arrList.forEach((n) -> arrMap.put(arrMap.size(), n));
System.out.println(arrMap);
}
}
| [
"[email protected]"
] | |
b93a9b96ed2abf1ff158ee11514220674dd52d27 | e106ed1b19e8bb93e788da4e895c2bf29e89809e | /src/main/java/com/ylink/ylpay/common/project/invest/app/QueryAppService.java | 7fc0cb3dfb760ad4d6f5c6d58505ca525368e577 | [] | no_license | lf2035724/aucross-commons | ab691f93ac21bd2bdaa959fd492efd86d2591853 | d2977749da24db8dc1db4ea6f42624c95991d0b2 | refs/heads/master | 2020-06-13T11:39:31.064143 | 2016-12-02T11:20:57 | 2016-12-02T11:21:02 | 75,385,027 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,254 | java | /**
* 版权所有(C) 2013 深圳市雁联计算系统有限公司
* 创建:Pengyindong 2013-1-8
*/
package com.ylink.ylpay.common.project.invest.app;
import java.util.Date;
import java.util.List;
import com.google.code.lightssh.common.model.page.ListPage;
import com.ylink.ylpay.common.project.invest.dto.CheckResultDTO;
import com.ylink.ylpay.common.project.invest.dto.DayCutDTO;
import com.ylink.ylpay.common.project.invest.dto.FcheckMonitorDTO;
import com.ylink.ylpay.common.project.invest.dto.RedemptionDTO;
import com.ylink.ylpay.common.project.invest.dto.SubscriptionDTO;
/**
* @author Pengyindong
* @date 2013-1-8
* @description:基金前置查询接口
*/
public interface QueryAppService {
/**
* @description 分页查询赎回记录信息
* @param page
* @param dto
* @return
* @author Pengyindong
* @date 2013-1-8
*/
public ListPage<RedemptionDTO> findRedemptionListPage(
ListPage<RedemptionDTO> page, RedemptionDTO dto);
/**
* @description 分页查询申购记录信息
* @param page
* @param dto
* @return
* @author Pengyindong
* @date 2013-1-8
*/
public ListPage<SubscriptionDTO> findSubscriptionListPage(
ListPage<SubscriptionDTO> page, SubscriptionDTO dto);
public ListPage<SubscriptionDTO> findSubscriptionList(
ListPage<SubscriptionDTO> page, SubscriptionDTO dto);
/**
* @description 日切数据查询
* @return
* @author Pengyindong
* @date 2013-1-9
*/
public List<DayCutDTO> findDayCutList(DayCutDTO dto);
/**
* huoquriqie
* @description:
* @return
* @author LiXiPing
* @date 2013-12-3
*/
public Date getDayCut();
/**
* 分页查询对账结果信息
* @description
* @param page
* @param dto
* @return
* @author Leo
* @date 2013-1-21
*/
public ListPage<CheckResultDTO> findListPage(ListPage<CheckResultDTO> page, CheckResultDTO dto);
// public ListPage<CheckResultDTO> findListPage(ListPage<CheckResultDTO> page, CheckResultDTO checkResult);
/**
* @description 对账记录分页信息
* @param page
* @param dto
* @return
* @author Pengyindong
* @date 2013-1-26
*/
public ListPage<FcheckMonitorDTO> findFcheckMonitorListPage(ListPage<FcheckMonitorDTO> page, FcheckMonitorDTO dto);
}
| [
"[email protected]"
] | |
989b65035675c6d6dc3124db251012be38b025a8 | 8288b6a70fdbee951102b19013d5a0bc55753e07 | /app/src/main/java/com/returntrader/view/widget/CropCircleTransformation.java | ecbdc75144ff21831c68f5601d9f4b071863a137 | [] | no_license | Thaniatdoodleblue/Ruturn-Trading-Android | 7c7f4b8320e9f197cb55b0f57ee8f849ebbf05f2 | 8515e4c918f6d7a1ae37c903915705d43ac79d01 | refs/heads/master | 2020-03-26T23:46:13.497726 | 2018-08-21T13:19:08 | 2018-08-21T13:19:08 | 145,565,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,543 | java | package com.returntrader.view.widget;
/**
* Copyright (C) 2017 Wasabeef
*
* 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.
*/
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.BitmapResource;
public class CropCircleTransformation implements Transformation<Bitmap> {
private BitmapPool mBitmapPool;
public CropCircleTransformation(Context context) {
this(Glide.get(context).getBitmapPool());
}
public CropCircleTransformation(BitmapPool pool) {
this.mBitmapPool = pool;
}
@Override
public Resource<Bitmap> transform(Resource<Bitmap> resource, int outWidth, int outHeight) {
Bitmap source = resource.get();
int size = Math.min(source.getWidth(), source.getHeight());
int width = (source.getWidth() - size) / 2;
int height = (source.getHeight() - size) / 2;
Bitmap bitmap = mBitmapPool.get(size, size, Bitmap.Config.ARGB_8888);
if (bitmap == null) {
bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
}
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
BitmapShader shader =
new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
if (width != 0 || height != 0) {
// source isn't square, move viewport to center
Matrix matrix = new Matrix();
matrix.setTranslate(-width, -height);
shader.setLocalMatrix(matrix);
}
paint.setShader(shader);
paint.setAntiAlias(true);
float r = size / 2f;
canvas.drawCircle(r, r, r, paint);
return BitmapResource.obtain(bitmap, mBitmapPool);
}
@Override public String getId() {
return "CropCircleTransformation()";
}
} | [
"[email protected]"
] | |
1a34ad27fe37ed3557629489b4b54ea8c4c328a8 | 91b958e65bba29caee1c82208523c8c7269b0ee2 | /src/test/java/com/intelligrated/download/mapper/converter/StringToBooleanConverterTest.java | a7ee9e5d71ad8da981729c8674012f8ac7be5b72 | [] | no_license | maspen/jpa-boot-download-5 | f86082270780a06c6643aa2842d75123c0c45835 | edcefacf2810a3a2092ee7da6684a9cf30cc2487 | refs/heads/master | 2021-01-10T07:21:39.197003 | 2016-01-07T02:09:17 | 2016-01-07T02:09:17 | 49,032,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,696 | java | package com.intelligrated.download.mapper.converter;
import org.junit.Assert;
import org.junit.Test;
public class StringToBooleanConverterTest {
private StringToBooleanConverter converter = new StringToBooleanConverter();
@Test
public void convertNullStringReturnsNull() {
String nullString = null;
Boolean returnedBooleanType = converter.convert(nullString);
Assert.assertNull(returnedBooleanType);
}
@Test
public void convertEmptyStringReturnsNull() {
String emptyString = "";
Boolean returnedBooleanType = converter.convert(emptyString);
Assert.assertNull(returnedBooleanType);
}
@Test
public void convertBogusStringReturnsFalse() {
String bogusString = "12tdset9";
Boolean returnedBooleanType = null;
try {
returnedBooleanType = converter.convert(bogusString);
} catch (Exception e) {
Assert.assertNotNull(e);
}
Assert.assertFalse(returnedBooleanType);
}
@Test
public void convertTStringReturnsBooleanTrue() {
String tString = "t";
Boolean returnedBooleanType = converter.convert(tString);
Assert.assertTrue(returnedBooleanType);
}
@Test
public void convertTrueStringReturnsBooleanTrue() {
String trueString = "true";
Boolean returnedBooleanType = converter.convert(trueString);
Assert.assertTrue(returnedBooleanType);
}
@Test
public void convertFStringReturnsBooleanFalse() {
String fString = "f";
Boolean returnedBooleanType = converter.convert(fString);
Assert.assertFalse(returnedBooleanType);
}
@Test
public void convertFalseStringReturnsBooleanFalse() {
String falseString = "false";
Boolean returnedBooleanType = converter.convert(falseString);
Assert.assertFalse(returnedBooleanType);
}
}
| [
"[email protected]"
] | |
ce3ff82d772f15dd0f000c5bf197426f701d2cfb | 71954a57f48aa24de46bcc97db2b045266dca664 | /liquibase.eclipse.plugin/src/liquibase/eclipse/plugin/view/wizards/LiqConfPageChooseStructure.java | a8f5f0bb7c7f4ec36975d44dd55ad7a39714987e | [
"Apache-2.0"
] | permissive | achim86/liquibaseplugin | 50c8345b95d8eb877b3a5fbe5019bc45325c6b96 | 6fff6c89cbe8f6efddabf2ae1341dc5dda0a246d | refs/heads/master | 2021-01-13T16:11:29.481144 | 2012-11-20T13:13:03 | 2012-11-20T13:13:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,801 | java | package liquibase.eclipse.plugin.view.wizards;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
* First page of {@link liquibase.eclipse.plugin.view.wizards.LiqConfWizard}.
* Choose if create new database structure or use existing.
*
* @author afinke
*
*/
public class LiqConfPageChooseStructure extends WizardPage {
private LiqConfValues liqConfValues;
private Composite mainComposite;
private Text nameText;
private Group radioButtonGroup;
private Button existingStructure;
private Button newStructure;
public LiqConfPageChooseStructure(LiqConfValues liqConfValues) {
super("Create Liquibase Configuration");
setTitle("Create Liquibase Configuration");
this.liqConfValues = liqConfValues;
}
@Override
public void createControl(Composite parent) {
mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayout(new GridLayout(2, false));
// blank line
Label blankLine = new Label(mainComposite, SWT.NONE);
GridData blankLineData = new GridData(GridData.FILL, GridData.CENTER, true, false);
blankLineData.horizontalSpan = 2;
blankLine.setLayoutData(blankLineData);
// Name
Label label1 = new Label(mainComposite, SWT.NONE);
label1.setText("Name: ");
nameText = new Text(mainComposite, SWT.BORDER | SWT.SINGLE);
nameText.setText("");
nameText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
nameText.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) { }
@Override
public void keyReleased(KeyEvent e) {
validatePage();
}
});
// blank line
blankLine = new Label(mainComposite, SWT.NONE);
blankLine.setLayoutData(blankLineData);
// Choose
radioButtonGroup = new Group(mainComposite, SWT.SHADOW_IN);
radioButtonGroup.setText("Structure: ");
radioButtonGroup.setLayout(new GridLayout(1, false));
GridData radioButtonLayoutData = new GridData(GridData.FILL, GridData.CENTER, true, false);
radioButtonLayoutData.horizontalSpan = 2;
radioButtonGroup.setLayoutData(radioButtonLayoutData);
newStructure = new Button(radioButtonGroup, SWT.RADIO);
newStructure.setText("Create new structure.");
existingStructure = new Button(radioButtonGroup, SWT.RADIO);
existingStructure.setText("Use existing structure.");
SelectionAdapter listener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (isNewStructure()) {
liqConfValues.setNewStructure(true);
validatePage();
}
if (isExistingStructure()){
liqConfValues.setExistingStructure(true);
validatePage();
}
}
};
newStructure.addSelectionListener(listener);
existingStructure.addSelectionListener(listener);
// Required to avoid an error in the system
setControl(mainComposite);
setPageComplete(false);
}
private boolean isNewStructure() {
return newStructure.getSelection();
}
private boolean isExistingStructure() {
return existingStructure.getSelection();
}
private void validatePage() {
disableFinish();
if (!nameText.getText().isEmpty() && (isNewStructure() || isExistingStructure())) {
setPageComplete(true);
if(isNewStructure() && liqConfValues.isNewStructurePageComplete()) {
enableFinish();
}
if(isExistingStructure() && liqConfValues.isExistingStructurePageComplete()) {
enableFinish();
}
} else {
setPageComplete(false);
}
}
private void enableFinish(){
IWizard w = this.getWizard();
IWizardPage [] pages = w.getPages();
for(int i = 0; i < pages.length; i++){
((WizardPage) pages[i]).setPageComplete(true);
}
setPageComplete(true);
}
private void disableFinish(){
IWizard w = this.getWizard();
IWizardPage [] pages = w.getPages();
for(int i = 0; i < pages.length; i++){
((WizardPage) pages[i]).setPageComplete(false);
}
setPageComplete(false);
}
public Text getNameText() {
return nameText;
}
}
| [
"[email protected]"
] | |
737174b299e56545938b19bea649e4c41b8d8004 | b2add4d77a634156c8ff644f22ff628de9446896 | /JdbcDemo/src/main/java/com/stackroute/App.java | 1799331e8163334d2827a565c7cb54afce070ebc | [] | no_license | Somyadeep-Chowdhury/stack_route-uploads1- | 06e97f92b8217ab327ae0e6606d67b602acf3e19 | 3308be53ea5e52e9bebc937ddbfd860a8d4ac96f | refs/heads/master | 2020-05-03T01:13:28.967942 | 2019-03-29T04:23:07 | 2019-03-29T04:23:07 | 178,331,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,421 | java | package com.stackroute;
import java.sql.*;
/**
* Hello world!
*
*/
public class App
{
static Connection con;
public static void main( String[] args )
{
try{
//Resister Driver with driver manager service
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver loaded");//create connection
//here db1 is database name, root is username and root123 is password
con= DriverManager.getConnection(
"jdbc:mysql://localhost:3306/customerdb","root","Root@123");
//create statement object
System.out.println("got connected");
Statement stmt=con.createStatement();
PreparedStatement preparedStatement = con.prepareStatement("select * from customer where name=?");
preparedStatement.setString(1,args[0]);
ResultSet rs=preparedStatement.executeQuery();
//execute query
// ResultSet rs=stmt.executeQuery("select * from customer where name=?");
//process result
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getInt(3));
}catch(Exception e){ System.out.println(e);}
finally {
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
cd262cdc505ecd588494722ea4ea4b4730e84120 | 297b2b4dad220397902bea562655921d2695924a | /src/test/java/WarmUpTask/T2_FindElements_Apple.java | 7b7efcafcbec275e6923a9575b3a43df37fe7bb2 | [] | no_license | RajmiNakarmi/seleniumProjectB20 | 033d379023b85aeb75f6160a7cea48b13ee86d91 | 48231532fe9b5f6aa205d8ba90292d10f5fd0565 | refs/heads/master | 2023-01-11T09:49:50.588040 | 2020-11-15T15:47:00 | 2020-11-15T15:47:00 | 313,065,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package WarmUpTask;
import com.cybertek.utilities.WebDriverFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.List;
public class T2_FindElements_Apple {
public static void main(String[] args) {
//C #02: FINDELEMENTS_APPLE
// 1.Open Chrome browser
WebDriver driver = WebDriverFactory.getDriver("Chrome");
// 2.Go to https://www.apple.com
driver.get("https://www.apple.com");
// 3.Click to iPhone
WebElement iPhone = driver.findElement(By.xpath("//a[@class ='ac-gn-link ac-gn-link-iphone']"));
iPhone.click();
// 4.Print out the texts of all links
List<WebElement> listOfLinks = driver.findElements(By.xpath("//body//a"));
int linksWithoutText =0;
int linksWithText =0;
for(WebElement eachLink: listOfLinks) {
String textOfEachLink = eachLink.getText();
System.out.println(textOfEachLink);
if (textOfEachLink.isEmpty()) {
linksWithoutText++;
} else {
linksWithText++;
}
}
// 5.Print out how many link is missing text
System.out.println("The number of the list that has not text: "+ linksWithoutText);
// 6.Print out how many link has text
System.out.println("The number of the list that has text: "+ linksWithText);
// 7.Print out how many total links
System.out.println("The total links: "+ listOfLinks.size());
}
}
| [
"[email protected]"
] | |
0f659233e76957e7ca67111c81f66dbd87171086 | 1a7616a518a17c4e1b0af0390e6b30ad9121fee9 | /RTP37/cstd/.svn/pristine/e2/e29123d4556de1068ab39320b5f64b208ced16af.svn-base | fe6d607b12052de14552cae5faebbce36af821f7 | [] | no_license | ALLISWELL-REPO/Welcome | 12edfbdb6413d4aad74764d47d11f39f4e0799e8 | 6a4f19f2e9f67009a4b26a7f9bb155608ed2aad2 | refs/heads/master | 2022-12-22T15:57:34.886643 | 2019-09-29T18:51:45 | 2019-09-29T18:51:45 | 211,673,463 | 0 | 0 | null | 2022-12-16T06:57:22 | 2019-09-29T14:14:13 | Java | UTF-8 | Java | false | false | 739 |
package com.citybank.statementdtls_schema.resp;
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.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.codehaus.jackson.annotate.JsonProperty;
public class TransDetailsType {
@JsonProperty
protected List<TrasactionType> Trasaction;
public List<TrasactionType> getTrasaction() {
if (Trasaction == null) {
Trasaction = new ArrayList<TrasactionType>();
}
return this.Trasaction;
}
@Override
public String toString() {
return "TransDetailsType [trasaction=" + Trasaction + "]";
}
}
| [
"[email protected]"
] | ||
0d9346f2634f67492173bd1aa35be3a0d21f7e45 | 39cfdf3d91197ea43c2e2a4c04aea2c576a9b4cc | /Behavioral_Design_Pattern/src/main/java/Divison.java | 4884fe578e552df0ced39d128f092c1629c48dc9 | [] | no_license | AmareshVinnakota/AmareshVinnakota_DesignPatterns | 8e9abfc0f58c26be3e9ace4e7cfefe3eb6334c5a | b9b9b6feecc2d2570ea51a5ab568e7abc9593b87 | refs/heads/master | 2021-03-03T23:52:38.798898 | 2020-03-09T09:47:12 | 2020-03-09T09:47:12 | 245,995,569 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java |
public class Divison implements Calculator{
public void Calculation(int a,int b)
{
try
{
int d=a/b;
System.out.println(d);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
| [
"[email protected]"
] | |
3015b2f532bf3a34db6d696923d98a61bcf715f5 | c93e51182bc5fae3d43791928806864a48fee5f9 | /app/src/main/java/com/example/charmer/moving/relevantexercise/ExeSharedMthd.java | e290ac9769f5cf10ee9d5865c9190747a11db0fb | [
"Apache-2.0"
] | permissive | hellcharmer/REMOVING | 516ffa72accdbb16141cb46ec3d4e93c88a127f2 | c11b1ebd495bd3966c54023ad5bffab5ef1e1df2 | refs/heads/master | 2021-01-12T17:14:23.236409 | 2016-11-08T14:34:18 | 2016-11-08T14:34:18 | 71,522,283 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,631 | java | package com.example.charmer.moving.relevantexercise;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;
import com.example.charmer.moving.R;
import com.example.charmer.moving.contantData.HttpUtils;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;
/**
* Created by Charmer on 2016/10/25.
*/
public class ExeSharedMthd {
private static int reAction = 0;
public int getReAction() {
return reAction;
}
// public static void setReAction(int reAction) {
// ExeSharedMthd.reAction = reAction;
// }
// private static Handler handler = new Handler(){
// @Override
// public void handleMessage(Message msg) {
// super.handleMessage(msg);
// switch (msg.what){
// case 0:
// break;
// case 1:
// break;
// }
// }
// };
public static void tryToEnroll(String exerciseId,String joiner,Context contexts){
final Context context = contexts;
String str = HttpUtils.hoster+"enrollexe";
RequestParams params = new RequestParams(str);
params.addQueryStringParameter("exerciseId",exerciseId);
params.addQueryStringParameter("joiner",joiner);
params.addQueryStringParameter("state","0");
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
System.out.println(result);
if ("0".equals(result)){
Toast.makeText(context,"您已报名!请勿重复报名",Toast.LENGTH_SHORT).show();
}else
if ("1".equals(result)){
Toast.makeText(context,"报名成功!",Toast.LENGTH_SHORT).show();
}else
if("3".equals(result)) {
Toast.makeText(context,"参加本活动的人数已满!",Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(context,"报名失败!",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
public static void agreeJoin(String exerciseId,String joiner,Context contexts){
final Context context = contexts;
String str = HttpUtils.hoster+"enrollexe";
RequestParams params = new RequestParams(str);
params.addQueryStringParameter("exerciseId",exerciseId);
params.addQueryStringParameter("joiner",joiner);
params.addQueryStringParameter("state","1");
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
System.out.println(result);
if ("0".equals(result)){
Toast.makeText(context,"人数已满,操作失败!",Toast.LENGTH_SHORT).show();
}else
if ("1".equals(result)){
Toast.makeText(context,"操作成功!",Toast.LENGTH_SHORT).show();
}else
{
Toast.makeText(context,"操作失败!",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
public static void cancelEnroll(String exerciseId,String joiner,Context contexts){
final Context context = contexts;
String str = HttpUtils.hoster+"cancelany";
RequestParams params = new RequestParams(str);
params.addQueryStringParameter("exerciseId",exerciseId);
params.addQueryStringParameter("joiner",joiner);
params.addQueryStringParameter("choice","1");
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
System.out.println(result);
if ("true".equals(result)){
Toast.makeText(context,"报名取消成功!",Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(context,"取消失败!",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
public static void cancelJoin(String exerciseId,String joiner,Context contexts){
final Context context = contexts;
String str = HttpUtils.hoster+"cancelany";
RequestParams params = new RequestParams(str);
params.addQueryStringParameter("exerciseId",exerciseId);
params.addQueryStringParameter("joiner",joiner);
params.addQueryStringParameter("choice","2");
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
System.out.println(result);
if ("true".equals(result)){
//Toast.makeText(context,"取消参加成功!",Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(context,"取消失败!",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
public static void cancelExe(String exerciseId,String publisher,Context contexts){
final Context context = contexts;
String str = HttpUtils.hoster+"cancelany";
RequestParams params = new RequestParams(str);
params.addQueryStringParameter("publisher",publisher);
params.addQueryStringParameter("exerciseId",exerciseId);
params.addQueryStringParameter("choice","3");
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
System.out.println(result);
if ("true".equals(result)){
Toast.makeText(context,"取消活动成功!",Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(context,"取消失败!",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
public static void cancelRequest(String exerciseId,String joiner,Context contexts){
final Context context = contexts;
String str = HttpUtils.hoster+"cancelany";
RequestParams params = new RequestParams(str);
params.addQueryStringParameter("exerciseId",exerciseId);
params.addQueryStringParameter("joiner",joiner);
params.addQueryStringParameter("choice","4");
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
System.out.println(result);
if ("true".equals(result)){
//Toast.makeText(context,"取消参加成功!",Toast.LENGTH_SHORT).show();
}else {
//Toast.makeText(context,"取消失败!",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
}
| [
"[email protected]"
] | |
a7c7d76a43019f535368e65cc3dc347719e33cc6 | 398d9e0ccd7234f5ddfe9453af071b32ab19795a | /src/main/java/com/zhangchangq/project/service/model/PromoModel.java | 15ebc9e6ac6f5f772189237add4f0dc3da0e9fa8 | [] | no_license | zhangchangqing2016/mygit | e69f6f26b30e91bf07c5ee877a17b17f33b4f98b | b7c665c0a086b1211088ed9175344f1f3be00a2c | refs/heads/master | 2020-04-27T23:25:38.081101 | 2019-04-07T12:55:57 | 2019-04-07T12:55:57 | 174,775,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,074 | java | package com.zhangchangq.project.service.model;
import org.joda.time.DateTime;
import java.math.BigDecimal;
public class PromoModel {
private Integer id;
//秒杀活动状态,为1表示还未开始,2表示进行中,3表示已结束
private Integer status;
//秒杀活动名称
private String promoName;
//秒杀活动的开始时间
private DateTime startDate;
//秒杀活动结束时间
private DateTime endDate;
//秒杀活动适用商品
private Integer itemId;
//秒杀活动的商品价格
private BigDecimal promoItemPrice;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPromoName() {
return promoName;
}
public void setPromoName(String promoName) {
this.promoName = promoName;
}
public DateTime getStartDate() {
return startDate;
}
public void setStartDate(DateTime startDate) {
this.startDate = startDate;
}
public Integer getItemId() {
return itemId;
}
public void setItemId(Integer itemId) {
this.itemId = itemId;
}
public BigDecimal getPromoItemPrice() {
return promoItemPrice;
}
public void setPromoItemPrice(BigDecimal promoItemPrice) {
this.promoItemPrice = promoItemPrice;
}
public DateTime getEndDate() {
return endDate;
}
public void setEndDate(DateTime endDate) {
this.endDate = endDate;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return "PromoModel{" +
"id=" + id +
", status=" + status +
", promoName='" + promoName + '\'' +
", startDate=" + startDate +
", endDate=" + endDate +
", itemId=" + itemId +
", promoItemPrice=" + promoItemPrice +
'}';
}
}
| [
"[email protected]"
] | |
f1091eb350b4924fe801866775d885063d0a3af1 | c5b1d0951b18cbde9f2abc7ff00451e5ecc8ae13 | /src/com/starbaby/diyBook/net/SyncHttpGet.java | 3b37a79949fd704e1709b296e3abf7f456a2ff94 | [] | no_license | sangmingming/MyMusic | c1f787c612b70b41810d7c86b9d299d06e742b06 | 1eb15042c50fe2803eaf8a71320ea44736f64680 | refs/heads/master | 2021-01-20T17:50:11.392996 | 2014-04-04T04:43:50 | 2014-04-04T04:43:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | package com.starbaby.diyBook.net;
public class SyncHttpGet extends BaseRequest{
private static final long serialVersionUID = -7690078845843324399L;
}
| [
"[email protected]"
] | |
324e1350e8d18a58f1cf313115df2854755b088a | 7c33faa1c5a9bdfdf47d5c3561326f466f41ba16 | /sever/src/main/java/cn/edu/sjtu/bpmproject/server/enums/InteractionType.java | 004d2f34f2486bb1f8ec70f8895ac8759a7aaa57 | [] | no_license | DHPO/BPM-Project | b05dd3c75fb691fdddaa342daf1d4a6ea1d9c48d | 40b0fecdbf63a0ba9b39e36fe6c542c6ed791100 | refs/heads/master | 2022-03-25T20:33:16.118603 | 2019-12-30T04:40:19 | 2019-12-30T04:40:19 | 224,850,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 283 | java | package cn.edu.sjtu.bpmproject.server.enums;
public enum InteractionType {
COMMENT("弹幕"), VOTE("投票"), GAME("答题闯关"),SCORE("评分"),DRAW("抽奖"),VIDEO("直播");
private String type;
private InteractionType(String type){
this.type=type;
}
}
| [
"[email protected]"
] | |
0d2db7e98d0093ceb71dd2593df87792431ef707 | 823e51b3e2be827ecacc99eed68265b67ad87991 | /mytaxi_server_applicant_test/src/test/java/com/mytaxi/integration/DriverRepositoryTest.java | 6d166d1d2ea6ed6ef4096fa980d3a506ccbf120d | [] | no_license | denizgrad/driversCars | c22dec79927f301b45b96d80a2a979db8f40880e | db90065f2e5f6c862b25839521031229d0ff5769 | refs/heads/master | 2021-08-31T20:42:10.783366 | 2017-12-22T22:35:59 | 2017-12-22T22:35:59 | 115,148,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,834 | java | package com.mytaxi.integration;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.google.common.collect.Lists;
import com.mytaxi.MytaxiServerApplicantTestApplication;
import com.mytaxi.dataaccessobject.CarRepository;
import com.mytaxi.dataaccessobject.DriverRepository;
import com.mytaxi.domainobject.CarDO;
import com.mytaxi.domainobject.DriverDO;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = MytaxiServerApplicantTestApplication.class)
public class DriverRepositoryTest {
@Autowired
private DriverRepository driverRepository;
@Autowired
private CarRepository carRepository;
@Test
public void testDriverById() {
DriverDO driver = driverRepository.findOne(1L);
Assert.assertNotNull(driver);
}
@Test
public void testAllDrivers() {
List<DriverDO> cars = Lists.newArrayList(driverRepository.findAll());
Assert.assertThat(cars, hasSize(8));
}
@Test
public void testDriverCarFetch() {
CarDO car = carRepository.findOne(9L);
DriverDO driver = driverRepository.findOne(1L);
car.setSelectedDriver(driver);
driver.setSelectedCar(car);
carRepository.save(car);
driverRepository.save(driver);
CarDO car2 = carRepository.findOne(9L);
DriverDO driver2 = driverRepository.findOne(1L);
Assert.assertThat(car2.getSelectedDriver().getUsername(), is(driver.getUsername()));
Assert.assertThat(driver2.getSelectedCar().getLicensePlate(), is(car.getLicensePlate()));
}
}
| [
"[email protected]"
] | |
930fa364030a8ae0d189aef098f0490d696319f6 | 1a34df26167446c04c77cc72ed0caf1ac080ac33 | /src/sample/ModelTable.java | cc96a1b65a26e01533ded81dabb803c9f0a1680c | [] | no_license | djamel2288/Check_In | ce40af6a37fdbcccfacf76da871ee03c2b63d351 | e1a95fc3a8d816f023f549fa2b69d50984dcb623 | refs/heads/master | 2020-08-29T04:24:35.361292 | 2020-08-15T15:02:13 | 2020-08-15T15:02:13 | 217,925,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,123 | java | package sample;
public class ModelTable {
int id_p;
String f_name_p;
String l_name_p;
String email_p;
int nbr_p_p;
public ModelTable(int id_p, String f_name_p, String l_name_p, String email_p, int nbr_p_p) {
this.id_p = id_p;
this.f_name_p = f_name_p;
this.l_name_p = l_name_p;
this.email_p = email_p;
this.nbr_p_p = nbr_p_p;
}
public int getId_p() {
return id_p;
}
public void setId_p(int id_p) {
this.id_p = id_p;
}
public String getF_name_p() {
return f_name_p;
}
public void setF_name_p(String f_name_p) {
this.f_name_p = f_name_p;
}
public String getL_name_p() {
return l_name_p;
}
public void setL_name_p(String l_name_p) {
this.l_name_p = l_name_p;
}
public String getEmail_p() {
return email_p;
}
public void setEmail_p(String email_p) {
this.email_p = email_p;
}
public int getNbr_p_p() {
return nbr_p_p;
}
public void setNbr_p_p(int nbr_p_p) {
this.nbr_p_p = nbr_p_p;
}
}
| [
"[email protected]"
] | |
64c92d4b08e2681d28207909d0d81a6e16d50b0c | eec166d19f5cb50e8b2c9a12454c387f7caf1a10 | /Bio/js-cloud-computing/src/org/jscc/app/client/biojava3/core/sequence/CDSComparator.java | b8787c4e0da03a3e6a09fb29bd10d8587f013ce8 | [] | no_license | panyao/jsMapReduce | dda2a2054866136b204c7ac3b01813b1dc928d38 | 22ba3358bbec81918b6b233de59d65e58e564456 | refs/heads/master | 2016-09-02T08:32:05.160657 | 2014-06-04T23:13:15 | 2014-06-04T23:13:15 | 15,548,611 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.jscc.app.client.biojava3.core.sequence;
import java.util.Comparator;
/**
*
* @author Scooter Willis <willishf at gmail dot com>
*/
public class CDSComparator implements Comparator<CDSSequence>{
@Override
public int compare(CDSSequence o1, CDSSequence o2) {
if(o1.getStrand() != o2.getStrand()){
return o1.getBioBegin() - o2.getBioBegin();
}
if(o1.getStrand() == Strand.NEGATIVE){
return -1 * (o1.getBioBegin() - o2.getBioBegin());
}
return o1.getBioBegin() - o2.getBioBegin();
}
}
| [
"[email protected]"
] | |
06e09fb97c956d058cd2630162ee190832d6281d | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/7/7_293ede0b67685f74bc88d874dfc532ded3ea7f71/Homing/7_293ede0b67685f74bc88d874dfc532ded3ea7f71_Homing_s.java | c93b395b71188e9a177fa54657b97bf370d958b5 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,086 | java | /*
* This file is part of the Haven & Hearth game client.
* Copyright (C) 2009 Fredrik Tolf <[email protected]>, and
* Björn Johannessen <[email protected]>
*
* Redistribution and/or modification of this file is subject to the
* terms of the GNU Lesser General Public License, version 3, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Other parts of this source tree adhere to other copying
* rights. Please see the file `COPYING' in the root directory of the
* source tree for details.
*
* A copy the GNU Lesser General Public License is distributed along
* with the source tree of which this file is a part in the file
* `doc/LPGL-3'. If it is missing for any reason, please see the Free
* Software Foundation's website at <http://www.fsf.org/>, or write
* to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package haven;
public class Homing extends Moving {
long tgt;
Coord tc;
int v;
double dist;
public Homing(Gob gob, long tgt, Coord tc, int v) {
super(gob);
this.tgt = tgt;
this.tc = tc;
this.v = v;
}
public Coord3f getc() {
Coord tc = this.tc;
Gob tgt = gob.glob.oc.getgob(this.tgt);
if(tgt != null)
tc = tgt.rc;
Coord d = tc.add(gob.rc.inv());
double e = gob.rc.dist(tc);
float rx = (float)((d.x / e) * dist) + gob.rc.x;
float ry = (float)((d.y / e) * dist) + gob.rc.y;
return(new Coord3f(rx, ry, gob.glob.map.getcz(rx, ry)));
}
public double getv() {
return((v / 100.0) / 0.06);
}
public void move(Coord c) {
dist = 0;
}
public void ctick(int dt) {
double da = ((double)dt / 1000) / 0.06;
dist += (da * 0.9) * ((double)v / 100);
}
}
| [
"[email protected]"
] | |
15235e607e46fb7c96d7c2a78b85df38acadf5db | 3472b989ffb4ad24107e5f21390f398fbd6da3fc | /nfctools-core/src/test/java/org/nfctools/mf/classic/ClassicHandlerTest.java | 93f746c2a9436b42f568b7641e9d5e07d89014cd | [
"Apache-2.0"
] | permissive | noxo/nfctools | 3ece95b38d9d71ed44cc456a091f72e0b0f499fe | 12e547a710f19c9fdc1647f378a9f352d748f0ab | refs/heads/master | 2020-12-25T13:33:31.753484 | 2012-11-04T08:41:09 | 2012-11-04T08:41:09 | 7,385,737 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,067 | java | /**
* Copyright 2011-2012 Adrian Stabiszewski, [email protected]
*
* 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.nfctools.mf.classic;
import static org.junit.Assert.*;
import org.junit.Test;
import org.nfctools.mf.MfConstants;
import org.nfctools.mf.mad.ApplicationDirectory;
import org.nfctools.test.ReaderWriterCreator;
public class ClassicHandlerTest {
@Test
public void testIsBlank() throws Exception {
assertTrue(ClassicHandler.isBlank(ReaderWriterCreator.createReadWriter("mfstd1k_blank.txt",
MemoryLayout.CLASSIC_1K)));
assertTrue(ClassicHandler.isBlank(ReaderWriterCreator.createReadWriter("mfstd4k_blank.txt",
MemoryLayout.CLASSIC_4K)));
assertFalse(ClassicHandler.isBlank(ReaderWriterCreator.createReadWriter("mfstd1k_ndef.txt",
MemoryLayout.CLASSIC_1K)));
assertFalse(ClassicHandler.isBlank(ReaderWriterCreator.createReadWriter("mfstd4k_ndef.txt",
MemoryLayout.CLASSIC_4K)));
}
@Test
public void testIsFormattedWritable() throws Exception {
ApplicationDirectory applicationDirectory = ReaderWriterCreator.createReadWriter("mfstd1k_ndef.txt",
MemoryLayout.CLASSIC_1K).getApplicationDirectory();
assertTrue(ClassicHandler.isFormattedWritable(applicationDirectory.openApplication(MfConstants.NDEF_APP_ID)));
ApplicationDirectory applicationDirectory2 = ReaderWriterCreator.createReadWriter("mfstd4k_ndef.txt",
MemoryLayout.CLASSIC_4K).getApplicationDirectory();
assertTrue(ClassicHandler.isFormattedWritable(applicationDirectory2.openApplication(MfConstants.NDEF_APP_ID)));
}
}
| [
"[email protected]"
] | |
1b5fced06e6a33b712889a01604cfbedc97f2ee5 | c9424256999ef9a74de23b7598121c361341ba02 | /app/src/main/java/com/obpoo/gfsfabricsoftware/utilities/LocalStorageProvider.java | 6e311e2fe7cffc8dce7f030808c3cd5ba9830c8c | [] | no_license | anilobpoo/GFSADMIN_AWS | d25fdf462811d4b2e4c80eda44b956dbf809b60a | b6708995c0082848602076f9dd2187deb16af27f | refs/heads/master | 2020-06-09T12:51:32.203195 | 2019-07-24T12:47:25 | 2019-07-24T12:47:25 | 193,440,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,230 | java | package com.obpoo.gfsfabricsoftware.utilities;
import android.annotation.SuppressLint;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.os.CancellationSignal;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.provider.DocumentsContract.Document;
import android.provider.DocumentsContract.Root;
import android.provider.DocumentsProvider;
import android.util.Log;
import android.webkit.MimeTypeMap;
import com.obpoo.gfsfabricsoftware.R;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
@SuppressLint("NewApi")
public class LocalStorageProvider extends DocumentsProvider {
public static final String AUTHORITY = "org.snowcorp.sample.uploadsfiles.documents";
/**
* Default root projection: everything but Root.COLUMN_MIME_TYPES
*/
private final static String[] DEFAULT_ROOT_PROJECTION = new String[] {
Root.COLUMN_ROOT_ID,
Root.COLUMN_FLAGS, Root.COLUMN_TITLE, Root.COLUMN_DOCUMENT_ID, Root.COLUMN_ICON,
Root.COLUMN_AVAILABLE_BYTES
};
/**
* Default document projection: everything but Document.COLUMN_ICON and
* Document.COLUMN_SUMMARY
*/
private final static String[] DEFAULT_DOCUMENT_PROJECTION = new String[] {
Document.COLUMN_DOCUMENT_ID,
Document.COLUMN_DISPLAY_NAME, Document.COLUMN_FLAGS, Document.COLUMN_MIME_TYPE,
Document.COLUMN_SIZE,
Document.COLUMN_LAST_MODIFIED
};
@Override
public Cursor queryRoots(final String[] projection) throws FileNotFoundException {
// Create a cursor with either the requested fields, or the default
// projection if "projection" is null.
final MatrixCursor result = new MatrixCursor(projection != null ? projection
: DEFAULT_ROOT_PROJECTION);
// Add Home directory
File homeDir = Environment.getExternalStorageDirectory();
final MatrixCursor.RowBuilder row = result.newRow();
// These columns are required
row.add(Root.COLUMN_ROOT_ID, homeDir.getAbsolutePath());
row.add(Root.COLUMN_DOCUMENT_ID, homeDir.getAbsolutePath());
row.add(Root.COLUMN_TITLE, getContext().getString(R.string.internal_storage));
row.add(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_CREATE);
row.add(Root.COLUMN_ICON, R.drawable.ic_add_white_18dp);
// These columns are optional
row.add(Root.COLUMN_AVAILABLE_BYTES, homeDir.getFreeSpace());
// Root.COLUMN_MIME_TYPE is another optional column and useful if you
// have multiple roots with different
// types of mime types (roots that don't match the requested mime type
// are automatically hidden)
return result;
}
@Override
public String createDocument(final String parentDocumentId, final String mimeType,
final String displayName) throws FileNotFoundException {
File newFile = new File(parentDocumentId, displayName);
try {
newFile.createNewFile();
return newFile.getAbsolutePath();
} catch (IOException e) {
Log.e(LocalStorageProvider.class.getSimpleName(), "Error creating new file " + newFile);
}
return null;
}
@Override
public AssetFileDescriptor openDocumentThumbnail(final String documentId, final Point sizeHint,
final CancellationSignal signal) throws FileNotFoundException {
// Assume documentId points to an image file. Build a thumbnail no
// larger than twice the sizeHint
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(documentId, options);
final int targetHeight = 2 * sizeHint.y;
final int targetWidth = 2 * sizeHint.x;
final int height = options.outHeight;
final int width = options.outWidth;
options.inSampleSize = 1;
if (height > targetHeight || width > targetWidth) {
final int halfHeight = height / 2;
final int halfWidth = width / 2;
// Calculate the largest inSampleSize value that is a power of 2 and
// keeps both
// height and width larger than the requested height and width.
while ((halfHeight / options.inSampleSize) > targetHeight
|| (halfWidth / options.inSampleSize) > targetWidth) {
options.inSampleSize *= 2;
}
}
options.inJustDecodeBounds = false;
Bitmap bitmap = BitmapFactory.decodeFile(documentId, options);
// Write out the thumbnail to a temporary file
File tempFile = null;
FileOutputStream out = null;
try {
tempFile = File.createTempFile("thumbnail", null, getContext().getCacheDir());
out = new FileOutputStream(tempFile);
bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
} catch (IOException e) {
Log.e(LocalStorageProvider.class.getSimpleName(), "Error writing thumbnail", e);
return null;
} finally {
if (out != null)
try {
out.close();
} catch (IOException e) {
Log.e(LocalStorageProvider.class.getSimpleName(), "Error closing thumbnail", e);
}
}
// It appears the Storage Framework UI caches these results quite
// aggressively so there is little reason to
// write your own caching layer beyond what you need to return a single
// AssetFileDescriptor
return new AssetFileDescriptor(ParcelFileDescriptor.open(tempFile,
ParcelFileDescriptor.MODE_READ_ONLY), 0,
AssetFileDescriptor.UNKNOWN_LENGTH);
}
@Override
public Cursor queryChildDocuments(final String parentDocumentId, final String[] projection,
final String sortOrder) throws FileNotFoundException {
// Create a cursor with either the requested fields, or the default
// projection if "projection" is null.
final MatrixCursor result = new MatrixCursor(projection != null ? projection
: DEFAULT_DOCUMENT_PROJECTION);
final File parent = new File(parentDocumentId);
for (File file : parent.listFiles()) {
// Don't show hidden files/folders
if (!file.getName().startsWith(".")) {
// Adds the file's display name, MIME type, size, and so on.
includeFile(result, file);
}
}
return result;
}
@Override
public Cursor queryDocument(final String documentId, final String[] projection)
throws FileNotFoundException {
// Create a cursor with either the requested fields, or the default
// projection if "projection" is null.
final MatrixCursor result = new MatrixCursor(projection != null ? projection
: DEFAULT_DOCUMENT_PROJECTION);
includeFile(result, new File(documentId));
return result;
}
private void includeFile(final MatrixCursor result, final File file)
throws FileNotFoundException {
final MatrixCursor.RowBuilder row = result.newRow();
// These columns are required
row.add(Document.COLUMN_DOCUMENT_ID, file.getAbsolutePath());
row.add(Document.COLUMN_DISPLAY_NAME, file.getName());
String mimeType = getDocumentType(file.getAbsolutePath());
row.add(Document.COLUMN_MIME_TYPE, mimeType);
int flags = file.canWrite() ? Document.FLAG_SUPPORTS_DELETE | Document.FLAG_SUPPORTS_WRITE
: 0;
// We only show thumbnails for image files - expect a call to
// openDocumentThumbnail for each file that has
// this flag set
if (mimeType.startsWith("image/"))
flags |= Document.FLAG_SUPPORTS_THUMBNAIL;
row.add(Document.COLUMN_FLAGS, flags);
// COLUMN_SIZE is required, but can be null
row.add(Document.COLUMN_SIZE, file.length());
// These columns are optional
row.add(Document.COLUMN_LAST_MODIFIED, file.lastModified());
// Document.COLUMN_ICON can be a resource id identifying a custom icon.
// The system provides default icons
// based on mime type
// Document.COLUMN_SUMMARY is optional additional information about the
// file
}
@Override
public String getDocumentType(final String documentId) throws FileNotFoundException {
File file = new File(documentId);
if (file.isDirectory())
return Document.MIME_TYPE_DIR;
// From FileProvider.getType(Uri)
final int lastDot = file.getName().lastIndexOf('.');
if (lastDot >= 0) {
final String extension = file.getName().substring(lastDot + 1);
final String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
if (mime != null) {
return mime;
}
}
return "application/octet-stream";
}
@Override
public void deleteDocument(final String documentId) throws FileNotFoundException {
new File(documentId).delete();
}
@Override
public ParcelFileDescriptor openDocument(final String documentId, final String mode,
final CancellationSignal signal) throws FileNotFoundException {
File file = new File(documentId);
final boolean isWrite = (mode.indexOf('w') != -1);
if (isWrite) {
return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE);
} else {
return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
}
}
@Override
public boolean onCreate() {
return true;
}
} | [
"[email protected]"
] | |
8c7ca051e4c728456ffc90c81aadef463716ace9 | 833918741f23ceb1b567b883788ff1169577b977 | /core/src/com/mygdx/game/entity/weapon/AttackType.java | 093d0040bb10a49ac48d0c87c869535f1e32d95c | [] | no_license | wholton/sas | 6e427bd602f3f109bc9ec3bac09e7be67b88b18b | 21b515a2f225c49032536522c3cce29887c461a7 | refs/heads/master | 2016-09-13T01:08:27.592582 | 2016-06-02T16:12:38 | 2016-06-02T16:12:38 | 59,377,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package com.mygdx.game.entity.weapon;
public final class AttackType {
public final static String SWING = "Swing";
public final static String THRUST = "Thrust";
public final static String SWING_OR_THRUST = "Swing or Thrust";
private AttackType() {
}
}
| [
"[email protected]"
] | |
f02af6e3ec9dcdd51a19433ad6317e57ea48b4ee | f70f1046cc895ee9f9b89f038045161c3a8b9a99 | /src/main/java/com/atos/lawws/webservice/xml/fechasreordersprov/FechasReordersProvResponse.java | 4e003a5602c3356eb2f47b15165da672bc13be3f | [] | no_license | egonzalezcalderon/LawWS | d6362ff692c7f63938da43f2c2ae2ff867fdc973 | 82d401f5b1f8f07152dfcca0ad66985fd2596b56 | refs/heads/master | 2020-03-11T22:03:01.046374 | 2018-04-19T23:15:25 | 2018-04-19T23:15:25 | 130,281,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,633 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
// 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: 2018.04.19 at 08:11:28 PM GFT
//
package com.atos.lawws.webservice.xml.fechasreordersprov;
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.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="fechasReordersProv" type="{http://www.w3.org/2001/XMLSchema}date" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"fechasReordersProv"
})
@XmlRootElement(name = "fechasReordersProvResponse")
public class FechasReordersProvResponse {
@XmlElement(required = true)
@XmlSchemaType(name = "date")
protected List<XMLGregorianCalendar> fechasReordersProv;
/**
* Gets the value of the fechasReordersProv 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 fechasReordersProv property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getFechasReordersProv().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link XMLGregorianCalendar }
*
*
*/
public List<XMLGregorianCalendar> getFechasReordersProv() {
if (fechasReordersProv == null) {
fechasReordersProv = new ArrayList<XMLGregorianCalendar>();
}
return this.fechasReordersProv;
}
}
| [
"[email protected]"
] | |
6931bdf67c385edcd675a2decdac248d2ed46307 | ab6ff99ecef22dcf28ef1fed15b71a37c2eb2694 | /Sunshine-student/ud851-Exercises-student/Lesson10-Hydration-Reminder/T10.05-Exercise-ChargingBroadcastReceiver/app/src/main/java/com/example/android/background/MainActivity.java | d3e9b30c666462d1386e94ee7bc3cde3abfe59e9 | [
"Apache-2.0"
] | permissive | Muhammadwahab/Android-Development | 4ceacdf6b865fe1ed64e8985f180b50141a8aced | 7ff18f5d2940b262a6e3b51c425e21b970907392 | refs/heads/master | 2020-05-21T20:27:34.324098 | 2017-07-17T20:42:15 | 2017-07-17T20:42:15 | 62,420,130 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,781 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.background;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.android.background.sync.ReminderTasks;
import com.example.android.background.sync.ReminderUtilities;
import com.example.android.background.sync.WaterReminderIntentService;
import com.example.android.background.utilities.PreferenceUtilities;
public class MainActivity extends AppCompatActivity implements
SharedPreferences.OnSharedPreferenceChangeListener {
private TextView mWaterCountDisplay;
private TextView mChargingCountDisplay;
private ImageView mChargingImageView;
private Toast mToast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/** Get the views **/
mWaterCountDisplay = (TextView) findViewById(R.id.tv_water_count);
mChargingCountDisplay = (TextView) findViewById(R.id.tv_charging_reminder_count);
mChargingImageView = (ImageView) findViewById(R.id.iv_power_increment);
/** Set the original values in the UI **/
updateWaterCount();
updateChargingReminderCount();
ReminderUtilities.scheduleChargingReminder(this);
/** Setup the shared preference listener **/
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(this);
// TODO (5) Create and instantiate a new instance variable for your ChargingBroadcastReceiver
// and an IntentFilter
// TODO (6) Call the addAction method on your intent filter and add Intent.ACTION_POWER_CONNECTED
// and Intent.ACTION_POWER_DISCONNECTED. This sets up an intent filter which will trigger
// when the charging state changes.
}
// TODO (7) Override onResume and setup your broadcast receiver. Do this by calling
// registerReceiver with the ChargingBroadcastReceiver and IntentFilter.
// TODO (8) Override onPause and unregister your receiver using the unregisterReceiver method
/**
* Updates the TextView to display the new water count from SharedPreferences
*/
private void updateWaterCount() {
int waterCount = PreferenceUtilities.getWaterCount(this);
mWaterCountDisplay.setText(waterCount+"");
}
/**
* Updates the TextView to display the new charging reminder count from SharedPreferences
*/
private void updateChargingReminderCount() {
int chargingReminders = PreferenceUtilities.getChargingReminderCount(this);
String formattedChargingReminders = getResources().getQuantityString(
R.plurals.charge_notification_count, chargingReminders, chargingReminders);
mChargingCountDisplay.setText(formattedChargingReminders);
}
// TODO (1) Create a new method called showCharging which takes a boolean. This method should
// either change the image of mChargingImageView to ic_power_pink_80px if the boolean is true
// or R.drawable.ic_power_grey_80px it it's not. This method will eventually update the UI
// when our broadcast receiver is triggered when the charging state changes.
/**
* Adds one to the water count and shows a toast
*/
public void incrementWater(View view) {
if (mToast != null) mToast.cancel();
mToast = Toast.makeText(this, R.string.water_chug_toast, Toast.LENGTH_SHORT);
mToast.show();
Intent incrementWaterCountIntent = new Intent(this, WaterReminderIntentService.class);
incrementWaterCountIntent.setAction(ReminderTasks.ACTION_INCREMENT_WATER_COUNT);
startService(incrementWaterCountIntent);
}
@Override
protected void onDestroy() {
super.onDestroy();
/** Cleanup the shared preference listener **/
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.unregisterOnSharedPreferenceChangeListener(this);
}
/**
* This is a listener that will update the UI when the water count or charging reminder counts
* change
*/
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (PreferenceUtilities.KEY_WATER_COUNT.equals(key)) {
updateWaterCount();
} else if (PreferenceUtilities.KEY_CHARGING_REMINDER_COUNT.equals(key)) {
updateChargingReminderCount();
}
}
// TODO (2) Create an inner class called ChargingBroadcastReceiver that extends BroadcastReceiver
// TODO (3) Override onReceive to get the action from the intent and see if it matches the
// Intent.ACTION_POWER_CONNECTED. If it matches, it's charging. If it doesn't match, it's not
// charging.
// TODO (4) Update the UI using the showCharging method you wrote
} | [
"[email protected]"
] | |
980dae38fe05b578e6c26ff299fbe448ca18022c | 4ce89420be71b774b1058ff066c6960a595211a3 | /asm/src/main/java/org/objectweb/asm/util/TraceSignatureVisitor.java | 047c6ef1029a3a4602f40936ec2e2d07cdf2cb04 | [
"Apache-2.0"
] | permissive | bahaihe/javaflow | fcb0eb6022bd31dcad2e35ce1de5c71af0b7c2e5 | 85c622164bc653bc457a00b6a576367a7667bdc3 | refs/heads/master | 2021-01-20T04:57:29.575487 | 2015-11-13T14:27:08 | 2015-11-13T14:27:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,833 | java | /***
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2011 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.objectweb.asm.util;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.signature.SignatureVisitor;
/**
* A {@link SignatureVisitor} that prints a disassembled view of the signature
* it visits.
*
* @author Eugene Kuleshov
* @author Eric Bruneton
*/
public final class TraceSignatureVisitor extends SignatureVisitor {
private final StringBuffer declaration;
private boolean isInterface;
private boolean seenFormalParameter;
private boolean seenInterfaceBound;
private boolean seenParameter;
private boolean seenInterface;
private StringBuffer returnType;
private StringBuffer exceptions;
/**
* Stack used to keep track of class types that have arguments. Each element
* of this stack is a boolean encoded in one bit. The top of the stack is
* the lowest order bit. Pushing false = *2, pushing true = *2+1, popping =
* /2.
*/
private int argumentStack;
/**
* Stack used to keep track of array class types. Each element of this stack
* is a boolean encoded in one bit. The top of the stack is the lowest order
* bit. Pushing false = *2, pushing true = *2+1, popping = /2.
*/
private int arrayStack;
private String separator = "";
public TraceSignatureVisitor(final int access) {
super(Opcodes.ASM5);
isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
this.declaration = new StringBuffer();
}
private TraceSignatureVisitor(final StringBuffer buf) {
super(Opcodes.ASM5);
this.declaration = buf;
}
@Override
public void visitFormalTypeParameter(final String name) {
declaration.append(seenFormalParameter ? ", " : "<").append(name);
seenFormalParameter = true;
seenInterfaceBound = false;
}
@Override
public SignatureVisitor visitClassBound() {
separator = " extends ";
startType();
return this;
}
@Override
public SignatureVisitor visitInterfaceBound() {
separator = seenInterfaceBound ? ", " : " extends ";
seenInterfaceBound = true;
startType();
return this;
}
@Override
public SignatureVisitor visitSuperclass() {
endFormals();
separator = " extends ";
startType();
return this;
}
@Override
public SignatureVisitor visitInterface() {
separator = seenInterface ? ", " : isInterface ? " extends "
: " implements ";
seenInterface = true;
startType();
return this;
}
@Override
public SignatureVisitor visitParameterType() {
endFormals();
if (seenParameter) {
declaration.append(", ");
} else {
seenParameter = true;
declaration.append('(');
}
startType();
return this;
}
@Override
public SignatureVisitor visitReturnType() {
endFormals();
if (seenParameter) {
seenParameter = false;
} else {
declaration.append('(');
}
declaration.append(')');
returnType = new StringBuffer();
return new TraceSignatureVisitor(returnType);
}
@Override
public SignatureVisitor visitExceptionType() {
if (exceptions == null) {
exceptions = new StringBuffer();
} else {
exceptions.append(", ");
}
// startType();
return new TraceSignatureVisitor(exceptions);
}
@Override
public void visitBaseType(final char descriptor) {
switch (descriptor) {
case 'V':
declaration.append("void");
break;
case 'B':
declaration.append("byte");
break;
case 'J':
declaration.append("long");
break;
case 'Z':
declaration.append("boolean");
break;
case 'I':
declaration.append("int");
break;
case 'S':
declaration.append("short");
break;
case 'C':
declaration.append("char");
break;
case 'F':
declaration.append("float");
break;
// case 'D':
default:
declaration.append("double");
break;
}
endType();
}
@Override
public void visitTypeVariable(final String name) {
declaration.append(name);
endType();
}
@Override
public SignatureVisitor visitArrayType() {
startType();
arrayStack |= 1;
return this;
}
@Override
public void visitClassType(final String name) {
if ("java/lang/Object".equals(name)) {
// Map<java.lang.Object,java.util.List>
// or
// abstract public V get(Object key); (seen in Dictionary.class)
// should have Object
// but java.lang.String extends java.lang.Object is unnecessary
boolean needObjectClass = argumentStack % 2 != 0 || seenParameter;
if (needObjectClass) {
declaration.append(separator).append(name.replace('/', '.'));
}
} else {
declaration.append(separator).append(name.replace('/', '.'));
}
separator = "";
argumentStack *= 2;
}
@Override
public void visitInnerClassType(final String name) {
if (argumentStack % 2 != 0) {
declaration.append('>');
}
argumentStack /= 2;
declaration.append('.');
declaration.append(separator).append(name.replace('/', '.'));
separator = "";
argumentStack *= 2;
}
@Override
public void visitTypeArgument() {
if (argumentStack % 2 == 0) {
++argumentStack;
declaration.append('<');
} else {
declaration.append(", ");
}
declaration.append('?');
}
@Override
public SignatureVisitor visitTypeArgument(final char tag) {
if (argumentStack % 2 == 0) {
++argumentStack;
declaration.append('<');
} else {
declaration.append(", ");
}
if (tag == EXTENDS) {
declaration.append("? extends ");
} else if (tag == SUPER) {
declaration.append("? super ");
}
startType();
return this;
}
@Override
public void visitEnd() {
if (argumentStack % 2 != 0) {
declaration.append('>');
}
argumentStack /= 2;
endType();
}
public String getDeclaration() {
return declaration.toString();
}
public String getReturnType() {
return returnType == null ? null : returnType.toString();
}
public String getExceptions() {
return exceptions == null ? null : exceptions.toString();
}
// -----------------------------------------------
private void endFormals() {
if (seenFormalParameter) {
declaration.append('>');
seenFormalParameter = false;
}
}
private void startType() {
arrayStack *= 2;
}
private void endType() {
if (arrayStack % 2 == 0) {
arrayStack /= 2;
} else {
while (arrayStack % 2 != 0) {
arrayStack /= 2;
declaration.append("[]");
}
}
}
}
| [
"[email protected]"
] | |
b88fcbcdc4d358cc71af36787d97c95a0847f65c | d55b368f825e11da656be792b93f6b9af06b0dca | /src/main/java/com/cn/controller/GlobalExceptionHandler.java | a0597803b493e3317cabfb89ce3bc3cf9bf40e38 | [] | no_license | Mysteryzzz/Recruitment-website | e93d03fdf5a5b70e4c0e6364fc629fb9346f11c8 | 5ede1271fd216d22136e06fb2d2f2d6a317925a7 | refs/heads/master | 2020-05-15T15:09:00.134699 | 2019-05-21T08:05:00 | 2019-05-21T08:05:00 | 182,352,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,280 | java | package com.cn.controller;
import com.cn.domain.ResponseData;
import com.cn.exception.MyException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* @description: 异常处理handler
* @version: 1.0
* @author: [email protected]
* @date: 2019/4/19
*/
@RestControllerAdvice
public class GlobalExceptionHandler
{
private static final Logger LOGGER = LoggerFactory.getLogger(GlobalExceptionHandler.class);
@ExceptionHandler(Exception.class)
public ResponseData allExceptionHandler(Exception e)
{
LOGGER.error(e.getMessage(),e);
ResponseData responseData = new ResponseData(false);
responseData.setMsg("网络问题,操作失败");
return responseData;
}
@ExceptionHandler(MyException.class)
public ResponseData myExceptionHandler(MyException e)
{
LOGGER.error(e.getMessage(),e);
ResponseData responseData = new ResponseData(false);
responseData.setMsg(e.getMessage());
return responseData;
}
}
| [
"[email protected]"
] | |
2954ddb15afc09d41154a63f2b357d8bbc96a64c | a9ad1be9d0542309b5936580e73bc02629b04d6e | /src/automata/fsa/DFAtoAA.java | 06d8300e668b3fc1076856a012c008d855f07948 | [] | no_license | Mene90/Tesi | 8aab17d9c3b0ef349b3970c16dcf26d3352e78f4 | f7c8174d78ee1b6ff53c3b1197eaa358dcc12e13 | refs/heads/master | 2021-01-01T18:48:55.244911 | 2014-11-11T09:27:16 | 2014-11-11T09:27:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,832 | java | package automata.fsa;
import java.util.ArrayList;
import java.util.Iterator;
import automata.Automaton;
import automata.AutomatonChecker;
import automata.Configuration;
import automata.State;
import automata.Transition;
public class DFAtoAA extends NFAToDFA {
public void setEpsilonTransictions (Automaton dfa){
Transition[] transitions = dfa.getTransitions();
for(Transition t : transitions){
FSATransition epsilonTran = new FSATransition
(t.getFromState(),t.getToState(),"");
dfa.addTransition(epsilonTran);
}
}
/**
* Returns a deterministic finite state automaton equivalent to <CODE>automaton</CODE>.
* <CODE>automaton</CODE> is not at all affected by this conversion.
*
* @param automaton
* the automaton to convert to a dfa.
* @return a deterministic finite state automaton equivalent to <CODE>automaton</CODE>.
*/
public void convertDFA(Automaton abstractautomaton) {
/** check if actually nfa. */
AutomatonChecker ac = new AutomatonChecker();
if (!ac.isNFA(abstractautomaton)) {
return;
}
/** create new finite state automaton. */
FiniteStateAutomaton automaton = (FiniteStateAutomaton) abstractautomaton.clone();
abstractautomaton.clear();
State initialState = createInitialState(automaton, abstractautomaton);
/**
* get initial state and add to list of states that need to be expanded.
*/
ArrayList list = new ArrayList();
list.add(initialState);
/** while still more states to be expanded. */
while (!list.isEmpty()) {
ArrayList statesToExpand = new ArrayList();
Iterator it = list.iterator();
while (it.hasNext()) {
State state = (State) it.next();
/** expand state. */
statesToExpand.addAll(expandState(state, automaton, abstractautomaton));
it.remove();
}
list.addAll(statesToExpand);
}
}
}
| [
"[email protected]"
] | |
ebbe07ea72765a7ee058aa56f3d19300981ed1c3 | 5c4933ab2808da1b64e76892d30dc029a25f9f77 | /src/Passenger.java | 461446c1de1edebdd597920379fa332050099e18 | [] | no_license | dkozakevich/airport | aadc579df79941eade65368aa01f6b50f937b551 | 7c968745bbd6fdf0fdc409c4025bbeab745984cc | refs/heads/master | 2020-05-20T14:44:37.312747 | 2017-03-19T21:17:01 | 2017-03-19T21:17:01 | 84,484,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java |
public class Passenger {
private String firstName;
private String lastName;
private double baggageWeight;
public Passenger(String firstName, String lastName, double baggageWeight){
this.firstName = firstName;
this.lastName = lastName;
this.baggageWeight = baggageWeight;
}
public double getBaggageWeight() {
return baggageWeight;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
}
| [
"[email protected]"
] | |
8fbf09951531fdba184777daf95061a094764738 | 283873cc53af5c6923b7305bb49e185c98b1ce2c | /coding/src/example/Ex01_factorization.java | 30f3d45e97072f665e7ae87bdf9b1fdcade25b5f | [] | no_license | jeongeunii/coding | b6735a1dd345b8be9055abc6c6ff38cba9181a3c | e221ed8ca0a05f7ea672c83c4e2ff79e2684817f | refs/heads/master | 2022-07-17T08:54:14.883098 | 2020-05-22T16:28:09 | 2020-05-22T16:28:09 | 257,236,533 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,200 | java | package example;
import java.util.Scanner;
// 소인수 분해
// 1) 숫자를 입력 받는다.
// 2) 결과 값이 입력 받은 숫자 = x * y 형식으로 ex) 24 = 2 * 2 * 2 * 3
// 3) 0이 입력 되면 프로그램이 out 되도록
// 4) 결과 값이 나온다면 다시 위 과정 반복
public class Ex01_factorization {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
while (true) {
System.out.print("숫자를 입력하세요 -> ");
int cnt = sc.nextInt();
int i = 2;
String result = cnt + " = ";
if (cnt == 0) {
System.out.println("시스템 종료");
System.exit(0);
} // end of if
while (cnt != 1) {
if (cnt % i == 0) {
cnt /= i;
result += i;
} else {
i++;
// cnt % i != 0 이라면 아래의 코드를 실행하지않고 다음 제어로 넘김
continue;
}
// cnt = 1 이 되어 소인수분해의 마지막 값 뒤에는 * 출력 안함
if(cnt != 1) {
result += " * ";
}
} // end of while(cnt != 1)
System.out.println("소인수분해 결과 : " + result + "\n");
} // end of while(true)
}
}
| [
"[email protected]"
] | |
712ec9ff1b02c9f9252af79030288ce8ed7bc27d | bc57f8ccb76295738dc3af749eb7e7911086ba7e | /ChatServer/src/bg/sofia/uni/fmi/chat/nio/client/ClientRunnable.java | 106663dc3ebdd7f2dee0fbeaa41bad5cd0a1c089 | [] | no_license | SilviaTodorova/Modern-Java-Technology | 14e28c9a4f8f0f1fe3b371aee49da91e3b9cdbf0 | 09d0f1596fd6495a3c593c4630505f5fd1a53610 | refs/heads/master | 2022-04-10T07:01:55.261996 | 2020-04-05T05:52:55 | 2020-04-05T05:52:55 | 229,270,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,147 | java | package bg.sofia.uni.fmi.chat.nio.client;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import static bg.sofia.uni.fmi.chat.nio.client.GlobalConstants.BUFFER_SIZE;
import static bg.sofia.uni.fmi.chat.nio.client.GlobalConstants.DISCONNECT_FROM_SERVER_MESSAGE_FORMAT;
import static bg.sofia.uni.fmi.chat.nio.client.GlobalConstants.HOST;
import static bg.sofia.uni.fmi.chat.nio.client.GlobalConstants.PORT;
public class ClientRunnable implements Runnable {
private final SocketChannel socket;
public ClientRunnable(SocketChannel socket) {
this.socket = socket;
}
@Override
public void run() {
try {
ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
while (true) {
buffer.clear();
socket.read(buffer);
buffer.flip();
String reply = new String(buffer.array(), 0, buffer.limit());
System.out.print(reply);
}
} catch (IOException e) {
System.out.printf(DISCONNECT_FROM_SERVER_MESSAGE_FORMAT, HOST, PORT);
}
}
}
| [
"[email protected]"
] | |
c03571a4b55c31eec9861bfe780d3dc2640e24e9 | b2188bf9990132c5998c8d33dda2058b185d85e2 | /src/com/example/project1/Custom_adapter.java | cdd83a985856dc4e5cc182f8fc15c124849ce8a2 | [] | no_license | UmarNawazAbbasi/HawkEye | 02917266b24b46dab431aba7353f4d867c10ce7e | c3383550212a0d46e8b33b5c5bb8d576384317a3 | refs/heads/master | 2021-01-10T15:20:24.887646 | 2015-06-02T18:48:10 | 2015-06-02T18:48:10 | 36,753,783 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,387 | java | package com.example.project1;
import java.util.ArrayList;
import java.util.List;
import com.example.project1.Notification_adapter.NotificationHolder;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class Custom_adapter extends BaseAdapter {
Context context;
int layoutResourceId;
List<Person> data;
public Custom_adapter(Context context, int layoutResourceId,List<Person>data) {
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;
}
public static class NotificationHolder
{
ImageView im;
ImageView im1;
TextView text;
}
public List<Person> getData() {
return data;
}
public void setData(List<Person> data) {
this.data = data;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return data.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return data.get(arg0);
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View row = convertView;
NotificationHolder holder = null;
if(row == null)
{
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
holder = new NotificationHolder();
holder.text = (TextView)row.findViewById(R.id.textNoti);
holder.im=(ImageView)row.findViewById(R.id.imageNoti);
holder.im1=(ImageView)row.findViewById(R.id.imageNoti);
row.setTag(holder);
}
else
{
holder = (NotificationHolder)row.getTag();
}
String weather = data.get(position).get_fullName();
holder.text.setText(weather);
return row;
}
/* important note
* notification_custom1.xml use for layout fot that adapter
*/
}
| [
"[email protected]"
] | |
88a5f132d33131119168466d2add88304c27c5d2 | 5c03ebc67a6da1f4861b51997fd9b32d9ca47241 | /src/main/java/com/boot/dao/domain/Customer.java | 0c6da71781f352e30affa37dca26b2a3eff602ff | [] | no_license | Unicom1/CRMProject | 6710a49aca93c7057ba488479d767a4ac231360b | 289b88c1c59305c2938d90c6ed12583d5f7fca6c | refs/heads/master | 2020-03-12T08:40:51.737609 | 2018-06-21T15:54:47 | 2018-06-21T15:54:47 | 130,533,163 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,621 | java | package com.boot.dao.domain;
import java.sql.Date;
public class Customer {
private Integer id;
private String cName;
private Integer cState;
private String cWork;
private String cSource;
private String cResponsible;
private Integer cLevel;
private String cAddress;
private Date cCreateTime;
private String cRemark;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getcName() {
return cName;
}
public void setcName(String cName) {
this.cName = cName;
}
public Integer getcState() {
return cState;
}
public void setcState(Integer cState) {
this.cState = cState;
}
public String getcWork() {
return cWork;
}
public void setcWork(String cWork) {
this.cWork = cWork;
}
public String getcSource() {
return cSource;
}
public void setcSource(String cSource) {
this.cSource = cSource;
}
public String getcResponsible() {
return cResponsible;
}
public void setcResponsible(String cResponsible) {
this.cResponsible = cResponsible;
}
public Integer getcLevel() {
return cLevel;
}
public void setcLevel(Integer cLevel) {
this.cLevel = cLevel;
}
public String getcRemark() {
return cRemark;
}
public void setcRemark(String cRemark) {
this.cRemark = cRemark;
}
public String getcAddress() {
return cAddress;
}
public void setcAddress(String cAddress) {
this.cAddress = cAddress;
}
public Date getcCreateTime() {
return cCreateTime;
}
public void setcCreateTime(Date cCreateTime) {
this.cCreateTime = cCreateTime;
}
}
| [
"[email protected]"
] | |
4ef94d9c9be2393699be808d5aaa1bd1e915848e | 575e1cff368355678ac888b72f43f0a8900d1dde | /src/DO/TransportRateObject.java | c725110b8d2f9196960fd976d2755145657f79d8 | [] | no_license | Dukester1987/QuoteRegister | dd8779348d90ac546c6c57b31b49c7876da2fd83 | c2a124378c048c83413b25d504c10981a9d6645e | refs/heads/master | 2018-12-20T02:11:40.902148 | 2018-09-17T03:01:47 | 2018-09-17T03:01:47 | 113,371,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,692 | 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 DO;
/**
*
* @author ldulka
*/
public class TransportRateObject extends AbstractDatabaseObject {
private String ProductID,ID,Notes;
private TruckGroupObject truckGroupObject;
private Double materialCost, transportRate, externalTipping;
private Double specialProject;
public TransportRateObject(String ProductID, String ID, TruckGroupObject truckGroupObject, Double materialCost, Double transportRate, Double specialProject, Double externalTipping, String notes) {
setTransportRateObject(ProductID, ID, truckGroupObject, materialCost, transportRate, specialProject, externalTipping, notes);
}
public String getProductID() {
return ProductID;
}
public void setProductID(String ProductID) {
this.ProductID = ProductID;
}
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public TruckGroupObject getTruckGroupObject() {
return truckGroupObject;
}
public void setTruckGroupObject(TruckGroupObject truckGroupObject) {
this.truckGroupObject = truckGroupObject;
}
public Double getMaterialCost() {
return materialCost;
}
public void setMaterialCost(Double materialCost) {
this.materialCost = materialCost;
}
public Double getTransportRate() {
return transportRate;
}
public void setTransportRate(Double transportRate) {
this.transportRate = transportRate;
}
public Double getTotalCost() {
return transportRate+materialCost+specialProject+externalTipping;
}
public String getNotes() {
return Notes;
}
public void setNotes(String Notes) {
this.Notes = Notes;
}
public void setTransportRateObject(String ProductID, String ID, TruckGroupObject truckGroupObject, Double materialCost, Double transportRate, Double specialProject, Double externalTipping, String notes){
this.ProductID = ProductID;
this.ID = ID;
this.truckGroupObject = truckGroupObject;
this.materialCost = materialCost;
this.transportRate = transportRate;
this.specialProject = specialProject;
this.externalTipping = externalTipping;
this.Notes = notes;
}
public Double getSpecialProject() {
return specialProject;
}
public Double getExternalTipping() {
return externalTipping;
}
public void setSpecialProject(Double specialProject) {
this.specialProject = specialProject;
}
public void setExternalTipping(Double externalTipping){
this.externalTipping = externalTipping;
}
public Object[] getTableObject(){
return new Object[] {getTruckGroupObject(),null,null,ID,null,null,null,null,null,null,null,null,null,null,getTruckGroupObject(),getTotalCost(),getMaterialCost(),getTransportRate(),getSpecialProject(),getExternalTipping(),getNotes()};
}
@Override
public Object[][] getDBObject() {
return new Object[][]{
{"ID",
"ProductAllID",
"TruckGroupID",
"Notes",
"MaterialCost",
"TransportRate",
"SpecialProject",
"ExternalTipping"},
{getID(),
getProductID(),
getTruckGroupObject().getID(),
getNotes(),
getMaterialCost(),
getTransportRate(),
getSpecialProject(),
getExternalTipping()}
};
}
@Override
public Object[] getSearchObject() {
return new Object[]{
getID(),
getProductID(),
getTruckGroupObject().getGroupName(),
getNotes(),
getMaterialCost(),
getTransportRate(),
getSpecialProject(),
getExternalTipping()
};
}
@Override
public Object[][] getDBWhere() {
return new Object[][]{
{"ID","ProductAllID"},{"=","="},{getID(),getProductID()},{"AND","AND"}
};
}
@Override
public String getTableName() {
return "QR_TransportRate";
}
@Override
public Object getDBID() {
return getID();
}
}
| [
"[email protected]"
] | |
39c503b603253e3da39645cf73b91019cc5a5633 | 9c4cde879b98784d47bab681ddb2c74e8ad42e5a | /src/main/java/life/lluis/multiversehardcore/utils/WorldUtils.java | 6fa6aac20cfd4c499ee30391735f1d6503dca644 | [] | no_license | LordMike1/MultiverseHardcore | a0adf0be7f358827eab0fd51e0a9298556675684 | 3e6c7a3286ea37188e2248ea8387ad277356f925 | refs/heads/master | 2023-01-19T21:33:56.503031 | 2020-12-05T19:29:46 | 2020-12-05T19:29:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,339 | java | package life.lluis.multiversehardcore.utils;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import life.lluis.multiversehardcore.MultiverseHardcore;
import life.lluis.multiversehardcore.exceptions.PlayerNotParticipatedException;
import life.lluis.multiversehardcore.exceptions.PlayerParticipationAlreadyExistsException;
import life.lluis.multiversehardcore.exceptions.WorldIsNotHardcoreException;
import life.lluis.multiversehardcore.models.HardcoreWorld;
import life.lluis.multiversehardcore.models.PlayerParticipation;
import org.bukkit.GameMode;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;
import java.util.Date;
import java.util.logging.Logger;
public final class WorldUtils {
private WorldUtils() {
}
public static boolean worldExists(@NotNull String worldName) {
return getServer().getWorld(worldName) != null;
}
public static boolean worldIsHardcore(@NotNull World world) {
try {
new HardcoreWorld(world.getName());
return true;
} catch (WorldIsNotHardcoreException e) {
return false;
}
}
public static boolean playerIsInWorld(Player player, World world) {
String worldName = world.getName();
String playerWorldName = player.getWorld().getName();
return worldName.equals(playerWorldName);
}
public static World getNormalWorld(@NotNull World world) {
try {
if (world.getEnvironment() == World.Environment.NORMAL) return world;
if (hasSuffix(world)) {
World normalWorld = getServer().getWorld(removeWorldSuffix(world));
if (normalWorld == null) return world;
HardcoreWorld hcWorld = new HardcoreWorld(normalWorld.getName());
boolean includeNetherOrEnd = world.getEnvironment() == World.Environment.NETHER ?
hcWorld.getConfiguration().isIncludeNether() : hcWorld.getConfiguration().isIncludeEnd();
return !includeNetherOrEnd ? world : normalWorld;
}
return world;
} catch (WorldIsNotHardcoreException e) {
return world;
}
}
public static boolean respawnPlayer(@NotNull Player player) {
try {
String worldName = getNormalWorld(player.getWorld()).getName();
World respawnWorld = new HardcoreWorld(worldName).getConfiguration().getSpawnWorld();
if (respawnWorld == null) {
getLogger().warning("Respawn world does not exist!");
return false;
}
return player.teleport(respawnWorld.getSpawnLocation());
} catch (WorldIsNotHardcoreException e) {
return false; // This cannot happen. If player is not in a hardcore world, this function will not be called.
}
}
public static void handlePlayerEnterWorld(@NotNull Event event) {
try {
Player player = event instanceof PlayerEvent ? ((PlayerEvent) event).getPlayer() : ((PlayerDeathEvent) event).getEntity();
World world = getNormalWorld(player.getWorld());
if (!worldIsHardcore(world)) {
setGameModeBackToDefaultIfNecessary(player, world);
return;
}
addPlayerParticipationIfNotExists(player, world);
PlayerParticipation participation = new PlayerParticipation(player, world);
if (participation.isDeathBanned()) {
sendYouCantPlayMessage(participation);
preventPlayerEnterWorld(participation);
} else {
setGameModeBackToDefaultIfNecessary(player, world);
sendEnteringWorldMessage(player);
}
} catch (PlayerNotParticipatedException | WorldIsNotHardcoreException ignored) {
} // This cannot happen.
}
private static FileConfiguration getConfig() {
return MultiverseHardcore.getInstance().getConfig();
}
private static Logger getLogger() {
return MultiverseHardcore.getInstance().getLogger();
}
private static Server getServer() {
return MultiverseHardcore.getInstance().getServer();
}
private static boolean hasSuffix(@NotNull World world) {
if (world.getEnvironment() == World.Environment.NORMAL) return false;
String suffix = getWorldSuffix(world.getEnvironment());
String worldName = world.getName();
return worldName.endsWith(suffix);
}
private static String removeWorldSuffix(@NotNull World world) {
if (world.getEnvironment() == World.Environment.NORMAL) return world.getName();
String suffix = getWorldSuffix(world.getEnvironment());
String worldName = world.getName();
return worldName.substring(0, worldName.length() - suffix.length());
}
private static String getWorldSuffix(@NotNull World.Environment environment) {
return environment == World.Environment.NETHER ? "_nether" : "_the_end";
}
private static void addPlayerParticipationIfNotExists(@NotNull Player player, @NotNull World world) {
try {
PlayerParticipation.addPlayerParticipation(player, world, new Date());
} catch (PlayerParticipationAlreadyExistsException ignored) {
}
}
private static void sendYouCantPlayMessage(@NotNull PlayerParticipation participation) {
String message = participation.isBannedForever() ? "You can't play in this world since you died" :
"You can't play in this world now. You'll be able to join again on " + participation.getUnBanDate();
MessageSender.sendNormal(participation.getPlayer(), message);
}
private static void sendEnteringWorldMessage(@NotNull Player player) {
MessageSender.sendNormal(player, "You are entering a HARDCORE world, be careful!");
}
private static void preventPlayerEnterWorld(@NotNull PlayerParticipation participation) {
int enterWorldTicks = getConfig().getInt("enter_world_ticks");
HardcoreWorld hcWorld = participation.getHcWorld();
Player player = participation.getPlayer();
MultiverseHardcore plugin = MultiverseHardcore.getInstance();
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
if (hcWorld.getConfiguration().isSpectatorMode()) {
player.setGameMode(GameMode.SPECTATOR);
} else {
respawnPlayer(player);
}
}, enterWorldTicks);
}
private static GameMode getDefaultGameMode(World world) {
MVWorldManager worldManager = MultiverseHardcore.getInstance().getMVWorldManager();
MultiverseWorld multiverseWorld = worldManager.getMVWorld(world);
return multiverseWorld.getGameMode();
}
private static void setGameModeBackToDefaultIfNecessary(Player player, World world) {
if (player.getGameMode() == GameMode.SPECTATOR) {
player.setGameMode(getDefaultGameMode(world));
}
}
}
| [
"[email protected]"
] | |
8f86cb70f7c9e8211ce99ea2523d7e77bf5c3037 | d7d8e2c3f2315e4f5edc0239c9570f1b0472a613 | /practice/src/dp/FishShapedBun.java | a2b07f1009d1c2ae383cfdec55073f8f385f44ba | [] | no_license | kwonyonghwan/MyProject | f2b5ce502c17d212abcc7b4a9fc8b8d30ebe0432 | 28fe07577b978fb44eb5873596f65a8bfa9bf93f | refs/heads/master | 2021-01-01T06:14:57.223982 | 2017-12-20T04:36:18 | 2017-12-20T04:36:18 | 97,391,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package dp;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class FishShapedBun {
public static void main(String[] args) throws FileNotFoundException {
Scanner sc = new Scanner(new FileInputStream("src/dp/FishShapedBun.txt"));
int countOfFishbun = sc.nextInt()+1;
int[] feeOfSetmenu = new int[countOfFishbun];
int[] bottomUpMap = new int[countOfFishbun];
for(int i=1; i<countOfFishbun; i++){
feeOfSetmenu[i] = sc.nextInt();
}
bottomUpMap[1] = feeOfSetmenu[1];
for(int i=2; i<countOfFishbun; i++){
bottomUpMap[i]= Math.max(bottomUpMap[i], feeOfSetmenu[i]);
for(int j=1; j<i; j++){
bottomUpMap[i]= Math.max(bottomUpMap[i], bottomUpMap[i-j]+feeOfSetmenu[j]);
}
}
System.out.println(bottomUpMap[countOfFishbun-1]);
}//main
}//class
| [
"[email protected]"
] | |
85460d37eaddbc878dd4da1d84eb86e68bab0237 | f44d50903da1b734802502ac5b46485ee8efc12c | /src/TestNG/GroupTest.java | 7d64f10dd58c84dda2823a2781e4d36b6782ba67 | [] | no_license | ameettshelar/selenium_practice | 56118636b1703035addb35f78feaa59f153c9d98 | 55f291074f197cd36e0f55a80a4373cd62e50955 | refs/heads/master | 2021-01-22T05:19:48.081139 | 2017-02-11T11:47:26 | 2017-02-11T11:47:26 | 81,647,413 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package TestNG;
import org.testng.annotations.Test;
public class GroupTest
{
@Test(groups={"Sedan", "BMW"})
public void BMW3Series()
{
System.out.println("BMW3Series");
}
@Test(groups={"Sedan"})
public void BMWX3()
{
System.out.println("BMWX3");
}
@Test(groups={"Sedan"})
public void AudiA6()
{
System.out.println("AudiA6");
}
@Test(groups={"Honda"})
public void HondAccord()
{
System.out.println("HondAccord");
}
}
| [
"[email protected]"
] | |
9de4d4a3c7e0c71190daca3526a7c9d6d7394d75 | 2881f733dd5926cfddc53be5e8e409d8e0d0b091 | /src/Test_01/Test_03.java | d34e5664d1ad9614662c010fa328d4c92d67df08 | [] | no_license | Anthony-Jo/20200925_Test_01 | 8dfbe0b5c5ea4531a209620843a231701456f8a7 | 4c52f6fc941b2ed7a512d8dfda3011c599906844 | refs/heads/master | 2022-12-24T14:44:27.725281 | 2020-10-07T00:26:24 | 2020-10-07T00:26:43 | 298,490,859 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 212 | java | package Test_01;
public class Test_03 {
public static void main(String[] args) {
// TODO Auto-generated method stub
final String KOREA = "´ëÇѹα¹";
System.out.println("Korea: " + KOREA);
}
}
| [
"[email protected]"
] | |
60a5925e57205fa2ecc538cbd72f71c61b43754d | 37439469d7a4bf3e736f01695797cc558a19e77c | /src/main/java/mn/validation/array/PojoService.java | f31ff5d5ab5fb14c0d02d8d736959457874b729e | [] | no_license | JasonTypesCodes/mn-validation-array | 40ed546ca08e078a39273a39b9e40d2e86042c3f | 8f6fc553beefbf344813bc51caabf4ebda0b13d5 | refs/heads/main | 2021-05-21T08:37:58.572523 | 2020-04-03T03:17:07 | 2020-04-03T03:17:07 | 252,622,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 187 | java | package mn.validation.array;
import javax.inject.Singleton;
import javax.validation.Valid;
@Singleton
public class PojoService {
public void checkTestPojo(@Valid TestPojo input) {}
}
| [
"[email protected]"
] | |
ee317dab71c91cad290306130c59b255a0ae1be7 | aac5bd343754ac28ff7e66d5af4104165e2acebb | /common/mdiyo/inficraft/infiblocks/bricks/BrickFancyMagicSlab.java | e533522dbba9610aa1535f72c1162066bc4389ec | [] | no_license | AlexTheLarge/InfiCraft | 8c36406887da285b1e30c7787334780869953e20 | 0d6fc1a2e622988a77d71f9eabaecef39005edf8 | refs/heads/master | 2021-01-16T20:35:08.747272 | 2012-08-28T06:43:33 | 2012-08-28T06:43:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,840 | java | package mdiyo.inficraft.infiblocks.bricks;
import java.util.ArrayList;
import mdiyo.inficraft.infiblocks.InfiBlocks;
import mdiyo.inficraft.infiblocks.magicslabs.MagicSlabBase;
import net.minecraft.src.Block;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
public class BrickFancyMagicSlab extends MagicSlabBase
{
public BrickFancyMagicSlab(int i, int j)
{
super(i, j, Material.rock);
}
public float getHardness(int md) {
switch(md) {
case 0: return Block.obsidian.getBlockHardness(null, 0, 0, 0);
case 1: return 0.5F; //Snow
case 2: return 1.2F; //Sandstone
case 3: return Block.brick.getBlockHardness(null, 0, 0, 0);
case 4: return 1.5F; //Netherrack
case 5: return Block.blockDiamond.getBlockHardness(null, 0, 0, 0);
case 6: return Block.blockGold.getBlockHardness(null, 0, 0, 0);
case 7: return Block.blockLapis.getBlockHardness(null, 0, 0, 0);
case 8: return Block.stone.getBlockHardness(null, 0, 0, 0);
case 9: return Block.stone.getBlockHardness(null, 0, 0, 0);
case 10: return 3F;
case 11: return Block.brick.getBlockHardness(null, 0, 0, 0);
case 12: return Block.blockSteel.getBlockHardness(null, 0, 0, 0);
case 13: return 3F;
case 14: return 3F;
case 15: return 3F;
default: return 0;
}
}
public int getBlockTextureFromSideAndMetadata(int side, int md)
{
return blockIndexInTexture+md;
}
public String getTextureFile()
{
return InfiBlocks.blocksImage;
}
public void addCreativeItems(ArrayList arraylist)
{
for (int iter = 0; iter < 15; iter++)
{
arraylist.add(new ItemStack(InfiBlocks.getContentInstance().fancyBrickMagicSlab, 1, 0));
}
}
}
| [
"[email protected]"
] | |
13bf7e6749eea16317b39abf4e06fe708ea784be | b33527a2141b3e87bc5c41cbcf2be1c4556ec64b | /src/br/common/models/classes/ClassDataBuilder.java | cfdf0c2ce201ea36a430d2dad557aa7f895af46b | [
"MIT"
] | permissive | yanmarques/project-thursday | 3311f0e4c0a782c8ba8a8303f59895d83d8153ac | 07c41f128720b442e17f548525b9712258403028 | refs/heads/master | 2020-12-29T09:07:18.150325 | 2020-02-05T21:14:25 | 2020-02-05T21:14:25 | 238,549,692 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | package br.common.models.classes;
import br.common.database.DataBuilder;
import br.common.database.SQLCompiler;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class ClassDataBuilder implements DataBuilder<Class> {
@Override
public Class getModel() {
return new Class();
}
@Override
public Class build(SQLCompiler compiler, ResultSet resultSet) throws SQLException {
Class classModel = this.getModel();
String name = compiler.alias(Class.NAME);
classModel.setName(resultSet.getString(name));
try {
double totalScore = resultSet.getDouble(Class.TOTAL_SCORE);
classModel.setTotalScore(totalScore);
} catch (Exception exception) {
// Ignore this exception.
}
return classModel;
}
@Override
public void buildStatement(PreparedStatement preparedStatement, Class classModel) throws SQLException {
preparedStatement.setString(1, classModel.getName());
}
}
| [
"[email protected]"
] | |
caab123358cf5d87979f3da4c5d7a373b31738a0 | b85a472ce96564ac5de93a47a82538abd63f438c | /J2EE/SpringStudy/test/com/jimmy/spring/test/aop/AOPTest.java | 83cd343b18cc6241e96517a99dd53915dfcea19d | [] | no_license | fushcpc/my-workspace-repository | 042c0014833bd21d99dcde9f191ea469781fb6c0 | 7ae282483bf9478dbe0649cd3151fc9ccf494e7a | refs/heads/master | 2016-09-05T19:07:30.365743 | 2014-04-02T14:25:26 | 2014-04-02T14:25:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package com.jimmy.spring.test.aop;
import org.junit.Test;
public class AOPTest {
@Test
public void testOK() {
JDKProxyFactory factory = new JDKProxyFactory();
IUserService service = (IUserService) factory.createProxyInstance(new UserService("HelloKitty"));
service.save();//actually invoke
}
@Test
public void testFailed() {
JDKProxyFactory factory = new JDKProxyFactory();
IUserService service = (IUserService) factory.createProxyInstance(new UserService());
service.save();//didn't invoke
}
}
| [
"[email protected]"
] | |
b861949da71988e026266c9e6d0b7481e09ca4de | 163f6a0829b1cd14cf67c2e6d4cbf2b1552b46c5 | /desktop/src/com/jgntic/bloxet/desktop/DesktopLauncher.java | 6564e666439d6ecb88d912ddfc80881b1de8060f | [] | no_license | vankusoft/Bloxet | a0d9148713676a4ef8fbc05bc42e1e8452312c07 | f7471b75da74d514f4794e861f05aab600bb4bb1 | refs/heads/master | 2021-01-12T13:10:46.334581 | 2018-03-27T12:58:12 | 2018-03-27T12:58:12 | 72,135,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 452 | java | package com.jgntic.bloxet.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.jgntic.bloxet.Bloxet;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width=320;
config.height=480;
new LwjglApplication(new Bloxet(), config);
}
}
| [
"[email protected]"
] | |
09565c9deea379814759da462254f9ee6aa72d65 | 473f08cd5d1179366250278c3232dd5e5f4b822e | /src/main/java/reservation/controller/CommandParser/Options/ShowOption.java | db15980abd9a7d0f328c213b0e98bbb10cd9aaa2 | [] | no_license | pedrocantu16/TicketReservation | 2090c4765742f01105fb054c8a0fa09309cd166e | a2248cbb10393f308b1848a3a252b8090a7d1822 | refs/heads/master | 2022-12-03T08:54:24.346380 | 2020-08-17T17:15:32 | 2020-08-17T17:15:32 | 288,240,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,517 | java | package reservation.controller.CommandParser.Options;
import java.util.List;
import reservation.controller.CommandParser.CommandData.ICommandData;
import reservation.controller.CommandParser.CommandData.ShowCommandData;
/**
* Represents an Option that can be passed to the program to display seats in the Theater.
*/
public class ShowOption implements IOption {
/**
* Singleton instance of ShowOption object.
*/
private static ShowOption instance;
/**
* String representing expected argument.
*/
private static final String ARGUMENT = "show";
/**
* Private Constructor for ShowOption class. Singleton
* prevents instantiation outside class.
*/
private ShowOption() {
}
/**
* Returns the ShowOption object
* @return the ShowOption object
*/
public static synchronized ShowOption getInstance() {
if (instance == null) {
instance = new ShowOption();
}
return instance;
}
/**
* Method to validate the arguments of an option.
* @param args List of arguments passed to the program by the user.
* @return ICommandData object with all the fields passed by the user.
*/
@Override
public ICommandData validateArgs(List<String> args) {
if(args.contains(ARGUMENT)) {
args.remove(ARGUMENT);
return ShowCommandData.getInstance();
}
return null;
}
/**
* Get String representation.
* @return String representation of object.
*/
@Override
public String toString() {
return "ShowOption{}";
}
}
| [
"[email protected]"
] | |
34c18d5cd072e7a3fbecb4effb1327bf424c1a1e | e45ac3001e1770170739704c8cec44d8f7320d2e | /rest-api/src/main/java/com/example/test/restapi/hello_bean.java | c187d8221c5da84ffef42271974819f30bb5157e | [] | no_license | ssgandham/REST-API-using-Spring | 85915c3ea8e7d8772a9e8824461979377274e754 | 55ce7517c22ec1479c534bc8b217ed423962188d | refs/heads/master | 2020-03-16T12:44:13.141973 | 2018-05-08T23:01:36 | 2018-05-08T23:01:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.example.test.restapi;
public class hello_bean {
private String msg;
public String getMsg() {
return msg;
}
public hello_bean(String string) {
// TODO Auto-generated constructor stub
this.msg = string;
}
public void setMsg(String msg) {
this.msg = msg;
}
@Override
public String toString() {
return "hello_bean [msg=" + msg + "]";
}
}
| [
"[email protected]"
] | |
a294bee3de620687d516a764c02b83d6d6914e12 | c3381ece1e660f2d626480152349262a511aefb5 | /icefrog-core/src/main/java/com/whaleal/icefrog/core/convert/impl/EnumConverter.java | ab8f1054f84600ab0be8fee062f87935397c4441 | [
"Apache-2.0"
] | permissive | whaleal/icefrog | 775e02be5b2fc8d04df1dd490aa765232cb0e6a4 | c8dc384a3de1ed17077ff61ba733b1e2f37e32ab | refs/heads/v1-dev | 2022-07-27T01:27:52.624849 | 2022-06-20T13:38:12 | 2022-06-20T13:38:12 | 414,203,703 | 9 | 5 | Apache-2.0 | 2022-06-20T14:08:57 | 2021-10-06T12:30:31 | Java | UTF-8 | Java | false | false | 4,658 | java | package com.whaleal.icefrog.core.convert.impl;
import com.whaleal.icefrog.core.convert.AbstractConverter;
import com.whaleal.icefrog.core.lang.EnumItem;
import com.whaleal.icefrog.core.lang.SimpleCache;
import com.whaleal.icefrog.core.map.MapUtil;
import com.whaleal.icefrog.core.util.ClassUtil;
import com.whaleal.icefrog.core.util.EnumUtil;
import com.whaleal.icefrog.core.util.ModifierUtil;
import com.whaleal.icefrog.core.util.ReflectUtil;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 无泛型检查的枚举转换器
*
* @author Looly
* @author wh
* @since 1.0.0
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public class EnumConverter extends AbstractConverter<Object> {
private static final long serialVersionUID = 1L;
private static final SimpleCache<Class<?>, Map<Class<?>, Method>> VALUE_OF_METHOD_CACHE = new SimpleCache<>();
private final Class enumClass;
/**
* 构造
*
* @param enumClass 转换成的目标Enum类
*/
public EnumConverter( Class enumClass ) {
this.enumClass = enumClass;
}
/**
* 尝试找到类似转换的静态方法调用实现转换且优先使用<br>
* 约定枚举类应该提供 valueOf(String) 和 valueOf(Integer)用于转换
* oriInt /name 转换托底
*
* @param value 被转换的值
* @param enumClass enum类
* @return 对应的枚举值
*/
protected static Enum tryConvertEnum( Object value, Class enumClass ) {
if (value == null) {
return null;
}
// EnumItem实现转换
Enum enumResult = null;
if (EnumItem.class.isAssignableFrom(enumClass)) {
final EnumItem first = (EnumItem) EnumUtil.getEnumAt(enumClass, 0);
if (null != first) {
if (value instanceof Integer) {
return (Enum) first.fromInt((Integer) value);
} else if (value instanceof String) {
return (Enum) first.fromStr(value.toString());
}
}
}
// 用户自定义方法
// 查找枚举中所有返回值为目标枚举对象的方法,如果发现方法参数匹配,就执行之
final Map<Class<?>, Method> methodMap = getMethodMap(enumClass);
if (MapUtil.isNotEmpty(methodMap)) {
final Class<?> valueClass = value.getClass();
for (Map.Entry<Class<?>, Method> entry : methodMap.entrySet()) {
if (ClassUtil.isAssignable(entry.getKey(), valueClass)) {
enumResult = ReflectUtil.invokeStatic(entry.getValue(), value);
}
}
}
//oriInt 应该滞后使用 以 GB/T 2261.1-2003 性别编码为例,对应整数并非连续数字会导致数字转枚举时失败
//0 - 未知的性别
//1 - 男性
//2 - 女性
//5 - 女性改(变)为男性
//6 - 男性改(变)为女性
//9 - 未说明的性别
if (null == enumResult) {
if (value instanceof Integer) {
enumResult = EnumUtil.getEnumAt(enumClass, (Integer) value);
} else if (value instanceof String) {
try {
enumResult = Enum.valueOf(enumClass, (String) value);
} catch (IllegalArgumentException e) {
//ignore
}
}
}
return enumResult;
}
/**
* 获取用于转换为enum的所有static方法
*
* @param enumClass 枚举类
* @return 转换方法map,key为方法参数类型,value为方法
*/
private static Map<Class<?>, Method> getMethodMap( Class<?> enumClass ) {
return VALUE_OF_METHOD_CACHE.get(enumClass, () -> Arrays.stream(enumClass.getMethods())
.filter(ModifierUtil::isStatic)
.filter(m -> m.getReturnType() == enumClass)
.filter(m -> m.getParameterCount() == 1)
.filter(m -> false == "valueOf".equals(m.getName()))
.collect(Collectors.toMap(m -> m.getParameterTypes()[0], m -> m)));
}
@Override
protected Object convertInternal( Object value ) {
Enum enumValue = tryConvertEnum(value, this.enumClass);
if (null == enumValue && false == value instanceof String) {
// 最后尝试valueOf转换
enumValue = Enum.valueOf(this.enumClass, convertToStr(value));
}
return enumValue;
}
@Override
public Class getTargetType() {
return this.enumClass;
}
}
| [
"[email protected]"
] | |
1db43a23f2cffe55bca2b83fd5771b3e3589f697 | 91312b6add83ec8b9dbc559481c42bf026c2b9b0 | /app/src/main/java/com/example/anilreddy/rxjavasampleapp/utils/AppConstant.java | bd4d998c74a923e0c39d1890da16eb7e9ebf14a2 | [] | no_license | AnilRdyAleti/RxjavaSampleApp | 459f68a2ee10732598d2b50ddbe4e9a2a957fc1e | bc86642226d9f62cd1868ece44208ad2c5f1afaa | refs/heads/master | 2020-03-16T09:07:37.053761 | 2018-05-09T14:02:02 | 2018-05-09T14:02:02 | 132,609,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package com.example.anilreddy.rxjavasampleapp.utils;
public final class AppConstant {
AppConstant() {
}
public static String LINE_SEPARATOR = "\n";
}
| [
"[email protected]"
] | |
b96e1e5f524fda404c073b35e68d375ff9639dae | fdb7f01a7405fd193538fc569147250cbd773a25 | /app/src/test/java/com/pervasive/sth/smarttreasurehunt/ExampleUnitTest.java | 0fe329d0b8a39e63a55ddbb98bd400869e268462 | [] | no_license | davtir/pervasive-sth | 7907c5da4dc8d912f8d8a245b63aca425ddb4563 | 24de04f6578e9594992242e75b56ee9cf79b6ef0 | refs/heads/master | 2020-04-06T03:33:31.982578 | 2016-09-13T16:52:34 | 2016-09-13T16:52:34 | 56,173,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.pervasive.sth.smarttreasurehunt;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
5de6c328f658c5263dd8ad59b35c81c1f05a134f | 0867e665caa130ca17ce0ccb3efa22b2ef0540f1 | /CyberLink/src/org/cybergarage/net/HostInterface.java | 8d31ec6a6805c88ec155ab11423c084bfc0f0f0c | [] | no_license | james026yeah/sharescreen | 7dd3f2a5702b301a10bca538714057f5ff1c3c32 | f936fd79e19788ee650f2f3b8f2302ab69684de2 | refs/heads/master | 2020-05-20T09:33:05.685478 | 2013-01-05T03:12:40 | 2013-01-05T03:12:40 | 6,563,319 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,050 | java | /******************************************************************
*
* CyberHTTP for Java
*
* Copyright (C) Satoshi Konno 2002-2003
*
* File: HostInterface.java
*
* Revision;
*
* 05/12/03
* - first revision.
* 05/13/03
* - Added support for IPv6 and loopback address.
* 02/15/04
* - Added the following methods to set only a interface.
* - setInterface(), getInterfaces(), hasAssignedInterface()
* 06/30/04
* - Moved the package from org.cybergarage.http to org.cybergarage.net.
* 06/30/04
* - Theo Beisch <[email protected]>
* - Changed isUseAddress() to isUsableAddress().
*
******************************************************************/
package org.cybergarage.net;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;
import org.cybergarage.util.Debug;
public class HostInterface
{
////////////////////////////////////////////////
// Constants
////////////////////////////////////////////////
public static boolean USE_LOOPBACK_ADDR = false;
public static boolean USE_ONLY_IPV4_ADDR = false;
public static boolean USE_ONLY_IPV6_ADDR = false;
////////////////////////////////////////////////
// Network Interfaces
////////////////////////////////////////////////
private static String ifAddress = "";
public final static int IPV4_BITMASK = 0x0001;
public final static int IPV6_BITMASK = 0x0010;
public final static int LOCAL_BITMASK = 0x0100;
public final static void setInterface(String ifaddr)
{
ifAddress = ifaddr;
}
public final static String getInterface()
{
return ifAddress;
}
private final static boolean hasAssignedInterface()
{
return (0 < ifAddress.length()) ? true : false;
}
////////////////////////////////////////////////
// Network Interfaces
////////////////////////////////////////////////
// Thanks for Theo Beisch (10/27/04)
private final static boolean isUsableAddress(InetAddress addr)
{
if (USE_LOOPBACK_ADDR == false) {
if (addr.isLoopbackAddress() == true)
return false;
}
if (USE_ONLY_IPV4_ADDR == true) {
if (addr instanceof Inet6Address)
return false;
}
if (USE_ONLY_IPV6_ADDR == true) {
if (addr instanceof Inet4Address)
return false;
}
return true;
}
public final static int getNHostAddresses()
{
if (hasAssignedInterface() == true)
return 1;
int nHostAddrs = 0;
try {
Enumeration nis = NetworkInterface.getNetworkInterfaces();
while (nis.hasMoreElements()){
NetworkInterface ni = (NetworkInterface)nis.nextElement();
Enumeration addrs = ni.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress addr = (InetAddress)addrs.nextElement();
if (isUsableAddress(addr) == false)
continue;
nHostAddrs++;
}
}
}
catch(Exception e){
Debug.warning(e);
};
return nHostAddrs;
}
/**
*
* @param ipfilter
* @param interfaces
* @return
* @since 1.8.0
* @author Stefano "Kismet" Lenzi <[email protected]>
*/
public final static InetAddress[] getInetAddress(int ipfilter,String[] interfaces){
Enumeration nis;
if(interfaces!=null){
Vector iflist = new Vector();
for (int i = 0; i < interfaces.length; i++) {
NetworkInterface ni;
try {
ni = NetworkInterface.getByName(interfaces[i]);
} catch (SocketException e) {
continue;
}
if(ni != null) iflist.add(ni);
}
nis = iflist.elements();
}else{
try {
nis = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
return null;
}
}
ArrayList addresses = new ArrayList();
while (nis.hasMoreElements()){
NetworkInterface ni = (NetworkInterface)nis.nextElement();
Enumeration addrs = ni.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress addr = (InetAddress)addrs.nextElement();
if(((ipfilter & LOCAL_BITMASK)==0) && addr.isLoopbackAddress())
continue;
if (((ipfilter & IPV4_BITMASK)!=0) && addr instanceof Inet4Address ) {
addresses.add(addr);
}else if (((ipfilter & IPV6_BITMASK)!=0)&& addr instanceof InetAddress) {
addresses.add(addr);
}
}
}
return (InetAddress[]) addresses.toArray(new InetAddress[]{});
}
public final static String getHostAddress(int n)
{
if (hasAssignedInterface() == true)
return getInterface();
int hostAddrCnt = 0;
try {
Enumeration nis = NetworkInterface.getNetworkInterfaces();
while (nis.hasMoreElements()){
NetworkInterface ni = (NetworkInterface)nis.nextElement();
Enumeration addrs = ni.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress addr = (InetAddress)addrs.nextElement();
if (isUsableAddress(addr) == false)
continue;
if (hostAddrCnt < n) {
hostAddrCnt++;
continue;
}
String host = addr.getHostAddress();
//if (addr instanceof Inet6Address)
// host = "[" + host + "]";
return host;
}
}
}
catch(Exception e){};
return "";
}
public static String getLocalIpAddress() {
String availableIp = null;
Enumeration<NetworkInterface> interfaces = null;
try {
//the WiFi network interface will be one of these.
interfaces = NetworkInterface.getNetworkInterfaces();
} catch (Exception e) {
e.printStackTrace();
return null;
}
while (interfaces.hasMoreElements()) {
NetworkInterface iface = interfaces.nextElement();
//since each interface could have many InetAddresses...
for (InetAddress inetAddress : Collections.list(iface.getInetAddresses())) {
if (inetAddress == null)
continue;
if (isUsableAddress(inetAddress)) {
availableIp = inetAddress.getHostAddress();
}
}
}
return availableIp;
}
////////////////////////////////////////////////
// isIPv?Address
////////////////////////////////////////////////
public final static boolean isIPv6Address(String host)
{
try {
InetAddress addr = InetAddress.getByName(host);
if (addr instanceof Inet6Address)
return true;
return false;
}
catch (Exception e) {}
return false;
}
public final static boolean isIPv4Address(String host)
{
try {
InetAddress addr = InetAddress.getByName(host);
if (addr instanceof Inet4Address)
return true;
return false;
}
catch (Exception e) {}
return false;
}
////////////////////////////////////////////////
// hasIPv?Interfaces
////////////////////////////////////////////////
public final static boolean hasIPv4Addresses()
{
int addrCnt = getNHostAddresses();
for (int n=0; n<addrCnt; n++) {
String addr = getHostAddress(n);
if (isIPv4Address(addr) == true)
return true;
}
return false;
}
public final static boolean hasIPv6Addresses()
{
int addrCnt = getNHostAddresses();
for (int n=0; n<addrCnt; n++) {
String addr = getHostAddress(n);
if (isIPv6Address(addr) == true)
return true;
}
return false;
}
////////////////////////////////////////////////
// hasIPv?Interfaces
////////////////////////////////////////////////
public final static String getIPv4Address()
{
int addrCnt = getNHostAddresses();
for (int n=0; n<addrCnt; n++) {
String addr = getHostAddress(n);
if (isIPv4Address(addr) == true)
return addr;
}
return "";
}
public final static String getIPv6Address()
{
int addrCnt = getNHostAddresses();
for (int n=0; n<addrCnt; n++) {
String addr = getHostAddress(n);
if (isIPv6Address(addr) == true)
return addr;
}
return "";
}
////////////////////////////////////////////////
// getHostURL
////////////////////////////////////////////////
public final static String getHostURL(String host, int port, String uri)
{
String hostAddr = host;
if (isIPv6Address(host) == true)
hostAddr = "[" + host + "]";
return
"http://" +
hostAddr +
":" + Integer.toString(port) +
uri;
}
}
| [
"root@james026-ThinkPad-T420.(none)"
] | root@james026-ThinkPad-T420.(none) |
ba066487f37c570be346e9d724847a2c6322fc98 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/JetBrains--intellij-community/3a9990ed4745c20ace636889dc886e8ebf96ef29/before/DomUtil.java | 6e1ccf8b94e33f73d7ce34c60d39c3033648cb06 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,658 | java | /*
* Copyright (c) 2005 Your Corporation. All Rights Reserved.
*/
package com.intellij.util.xml;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.xml.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ReflectionCache;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ConcurrentFactoryMap;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xml.reflect.DomAttributeChildDescription;
import com.intellij.util.xml.reflect.DomCollectionChildDescription;
import com.intellij.util.xml.reflect.DomFixedChildDescription;
import com.intellij.util.xml.reflect.DomGenericInfo;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.*;
/**
* @author peter
*/
public class DomUtil {
public static final TypeVariable<Class<GenericValue>> GENERIC_VALUE_TYPE_VARIABLE = ReflectionCache.getTypeParameters(GenericValue.class)[0];
private static final Class<Void> DUMMY = void.class;
private static final ConcurrentFactoryMap<Type, Class> ourTypeParameters = new ConcurrentFactoryMap<Type, Class>() {
@NotNull
protected Class create(final Type key) {
final Class<?> result = ReflectionUtil.substituteGenericType(GENERIC_VALUE_TYPE_VARIABLE, key);
return result == null ? DUMMY : result;
}
};
private DomUtil() {
}
public static Class extractParameterClassFromGenericType(Type type) {
return getGenericValueParameter(type);
}
public static boolean isGenericValueType(Type type) {
return getGenericValueParameter(type) != null;
}
@Nullable
public static <T extends DomElement> T findByName(@NotNull Collection<T> list, @NonNls @NotNull String name) {
for (T element: list) {
String elementName = element.getGenericInfo().getElementName(element);
if (elementName != null && elementName.equals(name)) {
return element;
}
}
return null;
}
@NotNull
public static String[] getElementNames(@NotNull Collection<? extends DomElement> list) {
ArrayList<String> result = new ArrayList<String>(list.size());
if (list.size() > 0) {
for (DomElement element: list) {
String name = element.getGenericInfo().getElementName(element);
if (name != null) {
result.add(name);
}
}
}
return ArrayUtil.toStringArray(result);
}
@NotNull
public static List<XmlTag> getElementTags(@NotNull Collection<? extends DomElement> list) {
ArrayList<XmlTag> result = new ArrayList<XmlTag>(list.size());
for (DomElement element: list) {
XmlTag tag = element.getXmlTag();
if (tag != null) {
result.add(tag);
}
}
return result;
}
@NotNull
public static XmlTag[] getElementTags(@NotNull DomElement[] list) {
XmlTag[] result = new XmlTag[list.length];
int i = 0;
for (DomElement element: list) {
XmlTag tag = element.getXmlTag();
if (tag != null) {
result[i++] = tag;
}
}
return result;
}
@Nullable
public static List<JavaMethod> getFixedPath(DomElement element) {
assert element.isValid();
final LinkedList<JavaMethod> methods = new LinkedList<JavaMethod>();
while (true) {
final DomElement parent = element.getParent();
if (parent instanceof DomFileElement) {
break;
}
final JavaMethod method = getGetterMethod(element, parent);
if (method == null) {
return null;
}
methods.addFirst(method);
element = element.getParent();
}
return methods;
}
@Nullable
private static JavaMethod getGetterMethod(final DomElement element, final DomElement parent) {
final String xmlElementName = element.getXmlElementName();
final String namespace = element.getXmlElementNamespaceKey();
final DomGenericInfo genericInfo = parent.getGenericInfo();
if (element instanceof GenericAttributeValue) {
final DomAttributeChildDescription description = genericInfo.getAttributeChildDescription(xmlElementName, namespace);
assert description != null;
return description.getGetterMethod();
}
final DomFixedChildDescription description = genericInfo.getFixedChildDescription(xmlElementName, namespace);
return description != null ? description.getGetterMethod(description.getValues(parent).indexOf(element)) : null;
}
@Nullable
public static Class getGenericValueParameter(Type type) {
final Class aClass = ourTypeParameters.get(type);
return aClass == DUMMY ? null : aClass;
}
@Nullable
public static XmlElement getValueElement(GenericDomValue domValue) {
if (domValue instanceof GenericAttributeValue) {
final GenericAttributeValue value = (GenericAttributeValue)domValue;
final XmlAttributeValue attributeValue = value.getXmlAttributeValue();
return attributeValue == null ? value.getXmlAttribute() : attributeValue;
} else {
return domValue.getXmlTag();
}
}
public static List<? extends DomElement> getIdentitySiblings(DomElement element) {
final Method nameValueMethod = ElementPresentationManager.findNameValueMethod(element.getClass());
if (nameValueMethod != null) {
final NameValue nameValue = DomReflectionUtil.findAnnotationDFS(nameValueMethod, NameValue.class);
if (nameValue == null || nameValue.unique()) {
final String stringValue = ElementPresentationManager.getElementName(element);
if (stringValue != null) {
final DomElement parent = element.getManager().getIdentityScope(element);
final DomGenericInfo domGenericInfo = parent.getGenericInfo();
final String tagName = element.getXmlElementName();
final DomCollectionChildDescription childDescription = domGenericInfo.getCollectionChildDescription(tagName, element.getXmlElementNamespaceKey());
if (childDescription != null) {
final ArrayList<DomElement> list = new ArrayList<DomElement>(childDescription.getValues(parent));
list.remove(element);
return list;
}
}
}
}
return Collections.emptyList();
}
public static <T> List<T> getChildrenOfType(@NotNull final DomElement parent, final Class<T> type) {
final List<T> result = new SmartList<T>();
parent.acceptChildren(new DomElementVisitor() {
public void visitDomElement(final DomElement element) {
if (type.isInstance(element)) {
result.add((T)element);
}
}
});
return result;
}
public static List<DomElement> getDefinedChildren(@NotNull final DomElement parent, final boolean tags, final boolean attributes) {
if (parent instanceof MergedObject) {
final SmartList<DomElement> result = new SmartList<DomElement>();
parent.acceptChildren(new DomElementVisitor() {
public void visitDomElement(final DomElement element) {
if (DomUtil.hasXml(element)) {
result.add(element);
}
}
});
return result;
}
ProgressManager.getInstance().checkCanceled();
if (parent instanceof GenericAttributeValue) return Collections.emptyList();
if (parent instanceof DomFileElement) {
final DomFileElement element = (DomFileElement)parent;
return tags ? Arrays.asList(element.getRootElement()) : Collections.<DomElement>emptyList();
}
final XmlElement xmlElement = parent.getXmlElement();
if (xmlElement instanceof XmlTag) {
XmlTag tag = (XmlTag) xmlElement;
final DomManager domManager = parent.getManager();
final SmartList<DomElement> result = new SmartList<DomElement>();
if (attributes) {
for (final XmlAttribute attribute : tag.getAttributes()) {
ContainerUtil.addIfNotNull(domManager.getDomElement(attribute), result);
}
}
if (tags) {
for (final XmlTag subTag : tag.getSubTags()) {
ContainerUtil.addIfNotNull(domManager.getDomElement(subTag), result);
}
}
return result;
}
return Collections.emptyList();
}
public static <T> List<T> getDefinedChildrenOfType(@NotNull final DomElement parent, final Class<T> type, boolean tags, boolean attributes) {
return ContainerUtil.findAll(getDefinedChildren(parent, tags, attributes), type);
}
public static <T> List<T> getDefinedChildrenOfType(@NotNull final DomElement parent, final Class<T> type) {
return getDefinedChildrenOfType(parent, type, true, true);
}
@Nullable
public static DomElement findDuplicateNamedValue(DomElement element, String newName) {
return ElementPresentationManager.findByName(getIdentitySiblings(element), newName);
}
public static boolean isAncestor(@NotNull DomElement ancestor, @NotNull DomElement descendant, boolean strict) {
if (!strict && ancestor.equals(descendant)) return true;
final DomElement parent = descendant.getParent();
return parent != null && isAncestor(ancestor, parent, false);
}
public static void acceptAvailableChildren(final DomElement element, final DomElementVisitor visitor) {
final XmlTag tag = element.getXmlTag();
if (tag != null) {
for (XmlTag xmlTag : tag.getSubTags()) {
final DomElement childElement = element.getManager().getDomElement(xmlTag);
if (childElement != null) {
childElement.accept(visitor);
}
}
}
}
public static Collection<Class> getAllInterfaces(final Class aClass, final Collection<Class> result) {
final Class[] interfaces = ReflectionCache.getInterfaces(aClass);
result.addAll(Arrays.asList(interfaces));
if (aClass.getSuperclass() != null) {
getAllInterfaces(aClass.getSuperclass(), result);
}
for (Class anInterface : interfaces) {
getAllInterfaces(anInterface, result);
}
return result;
}
@Nullable
public static <T> T getParentOfType(final DomElement element, final Class<T> requiredClass, final boolean strict) {
for (DomElement curElement = strict && element != null? element.getParent() : element;
curElement != null;
curElement = curElement.getParent()) {
if (requiredClass.isInstance(curElement)) {
return (T)curElement;
}
}
return null;
}
@Nullable
public static <T> T getContextElement(@Nullable final Editor editor, Class<T> clazz) {
final DomElement element = getContextElement(editor);
return getParentOfType(element, clazz, false);
}
@Nullable
public static DomElement getContextElement(@Nullable final Editor editor) {
if(editor == null) return null;
final Project project = editor.getProject();
if (project == null) return null;
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (!(file instanceof XmlFile)) {
return null;
}
return getDomElement(file.findElementAt(editor.getCaretModel().getOffset()));
}
@Nullable
public static DomElement getDomElement(final Editor editor, final PsiFile file) {
return getDomElement(file.findElementAt(editor.getCaretModel().getOffset()));
}
@Nullable
public static DomElement getDomElement(@Nullable final PsiElement element) {
if (element == null) return null;
final Project project = element.getProject();
final DomManager domManager = DomManager.getDomManager(project);
final XmlAttribute attr = PsiTreeUtil.getParentOfType(element, XmlAttribute.class, false);
if (attr != null) {
final GenericAttributeValue value = domManager.getDomElement(attr);
if (value != null) return value;
}
XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false);
while (tag != null) {
final DomElement domElement = domManager.getDomElement(tag);
if(domElement != null) return domElement;
tag = tag.getParentTag();
}
return null;
}
@NotNull
public static <T extends DomElement> T getOriginalElement(@NotNull final T domElement) {
final XmlElement psiElement = domElement.getXmlElement();
if (psiElement == null) return domElement;
final PsiFile psiFile = psiElement.getContainingFile().getOriginalFile();
final TextRange range = psiElement.getTextRange();
final PsiElement element = psiFile.findElementAt(range.getStartOffset());
final int maxLength = range.getLength();
final boolean isAttribute = psiElement instanceof XmlAttribute;
final Class<? extends XmlElement> clazz = isAttribute ? XmlAttribute.class : XmlTag.class;
final DomManager domManager = domElement.getManager();
DomElement current = null;
for (XmlElement next = PsiTreeUtil.getParentOfType(element, clazz, false);
next != null && next.getTextLength() <= maxLength;
next = PsiTreeUtil.getParentOfType(next, clazz, true)) {
current = isAttribute? domManager.getDomElement((XmlAttribute)next) : domManager.getDomElement((XmlTag)next);
if (current != null && domElement.getClass() != current.getClass()) current = null;
}
return (T)current;
}
public static <T extends DomElement> T addElementAfter(@NotNull final T anchor) {
final DomElement parent = anchor.getParent();
final DomCollectionChildDescription childDescription = (DomCollectionChildDescription)anchor.getChildDescription();
assert parent != null;
final List<? extends DomElement> list = childDescription.getValues(parent);
final int i = list.indexOf(anchor);
assert i >= 0;
return (T)childDescription.addValue(parent, i + 1);
}
@Nullable
public static <T extends DomElement> T findDomElement(@Nullable final PsiElement element, final Class<T> beanClass) {
if (element == null) return null;
XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
DomElement domElement;
while (tag != null) {
domElement = DomManager.getDomManager(tag.getProject()).getDomElement(tag);
if (domElement != null) {
return domElement.getParentOfType(beanClass, false);
}
tag = tag.getParentTag();
}
return null;
}
public static <T extends DomElement> DomFileElement<T> getFileElement(@NotNull DomElement element) {
final DomElement root = getRoot(element);
return root instanceof DomFileElement ? (DomFileElement<T>)root : null;
}
@NotNull
public static XmlFile getFile(@NotNull DomElement element) {
return DomService.getInstance().getContainingFile(element);
}
/**
* @param domElement DomElement to search root of
* @return the topmost valid DomElement being a parent of the given one. May be and may be not DomFileElement.
* If root tag has changed, file may lose its domness, so there will be no DomFileElement, but the inner DomElement's
* will be still alive because the underlying XML tags are valid
*/
@NotNull
public static DomElement getRoot(@NotNull DomElement domElement) {
while (true) {
final DomElement parent = domElement.getParent();
if (parent == null) {
return domElement;
}
domElement = parent;
}
}
public static boolean hasXml(@NotNull DomElement element) {
return element.getXmlElement() != null;
}
} | [
"[email protected]"
] | |
0ac4365a0efc262215604d716b5ef081b950d689 | dde804bed2655d40ce4cf4fb65701e652415b7d1 | /ebaysdkcore/src/main/java/com/ebay/soap/eBLBaseComponents/ShippingCarrierCodeType.java | 4aea5537ab27b36a9777bf24ca283b7522e25c3e | [] | no_license | mamthal/getItemJava | ceccf4a8bab67bab5e9e8a37d60af095f847de44 | d7a1bcc8c7a1f72728973c799973e86c435a6047 | refs/heads/master | 2016-09-05T23:39:46.495096 | 2014-04-21T18:19:21 | 2014-04-21T18:19:21 | 19,001,704 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,122 | java |
package com.ebay.soap.eBLBaseComponents;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ShippingCarrierCodeType.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="ShippingCarrierCodeType">
* <restriction base="{http://www.w3.org/2001/XMLSchema}token">
* <enumeration value="UPS"/>
* <enumeration value="USPS"/>
* <enumeration value="FedEx"/>
* <enumeration value="DeutschePost"/>
* <enumeration value="DHL"/>
* <enumeration value="Hermes"/>
* <enumeration value="iLoxx"/>
* <enumeration value="Other"/>
* <enumeration value="ColiposteDomestic"/>
* <enumeration value="ColiposteInternational"/>
* <enumeration value="Chronopost"/>
* <enumeration value="Correos"/>
* <enumeration value="Seur"/>
* <enumeration value="Nacex"/>
* <enumeration value="GlobalShipping_MultiCarrier"/>
* <enumeration value="CustomCode"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "ShippingCarrierCodeType")
@XmlEnum
public enum ShippingCarrierCodeType {
/**
*
* United Parcel Service.
* <br><br>
* For UPS Mail Innovations (for CompleteSale call requests only),
* specify the value UPS-MI.
*
*
*/
UPS("UPS"),
/**
*
* U.S. Postal Service.
*
*
*/
USPS("USPS"),
/**
*
* Fedex
* For FedEx SmartPost (for CompleteSale call requests only),
* specify the value FedEx.
*
*
*/
@XmlEnumValue("FedEx")
FED_EX("FedEx"),
/**
*
* Deutsche Post.
*
*
*/
@XmlEnumValue("DeutschePost")
DEUTSCHE_POST("DeutschePost"),
/**
*
* DHL service
*
*
*/
DHL("DHL"),
/**
*
* Hermes
*
*
*/
@XmlEnumValue("Hermes")
HERMES("Hermes"),
/**
*
* iLoxx
*
*
*/
@XmlEnumValue("iLoxx")
I_LOXX("iLoxx"),
/**
*
* Other postal service
*
*
*/
@XmlEnumValue("Other")
OTHER("Other"),
/**
*
* Coliposte Domestic
*
*
*/
@XmlEnumValue("ColiposteDomestic")
COLIPOSTE_DOMESTIC("ColiposteDomestic"),
/**
*
* Coliposte International
*
*
*/
@XmlEnumValue("ColiposteInternational")
COLIPOSTE_INTERNATIONAL("ColiposteInternational"),
/**
*
* Chronopost
*
*
*/
@XmlEnumValue("Chronopost")
CHRONOPOST("Chronopost"),
/**
*
* Correos
*
*
*/
@XmlEnumValue("Correos")
CORREOS("Correos"),
/**
*
* Seur (reserved for future use)
*
*
*/
@XmlEnumValue("Seur")
SEUR("Seur"),
/**
*
* Nacex
*
*
*/
@XmlEnumValue("Nacex")
NACEX("Nacex"),
/**
*
* The Global Shipping Program's international shipping provider.
*
*
*/
@XmlEnumValue("GlobalShipping_MultiCarrier")
GLOBAL_SHIPPING_MULTI_CARRIER("GlobalShipping_MultiCarrier"),
/**
*
* Reserved for internal or future use
*
*
*/
@XmlEnumValue("CustomCode")
CUSTOM_CODE("CustomCode");
private final String value;
ShippingCarrierCodeType(String v) {
value = v;
}
public String value() {
return value;
}
public static ShippingCarrierCodeType fromValue(String v) {
for (ShippingCarrierCodeType c: ShippingCarrierCodeType.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"mamtha@mamtha-Dell.(none)"
] | mamtha@mamtha-Dell.(none) |
3220b27008a92713e74ec8d5e0f4f7a4467cb8c9 | 8c9e499552ba46d9902bec570671eb713bf78a21 | /src/main/java/com/gymdsadatametrics/repository/search/package-info.java | 9047aa829f948cfaa228586c869f23c84a7624ea | [] | no_license | RAVIKUMAR-GUJJULA/GymDSADataMetrics | 426e4129710fcd3229d91e95bc94674cb62fe9ec | 3b201a78ee0baed509c6932aaa3c0ee3218a48e9 | refs/heads/master | 2022-12-23T04:42:29.826908 | 2019-08-26T07:15:52 | 2019-08-26T07:15:52 | 204,420,309 | 1 | 0 | null | 2022-12-16T04:53:16 | 2019-08-26T07:27:07 | Java | UTF-8 | Java | false | false | 100 | java | /**
* Spring Data Elasticsearch repositories.
*/
package com.gymdsadatametrics.repository.search;
| [
"[email protected]"
] | |
3b9b857c72c899dfcecbaa925054da7734ea8952 | 38e7e5e5e8d9d2196911f60847e3b3ac035c8cad | /buyer/tpp_buyer/src/main/java/com/tianpingpai/buyer/ui/MakeCommentViewController.java | 6da8fa2fc96160bc6d50947f69a168147993b3c4 | [] | no_license | RogerLwr/TPP | 7173fa82ee551311b10c5c74906cb101730d6222 | 8c568bc71f33bca6fb32cc465db5e621a93d9e6d | refs/heads/master | 2021-06-30T02:22:56.796460 | 2017-09-16T06:28:40 | 2017-09-16T06:28:40 | 103,729,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,798 | java | package com.tianpingpai.buyer.ui;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import com.brother.tpp.net.URLUtil;
import com.tianpingpai.buyer.R;
import com.tianpingpai.buyer.manager.UserManager;
import com.tianpingpai.buyer.model.URLApi;
import com.tianpingpai.buyer.model.UserModel;
import com.tianpingpai.core.ContextProvider;
import com.tianpingpai.core.ModelEvent;
import com.tianpingpai.http.HttpRequest;
import com.tianpingpai.http.volley.VolleyDispatcher;
import com.tianpingpai.manager.OrderManager;
import com.tianpingpai.model.Model;
import com.tianpingpai.model.OrderModel;
import com.tianpingpai.parser.GenericModelParser;
import com.tianpingpai.parser.ModelResult;
import com.tianpingpai.ui.ActionBar;
import com.tianpingpai.ui.BaseViewController;
import com.tianpingpai.ui.Binder;
import com.tianpingpai.ui.Binding;
import com.tianpingpai.ui.CommonErrorHandler;
import com.tianpingpai.ui.ContainerActivity;
import com.tianpingpai.ui.Layout;
import com.tianpingpai.ui.OnClick;
import com.tianpingpai.ui.Statistics;
@SuppressWarnings("unused")
@Statistics(page = "评价")
@ActionBar(title = "评价")
@Layout(id = R.layout.ui_make_comment)
public class MakeCommentViewController extends BaseViewController {
public static final String KEY_ORDER_ID = "key.orderID";
public static final String KEY_SELLER_ID = "key.sellerID";
public static final String KEY_STORE_NAME = "key.storeName";
@Binding(id = R.id.store_name_text_view)
private TextView storeNameTextView;
@Binding(id = R.id.quality_rating_bar)
private RatingBar qualityRatingBar;
@Binding(id = R.id.quality_text_view)
private TextView qualityTextView;
@Binding(id = R.id.deliver_speed_rating_bar)
private RatingBar deliverSpeedRatingBar;
@Binding(id = R.id.deliver_speed_text_view)
private TextView deliverSpeedTextView;
@Binding(id = R.id.service_rating_bar)
private RatingBar serviceRatingBar;
@Binding(id = R.id.service_text_view)
private TextView serviceTextView;
@Binding(id = R.id.comment_edit_text)
private EditText commentEditText;
@Binding(id = R.id.checkbox_button)
private ImageView checkboxButton;
private Binder binder = new Binder();
private long orderId;
private String sellerId;
private String storeName;
@Override
public void onActivityCreated(Activity a) {
super.onActivityCreated(a);
orderId = a.getIntent().getLongExtra(KEY_ORDER_ID, -1);
sellerId = a.getIntent().getStringExtra(KEY_SELLER_ID);
storeName = a.getIntent().getStringExtra(KEY_STORE_NAME);
}
@Override
protected void onConfigureView(View rootView) {
super.onConfigureView(rootView);
binder.bindView(this, rootView);
storeNameTextView.setText(storeName);
qualityRatingBar.setOnRatingBarChangeListener(new RatingChangeListener(qualityTextView));
deliverSpeedRatingBar.setOnRatingBarChangeListener(new RatingChangeListener(deliverSpeedTextView));
serviceRatingBar.setOnRatingBarChangeListener(new RatingChangeListener(serviceTextView));
qualityRatingBar.setRating(0);
deliverSpeedRatingBar.setRating(0);
serviceRatingBar.setRating(0);
showContent();
}
@OnClick(R.id.submit_button)
private View.OnClickListener submitButtonListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
UserModel user = UserManager.getInstance().getCurrentUser();
if (user == null){
return;
}
String content = commentEditText.getText().toString().trim();
// if(TextUtils.isEmpty(content)){
// Toast.makeText(ContextProvider.getContext(),"评价内容不能为空!",Toast.LENGTH_SHORT).show();
// return;
// }
int quality = (int)qualityRatingBar.getRating()*2;
int deliver = (int)deliverSpeedRatingBar.getRating()*2;
int service = (int)serviceRatingBar.getRating()*2;
if(quality < 1 ){
Toast.makeText(ContextProvider.getContext(),"请给商品质量打分",Toast.LENGTH_SHORT).show();
return;
}
if(deliver < 1 ){
Toast.makeText(ContextProvider.getContext(),"请给发货速度打分",Toast.LENGTH_SHORT).show();
return;
}
if(service < 1 ){
Toast.makeText(ContextProvider.getContext(),"请给服务态度打分",Toast.LENGTH_SHORT).show();
return;
}
HttpRequest<ModelResult<Model>> req = new HttpRequest<>(URLUtil.ADD_COMMENT_URL,submitListener);
req.setMethod(HttpRequest.POST);
req.addParam("saler_id", String.valueOf(sellerId));
req.addParam("user_id", user.getUserID());//TODO
req.addParam("order_id", String.valueOf(orderId));
req.addParam("content", content);
req.addParam("speed", String.valueOf(deliver));
req.addParam("service", String.valueOf(service));
req.addParam("quality", String.valueOf(quality));
req.addParam("anonymous",String.valueOf(anonymous));
req.setErrorListener(new CommonErrorHandler(MakeCommentViewController.this));
req.setParser(new GenericModelParser());
VolleyDispatcher.getInstance().dispatch(req);
showSubmitting();
}
};
public HttpRequest.ResultListener<ModelResult<Model>> submitListener = new HttpRequest.ResultListener<ModelResult<Model>>() {
@Override
public void onResult(HttpRequest<ModelResult<Model>> request, final ModelResult<Model> data) {
hideSubmitting();
if(data.isSuccess()){
OrderModel orderModel = new OrderModel();
orderModel.setId(orderId);
OrderManager.getInstance().notifyEvent(ModelEvent.OnModelUpdate, orderModel);
Model couponModel = data.getModel();
int toWhere = couponModel.getInt("toWhere");
if(1 == toWhere){//去APP拆红包
Intent intent = new Intent(getActivity(),ContainerActivity.class);
intent.putExtra(ContainerActivity.KEY_CONTENT, GetCouponViewController.class);
Bundle bundle = new Bundle();
bundle.putParcelable("couponData",couponModel);
intent.putExtras(bundle);
getActivity().startActivity(intent);
getActivity().finish();
}else if(2 == toWhere){//去网页拆红包
UserModel userModel = UserManager.getInstance().getCurrentUser();
Intent intent = new Intent(getActivity(),ContainerActivity.class);
intent.putExtra(ContainerActivity.KEY_CONTENT,WebViewController.class);
String couponUrl = URLApi.getBaseUrl()+"/apply/bonus/coupon?order_id="+orderId;
intent.putExtra(WebViewController.KEY_URL,couponUrl);
getActivity().startActivity(intent);
getActivity().finish();
}
}else{
Toast.makeText(ContextProvider.getContext(), data.getDesc(), Toast.LENGTH_SHORT).show();
}
}
};
private class RatingChangeListener implements RatingBar.OnRatingBarChangeListener{
private TextView textView;
RatingChangeListener(TextView tv){
this.textView = tv;
}
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean b) {
if(rating <= 3.0){
textView.setText("差评");
}else if( rating == 4.0 ){
textView.setText("中评");
}else if( rating >= 4.0 ){
textView.setText("好评");
}
}
}
boolean isCheck = true;
private int anonymous = 2;
@OnClick(R.id.checkbox_button)
private View.OnClickListener checkboxButtonOnClick = new View.OnClickListener(){
@Override
public void onClick(View view) {
if(isCheck){
checkboxButton.setImageResource(R.drawable.checkbox_unchecked);
isCheck = false;
anonymous = 1;
}else {
checkboxButton.setImageResource(R.drawable.checkbox_checked);
anonymous = 2;
isCheck = true;
}
}
};
}
| [
"[email protected]"
] | |
c003f0e156523a37c4ff5599e3a2b3b227c00f39 | 64a3b1c571c8c3afa12a57588aaacddddc878061 | /src/main/java/ru/vorobyoff/recipeapp/domain/Category.java | d384e398daff50533a63147bca8f33db75ff02ad | [] | no_license | vorobyoff/recipe-app | 32c4500f00026c6503b325a727270a3d7fedcdeb | 26b5e6b79ae8ea334c7ea96c0f462c07f597115b | refs/heads/master | 2023-06-24T03:13:59.733470 | 2021-07-27T12:56:13 | 2021-07-27T12:56:13 | 379,243,123 | 0 | 0 | null | 2021-07-08T10:34:20 | 2021-06-22T11:21:46 | Java | UTF-8 | Java | false | false | 832 | java | package ru.vorobyoff.recipeapp.domain;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import java.util.HashSet;
import java.util.Set;
import static java.util.Objects.isNull;
import static lombok.AccessLevel.PROTECTED;
@Entity
@Getter
@Setter
@NoArgsConstructor(onConstructor_ = @Deprecated, access = PROTECTED)
public final class Category extends BaseEntity {
private String description;
@ManyToMany(mappedBy = "categories")
private Set<Recipe> recipes;
@Builder
public Category(final Long id, final String description, final Set<Recipe> recipes) {
super(id);
this.description = description;
this.recipes = isNull(recipes) ? new HashSet<>() : recipes;
}
} | [
""
] | |
5a6dcefc9c797c72fcc1724e1efa794b02f9066f | b69545c294112af57941bbfde18511d91b3b777e | /lib/third_party/json/test/Salary.java | 6348e702931e4d238fbda24f75bfecda2b4e0ec1 | [] | no_license | abayer/commoncrawl | 16859dd10972ebafa9347446bc02c9df243debf6 | 0eaa3db8ad61c8db2058b843ee3e895698f0e2ff | refs/heads/master | 2021-01-23T07:02:35.513571 | 2010-12-30T20:47:00 | 2010-12-30T20:47:00 | 1,209,359 | 4 | 3 | null | 2023-03-20T11:51:30 | 2010-12-30T20:22:21 | Java | UTF-8 | Java | false | false | 285 | java | package test;
public class Salary {
int basicPay = -1;
public Salary(int basicPay) {
this.basicPay = basicPay;
}
public int getBasicPay() {
return basicPay;
}
public void setBasicPay(int basicPay) {
this.basicPay = basicPay;
}
}
| [
"[email protected]"
] | |
79e623433ad1cda6514be35bf1538e6cf7583840 | c9e7f38cf8804242db7e1d1a82fbb6358258f5b7 | /src/finalExamModule2/models/employee/PositionChoice.java | 4770ee8c9e668d350cca6d3ccbb9b083dceda82a | [] | no_license | nhatlinh8816/C0421G1_DangNhatLinh_Module2 | d719ddd884801b9a1a4d989e185a7dc7a2f89eb8 | 467b0b10beacc138cb2ba733c324dce0aaebfd39 | refs/heads/master | 2023-06-17T20:41:22.892090 | 2021-07-13T18:04:23 | 2021-07-13T18:04:23 | 372,868,114 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | java | package finalExamModule2.models.employee;
import finalExamModule2.utils.CheckChoice;
public class PositionChoice {
public String positionChoicee() {
String a = null;
boolean check = true;
while (check) {
System.out.println(" 1: le tan \n 2: phucvu \n 3:chuyen vien \n 4:giam sat \n 5: quan ly \n 6: giam doc");
System.out.println("chon chuc vu");
int choice = new CheckChoice().choice();
switch (choice) {
case 1: {
a = "Lễ tân";
check = false;
break;
}
case 2: {
a = "phục vụ";
check = false;
break;
}
case 3: {
a = "chuyên viên";
check = false;
break;
}
case 4: {
a = "giám sát";
check = false;
break;
}
case 5: {
a = "quản lý";
check = false;
break;
}
case 6: {
a = "giám đốc";
check = false;
break;
}
default:
break;
}
}
return a;
}
}
| [
"[email protected]"
] | |
115f10801177ec14f5791e4ee9f74de883756dfc | ad7df15f5dfc38f6bb0fce29822c7b9280529ec5 | /pendotiba-logic-bus/src/main/java/br/com/logic/pendotiba/logicbus/controller/MotivoPuloViagemController.java | b17b2d5d049aa9241319e02d199c83e078c174e9 | [] | no_license | rafael-queiroz/pendotiba_2 | 335b1ddba54ba516d9b95019dbbabbec087a01c3 | 54d48c5918ca9ce2faeb7904b70a2b59b47633af | refs/heads/master | 2022-07-20T08:13:58.741730 | 2020-03-15T20:58:16 | 2020-03-15T20:58:16 | 247,506,832 | 0 | 0 | null | 2022-06-29T18:01:12 | 2020-03-15T16:36:51 | JavaScript | UTF-8 | Java | false | false | 3,032 | java | package br.com.logic.pendotiba.logicbus.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import br.com.logic.pendotiba.core.model.MotivoPuloViagem;
import br.com.logic.pendotiba.core.repository.MotivoPuloViagemRepository;
import br.com.logic.pendotiba.logicbus.service.MotivoPuloViagemService;
import br.com.logic.pendotiba.logicbus.service.exception.ImpossivelExcluirEntidadeException;
import br.com.logic.pendotiba.logicbus.service.exception.NegocioException;
@Controller
@RequestMapping("/motivo-pulo-viagem")
public class MotivoPuloViagemController {
@Autowired
MotivoPuloViagemRepository motivoPuloViagemRepository;
@Autowired
MotivoPuloViagemService motivoPuloViagemService;
@GetMapping
public ModelAndView consultar() {
ModelAndView mv = new ModelAndView("motivo-pulo-viagem/ConsultaMotivoPuloViagem");
mv.addObject("motivosPuloViagem", motivoPuloViagemRepository.findAll());
return mv;
}
@GetMapping("/novo")
public ModelAndView prepararCadastrar(MotivoPuloViagem motivoPuloViagem) {
ModelAndView mv = new ModelAndView("motivo-pulo-viagem/CadastroMotivoPuloViagem");
return mv;
}
@PostMapping({"/novo", "{\\+d}"})
public ModelAndView salvar(@Valid MotivoPuloViagem motivoPuloViagem, BindingResult result, Model model, RedirectAttributes attributes) {
if (result.hasErrors())
return prepararCadastrar(motivoPuloViagem);
try {
motivoPuloViagemService.salvar(motivoPuloViagem);
} catch (NegocioException e) {
model.addAttribute("erro", e.getMessage());
return prepararCadastrar(motivoPuloViagem);
}
attributes.addFlashAttribute("mensagem", "Motivo salvo com sucesso!");
return new ModelAndView("redirect:/motivo-pulo-viagem/novo");
}
@GetMapping("/{id}")
public ModelAndView prepararAlterar(@PathVariable("id") MotivoPuloViagem motivoPuloViagem) {
ModelAndView mv = prepararCadastrar(motivoPuloViagem);
mv.addObject(motivoPuloViagem);
return mv;
}
@DeleteMapping("/{id}")
public @ResponseBody ResponseEntity<?> excluir(@PathVariable("id") MotivoPuloViagem motivoPuloViagem) {
try {
motivoPuloViagemService.excluir(motivoPuloViagem);
} catch (ImpossivelExcluirEntidadeException e) {
return ResponseEntity.badRequest().body(e.getMessage());
}
return ResponseEntity.ok().build();
}
}
| [
"[email protected]"
] | |
141c913ea3ba55f64a5787ac8abd2514d1cc7ea5 | 2d6a41e18d5f35b8a7c9fbc3b91d64b118b363b9 | /Java/Trabalho2/Teste.java | 18a7d1f4d8b7152fa2971377a78d6ebb073c0667 | [] | no_license | ChristianSF/POO | d6d44701f9aa958c5e387cd5c57bd4cd02820a9b | b2326b7658e982b4c096ed8ab883d1f72c03c8a0 | refs/heads/main | 2023-05-14T01:23:03.953649 | 2021-06-06T20:03:57 | 2021-06-06T20:03:57 | 312,105,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,251 | java | package Trabalho;
import java.util.Scanner;
public class Teste {
public static void main(String args[]) {
Sistema sistema = new Sistema();
Motorista motorista_teste = new Motorista("aaaa", "bbbb", "77", "c", "75", 4);
sistema.InsereMotorista(motorista_teste);
Automovel automovel_teste = new Automovel("ford", "sei lá", "5");
sistema.InsereVeiculo(automovel_teste);
Multa multa_teste = new Multa("Alcool", 100, "SP", 15, "77", "sei lá");
sistema.InsereMulta(multa_teste);
Scanner entrada = new Scanner(System.in);
while(true) {
System.out.println("\n");
System.out.println("-------Menu-------");
System.out.println("Escolha uma das opções abaixo: ");
System.out.println("0- Sair do sistema");
System.out.println("1- Inserir Motorista");
System.out.println("2- Listar motoristas");
System.out.println("3- Inserir Veiculo");
System.out.println("4- Listar veiculos");
System.out.println("5- Inserir multas");
System.out.println("6- Listar multas");
System.out.println("Digite a opção: ");
int a = entrada.nextInt();
if(a == 0) {
System.out.println("Saindo do sistema");
break;
}
else if(a == 1) {
System.out.println("Digite o nome do motorista: ");
String nome = entrada.next();
System.out.println("Digite o sobrenome: ");
String sobrenome = entrada.next();
System.out.println("Digite o Id do motorista: ");
String id = entrada.next();
System.out.println("Digite a categoria da cnh: ");
String categoria_cnh = entrada.next();
System.out.println("Digite a data de nascimento: ");
String data_nascimento = entrada.next();
System.out.println("Digite o número de telefone: ");
int num_telefone = entrada.nextInt();
Motorista motorista = new Motorista(nome, sobrenome, id, categoria_cnh, data_nascimento, num_telefone);
sistema.InsereMotorista(motorista);
System.out.println("Motorista cadastrado com sucesso!");
System.out.println("\n");
}
else if(a == 2){
System.out.println("Listando motoristas");
System.out.println("Número de motoristas cadastrados: " + sistema.TamanhoMotorista());
sistema.ImprimeMotorista();
}
else if(a == 3) {
System.out.println("Digite a categoria do veiculo (Automovel, Caminhao, Moto):");
String categoria = entrada.next();
System.out.println("Digite a placa do veiculo: ");
String placa = entrada.next();
System.out.println("Digite a marca do carro: ");
String marca = entrada.next();
System.out.println("Digite o id do motorista: ");
String id_motorista = entrada.next();
if(categoria.equalsIgnoreCase("automovel")) {
Automovel automovel = new Automovel(marca, placa, id_motorista);
sistema.InsereVeiculo(automovel);
}
}
else if(a == 4) {
System.out.println("Listando veiculos: ");
System.out.println("Número de veiculos cadastrados: "+sistema.TamanhoVeiculo());
sistema.ImprimeVeiculo();
}
else if(a == 5) {
System.out.println("Digite a categoria da multa: ");
String categoria_mu = entrada.next();
System.out.println("Digite o preço da multa: ");
float preco = entrada.nextFloat();
System.out.println("Digite o ID do motorista: ");
String id_mot = entrada.next();
System.out.println("Digite a placa do carro: ");
String placa_c = entrada.next();
System.out.println("Digite o local: ");
String local = entrada.next();
System.out.println("Digite o número de de pontos na carteira: ");
int pontos = entrada.nextInt();
Multa multa = new Multa(categoria_mu, preco, local, pontos, id_mot, placa_c);
sistema.InsereMulta(multa);
System.out.println("Multa cadastrada com sucesso!");
System.out.println("\n");
}
else if(a == 6) {
System.out.println("Listando multas: ");
System.out.println("Número de multas: " + sistema.TamanhoMulta());
sistema.ImprimeMulta();
}
}
}
}
| [
"[email protected]"
] | |
6f694ead01f6785acea10aa2d5cf15335d27fd4e | 6221262585abc29d0b7abff1c7b497f5bdf67a36 | /expdemo/src/com/part01/Demo06.java | 89fb639f7f97107980c58faf5aae79fa081b00ae | [] | no_license | Ruo-Chenx/JavaDemo | 902729b1c5a50c4a2474eb99254d247431c3370a | 99472e2f822089ddf28d9a691e4e3068ccc73069 | refs/heads/master | 2020-05-04T01:02:18.143934 | 2019-04-23T13:27:34 | 2019-04-23T13:27:34 | 178,886,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | package com.part01;
public class Demo06 {
public static void main(String[] args) {
int i=-9;
int [] aa=new int[i];
}
}
| [
"[email protected]"
] | |
66494d63783aa28f0d57dce26b7299701817cb69 | 0375dbb4ffa8c1d68d4108be695a1e42c8cbb1b2 | /app/src/test/java/org/stepic/droid/core/presenters/InstructorsPresenterTest.java | d99c8111edf752fda635764a729f3999be1fc420 | [
"Apache-2.0"
] | permissive | hkh412/stepik-android | 2b4b60f7f7ed1e84cdce096a7fc572d57a4566bd | 8dc965cbd975bf2ec64220acc78930c5a6b9a7e8 | refs/heads/master | 2020-12-02T22:12:28.859567 | 2017-06-28T09:03:17 | 2017-06-28T09:03:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,207 | java | package org.stepic.droid.core.presenters;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.stepic.droid.concurrency.MainHandler;
import org.stepic.droid.core.presenters.contracts.InstructorsView;
import org.stepic.droid.model.Course;
import org.stepic.droid.model.User;
import org.stepic.droid.test_utils.ConcurrencyUtilForTest;
import org.stepic.droid.test_utils.ResponseGeneratorKt;
import org.stepic.droid.test_utils.generators.FakeCourseGenerator;
import org.stepic.droid.test_utils.generators.FakeUserGenerator;
import org.stepic.droid.web.Api;
import org.stepic.droid.web.UserStepicResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
public class InstructorsPresenterTest {
private InstructorsPresenter instructorsPresenter;
@Mock
ThreadPoolExecutor threadPoolExecutor;
@Mock
MainHandler mainHandler;
@Mock
Api api;
@Mock
InstructorsView instructorsView;
@Before
public void beforeEachTest() throws IOException {
MockitoAnnotations.initMocks(this);
ConcurrencyUtilForTest.transformToBlockingMock(threadPoolExecutor);
ConcurrencyUtilForTest.transformToBlockingMock(mainHandler);
instructorsPresenter = new InstructorsPresenter(
threadPoolExecutor,
mainHandler,
api
);
}
@Test
public void nullCourse_hideInstructors() {
instructorsPresenter.attachView(instructorsView);
instructorsPresenter.fetchInstructors(null);
//verify
verify(threadPoolExecutor, never()).execute(any(Runnable.class)); //should be insta on main thread
verify(instructorsView).onHideInstructors();
verify(instructorsView, never()).onFailLoadInstructors();
verify(instructorsView, never()).onLoadingInstructors();
verify(instructorsView, never()).onInstructorsLoaded(any(List.class));
}
@Test
public void emptyInstructors_hideInstructors() {
Course course = FakeCourseGenerator.INSTANCE.generate(67);
course.setInstructors(new long[0]);
instructorsPresenter.attachView(instructorsView);
instructorsPresenter.fetchInstructors(course);
verify(threadPoolExecutor, never()).execute(any(Runnable.class));
verify(instructorsView).onHideInstructors();
verifyNoMoreInteractions(instructorsView);
}
@Test
public void oneInstructor_instructorsLoaded() {
//setup
Course course = FakeCourseGenerator.INSTANCE.generate(67);
long userId = 1112234;
long[] instructors = new long[1];
instructors[0] = userId;
course.setInstructors(instructors);
User instructor = FakeUserGenerator.INSTANCE.generate(userId);
List<User> instructorList = new ArrayList<>();
instructorList.add(instructor);
UserStepicResponse responseMock = mock(UserStepicResponse.class);
when(responseMock.getUsers()).thenReturn(instructorList);
ResponseGeneratorKt.useMockInsteadCall(when(api.getUsers(any(long[].class))), responseMock);
//call
instructorsPresenter.attachView(instructorsView);
instructorsPresenter.fetchInstructors(course);
//verify
verify(threadPoolExecutor, only()).execute(any(Runnable.class));
InOrder inOrder = inOrder(instructorsView);
inOrder.verify(instructorsView).onLoadingInstructors();
inOrder.verify(instructorsView).onInstructorsLoaded(instructorList);
verifyNoMoreInteractions(instructorsView);
}
@Test
public void noInternet_failInstructors() {
Course course = FakeCourseGenerator.INSTANCE.generate(67);
long userId = 1112234;
long[] instructors = new long[1];
instructors[0] = userId;
course.setInstructors(instructors);
when(api.getUsers(any(long[].class)))
.thenThrow(RuntimeException.class); //throw exception on getting from api instead of executing for simplify testing
instructorsPresenter.attachView(instructorsView);
instructorsPresenter.fetchInstructors(course);
InOrder inOrder = inOrder(instructorsView);
inOrder.verify(instructorsView).onLoadingInstructors();
inOrder.verify(instructorsView).onFailLoadInstructors();
verifyNoMoreInteractions(instructorsView);
}
@Test
public void multiplyFetchingSameCourse_showCachedData() {
Course course = FakeCourseGenerator.INSTANCE.generate(67);
long userId = 1112234;
long[] instructors = new long[1];
instructors[0] = userId;
course.setInstructors(instructors);
User instructor = FakeUserGenerator.INSTANCE.generate(userId);
List<User> instructorList = new ArrayList<>();
instructorList.add(instructor);
UserStepicResponse responseMock = mock(UserStepicResponse.class);
when(responseMock.getUsers()).thenReturn(instructorList);
ResponseGeneratorKt.useMockInsteadCall(when(api.getUsers(any(long[].class))), responseMock);
//call
int numberOfCalls = 6;
instructorsPresenter.attachView(instructorsView);
for (int i = 0; i < numberOfCalls; i++) {
instructorsPresenter.fetchInstructors(course); //assumption, that code is not async
}
//verify
verify(api, only()).getUsers(any(long[].class));
verify(threadPoolExecutor, only()).execute(any(Runnable.class));
verify(instructorsView, times(1)).onLoadingInstructors();
verify(instructorsView, times(numberOfCalls)).onInstructorsLoaded(instructorList);
}
}
| [
"[email protected]"
] | |
8ed994d6143335ff690bc9b594cee317a7d68113 | 32b5281b16770a2dc95b601ff7c05d5252c8849e | /app/src/main/java/com/geek/newmanager/mvp/ui/adapter/holder/CaseItemHolder.java | 9e578c28ac9f4cf2ea9168f3488cc16922e38045 | [
"Apache-2.0"
] | permissive | DarianLiu/welfare | a26023bffdd1dfd246a5e5fa8ce091cde9520e81 | 2ed210be6ef4dd66f95e18a352e44af90c2b4764 | refs/heads/master | 2020-05-04T10:38:18.057551 | 2019-04-02T14:20:31 | 2019-04-02T14:20:34 | 179,091,948 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,424 | java | package com.geek.newmanager.mvp.ui.adapter.holder;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import com.geek.newmanager.R;
import com.geek.newmanager.mvp.model.entity.Case;
import com.jess.arms.base.BaseHolder;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* 案件ItemHolder
* Created by LiuLi on 2018/9/8.
*/
public class CaseItemHolder extends BaseHolder<Case> {
@BindView(R.id.tv_case_time)
TextView tvCaseTime;
@BindView(R.id.tv_case_source)
TextView tvCaseSource;
@BindView(R.id.tv_case_flag)
TextView tvCaseFlag;
@BindView(R.id.tv_case_describe)
TextView tvCaseDescribe;
@BindView(R.id.tv_case_address)
TextView tvCaseAddress;
public CaseItemHolder(View itemView) {
super(itemView);
ButterKnife.bind(itemView);
}
@Override
public void setData(Case data, int position) {
tvCaseTime.setText(TextUtils.isEmpty(data.getAcceptDate()) ? "" : data.getAcceptDate());
tvCaseSource.setText(TextUtils.isEmpty(data.getSource()) ? "" : data.getSource());
tvCaseFlag.setText(TextUtils.isEmpty(data.getCaseCode()) ? "暂无" : data.getCaseCode());
tvCaseDescribe.setText(TextUtils.isEmpty(data.getDescription()) ? "暂无" : data.getDescription());
tvCaseAddress.setText(TextUtils.isEmpty(data.getAddress()) ? "" : data.getAddress());
}
}
| [
"[email protected]"
] | |
a612cbed31c605f02c2bd7e002774f4605038ebb | 93ad86d33a7e007d2d16fed6cff6c8b1f19d9b48 | /src/concurrent/Foo1.java | 9d198ad1d595c29de3d5423c9446bf8304fc9fe8 | [] | no_license | chevro-lee/leetcode-question-set | cef391faeee5431d94ab7224293eb300d8362318 | fd0d34690760b27867dbebd579b5f106d4da398c | refs/heads/master | 2023-05-27T16:34:30.482646 | 2021-06-17T10:00:39 | 2021-06-17T10:00:39 | 377,782,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java | package concurrent;
/**
* Author li.ling
* Description
* Date 2021/2/23 18:23
*/
public class Foo1 {
}
| [
"[email protected]"
] | |
fadea839bef9efc01f751bd91c10dc52347a73b9 | e78a4941076202428a1a9b8f97aafb334f081eb5 | /src/alvaro/thinking/tema10/anonimas/AddObject.java | 1c21e291d8ba58f3158e21d936f2d1eeed33d985 | [] | no_license | Agomezdelamo/Thinking-java-training | 6e91588b3e08a4cd5591a6c8bd3bc5f33eb7e012 | c55b754c4ffa94725adcc0a99013cf419ca2906a | refs/heads/master | 2021-01-17T07:13:19.581915 | 2016-12-13T16:45:57 | 2016-12-13T16:45:57 | 49,752,545 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,482 | java | package alvaro.thinking.tema10.anonimas;
/*************** CLASE BASE ***************/
class Palabra {
String guardoPalabra;
public Palabra(String guardoPalabra){ this.guardoPalabra = guardoPalabra; }
@Override
public String toString() { return "Este es mi String -->"+guardoPalabra; };
}
/*************** INTERFAZ ***************/
interface IteratorObject {
boolean end();
Object current();
void next();
int getIndex();
}
/******** CLASE OUTTER CON IMPLEMENTACION ********/
//outterSecquence añade objetos a un array.
public class AddObject {
private Object[] items;//arRay de items que incrementamos con add
private int next = 0;
public AddObject (int tamañoArray) { items = new Object[tamañoArray];}
//en el constructor le damos tamaño, con lo que
//en add el next que inicia en 0 SIEMPRE sera menor que el tamaño la primera vez.
public void add(Object x){
if(next < items.length)
items[next++] = x;
}
/******** CLASE INNER CON IMPLEMENTACION ********/
private class ReturnObject implements IteratorObject {
//una clase interna que itera sobre propiedades de su padre que es clase externa.
private int index = 0;
public boolean end() { return index == items.length; }
public Object current() { return items[index]; }
public void next() { if(index < items.length) index++; }
public int getIndex() {return index;}
}
public IteratorObject getReturnObject() { //DEVUELVO UN OBJETO POR SU INTERFAZ
return new ReturnObject();
}
public static void main (String[] args){
AddObject outter = new AddObject(10);
for(int i = 0; i < 10; i++)
//añade tantas palabras como el int de su constructor
outter.add(new Palabra(" esta es la palabra número "+Integer.toString(i)));
IteratorObject inner = outter.getReturnObject(); //OBTENGO LA INNER POR SU INTERFAZ Y UN METODO QUE DEVUELVE ESE TIPO DE INTERFAZ
while(!inner.end()) {
System.out.print(inner.current() + "\n");
inner.next();
}
Palabra palabra1 = new Palabra("hola");
Palabra palabra2 = new Palabra("que");
Palabra palabra3 = new Palabra("tal");
Palabra palabra4 = new Palabra("estas");
AddObject outter2 = new AddObject(4);
outter2.add(palabra1);
outter2.add(palabra2);
outter2.add(palabra3);
outter2.add(palabra4);
IteratorObject inner2 = outter2.getReturnObject();
while(!inner2.end()) {
System.out.print("La palabra numero "+inner2.getIndex()+" contiene "+inner2.current()+"\n");
inner2.next();
}
}
}
| [
"[email protected]"
] | |
ace06d81550162f6f7997d704d4f3fa77a9ef365 | 571d7cbd9150d23fb643bdba263bb3efbb8b4669 | /src/session5/exercise1/Main.java | 0ac12b30b6eb0ab34c72793de03a4cc2988a5c43 | [] | no_license | anmenmor/java-programming-subject-2 | 0a40baa15a68dc66bb4cba93d8dfdb5751568bd5 | 68bc9eda5696a833269490a5205a549cb604d6f8 | refs/heads/master | 2023-02-21T06:25:43.957643 | 2021-01-25T18:54:20 | 2021-01-25T18:54:20 | 332,848,749 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,199 | java | package session5.exercise1;
import sun.lwawt.macosx.CSystemTray;
import java.io.File;
import java.io.IOException;
import java.nio.file.*;
import java.util.HashMap;
public class Main {
public static void main(String[] args) throws IOException {
Path path = Paths.get("new Directory");
System.out.println("creating directory :" + path.toString());
Path newDir = Files.createDirectory(path);
System.out.println("creating file: newFile1.txt");
Files.createFile(newDir.resolve("newFile1.txt"));
System.out.println("creating file: newFile2.txt");
Files.createFile(newDir.resolve("newFile2.txt"));
System.out.println("creating file: newFile3.txt");
Files.createFile(newDir.resolve("newFile3.txt"));
deleteFile(newDir.toFile());
System.out.println("Done");
}
private static boolean deleteFile(File dir) {
if (dir.isDirectory()) {
File[] children = dir.listFiles();
for (int i = 0; i < children.length; i++) {
deleteFile(children[i]);
}
}
System.out.println("removing file or directory :"+ dir.getName());
return dir.delete();
}
} | [
"[email protected]"
] | |
d361e47605c73ea6ce88f38ebb3fb44102a00ddc | 18d70ec21adbf477ee7f82612c8ee5a8522387f4 | /Fabi_EntregavelCelia/src/main/java/Mysql.java | 9355501bf73d818aa2affa75d4e7c11e4c67a4a0 | [] | no_license | vsilva2019/Desafio_Projeto | 9987aa17682c0fd6449f28a6f29fcea4a201fa58 | 299871fd797e9b3c0d33b71d5ef211b0ab473d3a | refs/heads/master | 2021-02-16T17:38:56.186173 | 2020-03-10T23:09:41 | 2020-03-10T23:09:41 | 245,030,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | public class Mysql extends Dados {
public Mysql(String nome, String descricao, String complexidade, double tempo) {
super(nome, descricao, complexidade, tempo);
}
@Override
public double getPontuacao() {
if (this.getTempo() >= 10 || this.getComplexidade().equals("ALTA")) {
return 8.0;
} else if (this.getTempo() >= 5 || this.getComplexidade().equals("MEDIA")) {
return 4.0;
} else if (this.getTempo() >= 2 || this.getComplexidade().equals("BAIXA")) {
return 2.0;
} else {
return 1.0;
}
}
}
| [
"[email protected]"
] | |
94bea6de30c93321074f2790b015fe3fceea6961 | b6d1b052822dfb176917a4f9c8684b52044786de | /src/main/java/com/jyss/ziwei/service/impl/PhysicalTestServiceImpl.java | e3da151b2acc01f60c4aafd40b94f212e3fd109f | [] | no_license | sosahh/ZIWEI | 522f33d5b65619e0d22b16e2bf4ba3d9beb258dd | 66898e15b4d6b54ec8064874b8eb6b34542d00d3 | refs/heads/master | 2020-03-23T01:31:10.306916 | 2018-07-15T07:42:00 | 2018-07-15T07:42:00 | 140,922,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,169 | java | package com.jyss.ziwei.service.impl;
import com.jyss.ziwei.entity.PhysicalTest;
import com.jyss.ziwei.mapper.PhysicalTestMapper;
import com.jyss.ziwei.service.PhysicalTestService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class PhysicalTestServiceImpl implements PhysicalTestService{
@Autowired
private PhysicalTestMapper ptMapper;
@Override
public int insert(PhysicalTest physicalTest) {
return ptMapper.insert(physicalTest);
}
@Override
public int updateByPrimaryKey(PhysicalTest physicalTest) {
return ptMapper.updateByPrimaryKey(physicalTest);
}
@Override
public int deletePhysicalTest(@Param("id") String id) {
return ptMapper.deletePhysicalTest(id);
}
@Override
public List<PhysicalTest> getPhysicalTest(@Param("status") String status, @Param("uId") String uId, @Param("id") String id) {
return ptMapper.getPhysicalTest(status,uId,id);
}
} | [
"[email protected]"
] | |
8245bfcf5fe20bdd38d2f6f74f54ac0f5f399586 | 052d648a7b0f6c249804bc026db19075d7975aed | /Utility/src/com/dtv/oss/dto/BundlePrepaymentDTO.java | 5b248d1f787911a00785ef99c7e9a5f775177000 | [] | no_license | worldup/boss | 84fa357934a7a374d3d0617607391d0446e3b37d | 667dc568c35c3f38b506d21375e298819e58bc33 | refs/heads/master | 2021-01-13T01:36:56.187120 | 2015-02-10T14:01:37 | 2015-02-10T14:01:37 | 30,594,799 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,937 | java | package com.dtv.oss.dto;
import java.io.Serializable;
import java.sql.Timestamp;
public class BundlePrepaymentDTO implements ReflectionSupport, Serializable {
private int campaignId;
private int targetBundleId;
private int bundlePrepaymentPlanId;
private String timeUnitLengthType;
private int timeUnitLengthNumber;
private String acctItemTypeId;
private String feeType;
private double amount;
private Timestamp dtCreate;
private Timestamp dtLastmod;
public int getCampaignId() {
return campaignId;
}
public void setCampaignId(int campaignId) {
this.campaignId = campaignId;
}
public int getTargetBundleId() {
return targetBundleId;
}
public void setTargetBundleId(int targetBundleId) {
this.targetBundleId = targetBundleId;
put("targetBundleId");
}
public int getBundlePrepaymentPlanId() {
return bundlePrepaymentPlanId;
}
public void setBundlePrepaymentPlanId(int bundlePrepaymentPlanId) {
this.bundlePrepaymentPlanId = bundlePrepaymentPlanId;
put("bundlePrepaymentPlanId");
}
public String getTimeUnitLengthType() {
return timeUnitLengthType;
}
public void setTimeUnitLengthType(String timeUnitLengthType) {
this.timeUnitLengthType = timeUnitLengthType;
put("timeUnitLengthType");
}
public int getTimeUnitLengthNumber() {
return timeUnitLengthNumber;
}
public void setTimeUnitLengthNumber(int timeUnitLengthNumber) {
this.timeUnitLengthNumber = timeUnitLengthNumber;
put("timeUnitLengthNumber");
}
public String getAcctItemTypeId() {
return acctItemTypeId;
}
public void setAcctItemTypeId(String acctItemTypeId) {
this.acctItemTypeId = acctItemTypeId;
put("acctItemTypeId");
}
public String getFeeType() {
return feeType;
}
public void setFeeType(String feeType) {
this.feeType = feeType;
put("feeType");
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
put("amount");
}
public Timestamp getDtCreate() {
return dtCreate;
}
public void setDtCreate(Timestamp dtCreate) {
this.dtCreate = dtCreate;
}
public Timestamp getDtLastmod() {
return dtLastmod;
}
public void setDtLastmod(Timestamp dtLastmod) {
this.dtLastmod = dtLastmod;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof BundlePrepaymentDTO))
return false;
BundlePrepaymentDTO that = (BundlePrepaymentDTO) obj;
if (that.campaignId != this.campaignId)
return false;
if (that.targetBundleId != this.targetBundleId)
return false;
if (that.bundlePrepaymentPlanId != this.bundlePrepaymentPlanId)
return false;
if (!(that.timeUnitLengthType == null ? this.timeUnitLengthType == null :
that.timeUnitLengthType.equals(this.timeUnitLengthType)))
return false;
if (that.timeUnitLengthNumber != this.timeUnitLengthNumber)
return false;
if (!(that.acctItemTypeId == null ? this.acctItemTypeId == null :
that.acctItemTypeId.equals(this.acctItemTypeId)))
return false;
if (!(that.feeType == null ? this.feeType == null :
that.feeType.equals(this.feeType)))
return false;
if (Double.doubleToLongBits(that.amount) !=
Double.doubleToLongBits(this.amount))
return false;
if (!(that.dtCreate == null ? this.dtCreate == null :
that.dtCreate.equals(this.dtCreate)))
return false;
if (!(that.dtLastmod == null ? this.dtLastmod == null :
that.dtLastmod.equals(this.dtLastmod)))
return false;
return true;
}
public int hashCode() {
int result = 17;
result = 37 * result + (int)this.campaignId;
result = 37 * result + (int)this.targetBundleId;
result = 37 * result + (int)this.bundlePrepaymentPlanId;
result = 37 * result + this.timeUnitLengthType.hashCode();
result = 37 * result + (int)this.timeUnitLengthNumber;
result = 37 * result + this.acctItemTypeId.hashCode();
result = 37 * result + this.feeType.hashCode();
result = 37 * result + (int)(this.amount);
result = 37 * result + this.dtCreate.hashCode();
result = 37 * result + this.dtLastmod.hashCode();
return result;
}
public String toString() {
StringBuffer returnStringBuffer = new StringBuffer(320);
returnStringBuffer.append("[");
returnStringBuffer.append("campaignID:").append(campaignId);
returnStringBuffer.append("targetBundleID:").append(targetBundleId);
returnStringBuffer.append("bundlePrepaymentPlanID:").append(
bundlePrepaymentPlanId);
returnStringBuffer.append("timeUnitLengthType:").append(
timeUnitLengthType);
returnStringBuffer.append("timeUnitLengthNumber:").append(
timeUnitLengthNumber);
returnStringBuffer.append("acctItemTypeID:").append(acctItemTypeId);
returnStringBuffer.append("feeType:").append(feeType);
returnStringBuffer.append("amount:").append(amount);
returnStringBuffer.append("dtCreate:").append(dtCreate);
returnStringBuffer.append("dtLastmod:").append(dtLastmod);
returnStringBuffer.append("]");
return returnStringBuffer.toString();
}
private java.util.Map map = new java.util.HashMap();
public void put(String field) {
map.put(field, Boolean.TRUE);
}
public java.util.Map getMap() {
return this.map;
}
}
| [
"[email protected]"
] | |
d81fd5e2de7c9d50b84ed1ab28e2d2d99bd0a883 | dca0487eeff989228efa5405b01a69badd18ac5f | /engine/game/src/main/java/com/maehem/rocket/engine/game/events/GameEvent.java | c512de09b624ec1ed055178e0b236063245083f1 | [
"Apache-2.0"
] | permissive | maehem/Rocket | a7d8af5fb9f65242d2ec22406085204c0b6803e7 | 061695fe8cd3a0f7b1f6ac6f6fbc68fc358ccfdb | refs/heads/master | 2022-05-30T09:21:29.803913 | 2022-05-17T20:42:48 | 2022-05-17T20:42:48 | 234,600,455 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,278 | 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 com.maehem.rocket.engine.game.events;
import com.maehem.rocket.engine.game.Game;
/**
*
* @author maehem
*/
public class GameEvent {
private final Game game;
public static enum TYPE { DATA_LOADED, PAUSED, RUNNING, TICK, DATA_SAVED, SPEED }
public final TYPE type;
public GameEvent( Game game, TYPE type ) {
this.game = game;
this.type = type;
}
public Game getSource() {
return game;
}
}
| [
"[email protected]"
] | |
eac0a5e668a19b80252a7c366174372c5044e03f | 8dfa153510f3704da2e541359e37c8c79b06a29e | /RECAST/src/network/graph/EdgeList.java | cceb500ce1af1d7e306cbc0054655951af5d1262 | [
"MIT"
] | permissive | lab-csx-ufmg/RECAST | 38f01705ff790a799401f98f59cdb1e3757b3e01 | e254ad9de5fbe1aa0693ddcff91d2a1c9374b19c | refs/heads/master | 2021-01-17T16:45:12.897111 | 2016-07-13T18:36:35 | 2016-07-13T18:36:35 | 57,069,330 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,068 | java | package network.graph;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
public class EdgeList extends HashMap<Integer, Edge> {
private static final long serialVersionUID = 1L;
int nodeId;
public EdgeList(int nodeId) {
this.nodeId = nodeId;
}
public int getNodeId() {
return nodeId;
}
public Set<Integer> getNodeSet() {
return this.keySet();
}
public ArrayList<Edge> getEdgesL() {
ArrayList<Edge> edgesL = new ArrayList<Edge>(this.values());
return edgesL;
}
public Edge[] toArray() {
return this.values().toArray(new Edge[0]);
}
public void add(int nodeid) {
this.add(new Edge(this.nodeId, nodeid,1.0));
}
public boolean add(int nodeid, Double weight, Long timeWillDie) {
Edge e = new Edge(this.nodeId,nodeid,weight,timeWillDie);
return this.add(e);
}
public boolean add(Edge e) {//false if the edge already existed
if(!this.containsKey(e.getNodeDest())) {
this.put(e.getNodeDest(), e);
return true;
}
this.get(e.getNodeDest()).incrementEdge(e);
return false;
}
}
| [
"[email protected]"
] | |
30dbc48c0849dffce0d96691072c777bb1881116 | 5a58600f70c13f613d3a1a26695b058c2ba9e52a | /dah-main/src/main/java/com/qrqy/dah/qo/AdminImportExcelQO.java | 0ea4410df9c42890089224b847a8eb8aa493aa45 | [] | no_license | 928787773/dah | 45db7bc1f19a5096bb4db1baeee455417c828ed4 | c23e0e3c4eba12d57c0ce423d9484fdd0d7b0660 | refs/heads/master | 2023-07-21T14:24:24.332289 | 2021-09-04T15:13:07 | 2021-09-04T15:13:07 | 403,085,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | package com.qrqy.dah.qo;
import com.qrqy.dp.qo.IBaseQO;
import com.qrqy.dp.qo.PageableQO;
import com.qrqy.mysql.enumeration.ImportExportTaskFileTypeEnum;
import com.sun.istack.NotNull;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
/**
* 参数支持动态查询后缀:Is、Eq、Neq、StartWith、EndWith、Like、Gt、Gte、Lt、Lte、Null、NotNull、In、NotIn
* @author : QRQY
* @date : 2021-07-01 16:04
*/
@Data
public class AdminImportExcelQO implements IBaseQO {
@ApiModelProperty(value = "类型;caseInfo病例,material物资,drug药品,device设备,formCategory调查问卷,medicalStaff医务人员", example = "")
@NotNull
private ImportExportTaskFileTypeEnum fileType;
@ApiModelProperty(value = "导入文件路径", example = "")
@NotBlank
private String filePath;
}
| [
"hou2020"
] | hou2020 |
a8fad3fa9c63a64819fa9d541721c46703283a1d | 5748d192246e739f897e3a551b12b2979b5d4a37 | /src/test/java/com/pages/pageobjecrmanager.java | 9ee629851b1625654a867b57f3ec0d1f6b74f932 | [] | no_license | marcellin93/JENKIN | 4a9e0f7cc79ec2bd58e91ce9bade02f488f8faab | aeec7961ee1bed2d587ff1dc6a0addbdf9cb2232 | refs/heads/master | 2021-07-18T20:17:46.738299 | 2020-03-14T14:57:48 | 2020-03-14T14:57:48 | 247,296,385 | 0 | 0 | null | 2021-04-26T20:03:19 | 2020-03-14T14:55:37 | HTML | UTF-8 | Java | false | false | 619 | java | package com.pages;
public class pageobjecrmanager {
private loginpage loginpage;
private paymentpage paymentpage;
private searchHotel searchHotel;
private selectHotel selectHotel;
public loginpage getLoginpage() {
return (loginpage==null)?loginpage=new loginpage():loginpage;
}
public paymentpage getPaymentpage() {
return (paymentpage==null)?paymentpage=new paymentpage():paymentpage;
}
public searchHotel getSearchHotel() {
return (searchHotel==null)?searchHotel=new searchHotel():searchHotel;
}
public selectHotel getSelectHotel() {
return (selectHotel==null)?selectHotel=new selectHotel():selectHotel;
}
}
| [
"[email protected]"
] | |
c4b1af034b7fae4f2b56c10cc14da716f28a641a | 76fe58befc580d3412d42994cc46f0786cf4ba91 | /presentation/build/generated/source/kapt/debug/dev/alimansour/ireddit/di/DaggerAppComponent.java | fe0920b88113c35380d40b72d552d72c22fe4308 | [] | no_license | dev-ali-mansour/IReddit | 88c17b35d4d9b4263682f62f81bffac7f7e28a03 | fef7c00b305853959db8f6779872f193d1650a02 | refs/heads/master | 2023-09-05T04:02:29.571238 | 2021-11-14T01:39:24 | 2021-11-14T01:39:24 | 427,108,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,265 | java | // Generated by Dagger (https://dagger.dev).
package dev.alimansour.ireddit.di;
import android.content.Context;
import androidx.fragment.app.FragmentActivity;
import dagger.internal.DaggerGenerated;
import dagger.internal.DoubleCheck;
import dagger.internal.InstanceFactory;
import dagger.internal.Preconditions;
import dev.alimansour.data.local.LocalDataSource;
import dev.alimansour.data.local.dao.PostsDao;
import dev.alimansour.data.local.database.RedditDatabase;
import dev.alimansour.data.remote.RemoteDataSource;
import dev.alimansour.data.remote.response.RedditService;
import dev.alimansour.domain.repository.PostsRepository;
import dev.alimansour.domain.usecase.AddPostToFavoriteUseCase;
import dev.alimansour.domain.usecase.AddPostToFavoriteUseCase_Factory;
import dev.alimansour.domain.usecase.ClearFavoriteUseCase;
import dev.alimansour.domain.usecase.ClearFavoriteUseCase_Factory;
import dev.alimansour.domain.usecase.DisposeObserversUseCase;
import dev.alimansour.domain.usecase.DisposeObserversUseCase_Factory;
import dev.alimansour.domain.usecase.GetFavoritesUseCase;
import dev.alimansour.domain.usecase.GetFavoritesUseCase_Factory;
import dev.alimansour.domain.usecase.GetPostsUseCase;
import dev.alimansour.domain.usecase.GetPostsUseCase_Factory;
import dev.alimansour.domain.usecase.RemovePostFromFavoriteUseCase;
import dev.alimansour.domain.usecase.RemovePostFromFavoriteUseCase_Factory;
import dev.alimansour.domain.usecase.SearchForPostUseCase;
import dev.alimansour.domain.usecase.SearchForPostUseCase_Factory;
import dev.alimansour.ireddit.ui.MainActivity;
import dev.alimansour.ireddit.ui.favorites.FavoritesAdapter;
import dev.alimansour.ireddit.ui.favorites.FavoritesFragment;
import dev.alimansour.ireddit.ui.favorites.FavoritesFragment_MembersInjector;
import dev.alimansour.ireddit.ui.favorites.FavoritesViewModel;
import dev.alimansour.ireddit.ui.favorites.FavoritesViewModelFactory;
import dev.alimansour.ireddit.ui.favorites.FavoritesViewModelFactory_Factory;
import dev.alimansour.ireddit.ui.home.HomeFragment;
import dev.alimansour.ireddit.ui.home.HomeFragment_MembersInjector;
import dev.alimansour.ireddit.ui.home.HomeViewModel;
import dev.alimansour.ireddit.ui.home.HomeViewModelFactory;
import dev.alimansour.ireddit.ui.home.HomeViewModelFactory_Factory;
import dev.alimansour.ireddit.ui.home.PostsAdapter;
import dev.alimansour.ireddit.util.ConnectivityManager;
import dev.alimansour.ireddit.util.ConnectivityManager_Factory;
import io.reactivex.disposables.CompositeDisposable;
import javax.inject.Provider;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
@DaggerGenerated
@SuppressWarnings({
"unchecked",
"rawtypes"
})
public final class DaggerAppComponent implements AppComponent {
private final DaggerAppComponent appComponent = this;
private Provider<HttpLoggingInterceptor> providesHttpLoggingInterceptorProvider;
private Provider<OkHttpClient> providesOkHttpClientProvider;
private Provider<Retrofit> providesRetrofitClientProvider;
private Provider<RedditService> provideRedditServiceProvider;
private Provider<RemoteDataSource> provideRemoteDataSourceProvider;
private Provider<Context> contextProvider;
private Provider<RedditDatabase> provideRedditDatabaseProvider;
private Provider<PostsDao> providePostsDaoProvider;
private Provider<LocalDataSource> provideLocalDataSourceProvider;
private Provider<CompositeDisposable> providesCompositeDisposableProvider;
private Provider<PostsRepository> providePostsRepositoryProvider;
private Provider<GetPostsUseCase> getPostsUseCaseProvider;
private Provider<SearchForPostUseCase> searchForPostUseCaseProvider;
private Provider<AddPostToFavoriteUseCase> addPostToFavoriteUseCaseProvider;
private Provider<DisposeObserversUseCase> disposeObserversUseCaseProvider;
private Provider<HomeViewModelFactory> homeViewModelFactoryProvider;
private Provider<ConnectivityManager> connectivityManagerProvider;
private Provider<GetFavoritesUseCase> getFavoritesUseCaseProvider;
private Provider<RemovePostFromFavoriteUseCase> removePostFromFavoriteUseCaseProvider;
private Provider<ClearFavoriteUseCase> clearFavoriteUseCaseProvider;
private Provider<FavoritesViewModelFactory> favoritesViewModelFactoryProvider;
private DaggerAppComponent(Context contextParam) {
initialize(contextParam);
}
public static AppComponent.Builder builder() {
return new Builder();
}
@SuppressWarnings("unchecked")
private void initialize(final Context contextParam) {
this.providesHttpLoggingInterceptorProvider = DoubleCheck.provider(RetrofitModule_ProvidesHttpLoggingInterceptorFactory.create());
this.providesOkHttpClientProvider = DoubleCheck.provider(RetrofitModule_ProvidesOkHttpClientFactory.create(providesHttpLoggingInterceptorProvider));
this.providesRetrofitClientProvider = DoubleCheck.provider(RetrofitModule_ProvidesRetrofitClientFactory.create(providesOkHttpClientProvider));
this.provideRedditServiceProvider = DoubleCheck.provider(RetrofitModule_ProvideRedditServiceFactory.create(providesRetrofitClientProvider));
this.provideRemoteDataSourceProvider = DoubleCheck.provider(AppModule_ProvideRemoteDataSourceFactory.create(provideRedditServiceProvider));
this.contextProvider = InstanceFactory.create(contextParam);
this.provideRedditDatabaseProvider = DoubleCheck.provider(RoomModule_ProvideRedditDatabaseFactory.create(contextProvider));
this.providePostsDaoProvider = DoubleCheck.provider(RoomModule_ProvidePostsDaoFactory.create(provideRedditDatabaseProvider));
this.provideLocalDataSourceProvider = DoubleCheck.provider(AppModule_ProvideLocalDataSourceFactory.create(providePostsDaoProvider));
this.providesCompositeDisposableProvider = DoubleCheck.provider(AppModule_ProvidesCompositeDisposableFactory.create());
this.providePostsRepositoryProvider = DoubleCheck.provider(AppModule_ProvidePostsRepositoryFactory.create(provideRemoteDataSourceProvider, provideLocalDataSourceProvider, providesCompositeDisposableProvider));
this.getPostsUseCaseProvider = GetPostsUseCase_Factory.create(providePostsRepositoryProvider);
this.searchForPostUseCaseProvider = SearchForPostUseCase_Factory.create(providePostsRepositoryProvider);
this.addPostToFavoriteUseCaseProvider = AddPostToFavoriteUseCase_Factory.create(providePostsRepositoryProvider);
this.disposeObserversUseCaseProvider = DisposeObserversUseCase_Factory.create(providePostsRepositoryProvider);
this.homeViewModelFactoryProvider = DoubleCheck.provider(HomeViewModelFactory_Factory.create(getPostsUseCaseProvider, searchForPostUseCaseProvider, addPostToFavoriteUseCaseProvider, disposeObserversUseCaseProvider));
this.connectivityManagerProvider = DoubleCheck.provider(ConnectivityManager_Factory.create(contextProvider));
this.getFavoritesUseCaseProvider = GetFavoritesUseCase_Factory.create(providePostsRepositoryProvider);
this.removePostFromFavoriteUseCaseProvider = RemovePostFromFavoriteUseCase_Factory.create(providePostsRepositoryProvider);
this.clearFavoriteUseCaseProvider = ClearFavoriteUseCase_Factory.create(providePostsRepositoryProvider);
this.favoritesViewModelFactoryProvider = DoubleCheck.provider(FavoritesViewModelFactory_Factory.create(getFavoritesUseCaseProvider, removePostFromFavoriteUseCaseProvider, clearFavoriteUseCaseProvider, disposeObserversUseCaseProvider));
}
@Override
public ViewModelComponent.Builder viewModelComponentBuilder() {
return new ViewModelComponentBuilder(appComponent);
}
private static final class Builder implements AppComponent.Builder {
private Context context;
@Override
public Builder context(Context context) {
this.context = Preconditions.checkNotNull(context);
return this;
}
@Override
public AppComponent build() {
Preconditions.checkBuilderRequirement(context, Context.class);
return new DaggerAppComponent(context);
}
}
private static final class ViewModelComponentBuilder implements ViewModelComponent.Builder {
private final DaggerAppComponent appComponent;
private Context context;
private FragmentActivity activity;
private ViewModelComponentBuilder(DaggerAppComponent appComponent) {
this.appComponent = appComponent;
}
@Override
public ViewModelComponentBuilder context(Context context) {
this.context = Preconditions.checkNotNull(context);
return this;
}
@Override
public ViewModelComponentBuilder activity(FragmentActivity activity) {
this.activity = Preconditions.checkNotNull(activity);
return this;
}
@Override
public ViewModelComponent build() {
Preconditions.checkBuilderRequirement(context, Context.class);
Preconditions.checkBuilderRequirement(activity, FragmentActivity.class);
return new ViewModelComponentImpl(appComponent, context, activity);
}
}
private static final class ViewModelComponentImpl implements ViewModelComponent {
private final DaggerAppComponent appComponent;
private final ViewModelComponentImpl viewModelComponentImpl = this;
private Provider<FragmentActivity> activityProvider;
private Provider<HomeViewModel> provideHomeViewModelProvider;
private Provider<FavoritesViewModel> provideFavoritesViewModelProvider;
private ViewModelComponentImpl(DaggerAppComponent appComponent, Context contextParam,
FragmentActivity activityParam) {
this.appComponent = appComponent;
initialize(contextParam, activityParam);
}
@SuppressWarnings("unchecked")
private void initialize(final Context contextParam, final FragmentActivity activityParam) {
this.activityProvider = InstanceFactory.create(activityParam);
this.provideHomeViewModelProvider = DoubleCheck.provider(ViewModelModule_ProvideHomeViewModelFactory.create(activityProvider, appComponent.homeViewModelFactoryProvider));
this.provideFavoritesViewModelProvider = DoubleCheck.provider(ViewModelModule_ProvideFavoritesViewModelFactory.create(activityProvider, appComponent.favoritesViewModelFactoryProvider));
}
@Override
public void inject(MainActivity mainActivity) {
}
@Override
public void inject(HomeFragment homeFragment) {
injectHomeFragment(homeFragment);
}
@Override
public void inject(FavoritesFragment favoritesFragment) {
injectFavoritesFragment(favoritesFragment);
}
private HomeFragment injectHomeFragment(HomeFragment instance) {
HomeFragment_MembersInjector.injectHomeViewModel(instance, provideHomeViewModelProvider.get());
HomeFragment_MembersInjector.injectPostsAdapter(instance, new PostsAdapter());
HomeFragment_MembersInjector.injectConnectivityManager(instance, appComponent.connectivityManagerProvider.get());
return instance;
}
private FavoritesFragment injectFavoritesFragment(FavoritesFragment instance) {
FavoritesFragment_MembersInjector.injectFavoritesViewModel(instance, provideFavoritesViewModelProvider.get());
FavoritesFragment_MembersInjector.injectFavoritesAdapter(instance, new FavoritesAdapter());
return instance;
}
}
}
| [
"[email protected]"
] | |
f96ad59fa28995058da9b3c95d8b2a5f7d43e46e | 500cf354b14ef0df95333a85dcb0930ad58027b1 | /Land.java | 73a1bab74c8de3cf2cfd6531c36b9b421dc3e642 | [] | no_license | RyanWoodard/Botanical-Brewery | 76bfe3c3bb5217754acf1a82b611b9836e124364 | 510e09a3fa04404a225a3ce5eb82e73d1755c75c | refs/heads/master | 2020-03-29T07:50:21.252066 | 2018-09-21T01:06:42 | 2018-09-21T01:06:42 | 149,681,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,973 | java | import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.io.IOException;
public class Land {
private boolean planted;
private Seed[] seeds;
private static int noSeeds;
private static int timeLevel = 1;
private static int spaceLevel = 1;
private static int currentSeed;
private int time = 0;
private boolean grown = false;
private static StartBrewery main;
private int x, y, size, seed,time2;
private static int costTime = 100;//temp
private static int costSpace = 100;//temp
public Land(StartBrewery main, int x, int y) throws IOException {
this.x = x;
this.y = y;
size = 100;
this.main = main;
currentSeed = -1;
seeds = main.getSeeds();
}
public static int getCostTime(){
return costTime;
}
public static int getCostSpace(){
return costSpace;
}
public void plant() {
if (standing()) {
if (!planted && currentSeed != -1) {
main.getPlayer().removeSeed(currentSeed);
planted = true;
seed = currentSeed;
time = (int) (seeds[seed].getTime() / (timeLevel / 2.0));
time2 = time;
if (main.getPlayer().getSeeds(seed) == 0)
currentSeed = -1;
}
}
}
public void grow() {
if (time > 0)
time--;
if (planted && time == 0 && !grown) {
grown = true;
}
}
public void harvest() {
if (standing()) {
if (planted && grown) {
planted = false;
grown = false;
main.getPlayer().addIng(seeds[seed].getNum());
}
}
}
private boolean standing() {
return main.getPlayer().getY() + 64 >= y && main.getPlayer().getY() + 64 <= y + size
&& main.getPlayer().getX() + 64 >= x && main.getPlayer().getX() + 64 <= (x + size);
}
public void paint(Graphics g) {
double size2 = size;
g.setColor(Color.YELLOW);
if (standing())
g.fillRect(x - 3, y - 3, size + 6, size + 6);
g.drawImage(Images.getLand(), x, y, size, size, null);
if (planted)
g.drawImage(Images.getPlanted(seed), x + 10, y + 10, size - 20, size - 20, null);
if (grown)
g.drawImage(Images.getGrown(seed), x + 10, y + 10, size - 20, size - 20, null);
if(planted && !grown) {
g.setColor(Color.GREEN);
g.fillRect(x, y+size-5,(int)(size2*((time*1.0)/(time2*1.0))-1), 4);
g.setColor(Color.black);
g.drawRect(x, y+size-5,(int)(size2-1), 4);
}
}
public static void paintINV(Graphics g) {
int x = 0;
int y = 0;
int size = 80;
for (int i = 0; i < 6; i++) {
g.setColor(Color.GRAY);
if (i == currentSeed)
g.setColor(Color.GREEN);
g.fillRect(x + size * i, y, size, size);
g.setColor(Color.BLACK);
g.drawRect(x + size * i, y, size, size);
g.setColor(Color.GREEN);
if (main.getPlayer().getSeeds(i) == 0)
g.setColor(Color.RED);
if (currentSeed == i)
g.setColor(Color.BLACK);
g.setFont(new Font("Impact", Font.PLAIN, 14));
g.drawImage(Images.getSeed(i), x + size * i, y, size, size, null);
g.drawString("" + main.getPlayer().getSeeds(i), x + (i + 1) * size - 22, y + 14);
}
if (noSeeds > 0) {
g.setColor(Color.RED);
g.setFont(new Font("Impact", Font.PLAIN, 40));
g.drawString("YOU DONT HAVE ENOUGH SEEDS", 400, 400);
noSeeds--;
}
}
public static void setCurSeed(int xM, int yM) {
int seedNum;
int x = 0;
int y = 0;
int size = 80;
// System.out.println((xM - x)/size);
if (yM >= y && yM <= y + size && xM >= x && xM <= (x + size * 6)) {
seedNum = (xM - x - 1) / size;
if (main.getPlayer().getSeeds(seedNum) > 0) {
currentSeed = seedNum;
noSeeds = 0;
} else {
noSeeds = 200;
}
}
}
public static int getTimeLevel() {
return timeLevel;
}
public static void increaseTimeLevel() {
if (timeLevel < 4) {
timeLevel++;
costTime*=2;
}
if(timeLevel ==4){
costTime = 0;
}
}
public static int getSpaceLevel() {
return spaceLevel;
}
public static void increaseSpaceLevel() {
if (spaceLevel < 4) {
spaceLevel++;
costSpace*=2;
}
if(spaceLevel ==4){
costSpace = 0;
}
}
} | [
"[email protected]"
] | |
a43cedfecd5daa3aced8c2e310e23d564dbcb3fc | 95458debd0ca1dc85d4eabe3f36ca45344008b9b | /Crypto/src/com/saggu/Secure.java | dcf270cd37a7188668daccc6d81cbfa012f57022 | [] | no_license | randeep01/securedb | 78e40e92e7fe647c058b69f7371ff35966393832 | b56ba92720b2f3623d4ec9e3121a2b64859f14f0 | refs/heads/master | 2020-03-26T02:18:19.118963 | 2018-08-13T01:28:04 | 2018-08-13T01:28:04 | 144,405,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,226 | java | package com.saggu;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
public class Secure {
public static void main(String[] args) {
if (args.length <= 2) {
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("java -jar Secure [A/E/D/R][Key]<user>");
System.out.println(" A - ADD\nE - Edit\nD - Delete\nR - Read");
System.out.println("java -jar Secure A [key]");
System.out.println("java -jar Secure R [key][all/<insitute>]<security>");
System.out.println("java -jar Secure E [key][insitute] ");
System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++");
// return;
}
int iterations = 250000;
String userpassword = args[1];
String salt = "salt";
SecretKeyFactory factory;
byte[] keyVal = null;
SecretKey key = null;
SecretKey secret = null;
try {
factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
char[] passwordChars = userpassword.toCharArray();
KeySpec spec = new PBEKeySpec(passwordChars, salt.getBytes(), iterations, 128);
key = factory.generateSecret(spec);
// keyVal = key.;
secret = new SecretKeySpec(key.getEncoded(), "AES");
// keyVal = secret.getEncoded();
} catch (NoSuchAlgorithmException | InvalidKeySpecException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// String currentDir = System.getProperty("user.dir");
// System.out.println("Current dir using System:" + currentDir);
// System.out.println(args[0]);
// System.out.println(args[1]);
try {
File file = new File("data");
file.createNewFile();
HashMap<String, Credentials> map;
map = loadDataToMap(file, secret);
if (map == null) {
return;
}
switch (args[0]) {
case "A": {
System.out.print("Insitute :");
String insitute = System.console().readLine();
System.out.print("UserName :");
String userName = System.console().readLine();
System.out.print("Password : ");
String password = System.console().readLine();
Credentials temp = new Credentials(userName, password);
if (map.containsKey(insitute)) {
System.out.println("Can't Enter Key already exists");
}
if (map.put(insitute, temp) == null) {
System.out.println("Added");
}
saveMaptoFile(map, file, secret);
break;
}
case "R": {
String insitute = args[2];
String security = args[3];
System.out.println("-----------------------------------------------------------------------------");
System.out.printf("%20s| %20s| %20s| ", "Insitute", "User Name", "Password");
System.out.println();
System.out.println("-----------------------------------------------------------------------------");
map.forEach((k, v) -> printData(k, v, insitute, security));
System.out.println("-----------------------------------------------------------------------------");
break;
}
case "D": {
String insitute = args[2];
if (map.containsKey(insitute) == true) {
map.remove(insitute);
} else {
System.out.println("No Record");
}
saveMaptoFile(map, file, secret);
break;
}
case "E": {
String insitute = args[2];
if (map.containsKey(insitute) == true) {
System.out.print("UserName :");
String userName = System.console().readLine();
System.out.print("Password: ");
String password = System.console().readLine();
Credentials temp = new Credentials(userName, password);
if (map.put(insitute, temp) != null) {
System.out.println("Record Edited");
}
saveMaptoFile(map, file, secret);
} else {
System.out.println("Record doesn't exists");
}
break;
}
}
} catch (IOException | CryptoException e) {
// TODO Auto-generated catch block
System.err.println(e.getMessage());
// e.printStackTrace();
} finally {
}
}
private static void printData(String k, Credentials v, String insitute, String security) {
if (insitute == null || insitute.equals("")) {
insitute = "all";
}
if (security == null || security.equals("")) {
security = "high";
}
if (insitute.equalsIgnoreCase("all") || k.equalsIgnoreCase(insitute)) {
String password = v.getPassword();
switch (security) {
case "low": {
break;
}
case "high": {
// password = password;
int length = password.length();
char[] chArr = new char[length];
for (int i = 0; i < length; i++) {
chArr[i] = '*';
}
password = new String(chArr);
break;
}
case "mid": {
int length = password.length();
char[] chArr = password.toCharArray();
for (int i = 0; i < length; i++) {
if (i % 2 == 0) {
chArr[i] = '*';
} else {
// chArr[i] = chArr[i];
}
}
password = new String(chArr);
break;
}
default: {
int length = password.length();
char[] chArr = new char[length];
for (int i = 0; i < length; i++) {
chArr[i] = '*';
}
password = new String(chArr);
break;
}
}
System.out.format("%20s| %20s| %20s| ", k, v.getUserName(), password);
System.out.println();
}
// return null;
}
private static void saveMaptoFile(HashMap<String, Credentials> map, File file, SecretKey key)
throws IOException, CryptoException {
FileOutputStream fos = new FileOutputStream(file);
try {
Set<Entry<String, Credentials>> s = map.entrySet();
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, Credentials> val : s) {
sb.append(val.getKey()).append(",").append(val.getValue().getUserName()).append(",")
.append(val.getValue().getPassword()).append("\r\n");
}
byte[] strToBytes = sb.toString().getBytes();
byte[] output = null;
output = CryptoUtils.encrypt(key, strToBytes);
fos.write(output);
fos.close();
} finally {
fos.close();
}
}
private static HashMap<String, Credentials> loadDataToMap(File file, SecretKey key)
throws IOException, CryptoException {
HashMap<String, Credentials> map = new HashMap<>();
int lenght = (int) file.length();
if (lenght == 0) {
return map;
}
FileInputStream fis = new FileInputStream(file);
byte[] inputBytes = new byte[lenght];
fis.read(inputBytes);
byte[] output = null;
output = CryptoUtils.decrypt(key, inputBytes);
ByteArrayInputStream bis = new ByteArrayInputStream(output);
Scanner sc = new Scanner(bis);
String line = "";
while (sc.hasNextLine()) {
line = sc.nextLine();
String str[] = line.split(",");
Credentials temp = new Credentials(str[1], str[2]);
// System.out.println(str[0] + "," + temp.toString());
map.put(str[0], temp);
}
sc.close();
fis.close();
return map;
}
} | [
"[email protected]"
] | |
352642edbe7950f6a010e7e5cd8bdc8ab18bc455 | 32f38cd53372ba374c6dab6cc27af78f0a1b0190 | /app/src/main/java/com/autonavi/bl/search/PoilistClusterChild.java | 1365f621e05e2a283fe88e8c519789156e54d220 | [] | no_license | shuixi2013/AmapCode | 9ea7aefb42e0413f348f238f0721c93245f4eac6 | 1a3a8d4dddfcc5439df8df570000cca12b15186a | refs/heads/master | 2023-06-06T23:08:57.391040 | 2019-08-29T04:36:02 | 2019-08-29T04:36:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package com.autonavi.bl.search;
import java.util.ArrayList;
public class PoilistClusterChild {
public ArrayList<PoilistClusterChildInfo> item;
}
| [
"[email protected]"
] | |
477a7b7932b89cbeefcfbbeac7130bd98c526566 | f7be2aad450fc96adf5e1f79ffc723b3fefd0874 | /CTS_Seminar9/src/ro/ase/cts/flyweight/clase/Rezervare.java | e51e070fe3d19f90b10b96ad52be480915910db4 | [] | no_license | anampetrescu/CTS2021 | 7253a8298100e0052bbaa4fb60ebafe7087cd6d2 | a17add2bcd3d1b40772990235129279824982289 | refs/heads/master | 2023-05-13T15:19:13.597125 | 2021-06-03T14:05:04 | 2021-06-03T14:05:04 | 342,260,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package ro.ase.cts.flyweight.clase;
public class Rezervare {
private int nrMasa;
private int nrPers;
private int oraRezervare;
public Rezervare(int nrMasa, int nrPers, int oraRezervare) {
super();
this.nrMasa = nrMasa;
this.nrPers = nrPers;
this.oraRezervare = oraRezervare;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Rezervare [nrMasa=");
builder.append(nrMasa);
builder.append(", nrPers=");
builder.append(nrPers);
builder.append(", oraRezervare=");
builder.append(oraRezervare);
builder.append("]");
return builder.toString();
}
} | [
"[email protected]"
] | |
88664bfb284d726c6457b4413d4793600929628e | 4d89143f3517eafab9875ae240f08808dd0e1def | /src/cpw/mods/fml/common/toposort/ModSorter.java | ce7965f49c5082c2ec5fb31638d06b033de088fc | [] | no_license | muCkk/MCPC-1.4 | 0d9d7f12715dc3d45b5c37491ebd72b3d66cb46a | d616d26f9ccebfa76a2393707e397c64a36692f0 | refs/heads/master | 2020-12-25T03:11:09.051438 | 2012-11-07T10:07:43 | 2012-11-07T10:07:43 | 6,580,293 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,160 | java | package cpw.mods.fml.common.toposort;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.toposort.TopologicalSort$DirectedGraph;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class ModSorter
{
private TopologicalSort$DirectedGraph modGraph;
private ModContainer beforeAll = new DummyModContainer();
private ModContainer afterAll = new DummyModContainer();
private ModContainer before = new DummyModContainer();
private ModContainer after = new DummyModContainer();
public ModSorter(List var1, Map var2)
{
this.buildGraph(var1, var2);
}
private void buildGraph(List var1, Map var2)
{
this.modGraph = new TopologicalSort$DirectedGraph();
this.modGraph.addNode(this.beforeAll);
this.modGraph.addNode(this.before);
this.modGraph.addNode(this.afterAll);
this.modGraph.addNode(this.after);
this.modGraph.addEdge(this.before, this.after);
this.modGraph.addEdge(this.beforeAll, this.before);
this.modGraph.addEdge(this.after, this.afterAll);
Iterator var3 = var1.iterator();
ModContainer var4;
while (var3.hasNext())
{
var4 = (ModContainer)var3.next();
this.modGraph.addNode(var4);
}
var3 = var1.iterator();
while (var3.hasNext())
{
var4 = (ModContainer)var3.next();
if (var4.isImmutable())
{
this.modGraph.addEdge(this.beforeAll, var4);
this.modGraph.addEdge(var4, this.before);
}
else
{
boolean var5 = false;
boolean var6 = false;
Iterator var7 = var4.getDependencies().iterator();
ArtifactVersion var8;
String var9;
while (var7.hasNext())
{
var8 = (ArtifactVersion)var7.next();
var5 = true;
var9 = var8.getLabel();
if (var9.equals("*"))
{
this.modGraph.addEdge(var4, this.afterAll);
this.modGraph.addEdge(this.after, var4);
var6 = true;
}
else
{
this.modGraph.addEdge(this.before, var4);
if (Loader.isModLoaded(var9))
{
this.modGraph.addEdge(var2.get(var9), var4);
}
}
}
var7 = var4.getDependants().iterator();
while (var7.hasNext())
{
var8 = (ArtifactVersion)var7.next();
var6 = true;
var9 = var8.getLabel();
if (var9.equals("*"))
{
this.modGraph.addEdge(this.beforeAll, var4);
this.modGraph.addEdge(var4, this.before);
var5 = true;
}
else
{
this.modGraph.addEdge(var4, this.after);
if (Loader.isModLoaded(var9))
{
this.modGraph.addEdge(var4, var2.get(var9));
}
}
}
if (!var5)
{
this.modGraph.addEdge(this.before, var4);
}
if (!var6)
{
this.modGraph.addEdge(var4, this.after);
}
}
}
}
public List sort()
{
List var1 = TopologicalSort.topologicalSort(this.modGraph);
var1.removeAll(Arrays.asList(new ModContainer[] {this.beforeAll, this.before, this.after, this.afterAll}));
return var1;
}
}
| [
"[email protected]"
] | |
7ee41bc073dbc62b1e63229884bc20899b41a730 | e8821220c626d25505868f5bc1ef39687592ec43 | /src/main/java/xgt/util/easyexcel/last/ExcelCellStyle.java | 61108987bd3d6010f0c477517004e1e1e2f87caa | [] | no_license | xgtxxxx/easyexcel | 92c1e2925d6379551966309edc1c63e18f6e3792 | a61d698ee1b739da9b814c66533fe8560377f397 | refs/heads/master | 2020-05-18T16:37:42.627680 | 2015-08-14T09:11:39 | 2015-08-14T09:11:39 | 38,679,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,973 | java | package xgt.util.easyexcel.last;
import java.util.HashMap;
import java.util.Map;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Workbook;
public class ExcelCellStyle {
/**
* 字体加粗
*/
public static final short BOLD_ADD = Font.BOLDWEIGHT_BOLD;
/**
* 字体不加粗
*/
public static final short BOLD_NOMAL = Font.BOLDWEIGHT_NORMAL;
/**
* 红色字体
*/
public static final short COLOR_RED = Font.COLOR_RED;
/**
* 黑色字体
*/
public static final short COLOR_NORMAL = Font.COLOR_NORMAL;
/**
* 字体加下划线
*/
public static final byte UNDERLINE_ONE = Font.U_SINGLE_ACCOUNTING;
/**
* 字体不加下划线
*/
public static final byte UNDERLINE_NONE = Font.U_NONE;
/**
* 文字居中
*/
public static final short ALIGN_CENTER = CellStyle.ALIGN_CENTER;
/**
* 文字左对齐
*/
public static final short ALIGN_LEFT = CellStyle.ALIGN_LEFT;
/**
* 文字右对齐
*/
public static final short ALIGN_RIGHT = CellStyle.ALIGN_RIGHT;
public static final short FONT_SIZE_BIGGER = 16;
public static final short FONT_SIZE_BIG = 14;
public static final short FONT_SIZE_NORMAL = 12;
public static final short FONT_SIZE_SMALL = 10;
/**
* head样式
*/
public static final int HEAD_STYLE = 1;
/**
* money样式
*/
public static final int MONEY_STYLE = 2;
/**
* 不带边框的居中
*/
public static final int BORDER_NONE_CENTER = 3;
/**
* 不带边框的居左
*/
public static final int BORDER_NONE_LEFT = 4;
/**
* 不带边框的居右
*/
public static final int BORDER_NONE_RIGHT = 5;
/**
* 普通样式居左,带边框
*/
public static final int DEFAULT_STYLE_LEFT = 6;
/**
* 普通样式居中,带边框
*/
public static final int DEFAULT_STYLE_CENTER = 0;
//导出一次内存中的样式
private static Map<String,CellStyle> styles = new HashMap<String,CellStyle>();
private ExcelCellStyle(){}
/**
* 创建单元格样式
* @param fontColor 字体颜色
* @param fontBlod 字体加粗值
* @param fontUnderLine 字体下划线
* @param fontSize 字体大小
* @param fontAlign 字体对齐方式
* @param isBorder 单元格是否带边框
* @return
*/
public static CellStyle newInstance(ExcelHandler handler, short fontColor, short fontBlod,
byte fontUnderLine, short fontSize, short fontAlign,
boolean isBorder){
return newInstance(handler.getWorkbook(), fontColor, fontBlod, fontUnderLine, fontSize, fontAlign, isBorder);
}
/**
*
* @param wb
* @param fontColor
* @param fontBlod
* @param fontUnderLine
* @param fontSize
* @param fontAlign
* @param isBorder
* @return
*/
private static CellStyle newInstance(Workbook wb, short fontColor, short fontBlod,
byte fontUnderLine, short fontSize, short fontAlign,
boolean isBorder){
StringBuffer key = new StringBuffer();
key.append(fontColor).append(fontBlod).append(fontUnderLine).append(fontSize).append(fontAlign).append(isBorder);
CellStyle style = styles.get(key.toString());
if(style==null){
style = ExcelUtil.createCellStyle(wb, fontColor, fontBlod, fontUnderLine, fontSize, fontAlign, isBorder);
styles.put(key.toString(), style);
}
return style;
}
/**
* @see newStyle
* 默认单元格样式,带边框普通字体居中
* @return
*/
public static CellStyle newDefaultInstance(Workbook wb) {
return newInstance(wb,ExcelUtil.FONT_COLOR_NORMAL,ExcelUtil.FONT_BOLD_NOMAL,
ExcelUtil.NONE_UNDERLINE,ExcelUtil.FONT_NORMAL,ExcelUtil.ALIGN_CENTER,true);
}
/**
* @see newStyle
* 默认单元格样式,带边框普通字体居中
* @return
*/
public static CellStyle newDefaultInstance(ExcelHandler handler) {
return newInstance(handler,ExcelUtil.FONT_COLOR_NORMAL,ExcelUtil.FONT_BOLD_NOMAL,
ExcelUtil.NONE_UNDERLINE,ExcelUtil.FONT_NORMAL,ExcelUtil.ALIGN_CENTER,true);
}
/**
* 带边框
* @param handler
* @param align 字体对齐方式
* @return
*/
public static CellStyle newInstance(ExcelHandler handler,short align) {
return newInstance(handler,ExcelUtil.FONT_COLOR_NORMAL,ExcelUtil.FONT_BOLD_NOMAL,
ExcelUtil.NONE_UNDERLINE,ExcelUtil.FONT_NORMAL,align,true);
}
/**
* @see newStyle
* 创建单元格样式
* @param style 样式类型
* @return
*/
public static CellStyle newInstance(ExcelHandler handler,int style){
switch(style){
case 0 :
return newDefaultInstance(handler);
case 1 :
return newInstance(
handler,
ExcelUtil.FONT_COLOR_NORMAL,
ExcelUtil.FONT_BOLD,
ExcelUtil.NONE_UNDERLINE,
ExcelUtil.FONT_NORMAL,
ExcelUtil.ALIGN_CENTER,
true);
case 2 :
return newInstance(
handler,
ExcelUtil.FONT_COLOR_NORMAL,
ExcelUtil.FONT_BOLD_NOMAL,
ExcelUtil.NONE_UNDERLINE,
ExcelUtil.FONT_NORMAL,
ExcelUtil.ALIGN_RIGHT,
true
);
case 3 :
return newInstance(
handler,
ExcelUtil.FONT_COLOR_NORMAL,
ExcelUtil.FONT_BOLD_NOMAL,
ExcelUtil.NONE_UNDERLINE,
ExcelUtil.FONT_NORMAL,
ExcelUtil.ALIGN_CENTER,
false
);
case 4 :
return newInstance(
handler,
ExcelUtil.FONT_COLOR_NORMAL,
ExcelUtil.FONT_BOLD_NOMAL,
ExcelUtil.NONE_UNDERLINE,
ExcelUtil.FONT_NORMAL,
ExcelUtil.ALIGN_LEFT,
false
);
case 5 :
return newInstance(
handler,
ExcelUtil.FONT_COLOR_NORMAL,
ExcelUtil.FONT_BOLD_NOMAL,
ExcelUtil.NONE_UNDERLINE,
ExcelUtil.FONT_NORMAL,
ExcelUtil.ALIGN_RIGHT,
false
);
case 6 :
return newInstance(
handler,
ExcelUtil.FONT_COLOR_NORMAL,
ExcelUtil.FONT_BOLD_NOMAL,
ExcelUtil.NONE_UNDERLINE,
ExcelUtil.FONT_NORMAL,
ExcelUtil.ALIGN_LEFT,
true
);
default :
return newDefaultInstance(handler);
}
}
public static void clear(){
styles.clear();
}
}
| [
"[email protected]"
] | |
fb76dc0d8c0f47699086c01d4cb75d8f06c32b0e | ee1875f56a85681e94090327eb1f1bd49cd99e27 | /library/src/main/java/fr/prcaen/externalresources/converter/JsonConverter.java | 1cea4bcdf5919be1ed117357189b27495f56df53 | [
"Apache-2.0"
] | permissive | prcaen/external-resources | 3df0b1ca8b571367d8653306ddf38d0e17a4ded8 | 96d152f84683db5479e94f2899e6162f5bf83089 | refs/heads/develop | 2021-01-21T13:29:51.296645 | 2016-05-27T18:30:22 | 2016-05-27T18:30:29 | 47,921,185 | 174 | 15 | null | 2016-01-06T20:12:00 | 2015-12-13T13:54:00 | Java | UTF-8 | Java | false | false | 2,790 | java | package fr.prcaen.externalresources.converter;
import android.support.annotation.Nullable;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import fr.prcaen.externalresources.model.Resource;
import fr.prcaen.externalresources.model.Resources;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Map;
public final class JsonConverter implements Converter {
private static final Gson GSON =
new GsonBuilder().registerTypeAdapter(Resource.class, new ResourceJsonDeserializer())
.create();
@Override @Nullable public Resources fromReader(Reader reader) throws IOException {
JsonObject jsonObject = GSON.fromJson(reader, JsonObject.class);
if (null == jsonObject) {
return null;
}
Resources resources = new Resources();
for (Map.Entry<String, JsonElement> entry : jsonObject.entrySet()) {
Resource resource = GSON.fromJson(entry.getValue(), Resource.class);
if (null != resource) {
resources.add(entry.getKey(), resource);
}
}
return resources;
}
@SuppressWarnings("unused") public Resources fromString(String string) throws IOException {
return fromReader(new StringReader(string));
}
protected static class ResourceJsonDeserializer implements JsonDeserializer<Resource> {
@Override
public Resource deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
return get(json, 0);
}
@Nullable private Resource get(JsonElement json, int depth) throws JsonParseException {
if (json.isJsonPrimitive()) {
return get(json.getAsJsonPrimitive());
} else if (json.isJsonArray() && depth == 0) {
ArrayList<Resource> resources = new ArrayList<>();
for (JsonElement element : json.getAsJsonArray()) {
resources.add(get(element, 1));
}
Resource[] resourcesArray = new Resource[resources.size()];
resourcesArray = resources.toArray(resourcesArray);
return new Resource(resources.toArray(resourcesArray));
} else {
return null;
}
}
private Resource get(JsonPrimitive primitive) {
if (primitive.isBoolean()) {
return new Resource(primitive.getAsBoolean());
} else if (primitive.isNumber()) {
return new Resource(primitive.getAsNumber());
} else {
return new Resource(primitive.getAsString());
}
}
}
}
| [
"[email protected]"
] | |
ac546e270e6c86e7d4b60ac3a3d60366382e0c57 | b3b62a79bb1821cbb39e395bf7234d4128c035cf | /src/day32/ArrayPracticewithMethod.java | 0e09a7086594c86dd1b80979c38d98528a02a4a3 | [] | no_license | aytenmarul/firsjavamm | 6aecf84fecd7fdf4dd3e9a013ff86776ff8d07e8 | 930b222db56bff5794aa3e38a1a7c11803d7d5d0 | refs/heads/master | 2020-11-28T04:44:11.770830 | 2019-12-23T08:06:24 | 2019-12-23T08:06:24 | 229,706,397 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package day32;
import java.util.Arrays;
public class ArrayPracticewithMethod {
public static void main(String[] args) {
printArrayItems(new int[]{ 1,6,5,3,12,3});
int [] scores={2,5,23,4,5,6};
printArrayItems(scores);
}
public static void printArrayItems(int [] nums){
System.out.println("array has items:"+Arrays.toString(nums));
}
}
| [
"[email protected]"
] | |
d979a49fe36080ac54a7f293d5f621b42145e46c | b7966f4fdd04a066811a0389f4111b0b9014f6ee | /app/src/main/java/com/greencross/greencare/network/tr/BaseData.java | 2f3aeec54f566bfde639cbd848dad6200946fa7c | [] | no_license | tddyko/HealthCareSolution | f370eb3f23aaa84abdceda16567ccf63f2a4fd82 | 901f65f12f07e4144bed70a66e54f828fecf3fc8 | refs/heads/master | 2023-08-23T07:14:31.704097 | 2021-09-25T09:36:09 | 2021-09-25T09:36:09 | 410,231,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,901 | java | package com.greencross.greencare.network.tr;
import android.content.Context;
import android.os.Build;
import com.google.firebase.iid.FirebaseInstanceId;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
public class BaseData implements Cloneable, IBaseData {
protected Context mContext;
public String APP_CODE = "android"+ Build.VERSION.RELEASE;
public String DEVICE_TOKEN = FirebaseInstanceId.getInstance().getToken();
public String INSURES_CODE = "300";
protected String getApiCode(String tag) {
return tag.replace("Tr_", "");
}
protected String conn_url = "";
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
protected JSONObject getBaseJsonObj(String apiCode) throws JSONException{
JSONObject body = new JSONObject();
body.put("api_code", apiCode);
body.put("app_code", APP_CODE);
body.put("insures_code", INSURES_CODE);
return body;
}
public String toString() {
StringBuilder sBuilder = new StringBuilder();
Class<?> gotClass = this.getClass();
String className = gotClass.getName();
Field[] fields = gotClass.getFields();
int fieldLen = fields.length;
Field field = null;
String fieldName = null;
String fieldValue = null;
Class<?> fieldType = null;
sBuilder.append("#ClassName=" + className + "\n");
for (int i = 0; i < fieldLen; ++i) {
field = fields[i];
fieldName = field.getName();
fieldType = field.getType();
if (Modifier.isFinal(field.getModifiers()) || Modifier.isStatic(field.getModifiers())) {
continue;
}
try {
if (fieldType.isArray()) {
fieldValue = Arrays.toString((Object[]) field.get(BaseData.this));
} else {
fieldValue = field.get(BaseData.this).toString();
}
} catch (Exception e) {
}
sBuilder.append(fieldName + "=" + fieldValue + "\n");
}
return sBuilder.toString();
}
/**
* 이미지 데이터 불러올때 null 이거나 "" 이면 불러올 필요가 없으므로 null로 리턴 한다
* @param url
* @param photo
* @return
*/
public String getPhoto(String url, String photo) {
if (checkPhotoData(photo)) {
return url+photo;
} else {
return null;
}
}
public boolean checkPhotoData(String photo) {
if (photo == null || "".equals(photo)) {
return false;
}
return true;
}
@Override
public JSONObject makeJson(Object obj) throws JSONException {
return null;
}
// B representing the byte primitive type
// S representing the short primitive type
// I representing the int primitive type
// J representing the long primitive type
// F representing the float primitive type
// D representing the double primitive type
// C representing the char primitive type
// Z representing the boolean primitive type
// V representing void function return values
}
| [
"[email protected]"
] | |
22c6652e01aa2b2a642826736d826488c493e166 | 1846430b598ca4d54f6f27cb9a34665a8b092bfe | /src/test/java/OperatorTest.java | 9cf5d90fb41d81802e40637dd2694abd082f2307 | [] | no_license | Grommash88/CompanyAndStaff | f8ed2ec2c2a08ca0c22771a1027a09fb6de35c77 | 8ed19bfd5d35e64dcf7da8b858968771557c1f24 | refs/heads/main | 2023-07-26T14:47:46.255281 | 2021-09-01T16:36:33 | 2021-09-01T16:36:33 | 398,320,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,090 | java | import static org.junit.jupiter.api.Assertions.assertEquals;
import java.math.BigDecimal;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import ru.lakeev.companyandstaff.company.Company;
import ru.lakeev.companyandstaff.staff.Operator;
import ru.lakeev.companyandstaff.staff.StaffFactory;
import ru.lakeev.companyandstaff.staff.parent.Employee;
@DisplayName("Тест класса ru.lakeev.companyandstaff.staff.Operator.java")
public class OperatorTest {
private Employee operator;
private Company company;
@BeforeEach
public void setUp() {
operator = StaffFactory.createAndGetEmployee(Operator.class.getSimpleName());
company = new Company();
company.hire(operator);
}
@Test
@DisplayName("Тест метода getMonthSalary.")
void getMonthSalaryTest() {
BigDecimal expected = operator.getSalary();
assertEquals(expected.doubleValue(), operator.getMonthSalary(),
"Месячная зарплата не равна фиксированной ставке.");
}
}
| [
"[email protected]"
] | |
06002c5806d8a58e2c023c6964718178bb71263f | d0b2e7a5886252cbbaad9f44599eac7e3576e7a8 | /src/main/java/student_eduards_jasvins/lesson_2/day_3/Task_10.java | 30c2f59a30d46172e9a7059ade2aeae04fd6e0d4 | [] | no_license | Dmitryyyyo/java_1_tuesday_2020_online | ac1b44822a2aed40a6e12e6909e9b8c699e57d4c | 7e3bba7ead444d0b2bf1b6715289b2fcc4d22c54 | refs/heads/master | 2023-01-02T11:21:40.223345 | 2020-10-21T18:02:55 | 2020-10-21T18:02:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package student_eduards_jasvins.lesson_2.day_3;
import java.util.Scanner;
public class Task_10 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter radius!");
double radius = scanner.nextDouble();
double area = Math.PI * (radius * radius);
System.out.println("Area is " + area);
double perimeter = Math.PI * (2 * radius);
System.out.println("Perimeter is " + perimeter);
}
}
| [
"[email protected]"
] | |
a13c0dd5a839fee303bb2de5f2b52b97df898385 | 4885393ebfb7fbd9bfe333c15ac1024f69ccb07e | /SnakeGame/src/model/Mouse.java | 4358d0e0a56c2ba09efcb8a02a85143b5f164b3b | [] | no_license | lashka12/snake | 90cba30fc83c08441adbe1f8870a65f849091975 | 1f2127f2d9121df2bea1605f6d1ffdd189dba511 | refs/heads/master | 2020-09-15T12:56:05.408885 | 2020-05-05T16:47:47 | 2020-05-05T16:47:47 | 223,451,117 | 2 | 0 | null | 2020-07-15T16:58:47 | 2019-11-22T17:15:57 | Java | UTF-8 | Java | false | false | 3,748 | java | package model;
import java.util.Random;
import utilities.Constants;
import utilities.Direction;
/**
* this class represents a mouse in the game that move randomly on the play
* ground
*
* @author L.A
*
*/
public class Mouse extends Block {
private Direction direction;
private boolean eaten;
/**
* full constructor
*
* @param x - x position
* @param y - y position
*/
public Mouse(int x, int y) {
super(x, y);
stepsCount = 0;
this.direction = Direction.UP;
}
/**
* moving the mouse one step up
*/
public void moveUp() {
if (getY() > 0) {
setY(getY() - 1);
}
}
/**
* moving the mouse one step down
*/
public void moveDown() {
if (getY() < Constants.GAME_HIGHT - 7) {
setY(getY() + 1);
}
}
/**
* moving the mouse one step left
*/
public void moveLeft() {
if (getX() > 0) {
setX(getX() - 1);
}
}
/**
* moving the mouse one step right
*/
public void moveRight() {
if (getX() < Constants.GAME_WIDTH - 7) {
setX(getX() + 1);
}
}
/**
* this method is called when ever the main timer of the game asks to , it
* updates the mouse position step at a time according to a specific algorithm
*/
public void update() {
if (stepsCount == 0) {
Random rand = new Random();
int randomNum = rand.nextInt(4) + 1;
while (true) {
if ((direction == Direction.UP & randomNum == 2) || (direction == Direction.DOWN & randomNum == 2)
|| (direction == Direction.LEFT & randomNum == 4)
|| (direction == Direction.RIGHT & randomNum == 3)) {
rand = new Random();
randomNum = rand.nextInt(4) + 1;
} else {
break;
}
}
switch (randomNum) {
case 1:
direction = Direction.UP;
moveUp();
break;
case 2:
direction = Direction.DOWN;
moveDown();
break;
case 3:
direction = Direction.LEFT;
moveLeft();
break;
case 4:
direction = Direction.RIGHT;
moveRight();
break;
}
stepsCount++;
} else {
switch (direction) {
case UP:
moveUp();
break;
case DOWN:
moveDown();
break;
case LEFT:
moveLeft();
break;
case RIGHT:
moveRight();
break;
}
if (stepsCount == 20) { // keep walking in the same direction 30 steps before changing direction
Random rand = new Random();
int randomNum = rand.nextInt(4) + 1;
while (true) {
if ((direction == Direction.UP & randomNum == 2) || (direction == Direction.DOWN & randomNum == 1)
|| (direction == Direction.LEFT & randomNum == 4)
|| (direction == Direction.RIGHT & randomNum == 3)) {
rand = new Random();
randomNum = rand.nextInt(4) + 1;
} else {
break;
}
}
switch (randomNum) {
case 1:
direction = Direction.UP;
moveUp();
break;
case 2:
direction = Direction.DOWN;
moveDown();
break;
case 3:
direction = Direction.LEFT;
moveLeft();
break;
case 4:
direction = Direction.RIGHT;
moveRight();
break;
}
stepsCount = 0;
}
stepsCount++;
}
}
public boolean isEaten() {
return eaten;
}
public void setEaten(boolean eaten) {
this.eaten = eaten;
}
private static int stepsCount;
public Direction getDirection() {
return direction;
}
public void setDirection(Direction direction) {
this.direction = direction;
}
public static int getStepsCount() {
return stepsCount;
}
public static void setStepsCount(int stepsCount) {
Mouse.stepsCount = stepsCount;
}
}
| [
"L.A@DESKTOP-490V3G5"
] | L.A@DESKTOP-490V3G5 |
56f9d2b31369999accfccd9939c26bec3e28f557 | 6572dcb7a13dd505ff23a09b07bd2e0f42fe4197 | /SmartParking Android/app/src/main/java/com/example/akhil/smartparking/BaseActivity.java | 6e06815edb3d3a4d504f9034e910644adf8940a5 | [] | no_license | amarpadga/Smart-Parking | acbf5e7ee353b3488a5615afb7656c0de3d915bc | 45a578845f60fc28fce2b462fe701e11f3ed4860 | refs/heads/master | 2020-05-27T21:24:19.832114 | 2017-04-08T04:05:28 | 2017-04-08T04:05:28 | 83,683,562 | 0 | 0 | null | 2017-04-08T04:05:29 | 2017-03-02T13:56:52 | Ruby | UTF-8 | Java | false | false | 3,040 | java | package com.example.akhil.smartparking;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
/**
* The BaseActivity is being extended by all the activities. This activity is an extension to AppCompatActivity
* which was originally the supreme class. By making this class it adds the Menu item to all the classes.
*/
public class BaseActivity extends AppCompatActivity{
private SharedPreferences mPreferences;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
//Visibilities of the menu items are set dependant if the user is logged in or not
mPreferences = getSharedPreferences("CurrentUser", MODE_PRIVATE);
//If user is logged in:
if(mPreferences.contains("uid")){
menu.getItem(3).setVisible(false); //LoginActivity is hidden
menu.getItem(2).setVisible(true); //MyReservations activity can be seen
menu.getItem(4).setVisible(true); //Logout button is shown
}else{
System.out.println("uid doesnt exist");
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
mPreferences = getSharedPreferences("CurrentUser", MODE_PRIVATE);
switch (item.getItemId()) {
case R.id.menu1:
Toast.makeText(this, "Clicked: Parking View", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, MainActivity.class);
this.startActivity(intent);
break;
case R.id.menu2:
Toast.makeText(this, "Clicked: My Reservations", Toast.LENGTH_SHORT).show();
Intent intent2 = new Intent(this, MyReservations.class);
this.startActivity(intent2);
break;
case R.id.menu3:
Toast.makeText(this, "Clicked: Login/Register", Toast.LENGTH_SHORT).show();
Intent intent3 = new Intent(this, LoginActivity.class);
this.startActivity(intent3);
break;
case R.id.menu4:
//Logout is selected. Clears the session and notifies all the activities that the user is not logged in.
Toast.makeText(this, "Clicked: Logout", Toast.LENGTH_SHORT).show();
SharedPreferences preferences =getSharedPreferences("CurrentUser", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.commit();
invalidateOptionsMenu();
Intent intent5 = new Intent(this, MainActivity.class);
this.startActivity(intent5);
break;
default:
return super.onOptionsItemSelected(item);
}
return true;
}
} | [
"[email protected]"
] | |
ef5f55524e2f9aa8690f30c1302b30f129f78ca2 | 28a0576cd556796a64515bab9f9fca45aeb11bcd | /src/main/java/org/marcel/vaadin/vaadin7test/mvp_adv/Presenter.java | 53963b4b42e45da7e6dadfc6c5532e43f7ecbf80 | [] | no_license | marcelseifert/mvvp_vaadin | 3bf3d424c065ac5a0cacdeb232338a0414716053 | 5fdf4e2e44781d4869396c40b7bd3499747b8413 | refs/heads/master | 2021-01-10T19:26:14.075403 | 2012-12-18T18:05:08 | 2012-12-18T18:05:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.marcel.vaadin.vaadin7test.mvp_adv;
import com.vaadin.ui.Button;
/**
*
* @author Marcel
*/
public interface Presenter {
void bind();
void unbind();
}
| [
"Marcel@Toschi"
] | Marcel@Toschi |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.