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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bed3d6694bf027c722e52fa51e93092ed931e47d | a46e033f66df3f32cdeb6651a63d1e5277f6b8bf | /src/com/se/mapping/Visit.java | 04b269937f1e65365114534f22fa833a54bb9ab5 | [] | no_license | MohamedGawad/Clinic-App | 9c7333a3d93b5ab96828d1205926e9e2be2727e0 | 95951e9d3d2a132f64f5c53c999bab201332922f | refs/heads/master | 2021-01-10T21:17:52.261313 | 2015-03-21T22:01:26 | 2015-03-31T03:14:52 | 32,651,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,246 | java | package com.se.mapping;
// Generated Mar 21, 2015 7:24:01 PM by Hibernate Tools 3.6.0
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
/**
* Visit generated by hbm2java
*/
public class Visit implements java.io.Serializable {
private Integer id;
private Patient patient;
private String complaint;
private String hpi;
private String ph;
private String ears;
private String nose;
private String pharynx;
private String larynx;
private String neckOtherareas;
private String otherData;
private String investigationDone;
private String investigationRequest;
private String treatment;
private Date visitDate;
private Set<Followup> followups = new HashSet<Followup>(0);
public Visit() {
}
public Visit(Patient patient, String complaint, String hpi, String ph,
String ears, String nose, String pharynx, String larynx,
String neckOtherareas, String otherData, String investigationDone,
String investigationRequest, String treatment) {
this.patient = patient;
this.complaint = complaint;
this.hpi = hpi;
this.ph = ph;
this.ears = ears;
this.nose = nose;
this.pharynx = pharynx;
this.larynx = larynx;
this.neckOtherareas = neckOtherareas;
this.otherData = otherData;
this.investigationDone = investigationDone;
this.investigationRequest = investigationRequest;
this.treatment = treatment;
}
public Visit(Patient patient, String complaint, String hpi, String ph,
String ears, String nose, String pharynx, String larynx,
String neckOtherareas, String otherData, String investigationDone,
String investigationRequest, String treatment, Set<Followup> followups) {
this.patient = patient;
this.complaint = complaint;
this.hpi = hpi;
this.ph = ph;
this.ears = ears;
this.nose = nose;
this.pharynx = pharynx;
this.larynx = larynx;
this.neckOtherareas = neckOtherareas;
this.otherData = otherData;
this.investigationDone = investigationDone;
this.investigationRequest = investigationRequest;
this.treatment = treatment;
this.followups = followups;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Patient getPatient() {
return this.patient;
}
public void setPatient(Patient patient) {
this.patient = patient;
}
public String getComplaint() {
return this.complaint;
}
public void setComplaint(String complaint) {
this.complaint = complaint;
}
public String getHpi() {
return this.hpi;
}
public void setHpi(String hpi) {
this.hpi = hpi;
}
public String getPh() {
return this.ph;
}
public void setPh(String ph) {
this.ph = ph;
}
public String getEars() {
return this.ears;
}
public void setEars(String ears) {
this.ears = ears;
}
public String getNose() {
return this.nose;
}
public void setNose(String nose) {
this.nose = nose;
}
public String getPharynx() {
return this.pharynx;
}
public void setPharynx(String pharynx) {
this.pharynx = pharynx;
}
public String getLarynx() {
return this.larynx;
}
public void setLarynx(String larynx) {
this.larynx = larynx;
}
public String getNeckOtherareas() {
return this.neckOtherareas;
}
public void setNeckOtherareas(String neckOtherareas) {
this.neckOtherareas = neckOtherareas;
}
public String getOtherData() {
return this.otherData;
}
public void setOtherData(String otherData) {
this.otherData = otherData;
}
public String getInvestigationDone() {
return this.investigationDone;
}
public void setInvestigationDone(String investigationDone) {
this.investigationDone = investigationDone;
}
public String getInvestigationRequest() {
return this.investigationRequest;
}
public void setInvestigationRequest(String investigationRequest) {
this.investigationRequest = investigationRequest;
}
public String getTreatment() {
return this.treatment;
}
public void setTreatment(String treatment) {
this.treatment = treatment;
}
public Set<Followup> getFollowups() {
return this.followups;
}
public void setFollowups(Set<Followup> followups) {
this.followups = followups;
}
public Date getVisitDate() {
return visitDate;
}
public void setVisitDate(Date visitDate) {
this.visitDate = visitDate;
}
}
| [
"Gawad@Mohamed"
] | Gawad@Mohamed |
c665c62de8a0dcb6e59270b9a405749dd7582940 | 6fec1124ad5cae9e50429fae3fc501ae54abf82a | /EsExtends/src/it/engim/esExtends/CollectionBicy.java | 84f170f09f3c38a346c07ab91ec3c0e63bfdf80c | [] | no_license | zeionut/workspace | 5425ce5c8c01194b237b5ff5bb46b1118b227fdf | fd9625e683e649cc63d494573ab21e97d7f9762b | refs/heads/master | 2021-01-10T01:42:49.905815 | 2016-04-08T11:22:53 | 2016-04-08T11:22:53 | 55,767,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,216 | java | package it.engim.esExtends;
public class CollectionBicy {
private Bicycle [] bicyList;
public CollectionBicy(int i) {
this.bicyList = new Bicycle[i];
}
public Bicycle[] getBicyList() {
return bicyList;
}
public void setBicyList(Bicycle[] bicyList) {
this.bicyList = bicyList;
}
public boolean verifyExistedName(String name) {
boolean verify = false;
for (int i = 0; i < this.bicyList.length && !verify; i++) {
if (name.equals(this.bicyList[i].getOwner().getName())) {
verify = true;
}
}
return verify;
}
public Bicycle findBicyFormName(String name) {
boolean verify = false;
Bicycle tempBicy = new Bicycle();
for (int i = 0; i < this.bicyList.length && !verify; i++) {
if (name.equals(this.bicyList[i].getOwner().getName())) {
tempBicy = this.bicyList[i];
verify = true;
}
}
return tempBicy;
}
public boolean verifyBicy(String name) {
boolean verify;
Bicycle tempBicy = findBicyFormName(name);
if (tempBicy instanceof ElectricBicycle) {
verify = false;
}
else {
verify = true;
}
return verify;
}
}
| [
"[email protected]"
] | |
f435a7d1b55db95601f9ef0df3b0adfbf1a2d50c | 160a34361073a54d39ffa14fdae6ce3cbc7d6e6b | /src/main/java/com/alipay/api/domain/StandardCategoryInfo.java | 5b44136dce789c219615269cdd95a0c7002cac93 | [
"Apache-2.0"
] | permissive | appbootup/alipay-sdk-java-all | 6a5e55629b9fc77e61ee82ea2c4cdab2091e0272 | 9ae311632a4053b8e5064b83f97cf1503a00147b | refs/heads/master | 2020-05-01T09:45:44.940180 | 2019-03-15T09:52:14 | 2019-03-15T09:52:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,932 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 口碑标准后台类目
*
* @author auto create
* @since 1.0, 2017-06-06 11:40:51
*/
public class StandardCategoryInfo extends AlipayObject {
private static final long serialVersionUID = 7447165982567425265L;
/**
* 后台类目ID,类目信息的主键;商品类目ID,发布/修改商品的时候,需要填写商品所属的类目ID
*/
@ApiField("category_id")
private String categoryId;
/**
* 是否为叶子类目,商品只能够发布在叶子类目下
*/
@ApiField("is_leaf")
private String isLeaf;
/**
* 类目名称
*/
@ApiField("name")
private String name;
/**
* 本类目的上一级类目ID,如果本类目是一级类目,上一级类目ID为空
*/
@ApiField("parent_id")
private String parentId;
/**
* 类目路径,递归父一级类目ID的列表,依次按照一级、二级、三级...顺序排列
*/
@ApiField("path")
private String path;
/**
* 类目所属一级类目的ID,若本类目是一级类目,值为本类目的ID
*/
@ApiField("root_id")
private String rootId;
public String getCategoryId() {
return this.categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getIsLeaf() {
return this.isLeaf;
}
public void setIsLeaf(String isLeaf) {
this.isLeaf = isLeaf;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getParentId() {
return this.parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getPath() {
return this.path;
}
public void setPath(String path) {
this.path = path;
}
public String getRootId() {
return this.rootId;
}
public void setRootId(String rootId) {
this.rootId = rootId;
}
}
| [
"[email protected]"
] | |
8c59a204d3eea3fa3170be868ec47916a38899ab | 16850d0bfd3b9ec27a4127d50c4aec8da840f583 | /app/src/main/java/com/newland/homecontrol/activity/StudyActivity.java | f8ff029add446386e457d2f74f5fd0cef54c4d0e | [] | no_license | Steven-Lion/HOMEControl2_init | cbccaac319974e7c27b3e7487bf2759ee0c0b554 | ca40bd991ce8feffcb40d2f15efe75760723a4d5 | refs/heads/master | 2020-03-16T22:47:27.203109 | 2018-05-12T10:28:42 | 2018-05-12T10:28:42 | 133,052,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,083 | java | package com.newland.homecontrol.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.newland.homecontrol.bean.Global;
import com.newland.homecontrol.R;
import com.newland.homecontrol.utils.SharedPreferencesUtils;
import com.nlecloud.nlecloudlibrary.api.ApiResponse;
import com.nlecloud.nlecloudlibrary.core.ActionCallbackListener;
import com.nlecloud.nlecloudlibrary.core.AppAction;
import com.nlecloud.nlecloudlibrary.core.AppActionImpl;
/**
* 书房
*/
public class StudyActivity extends Activity {
private TextView tvTitle;
private LinearLayout llbottomBackGround;//下部分背景 需要设置透明度
private RelativeLayout rlBackGround;//背景图片
private ImageView ivCurtain;
private CheckBox cbStudy;
private AppAction mAppAction;
private SharedPreferencesUtils spUtils;
private boolean isSave=false;//是否要保存灯的状态到SP中
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_study);
//初始化视图
initView();
//初始化监听
initCheckListenser();
}
private void initView() {
tvTitle = (TextView) findViewById(R.id.tvTitle);
llbottomBackGround = (LinearLayout) findViewById(R.id.llbottomBackGround);
rlBackGround = (RelativeLayout) findViewById(R.id.rlBackGround);
cbStudy = (CheckBox) findViewById(R.id.cbStudy);
llbottomBackGround.getBackground().setAlpha(220);
tvTitle.setText("书房灯控");
mAppAction = new AppActionImpl(this);
// 设置服务器地址
spUtils = SharedPreferencesUtils.getInstant(this);
cbStudy.setChecked(spUtils.getStudy());//设置灯控开关初始状态
setLightBackground(spUtils.getStudy(),false);//设置书房灯的初始状态
if (spUtils.getISAutomatic()) {//是自动模式 隐藏下方按钮
llbottomBackGround.setVisibility(View.INVISIBLE);
} else {
llbottomBackGround.setVisibility(View.VISIBLE);
}
}
/**
* 开关灯状态监听
*/
private void initCheckListenser() {
//窗帘开关监听
cbStudy.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (spUtils.getIsSimulation()) {
//如果是模拟,开关灯直接切换图片
setLightBackground(isChecked,true);
} else {
//如果不是模拟,去获取云平台上灯的开关状态
operateLight(isChecked);
}
}
});
}
/**
* 模拟的时候设置灯的灯的状态(直接切换图片)
*/
private void setLightBackground(boolean check,boolean isSave) {
if(isSave){
//存储当前卧室灯的开关状态
spUtils.setStudy(cbStudy.isChecked());
}
if (check) {
rlBackGround.setBackgroundResource(R.mipmap.pic_study);
} else {
rlBackGround.setBackgroundResource(R.mipmap.pic_study_close);
}
}
/**
* 通知设备开关
*
* @param isChecked
*/
private void operateLight(final boolean isChecked) {
mAppAction.onOff(Global.LIGHT_STUDY, isChecked,
new ActionCallbackListener<ApiResponse<String>>() {
@Override
public void onSuccess(ApiResponse<String> data) {
setLightBackground(isChecked,true);//进行开关灯图片替换
}
@Override
public void onFailure(String errorEven, String message) {
Toast.makeText(StudyActivity.this, message,
Toast.LENGTH_SHORT).show();
}
});
}
@Override
protected void onDestroy() {
//卧室界面activity结束时 发送广播 进行通知各卧室界面现在是处于哪个状态
Intent intent = new Intent("com.nangch.broadcasereceiver.MYRECEIVER");
intent.putExtra("check", "check"); //向广播接收器传递数据
sendBroadcast(intent);//发送check消息 通知灯光控制界面 改变灯光展示图片
super.onDestroy();
}
/**
* 点击事件
* @param view
*/
public void MyClick(View view) {
switch (view.getId()) {
case R.id.ivBack://返回
finish();
break;
}
}
}
| [
"[email protected]"
] | |
2bae16e3a285e4b5541f8094cda1fb6203e75cf2 | 4a14000f60919ca75d7a3200116f5b181f298806 | /src/com/test/unit9/VerifierTest.java | d877e8d363a9aa067e17b39ef93913ce96ee1c56 | [] | no_license | Gitrenzhijiang/JavaCoreDemo | 5b0f19fea5116e1186c16bdab11c5f2aab4af5df | 36bf1e9d41e977c941ee7d23a239ab71ffb3f94e | refs/heads/master | 2020-04-23T15:32:55.923512 | 2019-02-18T11:13:05 | 2019-02-18T11:13:05 | 171,269,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,235 | java | package com.test.unit9;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.file.Paths;
/**
* Java SecurityManager 测试实例
* @author REN
*
*/
public class VerifierTest {
public static void main(String[] args) throws Exception {
System.setProperty("java.security.policy", "MyApp.policy");
SecurityManager sm = new SecurityManager();
System.setSecurityManager(sm); // 安装安全管理器
System.out.println(sm);
File file = Paths.get("D://a/123.txt").toFile();
try (
PrintWriter pw = new PrintWriter(
new OutputStreamWriter(
new FileOutputStream(file, true)));
){
pw.append("hello,world");
}
}
static int fun()
{
int m = 1;
int n;
m = 1;
n = 2; // 在n=2,的字节码变成m=2;
int r = m + n;
return r;
}
}
| [
"[email protected]"
] | |
72b4be0b85b42e90a0e9f1acdb88507cf5ee79c7 | 3b1e641f51d9cb0c39804dd35e693f0586b7316b | /src/com/configuration/YamlConfiguration.java | 809a0f02597c424001956d5b4ab3f6172f69dc32 | [] | no_license | mohanr/Code-Generator | 61dfd4ea1c6a59f14480e11eda9ffc172549142d | 016dbd742b36bdf05c44772b096d76758c9c6887 | refs/heads/master | 2021-01-19T04:51:55.020174 | 2019-12-18T09:39:35 | 2019-12-18T09:39:35 | 61,132,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,034 | java | package com.configuration;
import org.yaml.snakeyaml.TypeDescription;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by Mohan Radhakrishnan on 7/11/2016.
*/
public class YamlConfiguration {
Yaml yaml = new Yaml();
Map<String, ArrayList> config;
static TransformerRuleConfiguration rules;
public static final String CONFIG_FILE = "D:\\IdeaProjects\\Antlr\\config.yml";
private YamlConfiguration(){
}
public static TransformerRuleConfiguration getDefaultTransformerRuleConfiguration(){
Constructor constructor = new Constructor(TransformerRuleConfiguration.class);
TypeDescription ruleDescription = new TypeDescription(TransformerRuleConfiguration.class);
constructor.addTypeDescription( ruleDescription );
loadImports( ruleDescription );
loadOutputLocation( ruleDescription );
loadClassIdentifier(ruleDescription);
Yaml yaml = new Yaml(constructor);
try {
rules =
(TransformerRuleConfiguration) yaml.loadAs(new FileReader(CONFIG_FILE), TransformerRuleConfiguration.class);
}catch( final FileNotFoundException fnfex ){
throw new Error(fnfex);
}
return rules;
}
private static void loadOutputLocation( TypeDescription ruleDescription ) {
ruleDescription.putListPropertyType("outputDir", String.class);
}
private static void loadImports( TypeDescription ruleDescription ){
ruleDescription.putListPropertyType("oldImports", String.class);
ruleDescription.putListPropertyType("newImports", String.class);
}
private static void loadClassIdentifier( TypeDescription ruleDescription ){
ruleDescription.putListPropertyType("classIdentifier ", String.class);
}
}
| [
"[email protected]"
] | |
cef23af2baee0b6de5b619ab850babad33437447 | ea26cbed5987b284b15a919c42b6d4dd04145809 | /src/main/java/com/oop/mail/MailController.java | d97573121fd101b53eaced7bcea84e9e356eff9c | [] | no_license | petrostrak/airSense | 94578697e6d23c39116969ffb6e99bd5a6038f31 | 4cca6719f2dc78c6f1ff06ba4b6f984930e333d5 | refs/heads/master | 2022-11-19T05:51:15.095382 | 2020-07-21T06:44:34 | 2020-07-21T06:44:34 | 269,696,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,121 | java | package com.oop.mail;
import com.oop.entities.SensorLocation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author orestis
*/
@RestController
public class MailController {
@Autowired
private MailService emailService;
@RequestMapping(value = "/sendmail", method = RequestMethod.GET)
public String sendMail() {
// String from = "[email protected]";
String subject = "Dickpics from your awesome springboot app";
String toAddresses = "[email protected]";
String body = "<html> <body><h1>Rendered HTML, plain text is for boootsam </h1> </body></html>";
emailService.sendMail(subject, toAddresses, body);
return "mail sent";
}
}
// TODO check here for html paths:
// https://stackoverflow.com/questions/37163553/sending-html-with-message-in-email-using-file-path | [
"[email protected]"
] | |
714733e24567cdd01f8b9178b219eb511864a374 | 01315bb81f318bd5bb9991fe8ee374a6b49533b0 | /src/main/java/com/kirak/repository/datajpa/BookingRepositoryImpl.java | eff1067f8df6acff7e585075a46d51254bc2d5ed | [
"MIT"
] | permissive | kkaun/simple_booking_service | 2942f6a8da3cd705b33fa76000091e6f96c23f72 | 3c0a293f3a06225b281537be27045fdfdc924411 | refs/heads/master | 2021-01-22T08:28:26.202445 | 2018-07-09T16:43:09 | 2018-07-09T16:43:09 | 92,617,895 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,187 | java | package com.kirak.repository.datajpa;
import com.kirak.model.Booking;
import com.kirak.repository.BookingRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
* Created by Kir on 07.08.2017.
*/
@Transactional
@Repository
public class BookingRepositoryImpl implements BookingRepository {
private static final Sort DATE_ADDED_SORT = new Sort(Sort.Direction.DESC, "dateAdded");
@Autowired
private DataJpaBookingRepository bookingRepository;
@Autowired
private DataJpaUserRepository userRepository;
@Override
public Booking save(Booking booking) {
if(!booking.isNew() && get(booking.getId()) == null){
return null;
}
return bookingRepository.save(booking);
}
@Override
public Booking save(Booking booking, int userId) {
if(!booking.isNew() && get(booking.getId(), userId) == null){
return null;
}
booking.setUser(userRepository.findOne(userId));
return bookingRepository.save(booking);
}
@Override
public Booking get(Integer id) {
return bookingRepository.findOne(id);
}
@Override
public Booking get(int id, int userId) {
Booking booking = bookingRepository.findOne(id);
return booking != null && booking.getUser().getId() == userId ? booking : null;
}
@Override
public List<Booking> getAll() {
return bookingRepository.findAll(DATE_ADDED_SORT);
}
@Override
public List<Booking> getAllByUserId(int userId) {
return bookingRepository.getAllByUserId(userId);
}
@Override
public List<Booking> getAllByHotelId(int hotelId) {
return bookingRepository.getAllByHotelId(hotelId);
}
@Override
public List<Booking> getAllBetweenCreatedDateTimes(LocalDateTime startDateTime, LocalDateTime endDateTime) {
return bookingRepository.getAllBetweenCreatedDateTimes(startDateTime, endDateTime);
}
}
| [
"[email protected]"
] | |
96c89bb5c88cb32c9d296d8e603773942e192603 | 665110e99befea67ea7dcdd6939e313cff471654 | /src/main/java/net/smert/frameworkgl/opengl/renderer/RendererGL3.java | 1ffb76cfa1f212a3ac0cbb2829f33a4977abe0b5 | [
"Apache-2.0"
] | permissive | kovertopz/Framework-GL | 187cd6771c5ed0192da3564a22c6281956bb2ce2 | 1504f4746c80bf0667f62ecea2569f8d37a46184 | refs/heads/master | 2021-06-07T08:22:46.693230 | 2017-07-08T09:10:17 | 2017-07-08T09:10:17 | 24,876,706 | 10 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,754 | java | /**
* Copyright 2012 Jason Sorensen ([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 net.smert.frameworkgl.opengl.renderer;
import java.util.List;
import net.smert.frameworkgl.Fw;
import net.smert.frameworkgl.gameobjects.GameObject;
import net.smert.frameworkgl.math.Transform4f;
import net.smert.frameworkgl.math.Vector2f;
import net.smert.frameworkgl.math.Vector3f;
import net.smert.frameworkgl.opengl.GL;
import net.smert.frameworkgl.opengl.camera.Camera;
import net.smert.frameworkgl.opengl.renderable.AbstractRenderable;
import net.smert.frameworkgl.opengl.renderable.Renderable;
import net.smert.frameworkgl.opengl.renderable.gl3.DynamicVertexArrayObjectInterleavedGL3Renderable;
import net.smert.frameworkgl.opengl.renderable.gl3.DynamicVertexArrayObjectNonInterleavedGL3Renderable;
import net.smert.frameworkgl.opengl.renderable.gl3.VertexArrayObjectInterleavedGL3Renderable;
import net.smert.frameworkgl.opengl.renderable.gl3.VertexArrayObjectNonInterleavedGL3Renderable;
import net.smert.frameworkgl.opengl.shader.AbstractShader;
import net.smert.frameworkgl.utils.Color;
/**
*
* @author Jason Sorensen <[email protected]>
*/
public class RendererGL3 extends AbstractRendererGL {
public RendererGL3() {
super();
}
public AbstractRenderable createArrayRenderable() {
return GL.rf3.createArrayRenderable();
}
public AbstractRenderable createDisplayListRenderable() {
return GL.rf3.createDisplayListRenderable();
}
public DynamicVertexArrayObjectInterleavedGL3Renderable createDynamicInterleavedRenderable() {
return GL.rf3.createDynamicInterleavedRenderable();
}
public DynamicVertexArrayObjectNonInterleavedGL3Renderable createDynamicNonInterleavedRenderable() {
return GL.rf3.createDynamicNonInterleavedRenderable();
}
public AbstractRenderable createImmediateModeRenderable() {
return GL.rf3.createImmediateModeRenderable();
}
public VertexArrayObjectInterleavedGL3Renderable createInterleavedRenderable() {
return GL.rf3.createInterleavedRenderable();
}
public VertexArrayObjectNonInterleavedGL3Renderable createNonInterleavedRenderable() {
return GL.rf3.createNonInterleavedRenderable();
}
public void destroy() {
}
public void init() {
}
@Override
public void color(float r, float g, float b, float a) {
GL.o2.vertexAttrib(GL.defaultAttribLocations.getIndex("color"), r, g, b, a);
}
@Override
public void disableTexture2D() {
}
@Override
public void disableTexture3D() {
}
@Override
public void disableTextureCubeMap() {
}
@Override
public void enableTexture2D() {
}
@Override
public void enableTexture3D() {
}
@Override
public void enableTextureCubeMap() {
}
@Override
public void popMatrix() {
GL.matrixHelper.setModeModel();
GL.matrixHelper.pop();
}
@Override
public void pushMatrix() {
GL.matrixHelper.setModeModel();
GL.matrixHelper.push();
}
@Override
public void render(AbstractRenderable renderable) {
Renderable.shaderBindState.sendUniformMatrices();
renderable.render();
}
@Override
public void render(AbstractRenderable renderable, float x, float y, float z) {
pushMatrix();
translate(x, y, z);
render(renderable);
popMatrix();
}
@Override
public void render(AbstractRenderable renderable, Transform4f transform) {
pushMatrix();
GL.matrixHelper.load(transform);
render(renderable);
popMatrix();
}
@Override
public void render(AbstractRenderable renderable, Vector3f position) {
pushMatrix();
translate(position);
render(renderable);
popMatrix();
}
@Override
public void render(GameObject gameObject) {
pushMatrix();
GL.matrixHelper.load(gameObject.getWorldTransform());
Renderable.shaderBindState.sendUniformsOncePerGameObject(gameObject);
render(gameObject.getRenderable());
popMatrix();
}
@Override
public void render(List<GameObject> gameObjects) {
for (GameObject gameObject : gameObjects) {
render(gameObject);
}
}
@Override
public void renderBlend(GameObject gameObject) {
if (gameObject.getRenderableState().isOpaque()) {
return;
}
GL.o1.enableBlending();
render(gameObject);
GL.o1.disableBlending();
}
@Override
public void renderBlend(List<GameObject> gameObjects) {
GL.o1.enableBlending();
for (GameObject gameObject : gameObjects) {
if (gameObject.getRenderableState().isOpaque()) {
continue;
}
render(gameObject);
}
GL.o1.disableBlending();
}
@Override
public void renderOpaque(GameObject gameObject) {
if (!gameObject.getRenderableState().isOpaque()) {
return;
}
render(gameObject);
}
@Override
public void renderOpaque(List<GameObject> gameObjects) {
for (GameObject gameObject : gameObjects) {
if (!gameObject.getRenderableState().isOpaque()) {
continue;
}
render(gameObject);
}
}
@Override
public void scale(float x, float y, float z) {
GL.matrixHelper.setModeModel();
GL.matrixHelper.scale(x, y, z);
}
@Override
public void scale(Vector3f scaling) {
GL.matrixHelper.setModeModel();
GL.matrixHelper.scale(scaling.getX(), scaling.getY(), scaling.getZ());
}
@Override
public void set2DMode() {
GL.matrixHelper.setModeProjection();
GL.matrixHelper.setOrthogonal(0f, Fw.config.getCurrentWidth(), 0f, Fw.config.getCurrentHeight(), -1f, 1f);
GL.matrixHelper.setModeView();
GL.matrixHelper.loadIdentity();
GL.matrixHelper.setModeModel();
GL.matrixHelper.loadIdentity();
}
@Override
public void set2DMode(int width, int height) {
GL.matrixHelper.setModeProjection();
GL.matrixHelper.setOrthogonal(0f, width, 0f, height, -1f, 1f);
GL.matrixHelper.setModeView();
GL.matrixHelper.loadIdentity();
GL.matrixHelper.setModeModel();
GL.matrixHelper.loadIdentity();
}
@Override
public void setCamera(Camera camera) {
camera.update();
GL.matrixHelper.setModeProjection();
GL.matrixHelper.load(camera.getProjectionMatrix());
GL.matrixHelper.setModeView();
GL.matrixHelper.load(camera.getViewMatrix());
GL.matrixHelper.setModeModel();
GL.matrixHelper.loadIdentity();
}
@Override
public void switchShader(AbstractShader shader) {
Renderable.shaderBindState.switchShader(shader);
}
@Override
public void translate(float x, float y, float z) {
GL.matrixHelper.setModeModel();
GL.matrixHelper.translate(x, y, z);
}
@Override
public void translate(Vector3f position) {
GL.matrixHelper.setModeModel();
GL.matrixHelper.translate(position.getX(), position.getY(), position.getZ());
}
@Override
public void unbindShader() {
Renderable.shaderBindState.unbindShader();
}
@Override
public void colorText(Color color) {
color(color.getR(), color.getG(), color.getB(), color.getA());
}
@Override
public AbstractRenderable createGlyphRenderable() {
return createInterleavedRenderable();
}
@Override
public float getTextDefaultX() {
return textDefaultX;
}
@Override
public float getTextDefaultY() {
return textDefaultY;
}
@Override
public Vector2f getTextPosition() {
return textPosition;
}
@Override
public void renderGlyph(AbstractRenderable renderable) {
render(renderable);
}
@Override
public void scaleText(float x, float y) {
scale(x, y, 1f);
}
@Override
public void translateText(float x, float y) {
translate(x, y, 0f);
}
}
| [
"[email protected]"
] | |
7a9239e845c90489ff7daa80d0475b60fd380fd8 | fea07f0dd2555f7b51e3cdd15e96812820499aea | /hedera-node/src/test/java/com/hedera/test/factories/accounts/MockFCMapFactory.java | 0998e9636a9ef4f0c616de1580894e99c0911b27 | [
"Apache-2.0"
] | permissive | Vinci-zZ/hedera-services | e663c3dc1aae8742d92b0031727861c5fb323c97 | afa3afb5041a908a783fc0b91c61facc532a7463 | refs/heads/master | 2023-02-28T03:44:11.524812 | 2021-02-06T06:26:00 | 2021-02-06T06:26:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,295 | java | package com.hedera.test.factories.accounts;
/*-
*
* Hedera Services Node
*
* Copyright (C) 2018 - 2020 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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 com.hedera.services.state.merkle.MerkleEntityId;
import com.hedera.services.state.merkle.MerkleAccount;
import com.swirlds.fcmap.FCMap;
import static com.hedera.test.utils.IdUtils.asContract;
import static org.mockito.BDDMockito.*;
import static com.hedera.test.utils.IdUtils.asAccount;
import static com.hedera.test.factories.accounts.MerkleAccountFactory.newAccount;
import static com.hedera.test.factories.txns.SignedTxnFactory.*;
public class MockFCMapFactory {
public static final long NODE_BALANCE = 1_000_000_000L;
public static final long GENESIS_BALANCE = 50_000_000_000_000L;
private final FCMap mock = mock(FCMap.class);
private MockFCMapFactory() {}
public static MockFCMapFactory newAccounts() {
return new MockFCMapFactory();
}
public static MockFCMapFactory newAccountsWithDefaults() throws Exception {
return newAccounts()
.withAccount(DEFAULT_NODE_ID, newAccount().balance(NODE_BALANCE).get())
.withAccount(DEFAULT_PAYER_ID, newAccount().balance(GENESIS_BALANCE).accountKeys(DEFAULT_PAYER_KT).get());
}
public MockFCMapFactory withAccount(String id, MerkleAccount meta) {
MerkleEntityId account = MerkleEntityId.fromAccountId(asAccount(id));
given(mock.get(account)).willReturn(meta);
return this;
}
public MockFCMapFactory withContract(String id, MerkleAccount meta) {
MerkleEntityId contract = MerkleEntityId.fromContractId(asContract(id));
given(mock.get(contract)).willReturn(meta);
return this;
}
public FCMap<MerkleEntityId, MerkleAccount> get() {
return (FCMap<MerkleEntityId, MerkleAccount>)mock;
}
}
| [
"[email protected]"
] | |
ad24106b08d38b6c607866c3a2442a64ea46c483 | 8b736128fdb1dcb5a7b90250db12ae1c3e9e91bf | /shade-processor/src/test/java/io/t28/shade/test/ConverterClassMetadataAssert.java | 532277001a4c0f8de34e552dc3687af883f25662 | [
"Apache-2.0"
] | permissive | t28hub/shade | dd731a37048d7a8b084acc7e570d0c5aa7e038f0 | baaf694fef85a51c1b77e36dc77b120f495dcc2c | refs/heads/master | 2021-01-11T12:04:26.812152 | 2016-12-26T14:51:17 | 2016-12-26T14:51:17 | 69,031,608 | 32 | 6 | null | 2016-12-26T14:51:18 | 2016-09-23T14:18:53 | Java | UTF-8 | Java | false | false | 2,611 | java | /*
* Copyright (c) 2016 Tatsuya Maki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.t28.shade.test;
import com.squareup.javapoet.TypeName;
import org.assertj.core.api.AbstractAssert;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.t28.shade.processor.metadata.ConverterClassMetadata;
import static org.assertj.core.api.Assertions.assertThat;
public class ConverterClassMetadataAssert extends AbstractAssert<ConverterClassMetadataAssert, ConverterClassMetadata> {
public ConverterClassMetadataAssert(@Nullable ConverterClassMetadata actual) {
super(actual, ConverterClassMetadataAssert.class);
}
@Nonnull
public ConverterClassMetadataAssert isDefault() {
isNotNull();
final boolean actual = this.actual.isDefault();
assertThat(actual)
.overridingErrorMessage("Expected converter to be default, but was non-default")
.isTrue();
return this;
}
@Nonnull
public ConverterClassMetadataAssert isNotDefault() {
isNotNull();
final boolean actual = this.actual.isDefault();
assertThat(actual)
.overridingErrorMessage("Expected converter to be non-default, but was default")
.isFalse();
return this;
}
@Nonnull
public ConverterClassMetadataAssert isSupportedType(@Nonnull TypeName expected) {
isNotNull();
final TypeName actual = this.actual.getSupportedType();
assertThat(actual)
.overridingErrorMessage("Expected supportedType to be <%s>, but was <%s>", expected, actual)
.isEqualTo(expected);
return this;
}
@Nonnull
public ConverterClassMetadataAssert isConvertedType(@Nonnull TypeName expected) {
isNotNull();
final TypeName actual = this.actual.getConvertedType();
assertThat(actual)
.overridingErrorMessage("Expected convertedType to be <%s>, but was <%s>", expected, actual)
.isEqualTo(expected);
return this;
}
}
| [
"[email protected]"
] | |
ed2f8c4c8a983461208e173f2ca13673bb151d26 | 692e68c46eeb49c63523bb5198cb66386a5e5b4d | /app/src/main/java/com/example/primetech/contactproviderwithcursoradapter/MainActivity.java | 329cff9ed5d9ff06c4443da06e78d81e1057aa9f | [] | no_license | fardin95/ContactProviderWithCursorAdapter | b07eb123f2275dcf35e037d91503192c20c8e2d7 | 8afabbae586e04f36f09bb3871857bf533e36ca0 | refs/heads/master | 2021-01-19T00:58:13.198752 | 2016-07-19T11:23:55 | 2016-07-19T11:23:55 | 63,677,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,911 | java | package com.example.primetech.contactproviderwithcursoradapter;
import android.content.ContentResolver;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
private android.widget.ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.listView = (ListView) findViewById(R.id.listView);
ContentResolver contentResolver = getContentResolver();
// Contact data
String columsToExtract[] = new String[]{
ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.PHOTO_THUMBNAIL_URI
};
String whereClause = "((" + ContactsContract.Contacts.DISPLAY_NAME + " NOTNULL) AND (" + ContactsContract.Contacts.DISPLAY_NAME + " != '' ) AND (" + ContactsContract.Contacts.STARRED + "== 1))";
// sort by incresing id
String sortOrder = ContactsContract.Contacts._ID + " ASC";
// query contats contentProvider
Cursor cursor = contentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if (cursor!=null){
int i = 0;
cursor.moveToFirst();
for ( i=0; i<cursor.getCount(); i++){
String string = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
Log.e("nAME", string);
cursor.moveToNext();
}
}
ContactInfoListAdapter contactInfoListAdapter = new ContactInfoListAdapter(this, R.layout.list_item, cursor, 1);
listView.setAdapter(contactInfoListAdapter);
}
}
| [
"[email protected]"
] | |
db163c4b1d8d381d73da7e1383e473fbeb2d24a4 | 8419df2ca4066a676d88f9760c6b4b5108729118 | /CafeteriaBlackWhiteDecorator/src/main/java/br/edu/ifes/poo2/cafeteriablackwhitedecorator/cdp/CremeDeLaranja.java | 351f987acb738f9dc61903f8cb379851cd465f91 | [] | no_license | phoenixproject/poo2dp | 0ef3c013c221babef7a335a70509098b5efd1dcc | cb96338f1e17355fd1ecc5c72558bf56d371d4f6 | refs/heads/master | 2021-01-10T06:18:08.518065 | 2015-11-24T17:37:50 | 2015-11-24T17:37:50 | 46,763,514 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | 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 br.edu.ifes.poo2.cafeteriablackwhitedecorator.cdp;
/**
*
* @author 20101bsi0453
*/
public class CremeDeLaranja extends AbstractComplemento {
public CremeDeLaranja(Cafe cafe) {
super(cafe);
}
@Override
public Double getPreco(){
return cafeDecorado.getPreco() + 1.50;
}
}
| [
"[email protected]"
] | |
a81115beaa5950525dd4014d2f279d4d25111f6c | 43d8520aecdad8ee7e4b1ac6b4e18bdf871de774 | /src/com/comment/model/CommentDAO.java | 322597e58d34901ca02f4ab7abc16cc15dea2d9f | [] | no_license | a5372268/MoviesHit | 16f2862a40b1debc0ba4ae4def5ed56e98bbd1a6 | 26f20fe75510b2ecd80b3660b91801146f496a22 | refs/heads/main | 2023-05-25T04:47:08.688855 | 2021-06-11T11:38:33 | 2021-06-11T11:38:33 | 375,986,887 | 0 | 0 | null | null | null | null | BIG5 | Java | false | false | 17,002 | java | package com.comment.model;
import java.sql.*;
import java.util.*;
import javax.naming.*;
import javax.sql.DataSource;
import com.movie.model.MovieVO;
import jdbc.util.CompositeQuery.jdbcUtil_CompositeQuery_Comment;
public class CommentDAO implements CommentDAO_interface{
private static DataSource ds = null;
static {
try {
Context ctx = new InitialContext();
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/CEA103G3");
} catch (NamingException e) {
e.printStackTrace();
}
}
private static final String INSERT_STMT =
"insert into COMMENT (MEMBER_NO,MOVIE_NO,CONTENT,STATUS) values (?, ?, ?, ?)";
private static final String UPDATE_STMT =
"update COMMENT set CONTENT=?, MOVIE_NO=?, MODIFY_DT=default where COMMENT_NO = ?";
private static final String UPDATE_COMMENTSTATUS_OFF_STMT =
"update COMMENT set STATUS=1 where COMMENT_NO = ?";
private static final String UPDATE_COMMENTSTATUS_ON_STMT =
"update COMMENT set STATUS=0 where COMMENT_NO = ?";
private static final String DELETE_REPORTCOMMENTS =
"delete from REPORT_COMMENT where COMMENT_NO = ?";
private static final String DELETE_COMMENT =
"delete from COMMENT where COMMENT_NO = ?";
private static final String GET_ONE_STMT =
"select * from COMMENT where COMMENT_NO = ?";
private static final String GET_ALL_STMT =
"select * from COMMENT order by COMMENT_NO";
private static final String GET_MOVIE_COMMENT_STMT =
"select * from COMMENT where MOVIE_NO = ? and STATUS = 0 order by CRT_DT desc";
// private static final String GET_MEMBER_COMMENT_STMT =
// "select * from COMMENT where MEMBER_NO = ?";
private static final String GET_MOVIE_COMMENT_BY_MEM =
"select * from COMMENT where MEMBER_NO = ?";
private static final String UPDATE_BY_COMMENTNO_STMT =
"update COMMENT set CONTENT=? where COMMENT_NO = ?";
@Override
public void insert(CommentVO commentVO) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = ds.getConnection();
pstmt = con.prepareStatement(INSERT_STMT);
pstmt.setInt(1, commentVO.getMemberno());
pstmt.setInt(2, commentVO.getMovieno());
pstmt.setString(3, commentVO.getContent());
pstmt.setString(4, commentVO.getStatus());
pstmt.executeUpdate();
// Handle any SQL errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
// Clean up JDBC resources
} finally {
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (con != null) {
try {
con.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
}
@Override
public void update(CommentVO commentVO) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = ds.getConnection();
pstmt = con.prepareStatement(UPDATE_STMT);
pstmt.setString(1, commentVO.getContent());
pstmt.setInt(2, commentVO.getMovieno());
pstmt.setInt(3, commentVO.getCommentno());
pstmt.executeUpdate();
// Handle any driver errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
// Clean up JDBC resources
} finally {
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (con != null) {
try {
con.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
}
@Override
public void updateCommentStatusOff(CommentVO commentVO , Connection con) {
PreparedStatement pstmt = null;
try {
pstmt = con.prepareStatement(UPDATE_COMMENTSTATUS_OFF_STMT);
pstmt.setDouble(1, commentVO.getCommentno());
pstmt.executeUpdate();
// System.out.println("11");
// Handle any driver errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
// Clean up JDBC resources
} finally {
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
}
}
@Override
public void updateCommentStatusOn(CommentVO commentVO , Connection con) {
PreparedStatement pstmt = null;
try {
pstmt = con.prepareStatement(UPDATE_COMMENTSTATUS_ON_STMT);
pstmt.setDouble(1, commentVO.getCommentno());
pstmt.executeUpdate();
// System.out.println("11");
// Handle any driver errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
// Clean up JDBC resources
} finally {
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
}
}
// @Override
// public void delete(Integer commentno) {
//
// Connection con = null;
// PreparedStatement pstmt = null;
//
// try {
//
// con = ds.getConnection();
// pstmt = con.prepareStatement(DELETE_STMT);
//
// pstmt.setInt(1, commentno);
//
// pstmt.executeUpdate();
//
// // Handle any driver errors
// } catch (SQLException se) {
// throw new RuntimeException("A database error occured. "
// + se.getMessage());
// // Clean up JDBC resources
// } finally {
// if (pstmt != null) {
// try {
// pstmt.close();
// } catch (SQLException se) {
// se.printStackTrace(System.err);
// }
// }
// if (con != null) {
// try {
// con.close();
// } catch (Exception e) {
// e.printStackTrace(System.err);
// }
// }
// }
//
// }
@Override
public void delete(Integer commentno) {
int updateCount_ReportComments = 0;
Connection con = null;
PreparedStatement pstmt = null;
try {
con = ds.getConnection();
// 1●設定於 pstm.executeUpdate()之前
con.setAutoCommit(false);
// 先刪除檢舉評論
pstmt = con.prepareStatement(DELETE_REPORTCOMMENTS);
pstmt.setInt(1, commentno);
updateCount_ReportComments = pstmt.executeUpdate();
// 再刪除評論
pstmt = con.prepareStatement(DELETE_COMMENT);
pstmt.setInt(1, commentno);
pstmt.executeUpdate();
// 2●設定於 pstm.executeUpdate()之後
con.commit();
con.setAutoCommit(true);
System.out.println("刪除評論編號" + commentno + "時,共有檢舉評論" + updateCount_ReportComments
+ "則同時被刪除");
// Handle any SQL errors
} catch (SQLException se) {
if (con != null) {
try {
// 3●設定於當有exception發生時之catch區塊內
con.rollback();
} catch (SQLException excep) {
throw new RuntimeException("rollback error occured. "
+ excep.getMessage());
}
}
throw new RuntimeException("A database error occured. "
+ se.getMessage());
} finally {
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (con != null) {
try {
con.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
}
@Override
public CommentVO findByPrimaryKey(Integer commentno) {
CommentVO commentVO = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = ds.getConnection();
pstmt = con.prepareStatement(GET_ONE_STMT);
pstmt.setInt(1, commentno);
rs = pstmt.executeQuery();
while (rs.next()) {
// commentVo 也稱為 Domain objects
commentVO = new CommentVO();
commentVO.setCommentno(rs.getInt("COMMENT_NO"));
commentVO.setMemberno(rs.getInt("MEMBER_NO"));
commentVO.setMovieno(rs.getInt("MOVIE_NO"));
commentVO.setContent(rs.getString("CONTENT"));
commentVO.setCreatdate(rs.getTimestamp("CRT_DT"));
commentVO.setModifydate(rs.getTimestamp("MODIFY_DT"));
commentVO.setStatus(rs.getString("STATUS"));
}
// Handle any driver errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
// Clean up JDBC resources
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (con != null) {
try {
con.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
return commentVO;
}
// @Override
// public List<CommentVO> findByMemberNo(Integer memberno) {
// List<CommentVO> list = new ArrayList<CommentVO>();
// CommentVO commentVO = null;
//
// Connection con = null;
// PreparedStatement pstmt = null;
// ResultSet rs = null;
//
// try {
//
// con = ds.getConnection();
// pstmt = con.prepareStatement(GET_MEMBER_COMMENT_STMT);
//
// pstmt.setInt(1, memberno);
//
// rs = pstmt.executeQuery();
//
// while (rs.next()) {
// // commentVo 也稱為 Domain objects
// commentVO = new CommentVO();
// commentVO.setCommentno(rs.getInt("COMMENT_NO"));
// commentVO.setMemberno(rs.getInt("MEMBER_NO"));
// commentVO.setMovieno(rs.getInt("MOVIE_NO"));
// commentVO.setContent(rs.getString("CONTENT"));
// commentVO.setCreatdate(rs.getTimestamp("CRT_DT"));
// commentVO.setModifydate(rs.getTimestamp("MODIFY_DT"));
// commentVO.setStatus(rs.getString("STATUS"));
// list.add(commentVO);
// }
//
// // Handle any driver errors
// } catch (SQLException se) {
// throw new RuntimeException("A database error occured. "
// + se.getMessage());
// // Clean up JDBC resources
// } finally {
// if (rs != null) {
// try {
// rs.close();
// } catch (SQLException se) {
// se.printStackTrace(System.err);
// }
// }
// if (pstmt != null) {
// try {
// pstmt.close();
// } catch (SQLException se) {
// se.printStackTrace(System.err);
// }
// }
// if (con != null) {
// try {
// con.close();
// } catch (Exception e) {
// e.printStackTrace(System.err);
// }
// }
// }
// return list;
// }
@Override
public List<CommentVO> getAll() {
List<CommentVO> list = new ArrayList<CommentVO>();
CommentVO commentVO = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = ds.getConnection();
pstmt = con.prepareStatement(GET_ALL_STMT);
rs = pstmt.executeQuery();
while (rs.next()) {
// commentVO 也稱為 Domain objects
commentVO = new CommentVO();
commentVO.setCommentno(rs.getInt("COMMENT_NO"));
commentVO.setMemberno(rs.getInt("MEMBER_NO"));
commentVO.setMovieno(rs.getInt("MOVIE_NO"));
commentVO.setContent(rs.getString("CONTENT"));
commentVO.setCreatdate(rs.getTimestamp("CRT_DT"));
commentVO.setModifydate(rs.getTimestamp("MODIFY_DT"));
commentVO.setStatus(rs.getString("STATUS"));
list.add(commentVO); // Store the row in the list
}
// Handle any driver errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
// Clean up JDBC resources
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (con != null) {
try {
con.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
return list;
}
@Override
public List<CommentVO> getAll(Map<String, String[]> map) {
List<CommentVO> list = new ArrayList<CommentVO>();
CommentVO commentVO = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = ds.getConnection();
String finalSQL = "select * from COMMENT "
+ jdbcUtil_CompositeQuery_Comment.get_WhereCondition(map)
+ "order by COMMENT_NO desc";
pstmt = con.prepareStatement(finalSQL);
System.out.println("●●finalSQL(by DAO) = "+finalSQL);
rs = pstmt.executeQuery();
while (rs.next()) {
commentVO = new CommentVO();
commentVO.setCommentno(rs.getInt("COMMENT_NO"));
commentVO.setMemberno(rs.getInt("MEMBER_NO"));
commentVO.setMovieno(rs.getInt("MOVIE_NO"));
commentVO.setContent(rs.getString("CONTENT"));
commentVO.setCreatdate(rs.getTimestamp("CRT_DT"));
commentVO.setModifydate(rs.getTimestamp("MODIFY_DT"));
commentVO.setStatus(rs.getString("STATUS"));
list.add(commentVO); // Store the row in the List
}
// Handle any SQL errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (con != null) {
try {
con.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
return list;
}
@Override
public List<CommentVO> findByMovieNo(Integer movieno) {
List<CommentVO> list = new ArrayList<CommentVO>();
CommentVO commentVO = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = ds.getConnection();
pstmt = con.prepareStatement(GET_MOVIE_COMMENT_STMT);
pstmt.setInt(1, movieno);
rs = pstmt.executeQuery();
while (rs.next()) {
// commentVo 也稱為 Domain objects
commentVO = new CommentVO();
commentVO.setCommentno(rs.getInt("COMMENT_NO"));
commentVO.setMemberno(rs.getInt("MEMBER_NO"));
commentVO.setMovieno(rs.getInt("MOVIE_NO"));
commentVO.setContent(rs.getString("CONTENT"));
commentVO.setCreatdate(rs.getTimestamp("CRT_DT"));
commentVO.setModifydate(rs.getTimestamp("MODIFY_DT"));
commentVO.setStatus(rs.getString("STATUS"));
list.add(commentVO);
}
// Handle any driver errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
// Clean up JDBC resources
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (con != null) {
try {
con.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
return list;
}
@Override
public List<CommentVO> findByMemberNo(Integer memberno) {
List<CommentVO> list = new ArrayList<CommentVO>();
CommentVO commentVO = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = ds.getConnection();
pstmt = con.prepareStatement(GET_MOVIE_COMMENT_BY_MEM);
pstmt.setInt(1, memberno);
rs = pstmt.executeQuery();
while (rs.next()) {
// commentVo 也稱為 Domain objects
commentVO = new CommentVO();
commentVO.setCommentno(rs.getInt("COMMENT_NO"));
commentVO.setMemberno(rs.getInt("MEMBER_NO"));
commentVO.setMovieno(rs.getInt("MOVIE_NO"));
commentVO.setContent(rs.getString("CONTENT"));
commentVO.setCreatdate(rs.getTimestamp("CRT_DT"));
commentVO.setModifydate(rs.getTimestamp("MODIFY_DT"));
commentVO.setStatus(rs.getString("STATUS"));
list.add(commentVO);
}
// Handle any driver errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
// Clean up JDBC resources
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (con != null) {
try {
con.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
return list;
}
@Override
public void update_bycommentno(CommentVO commentVO) {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = ds.getConnection();
pstmt = con.prepareStatement(UPDATE_BY_COMMENTNO_STMT);
pstmt.setString(1, commentVO.getContent());
pstmt.setInt(2, commentVO.getCommentno());
pstmt.executeUpdate();
// Handle any driver errors
} catch (SQLException se) {
throw new RuntimeException("A database error occured. "
+ se.getMessage());
// Clean up JDBC resources
} finally {
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException se) {
se.printStackTrace(System.err);
}
}
if (con != null) {
try {
con.close();
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
}
}
}
| [
"[email protected]"
] | |
b435b82fb43c05a4691fccb9c0f49035540bf905 | 69ac3fb006e10da40d17eaef5564080b20458267 | /Mtravelplan_final/src/com/travel/plan/tripboard/vote/dao/TripVoteService.java | 2d55cb60c9b351d9babbcc5fe8a299e73c576403 | [] | no_license | skathal124/travel_helper | e46f42b7b3af192b8d1968a022e1fcc2e9c4fd6a | afb00141bb02a0588c2e849a77832311d3318087 | refs/heads/master | 2020-03-31T19:53:42.219577 | 2018-10-11T04:40:58 | 2018-10-11T04:40:58 | 152,516,730 | 0 | 0 | null | 2018-10-11T04:40:59 | 2018-10-11T02:08:25 | JavaScript | UTF-8 | Java | false | false | 670 | java | package com.travel.plan.tripboard.vote.dao;
import java.util.List;
import com.travel.plan.tripboard.help.PollBean;
import com.travel.plan.tripboard.model.TripPoll;
import com.travel.plan.tripboard.model.TripPollSub;
import com.travel.plan.tripboard.model.TripVoter;
public interface TripVoteService {
void makePoll(PollBean pbean);
List<TripPoll> getPollAllList(TripPoll poll);
TripPoll getPoll(TripPoll poll);
List<TripPollSub> getPollSubList(TripPoll poll);
void polling(TripVoter voter);
List<TripPoll> getMyPollList(TripPoll poll);
void deleteTrip_Voter(int tpseq);
void deleteTrip_PollSub(int tpseq);
void deleteTrip_Poll(int tpseq);
}
| [
"[email protected]"
] | |
8f1aaf38fc066277248cc2ada1c29529c1b545fc | 4fe45f0a4dd70b9f32c7a080d13725f56722e045 | /pelit/kuutiopeli/src/cubegame/multiplayer/ClientWritingThread.java | abd22d523555714624b4161d9747a6cdd195bedb | [] | no_license | fergusq/vanhat-ohjelmani | b1233f2672591b5c95314482f6562a3f11cef55f | 2b990a0e2aa92528fa89a048f102732b23ad8466 | refs/heads/master | 2021-01-01T20:41:42.293896 | 2015-04-12T13:53:23 | 2015-04-12T13:53:23 | 33,550,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package cubegame.multiplayer;
public class ClientWritingThread extends Thread {
private NetClientHandler netHandler;
public ClientWritingThread(NetClientHandler netClientHandler) {
this.netHandler = netClientHandler;
}
@Override
public void run() {
synchronized (netHandler.threadSyncObject) {
netHandler.writeThreads++;
}
try{
for(; netHandler.isRunning && !netHandler.isTerminating; netHandler.writePacket()) { }
try {
sleep(1L);
}catch (InterruptedException ex){;}
} finally{
netHandler.writeThreads--;
}
}
}
| [
"[email protected]"
] | |
1e8ce981c024a11988ee6e89ec2221b77322316a | 4e41d8251e19228e8758f80448a0219988fd0c50 | /src/TestaArraysObjetos.java | ca884d649b81c25239aaad363f994a19af5144b6 | [] | no_license | JAlvesBruno/OrientacaoObjetos | bfeda220c697c7bceae6290ffa4efebce3ec88af | 18cd6a15122e55d31c9abc82b4537cb915cf71f7 | refs/heads/master | 2020-03-25T22:17:12.512324 | 2018-08-09T23:40:26 | 2018-08-09T23:40:26 | 144,214,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 789 | java | public class TestaArraysObjetos {
public static void main(String[] args) {
Carro[] carros = new Carro[5];
Carro carro1 = new Carro("verde","HB20",120);
// carro1.setCor("verde");
// carro1.setModelo("HB20");
// carro1.setVelocidadeMaxima(120);
Carro carro2 = new Carro("branco", "BMW", 320);
// carro2.setCor("branco");
// carro2.setModelo("BMW");
// carro2.setVelocidadeMaxima(320);
carros[0] = carro1;
carros[1] = carro2;
carros[0].setCor("Preto");
System.out.println("Carro1: " + carros[0].getCor());
System.out.println("Carro2: " + carros[1].getCor());
for(Carro carro: carros) {
System.out.println("Carro: " + carro.getModelo());
}
}
}
| [
"[email protected]"
] | |
fde7b8a40d76dd294f8f72f5e407832d7ffff197 | 530fe1b3a654543334d5a9afbb2ea46b8544d6b0 | /week-03/Day-03/src/Workshop10.java | 62ae68137f775f44a244005451bb7f5ca56377c6 | [] | no_license | greenfox-zerda-raptors/PappBeata | d58ea959f8588172df5ae9994a552a6af5bb7283 | 3a67b8eedeb7e1b0ff723429ea4faa5350fa8d80 | refs/heads/master | 2021-01-12T18:19:16.649526 | 2017-05-06T07:55:19 | 2017-05-06T07:55:19 | 71,363,242 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | import java.util.Arrays;
public class Workshop10{
public static void main(String[] args) {
// Task 1: Create an array (jagged) which can contain the different shades of specified colors
// in colors[0] store the shades of green: "lime", "forest green", "olive", "pale green", "spring green"
// in colors[1] store the shades of red: "orange red", "red", "tomato"
// in colors[2] store the shades of pink: "orchid", "violet", "pink", "hot pink"
String colors[][]={{"lime", "forest green", "olive", "pale green", "spring green"},
{"orange red", "red", "tomato"},
{"orchid", "violet", "pink", "hot pink"}};
// Task 2: Print the values of the array to the console
int i;
for (i=0; i<3; i++) {
System.out.print(Arrays.toString(colors[i]) + "\n");
}
}
} | [
"[email protected]"
] | |
6da794cd6607e05a8238ca00b3d812c61aa50d36 | 0943ac0ad90002e3ae5207a94f9973a84077dda3 | /app/src/main/java/com/hesham/fibonacci/fibonaccinumbers/GeneralDialogFragment.java | 6dc9e422e4133c8565b01de97be3117a6829b837 | [] | no_license | heshamfas/FibonacciNumbers | 816a0052fa65c7f490b0b3293a32d0b572423daf | 2695a55e54b081d7168ab777861ba347bfd2fb17 | refs/heads/master | 2021-01-02T08:34:14.159262 | 2014-09-07T19:59:56 | 2014-09-07T19:59:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 941 | java | package com.hesham.fibonacci.fibonaccinumbers;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
/**
* Created by Hesham on 8/11/2014.
*/
public class GeneralDialogFragment extends DialogFragment{
public GeneralDialogFragment() {
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle bundle = this.getArguments();
String title = bundle.getString("title");
String message = bundle.getString("message");
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
alertDialogBuilder.setTitle(title);
alertDialogBuilder.setMessage(message);
//null should be your on click listener
alertDialogBuilder.setPositiveButton("OK", null);
return alertDialogBuilder.create();
}
} | [
"[email protected]"
] | |
94c9dd33ace703c06c56040af4b42c65b860f1a7 | e306ba2d2ff8ca1945291f011bef28deba026b80 | /zhouchao/Exercise0425/src/cn/hfxt/entity/ZC.java | 277712e09e86fa1920b4a1738c5e04cd54aef77e | [] | no_license | SunYongLi12/SunYL | e7a80d0e79c1d57d7a36ae54b90ae9b79faaba7f | 634e88975c3d03d084a5d7b2a8c31238fcf563f5 | refs/heads/master | 2023-04-14T11:39:19.355638 | 2021-04-28T04:35:03 | 2021-04-28T04:35:03 | 362,008,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package cn.hfxt.entity;
public class ZC {
private int id;
private String rank;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
}
| [
"[email protected]"
] | |
0ec1e1c1e842346ecd7ce3e8d0510f00c876d0c9 | 39f6016314a0dd0a4f765030e0111c8dc56a6087 | /xiaoming-security-core/src/main/java/com/xiaoming/core/validate/code/ValidateCodeException.java | 73c68cb5c0bf2d9de2c22eea23eef7ef6bcbd477 | [] | no_license | TPxiaoming/spring-security | 088aee722cef04ef441318ff6acc4abe494f01a7 | 84b0b7bb3d93fc03edcd7b7959376b9407a2b368 | refs/heads/master | 2020-05-09T14:10:26.609236 | 2019-06-13T09:31:01 | 2019-06-13T09:31:01 | 181,182,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 470 | java | package com.xiaoming.core.validate.code;
import org.springframework.security.core.AuthenticationException;
/**
* 验证码异常
* AuthenticationException 抽象异常, 身份认证异常的基类
* @Author: xiaoming
* @Date: 16:02 2019/5/27
*/
public class ValidateCodeException extends AuthenticationException {
private static final long serialVersionUID = 1850122820931656032L;
public ValidateCodeException(String msg) {
super(msg);
}
} | [
"[email protected]"
] | |
c86475448aaf7872564d12f3f8dc6c6fa2c49df8 | 45141bec96cd635707213dba449867a36d6da3b4 | /Lab2/src/main/java/com/naofi/controllers/ManagerController.java | c59cfaffc289486fe445335d9e469f82e75ae492 | [] | no_license | kubayof/databases | fbac65db9885337ea1067078e95a2905cbad63e9 | ef28e552a5e38f78e239405c456c8f2710857bf0 | refs/heads/master | 2023-02-08T03:50:25.569543 | 2020-12-29T14:22:24 | 2020-12-29T14:22:24 | 291,979,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,822 | java | package com.naofi.controllers;
import com.naofi.model.dao.interfaces.ManagerDAO;
import com.naofi.model.entity.Manager;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Controller
@RequestMapping("/managers")
public class ManagerController {
private final ManagerDAO dao;
public ManagerController(ManagerDAO dao) {
this.dao = dao;
}
@GetMapping("/id")
@ResponseBody
public Manager getById(@RequestParam Integer id) {
Manager manager = dao.getById(id);
if (manager == null) {
throw new NullPointerException();
}
return manager;
}
@GetMapping("/first_name")
public String getByFirstName(@RequestParam("first_name") String firstName, Model model) {
model.addAttribute("items", dao.getByFirstName(firstName));
return "list_info";
}
@GetMapping("/last_name")
public String getByLastName(@RequestParam("last_name") String lastName, Model model) {
model.addAttribute("items", dao.getByLastName(lastName));
return "list_info";
}
@GetMapping("/get_by")
public String getBy(Manager manager, Model model) {
model.addAttribute("items", dao.getBy(manager));
return "list_info";
}
@GetMapping("/project_id")
@ResponseBody
public Manager getByProjectId(@RequestParam("project_id") Integer projectId) {
Manager manager = dao.getByProjectId(projectId);
if (manager == null) {
throw new NullPointerException();
}
return manager;
}
@GetMapping("/programmer_id")
@ResponseBody
public Manager getByProgrammerId(@RequestParam("programmer_id") Integer programmerId) {
Manager manager = dao.getByProgrammerId(programmerId);
if (manager == null) {
throw new NullPointerException();
}
return manager;
}
@PostMapping("/new")
@ResponseBody
public String createNew(Manager manager) {
if (dao.save(manager) > 0) {
return "Successfully inserted";
} else {
return "Error while insert attempt";
}
}
@PostMapping("/update")
@ResponseBody
public String update(Manager manager) {
if (dao.update(manager) > 0) {
return "Updated successfully";
} else {
return "Error while updating";
}
}
@PostMapping("/delete")
@ResponseBody
public String delete(@RequestParam("id") Integer id) {
if (dao.deleteById(id) > 0) {
return "Successfully deleted";
} else {
return "Error during delete attempt";
}
}
}
| [
"[email protected]"
] | |
31d5e5ed1fceb42500a18c4f203c30efe6eb2178 | 39ef3a7cc8c37214ea5167822365ec8daec0e702 | /projecteuler/12-highly-divisible-triangular-number/Solution.java | 2b883d5ac3d787b1efbf527bdb2e79b605f5c18a | [] | no_license | neppramod/problems_practice | 75449062037282d65896d296f0e1832482869832 | 764d2e4470d87c66cd1223387b49d3df610bb2a1 | refs/heads/master | 2022-08-18T19:54:16.370710 | 2022-08-16T02:54:45 | 2022-08-16T02:54:45 | 59,494,037 | 2 | 0 | null | 2021-01-03T18:07:56 | 2016-05-23T15:26:56 | Java | UTF-8 | Java | false | false | 1,825 | java | import java.util.*;
// Use arithmetic series summation
public class Solution
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = triangleNumberWithOverFiveHundredDivisors();
System.out.println(num);
//System.out.println(divisors(28));
/*
Lot of calculation
2162160 - 320
10767120 - 320
13857480 - 320
17907120 - 480
20991960 - 320
22582560 - 384
27561600 - 384
29610360 - 320
30728880 - 360
31240560 - 320
34283340 - 324
37191000 - 384
39209940 - 384
43809480 - 384
45158256 - 320
48024900 - 405
48565440 - 448
53411280 - 320
54752880 - 320
59192640 - 448
60769800 - 432
60935280 - 320
64292130 - 320
64701000 - 384
65431080 - 384
69390090 - 384
73150560 - 384
73926720 - 336
75897360 - 360
76576500 - 576
576
12375
*/
}
static int triangleNumberWithOverFiveHundredDivisors()
{
for (int i = 1; i <= 50000; i++) {
int cur = i * (i + 1) / 2;
int divisors = divisors(cur);
if (divisors > 300) {
System.out.println(cur + " - " + divisors);
}
if (divisors > 500) {
System.out.println(divisors);
return i;
}
}
return 0;
}
static int divisors(int number)
{
int count = 0;
for (int i = 1; i <= number; i++) {
if (number % i == 0) {
count++;
}
}
return count;
}
}
| [
"[email protected]"
] | |
1a9d91bf9e9c840f4aeb8c91507d0ba4dc4b0646 | 539b6808826b0af0e3ae0d3828961bc4cb7605ba | /Link_prediction/src/utils/interest.java | 425172119914bd0ea997ab20debac487cb990d8e | [] | no_license | souravrevo/Link_prediction | 3e436026f1a52c19a15d11cc7266f033b567d2b8 | 552b25b2bd89756cded3bec82cde749093ce07a0 | refs/heads/master | 2016-09-06T11:19:26.912941 | 2014-05-21T01:55:40 | 2014-05-21T01:55:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,809 | java | package utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.PreparedStatement;
//Calculate interest_count column of auth_all_info table
public class interest {
public static void main(String []args){
String name = "";
String interest = "";
String interest_db = "";
String auth_id = "";
try{
//open connection and get matrix dimenxions
String url = "jdbc:mysql://localhost/crawler";
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection(url, "root", "root");
Statement stmt = con.createStatement();
Statement stmt1 = con.createStatement();
ResultSet rs = stmt
.executeQuery("select * from auth_all_info");
ResultSet rs1 = null;
PreparedStatement stmtp = null;
while (rs.next()){
name = rs.getString(1);
auth_id = rs.getString(2);
interest = rs.getString(3).toLowerCase();
interest_db = " "+interest+" ";
interest_db = interest_db.replace(" ", "%");
rs1 = stmt1
.executeQuery("select count(*) from paper_all_info where auth_id=\'"+auth_id+"\' and paper like \'"+interest_db+"\'");
while (rs1.next()){
stmtp = con.prepareStatement("UPDATE auth_all_info SET interest_count=? WHERE auth_id=\'"+auth_id+"\' and auth_interest=\'"+interest+"\'");
stmtp.setString(1,rs1.getString(1));
System.out.println(rs1.getString(1));
int ii = stmtp.executeUpdate();
}
}
rs.close();
rs1.close();
stmtp.close();
stmt.close();
stmt1.close();
con.close();
}catch (Exception e) {
System.out.println("Exception caught"+e);
}
}
}
| [
"[email protected]"
] | |
1448bb5e9788cd985aba65d7ebf5974cff92704e | 48fbe64d3170950ba60b73615b01b06dde09fb89 | /src/main/java/com/yura/repair/command/admin/AdminAllReviewsCommand.java | 7c2245ea55612c6bbbf0fb9381f85736dd4190e5 | [] | no_license | Gtm417/guitar-repair-service-servlet | 4e5ca1ad04db34fa3b08ef6f6384576aa227a855 | da6a9a847ec88b2298017ece6f8254445a2cfb7b | refs/heads/master | 2022-04-06T14:45:13.014624 | 2020-02-21T07:48:55 | 2020-02-21T07:48:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,270 | java | package com.yura.repair.command.admin;
import com.yura.repair.command.Command;
import com.yura.repair.dto.ReviewDto;
import com.yura.repair.service.ReviewService;
import com.yura.repair.util.PaginationUtility;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import static com.yura.repair.constant.PageConstant.ADMIN_REVIEWS_PAGE;
public class AdminAllReviewsCommand implements Command {
private static final String ADMIN_REVIEWS_COMMAND = "/admin/reviews";
private final ReviewService reviewService;
private final PaginationUtility pagination;
public AdminAllReviewsCommand(ReviewService reviewService, PaginationUtility pagination) {
this.reviewService = reviewService;
this.pagination = pagination;
}
@Override
public String execute(HttpServletRequest request) {
int currentPage = pagination.getCurrentPage(request);
int recordsPerPage = pagination.getRecordsPerPage(request);
List<ReviewDto> reviews = reviewService.findAll(pagination.getOffset(currentPage, recordsPerPage), recordsPerPage);
pagination.paginate(currentPage, recordsPerPage, reviewService.numberOfEntries(), reviews, ADMIN_REVIEWS_COMMAND, request);
return ADMIN_REVIEWS_PAGE;
}
}
| [
"[email protected]"
] | |
0d49e82fdb2b201f81a3869d172e4dec7d87a598 | 7a3c0a90c4f8039837de7c07c687150b5b8bc647 | /src/main/java/com/ldh/permission/core/service/impl/AdminResourceServiceImpl.java | 98ae321a527aafc88993ac8e7478e02a14e18474 | [] | no_license | coder-ldh/permission | b3c84a9c1834ccf6a00d75ce3ac9b937ffd7397d | 426a7ecbf90860a8d350c196c41a5be7898bd96b | refs/heads/master | 2020-04-11T15:31:42.531787 | 2019-01-04T01:49:59 | 2019-01-04T01:49:59 | 161,894,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package com.ldh.permission.core.service.impl;
import com.ldh.permission.core.model.AdminResource;
import com.ldh.permission.core.mapper.AdminResourceMapper;
import com.ldh.permission.core.service.AdminResourceService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 用户资源表 服务实现类
* </p>
*
* @author ldh
* @since 2018-12-17
*/
@Service
public class AdminResourceServiceImpl extends ServiceImpl<AdminResourceMapper, AdminResource> implements AdminResourceService {
}
| [
"[email protected]"
] | |
013e61a23a29857a3d5eaf021a17c131044aa0b6 | 6757aa38d6eafd1707376e0afa4de6ab86d9e9af | /app/src/main/java/com/andrewnwalker/mousetimes_california/CountUpTimer.java | 274f497a40df19b7270bedb4b9a9cd6236ea0163 | [] | no_license | Andrew-Walker/Mouse-Times-California---Android | 2b557d72e4110c2d1f8804fccdab018efb45ee21 | 9e0c03b4161dd12911150bef91c1a40f139daa1d | refs/heads/master | 2020-09-20T19:46:28.717803 | 2016-04-03T01:01:00 | 2016-04-03T01:01:00 | 65,948,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,027 | java | package com.andrewnwalker.mousetimes_california;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
/**
* Created by Andrew Walker on 13/02/2016.
*/
public abstract class CountUpTimer {
abstract public void onTick(long elapsedTime);
private static final int MSG = 1;
private final long interval;
private long base;
public CountUpTimer(long interval) {
this.interval = interval;
}
public void start() {
base = SystemClock.elapsedRealtime();
handler.sendMessage(handler.obtainMessage(MSG));
}
public void stop() {
handler.removeMessages(MSG);
}
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
synchronized (CountUpTimer.this) {
long elapsedTime = SystemClock.elapsedRealtime() - base;
onTick(elapsedTime);
sendMessageDelayed(obtainMessage(MSG), interval);
}
}
};
} | [
"[email protected]"
] | |
22d0151b123306f5e60fd181b940e806211b16f5 | 857a460a6c8335e099a83d2e7b671618a71b0464 | /src/main/java/com/lb/game/controller/DigitalGamePlayController.java | 89b1aa9c97ca68a46818803eba96b11f01274540 | [] | no_license | zxcv1122BB/lb_n | bce2e7c456f4628d615b707f4931bc12c5feff52 | 9a0a3eb156bb94d66c9176de1e5d506fabecc50e | refs/heads/master | 2022-07-10T01:18:47.642054 | 2019-08-26T14:55:01 | 2019-08-26T14:55:01 | 203,388,208 | 1 | 1 | null | 2022-06-29T17:35:23 | 2019-08-20T14:01:58 | JavaScript | UTF-8 | Java | false | false | 4,821 | java | package com.lb.game.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import com.lb.game.service.impl.GameTypeServiceImpl;
import com.lb.sys.dao.DigitalGamePlayMapper;
import com.lb.sys.tools.BaseController;
import com.lb.sys.tools.PageUtils;
import com.lb.sys.tools.ResponseUtils;
import com.lb.sys.tools.StringUtil;
@Controller
@RestController
@RequestMapping("/game")
public class DigitalGamePlayController {
@Autowired DigitalGamePlayMapper digital;
@Autowired GameTypeServiceImpl gameType;
@RequestMapping(method = RequestMethod.POST, value = "/getGameInfo")
public ModelAndView getGameInfo(HttpServletRequest request) {
// 获取参数
Map<String, Object> map = BaseController.jsonToMap(request);
Integer id = map.containsKey("id")?Integer.valueOf(map.get("id").toString()) : null;
Integer act_id = map.containsKey("act_id")?Integer.valueOf(map.get("act_id").toString()) : null;
try {
if(map.get("openno")!=null&&!"".equals(map.get("openno"))) {
map.put("openno", map.get("openno").toString().trim().replace("-", ""));
}
// 调用查询方法
List<Map<String, Object>> all = new ArrayList<>();
if(!StringUtil.isBlank(map.get("pageIndex")) && !StringUtil.isBlank(map.get("pageNum")) && !StringUtil.isBlank(map.get("pageSize"))) {
// 当前页
Integer pageIndex = Integer.valueOf(map.get("pageIndex").toString()) ;
// 每一页数据条数
Integer pageNum = Integer.valueOf(map.get("pageNum").toString());
if (act_id==1) {
all = digital.qryGameType();
}else if (act_id==2) {
all = digital.qryGameGroup(id);
}
else if (act_id==3) {
all = digital.qryGamePlayed(id);
}
PageUtils<Map<String, Object>> pageInfo = new PageUtils<>(pageIndex,pageNum,all);
return ResponseUtils.jsonView(200, "获取数据成功",pageInfo);
}else {
if (act_id==1) {
all = digital.qryGameType();
}else if (act_id==2) {
all = digital.qryGameGroup(id);
}
else if (act_id==3) {
all = digital.qryGamePlayed(id);
}
return ResponseUtils.jsonView(200, "获取数据成功",all);
}
} catch (Exception e) {
e.printStackTrace();
return ResponseUtils.jsonView(201, "访问出现错误,请稍后再试",null) ;
}
}
@RequestMapping(method = RequestMethod.POST, value = "/updateGameInfo")
public ModelAndView updateGameInfo(HttpServletRequest request) {
Map<String, Object> paramMap = BaseController.jsonToMap(request);//this.jsonToMap(request);
int act_id = Integer.valueOf(paramMap.get("act_id").toString());
int id = Integer.valueOf(paramMap.get("id").toString());
if(paramMap.containsKey("status")) {
paramMap.put("status",String.valueOf(paramMap.get("status").toString()));
}
//System.err.println("[参数]:"+paramMap.entrySet());
//Integer id = paramMap.containsKey("id")?Integer.valueOf(paramMap.get("id").toString()):null;
try {
int all = 0;
if(act_id==0) {
//all = digital.qryGameKind(id);
}else if (act_id==1) {
boolean batchCanada28Issue = false;
if(41!=id) {
/*基础配置数据,修改导致坍塌性Bug。故只开放
id=41,加拿大28的起始期数据修改权限。
*/
paramMap.remove("current_issue");
paramMap.remove("start_time");
paramMap.remove("end_time");
all = digital.updateGameType(paramMap);
}else {
List<Map<String, Object>> qryGameType = digital.qryGameType();
boolean isUpdateIssue = !StringUtil.isBlank(paramMap.get("current_issue"))
&& StringUtil.isBlank(paramMap.get("start_time"))
&& !StringUtil.isBlank(paramMap.get("end_time"));
if(isUpdateIssue)//需要重新生成
batchCanada28Issue = gameType.batchCanada28Issue(qryGameType,paramMap);
if(batchCanada28Issue || !isUpdateIssue)//更新成功或者不需要更新
all = digital.updateGameType(paramMap);
}
}else if (act_id==2) {
all = digital.updateGameGroup(paramMap);
}
else if (act_id==3) {
if("0".equals(paramMap.get("status")+"")) {
paramMap.put("status",2);
}
all = digital.updateGamePlayed(paramMap);
}
return ResponseUtils.jsonView( all == 1 ? 200 : 133, all == 1 ? "更新成功":"更新失败");
} catch (Exception e) {
e.printStackTrace();
return ResponseUtils.jsonView(201, "更新失败,请稍后再试",e.getMessage()) ;
}
}
}
| [
"[email protected]"
] | |
59dab06b4eab5e6e19e5c3d3b26604b4ed06e7bc | 65bddbf6c9ecacafdea1ae6699887dcb02946cf3 | /RetailMeNotM/src/test/java/com/retailmenot/tests/VerifyNumberofItem_Test.java | 0e2d3c591e9ced05da33317cbf6d9bc6773bca36 | [] | no_license | singh234/TestSWPrj | 895da7346ba9ec04cf192aa57c094b1eccb17130 | 51c08853f510047d3035c7108e890599e994b904 | refs/heads/master | 2021-01-17T15:06:51.214498 | 2016-09-22T04:23:56 | 2016-09-22T04:23:56 | 68,880,102 | 0 | 0 | null | 2016-09-22T04:43:09 | 2016-09-22T03:14:18 | Java | UTF-8 | Java | false | false | 2,556 | java | package com.retailmenot.tests;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import com.retailmenot.pages.DealsPage;
import com.retailmenot.pages.HomePage;
import com.retailmenot.util.Utility;
import jxl.read.biff.BiffException;
public class VerifyNumberofItem_Test {
WebDriver driver;
HomePage homePage;
DealsPage dealsPage;
Logger logger;
@Parameters({"url","browserType"})
@BeforeClass
public void launchBrowser(String url,String browserType){
if(browserType.equals("FF"))
{
driver = new FirefoxDriver();
System.out.println("New Branch to practice Github");
}
else if(browserType.equals("IE")){
System.setProperty("webdriver.ie.driver", "IEDriverServer.exe");
driver = new InternetExplorerDriver();
}
else{
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
driver = new ChromeDriver();
}
driver.get(url);
logger=Logger.getLogger("VerifyNumberofItem_Test");
PropertyConfigurator.configure("Log4j.properties");
logger.info("Browser Launched Successfully");
}
@DataProvider(name="DP")
public String[][] feedDP() throws BiffException, IOException{
String data[][] = Utility.readExcel("VerifyDealsInput.xls", "sanity");
return data;
}
@Parameters({"pageTitle"})
@Test
public void verifyDealPageTitle(String pageTitle){
homePage = new HomePage(driver);
dealsPage = homePage.browsetoDealPage();
boolean actualTitle = dealsPage.verifydealsPage(pageTitle);
Assert.assertTrue(actualTitle);
logger.info("Verify Deals Page Title is Passed");
}
//@Parameters({"productCategory","dealsCount"})
@Test(dependsOnMethods={"verifyDealPageTitle"},dataProvider="DP")
public void verifyDealsCount(String productCategory,String dealsCount ){
int actualCount = dealsPage.verifyDealsCount(productCategory);
logger.info("Actual count of the products"+actualCount);
int expectedCount = Integer.parseInt(dealsCount);
Assert.assertEquals(actualCount, expectedCount);
}
}
| [
"[email protected]"
] | |
477c1fa840b110e6a117d4c738f6ce0711b07028 | 199e420db803921633fe31f0aa9aeb0b5881b4a8 | /app/src/main/java/com/example/movies_and_actors/adapters/AdapterSearch.java | 8e35d0ed2a22b85f9697c7ca3f7fdfb20409a59a | [] | no_license | adrijanasavic/Movies_and_Actors | 6d26b98d7e439c474f49437e36b7d98c4c529f0f | cfdb729d07d25a5041d81c43f6ff774f0669e211 | refs/heads/master | 2022-10-20T19:25:19.386002 | 2020-06-10T15:12:13 | 2020-06-10T15:12:13 | 270,801,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,543 | java | package com.example.movies_and_actors.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.example.movies_and_actors.R;
import com.example.movies_and_actors.models.ResultsMovieItem;
import java.util.List;
import static com.example.movies_and_actors.net.MyServiceContract.IMAGEBASEURL;
public class AdapterSearch extends RecyclerView.Adapter<AdapterSearch.MyViewHolder>{
private Context context;
private List<ResultsMovieItem> searchItems;
private OnItemClickListener listener;
public String firstFour(String godina) {
if (godina.length() > 4) {
return godina.substring(0, 4);
} else {
return null;
}
}
public AdapterSearch(Context context, List<ResultsMovieItem> searchItems, OnItemClickListener listener) {
this.context = context;
this.searchItems = searchItems;
this.listener = listener;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.recycler_prikaz, parent, false);
return new MyViewHolder(view, listener);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
holder.imeFilma.setText(searchItems.get(position).getTitle());
try {
holder.godinaFilma.setText(firstFour(searchItems.get(position).getReleaseDate()));
} catch (NullPointerException e) {
e.printStackTrace();
}
// Picasso.with(context).load(searchItems.get(position).getPosterPath()).into(holder.slikaGlumca);
Glide.with(holder.itemView)
.load(IMAGEBASEURL + searchItems.get(position).getPosterPath())
.into(holder.slikaGlumca);
}
@Override
public int getItemCount() {
return searchItems.size();
}
public ResultsMovieItem get(int position) {
return searchItems.get(position);
}
public static class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private TextView imeFilma, godinaFilma;
private ImageView slikaGlumca;
private long lastClickTime = System.currentTimeMillis();
private static final long CLICK_TIME_INTERVAL = 1000;
private OnItemClickListener vhListener;
MyViewHolder(@NonNull View itemView, OnItemClickListener vhListener) {
super(itemView);
itemView.setClickable(true);
itemView.setOnClickListener(this);
slikaGlumca = itemView.findViewById(R.id.slikaGlumca);
imeFilma = itemView.findViewById( R.id.imeGlumca);
godinaFilma = itemView.findViewById((R.id.godinaFilma));
this.vhListener = vhListener;
}
@Override
public void onClick(View v) {
long now = System.currentTimeMillis();
if (now - lastClickTime < CLICK_TIME_INTERVAL){
return;
}
lastClickTime = now;
vhListener.onSearchMovieClick(getAdapterPosition());
}
}
public interface OnItemClickListener {
void onSearchMovieClick(int position);
}
}
| [
"[email protected]"
] | |
833de32db82c5cd5597885efd81dbaeb94c21423 | f2f0e98d242baf79fda5778328ae40a583582bdb | /400_xowa/src/gplx/xowa/xtns/mapSources/Map_math.java | 85712a45c127a30e125172c7e67a7684d5434d31 | [] | no_license | ATCARES/xowa | 0ca09f7aa08f400713f9d298bc9843b96e000a0c | 5957bd0cb0de1dbfafae1aef9055846713a5e521 | refs/heads/master | 2021-01-15T14:41:57.565426 | 2014-04-14T03:28:27 | 2014-04-14T03:28:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,151 | java | /*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 [email protected]
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.xtns.mapSources; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
import org.junit.*;
class Map_math {// REF.MW:MapSources_math.php
private int word_idx_nsew;
private double[] rv = new double[4];
private byte dir_id;
private int prec;
private int step;
public double Dec() {return dec;} private double dec;
public int Error() {return error;} private int error;
public double Coord_dec() {return coord_dec;} private double coord_dec;
public double Coord_deg() {return coord_deg;} private double coord_deg;
public double Coord_min() {return coord_min;} private double coord_min;
public double Coord_sec() {return coord_sec;} private double coord_sec;
public byte[] Coord_dir_ns() {return coord_dir_ns;} private byte[] coord_dir_ns;
public byte[] Coord_dir_ew() {return coord_dir_ew;} private byte[] coord_dir_ew;
public boolean Ctor(byte[] input, int prec, byte[] dir, int until_step) {
try {
New_coord(input, dir, prec);
if (until_step > 1 && error == 0)
Set_coord();
} catch (Exception e) {
Err_.Noop(e);
error = -128;
}
return error == 0;
}
public void Fail(Xop_ctx ctx, byte[] src, Xot_invk self, ByteAryBfr bfr, byte[] pfunc_name) {
byte[] self_src = ByteAry_.Mid(src, self.Src_bgn(), self.Src_end());
if (error != -1) // -1 indicates empty coord; don't log, b/c it.v: often omits; it.v:Sami; DATE:2014-03-02
ctx.App().Usr_dlg().Warn_many("", "", "mapSources failed: page=~{0} src=~{1} err=~{2}", String_.new_utf8_(ctx.Page().Ttl().Full_db()), String_.new_utf8_(self_src), error);
bfr.Add(pfunc_name).Add(Bry_failed);
return;
} private static final byte[] Bry_failed = ByteAry_.new_ascii_(" failed.");
private void New_coord(byte[] input, byte[] dir, int prec) { // REF.MW:newCoord
this.error = 0; this.word_idx_nsew = -1;
coord_dec = coord_deg = coord_min = coord_sec = 0;
rv[0] = rv[1] = rv[2] = 0; rv[3] = 1;
this.dir_id = Parse_dir(dir);
this.prec = Parse_precision(prec);
this.dec = 0;
this.step = 0;
Parse_input(input);
}
private void Set_coord() { // REF.MW:setCoord
if (step > 1) return;
if (prec < 9)
dec = Math_.Round(dec, prec);
int sign = dec < 0 ? -1 : 1;
double angle = Math_.Abs_double(dec);
double deg = Math_.Floor(angle);
double min = (angle - deg) * 60;
double sec = prec > 0
? Math_.Round((min - Math_.Floor(min)) * 60, prec - 4)
: Math_.Round((min - Math_.Floor(min)) * 60, 0)
;
min = Math_.Floor(min);
if (sec >= 60) {
sec -= 60;
min++;
}
if (prec < 3 && sec >= 30)
min++;
if (prec < 3)
sec = 0;
if (min >= 60) {
min -= 60;
deg++;
}
if (prec < 1 && min >= 30) {
deg++;
}
if (prec < 1)
min = 0;
coord_dec = Math_.Round(dec, prec);
coord_deg = deg * sign;
coord_min = min;
coord_sec = sec;
if (sign > 0) {
coord_dir_ns = Compass_N;
coord_dir_ew = Compass_E;
}
else {
coord_dir_ns = Compass_S;
coord_dir_ew = Compass_W;
}
step = 2;
}
private static final byte[] Bry_deg = ByteAry_.new_utf8_("°"), Bry_quot = ByteAry_.new_ascii_(""");
public byte[] Get_dms(byte[] plus, byte[] minus) { // REF.MW: getDMSString
if (step < 2) Set_coord();
double deg = coord_deg;
if ( dec < 0
&& (ByteAry_.Len_gt_0(plus) || ByteAry_.Len_gt_0(minus))) {
deg = Math_.Abs_double(deg);
}
tmp_bfr.Add_double(deg).Add(Bry_deg);
if (prec > 0)
tmp_bfr.Add_byte_space().Add_double(coord_min).Add_byte(Byte_ascii.Apos);
if (prec > 2)
tmp_bfr.Add_byte_space().Add_double(coord_sec).Add(Bry_quot);
byte[] letter = null;
if (dir_id == Dir_lat_id)
letter = coord_dir_ns;
if (dir_id == Dir_long_id)
letter = coord_dir_ew;
if (dec > 0 && ByteAry_.Len_gt_0(plus))
letter = plus;
if (dec < 0 && ByteAry_.Len_gt_0(minus))
letter = minus;
if (letter != null)
tmp_bfr.Add_byte_space().Add(letter);
return tmp_bfr.XtoAryAndClear();
}
private void Parse_input(byte[] src) { // REF.MW: toDec
src = Parse_input_normalize(tmp_bfr, src);
if (src == null) {error = -1; return;}
int src_len = src.length;
int word_idx = -1, word_bgn = 0, words_len = 0;
int i = 0;
while (true) {
boolean is_last = i == src_len;
byte b = is_last ? Byte_ascii.Space : src[i];
switch (b) {
case Byte_ascii.Space:
Parse_input_word(rv, src, ++word_idx, word_bgn, i);
++words_len;
i = Byte_ary_finder.Find_fwd_while_space_or_tab(src, i, src_len);
word_bgn = i;
break;
}
if (is_last) break;
i++;
}
if (word_idx_nsew != -1 && word_idx_nsew != words_len - 1) {error = -10; return;}
if (words_len < 1 || words_len > 4) {error = -2; return;}
if (rv[0] >= 0)
dec = (rv[0] + rv[1] / 60 + rv[2] / 3600 ) * rv[3];
else
dec = (rv[0] - rv[1] / 60 - rv[2] / 3600 ) * rv[3];
this.step = 1;
}
private boolean Parse_input_word_is_compass(byte v) {
switch (v) {
case Byte_ascii.Ltr_N:
case Byte_ascii.Ltr_E:
case Byte_ascii.Ltr_S:
case Byte_ascii.Ltr_W:
return true;
default:
return false;
}
}
private void Parse_input_word(double[] rv, byte[] input, int word_idx, int word_bgn, int word_end) {
if (word_idx >= Input_units_len) return;
byte unit_dlm = Input_units[word_idx];
int pos = Byte_ary_finder.Find_fwd(input, unit_dlm, word_bgn, word_end);
if (pos != ByteAry_.NotFound) // remove dlms from end of bry; EX: "123'" -> "123"
word_end = pos;
if (!Parse_input_word_is_compass(input[word_bgn])) { // if ( is_numeric( $v ) ) {
double word_val = ByteAry_.XtoDoubleByPosOr(input, word_bgn, word_end, Double_.NaN);
if (word_val != Double_.NaN) {
if (word_idx > 2) {error = -4; return;}
switch (word_idx) {
case 0:
if (word_val <= -180 || word_val > 180) {error = -5; return;}
rv[0] = word_val;
break;
case 1:
if (word_val < 0 || word_val >= 60) {error = -6; return;}
if (rv[0] != (int)(rv[0])) {error = -7; return;}
rv[1] = word_val;
break;
case 2:
if (word_val < 0 || word_val >= 60) {error = -8; return;}
if (rv[1] != (int)(rv[1])) {error = -9; return;}
rv[2] = word_val;
break;
}
}
else {error = -3; return;}
}
else { // 'NSEW'
word_idx_nsew = word_idx;
byte word_byte = input[word_bgn];
if (rv[0] < 0) {error = -11; return;}
if (word_end - word_bgn != 1) {error = -3; return;}
switch (dir_id) {
case Dir_long_id:
if (word_byte == Byte_ascii.Ltr_N || word_byte == Byte_ascii.Ltr_S) {error = -12; return;}
break;
case Dir_lat_id:
if (word_byte == Byte_ascii.Ltr_E || word_byte == Byte_ascii.Ltr_W) {error = -12; return;}
break;
case Dir_unknown_id:
if (word_byte == Byte_ascii.Ltr_N || word_byte == Byte_ascii.Ltr_S) this.dir_id = Dir_lat_id;
else this.dir_id = Dir_long_id;
break;
}
if (this.dir_id == Dir_lat_id) {
double rv_0 = rv[0];
if (rv_0 < -90 || rv_0 > 90) {error = -13; return;}
}
if (word_byte == Byte_ascii.Ltr_S || word_byte == Byte_ascii.Ltr_W)
rv[3] = -1;
}
}
private static byte Parse_dir(byte[] dir) {
if (ByteAry_.Len_eq_0(dir)) return Dir_unknown_id;
Object dir_obj = Dir_trie.MatchAtCur(dir, 0, dir.length);
return dir_obj == null ? Dir_unknown_id : ((ByteVal)dir_obj).Val();
}
private static int Parse_precision(int val) { // REF.MW: MapSourcesMath.php|newCoord
if (val > -1 && val < 10) return val;
else if (val == -1) return 9;
else return 4;
}
private ByteAryBfr tmp_bfr = ByteAryBfr.reset_(32);
private static byte[] Parse_input_normalize(ByteAryBfr bfr, byte[] input) {
int input_end = input.length; if (input_end == 0) return null;
int i = 0;
while (i < input_end) {
byte b = input[i];
Object o = Input_trie.Match(b, input, i, input_end);
if (o == null) {
bfr.Add_byte(b);
++i;
}
else {
byte tid = ((ByteVal)o).Val();
switch (tid) {
case Input_tid_apos: bfr.Add_byte(Byte_ascii.Apos).Add_byte_space(); break; // EX: "'" -> "' "
case Input_tid_quote: bfr.Add_byte(Byte_ascii.Quote).Add_byte_space(); break; // EX: '"' -> '" '
case Input_tid_dash: bfr.Add_byte(Byte_ascii.Dash); break;
case Input_tid_space: bfr.Add_byte_space(); break;
case Input_tid_degree: bfr.Add_byte(Byte_ascii.Slash); bfr.Add_byte_space(); break; // EX: "°" -> "° "
case Input_tid_compass: bfr.Add_byte_space(); bfr.Add_byte(Byte_ascii.Case_upper(b)); break; // NOTE: always single-char ASCII; EX: N,E,S,W,n,e,s,w
}
i = Input_trie.Match_pos();
}
}
return bfr.XtoAryAndClearAndTrim();
}
private static final byte Dir_unknown_id = 0, Dir_lat_id = 1, Dir_long_id = 2;
public static final byte[] Dir_lat_bry = ByteAry_.new_ascii_("lat"), Dir_long_bry = ByteAry_.new_ascii_("long");
private static final ByteTrieMgr_slim Dir_trie = ByteTrieMgr_slim.ci_()
.Add_bry_bval(Dir_lat_bry , Dir_lat_id)
.Add_bry_bval(Dir_long_bry , Dir_long_id)
;
private static final byte[]
Compass_N = new byte[] {Byte_ascii.Ltr_N}
, Compass_E = new byte[] {Byte_ascii.Ltr_E}
, Compass_S = new byte[] {Byte_ascii.Ltr_S}
, Compass_W = new byte[] {Byte_ascii.Ltr_W}
;
private static final byte Input_tid_apos = 1, Input_tid_quote = 2, Input_tid_dash = 3, Input_tid_space = 4, Input_tid_degree = 5, Input_tid_compass = 6;
private static final byte Input_byte_degree = Byte_ascii.Slash; // NOTE: ugly cheat to avoid using multi-byte char; note that all "/" are swapped out to " ", so any remaining "/" was added by the normalizer; EX: "123° 4/5" -> "123/ 4 5"
private static final byte[] Input_units = new byte[] {Input_byte_degree, Byte_ascii.Apos, Byte_ascii.Quote, Byte_ascii.Space};
private static final int Input_units_len = Input_units.length;
private static final byte[] Input_bry_degree = ByteAry_.new_utf8_("°");
private static final ByteTrieMgr_slim Input_trie = ByteTrieMgr_slim.cs_()
.Add_str_byte("'" , Input_tid_apos) // NOTE: must add ' so that "'" -> "' "
.Add_str_byte("‘" , Input_tid_apos)
.Add_str_byte("’" , Input_tid_apos)
.Add_str_byte("′" , Input_tid_apos)
.Add_str_byte("\"" , Input_tid_quote) // NOTE: must add " so that '"' -> '" '
.Add_str_byte("''" , Input_tid_quote)
.Add_str_byte("“" , Input_tid_quote)
.Add_str_byte("”" , Input_tid_quote)
.Add_str_byte("″" , Input_tid_quote)
.Add_str_byte("-" , Input_tid_dash)
.Add_str_byte("−" , Input_tid_dash)
.Add_str_byte(" " , Input_tid_space)
.Add_str_byte("_" , Input_tid_space)
.Add_str_byte("/" , Input_tid_space)
.Add_str_byte("\t" , Input_tid_space)
.Add_str_byte("\n" , Input_tid_space)
.Add_str_byte("\r" , Input_tid_space)
.Add_bry_bval(Input_bry_degree , Input_tid_degree)
.Add_str_byte("N" , Input_tid_compass)
.Add_str_byte("S" , Input_tid_compass)
.Add_str_byte("E" , Input_tid_compass)
.Add_str_byte("W" , Input_tid_compass)
.Add_str_byte("n" , Input_tid_compass)
.Add_str_byte("s" , Input_tid_compass)
.Add_str_byte("e" , Input_tid_compass)
.Add_str_byte("w" , Input_tid_compass)
;
public static final Map_math _ = new Map_math();
}
| [
"[email protected]"
] | |
36b39bf7999dfcbb14c5e1d86dd6879b6b6844e0 | 63fbb8a46bd293e153d22b1f37acd0ac9b3c3491 | /Samples/app/src/main/java/samples/linhtruong/com/app/memoryleak/LeakCase2.java | 7e2effb30a9857d5192adc839600f61ff6848945 | [] | no_license | trithucbkpro/Samples | 2800e71ef29088aa486ca046f22e16b42700ad72 | 89af0f28504a192cdacdca578fcda9f221227e69 | refs/heads/master | 2021-01-19T22:41:30.950666 | 2019-09-19T14:54:23 | 2019-09-19T14:54:23 | 88,845,710 | 0 | 0 | null | 2017-04-20T09:21:23 | 2017-04-20T09:21:23 | null | UTF-8 | Java | false | false | 1,771 | java | package samples.linhtruong.com.app.memoryleak;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import samples.linhtruong.com.app.R;
import samples.linhtruong.com.base.BaseActivity;
/**
* Anonymous inner classes: i.e callback
*
* @author linhtruong
* @date 2/20/17 - 14:28.
* @organization VED
*/
public class LeakCase2 extends BaseActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
doTaskLeak();
doTask();
}
/**
* This is memory leak.
* Since {@link LSingleton} is singleton, it will in the memory for the lifetime of the application.
* The {@link LCallback} object is passed to this singleton and stored in mCallbackQueue variable.
* So there is a reference to {@link LCallback} object from a static object in memory.
* So the parent class of {@link LCallback} object wont be cleared if needed.
*/
private void doTaskLeak() {
LSingleton.getInstance().doTask(new LCallback() {
@Override
public void onStart() {
}
@Override
public void onCompleted() {
}
});
}
/**
* Avoid passing anonymous inner class object to static/singleton classes
* which keep strong reference to it.
* The solution is make it {@link java.lang.ref.WeakReference}
*/
private void doTask() {
LSingleton.getInstance().doTask(new LCallback() {
@Override
public void onStart() {
}
@Override
public void onCompleted() {
}
});
}
}
| [
"[email protected]"
] | |
04174ab64cfe9c7c40de3ee2179c44c9794f2296 | 24d8cf871b092b2d60fc85d5320e1bc761a7cbe2 | /DrJava/rev4989-5058/base-trunk-4989/src/edu/rice/cs/drjava/model/debug/DebugEventNotifier.java | ba8294b324138206e2f6f161d2febc545f535c13 | [] | no_license | joliebig/featurehouse_fstmerge_examples | af1b963537839d13e834f829cf51f8ad5e6ffe76 | 1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad | refs/heads/master | 2016-09-05T10:24:50.974902 | 2013-03-28T16:28:47 | 2013-03-28T16:28:47 | 9,080,611 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,801 | java |
package edu.rice.cs.drjava.model.debug;
import edu.rice.cs.drjava.model.EventNotifier;
import edu.rice.cs.drjava.model.OpenDefinitionsDocument;
import java.awt.EventQueue;
public class DebugEventNotifier extends EventNotifier<DebugListener> implements DebugListener {
public void debuggerStarted() {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) {
_listeners.get(i).debuggerStarted();
}
}
finally { _lock.endRead(); }
}
public void debuggerShutdown() {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) {
_listeners.get(i).debuggerShutdown();
}
}
finally { _lock.endRead(); }
}
public void threadLocationUpdated(OpenDefinitionsDocument doc, int lineNumber, boolean shouldHighlight) {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) {
_listeners.get(i).threadLocationUpdated(doc, lineNumber, shouldHighlight);
}
}
finally { _lock.endRead(); }
}
public void regionAdded(Breakpoint bp) {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) { _listeners.get(i).regionAdded(bp); }
}
finally { _lock.endRead(); }
}
public void breakpointReached(Breakpoint bp) {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) {
_listeners.get(i).breakpointReached(bp);
}
}
finally {
_lock.endRead();
}
}
public void regionChanged(Breakpoint bp) {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) {
_listeners.get(i).regionChanged(bp);
}
}
finally {
_lock.endRead();
}
}
public void watchSet(DebugWatchData w) {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) { _listeners.get(i).watchSet(w); }
}
finally { _lock.endRead(); }
}
public void watchRemoved(DebugWatchData w) {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) { _listeners.get(i).watchRemoved(w); }
}
finally { _lock.endRead(); }
}
public void regionRemoved(Breakpoint bp) {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) _listeners.get(i).regionRemoved(bp);
}
finally { _lock.endRead(); }
}
public void stepRequested() {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) _listeners.get(i).stepRequested();
}
finally { _lock.endRead(); }
}
public void currThreadSuspended() {
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) _listeners.get(i).currThreadSuspended();
}
finally { _lock.endRead(); }
}
public void currThreadResumed() {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) _listeners.get(i).currThreadResumed();
}
finally { _lock.endRead(); }
}
public void threadStarted() {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) _listeners.get(i).threadStarted();
}
finally { _lock.endRead(); }
}
public void currThreadDied() {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) _listeners.get(i).currThreadDied();
}
finally { _lock.endRead(); }
}
public void nonCurrThreadDied() {
assert EventQueue.isDispatchThread();
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) _listeners.get(i).nonCurrThreadDied();
}
finally { _lock.endRead(); }
}
public void currThreadSet(DebugThreadData thread) {
_lock.startRead();
try {
int size = _listeners.size();
for (int i = 0; i < size; i++) {
_listeners.get(i).currThreadSet(thread);
}
}
finally { _lock.endRead(); }
}
}
| [
"[email protected]"
] | |
ee965043a54a60580720db94317319c497fdd022 | 46203451280bd1477e5c033da5790a503efcead7 | /src/main/java/subtask/SubTask.java | d4339cdad79046d7475ec7fe6941c5074e7d702b | [] | no_license | prakharrke/dailytasks_backend | 0f68eda7dd63c8474b0b1e0c55d0392d1684ab7e | dca2b0ad3dd99f32e4eefeb84b8fc15fbea8d120 | refs/heads/master | 2022-06-23T16:46:20.893594 | 2019-06-13T05:26:41 | 2019-06-13T05:26:41 | 191,695,820 | 0 | 0 | null | 2022-05-20T21:00:34 | 2019-06-13T05:23:14 | Java | UTF-8 | Java | false | false | 1,443 | java | package subtask;
import java.sql.SQLException;
import model.DBCommunication;
public class SubTask {
String taskID;
String subTaskID;
String description;
String timeSheet;
char special;
char approved = 'n';
char reviewed = 'n';
public String getTaskID() {
return taskID;
}
public SubTask setTaskID(String taskID) {
this.taskID = taskID;
return this;
}
public String getSubTaskID() {
return subTaskID;
}
public SubTask setSubTaskID(String subTaskID) {
this.subTaskID = subTaskID;
return this;
}
public String getDescription() {
return description;
}
public SubTask setDescription(String description) {
this.description = description;
return this;
}
public String getTimeSheet() {
return timeSheet;
}
public SubTask setTimeSheet(String timeSheet) {
this.timeSheet = timeSheet;
return this;
}
public char getSpecial() {
return special;
}
public SubTask setSpecial(char special) {
this.special = special;
return this;
}
public char getApproved() {
return approved;
}
public SubTask setApproved(char approved) {
this.approved = approved;
return this;
}
public char getReviewed() {
return reviewed;
}
public SubTask setReviewed(char reviewed) {
this.reviewed = reviewed;
return this;
}
public void insertSubTask() throws ClassNotFoundException, SQLException {
DBCommunication dbCommunication = new DBCommunication();
dbCommunication.insertSubTask(this);
}
}
| [
"[email protected]"
] | |
7b684b35c0039c8c9795eaed8ea2383e4eb6d6a9 | 6a8a8984959b30cea3dbc5168f89fae68bda62cb | /PrintDuplicatesCollections.java | 40d89ad9285ef8570bd2966f152587919978d0d7 | [] | no_license | TestLeaf-Arun/week3.day2 | aec5b5cc9e46a26ff58b0d1ae2cb0ffebbefe6dd | d0c3183c02bcf3b49f32aa1929927529f1fa78c1 | refs/heads/main | 2023-07-12T09:28:12.831790 | 2021-08-27T03:52:23 | 2021-08-27T03:52:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package week3.day2;
import java.util.LinkedHashSet;
import java.util.Set;
public class PrintDuplicatesCollections {
public static void main(String[] args) {
int[] arr = {14,12,13,11,15,14,18,16,17,19,18,17,20};
Set<Integer> num = new LinkedHashSet<Integer>();
for (Integer eachData : arr) {
if (!num.add(eachData)) {
System.out.println(eachData);
}
}
}
} | [
"[email protected]"
] | |
cf1d4049197759a12add8762486d70713f6d201e | cf0b2e2fcd3838e470cb4c205dda8cc05ac11628 | /hotils-inject/src/main/java/org/hotilsframework/inject/annotation/Inject.java | af51933cb27f2a0a61061c4c8f7aa4574924e21f | [] | no_license | hireny/hotils | b216b2991c7f3ad6447dbcc8433a9a771e8be1e3 | 0b59a3853d5e636a4a499cca8e7799d540ece62b | refs/heads/master | 2021-09-10T02:05:54.275527 | 2021-08-26T14:44:08 | 2021-08-26T14:44:08 | 225,169,822 | 0 | 0 | null | 2020-10-13T20:59:23 | 2019-12-01T13:54:30 | Java | UTF-8 | Java | false | false | 423 | java | package org.hotilsframework.inject.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Inject注解,相当于Spring的@Autowired
* @author hireny
* @className Inject
* @create 2020-04-01 20:15
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Inject {
}
| [
"[email protected]"
] | |
b7aa8d6e188213be481718594362d5a472dc1b61 | b146af64dd81bc05ed8b9a4db18dd51a965ae0b5 | /src/rs/ac/bg/etf/pp1/ast/AstLetop.java | 54fae17ffc7c0fb0c8c0f1c5cc83fad2bddb452c | [
"MIT"
] | permissive | Edvvin/MicroJavaCompiler | 07cf9b6dab83dabfe654762a5448db82cbef1e86 | 5ff2ee830c8214b9f54494f16fdcd19344f5135d | refs/heads/master | 2023-06-08T07:49:02.599846 | 2021-06-16T14:57:37 | 2021-06-16T14:57:37 | 343,233,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | // generated with ast extension for cup
// version 0.8
// 16/5/2021 15:11:18
package rs.ac.bg.etf.pp1.ast;
public class AstLetop extends Relop {
public AstLetop () {
}
public void accept(Visitor visitor) {
visitor.visit(this);
}
public void childrenAccept(Visitor visitor) {
}
public void traverseTopDown(Visitor visitor) {
accept(visitor);
}
public void traverseBottomUp(Visitor visitor) {
accept(visitor);
}
public String toString(String tab) {
StringBuffer buffer=new StringBuffer();
buffer.append(tab);
buffer.append("AstLetop(\n");
buffer.append(tab);
buffer.append(") [AstLetop]");
return buffer.toString();
}
}
| [
"[email protected]"
] | |
ca6821a1c7fc67e8d841cd4358f3f5c444842273 | e048cb9cd0a7d49bb284dcc3d9a0871713127c48 | /leasing-company-parent/leasing-company-service/src/main/java/com/cloudkeeper/leasing/company/repository/AttendanceRepository.java | cb28675eb899e0de952e14535c5686ddb46a327a | [] | no_license | lzj1995822/GuSuCommunityApi | 65b97a0c9f8bdeb608f887970f4d2e99d2306785 | 51348b26b9b0c0017dca807847695b3740aaf2e8 | refs/heads/master | 2020-04-23T19:18:18.348991 | 2019-04-28T02:56:21 | 2019-04-28T02:56:21 | 171,398,689 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package com.cloudkeeper.leasing.company.repository;
import com.cloudkeeper.leasing.base.repository.BaseRepository;
import com.cloudkeeper.leasing.company.domain.Attendance;
public interface AttendanceRepository extends BaseRepository<Attendance> {
}
| [
"[email protected]"
] | |
a5f5f7cb2d6280c82aa7090e7f7c87b8975fac06 | a3841d9f3d125bfc4fb14b56438f9ffa7b270b1c | /src/test/java/com/hillel/lecture_4/Method.java | b0710f2c836c9e9bb2c4871129ac36269d673a34 | [] | no_license | Dmitriy2509/home-work-task | 346fa43941f0795d54adbeb46918b79d0f946862 | 00f8e4b631534fd9020c5735bb2209221ab2955e | refs/heads/master | 2020-08-28T21:16:11.279256 | 2019-12-08T09:46:57 | 2019-12-08T09:46:57 | 217,823,419 | 0 | 0 | null | 2019-10-27T08:06:45 | 2019-10-27T08:06:45 | null | UTF-8 | Java | false | false | 1,357 | java | package com.hillel.lecture_4;
public class Method {
public static void main(String[] args) {
/* double result = 25d+273.16;
System.out.println("Celsius to Kelvin: "+ result);*/
celsiusToKelvin(10d);
//metersToKilometers ();
double kilometers = metersToKilometers(500d);
distanceCompare(kilometers);
if (kilometers>0.7){
System.out.println("Correct distance!");
}else if(kilometers<0.5){
System.out.println("Excellent distance!");
}
else{
System.out.println("Bad distance!");
}
System.out.println(kilometers);
}
public static void celsiusToKelvin(double celsius) {
double result = celsius + 273.16;
System.out.println("Celsius to Kelvin: "+ result);
}
public static double metersToKilometers (double meters){
double result = meters/1000d;
System.out.println("Meters to kilometers: "+ result);
return result;
}
public static String distanceCompare(double kilometers){
String message;
if (kilometers>0.7){
message ="Correct distance!";
}else if(kilometers<0.5){
message="Excellent distance!";
}
else{
message="Bad distance!";
}
return message;
}
}
| [
"[email protected]"
] | |
324062de7589452802949cfe56cab85bbc7b8301 | 11431aa193e9026d84bcd0b5e8af1ce817f8dc0c | /PizzaProj/src/main/java/db2/juhh/PizzaProj/model/PizzaDetalhe.java | 411ccfdb48e98bf6ad265c85b642b74b4b373414 | [] | no_license | leoljunior/db2 | 4f23894980fa160d4682875dd00abd47b6e3071d | 6dba5e0b00afa125f6e427c0e882876822f3adef | refs/heads/master | 2023-06-05T09:16:10.701716 | 2021-06-28T15:00:10 | 2021-06-28T15:00:10 | 380,547,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,091 | java | package db2.juhh.PizzaProj.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name = "pizzadetalhe")
public class PizzaDetalhe implements Serializable {
@Temporal(TemporalType.DATE)
private Date data;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int numPedido;
private int quantidade;
private float preco;
public Date getData() {
return data;
}
public void setData(Date data) {
this.data = data;
}
public int getNumPedido() {
return numPedido;
}
public void setNumPedido(int numPedido) {
this.numPedido = numPedido;
}
public int getQuantidade() {
return quantidade;
}
public void setQuantidade(int quantidade) {
this.quantidade = quantidade;
}
public float getPreco() {
return preco;
}
public void setPreco(float preco) {
this.preco = preco;
}
}
| [
"[email protected]"
] | |
cfd152655fdd852784983ef925814f4e28238ad4 | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/Transcript.java | 3bded6d7e5fd7f59f8c4200b91a851ef81caf4e7 | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 11,144 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.transcribe.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* Identifies the location of a transcription.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/transcribe-2017-10-26/Transcript" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Transcript implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The S3 object location of the transcript.
* </p>
* <p>
* Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> field
* when you created the job, this is the URI of that bucket. If you chose to store the transcript in Amazon
* Transcribe, this is a shareable URL that provides secure access to that location.
* </p>
*/
private String transcriptFileUri;
/**
* <p>
* The S3 object location of the redacted transcript.
* </p>
* <p>
* Use this URI to access the redacted transcript. If you specified an S3 bucket in the
* <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose to
* store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that location.
* </p>
*/
private String redactedTranscriptFileUri;
/**
* <p>
* The S3 object location of the transcript.
* </p>
* <p>
* Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> field
* when you created the job, this is the URI of that bucket. If you chose to store the transcript in Amazon
* Transcribe, this is a shareable URL that provides secure access to that location.
* </p>
*
* @param transcriptFileUri
* The S3 object location of the transcript.</p>
* <p>
* Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code>
* field when you created the job, this is the URI of that bucket. If you chose to store the transcript in
* Amazon Transcribe, this is a shareable URL that provides secure access to that location.
*/
public void setTranscriptFileUri(String transcriptFileUri) {
this.transcriptFileUri = transcriptFileUri;
}
/**
* <p>
* The S3 object location of the transcript.
* </p>
* <p>
* Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> field
* when you created the job, this is the URI of that bucket. If you chose to store the transcript in Amazon
* Transcribe, this is a shareable URL that provides secure access to that location.
* </p>
*
* @return The S3 object location of the transcript.</p>
* <p>
* Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code>
* field when you created the job, this is the URI of that bucket. If you chose to store the transcript in
* Amazon Transcribe, this is a shareable URL that provides secure access to that location.
*/
public String getTranscriptFileUri() {
return this.transcriptFileUri;
}
/**
* <p>
* The S3 object location of the transcript.
* </p>
* <p>
* Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code> field
* when you created the job, this is the URI of that bucket. If you chose to store the transcript in Amazon
* Transcribe, this is a shareable URL that provides secure access to that location.
* </p>
*
* @param transcriptFileUri
* The S3 object location of the transcript.</p>
* <p>
* Use this URI to access the transcript. If you specified an S3 bucket in the <code>OutputBucketName</code>
* field when you created the job, this is the URI of that bucket. If you chose to store the transcript in
* Amazon Transcribe, this is a shareable URL that provides secure access to that location.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Transcript withTranscriptFileUri(String transcriptFileUri) {
setTranscriptFileUri(transcriptFileUri);
return this;
}
/**
* <p>
* The S3 object location of the redacted transcript.
* </p>
* <p>
* Use this URI to access the redacted transcript. If you specified an S3 bucket in the
* <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose to
* store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that location.
* </p>
*
* @param redactedTranscriptFileUri
* The S3 object location of the redacted transcript.</p>
* <p>
* Use this URI to access the redacted transcript. If you specified an S3 bucket in the
* <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose
* to store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that
* location.
*/
public void setRedactedTranscriptFileUri(String redactedTranscriptFileUri) {
this.redactedTranscriptFileUri = redactedTranscriptFileUri;
}
/**
* <p>
* The S3 object location of the redacted transcript.
* </p>
* <p>
* Use this URI to access the redacted transcript. If you specified an S3 bucket in the
* <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose to
* store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that location.
* </p>
*
* @return The S3 object location of the redacted transcript.</p>
* <p>
* Use this URI to access the redacted transcript. If you specified an S3 bucket in the
* <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you
* chose to store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access
* to that location.
*/
public String getRedactedTranscriptFileUri() {
return this.redactedTranscriptFileUri;
}
/**
* <p>
* The S3 object location of the redacted transcript.
* </p>
* <p>
* Use this URI to access the redacted transcript. If you specified an S3 bucket in the
* <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose to
* store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that location.
* </p>
*
* @param redactedTranscriptFileUri
* The S3 object location of the redacted transcript.</p>
* <p>
* Use this URI to access the redacted transcript. If you specified an S3 bucket in the
* <code>OutputBucketName</code> field when you created the job, this is the URI of that bucket. If you chose
* to store the transcript in Amazon Transcribe, this is a shareable URL that provides secure access to that
* location.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Transcript withRedactedTranscriptFileUri(String redactedTranscriptFileUri) {
setRedactedTranscriptFileUri(redactedTranscriptFileUri);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getTranscriptFileUri() != null)
sb.append("TranscriptFileUri: ").append(getTranscriptFileUri()).append(",");
if (getRedactedTranscriptFileUri() != null)
sb.append("RedactedTranscriptFileUri: ").append(getRedactedTranscriptFileUri());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Transcript == false)
return false;
Transcript other = (Transcript) obj;
if (other.getTranscriptFileUri() == null ^ this.getTranscriptFileUri() == null)
return false;
if (other.getTranscriptFileUri() != null && other.getTranscriptFileUri().equals(this.getTranscriptFileUri()) == false)
return false;
if (other.getRedactedTranscriptFileUri() == null ^ this.getRedactedTranscriptFileUri() == null)
return false;
if (other.getRedactedTranscriptFileUri() != null && other.getRedactedTranscriptFileUri().equals(this.getRedactedTranscriptFileUri()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTranscriptFileUri() == null) ? 0 : getTranscriptFileUri().hashCode());
hashCode = prime * hashCode + ((getRedactedTranscriptFileUri() == null) ? 0 : getRedactedTranscriptFileUri().hashCode());
return hashCode;
}
@Override
public Transcript clone() {
try {
return (Transcript) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.transcribe.model.transform.TranscriptMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
4c6010e91efed5e8e8bdafb057126f0716157561 | 9fed869617e20d51db1f18b76530c8113d79740f | /src/main/java/com/revature/services/EmployeeService.java | 9ef6e03b086ec47b77dbf5c355f8aad3d6423bca | [] | no_license | 210614-JavaFS/project0-btoledo2 | 4668f48552e4d288a5ff27782ffc25530a9abcb2 | 220dfeed5f3dcdcb3d855edc0a51810041a4b16f | refs/heads/master | 2023-06-16T13:32:37.305900 | 2021-07-14T05:34:21 | 2021-07-14T05:34:21 | 381,057,827 | 0 | 0 | null | 2021-07-14T05:30:47 | 2021-06-28T14:21:23 | Java | UTF-8 | Java | false | false | 1,138 | java | package com.revature.services;
import java.util.List;
import com.revature.models.Employee;
import com.revature.repos.EmployeeDAO;
import com.revature.repos.EmployeeImpl;
public class EmployeeService {
private static EmployeeDAO employeeDao = new EmployeeImpl();
public List<Employee> getAllEmployees(){
return employeeDao.findAll();
}
public Employee getEmployee(int id) {
return employeeDao.findEmployee(id);
}
public boolean showAccountBalance() {
return employeeDao.showAccountBalance();
}
public boolean showPersonalInfo() {
return employeeDao.showPersonalInfo();
}
public boolean customerAccountStatus() {
return employeeDao.showAccountInfo();
}
public boolean approveSaving(int id) {
return employeeDao.approveSavingAccount(id);
}
public boolean approveChecking(int id) {
return employeeDao.approveCheckingAccount(id);
}
public boolean denySaving(int id) {
return employeeDao.denySavingAccount(id);
}
public boolean denyChecking(int id) {
return employeeDao.denyCheckingAccount(id);
}
public boolean delete(int id){
return employeeDao.removeUSer(id);
}
}
| [
"[email protected]"
] | |
dba9ee1476a32bebd821b0c15003236eeab674cf | 43b978c8caaa77de9dd2afd134a790af84b51481 | /CSC 151/Lab 5 Assignments/StudentOrderingNumbers.java | eee81e97be3d0c3e0f20763edb4d263295d4f1eb | [] | no_license | cmhansen125/Java-Classes | 9b79e212e0d480bfe8fc9d61e4ec9d4a6ae92b7e | f651a1106c1557ab6f53935a563868c878b4b7eb | refs/heads/master | 2021-02-11T13:49:27.840178 | 2020-03-02T23:47:49 | 2020-03-02T23:47:49 | 244,496,966 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,820 | java | import javax.swing.*;
public class StudentOrderingNumbers {
public static void main(String[] args) {
WidgetView wv = new WidgetView();
// Finally, a program that does something. This program asks the user
// for 3 numbers and figures out the largest, middle and smallest.
// JLabels are similar to JTextFields, but JTextFields can be modified by
// the user. JLabels can't
JLabel jlInstructions = new JLabel("Enter 3 numbers and I'll order them");
JTextField num1 = new JTextField(5);
JTextField num2 = new JTextField(5);
JTextField num3 = new JTextField(5);
// add the initial widgets
wv.add(jlInstructions);
wv.add(num1);
wv.add(num2);
wv.add(num3);
JButton execute = new JButton("Push me after entering the numbers");
wv.addAndWait(execute);
// When addAndWait returns, the user has pushed the execute JButton.
// Hopefully the user has entered three valid numbers.
// read the (String) contents of the JTextFields, and convert them to int
int n1 = Integer.parseInt(num1.getText());
int n2 = Integer.parseInt(num2.getText());
int n3 = Integer.parseInt(num3.getText());
int hi = n1;
hi = Math.max(hi, n2);
hi = Math.max(hi, n3);
int lo = n1;
lo = Math.min(lo, n2);
lo = Math.min(lo, n3);
int mid = n1 + n2 + n3 - hi - lo;
JLabel hiLabel = new JLabel("highest " + hi);
JLabel midLabel = new JLabel("middle " + mid);
JLabel loLabel = new JLabel("lowest " + lo);
// update the gui with our results
wv.add(hiLabel);
wv.add(midLabel);
wv.add(loLabel);
}
}
| [
"[email protected]"
] | |
836db588d3ebbda95ec018e41034285b240c046e | e4d9c628519e51a49f822c06112604c0829ef5ae | /Backend/src/main/java/com/pokemon/pokemon/controller/interfaces/ITrainerController.java | f533346473506519765cc85d973916ef8c156c89 | [] | no_license | juliagarlor/PokeTeam | fdb9b8da52558903146b703ed49085ce954f0ab4 | 40059e7c9e290cb8d68a0b8a91a0d9f2774aad0e | refs/heads/master | 2023-05-12T06:45:52.519920 | 2021-06-06T16:46:17 | 2021-06-06T16:46:17 | 350,309,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package com.pokemon.pokemon.controller.interfaces;
import com.pokemon.pokemon.utils.dtos.*;
import org.springframework.web.bind.annotation.*;
import java.util.*;
public interface ITrainerController {
List<Object> getNamesAndIds();
List<TrainerDTO> getTrainers();
TrainerDTO createTrainer(TrainerDTO trainerDTO);
void removeTrainer(Long id);
}
| [
"[email protected]"
] | |
4e3ec35ea4fd4650cee60ee51e794822de363214 | 2905ab13085cf90fa3ff02eabb635ffb80421121 | /ivanhoe/src/edu/virginia/speclab/ivanhoe/shared/message/DeleteDocumentMsg.java | e7b6a485985c03f238ec0e43fcf2e6bd7d3b37ce | [] | no_license | waynegraham/ivanhoe | 8474eccd2eb05e30d16eef9ad4425e71fca65b12 | dfe05439f7e75298a4b38313d5fe904998dbda42 | refs/heads/master | 2020-05-31T00:45:22.000842 | 2010-03-23T15:28:59 | 2010-03-23T15:28:59 | 32,215,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | /*
* Created on Mar 22, 2004
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package edu.virginia.speclab.ivanhoe.shared.message;
import edu.virginia.speclab.ivanhoe.shared.data.DocumentInfo;
/**
* @author lfoster
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class DeleteDocumentMsg extends Message
{
private DocumentInfo docInfo;
public DeleteDocumentMsg(DocumentInfo delDocInfo)
{
super(MessageType.DELETE_DOCUMENT);
this.docInfo = delDocInfo;
}
public DocumentInfo getInfo()
{
return this.docInfo;
}
}
| [
"nicklaiacona@c161d011-2726-0410-8d5a-8f576c7000fa"
] | nicklaiacona@c161d011-2726-0410-8d5a-8f576c7000fa |
a0d8e0d3706162aad9ec319bc4516970aa55d674 | a3742532e43ebf8ae09c2036dc817759fad5a6b4 | /src/main/java/tests/maptests/primitive/HftcUpdateableMapTest.java | 3b0071ddc6a9921141239bc8d726696b85e231a5 | [] | no_license | zhudebin/maptest | 2b98a50cdd21481b235f66a3d44294ea87efb2ea | 5588e9c4e398cd1ae56cc326842bfd2b0e4e2b34 | refs/heads/master | 2021-01-17T05:50:47.743692 | 2016-06-03T06:36:48 | 2016-06-03T06:36:48 | 60,315,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | package tests.maptests.primitive;
import net.openhft.koloboke.collect.map.hash.HashIntIntMap;
import net.openhft.koloboke.collect.map.hash.HashIntIntMaps;
/**
* Koloboke HashIntIntMaps.newImmutableMap test
*/
public class HftcUpdateableMapTest extends AbstractPrimPrimMapTest {
private HashIntIntMap m_map;
@Override
public void setup(final int[] keys, float fillFactor) {
super.setup( keys, fillFactor );
final HashIntIntMap map = HashIntIntMaps.newMutableMap(keys.length);
for (int key : keys) map.put(key, key);
m_map = HashIntIntMaps.newUpdatableMap( map );
}
@Override
public int runRandomTest() {
int res = 0;
for ( int i = 0; i < m_keys.length; ++i )
res = res ^ m_map.get( m_keys[ i ] );
return res;
}
}
| [
"[email protected]"
] | |
efac8b145513f277244c81c6cd8c5a56a017fc9c | eac648c76b9e7d9fcb6f8fb7d6717374c9914047 | /Core/src/CoreClass.java | a28714d9d2d7eec210c922a7625596a979f93881 | [] | no_license | KagamiMi/TPDiA2 | fbddf3149e551a86814def9c3f9032cd178e611a | 5ec5f681eb2eb1a092c4d93a0c313fd972d040c8 | refs/heads/master | 2020-03-21T21:34:05.819912 | 2018-07-22T18:00:44 | 2018-07-22T18:00:44 | 139,070,672 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 2,292 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Date;
public class CoreClass {
static int portNumber = 7;
public static void main(String args[]) throws ClassNotFoundException {
try
{
ServerSocket ss = new ServerSocket(portNumber,10);
System.out.println("created socket server ");
while (true) {
Socket cs = ss.accept();
System.out.println("Connected to new client");
ObjectInputStream is = new ObjectInputStream(cs.getInputStream());
new SocketHandler(is).start();
System.out.println("New thread running!");
}
// za pomocą JPQL
// mamy interwał czasowy t
// tank measures zawiera "prawidłowe wartości"
// obliczamy wartość końcową po interwale i porównujemy z wartością końcową z tank measures
// dla każdego z tanków osobno!
//
// dla danego tanka w danej chwili czasu startowej, to samo będzie dla końcowego tylko z inną datą
// double startFuelVolume = em.createQuery("SELECT t.fuelVolume from TankMeasures t WHERE t.tankId=:tankId AND t.date=:date").setParameter("tankId",tankId).setParameter("date",date).getSingleResult();
//
// musimy uzwględnić sprzedaż (sales) w tym okresie czasu.
// status - 1 odłożony, 0 podniesiony
// literCounter - bieżący licznik transkacji (status 0)
// totalCounter - końcowy licznik transakcji (status 1)
// podczas 0 musimy zwracać uwagę na poprzedni stan aby odjąć dobrą wartość: literCounter - poprzedni_literCounter z pomiaru (może być ze statusu 1 gdy to pierwszy raz w serii),
// podczas 1 jesli mamy totalCounter to odejmujemy ostatni literCounter ze statusem 0
// dopiero tą wartość możemy odjąć od wartości startowej
//
// przy dostawach paliwa podobny problem - po pierwsze w jakiej jednostce jest szybkośc tankowania?!
// musimy sami na podstawie szybkości obliczyć czy paliwo zostało już wpompowane i ile i czy jest jeszcze co pompować
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
ce2e677fb9df5c0ff521b3c9752780f7b3968e46 | 4946183930dd93dfa6d25f8d561b43aab823545c | /test/src/Singleton.java | ea5d1657e9cbc322b801758092b7211cb47a52d2 | [] | no_license | chen-t7/code | f82d02b5ee2b5fbf7d691fd329ed5569bb0cb642 | ce9a9ac2c5da170e8f33997814958b3f1706886d | refs/heads/master | 2022-12-26T21:57:34.316622 | 2020-09-07T09:05:49 | 2020-09-07T09:05:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | //class Singleton {
// private static Singleton instance=new Singleton();
// private Singleton(){}
// public static Singleton getInstance(){
// return instance;
// }
//}
class Singleton{
private static volatile Singleton instance=null;
private Singleton(){}
public static Singleton getInstance(){
if(instance==null){
synchronized (Singleton.class){
if(instance==null){
instance=new Singleton();
}
}
}
return instance;
}
} | [
"[email protected]"
] | |
dc12ae9c10472fefe2270298b1646d8b90a2221d | d2045b375576f99415c1ee3298dec7d1330711aa | /meuprograma.java | 612dd5e41015f417e90c9eaa1464751c00e098a9 | [] | no_license | Alexandresteves/Java-projects | 75f5e0754db202c1ebb4a890319e703d0aab5511 | 76158ae39acf4c2605595b167419abb5d803bee1 | refs/heads/master | 2021-04-15T16:33:10.144950 | 2018-03-25T23:22:13 | 2018-03-25T23:22:13 | 126,748,597 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 115 | java | public class Meuprograma {
public static void main(String[] args) {
System.out.println("Aplicação Java");
}
} | [
"[email protected]"
] | |
eda5eb3b022aaca023a5c27f40149b54efed37b3 | 866e04d6eccb39f21f83e8e7399b128931090b91 | /lunch/src/main/java/com/example/recipe/lunch/LunchRecipeApplication.java | 43e6028e1768f42d6b03e630e02800696b0d8b68 | [] | no_license | chathuran/lunch-app | 1fa169cd5cced7c2f847086026de79c161979587 | b33dec876a91cd1af84c60a326ea34c553153428 | refs/heads/master | 2022-12-19T12:26:12.147965 | 2020-09-28T15:17:43 | 2020-09-28T15:17:43 | 298,964,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.example.recipe.lunch;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class LunchRecipeApplication {
public static void main(String[] args) {
SpringApplication.run(LunchRecipeApplication.class, args);
}
}
| [
"071@erangaDC"
] | 071@erangaDC |
1eb15406f7d64a2c6e802d1ba5db455e21488087 | 9452e1992b36fac0414de9856cefa67f95e984de | /sacamos-server/src/main/java/main.java | 997199a0eb926073cc52daf40233e3ce71a64e0d | [] | no_license | randyquaye/randyquaye | 81a899c0735b82f63b3d9f91694116f8fa2dfd85 | 258be6d776d5bc3a1d76028daecd2b4cd59b0a1b | refs/heads/main | 2023-05-18T11:33:15.485728 | 2021-06-09T22:05:07 | 2021-06-09T22:05:07 | 352,344,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,198 | java | import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Bucket;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.cloud.StorageClient;
import com.google.firebase.database.*;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.apache.http.protocol.HTTP.UTF_8;
public class main {
public static void main(String[] args) {
try {
FileInputStream serviceAccount;
serviceAccount = new FileInputStream("C:\\Users\\Randy Quaye\\IdeaProjects\\sacamos-server\\src\\serviceAccountKey.json");
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
.setDatabaseUrl("https://finalyear-7d906.firebaseio.com")
.setStorageBucket("finalyear-7d906.appspot.com")
.build();
FirebaseApp.initializeApp(options);
} catch (IOException ex) {
Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
System.exit(1);
}
// As an admin, the app has access to read and write all data, regardless of Security Rules
DatabaseReference database = FirebaseDatabase.getInstance().getReference();
//Start Listeners
cableListener(database);
bundleListener(database);
Scanner scanner = new Scanner(System.in);
while (!scanner.nextLine().equals("Quit")) {}
}
/**************CABLE PROCESSING*******************/
public static void cableListener(DatabaseReference database){
DatabaseReference cablesRef = database.child("Cyl_cables");
// Attach a listener to read and process the data at our cables reference
cablesRef.orderByChild("status").equalTo(1).addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot snapshot, String previousChildName) {
CylindricalCable c = snapshot.child("cable_spec").getValue(CylindricalCable.class);
System.out.println(c.getName());
c.setID(snapshot.getKey());
writeCableSpecFile(c);
cablesRef.child(c.getID()).child("status").setValueAsync(buildCable(c.getID()));
}
@Override
public void onChildChanged(DataSnapshot snapshot, String previousChildName) {
}
@Override
public void onChildRemoved(DataSnapshot snapshot) {
}
@Override
public void onChildMoved(DataSnapshot snapshot, String previousChildName) {
}
@Override
public void onCancelled(DatabaseError error) {
}
});
}
public static void writeCableSpecFile(CylindricalCable c) {
//TODO : Sort out the params and remove default zeros from Ao and Bo
String spec_data = "# MOD_cable_lib_dir \r\n" +
"../MOD/CABLE/\r\n" +
"Cylindrical\r\n" +
"1 #number of conductors \r\n" +
"3 #number of parameters \r\n" +
String.valueOf(c.getC_Radius()) + " # parameter 1: conductor radius\r\n" +
String.valueOf(c.getD_Radius()) + " # parameter 2: dielectric radius\r\n" +
String.valueOf(c.getC_conductivity()) + " # parameter 3: conductivity\r\n" +
"1 \t\t\t# number of frequency dependent parameters\r\n" +
"# Dielectric relative permittivity model follows\r\n" +
String.valueOf(c.getNormalisation()) + " # w normalisation constant\r\n" +
0 + " # a order, a coefficients follow below\r\n" +
String.valueOf(c.getAc()) + "\r\n" +
0 + " # b order, b coefficients follow below\r\n" +
String.valueOf(c.getBc());
//Create file;
String file_path = "C:/Users/Randy Quaye/Documents/SACAMOS/MOD/CABLE/";
String file = file_path + c.getID() + ".cable_spec";
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(spec_data);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static int buildCable(String filename) {
String filepath = "\""+"C:\\Users\\Randy Quaye\\Documents\\SACAMOS\\MOD\\CABLE\\"+ filename + "\"";
String cmd1 = "cd C:/Users/Randy Quaye/Documents/SACAMOS/BIN";
String cmd2 = "cable_model_builder.exe "+filepath;
ProcessBuilder builder = new ProcessBuilder(
"cmd.exe", "/c", cmd1 + "&& "+cmd2);
builder.redirectErrorStream(true);
Process p = null;
try {
p = builder.start();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line,strLine="";
while ((line = r.readLine()) != null) strLine = line;
if(strLine.equals("cable_model_builder:Finished_Correctly")){
//Write cable status to 4
return 4;
}
else{ return -1;}
} catch (IOException e) {
e.printStackTrace();
return -1;
}
}
/**************BUNDLE PROCESSING*******************/
public static void bundleListener(DatabaseReference database){
DatabaseReference bundleRef = database.child("Bundles");
bundleRef.orderByChild("status").equalTo(1).addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot snapshot, String previousChildName) {
Bundle b = snapshot.child("bundle_spec").getValue(Bundle.class);
System.out.println(b.getBundleName());
b.setBundleID(snapshot.getKey());
writeBundleSpecFile(b);
bundleRef.child(b.getBundleID()).child("status").setValueAsync(buildBundle(b.getBundleID()));
}
@Override
public void onChildChanged(DataSnapshot snapshot, String previousChildName) {
}
@Override
public void onChildRemoved(DataSnapshot snapshot) {
}
@Override
public void onChildMoved(DataSnapshot snapshot, String previousChildName) {
}
@Override
public void onCancelled(DatabaseError error) {
}
});
}
public static void writeBundleSpecFile(Bundle b){
String data = "#MOD_cable_lib_dir\r\n" +
"../MOD/CABLE/\r\n" +
"#MOD_cable_lib_dir\r\n" +
"../MOD/BUNDLE/\r\n" +
b.getNumber_of_params() +" #Number of cables in bundle, cable list follows\r\n";
ArrayList<BundleComponent> bC = b.getComponents();
for(int i = 0;i<b.getNumber_of_params();i++){
data = data + bC.get(i).getCableID()+"\r\n" +
bC.get(i).getX_param()+"\t"+
bC.get(i).getY_param()+"\t"+
bC.get(i).getRot_param()+"\r\n";
}
data = data +"no_ground_plane\r\n"+
"no_laplace";
//Create file;
String file_path = "C:/Users/Randy Quaye/Documents/SACAMOS/MOD/BUNDLE/";
String file = file_path + b.getBundleID() + ".bundle_spec";
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(data);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static int buildBundle(String filename) {
String filepath = "\""+"C:\\Users\\Randy Quaye\\Documents\\SACAMOS\\MOD\\BUNDLE\\"+ filename + "\"";
String cmd1 = "cd C:/Users/Randy Quaye/Documents/SACAMOS/BIN";
String cmd2 = "cable_bundle_model_builder.exe "+filepath;
ProcessBuilder builder = new ProcessBuilder(
"cmd.exe", "/c", cmd1 + "&& "+cmd2);
builder.redirectErrorStream(true);
Process p = null;
try {
p = builder.start();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line,strLine="";
while ((line = r.readLine()) != null) strLine = line;
if(strLine.equals("cable_bundle_model_builder:Finished_Correctly")){
//Write cable status to 4
return 4;
}
else{ return -1;}
} catch (IOException e) {
e.printStackTrace();
return -1;
}
}
}
| [
"[email protected]"
] | |
975f723bdbe59b219bad977a917e465fe6333281 | 7216e4d3e4522b9fe0148fc4c1560e4e79286357 | /idp-authn-impl-socialuser/src/test/java/fi/okm/mpass/idp/authn/impl/ExtractSocialPrincipalsFromSubjectTest.java | 0f850c4bab07ff2420a756ab4303f2986b3591d7 | [
"MIT"
] | permissive | haltu/eca-auth-proxy | a374c1ec530e36b924a46278959e4313ee65f3c3 | 31cdcd36b419d5067fe265399b2680e38bdb527a | refs/heads/master | 2021-01-17T05:20:06.028510 | 2015-12-14T14:57:36 | 2015-12-14T14:57:36 | 48,229,777 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,426 | java | /*
* The MIT License
* Copyright (c) 2015 CSC - IT Center for Science, http://www.csc.fi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package fi.okm.mpass.idp.authn.impl;
import org.testng.Assert;
import net.shibboleth.idp.authn.AuthnEventIds;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.ExternalAuthenticationContext;
import net.shibboleth.idp.authn.impl.PopulateAuthenticationContextTest;
import javax.security.auth.Subject;
import org.springframework.webflow.execution.Event;
import net.shibboleth.idp.profile.ActionTestingSupport;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import org.springframework.mock.web.MockHttpServletRequest;
import fi.okm.mpass.idp.authn.context.SocialUserContext;
import fi.okm.mpass.idp.authn.principal.SocialUserPrincipal;
import fi.okm.mpass.idp.authn.principal.SocialUserPrincipal.Types;
/** {@link ExtractSocialPrincipalsFromSubject} unit test. */
public class ExtractSocialPrincipalsFromSubjectTest extends
PopulateAuthenticationContextTest {
private ExtractSocialPrincipalsFromSubject action;
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
action = new ExtractSocialPrincipalsFromSubject();
}
@Test
public void testNoServlet() throws Exception {
action.initialize();
final Event event = action.execute(src);
ActionTestingSupport.assertEvent(event, AuthnEventIds.NO_CREDENTIALS);
}
@Test
public void testIdentity() throws Exception {
Subject subject = new Subject();
SocialUserPrincipal socialUserPrincipalProviderId = new SocialUserPrincipal(
Types.providerId, "providerId");
subject.getPrincipals().add(socialUserPrincipalProviderId);
SocialUserPrincipal socialUserPrincipalDisplayName = new SocialUserPrincipal(
Types.displayName, "displayName");
subject.getPrincipals().add(socialUserPrincipalDisplayName);
SocialUserPrincipal socialUserPrincipalEmail = new SocialUserPrincipal(
Types.email, "email");
subject.getPrincipals().add(socialUserPrincipalEmail);
SocialUserPrincipal socialUserPrincipalFirstName = new SocialUserPrincipal(
Types.firstName, "firstName");
subject.getPrincipals().add(socialUserPrincipalFirstName);
SocialUserPrincipal socialUserPrincipalLastName = new SocialUserPrincipal(
Types.lastName, "lastName");
subject.getPrincipals().add(socialUserPrincipalLastName);
SocialUserPrincipal socialUserPrincipalUserId = new SocialUserPrincipal(
Types.userId, "userId");
subject.getPrincipals().add(socialUserPrincipalUserId);
SocialUserPrincipal socialUserPrincipalUS = new SocialUserPrincipal(
"unsupported", "unsupported");
subject.getPrincipals().add(socialUserPrincipalUS);
SocialUserContext suCtx = initContexts(subject);
Assert.assertNotNull(suCtx);
Assert.assertEquals(suCtx.getProviderId(), "providerId");
Assert.assertEquals(suCtx.getDisplayName(), "displayName");
Assert.assertEquals(suCtx.getEmail(), "email");
Assert.assertEquals(suCtx.getFirstName(), "firstName");
Assert.assertEquals(suCtx.getLastName(), "lastName");
Assert.assertEquals(suCtx.getUserId(), "userId");
}
private SocialUserContext initContexts(Subject subject)
throws ComponentInitializationException {
MockHttpServletRequest mockHttpServletRequest = new MockHttpServletRequest();
action.setHttpServletRequest(mockHttpServletRequest);
action.initialize();
final AuthenticationContext ac = prc.getSubcontext(
AuthenticationContext.class, false);
ExternalAuthenticationContext externalAuthenticationContext = new ExternalAuthenticationContext();
externalAuthenticationContext.setSubject(subject);
ac.addSubcontext(externalAuthenticationContext);
final Event event = action.execute(src);
ActionTestingSupport.assertProceedEvent(event);
return (SocialUserContext) ac.getSubcontext(SocialUserContext.class,
false);
}
}
| [
"[email protected]"
] | |
2ea3c39a66aca59c33ab7b72916de543d8092451 | 5bab3f49607b66c77457a49c9d395628d4f45ca3 | /jibx/examples/codegen/gen/src/org/opentravel/ota/CancelInfoRSType.java | 8ccd16a16351397f0369d53d58324d47dc80d576 | [] | no_license | zwijze/journallines | 8ee37a559b1c1fe2070fa14b56e3957396a83a5e | 973ab3228740b7e810af5f746da7abf556abaaaa | refs/heads/master | 2020-04-06T07:53:20.251060 | 2016-08-29T19:38:29 | 2016-08-29T19:38:29 | 65,633,068 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,643 | java |
package org.opentravel.ota;
import java.util.ArrayList;
import java.util.List;
/**
* May contain rules associated with canceling a reservation as well as the supplier's cancellation number.
*
* Schema fragment(s) for this class:
* <pre>
* <xs:complexType xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="CancelInfoRSType">
* <xs:sequence>
* <xs:element name="CancelRules" minOccurs="0">
* <!-- Reference to inner class CancelRules -->
* </xs:element>
* <xs:element type="ns:UniqueID_Type" name="UniqueID" minOccurs="0"/>
* </xs:sequence>
* </xs:complexType>
* </pre>
*/
public class CancelInfoRSType
{
private CancelRules cancelRules;
private UniqueIDType uniqueID;
/**
* Get the 'CancelRules' element value.
*
* @return value
*/
public CancelRules getCancelRules() {
return cancelRules;
}
/**
* Set the 'CancelRules' element value.
*
* @param cancelRules
*/
public void setCancelRules(CancelRules cancelRules) {
this.cancelRules = cancelRules;
}
/**
* Get the 'UniqueID' element value. Contains the supplier's cancellation number.
*
* @return value
*/
public UniqueIDType getUniqueID() {
return uniqueID;
}
/**
* Set the 'UniqueID' element value. Contains the supplier's cancellation number.
*
* @param uniqueID
*/
public void setUniqueID(UniqueIDType uniqueID) {
this.uniqueID = uniqueID;
}
/**
* Schema fragment(s) for this class:
* <pre>
* <xs:element xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="CancelRules" minOccurs="0">
* <xs:complexType>
* <xs:sequence>
* <xs:element type="ns:CancelRuleType" name="CancelRule" maxOccurs="unbounded"/>
* </xs:sequence>
* </xs:complexType>
* </xs:element>
* </pre>
*/
public static class CancelRules
{
private List<CancelRuleType> cancelRuleList = new ArrayList<CancelRuleType>();
/**
* Get the list of 'CancelRule' element items.
*
* @return list
*/
public List<CancelRuleType> getCancelRuleList() {
return cancelRuleList;
}
/**
* Set the list of 'CancelRule' element items.
*
* @param list
*/
public void setCancelRuleList(List<CancelRuleType> list) {
cancelRuleList = list;
}
}
}
| [
"[email protected]"
] | |
2865885b1cd6d8c68877f0c21ae74c7bd5205d3e | 2ddbe278a618adf859430ee875888aaec971d73b | /factory/src/FactoeyMethod/Apple.java | 2f9ae75c6925f73b54feabdf674c466be6f0f585 | [] | no_license | tanzikun/IdeaProjects | 6733695e46bf80c692069a1b02853d981c4ae65b | 8ff788b242e565d3cff0ae97515e64cb3478a7db | refs/heads/master | 2022-12-02T06:20:50.124198 | 2019-08-06T14:39:54 | 2019-08-06T14:39:54 | 200,869,608 | 0 | 0 | null | 2022-11-16T12:22:43 | 2019-08-06T14:38:20 | Java | UTF-8 | Java | false | false | 167 | java | package FactoeyMethod;
public class Apple implements Fruit {
/**
* 采集
*/
public void get(){
System.out.println("采集苹果");
}
}
| [
"[email protected]"
] | |
61dbc5f1c4683ed6ad2faae8438527ca56253fa8 | 3ee9187e459512f33ff1c4231e9edfb321380d08 | /src/main/java/org/spongepowered/common/event/tracking/context/transaction/effect/RemoveTileEntityFromChunkEffect.java | cc118789df8e64b3807ea415793000e80c329b5a | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | SpongePowered/Sponge | 37ef5f6c77cdbbdb007d6e68f4c5a1be0e56441e | 5d39e239d8de5e746efdb82725854ee1f57a34a5 | refs/heads/api-10 | 2023-08-17T05:53:40.685621 | 2023-06-17T21:01:13 | 2023-06-17T21:01:13 | 33,791,453 | 171 | 97 | MIT | 2023-09-12T11:49:33 | 2015-04-11T20:38:48 | Java | UTF-8 | Java | false | false | 2,578 | java | /*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.event.tracking.context.transaction.effect;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.common.event.tracking.context.transaction.pipeline.BlockPipeline;
import org.spongepowered.common.event.tracking.context.transaction.pipeline.PipelineCursor;
import org.spongepowered.common.world.SpongeBlockChangeFlag;
public final class RemoveTileEntityFromChunkEffect implements ProcessingSideEffect {
private static final class Holder {
static final RemoveTileEntityFromChunkEffect INSTANCE = new RemoveTileEntityFromChunkEffect();
}
public static RemoveTileEntityFromChunkEffect getInstance() {
return RemoveTileEntityFromChunkEffect.Holder.INSTANCE;
}
RemoveTileEntityFromChunkEffect() {}
@Override
public EffectResult processSideEffect(final BlockPipeline pipeline, final PipelineCursor oldState, final BlockState newState,
final SpongeBlockChangeFlag flag, final int limit
) {
final BlockEntity tileEntity = oldState.tileEntity;
if (tileEntity == null) {
return EffectResult.NULL_RETURN;
}
pipeline.getAffectedChunk().removeBlockEntity(oldState.pos);
return EffectResult.NULL_RETURN;
}
}
| [
"[email protected]"
] | |
79f84cd14810ca1173599262e6307d953331daf5 | 9f3ef32725b29ce770af806f0c8312af0fa51b27 | /src/main/java/com/gy/yb/Observer.java | bb5b1d9aaa8b82079be1f17d35660496108e5977 | [] | no_license | SeekingPlumBlossoms/observer | 8457a86d2b0f2ba776c9f55db4226783fb0032d1 | b5827cb49e575cc65489a8860029367f058d040c | refs/heads/master | 2020-03-25T04:33:00.845147 | 2018-08-04T01:20:33 | 2018-08-04T01:20:33 | 143,400,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | package com.gy.yb;
public interface Observer {
public void update(WeatherSubject weatherSubject);
}
| [
"[email protected]"
] | |
d0031958994f0c808cab10fe5e27530a91d5de76 | 61dea18460df6f2bc1fe19af8bfa6e0809406885 | /ecmoban/src/main/java/com/ecjia/view/adapter/DataBindingAdapter.java | 1e1eaff9d779f3bfec13591f934059bac174fd52 | [] | no_license | hackerlc/SJQ_ECSHOP_MJ_NEW | a006261856124671bceaf92d1f65d4905dc35078 | 2c8ac3f2464c4536c079ac067ec761adcd9c267e | refs/heads/master | 2021-08-31T11:01:29.247522 | 2017-12-21T03:55:09 | 2017-12-21T03:55:09 | 114,960,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package com.ecjia.view.adapter;
import android.databinding.BindingAdapter;
import android.widget.ImageView;
import com.ecjia.util.ImageLoaderForLV;
/**
* SJQ_ECSHOP_MJ_NEW
* Created by YichenZ on 2017/2/22 13:32.
*/
public class DataBindingAdapter {
@BindingAdapter("android:src")
public static void setImageUrl(ImageView view, String url){
ImageLoaderForLV.getInstance(view.getContext()).setImageRes(view, url);
}
}
| [
"[email protected]"
] | |
35698160e29652501fef334dbd7f4b08f1be6295 | 7c7c660e45be16b60f74d5cc5daa3f7c71fe45d4 | /ecolls-j/src/main/java/xyz/cofe/collection/UnionMap.java | de0b4865ef02c6f6acbfd00a85a86efc46fc74e3 | [
"MIT"
] | permissive | gochaorg/cofe.xyz-next | 9f160e6726d5af9d6efd5eda8b86b381c9d62824 | 02cb327222d113fd53e773bd61c3a0aeef24b9b2 | refs/heads/master | 2022-11-27T05:52:42.549697 | 2022-10-15T22:13:51 | 2022-10-15T22:13:51 | 200,032,063 | 0 | 0 | MIT | 2022-11-15T23:42:12 | 2019-08-01T10:45:09 | Java | UTF-8 | Java | false | false | 9,113 | java | /*
* The MIT License
*
* Copyright 2014 Kamnev Georgiy ([email protected]).
*
* Данная лицензия разрешает, безвозмездно, лицам, получившим копию данного программного
* обеспечения и сопутствующей документации (в дальнейшем именуемыми "Программное Обеспечение"),
* использовать Программное Обеспечение без ограничений, включая неограниченное право на
* использование, копирование, изменение, объединение, публикацию, распространение, сублицензирование
* и/или продажу копий Программного Обеспечения, также как и лицам, которым предоставляется
* данное Программное Обеспечение, при соблюдении следующих условий:
*
* Вышеупомянутый копирайт и данные условия должны быть включены во все копии
* или значимые части данного Программного Обеспечения.
*
* ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ ЛЮБОГО ВИДА ГАРАНТИЙ,
* ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ,
* СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И НЕНАРУШЕНИЯ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ
* ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ
* ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ
* ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ
* ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ.
*/
package xyz.cofe.collection;
import xyz.cofe.iter.ArrayIterable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Карта для записи в несколько других карт и чтение из указанной
* @author gocha
*/
public class UnionMap<K,V> implements Map<K, V>{
//<editor-fold defaultstate="collapsed" desc="log Функции">
private static void logFine(String message,Object ... args){
Logger.getLogger(UnionMap.class.getName()).log(Level.FINE, message, args);
}
private static void logFiner(String message,Object ... args){
Logger.getLogger(UnionMap.class.getName()).log(Level.FINER, message, args);
}
private static void logInfo(String message,Object ... args){
Logger.getLogger(UnionMap.class.getName()).log(Level.INFO, message, args);
}
private static void logWarning(String message,Object ... args){
Logger.getLogger(UnionMap.class.getName()).log(Level.WARNING, message, args);
}
private static void logSevere(String message,Object ... args){
Logger.getLogger(UnionMap.class.getName()).log(Level.SEVERE, message, args);
}
private static void logException(Throwable ex){
Logger.getLogger(UnionMap.class.getName()).log(Level.SEVERE, null, ex);
}
//</editor-fold>
protected Map<K,V> readMap = null;
protected Iterable<Map> writeMaps = null;
/**
* Возвращает карту из которой произодит чтение
* @return карта для чтения
*/
public Map<K, V> getReadMap() {
return readMap;
}
/**
* Указывает карту из которой произодит чтение
* @param readMap карта для чтения
*/
public void setReadMap(Map<K, V> readMap) {
this.readMap = readMap;
}
/**
* Возвращает карты в которые производит запись
* @return карты для записи
*/
public Iterable<Map> getWriteMaps() {
return writeMaps;
}
/**
* Указывет карты в которые производит запись
* @param writeMaps карты для записи
*/
public void setWriteMaps(Iterable<Map> writeMaps) {
this.writeMaps = writeMaps;
}
/**
* Указывет карты в которые производит запись
* @param maps карты для записи
*/
public void setWriteMaps(Map ... maps){
this.writeMaps = new ArrayIterable<>(maps);
}
/**
* Возвращает размер карты
* @return размер карты
*/
@Override
public int size() {
if( readMap==null )return 0;
return readMap.size();
}
/**
* Проверяет что карта пустая
* @return true - нет элементов
*/
@Override
public boolean isEmpty() {
if( readMap==null )return true;
return readMap.isEmpty();
}
/**
* Проверяет наличие ключа в карте
* @param key ключ
* @return true - есть в карте
*/
@Override
public boolean containsKey(Object key) {
if( readMap==null )return false;
return readMap.containsKey(key);
}
/**
* ПРоверяет наличие значения в карте
* @param value значение
* @return true - есть значение
*/
@Override
public boolean containsValue(Object value) {
if( readMap==null )return false;
return readMap.containsValue(value);
}
/**
* Возвращает значение по ключу
* @param key ключ
* @return значение
*/
@Override
public V get(Object key) {
if( readMap==null )return null;
return readMap.get(key);
}
/**
* Устанавливает ключ/значение
* @param key ключ
* @param value значние
* @return предыдущее (последнее) значение
*/
@Override
public V put(K key, V value) {
V r = null;
if( writeMaps!=null ){
for( Map<K,V> m : writeMaps ){
if( m!=null ){
r = m.put(key, value);
}
}
}
return r;
}
/**
* Удаляет ключ/значение
* @param key ключ
* @return предыдущее значение
*/
@Override
public V remove(Object key) {
V r = null;
if( writeMaps!=null ){
for( Map<K,V> m : writeMaps ){
if( m!=null ){
r = m.remove(key);
}
}
}
return r;
}
/**
* Добавляет значения
* @param ms значения
*/
@Override
public void putAll(Map<? extends K, ? extends V> ms) {
if( writeMaps!=null ){
for( Map<K,V> m : writeMaps ){
if( m!=null ){
m.putAll(ms);
}
}
}
}
/**
* Удялет все значения
*/
@Override
public void clear() {
if( writeMaps!=null ){
for( Map<K,V> m : writeMaps ){
if( m!=null ){
m.clear();
}
}
}
}
/**
* Возвращает все ключи карты
* @return ключи
*/
@Override
public Set<K> keySet() {
if( readMap==null )return new HashSet<K>();
return readMap.keySet();
}
/**
* Возвращает значения карты
* @return значения
*/
@Override
public Collection<V> values() {
if( readMap==null )return new HashSet<V>();
return readMap.values();
}
/**
* Возвращает пары ключ/значние
* @return пары ключ/значние
*/
@Override
public Set<Entry<K, V>> entrySet() {
if( readMap==null )return new HashSet<Entry<K, V>>();
return readMap.entrySet();
}
}
| [
"[email protected]"
] | |
70d81e89195ec6ad5edcfc1e919f18146de18f59 | 7dff6c11ca1d7b5fadf3eaff1ae865805ef5a14d | /Flyweight/app/src/main/java/demo/dhcc/com/flyweight/simple2/ConcreteFlyweight.java | 7d35f10892420a229d41f8355e786adc4ba444c3 | [] | no_license | heyangJob/Design-Pattern | 85a1fc0ff7058db875ceaf065e1b803ed6227a1c | a7849247139a2a00103333d56de76783ab1fabbb | refs/heads/master | 2020-03-23T12:01:08.143480 | 2018-08-22T09:21:50 | 2018-08-22T09:21:50 | 141,531,909 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | package demo.dhcc.com.flyweight.simple2;
/**
* 享元角色的实现类
*
* @author [email protected]
* @created 2018/8/6 下午3:50.
*/
public class ConcreteFlyweight implements Flyweight {
private String intrinsicState = null;
public ConcreteFlyweight(String intrinsicState) {
this.intrinsicState = intrinsicState;
}
@Override
public void operation(String state) {
// 内部状态
System.out.println("Intrinsic State = " + this.intrinsicState);
// 外部状态
System.out.println("Extrinsic State = " + state);
}
}
| [
"[email protected]"
] | |
f13a8531f399af51f015e1496a7a39ecb716d637 | 66b167fac9fe9648efc460640d4b0c9e27ebc017 | /src/BusinessLayer/Tiles/Player/Ability/MageAbility.java | be1bb971dea3b34f1b0dad8fac6995e445a4cbc5 | [] | no_license | hk772/OOP3_Dungeons_and_Dragons | ea7d2388686332838dc469d4027441952bb8300e | 7138cb512cd081b052a4074879ada4a8eacf558e | refs/heads/master | 2023-08-09T07:07:49.486129 | 2021-08-10T12:11:08 | 2021-08-10T12:11:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 543 | java | package BusinessLayer.Tiles.Player.Ability;
public class MageAbility extends AbilityIMP {
private int cost;
public MageAbility(String name, String poolName, int pool, int cost) {
super(name, poolName, pool);
this.cost = cost;
}
@Override
public boolean isAvailable() {
return amount >= cost;
}
@Override
public void onTick() {
throw new IllegalArgumentException("cant use");
}
@Override
public void use() {
super.use();
amount -= cost;
}
}
| [
"[email protected]"
] | |
deab7b06caaf45c6d77b57dd3a9bf69559496e60 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_crypto_CipherInputStream_notify.java | f351c064b66ea6d98fb7d9ba27422a795b116f6a | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | class javax_crypto_CipherInputStream_notify{ public static void function() {javax.crypto.CipherInputStream obj = new javax.crypto.CipherInputStream();obj.notify();}} | [
"[email protected]"
] | |
5facd01330232c9652f77e30664e02204ea84c95 | 65572044f62b9d8d08c8d19fca13b9b728d23862 | /coisini-ms/coisini-admin-server/src/main/java/com/coisini/admin/entity/SysRole.java | 1c3a77808267cfb1850df1efcdbf515d89a3373d | [] | no_license | Maggieq8324/coisini-cloud | 76a75fb93f3889f536d3fa12cc39166025b37429 | 1fbf59597428d4acda740883fd3366704b516235 | refs/heads/main | 2023-06-20T16:05:48.856207 | 2021-07-23T07:05:14 | 2021-07-23T07:05:14 | 388,693,926 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package com.coisini.admin.entity;
public class SysRole extends BaseModel {
private String name;
private String remark;
private Byte delFlag;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Byte getDelFlag() {
return delFlag;
}
public void setDelFlag(Byte delFlag) {
this.delFlag = delFlag;
}
} | [
"[email protected]"
] | |
49054fc1e6444977c225869fc526fade88a74044 | 02ec61624a19f1582e2ca1b4fb9d25e2b19e843f | /android/app/src/main/java/com/tevinjeffrey/njitct/utils/AndroidMainThread.java | 07efabe4de10a8a0a75e0e4a7ec6c220d6e7c288 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | tevjef/NJIT-Course-Tracker | 0c45a5b95f2d06e2b6ab92844c84784774b3b639 | 549e299ac10bb6fd504bfd2554c2506a12c57d3c | refs/heads/master | 2021-01-10T03:00:14.363189 | 2016-02-03T08:57:33 | 2016-02-03T08:57:33 | 50,632,308 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package com.tevinjeffrey.njitct.utils;
import java.lang.annotation.Retention;
import javax.inject.Qualifier;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Qualifier
@Retention(RUNTIME)
public @interface AndroidMainThread {
}
| [
"[email protected]"
] | |
e80c276c25c136fde3c3880191ef7b5b1f8eee0a | f538a4f3bcf7a2c9c93c155141777065157947c8 | /spliffy-server/src/main/java/org/spliffy/server/web/sharing/SharesFolder.java | 57e33554d00f1516b5e6ba4911325e6f1eeb69a1 | [] | no_license | nabilshams/spliffy | d638ce63f1610d455087dcbe0e5f22e9a08c3192 | 3ad26f0f9e9c9fe68d30303a2f8c818c00a97af3 | refs/heads/master | 2021-01-17T22:18:30.396874 | 2012-04-27T12:11:06 | 2012-04-27T12:11:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,376 | java | package org.spliffy.server.web.sharing;
import com.bradmcevoy.http.CollectionResource;
import com.bradmcevoy.http.Resource;
import com.bradmcevoy.http.exceptions.BadRequestException;
import com.bradmcevoy.http.exceptions.NotAuthorizedException;
import com.ettrema.http.acl.Principal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.spliffy.server.db.BaseEntity;
import org.spliffy.server.db.Link;
import org.spliffy.server.db.SessionManager;
import org.spliffy.server.db.User;
import org.spliffy.server.web.AbstractResource;
import org.spliffy.server.web.Services;
import org.spliffy.server.web.SpliffyCollectionResource;
/**
*
* @author brad
*/
public class SharesFolder extends AbstractResource implements CollectionResource{
private final String name;
private final SpliffyCollectionResource parent;
public SharesFolder(String name, SpliffyCollectionResource parent) {
super(parent.getServices());
this.name = name;
this.parent = parent;
}
@Override
public boolean isDir() {
return false;
}
@Override
public SpliffyCollectionResource getParent() {
return parent;
}
@Override
public BaseEntity getOwner() {
return null;
}
@Override
public void addPrivs(List<Priviledge> list, User user) {
}
@Override
public String getName() {
return name;
}
@Override
public Date getModifiedDate() {
return null;
}
@Override
public Date getCreateDate() {
return null;
}
@Override
public Resource child(String childName) throws NotAuthorizedException, BadRequestException {
UUID id;
try {
id = UUID.fromString(childName);
} catch (Exception e) {
return null; // not a UUID
}
Link link = Link.get(id, SessionManager.session());
if( link == null) {
return null;
}
return new ShareResource(link, parent);
}
@Override
public List<? extends Resource> getChildren() throws NotAuthorizedException, BadRequestException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Map<Principal, List<Priviledge>> getAccessControlList() {
return null;
}
}
| [
"[email protected]"
] | |
54d8fd2fb4c94cad6069804c5d429fefd29cdcce | fdb7108ae59488c98373c5b15f2b7127cf94f2bf | /src/Uebung/Calendar/Main.java | f9d6b6ab4b8d8f358d56e105aa6edda35f05ab7c | [] | no_license | stqrsky/HandelBBQ | 7ad86fa07f5dee5f5b2ce214f5c868e86ede8284 | 803cf19da2addca7ad2b5eb8433189cd984b9487 | refs/heads/master | 2020-09-12T18:35:49.845562 | 2019-11-18T18:07:56 | 2019-11-18T18:07:56 | 222,512,320 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | package Uebung.Calendar;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class Main {
public static void main(String[] args) {
GregorianCalendar cal = new GregorianCalendar();
System.out.println(cal.get(Calendar.HOUR));
cal.set(Calendar.HOUR,129);
System.out.println(cal.get(Calendar.MINUTE));
System.out.println(cal.get(Calendar.HOUR));
System.out.println(cal.get(Calendar.YEAR));
System.out.println(cal.get(Calendar.HOUR_OF_DAY));
System.out.println(cal.isLeapYear(cal.get(Calendar.YEAR)));
}
}
| [
"[email protected]"
] | |
30333302a2e99e12ee212fea827f4e5ffdb66ffd | 9f8e15acd808f605db4da6d9c316fea8a8ddc1d4 | /Servlets and Jsp/Lab 3 - forward/src/main/java/iti/gov/hadeer/SendRedirect.java | 5345212e133f2d6aadc52e2a2c2b6b7f885b719b | [] | no_license | hadeerelnaggar/ITI-Web-Javaee-Labs | f73ba5023ec35d60af49caa61986984a64e5e058 | 750b24ff35b620b17b572d78d1bcd16d1dbdb8a5 | refs/heads/master | 2023-04-14T04:41:23.378794 | 2021-05-10T14:03:55 | 2021-05-10T14:03:55 | 366,055,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,542 | java | package iti.gov.hadeer;
import jakarta.servlet.*;
import java.io.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.sql.*;
import java.sql.Connection;
import java.sql.SQLException;
import javax.naming.*;
import javax.sql.*;
import javax.sql.DataSource;
public class SendRedirect extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException
{
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
RequestDispatcher rd = request.getRequestDispatcher("login");
rd.include(request, response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
PrintWriter out = response.getWriter();
String userName = request.getParameter("userName");
String password = request.getParameter("password");
if(!userName.equals("") && !password.equals("")){
System.out.println("not null");
//response.sendRedirect("welcome?userName=" + userName + "&password=" + password);
RequestDispatcher rd = request.getRequestDispatcher("welcome");
request.setAttribute("userName",userName);
request.setAttribute("password",password);
rd.forward(request, response);
}
else {
System.out.println("null");
out.println("<html>");
out.println("<body>");
out.println("<h3 style=\"color: red\">Login Failed, please try again</h3>");
RequestDispatcher rd = request.getRequestDispatcher("login");
rd.include(request, response);
}
}
} | [
"[email protected]"
] | |
f4856326f77d6521af5bb00a72f3cf44a999c2a4 | 1e348c4af6e0de749edb97c255f72903b5c412cf | /TpJavaJpa/Tp/TpJavaClient/src/main/java/fr/nguigou971/App.java | 9ebf0a2888a1caff86389e8ea634914725158ce5 | [] | no_license | nico-83190/TpJavaNicolasGuigou | d76563de2d6011c9a15ea090b97e7b80989055b1 | b662a3142c7a90ee903a2745c8b070693d6a68f0 | refs/heads/master | 2022-06-30T15:52:03.720582 | 2019-05-27T08:35:40 | 2019-05-27T08:35:40 | 188,802,992 | 0 | 0 | null | 2022-06-21T01:10:44 | 2019-05-27T08:27:51 | Java | UTF-8 | Java | false | false | 176 | java | package fr.nguigou971;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"[email protected]"
] | |
60ed6412241139ef8f597159cd66b1efe778ec9f | d9ea42be39a8078db52e09274d8013998011d8e1 | /xc-auth/xc-auth-api/src/main/java/com/chenyu/cloud/auth/dto/UserPasswordDto.java | 519b888917687583c225a1bd9b72a76f06e41244 | [] | no_license | cyuaa/xc-cloud | 3cb9ab0576c8db2372dc96b0348a16c2a7c24321 | 511a7e090bd501ebac7b197b71f8110f44d97c04 | refs/heads/master | 2023-04-20T05:22:44.480231 | 2021-05-13T09:13:31 | 2021-05-13T09:13:31 | 357,454,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package com.chenyu.cloud.auth.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotEmpty;
/**
* 修改用户名密码参数
* Created by JackyChen on 2021/4/28.
*/
@Getter
@Setter
public class UserPasswordDto {
@ApiModelProperty(value = "用户名", required = true)
@NotEmpty(message = "用户名不能为空")
private String username;
@ApiModelProperty(value = "旧密码", required = true)
@NotEmpty(message = "旧密码不能为空")
private String oldPassword;
@ApiModelProperty(value = "新密码", required = true)
@NotEmpty(message = "新密码不能为空")
private String newPassword;
}
| [
"[email protected]"
] | |
1f1834034ea578d4b1bf821112c645eb723f4359 | b1a102037f6a6e82285097f006bab55d58679936 | /app/src/main/java/io/github/mcvlaga/sunshine/MainActivity.java | 38b199317e3d5210b55265bb648b5b61ca75f34f | [] | no_license | McVlaga/sunshine | c246081f50b1b705ed6c3e1ebb3e22cc74c03559 | 33a3cf03690952214740c23fded8aea0fea44f38 | refs/heads/master | 2021-01-10T16:16:59.098247 | 2016-01-15T08:27:37 | 2016-01-15T08:27:37 | 45,015,157 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,197 | java | package io.github.mcvlaga.sunshine;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
return true;
}
else if (id == R.id.action_location) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
String zipCode = preferences.getString(getResources().getString(R.string.pref_zipcode_key),
getResources().getString(R.string.pref_zipcode_stcharles));
String address = "http://maps.google.co.in/maps?q=" + zipCode;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(address));
// Verify that the intent will resolve to an activity
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
] | |
a171abad5bdaf7027b677b7f1f0813db3450003f | 42b1be27b8a196865620c3a84592f62fc5661fe1 | /cloud-provider-payment-8001/src/main/java/cn/zzf/spring/cloud/payment/mapper/PaymentMapper.java | c1032f2d31645e568725a130c73ba5fd98960d10 | [] | no_license | ZGAOF/spring-cloud-2020 | d6e4b1d96e1c51ac3ed5a47e4f7b04690bc8968f | b5588c65ee444043e7200efb4bb9384b1e5f7eac | refs/heads/master | 2023-01-11T09:50:21.413305 | 2020-11-18T04:15:33 | 2020-11-18T04:15:33 | 313,794,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package cn.zzf.spring.cloud.payment.mapper;
import cn.zzf.spring.cloud.entity.Payment;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PaymentMapper {
int create(Payment payment);
Payment selectPaymentById(Long id);
}
| [
"[email protected]"
] | |
353e4d80b1aa7bd9c1d296cea36ea03c88dc4672 | ea4a4a70ca7e7396053d90d52c0c141d86b3ec16 | /src/main/java/com/loniks/letsgo/domain/TicketEntity.java | 1e524a1b562d488a20e8695bdd03d2a06b470de8 | [
"Apache-2.0"
] | permissive | Loniks/LetsGo | 97d19a2d073c53406a98759f2865463928b3193e | 9a8f6906c2c641ce40f7727d8958aa0c09c82087 | refs/heads/master | 2023-04-30T14:11:24.109150 | 2020-11-25T19:50:12 | 2020-11-25T19:50:12 | 79,941,686 | 0 | 1 | Apache-2.0 | 2023-04-17T20:58:18 | 2017-01-24T18:39:29 | JavaScript | UTF-8 | Java | false | false | 820 | java | package com.loniks.letsgo.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import javax.persistence.*;
/**
* @author Bondar Dmytro
*/
@Data
@Entity
@Table(name = "tickets")
@AllArgsConstructor
@NoArgsConstructor
public class TicketEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name="status")
@Enumerated(EnumType.STRING)
private TicketStatus status;
@ManyToOne
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinColumn(name = "owner")
private VisitorEntity owner;
@ManyToOne
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinColumn(name = "event")
private EventEntity event;
}
| [
"[email protected]"
] | |
d7c7d2e764510f5ece7c09f0ab92afd4cd12f20d | d6e937c0526d90d41d22b2e31bd05da290447f2c | /src/main/java/com/biblioteca/exception/InvalidItemException.java | afbc0e5e56256910abd50765b1761dd896b08153 | [] | no_license | prachi-kr/biblioteca | 4f166da96caaa6d66a624bda7484774c2bb7c1e8 | ee08f5921b011e421a87157ee6037e74a7504c57 | refs/heads/master | 2021-09-16T09:17:00.955460 | 2018-06-18T18:17:49 | 2018-06-18T18:17:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package com.biblioteca.exception;
public class InvalidItemException extends RuntimeException {
public InvalidItemException(String bookId) {
super("Item id - " + bookId + ", is an invalid BookId");
}
}
| [
"[email protected]"
] | |
bcef0e11db3261ab0b886ebd91962c4e5c8a8547 | a75d31d3a2466bc92233f7494adf503a79de05ce | /src/main/java/org/mifos/ussd/MifosUssdApplication.java | 428ffc29439a56cb7f44330a034d5909b29231a5 | [] | no_license | openMF/ussd-app | b5ad71a92e2014c97713091188ac3b8907dad192 | 9fc6b8e44b0212cd01355aecc45db7821cab22e1 | refs/heads/master | 2022-07-12T14:42:23.932699 | 2020-07-12T15:55:44 | 2020-07-12T15:55:44 | 78,035,460 | 5 | 16 | null | 2020-05-15T02:24:27 | 2017-01-04T17:02:51 | Java | UTF-8 | Java | false | false | 325 | java | package org.mifos.ussd;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MifosUssdApplication {
public static void main(String[] args) {
SpringApplication.run(MifosUssdApplication.class, args);
}
}
| [
"[email protected]"
] | |
d64ed7927fee679883a9d1e23d2ccc998c53ce05 | ada0c9168deedece91162b5c2a3908c61626caaa | /src/telas/NotaSaida/ListaProdutoSaidaBeanTableModel.java | 4e4e5f895cf408fc871dbd9ca8c363c751882462 | [] | no_license | julioizidoro/jgdynamic | 52464107c48c43708eb91637ee82dad7d321bc89 | 11735a498712f902409688d30963a79a7c990c9d | refs/heads/master | 2020-04-12T01:33:54.980169 | 2019-04-25T18:54:38 | 2019-04-25T18:54:38 | 30,019,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,160 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package telas.NotaSaida;
import Regras.Formatacao;
import java.util.List;
import javax.swing.table.AbstractTableModel;
/**
*
* @author wolverine
*/
public class ListaProdutoSaidaBeanTableModel extends AbstractTableModel{
private List<NotaSaidaProdutoBean> listaProdutoBean;
private String[] colunas ={"Código", "Descrição", "Unidade", "NCM", "CEST", "Quantidade", "Valor Unitário", "Valor Total", "Valor Desconto", "Valor Outros" ,"Situação"};
public ListaProdutoSaidaBeanTableModel(List<NotaSaidaProdutoBean> listaProdutoBean) {
this.listaProdutoBean = listaProdutoBean;
}
public int getRowCount() {
return listaProdutoBean.size();
}
public int getColumnCount() {
return colunas.length;
}
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex==0){
return listaProdutoBean.get(rowIndex).getProduto().getReferencia();
}else if (columnIndex==1){
return listaProdutoBean.get(rowIndex).getProduto().getDescricao();
}else if (columnIndex==2){
return listaProdutoBean.get(rowIndex).getProduto().getUnidade();
}else if (columnIndex==3){
return listaProdutoBean.get(rowIndex).getProduto().getNcm();
}else if (columnIndex==4){
return listaProdutoBean.get(rowIndex).getProduto().getCest();
}else if (columnIndex==5){
return Formatacao.foramtarQuantidade(listaProdutoBean.get(rowIndex).getQuantidade());
}else if (columnIndex==6){
return Formatacao.foramtarDoubleString(listaProdutoBean.get(rowIndex).getValorUnitario());
}else if (columnIndex==7){
return Formatacao.foramtarDoubleString(listaProdutoBean.get(rowIndex).getValortotal());
}else if (columnIndex==8){
return Formatacao.foramtarDoubleString(listaProdutoBean.get(rowIndex).getValorDesconto());
}else if (columnIndex==9){
return Formatacao.foramtarDoubleString(listaProdutoBean.get(rowIndex).getValoracessorios());
}else return listaProdutoBean.get(rowIndex).getSituacao();
}
@Override
public String getColumnName(int column) {
return colunas[column];
}
@Override
public Class<?> getColumnClass(int columnIndex) {
if (columnIndex==0){
return Integer.class;
} else if (columnIndex==1){
return String.class;
}else if (columnIndex==2){
return String.class;
}else if (columnIndex==3){
return String.class;
}else if (columnIndex==4){
return String.class;
}else if (columnIndex==5){
return String.class;
}else if (columnIndex==6){
return String.class;
}else if (columnIndex==7){
return String.class;
}else if (columnIndex==8){
return String.class;
}else return String.class;
}
}
| [
"[email protected]"
] | |
248d0669eb57f7d67771e38f45d95f9e13911fd3 | aed9a76e700affb78211a89db311fc88191ba9da | /js相关/SampleAndroidProject/src/com/phonegap/sample/MainActivity.java | b2db9723186dd4822df99e5e8bbb06d25f5856fd | [] | no_license | laiqurufeng/jidiao | 52bd95707285c6bc81064237b3c33969081125ef | f934c6beaed3718269fa80915491afe2cfd96ff7 | refs/heads/master | 2021-01-23T19:13:12.108304 | 2016-03-30T02:58:57 | 2016-03-30T02:58:57 | 40,657,295 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,404 | java | package com.phonegap.sample;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import com.splunk.mint.Mint;
import com.splunk.mint.MintJavascript;
import com.splunk.mint.MintWebView;
import com.splunk.mint.MintWebViewClient;
public class MainActivity extends Activity {
public final static String TAG = "hope";
private WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
Mint.initAndStartSession(this, "f091edc8");
setContentView(R.layout.main_webview);
}
@Override
protected void onStart() {
super.onStart();
mWebView = (WebView) findViewById(R.id.wv_demo);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new NBSWebViewClient(this, null));
// MintJavascript mintJavascript = new MintJavascript(this, mWebView);
// NBSJavascript javascript = new NBSJavascript(this, mWebView);
CritterJSInterface javascript = new CritterJSInterface();
mWebView.addJavascriptInterface(javascript, "_crttr");
//
// UTester.instrumentWebViewNew(this, mWebView);
// instrumentWebView(this, mWebView);
// mWebView.getSettings().setJavaScriptEnabled(true);
// super.loadUrl("file:///android_asset/www/index.html");
mWebView.loadUrl("file:///android_asset/www/index.html");
// mWebView.loadUrl("http://www.sina.com.cn/");
// try{
// Thread.sleep(1500);
// //Thread.sleep(1500);
// }catch (InterruptedException in){
// Log.e(MainActivity.TAG, "sleep");
// }
//
// instrumentWebView(this, mWebView);
}
@Override
protected void onResume() {
super.onResume();
try{
Thread.sleep(1500);
//Thread.sleep(1500);
}catch (InterruptedException in){
Log.e(MainActivity.TAG, "sleep");
}
// UTester.instrumentWebView(this, mWebView);
// instrumentWebView(this, mWebView);
}
}
| [
"[email protected]"
] | |
5075447ab477c5d1a867cc92dca7563b01083c6b | 11833e305deb826dca0c55ca9a0e731fee8f76f7 | /src/com/appbegin/MainService.java | 1bf90dbf1d731927d0682470804d5fe4950dee3a | [] | no_license | RAGHAVNAIDU/MYTELE | f211c05c24e81785eac74d70e48422384f31f8fd | c0b422e76a303438be1487fbfeb3d6e2979092fa | refs/heads/master | 2016-09-06T05:12:33.468393 | 2012-07-03T05:25:25 | 2012-07-03T05:25:25 | 38,572,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,260 | java | package com.appbegin;
import java.io.IOException;
import com.ibm.mqtt.IMqttClient;
import com.ibm.mqtt.MqttClient;
import com.ibm.mqtt.MqttException;
import com.ibm.mqtt.MqttPersistence;
import com.ibm.mqtt.MqttPersistenceException;
import com.ibm.mqtt.MqttSimpleCallback;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.IBinder;
import android.util.Log;
/*
* PushService that does all of the work.
* Most of the logic is borrowed from KeepAliveService.
* http://code.google.com/p/android-random/source/browse/trunk/TestKeepAlive/src/org/devtcg/demo/keepalive/KeepAliveService.java?r=219
*/
public class MainService extends Service
{
// this is the log tag
public static final String TAG = "MainPushService";
// the IP address, where your MQTT broker is running.
private static final String MQTT_HOST = "push.appbegin.com";
// the port at which the broker is running.
private static int MQTT_BROKER_PORT_NUM = 1883;
// Let's not use the MQTT persistence.
private static MqttPersistence MQTT_PERSISTENCE = null;
// We don't need to remember any state between the connections, so we use a clean start.
private static boolean MQTT_CLEAN_START = true;
// Let's set the internal keep alive for MQTT to 15 mins. I haven't tested this value much. It could probably be increased.
private static short MQTT_KEEP_ALIVE = 60 * 15;
// Set quality of services to 0 (at most once delivery), since we don't want push notifications
// arrive more than once. However, this means that some messages might get lost (delivery is not guaranteed)
private static int[] MQTT_QUALITIES_OF_SERVICE = { 0 } ;
private static int MQTT_QUALITY_OF_SERVICE = 0;
// The broker should not retain any messages.
private static boolean MQTT_RETAINED_PUBLISH = false;
// MQTT client ID, which is given the broker. In this example, I also use this for the topic header.
// You can use this to run push notifications for multiple apps with one MQTT broker.
public static String MQTT_CLIENT_ID = "appbegin";
// These are the actions for the service (name are descriptive enough)
private static final String ACTION_START = MQTT_CLIENT_ID + ".START";
private static final String ACTION_STOP = MQTT_CLIENT_ID + ".STOP";
private static final String ACTION_KEEPALIVE = MQTT_CLIENT_ID + ".KEEP_ALIVE";
private static final String ACTION_RECONNECT = MQTT_CLIENT_ID + ".RECONNECT";
// Connection log for the push service. Good for debugging.
private ConnectionLog mLog;
// Connectivity manager to determining, when the phone loses connection
private ConnectivityManager mConnMan;
// Notification manager to displaying arrived push notifications
private NotificationManager mNotifMan;
// Whether or not the service has been started.
private boolean mStarted;
// This the application level keep-alive interval, that is used by the AlarmManager
// to keep the connection active, even when the device goes to sleep.
private static final long KEEP_ALIVE_INTERVAL = 1000 * 60 * 28;
// Retry intervals, when the connection is lost.
private static final long INITIAL_RETRY_INTERVAL = 1000 * 10;
private static final long MAXIMUM_RETRY_INTERVAL = 1000 * 60 * 30;
// Preferences instance
private SharedPreferences mPrefs;
// We store in the preferences, whether or not the service has been started
public static final String PREF_STARTED = "isStarted";
// We also store the deviceID (target)
public static final String PREF_DEVICE_ID = "deviceID";
// We store the last retry interval
public static final String PREF_RETRY = "retryInterval";
// Notification title
public static String NOTIF_TITLE = "Appbegin Push Demo";
// Notification id
private static final int NOTIF_CONNECTED = 0;
// This is the instance of an MQTT connection.
private MQTTConnection mConnection;
private long mStartTime;
public static String deviceID ;
public static void setDeviceID(String id) {
deviceID = id;
}
// Static method to start the service
public static void actionStart(Context ctx) {
Intent i = new Intent(ctx, MainService.class);
i.setAction(ACTION_START);
ctx.startService(i);
}
// Static method to stop the service
public static void actionStop(Context ctx) {
Intent i = new Intent(ctx, MainService.class);
i.setAction(ACTION_STOP);
ctx.startService(i);
}
// Static method to send a keep alive message
public static void actionPing(Context ctx) {
Intent i = new Intent(ctx, MainService.class);
i.setAction(ACTION_KEEPALIVE);
ctx.startService(i);
}
@Override
public void onCreate() {
super.onCreate();
log("Creating service");
mStartTime = System.currentTimeMillis();
try {
mLog = new ConnectionLog();
Log.i(TAG, "Opened log at " + mLog.getPath());
} catch (IOException e) {
Log.e(TAG, "Failed to open log", e);
}
// Get instances of preferences, connectivity manager and notification manager
mPrefs = getSharedPreferences(TAG, MODE_PRIVATE);
mConnMan = (ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
mNotifMan = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
/* If our process was reaped by the system for any reason we need
* to restore our state with merely a call to onCreate. We record
* the last "started" value and restore it here if necessary. */
handleCrashedService();
}
// This method does any necessary clean-up need in case the server has been destroyed by the system
// and then restarted
private void handleCrashedService() {
if (wasStarted() == true) {
log("Handling crashed service...");
// stop the keep alives
stopKeepAlives();
// Do a clean start
start();
}
}
@Override
public void onDestroy() {
log("Service destroyed (started=" + mStarted + ")");
// Stop the services, if it has been started
if (mStarted == true) {
stop();
}
try {
if (mLog != null)
mLog.close();
} catch (IOException e) {}
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
log("Service started with intent=" + intent);
// Do an appropriate action based on the intent.
if (intent.getAction().equals(ACTION_STOP) == true) {
stop();
stopSelf();
} else if (intent.getAction().equals(ACTION_START) == true) {
start();
} else if (intent.getAction().equals(ACTION_KEEPALIVE) == true) {
keepAlive();
} else if (intent.getAction().equals(ACTION_RECONNECT) == true) {
if (isNetworkAvailable()) {
reconnectIfNecessary();
}
}
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
// log helper function
private void log(String message) {
log(message, null);
}
private void log(String message, Throwable e) {
if (e != null) {
Log.e(TAG, message, e);
} else {
Log.i(TAG, message);
}
if (mLog != null)
{
try {
mLog.println(message);
} catch (IOException ex) {}
}
}
// Reads whether or not the service has been started from the preferences
private boolean wasStarted() {
return mPrefs.getBoolean(PREF_STARTED, false);
}
// Sets whether or not the services has been started in the preferences.
private void setStarted(boolean started) {
mPrefs.edit().putBoolean(PREF_STARTED, started).commit();
mStarted = started;
}
private synchronized void start() {
log("Starting service...");
// Do nothing, if the service is already running.
if (mStarted == true) {
Log.w(TAG, "Attempt to start connection that is already active");
return;
}
// Establish an MQTT connection
connect();
// Register a connectivity listener
registerReceiver(mConnectivityChanged, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
private synchronized void stop() {
// Do nothing, if the service is not running.
if (mStarted == false) {
Log.w(TAG, "Attempt to stop connection not active.");
return;
}
// Save stopped state in the preferences
setStarted(false);
// Remove the connectivity receiver
unregisterReceiver(mConnectivityChanged);
// Any existing reconnect timers should be removed, since we explicitly stopping the service.
cancelReconnect();
// Destroy the MQTT connection if there is one
if (mConnection != null) {
mConnection.disconnect();
mConnection = null;
}
}
//
private synchronized void connect() {
log("Connecting...");
// fetch the device ID from the preferences.
//String deviceID = mPrefs.getString(PREF_DEVICE_ID, null);
// Create a new connection only if the device id is not NULL
if (deviceID == null) {
log("Device ID not found.");
} else {
try {
mConnection = new MQTTConnection(MQTT_HOST, deviceID);
} catch (MqttException e) {
// Schedule a reconnect, if we failed to connect
log("MqttException: " + (e.getMessage() != null ? e.getMessage() : "NULL"));
if (isNetworkAvailable()) {
scheduleReconnect(mStartTime);
}
}
setStarted(true);
}
}
private synchronized void keepAlive() {
try {
// Send a keep alive, if there is a connection.
if (mStarted == true && mConnection != null) {
mConnection.sendKeepAlive();
}
} catch (MqttException e) {
log("MqttException: " + (e.getMessage() != null? e.getMessage(): "NULL"), e);
mConnection.disconnect();
mConnection = null;
cancelReconnect();
}
}
// Schedule application level keep-alives using the AlarmManager
private void startKeepAlives() {
Intent i = new Intent();
i.setClass(this, MainService.class);
i.setAction(ACTION_KEEPALIVE);
PendingIntent pi = PendingIntent.getService(this, 0, i, 0);
AlarmManager alarmMgr = (AlarmManager)getSystemService(ALARM_SERVICE);
alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP,
System.currentTimeMillis() + KEEP_ALIVE_INTERVAL,
KEEP_ALIVE_INTERVAL, pi);
}
// Remove all scheduled keep alives
private void stopKeepAlives() {
Intent i = new Intent();
i.setClass(this, MainService.class);
i.setAction(ACTION_KEEPALIVE);
PendingIntent pi = PendingIntent.getService(this, 0, i, 0);
AlarmManager alarmMgr = (AlarmManager)getSystemService(ALARM_SERVICE);
alarmMgr.cancel(pi);
}
// We schedule a reconnect based on the starttime of the service
public void scheduleReconnect(long startTime) {
// the last keep-alive interval
long interval = mPrefs.getLong(PREF_RETRY, INITIAL_RETRY_INTERVAL);
// Calculate the elapsed time since the start
long now = System.currentTimeMillis();
long elapsed = now - startTime;
// Set an appropriate interval based on the elapsed time since start
if (elapsed < interval) {
interval = Math.min(interval * 4, MAXIMUM_RETRY_INTERVAL);
} else {
interval = INITIAL_RETRY_INTERVAL;
}
log("Rescheduling connection in " + interval + "ms.");
// Save the new internval
mPrefs.edit().putLong(PREF_RETRY, interval).commit();
// Schedule a reconnect using the alarm manager.
Intent i = new Intent();
i.setClass(this, MainService.class);
i.setAction(ACTION_RECONNECT);
PendingIntent pi = PendingIntent.getService(this, 0, i, 0);
AlarmManager alarmMgr = (AlarmManager)getSystemService(ALARM_SERVICE);
alarmMgr.set(AlarmManager.RTC_WAKEUP, now + interval, pi);
}
// Remove the scheduled reconnect
public void cancelReconnect() {
Intent i = new Intent();
i.setClass(this, MainService.class);
i.setAction(ACTION_RECONNECT);
PendingIntent pi = PendingIntent.getService(this, 0, i, 0);
AlarmManager alarmMgr = (AlarmManager)getSystemService(ALARM_SERVICE);
alarmMgr.cancel(pi);
}
private synchronized void reconnectIfNecessary() {
if (mStarted == true && mConnection == null) {
log("Reconnecting...");
connect();
}
}
// This receiver listeners for network changes and updates the MQTT connection
// accordingly
private BroadcastReceiver mConnectivityChanged = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Get network info
NetworkInfo info = (NetworkInfo)intent.getParcelableExtra (ConnectivityManager.EXTRA_NETWORK_INFO);
// Is there connectivity?
boolean hasConnectivity = (info != null && info.isConnected()) ? true : false;
log("Connectivity changed: connected=" + hasConnectivity);
if (hasConnectivity) {
reconnectIfNecessary();
} else if (mConnection != null) {
// if there no connectivity, make sure MQTT connection is destroyed
mConnection.disconnect();
cancelReconnect();
mConnection = null;
}
}
};
// Display the topbar notification
private void showNotification(String text) {
Notification n = new Notification();
n.flags |= Notification.FLAG_SHOW_LIGHTS;
n.flags |= Notification.FLAG_AUTO_CANCEL;
n.defaults = Notification.DEFAULT_ALL;
n.icon = com.appbegin.R.drawable.icon;
n.when = System.currentTimeMillis();
// Simply open the parent activity
PendingIntent pi = PendingIntent.getActivity(this, 0,
new Intent(this, MainActivity.class), 0);
// Change the name of the notification here
n.setLatestEventInfo(this, NOTIF_TITLE, text, pi);
mNotifMan.notify(NOTIF_CONNECTED, n);
}
// Check if we are online
private boolean isNetworkAvailable() {
NetworkInfo info = mConnMan.getActiveNetworkInfo();
if (info == null) {
return false;
}
return info.isConnected();
}
// This inner class is a wrapper on top of MQTT client.
private class MQTTConnection implements MqttSimpleCallback {
IMqttClient mqttClient = null;
// Creates a new connection given the broker address and initial topic
public MQTTConnection(String brokerHostName, String initTopic) throws MqttException {
// Create connection spec
String mqttConnSpec = "tcp://" + brokerHostName + "@" + MQTT_BROKER_PORT_NUM;
// Create the client and connect
mqttClient = MqttClient.createMqttClient(mqttConnSpec, MQTT_PERSISTENCE);
String clientID = MQTT_CLIENT_ID + "/" + mPrefs.getString(PREF_DEVICE_ID, "");
mqttClient.connect(clientID, MQTT_CLEAN_START, MQTT_KEEP_ALIVE);
// register this client app has being able to receive messages
mqttClient.registerSimpleHandler(this);
// Subscribe to an initial topic, which is combination of client ID and device ID.
initTopic = MQTT_CLIENT_ID + "/" + initTopic;
subscribeToTopic(initTopic);
log("Connection established to " + brokerHostName + " on topic " + initTopic);
// Save start time
mStartTime = System.currentTimeMillis();
// Star the keep-alives
startKeepAlives();
}
// Disconnect
public void disconnect() {
try {
stopKeepAlives();
mqttClient.disconnect();
} catch (MqttPersistenceException e) {
log("MqttException" + (e.getMessage() != null? e.getMessage():" NULL"), e);
}
}
/*
* Send a request to the message broker to be sent messages published with
* the specified topic name. Wildcards are allowed.
*/
private void subscribeToTopic(String topicName) throws MqttException {
if ((mqttClient == null) || (mqttClient.isConnected() == false)) {
// quick sanity check - don't try and subscribe if we don't have
// a connection
log("Connection error" + "No connection");
} else {
String[] topics = { topicName };
mqttClient.subscribe(topics, MQTT_QUALITIES_OF_SERVICE);
}
}
/*
* Sends a message to the message broker, requesting that it be published
* to the specified topic.
*/
private void publishToTopic(String topicName, String message) throws MqttException {
if ((mqttClient == null) || (mqttClient.isConnected() == false)) {
// quick sanity check - don't try and publish if we don't have
// a connection
log("No connection to public to");
} else {
mqttClient.publish(topicName,
message.getBytes(),
MQTT_QUALITY_OF_SERVICE,
MQTT_RETAINED_PUBLISH);
}
}
/*
* Called if the application loses it's connection to the message broker.
*/
public void connectionLost() throws Exception {
log("Loss of connection" + "connection downed");
stopKeepAlives();
// null itself
mConnection = null;
if (isNetworkAvailable() == true) {
reconnectIfNecessary();
}
}
/*
* Called when we receive a message from the message broker.
*/
public void publishArrived(String topicName, byte[] payload, int qos, boolean retained) {
// Show a notification
String s = new String(payload);
showNotification(s);
log("Got message: " + s);
}
public void sendKeepAlive() throws MqttException {
log("Sending keep alive");
// publish to a keep-alive topic
publishToTopic(MQTT_CLIENT_ID + "/keepalive", mPrefs.getString(PREF_DEVICE_ID, ""));
}
}
} | [
"[email protected]"
] | |
6f59c3318468b3bd47b391f07b8c7e924aa1c205 | 612efa8a2d20a844b6126119783d6add8d235972 | /src/main/java/com/situ/market/order/domain/Order.java | 038d08bad239bc2e8f62dbc3787e993eea6072c0 | [] | no_license | java-code-cpu/market | 937156ace48955c660b70aba7f635c45f8204eb4 | faaef7b80efbc76ca314d4644edfe8d2d46c0838 | refs/heads/master | 2022-12-21T11:08:50.787731 | 2020-01-06T02:38:13 | 2020-01-06T02:38:13 | 232,007,317 | 1 | 0 | null | 2022-12-15T23:33:52 | 2020-01-06T02:18:28 | Java | UTF-8 | Java | false | false | 1,287 | java | package com.situ.market.order.domain;
import java.math.BigDecimal;
import org.apache.ibatis.type.Alias;
import com.situ.market.base.BaseClass;
@Alias("Order")
public class Order extends BaseClass {
private static final long serialVersionUID = 1L;
private Long userRowId; //用户ID 关联用户表的ID
private BigDecimal allMoney; // 总价格
private String addressId; //收获地址ID
private Integer orderState; //订单状态 1:已付款 2:未付款 3:退单
private Integer payMothed; //支付方法 1:微信 2:支付宝
public Long getUserRowId() {
return userRowId;
}
public void setUserRowId(Long userRowId) {
this.userRowId = userRowId;
}
public BigDecimal getAllMoney() {
return allMoney;
}
public void setAllMoney(BigDecimal allMoney) {
this.allMoney = allMoney;
}
public String getAddressId() {
return addressId;
}
public void setAddressId(String addressId) {
this.addressId = addressId;
}
public Integer getOrderState() {
return orderState;
}
public void setOderState(Integer orderState) {
this.orderState = orderState;
}
public Integer getPayMothed() {
return payMothed;
}
public void setPayMothed(Integer payMothed) {
this.payMothed = payMothed;
}
}
| [
"[email protected]"
] | |
8c3d3c567dfb2f651179f1f1a82527b8cb92971f | be55285edbca96a3cdcf1c945e4363aa8455f15e | /src/main/java/co/iay/leetcode/Tester/Easy/TestConvertANumberToHexadecimal.java | 06757bef013489ac21f4150987ce040560c776e8 | [] | no_license | liaoaoyang/LeetCode | 03ce3ddfdf55968f719c857bc9f42f0cdd40e20f | 338f8137c3223b4f1d73b9b96f85637ea54975f9 | refs/heads/master | 2021-01-16T23:41:42.275307 | 2019-04-25T00:05:16 | 2019-04-25T00:05:16 | 55,667,787 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,323 | java | package co.iay.leetcode.Tester.Easy;
import co.iay.leetcode.Easy.ConvertANumberToHexadecimal;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by ng on 16/10/1.
*/
public class TestConvertANumberToHexadecimal {
private ConvertANumberToHexadecimal c = new ConvertANumberToHexadecimal();
@Test
public void testTestConvertANumberToHexadecimalCase1() {
Assert.assertEquals("1", c.toHex(1));
}
@Test
public void testTestConvertANumberToHexadecimalCase2() {
Assert.assertEquals("a", c.toHex(10));
}
@Test
public void testTestConvertANumberToHexadecimalCase3() {
Assert.assertEquals("b", c.toHex(11));
}
@Test
public void testTestConvertANumberToHexadecimalCase4() {
Assert.assertEquals("1a", c.toHex(26));
}
@Test
public void testTestConvertANumberToHexadecimalCase5() {
Assert.assertEquals("ffffffff", c.toHex(-1));
}
@Test
public void testTestConvertANumberToHexadecimalCase6() {
Assert.assertEquals("fffffffe", c.toHex(-2));
}
@Test
public void testTestConvertANumberToHexadecimalCase7() {
Assert.assertEquals("10", c.toHex(16));
}
@Test
public void testTestConvertANumberToHexadecimalCase8() {
Assert.assertEquals("0", c.toHex(0));
}
}
| [
"[email protected]"
] | |
7e759d99f192e2c98e02ad7a89eec546e813cfd7 | 44e082b233a2e44212422514fa9225cf1b6358d2 | /GPROG_oldPruefungen/src/_glProg_2016_NT2_GrA/Reihe.java | 040cc9cb2dfc92ed8637fa858ddda6af0f028a8e | [] | no_license | fhbgraceb/VerbundA-SS20 | b3af20000e1a4b6efe768156ad415dbf67e16be0 | 7e672445bb785386af2ff65d3526f89c67882a71 | refs/heads/master | 2022-12-28T05:56:20.158197 | 2020-10-10T23:20:18 | 2020-10-10T23:20:18 | 238,525,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package _glProg_2016_NT2_GrA;
public class Reihe
{
public static void main(String[] args)
{
final double grenze = -3.0;
double summe;
double glied;
int zaehler;
int nenner;
summe = 0;
zaehler = 1;
nenner = 2;
do
{
glied = ((double)zaehler) / nenner;
if ((zaehler % 5 == 1) || (zaehler % 5 == 2) || (zaehler % 5 == 3))
{
summe -= glied;
}
else
{
summe += glied;
}
System.out.println(zaehler + " / " + nenner + " = " + glied + " - " + summe);
if (summe >= grenze)
{
nenner += zaehler;
zaehler++;
}
} while (summe >= grenze);
System.out.println("Bei Glied Nr. " + zaehler + " ist die Summe zum ersten Mal kleiner als " + grenze + ".");
}
}
| [
"[email protected]"
] | |
3436ceb4860bd032e99ee5b899a041adf7b86d22 | a3c11f233154c78fdd71aaa958dd6dffce281019 | /src/com/company/MyRunnable.java | 3d3982b29837cb1b13ac73a72d056b1acd65e05d | [] | no_license | matheusmig/MyFirstJavaCode | 3662914d4fd7913e83ee3666414206e679333242 | 88c9df255728a3b8b6f6ba22aedf176774c6f49f | refs/heads/master | 2021-09-04T10:25:10.431742 | 2018-01-18T00:58:35 | 2018-01-18T00:58:35 | 112,982,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.company;
/**
* Created by mmignoni on 2017-11-09.
*
* Implementa thread através de "implements Runanble"
*/
public class MyRunnable implements Runnable {
String strName; //Nome da thread
MyRunnable(String strName) {
this.strName = strName;
}
public void run() {
for(int x = 0; x < 100; x = x + 1) {
System.out.println("I'm "+this.strName+" Thread");
}
}
}
| [
"[email protected]"
] | |
216962b5e0b19acf163151bf718a7ad1bafe5c4f | 41076deea9f13f7c16682f607d9a30a3b46a4bc2 | /NoemiLabant/src/main/java/persoane/Hash.java | b9019aa4145e928086533c30a40810353efcda8c | [] | no_license | Noemi-Labant/JavaLearning | dbc1c9a837831ab25aa6ece803787eacf550d97b | 1ff40cbc74f313b3994592d117c5decdd72530f3 | refs/heads/main | 2023-01-30T12:30:17.390239 | 2020-12-12T08:52:03 | 2020-12-12T08:52:03 | 309,957,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,789 | java | package persoane;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class Hash {
public static void main(String[] args) {
Map<Persoana, List<Hobby>> persoane = new HashMap<>();
Address address1 = new Address("Carpati nr. 254", "Romania");
Address address2 = new Address("Salcamilor nr. 3", "Germany");
Address address3 = new Address("Caprioarei nr. 10", "Italy");
List<Address> addresses1 = new LinkedList<>();
addresses1.add(address1);
addresses1.add(address2);
List<Address> addresses2 = new LinkedList<>();
addresses2.add(address1);
addresses2.add(address3);
Hobby hobby1 = new Hobby("skiing", 3, addresses1);
Hobby hobby2 = new Hobby("golfing", 5, addresses2);
List<Hobby> hobbies1 = new LinkedList<>();
hobbies1.add(hobby1);
hobbies1.add(hobby2);
List<Hobby> hobbies2 = new LinkedList<>();
hobbies2.add(hobby1);
Persoana persoana1 = new Persoana("Cristiano", 34);
Persoana persoana2 = new Persoana("Tarzan", 80);
persoane.put(persoana1, hobbies1);
persoane.put(persoana2, hobbies2);
for (Map.Entry<Persoana, List<Hobby>> entry: persoane.entrySet()) {
Persoana pers1 = entry.getKey();
List<Hobby> hobbiesList1 = entry.getValue();
System.out.println("Person name: " + pers1.getNume());
for (Hobby hobby: hobbiesList1) {
System.out.println("Hobby name: " + hobby.getHobbyName());
for (Address address: hobby.getAddresses()) {
System.out.println("Address country: " + address.getTara());
}
}
}
}
}
| [
"[email protected]"
] | |
c86c16e0fab5a90c7ed90823435051d1b2a5c100 | 8341549a002086aa2ef3c9294a5f15bfec219199 | /message/src/main/java/com/ydzb/message/service/ISmsLogService.java | 05a731e2e9b39ae5b35daaa2b2fa5a6de64991e8 | [] | no_license | songziyang/ydzb | 2498204b9ee3d8e101a64ee7e366d8115514908c | e8483e26efab94a110821a7612fbaee3b08e66d5 | refs/heads/master | 2021-01-19T22:41:01.600194 | 2017-04-20T09:20:24 | 2017-04-20T09:20:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package com.ydzb.message.service;
import com.ydzb.core.service.IBaseService;
import com.ydzb.sms.entity.SmsLog;
public interface ISmsLogService extends IBaseService<SmsLog, Long> {
}
| [
"[email protected]"
] | |
eb7fe368cd48b3f710d462b06d2548c75c4af325 | fb723603cce3fd93a7ae7bcf0a94839cddea331c | /src/uo/ri/ui/admin/action/ListMechanicsAction.java | 05f71a9dc09fb9a390e7fcd6468dbe24beb08f3f | [] | no_license | robertofd1995/RI-JDBC | 43c1db0698b7a1922115bc236d49ba8e82882b31 | 8130d6e62493f92607ec070cad9388c10d0cd255 | refs/heads/master | 2020-04-15T23:15:12.350614 | 2016-06-27T03:59:28 | 2016-06-27T03:59:28 | 61,814,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 939 | java | package uo.ri.ui.admin.action;
import java.util.List;
import java.util.Map;
import uo.ri.business.AdminService;
import uo.ri.common.BusinessException;
import uo.ri.conf.ServicesFactory;
import alb.util.console.Console;
import alb.util.menu.Action;
public class ListMechanicsAction implements Action {
@Override
public void execute() throws BusinessException {
Console.println("\nListado de mecánicos\n");
AdminService adminService=ServicesFactory.getAdminService();
List<Map<String,Object>> lista=adminService.listMechanic();
for (int i = 0; i < lista.size(); i++) {
long id=(long)lista.get(i).get("id");
String nombre=(String)lista.get(i).get("nombre");
String apellido=(String)lista.get(i).get("apellido");
StringBuilder str=new StringBuilder();
str.append(id+",");
str.append(nombre+",");
str.append(apellido+"\n");
System.out.println(str.toString());
}
}
}
| [
"[email protected]"
] | |
96c057a834d6b474e85fe8c7d2c9f8f96ea64f9e | 321df9a1996cce025fcf6cb447161b6a8d4ed0f4 | /src/cine/ListaPeliculas.java | c587072b092ca6f65f827b4fad8978d758e5ae43 | [] | no_license | jaravad/Dunord-Cinema | 85b7bbb7b30165472cfd192add03cf201de3bf30 | ad4af82d4744dca8adbb0677412f26a98a8d5a17 | refs/heads/master | 2020-03-15T02:54:25.825171 | 2018-08-29T23:30:19 | 2018-08-29T23:30:19 | 131,929,323 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,577 | java | package cine;
import com.sun.awt.AWTUtilities;
import java.awt.Color;
import java.awt.Image;
import java.io.File;
import java.util.Scanner;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public class ListaPeliculas extends javax.swing.JFrame {
public ListaPeliculas() {
initComponents();
AWTUtilities.setWindowOpaque(this, false);
setLocationRelativeTo(null);
table.getTableHeader().setReorderingAllowed(false);
table.setDefaultRenderer(Object.class, new ImgTable());
table.setRowHeight(230);
table.setShowHorizontalLines(false);
table.setShowVerticalLines(false);
table.getTableHeader().setUI(null);
File archivo = new File("mispeliculas.txt");
Scanner s = null;
try {
DefaultTableModel model = (DefaultTableModel) table.getModel();
s = new Scanner(archivo);
while (s.hasNextLine()) {
String linea = s.nextLine();
JLabel lbl = new JLabel();
lbl.setSize(165, 230);
String[] campos = linea.split(",");
ImageIcon icon = new ImageIcon(campos[3]);
Icon icono = new ImageIcon(icon.getImage().getScaledInstance(lbl.getWidth(), lbl.getHeight(), Image.SCALE_SMOOTH));
lbl.setText(null);
lbl.setIcon(icono);
model.addRow(new Object[]{campos[0], campos[1], campos[2], lbl});
}
} catch (Exception ex) {
System.out.println("Mensaje: " + ex.toString());
} finally {
try {
if (s != null) {
s.close();
}
} catch (Exception ex2) {
System.out.println("Mensaje 2: " + ex2.getMessage());
}
}
table.setBackground(Color.white);
}
public void Refresh(){
File archivo = new File("mispeliculas.txt");
Scanner s = null;
try {
DefaultTableModel model = (DefaultTableModel) table.getModel();
s = new Scanner(archivo);
while (s.hasNextLine()) {
String linea = s.nextLine();
JLabel lbl = new JLabel();
lbl.setSize(165, 230);
String[] campos = linea.split(",");
ImageIcon icon = new ImageIcon(campos[3]);
Icon icono = new ImageIcon(icon.getImage().getScaledInstance(lbl.getWidth(), lbl.getHeight(), Image.SCALE_SMOOTH));
lbl.setText(null);
lbl.setIcon(icono);
model.addRow(new Object[]{campos[0], campos[1], campos[2], lbl});
}
} catch (Exception ex) {
System.out.println("Mensaje: " + ex.toString());
} finally {
try {
if (s != null) {
s.close();
}
} catch (Exception ex2) {
System.out.println("Mensaje 2: " + ex2.getMessage());
}
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
back = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
table = new javax.swing.JTable();
close = new javax.swing.JLabel();
volver = new javax.swing.JLabel();
topbar = new javax.swing.JLabel();
title = new javax.swing.JLabel();
delete = new javax.swing.JLabel();
modify = new javax.swing.JLabel();
back1 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
table1 = new javax.swing.JTable();
close1 = new javax.swing.JLabel();
volver1 = new javax.swing.JLabel();
topbar1 = new javax.swing.JLabel();
title1 = new javax.swing.JLabel();
delete1 = new javax.swing.JLabel();
modify1 = new javax.swing.JLabel();
add = new javax.swing.JLabel();
refresh = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
back.setBackground(new java.awt.Color(255, 255, 255));
back.setBorder(javax.swing.BorderFactory.createEtchedBorder());
back.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
table.setFont(new java.awt.Font("Microsoft JhengHei UI", 0, 18)); // NOI18N
table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Nombre", "Duración", "Clasificación", "Caratula"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(table);
if (table.getColumnModel().getColumnCount() > 0) {
table.getColumnModel().getColumn(0).setResizable(false);
table.getColumnModel().getColumn(0).setPreferredWidth(160);
table.getColumnModel().getColumn(1).setResizable(false);
table.getColumnModel().getColumn(1).setPreferredWidth(4);
table.getColumnModel().getColumn(2).setResizable(false);
table.getColumnModel().getColumn(2).setPreferredWidth(5);
table.getColumnModel().getColumn(3).setResizable(false);
table.getColumnModel().getColumn(3).setPreferredWidth(52);
}
back.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 90, 700, 490));
close.setBackground(new java.awt.Color(255, 255, 255));
close.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
close.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Delete_25px.png"))); // NOI18N
close.setOpaque(true);
close.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
closeMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
closeMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
closeMouseExited(evt);
}
});
back.add(close, new org.netbeans.lib.awtextra.AbsoluteConstraints(820, 0, 40, 40));
volver.setBackground(new java.awt.Color(255, 255, 255));
volver.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
volver.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Back Arrow_28px.png"))); // NOI18N
volver.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
volver.setOpaque(true);
volver.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
volverMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
volverMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
volverMouseExited(evt);
}
});
back.add(volver, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 40, 40));
topbar.setCursor(new java.awt.Cursor(java.awt.Cursor.MOVE_CURSOR));
topbar.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
topbarMouseDragged(evt);
}
});
topbar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
topbarMousePressed(evt);
}
});
back.add(topbar, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 860, 40));
title.setFont(new java.awt.Font("Microsoft YaHei UI Light", 0, 18)); // NOI18N
title.setText("Peliculas Disponibles");
back.add(title, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 40, 180, 26));
delete.setBackground(new java.awt.Color(255, 255, 255));
delete.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N
delete.setForeground(new java.awt.Color(255, 51, 51));
delete.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
delete.setText("Eliminar");
delete.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 51, 51)));
delete.setOpaque(true);
delete.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
deleteMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
deleteMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
deleteMouseExited(evt);
}
});
back.add(delete, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 130, 60, 30));
modify.setBackground(new java.awt.Color(255, 255, 255));
modify.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N
modify.setForeground(new java.awt.Color(0, 153, 0));
modify.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
modify.setText("Modificar");
modify.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 0)));
modify.setOpaque(true);
modify.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
modifyMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
modifyMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
modifyMouseExited(evt);
}
});
back.add(modify, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 180, 60, 30));
back1.setBackground(new java.awt.Color(255, 255, 255));
back1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
back1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
table1.setFont(new java.awt.Font("Microsoft JhengHei UI", 0, 18)); // NOI18N
table1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Nombre", "Duración", "Clasificación", "Caratula"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane2.setViewportView(table1);
if (table1.getColumnModel().getColumnCount() > 0) {
table1.getColumnModel().getColumn(0).setResizable(false);
table1.getColumnModel().getColumn(0).setPreferredWidth(160);
table1.getColumnModel().getColumn(1).setResizable(false);
table1.getColumnModel().getColumn(1).setPreferredWidth(4);
table1.getColumnModel().getColumn(2).setResizable(false);
table1.getColumnModel().getColumn(2).setPreferredWidth(5);
table1.getColumnModel().getColumn(3).setResizable(false);
table1.getColumnModel().getColumn(3).setPreferredWidth(52);
}
back1.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 90, 700, 490));
close1.setBackground(new java.awt.Color(255, 255, 255));
close1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
close1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Delete_25px.png"))); // NOI18N
close1.setOpaque(true);
close1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
close1MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
close1MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
close1MouseExited(evt);
}
});
back1.add(close1, new org.netbeans.lib.awtextra.AbsoluteConstraints(820, 0, 40, 40));
volver1.setBackground(new java.awt.Color(255, 255, 255));
volver1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
volver1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Back Arrow_28px.png"))); // NOI18N
volver1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
volver1.setOpaque(true);
volver1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
volver1MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
volver1MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
volver1MouseExited(evt);
}
});
back1.add(volver1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 40, 40));
topbar1.setCursor(new java.awt.Cursor(java.awt.Cursor.MOVE_CURSOR));
topbar1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
topbar1MouseDragged(evt);
}
});
topbar1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
topbar1MousePressed(evt);
}
});
back1.add(topbar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 860, 40));
title1.setFont(new java.awt.Font("Microsoft YaHei UI Light", 0, 18)); // NOI18N
title1.setText("Peliculas Disponibles");
back1.add(title1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 40, 180, 26));
delete1.setBackground(new java.awt.Color(255, 255, 255));
delete1.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N
delete1.setForeground(new java.awt.Color(255, 51, 51));
delete1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
delete1.setText("Eliminar");
delete1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 51, 51)));
delete1.setOpaque(true);
delete1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
delete1MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
delete1MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
delete1MouseExited(evt);
}
});
back1.add(delete1, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 130, 60, 30));
modify1.setBackground(new java.awt.Color(255, 255, 255));
modify1.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N
modify1.setForeground(new java.awt.Color(0, 153, 0));
modify1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
modify1.setText("Modificar");
modify1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 0)));
modify1.setOpaque(true);
modify1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
modify1MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
modify1MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
modify1MouseExited(evt);
}
});
back1.add(modify1, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 180, 60, 30));
add.setBackground(new java.awt.Color(255, 255, 255));
add.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N
add.setForeground(new java.awt.Color(0, 102, 255));
add.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
add.setText("Agregar");
add.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 255)));
add.setOpaque(true);
add.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
addMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
addMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
addMouseExited(evt);
}
});
back1.add(add, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 230, 60, 30));
refresh.setBackground(new java.awt.Color(255, 255, 255));
refresh.setFont(new java.awt.Font("Microsoft JhengHei", 1, 11)); // NOI18N
refresh.setForeground(new java.awt.Color(153, 0, 153));
refresh.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
refresh.setText("Actualizar");
refresh.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 0, 153)));
refresh.setOpaque(true);
refresh.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
refreshMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
refreshMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
refreshMouseExited(evt);
}
});
back1.add(refresh, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 280, 60, 30));
back.add(back1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(back, javax.swing.GroupLayout.PREFERRED_SIZE, 858, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(back, javax.swing.GroupLayout.PREFERRED_SIZE, 604, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void closeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeMouseClicked
this.dispose();
System.exit(0);
}//GEN-LAST:event_closeMouseClicked
private void closeMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeMouseEntered
close.setBackground(new Color(255, 51, 51));
close.setIcon(new ImageIcon("src/imagenes/Deletewhite_25px.png"));
}//GEN-LAST:event_closeMouseEntered
public static int x;
public static int y;
private void closeMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeMouseExited
close.setBackground(new Color(255, 255, 255));
close.setIcon(new ImageIcon("src/imagenes/Delete_25px.png"));
}//GEN-LAST:event_closeMouseExited
private void topbarMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_topbarMouseDragged
this.setLocation(this.getLocation().x + evt.getX() - x, this.getLocation().y + evt.getY() - y);
}//GEN-LAST:event_topbarMouseDragged
private void topbarMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_topbarMousePressed
x = evt.getX();
y = evt.getY();
}//GEN-LAST:event_topbarMousePressed
private void deleteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteMouseClicked
try {
DefaultTableModel model = (DefaultTableModel) table.getModel();
String name = String.valueOf(model.getValueAt(table.getSelectedRow(), 0));
int j = JOptionPane.showConfirmDialog(null, "¿Seguro que desea borrar la pelicula " + "\"" + name + "\"" + "?, esta acción no es reversible", name, JOptionPane.YES_NO_OPTION);
if (j == JOptionPane.YES_OPTION) {
for (int i = 0; i < model.getRowCount(); i++) {
if (model.getValueAt(i, 0).equals(name)) {
model.removeRow(i);
File archivo = new File("mispeliculas.txt");
FileHandle a = new FileHandle();
a.delete(archivo, name);
}
}
}
} catch (ArrayIndexOutOfBoundsException e) {
JOptionPane.showMessageDialog(null, "No hay peliculas seleccionadas", "Error", JOptionPane.ERROR_MESSAGE);
}
}//GEN-LAST:event_deleteMouseClicked
private void deleteMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteMouseEntered
delete.setBackground(new Color(255, 51, 51));
delete.setForeground(Color.WHITE);
}//GEN-LAST:event_deleteMouseEntered
private void deleteMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteMouseExited
delete.setBackground(Color.WHITE);
delete.setForeground(new Color(255, 51, 51));
}//GEN-LAST:event_deleteMouseExited
private void modifyMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modifyMouseEntered
modify.setForeground(Color.WHITE);
modify.setBackground(new Color(0, 153, 0));
}//GEN-LAST:event_modifyMouseEntered
private void modifyMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modifyMouseExited
modify.setForeground(new Color(0, 153, 0));
modify.setBackground(Color.WHITE);
}//GEN-LAST:event_modifyMouseExited
public static String nombre;
public static String fichero;
private void modifyMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modifyMouseClicked
try {
DefaultTableModel model = (DefaultTableModel) table.getModel();
String name = String.valueOf(model.getValueAt(table.getSelectedRow(), 0));
nombre=name;
String campos[]=FileHandle.getField(nombre,3).split("/");
fichero=campos[3];
String durcombo = String.valueOf(model.getValueAt(table.getSelectedRow(), 1));
String clasicombo = String.valueOf(model.getValueAt(table.getSelectedRow(), 2));
JLabel portada=(JLabel)model.getValueAt(table.getSelectedRow(), 3);
EditPeliculas ventana = new EditPeliculas(name, durcombo,clasicombo,portada);
ventana.setVisible(true);
} catch (ArrayIndexOutOfBoundsException e) {
JOptionPane.showMessageDialog(null, "No hay peliculas seleccionadas", "Error", JOptionPane.ERROR_MESSAGE);
}
}//GEN-LAST:event_modifyMouseClicked
private void volverMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volverMouseClicked
Admin u = new Admin();
this.setVisible(false);
u.setVisible(true);
}//GEN-LAST:event_volverMouseClicked
private void volverMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volverMouseEntered
volver.setBackground(new Color(231, 231, 231));
}//GEN-LAST:event_volverMouseEntered
private void volverMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volverMouseExited
volver.setBackground(new Color(255, 255, 255));
}//GEN-LAST:event_volverMouseExited
private void addMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addMouseClicked
AddPeliculas ventana=new AddPeliculas();
ventana.setVisible(true);
}//GEN-LAST:event_addMouseClicked
private void addMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addMouseEntered
add.setForeground(Color.WHITE);
add.setBackground(new Color(0,102,255));
}//GEN-LAST:event_addMouseEntered
private void addMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addMouseExited
add.setForeground(new Color(0,102,255));
add.setBackground(Color.WHITE);
}//GEN-LAST:event_addMouseExited
private void close1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_close1MouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_close1MouseClicked
private void close1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_close1MouseEntered
// TODO add your handling code here:
}//GEN-LAST:event_close1MouseEntered
private void close1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_close1MouseExited
// TODO add your handling code here:
}//GEN-LAST:event_close1MouseExited
private void volver1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volver1MouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_volver1MouseClicked
private void volver1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volver1MouseEntered
// TODO add your handling code here:
}//GEN-LAST:event_volver1MouseEntered
private void volver1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volver1MouseExited
// TODO add your handling code here:
}//GEN-LAST:event_volver1MouseExited
private void topbar1MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_topbar1MouseDragged
// TODO add your handling code here:
}//GEN-LAST:event_topbar1MouseDragged
private void topbar1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_topbar1MousePressed
// TODO add your handling code here:
}//GEN-LAST:event_topbar1MousePressed
private void delete1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_delete1MouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_delete1MouseClicked
private void delete1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_delete1MouseEntered
// TODO add your handling code here:
}//GEN-LAST:event_delete1MouseEntered
private void delete1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_delete1MouseExited
// TODO add your handling code here:
}//GEN-LAST:event_delete1MouseExited
private void modify1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modify1MouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_modify1MouseClicked
private void modify1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modify1MouseEntered
// TODO add your handling code here:
}//GEN-LAST:event_modify1MouseEntered
private void modify1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modify1MouseExited
// TODO add your handling code here:
}//GEN-LAST:event_modify1MouseExited
private void refreshMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_refreshMouseClicked
DefaultTableModel model=(DefaultTableModel) table.getModel();
model.setRowCount(0);
Refresh();
}//GEN-LAST:event_refreshMouseClicked
private void refreshMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_refreshMouseEntered
refresh.setBackground(new Color(153,0,153));
refresh.setForeground(Color.WHITE);
}//GEN-LAST:event_refreshMouseEntered
private void refreshMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_refreshMouseExited
refresh.setBackground(Color.WHITE);
refresh.setForeground(new Color(153,0,153));
}//GEN-LAST:event_refreshMouseExited
/**
* bo
*
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ListaPeliculas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ListaPeliculas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ListaPeliculas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ListaPeliculas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ListaPeliculas().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel add;
private javax.swing.JPanel back;
private javax.swing.JPanel back1;
private javax.swing.JLabel close;
private javax.swing.JLabel close1;
private javax.swing.JLabel delete;
private javax.swing.JLabel delete1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JLabel modify;
private javax.swing.JLabel modify1;
private javax.swing.JLabel refresh;
private javax.swing.JTable table;
private javax.swing.JTable table1;
private javax.swing.JLabel title;
private javax.swing.JLabel title1;
private javax.swing.JLabel topbar;
private javax.swing.JLabel topbar1;
private javax.swing.JLabel volver;
private javax.swing.JLabel volver1;
// End of variables declaration//GEN-END:variables
}
| [
"Jesus David@JesusDavid"
] | Jesus David@JesusDavid |
fdcf4e5227a2666fd72fd8d6129758b87a0f533d | 51d05106ddd3494f0b6098cc97653ffac4896b70 | /motorMain/src/main/java/test/ZipTest.java | f345810ab39c709aa0e1ed5ac3523b2fc1067e7a | [] | no_license | cyf120209/motor | f6ed18d334abba370f5794d20a0328f0f56188de | c3f2a0c83439e5447c77bb0966744654d849d899 | refs/heads/master | 2021-09-22T14:33:26.528610 | 2018-08-30T08:26:46 | 2018-08-30T08:26:46 | 103,228,108 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,121 | java | package test;
import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
public class ZipTest {
public static void main(String[] args) {
ZipTest zipTest = new ZipTest();
zipTest.readZip();
}
/**
* 读取zip文件内容
*/
private void readZip() {
File fil = new File("D:\\Android\\Android.zip");
ZipInputStream zipIn = null;
try {
zipIn = new ZipInputStream(new FileInputStream(fil));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ZipEntry zipEn = null;
/**
* 需要读取zip文件项的内容时,需要ZipFile类的对象的getInputStream方法取得该项的内容,
* 然后传递给InputStreamReader的构造方法创建InputStreamReader对象,
* 最后使用此InputStreamReader对象创建BufferedReader实例
* 至此已把zip文件项的内容读出到缓存中,可以遍历其内容
*/
ZipFile zfil = null;
try {
zfil = new ZipFile("D:\\Android\\Android.zip");
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
while ((zipEn = zipIn.getNextEntry()) != null) {
if (!zipEn.isDirectory()) { // 判断此zip项是否为目录
System.out.println(zipEn.getName() + ":\t");
/**
* 把是文件的zip项读出缓存,
* zfil.getInputStream(zipEn):返回输入流读取指定zip文件条目的内容 zfil:new
* ZipFile();供阅读的zip文件 zipEn:zip文件中的某一项
*/
// BufferedReader buff = new BufferedReader(
// new InputStreamReader(zfil.getInputStream(zipEn)));
// String str;
// while ((str = buff.readLine()) != null) {
// System.out.println("\t" + str);
// }
// buff.close();
long size = zipEn.getSize();
byte[] b = new byte[(int) size];
InputStream is = zfil.getInputStream(zipEn);
BufferedInputStream bis = new BufferedInputStream(is);
while (bis.available()>0){
bis.read(b);
}
String s = new String(b);
System.out.println("\t"+s);
bis.close();
}
zipIn.closeEntry();// 关闭当前打开的项
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
zfil.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
524faebb173e39c8c07fb42007ff5655e806c916 | 9b9c3236cc1d970ba92e4a2a49f77efcea3a7ea5 | /L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/quests/Q00365_DevilsLegacy/Q00365_DevilsLegacy.java | 55ad11451bf2356d015dbc384494c77d085a61e3 | [] | no_license | BETAJIb/ikol | 73018f8b7c3e1262266b6f7d0a7f6bbdf284621d | f3709ea10be2d155b0bf1dee487f53c723f570cf | refs/heads/master | 2021-01-05T10:37:17.831153 | 2019-12-24T22:23:02 | 2019-12-24T22:23:02 | 240,993,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,058 | java | /*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package quests.Q00365_DevilsLegacy;
import java.util.HashMap;
import java.util.Map;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestState;
/**
* Devil's Legacy (365)
* @author Adry_85
*/
public class Q00365_DevilsLegacy extends Quest
{
// NPCs
private static final int COLLOB = 30092;
private static final int RANDOLF = 30095;
// Item
private static final int PIRATES_TREASURE_CHEST = 5873;
// Rewards
private static final int ENCHANT_WEAPON_C = 951;
private static final int ENCHANT_ARMOR_C = 952;
private static final int ENCHANT_WEAPON_D = 955;
private static final int ENCHANT_ARMOR_D = 956;
private static final int THREAD = 1868;
private static final int ANIMAL_BONE = 1872;
private static final int COKES = 1879;
private static final int STEEL = 1880;
private static final int COARSE_BONE_POWDER = 1881;
private static final int LEATHER = 1882;
private static final int CORD = 1884;
// Misc
private static final int MIN_LEVEL = 39;
// Skill
private static SkillHolder POISON = new SkillHolder(4035, 2);
// Mobs
private static final Map<Integer, Double> MOBS = new HashMap<>();
static
{
MOBS.put(20836, 0.47); // pirates_zombie
MOBS.put(20845, 0.40); // pirates_zombie_captain
MOBS.put(21629, 0.40); // pirates_zombie_captain_1
MOBS.put(21630, 0.40); // pirates_zombie_captain_2
}
public Q00365_DevilsLegacy()
{
super(365);
addStartNpc(RANDOLF);
addTalkId(RANDOLF, COLLOB);
addKillId(MOBS.keySet());
registerQuestItems(PIRATES_TREASURE_CHEST);
}
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if (qs == null)
{
return htmltext;
}
switch (event)
{
case "30095-02.htm":
{
qs.startQuest();
qs.setMemoState(1);
htmltext = event;
break;
}
case "30095-05.html":
{
qs.exitQuest(true, true);
htmltext = event;
break;
}
case "30095-06.html":
{
htmltext = event;
break;
}
case "REWARD":
{
if (!qs.isMemoState(1))
{
htmltext = "30092-04.html";
}
else if (!hasQuestItems(player, PIRATES_TREASURE_CHEST))
{
htmltext = "30092-02.html";
}
else if (player.getAdena() < 600)
{
htmltext = "30092-03.html";
}
else
{
final int itemId;
final int chance;
if (getRandom(100) < 80)
{
chance = getRandom(100);
if (chance < 1)
{
itemId = ENCHANT_WEAPON_D;
}
else if (chance < 4)
{
itemId = ENCHANT_ARMOR_D;
}
else if (chance < 36)
{
itemId = THREAD;
}
else if (chance < 68)
{
itemId = CORD;
}
else
{
itemId = ANIMAL_BONE;
}
htmltext = "30092-05.html";
}
else
{
chance = getRandom(1000);
if (chance < 10)
{
itemId = ENCHANT_WEAPON_C;
}
else if (chance < 40)
{
itemId = ENCHANT_ARMOR_C;
}
else if (chance < 60)
{
itemId = ENCHANT_WEAPON_D;
}
else if (chance < 260)
{
itemId = ENCHANT_ARMOR_D;
}
else if (chance < 445)
{
itemId = COKES;
}
else if (chance < 630)
{
itemId = STEEL;
}
else if (chance < 815)
{
itemId = LEATHER;
}
else
{
itemId = COARSE_BONE_POWDER;
}
npc.setTarget(player);
npc.doCast(POISON.getSkill());
npc.setCurrentMp(npc.getMaxMp());
qs.setMemoState(2);
htmltext = "30092-06.html";
}
takeItems(player, PIRATES_TREASURE_CHEST, 1);
takeItems(player, Inventory.ADENA_ID, 600);
rewardItems(player, itemId, 1);
}
break;
}
}
return htmltext;
}
@Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if (qs != null)
{
giveItemRandomly(qs.getPlayer(), npc, PIRATES_TREASURE_CHEST, 1, 0, MOBS.get(npc.getId()), true);
}
return super.onKill(npc, player, isSummon);
}
@Override
public String onTalk(Npc npc, PlayerInstance player)
{
final QuestState qs = getQuestState(player, true);
String htmltext = getNoQuestMsg(player);
switch (npc.getId())
{
case RANDOLF:
{
if (qs.isCreated())
{
htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30095-01.htm" : "30095-03.html");
}
else if (qs.isStarted())
{
if (hasQuestItems(player, PIRATES_TREASURE_CHEST))
{
final long chestCount = getQuestItemsCount(player, PIRATES_TREASURE_CHEST);
giveAdena(player, (chestCount * 400) + 19800, true);
takeItems(player, PIRATES_TREASURE_CHEST, -1);
htmltext = "30095-04.html";
}
else
{
htmltext = "30095-07.html";
}
}
break;
}
case COLLOB:
{
if (qs.isStarted())
{
htmltext = (qs.isMemoState(1) ? "30092-01.html" : "30092-07.html");
}
break;
}
}
return htmltext;
}
}
| [
"[email protected]"
] | |
ba76695a649be616b1337912febc162ab96e53d8 | f860e709ba232caffe4f8f77bfa9d7c91822df3b | /src/java/controller/Hanggiuacontroller.java | d10ca2986957b2fecf1d3bae50c3463cdfdb1f0f | [] | no_license | theanhhp/asm_Front-End-Frameworks | cbde4ce82ef31687ded57eac94400d4c5747d3da | 2ef548530c7fc186ede20f4797e65b91a57f500b | refs/heads/master | 2020-06-06T07:13:16.459868 | 2019-06-19T06:52:53 | 2019-06-19T06:52:53 | 192,674,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,980 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package controller;
import entity.Hanggiua;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
/**
*
* @author trant
*/
@Transactional
@Controller
@RequestMapping("/Hanggiua")
public class Hanggiuacontroller {
@Autowired
SessionFactory factory;
@RequestMapping()
public String index(ModelMap model) {
model.addAttribute("Hanggiua", new Hanggiua());
model.addAttribute("Hanggiuas", getHanggiua());
return "Hanggiua";
}
@RequestMapping(params = "btnInsert")
public String insert(ModelMap model, @ModelAttribute("Hanggiua") Hanggiua Hanggiua , Integer id) {
Session session = factory.openSession();
Transaction t = session.beginTransaction();
try {
if (id < 8) {
session.save(Hanggiua);
t.commit();
model.addAttribute("message", "Thêm mới thành công !");
} else {
t.rollback();
model.addAttribute("message", "Thêm mới thất bại !");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
session.close();
}
model.addAttribute("Hanggiuas", getHanggiua());
return "Hanggiua";
}
@RequestMapping(params = "btnUpdate")
public String update(ModelMap model, @ModelAttribute("Hanggiua") Hanggiua Hanggiua) {
Session session = factory.openSession();
Transaction t = session.beginTransaction();
try {
session.update(Hanggiua);
t.commit();
model.addAttribute("message", "Cập nhật thành công !");
} catch (Exception e) {
t.rollback();
model.addAttribute("message", "Cập nhật thành công !");
} finally {
session.close();
}
model.addAttribute("Hanggiuas", getHanggiua());
return "Hanggiua";
}
@RequestMapping(params = "btnDelete")
public String delete(ModelMap model, Hanggiua Hanggiua) {
Session session = factory.openSession();
Transaction t = session.beginTransaction();
try {
session.delete(Hanggiua);
t.commit();
model.addAttribute("message", "Xóa thành công !");
} catch (Exception e) {
t.rollback();
model.addAttribute("message", "Xóa thất bại !");
} finally {
session.close();
}
model.addAttribute("Hanggiua", new Hanggiua());
model.addAttribute("Hanggiuas", getHanggiua());
return "Hanggiua";
}
@RequestMapping("{id}")
public String edit(ModelMap model, @PathVariable("id") Integer id) {
Session session = factory.openSession();
Hanggiua Hanggiua = (Hanggiua) session.get(Hanggiua.class, id);
model.addAttribute("Hanggiua", Hanggiua);
model.addAttribute("Hanggiuas", getHanggiua());
return "Hanggiua";
}
@ModelAttribute("Hanggiuas")
@SuppressWarnings("unchecked")
public List<Hanggiua> getHanggiua() {
Session session = factory.openSession();
String hql = "FROM Hanggiua";
Query query = session.createQuery(hql);
List<Hanggiua> list = query.list();
return list;
}
}
| [
"="
] | = |
f6a47bdd6d944aa73e929f0ad8b8565065e69839 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-chimesdkmediapipelines/src/main/java/com/amazonaws/services/chimesdkmediapipelines/model/ThrottledClientException.java | 05e2a1f9f91d2c44eb15f6220fc6d102e324ad5b | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 3,546 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.chimesdkmediapipelines.model;
import javax.annotation.Generated;
/**
* <p>
* The client exceeded its request rate limit.
* </p>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ThrottledClientException extends com.amazonaws.services.chimesdkmediapipelines.model.AmazonChimeSDKMediaPipelinesException {
private static final long serialVersionUID = 1L;
private String code;
/**
* <p>
* The request ID associated with the call responsible for the exception.
* </p>
*/
private String requestId;
/**
* Constructs a new ThrottledClientException with the specified error message.
*
* @param message
* Describes the error encountered.
*/
public ThrottledClientException(String message) {
super(message);
}
/**
* @param code
* @see ErrorCode
*/
@com.fasterxml.jackson.annotation.JsonProperty("Code")
public void setCode(String code) {
this.code = code;
}
/**
* @return
* @see ErrorCode
*/
@com.fasterxml.jackson.annotation.JsonProperty("Code")
public String getCode() {
return this.code;
}
/**
* @param code
* @return Returns a reference to this object so that method calls can be chained together.
* @see ErrorCode
*/
public ThrottledClientException withCode(String code) {
setCode(code);
return this;
}
/**
* @param code
* @return Returns a reference to this object so that method calls can be chained together.
* @see ErrorCode
*/
public ThrottledClientException withCode(ErrorCode code) {
this.code = code.toString();
return this;
}
/**
* <p>
* The request ID associated with the call responsible for the exception.
* </p>
*
* @param requestId
* The request ID associated with the call responsible for the exception.
*/
@com.fasterxml.jackson.annotation.JsonProperty("RequestId")
public void setRequestId(String requestId) {
this.requestId = requestId;
}
/**
* <p>
* The request ID associated with the call responsible for the exception.
* </p>
*
* @return The request ID associated with the call responsible for the exception.
*/
@com.fasterxml.jackson.annotation.JsonProperty("RequestId")
public String getRequestId() {
return this.requestId;
}
/**
* <p>
* The request ID associated with the call responsible for the exception.
* </p>
*
* @param requestId
* The request ID associated with the call responsible for the exception.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ThrottledClientException withRequestId(String requestId) {
setRequestId(requestId);
return this;
}
}
| [
""
] | |
e71b1c51f6bb29fe3d0ccf3770cd659451a554ef | 334b8028bc22989212da33159a8434227f30cb1b | /src/salary/org/jsoft/salary/dao/impl/SalaryDAO.java | 822caa90455708db3180995d077fc2d3aeb43a45 | [] | no_license | dongyating/personnel19 | 0be434650c53e5516f53fa90d1975fa65bb505a7 | e863421f37c93b7db66fd09d1457db049db533b0 | refs/heads/master | 2021-05-28T20:50:53.230134 | 2015-03-18T19:29:00 | 2015-03-18T19:29:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,673 | java | package org.jsoft.salary.dao.impl;
import java.util.ArrayList;
import java.util.List;
import org.jsoft.comm.dao.impl.BaseDAO;
import org.jsoft.comm.vo.Bak;
import org.jsoft.comm.vo.DeptJobRel;
import org.jsoft.comm.vo.PageDivid;
import org.jsoft.comm.vo.Salary;
import org.jsoft.salary.dao.ISalaryDAO;
public class SalaryDAO extends BaseDAO<Object> implements ISalaryDAO
{
@Override
public Salary querySalary(String salaryId)
{
String hql = "from Salary where salaryId = " + salaryId;
List<Object> list = find(hql);
Salary salary = (Salary) list.get(0);
return salary;
}
@Override
public void updateSalary(Salary salary)
{
update(salary);
}
@Override
public DeptJobRel queryDeptJobRel(String jobid, String deptid)
{
// TODO Auto-generated method stub
String hql = "from DeptJobRel where department.departmentId=? and job.jobId=? ";
List<Object> paraments = new ArrayList<Object>();
paraments.add(jobid);
paraments.add(deptid);
List<Object> list = find(hql, paraments);
DeptJobRel d = (DeptJobRel) list.get(0);
return d;
}
@Override
public int AllCount()
{
String hql = "select count(*) From DeptJobRel where isDelete=?";
List<Object> paraments = new ArrayList<Object>();
paraments.add(0);
int a = Integer.parseInt(count(hql, paraments) + "");
return a;
// TODO Auto-generated method stub
}
public int AllCount2()
{
String hql = "select count(*) From DeptJobRel where isDelete=? and salary is null";
List<Object> paraments = new ArrayList<Object>();
paraments.add(0);
int a = Integer.parseInt(count(hql, paraments) + "");
System.out.println("我要输出总页数了 a A AA A A ");
System.out.println(a);
return a;
}
@Override
public List<DeptJobRel> queryAll(PageDivid pageDivid)
{
BaseDAO<DeptJobRel> base = new BaseDAO<DeptJobRel>();
String hql = "From DeptJobRel where isDelete=? and salary is not null";
List<Object> paraments = new ArrayList<Object>();
paraments.add(0);
List<DeptJobRel> baks = base.find(hql, paraments, pageDivid);
return baks;
}
@Override
public void saveSalary(Salary salary)
{
save(salary);
// TODO Auto-generated method stub
}
@Override
public DeptJobRel queryDeptJobRelbyId(String DeptJobRelId)
{
// TODO Auto-generated method stub
String hql = "from DeptJobRel where deptJobRelId =" + DeptJobRelId;
return (DeptJobRel) (find(hql).get(0));
}
public static void main(String[] args)
{
SalaryDAO sa = new SalaryDAO();
DeptJobRel d = sa.queryDeptJobRelbyId("2");
System.out.println(d.getJob().getJobName());
}
}
| [
"[email protected]"
] | |
5406d98c6b134cf3bfd8f94afe9891ca661222a9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/1/1_07b90692d7708c480911010589e0ce4fc203329a/RemoveRegionDialog/1_07b90692d7708c480911010589e0ce4fc203329a_RemoveRegionDialog_s.java | d3afb8bfff43fd1f06186dd5d20c8b98c874908f | [] | 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 | 3,001 | java | package org.dawb.workbench.plotting.system.dialog;
import org.dawb.common.ui.plot.region.IRegion;
import org.dawb.workbench.plotting.system.swtxy.RegionArea;
import org.dawb.workbench.plotting.system.swtxy.XYRegionGraph;
import org.dawb.workbench.plotting.system.swtxy.selection.AbstractSelectionRegion;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
/**The dialog for removing annotation.
* @author Xihui Chen
* @author Kay Kasemir layout tweaks
*/
public class RemoveRegionDialog extends Dialog {
private XYRegionGraph xyGraph;
private Combo regionCombo;
private AbstractSelectionRegion removedRegion;
public RemoveRegionDialog(Shell parentShell, XYRegionGraph xyGraph) {
super(parentShell);
this.xyGraph = xyGraph;
// Allow resize
setShellStyle(getShellStyle() | SWT.RESIZE);
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Remove Region");
}
@Override
protected Control createDialogArea(Composite parent) {
final Composite parent_composite = (Composite) super.createDialogArea(parent);
final Composite composite = new Composite(parent_composite, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
composite.setLayout(new GridLayout(1, false));
final Label removeLabel = new Label(composite, SWT.None);
removeLabel.setLayoutData(new GridData());
if(((RegionArea)xyGraph.getPlotArea()).getRegionMap().size() > 0){
removeLabel.setText("Select the region to be removed: ");
regionCombo = new Combo(composite, SWT.DROP_DOWN);
regionCombo.setLayoutData(new GridData(SWT.FILL, 0, true, false));
final RegionArea regArea = (RegionArea)xyGraph.getPlotArea();
for (String name : regArea.getRegionMap().keySet()) {
final AbstractSelectionRegion region = regArea.getRegion(name);
regionCombo.add(region.getName());
}
regionCombo.select(0);
}else{
removeLabel.setText("There are no selection regions on the graph.");
}
return parent_composite;
}
@Override
protected void okPressed() {
if(regionCombo != null) {
final int index = regionCombo.getSelectionIndex();
removedRegion = ((RegionArea)xyGraph.getPlotArea()).getRegions().get(index);
}
super.okPressed();
}
/**
* @return the annotation to be removed.
*/
public AbstractSelectionRegion getRegion() {
return removedRegion;
}
}
| [
"[email protected]"
] | |
05a18e593050bfc307f7bbf953086a8988f5dff1 | 11b5c6aea88051838685f2597e1fd4a580433c56 | /src/main/java/com/leetcode/number/Solution36.java | ae930978a0a848ffd2eb98efbd4257125dccdf12 | [] | no_license | coolxll/LeetCodePractise | 93e71591bc58c8aa66797c3d85111d092805f6ab | 5b53dd6794509b4120245cbce66e337f88c0e18e | refs/heads/master | 2022-06-20T21:24:00.706278 | 2021-06-07T11:51:49 | 2021-06-07T11:51:49 | 244,534,971 | 0 | 0 | null | 2022-06-17T03:00:40 | 2020-03-03T03:43:51 | Java | UTF-8 | Java | false | false | 1,345 | java | package com.leetcode.number;
import java.util.HashMap;
public class Solution36 {
public boolean isValidSudoku(char[][] board) {
//init data
HashMap<Integer, Integer>[] rows = new HashMap[9];
HashMap<Integer, Integer>[] columns = new HashMap[9];
HashMap<Integer, Integer>[] boxes = new HashMap[9];
for (int i = 0; i < 9; i++) {
rows[i] = new HashMap<>();
columns[i] = new HashMap<>();
boxes[i] = new HashMap<>();
}
//validate a board
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
char num = board[i][j];
if (num != '.') {
int n = num - '0';
int box_index = (i / 3 ) * 3 + j / 3;
// keep the current cell value
rows[i].put(n, rows[i].getOrDefault(n, 0) + 1);
columns[j].put(n, columns[j].getOrDefault(n, 0) + 1);
boxes[box_index].put(n, boxes[box_index].getOrDefault(n, 0) + 1);
// check if this value has been already seen before
if (rows[i].get(n) > 1 || columns[j].get(n) > 1 || boxes[box_index].get(n) > 1)
return false;
}
}
}
return true;
}
}
| [
"[email protected]"
] | |
ccce4f6c8d2e40f02d4f7675df9d55567d479c2e | a5d1355228908daf110db93a8641f212f5e9fbb1 | /src/main/java/gov/va/oit/vistaevolution/mailman/ws/xma2r/model/AbstractXMA2RRequest.java | a65798700486e46b145933091f4b4b70398cf3a0 | [] | no_license | MillerTom/Evolution | 24d10c0cad9887fcfeee5266a69fa9d98df66334 | 448a3136fa2205c12f135a432f7912317195482a | refs/heads/master | 2016-08-12T16:56:18.896488 | 2016-01-01T01:53:03 | 2016-01-01T01:53:03 | 48,867,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,737 | java | package gov.va.oit.vistaevolution.mailman.ws.xma2r.model;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
/**
* @author Tom Miller<[email protected]>
*
*/
public abstract class AbstractXMA2RRequest {
/**
* duz:
*
* (optional) User's DUZ. If DUZ is not defined, it defaults to the
* Postmaster. This is who is really sending the message.
*
* xmduz:
*
* (required) User's DUZ or FREE TEXT. This is from whom the message will
* appear to be. If it is not defined, it defaults to DUZ. (If DUZ is not
* defined, it defaults to Postmaster.) If it is FREE TEXT, it must not be
* more than 70 characters.
*
* xmsub:
*
* (required) Subject of the message, It should be from 3 to 65 characters
* in length.
*
* xmtext :
*
* (required) The name of the array (in open format) containing the text of
* the message. The array itself may be a local or a global variable, and it
* must be in a format acceptable to VA FileMan WORD-PROCESSING fields.
*
* xmz :
*
* (required) Message IEN in the MESSAGE file (#3.9)
*
* xmstrip :
*
* (optional) String containing characters that should be removed from the
* answer text. Default is none.
*/
@XmlElement(required = false)
protected String duz;
@XmlElement(required = true)
protected String xmduz;
@XmlElement(required = true)
protected String xmsub;
@XmlElementWrapper(name = "text")
@XmlElement(name = "entry", required = true)
protected List<String> xmtext;
@XmlElement(required = true)
protected String xmz;
@XmlElement(required = false)
protected String xmstrip;
/**
* Default Empty Constructor
*/
public AbstractXMA2RRequest() {
super();
}
/**
*
* Parameterised Constructor
*
* @param duz
* @param xmduz
* @param xmsub
* @param xmtext
* @param xmz
* @param xmstrip
*/
public AbstractXMA2RRequest(String duz, String xmduz, String xmsub,
List<String> xmtext, String xmz, String xmstrip) {
super();
this.duz = duz;
this.xmduz = xmduz;
this.xmsub = xmsub;
this.xmtext = xmtext;
this.xmz = xmz;
this.xmstrip = xmstrip;
}
/**
* Mandatory Parameters Constructor
*
* @param xmduz
* @param xmsub
* @param xmtext
* @param xmz
*/
public AbstractXMA2RRequest(String xmduz, String xmsub,
List<String> xmtext, String xmz) {
super();
this.xmduz = xmduz;
this.xmsub = xmsub;
this.xmtext = xmtext;
this.xmz = xmz;
}
/**
* @return the duz
*/
public String getDuz() {
return duz;
}
/**
* @param duz
* the duz to set
*/
protected void setDuz(String duz) {
this.duz = duz;
}
/**
* @return the xmduz
*/
public String getXmduz() {
return xmduz;
}
/**
* @param xmduz
* the xmduz to set
*/
protected void setXmduz(String xmduz) {
this.xmduz = xmduz;
}
/**
* @return the xmsub
*/
public String getXmsub() {
return xmsub;
}
/**
* @param xmsub
* the xmsub to set
*/
protected void setXmsub(String xmsub) {
this.xmsub = xmsub;
}
/**
* @return the xmtext
*/
public List<String> getXmtext() {
return xmtext;
}
/**
* @param xmtext
* the xmtext to set
*/
protected void setXmtext(List<String> xmtext) {
this.xmtext = xmtext;
}
/**
* @return the xmz
*/
public String getXmz() {
return xmz;
}
/**
* @param xmz
* the xmz to set
*/
protected void setXmz(String xmz) {
this.xmz = xmz;
}
/**
* @return the xmstrip
*/
public String getXmstrip() {
return xmstrip;
}
/**
* @param xmstrip
* the xmstrip to set
*/
protected void setXmstrip(String xmstrip) {
this.xmstrip = xmstrip;
}
}
| [
"[email protected]"
] | |
10b947694d91b8c6aafd6ee62642f8bab664ef55 | 5c1aaa432d832579a653c49b2a475b974795c2a4 | /src/main/java/itba/pdc/admin/filter/ManageFilter.java | 1f8359ecf504599926527fab45c1f5a935d77e31 | [] | no_license | bahui80/HTTP-Proxy | 0cfee14f92f4f7668dfc0577cf764099a9221db2 | b84196efebf2fba9a1e0c479af04e7393a94cc3f | refs/heads/master | 2020-09-25T01:40:28.407786 | 2013-11-20T14:01:39 | 2013-11-20T14:01:39 | 66,895,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | package itba.pdc.admin.filter;
import java.nio.ByteBuffer;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
public class ManageFilter {
private static ManageFilter instance = null;
private ConcurrentLinkedQueue<Filter> filters = null;
private Set<String> set;
private ManageFilter() {
if (instance != null) {
throw new IllegalAccessError("This class is already isntantiated");
}
filters = new ConcurrentLinkedQueue<Filter>();
set = new HashSet<String>();
}
public static ManageFilter getInstace() {
if (instance == null) {
instance = new ManageFilter();
}
return instance;
}
public void addOrRemoveFilter(FilterStatus filterStatus) {
switch (filterStatus) {
case TRANSFORMER:
TransformationFilter f = TransformationFilter.getInstace();
if (filters.contains(f)) {
set.remove(FilterStatus.TRANSFORMER.toString());
filters.remove(f);
} else {
set.add(FilterStatus.TRANSFORMER.toString());
filters.add(f);
}
break;
default:
break;
}
}
public void doFilters(ByteBuffer buffer) {
for (Filter f : filters) {
f.doFilter(buffer);
}
}
public Set<String> getSet() {
return set;
}
}
| [
"[email protected]"
] | |
0e91aba004bf35fa8bc56e987cc0f1af5b13cce6 | 4faacf02003e2f9304490bf5c1bacab77ac8c30c | /java05/src/loop/WhileTest4.java | fb5c45ba460861e20f6e9611a5f86ecd8ef754e8 | [] | no_license | heffy127/bigdata_java | 44933a50586c65dda65f2aa75936ec82117a7a3c | 9086a29af3364af1d9cdf23597a6c81d86511a08 | refs/heads/master | 2020-05-14T13:27:18.631178 | 2019-07-09T06:05:27 | 2019-07-09T06:05:27 | 181,812,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 557 | java | package loop;
import javax.swing.JOptionPane;
//두 개의 입력 값을 받아서,
//첫 번째 값부터 두 번째 값까지 더함
public class WhileTest4 {
public static void main(String[] args) {
int num1 = Integer.parseInt(JOptionPane.showInputDialog("첫 번째 값 입력 : "));
int num2 = Integer.parseInt(JOptionPane.showInputDialog("두 번째 값 입력 : "));
int sum = 0;
while(num1 <= num2) {
sum += num1;
num1++;
}
JOptionPane.showMessageDialog(null, "첫 번째 값 + 두 번째 값 = " + sum);
}
}
| [
"[email protected]"
] | |
7cff5732dda42a69c23f9f0a90740322a83fe93a | 7f1b4e346fb0968af22c51f1c55384c61f772ceb | /GmailMaven/src/main/java/gmail/test/GmailMaven/App.java | 4edc277574feb8f8b339f7604c806bef18083a35 | [] | no_license | NikhilRaj25/Niks | 2da0f0de30d38a1f1350be125923bdec556e2c3b | a92cdab2993ea76dddd8a51656143aae556ab1fe | refs/heads/master | 2023-05-10T22:05:30.916819 | 2019-08-18T17:46:15 | 2019-08-18T17:46:15 | 200,024,690 | 0 | 0 | null | 2023-05-09T18:11:45 | 2019-08-01T09:53:10 | Java | UTF-8 | Java | false | false | 197 | java | package gmail.test.GmailMaven;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"NIKHIL@LAPTOP-KJSGBRV1"
] | NIKHIL@LAPTOP-KJSGBRV1 |
32ced481ac43231bdec544e02e1ea93746410d5b | 6eb9945622c34e32a9bb4e5cd09f32e6b826f9d3 | /src/com/inponsel/android/v2/RoomChatActivity$15.java | b601166be6a8a6f382320840c7ff085e1d94362c | [] | no_license | alexivaner/GadgetX-Android-App | 6d700ba379d0159de4dddec4d8f7f9ce2318c5cc | 26c5866be12da7b89447814c05708636483bf366 | refs/heads/master | 2022-06-01T09:04:32.347786 | 2020-04-30T17:43:17 | 2020-04-30T17:43:17 | 260,275,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.inponsel.android.v2;
import android.content.DialogInterface;
// Referenced classes of package com.inponsel.android.v2:
// RoomChatActivity
class this._cls0
implements android.content.ickListener
{
final RoomChatActivity this$0;
public void onClick(DialogInterface dialoginterface, int i)
{
dialoginterface.dismiss();
statJoinChat = "0";
RoomChatActivity.access$17(RoomChatActivity.this, RoomChatActivity.user_id, codename, "0", t, bottom_id);
}
ner()
{
this$0 = RoomChatActivity.this;
super();
}
}
| [
"[email protected]"
] | |
fc4da1de74e56851d83b1615c570658302b5bd25 | f4fd782488b9cf6d99d4375d5718aead62b63c69 | /com/planet_ink/coffee_mud/Races/Centaur.java | 8f19dfed5eda25ef201d1458f980d250896e5fc4 | [
"Apache-2.0"
] | permissive | sfunk1x/CoffeeMud | 89a8ca1267ecb0c2ca48280e3b3930ee1484c93e | 0ac2a21c16dfe3e1637627cb6373d34615afe109 | refs/heads/master | 2021-01-18T11:20:53.213200 | 2015-09-17T19:16:30 | 2015-09-17T19:16:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,444 | java | package com.planet_ink.coffee_mud.Races;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2001-2015 Bo Zimmerman
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.
*/
public class Centaur extends StdRace
{
@Override public String ID(){ return "Centaur"; }
@Override public String name(){ return "Centaur"; }
@Override public int shortestMale(){return 60;}
@Override public int shortestFemale(){return 60;}
@Override public int heightVariance(){return 12;}
@Override public int lightestWeight(){return 1150;}
@Override public int weightVariance(){return 400;}
@Override public long forbiddenWornBits(){return Wearable.WORN_WAIST|Wearable.WORN_LEGS|Wearable.WORN_FEET;}
@Override public String racialCategory(){return "Equine";}
@Override public boolean useRideClass() { return true; }
private final String[]culturalAbilityNames={"Elvish","Foraging"};
private final int[]culturalAbilityProficiencies={75,50};
@Override public String[] culturalAbilityNames(){return culturalAbilityNames;}
@Override public int[] culturalAbilityProficiencies(){return culturalAbilityProficiencies;}
// an ey ea he ne ar ha to le fo no gi mo wa ta wi
private static final int[] parts={0 ,2 ,2 ,1 ,1 ,2 ,2 ,1 ,4 ,4 ,1 ,0 ,1 ,1 ,1 ,0 };
@Override public int[] bodyMask(){return parts;}
protected static Vector<RawMaterial> resources=new Vector<RawMaterial>();
@Override public int availabilityCode(){return Area.THEME_FANTASY;}
@Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_SEE_INFRARED);
}
@Override
public void affectCharStats(MOB affectedMOB, CharStats affectableStats)
{
super.affectCharStats(affectedMOB, affectableStats);
affectableStats.setStat(CharStats.STAT_STRENGTH,affectableStats.getStat(CharStats.STAT_STRENGTH)+1);
affectableStats.setStat(CharStats.STAT_MAX_STRENGTH_ADJ,affectableStats.getStat(CharStats.STAT_MAX_STRENGTH_ADJ)+1);
affectableStats.setStat(CharStats.STAT_INTELLIGENCE,affectableStats.getStat(CharStats.STAT_INTELLIGENCE)+1);
affectableStats.setStat(CharStats.STAT_MAX_INTELLIGENCE_ADJ,affectableStats.getStat(CharStats.STAT_MAX_INTELLIGENCE_ADJ)+1);
affectableStats.setStat(CharStats.STAT_CHARISMA,affectableStats.getStat(CharStats.STAT_CHARISMA)-1);
affectableStats.setStat(CharStats.STAT_MAX_CHARISMA_ADJ,affectableStats.getStat(CharStats.STAT_MAX_CHARISMA_ADJ)-1);
affectableStats.setStat(CharStats.STAT_WISDOM,affectableStats.getStat(CharStats.STAT_WISDOM)-1);
affectableStats.setStat(CharStats.STAT_MAX_WISDOM_ADJ,affectableStats.getStat(CharStats.STAT_MAX_WISDOM_ADJ)-1);
}
@Override
public Weapon myNaturalWeapon()
{
if(naturalWeapon==null)
{
naturalWeapon=CMClass.getWeapon("StdWeapon");
naturalWeapon.setName(L("a pair of hooves"));
naturalWeapon.setMaterial(RawMaterial.RESOURCE_BONE);
naturalWeapon.setUsesRemaining(1000);
naturalWeapon.setWeaponType(Weapon.TYPE_BASHING);
}
return naturalWeapon;
}
@Override
public String makeMobName(char gender, int age)
{
switch(age)
{
case Race.AGE_INFANT:
case Race.AGE_TODDLER:
return name().toLowerCase()+" foal";
case Race.AGE_CHILD:
case Race.AGE_YOUNGADULT:
switch(gender)
{
case 'M': case 'm': return name().toLowerCase()+" colt";
case 'F': case 'f': return name().toLowerCase()+" filly";
default: return "young "+name().toLowerCase();
}
case Race.AGE_MATURE:
case Race.AGE_MIDDLEAGED:
default:
switch(gender)
{
case 'M': case 'm': return "male "+name().toLowerCase();
case 'F': case 'f': return "female "+name().toLowerCase();
default: return name().toLowerCase();
}
case Race.AGE_OLD:
case Race.AGE_VENERABLE:
case Race.AGE_ANCIENT:
switch(gender)
{
case 'M': case 'm': return "old male "+name().toLowerCase();
case 'F': case 'f': return "old female "+name().toLowerCase();
default: return "old "+name().toLowerCase();
}
}
}
@Override
public String healthText(MOB viewer, MOB mob)
{
final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints()));
if(pct<.10)
return L("^r@x1^r is hovering on deaths door!^N",mob.name(viewer));
else
if(pct<.20)
return L("^r@x1^r is covered in blood and matted hair.^N",mob.name(viewer));
else
if(pct<.30)
return L("^r@x1^r is bleeding badly from lots of wounds.^N",mob.name(viewer));
else
if(pct<.40)
return L("^y@x1^y has large patches of bloody matted fur.^N",mob.name(viewer));
else
if(pct<.50)
return L("^y@x1^y has some bloody matted fur.^N",mob.name(viewer));
else
if(pct<.60)
return L("^p@x1^p has a lot of cuts and gashes.^N",mob.name(viewer));
else
if(pct<.70)
return L("^p@x1^p has a few cut patches.^N",mob.name(viewer));
else
if(pct<.80)
return L("^g@x1^g has a cut patch of fur.^N",mob.name(viewer));
else
if(pct<.90)
return L("^g@x1^g has some disheveled fur.^N",mob.name(viewer));
else
if(pct<.99)
return L("^g@x1^g has some misplaced hairs.^N",mob.name(viewer));
else
return L("^c@x1^c is in perfect health.^N",mob.name(viewer));
}
@Override
public List<RawMaterial> myResources()
{
synchronized(resources)
{
if(resources.size()==0)
{
resources.addElement(makeResource
(""+name().toLowerCase()+" mane",RawMaterial.RESOURCE_FUR));
for(int i=0;i<2;i++)
resources.addElement(makeResource
("a strip of "+name().toLowerCase()+" leather",RawMaterial.RESOURCE_LEATHER));
resources.addElement(makeResource
("a pound of "+name().toLowerCase()+" meat",RawMaterial.RESOURCE_BEEF));
resources.addElement(makeResource
("some "+name().toLowerCase()+" blood",RawMaterial.RESOURCE_BLOOD));
resources.addElement(makeResource
("a pile of "+name().toLowerCase()+" bones",RawMaterial.RESOURCE_BONE));
}
}
return resources;
}
}
| [
"[email protected]"
] | |
22b328ebe9c95809be24716b566868ab94e09ab3 | f9c89f6c9ce3fb29a16a4bb6229922a2aa88b41f | /changmie/app/src/androidTest/java/com/hjchangmie/changmie/ApplicationTest.java | a2a8a7c398e5eb805156f4965c98f3d20a09b272 | [] | no_license | ljnwork/changmie | 4a9cfa5a24a0a249daff9d90b2a8e66ac5e2432f | fb0cd92b865931dd98ed61bf4e7cc8976689d23c | refs/heads/master | 2021-01-01T05:35:08.820860 | 2015-02-07T01:43:56 | 2015-02-07T01:43:56 | 30,439,751 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package com.hjchangmie.changmie;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
df8d7a8bc9a1802e6b265e378896d599c7e32937 | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Lang-9/org.apache.commons.lang3.time.FastDateParser/BBC-F0-opt-60/27/org/apache/commons/lang3/time/FastDateParser_ESTest.java | 947a283234d0974a4544539646adf5437a29e9f5 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 24,558 | java | /*
* This file was automatically generated by EvoSuite
* Sat Oct 23 09:48:10 GMT 2021
*/
package org.apache.commons.lang3.time;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.text.ParseException;
import java.text.ParsePosition;
import java.time.ZoneId;
import java.time.temporal.ChronoField;
import java.util.Date;
import java.util.Locale;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
import java.util.regex.Pattern;
import org.apache.commons.lang3.time.FastDateParser;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class FastDateParser_ESTest extends FastDateParser_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
TimeZone timeZone0 = TimeZone.getTimeZone("7)@WyFkK%(");
Locale locale0 = Locale.GERMANY;
FastDateParser fastDateParser0 = new FastDateParser("7)@WyFkK%(", timeZone0, locale0);
assertEquals("7)@WyFkK%(", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test01() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("5", timeZone0, locale0);
int int0 = fastDateParser0.adjustYear(3489);
assertEquals(5389, int0);
}
@Test(timeout = 4000)
public void test02() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(63, "");
Locale locale0 = Locale.FRANCE;
FastDateParser fastDateParser0 = new FastDateParser("zcQJ.Nc|qL-pCZw}", simpleTimeZone0, locale0);
boolean boolean0 = fastDateParser0.isNextNumber();
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test03() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(0, " not in (");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser(" not in (", simpleTimeZone0, locale0);
TimeZone timeZone0 = fastDateParser0.getTimeZone();
assertEquals(0, timeZone0.getRawOffset());
}
@Test(timeout = 4000)
public void test04() throws Throwable {
Locale locale0 = Locale.CHINA;
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(2764, "g1HyD}Y()6y?_&Bk*");
FastDateParser fastDateParser0 = new FastDateParser("dzJ%4", simpleTimeZone0, locale0);
TimeZone timeZone0 = fastDateParser0.getTimeZone();
assertEquals("g1HyD}Y()6y?_&Bk*", timeZone0.getID());
}
@Test(timeout = 4000)
public void test05() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(63, "");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser("hLMAA[[", simpleTimeZone0, locale0);
int int0 = fastDateParser0.adjustYear((-2280));
assertEquals((-280), int0);
}
@Test(timeout = 4000)
public void test06() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ".G4;");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser(".G4;", simpleTimeZone0, locale0);
ParsePosition parsePosition0 = new ParsePosition((-861034049));
// Undeclared exception!
// try {
fastDateParser0.parseObject("AET", parsePosition0);
// fail("Expecting exception: StringIndexOutOfBoundsException");
// } catch(StringIndexOutOfBoundsException e) {
// }
}
@Test(timeout = 4000)
public void test07() throws Throwable {
ZoneId zoneId0 = ZoneId.systemDefault();
TimeZone timeZone0 = TimeZone.getTimeZone(zoneId0);
Locale locale0 = FastDateParser.JAPANESE_IMPERIAL;
FastDateParser fastDateParser0 = new FastDateParser(")+5a^mb+", timeZone0, locale0);
ParsePosition parsePosition0 = new ParsePosition(42);
// Undeclared exception!
// try {
fastDateParser0.parseObject((String) null, parsePosition0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.lang3.time.FastDateParser", e);
// }
}
@Test(timeout = 4000)
public void test08() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.JAPANESE;
FastDateParser fastDateParser0 = new FastDateParser("a;ysog", timeZone0, locale0);
// try {
fastDateParser0.parseObject("GMTAET");
// fail("Expecting exception: ParseException");
// } catch(ParseException e) {
// //
// // Unparseable date: \"GMTAET\" does not match (\u5348\u524D|\u5348\u5F8C);(\\p{IsNd}{1}+)(\\p{IsNd}++)
// //
// verifyException("org.apache.commons.lang3.time.FastDateParser", e);
// }
}
@Test(timeout = 4000)
public void test09() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("D+|E+|F+|G+|H+|K+|M+|S+|W+|Z+|a+|d+|h+|k+|m+|s+|w+|y+|z+|''|'[^']++(''[^']*+)*+'|[^'A-Za-z]++", timeZone0, locale0);
// Undeclared exception!
// try {
fastDateParser0.parseObject((String) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.lang3.time.FastDateParser", e);
// }
}
@Test(timeout = 4000)
public void test10() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.KOREA;
FastDateParser fastDateParser0 = new FastDateParser("w.G)yyD~~qCB8fYp)j", timeZone0, locale0);
ParsePosition parsePosition0 = new ParsePosition(14);
// Undeclared exception!
// try {
fastDateParser0.parse("CAT", parsePosition0);
// fail("Expecting exception: StringIndexOutOfBoundsException");
// } catch(StringIndexOutOfBoundsException e) {
// }
}
@Test(timeout = 4000)
public void test11() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("<<g^", timeZone0, locale0);
// Undeclared exception!
// try {
fastDateParser0.parse("pBO}uTn*'G.bw3Ua;", (ParsePosition) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.lang3.time.FastDateParser", e);
// }
}
@Test(timeout = 4000)
public void test12() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(0, "]kdf1@4uJ|v?q");
Locale locale0 = new Locale("]kdf1@4uJ|v?q", "", "");
FastDateParser fastDateParser0 = new FastDateParser("]kdf1@4uJ|v?q", simpleTimeZone0, locale0);
// Undeclared exception!
// try {
fastDateParser0.parse((String) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.lang3.time.FastDateParser", e);
// }
}
@Test(timeout = 4000)
public void test13() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ".G4;");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser(".G4;", simpleTimeZone0, locale0);
// Undeclared exception!
// try {
fastDateParser0.getFieldWidth();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.lang3.time.FastDateParser", e);
// }
}
@Test(timeout = 4000)
public void test14() throws Throwable {
Locale locale0 = Locale.GERMANY;
Locale locale1 = Locale.CHINESE;
TimeZone timeZone0 = TimeZone.getDefault();
timeZone0.getDisplayName();
FastDateParser fastDateParser0 = new FastDateParser("D+|E+|F+|G+|H+|K+|M+|S+|W+|Z+|a+|d+|h+|k+|m+|s+w+|y+|7+|''|'[^']++''[^']*+)*+'|[^'A-Za-z]++", timeZone0, locale1);
FastDateParser fastDateParser1 = new FastDateParser("D+|E+|F+|G+|H+|K+|M+|S+|W+|Z+|a+|d+|h+|k+|m+|s+w+|y+|7+|''|'[^']++''[^']*+)*+'|[^'A-Za-z]++", timeZone0, locale0);
Object object0 = new Object();
}
@Test(timeout = 4000)
public void test15() throws Throwable {
Locale locale0 = Locale.CANADA;
FastDateParser fastDateParser0 = null;
// try {
fastDateParser0 = new FastDateParser("L2,5q", (TimeZone) null, locale0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test16() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("M,9/pu)+Cfi<W?", timeZone0, locale0);
ParsePosition parsePosition0 = new ParsePosition(1);
Date date0 = fastDateParser0.parse("GMTEAT", parsePosition0);
assertNull(date0);
}
@Test(timeout = 4000)
public void test17() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.JAPAN;
FastDateParser fastDateParser0 = new FastDateParser("z", timeZone0, locale0);
ParsePosition parsePosition0 = new ParsePosition(0);
fastDateParser0.parse("IST", parsePosition0);
assertEquals("java.text.ParsePosition[index=3,errorIndex=-1]", parsePosition0.toString());
assertEquals(3, parsePosition0.getIndex());
}
@Test(timeout = 4000)
public void test18() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.JAPANESE;
FastDateParser fastDateParser0 = new FastDateParser("z", timeZone0, locale0);
Object object0 = fastDateParser0.parseObject("GMTCTT");
assertEquals("Fri Feb 14 20:21:21 GMT 2014", object0.toString());
}
@Test(timeout = 4000)
public void test19() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.JAPAN;
FastDateParser fastDateParser0 = new FastDateParser("z", timeZone0, locale0);
Date date0 = fastDateParser0.parse("IST");
assertEquals("Fri Feb 14 20:21:21 GMT 2014", date0.toString());
}
@Test(timeout = 4000)
public void test20() throws Throwable {
TimeZone timeZone0 = TimeZone.getTimeZone("");
Locale locale0 = Locale.TAIWAN;
FastDateParser fastDateParser0 = new FastDateParser("_iSI,#jGhJ/>dTC", timeZone0, locale0);
assertEquals("_iSI,#jGhJ/>dTC", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test21() throws Throwable {
TimeZone timeZone0 = TimeZone.getTimeZone("7)@WyFkK%(");
Locale locale0 = Locale.GERMANY;
FastDateParser fastDateParser0 = new FastDateParser("m(ED@Ir_owNcE+cFHj(", timeZone0, locale0);
assertEquals("m(ED@Ir_owNcE+cFHj(", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test22() throws Throwable {
TimeZone timeZone0 = TimeZone.getTimeZone(">BX0.y");
Locale locale0 = Locale.GERMANY;
FastDateParser fastDateParser0 = new FastDateParser(">6", timeZone0, locale0);
assertEquals(">6", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test23() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone((-2287), "K1");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser("=nI[os", simpleTimeZone0, locale0);
assertEquals("=nI[os", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test24() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(0, " not in (");
Locale locale0 = Locale.CHINA;
FastDateParser fastDateParser0 = new FastDateParser(":Lhq*>'%l1_", simpleTimeZone0, locale0);
assertEquals(":Lhq*>'%l1_", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test25() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(0, "6$cVbVRRBgtsHjlP");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser("6$cVbVRRBgtsHjlP", simpleTimeZone0, locale0);
assertEquals("6$cVbVRRBgtsHjlP", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test26() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("32*! ", timeZone0, locale0);
ParsePosition parsePosition0 = new ParsePosition(43);
Object object0 = fastDateParser0.parseObject("org.apache.commons.lang3.time.FastDateParser", parsePosition0);
assertNull(object0);
}
@Test(timeout = 4000)
public void test27() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, "");
Locale locale0 = Locale.CHINA;
FastDateParser fastDateParser0 = new FastDateParser("2(pK&Pa", simpleTimeZone0, locale0);
assertEquals("2(pK&Pa", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test28() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone((-2287), "K1");
Locale locale0 = Locale.CHINA;
FastDateParser fastDateParser0 = new FastDateParser("/y", simpleTimeZone0, locale0);
assertEquals("/y", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test29() throws Throwable {
TimeZone timeZone0 = TimeZone.getTimeZone(">BX0.y");
Locale locale0 = Locale.GERMANY;
FastDateParser fastDateParser0 = new FastDateParser("8}!s5!D0S,\"^ pu0j", timeZone0, locale0);
assertEquals("8}!s5!D0S,\"^ pu0j", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test30() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ":-OgS3}n;]Mf+~m|v");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser("1a{MKf,\"Lm&2wy", simpleTimeZone0, locale0);
int int0 = fastDateParser0.adjustYear(0);
assertEquals(2000, int0);
}
@Test(timeout = 4000)
public void test31() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.TAIWAN;
FastDateParser fastDateParser0 = new FastDateParser("~ZXD}", timeZone0, locale0);
int int0 = fastDateParser0.adjustYear(34);
assertEquals(1934, int0);
}
@Test(timeout = 4000)
public void test32() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(398, "GMTART");
Locale locale0 = Locale.forLanguageTag("GMTART");
FastDateParser fastDateParser0 = new FastDateParser("`a?@'-+:N&&s'yqlmR", simpleTimeZone0, locale0);
assertEquals("`a?@'-+:N&&s'yqlmR", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test33() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("9$_/loZ0PlED", timeZone0, locale0);
assertEquals("9$_/loZ0PlED", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test34() throws Throwable {
Locale locale0 = Locale.CHINESE;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("-mVj.V#hWAu", timeZone0, locale0);
// try {
fastDateParser0.parse("&H>2`|9g0");
// fail("Expecting exception: ParseException");
// } catch(ParseException e) {
// //
// // Unparseable date: \"&H>2`|9g0\" does not match -(\\p{IsNd}++)
// //
// verifyException("org.apache.commons.lang3.time.FastDateParser", e);
// }
}
@Test(timeout = 4000)
public void test35() throws Throwable {
TimeZone timeZone0 = TimeZone.getTimeZone("7L@WyFkK%[(");
Locale locale0 = FastDateParser.JAPANESE_IMPERIAL;
FastDateParser fastDateParser0 = new FastDateParser("w*,;}*[H71L", timeZone0, locale0);
// try {
fastDateParser0.parse("w*,;}*[H71L");
// fail("Expecting exception: ParseException");
// } catch(ParseException e) {
// //
// // (The ja_JP_JP_#u-ca-japanese locale does not support dates before 1868 AD)
// // Unparseable date: \"w*,;}*[H71L\" does not match (\\p{IsNd}++)\\*,;\\}\\*\\[(\\p{IsNd}{1}+)71
// //
// verifyException("org.apache.commons.lang3.time.FastDateParser", e);
// }
}
@Test(timeout = 4000)
public void test36() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale1 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser("(The ", timeZone0, locale1);
FastDateParser fastDateParser1 = new FastDateParser("(The ", timeZone0, locale0);
boolean boolean0 = fastDateParser0.equals(fastDateParser1);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test37() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.CHINESE;
FastDateParser fastDateParser0 = new FastDateParser(";.g]", timeZone0, locale0);
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(2023, "GMTPNT");
FastDateParser fastDateParser1 = new FastDateParser(";.g]", simpleTimeZone0, locale0);
boolean boolean0 = fastDateParser1.equals(fastDateParser0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test38() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("GMTNET", timeZone0, locale0);
FastDateParser fastDateParser1 = new FastDateParser("a!,a&H`!d;&", timeZone0, locale0);
boolean boolean0 = fastDateParser0.equals(fastDateParser1);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test39() throws Throwable {
Locale locale0 = Locale.ENGLISH;
TimeZone timeZone0 = TimeZone.getTimeZone("");
FastDateParser fastDateParser0 = new FastDateParser("dwTcnu*te-kU\"q\b&g", timeZone0, locale0);
ChronoField chronoField0 = ChronoField.EPOCH_DAY;
boolean boolean0 = fastDateParser0.equals(chronoField0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test40() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("GMTNET", timeZone0, locale0);
boolean boolean0 = fastDateParser0.equals(fastDateParser0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test41() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = null;
// try {
fastDateParser0 = new FastDateParser("CAT", timeZone0, locale0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Invalid pattern
// //
// verifyException("org.apache.commons.lang3.time.FastDateParser", e);
// }
}
@Test(timeout = 4000)
public void test42() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.CANADA_FRENCH;
FastDateParser fastDateParser0 = new FastDateParser("MIT", timeZone0, locale0);
Object object0 = fastDateParser0.parseObject("4");
assertEquals("Fri Feb 14 20:21:21 GMT 2014", object0.toString());
}
@Test(timeout = 4000)
public void test43() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.JAPAN;
FastDateParser fastDateParser0 = new FastDateParser("z", timeZone0, locale0);
Pattern pattern0 = fastDateParser0.getParsePattern();
assertEquals(0, pattern0.flags());
}
@Test(timeout = 4000)
public void test44() throws Throwable {
Locale locale0 = Locale.CHINA;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("D+|E+|F+|G+|H+|K+|M+|S+|W+|Z+|a+|d+|h+|k+|m+|s+|w+|y+|z+|''|'[^']++(''[^']*+)*+'|[^'A-Za-z]++", timeZone0, locale0);
Locale locale1 = fastDateParser0.getLocale();
assertEquals("", locale1.getVariant());
}
@Test(timeout = 4000)
public void test45() throws Throwable {
ZoneId zoneId0 = ZoneId.systemDefault();
TimeZone timeZone0 = TimeZone.getTimeZone(zoneId0);
Locale locale0 = FastDateParser.JAPANESE_IMPERIAL;
FastDateParser fastDateParser0 = new FastDateParser(")+5ub+", timeZone0, locale0);
String string0 = fastDateParser0.getPattern();
assertEquals(")+5ub+", string0);
}
@Test(timeout = 4000)
public void test46() throws Throwable {
TimeZone timeZone0 = TimeZone.getDefault();
Locale locale0 = Locale.CANADA;
FastDateParser fastDateParser0 = new FastDateParser("(The ", timeZone0, locale0);
ParsePosition parsePosition0 = new ParsePosition(0);
fastDateParser0.parseObject("(The ", parsePosition0);
assertEquals("java.text.ParsePosition[index=1,errorIndex=-1]", parsePosition0.toString());
assertEquals(1, parsePosition0.getIndex());
}
@Test(timeout = 4000)
public void test47() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ":-OgS3}n;]Mf+~m|v");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser("1a{MKf,\"Lm&2wy", simpleTimeZone0, locale0);
String string0 = fastDateParser0.toString();
assertEquals("FastDateParser[1a{MKf,\"Lm&2wy,en,:-OgS3}n;]Mf+~m|v]", string0);
}
@Test(timeout = 4000)
public void test48() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ".G4;");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser(".G4;", simpleTimeZone0, locale0);
fastDateParser0.hashCode();
}
@Test(timeout = 4000)
public void test49() throws Throwable {
Locale locale0 = Locale.SIMPLIFIED_CHINESE;
TimeZone timeZone0 = TimeZone.getDefault();
FastDateParser fastDateParser0 = new FastDateParser("MMM<", timeZone0, locale0);
assertEquals("MMM<", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test50() throws Throwable {
Locale locale0 = Locale.ENGLISH;
TimeZone timeZone0 = TimeZone.getTimeZone("");
FastDateParser fastDateParser0 = new FastDateParser("dwTcnu*te-kU\"q\b&g", timeZone0, locale0);
Object object0 = fastDateParser0.parseObject("85");
assertEquals("Fri Feb 14 20:21:21 GMT 2014", object0.toString());
}
@Test(timeout = 4000)
public void test51() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ".G4;");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser("FastDateParser[.G4;,en,.G4;]", simpleTimeZone0, locale0);
assertEquals("FastDateParser[.G4;,en,.G4;]", fastDateParser0.getPattern());
}
@Test(timeout = 4000)
public void test52() throws Throwable {
SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone((-2287), "K1");
Locale locale0 = Locale.ENGLISH;
FastDateParser fastDateParser0 = new FastDateParser("dzJ%4", simpleTimeZone0, locale0);
TimeZone timeZone0 = fastDateParser0.getTimeZone();
assertSame(simpleTimeZone0, timeZone0);
}
}
| [
"[email protected]"
] | |
2799206d575c6c5e0010e4a3d080d5ddd608742f | 9254e7279570ac8ef687c416a79bb472146e9b35 | /r-kvstore-20150101/src/main/java/com/aliyun/r_kvstore20150101/models/CreateTairInstanceRequest.java | 615c6abdc5ed31501450493f1c0fd6ad74fe7230 | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,729 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.r_kvstore20150101.models;
import com.aliyun.tea.*;
public class CreateTairInstanceRequest extends TeaModel {
@NameInMap("SecurityToken")
public String securityToken;
@NameInMap("OwnerId")
public Long ownerId;
@NameInMap("ResourceOwnerAccount")
public String resourceOwnerAccount;
@NameInMap("ResourceOwnerId")
public Long resourceOwnerId;
@NameInMap("OwnerAccount")
public String ownerAccount;
@NameInMap("RegionId")
public String regionId;
@NameInMap("InstanceName")
public String instanceName;
@NameInMap("Password")
public String password;
@NameInMap("InstanceClass")
public String instanceClass;
@NameInMap("ZoneId")
public String zoneId;
@NameInMap("ChargeType")
public String chargeType;
@NameInMap("VpcId")
public String vpcId;
@NameInMap("VSwitchId")
public String vSwitchId;
@NameInMap("Period")
public Integer period;
@NameInMap("BusinessInfo")
public String businessInfo;
@NameInMap("CouponNo")
public String couponNo;
@NameInMap("SrcDBInstanceId")
public String srcDBInstanceId;
@NameInMap("BackupId")
public String backupId;
@NameInMap("PrivateIpAddress")
public String privateIpAddress;
@NameInMap("AutoUseCoupon")
public String autoUseCoupon;
@NameInMap("AutoRenew")
public String autoRenew;
@NameInMap("AutoRenewPeriod")
public String autoRenewPeriod;
@NameInMap("AutoPay")
public Boolean autoPay;
@NameInMap("ClientToken")
public String clientToken;
@NameInMap("StorageType")
public String storageType;
@NameInMap("Storage")
public Integer storage;
@NameInMap("ShardType")
public String shardType;
@NameInMap("ShardCount")
public Integer shardCount;
@NameInMap("EngineVersion")
public String engineVersion;
@NameInMap("InstanceType")
public String instanceType;
public static CreateTairInstanceRequest build(java.util.Map<String, ?> map) throws Exception {
CreateTairInstanceRequest self = new CreateTairInstanceRequest();
return TeaModel.build(map, self);
}
public CreateTairInstanceRequest setSecurityToken(String securityToken) {
this.securityToken = securityToken;
return this;
}
public String getSecurityToken() {
return this.securityToken;
}
public CreateTairInstanceRequest setOwnerId(Long ownerId) {
this.ownerId = ownerId;
return this;
}
public Long getOwnerId() {
return this.ownerId;
}
public CreateTairInstanceRequest setResourceOwnerAccount(String resourceOwnerAccount) {
this.resourceOwnerAccount = resourceOwnerAccount;
return this;
}
public String getResourceOwnerAccount() {
return this.resourceOwnerAccount;
}
public CreateTairInstanceRequest setResourceOwnerId(Long resourceOwnerId) {
this.resourceOwnerId = resourceOwnerId;
return this;
}
public Long getResourceOwnerId() {
return this.resourceOwnerId;
}
public CreateTairInstanceRequest setOwnerAccount(String ownerAccount) {
this.ownerAccount = ownerAccount;
return this;
}
public String getOwnerAccount() {
return this.ownerAccount;
}
public CreateTairInstanceRequest setRegionId(String regionId) {
this.regionId = regionId;
return this;
}
public String getRegionId() {
return this.regionId;
}
public CreateTairInstanceRequest setInstanceName(String instanceName) {
this.instanceName = instanceName;
return this;
}
public String getInstanceName() {
return this.instanceName;
}
public CreateTairInstanceRequest setPassword(String password) {
this.password = password;
return this;
}
public String getPassword() {
return this.password;
}
public CreateTairInstanceRequest setInstanceClass(String instanceClass) {
this.instanceClass = instanceClass;
return this;
}
public String getInstanceClass() {
return this.instanceClass;
}
public CreateTairInstanceRequest setZoneId(String zoneId) {
this.zoneId = zoneId;
return this;
}
public String getZoneId() {
return this.zoneId;
}
public CreateTairInstanceRequest setChargeType(String chargeType) {
this.chargeType = chargeType;
return this;
}
public String getChargeType() {
return this.chargeType;
}
public CreateTairInstanceRequest setVpcId(String vpcId) {
this.vpcId = vpcId;
return this;
}
public String getVpcId() {
return this.vpcId;
}
public CreateTairInstanceRequest setVSwitchId(String vSwitchId) {
this.vSwitchId = vSwitchId;
return this;
}
public String getVSwitchId() {
return this.vSwitchId;
}
public CreateTairInstanceRequest setPeriod(Integer period) {
this.period = period;
return this;
}
public Integer getPeriod() {
return this.period;
}
public CreateTairInstanceRequest setBusinessInfo(String businessInfo) {
this.businessInfo = businessInfo;
return this;
}
public String getBusinessInfo() {
return this.businessInfo;
}
public CreateTairInstanceRequest setCouponNo(String couponNo) {
this.couponNo = couponNo;
return this;
}
public String getCouponNo() {
return this.couponNo;
}
public CreateTairInstanceRequest setSrcDBInstanceId(String srcDBInstanceId) {
this.srcDBInstanceId = srcDBInstanceId;
return this;
}
public String getSrcDBInstanceId() {
return this.srcDBInstanceId;
}
public CreateTairInstanceRequest setBackupId(String backupId) {
this.backupId = backupId;
return this;
}
public String getBackupId() {
return this.backupId;
}
public CreateTairInstanceRequest setPrivateIpAddress(String privateIpAddress) {
this.privateIpAddress = privateIpAddress;
return this;
}
public String getPrivateIpAddress() {
return this.privateIpAddress;
}
public CreateTairInstanceRequest setAutoUseCoupon(String autoUseCoupon) {
this.autoUseCoupon = autoUseCoupon;
return this;
}
public String getAutoUseCoupon() {
return this.autoUseCoupon;
}
public CreateTairInstanceRequest setAutoRenew(String autoRenew) {
this.autoRenew = autoRenew;
return this;
}
public String getAutoRenew() {
return this.autoRenew;
}
public CreateTairInstanceRequest setAutoRenewPeriod(String autoRenewPeriod) {
this.autoRenewPeriod = autoRenewPeriod;
return this;
}
public String getAutoRenewPeriod() {
return this.autoRenewPeriod;
}
public CreateTairInstanceRequest setAutoPay(Boolean autoPay) {
this.autoPay = autoPay;
return this;
}
public Boolean getAutoPay() {
return this.autoPay;
}
public CreateTairInstanceRequest setClientToken(String clientToken) {
this.clientToken = clientToken;
return this;
}
public String getClientToken() {
return this.clientToken;
}
public CreateTairInstanceRequest setStorageType(String storageType) {
this.storageType = storageType;
return this;
}
public String getStorageType() {
return this.storageType;
}
public CreateTairInstanceRequest setStorage(Integer storage) {
this.storage = storage;
return this;
}
public Integer getStorage() {
return this.storage;
}
public CreateTairInstanceRequest setShardType(String shardType) {
this.shardType = shardType;
return this;
}
public String getShardType() {
return this.shardType;
}
public CreateTairInstanceRequest setShardCount(Integer shardCount) {
this.shardCount = shardCount;
return this;
}
public Integer getShardCount() {
return this.shardCount;
}
public CreateTairInstanceRequest setEngineVersion(String engineVersion) {
this.engineVersion = engineVersion;
return this;
}
public String getEngineVersion() {
return this.engineVersion;
}
public CreateTairInstanceRequest setInstanceType(String instanceType) {
this.instanceType = instanceType;
return this;
}
public String getInstanceType() {
return this.instanceType;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.