text
stringlengths
10
2.72M
package com.tencent.mm.plugin.appbrand.widget.input.autofill; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import com.tencent.mm.plugin.appbrand.widget.input.autofill.AutoFillListPopupWindowBase.a; class AutoFillListPopupWindowBase$2 implements OnItemSelectedListener { final /* synthetic */ AutoFillListPopupWindowBase gKu; AutoFillListPopupWindowBase$2(AutoFillListPopupWindowBase autoFillListPopupWindowBase) { this.gKu = autoFillListPopupWindowBase; } public final void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) { if (i != -1) { a a = AutoFillListPopupWindowBase.a(this.gKu); if (a != null) { a.a(a, false); } } } public final void onNothingSelected(AdapterView<?> adapterView) { } }
import java.io.*; class sort { public static void main(String args[]) { DataInputStream in=new DataInputStream(System.in); int a[]=new int[10]; int n=0,i,j,temp; try { System.out.println("Enter n"); n=Integer.parseInt(in.readLine()); System.out.println("Enter array elements"); for(i=0;i<n;i++) a[i]=Integer.parseInt(in.readLine()); } catch(Exception e) { System.out.println(e); } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; } } } System.out.println("Elements in ascending order"); for(i=0;i<n;i++) System.out.print(a[i]+" "); for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(a[i]<a[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; } } } System.out.println(); System.out.println("Elements in descending order"); for(i=0;i<n;i++) System.out.print(a[i]+" "); } }
package net.liuzd.spring.boot.v2.mapper; import net.liuzd.spring.boot.v2.config.MyBaseMapper; import net.liuzd.spring.boot.v2.entity.User; import net.liuzd.spring.boot.v2.model.UserPage; public interface UserMapper extends MyBaseMapper<User> { /** * 自定义分页查询 * @param userPage 单独 user 模块使用的分页 * @return 分页数据 */ UserPage selectUserPage(UserPage userPage); Long saveOne(User user); }
package five.com.project.spring.entities; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; @Entity @Table(name = "departement") public class departement { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @ManyToMany @JoinTable(name = "societe_depart", joinColumns = { @JoinColumn(name = "departement_id") }, inverseJoinColumns = { @JoinColumn(name = "societe_id") }) private Set<societe> societe = new HashSet<>(); private String lastName; private String Adresse; public departement() { } public departement(int id, String lastName, String adresse) { //super(); this.id = id; this.lastName = lastName; Adresse = adresse; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getAdresse() { return Adresse; } public void setAdresse(String adresse) { Adresse = adresse; } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package control_de_versiones; /** * * @author Jukniz */ public class Constantes { public String driver ="com.mysql.jdbc.Driver"; public String conexion= "jdbc:mysql://localhost:3306/dambbddficheros"; public String user="root"; public String pass="Escolapia45"; }
package org.example.broker.core.repository; import org.example.broker.core.entity.MessageEntity; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import java.util.List; public interface MessageRepository extends CrudRepository<MessageEntity, Long> { @Query(value = "select * from messages where expires_at < now()", nativeQuery = true) List<MessageEntity> findAllByTopic(String topic); @Modifying @Query(value = "DELETE FROM messages WHERE expires_at < now()", nativeQuery = true) void deleteObsolete(); }
package excecoes; public class Erro extends Menssagem { public Erro(String menssagem) { super(menssagem); } }
package com.zhy.dagger2.multibindings; import com.zhy.dagger2.FourthActivity; import java.util.Map; import dagger.Component; @Component(modules = {SetModuleA.class, SetModuleB.class, MapModuleA.class, MapModuleB.class}) public interface MultiBindingsComponent { void inject(FourthActivity fourthActivity); Map<String, Long> longsByString(); Map<Long, String> stringsByLong(); Map<Class<?>, String> stringsByClass(); Map<Color, String> myEnumStringMap(); Map<Class<? extends Number>, String> stringsByNumberClass(); // Map<MyKey, String> myKeyStringMap(); }
package com.zhowin.miyou.recommend.activity; import android.content.Context; import android.content.Intent; import android.text.TextUtils; import android.view.KeyEvent; import android.view.View; import android.view.inputmethod.EditorInfo; import android.widget.TextView; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.chad.library.adapter.base.BaseQuickAdapter; import com.zhowin.base_library.http.HttpCallBack; import com.zhowin.base_library.model.UserInfo; import com.zhowin.base_library.utils.ActivityManager; import com.zhowin.base_library.utils.ConstantValue; import com.zhowin.base_library.utils.EmptyViewUtils; import com.zhowin.base_library.utils.KeyboardUtils; import com.zhowin.base_library.utils.SizeUtils; import com.zhowin.base_library.utils.ToastUtils; import com.zhowin.base_library.widget.GridSpacingItemDecoration; import com.zhowin.miyou.R; import com.zhowin.miyou.base.BaseBindActivity; import com.zhowin.miyou.databinding.ActivityRoomSearchBinding; import com.zhowin.miyou.db.manager.DaoManagerUtils; import com.zhowin.miyou.db.model.SearchUserHistory; import com.zhowin.miyou.http.BaseResponse; import com.zhowin.miyou.http.HttpRequest; import com.zhowin.miyou.mine.adapter.MyRoomListAdapter; import com.zhowin.miyou.mine.dialog.UnlockRoomDialog; import com.zhowin.miyou.recommend.adapter.SearchHistoryAdapter; import com.zhowin.miyou.recommend.adapter.SearchUserResultAdapter; import com.zhowin.miyou.recommend.callback.OnHitCenterClickListener; import com.zhowin.miyou.recommend.dialog.HitCenterDialog; import com.zhowin.miyou.recommend.model.RecommendList; import java.util.List; /** * 房间/ 好友 搜索 * <p> * type: 1 房间 2 好友 */ public class RoomSearchActivity extends BaseBindActivity<ActivityRoomSearchBinding> implements BaseQuickAdapter.OnItemClickListener { private int classType; private MyRoomListAdapter roomSearchAdapter; private SearchHistoryAdapter searchHistoryAdapter; private SearchUserResultAdapter searchUserResultAdapter; public static void start(Context context, int type) { Intent intent = new Intent(context, RoomSearchActivity.class); intent.putExtra(ConstantValue.TYPE, type); context.startActivity(intent); } @Override public int getLayoutId() { return R.layout.activity_room_search; } @Override public void initView() { setOnClick(R.id.ivBackReturn, R.id.tvSearchText); classType = getIntent().getIntExtra(ConstantValue.TYPE, 1); } @Override public void initData() { switch (classType) { case 1: mBinding.editSearch.setHint("请输入房间ID/名称关键字"); roomSearchAdapter = new MyRoomListAdapter(); mBinding.recyclerView.addItemDecoration(new GridSpacingItemDecoration(2, SizeUtils.dp2px(10), false)); mBinding.recyclerView.setLayoutManager(new GridLayoutManager(mContext, 2)); mBinding.recyclerView.setAdapter(roomSearchAdapter); roomSearchAdapter.setOnItemClickListener(this::onItemClick); break; case 2: mBinding.editSearch.setHint("请输入好友ID/昵称关键字"); mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(mContext)); searchHistoryAdapter = new SearchHistoryAdapter(); searchHistoryAdapter.setOnItemClickListener(this::onItemClick); searchUserResultAdapter = new SearchUserResultAdapter(); searchUserResultAdapter.setOnItemClickListener(this::onItemClick); queryHistoryData(); break; } } /** * 查询数据 */ private void queryHistoryData() { List<SearchUserHistory> searchHistoryList = DaoManagerUtils.getHistoryData(); if (searchHistoryList != null && !searchHistoryList.isEmpty()) { mBinding.recyclerView.setAdapter(searchHistoryAdapter); searchHistoryAdapter.setNewData(searchHistoryList); } else { EmptyViewUtils.bindEmptyView(mContext, searchHistoryAdapter, R.drawable.empty_wufj_icon, "没有历史记录"); } } @Override public void initListener() { mBinding.refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mBinding.refreshLayout.setRefreshing(false); String keyWord = mBinding.editSearch.getText().toString().trim(); if (TextUtils.isEmpty(keyWord)) return; currentPage = 0; if (1 == classType) { startSearchRoom(); } else { startSearchFriend(); } } }); mBinding.editSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { if (1 == classType) { startSearchRoom(); } else { startSearchFriend(); } return true; } return false; } }); } @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { if (adapter instanceof MyRoomListAdapter) { boolean roomIsLock = roomSearchAdapter.getItem(position).isExistPwd(); if (roomIsLock) { showUnLockRoomDialog(); } else { } } else if (adapter instanceof SearchHistoryAdapter) { SearchUserHistory searchUserHistory = searchHistoryAdapter.getItem(position); if (searchUserHistory != null) { showDeleteUserDialog(searchUserHistory); } } else if (adapter instanceof SearchUserResultAdapter) { int userId = searchUserResultAdapter.getItem(position).getUserId(); HomepageActivity.start(mContext, userId == UserInfo.getUserInfo().getUserId(), userId); } } private void showDeleteUserDialog(SearchUserHistory searchUserHistory) { HitCenterDialog hitCenterDialog = new HitCenterDialog(mContext); hitCenterDialog.setDialogTitle("确定要删除吗?"); hitCenterDialog.show(); hitCenterDialog.setOnHitCenterClickListener(new OnHitCenterClickListener() { @Override public void onCancelClick() { } @Override public void onDetermineClick() { DaoManagerUtils.deleteData(searchUserHistory); queryHistoryData(); } }); } /** * 解锁房间 */ private void showUnLockRoomDialog() { UnlockRoomDialog unlockRoomDialog = new UnlockRoomDialog(mContext); unlockRoomDialog.show(); unlockRoomDialog.setOnUnLockRoomListener(new UnlockRoomDialog.OnUnLockRoomListener() { @Override public void onUnLockRoom(String password) { } }); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.ivBackReturn: ActivityManager.getAppInstance().finishActivity(); break; case R.id.tvSearchText: if (1 == classType) { startSearchRoom(); } else { startSearchFriend(); } KeyboardUtils.hideSoftInput(mContext); break; } } /** * 搜索房间 */ private void startSearchRoom() { String keyWord = mBinding.editSearch.getText().toString().trim(); if (TextUtils.isEmpty(keyWord)) { ToastUtils.showToast("关键字不能为空哦"); return; } showLoadDialog(); HttpRequest.searchRoomResultList(this, keyWord, currentPage, pageNumber, new HttpCallBack<BaseResponse<RecommendList>>() { @Override public void onSuccess(BaseResponse<RecommendList> recommendListBaseResponse) { dismissLoadDialog(); if (recommendListBaseResponse != null) { List<RecommendList> roomList = recommendListBaseResponse.getRecords(); if (roomList != null && !roomList.isEmpty()) { mBinding.recyclerView.setAdapter(roomSearchAdapter); roomSearchAdapter.setNewData(roomList); } else { EmptyViewUtils.bindEmptyView(mContext, roomSearchAdapter, R.drawable.empty_wufj_icon, "没有搜索到房间"); ToastUtils.showToast("没有符合条件的房间哦"); } } } @Override public void onFail(int errorCode, String errorMsg) { dismissLoadDialog(); ToastUtils.showToast(errorMsg); } }); } /** * 搜索好友 */ private void startSearchFriend() { String keyWord = mBinding.editSearch.getText().toString().trim(); if (TextUtils.isEmpty(keyWord)) { ToastUtils.showToast("关键字不能为空哦"); return; } showLoadDialog(); HttpRequest.searchUserResultList(this, keyWord, currentPage, pageNumber, new HttpCallBack<BaseResponse<UserInfo>>() { @Override public void onSuccess(BaseResponse<UserInfo> userInfoBaseResponse) { dismissLoadDialog(); DaoManagerUtils.insertHistoryDao(keyWord); if (userInfoBaseResponse != null) { List<UserInfo> userInfoList = userInfoBaseResponse.getRecords(); if (userInfoList != null && !userInfoList.isEmpty()) { mBinding.recyclerView.setAdapter(searchUserResultAdapter); searchUserResultAdapter.setNewData(userInfoList); } else { mBinding.recyclerView.setAdapter(searchUserResultAdapter); searchUserResultAdapter.setNewData(userInfoList); EmptyViewUtils.bindEmptyView(mContext, searchUserResultAdapter, R.drawable.empty_wufj_icon, "没有搜索到好友"); ToastUtils.showToast("没有符合条件的好友哦"); } } } @Override public void onFail(int errorCode, String errorMsg) { dismissLoadDialog(); ToastUtils.showToast(errorMsg); } }); } }
package kz.feekapo.config; import javax.naming.NamingException; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @Configuration @EnableWebMvc @ComponentScan(basePackages = "kz.feekapo") public class WebConfig { @Autowired DataSource dataSource; @Bean public NamedParameterJdbcTemplate getNameParameterJdbcTemplate() { return new NamedParameterJdbcTemplate(dataSource); } @Bean public DataSource getDataSource() throws NamingException { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://localhost:3306/technodom"); dataSource.setUsername("techno"); dataSource.setPassword("techno"); return dataSource; } }
package cs425project; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.*; public class Owner { public Owner() { // TODO Auto-generated constructor stub } /** * view guests information, update movie and theatre schedule */ public void own(){ System.out.println("Welcome! Owner"); boolean b=true; while(b){ System.out.println("1 ----- view guests information"+"\n"+"2 ----- view registered members information"+"\n"+"3 ----- update movie and theatre schedule"+ "\n"+"4 ----- change discount policy"+"\n"+"5 ----- change member status policy"+"\n"+"6 ----- insert employee information"+ "\n"+"7 ----- view employees who are on duty on monday on a specific theatre"+"\n"+ "8 ----- check whether security is scheduled to work tomorrow"+"\n"+"-1 ----- quit"); System.out.println("now enter your choice:"); Scanner input=new Scanner(System.in); int choice=input.nextInt(); switch(choice){ case 1: showguestinfo(); break; case 2: showmemberinfo(); break; case 3: updateschedule(); break; case 4: break; case 5: break; case 6: insertstaff(); break; case 7: dutymonday(); break; case 8: nosecurity(); break; case -1: break; default: System.out.println("Error! please enter your choice again"); } } } public void showguestinfo(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection c=DriverManager.getConnection("jdbc:mysql://localhost/cs425project?user=root&password=sql123"); Statement s=c.createStatement(); System.out.println("here is the guests personal information"); ResultSet r=s.executeQuery("select * from Guest"); System.out.println("emailId, first name, last name, card number, phone number, theatre location chosed to watch movie, the theatre id, the screenroom number, the movie title"); while(r.next()){ System.out.println(r.getString("Guest.emailId")+" "+r.getString("Guest.fname")+" "+r.getString("Guest.lname")+" "+r.getString("Guest.cardnum")+" "+r.getString("Guest.phonenum")+" "+r.getString("Guest.location")); } System.out.println("\n"+"here is guests booking tickets information"); System.out.println("guetst's emailId, theatre id, screenroom number, movie title"); ResultSet r1=s.executeQuery("select * from GuestBook"); while(r1.next()){ System.out.println(r1.getString("emailId")+" "+r1.getString("tid")+" "+r1.getString("sid")+" "+r1.getString("mtitle")); } s.close(); c.close(); } catch(Exception e){e.printStackTrace();} } private void showmemberinfo() { try{ Class.forName("com.mysql.jdbc.Driver"); Connection c=DriverManager.getConnection("jdbc:mysql://localhost/cs425project?user=root&password=sql123"); Statement s=c.createStatement(); System.out.println("here is registered members' personal information"); ResultSet r=s.executeQuery("select userid,password,fname,lname,emailId,Register.cardnum,cardtype,expdate,phonenum,address from Register,Card where Register.cardnum=Card.cardnum"); System.out.println("userid, password, first name, last name, emailId, credit card number, card type, expiration type, phone nubmer, address,"); while(r.next()){ System.out.println(r.getString("userid")+" "+r.getString("fname")+" "+r.getString("lname")+" "+r.getString("emailId")+" "+r.getString("Register.cardnum")+" "+r.getString("cardtype")+" "+r.getString("expdate")+" "+r.getString("phonenum")+" "+r.getString("address")); } System.out.println("\n"+"here is registered member's booking tickets information"); ResultSet r1=s.executeQuery("select * from MemberBook"); System.out.println("userid, theatre id, screenroom number, movie title, date, tquantity"); while(r1.next()){ System.out.println(r1.getString("userid")+" "+r1.getString("tid")+" "+r1.getString("sid")+" "+r1.getString("mtitle")+" "+r1.getString("mtitle")+" "+r1.getString("date")+" "+r1.getString("tquantity")); } s.close(); c.close(); } catch(Exception e){e.printStackTrace();} } public void updateschedule(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection c=DriverManager.getConnection("jdbc:mysql://localhost/cs425project?user=root&password=sql123"); Statement s=c.createStatement(); /** * show current movie and theatre information and schedule */ ResultSet r=s.executeQuery("select theatre.id,screenid,capacity,location from Theatre,Screen where Theatre.id=Screen.tid"); System.out.println("here is theatre information:"); System.out.println("theatreid, location, screenroom number, capacity"); while(r.next()){ System.out.println(r.getString("theatre.id")+" "+r.getString("screenid")+" "+r.getString("capacity")+" "+r.getString("location")); } System.out.println("here is movie information:"); System.out.println("movie title, director, type"); ResultSet r1=s.executeQuery("select * from Movie"); while(r1.next()){ System.out.println(r1.getString("title")+" "+r1.getString("director")+" "+r1.getString("type")); } s.close(); c.close(); /** * update movie or theatre information */ System.out.println("1 ----- insert new movie"); System.out.println("2 ----- update movie show time"); System.out.println("3 ----- delete outdated movie"); System.out.println("now enter your choice"); Scanner scan=new Scanner(System.in); int choice=scan.nextInt(); switch(choice){ case 1: insertM(); break; case 2: updateM(); break; case 3: deleteM(); break; default: System.out.println("Error! please enter your choice again"); } } catch(Exception e){e.printStackTrace();} } public void insertM(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection c=DriverManager.getConnection("jdbc:mysql://localhost/cs425project?user=root&password=sql123"); Statement s=c.createStatement(); Scanner im=new Scanner(System.in); System.out.println("enter movie title"); String title=im.nextLine(); System.out.println("enter movie director"); String director=im.nextLine(); System.out.println("enter movie type"); String type=im.nextLine(); String insert="insert into Movie values('"+title+"','"+director+"','"+type+"')"; s.executeUpdate(insert); s.close(); c.close(); } catch(Exception e){e.printStackTrace();} } public void updateM(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection c=DriverManager.getConnection("jdbc:mysql://localhost/cs425project?user=root&password=sql123"); Statement s=c.createStatement(); Scanner um=new Scanner(System.in); System.out.println("enter theatre id"); int tid=um.nextInt(); System.out.println("enter Screenroom number"); int sid=um.nextInt(); System.out.println("enter movie title"); String time=um.nextLine(); String update="update PlaySchedule set time='"+time+"' where tidd='"+tid+"' and sid='"+sid+"'"; s.executeUpdate(update); s.close(); c.close(); } catch(Exception e){e.printStackTrace();} } public void deleteM(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection c=DriverManager.getConnection("jdbc:mysql://localhost/cs425project?user=root&password=sql123"); Statement s=c.createStatement(); Scanner dm=new Scanner(System.in); System.out.println("enter the movie title"); String mtitle=dm.nextLine(); ResultSet r=s.executeQuery("select mtitle from MovieStar"); boolean find=false; while(r.next()){ if(mtitle.equalsIgnoreCase(r.getString("mtitle"))) find=true; } if(find==true){ s.executeUpdate("delete from MovieStar where mtitle='"+mtitle+"'"); s.executeUpdate("delete from Movie where mtitle='"+mtitle+"'"); } else{ s.executeUpdate("delete from Movie where mtitle='"+mtitle+"'"); } s.close(); c.close(); } catch(Exception e){e.printStackTrace();} } public void insertstaff(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection c=DriverManager.getConnection("jdbc:mysql://localhost/cs425project?user=root&password=sql123"); Statement s=c.createStatement(); Scanner input=new Scanner(System.in); System.out.println("enter employee id:"); int employeeid=Integer.parseInt(input.nextLine()); System.out.println("enter job type:"); String jobtype=input.nextLine(); System.out.println("enter first name:"); String fname=input.nextLine(); System.out.println("enter last name:"); String lname=input.nextLine(); System.out.println("enter address:"); String address=input.nextLine(); System.out.println("enter phone number:"); String phone=input.nextLine(); System.out.println("enter the working theatre id:"); int tid=Integer.parseInt(input.nextLine()); System.out.println("enter ssn:"); int ssn=Integer.parseInt(input.nextLine()); System.out.println("enter time slot id:"); int timeslotid=Integer.parseInt(input.nextLine()); String insert="insert into Staff values('"+employeeid+"','"+jobtype+"','"+fname+"','"+lname+"','"+address+"','"+phone+"','"+tid+"','"+ssn+"')"; String insert2="insert into StaffSchedule values('"+employeeid+"','"+jobtype+"','"+tid+"','"+timeslotid+"')"; s.executeUpdate(insert); s.executeUpdate(insert2); System.out.println("you have inserted employee information successfully!"+"\n"); s.close(); c.close(); } catch(Exception e){e.printStackTrace();} } public void dutymonday(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection c=DriverManager.getConnection("jdbc:mysql://localhost/cs425project?user=root&password=sql123"); Statement s=c.createStatement(); /** * display list of employees who are on duty on Monday on a specific theatre * */ Scanner input=new Scanner(System.in); System.out.println("enter the specific theatre id"); int ttid=Integer.parseInt(input.nextLine()); ResultSet r=s.executeQuery("select distinct Staff.employeeid,Staff.fname,Staff.lname, Staff.jobtype, Time.starttime,Time.endtime from Staff,StaffSchedule natural join Time where Staff.tid='"+ttid+"' and Staff.employeeid in(select eid from StaffSchedule where timeslotid=1)"); System.out.println("here is employee id,name,jobtype,time schedule who are on duty on Monday on a specific theatre"); while(r.next()){ System.out.println(r.getString("Staff.employeeid")+" "+r.getString("Staff.fname")+" "+r.getString("Staff.lname")+" "+r.getString("Staff.jobtype")+" "+r.getString("Time.starttime")+" "+r.getString("Time.endtime")+"\n"); } /** * send an alert to the owner and manager if no employee with the job of security * is scheduled to work tomorrow. */ s.close(); c.close(); } catch(Exception e){e.printStackTrace();} } public void nosecurity(){ try{ Class.forName("com.mysql.jdbc.Driver"); Connection c=DriverManager.getConnection("jdbc:mysql://localhost/cs425project?user=root&password=sql123"); Statement s=c.createStatement(); /** * send an alert to the owner and manager if no employee with the job of security * is scheduled to work tomorrow. */ System.out.println("1 ----- Monday"+"\n"+"2 ----- Tuesday"+"\n"+"3 ----- Wendesday"+"\n"+"4 ----- Thursday" +"\n"+"5 ----- Friday"+"\n"+"6 ----- Saturday"+"\n"+"7 ----- Sunday"); Scanner input=new Scanner(System.in); System.out.println("enter tmorrow's timeslot id"); int timeid=input.nextInt(); System.out.println("enter theatre id"); int tid=input.nextInt(); System.out.println("please enter timeslot id corresponding to tmorrow"); ResultSet r=s.executeQuery("select jobtype from StaffSchedule where timeslotid='"+timeid+"' and tid='"+tid+"'" ); ArrayList<String> array=new ArrayList<String>(); while(r.next()){ array.add(r.getString("jobtype")); } if(!array.contains("Security")) { System.out.println("Alert! No employee with the job of security is sheduled to work tomorrow");} else{ System.out.println("don't worry, there is security is scheduled to work tomorrow"); } s.close(); c.close(); } catch(Exception e){e.printStackTrace();} } }
package com.spsc.szxq.view; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import com.flyco.dialog.widget.base.BaseDialog; import com.spsc.szxq.R; import java.util.ArrayList; /** * Created by allens on 2017/2/20. * <p> * 延期 dialog * * 不使用了 */ public class TimeDialog extends BaseDialog<TimeDialog> { private Context mContext; private Button mButtonnoo; private Button mButtonyes; private PickerView mDayTop; private PickerView mDayButtom; private PickerView mMouTop; private PickerView mMouButtom; private String mTopDayData; private String mButtomMouData; private String mButtonDayData; private String mTopMouData; public TimeDialog(Context context) { super(context); this.mContext = context; } @Override public View onCreateView() { View inflate = LayoutInflater.from(mContext).inflate(R.layout.dialog_time, null); mButtonnoo = (Button) inflate.findViewById(R.id.dialog_time_button_no); mButtonyes = (Button) inflate.findViewById(R.id.dialog_time_button_yes); mDayTop = (PickerView) inflate.findViewById(R.id.dialog_time_day_top); mDayButtom = (PickerView) inflate.findViewById(R.id.dialog_time_day_buttom); mMouTop = (PickerView) inflate.findViewById(R.id.dialog_time_mou_top); mMouButtom = (PickerView) inflate.findViewById(R.id.dialog_time_mou_buttom); return inflate; } @Override public void setUiBeforShow() { ArrayList<String> mDayList = new ArrayList<>(); ArrayList<String> mouList = new ArrayList<>(); for (int i = 0; i < 31; i++) { mDayList.add("" + i); } for (int i = 0; i < 12; i++) { mouList.add("" + i); } mDayTop.setData(mDayList); mDayButtom.setData(mDayList); mMouTop.setData(mouList); mMouButtom.setData(mouList); mDayTop.setOnSelectListener(new PickerView.onSelectListener() { @Override public void onSelect(String text) { mTopMouData = text; } }); mDayButtom.setOnSelectListener(new PickerView.onSelectListener() { @Override public void onSelect(String text) { mButtonDayData = text; } }); mMouTop.setOnSelectListener(new PickerView.onSelectListener() { @Override public void onSelect(String text) { mTopMouData = text; } }); mMouButtom.setOnSelectListener(new PickerView.onSelectListener() { @Override public void onSelect(String text) { mButtomMouData = text; } }); mButtonnoo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); mButtonyes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (onClickBtnListener != null) { if (mTopMouData == null) { mTopMouData = "6"; } if (mTopDayData == null) { mTopDayData = "15"; } if (mButtomMouData == null) { mButtomMouData = "6"; } if (mButtonDayData == null) { mButtonDayData = "15"; } onClickBtnListener.OnClickBtnListener(v, mTopMouData + "月" + mTopDayData + "日", mButtomMouData + "月" + mButtonDayData + "日"); } } }); } public interface OnClickBtnListener { void OnClickBtnListener(View view, String startdata, String lastdata); } private OnClickBtnListener onClickBtnListener; public void setOnClickBtnListener(OnClickBtnListener onClickBtnListener) { this.onClickBtnListener = onClickBtnListener; } }
package com.uwetrottmann.trakt5.entities; import java.util.List; public class Credits { public List<CastMember> cast; public Crew crew; }
package com.coinhunter.core.repository.user; import com.coinhunter.core.domain.user.User; import org.springframework.data.jpa.repository.JpaRepository; public interface UserRepository extends JpaRepository<User, String> { User findByName(String name); User findByEmail(String email); User findByNameAndEmail(String name, String email); }
package com.example.retail.models.fmcgproducts; import com.example.retail.models.jsonmodels.Suppliers; import com.vladmihalcea.hibernate.type.json.JsonBinaryType; import org.hibernate.annotations.Type; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; import javax.persistence.*; import javax.validation.constraints.Future; import javax.validation.constraints.NotNull; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; @Entity @Table(name = "fmcgproduct_inventory") @TypeDefs({ @TypeDef( name = "psql-jsonb", typeClass = JsonBinaryType.class ) }) public class FMCGProductsInventory { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "fmcgproductinventory_tableid") private Long fmcgProductTableId; @NotNull @Column(name = "fmcgproductinventory_costprice") private Float fmcgProductInventoryCostPrice; @Column(name = "fmcgproductinventory_fixedcost") private Float fmcgProductInventoryFixedCost; @NotNull @Column(name = "fmcgproductinventory_sellingprice") // This is excluding the taxes including discounts private Float fmcgProductInventorySellingPrice; @Future @NotNull @Column(name = "fmcgproductinventory_expiry") private LocalDate fmcgProductInventoryExpiry; @NotNull @Column(name = "fmcgproductinventory_addedby") private String fmcgProductInventoryAddedBy; /* * For MVP we update the id of the user who last updates the inventory and do not maintain each update record with * relation to which user and what time */ @NotNull @Column(name = "fmcgproductinventory_addedon") private LocalDateTime fmcgProductInventoryAddedOn; @NotNull @Column(name = "fmcgproductinventory_addedqty") private Float fmcgProductInventoryAddedQty; @Type(type = "psql-jsonb") @Column(name = "fmcgproductinventory_suppliers") private List<Suppliers> suppliers; @NotNull @Column(name = "fmcg_product_subid", unique = true) private String fmcgProductSubId; public FMCGProductsInventory() {} public FMCGProductsInventory(Float fmcgProductInventoryCostPrice, Float fmcgProductInventoryFixedCost, Float fmcgProductInventorySellingPrice, LocalDate fmcgProductInventoryExpiry, String fmcgProductInventoryAddedBy, LocalDateTime fmcgProductInventoryAddedOn, Float fmcgProductInventoryAddedQty, List<Suppliers> suppliers, @NotNull String fmcgProductSubId) { this.fmcgProductInventoryCostPrice = fmcgProductInventoryCostPrice; this.fmcgProductInventoryFixedCost = fmcgProductInventoryFixedCost; this.fmcgProductInventorySellingPrice = fmcgProductInventorySellingPrice; this.fmcgProductInventoryExpiry = fmcgProductInventoryExpiry; this.fmcgProductInventoryAddedBy = fmcgProductInventoryAddedBy; this.fmcgProductInventoryAddedOn = fmcgProductInventoryAddedOn; this.fmcgProductInventoryAddedQty = fmcgProductInventoryAddedQty; this.suppliers = suppliers; this.fmcgProductSubId = fmcgProductSubId; } public Long getFmcgProductTableId() { return fmcgProductTableId; } public void setFmcgProductTableId(Long fmcgProductTableId) { this.fmcgProductTableId = fmcgProductTableId; } public Float getFmcgProductInventoryCostPrice() { return fmcgProductInventoryCostPrice; } public void setFmcgProductInventoryCostPrice(Float fmcgProductInventoryCostPrice) { this.fmcgProductInventoryCostPrice = fmcgProductInventoryCostPrice; } public Float getFmcgProductInventoryFixedCost() { return fmcgProductInventoryFixedCost; } public void setFmcgProductInventoryFixedCost(Float fmcgProductInventoryFixedCost) { this.fmcgProductInventoryFixedCost = fmcgProductInventoryFixedCost; } public Float getFmcgProductInventorySellingPrice() { return fmcgProductInventorySellingPrice; } public void setFmcgProductInventorySellingPrice(Float fmcgProductInventorySellingPrice) { this.fmcgProductInventorySellingPrice = fmcgProductInventorySellingPrice; } public LocalDate getFmcgProductInventoryExpiry() { return fmcgProductInventoryExpiry; } public void setFmcgProductInventoryExpiry(LocalDate fmcgProductInventoryExpiry) { this.fmcgProductInventoryExpiry = fmcgProductInventoryExpiry; } public String getFmcgProductInventoryAddedBy() { return fmcgProductInventoryAddedBy; } public void setFmcgProductInventoryAddedBy(String fmcgProductInventoryAddedBy) { this.fmcgProductInventoryAddedBy = fmcgProductInventoryAddedBy; } public LocalDateTime getFmcgProductInventoryAddedOn() { return fmcgProductInventoryAddedOn; } public void setFmcgProductInventoryAddedOn(LocalDateTime fmcgProductInventoryAddedOn) { this.fmcgProductInventoryAddedOn = fmcgProductInventoryAddedOn; } public Float getFmcgProductInventoryAddedQty() { return fmcgProductInventoryAddedQty; } public void setFmcgProductInventoryAddedQty(Float fmcgProductInventoryAddedQty) { this.fmcgProductInventoryAddedQty = fmcgProductInventoryAddedQty; } public List<Suppliers> getSuppliers() { return suppliers; } public void setSuppliers(List<Suppliers> suppliers) { this.suppliers = suppliers; } public String getFmcgProductSubId() { return fmcgProductSubId; } public void setFmcgProductSubId(String fmcgProductSubId) { this.fmcgProductSubId = fmcgProductSubId; } }
package br.edu.ifpb.followup.dao; import br.edu.ifpb.followup.entity.Professor; import br.edu.ifpb.followup.entity.Questao; import br.edu.ifpb.followup.entity.TipoQuestao; import java.util.List; import javax.annotation.PostConstruct; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; @Stateless public class QuestaoDAO { @PersistenceContext(unitName = "followUpPU") private EntityManager em; private CriteriaBuilder builder; @PostConstruct public void init(){ builder = em.getCriteriaBuilder(); } public void salvar(Questao q, Professor p){ p = em.find(Professor.class, p.getEmail()); p.addQuestao(q); em.merge(p); } public void remover(Questao questao){ Questao q = em.find(Questao.class, questao.getId()); em.remove(q); } public List<Questao> questoesOf(Professor p){ String sql = "SELECT q FROM Professor p, IN(p.questoes) q " + "WHERE p.email = :email" ; TypedQuery<Questao> query = em.createQuery(sql, Questao.class); query.setParameter("email", p.getEmail()); return query.getResultList(); } public List<Questao> questoesOf(Professor p, TipoQuestao tipo){ String sql = "SELECT q FROM Professor p, IN(p.questoes) q " + "WHERE p.email = :email and q.tipo = :tipo"; TypedQuery<Questao> query = em.createQuery(sql, Questao.class); query.setParameter("email", p.getEmail()); query.setParameter("tipo", tipo); return query.getResultList(); } }
package com.tencent.mm.plugin.sns.model; import com.tencent.mm.g.a.lc; import com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.i; import com.tencent.mm.sdk.b.b; import com.tencent.mm.sdk.b.c; import com.tencent.mm.sdk.platformtools.bi; class af$30 extends c<lc> { final /* synthetic */ af nqT; af$30(af afVar) { this.nqT = afVar; this.sFo = lc.class.getName().hashCode(); } public final /* synthetic */ boolean a(b bVar) { lc lcVar = (lc) bVar; lcVar.bVr.bVv = lcVar.bVq.source == 1 ? i.bAE().k(lcVar.bVq.bVs, lcVar.bVq.bJv, lcVar.bVq.bVt, lcVar.bVq.bVu) : i.bAE().h(bi.WV(lcVar.bVq.bVs), lcVar.bVq.bVt, lcVar.bVq.bVu); return false; } }
package com.youthchina.domain.tianjian; import java.sql.Timestamp; public class ComMediaDocument { private Integer docu_id; private String docu_local_id; private String docu_local_name; private String docu_local_format; private String docu_server_ali_id; private String docu_server_aws_id; private Timestamp create_time; private Integer is_delete; private Timestamp is_delete_time; private String docu_local_size; private Integer upload_user_id; public Integer getDocu_id() { return docu_id; } public void setDocu_id(Integer docu_id) { this.docu_id = docu_id; } public String getDocu_local_id() { return docu_local_id; } public void setDocu_local_id(String docu_local_id) { this.docu_local_id = docu_local_id; } public String getDocu_local_name() { return docu_local_name; } public void setDocu_local_name(String docu_local_name) { this.docu_local_name = docu_local_name; } public String getDocu_local_format() { return docu_local_format; } public void setDocu_local_format(String docu_local_format) { this.docu_local_format = docu_local_format; } public String getDocu_server_ali_id() { return docu_server_ali_id; } public void setDocu_server_ali_id(String docu_server_ali_id) { this.docu_server_ali_id = docu_server_ali_id; } public String getDocu_server_aws_id() { return docu_server_aws_id; } public void setDocu_server_aws_id(String docu_server_aws_id) { this.docu_server_aws_id = docu_server_aws_id; } public Timestamp getCreate_time() { return create_time; } public void setCreate_time(Timestamp create_time) { this.create_time = create_time; } public Integer getIs_delete() { return is_delete; } public void setIs_delete(Integer is_delete) { this.is_delete = is_delete; } public Timestamp getIs_delete_time() { return is_delete_time; } public void setIs_delete_time(Timestamp is_delete_time) { this.is_delete_time = is_delete_time; } public String getDocu_local_size() { return docu_local_size; } public void setDocu_local_size(String docu_local_size) { this.docu_local_size = docu_local_size; } public Integer getUpload_user_id() { return upload_user_id; } public void setUpload_user_id(Integer upload_user_id) { this.upload_user_id = upload_user_id; } }
package rgg.campusvirtualapp.modelo; import java.util.ArrayList; import java.util.Date; import java.util.List; import rgg.campusvirtualapp.AppMediador; import android.os.Bundle; import android.util.Log; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; public class TablaForoAsignatura { public static final String nombreTabla = "foroAsignatura"; public static final String CAMPO_CODIGO = "codAsignatura"; public static final String CAMPO_USUARIO = "username"; public static final String CAMPO_ASUNTO = "asunto"; public static final String CAMPO_MENSAJE = "mensaje"; public static final String CAMPO_RESPUESTA = "esRespuesta"; public static final String CAMPO_FECHA = "fechaEnviado"; public static final String CAMPO_NRESPUESTAS = "numero_respuestas"; public static final String CAMPO_ID = "idHilo"; @SuppressWarnings({ "unchecked", "rawtypes" }) public static void obtenerForo(final int codAsignatura) { /** * Devuelve la lista de temas del foro de una asignatura en concreto. */ final AppMediador appMediador = AppMediador.getInstance(); // busca en la tabla tareas todas las tareas que tienen un codigo de // asignatura dado ParseQuery query = new ParseQuery( TablaAsignaturasMatriculadas.nombreTabla); query.whereEqualTo(TablaAsignaturasMatriculadas.CAMPO_CODIGO, codAsignatura); query.addAscendingOrder(TablaAsignaturasMatriculadas.CAMPO_USUARIO); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> registros, ParseException e) { if (e == null) { // con los resultados obtenidos, se guarda en un vector los // dnis de los alumnos matriculados en esa asignatura final int[] usernames = new int[registros.size()]; int i = 0; for (ParseObject reg : registros) { usernames[i++] = reg.getNumber( TablaAsignaturasMatriculadas.CAMPO_USUARIO) .intValue(); } ParseQuery query = new ParseQuery(TablaUsuarios.nombreTabla); query.addAscendingOrder(TablaUsuarios.CAMPO_USUARIO); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> registros, ParseException e2) { if (e2 == null) { // con los resultados obtenidos, se guarda en un // vector los nombres de las tareas de esa // asignatura final String[] nombres = new String[usernames.length]; for (ParseObject reg : registros) { if (esUsuario( usernames, reg.getNumber( TablaUsuarios.CAMPO_USUARIO) .intValue()) != -1) { nombres[esUsuario( usernames, reg.getNumber( TablaUsuarios.CAMPO_USUARIO) .intValue())] = reg .getString(TablaUsuarios.CAMPO_NOMBRE); } } ParseQuery query = new ParseQuery(nombreTabla); query.whereEqualTo(CAMPO_CODIGO, codAsignatura); query.addDescendingOrder("createdAt"); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done( List<ParseObject> registros, ParseException e3) { if (e3 == null && registros.size() > 0) { // con los resultados obtenidos, se // guarda en un vector los nombres // de las tareas de esa asignatura ArrayList<DatosHilo> foro = new ArrayList<DatosHilo>( registros.size()); int i = 0; for (ParseObject reg : registros) { Date horapublicada = reg .getCreatedAt(); if (esUsuario( usernames, reg.getNumber( CAMPO_USUARIO) .intValue()) != -1) foro.add(new DatosHilo( reg.getString(CAMPO_ASUNTO), nombres[esUsuario( usernames, reg.getNumber( CAMPO_USUARIO) .intValue())], reg.getNumber( CAMPO_NRESPUESTAS) .intValue(), horapublicada, reg.getString(CAMPO_MENSAJE), reg.getNumber( CAMPO_RESPUESTA) .intValue(), reg.getNumber( CAMPO_ID) .intValue(), codAsignatura, reg.getNumber( CAMPO_USUARIO) .intValue(), i++)); } Bundle extras = new Bundle(); extras.putSerializable( AppMediador.DATOS_ARRAY_FORO, foro); appMediador.sendBroadcast( AppMediador.AVISO_FORO, extras); } else { appMediador.sendBroadcast( AppMediador.AVISO_FORO, null); } } }); } else { appMediador.sendBroadcast( AppMediador.AVISO_FORO, null); } } }); } else { appMediador.sendBroadcast(AppMediador.AVISO_FORO, null); } } }); } @SuppressWarnings("unchecked") public static void publicarTema(Object tema) { /** * Método que inserta un tema nuevo en el foro de la asignatura, por * parámetro se pasa un Object que tiene todos los datos necesarios. */ final AppMediador appMediador = AppMediador.getInstance(); // busca en la tabla foroAsignatura todos los hilos que tienen una // asignatura @SuppressWarnings("rawtypes") ParseQuery query = new ParseQuery(nombreTabla); final DatosHilo datos = ((DatosHilo) tema); query.whereEqualTo(CAMPO_CODIGO, datos.getCodAsignatura()); query.addAscendingOrder(CAMPO_ID); Log.i("depurador","tft 1"); query.findInBackground(new FindCallback<ParseObject>() { @SuppressWarnings("rawtypes") @Override public void done(List<ParseObject> registros, ParseException e1) { Log.i("depurador","tft 2"+ " "+e1); if (e1 == null) { for (ParseObject reg : registros) { if (datos.getEsRespuesta() != 0 && reg.getNumber(CAMPO_ID).intValue() == datos .getEsRespuesta()) { reg.put(CAMPO_NRESPUESTAS, reg.getNumber(CAMPO_NRESPUESTAS).intValue() + 1); reg.saveInBackground(); } } if (registros.size() != 0) { ParseObject ultimoTema = registros.get(registros.size() - 1); datos.setId(ultimoTema.getNumber(CAMPO_ID).intValue() + 1); } if (0 == datos.getAsunto().compareTo("")) datos.setAsunto("Sin asunto"); ParseObject po = new ParseObject(nombreTabla); po.put(CAMPO_USUARIO, datos.getUsername()); po.put(CAMPO_ASUNTO, datos.getAsunto()); po.put(CAMPO_FECHA, (Date) datos.getHorapublicacion()); po.put(CAMPO_ID, datos.getId()); po.put(CAMPO_MENSAJE, datos.getMensaje()); po.put(CAMPO_NRESPUESTAS, datos.getNrespuestas()); po.put(CAMPO_RESPUESTA, datos.getEsRespuesta()); po.put(CAMPO_CODIGO, datos.getCodAsignatura()); po.saveInBackground(); // Recupero el nombre del usuario ParseQuery query = new ParseQuery(TablaUsuarios.nombreTabla); query.whereEqualTo(TablaUsuarios.CAMPO_USUARIO, datos.getUsername()); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> registros, ParseException e1) { if (registros.size() == 1 && e1 == null) { Bundle extras = new Bundle(); datos.setAutor(registros.get(0).getString( TablaUsuarios.CAMPO_NOMBRE)); if (datos.getEsRespuesta() == 0) { ParseQuery query = new ParseQuery( TablaAsignaturasMatriculadas.nombreTabla); query.whereEqualTo( TablaAsignaturasMatriculadas.CAMPO_CODIGO, datos.getCodAsignatura()); query.addAscendingOrder(TablaAsignaturasMatriculadas.CAMPO_USUARIO); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done( List<ParseObject> registros, ParseException e) { if (e == null) { for (ParseObject reg : registros) { if (reg.getNumber( CAMPO_USUARIO) .intValue() != datos .getUsername()) { ParseObject po = new ParseObject( TablaNotificaciones.nombreTabla); po.put(TablaNotificaciones.CAMPO_USUARIO, reg.getNumber( TablaAsignaturasMatriculadas.CAMPO_USUARIO) .intValue()); po.put(TablaNotificaciones.CAMPO_ASUNTO, datos.getAsunto()); po.put(TablaNotificaciones.CAMPO_AUTOR, datos.getAutor()); po.put(TablaNotificaciones.CAMPO_MENSAJE, datos.getMensaje()); po.put(TablaNotificaciones.CAMPO_VISTA, false); po.saveInBackground(); } } } } }); } extras.putSerializable(AppMediador.DATOS_FORO, datos); extras.putBoolean("enviado", true); appMediador.sendBroadcast( AppMediador.AVISO_TEMA_ENVIADO, extras); } else { // Se ha publicado pero no ha generado las // notificaciones a los participantes Bundle extras = new Bundle(); extras.putBoolean("enviado", true); appMediador.sendBroadcast( AppMediador.AVISO_TEMA_ENVIADO, extras); } } }); } else { // No se ha publicado el nuevo tema. Bundle extras = new Bundle(); extras.putBoolean("enviado", false); appMediador.sendBroadcast(AppMediador.AVISO_TEMA_ENVIADO, extras); } } }); } private static int esUsuario(int[] usernames, int username) { for (int i = 0; i < usernames.length; i++) if (usernames[i] == username) return i; return -1; } }
package com.tencent.mm.plugin.appbrand.page; import android.view.View; import com.tencent.mm.plugin.appbrand.page.u.b; class u$1 extends x { final /* synthetic */ u goS; u$1(u uVar) { this.goS = uVar; } public final void ajd() { u uVar = this.goS; b lv = uVar.lv(uVar.goR); float[] fArr = uVar.goO; if (!(lv == null || lv.gpb == null || fArr == null)) { View view = (View) lv.gpb.get(); if (view != null) { if (uVar.goR != uVar.goN) { b lv2 = uVar.lv(uVar.goN); if (!(lv2 == null || lv2.gpb == null)) { View view2 = (View) lv2.gpb.get(); if (view2 != null) { uVar.b(uVar.goN, fArr, view2.getVisibility(), Boolean.valueOf(lv.gpd)); } } } int i = uVar.goR; uVar.goN = -1; uVar.goR = -1; uVar.b(i, fArr, view.getVisibility(), Boolean.valueOf(lv.gpd)); } } if (this.goS.goQ != null) { this.goS.goQ.ajd(); this.goS.goQ = null; } } }
package blogic; /** * class contorls some logic aspect of the game * * @author Pawel */ public class Logic { /** * size of the world in X dimension */ private static byte worldSizeX = 6; /** * size of the world in Y dimension */ private static byte worldSizeY = 12; /** * size of the world in Z dimension */ private static byte worldSizeZ = 6; /** * number of game ending level */ private static byte endLevel = 9; /** * removes all full levels * @param world */ public static void removeLevels(short[][][] world) { for (byte i = (byte) (worldSizeY - 2); i >= 0; i--) { boolean remove = true; for (byte j = 0; j < worldSizeX; j++) { for (byte k = 0; k < worldSizeZ; k++) { if (world[j][i][k] == 0) { remove = false; } } } if (remove) { removeLevel(i, world); } } } /** * remove one given level, and moves all upper levels down * @param i number of level * @param world */ private static void removeLevel(byte i, short[][][] world) { for (byte j = 0; j < worldSizeX; j++) { for (byte k = 0; k < worldSizeZ; k++) { world[j][i][k] = 0; } } for (byte l = i; l <= worldSizeY - 2; l++) { for (byte j = 0; j < worldSizeX; j++) { for (byte k = 0; k < worldSizeZ; k++) { world[j][l][k] = world[j][l + 1][k]; } } } } /** * return if game is over */ public static boolean gameIsOver(short[][][] world) { for (byte i = 0; i < worldSizeX; i++) { for (byte j = 0; j < worldSizeZ; j++) { if (world[i][endLevel][j] != 0) { return true; } } } return false; } /** * clean and return the world * @param world */ public static void cleanWorld(short[][][] world) { for (byte i = 0; i < worldSizeX; i++) { for (byte j = 0; j < worldSizeY; j++) { for (byte k = 0; k < worldSizeZ; k++) { world[i][j][k] = 0; } } } } }
package com.tencent.mm.plugin.setting.ui.setting; import android.app.ProgressDialog; import android.content.ComponentName; import android.content.Intent; import android.nfc.NfcAdapter; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.LinearLayout; import android.widget.TextView; import com.tencent.mm.compatible.e.q; import com.tencent.mm.compatible.i.a; import com.tencent.mm.compatible.util.d; import com.tencent.mm.kernel.g; import com.tencent.mm.platformtools.af; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.plugin.setting.a.b; import com.tencent.mm.plugin.setting.a.e; import com.tencent.mm.plugin.setting.a.i; import com.tencent.mm.plugin.setting.a.k; import com.tencent.mm.protocal.c.xt; import com.tencent.mm.sdk.platformtools.ad; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.w; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.aa; import com.tencent.mm.ui.base.preference.CheckBoxPreference; import com.tencent.mm.ui.base.preference.IconPreference; import com.tencent.mm.ui.base.preference.MMPreference; import com.tencent.mm.ui.base.preference.Preference; import com.tencent.mm.ui.base.preference.f; import com.tencent.mm.ui.base.s; import com.tencent.mm.ui.widget.a.c; public class SettingsAboutSystemUI extends MMPreference { private f eOE; private boolean isDeleteCancel = false; private ProgressDialog mQY = null; private boolean mRg = false; private int mRh = -1; private int mRi = -1; private boolean mRj = false; public final int Ys() { return k.settings_pref_system; } public void onCreate(Bundle bundle) { super.onCreate(bundle); this.mRg = false; initView(); } protected final void initView() { setMMTitle(i.settings_about_system); this.eOE = this.tCL; setBackBtn(new 1(this)); this.eOE.bw("settings_swipeback_mode", !d.fR(19)); if (!com.tencent.mm.bg.d.QS("backup")) { this.eOE.bw("settings_bak_chat", true); } bty(); this.eOE.bw("settings_traffic_statistic", com.tencent.mm.bg.d.cfH()); if (af.eyg) { this.eOE.bw("settings_take_photo", true); } } protected void onResume() { super.onResume(); CheckBoxPreference checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("settings_voice_play_mode"); if (checkBoxPreference != null) { checkBoxPreference.qpJ = ((Boolean) g.Ei().DT().get(26, Boolean.valueOf(false))).booleanValue(); checkBoxPreference.tDr = false; } checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("settings_enter_button_send"); if (checkBoxPreference != null) { checkBoxPreference.qpJ = ((Boolean) g.Ei().DT().get(66832, Boolean.valueOf(false))).booleanValue(); checkBoxPreference.tDr = false; } checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("settings_swipeback_mode"); if (checkBoxPreference != null) { checkBoxPreference.qpJ = a.zX(); checkBoxPreference.tDr = false; } Preference ZZ = this.eOE.ZZ("settings_language"); if (ZZ != null) { ZZ.setSummary(w.h(this.mController.tml, b.language_setting, i.app_lang_sys)); } bty(); btB(); btB(); btA(); NfcAdapter defaultAdapter = NfcAdapter.getDefaultAdapter(this); checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("settings_nfc_switch"); if (defaultAdapter == null) { this.eOE.bw("settings_nfc_switch", true); return; } this.eOE.bw("settings_nfc_switch", false); checkBoxPreference.setSummary(bi.oV((String) g.Ei().DT().get(aa.a.sQK, null))); if (this.mRg) { x.i("MicroMsg.SettingsAboutSystemUI", "lo-nfc-updateNfcOpenSwitch go setSystemNfc and back"); if (defaultAdapter.isEnabled()) { gT(true); hz(true); return; } } int intValue = ((Integer) g.Ei().DT().get(aa.a.sQG, Integer.valueOf(0))).intValue(); if (intValue == 0) { if (((Integer) g.Ei().DT().get(aa.a.sQH, Integer.valueOf(0))).intValue() == 1) { hz(true); } else { hz(false); } } else if (intValue == 1) { hz(true); } else { hz(false); } this.eOE.notifyDataSetChanged(); } protected void onDestroy() { boolean z = true; super.onDestroy(); if (this.mRj) { boolean z2; String str = "MicroMsg.SettingsAboutSystemUI"; String str2 = "kvstat, autodownload sight change: %d, %b"; Object[] objArr = new Object[2]; objArr[0] = Integer.valueOf(this.mRi); if (this.mRh == this.mRi) { z2 = true; } else { z2 = false; } objArr[1] = Boolean.valueOf(z2); x.i(str, str2, objArr); h hVar = h.mEJ; Object[] objArr2 = new Object[3]; objArr2[0] = Integer.valueOf(1); objArr2[1] = Integer.valueOf(this.mRi); if (this.mRh != this.mRi) { z = false; } objArr2[2] = Boolean.valueOf(z); hVar.h(11437, objArr2); } } public final boolean a(f fVar, Preference preference) { boolean z = false; String str = preference.mKey; boolean booleanValue; c.a aVar; LinearLayout linearLayout; c anj; if (str.equals("settings_landscape_mode")) { if (this.duR.getBoolean("settings_landscape_mode", false)) { setRequestedOrientation(-1); return true; } setRequestedOrientation(1); return true; } else if (str.equals("settings_voicerecorder_mode")) { if (this.duR.getBoolean("settings_voicerecorder_mode", q.deN.dbG != 1)) { return true; } com.tencent.mm.ui.base.h.a(this.mController.tml, i.settings_voicerecorder_mode_change_to_amr, i.app_tip, new 8(this), new 9(this)); return true; } else if (str.equals("settings_nfc_switch")) { NfcAdapter defaultAdapter = NfcAdapter.getDefaultAdapter(this); if (defaultAdapter == null) { x.i("MicroMsg.SettingsAboutSystemUI", "lo-nfc-goTosetNfcSwitch phone not suppot nfc"); return true; } int intValue = ((Integer) g.Ei().DT().get(aa.a.sQG, Integer.valueOf(0))).intValue(); int intValue2 = ((Integer) g.Ei().DT().get(aa.a.sQH, Integer.valueOf(0))).intValue(); if ((intValue == 2 || (intValue == 0 && intValue2 != 1)) && !defaultAdapter.isEnabled() && this.duR.getBoolean("settings_nfc_switch", false)) { hz(false); com.tencent.mm.ui.base.h.a(this.mController.tml, getString(i.nfc_off_tips), "", getString(i.nfc_open_title), getString(i.app_cancel), new 6(this), new 7(this)); return true; } gT(this.duR.getBoolean("settings_nfc_switch", false)); return true; } else if (str.equals("settings_voice_play_mode")) { booleanValue = ((Boolean) g.Ei().DT().get(26, Boolean.valueOf(false))).booleanValue(); String str2 = "MicroMsg.SettingsAboutSystemUI"; String str3 = "set voice mode from %B to %B"; Object[] objArr = new Object[2]; objArr[0] = Boolean.valueOf(booleanValue); objArr[1] = Boolean.valueOf(!booleanValue); x.d(str2, str3, objArr); com.tencent.mm.storage.x DT = g.Ei().DT(); if (!booleanValue) { z = true; } DT.set(26, Boolean.valueOf(z)); return true; } else if (str.equals("settings_enter_button_send")) { CheckBoxPreference checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("settings_enter_button_send"); if (checkBoxPreference == null) { return true; } x.d("MicroMsg.SettingsAboutSystemUI", "set enter button send : %s", new Object[]{Boolean.valueOf(checkBoxPreference.isChecked())}); g.Ei().DT().set(66832, Boolean.valueOf(r0)); return true; } else if (str.equals("settings_sns_sight_auto_download")) { aVar = new c.a(this.mController.tml); aVar.Gu(i.app_cancel); aVar.Gq(i.settings_sns_sight_auto_download_tips); View inflate = View.inflate(this.mController.tml, com.tencent.mm.plugin.setting.a.g.mm_alert_switch, null); linearLayout = (LinearLayout) inflate.findViewById(com.tencent.mm.plugin.setting.a.f.switcher_container); int a = bi.a((Integer) g.Ei().DT().get(327686, null), bi.getInt(com.tencent.mm.k.g.AT().getValue("SIGHTAutoLoadNetwork"), 1)); 2 2 = new 2(this, linearLayout, a); a(linearLayout, i.settings_sns_sight_auto_download_always, 1, 1 == a, 2); a(linearLayout, i.settings_sns_sight_auto_download_wifi, 2, 2 == a, 2); a(linearLayout, i.settings_sns_sight_auto_download_never, 3, 3 == a, 2); aVar.dR(inflate); anj = aVar.anj(); linearLayout.setTag(anj); anj.show(); addDialog(anj); this.mRj = true; return true; } else if (str.equals("settings_silence_update_mode")) { aVar = new c.a(this.mController.tml); aVar.Gu(i.app_cancel); aVar.Gq(i.settings_silence_update_mode); View inflate2 = View.inflate(this.mController.tml, com.tencent.mm.plugin.setting.a.g.mm_alert_switch, null); linearLayout = (LinearLayout) inflate2.findViewById(com.tencent.mm.plugin.setting.a.f.switcher_container); OnClickListener anonymousClass10 = new OnClickListener() { public final void onClick(View view) { int i; int i2; int i3 = 0; for (i = 0; i < linearLayout.getChildCount(); i++) { TextView textView = (TextView) linearLayout.getChildAt(i); if (com.tencent.mm.plugin.setting.a.f.tips_tv != textView.getId()) { textView.setCompoundDrawablesWithIntrinsicBounds(com.tencent.mm.plugin.setting.a.h.radio_off, 0, 0, 0); } } ((TextView) view).setCompoundDrawablesWithIntrinsicBounds(com.tencent.mm.plugin.setting.a.h.radio_on, 0, 0, 0); int intValue = ((Integer) g.Ei().DT().get(7, Integer.valueOf(0))).intValue(); int intValue2 = ((Integer) view.getTag()).intValue(); x.d("MicroMsg.SettingsAboutSystemUI", "settings_silence_update_mode choice: %d", new Object[]{Integer.valueOf(intValue2)}); if (intValue2 == 0) { i = 1; } else { i = 0; } if ((intValue & 16777216) == 0) { i2 = 1; } else { i2 = 0; } if (i != i2) { if (intValue2 == 0) { i3 = 1; } if (i3 != 0) { i = -16777217 & intValue; } else { i = intValue | 16777216; } i2 = i3 == 0 ? 1 : 2; g.Ei().DT().set(7, Integer.valueOf(i)); xt xtVar = new xt(); xtVar.rDz = 35; xtVar.rDA = i2; ((com.tencent.mm.plugin.messenger.foundation.a.i) g.l(com.tencent.mm.plugin.messenger.foundation.a.i.class)).FQ().b(new com.tencent.mm.plugin.messenger.foundation.a.a.h.a(23, xtVar)); com.tencent.mm.plugin.setting.b.ezo.vl(); view.post(new 1(this)); } } }; boolean z2 = (((Integer) g.Ei().DT().get(7, Integer.valueOf(0))).intValue() & 16777216) == 0; a(linearLayout, i.settings_silence_update_mode_wifi, 0, z2, anonymousClass10); a(linearLayout, i.settings_silence_update_mode_none, 1, !z2, anonymousClass10); aVar.dR(inflate2); anj = aVar.anj(); linearLayout.setTag(anj); anj.show(); addDialog(anj); return true; } else if (str.equals("settings_language")) { startActivity(new Intent(this.mController.tml, SettingsLanguageUI.class)); return true; } else if (str.equals("settings_text_size")) { return btz(); } else { Intent intent; if (str.equals("settings_chatting_bg")) { intent = new Intent(); intent.setClass(this, SettingsChattingBackgroundUI.class); this.mController.tml.startActivity(intent); return true; } else if (str.equals("settings_manage_findmoreui")) { intent = new Intent(); intent.setClass(this, SettingsManageFindMoreUI.class); startActivity(intent); return true; } else if (str.equals("settings_plugins")) { g.Ei().DT().set(-2046825377, Boolean.valueOf(false)); intent = new Intent(); intent.setClass(this, SettingsPluginsUI.class); startActivity(intent); com.tencent.mm.s.c.Cp().aV(262158, 266266); return true; } else if (str.equals("settings_reset")) { com.tencent.mm.ui.base.h.a(this.mController.tml, getResources().getString(i.settings_reset_warning), "", getString(i.app_clear), getString(i.app_cancel), new 5(this), null); return true; } else if (str.equals("settings_emoji_manager")) { intent = new Intent(); intent.putExtra("10931", 2); com.tencent.mm.bg.d.b(this.mController.tml, "emoji", ".ui.EmojiMineUI", intent); return true; } else if (str.equals("settngs_clean")) { if (g.Ei().isSDCardAvailable()) { com.tencent.mm.bg.d.b(this.mController.tml, "clean", ".ui.CleanUI", new Intent()); return true; } s.gH(this.mController.tml); return true; } else if (str.equals("settings_traffic_statistic")) { startActivity(new Intent(this, SettingsNetStatUI.class)); return true; } else if (str.equals("settings_text_size")) { return btz(); } else { if (str.equals("settings_swipeback_mode")) { CheckBoxPreference checkBoxPreference2 = (CheckBoxPreference) preference; booleanValue = a.zX(); com.tencent.mm.ui.base.h.a(this.mController.tml, getString(!booleanValue ? i.settings_swipeback_mode_open_tips : i.settings_swipeback_mode_close_tips), null, new 3(this), new 4(this, checkBoxPreference2, booleanValue)); return true; } if (str.equals("settings_take_photo")) { startActivity(new Intent(this, SettingsAboutCamera.class)); } return false; } } } private void bty() { int i; int i2 = 0; IconPreference iconPreference = (IconPreference) this.eOE.ZZ("settings_plugins"); if (bi.a((Boolean) g.Ei().DT().get(-2046825377, null), false)) { iconPreference.Er(0); iconPreference.dk(getString(i.app_new), e.new_tips_bg); } else { iconPreference.Er(8); iconPreference.dk("", -1); } if (com.tencent.mm.s.c.Cp().aU(262158, 266266)) { i = 0; } else { i = 8; } iconPreference.Et(i); com.tencent.mm.plugin.ab.a.bjk(); if (!com.tencent.mm.ao.c.ig(com.tencent.mm.ao.b.ebm)) { i2 = 8; } iconPreference.Et(i2); this.eOE.notifyDataSetChanged(); } private boolean btz() { startActivity(new Intent(this, SettingsFontUI.class)); return true; } private void gT(boolean z) { if (z) { getPackageManager().setComponentEnabledSetting(new ComponentName(ad.getPackageName(), "com.tencent.mm.plugin.nfc_open.ui.NfcWebViewUI"), 1, 1); g.Ei().DT().a(aa.a.sQG, Integer.valueOf(1)); return; } getPackageManager().setComponentEnabledSetting(new ComponentName(ad.getPackageName(), "com.tencent.mm.plugin.nfc_open.ui.NfcWebViewUI"), 2, 1); g.Ei().DT().a(aa.a.sQG, Integer.valueOf(2)); } private void hz(boolean z) { CheckBoxPreference checkBoxPreference = (CheckBoxPreference) this.eOE.ZZ("settings_nfc_switch"); ad.getContext().getSharedPreferences(ad.chY(), 0).edit().putBoolean("settings_nfc_switch", z).commit(); checkBoxPreference.qpJ = z; this.eOE.notifyDataSetChanged(); } private void btA() { boolean z = true; boolean z2 = bi.WU(com.tencent.mm.k.g.AT().getValue("SilentDownloadApkAtWiFi")) != 0; if ((com.tencent.mm.sdk.platformtools.e.bxm & 1) != 0) { x.d("MicroMsg.SettingsAboutSystemUI", "channel pack, not silence download."); z2 = true; } if (z2) { this.eOE.bw("settings_silence_update_mode", true); return; } this.eOE.bw("settings_silence_update_mode", false); if ((((Integer) g.Ei().DT().get(7, Integer.valueOf(0))).intValue() & 16777216) != 0) { z = false; } this.eOE.ZZ("settings_silence_update_mode").setSummary(getString(z ? i.settings_silence_update_mode_wifi : i.settings_silence_update_mode_none)); this.eOE.notifyDataSetChanged(); } private void a(LinearLayout linearLayout, int i, int i2, boolean z, OnClickListener onClickListener) { TextView textView = (TextView) View.inflate(this.mController.tml, com.tencent.mm.plugin.setting.a.g.radio_btn_item, null); textView.setText(i); textView.setTag(Integer.valueOf(i2)); linearLayout.addView(textView); textView.setOnClickListener(onClickListener); if (z) { textView.setCompoundDrawablesWithIntrinsicBounds(com.tencent.mm.plugin.setting.a.h.radio_on, 0, 0, 0); } } private void btB() { int a = bi.a((Integer) g.Ei().DT().get(327686, null), bi.getInt(com.tencent.mm.k.g.AT().getValue("SIGHTAutoLoadNetwork"), 1)); x.i("MicroMsg.SettingsAboutSystemUI", "auto getSightViewSummary %d, %d", new Object[]{Integer.valueOf(r1), Integer.valueOf(a)}); if (this.mRh == -1) { this.mRh = a; } this.mRi = a; if (3 == a) { a = i.settings_sns_sight_auto_download_never; } else if (2 == a) { a = i.settings_sns_sight_auto_download_wifi; } else { a = i.settings_sns_sight_auto_download_always; } Preference ZZ = this.eOE.ZZ("settings_sns_sight_auto_download"); if (!(ZZ == null || a == 0)) { ZZ.setSummary(getString(a)); } this.eOE.notifyDataSetChanged(); } }
/* */ package com.cleverfishsoftware.loadgenerator; import java.net.InetAddress; import java.net.UnknownHostException; /** * * @author peter */ public class GetCanonicalHostname { public static void main(String[] args) throws UnknownHostException { byte[] ipAddr = new byte[]{127, 0, 0, 1}; InetAddress addr = InetAddress.getByName("localhost"); System.out.println(addr.getCanonicalHostName()); } }
package com.microsilver.mrcard.basicservice.model; import lombok.Data; @Data public class FxSdSysAreaopen { private Long id; private Integer province; private Integer city; private Integer county; private String name; }
class Solution { public int longestSubsequence(int[] arr, int diff) { int n = arr.length , res = 0; HashMap<Integer , Integer> map = new HashMap(); for (int i = 0 ; i < n ; i++) { int val = arr[i] - diff; if (map.containsKey(val)) map.put(arr[i] , map.get(val) + 1); else map.put(arr[i] , 1); res = Math.max(res , map.get(arr[i])); } return res; } }
/* * Copyright 2019, E-Kohei * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.norana.numberplace; import android.app.Application; import com.norana.numberplace.database.SudokuDatabase; /** * Android Application class */ public class NumberPlaceApp extends Application{ private AppExecutors mAppExecutors; @Override public void onCreate(){ super.onCreate(); mAppExecutors = new AppExecutors(); } public SudokuDatabase getDatabase(){ return SudokuDatabase.getDatabase(this); } public SudokuRepository getRepository(){ return SudokuRepository.getRepository(getDatabase()); } public AppExecutors getExecutors(){ return mAppExecutors; } }
package com.pacific.dao; import com.pacific.dao.mapper.OptionChainRowMapper; import com.pacific.domain.Option; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.PreparedStatementCreator; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Repository; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Date; import java.util.List; /** * Created by yadavm on 05/06/14. */ @Repository public class OptionChainDaoImpl implements OptionChainDao { @Autowired JdbcTemplate jdbcTemplate; @Override public void create(Option option) { KeyHolder keyHolder = new GeneratedKeyHolder(); jdbcTemplate.update( new PreparedStatementCreator() { public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { PreparedStatement ps = connection.prepareStatement("insert into optionchain (stockdateid, expirationdate) values (?,?)", new String[] {"optionchainid"}); ps.setInt(1, option.getStockDateId()); ps.setDate(2, new java.sql.Date(option.getExpirationDate().getTime())); return ps; } }, keyHolder); option.setOptionChainId((Long) keyHolder.getKey()); } @Override public List<Option> getAll() { return jdbcTemplate.query("select * from optionchain", new OptionChainRowMapper()); } @Override public List<Option> getOne(Integer stockdateid, java.util.Date expirationdate) { return jdbcTemplate.query("select * from optionchain where stockdateid=? and expirationdate=?", new Object[]{stockdateid, new Date(expirationdate.getTime())}, new OptionChainRowMapper()); } @Override public Integer getCount(Integer stockdateid, java.util.Date expirationdate) { return jdbcTemplate.queryForObject("select * from optionchain where stockdateid=? and expirationdate=?", new Object[]{stockdateid, new Date(expirationdate.getTime())}, Integer.class); } @Override public int update(Option option) { return jdbcTemplate.update("update optionchain set stockdateid=?, expirationdate = ?, updatedate=current_date where optionchainid=?", new Object[]{option.getStockDateId(), option.getExpirationDate(), option.getOptionChainId()}); } @Override public int delete(Option option) { return jdbcTemplate.update("delete from optionchain where optionchainid=?", new Object[]{option.getOptionChainId()}); } }
package com.example.springtx; import com.example.springtx.bean.User; import com.example.springtx.mapper.UserMapper; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * @author Marco Song * @since 1.0.0 */ @RunWith(SpringRunner.class) @SpringBootTest public class UserMapperTest { @Autowired private UserMapper userMapper; @Test public void testAddUser() { User user = new User("admin","123",1); userMapper.addUser(user); Assert.assertNotNull(user.getId()); } @Test public void testDeleteUserById() { User user = new User("admin","123",1); userMapper.addUser(user); Integer count = userMapper.deleteUserById(user.getId()); Assert.assertEquals(new Integer(1), count); } @Test public void testUpdateUser() { User user = new User("admin","123",1); userMapper.addUser(user); user.setUsername("hr"); userMapper.updateUser(user); Assert.assertEquals("hr", user.getUsername()); } @Test public void testGetById() { User user = new User("admin","123",1); userMapper.addUser(user); User obj = userMapper.getById(user.getId()); Assert.assertEquals("admin", obj.getUsername()); Assert.assertEquals("123", obj.getPassword()); Assert.assertEquals(new Integer(1), obj.getStatus()); } }
package nl.rug.oop.flaps.simulation.view.panels.aircraft; import lombok.Getter; import lombok.extern.java.Log; import nl.rug.oop.flaps.simulation.controller.actions.OpenAircraftConfigurer; import nl.rug.oop.flaps.simulation.model.aircraft.Aircraft; import nl.rug.oop.flaps.simulation.model.world.World; import nl.rug.oop.flaps.simulation.model.world.WorldSelectionModelListener; import javax.swing.*; import java.awt.*; /** * * @author T.O.W.E.R. */ @Log public class AircraftPanel extends JPanel implements WorldSelectionModelListener { private final World world; @Getter private static AircraftPanel aircraftPanel; public AircraftPanel(World world) { super(new BorderLayout()); this.world = world; this.world.getSelectionModel().addListener(this); displayAircraft(null); aircraftPanel = this; } private void displayAircraft(Aircraft aircraft) { this.removeAll(); if(aircraft == null) { JLabel emptyLabel = new JLabel("No aircraft selected..", JLabel.CENTER); emptyLabel.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 30)); add(emptyLabel, BorderLayout.CENTER); revalidate(); repaint(); return; } add(new AircraftInfoPanel(aircraft, this.world.getSelectionModel()), BorderLayout.NORTH); ImageIcon blueprintIcon = new ImageIcon(aircraft.getType().getBannerImage().getScaledInstance(this.getWidth(), this.getWidth() / 3, Image.SCALE_SMOOTH)); add(new JLabel(blueprintIcon), BorderLayout.CENTER); var sm = this.world.getSelectionModel(); add(new JButton(new OpenAircraftConfigurer(sm.getSelectedAircraft(), sm)), BorderLayout.SOUTH); revalidate(); repaint(); } /** * displays the aircraft without the buttons * */ private void displayFlyingAircraft(Aircraft aircraft) { this.removeAll(); AircraftInfoPanel aircraftInfoPanelWithoutButton = new AircraftInfoPanel(aircraft, this.world.getSelectionModel()); aircraftInfoPanelWithoutButton.remove(aircraftInfoPanelWithoutButton.getSelectDestination()); add(aircraftInfoPanelWithoutButton, BorderLayout.NORTH); ImageIcon blueprintIcon = new ImageIcon(aircraft.getType().getBannerImage().getScaledInstance(this.getWidth(), this.getWidth() / 3, Image.SCALE_SMOOTH)); add(new JLabel(blueprintIcon), BorderLayout.CENTER); revalidate(); repaint(); } @Override public void aircraftSelected(Aircraft aircraft) { this.displayAircraft(aircraft); } @Override public void tripSelected() { this.displayFlyingAircraft(this.world.getSelectionModel().getSelectedAircraft()); } }
import java.util.Scanner; public class Problem5_21 {// Financial application public static void main(String[] args) { Scanner input = new Scanner(System.in); //Prompt the user to enter the loan amount System.out.print("Loan Amount: " ); double loanAmount = input.nextDouble(); System.out.print("Number of Years: "); int years = input.nextInt(); //Enter annual interest rate in percentage //System.out.print(" annual interest rate"); //double annualInterestRate = input.nextDouble(); //Obtain monthly interest rate System.out.println("Interest Rate \t Monthly Payment \t Total Payment"); for(double annualInterestRate = 5.000; annualInterestRate <= 8.000 ; annualInterestRate += (1d/8)) { double monthlyInterestRate = annualInterestRate / 1200; double monthlyPayment = loanAmount * monthlyInterestRate / (1 -1 / Math.pow(1 + monthlyInterestRate , years * 12)); double totalPayment = monthlyPayment * years * 12; System.out.printf("%.3f%% \t\t $%.2f \t\t $%.2f \n", annualInterestRate, monthlyPayment, totalPayment); } } }
import java.util.ArrayList; import java.util.List; /** * ArrayList Implementation of stack * * @author * */ public class StackUsingArrayList { /** ArrayList representation of the stack */ List<Integer> stackList; /** * Constructor */ StackUsingArrayList() { stackList = new ArrayList<>(); } /** * Adds value to the end of list which is the top for stack * * @param value * value to be added */ void push(int value) { stackList.add(value); } /** * Pops last element of list which is the top for Stack * * @return Element popped */ int pop() { if (!isEmpty()) { // checks for an empty Stack int popValue = stackList.get(stackList.size() - 1); stackList.remove(stackList.size() - 1); // removes the poped element return popValue; } else { System.out.print("The stack is empty "); return -1; } } /** * Checks for empty Stack * * @return true if stack is empty */ boolean isEmpty() { if (stackList.isEmpty()){ return true; } else { return false; } } /** * Top element of stack * * @return top element of stack */ int peek() { return stackList.get(stackList.size() - 1); } public static void main(String[] args) { StackUsingArrayList myStack = new StackUsingArrayList(); // Declare a stack of maximum size 4 // Populate the stack myStack.push(5); myStack.push(8); myStack.push(2); myStack.push(9); System.out.println("*********************Stack ArrayList Implementation*********************"); System.out.println(myStack.isEmpty()); // will print false System.out.println(myStack.peek()); // will print 9 System.out.println(myStack.pop()); // will print 9 System.out.println(myStack.peek()); // will print 2 System.out.println(myStack.pop()); // will print 2 } }
package cn.canlnac.onlinecourse.data.repository; import java.util.List; import java.util.Map; import javax.inject.Inject; import javax.inject.Singleton; import cn.canlnac.onlinecourse.data.entity.mapper.CatalogEntityDataMapper; import cn.canlnac.onlinecourse.data.entity.mapper.CommentListEntityDataMapper; import cn.canlnac.onlinecourse.data.entity.mapper.CourseEntityDataMapper; import cn.canlnac.onlinecourse.data.entity.mapper.CourseListEntityDataMapper; import cn.canlnac.onlinecourse.data.entity.mapper.DocumentListEntityDataMapper; import cn.canlnac.onlinecourse.data.repository.datasource.CourseDataStore; import cn.canlnac.onlinecourse.data.repository.datasource.CourseDataStoreFactory; import cn.canlnac.onlinecourse.domain.Catalog; import cn.canlnac.onlinecourse.domain.CommentList; import cn.canlnac.onlinecourse.domain.Course; import cn.canlnac.onlinecourse.domain.CourseList; import cn.canlnac.onlinecourse.domain.DocumentList; import cn.canlnac.onlinecourse.domain.repository.CourseRepository; import rx.Observable; /** * 课程数据接口,提供给domain调用. */ @Singleton public class CourseDataRepository implements CourseRepository { private final CourseDataStore courseDataStore; private final CourseEntityDataMapper courseEntityDataMapper; private final DocumentListEntityDataMapper documentListEntityDataMapper; private final CommentListEntityDataMapper commentListEntityDataMapper; private final CatalogEntityDataMapper catalogEntityDataMapper; private final CourseListEntityDataMapper courseListEntityDataMapper; @Inject public CourseDataRepository( CourseDataStoreFactory courseDataStoreFactory, CourseEntityDataMapper courseEntityDataMapper, DocumentListEntityDataMapper documentListEntityDataMapper, CommentListEntityDataMapper commentListEntityDataMapper, CatalogEntityDataMapper catalogEntityDataMapper, CourseListEntityDataMapper courseListEntityDataMapper ) { this.courseDataStore = courseDataStoreFactory.create(); this.courseEntityDataMapper = courseEntityDataMapper; this.documentListEntityDataMapper = documentListEntityDataMapper; this.commentListEntityDataMapper = commentListEntityDataMapper; this.catalogEntityDataMapper = catalogEntityDataMapper; this.courseListEntityDataMapper = courseListEntityDataMapper; } @Override public Observable<Course> getCourse(int courseId) { return courseDataStore.getCourse(courseId).map(courseEntityDataMapper::transform); } @Override public Observable<Void> updateCourse(int courseId, Map<String, String> course) { return courseDataStore.updateCourse(courseId, course); } @Override public Observable<Void> deleteCourse(int courseId) { return courseDataStore.deleteCourse(courseId); } @Override public Observable<Integer> createCourse(Map<String, String> course) { return courseDataStore.createCourse(course); } @Override public Observable<Void> likeCourse(int courseId) { return courseDataStore.likeCourse(courseId); } @Override public Observable<Void> unlikeCourse(int courseId) { return courseDataStore.unlikeCourse(courseId); } @Override public Observable<Void> favoriteCourse(int courseId) { return courseDataStore.favoriteCourse(courseId); } @Override public Observable<Void> unfavoriteCourse(int courseId) { return courseDataStore.unfavoriteCourse(courseId); } @Override public Observable<Integer> createDocument(int courseId, Map<String, String> document) { return courseDataStore.createDocument(courseId, document); } @Override public Observable<DocumentList> getDocumentsInCourse(int courseId, Integer start, Integer count, String sort) { return courseDataStore.getDocumentsInCourse(courseId, start, count, sort).map(documentListEntityDataMapper::transform); } @Override public Observable<CommentList> getCommentsInCourse(int courseId, Integer start, Integer count, String sort) { return courseDataStore.getCommentsInCourse(courseId,start,count,sort).map(commentListEntityDataMapper::transform); } @Override public Observable<Integer> createCommentInCourse(int courseId, Map<String, Object> comment) { return courseDataStore.createCommentInCourse(courseId,comment); } @Override public Observable<Integer> replyCommentInCourse(int courseId, int commentId, Map<String, Object> reply) { return courseDataStore.replyCommentInCourse(courseId, commentId, reply); } @Override public Observable<Integer> createCatalog(int courseId, Map<String, Object> catalog) { return courseDataStore.createCatalog(courseId, catalog); } @Override public Observable<List<Catalog>> getCatalogs(int courseId) { return courseDataStore.getCatalogs(courseId).map(catalogEntityDataMapper::transform); } @Override public Observable<CourseList> getCourses(Integer start, Integer count, String sort, List<String> departments) { return courseDataStore.getCourses(start, count, sort, departments).map(courseListEntityDataMapper::transform); } }
package org.fuserleer.network.messages; import org.fuserleer.node.Node; import org.fuserleer.serialization.DsonOutput; import org.fuserleer.serialization.SerializerId2; import org.fuserleer.serialization.DsonOutput.Output; import com.fasterxml.jackson.annotation.JsonProperty; @SerializerId2("network.message.pong") public final class PeerPongMessage extends NodeMessage { @JsonProperty("nonce") @DsonOutput(Output.ALL) private long nonce; PeerPongMessage() { super(); this.nonce = 0l; } public PeerPongMessage(Node node, long nonce) { super(node); this.nonce = nonce; } public long getNonce() { return this.nonce; } }
/* * UniTime 3.3 - 3.5 (University Timetabling Application) * Copyright (C) 2011 - 2013, UniTime LLC, and individual contributors * as indicated by the @authors tag. * * 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 org.unitime.localization.impl; import java.io.InputStream; import java.lang.reflect.Method; import java.util.Properties; import com.google.gwt.i18n.client.Constants; import com.google.gwt.i18n.client.Messages.DefaultMessage; /** * @author Tomas Muller */ public class ExportMessages { private static String array2string(String[] value) { String ret = ""; for (String s: value) { if (!ret.isEmpty()) ret += ","; ret += s.replace(",", "\\,"); } return ret; } public static void main(String[] args) { try { Class clazz = Class.forName(Localization.ROOT + System.getProperty("bundle", "CourseMessages")); String locale = System.getProperty("locale", "cs"); Properties properties = new Properties(); InputStream is = clazz.getClassLoader().getResourceAsStream(clazz.getName().replace('.', '/') + "_" + locale + ".properties"); if (is != null) properties.load(is); System.out.println("\"Key\",\"Default\",\"Value\""); for (Method method: clazz.getMethods()) { DefaultMessage dm = method.getAnnotation(DefaultMessage.class); String text = properties.getProperty(method.getName()); if (dm != null) System.out.println("\"" + method.getName() + "\",\"" + dm.value() + "\",\"" + (text == null ? "" : text) + "\""); Constants.DefaultBooleanValue db = method.getAnnotation(Constants.DefaultBooleanValue.class); if (db != null) System.out.println("\"" + method.getName() + "\",\"" + (db.value() ? "true" : "false") + "\",\"" + (text == null ? "" : text) + "\""); Constants.DefaultDoubleValue dd = method.getAnnotation(Constants.DefaultDoubleValue.class); if (dd != null) System.out.println("\"" + method.getName() + "\",\"" + dd.value() + "\",\"" + (text == null ? "" : text) + "\""); Constants.DefaultFloatValue df = method.getAnnotation(Constants.DefaultFloatValue.class); if (df != null) System.out.println("\"" + method.getName() + "\",\"" + df.value() + "\",\"" + (text == null ? "" : text) + "\""); Constants.DefaultIntValue di = method.getAnnotation(Constants.DefaultIntValue.class); if (di != null) System.out.println("\"" + method.getName() + "\",\"" + di.value() + "\",\"" + (text == null ? "" : text) + "\""); Constants.DefaultStringValue ds = method.getAnnotation(Constants.DefaultStringValue.class); if (ds != null) System.out.println("\"" + method.getName() + "\",\"" + ds.value() + "\",\"" + (text == null ? "" : text) + "\""); Constants.DefaultStringArrayValue dsa = method.getAnnotation(Constants.DefaultStringArrayValue.class); if (dsa != null) System.out.println("\"" + method.getName() + "\",\"" + array2string(dsa.value()) + "\",\"" + (text == null ? "" : text) + "\""); Constants.DefaultStringMapValue dsm = method.getAnnotation(Constants.DefaultStringMapValue.class); if (dsm != null) System.out.println("\"" + method.getName() + "\",\"" + array2string(dsm.value()) + "\",\"" + (text == null ? "" : text) + "\""); } } catch (Exception e) { e.printStackTrace(); } } }
import java.lang.reflect.Field; public class Hack { /** * @param args * @throws NoSuchFieldException * @throws SecurityException * @throws IllegalAccessException * @throws IllegalArgumentException */ public static void main(String[] args) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { String mail = "wada@jugem.co.jp"; System.out.println(mail); Field nameField = mail.getClass().getDeclaredField("value"); //Stringのvalueフィールドのクラス情報を取得 nameField.setAccessible(true); //プロテクトを強制的に解除 char[] c = {'h','o','g','e','@','d','h','w','g','e','.','n','e','.','j','p'}; nameField.set(mail, c); System.out.println(mail); } }
/** * <p> * This package contains high-level methods for deployment of WS-BPEL 2.0 * Processes unto WSO2 Business Process Servers. * </p> * * <p> * The package consist only of one class * {@link org.opentosca.bpsconnector.BpsConnector} which uses Axis2 generated * stubs for accessing web methods on an WSO2 BPS. * </p> */ package org.opentosca.bpsconnector;
package Strings; public class A extends B{ public int a=2; public A(int a) { this.a=a; } public static void main(String[] args) { // TODO Auto-generated method stub A obj = new A(3); System.out.println(obj.a); } }
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int testCases = scanner.nextInt(); scanner.nextLine(); for(int i = 0; i < testCases; i++) { char[] letters = scanner.nextLine().toCharArray(); int length = letters.length; int indexMismatch = -1; for(int j = 0; j < length/2; j++) { if(letters[j] != letters[length-1-j]) { indexMismatch = j; break; } // end if } // end for if(indexMismatch == -1) { System.out.println(-1); } else if (isPalindrome(letters, (indexMismatch+1), (length-1-indexMismatch))) { System.out.println(indexMismatch); } else if (isPalindrome(letters, indexMismatch, length-2-indexMismatch)) { System.out.println(length-1-indexMismatch); } } // end for } // end main() public static boolean isPalindrome(char[] word, int startIndex, int endIndex) { int a = startIndex; int b = endIndex; while(a < b) { if(word[a] != word[b]) { return false; } // end if a++; b--; } // end while return true; } // end isPalindrome() } // end class Solution
package cn.czfshine.network.im.server; /** * @author:czfshine * @date:2019/6/8 11:03 */ public class Main { public static void main(String[] args) { ImServer imServer = new ImServer(); imServer.start(); } }
package fr.lteconsulting; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; /* Utilisez cette classe à votre convenance, vous pouvez même la supprimer ! */ public class Tools { }
package com.tw.auth.domain.authority; import com.tw.auth.domain.AbstractAuditEntity; import lombok.Data; import lombok.EqualsAndHashCode; import javax.persistence.*; @Data @EqualsAndHashCode(callSuper=false) @Entity @Table(name = "AuthLookups") @IdClass(AuthLookupsPK.class) public class AuthLookups extends AbstractAuditEntity { @Id @Column(name = "LookupType") private String lookupType; @Id @Column(name = "LookupCode") private String lookupCode; @Column(name = "LookupValues") private String lookupValues; @Column(name = "ParentLookupType") private String parentLookupType; @Column(name = "ParentLookupCode") private String parentLookupCode; @Column(name = "Seq") private Short seq; @Column(name = "Memo") private String memo; }
package com.espendwise.manta.util.criteria; import java.io.Serializable; public class FilterValue implements Serializable { private String filterType; private String filterValue; public FilterValue() { } public FilterValue(String filterValue) { this.filterValue = filterValue; } public FilterValue(String filterValue, String filterType) { this.filterValue = filterValue; this.filterType = filterType; } public String getFilterType() { return filterType; } public void setFilterType(String filterType) { this.filterType = filterType; } public String getFilterValue() { return filterValue; } public void setFilterValue(String filterValue) { this.filterValue = filterValue; } @Override public String toString() { return "FilterValue{" + "filterType='" + filterType + '\'' + ", filterValue='" + filterValue + '\'' + '}'; } }
package com.rgsj3.sebbs.domain; import javax.persistence.*; import java.util.Date; import java.util.List; @Entity public class Topic { @Id @GeneratedValue private Integer id; private String title; private Date createDate; private Date replyDate; private Integer floor; private Integer click; @ManyToOne(targetEntity = User.class) private User user; @ManyToOne(targetEntity = User.class) private User replyUser; @ManyToOne(targetEntity = Board.class) private Board board; @OneToMany(targetEntity=Reply.class, mappedBy = "topic", cascade = CascadeType.ALL, orphanRemoval = true) private List<Reply> replyList; public Topic() { } public Integer getClick() { return click; } public void setClick(Integer click) { this.click = click; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Board getBoard() { return board; } public void setBoard(Board board) { this.board = board; } public List<Reply> getReplyList() { return replyList; } public void setReplyList(List<Reply> replyList) { this.replyList = replyList; } public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public Date getReplyDate() { return replyDate; } public void setReplyDate(Date replyDate) { this.replyDate = replyDate; } public Integer getFloor() { return floor; } public void setFloor(Integer floor) { this.floor = floor; } public User getReplyUser() { return replyUser; } public void setReplyUser(User replyUser) { this.replyUser = replyUser; } }
package com.goldgov.dygl.module.partyMemberDuty.duty.service; import com.goldgov.gtiles.core.service.Query; public class PartyMemberInfoDutyQuery extends Query { private String searchDutyId;//查询条件:履职要求主键 private String searchOrganizationId;//查询条件:组织名称 private String searchLoginId; private String[] loginIds; private Integer searchState; public Integer getSearchState() { return searchState; } public void setSearchState(Integer searchState) { this.searchState = searchState; } public String[] getLoginIds() { return loginIds; } public void setLoginIds(String[] loginIds) { this.loginIds = loginIds; } public String getSearchDutyId() { return searchDutyId; } public void setSearchDutyId(String searchDutyId) { this.searchDutyId = searchDutyId; } public String getSearchOrganizationId() { return searchOrganizationId; } public void setSearchOrganizationId(String searchOrganizationId) { this.searchOrganizationId = searchOrganizationId; } public String getSearchLoginId() { return searchLoginId; } public void setSearchLoginId(String searchLoginId) { this.searchLoginId = searchLoginId; } }
package com.tencent.mm.plugin.readerapp.ui; import android.content.Intent; import android.view.MenuItem; import android.view.MenuItem.OnMenuItemClickListener; import com.tencent.mm.model.bi; import com.tencent.mm.plugin.readerapp.b.a; class ReaderAppIntroUI$2 implements OnMenuItemClickListener { final /* synthetic */ ReaderAppIntroUI mnD; ReaderAppIntroUI$2(ReaderAppIntroUI readerAppIntroUI) { this.mnD = readerAppIntroUI; } public final boolean onMenuItemClick(MenuItem menuItem) { a.ezn.d(new Intent().putExtra("Contact_User", bi.he(ReaderAppIntroUI.a(this.mnD))), this.mnD); this.mnD.finish(); return true; } }
package basic; import org.junit.Test; import static org.junit.Assert.assertEquals; public class Exercise17Test { @Test public void test_findSquareRoot() { assertEquals(new Exercise17().findSqrtByBisection(16), 4, 0.000001); assertEquals(new Exercise17().findSqrtByBisection(3), 1.732051, 0.000001); assertEquals(new Exercise17().findSqrtByBisection(1), 1, 0.000001); assertEquals(new Exercise17().findSqrtByBisection(0.5), 0.707106, 0.000001); } }
package com.excel_Plugin; import java.io.IOException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; public class TestData { public static void main(String[] args) throws InvalidFormatException, IOException { String path=System.getProperty("user.dir")+"\\TestData\\TestData.xlsx"; ReadExcelData data=new ReadExcelData(path); data.loadExcelfile(); //data.rowCount("TestData"); //data.colCount("TestData"); //data.getTestcaseposition("TestData","TC_02"); //data.getcolpositin("TestData", "month"); String testdata=data.getData("TestData","TC_02","month"); System.out.println(testdata); } }
package edu.nju.web.controller; import edu.nju.data.entity.User; import edu.nju.data.util.VerifyResult; import edu.nju.logic.service.LoginService; import edu.nju.logic.vo.LoginStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.support.SessionStatus; import javax.servlet.http.HttpSession; /** * * Created by cuihao on 2016/7/11. */ @Controller @SessionAttributes("user") public class LoginController { @Autowired LoginService loginService; @RequestMapping("/login") public String login(@RequestParam(defaultValue="") String formerUrl, HttpSession session) { if(!formerUrl.equals("")) { session.setAttribute("formerUrl", formerUrl); } return "login"; } /** * 注销登陆 * @param session * @return */ @RequestMapping("/logout") public String logout(String formerUrl, HttpSession session,SessionStatus sessionStatus) { session.removeAttribute("user"); // session.invalidate(); sessionStatus.setComplete(); return "redirect:"+formerUrl; } }
package com.xjf.wemall.service.threadTest.ThreadPool; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.RejectedExecutionException; public class threadPool1 { //public static LinkedBlockingQueue<Runnable> blockQueue = new LinkedBlockingQueue<Runnable>(); // 核心池满了,往阻塞队列里面塞,阻塞队列满了,如果小于线程池最大数,则直接执行。 // 如果大于,拒绝执行 public static void main(String[] args) throws InterruptedException { ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 10, 200, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(5)); threadPool1 poolThread = new threadPool1(); // for (int i = 0; i < 15; i++) { for (int i = 0; i < 20; i++) { MyTask myTask = poolThread.new MyTask(i); try { executor.execute(myTask); } catch (RejectedExecutionException e) { System.out.println(i + "的线程池已满,被拒绝"); // 被拒绝后,开线程继续执行,但是此时,executor.shutdown();不能被执行 MyPoolTask reTask = poolThread.new MyPoolTask(executor, myTask); Thread reThread = new Thread(reTask); reThread.start(); } catch (Exception e) { System.out.println("未知错误"); } System.out.println("线程池中线程数目:" + executor.getPoolSize() + ",队列中等待执行的任务数目:" + executor.getQueue().size() + ",已执行完别的任务数目:" + executor.getCompletedTaskCount()); } // executor.shutdown(); } // 线程池线程 class MyTask implements Runnable { private int taskNum; public MyTask(int num) { this.taskNum = num; } public int getTask() { return taskNum; } @SuppressWarnings("static-access") @Override public void run() { System.out.println("正在执行task " + taskNum); try { Thread.currentThread().sleep(4000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("task " + taskNum + "执行完毕"); } } // 被拒绝后,执行线程池线程 class MyPoolTask implements Runnable { ThreadPoolExecutor executor; MyTask task; public MyPoolTask(ThreadPoolExecutor executor, MyTask task) { this.executor = executor; this.task = task; } @SuppressWarnings("static-access") @Override public void run() { System.out.println("重新正在执行task " + task.getTask()); try { executor.execute(task); } catch (RejectedExecutionException e) { System.out.println(task.getTask() + "的线程池已满,被拒绝"); try { Thread.currentThread().sleep(2000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // 再次执行 run(); } } } }
package com.devskiller.evaluation; import org.junit.jupiter.api.Test; import com.devskiller.sample.CommonsStringProcessor; import com.devskiller.sample.StringProcessor; import static org.assertj.core.api.Assertions.assertThat; class StringProcessorCheckTests { @Test void shouldAbbreviateNumbers() { StringProcessor stringProcessor = new CommonsStringProcessor(); assertThat(stringProcessor.abbreviate("12345", 4)).isEqualTo("1..."); } @Test void shouldAbbreviateToLongString() { StringProcessor stringProcessor = new CommonsStringProcessor(); assertThat(stringProcessor.abbreviate("abcdef", 5)).isEqualTo("ab..."); } }
package com.tencent.mm.plugin.appbrand.jsapi; import android.content.Context; import com.tencent.mm.plugin.appbrand.l; import com.tencent.mm.plugin.appbrand.page.n; import com.tencent.mm.plugin.appbrand.page.p; import com.tencent.mm.plugin.appbrand.r.c; import com.tencent.mm.plugin.appbrand.r.m; import com.tencent.mm.sdk.a.b; import com.tencent.mm.ui.MMActivity; import java.util.HashMap; import java.util.Map; import junit.framework.Assert; import org.json.JSONObject; public abstract class e extends b { public String fEX; public final String f(String str, Map<String, ? extends Object> map) { Map hashMap = new HashMap(); hashMap.put("errMsg", getName() + ":" + str); if (map != null) { if (b.chp() && map.containsKey("errMsg")) { Assert.assertTrue("api " + getName() + ": Cant put errMsg in res!!!", false); } hashMap.putAll(map); } c.m(hashMap); return new JSONObject(hashMap).toString(); } public final String a(l lVar, String str, Map<String, ? extends Object> map) { if (m.a(lVar, map, this)) { return f(str, map); } return f(this.fEX, null); } public static MMActivity c(l lVar) { n nVar = lVar.fdO.fcz; if (nVar == null) { return null; } Context context = nVar.getContext(); if (context instanceof MMActivity) { return (MMActivity) context; } return null; } public static p d(l lVar) { n nVar = lVar.fdO.fcz; if (nVar == null || nVar.getCurrentPage() == null) { return null; } return nVar.getCurrentPage().getCurrentPageView(); } }
package com.example.diabeticspredictor.Adapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.diabeticspredictor.Model.Food; import com.example.diabeticspredictor.R; import org.w3c.dom.Text; import java.util.List; public class FoodAdapter extends RecyclerView.Adapter<FoodAdapter.MyViewHolder> { private List<Food> foodList; public FoodAdapter(List<Food> foodList) { this.foodList = foodList; } @NonNull @Override public FoodAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.list_item_single, parent, false); return new MyViewHolder(itemView); } @Override public void onBindViewHolder(@NonNull FoodAdapter.MyViewHolder holder, int position) { Food food = foodList.get(position); holder.foodName.setText(food.getFoodName()); holder.foodInfo.setText(food.getFoodInfo()); } @Override public int getItemCount() { return foodList.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { TextView foodName, foodInfo; public MyViewHolder(@NonNull View itemView) { super(itemView); foodName = itemView.findViewById(R.id.foodNameTv); foodInfo = itemView.findViewById(R.id.foodInfoTv); } } }
package com.cngl.bilet.api; import java.util.List; import javax.validation.Valid; import com.cngl.bilet.dto.BiletRequestDto; import com.cngl.bilet.dto.BiletResponseDto; import com.cngl.bilet.service.impl.BiletServiceImpl; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; public class BiletController { private final BiletServiceImpl biletServiceImpl; public BiletController(BiletServiceImpl biletServiceImpl) { this.biletServiceImpl=biletServiceImpl; } @GetMapping public ResponseEntity<List<BiletResponseDto>> tumunuGetir(){ return ResponseEntity.ok(biletServiceImpl.tumunuGetir()); } @GetMapping("/id") public ResponseEntity<BiletResponseDto> idYeGoreGetir(@PathVariable(value="id") Long id) throws Exception{ return ResponseEntity.ok(biletServiceImpl.idYeGoreGetir(id)); } @GetMapping("/pnr/no") public ResponseEntity<BiletResponseDto> idYeGoreGetir(@PathVariable(value="no") String pnr) throws Exception{ return ResponseEntity.ok(biletServiceImpl.pnrYeGoreGetir(pnr)); } @PostMapping public ResponseEntity<BiletResponseDto> kaydet(@RequestBody @Valid BiletRequestDto entity)throws Exception { return ResponseEntity.ok(biletServiceImpl.kaydet(entity)); } @PutMapping public ResponseEntity<BiletResponseDto> guncelle(@RequestBody @Valid BiletRequestDto entity)throws Exception { return ResponseEntity.ok(biletServiceImpl.guncelle(entity)); } @DeleteMapping("/id") public ResponseEntity<Boolean> sil(@PathVariable(value="id") Long id) throws Exception { return ResponseEntity.ok(biletServiceImpl.aktifPasifEt(id)); } }
package android.huyhuynh.orderserverapp; import androidx.appcompat.app.AppCompatActivity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.huyhuynh.orderserverapp.model.NhanVien; import android.huyhuynh.orderserverapp.retrofit.APIUltils; import android.huyhuynh.orderserverapp.retrofit.DataClient; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class MainActivity extends AppCompatActivity { EditText edtUsername, edtPass; Button btnLogin; public static NhanVien nv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } private void init() { edtUsername = findViewById(R.id.edtLoginusername); edtPass = findViewById(R.id.edtLoginPass); btnLogin = findViewById(R.id.btnLogin); } public void loginToServer(View view) { final String username = edtUsername. getText().toString(); String password = edtPass.getText().toString(); DataClient dataClient = APIUltils.getDataClient(); Call<NhanVien> callback = dataClient.loginToServer(username,password); callback.enqueue(new Callback<NhanVien>() { @Override public void onResponse(Call<NhanVien> call, Response<NhanVien> response) { nv = response.body(); if (nv.getUsername().equals(username)){ if (nv.getChucVu()){ Intent intent = new Intent(MainActivity.this,ManagerActivity.class); intent.putExtra("username",nv.getUsername()); startActivity(intent); finish(); } else if (!nv.getChucVu()){ Intent intent = new Intent(MainActivity.this,OrderActivity.class); intent.putExtra("username",nv.getUsername()); startActivity(intent); finish(); } } else { thongBao("Đăng nhập thất bại!"); } } @Override public void onFailure(Call<NhanVien> call, Throwable t) { Log.d("MainActivity", "onFailure - loginToServer: "+t.toString()); } }); } private void thongBao(String message){ AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setTitle("Thông báo"); builder.setMessage(message); builder.setNegativeButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.show(); } }
package com.dishcuss.foodie.hub.Adapters; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.dishcuss.foodie.hub.Models.FoodItems; import com.dishcuss.foodie.hub.Models.FoodsCategory; import com.dishcuss.foodie.hub.Models.PhotoModel; import com.dishcuss.foodie.hub.R; import com.dishcuss.foodie.hub.Utils.Constants; import io.realm.RealmList; /** * Created by Naeem Ibrahim on 9/16/2016. */ public class RestaurantMenuAdapter extends RecyclerView.Adapter<RestaurantMenuAdapter.ViewHolder> { private RealmList<FoodItems> foodItemsRealmList; Context context; public static class ViewHolder extends RecyclerView.ViewHolder { public TextView menuItemName,menuItemType,menuItemPrice; public ImageView menuItemImage; public RelativeLayout select_a_menu_parent; public ViewHolder(View v) { super(v); menuItemName = (TextView) v.findViewById(R.id.menu_item_name); menuItemType = (TextView) v.findViewById(R.id.menu_item_type); menuItemPrice = (TextView) v.findViewById(R.id.menu_item_price); menuItemImage=(ImageView) v.findViewById(R.id.menu_item_image); select_a_menu_parent=(RelativeLayout) v.findViewById(R.id.select_a_menu_parent); } } public RestaurantMenuAdapter(RealmList<FoodItems> foodItemsRealmList,Context context) { this.foodItemsRealmList=foodItemsRealmList; this.context=context; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.restaurant_menu_row, parent, false); ViewHolder vh = new ViewHolder(v); return vh; } @Override public void onBindViewHolder(ViewHolder holder, final int position) { holder.menuItemName.setText(foodItemsRealmList.get(position).getName()); holder.menuItemPrice.setText(foodItemsRealmList.get(position).getPrice()+" PKR"); RealmList<FoodsCategory> foodsCategoryRealmList=foodItemsRealmList.get(position).getFoodsCategories(); if(foodsCategoryRealmList.size()>0){ for (int j=0;j<foodsCategoryRealmList.size();j++){ holder.menuItemType.setText(foodsCategoryRealmList.get(0).getCategoryName()); } }else { holder.menuItemType.setVisibility(View.INVISIBLE); } RealmList<PhotoModel> photoModelRealmList=foodItemsRealmList.get(position).getPhotoModels(); if(photoModelRealmList.size()>0) { for (int j = 0; j < photoModelRealmList.size(); j++) { Constants.PicassoImageSrc(photoModelRealmList.get(0).getUrl(),holder.menuItemImage,context); } } holder.select_a_menu_parent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Intent intent=new Intent(context, RestaurantDetailActivity.class); // intent.putExtra("RestaurantID", restaurantRealmList.get(position).getId()); // context.startActivity(intent); } }); holder.setIsRecyclable(false); } @Override public int getItemCount() { return foodItemsRealmList.size(); } }
package com.rc.portal.vo; public class TGoodsExtend { private Long goodsid; private String pinyinCode; private String bases; private String characterd; private String indication; private String usaged; private String untowardEffect; private String taboo; private String note; private String pharmacology; private String storaged; private String packing; private String lasts; private String attending; private String seoTitle; private String seoKeyword; private String seoDescribe; private String symptom; private String symptomRm; private String position; private String positionRm; private String disease; private String diseaseRm; public Long getGoodsid() { return goodsid; } public void setGoodsid(Long goodsid) { this.goodsid = goodsid; } public String getPinyinCode() { return pinyinCode; } public void setPinyinCode(String pinyinCode) { this.pinyinCode = pinyinCode; } public String getBases() { return bases; } public void setBases(String bases) { this.bases = bases; } public String getCharacterd() { return characterd; } public void setCharacterd(String characterd) { this.characterd = characterd; } public String getIndication() { return indication; } public void setIndication(String indication) { this.indication = indication; } public String getUsaged() { return usaged; } public void setUsaged(String usaged) { this.usaged = usaged; } public String getUntowardEffect() { return untowardEffect; } public void setUntowardEffect(String untowardEffect) { this.untowardEffect = untowardEffect; } public String getTaboo() { return taboo; } public void setTaboo(String taboo) { this.taboo = taboo; } public String getNote() { return note; } public void setNote(String note) { this.note = note; } public String getPharmacology() { return pharmacology; } public void setPharmacology(String pharmacology) { this.pharmacology = pharmacology; } public String getStoraged() { return storaged; } public void setStoraged(String storaged) { this.storaged = storaged; } public String getPacking() { return packing; } public void setPacking(String packing) { this.packing = packing; } public String getLasts() { return lasts; } public void setLasts(String lasts) { this.lasts = lasts; } public String getAttending() { return attending; } public void setAttending(String attending) { this.attending = attending; } public String getSeoTitle() { return seoTitle; } public void setSeoTitle(String seoTitle) { this.seoTitle = seoTitle; } public String getSeoKeyword() { return seoKeyword; } public void setSeoKeyword(String seoKeyword) { this.seoKeyword = seoKeyword; } public String getSeoDescribe() { return seoDescribe; } public void setSeoDescribe(String seoDescribe) { this.seoDescribe = seoDescribe; } public String getSymptom() { return symptom; } public void setSymptom(String symptom) { this.symptom = symptom; } public String getSymptomRm() { return symptomRm; } public void setSymptomRm(String symptomRm) { this.symptomRm = symptomRm; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } public String getPositionRm() { return positionRm; } public void setPositionRm(String positionRm) { this.positionRm = positionRm; } public String getDisease() { return disease; } public void setDisease(String disease) { this.disease = disease; } public String getDiseaseRm() { return diseaseRm; } public void setDiseaseRm(String diseaseRm) { this.diseaseRm = diseaseRm; } }
package Hub; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import javax.swing.JFrame; import javax.swing.JPanel; import Academic.Quiz; import Minigame.BallGame; import Minigame.MusicGame; import processing.awt.PSurfaceAWT; public class Main extends JFrame { private JPanel cardPanel; private StartWindow start1; private CustomizationWindow start2; private GameWindow gamePanel; private PSurfaceAWT gameSurf; private PSurfaceAWT.SmoothCanvas gameProcessingCanvas; private BallGame miniPanelA; private PSurfaceAWT miniPanelSurfA; private PSurfaceAWT.SmoothCanvas miniPanelProcessingCanvasA; private MusicGame miniPanelB; private PSurfaceAWT miniPanelSurfB; private PSurfaceAWT.SmoothCanvas miniPanelProcessingCanvasB; private Quiz quizPanel; private PSurfaceAWT quizSurf; private PSurfaceAWT.SmoothCanvas quizProcessingCanvas; private Student player; private StressBar stress; private Gradebook book; public static int WIDTH = 800; public static int HEIGHT = 600; public Main() { player = new Student(); stress = new StressBar(150,30); book = new Gradebook(); start1 = new StartWindow(this); start2 = new CustomizationWindow(this); gamePanel = new GameWindow(this, stress, book); gamePanel.runMe(); gameSurf = (PSurfaceAWT)gamePanel.getSurface(); gameProcessingCanvas = (PSurfaceAWT.SmoothCanvas)gameSurf.getNative(); miniPanelA = new BallGame(this); miniPanelA.runMe(); miniPanelSurfA = (PSurfaceAWT)miniPanelA.getSurface(); miniPanelProcessingCanvasA = (PSurfaceAWT.SmoothCanvas)miniPanelSurfA.getNative(); miniPanelB = new MusicGame(this); miniPanelB.runMe(); miniPanelSurfB = (PSurfaceAWT)miniPanelB.getSurface(); miniPanelProcessingCanvasB = (PSurfaceAWT.SmoothCanvas)miniPanelSurfB.getNative(); quizPanel = new Quiz(this); quizPanel.runMe(); quizSurf = (PSurfaceAWT)quizPanel.getSurface(); quizProcessingCanvas = (PSurfaceAWT.SmoothCanvas)quizSurf.getNative(); cardPanel = new JPanel(); CardLayout layout = new CardLayout(); cardPanel.setLayout(layout); cardPanel.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent arg0) { Component x = (Component)arg0.getSource(); fixProcessingPanelSizes(x); } }); cardPanel.add(start1, "1"); cardPanel.add(start2, "2"); cardPanel.add(gameProcessingCanvas, "3"); cardPanel.add(miniPanelProcessingCanvasA, "4"); cardPanel.add(miniPanelProcessingCanvasB, "5"); cardPanel.add(quizProcessingCanvas, "6"); setLayout(new BorderLayout()); setTitle("High School Experience"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800, 600); add(cardPanel, BorderLayout.CENTER); setVisible(true); setResizable(false); } public void fixProcessingPanelSizes(Component match) { gameSurf.setSize(match.getWidth(),match.getHeight()); } public static void main(String[] args) { Main m = new Main(); } public void changePanel(String name) { ((CardLayout)cardPanel.getLayout()).show(cardPanel,name); if (name.equals("3")) { gameProcessingCanvas.requestFocus(); gamePanel.pause(false); miniPanelA.pause(true); miniPanelB.pause(true); quizPanel.pause(true); this.setSize(500, 538); } else if (name.equals("4")) { miniPanelProcessingCanvasA.requestFocus(); miniPanelA.pause(false); miniPanelA.reset(); this.setSize(500, 580); } else if (name.equals("5")) { miniPanelProcessingCanvasB.requestFocus(); miniPanelB.pause(false); miniPanelB.reset(); this.setSize(500, 538); } else if (name.equals("6")) { quizProcessingCanvas.requestFocus(); quizPanel.pause(false); quizPanel.reset(); this.setSize(500, 538); } } public void setPlayerState(String name, int classType) { player.setClassType(classType); player.setName(name); } public void updatePlayerScore(int score) { if(score >= 90) stress.stressIncrease(0); else if(score >= 80) stress.stressIncrease(5); else if(score >= 70) stress.stressIncrease(10); else if(score >= 60) stress.stressIncrease(15); else stress.stressIncrease(20); book.addGrade(new Grade(score)); player.updateScore(score); } public String getPlayerName() { return player.getName(); } public int getPlayerClassType() { return player.getClassType(); } }
package day14_multi_branch_if_statements; public class MultiBranchIfStatement { public static void main (String [] args){ int day = 5; if (day ==1){ System.out.println(" Monday"); }else{ System.out.println("Not Monday"); }if (day ==2){ System.out.println(" Tuesday"); } System.out.println ("**************************"); day =1; if (day ==1) { System.out.println(" Monday"); }else if(day == 2){ System.out.println(" Tuesday" ); }else if(day ==3){ System.out.println(" Wednesday "); }else if (day ==4){ System.out.println("Thursday "); }else{ System.out.println("Java day"); } System.out.println(" Everyday code java"); } }
package com.orca.form; public class ReportForm { private String type; private Integer evaluationId; private Integer firstSurveyId; private Integer secondSurveyId; private Integer thirdSurveyId; private Integer fourthSurveyId; public String getType() { return type; } public void setType(String type) { this.type = type; } public Integer getEvaluationId() { return evaluationId; } public void setEvaluationId(Integer evaluationId) { this.evaluationId = evaluationId; } public Integer getFirstSurveyId() { return firstSurveyId; } public void setFirstSurveyId(Integer firstSurveyId) { this.firstSurveyId = firstSurveyId; } public Integer getSecondSurveyId() { return secondSurveyId; } public void setSecondSurveyId(Integer secondSurveyId) { this.secondSurveyId = secondSurveyId; } public Integer getThirdSurveyId() { return thirdSurveyId; } public void setThirdSurveyId(Integer thirdSurveyId) { this.thirdSurveyId = thirdSurveyId; } public Integer getFourthSurveyId() { return fourthSurveyId; } public void setFourthSurveyId(Integer fourthSurveyId) { this.fourthSurveyId = fourthSurveyId; } }
package com.classcheck.gen; import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.classcheck.autosource.Method; public class CheckMember { private List<Method> methodList; public CheckMember(List<Method> methodList) { this.methodList = methodList; } public void doCheck(){ Method method; String methodBody; List<Method> removeMethods = new ArrayList<Method>(); for(int i = 0;i<methodList.size() ;i++){ method = methodList.get(i); methodBody = method.getMethodBody(); if (writtenNewSt(methodBody) || bodyCounter(methodBody) <= 0) { removeMethods.add(method); } } for(int i =0;i<removeMethods.size();i++){ methodList.remove(removeMethods.get(i)); } } public List<Method> getMemberList() { return methodList; } private boolean writtenNewSt(String body) { StringReader sr = new StringReader(body); BufferedReader br = new BufferedReader(sr); String line; //メソッドのステートメントに //ある記述がされていると //除外するようにする //Pattern pattern = Pattern.compile("=\\s+new\\s"); Pattern pattern = Pattern.compile("(=|\\s+new\\s|this..)"); Matcher matcher; try { while((line = br.readLine()) != null){ matcher = pattern.matcher(line); if (matcher.find()){ return true; } } } catch (IOException e) { e.printStackTrace(); } return false; } private int bodyCounter(String body){ if (body == null || body.equals("")) { return 0; } int lineNum = 0; StringReader sr = new StringReader(body); BufferedReader br = new BufferedReader(sr); String line; boolean written_return = false; try { while((line = br.readLine()) != null){ if (line.contains("return 0")){ written_return = true; }else if (line.contains("return null")) { written_return = true; }else if (line.contains("return false")) { written_return = true; }else if (line.contains("return true")) { written_return = true; } lineNum++; } br.close(); } catch (IOException e) { e.printStackTrace(); } //1行のみで「return null,0,false」しか書かれていない場合も0行とみなす if (written_return && lineNum <= 1) { lineNum = 0; } return lineNum; } }
// Sun Certified Java Programmer // Chapter 2, P166 package self_test_9; class Tree { }
package de.zarncke.lib.time; import java.util.Collection; import org.joda.time.ReadableInterval; import de.zarncke.lib.math.Intervals; /** * Specialized supplier for Interval lists. * * @author Gunnar Zarncke */ public interface IntervalProvider { Collection<? extends ReadableInterval> getIntervals(ReadableInterval extent); Intervals.Relation getOverlapRelation(); }
/* * Sonar C# Plugin :: Core * Copyright (C) 2010 Jose Chillan, Alexandre Victoor and SonarSource * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ package org.sonar.plugins.csharp.api.sensor; import java.util.Collection; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.resources.File; import org.sonar.api.resources.Project; import org.sonar.dotnet.tools.commons.utils.FileFinder; import org.sonar.dotnet.tools.commons.visualstudio.VisualStudioProject; import org.sonar.dotnet.tools.commons.visualstudio.VisualStudioSolution; import org.sonar.plugins.csharp.api.CSharpConstants; import org.sonar.plugins.csharp.api.MicrosoftWindowsEnvironment; /** * This sensor gets executed on every C# sub-projects, but not on the root project (= the solution). <br/> * <br/> * Super class of {@link AbstractRegularCSharpSensor} and {@link AbstractTestCSharpSensor}. */ public abstract class AbstractCSharpSensor implements Sensor { private MicrosoftWindowsEnvironment microsoftWindowsEnvironment; /** * Creates an {@link AbstractCSharpSensor} that has a {@link MicrosoftWindowsEnvironment} reference. * * @param microsoftWindowsEnvironment * the {@link MicrosoftWindowsEnvironment} */ protected AbstractCSharpSensor(MicrosoftWindowsEnvironment microsoftWindowsEnvironment) { this.microsoftWindowsEnvironment = microsoftWindowsEnvironment; } /** * {@inheritDoc} */ public boolean shouldExecuteOnProject(Project project) { if (project.isRoot()) { return false; } return CSharpConstants.LANGUAGE_KEY.equals(project.getLanguageKey()); } /** * {@inheritDoc} */ public abstract void analyse(Project project, SensorContext context); /** * Returns the Sonar file representation ({@link File}) of the given file, if that file exists in the given project. * * @param file * the real file * @param project * the project * @return the Sonar resource if it exists in this project, or null if not. */ public File fromIOFile(java.io.File file, Project project) { return File.fromIOFile(file, project); } /** * Returns the Visual Studio Project corresponding to the given Sonar Project. * * @param project * the Sonar Project * @return the VS Project */ protected VisualStudioProject getVSProject(Project project) { return microsoftWindowsEnvironment.getCurrentProject(project.getName()); } protected VisualStudioSolution getVSSolution() { return microsoftWindowsEnvironment.getCurrentSolution(); } /** * Returns the {@link MicrosoftWindowsEnvironment} object. * * @return the {@link MicrosoftWindowsEnvironment} */ protected MicrosoftWindowsEnvironment getMicrosoftWindowsEnvironment() { return microsoftWindowsEnvironment; } protected Collection<java.io.File> findFiles(Project project, String... queries) { VisualStudioSolution vsSolution = microsoftWindowsEnvironment.getCurrentSolution(); VisualStudioProject vsProject = getVSProject(project); return FileFinder.findFiles(vsSolution, vsProject, queries); } }
package com.example.module_b; import android.util.Log; import com.example.module_base.InterfaceB; /** * ****************************** * * @author YOULU-wwb * date: 2020/1/17 16:30 * description: * ****************************** */ @Service public class BService implements InterfaceB { @Override public void method_b() { Log.e("interface","-----------B service"); } }
package it.test.strutturali; import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ AbbonamentoTest.class, CartaDiCreditoTest.class, CinemaTest.class, CircuitoTest.class, ClienteTest.class, FilmTest.class, ManagerTest.class, PrenotazioneTest.class, ProgrammazioneTest.class, RecensioneTest.class, SalaTest.class, UtenteTest.class }) public class TestSuiteS { }
/** * Paintroid: An image manipulation application for Android. * Copyright (C) 2010-2013 The Catrobat Team * (<http://developer.catrobat.org/credits>) * * 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 org.catrobat.paintroid.test.integration.tools; import java.util.ArrayList; import org.catrobat.paintroid.PaintroidApplication; import org.catrobat.paintroid.R; import org.catrobat.paintroid.test.integration.BaseIntegrationTestClass; import org.catrobat.paintroid.test.utils.PrivateAccess; import org.catrobat.paintroid.test.utils.Utils; import org.catrobat.paintroid.tools.ToolType; import org.catrobat.paintroid.tools.implementation.BaseTool; import org.catrobat.paintroid.ui.DrawingSurface; import org.junit.Before; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Cap; import android.graphics.PointF; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.TextView; public class EraserToolIntegrationTest extends BaseIntegrationTestClass { public EraserToolIntegrationTest() throws Exception { super(); } @Override @Before protected void setUp() { super.setUp(); } public void testEraseNothing() { assertTrue("Waiting for DrawingSurface", mSolo.waitForView(DrawingSurface.class, 1, TIMEOUT)); DrawingSurface drawingSurface = (DrawingSurface) getActivity().findViewById(R.id.drawingSurfaceView); PointF screenPoint = new PointF(mScreenWidth / 2, mScreenHeight / 2); PointF canvasPoint = Utils.getCanvasPointFromScreenPoint(screenPoint); int colorBeforeErase = drawingSurface.getPixel(canvasPoint); assertEquals("Get transparent background color", Color.TRANSPARENT, colorBeforeErase); selectTool(ToolType.ERASER); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_SLEEP); int colorAfterErase = drawingSurface.getPixel(canvasPoint); assertEquals("Pixel should still be transparent", Color.TRANSPARENT, colorAfterErase); } public void testErase() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { assertTrue("Waiting for DrawingSurface", mSolo.waitForView(DrawingSurface.class, 1, TIMEOUT)); PointF screenPoint = new PointF(mScreenWidth / 2, mScreenHeight / 2); PointF canvasPoint = Utils.getCanvasPointFromScreenPoint(screenPoint); ((Bitmap) PrivateAccess.getMemberValue(DrawingSurface.class, PaintroidApplication.drawingSurface, "mWorkingBitmap")).eraseColor(Color.BLACK); int colorBeforeErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After painting black, pixel should be black", Color.BLACK, colorBeforeErase); selectTool(ToolType.ERASER); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_SLEEP); int colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("Brushing after erase should be transparent", Color.TRANSPARENT, colorAfterErase); } public void testSwitchingBetweenBrushAndEraser() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { assertTrue("Waiting for DrawingSurface", mSolo.waitForView(DrawingSurface.class, 1, TIMEOUT)); PointF screenPoint = new PointF(mScreenWidth / 2, mScreenHeight / 2); PointF canvasPoint = Utils.getCanvasPointFromScreenPoint(screenPoint); ((Bitmap) PrivateAccess.getMemberValue(DrawingSurface.class, PaintroidApplication.drawingSurface, "mWorkingBitmap")).eraseColor(Color.BLACK); int colorBeforeErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After painting black, pixel should be black", Color.BLACK, colorBeforeErase); selectTool(ToolType.ERASER); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_TIMEOUT); int colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After erasing, pixel should be transparent again", Color.TRANSPARENT, colorAfterErase); selectTool(ToolType.BRUSH); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_TIMEOUT); int colorAfterBrush = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("Brushing after erase should be black again like before erasing", Color.BLACK, colorAfterBrush); selectTool(ToolType.ERASER); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_TIMEOUT); colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After erasing, pixel should be transparent again", Color.TRANSPARENT, colorAfterErase); } public void testSwitchingBetweenBrushAndEraserAndMoveTool() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { assertTrue("Waiting for DrawingSurface", mSolo.waitForView(DrawingSurface.class, 1, TIMEOUT)); PointF screenPoint = new PointF(mScreenWidth / 2, mScreenHeight / 2); PointF canvasPoint = Utils.getCanvasPointFromScreenPoint(screenPoint); ((Bitmap) PrivateAccess.getMemberValue(DrawingSurface.class, PaintroidApplication.drawingSurface, "mWorkingBitmap")).eraseColor(Color.BLACK); int colorBeforeErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After painting black, pixel should be black", Color.BLACK, colorBeforeErase); selectTool(ToolType.ERASER); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_SLEEP); int colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After erasing, pixel should be transparent again", Color.TRANSPARENT, colorAfterErase); mSolo.clickOnView(mButtonTopTool); mSolo.sleep(SHORT_SLEEP); mSolo.clickOnView(mButtonTopTool); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_SLEEP); colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After erasing, pixel should be transparent again", Color.TRANSPARENT, colorAfterErase); } public void testChangeEraserBrushSize() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { assertTrue("Waiting for DrawingSurface", mSolo.waitForView(DrawingSurface.class, 1, TIMEOUT)); PointF screenPoint = new PointF(mScreenWidth / 2, mScreenHeight / 2); PointF canvasPoint = Utils.getCanvasPointFromScreenPoint(screenPoint); ((Bitmap) PrivateAccess.getMemberValue(DrawingSurface.class, PaintroidApplication.drawingSurface, "mWorkingBitmap")).eraseColor(Color.BLACK); int colorBeforeErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After painting black, pixel should be black", Color.BLACK, colorBeforeErase); selectTool(ToolType.ERASER); mSolo.clickOnView(mMenuBottomParameter1); assertTrue("Waiting for Brush Picker Dialog", mSolo.waitForText(mSolo.getString(R.string.stroke_title), 1, TIMEOUT)); TextView brushWidthTextView = mSolo.getText("25"); String brushWidthText = (String) brushWidthTextView.getText(); assertEquals("Wrong brush width displayed", Integer.valueOf(brushWidthText), Integer.valueOf(25)); ArrayList<ProgressBar> progressBars = mSolo.getCurrentViews(ProgressBar.class); assertEquals(progressBars.size(), 1); SeekBar strokeWidthBar = (SeekBar) progressBars.get(0); assertEquals(strokeWidthBar.getProgress(), 25); int newStrokeWidth = 80; mSolo.setProgressBar(0, newStrokeWidth); assertTrue("Waiting for set stroke width ", mSolo.waitForView(LinearLayout.class, 1, TIMEOUT)); assertEquals(strokeWidthBar.getProgress(), newStrokeWidth); mSolo.clickOnButton(mSolo.getString(R.string.done)); mSolo.waitForDialogToClose(SHORT_TIMEOUT); Paint strokePaint = (Paint) PrivateAccess.getMemberValue(BaseTool.class, PaintroidApplication.currentTool, "mCanvasPaint"); int paintStrokeWidth = (int) strokePaint.getStrokeWidth(); assertEquals(paintStrokeWidth, newStrokeWidth); mSolo.clickOnScreen((int) screenPoint.x, (int) screenPoint.y); mSolo.sleep(SHORT_SLEEP); int colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("Brushing after erase should be transparent", Color.TRANSPARENT, colorAfterErase); } public void testChangeEraserBrushForm() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { assertTrue("Waiting for DrawingSurface", mSolo.waitForView(DrawingSurface.class, 1, TIMEOUT)); PointF screenPoint = new PointF(mScreenWidth / 2, mScreenHeight / 2); PointF canvasPoint = Utils.getCanvasPointFromScreenPoint(screenPoint); ((Bitmap) PrivateAccess.getMemberValue(DrawingSurface.class, PaintroidApplication.drawingSurface, "mWorkingBitmap")).eraseColor(Color.BLACK); int colorBeforeErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("After painting black, pixel should be black", Color.BLACK, colorBeforeErase); selectTool(ToolType.ERASER); mSolo.clickOnView(mMenuBottomParameter1); assertTrue("Waiting for Brush Picker Dialog", mSolo.waitForText(mSolo.getString(R.string.stroke_title), 1, TIMEOUT)); mSolo.clickOnImageButton(0); assertTrue("Waiting for set stroke cap SQUARE ", mSolo.waitForView(LinearLayout.class, 1, TIMEOUT)); Paint strokePaint = (Paint) PrivateAccess.getMemberValue(BaseTool.class, PaintroidApplication.currentTool, "mCanvasPaint"); mSolo.clickOnButton(mSolo.getString(R.string.done)); assertEquals(strokePaint.getStrokeCap(), Cap.SQUARE); mSolo.clickOnScreen(screenPoint.x, screenPoint.y); mSolo.sleep(SHORT_SLEEP); int colorAfterErase = PaintroidApplication.drawingSurface.getPixel(canvasPoint); assertEquals("Brushing after erase should be transparent", Color.TRANSPARENT, colorAfterErase); } public void testRestorePreviousToolSettings() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { assertTrue("Waiting for DrawingSurface", mSolo.waitForView(DrawingSurface.class, 1, TIMEOUT)); mSolo.clickOnView(mMenuBottomParameter1); assertTrue("Waiting for Brush Picker Dialog", mSolo.waitForText(mSolo.getString(R.string.stroke_title), 1, TIMEOUT)); TextView brushWidthTextView = mSolo.getText("25"); String brushWidthText = (String) brushWidthTextView.getText(); assertEquals("Wrong brush width displayed", Integer.valueOf(brushWidthText), Integer.valueOf(25)); ArrayList<ProgressBar> progressBars = mSolo.getCurrentViews(ProgressBar.class); assertEquals(progressBars.size(), 1); SeekBar strokeWidthBar = (SeekBar) progressBars.get(0); assertEquals(strokeWidthBar.getProgress(), 25); int newStrokeWidth = 80; mSolo.setProgressBar(0, newStrokeWidth); assertTrue("Waiting for set stroke width ", mSolo.waitForView(LinearLayout.class, 1, TIMEOUT)); assertEquals(strokeWidthBar.getProgress(), newStrokeWidth); int squarePictureButton = 0; mSolo.clickOnImageButton(squarePictureButton); assertTrue("Waiting for set stroke cap SQUARE ", mSolo.waitForView(LinearLayout.class, 1, TIMEOUT)); Paint strokePaint = (Paint) PrivateAccess.getMemberValue(BaseTool.class, PaintroidApplication.currentTool, "mCanvasPaint"); int paintStrokeWidth = (int) strokePaint.getStrokeWidth(); assertEquals(paintStrokeWidth, newStrokeWidth); mSolo.clickOnButton(mSolo.getString(R.string.done)); mSolo.sleep(500); assertEquals(strokePaint.getStrokeCap(), Cap.SQUARE); selectTool(ToolType.ERASER); mSolo.clickOnView(mMenuBottomParameter1); assertTrue("Waiting for Brush Picker Dialog", mSolo.waitForText(mSolo.getString(R.string.stroke_title), 1, TIMEOUT)); ArrayList<ProgressBar> eraserProgressBars = mSolo.getCurrentViews(ProgressBar.class); assertEquals(eraserProgressBars.size(), 1); SeekBar eraserStrokeWidthBar = (SeekBar) eraserProgressBars.get(0); assertEquals(eraserStrokeWidthBar.getProgress(), newStrokeWidth); int eraserStrokeWidth = 60; mSolo.setProgressBar(0, eraserStrokeWidth); assertTrue("Waiting for set stroke width ", mSolo.waitForView(LinearLayout.class, 1, TIMEOUT)); assertEquals(eraserStrokeWidthBar.getProgress(), eraserStrokeWidth); int roundPictureButton = 1; mSolo.clickOnImageButton(roundPictureButton); assertTrue("Waiting for set stroke cap ROUND ", mSolo.waitForView(LinearLayout.class, 1, TIMEOUT)); mSolo.clickOnButton(mSolo.getString(R.string.done)); mSolo.sleep(500); Paint eraserStrokePaint = (Paint) PrivateAccess.getMemberValue(BaseTool.class, PaintroidApplication.currentTool, "mCanvasPaint"); assertEquals(eraserStrokePaint.getStrokeCap(), Cap.ROUND); selectTool(ToolType.BRUSH); Paint lastStrokePaint = (Paint) PrivateAccess.getMemberValue(BaseTool.class, PaintroidApplication.currentTool, "mCanvasPaint"); assertEquals((int) lastStrokePaint.getStrokeWidth(), newStrokeWidth); assertEquals(lastStrokePaint.getStrokeCap(), Cap.SQUARE); } }
package code08_05; public class Hero { //フィールドを追加 String name; //名前の宣言 int hp; //HPの宣言 }
package com.zhy.dagger2.multibindings; import com.zhy.dagger2.qualifier.MyQualifier; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import dagger.Module; import dagger.Provides; import dagger.multibindings.ElementsIntoSet; @Module public class SetModuleB { @Provides @ElementsIntoSet @MyQualifier public Set<String> provideSpecialSomeStrings() { return new HashSet<>(Arrays.asList("Hello", "Dagger2")); } }
package nl.rug.oop.flaps.simulation.model.map; import lombok.Data; import nl.rug.oop.flaps.simulation.model.map.coordinates.GeographicCoordinates; /** * Contains a bunch of info about the dimensions (both in terms of pixels as in geographical coordinates) of the map * Basically just a data holder * * @author T.O.W.E.R. */ @Data public class WorldDimensions { private int mapWidth; private int mapHeight; private GeographicCoordinates mapStartCoordinates; private GeographicCoordinates mapEndCoordinates; }
package convalida.validators; import android.widget.EditText; /** * @author WellingtonCosta on 25/04/18. */ public class CpfValidator extends AbstractValidator { private boolean required; public CpfValidator( EditText editText, String errorMessage, boolean autoDismiss, boolean required ) { super(editText, errorMessage, autoDismiss); this.required = required; } @Override public boolean isValid(String value) { value = value .replace(".", "") .replace("-", "") .replace(" ", ""); boolean invalidLength = value.length() > 0 && value.length() < 11; if(required && value.isEmpty()) { return false; } else { if(value.isEmpty()) return true; if(invalidLength) return false; boolean hasOnlyDigits = value.matches("\\d{11}"); boolean isNotInBlackList = !inBlackList(value); int charAt9Position = Character.getNumericValue(value.charAt(9)); int charAt10Position = Character.getNumericValue(value.charAt(10)); boolean digit9IsValid = cpfDv(value, 1) == charAt9Position; boolean digit10IsValid = cpfDv(value, 2) == charAt10Position; return (hasOnlyDigits && isNotInBlackList && digit9IsValid && digit10IsValid); } } private static int cpfDv(final String cpf, final int step) { final int dv = 11 - cpfSum(cpf, step) % 11; return (dv == 10 || dv == 11) ? 0 : dv; } private static int cpfSum(final String rawCPF, final int step) { int sum = 0; final int count = 8 + step; final int baseMultiplier = 9 + step; for (int i = 0; i < count; ++i) { sum += ((baseMultiplier - i) * Character.getNumericValue(rawCPF.charAt(i))); } return sum; } private static boolean inBlackList(String cpf) { boolean equal = true; for (int i = 1; i < 11 && equal; i++) { if (cpf.charAt(i) != cpf.charAt(0)) { equal = false; } } return equal || cpf.equals("12345678909"); } }
/** * Provides classes for evaluating global RGB image features. */ package pwr.chrzescijanek.filip.gifa.core.function.rgb;
package com.ducph.consoledrawing.model; import com.ducph.consoledrawing.util.Utils; import lombok.Data; @Data public class Point { private int x; private int y; public Point(int x, int y) { Utils.shouldAllNonNegative(x, y); this.x = x; this.y = y; } }
package edunova; public class DomacaZadaca { //ČITATI //https://medium.freecodecamp.org/object-oriented-programming-concepts-21bb035f7260 //https://searchmicroservices.techtarget.com/definition/object-oriented-programming-OOP //http://www.ntu.edu.sg/home/ehchua/programming/java/J3a_OOPBasics.html //https://docs.oracle.com/javase/tutorial/java/concepts/index.html }
/* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.persistence.mapdb; import io.moquette.spi.IMatchingCondition; import io.moquette.spi.IMessagesStore; import io.moquette.spi.impl.subscriptions.Topic; import org.mapdb.DB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentMap; /** * IMessagesStore implementation backed by MapDB. */ class MapDBMessagesStore implements IMessagesStore { private static final Logger LOG = LoggerFactory.getLogger(MapDBMessagesStore.class); private DB m_db; private ConcurrentMap<Topic, StoredMessage> m_retainedStore; MapDBMessagesStore(DB db) { m_db = db; } @Override public void initStore() { m_retainedStore = m_db.getHashMap("retained"); LOG.info("Initialized store"); } @Override public Collection<StoredMessage> searchMatching(IMatchingCondition condition) { LOG.debug("Scanning retained messages"); List<StoredMessage> results = new ArrayList<>(); for (Map.Entry<Topic, StoredMessage> entry : m_retainedStore.entrySet()) { StoredMessage storedMsg = entry.getValue(); if (condition.match(entry.getKey())) { results.add(storedMsg); } } if (LOG.isTraceEnabled()) { LOG.trace("Retained messages have been scanned matchingMessages={}", results); } return results; } @Override public void cleanRetained(Topic topic) { LOG.debug("Cleaning retained messages. Topic={}", topic); m_retainedStore.remove(topic); } @Override public void storeRetained(Topic topic, StoredMessage storedMessage) { LOG.debug("Store retained message for topic={}, CId={}", topic, storedMessage.getClientID()); if (storedMessage.getClientID() == null) { throw new IllegalArgumentException( "Message to be persisted must have a not null client ID"); } m_retainedStore.put(topic, storedMessage); } }
package com.library.dao; import java.util.List; import com.library.entities.Banner; import com.library.entities.Type; public class TypeDao extends BaseDao { public List<Type> getAll(){ String hql="from Type"; return getSession().createQuery(hql).list(); } public int add(Type type){ getSession().save(type); return 1; } public int addBanner(Banner banner){ getSession().save(banner); return 1; } public List<Banner> bannerList(boolean isAll){ String hql=""; if(isAll){ hql="from Banner "; }else{ hql="from Banner where status=1"; } return getSession().createQuery(hql).list(); } public int delBanner(int id){ String hql="delete from Banner where id=?"; return getSession().createQuery(hql).setInteger(0, id).executeUpdate(); } public int bannerStatus(int id,int status){ String hql="update Banner set status=? where id=?"; return getSession().createQuery(hql).setInteger(0, status).setInteger(1,id).executeUpdate(); } }
package com.ld.baselibrary.http; import android.content.Context; import androidx.annotation.NonNull; import com.ld.baselibrary.http.response.BaseResponse; import com.trello.rxlifecycle4.LifecycleProvider; import com.trello.rxlifecycle4.LifecycleTransformer; import com.trello.rxlifecycle4.components.support.RxFragment; import io.reactivex.Observable; import io.reactivex.ObservableSource; import io.reactivex.ObservableTransformer; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.functions.Function; import io.reactivex.schedulers.Schedulers; /** * Created by goldze on 2017/6/19. * 有关Rx的工具类 */ public class RxUtils { /** * 生命周期绑定 * * @param lifecycle Activity */ public static <T> LifecycleTransformer<T> bindToLifecycle(@NonNull Context lifecycle) { if (lifecycle instanceof LifecycleProvider) { return ((LifecycleProvider) lifecycle).bindToLifecycle(); } else { throw new IllegalArgumentException("context not the LifecycleProvider type"); } } /** * 生命周期绑定 * * @param lifecycle Fragment */ public static LifecycleTransformer bindToLifecycle(@NonNull RxFragment lifecycle) { if (lifecycle instanceof LifecycleProvider) { return ((LifecycleProvider) lifecycle).bindToLifecycle(); } else { throw new IllegalArgumentException("fragment not the LifecycleProvider type"); } } /** * 生命周期绑定 * * @param lifecycle Fragment */ public static LifecycleTransformer bindToLifecycle(@NonNull LifecycleProvider lifecycle) { return lifecycle.bindToLifecycle(); } }
package com.polsl.edziennik.desktopclient.view.common.panels.tablePanels; import com.polsl.edziennik.desktopclient.model.tables.TableModel; public class ProjectStudentTablePanel extends TablePanel { public ProjectStudentTablePanel(TableModel tableModel) { super(tableModel, ""); } @Override public int getComboSelectedIndex() { return 0; } public void setColumnWidths() { if (table.getColumnModel() == null) return; table.getColumnModel().getColumn(0).setPreferredWidth(25); for (int i = 1; i < 4; i++) { table.getColumnModel().getColumn(i).setPreferredWidth(130); } } }
package com.perhab.napalm.statement; public interface ParameterSupplier { <T, R> T get(Class<T> parameterType, Class<R> reciever); }
package com.jim.multipos.ui.start_configuration.basics; import com.jim.multipos.core.BasePresenterImpl; import javax.inject.Inject; public class BasicsPresenterImpl extends BasePresenterImpl<BasicsView> implements BasicsPresenter{ @Inject protected BasicsPresenterImpl(BasicsView basicsView) { super(basicsView); } }
package com.tencent.mm.e.b; public interface a { void a(com.tencent.mm.ab.i.a aVar); boolean dc(String str); int getMaxAmplitude(); int getStatus(); boolean we(); int wf(); }
package com.tencent.mm.plugin.wenote.ui.nativenote.b; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import com.tencent.mm.model.au; class k$1 implements OnGlobalLayoutListener { final /* synthetic */ k qvL; k$1(k kVar) { this.qvL = kVar; } public final void onGlobalLayout() { au.Em().H(new 1(this)); } }
package edu.temple.convoy.api; import android.content.Context; import android.util.Log; import com.android.volley.Response; import org.json.JSONException; import org.json.JSONObject; import java.util.HashMap; import java.util.Map; import edu.temple.convoy.utils.Constants; public class AccountAPI extends BaseAPI { public AccountAPI(Context initialContext) { super(initialContext); } @Override protected String getApiSuffix() { return "account.php"; } /** * Register a new user by calling the remote API * * @param firstName * @param lastName * @param username * @param password * @param resultListener */ public void register(String firstName, String lastName, String username, String password, ResultListener resultListener) { Map<String, String> params = new HashMap<>(); params.put(Constants.API_KEY_ACTION, Constants.API_ACTION_REGISTER); params.put(Constants.API_KEY_USERNAME, username); params.put(Constants.API_KEY_FIRSTNAME, firstName); params.put(Constants.API_KEY_LASTNAME, lastName); params.put(Constants.API_KEY_PASSWORD, password); String apiName = "RegistrationAPI"; post(params, getListenerForAPI(apiName, resultListener)); } /** * Login a previously-registered user using the remote API * * @param username * @param password * @param resultListener */ public void login(String username, String password, ResultListener resultListener) { Map<String, String> params = new HashMap<>(); params.put(Constants.API_KEY_ACTION, Constants.API_ACTION_LOGIN); params.put(Constants.API_KEY_USERNAME, username); params.put(Constants.API_KEY_PASSWORD, password); String apiName = "LoginAPI"; post(params, getListenerForAPI(apiName, resultListener)); } /** * Log the current user out * * @param resultListener */ public void logout(String username, String sessionKey, ResultListener resultListener) { Map<String, String> params = new HashMap<>(); params.put(Constants.API_KEY_ACTION, Constants.API_ACTION_LOGOUT); params.put(Constants.API_KEY_USERNAME, username); params.put(Constants.API_KEY_SESSION_KEY, sessionKey); String apiName = "LogoutAPI"; post(params, getListenerForAPI(apiName, resultListener)); } /** * Generate a response listener for the provided API Name and results listener * * @param apiName * @param resultListener * @return */ protected Response.Listener<String> getListenerForAPI(String apiName, AccountAPI.ResultListener resultListener) { /* Lambda notation ... takes the place of: new Response.Listener<String>() { @Override public void onResponse(String origResponse) { */ Response.Listener<String> listener = origResponse -> { try { Log.d(Constants.LOG_TAG, apiName + " - Received response: " + origResponse); JSONObject response = new JSONObject(origResponse); String status = response.getString(Constants.API_KEY_STATUS); if (status.equals(Constants.API_STATUS_SUCCESS)) { resultListener.onSuccess(response.getString(Constants.API_KEY_SESSION_KEY)); } else if (status.equals(Constants.API_STATUS_ERROR)) { resultListener.onFailure(response.getString(Constants.API_KEY_MESSAGE)); } else { Log.e(Constants.LOG_TAG, apiName + " - Unrecognized result status: " + status); } } catch (JSONException e) { Log.e(Constants.LOG_TAG, apiName + " - Unable to parse results from JSON Object"); e.printStackTrace(); } }; return listener; } }
package ProjectThree350; import java.util.Scanner; /** * Factory class to start five threads. * **/ public class Factory { public static void main(String args[]) { Scanner input = new Scanner(System.in); System.out.println("Input the total memory size (in bytes): "); int mem = input.nextInt(); // the total memory we have available System.out.println("Input the memory size of each frame (in bytes): "); int frameSize = input.nextInt(); // variable stores the size of each frame input.close(); if (frameSize > mem) { frameSize = mem; } PhysicalMemory physicalMemory = new PhysicalMemory(mem, frameSize); Thread[] threadArray = new Thread[5]; for(int i=0; i<5 ;i++) threadArray[i] = new Thread(new MemoryThread(physicalMemory, i)); //i is threadID for(int i=0; i<5; i++) threadArray[i].start(); } }
package com.mindviewinc.chapter17.exercise; import java.util.Iterator; import java.util.LinkedList; import java.util.ListIterator; import java.util.NoSuchElementException; public class SList<T> { Link<T> header = new Link<T>(null, null); public SList() { header.next = header;// } public SListIterator<T> iterator() { return new SListIteratorImpl(); } private class Link<T> { T t; Link<T> next; public Link(Link<T> next) { this(null, next); } public Link(T t, Link<T> next) { this.t = t; this.next = next; } } private class SListIteratorImpl implements SListIterator<T> { Link<T> lastReturn = header; Link<T> next; public SListIteratorImpl() { next = header.next; } public boolean hasNext() { return next != header; } public T next() { if (next == header) throw new NoSuchElementException(); lastReturn = next; next = next.next; return lastReturn.t; } public void insert(T t) { lastReturn = header;// 最后让最近一次操作指向lastReturned位置复原,即指向头,固添加后不能马上进行删除与修改操作 Link<T> newLink = new Link<T>(t, next); if (header.next == header) // Empty list header.next = newLink; else { // Find an element before the one pointed by 'next' for (Link<T> curr = header;; curr = curr.next) if (curr.next == next) { curr.next = newLink; break; } } } public void remove(T t) { } } } interface SListIterator<T> { boolean hasNext(); T next(); void insert(T t); void remove(T t); }
package io.peppermint100.server.entity.item; public enum MachineType { ORIGINAL, VERTUO }
package com.hqb.patshop.app.home.domain; import com.hqb.patshop.mbg.model.SmsHomeHot; import java.util.List; public class HomeHotBidResult { private List<SmsHomeHot> homeProductDaoList; public List<SmsHomeHot> getHomeProductDaoList() { return homeProductDaoList; } public void setHomeProductDaoList(List<SmsHomeHot> homeProductDaoList) { this.homeProductDaoList = homeProductDaoList; } @Override public String toString() { return "HomeHotBidResult{" + "homeProductDaoList=" + homeProductDaoList + '}'; } }
//Additional Tutorial 1 - Q12 public class Question12{ public static void main (String[] args){ System.out.println(" +\"\"\"\"\"+ "); System.out.println("[| o o |]"); System.out.println(" | ^ |"); System.out.println(" | '_' |"); System.out.println(" +-----+"); } }
package oceans; public class Oceans { /* * given an ocean, count the the number of islands */ public static int isIsland (int[][] ocean) { int islandCount = 0; if(ocean.length == 0){ return islandCount; } boolean[][] visited = new boolean[ocean.length][ocean[0].length]; for (int i = 0; i < ocean.length; i++){ for (int j = 0; j < ocean[i].length; j++){ if (ocean[i][j] == 1 && !visited[i][j]){ islandCount++; changeIsland(ocean, i, j); } } } return islandCount; } public static void changeIsland(int[][] visited, int i, int j){ //if it is out of bounds or 0, then return if (i < 0 || i >= visited.length || j < 0 || j >= visited[0].length || visited[i][j] == 0){ return; } //change visited at i, j to true visited[i][j] = 0; //increment each i, j value. changeIsland(visited, i - 1, j); changeIsland(visited, i + 1, j); changeIsland(visited, i, j - 1); changeIsland(visited, i, j + 1); } }
package concrete; import abstracts.BaseManager; import entities.Campaigns; public class CampaignManager extends BaseManager { public void add(Campaigns campaigns) { System.out.println("Campaing saved."); } public void delete(Campaigns campaigns) { System.out.println("Campaign deleted"); } public void update(Campaigns campaigns) { System.out.println("Campaing updated."); } }
package com.koreait.bbs.model; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class DownloadAction implements Action { @Override public String command(HttpServletRequest request, HttpServletResponse response) { String filename = request.getParameter("filename"); request.setAttribute("filename", filename); request.setAttribute("path", "upload"); return "bbs/download.jsp"; } }
package com.company; import javax.imageio.ImageIO; import java.awt.*; import java.io.File; import java.io.IOException; /** * Created by Ngoc on 4/25/2016. */ public class Plane { public int x; public int y; public int dx; public int dy; public final int WIDTH = 70; public final int HEIGHT = 70; Bullet bullet; private Image image; public Plane(int x, int y, Image image) { this.x = x; this.y = y; this.image = image; } public void paint(Graphics g) { g.drawImage(image, x, y,WIDTH,HEIGHT, null); if (bullet != null) { bullet.panit(g); } } public void run() { x += dx; y += dy; if (bullet != null) { bullet.run(); } } public void run2(){ y += 5; } public void move(Movement movement) { if (movement.dx > 0) { dx = 5; } else if (movement.dx < 0) { dx = -5; } else dx = 0; if (movement.dy > 0) { dy = 5; } else if (movement.dy < 0) { dy = -5; } else dy = 0; } // public void setImage(Image image) { // if(image != null && this.image == null) { // this.image = image; // } // } public Image getImage() { return image; } public void shot() { try { this.bullet = new Bullet(this.x+WIDTH/2 - Bullet.WIDTH/2, this.y, ImageIO.read(new File("resources/bullet.png"))); } catch (IOException e) { e.printStackTrace(); } } }
package com.vilio.wct.test; import java.util.HashMap; import java.util.Map; public class test { public static void main(String[] args) { Map<String, Object> map = new HashMap<String, Object>(); // map.put("aaa", null); System.out.println(map.get("aaa")); System.out.println(map.containsKey("aaa")); } }
package org.zaproxy.zap.extension.advreport; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import org.parosproxy.paros.Constant; import org.parosproxy.paros.extension.AbstractPanel; public class ScopePanel extends AbstractPanel{ /** * */ private static final long serialVersionUID = 1L; private JTextArea name, description; private JComboBox template; private JCheckBox onlyInScope; public ScopePanel(){ initialize(); } private void initialize(){ this.setLayout( new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(2,3,2,3); // name line gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.NORTHWEST; this.add( new JLabel(Constant.messages.getString("advreport.scopepanel.name")), gbc ); gbc.gridx++ ; name = new JTextArea(Constant.messages.getString("advreport.scopepanel.report")); this.add( new JScrollPane(name, JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER), gbc ); // description line gbc.gridy++ ; gbc.gridx = 0; gbc.anchor = GridBagConstraints.NORTHWEST; this.add( new JLabel(Constant.messages.getString("advreport.scopepanel.description")), gbc ); gbc.gridx++; description = new JTextArea(Constant.messages.getString("advreport.scopepanel.desc"), 3, 30 ); description.setLineWrap( true ); this.add( new JScrollPane( description ), gbc ); // template line gbc.gridx = 0 ; gbc.gridy++; gbc.anchor = GridBagConstraints.WEST; this.add( new JLabel(Constant.messages.getString("advreport.scopepanel.template")), gbc ); String[] selection = {Constant.messages.getString("advreport.scopepanel.template.traditional"), Constant.messages.getString("advreport.scopepanel.template.separated"), Constant.messages.getString("advreport.scopepanel.template.concise")}; template = new JComboBox<>( selection ); template.setSelectedIndex(0); gbc.gridx++; gbc.anchor = GridBagConstraints.EAST; this.add( template, gbc ); // just alert check box line gbc.gridx = 0; gbc.gridy++; gbc.anchor = GridBagConstraints.WEST; this.add( new JLabel(Constant.messages.getString("advreport.scopepanel.scope")), gbc ); onlyInScope = new JCheckBox(); gbc.gridx++; gbc.anchor = GridBagConstraints.EAST; this.add( onlyInScope, gbc ); } public String getReportName(){ return name.getText(); } public String getReportDescription(){ return description.getText(); } public boolean onlyInScope(){ return onlyInScope.isSelected(); } public String getTemplate(){ return (String)template.getSelectedItem(); } }
package com.lito.fupin.meta.paper.dao; import com.lito.fupin.meta.paper.entity.Paper; import org.apache.ibatis.annotations.Mapper; import java.util.ArrayList; import java.util.Map; @Mapper public interface PaperDao { void createPaper(Paper paper); /** * 读取一个机构下的所有未审核文章 * * @param organizeId */ ArrayList<Paper> listPaperUnApprove(String organizeId); /** * 读取文章的简要信息,不包含详情 * * @param paperId * @return */ Paper getPaperTinyByPaperId(String paperId); /** * 增量修改文章信息 * * @param paper */ void updatePaper(Paper paper); Paper getPaperDetailByPaperId(String paperId); /** * 查询已通过审核的文章 * * @param qIn categoryId * organizeId * offset * * size * * @return */ ArrayList<Paper> listPaper(Map qIn); ArrayList<Paper> listMyPendingPaper(Map qIn); void updateAddView(String paperId); void deletePaper(String paperId); /** * 读取一个机构的所有文章 * @param organizeId * @return */ ArrayList<Paper> listPaperByOrganize(String organizeId); /** * 读取上一篇文章的标题信息 * @param qIn * @return */ Paper getLastPaper(Map qIn); /** * 读取下一篇文章的标题信息 * @param qIn * @return */ Paper getNextPaper(Map qIn); }
package com.spsc.szxq.view; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import android.support.v4.app.NotificationCompat; import com.spsc.szxq.R; //import com.spsc.szxq.activity.AcceptActivity; import com.spsc.szxq.utils.Utils; /** * Created by allens on 2017/2/28. */ public class NotificationView { private Context mContext; public NotificationView(Context context) { mContext = context; } public void sendNotification() { Utils.newInstance(mContext).searchdb(new Utils.Search() { private String path; private String mPath; @Override public void onOtherThread(SQLiteDatabase db, ContentValues cv) { Cursor cursor = db.query("T_music", new String[]{"path"}, null, null, null, null, null); while (cursor.moveToNext()) { path = cursor.getString(0); } if (path == null) { // mPath = "android.resource://" + mContext.getPackageName() + "/" + R.raw.notice; } else { mPath = ".." + path; } } @Override public void onMainThread() { // Intent mainIntent = new Intent(mContext, AcceptActivity.class); // PendingIntent mainPendingIntent = PendingIntent.getActivity(mContext, 0, mainIntent, PendingIntent.FLAG_UPDATE_CURRENT); // NotificationManager notifyManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); // NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext) // .setSmallIcon(R.mipmap.ic_launcher) // .setContentTitle("最简单的Notification") // .setContentText("只有小图标、标题、内容") // .setContentIntent(mainPendingIntent) // .setDefaults(Notification.DEFAULT_VIBRATE) // .setLights(0xFF0000, 3000, 3000) // .setSound(Uri.parse(mPath)) // .setAutoCancel(true); // notifyManager.notify(1, builder.build()); } }); } }
package ga.islandcrawl.form; import ga.islandcrawl.draw.Crescent; import ga.islandcrawl.draw.Image; import ga.islandcrawl.draw.Oval; import ga.islandcrawl.form.Parts.Hands; import ga.islandcrawl.form.Parts.Pair; import ga.islandcrawl.other.M; /** * Created by Ga on 7/11/2015. */ public class Human extends Form { enum EyeState{ Normal, Panic, Tired, Angry } Pair feet, eyes, pupils, eyelids; Hands hands; Oval body; private EyeState state; public Human(){ super(); eyes = new Pair(new Oval(.01f, .01f,new float[]{1,1,1,1}),new Oval(.01f, .01f, new float[]{1,1,1,1}), 0, .018f); eyelids = new Pair(new Crescent(.01f, .01f,0,new float[]{.95f,.8f,.6f,1}),new Crescent(.01f, .01f, 0, new float[]{.95f,.8f,.6f,1}), 0, .018f); // eyelids = new Pair(new Crescent(.01f, .01f,0,new float[]{1,0,0,1}),new Crescent(.01f, .01f, 0, new float[]{1,0,0,1}), 0, .018f); pupils = new Pair(new Oval(.007f, .007f,new float[]{0,0,0,1}),new Oval(.007f, .007f, new float[]{0,0,0,1}), 0, .018f); feet = new Pair(new Oval(.035f, .02f,new float[]{.8f,.6f,.5f,1}),new Oval(.035f, .02f, new float[]{.8f,.6f,.5f,1}), 0, .03f); hands = new Hands(new Oval(.02f, .02f,new float[]{.95f,.7f,.55f,1}),new Oval(.02f, .02f, new float[]{.95f,.7f,.55f,1}), 0, .045f); body = (Oval) new Oval(.05f,.05f,new float[]{1f,.88f,.64f,1}).setShader(4,null); eyes.offsetR.x = .015f; resetEye(); feet.offset.y = .01f; hands.offset.y = .015f; organs.add(feet); organs.add(hands); organs.add(body); organs.add(eyes); organs.add(pupils); organs.add(eyelids); } @Override public float setDepth(float p){ float r = super.setDepth(p); feet.setDepth(.01f); //depthDraw of 1 hands.setDepth(.09f); return r; } public void resetEye(){ pupils.offsetR.x = .018f; pupils.offsetR.y = 0; pupils.setDistX(0); pupils.setDistY(.018f); pupils.setScale(1); eyelids.rotate(rotation + 180); eyelids.offsetR.x = -.005f; eyelids.getLeft().rotate(rotation + 180); eyelids.getRight().rotate(rotation + 180); } public void setState(EyeState p){ if (p == EyeState.Normal) resetEye(); else if (p == EyeState.Panic) { pupils.setScale(.5f); pupils.setDistY(.04f); pupils.offsetR.x = .04f; eyelids.offsetR.x = 0; }else if (p == EyeState.Tired) { eyelids.offsetR.x = -.015f; }else if (p == EyeState.Angry) { eyelids.offsetR.x = -.01f; eyelids.getLeft().rotate(rotation-25); eyelids.getRight().rotate(rotation+25); } state = p; } public void carry(ga.islandcrawl.object.Object p, int a){ hands.carry(p, a); } @Override public void animate(int a, int time){ switch (a){ case 1: case 3: feet.step(time); hands.step(); break; case 2: hands.swing(time); break; case 4: hands.eat(time); break; case 10: setState(EyeState.Normal); break; case 11: setState(EyeState.Panic); break; case 12: setState(EyeState.Angry); break; case 13: setState(EyeState.Tired); break; default: break; } } @Override public void end(){ setState(EyeState.Normal); } }
package tainiothiki; public class userratings extends item{ private String userid; private String movieid; private String rating; private String timestamp; public userratings(String uid, String id,String rat,String time) { userid = uid; movieid=id; rating=rat; timestamp=time; } public String getMovieid() { return movieid; } public void setMovieid(String movieid) { this.movieid = movieid; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } public String getTimestamp() { return timestamp; } public void setTimestamp(String timestamp) { this.timestamp = timestamp; } public String getUserid() { return userid; } }
import java.util.*; import java.lang.*; public class ExceptionHandlingOne{ public static void main(String[] args){ int data; try { data = 50 / 0; } catch (Exception e) { System.out.println("Error : " + e); System.out.println("Please enter a new denominator"); } System.out.println("Outside try-catch"); } }
package com.projects.houronearth.activities.adapters; import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.projects.houronearth.R; import java.util.ArrayList; /** * Created by omegaon on 25-11-2017. */ public class FoodFavourAvoidItemsList_Recycleradapter extends RecyclerView.Adapter<FoodFavourAvoidItemsList_Recycleradapter.ListView_Holder>{ Context context; ArrayList<String> favourItems =new ArrayList<>(); ArrayList<String> avoiditems =new ArrayList<>(); public class ListView_Holder extends RecyclerView.ViewHolder { // View holder for list recycler view as we used in listview public TextView avoid,favour; public View top_divider,bottom_divider; public ListView_Holder(View view) { super(view); this.avoid = (TextView) view.findViewById(R.id.avoid); this.favour = (TextView) view.findViewById(R.id.favour); this.bottom_divider = (View) view.findViewById(R.id.bottom_devider); this.top_divider = (View) view.findViewById(R.id.top_divider); } } public FoodFavourAvoidItemsList_Recycleradapter(Context context, ArrayList<String> favourItems, ArrayList<String> avoiditems) { this.context = context; this.favourItems = favourItems; this.avoiditems = avoiditems; checkfavourAvoidSizes(); } private void checkfavourAvoidSizes() { if (favourItems.size()>avoiditems.size()) { for (int i = avoiditems.size(); i < favourItems.size(); i++) { avoiditems.add(""); } } else { for (int i = favourItems.size(); i < avoiditems.size(); i++) { favourItems.add(""); } } } @Override public int getItemCount() { return avoiditems.size(); } @Override public void onBindViewHolder(final ListView_Holder holder, final int position) { // setting data over views if (position==0) { holder.favour.setTextColor(context.getResources().getColor(R.color.colorGreen)); holder.avoid.setTextColor(Color.RED); holder.favour.setTypeface(null, Typeface.BOLD); holder.avoid.setTypeface(null, Typeface.BOLD); } holder.favour.setText(favourItems.get(position)); holder.avoid.setText(avoiditems.get(position)); } //On selecting any view set the current position to selectedPositon and notify adapter @Override public ListView_Holder onCreateViewHolder(ViewGroup viewGroup, int viewType){ // This method will inflate the custom layout and return as viewholder LayoutInflater mInflater= LayoutInflater.from(context); ViewGroup mainGroup = (ViewGroup) mInflater.inflate(R.layout.favouravoid_food_row_layout,viewGroup,false); ListView_Holder listHolder=new ListView_Holder(mainGroup); return listHolder; } public static String[] getSplittedString(String value, String delimitter) { return value.split(delimitter); } }
import javax.swing.*; import java.util.Scanner; public class inchesToFeet { public static void main(String[] args){ int inch; int feet; final int LIFE = 12; int input; String object = JOptionPane.showInputDialog(null,"how many inches?", "dialog", JOptionPane.INFORMATION_MESSAGE); input = Integer.parseInt(object); feet = input / LIFE; inch = input % LIFE; JOptionPane.showMessageDialog(null, "the number of feet is "+ feet +" with "+ inch + " inches" ); } }