blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
a321b23e1e5abe134fe462dde8792f1c76707d1a
22eb83d0fb3b751e9cda604a8055c802e0016ec4
/1.0/src/main/java/coffeemaker/App.java
f561acce2961c4d27893298f619fe4b71ff93455
[]
no_license
gone-phishing/coffee-maker
5915d9eeb63914ed273f7f87d154fb2ee2aaefad
1061425b74b6838fbdeeb47d23009780040ce250
refs/heads/main
2023-04-15T16:05:26.706519
2021-04-03T11:34:36
2021-04-03T11:34:36
354,265,626
0
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
package coffeemaker; import coffeemaker.Machine.BrandMachine; import coffeemaker.Machine.BrandMachineLauncher; import coffeemaker.Menu.Beverage; import coffeemaker.Menu.MenuChoices; public class App { public static void main( String[] args ) { BrandMachine brandMachine = new BrandMachineLauncher().launch(); System.out.println(brandMachine); // Beverage black_tea = takeAway(brandMachine, MenuChoices.black_tea); // black_tea.pour(); for(Beverage b:brandMachine.getBeverages()) { // System.out.println(b.getName()); if(takeAway(brandMachine, b)) { brandMachine.pour(b); } // System.out.println(brandMachine.getIngredients()); } } private static boolean takeAway(BrandMachine brandMachine, Beverage b) { try{ brandMachine.makeBeverage(b); System.out.println(b.getName() +" can be made as of now"); return true; } catch (Exception e) { System.out.println(b.getName() +" can not be made as of now"); return false; } } }
97c07f8e1e1f1a9174c9261b17b74794c9f45ff4
b9091a7bf56b737837b82ecec07463975dfdb593
/Assignment3/src/Interface/Airline/ChooseJPanel.java
a2830a2ed8eddd2a234bf4d0ef4b03a122c1ba5c
[]
no_license
IntegrityXu/INFO-5100
71a3a4e96f3729a5a20f0d634f35ba9f01ce2f01
535ebc49f17c7929e4566ad497cbbc6651278d25
refs/heads/master
2023-04-20T07:50:04.261506
2021-05-12T21:13:08
2021-05-12T21:13:08
366,854,891
0
0
null
null
null
null
UTF-8
Java
false
false
5,706
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Interface.Airline; import Business.*; import javax.swing.JPanel; import java.awt.CardLayout; /** * * @author xutao */ public class ChooseJPanel extends javax.swing.JPanel { /** * Creates new form ChooseJPanel */ private AirLine airline = new AirLine(); private JPanel container = new JPanel(); public ChooseJPanel( AirLine airline, JPanel container) { initComponents(); this.airline = airline; this.container = container; } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); planeBtn = new javax.swing.JButton(); flightBtn = new javax.swing.JButton(); backBtn = new javax.swing.JButton(); jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N jLabel1.setText("Airline Area"); planeBtn.setText("Manage Airplane > >"); planeBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { planeBtnActionPerformed(evt); } }); flightBtn.setText("Manage Flight > >"); flightBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { flightBtnActionPerformed(evt); } }); backBtn.setText("< < back"); backBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { backBtnActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(185, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(flightBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel1) .addGap(210, 210, 210)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(planeBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(179, 179, 179))))) .addGroup(layout.createSequentialGroup() .addGap(56, 56, 56) .addComponent(backBtn) .addGap(0, 0, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(jLabel1) .addGap(113, 113, 113) .addComponent(planeBtn) .addGap(18, 18, 18) .addComponent(flightBtn) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE) .addComponent(backBtn) .addGap(77, 77, 77)) ); }// </editor-fold>//GEN-END:initComponents private void flightBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_flightBtnActionPerformed // TODO add your handling code here: ManageFlightJPanel mfJP = new ManageFlightJPanel(airline, container); container.add("ManageFlightJPanel", mfJP); CardLayout layout = (CardLayout) container.getLayout(); layout.next(container); }//GEN-LAST:event_flightBtnActionPerformed private void planeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_planeBtnActionPerformed // TODO add your handling code here: ManageAirplaneJPanel maJP = new ManageAirplaneJPanel(airline, container); container.add("ManageAirplaneJPanel",maJP); CardLayout layout = (CardLayout) container.getLayout(); layout.next(container); }//GEN-LAST:event_planeBtnActionPerformed private void backBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backBtnActionPerformed // TODO add your handling code here: container.remove(this); CardLayout layout = (CardLayout) container.getLayout(); layout.previous(container); }//GEN-LAST:event_backBtnActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton backBtn; private javax.swing.JButton flightBtn; private javax.swing.JLabel jLabel1; private javax.swing.JButton planeBtn; // End of variables declaration//GEN-END:variables }
cfd90e533abce27cd042bcb2d264fffae0b3b660
4e76ab3f49504fc37c56bcae2e6187e01eb87ce0
/src/main/java/th/ac/ku/atm/Bank.java
bd4d05f916b2049ab90cdacb1d812de116d429bb
[]
no_license
WaroonSuppakit/atm-spring-annotation-main
792f6f50525a737a68e2e732114c296f62030b29
78881b43f70e47f268ae35a391e8e573aca0f16e
refs/heads/main
2023-08-05T13:40:47.580448
2021-10-06T10:52:49
2021-10-06T10:52:49
390,389,197
0
0
null
null
null
null
UTF-8
Java
false
false
1,155
java
package th.ac.ku.atm; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.Map; /** * A bank contains customers with bank accounts. */ @Component public class Bank { private String name; private Map<Integer,Customer> customers; private DataSource dataSource; /** * Constructs a bank with no customers. */ @Autowired public Bank(@Value("${bankname}") String name, DataSource dataSource) { this.name = name; this.dataSource = dataSource; this.customers = dataSource.readCustomers(); } /** * Adds a customer to the bank. * @param customer the customer to add */ public void registerCustomer(Customer customer) { customers.put(customer.getId(), customer); } /** * Finds a customer in the bank. * @param id a customer id * @return the matching customer, or null if no customer * matches */ public Customer findCustomer(int id) { return customers.get(id); } }
3425526d5e9093daecabae48315514307a01eede
66c8e7729f4f47bb032437c1bd283aa43bf797c0
/app/src/main/java/com/example/journey_mate/controller/SplashScreen.java
d393a9cdcbe1349952ef3453303d887efd157a6f
[]
no_license
rockushal3/androidfinalproject
40b7b4d7732c9c205165f3adc07d418beda750d9
43db0671986ec447a21e95912a5df826d6272f29
refs/heads/master
2023-01-04T13:33:11.008994
2020-02-16T16:20:09
2020-02-16T16:20:09
309,415,821
0
0
null
null
null
null
UTF-8
Java
false
false
1,988
java
package com.example.journey_mate.controller; import androidx.appcompat.app.AppCompatActivity; import android.app.Activity; import android.app.ActivityOptions; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.util.Pair; import android.view.View; import android.view.animation.AnimationUtils; import android.widget.ImageView; import com.blogspot.atifsoftwares.animatoolib.Animatoo; import com.example.journey_mate.R; import com.example.journey_mate.api.UserApi; public class SplashScreen extends AppCompatActivity { private static int Splash_time_out = 3000; private ImageView imageView6, imageView4; UserApi userApi = new UserApi(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); imageView6 = findViewById(R.id.imageView6); imageView4 = findViewById(R.id.imageView4); imageView4.setAnimation(AnimationUtils.loadAnimation(this, R.anim.rotate)); imageView6.setAnimation(AnimationUtils.loadAnimation(this, R.anim.lefttoright)); new Handler().postDelayed(new Runnable() { @Override public void run() { SharedPreferences sharedPreferences = getSharedPreferences("User", MODE_PRIVATE); String token = sharedPreferences.getString("Token", ""); if (userApi.checkLoginStatus(token)) { Intent intent = new Intent(SplashScreen.this, Home.class); startActivity(intent); finish(); } else { Intent intent = new Intent(SplashScreen.this, Login.class); Animatoo.animateZoom(SplashScreen.this); startActivity(intent); finish(); } } }, Splash_time_out); } }
e74eaf7121113c821e6894d1c43a7a343c2f9b90
d8066f31e52c7ef60d4d1f7925ef50beed9a56f7
/shared-kernel/src/main/java/com/finki/emt/sharedkernel/infra/DomainEventPublisher.java
6e06b81c09dc91f614cbf747590f13b50ca5a1c8
[]
no_license
LazarovaVaska/emt-easy-study
8888754014cca38805d251419f70539d97729082
ff0543184dd849db01680ab1725d7ae96a444b71
refs/heads/master
2023-08-06T20:29:57.807133
2021-09-22T20:54:04
2021-09-22T20:54:04
408,570,608
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package com.finki.emt.sharedkernel.infra; import com.finki.emt.sharedkernel.domain.events.DomainEvent; public interface DomainEventPublisher { void publish(DomainEvent event); }
d78c71a7d3e29471248dfbd6ae03d2e8e633d17b
4261a4c53d93a64cddcc12b880f7a981a4812f15
/app/src/main/java/com/unysoft/bimmik/adapter/KegiatanAdapter.java
16d793ed9227572becd53f300c229985fbbc2092
[]
no_license
bimmik-unp/Bimmik
f9d9140a29df83c5283a505666749baad5a1117f
af2fe2d7dafe162c1438d2bc4e5e7ae972d913f0
refs/heads/master
2020-04-09T16:53:30.382925
2018-12-16T14:25:08
2018-12-16T14:25:08
160,459,750
0
0
null
null
null
null
UTF-8
Java
false
false
3,954
java
package com.unysoft.bimmik.adapter; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.text.Layout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageButton; import android.widget.TextView; import com.shashank.sony.fancytoastlib.FancyToast; import com.unysoft.bimmik.R; import com.unysoft.bimmik.mahasiswa.Kegiatan; import com.unysoft.bimmik.mahasiswa.fragment.EditKegiatan; import com.unysoft.bimmik.model.Keg_item; import com.unysoft.bimmik.utils.Value; import com.unysoft.bimmik.webservice.ApiClient; import com.unysoft.bimmik.webservice.BaseApiService; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class KegiatanAdapter extends RecyclerView.Adapter<KegiatanAdapter.KegiatanHolder> { List<Keg_item> keg_itemList; Context context; public onItemClick listener; public KegiatanAdapter(List<Keg_item> keg_itemList, Context context) { this.keg_itemList = keg_itemList; this.context = context; } public interface onItemClick { void mDeleteClick(int postition); void mEditClick(int position); } @NonNull @Override public KegiatanHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.zzz_kegiatan, parent, false); return new KegiatanHolder(view); } @Override public void onBindViewHolder(@NonNull KegiatanAdapter.KegiatanHolder holder, final int position) { final Keg_item keg_item = keg_itemList.get(position); holder.nama.setText(keg_item.getNama()); holder.ket.setText(keg_item.getKet()); holder.edit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, EditKegiatan.class); intent.putExtra("id", keg_item.getId()); intent.putExtra("nk",keg_item.getNama()); intent.putExtra("kk",keg_item.getKet()); context.startActivity(intent); } }); holder.hapus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String id = keg_item.getId(); hapus(id); } }); } private void hapus(String id) { BaseApiService baseApiService = ApiClient.getClient().create(BaseApiService.class); baseApiService.deleteKegiatan(id).enqueue(new Callback<Value>() { @Override public void onResponse(Call<Value> call, Response<Value> response) { if (response.body().getValue().equals("1")){ Kegiatan.kegiatan.AmbilKegiatan(); FancyToast.makeText(context,"Data berhasil dihapus",FancyToast.LENGTH_SHORT, FancyToast.SUCCESS, false).show(); } } @Override public void onFailure(Call<Value> call, Throwable t) { } }); } @Override public int getItemCount() { return keg_itemList.size(); } public class KegiatanHolder extends RecyclerView.ViewHolder { TextView nama, ket; ImageButton edit, hapus; public KegiatanHolder(View view) { super(view); nama = view.findViewById(R.id.kegiatan_tb_nm); ket = view.findViewById(R.id.kegiatan_tb_ket); edit = view.findViewById(R.id.kegiatan_edit); hapus = view.findViewById(R.id.kegiatan_hapus); } } }
a7d9f179dd06a0194faf447a53f868e7c9d1a94a
fe0089887bc18b4c665aedbf0f35de3de5378870
/pbcs-service/src/main/java/com/pbcs/pbgl/service/KsZgrySer.java
2d110b76396d187c15df2c74fde93860ae9ce169
[]
no_license
snowxuyu/hpms
6039a3f8c6c9630871e55f6c7565bd50e25ed1b7
9ce0eb4d07a75aa2db4a7ddc8ea20d73deb3d4a9
refs/heads/master
2021-01-22T12:13:00.874267
2015-07-12T15:42:32
2015-07-12T15:42:32
38,957,360
0
0
null
null
null
null
UTF-8
Java
false
false
539
java
package com.pbcs.pbgl.service; import java.util.List; import java.util.Map; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import com.hpms.service.BaseSer; import com.pbcs.pbgl.vo.PBCS_ZGRYTJVO; public interface KsZgrySer extends BaseSer<PBCS_ZGRYTJVO> { public Map<String, Object> find(int page, int rows, Map<String, Object> map); public List<PBCS_ZGRYTJVO> find(Map<String, Object> map); public HSSFWorkbook export(String title, String cols, List<Object> data); public List<Object> exportList(Map<String, Object> map); }
7e19c32fb17f364ef33c48bc1e4322c9bef52a59
90f17cd659cc96c8fff1d5cfd893cbbe18b1240f
/src/main/java/com/google/android/gms/internal/clearcut/zzgn.java
18ffc2664395e92bd0a2d1d78d2008f4ba07998a
[]
no_license
redpicasso/fluffy-octo-robot
c9b98d2e8745805edc8ddb92e8afc1788ceadd08
b2b62d7344da65af7e35068f40d6aae0cd0835a6
refs/heads/master
2022-11-15T14:43:37.515136
2020-07-01T22:19:16
2020-07-01T22:19:16
276,492,708
0
0
null
null
null
null
UTF-8
Java
false
false
183
java
package com.google.android.gms.internal.clearcut; import com.google.android.gms.internal.clearcut.zzge.zzq.zzc; final class zzgn implements zzck<zzc> { zzgn() { } }
6d414e7bddd5d92403a46031ad40c11968268f8c
ddbd8eda48c5ad7f0c784d1a313204d0831517a3
/core/tags/1.1/src/com/captiveimagination/jgn/test/tcp/certified/BasicCertifiedMessage.java
ea59b4c384ba92fdfde251d63d1b83ae1e94c44c
[]
no_license
chinastyle/jgn
5c487323ad6b03139a8ddcdadbbad4db3265f3f6
bad8e4327090ae976144ea6328ac354a66fdc091
refs/heads/master
2020-08-05T01:48:48.093053
2010-02-14T12:48:53
2010-02-14T12:48:53
33,904,633
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package com.captiveimagination.jgn.test.tcp.certified; import com.captiveimagination.jgn.message.*; /** * @author Matthew D. Hicks * */ public class BasicCertifiedMessage extends CertifiedMessage { public long getResendTimeout() { return 5000; } public int getMaxTries() { return 5; } }
[ "mhicks@a42d04ac-5654-0410-88ef-dd6235ab3d57" ]
mhicks@a42d04ac-5654-0410-88ef-dd6235ab3d57
16641eb8f1ed2c83cd4e06194775e2d31f58229c
4c013cb09c9a621d4e14e631f4aca677c8770e1a
/18_10_18_FinalCarApplication/src/telran/cars/repo/DriverRepository.java
33a3cbbb9f7515405007186401a5af15414d55a1
[]
no_license
Avenirre/carsRenting
62ede8f8a6de4dd06a793de9f910a62c59357832
aa39a1a66543d44c2f061114fe4a3b14d70709f5
refs/heads/master
2020-04-02T03:07:21.842942
2018-10-20T20:57:51
2018-10-20T20:57:51
153,947,214
0
0
null
null
null
null
UTF-8
Java
false
false
274
java
package telran.cars.repo; import java.util.stream.Stream; import org.springframework.data.jpa.repository.JpaRepository; import telran.cars.entities.DriverJpa; public interface DriverRepository extends JpaRepository<DriverJpa, Long> { Stream<DriverJpa> findAllBy(); }
a562ab5ff4fd0c133cad2715e8b9966ebe8a4ace
06fb71c2951dcd3b19eedb92fcaa1da6f3a798a1
/src/com/wat/ssm/controller/CategoryController.java
d609b5e7a0df8589679da4fa44e97f28384dec34
[ "MIT" ]
permissive
Green8948/moon_SSM
adf73af938e2148795d19f16638fd7fc2eccbd5c
7f9edea26a13d202d8142da3c6d5d3dae4f9574e
refs/heads/master
2020-03-26T01:11:42.474932
2018-08-11T04:55:50
2018-08-11T04:55:50
144,356,258
0
0
null
null
null
null
GB18030
Java
false
false
3,870
java
package com.wat.ssm.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.wat.ssm.po.Category; import com.wat.ssm.service.CategoryService; @Controller public class CategoryController { @Autowired CategoryService categoryService; @RequestMapping("/queryCategory") public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println("good luck"); int totalPage=getTotalPage(); //获取总共的页数 int page=1; int index=(page-1)*5; java.util.List<Category> list=categoryService.findCategoryByPage(index); System.out.println("CategoryController_list.size()="+list.size()); //创建modelAndView准备填充数据,设置视图 ModelAndView modelAndView=new ModelAndView(); //填充数据 modelAndView.addObject("CategoryList",list); modelAndView.addObject("page", page); modelAndView.addObject("totalPage", totalPage); //给jsp传参数 //设置视图 modelAndView.setViewName("/order/CategoriesAll"); // return modelAndView; } public int getTotalPage(){ int num=categoryService.findAll(); //获取总共的行数 int totalPage=0; if(num%5==0){ totalPage=num/5; }else{ totalPage=num/5+1; } return totalPage; } @RequestMapping("/categoryAdd0") public String productAdd1(){ return "/order/CategoryAdd"; //是跳转到WEB-INF/productAdd.jsp } // @RequestMapping("/categoryAdd5") /* public String productAdd2(HttpServletRequest request,HttpServletResponse response,Product product,Uploadfile uploadFile,MultipartFile product_pic){ String path=request.getContextPath(); System.out.println("path="+path); //获取图片的原始名称 String originalFileName=product_pic.getOriginalFilename(); System.out.println("originalFileName="+originalFileName); //生成图片唯一标识 int index=originalFileName.lastIndexOf("."); //获取.的下标 String houzuiming=originalFileName.substring(index);//获取.jpg,.png,.bmp; UUID str=UUID.randomUUID(); //生成唯一标识的UUID。 String newFileName =str +houzuiming; uploadFile.setPath(newFileName); //保存图片到项目中 //存储图片的物理路径 String pic_path ="D:\\myGirl\\moonWorkspaces\\Test3Springmvc4SSMSHOP\\WebRoot\\pic\\"; // String pic_path=".\\WebRoot\\pic\\"; File newFile = new File(pic_path+newFileName); //创建图片 try { //将内存中的数据写入磁盘 product_pic.transferTo(newFile); //创建图片并且写入数据 } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } //获取商品:名称,类别,采购价格,市场价格,销售价格,是否推荐,性别,说明 System.out.println(product.getName()+" "+product.getCategoryid()+" "+product.getBaseprice()+" "+product.getMarketprice()+" "+product.getSellprice()+" "+product.getCommend()+" "+product.getDescription()+" "+product.getSexrequest()); productService.addProduct(product, uploadFile); return "/updateSuccess"; } */ }
9f97763e5ddf3571014957152a9ac80eebca2550
d38aaec516956c6459af340b4230477b723ad41a
/src/main/java/com/fsd/assignment/taskmanager/entity/UserEntity.java
ace4986044f753beb94c32777983d70c8ccdc824
[]
no_license
arjunMunusami/FA_SpringBoot
26bf755bc7cccd6b2241043c90174a951dab8aaf
8cd93054f916585a73324d784fb7da12e5ed7886
refs/heads/master
2022-07-11T03:47:34.618441
2019-12-23T16:15:10
2019-12-23T16:15:10
228,904,493
0
0
null
2022-06-21T02:28:29
2019-12-18T19:06:09
Java
UTF-8
Java
false
false
1,239
java
package com.fsd.assignment.taskmanager.entity; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "USER") public class UserEntity implements Serializable { /** * */ private static final long serialVersionUID = -3151038486260028159L; @Id @Column(name="USER_ID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer userId; @Column(name="FIRST_NAME") private String firstName; @Column(name="LAST_NAME") private String lastName; @Column(name="EMPLOYEE_ID") private String emplID; public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmplID() { return emplID; } public void setEmplID(String emplID) { this.emplID = emplID; } }
ede436e5c287759c448fdfb5b05bdf4ad30fef26
6d60ac2c3d8149326b402ee24b14e6c7bc48f1fc
/src/main/java/gov/lanl/micot/infrastructure/project/SimulatorConfiguration.java
ad29a34e1443c282130b579f1d027ba443448228
[ "BSD-2-Clause" ]
permissive
lanl-ansi/micot
141a99d160dc6f215ae8c9a19b2018961620fa0f
d84e40b1eade600cc6b817ac4bb275f3bb7c4714
refs/heads/master
2021-01-18T21:28:28.038751
2020-10-29T17:59:23
2020-10-29T17:59:23
84,364,230
3
4
NOASSERTION
2020-10-13T00:08:52
2017-03-08T20:42:24
Java
UTF-8
Java
false
false
1,296
java
package gov.lanl.micot.infrastructure.project; import gov.lanl.micot.util.io.Flags; import gov.lanl.micot.util.io.FlagsImpl; /** * Simulator Configuration * @author Russell Bent */ public class SimulatorConfiguration { private String simulatorFactoryClass = null; private Flags simulatorFlags = null; /** * Constructor */ public SimulatorConfiguration() { simulatorFlags = new FlagsImpl(); } /** * @return the algorithmFactoryClass */ public String getSimulatorFactoryClass() { return simulatorFactoryClass; } /** * @param algorithmFactoryClass the algorithmFactoryClass to set */ public void setSimulatorFactoryClass(String simulatorFactoryClass) { this.simulatorFactoryClass = simulatorFactoryClass; } /** * @return the algorithmFlags */ public Flags getSimulatorFlags() { return simulatorFlags; } /** * @param algorithmFlags the algorithmFlags to set */ public void setSimulatorFlags(Flags simulatorFlags) { this.simulatorFlags = simulatorFlags; } /** * Adds an algorithm flag * @param key * @param value */ public void addSimulatorFlag(String key, Object value) { simulatorFlags.put(key, value); } }
6a846e2ea0476fedae03ba5c1d32676f81294452
06d7b5fe31395780879e1afa5507d1a6ac4772fb
/spring_04_agent/src/main/java/test3_AOP/UserDao.java
fceb53e75cf4258df7f7a4c2ccfc0dde97f7fddd
[]
no_license
youzi530/maven_springs
1b62e8d9368e022e1dd7a38f505d398bf14c04d4
82569828a9b7b997a2921c6a2623178bc22e66d8
refs/heads/master
2023-08-20T17:09:39.559639
2021-10-16T07:50:14
2021-10-16T07:50:14
417,756,613
1
0
null
null
null
null
UTF-8
Java
false
false
144
java
package test3_AOP; public interface UserDao { //连接点 void add(); String update(); void select(); void delete(); }
dcec24e4c98b0ec0f3a2d67197bc752656508c26
f5617ad51592f4d3ecd86cd3ffc56b80fe0e585e
/iot_push_server/src/main/java/com/lxr/iot/bootstrap/channel/AbstractChannelService.java
cb60ad6e53cf473547f82891240a000be8ca2747
[]
no_license
linjiakin/iot_push
556e6229ff2ae4c639c8791aa6a64eced50cd11f
c794e93ad871112e5344261a901a7304ed1320df
refs/heads/master
2021-05-10T18:17:36.642826
2018-01-22T09:20:26
2018-01-22T09:20:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,175
java
package com.lxr.iot.bootstrap.channel; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.lxr.iot.bootstrap.bean.MqttChannel; import com.lxr.iot.bootstrap.bean.RetainMessage; import com.lxr.iot.bootstrap.BaseApi; import com.lxr.iot.bootstrap.ChannelService; import com.lxr.iot.bootstrap.channel.cache.CacheMap; import com.lxr.iot.bootstrap.scan.ScanRunnable; import io.netty.channel.Channel; import io.netty.util.AttributeKey; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import java.util.Collection; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * 抽象类 * * @author lxr * @create 2017-12-12 20:01 **/ @Slf4j public abstract class AbstractChannelService extends PublishApiSevice implements ChannelService ,BaseApi { protected AttributeKey<Boolean> _login = AttributeKey.valueOf("login"); protected AttributeKey<String> _deviceId = AttributeKey.valueOf("deviceId"); protected static char SPLITOR = '/'; protected ExecutorService executorService =Executors.newCachedThreadPool(); protected static CacheMap<String,MqttChannel> cacheMap= new CacheMap<>(); protected static ConcurrentHashMap<String ,MqttChannel> mqttChannels = new ConcurrentHashMap<>(); // deviceId - mqChannel 登录 protected static ConcurrentHashMap<String,ConcurrentLinkedQueue<RetainMessage>> retain = new ConcurrentHashMap<>(); // topic - 保留消息 protected static Cache<String, Collection<MqttChannel>> mqttChannelCache = CacheBuilder.newBuilder().maximumSize(100).build(); public AbstractChannelService(ScanRunnable scanRunnable) { super(scanRunnable); } protected Collection<MqttChannel> getChannels(String topic,TopicFilter topicFilter){ try { return mqttChannelCache.get(topic, () -> topicFilter.filter(topic)); } catch (Exception e) { log.info(String.format("guava cache key topic【%s】 channel value== null ",topic)); } return null; } @FunctionalInterface interface TopicFilter{ Collection<MqttChannel> filter(String topic); } protected boolean deleteChannel(String topic,MqttChannel mqttChannel){ mqttChannelCache.invalidate(topic); return cacheMap.delete(getTopic(topic),mqttChannel); } protected boolean addChannel(String topic,MqttChannel mqttChannel) { mqttChannelCache.invalidate(topic); return cacheMap.putData(getTopic(topic),mqttChannel); } /** * 获取channel * @param deviceId * @return */ public MqttChannel getMqttChannel(String deviceId){ return mqttChannels.get(deviceId); } /** * 获取channelId * @param channel * @return */ public String getDeviceId(Channel channel){ return channel.attr(_deviceId).get(); } protected String[] getTopic(String topic) { return StringUtils.split(topic,SPLITOR); } }
12f5ceb87fc5c77c2dc2b528e4289624a20e2b88
221e90aa0bbf693e7dba0ef912636807ec84c3ff
/src/tengxun/Test2.java
a9f547ab1524e3c44e634d088a9d128f600e9601
[]
no_license
zypzs/javaTest2
9da529fa8c223cd0e0b70007528f4c50bb02fd4b
f558ad3be5e391f95f999dc3f988b2922aa2c07e
refs/heads/master
2020-06-27T18:39:59.124570
2016-08-24T04:47:23
2016-08-24T04:47:23
66,430,506
0
0
null
null
null
null
GB18030
Java
false
false
641
java
package tengxun; import java.util.Scanner; public class Test2 { /* * 在不申请额外空间的前提下,实现字符大小写排序 */ public static void main(String[] args) { Scanner input = new Scanner(System.in); while(input.hasNext()){ String s = input.nextLine(); char []str = s.toCharArray(); for(int i = 0; i<str.length;i++){ for(int j=str.length-1 ; j>i;j--){ if(str[j] > 96 && str[j-1] < 96){ swap(str,j,j-1); } } } System.out.println(new String(str)); } } private static void swap(char[] str, int j, int i) { char temp = str[i]; str[i] = str[j]; str[j] = temp; } }
0eeaec8bc45c76d76c9d07d1a2176f9aebdd0f6c
fc4a5ad3532cbb7edb0d971245b14fa3e7601431
/bookmall/src/main/java/com/bookmall/service/RatingService.java
e6a509b5c1d07dc08ee538e9d70b4c3cf0aff910
[]
no_license
Evnov/Second-hand-Books-Trading-Platform
d532eb145c8ad9a9df4e742b98d4a469b851a0ca
031a846c768eff5b3ab24a15c178de5b86ae8ae2
refs/heads/main
2023-01-30T15:26:14.804417
2020-12-07T13:11:44
2020-12-07T13:11:44
305,512,149
0
0
null
2020-12-07T13:11:45
2020-10-19T21:01:50
JavaScript
UTF-8
Java
false
false
203
java
package com.bookmall.service; import com.bookmall.pojo.Rating; import java.util.List; public interface RatingService { int addRating(Rating rating); List<Rating> getReview(int reviewee_id); }
18a04b6c4e4f5abdf70af7757f0a3f19c81b7194
40665051fadf3fb75e5a8f655362126c1a2a3af6
/ibinti-bugvm/0248eed76c67ba07a04a79c2b55fb9581eae50b2/5230/OpenSSLSignature.java
7785942ec78379836f82a03136b1f793942e3bd6
[]
no_license
fermadeiral/StyleErrors
6f44379207e8490ba618365c54bdfef554fc4fde
d1a6149d9526eb757cf053bc971dbd92b2bfcdf1
refs/heads/master
2020-07-15T12:55:10.564494
2019-10-24T02:30:45
2019-10-24T02:30:45
205,546,543
2
0
null
null
null
null
UTF-8
Java
false
false
11,915
java
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.org.conscrypt; import java.security.InvalidKeyException; import java.security.InvalidParameterException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.Signature; import java.security.SignatureException; import java.security.interfaces.DSAPrivateKey; import java.security.interfaces.DSAPublicKey; import java.security.interfaces.ECPrivateKey; import java.security.interfaces.ECPublicKey; import java.security.interfaces.RSAPrivateCrtKey; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; /** * Implements the subset of the JDK Signature interface needed for * signature verification using OpenSSL. */ public class OpenSSLSignature extends Signature { private static enum EngineType { RSA, DSA, EC, }; /** * Holds a pointer to the native message digest context. */ private long ctx; /** * The current OpenSSL key we're operating on. */ private OpenSSLKey key; /** * Holds the type of the Java algorithm. */ private final EngineType engineType; /** * Holds the OpenSSL name of the algorithm (lower case, no dashes). */ private final String evpAlgorithm; /** * Holds a dummy buffer for writing single bytes to the digest. */ private final byte[] singleByte = new byte[1]; /** * Creates a new OpenSSLSignature instance for the given algorithm name. * * @param algorithm OpenSSL name of the algorithm, e.g. "RSA-SHA1". */ private OpenSSLSignature(String algorithm, EngineType engineType) throws NoSuchAlgorithmException { super(algorithm); // We don't support MD2 if ("RSA-MD2".equals(algorithm)) { throw new NoSuchAlgorithmException(algorithm); } this.engineType = engineType; this.evpAlgorithm = algorithm; } @Override protected void engineUpdate(byte input) { singleByte[0] = input; engineUpdate(singleByte, 0, 1); } @Override protected void engineUpdate(byte[] input, int offset, int len) { if (state == SIGN) { if (ctx == 0) { try { ctx = NativeCrypto.EVP_SignInit(evpAlgorithm); } catch (Exception ex) { throw new RuntimeException(ex); } } NativeCrypto.EVP_SignUpdate(ctx, input, offset, len); } else { if (ctx == 0) { try { ctx = NativeCrypto.EVP_VerifyInit(evpAlgorithm); } catch (Exception ex) { throw new RuntimeException(ex); } } NativeCrypto.EVP_VerifyUpdate(ctx, input, offset, len); } } @Override protected Object engineGetParameter(String param) throws InvalidParameterException { return null; } private void checkEngineType(OpenSSLKey pkey) throws InvalidKeyException { final int pkeyType = NativeCrypto.EVP_PKEY_type(pkey.getPkeyContext()); switch (engineType) { case RSA: if (pkeyType != NativeCrypto.EVP_PKEY_RSA) { throw new InvalidKeyException("Signature not initialized as RSA"); } break; case DSA: if (pkeyType != NativeCrypto.EVP_PKEY_DSA) { throw new InvalidKeyException("Signature not initialized as DSA"); } break; case EC: if (pkeyType != NativeCrypto.EVP_PKEY_EC) { throw new InvalidKeyException("Signature not initialized as EC"); } break; default: throw new InvalidKeyException("Need DSA or RSA or EC private key"); } } @Override protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException { destroyContextIfExists(); if (privateKey instanceof OpenSSLKeyHolder) { OpenSSLKey pkey = ((OpenSSLKeyHolder) privateKey).getOpenSSLKey(); checkEngineType(pkey); key = pkey; } else if (privateKey instanceof RSAPrivateCrtKey) { if (engineType != EngineType.RSA) { throw new InvalidKeyException("Signature not initialized as RSA"); } RSAPrivateCrtKey rsaPrivateKey = (RSAPrivateCrtKey) privateKey; key = OpenSSLRSAPrivateCrtKey.getInstance(rsaPrivateKey); } else if (privateKey instanceof RSAPrivateKey) { if (engineType != EngineType.RSA) { throw new InvalidKeyException("Signature not initialized as RSA"); } RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) privateKey; key = OpenSSLRSAPrivateKey.getInstance(rsaPrivateKey); } else if (privateKey instanceof DSAPrivateKey) { if (engineType != EngineType.DSA) { throw new InvalidKeyException("Signature not initialized as DSA"); } DSAPrivateKey dsaPrivateKey = (DSAPrivateKey) privateKey; key = OpenSSLDSAPrivateKey.getInstance(dsaPrivateKey); } else if (privateKey instanceof ECPrivateKey) { if (engineType != EngineType.EC) { throw new InvalidKeyException("Signature not initialized as EC"); } ECPrivateKey ecPrivateKey = (ECPrivateKey) privateKey; key = OpenSSLECPrivateKey.getInstance(ecPrivateKey); } else { throw new InvalidKeyException("Need DSA or RSA or EC private key"); } } @Override protected void engineInitVerify(PublicKey publicKey) throws InvalidKeyException { // If we had an existing context, destroy it first. destroyContextIfExists(); if (publicKey instanceof OpenSSLKeyHolder) { OpenSSLKey pkey = ((OpenSSLKeyHolder) publicKey).getOpenSSLKey(); checkEngineType(pkey); key = pkey; } else if (publicKey instanceof RSAPublicKey) { if (engineType != EngineType.RSA) { throw new InvalidKeyException("Signature not initialized as RSA"); } RSAPublicKey rsaPublicKey = (RSAPublicKey) publicKey; key = OpenSSLRSAPublicKey.getInstance(rsaPublicKey); } else if (publicKey instanceof DSAPublicKey) { if (engineType != EngineType.DSA) { throw new InvalidKeyException("Signature not initialized as DSA"); } DSAPublicKey dsaPublicKey = (DSAPublicKey) publicKey; key = OpenSSLDSAPublicKey.getInstance(dsaPublicKey); } else if (publicKey instanceof ECPublicKey) { if (engineType != EngineType.EC) { throw new InvalidKeyException("Signature not initialized as EC"); } ECPublicKey ecPublicKey = (ECPublicKey) publicKey; key = OpenSSLECPublicKey.getInstance(ecPublicKey); } else { throw new InvalidKeyException("Need DSA or RSA or EC public key"); } } @Override protected void engineSetParameter(String param, Object value) throws InvalidParameterException { } @Override protected byte[] engineSign() throws SignatureException { if (key == null) { // This can't actually happen, but you never know... throw new SignatureException("Need DSA or RSA or EC private key"); } try { byte[] buffer = new byte[NativeCrypto.EVP_PKEY_size(key.getPkeyContext())]; int bytesWritten = NativeCrypto.EVP_SignFinal(ctx, buffer, 0, key.getPkeyContext()); byte[] signature = new byte[bytesWritten]; System.arraycopy(buffer, 0, signature, 0, bytesWritten); return signature; } catch (Exception ex) { throw new SignatureException(ex); } finally { /* * Java expects the digest context to be reset completely after sign * calls. */ destroyContextIfExists(); } } @Override protected boolean engineVerify(byte[] sigBytes) throws SignatureException { if (key == null) { // This can't actually happen, but you never know... throw new SignatureException("Need DSA or RSA public key"); } try { int result = NativeCrypto.EVP_VerifyFinal(ctx, sigBytes, 0, sigBytes.length, key.getPkeyContext()); return result == 1; } catch (Exception ex) { return false; } finally { /* * Java expects the digest context to be reset completely after * verify calls. */ destroyContextIfExists(); } } private void destroyContextIfExists() { if (ctx != 0) { NativeCrypto.EVP_MD_CTX_destroy(ctx); ctx = 0; } } @Override protected void finalize() throws Throwable { try { if (ctx != 0) { NativeCrypto.EVP_MD_CTX_destroy(ctx); } } finally { super.finalize(); } } public static final class MD5RSA extends OpenSSLSignature { public MD5RSA() throws NoSuchAlgorithmException { super("RSA-MD5", EngineType.RSA); } } public static final class SHA1RSA extends OpenSSLSignature { public SHA1RSA() throws NoSuchAlgorithmException { super("RSA-SHA1", EngineType.RSA); } } public static final class SHA256RSA extends OpenSSLSignature { public SHA256RSA() throws NoSuchAlgorithmException { super("RSA-SHA256", EngineType.RSA); } } public static final class SHA384RSA extends OpenSSLSignature { public SHA384RSA() throws NoSuchAlgorithmException { super("RSA-SHA384", EngineType.RSA); } } public static final class SHA512RSA extends OpenSSLSignature { public SHA512RSA() throws NoSuchAlgorithmException { super("RSA-SHA512", EngineType.RSA); } } public static final class SHA1DSA extends OpenSSLSignature { public SHA1DSA() throws NoSuchAlgorithmException { super("DSA-SHA1", EngineType.DSA); } } public static final class SHA1ECDSA extends OpenSSLSignature { public SHA1ECDSA() throws NoSuchAlgorithmException { super("SHA1", EngineType.EC); } } public static final class SHA256ECDSA extends OpenSSLSignature { public SHA256ECDSA() throws NoSuchAlgorithmException { super("SHA256", EngineType.EC); } } public static final class SHA384ECDSA extends OpenSSLSignature { public SHA384ECDSA() throws NoSuchAlgorithmException { super("SHA384", EngineType.EC); } } public static final class SHA512ECDSA extends OpenSSLSignature { public SHA512ECDSA() throws NoSuchAlgorithmException { super("SHA512", EngineType.EC); } } }
83d69a689eabeb61f9b78fcd7726a9fd35785e8d
bb0edb183e35e85aa79932e554e32584bae247f6
/src/objects/savegamedialoge/ScrollUpBtn.java
75f2b612cd77d1edeeb9a753d434cb8b5d5127a2
[]
no_license
MrGussiaas/AdventureEngine
272b4f3a9d49bfcd4d432c2174a4856a69c42536
f6365f046765071b8daac521134a8cd9b0bda41a
refs/heads/master
2021-07-04T01:14:04.587097
2016-12-29T21:22:03
2016-12-29T21:22:03
15,502,957
0
0
null
null
null
null
UTF-8
Java
false
false
1,326
java
package objects.savegamedialoge; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.imageio.ImageIO; import objects.settingswindow.CommandButton; import trigger.ITriggerHandler; import trigger.ScrollUpTrigger; public class ScrollUpBtn extends CommandButton implements IScrollButton{ private BufferedImage upImage; private BufferedImage downImage; private List<IScrollBarListener> handlers = new ArrayList<IScrollBarListener>(10); private boolean clicked; public ScrollUpBtn(){ try { upImage = ImageIO.read(new File(".\\images\\scrollupbtn_up.bmp")); downImage = ImageIO.read(new File(".\\images\\scrollupbtn_down.bmp")); setWidth(upImage.getWidth()); setHeight(upImage.getHeight()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public Image createImage() { return clicked ? downImage : upImage; } @Override public void mouseUp() { clicked = false; for(int i = 0, n = handlers.size(); i < n; i++){ handlers.get(i).scrollUp(); } } @Override public void mouseLeft() { clicked = true; } @Override public void addITriggerHandler(IScrollBarListener handler) { handlers.add(handler); } }
65ceef424c42362ea3bfe537e15688d2dca6bc5c
70ee618d6a36684c7e749c749dfd8bca000f9630
/src/main/java/com/qidiancamp/common/utils/MapUtils.java
a69695386c13da91674e1fd7090f08d6a59623d6
[ "Apache-2.0" ]
permissive
valentinac/ucenter
bc1d89bc275db7032cac6680d8286568e06cdc94
a5045cf4a11435d1adbfb6907b17584ee5c904d6
refs/heads/master
2020-03-21T02:16:08.136100
2018-06-22T10:22:43
2018-06-22T10:22:43
137,990,237
0
0
null
null
null
null
UTF-8
Java
false
false
956
java
/** * Copyright 2018 人人开源 http://www.renren.io * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.qidiancamp.common.utils; import java.util.HashMap; /** * Map工具类 * * @author Mark [email protected] * @since 2.0.0 */ public class MapUtils extends HashMap<String, Object> { @Override public MapUtils put(String key, Object value) { super.put(key, value); return this; } }
03c13f85cc95340be64fb9acb3f8e04eed2c513b
61cf3109eaf4561e071d93f9daf0d3cf9155ca9f
/src/com/rbt/dao/impl/EmailhistoryDao.java
8dc32037d9bd479504378d8c6715e4394299b931
[]
no_license
haoouwen/epf
b620fe05c93db178a122cfef778d31c036a2a822
abe0f1ed564f33dcf766591c5f9b04ce2b5e8094
refs/heads/master
2021-01-19T13:46:10.278247
2017-08-20T10:40:12
2017-08-20T10:40:12
100,859,509
1
2
null
null
null
null
UTF-8
Java
false
false
564
java
/* * Package:com.rbt.dao.impl * FileName: EmailhistoryDao.java */ package com.rbt.dao.impl; import org.springframework.stereotype.Repository; import com.rbt.dao.IEmailhistoryDao; import com.rbt.model.Emailhistory; /** * @function 功能 记录邮件发送历史记录dao层业务接口实现类 * @author 创建人 HZX * @date 创建日期 Wed Jan 09 12:52:35 CST 2014 */ @Repository public class EmailhistoryDao extends GenericDao<Emailhistory,String> implements IEmailhistoryDao { public EmailhistoryDao() { super(Emailhistory.class); } }
[ "Administrator@USER-20170608NM" ]
Administrator@USER-20170608NM
ab425f2a69a54633c9b33e0d14c4854713c10f50
49517e85cf81cdc1c7a1b2edf767fa4e00c83f46
/server/src/main/java/ua/artcode/exceptions/CourseNotFoundException.java
262fdce2ab62a017d6fa2b2244eb7cc318c32b0e
[]
no_license
Reed17/StudyArt-1
28182d4d640f69257bc7b11052cfe4d435c0b52c
64a149758fcab050576cfb0d4b8b78932a9cc186
refs/heads/master
2020-04-25T23:31:30.851698
2017-06-27T06:54:26
2017-06-27T06:54:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package ua.artcode.exceptions; /** * Created by v21k on 15.04.17. */ public class CourseNotFoundException extends AppException { public CourseNotFoundException(String message) { super(message); } }
a661c3994c2b2397b7468e1474c161a20ac7f46f
5a5e592b7698f1a127234f8fdc37a7b0d3490294
/src/mavmiles/data/calendarDao.java
2dcb7e65f6643ce1260a3aff88127fb7b46b5b3b
[]
no_license
krishnanayyappan/Mavmiles
3a9d57a1807cedc2136b8e776b9bc99cc049fed2
7c63c279ccd5b252a3f0ac34642c26d8ecb4a9e2
refs/heads/master
2021-06-06T13:00:43.272277
2021-05-30T23:27:38
2021-05-30T23:27:38
166,314,751
0
0
null
null
null
null
UTF-8
Java
false
false
3,663
java
/*package mavmiles.data; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import mavmiles.model.CalendarModel; import mavmiles.util.SQLConnection; public class calendarDao { private static ArrayList<CalendarModel> GetCarsfromDB(CalendarModel vacModel, String queryString) { ArrayList<CalendarModel> ACarsList = new ArrayList<CalendarModel>(); Statement stmt = null; Connection conn = SQLConnection.getDBConnection(); try { stmt = conn.createStatement(); String fetchCarsquery = queryString + "SELECT * FROM cars WHERE licenseid IN( select licenseid from reservations WHERE( startdate BETWEEN ('" + vacModel.getstartdate() + "') AND ('" + vacModel.getenddate() + "') OR enddate BETWEEN ('" + vacModel.getstartdate() + "') AND ('" + vacModel.getenddate() + "') OR ('" + vacModel.getstartdate() + "')));" ; System.out.println("fetchCarsquery = " + fetchCarsquery); ResultSet availableList = stmt.executeQuery(fetchCarsquery); while (availableList.next()) { CalendarModel AvailableModel = new CalendarModel(); AvailableModel.setlicenseid(availableList.getString("licenseid")); AvailableModel.setcarname(availableList.getString("carname")); AvailableModel.setcapacity(availableList.getInt("capacity")); ACarsList.add(AvailableModel); } conn.commit(); } catch (SQLException e) { e.printStackTrace(); } finally { try { conn.close(); stmt.close(); } catch (SQLException e) { e.printStackTrace(); } }; return ACarsList; } public static ArrayList<CalendarModel> searchRental(CalendarModel vACModel) { return GetCarsfromDB(vACModel, "SELECT * FROM cars WHERE "); } } */ package mavmiles.data; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import mavmiles.model.CalendarModel; import mavmiles.util.SQLConnection; public class calendarDao { private static ArrayList<CalendarModel> GetCarsfromDB(CalendarModel vacModel, String queryString) { ArrayList<CalendarModel> ACarsList = new ArrayList<CalendarModel>(); Statement stmt = null; Connection conn = SQLConnection.getDBConnection(); try { stmt = conn.createStatement(); String fetchCarsquery = /* queryString + */ "SELECT * FROM cars WHERE licenseid IN( select licenseid from reservations WHERE( startdate BETWEEN ('" + vacModel.getstartdate() + "') AND ('" + vacModel.getenddate() + "') OR enddate BETWEEN ('" + vacModel.getstartdate() + "') AND ('" + vacModel.getenddate() + "') OR ('" + vacModel.getstartdate() + "')));" ; // System.out.println("fetchCarsquery = " + fetchCarsquery); ResultSet availableList = stmt.executeQuery(fetchCarsquery); while (availableList.next()) { CalendarModel AvailableModel = new CalendarModel(); AvailableModel.setlicenseid(availableList.getString("licenseid")); AvailableModel.setcarname(availableList.getString("carname")); AvailableModel.setcapacity(availableList.getInt("capacity")); ACarsList.add(AvailableModel); } conn.commit(); } catch (SQLException e) { e.printStackTrace(); } finally { try { conn.close(); stmt.close(); } catch (SQLException e) { e.printStackTrace(); } }; return ACarsList; } public static ArrayList<CalendarModel> searchRental(CalendarModel vACModel) { return GetCarsfromDB(vACModel, "SELECT * FROM cars WHERE "); } }
ebc331dec1531f3285d6bacf570f2ed686252455
752960187be905811e3de7cec117c6453297abeb
/app/src/main/java/com/example/simplegameengine/MainActivity.java
c3d139638374fed2593e8d06581a7903ec631cf5
[]
no_license
knadziroh/SimpleGameEngine
8a88d11b7811f4845ec5c108883771484dbed251
cf9b27050fafe5e0daf022a0053646a428ea0391
refs/heads/main
2023-02-18T01:18:34.960990
2021-01-21T03:51:08
2021-01-21T03:51:08
331,507,142
0
0
null
null
null
null
UTF-8
Java
false
false
4,890
java
package com.example.simplegameengine; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Point; import android.os.Bundle; import android.util.Log; import android.view.Display; import android.view.MotionEvent; import android.view.SurfaceView; import android.view.SurfaceHolder; public class MainActivity extends AppCompatActivity { GameView gameView; int width, height; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); gameView = new GameView(this); setContentView(gameView); Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); width = size.x; height = size.y; } public static int getScreenWidth() { return Resources.getSystem().getDisplayMetrics().widthPixels; } class GameView extends SurfaceView implements Runnable { Thread gameThread = null; SurfaceHolder ourHolder; volatile boolean playing; Canvas canvas; Paint paint; long fps; private long timeThisFrame; Bitmap bitmapPinguin; boolean isMoving = false; boolean forward = true; float walkSpeedPerSecond = 150; float pinguinXPosition = 20; public GameView(Context context) { super(context); ourHolder = getHolder(); paint = new Paint(); bitmapPinguin = BitmapFactory.decodeResource(this.getResources(), R.drawable.pinguin); playing = true; } @Override public void run() { while (playing) { long startFrameTime = System.currentTimeMillis(); update(); draw(startFrameTime); timeThisFrame = System.currentTimeMillis() - startFrameTime; if (timeThisFrame > 0) { fps = 1000 / timeThisFrame; } } } public void update() { if (isMoving) { if(forward){ if(pinguinXPosition >= (getScreenWidth() - 100)){ forward = false; } else{ pinguinXPosition = pinguinXPosition + (walkSpeedPerSecond / fps); } } else{ if(pinguinXPosition <= 20){ forward = true; } else{ pinguinXPosition = pinguinXPosition- (walkSpeedPerSecond/fps); } } } } public void draw(long startFrameTime) { if (ourHolder.getSurface().isValid()){ canvas = ourHolder.lockCanvas(); canvas.drawColor(Color.argb(250,140,194,240)); paint.setColor(Color.argb(255,73,73,73)); paint.setTextSize(45); canvas.drawText("FPS : " + fps, 20,40,paint) ; canvas.drawText("Height : " + height + " Width : " + width, 20,80,paint) ; canvas.drawText("Pinguin Height : " + bitmapPinguin.getHeight() + " Pinguin Width : " + bitmapPinguin.getHeight(), 20,120,paint) ; canvas.drawText("Pinguin X Position : " + startFrameTime, 20,160,paint) ; canvas.drawBitmap (bitmapPinguin,pinguinXPosition,300,paint); ourHolder.unlockCanvasAndPost(canvas); } } public void pause() { playing = false; try { gameThread.join(); } catch (InterruptedException e) { Log.e("Error", "Joining Thread"); } } public void resume() { playing = true; gameThread = new Thread(this); gameThread.start(); } @Override public boolean onTouchEvent (MotionEvent motionEvent){ switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: isMoving = true; break; case MotionEvent.ACTION_UP: isMoving = false; break; } return true; } } @Override protected void onResume() { super.onResume(); gameView.resume(); } @Override protected void onPause() { super.onPause(); gameView.pause(); } }
5469d9852e415263d8ec7db44f638a7e145a5246
33532e37e6e0e2abedb86ff9342bbd697fc37651
/oop/src/Matrix/MatrixBase.java
ad2ba4654eddc6f730e70fdd84b84080765f9297
[]
no_license
jhyunsin/oop
8a9071cd8ca339e6b9c62cad18d375a572a6bb83
8cd17a008d56dd5adfd7c369e32b5d5c44511300
refs/heads/master
2021-01-17T08:11:26.177964
2016-06-29T08:40:21
2016-06-29T08:40:21
61,357,983
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package Matrix; /** * @date : 2016. 6. 22. * @author : 신재현 * @file : Matrix5.java * @story : */ public class MatrixBase { public static void main(String[] args) { int[]arr= new int[5]; for (int i = 0; i < arr.length; i++) { arr[i]=i+1; System.out.printf(arr[i]+"\t"+"매트릭스극혐"); } }}
[ "hb2009@hb2009-PC" ]
hb2009@hb2009-PC
1a69cffa8a419adc2ce773d6699dac7b0778993b
ec1f43daa6ea1551943d60636b19040244646710
/src/main/java/com/example/stepruler/service/CommunityService.java
4da625b0a86b6e88b9398f0e73efa945c930655f
[]
no_license
Fantasy-zjh/StepRulerBack
16bcdd695433bb0d0f60bbe8d0158af36db9fa32
578568c78cde0cca4c1c077a713809c8df295dea
refs/heads/master
2020-03-16T18:46:34.170260
2018-05-10T10:39:50
2018-05-10T10:39:50
132,886,350
0
0
null
null
null
null
UTF-8
Java
false
false
4,074
java
package com.example.stepruler.service; import com.example.stepruler.Entity.CommunityEntity; import com.example.stepruler.builder.SortBuilder; import com.example.stepruler.jpa.CommentJPA; import com.example.stepruler.jpa.CommunityJPA; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import java.util.ArrayList; import java.util.List; @Service public class CommunityService { @Autowired CommunityJPA communityJPA; public List<CommunityEntity> cutPage(int page, int size, List<CommunityEntity> list) { List<CommunityEntity> list1 = new ArrayList<>(); if ((page - 1) * size >= list.size() && list.size() > size) { //没有那么多页,传回去一个空队列 return list1; } else if (page * size >= list.size()) { //当前页不够十个,也就是说最后一页咯 for (int i = 0; i < (list.size() - (page - 1) * size); i++) { list1.add(list.get((page - 1) * size + i)); } return list1; } else if (page * size < list.size()) { //不是最后一页 for (int i = 0; i < size; i++) { list1.add(list.get((page - 1) * size + i)); } return list1; } return list1; } //点赞 public int zan(int id) { List<CommunityEntity> list = communityJPA.findAll(); for (CommunityEntity communityEntity : list) { if (communityEntity.getCommunityId() == id) { communityEntity.setCommunityZan(communityEntity.getCommunityZan() + 1); communityJPA.save(communityEntity); return communityEntity.getCommunityZan(); } } return -1; } //取消点赞 public int notzan(int id) { List<CommunityEntity> list = communityJPA.findAll(); for (CommunityEntity communityEntity : list) { if (communityEntity.getCommunityId() == id) { communityEntity.setCommunityZan(communityEntity.getCommunityZan() - 1); communityJPA.save(communityEntity); return communityEntity.getCommunityZan(); } } return -1; } //发说说 public String post(int user_id, String date, String text, int zan, int comment) { CommunityEntity communityEntity = new CommunityEntity(); communityEntity.setCommunityZan(zan); communityEntity.setCommunityComment(comment); communityEntity.setCommunityDate(date); communityEntity.setCommunityText(text); communityEntity.setUserId(user_id); communityJPA.save(communityEntity); return "success"; } //查询自己发过的朋友圈,按日期排序 public List<CommunityEntity> mine(int user_id, int page) { int size = 5; List<CommunityEntity> list = communityJPA.findAllByUserId(user_id); return cutPage(page, size, list); } //删除自己发过的朋友圈操作 public List<CommunityEntity> delete(int communityId, int id) { communityJPA.delete(communityId); List<CommunityEntity> list = communityJPA.findAllByUserId(id); return list; } //返回热门朋友圈,按评论数排序 public List<CommunityEntity> getHot(int page) { int size = 5; List<CommunityEntity> list = communityJPA.findAll(SortBuilder.generateSort("communityComment/d")); return cutPage(page, size, list); } //返回我所关注的好友的朋友圈,按时间排序 public List<CommunityEntity> getFoll(int user_id, int page) { int size = 5; return cutPage(page, size, communityJPA.findByFriendId(user_id)); } }
9fc16d8a861c533355abbc33bf628df23692453d
a48a333147a57bcc8242108a944792ab53a6b533
/qingcheng_interface/src/main/java/com/qingcheng/service/goods/SkuService.java
567194f65357904dc4649b25ae088e719aa4c7ea
[]
no_license
luo1060958168/qingcheng
6673ce10eaba26ac78469f58af5f778978203824
3664d5c1a8640f62f8c964fd7e7648e32f728826
refs/heads/master
2022-12-24T06:07:17.042323
2019-08-03T12:32:56
2019-08-03T12:32:56
200,219,521
0
0
null
null
null
null
UTF-8
Java
false
false
864
java
package com.qingcheng.service.goods; import com.qingcheng.entity.PageResult; import com.qingcheng.pojo.goods.Sku; import com.qingcheng.pojo.order.OrderItem; import java.util.*; /** * sku业务逻辑层 */ public interface SkuService { public List<Sku> findAll(); public PageResult<Sku> findPage(int page, int size); public List<Sku> findList(Map<String,Object> searchMap); public PageResult<Sku> findPage(Map<String,Object> searchMap,int page, int size); public Sku findById(String id); public void add(Sku sku); public void update(Sku sku); public void delete(String id); public void importToEs(); public Integer findPrice(String id); /** * 根据购物车批量减库存 * @param orderItemList * @return */ public boolean deductionStock(List<OrderItem> orderItemList); }
3acb37afd0ca9c3ae06dfa3e51bb8b983a9313db
0413a62c4ec3d07074ed9dc25a89308621ab2002
/spring-welcome/src/com/springimplant/entities/WelcomeBean.java
4700f8e3f92c076cb6464550732126e5be50de13
[]
no_license
gauravmatta/springmvc
38ae8288732bfc4c3f86ba796919ce72658f884f
d6cf16bbf95c4d4cf4934d13c30520e707b63b96
refs/heads/master
2023-08-30T21:33:23.310678
2023-08-23T04:34:30
2023-08-23T04:34:30
134,175,952
0
0
null
2023-07-07T15:09:32
2018-05-20T18:28:27
Java
UTF-8
Java
false
false
294
java
package com.springimplant.entities; public class WelcomeBean { private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public void show() { System.out.println(message); } }
a51263eec1532320957d08477e2bfc716429a6f2
943ebfc0b885ff0e95339743639b49b6e36fce62
/app/src/main/java/com/Exposition/basigarcia/navigationdrawervideotutorial/ScrollFABBehavior.java
f962b90374c1ba6b9930ddee800d9b9adeed0bd0
[]
no_license
kalpawijesooriya/exposition
322bb739ecd1558392f504114dfc86b438d72f31
b40a30a6ec9e946679bcfb509213f000b863443a
refs/heads/master
2021-01-23T01:29:50.858531
2020-12-15T06:42:36
2020-12-15T06:42:36
92,873,375
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package com.Exposition.basigarcia.navigationdrawervideotutorial; import android.content.Context; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.FloatingActionButton; import android.support.v4.view.ViewCompat; import android.util.AttributeSet; import android.view.View; /** * Created by user on 25/12/2016. */ public class ScrollFABBehavior extends FloatingActionButton.Behavior { public ScrollFABBehavior(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { child.hide(); } else if (dyConsumed < 0 && child.getVisibility() == View.GONE) { child.show(); } } @Override public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View directTargetChild, View target, int nestedScrollAxes) { return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL; } }
95c973050328a2d25237120ebff0e5c5b19ceec1
8add4bd6666130f7f8251e942582631ccd9f5066
/andnext_app_whatsandroid/src/main/java/com/haiyunshan/test/widget/TestCoordinatorLayout1Fragment.java
d76615e7a14b906bf8b75dbe382ec8ff61a6b5d8
[]
no_license
honeyflyfish/WhatsAndroid
8ab1a1d3548bdbd8f292a3906db8f86e09dd0c5a
4bb583ae7a7843cc716dcfdcc48a507fc61806c8
refs/heads/master
2020-04-03T19:42:35.567859
2018-10-29T04:05:58
2018-10-29T04:05:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,815
java
package com.haiyunshan.test.widget; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.*; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import club.andnext.overscroll.OverScrollHelper; import club.andnext.recyclerview.bridge.BridgeAdapter; import club.andnext.recyclerview.bridge.BridgeAdapterProvider; import club.andnext.recyclerview.bridge.BridgeBuilder; import club.andnext.recyclerview.bridge.BridgeHolder; import com.google.android.material.appbar.AppBarLayout; import com.haiyunshan.whatsandroid.R; import me.everything.android.ui.overscroll.IOverScrollDecor; import me.everything.android.ui.overscroll.IOverScrollUpdateListener; import me.everything.android.ui.overscroll.VerticalOverScrollBounceEffectDecorator; import me.everything.android.ui.overscroll.adapters.IOverScrollDecoratorAdapter; import me.everything.android.ui.overscroll.adapters.StaticOverScrollDecorAdapter; /** * A simple {@link Fragment} subclass. */ public class TestCoordinatorLayout1Fragment extends Fragment { CoordinatorLayout coordinatorLayout; AppBarLayout appBarLayout; View headerView; RecyclerView recyclerView; public TestCoordinatorLayout1Fragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_test_coordinator_layout1, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); this.coordinatorLayout = (CoordinatorLayout)view; coordinatorLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Log.w("AA", "event y = " + event.getY()); return false; } }); { this.appBarLayout = view.findViewById(R.id.app_bar); this.headerView = view.findViewById(R.id.header); } { this.recyclerView = view.findViewById(R.id.recycler_list_view); LinearLayoutManager layout = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(layout); } } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); coordinatorLayout.setStatusBarBackgroundColor(Color.RED); { VerticalOverScrollBounceEffectDecorator ov = new VerticalOverScrollBounceEffectDecorator(new IOverScrollDecoratorAdapter() { @Override public View getView() { return coordinatorLayout; } @Override public boolean isInAbsoluteStart() { return recyclerView.getTop() == coordinatorLayout.getChildAt(0).getHeight(); } @Override public boolean isInAbsoluteEnd() { return false; } }); ov.attach(); } { BridgeAdapter adapter = new BridgeAdapter(getActivity(), new BridgeAdapterProvider() { @Override public Object get(int position) { return String.valueOf(position + 1); } @Override public int size() { return 20; } }); adapter.bind(String.class, new BridgeBuilder(DemoViewHolder.class, DemoViewHolder.LAYOUT_RES_ID, this)); recyclerView.setAdapter(adapter); } { coordinatorLayout.requestChildFocus(recyclerView, recyclerView); } { printBehavior("onActivityCreated"); } { OverScrollRunner.attach(coordinatorLayout, recyclerView); } } @Override public void onStart() { super.onStart(); printBehavior("onStart"); } @Override public void onResume() { super.onResume(); printBehavior("onResume"); } void printBehavior(String when) { { CoordinatorLayout.Behavior b = getBehavior(appBarLayout); Log.w("AA", when + " app bar behavior = " + b); } { CoordinatorLayout.Behavior b = getBehavior(recyclerView); Log.w("AA", when + " recycler view behavior = " + b); } } CoordinatorLayout.Behavior getBehavior(View view) { ViewGroup.LayoutParams params = view.getLayoutParams(); if (params instanceof CoordinatorLayout.LayoutParams) { return ((CoordinatorLayout.LayoutParams)params).getBehavior(); } return null; } /** * */ private static class DemoViewHolder extends BridgeHolder<String> implements View.OnClickListener { static final int LAYOUT_RES_ID = android.R.layout.simple_list_item_1; TestCoordinatorLayout1Fragment parent; public DemoViewHolder(TestCoordinatorLayout1Fragment parent, View itemView) { super(itemView); this.parent = parent; } @Override public int getLayoutResourceId() { return LAYOUT_RES_ID; } @Override public void onViewCreated(@NonNull View view) { view.setOnClickListener(this); } @Override public void onBind(String item, int position) { ((TextView)itemView).setText(item); Log.w("AA", "onBind = " + item); } @Override public void onClick(View v) { if (v == itemView) { parent.printBehavior("onClick"); } } } private static class OverScrollRunner extends OverScrollHelper implements IOverScrollUpdateListener { CoordinatorLayout layout; public static OverScrollRunner attach(CoordinatorLayout layout, RecyclerView recyclerView) { OverScrollDecorAdapter adapter = new OverScrollDecorAdapter(layout, recyclerView); OverScrollRunner r = new OverScrollRunner(layout, adapter); r.attach(); return r; } public OverScrollRunner(CoordinatorLayout layout, IOverScrollDecoratorAdapter viewAdapter) { super(viewAdapter); this.layout = layout; this.addOverScrollUpdateListener(this); } @Override protected void translateView(View view, float offset) { // layout.setTranslationY(offset); super.translateView(view, offset); layout.getChildAt(0).setTranslationY(offset); } @Override protected void translateViewAndEvent(View view, float offset, MotionEvent event) { // layout.setTranslationY(offset); // event.offsetLocation(offset - event.getY(0), 0f); super.translateViewAndEvent(view, offset, event); layout.getChildAt(0).setTranslationY(offset); } @Override public void onOverScrollUpdate(IOverScrollDecor decor, int state, float offset) { layout.getChildAt(0).setTranslationY(offset); } } private static class OverScrollDecorAdapter implements IOverScrollDecoratorAdapter { CoordinatorLayout layout; protected final RecyclerView mView; public OverScrollDecorAdapter(CoordinatorLayout layout, RecyclerView view) { this.layout = layout; mView = view; } @Override public View getView() { return mView; } @Override public boolean isInAbsoluteStart() { int index = layout.indexOfChild(mView); if (index != 0) { if (layout.getHeight() + layout.getChildAt(0).getHeight() != mView.getBottom()) { return false; } } return !mView.canScrollVertically(-1); } @Override public boolean isInAbsoluteEnd() { int index = layout.indexOfChild(mView); if (index != 0) { if (layout.getHeight() != mView.getBottom()) { return false; } } return !mView.canScrollVertically(1); } } }
82a1f50a699988a8cfa89b25c694972a301f420e
fe1f4101723e8fe4c9c63ddeb6708ae6dacc13c6
/src/main/java/com/example/geektrust/services/CeaserCipherImpl.java
a0352b53baf1450b0d8a765eb2d92a20569ef348
[]
no_license
sumitnathtiwari/Geektrust
6bfc9c289d0dab1c2ba4b73f76fc6aa161edeced
e9b17b698cef6aeacd27034c03277eb9605bbdbe
refs/heads/master
2022-11-29T17:58:57.081239
2020-08-08T12:47:22
2020-08-08T12:47:22
286,042,627
1
0
null
null
null
null
UTF-8
Java
false
false
830
java
package com.example.geektrust.services; import com.example.geektrust.dto.Kingdom; import com.example.geektrust.utils.AnagramUtils; import com.example.geektrust.utils.DecryptMessageUtils; import com.example.geektrust.utils.GetSecretKeyUtils; import org.jetbrains.annotations.NotNull; public class CeaserCipherImpl implements CeaserCipher { @Override public Boolean validateMessage(final @NotNull Kingdom kingdom, final String message) { //get the key....................................... final int key = GetSecretKeyUtils.findSecretKey(kingdom.getEmblem()); //................................................... final String decryptedMessage = DecryptMessageUtils.decryptSecretMessage(message, key); return AnagramUtils.isAnagram(decryptedMessage, kingdom.getEmblem()); } }
db2eaa8f256d5c0596aba51e95dbe288fccbfc0b
52634a0c4249e4716f55cb0cec10dd2a513d88db
/DataStructures/priorityQueue/BinaryHeapPriorityQueue.java
328ed9bc173784a99d1a0aea0919c17402df1094
[]
no_license
memoriasIT/Java-Practice
502594327cf77054e8134e8fce3ab7789fdd0d96
7d27e7e5fece4f6e38318d113ef5e3c630facc48
refs/heads/master
2020-03-18T10:39:12.454752
2019-05-29T20:35:15
2019-05-29T20:35:15
128,092,135
0
0
null
null
null
null
UTF-8
Java
false
false
1,982
java
package dataStructures.priorityQueue; import dataStructures.heap.BinaryHeap; import dataStructures.PriorityQueue.EmptyPriorityQueueException; // ___ _ _ _ ____ // / _ \_ __(_) ___ _ __(_) |_ _ _ /___ \_ _ ___ _ _ ___ // / /_)/ '__| |/ _ \| '__| | __| | | |// / / | | |/ _ \ | | |/ _ \ // / ___/| | | | (_) | | | | |_| |_| / \_/ /| |_| | __/ |_| | __/ // \/ |_| |_|\___/|_| |_|\__|\__, \___,_\ \__,_|\___|\__,_|\___| // Memorias de un informático |___/ public class BinaryHeapPriorityQueue<T extends Comparable<? super T>> implements dataStructures.PriorityQueue.PriorityQueue<T> { // Internal binary heap private BinaryHeap<T> heap; // Constructor public BinaryHeapPriorityQueue(){ heap = new BinaryHeap(); } // Test for emptiness public boolean isEmpty(){ return heap.isEmpty(); } // Adds element to queue with priority public void enqueue(T x){ heap.insert(x); } // Returns first element if possible public T first(){ if (isEmpty()){ throw new EmptyPriorityQueueException("Can't do first on empty queue"); } else{ return heap.minElem(); } } // Delete minimum element in queue public void dequeue(){ if (isEmpty()){ throw new EmptyPriorityQueueException("Can't dequeue on empty queue"); } else{ heap.delMin(); } } // String Representation @Override public String toString() { BinaryHeap<T> clonedHeap = new BinaryHeap<>(heap); String className = getClass().getSimpleName(); String s = className+"("; boolean stop = clonedHeap.isEmpty(); while(!stop) { s += clonedHeap.minElem(); clonedHeap.delMin(); stop = clonedHeap.isEmpty(); if(!stop) s += ","; } s += ")"; return s; } }
4bd3062a87a3a0a5b705ca64c7488895b84cd72d
b79369da4c89cbc4a61f9bfc071cc6c396909491
/server/src/main/java/com/cisco/wap/config/ConfigConstant.java
7766abdab287f6ec97eb63a56e8a0a1317f383c8
[]
no_license
doublewang7/try-voldemort2
64e18386b07dae829f9c06e1acfeb7516c6158e8
809d6a5954658de7d1b751422ae99f5cbd29b2a6
refs/heads/master
2023-04-07T12:22:58.581481
2020-06-11T22:51:40
2020-06-11T22:51:40
269,302,117
2
0
null
null
null
null
UTF-8
Java
false
false
873
java
package com.cisco.wap.config; import com.cisco.wap.exception.VoldemortConfigError; import java.util.Objects; import java.util.Properties; public interface ConfigConstant { String NODE_ID = "node.id"; String BIG_QUEUE_STORE_PATH = "queue.store.path"; static int getIntValue(Properties properties, String name) throws VoldemortConfigError { String property = properties.getProperty(name); if(Objects.isNull(property)) { throw new VoldemortConfigError("missing " + name); } return Integer.parseInt(property); } static String getStringValue(Properties properties, String name) throws VoldemortConfigError { String property = properties.getProperty(name); if(Objects.isNull(property)) { throw new VoldemortConfigError("missing " + name); } return property; } }
1772b354e58e9c9510e53e79244c3d177d5cd765
32b72e1dc8b6ee1be2e80bb70a03a021c83db550
/ast_results/micwallace_reddinator/reddinator/src/main/java/au/com/wallaceit/reddinator/ui/ActionbarFragmentActivity.java
78a1057472d6caff2728b025349b27bbb4053f11
[]
no_license
cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning
d90c41a17e88fcd99d543124eeb6e93f9133cb4a
0564143d92f8024ff5fa6b659c2baebf827582b1
refs/heads/master
2020-07-13T13:53:40.297493
2019-01-11T11:51:18
2019-01-11T11:51:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
// isComment package au.com.wallaceit.reddinator.ui; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import au.com.wallaceit.reddinator.core.Utilities; public class isClassOrIsInterface extends FragmentActivity { @Override protected void isMethod(Bundle isParameter) { super.isMethod(isNameExpr); // isComment isNameExpr.isMethod(this, isNameExpr.isMethod()); } }
7ac87af437eadf108f707a50352c29ed4c1e88e0
a024ebac0ecdc6ec20619375edf771872a97b605
/src/testngpractise/DependsOnMethod.java
2debde91c8a33ebf2f669eb34c3f9b170cc5353a
[]
no_license
neela26/seleniumPractise
0efe67d79aee243ad8688d8cb274a29a9ba1900d
f0b061ab0c219634823438f6804fc90124f06fea
refs/heads/master
2023-04-20T17:04:22.139239
2021-05-10T08:17:25
2021-05-10T08:17:25
365,967,461
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
package testngpractise; import org.testng.Assert; import org.testng.Reporter; import org.testng.annotations.Test; public class DependsOnMethod { @Test(priority=1) public void testcase1() { Reporter.log("Tc1",true); } @Test(priority=2) public void testcase2() { Reporter.log("Tc2",true); //Assert.fail(); } }
46679a11e7cf6bc7e2bc224a399e460763aeeb6e
4d16d88c79f541efd89223a5b67eba381e1f3bbc
/src/org/traccar/helper/Crc.java
418ec313218d2e102517d9572ac9181bd15c7ea5
[ "Apache-2.0" ]
permissive
demianalonso/traccar
c310d77e3eab1212513c199b36feacbc484def3f
412702aeb4baab45e9432ec3ded30426b1ecc58f
refs/heads/master
2021-01-15T09:01:48.180605
2016-03-17T19:11:34
2016-03-17T19:11:34
37,136,858
3
2
null
2015-06-09T14:26:19
2015-06-09T14:26:19
null
UTF-8
Java
false
false
7,897
java
/* * Copyright 2012 Anton Tananaev ([email protected]) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.traccar.helper; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.zip.CRC32; /** * CRC functions */ public class Crc { private static final int crc16CcittTableReverse[] = { 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 }; private static final int crc16CcittTable[] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485, 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D, 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4, 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC, 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823, 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A, 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41, 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49, 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70, 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78, 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F, 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E, 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256, 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D, 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C, 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634, 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB, 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3, 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A, 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92, 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8, 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 }; private static final int crc16CcittStart = 0xFFFF; private static final int crc16CcittXorout = 0xFFFF; private static int crc16Unreflected(ByteBuffer buf, int crc_in, int[] table) { int crc16 = crc_in; for (int i = 0; i < buf.remaining(); i++) { crc16 = table[((crc16 >> 8) ^ buf.get(i)) & 0xff] ^ (crc16 << 8); } return crc16 & 0xFFFF; } private static int crc16Reflected(ByteBuffer buf, int crc_in, int[] table) { int crc16 = crc_in; for (int i = 0; i < buf.remaining(); i++) { crc16 = table[(crc16 ^ buf.get(i)) & 0xff] ^ (crc16 >> 8); } return crc16 & 0xFFFF; } public static int crc16Ccitt(ByteBuffer buf) { return crc16Reflected(buf, crc16CcittStart, crc16CcittTableReverse) ^ crc16CcittXorout; } public static int crc16X25Ccitt(ByteBuffer buf) { return crc16Unreflected(buf, crc16CcittStart, crc16CcittTable); } public static int crc16CcittSeed(ByteBuffer buf, int seed) { return crc16Reflected(buf, seed, crc16CcittTableReverse) ^ crc16CcittXorout; } public static int crc32(ByteBuffer buf) { CRC32 checksum = new CRC32(); for (int i = 0; i < buf.remaining(); i++) { checksum.update(buf.get(i)); } return (int) checksum.getValue(); } public static int xorChecksum(ByteBuffer buf) { int checksum = 0; for (int i = 0; i < buf.remaining(); i++) { checksum ^= buf.get(i); } return checksum; } public static String nmeaChecksum(String msg) { int checksum = 0; byte bytes[] = msg.getBytes(Charset.defaultCharset()); for (int i = 1; i < msg.length(); i++) { checksum ^= bytes[i]; } return String.format("*%02x", checksum).toUpperCase(); } public static long luhnChecksum(long imei) { long checksum = 0; long remain = imei; for (int i = 0; remain != 0; i++) { long digit = remain % 10; if ((i % 2) == 0) { digit *= 2; if (digit >= 10) { digit = 1 + (digit % 10); } } checksum += digit; remain /= 10; } return 10 - (checksum % 10); } }
1c23171e218313243affbee8e1a78081853e3db2
0828c2bc7afd9c46b98b4671efc67c0924a5fd44
/src/supernode/src/main/java/com/alibaba/dragonfly/supernode/common/exception/DataNotFoundException.java
0012809560a8900fdf6347f953232790efd5dee8
[ "Apache-2.0" ]
permissive
u2takey/Dragonfly
5638073cd0223a701188c8cfd4036ffb78616dde
3f1839d7a6070ff8d98cd7f1f225300abcb0f1f8
refs/heads/master
2020-03-13T04:18:14.858928
2018-04-25T07:48:19
2018-04-25T07:53:50
130,960,351
1
0
Apache-2.0
2018-04-25T06:25:09
2018-04-25T06:25:09
null
UTF-8
Java
false
false
1,043
java
/* * Copyright 1999-2017 Alibaba Group. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.dragonfly.supernode.common.exception; public class DataNotFoundException extends RuntimeException { /** * */ private static final long serialVersionUID = 4655324245971657198L; public DataNotFoundException(String type, String id, String msg) { super(new StringBuilder().append("type:").append(type).append(" id:") .append(id).append(" msg:").append(msg).toString()); } }
b3826740f95d54ce148a50bb8d8b4dd448d259f2
d74e597ec8e593882aa162eb2584bf3801e096da
/src/main/java/com/hackday/knowUrHub/health/KnowUrHubHealthCheck.java
cfc4c145c36fc1639cfa3495e7d1dc9705855451
[]
no_license
arabhishek1/know-ur-hub
f1596e990c04cc7c9f617320e2daa56188445309
984335d31dd429305e0bf2280db5691df8891c35
refs/heads/master
2016-08-12T04:17:00.157620
2015-06-06T05:32:35
2015-06-06T05:32:35
36,923,548
0
0
null
null
null
null
UTF-8
Java
false
false
446
java
package com.hackday.knowUrHub.health; import com.google.inject.Inject; import com.yammer.metrics.core.HealthCheck; /** * Created by abhishek.ar on 6/5/15. */ public class KnowUrHubHealthCheck extends HealthCheck { @Inject public KnowUrHubHealthCheck(String name) { super(name); } @Override protected HealthCheck.Result check() throws Exception { return Result.healthy("Application is running!"); } }
e56d37be3017a3d6f213265bb8d4833058ab047a
564c57178cf5e7285701411be16a8b70fee605ff
/cms-alfresco-platform-jar/src/main/java/gov/uspto/trademark/cms/repo/webscripts/legalproceeding/CreateLegalProceedingWebScript.java
25cd547d0cad476bd7dbe0979e07521bc75b7dd4
[]
no_license
dhaval1671/SDK-3.0.1-alfresco-plugin
3163046c9a8bb6eb299cf5ff2977e5c875f9988d
cce8d9d390a8a1cd26c5c40a8420837d311a0a42
refs/heads/master
2021-01-25T12:21:26.134123
2018-03-01T17:19:29
2018-03-01T17:19:29
123,468,540
0
0
null
null
null
null
UTF-8
Java
false
false
7,990
java
package gov.uspto.trademark.cms.repo.webscripts.legalproceeding; import java.io.IOException; import java.io.Serializable; import java.util.Map; import javax.annotation.Resource; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptRequest; import org.springframework.extensions.webscripts.WebScriptResponse; import org.springframework.extensions.webscripts.WrappingWebScriptRequest; import org.springframework.extensions.webscripts.servlet.FormData.FormField; import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest; import org.springframework.http.HttpStatus; import gov.uspto.trademark.cms.repo.TmngCmsException; import gov.uspto.trademark.cms.repo.TmngCmsException.CMSRuntimeException; import gov.uspto.trademark.cms.repo.TmngCmsException.CorruptedDocIdException; import gov.uspto.trademark.cms.repo.TmngCmsException.DocumentDoesNotExistException; import gov.uspto.trademark.cms.repo.TmngCmsException.SerialNumberNotFoundException; import gov.uspto.trademark.cms.repo.constants.TMConstants; import gov.uspto.trademark.cms.repo.helpers.CmsValidator; import gov.uspto.trademark.cms.repo.helpers.LegalProceedingValidator; import gov.uspto.trademark.cms.repo.helpers.WebScriptHelper; import gov.uspto.trademark.cms.repo.services.LegalProceedingServiceFactory; import gov.uspto.trademark.cms.repo.services.impl.cabinet.legalproceeding.AbstractLegalProceedingBaseCommonService; import gov.uspto.trademark.cms.repo.services.util.ContentItem; import gov.uspto.trademark.cms.repo.webscripts.AbstractCmsCommonWebScript; import gov.uspto.trademark.cms.repo.webscripts.beans.TmngAlfResponse; /** * This class is used to create all the document types. * * @author Sanjay Tank {linkedin.com/in/sanjaytaunk} * */ public class CreateLegalProceedingWebScript extends AbstractCmsCommonWebScript { /** The Constant FILE_NAME_PARAM. */ @Resource(name = "legalProceedingServiceMap") private Map<String, String> legalProceedingServiceMap; /** The legal-proceeding service factory. */ @Autowired @Qualifier(value = "legalProceedingServiceFactory") private LegalProceedingServiceFactory legalProceedingServiceFactory; /* * (non-Javadoc) * * @see * gov.uspto.trademark.cms.repo.webscripts.CmsCommonWebScript#executeService * (org.springframework.extensions.webscripts.WebScriptRequest, * org.springframework.extensions.webscripts.WebScriptResponse) */ @Override protected void executeService(WebScriptRequest webScriptRequest, WebScriptResponse webScriptResponse) { try { Map<String, String> urlParameters = WebScriptHelper.getUrlParameters(webScriptRequest); String cmsId = urlParameters.get(ID_PARAMETER); String docType = urlParameters.get(DOC_TYPE); String fileName = urlParameters.get(FILE_NAME_PARAM); String metadata = webScriptRequest.getParameter(METADATA_QS_PARAM); // Parse the Json and if that fails system throws bad request. Map<String, Serializable> metadataMap = CmsValidator.parseJsonReturningMapWithCaseSensitiveKeys(metadata); LegalProceedingValidator.validateProperties(metadataMap); // get the content from the request WrappingWebScriptRequest wrappingWebScriptRequest = (WrappingWebScriptRequest) webScriptRequest; WebScriptServletRequest webScriptServletRequest = (WebScriptServletRequest) wrappingWebScriptRequest.getNext(); FormField content = webScriptServletRequest.getFileField(CONTENT); if (content == null) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.BAD_REQUEST, "Please verify 'content' parameter, it should NOT be empty."); } AbstractLegalProceedingBaseCommonService madridCommonSrvc = (AbstractLegalProceedingBaseCommonService) legalProceedingServiceFactory .getLegalProceedingService(legalProceedingServiceMap.get(docType)); // Invoke the doctype specific service which creates the document TmngAlfResponse response = madridCommonSrvc.create(cmsId, fileName, ContentItem.getInstance(content), metadataMap); // Construct and Send Response if (response != null) { webScriptResponse.setStatus(Status.STATUS_CREATED); webScriptResponse.setContentType(TMConstants.APPLICATION_JSON); webScriptResponse.getOutputStream().write(WebScriptHelper.toJson(response)); } else { throw new TmngCmsException.CMSWebScriptException(HttpStatus.BAD_REQUEST, "Create request failed."); } } catch (DuplicateChildNodeNameException dcnne) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.CONFLICT, dcnne.getMessage(), dcnne); } catch (IOException e) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.BAD_REQUEST, e.getMessage(), e); } catch (SerialNumberNotFoundException e) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.NOT_FOUND, e.getMessage(), e); } catch (DocumentDoesNotExistException e) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.NOT_FOUND, e.getMessage(), e); } catch (CMSRuntimeException e) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.BAD_REQUEST, e.getMessage(), e); } catch (AlfrescoRuntimeException e) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.BAD_REQUEST, e.getMessage(), e); } catch (CorruptedDocIdException e) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.BAD_REQUEST, e.getMessage(), e); } catch (Exception e) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.BAD_REQUEST, e.getMessage(), e); } } /* * (non-Javadoc) * * @see gov.uspto.trademark.cms.repo.webscripts.CmsCommonWebScript# * validateRequest(org.springframework.extensions.webscripts. * WebScriptRequest) */ @Override public void validateRequest(WebScriptRequest webScriptRequest) { Map<String, String> urlParameters = WebScriptHelper.getUrlParameters(webScriptRequest); String idParam = WebScriptHelper.getUrlParameters(webScriptRequest).get(ID_PARAMETER); String errorMsg = null; if ((idParam != null) && WebScriptHelper.isBadCaseSerialNumber(idParam)) { // move error messages to a property file throw new TmngCmsException.CMSWebScriptException(HttpStatus.BAD_REQUEST, "Please verify incoming proceeding number: '" + ID_PARAMETER + "', it has to match, greater than or equal to eight character alpha numeric pattern."); } // move the error messages to a property file // see if we can implement the configurable validation framework errorMsg = StringUtils.isBlank(urlParameters.get(FILE_NAME_PARAM)) ? "Please verify 'fileName' parameter it should NOT be blank.." : ""; String docType = urlParameters.get(DOC_TYPE); errorMsg = StringUtils.isBlank(docType) ? "'docType' is mandatory parameter." : errorMsg; errorMsg = StringUtils.isBlank(webScriptRequest.getParameter(METADATA_QS_PARAM)) ? "Please verify 'metadata' parameter it should NOT be blank." : errorMsg; if (StringUtils.isNotBlank(errorMsg)) { throw new TmngCmsException.CMSWebScriptException(HttpStatus.BAD_REQUEST, errorMsg); } } }
b75e5b4bd1a84cb329c1b5c0dca2bf1d33787145
208ba847cec642cdf7b77cff26bdc4f30a97e795
/u/src/main/java/org.wp.u/models/BlogPairId.java
ab33b8a8fbfafb6c159db8b4860393c051bcd6f8
[]
no_license
kageiit/perf-android-large
ec7c291de9cde2f813ed6573f706a8593be7ac88
2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8
refs/heads/master
2021-01-12T14:00:19.468063
2016-09-27T13:10:42
2016-09-27T13:10:42
69,685,305
0
0
null
2016-09-30T16:59:49
2016-09-30T16:59:48
null
UTF-8
Java
false
false
580
java
package org.wp.u.models; import java.io.Serializable; /** * Simple POJO to store a pair of ids: a remoteBlogId + a genericId. * Could be used to identify a comment (remoteBlogId + commentId) or a post (remoteBlogId + postId) */ public class BlogPairId implements Serializable { private long mId; private long mRemoteBlogId; public BlogPairId(long remoteBlogId, long id) { mRemoteBlogId = remoteBlogId; mId = id; } public long getId() { return mId; } public long getRemoteBlogId() { return mRemoteBlogId; } }
37cb65e68bf649e0d990d8eda275fcca0a6d4ba1
3c48fc55fe6214c5c42862eee5f25605bdc2fc1f
/mycook/src/main/java/com/run/mycook/utils/XUtil.java
d6211862e2ccde80dd8ea522689d4da159ccca50
[]
no_license
17722525963/Project
bc5d0d521a44f8884391dac1a9ccccf79517a8dd
55e1a66c37e53aa54bf4c06d18c05d64fbd38166
refs/heads/master
2021-01-19T05:03:15.806735
2016-07-11T03:56:57
2016-07-11T03:56:57
61,987,539
0
0
null
null
null
null
UTF-8
Java
false
false
2,477
java
package com.run.mycook.utils; import org.xutils.common.Callback; import org.xutils.http.RequestParams; import org.xutils.x; import java.util.Map; /** * Created by zsr on 2016/5/31. */ public class XUtil { /** * 发送get请求 * * @param <T> */ public static <T> Callback.Cancelable get(String url, Map<String, String> map, Callback.CommonCallback<T> callback) { RequestParams params = new RequestParams(url); // params.setCacheMaxAge(1000 * 60);//默认缓存存活时间, 单位:毫秒.(如果服务没有返回有效的max-age或Expires) if (null != map) { for (Map.Entry<String, String> entry : map.entrySet()) { params.addQueryStringParameter(entry.getKey(), entry.getValue()); } } Callback.Cancelable cancelable = x.http().get(params, callback); return cancelable; } /** * 发送post请求 * * @param <T> */ public static <T> Callback.Cancelable post(String url, Map<String, Object> map, Callback.CommonCallback<T> callback) { RequestParams params = new RequestParams(url); if (null != map) { for (Map.Entry<String, Object> entry : map.entrySet()) { params.addParameter(entry.getKey(), entry.getValue()); } } Callback.Cancelable cancelable = x.http().post(params, callback); return cancelable; } /** * 上传文件 * * @param <T> */ public static <T> Callback.Cancelable upLoadFile(String url, Map<String, Object> map, Callback.CommonCallback<T> callback) { RequestParams params = new RequestParams(url); if (null != map) { for (Map.Entry<String, Object> entry : map.entrySet()) { params.addParameter(entry.getKey(), entry.getValue()); } } params.setMultipart(true); Callback.Cancelable cancelable = x.http().get(params, callback); return cancelable; } /** * 下载文件 * * @param <T> */ public static <T> Callback.Cancelable downLoadFile(String url, String filepath, Callback.CommonCallback<T> callback) { RequestParams params = new RequestParams(url); //设置断点续传 params.setAutoResume(true); params.setSaveFilePath(filepath); Callback.Cancelable cancelable = x.http().get(params, callback); return cancelable; } }
1fe134750f89f836b087ce4edbffa82863264e5b
a1146c60224d64926a149c3619114f5155409710
/JR_T10/src/lections/task1/Solution.java
efa8e3a5eae4276859711ee3943f20f461e89cba
[]
no_license
vlasove/Java
a981e0165e55ce254540a8a5da04ea18dddb17e8
97e7d44b30d28ae5ca43cf151dfa366139afa6ed
refs/heads/master
2023-02-11T08:00:42.519239
2021-01-03T19:51:51
2021-01-03T19:51:51
312,821,908
0
0
null
null
null
null
UTF-8
Java
false
false
2,397
java
package lections.task1; import javax.swing.text.html.parser.Entity; import java.io.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /* Замена чисел */ public class Solution { public static Map<Integer, String> map = new HashMap<Integer, String>(); static { map.put(12, "двенадцать"); map.put(11, "одиннадцать"); map.put(10, "десять"); map.put(9, "девять"); map.put(8, "восемь"); map.put(7, "семь"); map.put(6, "шесть"); map.put(5, "пять"); map.put(4, "четыре"); map.put(3, "три"); map.put(2, "два"); map.put(1, "один"); map.put(0, "ноль"); } public static void main(String[] args) { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String fileName = new String(); try { fileName = reader.readLine(); reader.close(); } catch (IOException ioe) { ioe.printStackTrace(); } String content = new String(); List<String> stringInFile = new ArrayList<>(); try (BufferedReader in = new BufferedReader(new FileReader(fileName))) { while ((content = in.readLine()) != null) { stringInFile.add(content); } in.close(); } catch (IOException ignore) { ignore.printStackTrace(); } for (String line : stringInFile) { String[] splitedLine = line.split(" "); for (int i = 0; i < splitedLine.length; i++) { for (Map.Entry<Integer, String> pair : map.entrySet()) { try { int number = Integer.parseInt(splitedLine[i]); if (pair.getKey().equals(number)) { splitedLine[i] = pair.getValue(); } } catch (NumberFormatException nfe) { nfe.printStackTrace(); } } } StringBuffer sb = new StringBuffer(); for (String word : splitedLine) { sb.append(word).append(" "); } System.out.println(sb.toString().trim()); } } }
209b9fad2640675a8a24995d8886f1a5db80485b
19a7edd24c34a411acea258b39e8ac7324de5dfb
/filterPattern/src/filterPattern/Criteria.java
e22fbb11552bae537e90f80e8678f2656477febf
[]
no_license
sophrs/filterDesignpatternexample
100db478105804f963ea2904eb6be31821ec49ab
1b88681d38a250264346ac95726730582a858269
refs/heads/master
2020-04-09T17:51:42.959708
2018-12-05T09:31:45
2018-12-05T09:31:45
160,493,837
0
0
null
null
null
null
UTF-8
Java
false
false
187
java
package filterPattern; import java.util.List; public interface Criteria { public List<Dog> meetCriteria(List<Dog>dogs); }
465749a76e9367aa5dc21e7e68a19799725d6d65
be27b3d09ee9f53a62c0bfc448a46cc602185f21
/app/src/main/java/com/tbx/gc/greatcash/videoPOJO/videoBean.java
33a36344b4819cec5125cfd26e62865387f2c8fb
[]
no_license
cmFodWx5YWRhdjEyMTA5/greatcash
ac5c070c89f63b41ba10155208f586f59092659c
dfe3730960cd79bae04861edb86384a893286171
refs/heads/master
2020-07-25T22:19:43.197045
2018-07-22T19:18:34
2018-07-22T19:18:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
835
java
package com.tbx.gc.greatcash.videoPOJO; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.List; public class videoBean { @SerializedName("message") @Expose private String message; @SerializedName("status") @Expose private String status; @SerializedName("data") @Expose private List<Datum> data = null; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public List<Datum> getData() { return data; } public void setData(List<Datum> data) { this.data = data; } }
7d68cf1428b2c88e815c05e9efa0cda548a45b94
255684e12c075db98237ccdf2e130603d4bbb183
/src/leo/InforBoard.java
caeb5973d8b442b9c1789ba0d8a051c036f38cce
[]
no_license
Leogaogithub/Computer-Graphics-Game-of-Tetris
5cd2f6889494ad7319f8102c4485412e48f15a5e
65659fe4cd4f6f39476cf033d043e46fa954f7e1
refs/heads/master
2020-05-29T08:49:38.102099
2016-10-17T02:50:59
2016-10-17T02:50:59
68,950,495
1
0
null
null
null
null
UTF-8
Java
false
false
1,164
java
package leo; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Rectangle; public class InforBoard extends Bounds implements CleanLinesListener{ String score = "Score: "; String level = "Level: "; String lines = "Lines: "; int iScore = 0; int iLevel = 1; int iLines = 0; InforBoard(){ this.localCoordSys.rHeight = 6; this.localCoordSys.rWidth = 1; ScoreController.getSingleton().addCleanLinesListener(this); } public void paint(Graphics g){ this.updateLocalCoordSys(); int x = localCoordSys.iX(0.5f); Rectangle rectangle = this.getBounds(); int fontSize = rectangle.height/9; g.setFont(new Font("TimesRoman", Font.BOLD, fontSize)); g.setColor(Color.black); g.drawString(level+iLevel, x, localCoordSys.iY(1f)); g.drawString(lines+iLines, x, localCoordSys.iY(3f)); g.drawString(score+iScore, x, localCoordSys.iY(5f)); } @Override public void lineClean(int lines) { System.out.println("InforBoard lineClean"); iLevel = ScoreController.getSingleton().iLevel; iScore = ScoreController.getSingleton().iScore; iLines = ScoreController.getSingleton().iLines; } }
da51f99fa17a955655500c305f28a248ca9e83c0
be820eb0931ea3de18ad824173a6b9266dd8f8da
/Exercises/S1/src/game/controllers/pacman/exercises/e1/path/impl/DFS.java
2009d1f35330e3d77ed01430cf78894dfe9498bb
[]
no_license
yetty123/MsPacMan-vs-Ghosts-AI
2aab2ee29ebe089740c44d4f7241cdb666788685
8ba42e09cabe4240a6be3279bd94a469d70f4b75
refs/heads/master
2021-01-17T12:23:20.699089
2016-01-01T19:53:43
2016-01-01T19:53:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
894
java
package game.controllers.pacman.exercises.e1.path.impl; import game.controllers.pacman.exercises.e1.path.impl.base.UninformedNode; import game.controllers.pacman.exercises.e1.path.impl.base.UninformedGraphSearch; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; /** * DEAPTH-FIRST-SEARCH * * @author Jimmy */ public class DFS extends UninformedGraphSearch { @Override public String getName() { return "DFS[" + getSteps() + "]"; } @Override protected Collection<UninformedNode> createCloseList() { return new HashSet<UninformedNode>(); } @Override protected Collection<UninformedNode> createOpenList() { return new ArrayList<UninformedNode>(); } @Override protected UninformedNode selectNextNode(Collection<UninformedNode> openList) { return ((List<UninformedNode>)openList).get(openList.size()-1); } }
9fb7f6b7b3596da87ac6e3300dbc2b33d9bc703f
79221a6b239099abc647e4937b9aff02f5e0aa35
/way2sms/src/test/java/pages/LoginGlueCodee.java
0819925314cf2a6cc5b6b9e7ee02caf4ed4744b2
[]
no_license
nagarajutest/GitTutorial
f774f144603ae5a989c3b910ae6306852f3f5bdb
4c85ef0fbcb215576f5b6a6d0d6ef4811597fc47
refs/heads/master
2020-04-11T21:05:45.429638
2018-12-17T08:25:19
2018-12-17T08:25:19
162,094,433
0
0
null
null
null
null
UTF-8
Java
false
false
4,047
java
package pages; import java.io.FileInputStream; import java.util.Properties; import org.junit.Assert; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.opera.OperaDriver; import org.openqa.selenium.opera.OperaOptions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import cucumber.api.Scenario; import cucumber.api.java.Before; import cucumber.api.java.en.And; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class LoginGlueCodee { public WebDriver driver; public WebDriverWait wait; public Login lp; public Properties pro; public Scenario s; @Before public void methhod1(Scenario s) throws Exception { //use scenario object for current scenario this.s=s; //load properties to ram FileInputStream fip=new FileInputStream("F:\\Bddf\\way2sms\\src\\test\\resources\\files\\properties.properties"); pro=new Properties(); pro.load(fip); } @Given("^launch site using \"(.*)\"$") public void method2(String x) { if(x.equalsIgnoreCase("chrome")) { System.setProperty("webdriver.chrome.driver",pro.getProperty("cdriver")); driver=new ChromeDriver(); } else if(x.equalsIgnoreCase("firefox")) { System.setProperty("webdriver.gecko.driver",pro.getProperty("fdriver")); driver=new FirefoxDriver(); } else if(x.equalsIgnoreCase("opera")) { OperaOptions o=new OperaOptions(); o.setBinary("C:\\Program Files\\Opera\\56.0.3051.36\\opera.exe"); System.setProperty("webdriver.opera.driver",pro.getProperty("odriver")); driver=new OperaDriver(o); } lp=new Login(driver); driver.get(pro.getProperty("url")); wait=new WebDriverWait(driver,20); wait.until(ExpectedConditions.visibilityOf(lp.mbno)); driver.manage().window().maximize(); } @Then("^title contains \"(.*)\"$") public void method3(String x) { wait.until(ExpectedConditions.visibilityOf(lp.mbno)); String z=driver.getTitle(); if(z.contains(x)) { s.write("title test Passed"); } else { byte ssbytes[]=((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES); s.embed(ssbytes,"title test failed"); Assert.fail(); } } @And("^close site$") public void method4() { driver.close(); } @When("^enter mobile no as\"(.*)\"$") public void method5(String x) { wait.until(ExpectedConditions.visibilityOf(lp.mbno)); lp.fillmbno(x); } @And("^enter password as\"(.*)\"$") public void method6(String x) { wait.until(ExpectedConditions.visibilityOf(lp.pwd)); lp.fillpwd(x); } @And("^click login$") public void method7() { wait.until(ExpectedConditions.visibilityOf(lp.signin)); lp.clickSignin(); } @Then("^validate output criteria as \"(.*)\"$") public void method8(String x) { try { if(x.contains("mbno blank")&&lp.mbno_blank_err.isDisplayed()) { s.write("mobile number blank test passed"); } else if(x.contains("pwd blank")&&lp.pwd_blank_err.isDisplayed()) { s.write("password blank test passed"); } else if(x.contains("mbno invalid")&&lp.mbno_invalid.isDisplayed()) { s.write("mobile number invalid test passed"); } else if(x.contains("pwd invalid")&&lp.pwd_invalid.isDisplayed()) { s.write("password invalid test failed"); } else if(x.contains("all valid")&&lp.all_valid.isDisplayed()) { s.write("Login test passed"); } else { byte ssbytes[]=((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES); s.embed(ssbytes,"login test failed"); Assert.fail(); } } catch(Exception e) { byte ssbytes[]=((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES); s.embed(ssbytes,e.getMessage()); } } }
[ "Nagaraj@LAPTOP-D4OSNDJH" ]
Nagaraj@LAPTOP-D4OSNDJH
546adc3550b4295e457d854dbeea1521dd553dee
4f0fee52be0db8fbeedff3eb3c6f767a9a66a9a4
/src/linked_list/CReverseSubList.java
50cdef92fd6ed3b69213d9d0e2d6e2614635037e
[]
no_license
kartavya-ramnani/dsa
447e6633c50737f99f8ed3022d45dd1d8e77b8d7
f7eaeece977520a0a3b9f385a1d6d520aa4ed261
refs/heads/master
2023-01-25T00:44:46.065884
2020-12-05T16:12:23
2020-12-05T16:12:23
295,834,785
2
1
null
null
null
null
UTF-8
Java
false
false
1,711
java
package linked_list; // Given the head of a LinkedList and two positions ‘p’ and ‘q’, reverse the LinkedList from position ‘p’ to ‘q’. public class CReverseSubList { public static ListNode reverse(ListNode head, int start, int end) { if (head == null) { return null; } if (start == end) { return head; } // traverse until p ListNode current = head; ListNode previous = null; for (int i = 0; current != null && i < start - 1; i++) { previous = current; current = current.next; } if (current == null) { return head; } ListNode beforeStart = previous; ListNode lastNodeOfSublist = current; ListNode next; for (int i = 0; current != null && i < end - start + 1; i++) { next = current.next; current.next = previous; previous = current; current = next; } if (beforeStart != null) { beforeStart.next = previous; } else { head = previous; } lastNodeOfSublist.next = current; return head; } public static void main(String[] args) { ListNode head = new ListNode(1); head.next = new ListNode(2); head.next.next = new ListNode(3); head.next.next.next = new ListNode(4); head.next.next.next.next = new ListNode(5); ListNode responseHead = CReverseSubList.reverse(head, 2, 4); while (responseHead != null) { System.out.println(responseHead.value + "->"); responseHead = responseHead.next; } } }
c13083986fcde63c41c56cbfbb94a831a166d66e
751d84ec4f6834627bc4d95be6373081310d9582
/Java OOP Basics/t04_Polymorphism/p03_WildFarm/Main.java
6511aff5e62abb2a0123a8caefd49e16b437e009
[]
no_license
AtanasYordanov/Java-Advanced
efcfac4f5e4d36956763f5ebbae727bab5aad755
1c126edaff0d8489aa64a8dbf1e2b8ce69902d57
refs/heads/master
2021-07-24T03:00:30.313958
2018-10-19T19:10:57
2018-10-19T19:10:57
133,526,065
0
1
null
null
null
null
UTF-8
Java
false
false
2,115
java
package t04_Inheritance.p03_WildFarm; import t04_Inheritance.p03_WildFarm.animals.*; import t04_Inheritance.p03_WildFarm.foods.Food; import t04_Inheritance.p03_WildFarm.foods.Meat; import t04_Inheritance.p03_WildFarm.foods.Vegetable; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); List<Animal> animals = new ArrayList<>(); for (String line = reader.readLine(); !line.equals("End"); line = reader.readLine()) { String[] tokens = line.split(" "); Animal animal = getAnimal(tokens); tokens = reader.readLine().split(" "); Food food = getFood(tokens); animal.makeSound(); try { animal.eat(food); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); } animals.add(animal); } animals.forEach(System.out::println); } private static Food getFood(String[] tokens) { String type = tokens[0]; int amount = Integer.parseInt(tokens[1]); switch (type) { case "Vegetable": return new Vegetable(amount); default: return new Meat(amount); } } private static Animal getAnimal(String[] tokens) { String type = tokens[0]; String name = tokens[1]; double weight = Double.parseDouble(tokens[2]); String region = tokens[3]; switch (type) { case "Cat": String breed = tokens[4]; return new Cat(name, weight, region, breed); case "Tiger": return new Tiger(name, weight, region); case "Zebra": return new Zebra(name, weight, region); default: return new Mouse(name, weight, region); } } }
f423455e896d71ae2405d5fcd50673c4b2f327de
81d472dd7458f9e68ef18964e8e9bfb6e38f3f45
/nstoya/javaId/src/com/nstoya/oop/interfaces/X.java
7e4155341028b78bacd20e70c9f9967c2be693c5
[]
no_license
nstoya/JavaId
e99ec83be861f49ca8cd0885e34b3d3b6acabe5d
a98da2d80fd5ee5dc75c736c47e12165a36a41cd
refs/heads/master
2020-03-12T02:06:47.065028
2018-06-28T07:05:33
2018-06-28T07:05:33
130,393,964
0
0
null
null
null
null
UTF-8
Java
false
false
524
java
package com.nstoya.oop.interfaces; public class X extends AbstractA implements AInt, BInt, CInt, Cloneable { @Override public void foo() { System.out.println("X: foo"); System.out.println("VAL: " + BInt.VAL); //avoid diamond problem } public void foobar() { System.out.println("X: foobar"); } public CInt clone() { //if cloneable is not implemented an exception is thrown try { return (CInt)super.clone(); }catch (CloneNotSupportedException e) { e.printStackTrace(); } return null; } }
e6c933690a1914324d06592c29a6b676459c6812
6b5c79a773e6a065cfeb1dd208fd68d7330d115f
/app/src/test/java/com/example/s304114mappe1/ExampleUnitTest.java
3a87c4c62fb22d3fa44bb91363fbd5e6eb3a895c
[]
no_license
AreAndresen/MatteMorroApp
113cf3381e8d5dfb31b59af14fb25205329ece8b
5c3c3b57a206dd9f37319c62fdbacdf8785f5331
refs/heads/master
2020-07-26T00:33:08.469333
2019-09-22T17:13:20
2019-09-22T17:13:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.example.s304114mappe1; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
dda41ae94b374d002645acfe016f0df992884808
f3219b634affc7715fd3737ca2872c7138f0e8d8
/src/edge_info.java
50d00fb88ec98f4a1ef2b1befb34e0b0b334dec0
[]
no_license
snir1551/Ex1
39667fc00325e432e1e8203bab97b418bf04b8ff
37c54a70611af33378e8e702d3042fe1688c4dbf
refs/heads/master
2021-07-13T02:07:27.771806
2020-11-22T22:00:41
2020-11-22T22:00:41
225,019,762
0
0
null
null
null
null
UTF-8
Java
false
false
131
java
public interface edge_info { public double getWeight(); public String getInfo(); public void setInfo(String s); }
e42d2f9e16e02eb549bb2cf42be4e7e94fe867c0
d5f63aaabd51acd11753ef75abed3f0a2873fe49
/framework/framework-netty/module-system/src/main/java/cn/roilat/modules/system/entity/MsUserOrganization.java
6b184181e8256700354bce774f2538f56ea96568
[]
no_license
roilat/roilat_study_code
bf8ac1849f69d60ca0142fc03e452da5e235a975
8e58735b62c4ceda120410b999c06dea57d47e1d
refs/heads/master
2022-12-23T21:07:26.720607
2019-12-17T16:00:39
2019-12-17T16:00:39
125,948,386
0
2
null
2022-12-16T06:11:44
2018-03-20T02:21:34
Java
UTF-8
Java
false
false
1,309
java
package cn.roilat.modules.system.entity; import java.io.Serializable; import javax.persistence.*; /** * The persistent class for the ms_user_organization database table. * */ @Entity @Table(name="ms_user_organization") public class MsUserOrganization implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(generator="JDBC") private Integer id; @Column(name="is_admin") private Integer isAdmin; @Column(name="organization_id") private Integer organizationId; @Column(name="user_id") private Integer userId; public MsUserOrganization() { } public MsUserOrganization(Integer isAdmin, Integer organizationId, Integer userId) { this.isAdmin = isAdmin; this.organizationId = organizationId; this.userId = userId; } public Integer getId() { return this.id; } public Integer getOrganizationId() { return organizationId; } public void setOrganizationId(Integer organizationId) { this.organizationId = organizationId; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public void setId(Integer id) { this.id = id; } public Integer getIsAdmin() { return this.isAdmin; } public void setIsAdmin(Integer isAdmin) { this.isAdmin = isAdmin; } }
de8166728500566b44f2bcf27246251ebbedfbed
28e2acf9f31bfa8a50f45678f894be0a52c43692
/M.A.Git/WebUI/src/magit/start/StartServlet.java
32ed7f10760b4c47461ade56b1be912d1697209b
[]
no_license
eidoil32/M.A.Git---JAVA---MTA-Course
738e8bcb620adc550a76c4ec79248180d519d021
e979eff820d7ebad1180cb18256c598e41d4e17d
refs/heads/master
2020-06-22T18:05:03.135559
2019-10-25T09:25:05
2019-10-25T09:25:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,227
java
package magit.start; import settings.Settings; import usermanager.User; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; @WebServlet({"/StartServlet", ""}) public class StartServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); User user = (User) session.getAttribute(Settings.WSA_USER); String page; if (user == null) { page = Settings.PAGE_LOGIN; } else { page = Settings.PAGE_INDEX; } RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(page); dispatcher.forward(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { super.doPost(req, resp); System.out.println("before get"); } }
99b2f3f9bd69f32c7f80035084ce7a3679c0bb73
c66b3f3d4b9b4ca75aba7d82830b1025d90bab21
/stock-tracker-api/src/main/java/com/ravi/util/AppUtil.java
493e100caff51b4166e1a7be5342fe6834bd023f
[]
no_license
ravichandrareddyl/stockanalysis
9e1103931add39d011d8a1bc52e4af132460017f
22ba44949b0d0e41cbbaf3cd37f8111266984291
refs/heads/master
2020-03-22T14:12:31.627032
2018-12-12T08:57:19
2018-12-12T08:57:19
140,161,164
0
0
null
null
null
null
UTF-8
Java
false
false
1,636
java
package com.ravi.util; import java.math.BigDecimal; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Random; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.ravi.constants.AppConstants; import com.ravi.model.Stock; public class AppUtil { public static String getDateString(Date date, String format) { DateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); } public static String getNseUrl(Stock stock) { return AppConstants.NSE_QUOTE_URL.replace(AppConstants.STOCK_PLACEHOLDER, stock.getStock()); } public static int getRandomnNum() { Random rand = new Random(); return rand.nextInt(59) + 1; } public static String getCronExpression() { int rand = getRandomnNum(); return String.format("%d * 9-15 ? * MON,TUE,WED,THU,FRI *", rand); } public static BigDecimal getSquareOffValue(BigDecimal in, double percent) { return in.add((in.multiply(new BigDecimal((percent))).divide(new BigDecimal(100)))); } public static BigDecimal getSellOffValue(BigDecimal in, double percent) { return in.subtract((in.multiply(new BigDecimal((percent))).divide(new BigDecimal(100)))); } public static String valueFromKey(String json) { String result = null; Pattern pattern = Pattern.compile("\"lastPrice\"\\s*:\\s*\"([^\"]*)\""); Matcher matcher = pattern.matcher(json); while (matcher.find()) { result = matcher.group(1); } return result; } }
f6f62a9decbbf30fac55b3e360dfd2b4362ff703
0967082caf59a742fb00283bf4150e260fc1bdfb
/NBA/src/main/java/gui/match/MatchListPanel.java
8a7e76d3e6c3ab2034aae6209b2c352d3fcebe83
[]
no_license
xinjin1994/NBA-Data-Analysis-System
1fd2b28d389f71b952ab05bf4f61a818781f346c
278be040203858b316d7037ada467e19a4fbe55b
refs/heads/master
2021-06-05T03:35:58.373700
2016-10-24T14:42:20
2016-10-24T14:42:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,327
java
package gui.match; import java.awt.BorderLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Date; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import exceptions.MatchNotFound; import exceptions.StatsNotFound; import factory.ObjectCreator; import gui.MainFrame; import gui.util.ShortDate; import businessLogicService.matchesBLService.MatchesBLService; public class MatchListPanel extends JPanel implements DateChangeable{ private static final long serialVersionUID = 6188988795153593485L; private static MatchesBLService matchbl = new ObjectCreator().matchesBLService(); private MatchList list = new MatchList(); private String season = MainFrame.season.season; public MatchListPanel(MatchVOChangeable changer) { setLayout(new BorderLayout()); try { ArrayList<Date> dates = matchbl.getAvailableDays(season); ShortDate[] datelist = new ShortDate[dates.size()]; for(int i = 0;i < dates.size();i++) datelist[i] = new ShortDate(dates.get(i)); DateChooser chooser = new DateChooser(datelist,this); add(chooser,BorderLayout.NORTH); JScrollPane scrpane = new JScrollPane(list); add(scrpane); list.setListData(MatchList.toArray(matchbl.getMatchByDate(season, dates.get(0)))); list.addMouseListener(new MouseAdapter(){ @Override public void mouseClicked(MouseEvent me){ if(me.getButton() == MouseEvent.BUTTON1 && me.getClickCount() == 2){ MatchItemPanel_Large pnl_item = list.getSelectedValue(); if(pnl_item != null) changer.changeMatch(pnl_item.getMatch()); else changer.noMatch(); } } }); } catch (StatsNotFound e) { JOptionPane.showMessageDialog(MainFrame.currentFrame, e); e.printStackTrace(); } catch (MatchNotFound e) { JOptionPane.showMessageDialog(MainFrame.currentFrame, e); e.printStackTrace(); } } @Override public void dateChange(Date date) { try { list.setListData(MatchList.toArray(matchbl.getMatchByDate(season, date))); } catch (MatchNotFound e) { JOptionPane.showMessageDialog(MainFrame.currentFrame, e); e.printStackTrace(); } } @Override public void invalidDate() { JOptionPane.showMessageDialog(MainFrame.currentFrame, "InvalidDate"); } }
e21fe420981e7e29d1845eadca5f31246c192ac1
0e00d80cb202600cba1e0826ae2138f5f72a9b73
/Agendas/Agenda_Servlets/agenda_servlets/src/br/com/ifpb/servlet/ListaContatosServlet.java
f5e43861a1b158e4e74276b668de3b8841a3bb6e
[]
no_license
JardelBrandon/Desenvolvimento_Web
5cdb0d148d9e4ffed4db8a96a66086ea77c73984
04969d23ed942819c100619ffea0149821f9757f
refs/heads/master
2023-02-07T06:29:36.681196
2020-12-27T01:34:27
2020-12-27T01:34:27
269,496,116
0
0
null
null
null
null
UTF-8
Java
false
false
1,115
java
package br.com.ifpb.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/listaContatos") public class ListaContatosServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Banco banco = new Banco(); List<Contato> lista = banco.getContatos(); PrintWriter out = response.getWriter(); out.println("<html><body>"); out.println("<ul>"); for (Contato contato : lista) { out.println("<li> " + contato.getNome() + ":"); out.println(contato.getTelefone() + "</li>"); } out.println("</ul>"); out.println("<form action=\"/agenda_servlets/mainMenu.html\">\n" + " <input type=\"submit\" value=\"Voltar\"/>\n" + " </form>"); out.println("</body></html>"); } }
60bb3f9c670ffcdcfa682411939e61a004f6e8e8
d77007738803b4512658463f060a26e591ff9bb1
/Aula02ProgMult-2-master/app/src/main/java/br/usjt/aula02final/ActivityC.java
8be29f6e24043138e65adb55a2c6123a91ee4cde
[]
no_license
DanieleSouz/Aula02ProgMult
c2e7a03001a233d8b8323cafa59e09b9a2ca3dbf
e90a1969e21e5050452623afb82f3f92ae0a35ca
refs/heads/master
2021-09-10T04:11:49.616535
2018-03-21T00:00:07
2018-03-21T00:00:07
126,098,157
0
0
null
null
null
null
UTF-8
Java
false
false
2,722
java
package br.usjt.aula02final; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; import br.usjt.aula02final.util.StatusTracker; import br.usjt.aula02final.util.Utils; /** * Daniele Souza 816113194 */ public class ActivityC extends Activity { private String mActivityName; private TextView mStatusView; private TextView mStatusAllView; private StatusTracker mStatusTracker = StatusTracker.getInstance(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_c); mActivityName = getString(R.string.activity_c_label); mStatusView = (TextView)findViewById(R.id.status_view_c); mStatusAllView = (TextView)findViewById(R.id.status_view_all_c); mStatusTracker.setStatus(mActivityName, getString(R.string.on_create)); Utils.printStatus(mStatusView, mStatusAllView); } @Override protected void onStart() { super.onStart(); mStatusTracker.setStatus(mActivityName, getString(R.string.on_start)); Utils.printStatus(mStatusView, mStatusAllView); } @Override protected void onRestart() { super.onRestart(); mStatusTracker.setStatus(mActivityName, getString(R.string.on_restart)); Utils.printStatus(mStatusView, mStatusAllView); } @Override protected void onResume() { super.onResume(); mStatusTracker.setStatus(mActivityName, getString(R.string.on_resume)); Utils.printStatus(mStatusView, mStatusAllView); } @Override protected void onPause() { super.onPause(); mStatusTracker.setStatus(mActivityName, getString(R.string.on_pause)); Utils.printStatus(mStatusView, mStatusAllView); } @Override protected void onStop() { super.onStop(); mStatusTracker.setStatus(mActivityName, getString(R.string.on_stop)); } @Override protected void onDestroy() { super.onDestroy(); mStatusTracker.setStatus(mActivityName, getString(R.string.on_destroy)); } public void startDialog(View v) { Intent intent = new Intent(ActivityC.this, DialogActivity.class); startActivity(intent); } public void startActivityA(View v) { Intent intent = new Intent(ActivityC.this, ActivityA.class); startActivity(intent); } public void startActivityB(View v) { Intent intent = new Intent(ActivityC.this, ActivityB.class); startActivity(intent); } public void finishActivityC(View v) { ActivityC.this.finish(); } }
b2805ae49e452d6276ddd06f9cd0a987ca327be0
4fca568a1da465966b13a9e7a0a6339b9285e265
/src/main/java/es/redmoon/comunidades/altas/SQLConnEntryPoint.java
5916756b0f3324f58fe2f3e5ad6ef2b73d7a49a4
[]
no_license
gialnet/Comunidades
0f4f1b12e6cf110c53a8db1d8bbf4641301fb571
ee0ca1b7f55abe421514ee3da054bfd65acac5d2
refs/heads/master
2021-01-01T04:26:18.349780
2018-02-16T16:39:27
2018-02-16T16:39:27
59,267,048
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package es.redmoon.comunidades.altas; import java.sql.SQLException; import javax.naming.NamingException; /** * * @author antonio */ public class SQLConnEntryPoint extends PoolConnAltas { public SQLConnEntryPoint() throws SQLException, NamingException { super(); } }
58a24fbfdb668edf2566bb3e7853048165ff4d67
3ef94168eeb263fe03eb301aaaf1d6c49be2f4c8
/inherit/src/main/Contact.java
353be204f0d80211086b183e74b9d6fe7d371bc1
[]
no_license
VishnuPriyaKasula03/Mode2
459abe9b2f118290a02d3856dd2214176a503bb8
db1cc945f70bdd960768691fbe014f38324c33ec
refs/heads/main
2023-02-02T04:34:24.240328
2020-12-20T07:31:10
2020-12-20T07:31:10
309,633,765
0
0
null
null
null
null
UTF-8
Java
false
false
897
java
package main; public class Contact { String contactPerson; String mobile; String email; public Contact() { } public Contact(String contactPerson, String mobile, String email) { super(); this.contactPerson = contactPerson; this.mobile = mobile; this.email = email; } public String getContactPerson() { return contactPerson; } public void setContactPerson(String contactPerson) { this.contactPerson = contactPerson; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public void printContact() { System.out.println("Contact Person:"+this.contactPerson); System.out.println("Mobile:"+this.mobile); System.out.println("Email:"+this.email); } }
1fffe3390f374595f9978213f413ce41c126e130
7b4558278b13d07d8c9797a01a3ef401c6878382
/common/src/main/java/cn/wisdsoft/pojo/StudentEntity.java
1aad372cce0ccf175a81a614054a04b00ece10fc
[]
no_license
electiveteam1/elective
80afc806ddd3fcdd2037f4b2cc9ca0e48127895f
a2623f954217f0c8b02b50c8cc56a8693fc4cb86
refs/heads/master
2023-05-25T17:22:24.512942
2019-05-23T08:00:45
2019-05-23T08:00:45
185,498,844
0
0
null
null
null
null
UTF-8
Java
false
false
1,668
java
package cn.wisdsoft.pojo; import java.io.Serializable; /** * @ Author :高伟萌. * @ Date :Created in 2019-04-06 12:20 * @ Description:学生表 */ public class StudentEntity implements Serializable { //学生ID private String studentId; //学生姓名 private String studentName; //学生密码 private String studentPassword; //学院名称 private String collegeName; //学生年级 private Short grade; //备注 private String remark; public String getStudentId() { return studentId; } public StudentEntity setStudentId(String studentId) { this.studentId = studentId; return this; } public String getStudentName() { return studentName; } public StudentEntity setStudentName(String studentName) { this.studentName = studentName; return this; } public String getStudentPassword() { return studentPassword; } public StudentEntity setStudentPassword(String studentPassword) { this.studentPassword = studentPassword; return this; } public String getCollegeName() { return collegeName; } public StudentEntity setCollegeName(String collegeName) { this.collegeName = collegeName; return this; } public Short getGrade() { return grade; } public StudentEntity setGrade(Short grade) { this.grade = grade; return this; } public String getRemark() { return remark; } public StudentEntity setRemark(String remark) { this.remark = remark; return this; } }
71b2b4c673d6af3a5efc52f98c5435c887fedbe2
a6112adc67ea4279bcbbff4366ff4d8c9e9e5342
/code/src/bropals/tag16/world/Building.java
c6210fb4f55dade91338eb45f6ee7f9fc1959716
[]
no_license
Bro-Pals/TAG_Jam_16
5cdab7f490f372cad310b29407d159de68708beb
91e4e2ae09e939d16a4c2da6ae43b66aa110b97d
refs/heads/master
2021-01-19T04:51:01.909833
2014-11-08T22:00:52
2014-11-08T22:00:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
57
java
package bropals.tag16.world; public class Building { }
a16eeaac4d1d12fadab87c37948e2a2cc0c7b416
6cef7fc78cc935f733f3707fca94776effb94875
/network/kraken-ice/src/main/java/Ice/ResponseSentException.java
4f81693e77187d2ac19a06fd26d7310caaf27d43
[]
no_license
xeraph/kraken
1a5657d837caeaa8c6c045b24cd309d7184fd5b5
a2b6fe120b5c7d7cde0309ec1d4c3335abef17a1
refs/heads/master
2021-01-20T23:36:48.613826
2013-01-15T01:03:44
2013-01-15T01:03:44
7,766,261
1
0
null
null
null
null
UTF-8
Java
false
false
829
java
// ********************************************************************** // // Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** // Ice version 3.4.1 package Ice; // <auto-generated> // // Generated from file `LocalException.ice' // // Warning: do not edit this file. // // </auto-generated> /** * Indicates that the response to a request has already been sent; * re-dispatching such a request is not possible. * **/ public class ResponseSentException extends Ice.LocalException { public String ice_name() { return "Ice::ResponseSentException"; } }
[ "devnull@localhost" ]
devnull@localhost
0d386f6c776c2d87ba6687e53e3f9f723efebe83
be9f8073d84526712c46772301f026b2d1726636
/fj21-agenda/src/br/com/caelum/agenda/dao/ContatoDao.java
85198f0dfd2c50222e492999c1f08e165f8fd691
[]
no_license
rafaelg202/fj21
93a5fa8a22f3a4c82b059b2102a4670e6ad55b2f
34a29d6c313412b12d812d2eefa85a6f972bf3b1
refs/heads/master
2021-05-01T20:26:26.837554
2017-01-24T23:07:08
2017-01-24T23:07:08
79,286,638
0
0
null
null
null
null
UTF-8
Java
false
false
2,696
java
package br.com.caelum.agenda.dao; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import br.com.caelum.agenda.modelo.Contato; public class ContatoDao { private Connection connection; public ContatoDao(Connection connection){ this.connection = connection; } public void adiciona(Contato contato) { try { String sql = "insert into contatos (nome, email, endereco, dataNascimento) values (?,?,?,?)"; PreparedStatement stmt = connection.prepareStatement(sql); stmt.setString(1, contato.getNome()); stmt.setString(2, contato.getEmail()); stmt.setString(3, contato.getEndereco()); stmt.setDate(4, new Date(contato.getDataNascimento().getTimeInMillis())); stmt.execute(); stmt.close(); } catch (SQLException e) { throw new RuntimeException(e); } } public List<Contato> getLista() { try { List<Contato> contatos = new ArrayList<Contato>(); PreparedStatement stmt = this.connection.prepareStatement("select * from contatos"); ResultSet rs = stmt.executeQuery(); while(rs.next()) { Contato contato = new Contato(); //popula o objeto contato contato.setId(rs.getLong("id")); contato.setNome(rs.getString("nome")); contato.setEmail(rs.getString("email")); contato.setEndereco(rs.getString("endereco")); //popula a data de nascimento do contato, fazendo a conversao Calendar data = Calendar.getInstance(); data.setTime(rs.getDate("dataNascimento")); contato.setDataNascimento(data); //adiciona o contato na lista contatos.add(contato); } rs.close(); stmt.close(); return contatos; } catch (SQLException e) { throw new RuntimeException(e); } } public void exclui(Contato contato) { String sql = "delete from contatos where id=?"; try { PreparedStatement stmt = this.connection.prepareStatement(sql); stmt.setLong(1, contato.getId()); stmt.execute(); } catch (SQLException e) { throw new RuntimeException(e); } } public void atualiza(Contato contato) { String sql = "update contatos set nome = ?, email = ?, endereco = ?, dataNascimento = ? where id = ?"; try { PreparedStatement stmt = this.connection.prepareStatement(sql); stmt.setString(1, contato.getNome()); stmt.setString(2, contato.getEmail()); stmt.setString(3, contato.getEndereco()); stmt.setDate(4, new java.sql.Date(contato.getDataNascimento().getTimeInMillis())); stmt.setLong(5, contato.getId()); stmt.execute(); } catch (SQLException e) { throw new RuntimeException(e); } } }
[ "web6600@caelum55-07" ]
web6600@caelum55-07
26403fd8e63a22d59fce851004bc717e1197e9a7
bbe10639bb9c8f32422122c993530959534560e1
/delivery/app-release_source_from_JADX/com/google/android/gms/internal/zzsl.java
6a1e98396f76b3e97ae9bb8b604c4a0548e95a7c
[ "Apache-2.0" ]
permissive
ANDROFAST/delivery_articulos
dae74482e41b459963186b6e7e3d6553999c5706
ddcc8b06d7ea2895ccda2e13c179c658703fec96
refs/heads/master
2020-04-07T15:13:18.470392
2018-11-21T02:15:19
2018-11-21T02:15:19
158,476,390
0
0
null
null
null
null
UTF-8
Java
false
false
197
java
package com.google.android.gms.internal; import java.io.IOException; import java.io.InputStream; public interface zzsl { void close(); InputStream zzfU(String str) throws IOException; }
dc07b8a64069a1995e842f4fb670944abd70d43a
4889e7bba24eb20178aa0bd0790353cca4099727
/src/java/nz/govt/natlib/meta/config/Config.java
ba9807757b99fdd69cb838b65bc5b65941503bd9
[ "Apache-2.0" ]
permissive
doctorlard/metadata-extractor
bee3c1bc4d0362b28712722bea3efd5da89e0165
31eb02324b8dbb9b867f85db9992640ec09d01fb
refs/heads/master
2020-05-18T09:12:31.864452
2010-08-05T04:52:20
2010-08-05T04:52:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
32,698
java
/* * Copyright 2006 The National Library of New Zealand * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nz.govt.natlib.meta.config; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLDecoder; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import nz.govt.natlib.AdapterFactory; import nz.govt.natlib.FileUtil; import nz.govt.natlib.adapter.DataAdapter; import nz.govt.natlib.fx.FXUtil; import nz.govt.natlib.meta.log.LogManager; import nz.govt.natlib.meta.log.LogMessage; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import blowfishj.BlowfishEasy; /** * @author Nic Evans * @version 1.0 */ public class Config { private static final String ROOT_TAG = "meta-config"; private static final String INPUT_FILES_TAG = "input-files"; private static final String HARVESTER_TAG = "harvester"; private static final String PARAMETER_TAG = "parameter"; private static final String XML_BASE_TAG = "xml-location"; private static final String JAR_BASE_TAG = "jar-location"; private static final String JAR_TAG = "jar"; private static final String TITLE_TAG = "title"; private static final String ADMIN_PASSWORD_TAG = "admin-password"; private static final String ADAPTERS_TAG = "adapters"; private static final String PROFILES_TAG = "profiles"; private static final String PROFILE_TAG = "profile"; private static final String PROFILE_DEFAULT_NAME_TAG = "default"; private static final String MAPS_TAG = "xslt-map"; private static final String MAP_TAG = "map"; private static final String ADAPTER_TAG = "adapter"; private static final String CLASS_TAG = "class"; private static final String OUTPUT_DTD_TAG = "output-dtd"; private static final String INPUT_DTD_TAG = "input-dtd"; private static final String XSLT_TAG = "xslt"; private static final String DOC_NAME_TAG = "doc-name"; private static final String CONFIGURATIONS_TAG = "configurations"; private static final String CONFIGURATION_TAG = "configuration"; private static final String NAME_TAG = "name"; private static final String VALUE_TAG = "value"; private static final String OUTPUT_DIRECTORY_TAG = "output-directory"; private static final String DIR_NAME_TAG = "dir"; private static final String LOG_TAG = "log-dir"; private static final String URL_TAG = "url"; private static final String USERS_TAG = "users"; private static final String USER_TAG = "user"; private static final String USER_NAME_TAG = "name"; private static final String USER_DEFAULT_NAME_TAG = "default"; private static final int USER_ADDED = 0; private static final int USER_REMOVED = 1; private static final int PROFILE_ADDED = 0; private static final int PROFILE_REMOVED = 1; private static final int PROFILE_CHANGED = 2; private static final String SEED = "9B73B749C6A2EA4112400B66EB1E762F"; public static final String SYSTEM_ADAPTER = "[SYSTEM]"; private static Config instance; private static Config editInstance; private ArrayList configMapping; private ArrayList users; private ArrayList profiles; private Profile defaultProfile; private Profile currentProfile; private Node usersNode; private Node baseXMLDir; private Node baseJarDir; private Node appName; private Node adaptersNode; private Node adminPasswordNode; private static final String copyright = '\u00A9' + " National Library of New Zealand"; private Node baseHarvestDir; private Node logDirectory; private Node mapNode; private Node profileNode; private Node configNode; private Document configDoc; private User defaultUser; private ArrayList configs = new ArrayList(); private HashMap adapterJarLocations = new HashMap(); private HashSet userListeners = new HashSet(); private HashSet profileListeners = new HashSet(); private String adminPassword; private Config() { configMapping = new ArrayList(); users = new ArrayList(); readConfig(); } public void setJarForAdapter(DataAdapter adapter, String jar) { adapterJarLocations.put(adapter.getClass(), jar); } public String getJarForAdapter(DataAdapter adapter) { return (String) adapterJarLocations.get(adapter.getClass()); } private Config(Config original) { configMapping = (ArrayList) original.configMapping.clone(); users = (ArrayList) original.users.clone(); profiles = new ArrayList(); currentProfile = original.currentProfile; defaultProfile = original.defaultProfile; defaultUser = original.defaultUser; Iterator it = original.profiles.iterator(); while (it.hasNext()) { Profile origP = (Profile) it.next(); Profile p = new Profile(); p.setName(origP.getName()); p.setInputDirectory(origP.getInputDirectory()); p.setLogDirectory(origP.getLogDirectory()); Iterator ads = origP.getAdapterClasses(); while (ads.hasNext()) { p.setAdapter((String) ads.next(), true); } baseXMLDir = original.baseXMLDir; baseJarDir = original.baseJarDir; profiles.add(p); if (original.currentProfile.getName().equals(p.getName())) { currentProfile = p; } if (original.defaultProfile.getName().equals(p.getName())) { defaultProfile = p; } } configs = (ArrayList) original.configs.clone(); adapterJarLocations = (HashMap) original.adapterJarLocations.clone(); } public static synchronized void saveAdapterEdit() { instance.adapterJarLocations = editInstance.adapterJarLocations; instance.configMapping = editInstance.configMapping; } public static synchronized void saveEdit() { instance.configMapping = editInstance.configMapping; instance.users = editInstance.users; instance.profiles = editInstance.profiles; instance.defaultProfile = editInstance.defaultProfile; instance.defaultUser = editInstance.defaultUser; Profile old = instance.currentProfile; instance.currentProfile = editInstance.currentProfile; if (!old.equals(instance.currentProfile)) { instance.fireProfileEvent(PROFILE_CHANGED, old); } instance.configs = editInstance.configs; instance.adapterJarLocations = editInstance.adapterJarLocations; } public synchronized static Config getInstance() { if (instance == null) { instance = new Config(); } return instance; } public synchronized static Config getEditInstance(boolean renew) { if ((editInstance == null) || renew) { editInstance = new Config(Config.getInstance()); } return editInstance; } public synchronized static Config getEditInstance() { return getEditInstance(false); } public ArrayList getAvailableConfigs() { return configs; } /** * Get the configuration with a given name. * @param name The name of the configuration to retrieve. * @return The Configuration object. */ public Configuration getConfiguration(String name) throws ConfigurationException { Iterator it = configs.iterator(); while (it.hasNext()) { Configuration c = (Configuration) it.next(); if (c.getName().equalsIgnoreCase(name)) { return c; } } // We haven't found the configuration, return null. throw new ConfigurationException("Could not find a configuration with the name " + name); } public ArrayList getAvailableProfiles() { return profiles; } public Profile getDefaultProfile() { return defaultProfile; } public void setAdminPassword(String oldPassword, String password) { if (oldPassword.equals(adminPassword)) { adminPassword = password; BlowfishEasy bfish = new BlowfishEasy(SEED.toCharArray()); adminPasswordNode.setNodeValue(bfish.encryptString(password)); } } public boolean checkAdminPassword(String pass) { if (pass != null) { return pass.equals(adminPassword); } return false; } public Profile getCurrentProfile() { return currentProfile; } public void setCurrentProfile(Profile current) { currentProfile = current; } public void addConfig(Configuration config) { configs.add(config); } public User getDefaultUser() { return defaultUser; } public void setDefaultUser(User user) { this.defaultUser = user; } public String getBaseHarvestDir() { return getCurrentProfile().getInputDirectory(); } public void setBaseHarvestDir(String baseHarvestDir) { getCurrentProfile().setInputDirectory(baseHarvestDir); } public String getXMLBaseURL() { String st = baseXMLDir.getNodeValue(); try { File f = new File(st); return f.getAbsolutePath(); } catch (Exception ex) { LogManager.getInstance().logMessage(ex); } return st; } public String getJarBaseURL() { String st = baseJarDir.getNodeValue(); try { File f = new File(st); return f.getAbsolutePath(); } catch (Exception ex) { LogManager.getInstance().logMessage(ex); } return st; } public void setXMLBaseURL(String url) { baseXMLDir.setNodeValue(url); } public void setJarBaseURL(String url) { baseJarDir.setNodeValue(url); } public String getApplicationName() { return appName.getNodeValue(); } public void setApplicationName(String name) { appName.setNodeValue(name); } public String getCopyright() { return copyright; } public void setLogDirectory(String logDirectory) { instance.getCurrentProfile().setLogDirectory(logDirectory); } public String getLogDirectory() { return instance.getCurrentProfile().getLogDirectory(); } public void addMapping(String inputDTD, String outputDTD, String xsltFunction) { configMapping .add(new ConfigMapEntry(inputDTD, outputDTD, xsltFunction)); } public String createLogFileName() { DateFormat formatter = new SimpleDateFormat("MMMdyyyy_Hmmss"); Date now = new Date(); String nowText = formatter.format(now); return getLogDirectory() + "/nlnz_" + nowText + ".log"; } public ConfigMapEntry getMapping(String inputDTD, String outputDTD) { Iterator it = configMapping.iterator(); while (it.hasNext()) { ConfigMapEntry entry = (ConfigMapEntry) it.next(); if (entry.getInputDTD().equals(inputDTD) && entry.getOutputDTD().equals(outputDTD)) { return entry; } } return null; // no function exists to do this transform... } public ConfigMapEntry[] getMappings() { ConfigMapEntry[] maps = new ConfigMapEntry[configMapping.size()]; configMapping.toArray(maps); return maps; } public void addMapping(ConfigMapEntry mapping) { configMapping.add(mapping); } public void removeMapping(ConfigMapEntry mapping) { configMapping.remove(mapping); } public void removeConfig(Configuration config) { configs.remove(config); } public User[] getUsers() { User[] u = new User[users.size()]; users.toArray(u); return u; } public void writeNewConfig() throws IOException { // find out where... URL furl = ClassLoader.getSystemResource("saveconfig.xml"); // remove spaces - if any... String configPath = URLDecoder.decode(furl.getPath()); File configFile = new File(configPath); File backup = new File(configFile.getPath() + ".bak"); // backup - if poss boolean backedup = (backup.delete() && configFile.renameTo(backup)); if (!backedup) { LogMessage msg = new LogMessage(LogMessage.INFO, configFile, "Config File not backed up", "check file system permissions etc"); LogManager.getInstance().logMessage(msg); } try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); // Prepare the DOM document for writing Source source = new DOMSource(configDoc); // Prepare the output file Result result = new StreamResult(configFile); // Write the DOM document to the file Transformer xformer = TransformerFactory.newInstance() .newTransformer(); xformer.transform(source, result); } catch (TransformerException ex) { throw new RuntimeException(ex); } } public void writeConfig() throws IOException { // find out where... URL furl = ClassLoader.getSystemResource("config.xml"); try { writeProfiles(); writeAdapters(); writeUsers(); writeMaps(); writeConfigurations(); } catch (Exception e) { LogManager.getInstance().logMessage(e); } // remove spaces - if any... String configPath = URLDecoder.decode(furl.getPath()); File configFile = new File(configPath); File backup = new File(configFile.getPath() + ".bak"); System.out.println(backup); // backup - if poss LogMessage msg = new LogMessage(LogMessage.INFO, configFile, "Backing up config: " + configFile.getAbsolutePath(), "Backing up to: " + backup.getAbsolutePath()); LogManager.getInstance().logMessage(msg); LogMessage msg2 = new LogMessage(LogMessage.INFO, configFile, "Backup deleted: " + backup.delete(), ""); LogManager.getInstance().logMessage(msg2); boolean backedup = FileUtil.copy(configFile.getAbsolutePath(), backup .getAbsolutePath());// fconfigFile.renameTo(backup)); if (!backedup) { LogMessage msg3 = new LogMessage(LogMessage.INFO, configFile, "Config File not backed up", "check file system permissions etc"); LogManager.getInstance().logMessage(msg3); } try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); // Prepare the DOM document for writing Source source = new DOMSource(configDoc); // Prepare the output file Result result = new StreamResult(configFile.getAbsolutePath()); // Write the DOM document to the file Transformer xformer = TransformerFactory.newInstance() .newTransformer(); System.out.println(source.getSystemId()); System.out.println(result.getSystemId()); xformer.transform(source, result); } catch (TransformerException ex) { ex.printStackTrace(); throw new RuntimeException(ex); } } /** The cool stuff that reads the config... * */ private void readConfig() { try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); factory.setValidating(false); DocumentBuilder builder = factory.newDocumentBuilder(); // find the file... InputStream cfgFile = null; try { cfgFile = ClassLoader.getSystemResourceAsStream("config.xml"); configDoc = builder.parse(cfgFile); } catch(Throwable t) { throw new RuntimeException("Config file not found - make sure it is in the classpath", t); } finally { cfgFile.close(); } //configDoc = builder.parse(configFile); // find the <meta-config> tag Node metaConfig = null; for (int i = 0; i < configDoc.getChildNodes().getLength(); i++) { if (ROOT_TAG.equalsIgnoreCase(configDoc.getChildNodes().item(i) .getNodeName())) { metaConfig = configDoc.getChildNodes().item(i); } } if (metaConfig == null) { throw new RuntimeException( "Root element <meta-config> not found in config.xml"); } NodeList nodes = metaConfig.getChildNodes(); boolean app = false, adapters = false, maps = false, configs = false, profiles = false, users = false; for (int i = 0; i < nodes.getLength(); i++) { if (initApplication(nodes.item(i))) app = true; if (initAdapters(nodes.item(i))) adapters = true; if (initMaps(nodes.item(i))) maps = true; if (initConfigs(nodes.item(i))) configs = true; if (initProfiles(nodes.item(i))) profiles = true; if (initUsers(nodes.item(i))) users = true; } if (!app) { System.out .println("No application configuration information found in config.xml"); } if (!adapters) { System.out.println("No Adapters found in config.xml"); } if (!maps) { System.out.println("No Maps found in config.xml"); } if (!configs) { System.out .println("No processing configurations found in config.xml"); } if (!profiles) { System.out.println("No profiles found in config.xml"); } if (!users) { System.out.println("Incorrect users tag in config.xml"); } } catch (Throwable ex) { ex.printStackTrace(); } } private boolean initApplication(Node node) { boolean foundInit = false; if (HARVESTER_TAG.equalsIgnoreCase(node.getNodeName())) { NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node appParam = nodes.item(i); if (TITLE_TAG.equalsIgnoreCase(appParam.getNodeName())) { appName = appParam.getAttributes().getNamedItem(NAME_TAG); } if (INPUT_FILES_TAG.equalsIgnoreCase(appParam.getNodeName())) { baseHarvestDir = appParam.getAttributes().getNamedItem( DIR_NAME_TAG); } if (XML_BASE_TAG.equalsIgnoreCase(nodes.item(i).getNodeName())) { baseXMLDir = appParam.getAttributes().getNamedItem(URL_TAG); foundInit = true; } if (JAR_BASE_TAG.equalsIgnoreCase(nodes.item(i).getNodeName())) { baseJarDir = appParam.getAttributes().getNamedItem(URL_TAG); Loader.setJarDir(baseJarDir.getNodeValue()); } if (ADMIN_PASSWORD_TAG.equalsIgnoreCase(nodes.item(i) .getNodeName())) { // the value is in the tag - not an attribute... adminPasswordNode = appParam.getFirstChild(); readAdminPassword(appParam.getFirstChild().getNodeValue()); } if (LOG_TAG.equalsIgnoreCase(nodes.item(i).getNodeName())) { // the value is in the tag - not an attribute... logDirectory = appParam.getAttributes().getNamedItem( DIR_NAME_TAG); } } } return foundInit; } private void readAdminPassword(String hashedValue) { // System.out.println(hashedValue); BlowfishEasy bf = new BlowfishEasy(SEED.toCharArray()); // System.out.println(bf); adminPassword = bf.decryptString(hashedValue);// .trim(); // System.out.println(adminPassword); } private boolean initAdapters(Node node) throws ClassNotFoundException, IllegalAccessException, InstantiationException { boolean initAdapter = false; if (ADAPTERS_TAG.equalsIgnoreCase(node.getNodeName())) { adaptersNode = node; NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { if (ADAPTER_TAG.equalsIgnoreCase(nodes.item(i).getNodeName())) { Node adapterNode = nodes.item(i); NamedNodeMap map = adapterNode.getAttributes(); String className = map.getNamedItem(CLASS_TAG) .getNodeValue(); // String outputDTD = // map.getNamedItem(OUTPUT_DTD_TAG).getNodeValue(); // create it and set it up... DataAdapter adapter = null; try { adapter = (DataAdapter) Class.forName(className, true, ClassLoader.getSystemClassLoader()) .newInstance(); String jarName = map.getNamedItem(JAR_TAG) .getNodeValue(); setJarForAdapter(adapter, jarName); } catch (ClassCastException e) { LogManager .getInstance() .logMessage( new LogMessage( LogMessage.ERROR, e, "Adapter class " + className + " not found", "Invalid adapter entry in config.xml file - check contents using admin tool or filesystem")); } catch (Exception e) { LogManager .getInstance() .logMessage( new LogMessage( LogMessage.ERROR, e, "Adapter class " + className + " not found", "Invalid adapter entry in config.xml file - check contents using admin tool or filesystem")); } // are there any properties for the adapter. NodeList params = adapterNode.getChildNodes(); for (int p = 0; p < params.getLength(); p++) { if (PARAMETER_TAG.equalsIgnoreCase(params.item(p) .getNodeName())) { NamedNodeMap paramMap = params.item(p) .getAttributes(); String name = paramMap.getNamedItem(NAME_TAG) .getNodeValue(); String value = paramMap.getNamedItem(VALUE_TAG) .getNodeValue(); try { FXUtil.setProperty(adapter, name, value); } catch (Exception ex) { throw new RuntimeException( "Invalid Adapter parameter"); } } } // tell the directory about the adapter... if (adapter != null) { AdapterFactory.getInstance().addAdapter(adapter); initAdapter = true; } } } } return initAdapter; } private boolean initProfiles(Node node) throws ClassNotFoundException, IllegalAccessException, InstantiationException { boolean initProfiles = false; if (PROFILES_TAG.equalsIgnoreCase(node.getNodeName())) { profileNode = node; profiles = new ArrayList(); NamedNodeMap nodeMap = node.getAttributes(); String defaultProfileName = nodeMap.getNamedItem( PROFILE_DEFAULT_NAME_TAG).getNodeValue(); NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { if (PROFILE_TAG.equalsIgnoreCase(nodes.item(i).getNodeName())) { Profile prof = new Profile(); Node profileNode = nodes.item(i); NamedNodeMap map = profileNode.getAttributes(); String profileName = map.getNamedItem(NAME_TAG) .getNodeValue(); prof.setName(profileName); if (profileName.equals(defaultProfileName)) { defaultProfile = prof; currentProfile = prof; } NodeList profileNodes = profileNode.getChildNodes(); for (int elem = 0; elem < profileNodes.getLength(); elem++) { Node profileElement = profileNodes.item(elem); if (Config.LOG_TAG.equalsIgnoreCase(profileElement .getNodeName())) { prof.setLogDirectory(profileElement.getAttributes() .getNamedItem(DIR_NAME_TAG).getNodeValue()); } else if (Config.INPUT_FILES_TAG .equalsIgnoreCase(profileElement.getNodeName())) { prof.setInputDirectory(profileElement .getAttributes().getNamedItem(DIR_NAME_TAG) .getNodeValue()); } else if (Config.ADAPTER_TAG .equalsIgnoreCase(profileElement.getNodeName())) { NamedNodeMap adapterMap = profileElement .getAttributes(); String adapterClass = adapterMap.getNamedItem( CLASS_TAG).getNodeValue(); prof.setAdapter(adapterClass, true); } } profiles.add(prof); initProfiles = true; } } } return initProfiles; } public void removeUser(User user) { users.remove(user); fireUserEvent(USER_REMOVED, user); } public User addUser(User user) { users.add(user); fireUserEvent(USER_ADDED, user); return user; } public void addProfile(Profile p) { if (!profiles.contains(p)) { profiles.add(p); fireProfileEvent(PROFILE_ADDED, p); } } public boolean removeProfile(Profile p) { if (profiles.size() > 1) { if (profiles.contains(p)) { profiles.remove(p); if (p.equals(defaultProfile)) { defaultProfile = (Profile) profiles.get(0); } if (p.equals(currentProfile)) { currentProfile = (Profile) profiles.get(0); } fireProfileEvent(PROFILE_REMOVED, p); return true; } } return false; } private void fireUserEvent(int type, User user) { Iterator it = userListeners.iterator(); while (it.hasNext()) { UserListener ul = (UserListener) it.next(); switch (type) { case USER_ADDED: ul.userAdded(user); break; case USER_REMOVED: ul.userRemoved(user); break; } } } private void fireProfileEvent(int type, Profile p) { Iterator it = profileListeners.iterator(); while (it.hasNext()) { ProfileListener pl = (ProfileListener) it.next(); switch (type) { case PROFILE_ADDED: pl.profileAdded(p); break; case PROFILE_REMOVED: pl.profileRemoved(p); break; case PROFILE_CHANGED: pl.profileChanged(p); break; } } } private boolean initUsers(Node node) throws ClassNotFoundException, IllegalAccessException, InstantiationException { boolean result = false; if (USERS_TAG.equalsIgnoreCase(node.getNodeName())) { String defaultUserName = node.getAttributes().getNamedItem( USER_DEFAULT_NAME_TAG).getNodeValue(); if (defaultUserName != null) { result = true; } NodeList nodes = node.getChildNodes(); usersNode = node; for (int i = 0; i < nodes.getLength(); i++) { Node appParam = nodes.item(i); if (USER_TAG.equalsIgnoreCase(appParam.getNodeName())) { Node name = appParam.getAttributes().getNamedItem( USER_NAME_TAG); User u = new User(name.getNodeValue()); users.add(u); if (u.getName().equals(defaultUserName)) { defaultUser = u; } } } } return result; } private boolean initMaps(Node node) throws ClassNotFoundException, IllegalAccessException, InstantiationException { boolean initMaps = false; if (MAPS_TAG.equalsIgnoreCase(node.getNodeName())) { mapNode = node; NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { if (MAP_TAG.equalsIgnoreCase(nodes.item(i).getNodeName())) { Node mapNode = nodes.item(i); NodeList map = mapNode.getChildNodes(); String inDTD = null; String outDTD = null; String xsltDoc = null; for (int elem = 0; elem < map.getLength(); elem++) { Node mapElement = map.item(elem); if (INPUT_DTD_TAG.equalsIgnoreCase(mapElement .getNodeName())) { inDTD = mapElement.getAttributes().getNamedItem( DOC_NAME_TAG).getNodeValue(); } if (OUTPUT_DTD_TAG.equalsIgnoreCase(mapElement .getNodeName())) { outDTD = mapElement.getAttributes().getNamedItem( DOC_NAME_TAG).getNodeValue(); } if (XSLT_TAG.equalsIgnoreCase(mapElement.getNodeName())) { xsltDoc = mapElement.getAttributes().getNamedItem( DOC_NAME_TAG).getNodeValue(); } } // set up the mappings... addMapping(inDTD, outDTD, xsltDoc); initMaps = true; } } } return initMaps; } private boolean initConfigs(Node node) throws ClassNotFoundException, IllegalAccessException, InstantiationException { boolean initConfigs = false; if (CONFIGURATIONS_TAG.equalsIgnoreCase(node.getNodeName())) { NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { if (CONFIGURATION_TAG.equalsIgnoreCase(nodes.item(i) .getNodeName())) { configNode = node; Node mapNode = nodes.item(i); NodeList map = mapNode.getChildNodes(); String name = mapNode.getAttributes() .getNamedItem(NAME_TAG).getNodeValue(); String outputDir = null; String outputDTD = null; String className = null; for (int elem = 0; elem < map.getLength(); elem++) { Node mapElement = map.item(elem); if (OUTPUT_DIRECTORY_TAG.equalsIgnoreCase(mapElement .getNodeName())) { outputDir = mapElement.getAttributes() .getNamedItem(DIR_NAME_TAG).getNodeValue(); } if (OUTPUT_DTD_TAG.equalsIgnoreCase(mapElement .getNodeName())) { // optional... outputDTD = mapElement.getAttributes() .getNamedItem(DOC_NAME_TAG).getNodeValue(); } if (HARVESTER_TAG.equalsIgnoreCase(mapElement .getNodeName())) { // optional... className = mapElement.getAttributes() .getNamedItem(CLASS_TAG).getNodeValue(); } } // set up the mappings... Configuration config = new Configuration(name, className, outputDir, outputDTD); addConfig(config); initConfigs = true; } } } return initConfigs; } private boolean writeUsers() { while (usersNode.hasChildNodes()) { usersNode.removeChild(usersNode.getFirstChild()); } Element userEl = (Element) usersNode; userEl.setAttribute("default", getDefaultUser().getName()); Iterator it = users.iterator(); while (it.hasNext()) { User user = (User) it.next(); Element userNode = configDoc.createElement("user"); userNode.setAttribute("name", user.getName()); usersNode.appendChild(userNode); } return true; } private boolean writeProfiles() { while (profileNode.hasChildNodes()) { profileNode.removeChild(profileNode.getFirstChild()); } Iterator it = profiles.iterator(); while (it.hasNext()) { Profile prof = (Profile) it.next(); Element profNode = configDoc.createElement("profile"); profNode.setAttribute("name", prof.getName()); Element inpDirNode = configDoc.createElement(INPUT_FILES_TAG); inpDirNode.setAttribute(DIR_NAME_TAG, prof.getInputDirectory()); Element logDirNode = configDoc.createElement(LOG_TAG); logDirNode.setAttribute(DIR_NAME_TAG, prof.getLogDirectory()); profNode.appendChild(inpDirNode); profNode.appendChild(logDirNode); Iterator ad = prof.getAdapterClasses(); while (ad.hasNext()) { String adClass = (String) ad.next(); Element adapNode = configDoc.createElement(ADAPTER_TAG); adapNode.setAttribute(CLASS_TAG, adClass); profNode.appendChild(adapNode); } profileNode.appendChild(profNode); } return true; } private boolean writeMaps() { while (mapNode.hasChildNodes()) { mapNode.removeChild(mapNode.getFirstChild()); } Iterator it = this.configMapping.iterator(); while (it.hasNext()) { ConfigMapEntry map = (ConfigMapEntry) it.next(); Element mapSubNode = configDoc.createElement("map"); Element inpDTDNode = configDoc.createElement(INPUT_DTD_TAG); inpDTDNode.setAttribute(DOC_NAME_TAG, map.getInputDTD()); Element outDTDNode = configDoc.createElement(OUTPUT_DTD_TAG); outDTDNode.setAttribute(DOC_NAME_TAG, map.getOutputDTD()); Element mapXSLTNode = configDoc.createElement(XSLT_TAG); mapXSLTNode.setAttribute(DOC_NAME_TAG, map.getXsltFunction()); mapSubNode.appendChild(inpDTDNode); mapSubNode.appendChild(outDTDNode); mapSubNode.appendChild(mapXSLTNode); mapNode.appendChild(mapSubNode); } return true; } private boolean writeAdapters() { while (adaptersNode.hasChildNodes()) { adaptersNode.removeChild(adaptersNode.getFirstChild()); } DataAdapter[] ads = AdapterFactory.getInstance().getAdapters(); for (int i = 0; i < ads.length; i++) { Element adSubNode = configDoc.createElement(ADAPTER_TAG); adSubNode.setAttribute(CLASS_TAG, ads[i].getClass().getName()); String ot = ads[i].getOutputType(); if ((ot != null) && (ot.length() > 0)) { adSubNode.setAttribute(OUTPUT_DTD_TAG, ads[i].getOutputType()); } String jar = getJarForAdapter(ads[i]); if ((jar != null) && (jar.length() > 0)) { adSubNode.setAttribute(JAR_TAG, getJarForAdapter(ads[i])); } Element adParamNode = configDoc.createElement(PARAMETER_TAG); // FXUtil.get // ads[i]. // adParamNode. adaptersNode.appendChild(adSubNode); } return true; } private boolean writeConfigurations() { while (configNode.hasChildNodes()) { configNode.removeChild(configNode.getFirstChild()); } Iterator it = this.configs.iterator(); while (it.hasNext()) { Configuration config = (Configuration) it.next(); Element configSubNode = configDoc.createElement("configuration"); configSubNode.setAttribute(NAME_TAG, config.getName()); Element outputDirNode = configDoc .createElement(OUTPUT_DIRECTORY_TAG); outputDirNode.setAttribute(DIR_NAME_TAG, config .getOutputDirectory()); configSubNode.appendChild(outputDirNode); Element harvesterNode = configDoc.createElement(HARVESTER_TAG); harvesterNode.setAttribute(CLASS_TAG, config.getClassName()); configSubNode.appendChild(harvesterNode); configNode.appendChild(configSubNode); } return true; } public void addUserListener(UserListener ul) { userListeners.add(ul); } public void removeUserListener(UserListener ul) { userListeners.remove(ul); } public void addProfileListener(ProfileListener pl) { profileListeners.add(pl); } public void removeProfileListener(ProfileListener pl) { profileListeners.remove(pl); } }
[ "beaumont_brett" ]
beaumont_brett
4c87bfe8389b5d35f86d61f265ba17b4065802e7
4d463786e32174af131175b9a9858ff4ff4f13aa
/src/de/nope/ultraholograms/events/HologramsClick.java
557b56f64037d61c4c7274cbc7252b20f239c02f
[ "Apache-2.0" ]
permissive
Nope-Developing/UltraHolograms
e39063e91fd44c5f5af3310acd0ba351234b21b3
cd585cfd94365473027b7a42037c6d6287d3fe79
refs/heads/master
2020-07-16T04:45:18.645960
2019-09-03T16:37:43
2019-09-03T16:37:43
205,722,346
0
0
null
null
null
null
UTF-8
Java
false
false
1,512
java
package de.nope.ultraholograms.events; import de.nope.ultraholograms.Guis.ArmorStandEditor; import de.nope.ultraholograms.Main; import de.nope.ultraholograms.hashmaps.EditHash; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import de.nope.ultraholograms.Guis.Maingui; import java.util.ArrayList; import java.util.UUID; public class HologramsClick implements Listener { @EventHandler public void handleMaindGuiClick(InventoryClickEvent event) { if (event.getView().getTitle().contains("Hologram List")) { Player player = (Player) event.getWhoClicked(); if (event.getCurrentItem() == null) { } else { if (event.getSlot() == 46) { Maingui.openMainGui(player); } else { ArrayList<String> temporaryList = new ArrayList<String>(); for (String x : Main.cfgholo.getKeys(false)) { temporaryList.add(x); } for (int i=0; i<temporaryList.size(); i++) { if (event.getSlot() == i) { ArmorStand HOLO = (ArmorStand) Bukkit.getEntity(UUID.fromString(temporaryList.get(i))); EditHash.CurrentStand.put(player, HOLO); ArmorStandEditor.openHoloEditGui(player); if (HOLO.isGlowing()) HOLO.setGlowing(false); } } } } } } }
681c106db0fb51e9c993ff516a161e0d28ac86f5
09ed5dcfba70cf786a410c532f8f063d1dc56147
/src/epub3maker/Epub3Archiver.java
9607c8271b3cf18259be9dd4beeb7681e11cc81b
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
cccties/chilo-producer
82596a77f8d8fad43e4a364e05710fbe964b1b9d
880c48c53c5faaf1192ece2934a077269855162e
refs/heads/master
2022-07-17T09:53:40.792266
2020-03-17T03:09:48
2020-03-17T03:09:48
33,848,043
5
4
Apache-2.0
2022-06-29T16:58:10
2015-04-13T04:38:33
Java
UTF-8
Java
false
false
4,472
java
/** * * :-::-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-+:-+:-+:-+:-++:-:+:-:+:-:+:-: * * This file is part of CHiLOⓇ - http://www.cccties.org/en/activities/chilo/ * CHiLOⓇ is a next-generation learning system utilizing ebooks, aiming * at dissemination of open education. * Copyright 2015 NPO CCC-TIES * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * :-::-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-:+:-+:-+:-+:-+:-++:-:+:-:+:-:+:-: * */ package epub3maker; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.zip.CRC32; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class Epub3Archiver { @SuppressWarnings("unused") private static Log log = LogFactory.getLog(Epub3Archiver.class); public void archive(Series series, Book book, List<Path> inputFilePaths, Path tempPath, List<Path> extensionPaths) throws Exception { Path output = series.getEpubFilePath(book); // charset指定しないと日本語ばける? ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(output.toFile()))); // mimetypeファイルが最初のエントリーである必要あり writeMimetypeFile(tempPath.resolve("mimetype"), zos); writeFile("OEBPS/", tempPath.resolve("content.opf"), zos); writeFile("META-INF/", tempPath.resolve("container.xml"), zos); writeFile("OEBPS/", tempPath.resolve(Process.Document.CARDVIEW.fileName), zos); writeFile("OEBPS/", tempPath.resolve(Process.Document.NAV.fileName), zos); Path mediaPath = tempPath.resolve(Process.Document.MEDIA_OVERLAY.fileName); if(Files.exists(mediaPath)){ writeFile("OEBPS/", mediaPath, zos); } zos.setMethod(ZipOutputStream.DEFLATED); // zos.setLevel(9); for (Path p: inputFilePaths) { writeInputFile(p, zos); } for (Path p: extensionPaths) { writeFile("", p, zos); } zos.close(); } private void writeMimetypeFile(Path path, ZipOutputStream zos) throws IOException { ZipEntry entry = new ZipEntry(path.getFileName().toString()); long size = Files.size(path); entry.setSize(size); entry.setCompressedSize(size); entry.setCrc(getCRCValue(path)); // entry.setCrc(0x2CAB616F); entry.setMethod(ZipEntry.STORED); zos.putNextEntry(entry); zos.write(Files.readAllBytes(path)); } private void writeFile(String dir, Path path, ZipOutputStream zos) throws IOException { ZipEntry entry = new ZipEntry(dir + path.getFileName().toString()); zos.putNextEntry(entry); zos.write(Files.readAllBytes(path)); } private void writeInputFile(Path path, ZipOutputStream zos) throws Exception { ZipEntry entry = new ZipEntry("OEBPS/" + Util.path2str(Process.subtractBasePath(path))); zos.putNextEntry(entry); zos.write(Files.readAllBytes(path)); } /** * ファイルのCRC-32チェックサムを取得する。 * * @param file * ファイル * @return CRC-32チェックサム * @throws IOException * ファイル入出力エラー */ private long getCRCValue(Path file) throws IOException { CRC32 crc = new CRC32(); try (BufferedInputStream input = new BufferedInputStream( new FileInputStream(file.toFile()))) { int b; while ((b = input.read()) != -1) { crc.update(b); } } return crc.getValue(); } }
ed99ae75867d0736d14cc1b0d36f9a813ace96a8
e32d40c1fb81eb45c7d264536de247b81eb927f8
/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java
f51dcb31924e8104b9c773d13d8a93855eaee768
[ "MIT" ]
permissive
jihaifeng/RichText
87ba635376e6df7fa17840db1084aedddae8d4d6
a743eca32826bf34362cb65d8754e8e4d7b79120
refs/heads/master
2021-01-23T02:39:56.608597
2017-03-21T09:01:04
2017-03-21T09:01:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,456
java
package com.zzhoujay.richtext; import android.graphics.Rect; import android.support.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Created by zhou on 16-5-28. * ImageHolder */ @SuppressWarnings("ALL") public class ImageHolder { /** * ScaleType */ @IntDef({ScaleType.DEFAULT, ScaleType.CENTER_CROP, ScaleType.FIT_CENTER}) @Retention(RetentionPolicy.SOURCE) public @interface ScaleType { int DEFAULT = 0; int CENTER_CROP = 1; int FIT_CENTER = 2; } /** * ImageType */ @IntDef({ImageType.JPG, ImageType.GIF}) @Retention(RetentionPolicy.SOURCE) public @interface ImageType { int JPG = 0; int GIF = 1; } /** * ImageState 图片的加载状态 * INIT: 初始化加载,可以设置图片宽高给Glide * LOADING: 加载中,设置placeholder图片的宽高 * READY: 图片加载成功,设置最终显示的图片的宽高 * FAILED: 加载失败,设置加载失败的图片的宽高 */ @IntDef({ImageState.INIT, ImageState.LOADING, ImageState.READY, ImageState.FAILED, ImageState.SIZE_READY}) @Retention(RetentionPolicy.SOURCE) public @interface ImageState { int INIT = 0; int LOADING = 1; int READY = 2; int FAILED = 3; int SIZE_READY = 4; } private final String source; // 图片URL private final int position; // 图片在在某个富文本中的位置 private int width = -1, height = -1; // 和scale属性共同决定holder宽高,开发者设置,内部获取值然后进行相应的设置 private int maxWidth, maxHeight; // holder最大的宽高,开发者设置,内部获取,在SIZE_READY回调中由开发者设置 private float scale = 1; // holder的缩放比例 @ScaleType private int scaleType = ScaleType.DEFAULT; @ImageType private int imageType = ImageType.JPG; @ImageState private int imageState; // 图片加载的状态 private boolean autoFix; private boolean autoPlay; @Deprecated private boolean autoStop; //强制自动停止 private boolean show; private Exception exception; private Rect cachedBound; public ImageHolder(String source, int position) { this.source = source; this.position = position; autoPlay = false; autoStop = true; show = true; maxWidth = -1; maxHeight = -1; } public boolean success() { return imageState == ImageState.READY; } public boolean failed() { return imageState == ImageState.FAILED; } public void setSize(int width, int height) { this.width = width; this.height = height; } // public void setImageSize(int width, int height) { // this.imageWidth = width; // this.imageHeight = height; // } public int getHeight() { return height; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public void setHeight(int height) { this.height = height; } public int getPosition() { return position; } public String getSource() { return source; } @Deprecated public String getSrc() { return getSource(); } public boolean isAutoFix() { return autoFix; } public void setAutoFix(boolean autoFix) { this.autoFix = autoFix; } @ImageType public int getImageType() { return imageType; } public void setImageType(@ImageType int imageType) { this.imageType = imageType; } @ScaleType public int getScaleType() { return scaleType; } public void setScaleType(@ScaleType int scaleType) { this.scaleType = scaleType; } public boolean isGif() { return imageType == ImageType.GIF; } public boolean isAutoPlay() { return autoPlay; } public void setAutoPlay(boolean autoPlay) { this.autoPlay = autoPlay; } @Deprecated public boolean isAutoStop() { return autoStop; } @Deprecated public void setAutoStop(boolean autoStop) { this.autoStop = autoStop; } public boolean isShow() { return show; } public void setShow(boolean show) { this.show = show; } public float getScale() { return scale; } public void setScale(float scale) { this.scale = scale; } @ImageState public int getImageState() { return imageState; } public void setImageState(@ImageState int imageState) { this.imageState = imageState; } public int getMaxWidth() { return maxWidth; } public void setMaxWidth(int maxWidth) { this.maxWidth = maxWidth; } public int getMaxHeight() { return maxHeight; } public void setMaxHeight(int maxHeight) { this.maxHeight = maxHeight; } public Exception getException() { return exception; } public void setException(Exception exception) { this.exception = exception; } public float getScaleWidth() { return scale * width; } public float getScaleHeight() { return scale * height; } public Rect getCachedBound() { return cachedBound; } public void setCachedBound(Rect cachedBound) { this.cachedBound = cachedBound; } public boolean isInvalidateSize() { return width > 0 && height > 0 && scale > 0; } @Override public String toString() { return "ImageHolder{" + "source='" + source + '\'' + ", position=" + position + ", width=" + width + ", height=" + height + ", maxWidth=" + maxWidth + ", maxHeight=" + maxHeight + ", scale=" + scale + ", scaleType=" + scaleType + ", imageType=" + imageType + ", imageState=" + imageState + ", autoFix=" + autoFix + ", autoPlay=" + autoPlay + ", autoStop=" + autoStop + ", show=" + show + ", exception=" + exception + ", cachedBound=" + cachedBound + '}'; } }
c69bf9b1e71d3065cdabd416136efcea070d3f8e
b8a4b150c68628ed40c64cd1af14b4acaa7886a0
/gateway/src/main/java/com/gateway/GatewayApplication.java
4f82b23d2647abaa1b6c7a14684bd68bfdd38b6d
[]
no_license
qinjie1314520/graduation_project_roger
d77fbb9b4ab97ea2016e0ee3bd50c06795f88185
ddd4bdd3dde786669334c78c24c4dbfac5925e1a
refs/heads/master
2023-03-14T14:33:38.878636
2021-03-07T07:04:22
2021-03-07T07:04:22
309,324,867
0
0
null
null
null
null
UTF-8
Java
false
false
611
java
package com.gateway; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate; @SpringBootApplication @EnableDiscoveryClient public class GatewayApplication { @Bean public RestTemplate restTemplate() { return new RestTemplate(); } public static void main(String[] args) { SpringApplication.run(GatewayApplication.class, args); } }
[ "qj18780122553" ]
qj18780122553
5d148719ae1312c4343da591a07826e017a17336
3f03c05bdc94d1f3999f21aca4223c752c93c067
/Stage1/src/main/java/circulation/DDDDDD.java
dd08a40d1c5f2de5de37be220c307c267a56a4b1
[]
no_license
langdawang678/Jav
ab5b7d86de9873807ea9e842dea895699aed696e
6c9c399988c1a881ef7ffca244409ab37ccfd809
refs/heads/master
2022-11-20T20:50:39.850462
2020-07-22T11:26:04
2020-07-22T11:26:04
280,644,121
0
0
null
null
null
null
UTF-8
Java
false
false
837
java
package circulation; /* ABCD分别为不同的几个数字,请编写程序找到符合下面算式的ABCD的值。 A B C A B * A = DDDDDD */ public class DDDDDD { public static void main(String[] args) { int a,b,c,d; for (a=0;a<10;a++) { for(b=0;b<10;b++) { for(c=0;c<10;c++) { for(d=0;d<10;d++) { boolean condition1= (a!=b && a!=c && a!=d && b!=c && b!=d && c!=d); boolean condition2=((10000*a+1000*b+100*c+10*a+b)*a)==d+10*d+100*d+1000*d+10000*d+100000*d; if (condition1 && condition2) { System.out.println(a+""+b+""+c+""+a+b); } } } } } System.out.println("over"); } }
237a4d61986fc30774ccb36a0b2ebfb77b985101
c648d621d62e85a96fd1d79e00b0883ab789716d
/Java/ParkedCode/src/selenium/chapter10/GoogleSearch.java
b4b09f8c8501cc9a51de51135126f138a25daa1f
[]
no_license
horiavitcu/Portfolio-Code
dbe9fac7cd8f3e6fa896be4bb7de4d218252a348
f916a6fb49c7c5c0beb733f15f363ac5a8911fb1
refs/heads/master
2016-09-06T01:09:17.089155
2013-11-10T17:11:07
2013-11-10T17:11:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,166
java
package selenium.chapter10; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.By; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.WebDriverWait; import org.monte.media.math.Rational; import org.monte.media.Format; import org.monte.screenrecorder.ScreenRecorder; import static org.monte.media.AudioFormatKeys.*; import static org.monte.media.VideoFormatKeys.*; import org.junit.*; import static org.junit.Assert.*; import java.awt.*; public class GoogleSearch { private WebDriver driver; private ScreenRecorder screenRecorder; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { // Create an instance of GraphicsConfiguration to get the Graphics configuration // of the Screen. This is needed for ScreenRecorder class. GraphicsConfiguration gc = GraphicsEnvironment .getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration(); // Create a instance of ScreenRecorder with the required configurations screenRecorder = new ScreenRecorder(gc, new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, DepthKey, (int)24, FrameRateKey, Rational.valueOf(15), QualityKey, 1.0f, KeyFrameIntervalKey, (int) (15 * 60)), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey,"black", FrameRateKey, Rational.valueOf(30)), null); // Create a new instance of the Firefox driver driver = new FirefoxDriver(); //Call the start method of ScreenRecorder to begin recording screenRecorder.start(); } @Test public void testGoogleSearch() throws Exception { // And now use this to visit Google driver.get("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit(); try { // Google's search is rendered dynamically with JavaScript. // Wait for the page to load, timeout after 10 seconds (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return d.getTitle().toLowerCase().startsWith("cheese!"); }}); // Should see: "cheese! - Google Search" assertEquals("cheese! - Google Search", driver.getTitle()); } catch (Error e) { //Capture and append Exceptions/Errors verificationErrors.append(e.toString()); } } @After public void tearDown() throws Exception { //Close the browser driver.quit(); // Call the stop method of ScreenRecorder to end the recording screenRecorder.stop(); String verificationErrorString = verificationErrors.toString(); if (!"".equals(verificationErrorString)) { fail(verificationErrorString); } } }
510a06496cbc94d6ef846e2ac30f4941f85a6b3d
f3f844d216486e95cf9a1b5cb49a621dbfd732e1
/src/main/java/com/example/demo/repositort/WarehouseRepository.java
62b1b2331459a7f401c176802f6926003b784b48
[]
no_license
Ilxom1992/spring_model_2_lesson_2_task_1
842639b42d6dbd237a3cd2e343a611b77cce4c27
4804455f642c5a8a692c07d28521814ea3f873f5
refs/heads/master
2023-04-01T07:17:29.709249
2021-04-02T19:33:17
2021-04-02T19:33:17
353,658,924
0
0
null
null
null
null
UTF-8
Java
false
false
522
java
package com.example.demo.repositort; import com.example.demo.entity.Warehouse; import com.example.demo.projection.CustomUser; import com.example.demo.projection.CustomWarehouse; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(path = "warehouse", collectionResourceRel = "list",excerptProjection = CustomWarehouse.class) public interface WarehouseRepository extends JpaRepository<Warehouse, Integer> { }
cc36f2d535a0c62a707c64ac2a30054d1ca88b4b
71301fbf08ca00b1852ed91516280fb26d871da7
/src/main/java/leetcode/LogestIncreasingPathInMatrix.java
b492a2252607a11a1213d4beb4c166ed17a5fe5e
[]
no_license
taku-k/coding-interview
7402772941013e603723d20f754ce4c48744b3f6
91a27e2640461c79302bdad04d949bc0f210eec8
refs/heads/master
2021-01-17T17:24:33.175996
2017-06-11T16:42:03
2017-06-11T16:42:03
64,284,765
0
0
null
null
null
null
UTF-8
Java
false
false
901
java
package leetcode; public class LogestIncreasingPathInMatrix { private static final int[][] dirs = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; public int longestIncreasingPath(int[][] matrix) { if (matrix.length == 0) return 0; int n = matrix.length, m = matrix[0].length; int[][] dp = new int[n][m]; int res = 0; for (int y = 0; y < n; ++y) { for (int x = 0; x < m; ++x) { res = Math.max(res, dfs(matrix, dp, n, m, x, y)); } } return res; } private int dfs(int[][] matrix, int[][] dp, int n, int m, int x, int y) { if (dp[y][x] != 0) return dp[y][x]; int max = 1; for (int[] dir : dirs) { int nx = x + dir[0], ny = y + dir[1]; if (nx >= 0 && nx < m && ny >= 0 && ny < n && matrix[y][x] < matrix[ny][nx]) { max = Math.max(max, dfs(matrix, dp, n, m, nx, ny) + 1); } } dp[y][x] = max; return max; } }
b91e9a0ef11defb118710ab2c26b956ac0c5008f
f37e90775a158ea0ae644e334eac5bba341f4989
/Java+/Libs+/Cloud+/Azure+/MSAL/src/azure/certificate/AuthFilter.java
55c8a2a27787ad722ffbb14871d9660bd686a655
[]
no_license
Aleks-Ya/yaal_examples
0087bbaf314ca5127051c93b89c8fc2dcd14c1e3
ec282968abf1b86e54fc2116c39f2d657b51baac
refs/heads/master
2023-09-01T07:40:44.404550
2023-08-27T15:24:34
2023-08-29T22:01:46
14,327,752
4
2
null
2021-06-16T20:39:19
2013-11-12T09:26:08
Java
UTF-8
Java
false
false
3,869
java
package azure.certificate; import com.microsoft.aad.msal4j.AuthorizationRequestUrlParameters; import com.microsoft.aad.msal4j.Prompt; import com.microsoft.aad.msal4j.PublicClientApplication; import com.microsoft.aad.msal4j.ResponseMode; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.HandlerWrapper; import java.io.IOException; import java.net.MalformedURLException; import java.util.List; import java.util.Set; import java.util.UUID; import static azure.certificate.RedirectHandler.REDIRECT_ENDPOINT; class AuthFilter extends HandlerWrapper { public static final String GRAPH_USER_READ_SCOPE = "https://graph.microsoft.com/User.Read"; private static final List<String> NOT_SECURE_PATHS = List.of(REDIRECT_ENDPOINT); private final String authority; private final String redirectUri; private final String clientId; private final String tokenAttr; private final Set<String> scopes; private static final String USER_COUNTRY_CLAIM = "ctry"; public AuthFilter(String authority, String redirectUri, String clientId, String tokenAttr, Set<String> scopes) { this.authority = authority; this.redirectUri = redirectUri; this.clientId = clientId; this.tokenAttr = tokenAttr; this.scopes = scopes; } @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { var path = request.getPathInfo(); var notSecure = NOT_SECURE_PATHS.stream().anyMatch(path::startsWith); if (notSecure) { System.out.println("Auth not needed for " + path); super.handle(target, baseRequest, request, response); } else { var session = request.getSession(); var accessTokenOpt = SessionHelper.getAccessTokenOptional(request, tokenAttr); if (accessTokenOpt.isEmpty()) { System.out.println("Need authorize session id=" + session.getId()); authenticate(request, response, tokenAttr, clientId); } else { System.out.println("Session is already authorized id=" + session.getId()); super.handle(target, baseRequest, request, response); } } } private void authenticate(HttpServletRequest request, HttpServletResponse response, String tokenAttr, String clientId) throws IOException { var targetUrlPath = request.getPathInfo(); var nonce = UUID.randomUUID().toString(); var stateId = SessionHelper.saveState(request, targetUrlPath, nonce, tokenAttr); // var claims = request.getParameter("claims"); var claims = USER_COUNTRY_CLAIM; var authorizationCodeUrl = getAuthorizationCodeUrl(claims, redirectUri, stateId, nonce, clientId); response.sendRedirect(authorizationCodeUrl); } private String getAuthorizationCodeUrl(String claims, String registeredRedirectURL, String state, String nonce, String clientId) throws MalformedURLException { var pca = PublicClientApplication.builder(clientId).authority(authority).build(); var parameters = AuthorizationRequestUrlParameters .builder(registeredRedirectURL, scopes) .responseMode(ResponseMode.QUERY) .prompt(Prompt.SELECT_ACCOUNT) .state(state) .nonce(nonce) // .claimsChallenge(claims) .build(); var authorizationUrl = pca.getAuthorizationRequestUrl(parameters).toString(); System.out.println("Authorization URL: " + authorizationUrl); return authorizationUrl; } }
73eeeac8cfdb6f88e7d8d0b2f68b908a8ed0acff
105afbad6360cc91d09ebfae51880cec55c7d969
/src/main/java/com/najdiigrac/mk/web/ParticipateRequestController.java
f034e546aa03147ae9865f0daf7fd01cdc07d558
[]
no_license
kirkovg/najdi-igrac-resource
f6c79d9ca97efcce44988c7434b7ea8cd3879f06
15d1c6c732c94ac7285bc86fedbdc89dc94984a9
refs/heads/master
2021-01-21T22:02:08.941555
2017-06-22T21:22:33
2017-06-22T21:22:33
95,154,007
0
0
null
null
null
null
UTF-8
Java
false
false
2,616
java
package com.najdiigrac.mk.web; import com.najdiigrac.mk.model.jpa.Event; import com.najdiigrac.mk.model.jpa.ParticipateRequest; import com.najdiigrac.mk.model.jpa.User; import com.najdiigrac.mk.service.ParticipateRequestService; import com.najdiigrac.mk.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.web.bind.annotation.*; import java.util.List; /** * Created by Dj Ux on 18-Jun-17. */ @RestController @RequestMapping(value = "/api/participateRequests", produces = "application/json") public class ParticipateRequestController { private ParticipateRequestService participateRequestService; private UserService userService; @Autowired public ParticipateRequestController(ParticipateRequestService participateRequestService, UserService userService) { this.participateRequestService = participateRequestService; this.userService = userService; } @RequestMapping(value = "/forAuthenticatedUser", method = RequestMethod.GET) @ResponseBody public List<ParticipateRequest> forAuthenticatedUser() { UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); User currentAuthenticatedUser = userService.findByUserName(userDetails.getUsername()); return participateRequestService.getRequestsSentByUser(currentAuthenticatedUser.id); } @RequestMapping(value = "/getParticipateRequestsForMyEvents", method = RequestMethod.GET) public List<ParticipateRequest> getParticipateRequestsForMyEvents() { UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); User currentAuthenticatedUser = userService.findByUserName(userDetails.getUsername()); List<ParticipateRequest> participateRequests = participateRequestService .getRequestsForAdminOfEvent(currentAuthenticatedUser.id); return participateRequests; } @RequestMapping(value = "/accept/{requestId}", method = RequestMethod.POST) public void acceptParticipatingRequest(@PathVariable Long requestId) { participateRequestService.acceptParticipatingRequest(requestId); } @RequestMapping(value = "/reject/{requestId}", method = RequestMethod.POST) public void rejectParticipatingRequest(@PathVariable Long requestId) { participateRequestService.rejectParticipatingRequest(requestId); } }
4df36e83bf02ffd6c206cb9d1c2ba060292a72ae
f857d6dee05996f018006936ac51ea527966578c
/Veda2TestAutomation/src/com/viteos/veda/master/feederredemptiontestscripts/FeederRedemptionMaster_MakerOperations_TS1.java
94e4c7dda7952a5d4124af9b00b3cf2e18d5cec0
[]
no_license
MummanaSubramanya/VEDA_v2.0_QA
6d736a71507a09f34812fca30a87c444615c9a93
1760e3aacc0d2bc2e620d9080d49ce1dddf1dce6
refs/heads/master
2020-04-23T03:46:58.743651
2016-07-06T07:03:28
2016-07-06T07:03:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,884
java
package com.viteos.veda.master.feederredemptiontestscripts; import java.util.HashMap; import java.util.Map; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.tenx.framework.lib.Messages; import com.tenx.framework.lib.Utilities; import com.tenx.framework.reporting.Reporting; import com.viteos.veda.master.lib.FeederRedemptionAppFunctions; import com.viteos.veda.master.lib.FeederSubscriptionAppFunctions; import com.viteos.veda.master.lib.Global; import com.viteos.veda.master.lib.NewUICommonFunctions; import com.viteos.veda.master.lib.XMLLibrary; public class FeederRedemptionMaster_MakerOperations_TS1 { static boolean bStatus; static String sSheetName = "FeederRedemptionTestData"; @BeforeMethod public static void setUp(){ Reporting.Functionality ="FeederRedemption Master"; Reporting.Testcasename = "Open Application"; Utilities.bscreenShot = false; bStatus = NewUICommonFunctions.loginToApplication(Global.sMakerUserName, Global.sMakerPassword); if(!bStatus){ Reporting.logResults("Fail", "Login into application", "Login to application Failed.Error: "+Messages.errorMsg); Assert.fail(Messages.errorMsg); } Reporting.logResults("Pass", "Login into application ", "Login into application successfully"); } @Test public static void testMakerOperations(){ try{ Map<String, Map<String, String>> mapAllFeederREDMDetailsTestData = Utilities.readMultipleTestData(Global.sFeedeerRedemptionTestDataFilePath, sSheetName, "Y"); for(int index = 1;index <= mapAllFeederREDMDetailsTestData.size();index++){ Map<String, String> mapFeederREDMDetailsTestData = mapAllFeederREDMDetailsTestData.get("Row"+index); Reporting.Testcasename = mapFeederREDMDetailsTestData.get("TestCaseName"); //Navigate to DashBoard bStatus = NewUICommonFunctions.selectMenu("TRADES", "Feeder Redemption"); if(!bStatus){ Reporting.logResults("Fail", "Navigate To Feeder Redemption","Cannot Navigate to Feeder Redemption"); continue; } Reporting.logResults("Pass","Navigate To Feeder Redemption", "Navigated to Feeder Redemption"); //Adding new feeder Redemption. bStatus = FeederRedemptionAppFunctions.AddFeederRedemptionDetails(mapFeederREDMDetailsTestData); if (bStatus && mapFeederREDMDetailsTestData.get("ExpectedResults") != null && mapFeederREDMDetailsTestData.get("ExpectedResults").equalsIgnoreCase("Pass") && mapFeederREDMDetailsTestData.get("OperationType") != null && mapFeederREDMDetailsTestData.get("OperationType").equalsIgnoreCase("Save")) { String sTransactionID = NewUICommonFunctions.getIDFromSuccessMessage(); if (sTransactionID == null || sTransactionID.equalsIgnoreCase("")) { Reporting.logResults("Fail", "Verify Transaction ID generated for the Feeder Redemption addition.", "Transaction ID wasn't generated for the Feeder Redemption addition."+Messages.errorMsg); continue; } Map<String, String> mapXMLLibWriteDetails = new HashMap<String, String>(); mapXMLLibWriteDetails.put("TestcaseName", mapFeederREDMDetailsTestData.get("TestCaseName")); mapXMLLibWriteDetails.put("SearchID", sTransactionID); mapXMLLibWriteDetails.put("MakerStatus", "Pass"); mapXMLLibWriteDetails.put("CheckerStatus", "None"); Map<String ,String> mapXMLSubscriptionDetails = XMLLibrary.getCreatedMasterDataFromXML(XMLLibrary.sFeederREDAccountXMLFilePath, "FeederREDAccount", mapFeederREDMDetailsTestData.get("TestCaseName")); if(mapXMLSubscriptionDetails != null){ XMLLibrary.updatedAttributeValueInCreatedXMLFile(XMLLibrary.sFeederREDAccountXMLFilePath, "SearchID", sTransactionID , "TestcaseName", mapFeederREDMDetailsTestData.get("TestCaseName"), "FeederREDAccount"); XMLLibrary.updatedAttributeValueInCreatedXMLFile(XMLLibrary.sFeederREDAccountXMLFilePath, "MakerStatus", "Pass" , "TestcaseName", mapFeederREDMDetailsTestData.get("TestCaseName"), "FeederREDAccount"); XMLLibrary.updatedAttributeValueInCreatedXMLFile(XMLLibrary.sFeederREDAccountXMLFilePath, "CheckerStatus", "None" , "TestcaseName", mapFeederREDMDetailsTestData.get("TestCaseName"), "FeederREDAccount"); }else{ XMLLibrary.writeFeederREDAccountDetailsToXML(mapXMLLibWriteDetails); } Reporting.logResults("Pass","Perform Maker Operation: "+mapFeederREDMDetailsTestData.get("OperationType"), "Successfully Performed Maker operations."); continue; } if(bStatus && mapFeederREDMDetailsTestData.get("ExpectedResults").equalsIgnoreCase("Pass")){ Reporting.logResults("Pass","Perform Maker Operation: "+mapFeederREDMDetailsTestData.get("OperationType"), "Successfully Performed Maker operations."); continue; } if(!bStatus && mapFeederREDMDetailsTestData.get("ExpectedResults").equalsIgnoreCase("Pass")){ Reporting.logResults("Fail","Perform Maker Operation: "+mapFeederREDMDetailsTestData.get("OperationType"), "Cannot Perform Maker operations : "+Messages.errorMsg); Map<String ,String> mapXMLSubscriptionDetails = XMLLibrary.getCreatedMasterDataFromXML(XMLLibrary.sFeederREDAccountXMLFilePath, "FeederREDAccount", mapFeederREDMDetailsTestData.get("TestCaseName")); if(mapXMLSubscriptionDetails != null){ XMLLibrary.updatedAttributeValueInCreatedXMLFile(XMLLibrary.sFeederREDAccountXMLFilePath, "MakerStatus", "Fail" , "TestcaseName", mapFeederREDMDetailsTestData.get("TestCaseName"), "FeederREDAccount"); XMLLibrary.updatedAttributeValueInCreatedXMLFile(XMLLibrary.sFeederREDAccountXMLFilePath, "CheckerStatus", "None" , "TestcaseName", mapFeederREDMDetailsTestData.get("TestCaseName"), "FeederREDAccount"); } continue; } if(!bStatus && mapFeederREDMDetailsTestData.get("ExpectedResults").equalsIgnoreCase("Fail")){ Reporting.logResults("Pass","Perform Maker Operation: "+mapFeederREDMDetailsTestData.get("OperationType"), "Negative testcase - Cannot Perform Maker operations : "+Messages.errorMsg); continue; } if(bStatus && mapFeederREDMDetailsTestData.get("ExpectedResults").equalsIgnoreCase("Fail")){ Reporting.logResults("Fail","Perform Maker Operation: "+mapFeederREDMDetailsTestData.get("OperationType"), "Able to Peformed Maker operations with negative testdata."); continue; } } } catch(Exception e){ e.printStackTrace(); } } @AfterMethod public static void tearDown(){ Reporting.Testcasename = "Close Application"; bStatus = NewUICommonFunctions.logoutFromApplication(); if(!bStatus){ Reporting.logResults("Fail", "Close Application","Cannot logout from application. Error "+Messages.errorMsg); Assert.fail("Cannot logout from application. Error "+Messages.errorMsg); } Reporting.logResults("Pass","Logout from Application","Logged Out from application successfully"); } }
327b17a2d28fc085ea0a21c3f536d188445f58ed
c67b9f32adbd1903fc87e4831c47045c8998b4fc
/business/src/main/java/com/sg/kata/bankaccount/business/dddframework/BusinessValue.java
be89264546464e16c86a635844b89d8555629b43
[]
no_license
msicsic/bankAccount
65d05ddbeb072ab88e6cc7ef639c829b5b340e9d
ce8888a728d63bf2fa1efc60ca6878919cf8052d
refs/heads/master
2020-09-05T12:44:04.102059
2019-11-06T23:19:57
2019-11-06T23:19:57
220,108,483
0
0
null
null
null
null
UTF-8
Java
false
false
92
java
package com.sg.kata.bankaccount.business.dddframework; public @interface BusinessValue { }
395becf3ade0c2241da08612d27ae2e45ea9a774
fa05b44b791399f51d295f236b0ca951b038abd6
/aliyun-java-sdk-pts/src/main/java/com/aliyuncs/pts/model/v20190810/DescribeRdsByGroupIdRequest.java
ace990311f6b7547c5eca45ff3e994b6780da57e
[ "Apache-2.0" ]
permissive
ybz216/aliyun-openapi-java-sdk
05869fd10e8e9c68ac3d1df99142b3c3599e6e5d
14b77a7b121180b887bcd7a5e6e4dfd6d542128c
refs/heads/master
2022-06-24T03:23:41.762464
2020-05-09T14:54:34
2020-05-09T14:54:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,582
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.pts.model.v20190810; import com.aliyuncs.RpcAcsRequest; import com.aliyuncs.http.MethodType; import com.aliyuncs.pts.Endpoint; /** * @author auto create * @version */ public class DescribeRdsByGroupIdRequest extends RpcAcsRequest<DescribeRdsByGroupIdResponse> { private Long ver; private Long groupId; private Integer pageSize; private String keyWord; private Integer pageNumber; public DescribeRdsByGroupIdRequest() { super("PTS", "2019-08-10", "DescribeRdsByGroupId"); setMethod(MethodType.POST); try { com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap); com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType); } catch (Exception e) {} } public Long getVer() { return this.ver; } public void setVer(Long ver) { this.ver = ver; if(ver != null){ putQueryParameter("Ver", ver.toString()); } } public Long getGroupId() { return this.groupId; } public void setGroupId(Long groupId) { this.groupId = groupId; if(groupId != null){ putQueryParameter("GroupId", groupId.toString()); } } public Integer getPageSize() { return this.pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; if(pageSize != null){ putQueryParameter("PageSize", pageSize.toString()); } } public String getKeyWord() { return this.keyWord; } public void setKeyWord(String keyWord) { this.keyWord = keyWord; if(keyWord != null){ putQueryParameter("KeyWord", keyWord); } } public Integer getPageNumber() { return this.pageNumber; } public void setPageNumber(Integer pageNumber) { this.pageNumber = pageNumber; if(pageNumber != null){ putQueryParameter("PageNumber", pageNumber.toString()); } } @Override public Class<DescribeRdsByGroupIdResponse> getResponseClass() { return DescribeRdsByGroupIdResponse.class; } }
b913368fd0504a2154f04b45eefa0d5b81ae2ab8
fba8af31d5d36d8a6cf0c341faed98b6cd5ec0cb
/src/main/java/com/alipay/api/response/KoubeiMarketingDataTradeHabbitQueryResponse.java
721048d3605e76835115c640cfa446c50336ad56
[ "Apache-2.0" ]
permissive
planesweep/alipay-sdk-java-all
b60ea1437e3377582bd08c61f942018891ce7762
637edbcc5ed137c2b55064521f24b675c3080e37
refs/heads/master
2020-12-12T09:23:19.133661
2020-01-09T11:04:31
2020-01-09T11:04:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,682
java
package com.alipay.api.response; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.AlipayResponse; /** * ALIPAY API: koubei.marketing.data.trade.habbit.query response. * * @author auto create * @since 1.0, 2019-01-07 20:51:15 */ public class KoubeiMarketingDataTradeHabbitQueryResponse extends AlipayResponse { private static final long serialVersionUID = 2837679753139948336L; /** * biz_date: 业务日期 格式:yyyyMMdd partner_industry_type:商户行业标识(轻餐or正餐) shop_id: 门店id shop_name: 门店名称 trade_again_ratio_7d: (近7天)复购率 trade_again_ratio_active_7d: (近7天)复购率(口碑活跃用户) trade_user_cnt_7d: (近7天)交易会员数 trade_user_cnt_active_7d: (近7天)交易活跃会员数(口碑活跃用户贡献) zdj_order_amt_7d: (近7天)桌单价(订单金额)(单位:分) zdj_service_amt_7d: (近7天)桌单价(实收金额)(单位:分) zdj_service_amt_distribution_7d: (近7天)桌单价(实收金额)段分布(示例:0-15:0.2799,15-20:0.1775,20-25:0.1058,25-30:0.0956,30-35:0.0648,35-40:0.0751,40-45:0.0444,45-50:0.0137,50-55:0.0171,55及以上:0.1263 意思是消费0-15元的比例占消费总人数的0.2799) 注意:出参中还包含30天/60天/90天的类似指标,篇幅有限不一一列举 */ @ApiField("trade_habit_info") private String tradeHabitInfo; public void setTradeHabitInfo(String tradeHabitInfo) { this.tradeHabitInfo = tradeHabitInfo; } public String getTradeHabitInfo( ) { return this.tradeHabitInfo; } }
9680117b53c3527c07b15e7d969f5d5a1032bb2c
b42b9d61246d593de5f3f90d9d23abd955c917eb
/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/repository/spi/AbstractGitCommandTest.java
0b7e8e059ef6691969727cbc2252c28a4cae8d5b
[ "MIT" ]
permissive
scm-manager/scm-manager
0795574c11cf412b15221e672b5e1e10d272fdda
de813efcb1d9f42ce8062e219b678c4feb8f48de
refs/heads/develop
2023-08-27T22:58:18.440765
2023-08-25T12:50:18
2023-08-25T12:50:18
245,964,662
124
31
MIT
2023-08-17T15:45:31
2020-03-09T06:57:28
Java
UTF-8
Java
false
false
4,357
java
/* * MIT License * * Copyright (c) 2020-present Cloudogu GmbH and Contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package sonia.scm.repository.spi; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import org.awaitility.Awaitility; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.Repository; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import sonia.scm.ConcurrentModificationException; import sonia.scm.repository.work.NoneCachingWorkingCopyPool; import sonia.scm.repository.work.WorkdirProvider; import java.io.IOException; import java.util.concurrent.CountDownLatch; public class AbstractGitCommandTest extends AbstractGitCommandTestBase { @Rule public BindTransportProtocolRule transportProtocolRule = new BindTransportProtocolRule(); @Rule public TemporaryFolder cloneFolder = new TemporaryFolder(); private final CountDownLatch createdWorkingCopyLatch = new CountDownLatch(1); private final CountDownLatch createdConflictingCommitLatch = new CountDownLatch(1); private boolean gotConflict = false; @Override protected String getZippedRepositoryResource() { return "sonia/scm/repository/spi/scm-git-spi-test.zip"; } @Test public void shouldNotOverwriteConcurrentCommit() throws GitAPIException, IOException, InterruptedException { GitContext context = createContext(); SimpleGitCommand command = new SimpleGitCommand(context); Repository repo = context.open(); new Thread(() -> { try { command.doSomething(); } catch (Exception e) { throw new RuntimeException(e); } }).start(); Git clone = Git .cloneRepository() .setURI(repo.getDirectory().toString()) .setDirectory(cloneFolder.newFolder()) .call(); // somehow we have to wait here, though we don't know why Thread.sleep(1000); createdWorkingCopyLatch.await(); createCommit(clone); clone.push().call(); createdConflictingCommitLatch.countDown(); Awaitility.await().until(() -> gotConflict); } private class SimpleGitCommand extends AbstractGitCommand { SimpleGitCommand(GitContext context) { super(context); } void doSomething() { inClone( git -> new Worker(context, repository, git), new SimpleGitWorkingCopyFactory(new NoneCachingWorkingCopyPool(new WorkdirProvider(repositoryLocationResolver)), new SimpleMeterRegistry()), "master" ); } } private synchronized void createCommit(Git git) throws GitAPIException { git.commit().setMessage("Add new commit").call(); } private class Worker extends AbstractGitCommand.GitCloneWorker<Void> { private final Git git; private Worker(GitContext context, sonia.scm.repository.Repository repository, Git git) { super(git, context, repository); this.git = git; } @Override Void run() { try { createCommit(git); createdWorkingCopyLatch.countDown(); createdConflictingCommitLatch.await(); push("master"); } catch (ConcurrentModificationException e) { gotConflict = true; } catch (Exception e) { throw new RuntimeException(e); } return null; } } }
b3f26e2bcf449eaa1b5cf8eb24c9c56edbcda91d
421f0a75a6b62c5af62f89595be61f406328113b
/generated_tests/model_seeding/6_jnfe-br.com.jnfe.base.ProcEmi-1.0-10/br/com/jnfe/base/ProcEmi_ESTest.java
1f3e0a91be1ef02a23385b1a06e69eb8ff2e3980
[]
no_license
tigerqiu712/evosuite-model-seeding-empirical-evaluation
c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6
11a920b8213d9855082d3946233731c843baf7bc
refs/heads/master
2020-12-23T21:04:12.152289
2019-10-30T08:02:29
2019-10-30T08:02:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
636
java
/* * This file was automatically generated by EvoSuite * Sat Oct 26 01:32:10 GMT 2019 */ package br.com.jnfe.base; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class ProcEmi_ESTest extends ProcEmi_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
b250fc2aff8449964dba5ee184d31b9f6e655b6e
890a649bda1d21b1e1250641df673b331de35bf0
/src/main/java/com/coronation/collections/domain/IEntity.java
2cbdb39b626fc21200f91a135f89622c0425f555
[]
no_license
oagunbiade/Collections
342260ab1647fa83e7cc0e545b08cf13fc114b46
fe4d9f30d37d33cbc04e89bccc37fa9e502aa908
refs/heads/master
2020-05-06T12:23:55.821189
2019-04-26T10:18:37
2019-04-26T10:18:37
180,120,721
0
0
null
2019-04-08T10:13:12
2019-04-08T09:57:50
null
UTF-8
Java
false
false
131
java
package com.coronation.collections.domain; /** * Created by Toyin on 4/23/19. */ public interface IEntity { Long getId(); }
77521e827aeefb685f279125da7f259186885ebb
9182d336f5ef7dbb7e35b10803ca9d8e7f0e7c57
/UHCL_EmailSystem_2_1/src/java/Login.java
a93b5fe34db2e04c4626bffd5843d8a385034138
[]
no_license
SaleelaA/WebMailSystem
caf7dacc5275d85b847d6d1421035cdd20c4d2fa
e5e9977b85796ec8ff0d0ff8fe190f3918c9df81
refs/heads/master
2020-03-23T13:47:45.360031
2018-07-19T22:47:14
2018-07-19T22:47:14
141,637,722
0
0
null
null
null
null
UTF-8
Java
false
false
3,081
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import javax.inject.Named; import java.io.Serializable; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Scanner; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; // divya code starts here @ManagedBean @SessionScoped public class Login implements Serializable { private String id; private String password; EmailAccount theLoginAccount; //get methods and set methods public String getId() { return id; } public String getPassword() { return password; } public EmailAccount getTheLoginAccount() { return theLoginAccount; } public void setId(String id) { this.id = id; } public void setPassword(String password) { this.password = password; } public String login() { try { Class.forName("com.mysql.jdbc.Driver"); } catch (Exception e) { return ("internalError"); } final String DATABASE_URL = "jdbc:mysql://mis-sql.uhcl.edu/chinthabathis58"; Connection connection = null; Statement statement = null; ResultSet resultSet = null; try { //connect to the databse connection = DriverManager.getConnection(DATABASE_URL, "chinthabathis58", "1560843"); //create statement statement = connection.createStatement(); //search the accountID in the onlineAccount table resultSet = statement.executeQuery("Select * from emailaccount1 " + "where id = '" + id + "'"); if (resultSet.next()) { //the id is found, check the password if (password.equals(resultSet.getString(2))) { //password is good theLoginAccount = new EmailAccount(id, password, resultSet.getString(3)); //go to the welcome page return "welcome"; } else { //password is not correct id = ""; password = ""; return ("loginNotOK"); } } else { id = ""; password = ""; return ("loginNotOK"); } } catch (SQLException e) { e.printStackTrace(); return ("internalError"); } finally { //close the database try { connection.close(); statement.close(); resultSet.close(); } catch (Exception e) { e.printStackTrace(); } } } } // divya code ends here
c926b7ea17150f1c63fac9d653c2b412dc54f24f
f7cb94ce6b9e18f12ec2f1e41b675c194524906d
/src/projectsmkn8/LoginGuru.java
79dcfe6457e5254832e8e8b99860c7fbc839a5d1
[]
no_license
diimasbayu/Encryption-AES-256
9996097c25cf6114355b2302a5be42cc1d1040f1
4a941234a42e9b8c8843966a9ea19e5855289906
refs/heads/master
2021-05-10T17:05:46.885788
2018-01-23T10:59:00
2018-01-23T10:59:00
118,597,847
0
0
null
null
null
null
UTF-8
Java
false
false
13,140
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package projectsmkn8; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.SimpleDateFormat; import java.util.Locale; import javax.swing.JOptionPane; import javax.swing.Timer; /** * * @author AdiRahmad */ public class LoginGuru extends javax.swing.JFrame { java.util.Date tglsekarang = new java.util.Date(); private SimpleDateFormat smpdtfmt = new SimpleDateFormat("dd MMMMMMMMM yyyy", Locale.getDefault()); private String tanggal = smpdtfmt.format(tglsekarang); final void setJam(){ ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { String nol_jam = "", nol_menit = "",nol_detik = ""; java.util.Date dateTime = new java.util.Date(); int nilai_jam = dateTime.getHours(); int nilai_menit = dateTime.getMinutes(); int nilai_detik = dateTime.getSeconds(); if(nilai_jam <= 9) nol_jam= "0"; if(nilai_menit <= 9) nol_menit= "0"; if(nilai_detik <= 9) nol_detik= "0"; String jam = nol_jam + Integer.toString(nilai_jam); String menit = nol_menit + Integer.toString(nilai_menit); String detik = nol_detik + Integer.toString(nilai_detik); lbljam1.setText(jam+":"+menit+":"+detik+""); } }; new Timer(1000, taskPerformer).start(); } /** * Creates new form LoginGuru */ public LoginGuru() { initComponents(); lbltgl.setText(tanggal); setJam(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtId = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtPass = new javax.swing.JPasswordField(); btnLogin = new javax.swing.JButton(); btnKeluar = new javax.swing.JButton(); lbltgl = new javax.swing.JLabel(); lbljam1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setUndecorated(true); setResizable(false); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/projectsmkn8/Image/Banner Decrypt.jpg"))); // NOI18N jLabel1.setText("jLabel1"); jLabel2.setFont(new java.awt.Font("Verdana", 0, 14)); // NOI18N jLabel2.setText("Id Guru : "); txtId.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtIdActionPerformed(evt); } }); jLabel3.setFont(new java.awt.Font("Verdana", 0, 14)); // NOI18N jLabel3.setText("Password :"); btnLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/projectsmkn8/Image/Login.png"))); // NOI18N btnLogin.setOpaque(false); btnLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLoginActionPerformed(evt); } }); btnKeluar.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")); btnKeluar.setForeground(new java.awt.Color(255, 255, 255)); btnKeluar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/projectsmkn8/Image/power-icon (1).png"))); // NOI18N btnKeluar.setOpaque(false); btnKeluar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnKeluarActionPerformed(evt); } }); lbltgl.setText("tanggal"); lbljam1.setText("jam"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGap(199, 199, 199) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnLogin) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btnKeluar, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtPass, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel2) .addGap(18, 18, 18) .addComponent(txtId, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(lbljam1, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26)) .addComponent(lbltgl, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 625, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(199, 199, 199)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(txtId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(17, 17, 17) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(txtPass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnLogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnKeluar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(lbltgl) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lbljam1))) .addContainerGap()) ); setSize(new java.awt.Dimension(625, 295)); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void txtIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtIdActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtIdActionPerformed void LoginGuru (){ try{ String Id = txtId.getText(); String Pass = txtPass.getText(); Koneksi ObjKoneksi = new Koneksi(); Connection con = ObjKoneksi.buka(); Statement st = con.createStatement(); String sql = "SELECT * FROM guru WHERE id_guru ='"+Id+"'"+"AND password='"+Pass+"'"; ResultSet rs= st.executeQuery(sql); if (rs.next()){ new GuruMenu().show(); dispose(); } else{ Bersih(); JOptionPane.showMessageDialog(null, "Harap Periksa Id Dan Password anda"); } }catch (SQLException e){ JOptionPane.showMessageDialog(null, "Harap periksa kembali"+e); } } void Bersih (){ txtId.setText(""); txtPass.setText(""); txtId.requestFocus(); } private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed LoginGuru(); // TODO add your handling code here: }//GEN-LAST:event_btnLoginActionPerformed private void btnKeluarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnKeluarActionPerformed dispose(); // TODO add your handling code here: }//GEN-LAST:event_btnKeluarActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(LoginGuru.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(LoginGuru.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(LoginGuru.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(LoginGuru.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new LoginGuru().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnKeluar; private javax.swing.JButton btnLogin; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel lbljam1; private javax.swing.JLabel lbltgl; private javax.swing.JTextField txtId; private javax.swing.JPasswordField txtPass; // End of variables declaration//GEN-END:variables }
49a4986494813492fcf72f3c5564d9032a7044e9
f5cf8cfbaeca20b1fc1de3508e2985dc1b1fa863
/jforgame-merge/src/main/java/com/kingston/jforgame/merge/service/CleanService.java
59148ad1d9f23e466f37e9a73efd87a69b81bf2b
[ "Apache-2.0" ]
permissive
LeonXia/jforgame
0ee2bfbeeb2e9eb668de5959a8e20e93e4b4aa3f
3aa34f18a641291929f602b6c63d561ca7f65731
refs/heads/master
2020-12-26T15:51:13.136228
2020-01-29T14:44:00
2020-01-29T14:44:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,302
java
package com.kingston.jforgame.merge.service; import com.kingston.jforgame.merge.config.MergeConfig; import com.kingston.jforgame.merge.config.MergeServer; import com.kingston.jforgame.merge.utils.JdbcUtils; import com.kingston.jforgame.merge.utils.SqlFactory; import org.apache.commons.dbutils.DbUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.Connection; import java.sql.SQLException; import java.util.List; public class CleanService { private static CleanService self = new CleanService(); private Logger logger = LoggerFactory.getLogger(CleanService.class); public static CleanService getInstance() { return self; } public void clearRubbish(MergeServer parent, List<MergeServer> children) { if (parent != null) { clear(parent); } if (children != null) { children.forEach(this::clear); } } private void clear(MergeServer server) { logger.error("开始对服务[{}]执行清档逻辑", server.getServerId()); MergeConfig config = MergeConfig.getInstance(); String sql = SqlFactory.createClearPlayerSql(config.getClear().getMinLevel(), config.getClear().getOfflineDays()); logger.info("清档sql为 {}", sql); Connection targetConn = JdbcUtils.getConnection(server); int beforeCount = JdbcUtils.queryRecordSum(targetConn, "SELECT COUNT(1) FROM t_role;"); logger.info("清档前[{}]服角色数量为{}", server.getServerId(), beforeCount); // JdbcUtils.execUpdate(targetConn, sql); int afterCount = JdbcUtils.queryRecordSum(targetConn, "SELECT COUNT(1) FROM t_role;"); logger.info("清档前[{}]角色数量为{}", server.getServerId(), afterCount); List<String> clearTables = MergedTableRegister.getInstance().listToDeleteTables(); for (String table : clearTables) { logger.info("清空[{}]服【{}】表数据", server.getServerId(), table); String delSql = SqlFactory.createDeleteTableSql(table); JdbcUtils.execUpdate(targetConn, delSql); } try { DbUtils.close(targetConn); } catch (SQLException e) { logger.error("", e); throw new RuntimeException(""); } } }
a58f31245a373214fb35cdc31bbb5a5cc7b77ea4
38899ba092d311d829c734b910e7479c261a8139
/app/src/main/java/com/avilaksh/ecomtemplates/photoview/view/IPhotoView.java
944d882b5be61f0045a43fa70b75b635a0528641
[]
no_license
TarunPal3551/Ecommerece
162824f4b5600c6adc4bb5f023aa9b91387cbeda
ef1ec0959595fc3cd29fcaea64bf72fe10f8a844
refs/heads/master
2020-04-01T11:03:26.170510
2018-10-15T16:54:41
2018-10-15T16:54:41
153,144,831
0
1
null
null
null
null
UTF-8
Java
false
false
11,819
java
/******************************************************************************* * Copyright 2011, 2012 Chris Banes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ package com.avilaksh.ecomtemplates.photoview.view; import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.RectF; import android.view.GestureDetector; import android.view.View; import android.widget.ImageView; public interface IPhotoView { public static final float DEFAULT_MAX_SCALE = 3.0f; public static final float DEFAULT_MID_SCALE = 1.75f; public static final float DEFAULT_MIN_SCALE = 1.0f; public static final int DEFAULT_ZOOM_DURATION = 200; /** * Returns true if the PhotoView is set to allow zooming of Photos. * * @return true if the PhotoView allows zooming. */ boolean canZoom(); /** * Gets the Display Rectangle of the currently displayed Drawable. The Rectangle is relative to * this View and includes all scaling and translations. * * @return - RectF of Displayed Drawable */ RectF getDisplayRect(); /** * Sets the Display Matrix of the currently displayed Drawable. The Rectangle is considered * relative to this View and includes all scaling and translations. * * @param finalMatrix target matrix to set PhotoView to * @return - true if rectangle was applied successfully */ boolean setDisplayMatrix(Matrix finalMatrix); /** * Gets the Display Matrix of the currently displayed Drawable. The Rectangle is considered * relative to this View and includes all scaling and translations. * * @return - true if rectangle was applied successfully */ Matrix getDisplayMatrix(); /** * Use {@link #getMinimumScale()} instead, this will be removed in future release * * @return The current minimum scale level. What this value represents depends on the current * {@link ImageView.ScaleType}. */ @Deprecated float getMinScale(); /** * @return The current minimum scale level. What this value represents depends on the current * {@link ImageView.ScaleType}. */ float getMinimumScale(); /** * Use {@link #getMediumScale()} instead, this will be removed in future release * * @return The current middle scale level. What this value represents depends on the current * {@link ImageView.ScaleType}. */ @Deprecated float getMidScale(); /** * @return The current medium scale level. What this value represents depends on the current * {@link ImageView.ScaleType}. */ float getMediumScale(); /** * Use {@link #getMaximumScale()} instead, this will be removed in future release * * @return The current maximum scale level. What this value represents depends on the current * {@link ImageView.ScaleType}. */ @Deprecated float getMaxScale(); /** * @return The current maximum scale level. What this value represents depends on the current * {@link ImageView.ScaleType}. */ float getMaximumScale(); /** * Returns the current scale value * * @return float - current scale value */ float getScale(); /** * Return the current scale type in use by the ImageView. * * @return current ImageView.ScaleType */ ImageView.ScaleType getScaleType(); /** * Whether to allow the ImageView's parent to intercept the touch event when the photo is scroll * to it's horizontal edge. * * @param allow whether to allow intercepting by parent element or not */ void setAllowParentInterceptOnEdge(boolean allow); /** * Use {@link #setMinimumScale(float minimumScale)} instead, this will be removed in future * release * <p>&nbsp;</p> * Sets the minimum scale level. What this value represents depends on the current {@link * ImageView.ScaleType}. * * @param minScale minimum allowed scale */ @Deprecated void setMinScale(float minScale); /** * Sets the minimum scale level. What this value represents depends on the current {@link * ImageView.ScaleType}. * * @param minimumScale minimum allowed scale */ void setMinimumScale(float minimumScale); /** * Use {@link #setMediumScale(float mediumScale)} instead, this will be removed in future * release * <p>&nbsp;</p> * Sets the middle scale level. What this value represents depends on the current {@link * ImageView.ScaleType}. * * @param midScale medium scale preset */ @Deprecated void setMidScale(float midScale); /* * Sets the medium scale level. What this value represents depends on the current {@link android.widget.ImageView.ScaleType}. * * @param mediumScale medium scale preset */ void setMediumScale(float mediumScale); /** * Use {@link #setMaximumScale(float maximumScale)} instead, this will be removed in future * release * <p>&nbsp;</p> * Sets the maximum scale level. What this value represents depends on the current {@link * ImageView.ScaleType}. * * @param maxScale maximum allowed scale preset */ @Deprecated void setMaxScale(float maxScale); /** * Sets the maximum scale level. What this value represents depends on the current {@link * ImageView.ScaleType}. * * @param maximumScale maximum allowed scale preset */ void setMaximumScale(float maximumScale); /** * Allows to set all three scale levels at once, so you don't run into problem with setting * medium/minimum scale before the maximum one * * @param minimumScale minimum allowed scale * @param mediumScale medium allowed scale * @param maximumScale maximum allowed scale preset */ void setScaleLevels(float minimumScale, float mediumScale, float maximumScale); /** * Register a callback to be invoked when the Photo displayed by this view is long-pressed. * * @param listener - Listener to be registered. */ void setOnLongClickListener(View.OnLongClickListener listener); /** * Register a callback to be invoked when the Matrix has changed for this View. An example would * be the user panning or scaling the Photo. * * @param listener - Listener to be registered. */ void setOnMatrixChangeListener(PhotoViewAttacher.OnMatrixChangedListener listener); /** * Register a callback to be invoked when the Photo displayed by this View is tapped with a * single tap. * * @param listener - Listener to be registered. */ void setOnPhotoTapListener(PhotoViewAttacher.OnPhotoTapListener listener); /** * Returns a listener to be invoked when the Photo displayed by this View is tapped with a * single tap. * * @return PhotoViewAttacher.OnPhotoTapListener currently set, may be null */ PhotoViewAttacher.OnPhotoTapListener getOnPhotoTapListener(); /** * Register a callback to be invoked when the View is tapped with a single tap. * * @param listener - Listener to be registered. */ void setOnViewTapListener(PhotoViewAttacher.OnViewTapListener listener); /** * Enables rotation via PhotoView internal functions. * * @param rotationDegree - Degree to rotate PhotoView to, should be in range 0 to 360 */ void setRotationTo(float rotationDegree); /** * Enables rotation via PhotoView internal functions. * * @param rotationDegree - Degree to rotate PhotoView by, should be in range 0 to 360 */ void setRotationBy(float rotationDegree); /** * Returns a callback listener to be invoked when the View is tapped with a single tap. * * @return PhotoViewAttacher.OnViewTapListener currently set, may be null */ PhotoViewAttacher.OnViewTapListener getOnViewTapListener(); /** * Changes the current scale to the specified value. * * @param scale - Value to scale to */ void setScale(float scale); /** * Changes the current scale to the specified value. * * @param scale - Value to scale to * @param animate - Whether to animate the scale */ void setScale(float scale, boolean animate); /** * Changes the current scale to the specified value, around the given focal point. * * @param scale - Value to scale to * @param focalX - X Focus Point * @param focalY - Y Focus Point * @param animate - Whether to animate the scale */ void setScale(float scale, float focalX, float focalY, boolean animate); /** * Controls how the image should be resized or moved to match the size of the ImageView. Any * scaling or panning will happen within the confines of this {@link * ImageView.ScaleType}. * * @param scaleType - The desired scaling mode. */ void setScaleType(ImageView.ScaleType scaleType); /** * Allows you to enable/disable the zoom functionality on the ImageView. When disable the * ImageView reverts to using the FIT_CENTER matrix. * * @param zoomable - Whether the zoom functionality is enabled. */ void setZoomable(boolean zoomable); /** * Enables rotation via PhotoView internal functions. Name is chosen so it won't collide with * View.setRotation(float) in API since 11 * * @param rotationDegree - Degree to rotate PhotoView to, should be in range 0 to 360 * @deprecated use {@link #setRotationTo(float)} */ void setPhotoViewRotation(float rotationDegree); /** * Extracts currently visible area to Bitmap object, if there is no image loaded yet or the * ImageView is already destroyed, returns {@code null} * * @return currently visible area as bitmap or null */ Bitmap getVisibleRectangleBitmap(); /** * Allows to change zoom transition speed, default value is 200 (PhotoViewAttacher.DEFAULT_ZOOM_DURATION). * Will default to 200 if provided negative value * * @param milliseconds duration of zoom interpolation */ void setZoomTransitionDuration(int milliseconds); /** * Will return instance of IPhotoView (eg. PhotoViewAttacher), can be used to provide better * integration * * @return IPhotoView implementation instance if available, null if not */ IPhotoView getIPhotoViewImplementation(); /** * Sets custom double tap listener, to intercept default given functions. To reset behavior to * default, you can just pass in "null" or public field of PhotoViewAttacher.defaultOnDoubleTapListener * * @param newOnDoubleTapListener custom OnDoubleTapListener to be set on ImageView */ void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener newOnDoubleTapListener); /** * Will report back about scale changes * * @param onScaleChangeListener OnScaleChangeListener instance */ void setOnScaleChangeListener(PhotoViewAttacher.OnScaleChangeListener onScaleChangeListener); }
7c6bc54b2f3cd33e8d9743fda18eeb16f7308579
28361145f030144fe1184bddea9933d0e9cf157f
/src/main/java/org/mcupdater/mojang/nbt/TagList.java
abc48dce471e336504df204db18a6ecf16be4ef2
[ "Apache-2.0" ]
permissive
MCUpdater/MCU-API
2121e6771a5d6f67afd74fd91aaa565055e4d292
1e898a37ae1bf9c2c58a3ee0ec51123c119308fc
refs/heads/master
2023-07-07T01:19:22.758639
2022-09-03T21:48:53
2022-09-03T21:48:53
15,918,707
2
7
Apache-2.0
2022-09-03T21:48:54
2014-01-14T23:08:36
Java
UTF-8
Java
false
false
1,879
java
package org.mcupdater.mojang.nbt; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; /** * Created by sbarbour on 2/15/15. */ public class TagList extends Tag { private final List<Tag> values; private final NBTType type; public TagList(String name, NBTType type) { super(name); this.type = type; this.values = new ArrayList<>(); } @Override public List<Tag> getValue() { return this.values; } @Override public byte[] toBytes(boolean doHeader) { byte[] header = new byte[0]; if (doHeader) { header = super.getHeader(NBTType.LIST.getValue()); } List<byte[]> children = new ArrayList<>(); int totalBytes = header.length + 5; for (Tag entry : values) { byte[] child = entry.toBytes(false); totalBytes += child.length; children.add(child); } ByteBuffer bb = ByteBuffer.allocate(totalBytes); bb.order(ByteOrder.BIG_ENDIAN); bb.put(header); bb.put(type.getValue()); bb.putInt(values.size()); for (byte[] child : children) { bb.put(child); } bb.rewind(); return bb.array(); } @Override public void add(Tag entry) { values.add(entry); } @Override public String toString() { StringBuilder output = new StringBuilder(); if (!this.getName().isEmpty()) { output.append(String.format("@name=%s ",this.getName())); } output.append(String.format("@type=%s @size=%d List: {",this.type.name(),this.values.size())).append("\n"); for (Tag child : values) { output.append(child.toString()).append("\n"); } output.append("}"); return output.toString(); } }
7d91b6ae2bd7ca34c121655f40f1431e8ea50380
f55f7173f20183a277a044ab6df0beaf0df51cda
/Java_Framework/src/com/hrms/TestScripts/TC_003.java
bef38ff0897245d32fe4ba1d7a78692c82a861ad
[]
no_license
ShivaMaragoni/MyProject
53efa608e2dac11edd29364dd2539c8b4b780304
af85cd98fe587b4d49fc37149784c391b48cec14
refs/heads/master
2022-12-26T01:42:09.428346
2020-08-04T11:50:36
2020-08-04T11:50:36
284,451,191
0
0
null
2020-10-14T00:07:16
2020-08-02T11:49:30
HTML
UTF-8
Java
false
false
463
java
package com.hrms.TestScripts; import org.testng.annotations.Test; import com.hrms.lib.General; public class TC_003 { @Test public void Run() throws Exception { General g=new General(); g.openApplication(); g.Login(); g.Title(); g.Text(); // g.Add_btn(); // g.add_emp1(); // g.Back_btn(); // g.delete_btn(); g.MouseOver(); g.Search(); // g.Alert(); // g.Add_btn(); // g.add_emp1(); // g.Back_btn(); g.logout(); g.close(); } }
502c4f2edbb0f5ac05aadbb0f2c9e717d014bf5a
109647d22f54652a633e6fdc3313c263eafa2f47
/app/src/main/java/com/example/hou/algorithminjava/leetcode/Solution.java
658d9499d296926e3c463cd426d96f9d1db4ee99
[]
no_license
Maskedheroe/algorithmInJava
4145733bdc3e50805b5a9c024a5ea19eae9c818c
1b613a036fd4f8dbf76d09852d8b054aa08d4fda
refs/heads/master
2020-03-29T09:38:56.952863
2019-03-23T09:23:51
2019-03-23T09:23:51
149,767,943
1
0
null
2018-11-14T14:36:30
2018-09-21T13:33:51
Java
UTF-8
Java
false
false
754
java
class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } class Solution { private boolean isBalance(TreeNode root){ if(root == null) return true; int left_height = height(root.left); int right_height = height(root.right); if(Math.abs(left_height - right_height) > 1) return false; else return isBalance(root.left) && isBalance(root.right); } private int height(TreeNode root) { if (root == null) return 0; int left_height = height(root.left); int right_height = height(root.right); return 1 + (left_height > right_height ? left_height : right_height); } }
3325d0f10dd9660ef15d62bf099b65e83fc97fed
5f0fd924d5dc18f3b5db9f87796c4e65f6c96ccc
/src/test/java/OpcoUserActions/GDSP_OpcoGUI_033_IMPCLASS.java
7286104155fc55272805f9accce1b787b6f94cc6
[]
no_license
jyotsnajuli09/Automation
25cab0ec368997448acebcf35ad5cb7f72b8c380
a0e75b7151b9614b8bec0588e31fe28188d057f1
refs/heads/master
2021-04-27T07:20:44.410436
2018-02-23T14:06:29
2018-02-23T14:06:29
122,627,037
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
java
package OpcoUserActions; import genericLibrary.CurrentDateTime; import java.util.Map; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.PageFactory; import org.testng.annotations.Test; import com.aventstack.extentreports.Status; public class GDSP_OpcoGUI_033_IMPCLASS extends BaseExtent { public WebDriver driver; public String tcid; public String now; @Test(dataProvider="TC_033",dataProviderClass=DataprovidersOpco.GDSP_033.class) public void TC_033(Map hm) throws Exception{ System.setProperty("webdriver.chrome.driver","./src/test/resources/exe_files/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); PageFactory.initElements(driver, GDSP_OpcoGUI_033.class); GDSP_OpcoGUI_033 obj = new GDSP_OpcoGUI_033(driver); String url = genericLibrary.ReadProperty.readURL(); String uid= genericLibrary.ReadProperty.readUnameOpco(); String pass = genericLibrary.ReadProperty.readPwdOpco(); String tcid = hm.get("TC_ID").toString(); String now = CurrentDateTime.get_datetimestamp(); String custname= hm.get("CUSTNAME").toString(); String certificatename=hm.get("CertificateName").toString(); driver.get(url); //driver.get("http://158.234.62.77:8080/GDSPGui/login.htm"); String tc_desc= hm.get("TC_DESC").toString(); test=extent.createTest(tcid + " "+tc_desc); // To login obj.login(uid, pass,test,tcid); test.log(Status.INFO, "Login is successful"); obj.searchcustomerandcertificatesdelete(custname,certificatename, test, tcid); driver.quit(); } }
8b66d030748b900d650d6e8c90a04fc3e70528ae
3ef08872401d8f92b25b966f60cf13859eeadc56
/app/src/main/java/com/opentouhou/opentouhouandroid/scene/stages/Compatible20/OpenGLES20Test.java
34fa267e86fa62f372dc7f6e2dc01e213ffc2e80
[ "CC-BY-4.0", "Apache-2.0" ]
permissive
opentouhouproject/OpenTouhouAndroid
dacaa74fd27252b0a291384b6007f5e98021fb3b
0a2904188f0d0a34ea492f5821503df00e99e1a0
refs/heads/master
2023-05-25T07:56:08.624412
2023-05-14T14:13:23
2023-05-14T14:13:23
174,387,071
4
0
null
null
null
null
UTF-8
Java
false
false
1,291
java
package com.opentouhou.opentouhouandroid.scene.stages.Compatible20; import android.content.Context; import com.scarlet.audio.opensles.AudioPlayer; import com.scarlet.io.FileManager; import com.scarlet.opengles20.Renderer20; import com.scarlet.scene.Stage; import com.opentouhou.opentouhouandroid.scene.scenes.loadingscreen.LoadingScreen20; public class OpenGLES20Test extends Stage { // Scenes private LoadingScreen20 loadingScreen; /* * Constructor(s). */ public OpenGLES20Test(String name, Context context) { super(name); renderer = new Renderer20(this); audioPlayer = new AudioPlayer(context); fileManager = new FileManager(context); } // Implement Stage. public void setup() { // Load the scenes. loadingScreen = new LoadingScreen20("TEST", this); loadingScreen.setup(); // Set the current scene. setCurrentScene(loadingScreen); // Start the audio. getAudioPlayer().play("audio/music/loadingMusic.mp3"); } /* * Implement the handleInput method. */ public void handleInput() { // do nothing } public void update() { getCurrentScene().update(); } public void draw() { getCurrentScene().draw(); } }
2eb175cdd5d7c27981dfea59443a693ea2db3c97
911c12bd631dc0d7323b9e202cf5c5e1ab2647ef
/lesson3/src/main/java/br/com/splessons/domain/impl/CommunicationQualifiedImpl.java
1ad509e26b47a1d2af94bf75680d40a8c3d68a40
[ "MIT" ]
permissive
marcellorego/SpringLabs
ce7f1228f801872adef850361b4e0a9695977c3a
683c8db152f76500538e34e9fed0a57a83300d79
refs/heads/master
2020-12-24T11:45:14.986859
2018-10-11T21:44:42
2018-10-11T21:44:42
73,019,854
0
0
null
null
null
null
UTF-8
Java
false
false
1,402
java
package br.com.splessons.domain.impl; import java.util.concurrent.atomic.AtomicInteger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import br.com.splessons.domain.ICommunication; import br.com.splessons.domain.IEncryption; import br.com.splessons.domain.IMessaging; @Component("communicationQualified") public class CommunicationQualifiedImpl implements ICommunication { private static AtomicInteger atomic = new AtomicInteger(); @Autowired @Qualifier("hexEncryption") private IEncryption encryption; @Autowired @Qualifier("asciiEncryption") private IEncryption decryption; @Autowired private IMessaging messaging; public CommunicationQualifiedImpl() { super(); } public CommunicationQualifiedImpl(IEncryption value) { super(); this.encryption = value; } public IEncryption getEncryption() { return encryption; } public void setEncryption(IEncryption encryption) { this.encryption = encryption; } public void setMessaging(IMessaging messaging){ this.messaging = messaging; } public void communicate(){ String msg = encryption.encryptData(messaging.getMessage()); System.out.println(atomic.incrementAndGet() + "-" + msg); System.out.println(atomic.incrementAndGet() + "-" + decryption.encryptData(msg)); } }
c04a812194eb3c641c743c0a5daf5197c5d33597
96c68414d2dd0610b11cbb57739a7a072d7b6e89
/src/com/android/settings/preferences/SecureSettingSwitchPreference.java
c6e863950ef715c0b3beeca6ef362d59a52a7cc0
[ "Apache-2.0" ]
permissive
FireHound/android_packages_apps_Settings
f1a0c155dcf99caa202210281ffb06fcd4f10d77
c4c367d6d1c2b82718f9f4118a756d79d10e5643
refs/heads/o8.1
2021-11-26T02:07:54.569239
2018-10-05T15:16:01
2018-10-05T15:16:01
64,948,244
3
29
null
2018-06-21T19:09:55
2016-08-04T16:00:22
Java
UTF-8
Java
false
false
2,283
java
/* * Copyright (C) 2014 The CyanogenMod project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.preferences; import android.content.Context; import android.provider.Settings; import android.support.v14.preference.SwitchPreference; import android.util.AttributeSet; public class SecureSettingSwitchPreference extends SwitchPreference { public SecureSettingSwitchPreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public SecureSettingSwitchPreference(Context context, AttributeSet attrs) { super(context, attrs); } public SecureSettingSwitchPreference(Context context) { super(context, null); } @Override protected boolean persistBoolean(boolean value) { if (shouldPersist()) { if (value == getPersistedBoolean(!value)) { // It's already there, so the same as persisting return true; } Settings.Secure.putInt(getContext().getContentResolver(), getKey(), value ? 1 : 0); return true; } return false; } @Override protected boolean getPersistedBoolean(boolean defaultReturnValue) { if (!shouldPersist()) { return defaultReturnValue; } return Settings.Secure.getInt(getContext().getContentResolver(), getKey(), defaultReturnValue ? 1 : 0) != 0; } @Override protected boolean isPersisted() { // Using getString instead of getInt so we can simply check for null // instead of catching an exception. (All values are stored as strings.) return Settings.Secure.getString(getContext().getContentResolver(), getKey()) != null; } }
75029a88d4b58168beb83cb2af2248d602671887
75e81011f0f7250f8a8ce863329b0e68c09e8a9b
/app/controllers/RequirementController.java
22702fe19aabf855da2c09cc6b11cf12052db341
[ "Apache-2.0" ]
permissive
xixixhalu/sss
03537ea40757cb210899b42e7c20c108ddd210e9
7a41349cd8b346646c6f7329091801d548019949
refs/heads/master
2021-01-10T18:25:59.457490
2014-05-08T02:23:44
2014-05-08T02:23:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,470
java
package controllers; import controllers.forms.RequirementAddForm; import controllers.forms.RequirementEditForm; import models.Requirement; import models.Sr; import play.data.Form; import play.mvc.Controller; import play.mvc.Result; public class RequirementController extends Controller{ /** * retrieve Requirement Information * @return requirement list page */ public static Result retrieveRequirements() { String user = session().get("user"); if(user == null) { return redirect(routes.UserController.retrieveLoginPage()); } try{ return ok(views.html.requirement_list.render(Requirement.getAll())); }catch(Exception e) { return badRequest(views.html.error.render("Cannot retrieve requirement list")); } } /** * delete requirement * @param id * - id of the requirement selected * */ public static Result deleteRequirement(Integer id){ String user = session().get("user"); if(user == null) { return redirect(routes.UserController.retrieveLoginPage()); } try{ Requirement.delete(id); return redirect(routes.RequirementController.retrieveRequirements()); }catch(Exception e) { return badRequest(views.html.error.render("Cannot delete requirement")); } } /** * request edit requirement page * @param id * - id of the requirement selected * */ public static Result requestEditRequirementPage(Integer id){ String user = session().get("user"); if(user == null) { return redirect(routes.UserController.retrieveLoginPage()); } try{ Form<RequirementEditForm> form = Form.form(RequirementEditForm.class); return ok(views.html.requirement_edit.render(Sr.getAll(), Requirement.findById(id), form)); }catch(Exception e) { return badRequest(views.html.error.render("Cannot find requirement information")); } } /** * update the selected requirement information * @param id * - id of the requirement selected * */ public static Result updateRequirement(Integer id){ String user = session().get("user"); if(user == null) { return redirect(routes.UserController.retrieveLoginPage()); } Form<RequirementEditForm> filledForm = Form.form(RequirementEditForm.class).bindFromRequest(); if(filledForm.hasErrors()) { return badRequest("Not all mandatory fields correct or entered."); } try{ RequirementEditForm requirementForm = filledForm.get(); Requirement requirement = Requirement.findById(id); requirement.setTitle(requirementForm.title); requirement.setSr_ids(requirementForm.sr_ids); requirement.update(); return redirect(routes.RequirementController.retrieveRequirements()); } catch(Exception e) { return badRequest(views.html.error.render(e.toString())); } } /** * request create requirement page * @return requirement information input page */ public static Result requestCreateRequirementPage(){ String user = session().get("user"); if(user == null) { return redirect(routes.UserController.retrieveLoginPage()); } try{ Form<RequirementAddForm> form = Form.form(RequirementAddForm.class); return ok(views.html.requirement_add.render(Sr.getAll(), form)); }catch(Exception e) { return badRequest(views.html.error.render(e.toString())); } } /** * submit a new requirement information * @return requirement list page */ public static Result addRequirement(){ String user = session().get("user"); if(user == null) { return redirect(routes.UserController.retrieveLoginPage()); } Form<RequirementAddForm> filledForm = Form.form(RequirementAddForm.class).bindFromRequest(); if (filledForm.hasErrors()) return badRequest(views.html.error.render("Not all mandatory fields correct or entered.")); try{ RequirementAddForm requirementForm = filledForm.get(); Requirement requirement = Requirement.createNewEntity(); requirement.setTitle(requirementForm.title); requirement.setSr_ids(requirementForm.sr_ids); requirement.save(); return redirect(routes.RequirementController.retrieveRequirements()); }catch(Exception e) { return badRequest(views.html.error.render(e.toString())); } } }
09ae6083c23c2a6bb0b587da2ddaaea89f946f6d
a3e3744fe4b132889dbaeb894788ff2d3e3e15ca
/src/android/lib/LaunchNavigator.java
ce62f78b435013f04383ddc304be7a372b0746fb
[ "MIT" ]
permissive
centricomen/lula-launch-navigation-custom
61349ca6378a8890be22b0fc5db83908464d4f7f
73f8ac5fc246ef37fd116a5ddc5ce9d773d7b875
refs/heads/master
2021-01-07T02:45:09.237874
2020-02-19T07:29:04
2020-02-19T07:29:04
241,556,648
0
0
null
null
null
null
UTF-8
Java
false
false
64,341
java
/* * LaunchNavigator library for Android * * Copyright (c) 2018 Dave Alden (http://github.com/dpa99c) * Copyright (c) 2018 Working Edge Ltd. (http://www.workingedge.co.uk) * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ package uk.co.workingedge; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.util.Log; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; public class LaunchNavigator { /********************** * Public properties **********************/ public static final String LOG_TAG = "LaunchNavigator"; public final String NO_APP_FOUND = "No Activity found to handle Intent"; //public final String MAPS_PROTOCOL = "http://maps.google.com/maps?"; public final String MAPS_PROTOCOL = "https://www.google.com/maps/dir/?api=1&travelmode=driving"; public final String TURN_BY_TURN_PROTOCOL = "google.navigation:"; // Explicitly supported apps public final String GEO = "geo"; // Use native app choose for geo: intent public final String GOOGLE_MAPS = "google_maps"; public final String CITYMAPPER = "citymapper"; public final String UBER = "uber"; public final String WAZE = "waze"; public final String YANDEX = "yandex"; public final String SYGIC = "sygic"; public final String HERE_MAPS = "here_maps"; public final String MOOVIT = "moovit"; public final String LYFT = "lyft"; public final String MAPS_ME = "maps_me"; public final String CABIFY = "cabify"; public final String BAIDU = "baidu"; public final String TAXIS_99 = "taxis_99"; public final String GAODE = "gaode"; public final Map<String, String> supportedAppPackages; { Map<String, String> _supportedAppPackages = new HashMap<String, String>(); _supportedAppPackages.put(GOOGLE_MAPS, "com.google.android.apps.maps"); _supportedAppPackages.put(CITYMAPPER, "com.citymapper.app.release"); _supportedAppPackages.put(UBER, "com.ubercab"); _supportedAppPackages.put(WAZE, "com.waze"); _supportedAppPackages.put(YANDEX, "ru.yandex.yandexnavi"); _supportedAppPackages.put(SYGIC, "com.sygic.aura"); _supportedAppPackages.put(HERE_MAPS, "com.here.app.maps"); _supportedAppPackages.put(MOOVIT, "com.tranzmate"); _supportedAppPackages.put(LYFT, "me.lyft.android"); _supportedAppPackages.put(MAPS_ME, "com.mapswithme.maps.pro"); _supportedAppPackages.put(CABIFY, "com.cabify.rider"); _supportedAppPackages.put(BAIDU, "com.baidu.BaiduMap"); _supportedAppPackages.put(TAXIS_99, "com.taxis99"); _supportedAppPackages.put(GAODE, "com.autonavi.minimap"); supportedAppPackages = Collections.unmodifiableMap(_supportedAppPackages); } public final Map<String, String> supportedAppNames; { Map<String, String> _supportedAppNames = new HashMap<String, String>(); _supportedAppNames.put(GOOGLE_MAPS, "Google Maps"); _supportedAppNames.put(CITYMAPPER, "Citymapper"); _supportedAppNames.put(UBER, "Uber"); _supportedAppNames.put(WAZE, "Waze"); _supportedAppNames.put(YANDEX, "Yandex Navigator"); _supportedAppNames.put(SYGIC, "Sygic"); _supportedAppNames.put(HERE_MAPS, "HERE Maps"); _supportedAppNames.put(MOOVIT, "Moovit"); _supportedAppNames.put(LYFT, "Lyft"); _supportedAppNames.put(MAPS_ME, "MAPS.ME"); _supportedAppNames.put(CABIFY, "Cabify"); _supportedAppNames.put(BAIDU, "Baidu Maps"); _supportedAppNames.put(TAXIS_99, "99 Taxi"); _supportedAppNames.put(GAODE, "Gaode Maps (Amap)"); supportedAppNames = Collections.unmodifiableMap(_supportedAppNames); } public final String GEO_URI = "geo:"; /********************** * Internal properties **********************/ boolean geocodingEnabled = true; PackageManager packageManager; Context context; OkHttpClient httpClient = new OkHttpClient(); ILogger logger; // Map of app name to package name Map<String, String> availableApps; private final String[] navigateParams = { "app", "dType", "dest", "destNickname", "sType", "start", "startNickname", "transportMode", "launchMode", "extras", "waypoints" }; String googleApiKey = null; /******************* * Constructors *******************/ public LaunchNavigator(Context context, ILogger logger) throws Exception { setLogger(logger); initialize(context); } public LaunchNavigator(Context context, ILogger logger, boolean geocodingEnabled) throws Exception { this.geocodingEnabled = geocodingEnabled; setLogger(logger); initialize(context); } /******************* * Public API *******************/ public void setGoogleApiKey(String googleApiKey){ this.googleApiKey = googleApiKey; } public void setLogger(ILogger logger){ this.logger = logger; } public ILogger getLogger(){ return this.logger; } public void setGeocoding(boolean geocodingEnabled){ this.geocodingEnabled = geocodingEnabled; } public JSONObject getGeoApps() throws JSONException{ JSONObject apps = new JSONObject(); // Dynamically populate from discovered available apps that support geo: protocol for (Map.Entry<String, String> entry : availableApps.entrySet()) { String appName = entry.getKey(); String packageName = entry.getValue(); // If it's not already an explicitly supported app if(!supportedAppPackages.containsValue(packageName)){ apps.put(appName, packageName); } } return apps; } public JSONObject getAvailableApps() throws Exception{ JSONObject apps = new JSONObject(); // Add explicitly supported apps first for (Map.Entry<String, String> entry : supportedAppPackages.entrySet()) { String _appName = entry.getKey(); String _packageName = entry.getValue(); apps.put(_appName, availableApps.containsValue(_packageName)); } // Iterate over available apps and add any dynamically discovered ones for (Map.Entry<String, String> entry : availableApps.entrySet()) { String _packageName = entry.getValue(); // If it's not already present if(!apps.has(_packageName) && !supportedAppPackages.containsValue(_packageName)){ apps.put(_packageName, true); } } return apps; } public boolean isAppAvailable(String appName){ if(supportedAppPackages.containsKey(appName)){ appName = supportedAppPackages.get(appName); } return availableApps.containsValue(appName); } public String navigate(JSONObject params) throws Exception{ params = ensureNavigateKeys(params); String navigateArgs = "Called navigate() with params"; for(String param : navigateParams){ navigateArgs += "; "+param+"="+params.getString(param); } logger.debug(navigateArgs); String appName = params.getString("app"); String launchMode = params.getString("launchMode"); String error; if(appName.equals(GOOGLE_MAPS) && !launchMode.equals("geo")){ error = launchGoogleMaps(params); }else if(appName.equals(CITYMAPPER)){ error = launchCitymapper(params); }else if(appName.equals(UBER)){ error = launchUber(params); }else if(appName.equals(WAZE)){ error = launchWaze(params); }else if(appName.equals(YANDEX)){ error = launchYandex(params); }else if(appName.equals(SYGIC)){ error = launchSygic(params); }else if(appName.equals(HERE_MAPS)){ error = launchHereMaps(params); }else if(appName.equals(MOOVIT)){ error = launchMoovit(params); }else if(appName.equals(LYFT)){ error = launchLyft(params); }else if(appName.equals(MAPS_ME)){ error = launchMapsMe(params); }else if(appName.equals(CABIFY)){ error = launchCabify(params); }else if(appName.equals(BAIDU)){ error = launchBaidu(params); }else if(appName.equals(GAODE)){ error = launchGaode(params); }else if(appName.equals(TAXIS_99)){ error = launch99Taxis(params); }else{ error = launchApp(params); } return error; } /******************* * Internal methods *******************/ private void initialize(Context context) throws Exception { if(context == null){ throw new Exception(LOG_TAG+": null context passed to initialize()"); } this.context = context; this.packageManager = context.getPackageManager(); discoverAvailableApps(); } private void discoverAvailableApps(){ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(GEO_URI)); List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, 0); availableApps = new HashMap<String, String>(); for (ResolveInfo resolveInfo : resolveInfoList) { String packageName = resolveInfo.activityInfo.packageName; String appName = getAppName(packageName); if(!supportedAppPackages.containsValue(packageName)) { // if it's not already an explicitly supported app logger.debug("Found available app supporting geo protocol: " + appName + " (" + packageName + ")"); availableApps.put(appName, packageName); } } // Check if explicitly supported apps are installed for (Map.Entry<String, String> entry : supportedAppPackages.entrySet()) { String _appName = entry.getKey(); String _packageName = entry.getValue(); if(isPackageInstalled(_packageName, packageManager)){ availableApps.put(supportedAppNames.get(_appName), _packageName); logger.debug(_appName+" is available"); }else{ logger.debug(_appName + " is not available"); } } } private String launchApp(JSONObject params) throws Exception{ String appName = params.getString("app"); String dType = params.getString("dType"); String dNickName = params.getString("destNickname"); String logMsg = "Using " + getAppDisplayName(appName)+" to navigate to "; String destLatLon = null; String destName = null; String dest; if(dType.equals("name")){ destName = getLocationFromName(params, "dest"); try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } logMsg += destName; if(!isNull(destLatLon)){ logMsg += "["+destLatLon+"]"; } }else{ destLatLon = getLocationFromPos(params, "dest"); logMsg += "["+destLatLon+"]"; } if(!isNull(destLatLon)){ dest = destLatLon; }else{ dest = destName; } String uri = GEO_URI+destLatLon+"?q="+dest; if(!isNull(dNickName)){ uri += "("+dNickName+")"; logMsg += "("+dNickName+")"; } String extras = parseExtrasToUrl(params); if(!isNull(extras)){ uri += extras; logMsg += " - extras="+extras; } logger.debug(logMsg); logger.debug("URI: " + uri); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); if(!appName.equals(GEO)){ if(appName.equals(GOOGLE_MAPS)) { appName = supportedAppPackages.get(GOOGLE_MAPS); } intent.setPackage(appName); } invokeIntent(intent); return null; } private String launchGoogleMaps(JSONObject params) throws Exception{ try { String destination; String start = null; String dType = params.getString("dType"); if(dType.equals("pos")){ destination = getLocationFromPos(params, "dest"); }else{ destination = getLocationFromName(params, "dest"); } String sType = params.getString("sType"); if(sType.equals("pos")){ start = getLocationFromPos(params, "start"); }else if(sType.equals("name")){ start = getLocationFromName(params, "start"); } String transportMode = params.getString("transportMode"); String launchMode = params.getString("launchMode"); String logMsg = "Using Google Maps to navigate to "+destination; String url; if(launchMode.equals("turn-by-turn")){ url = TURN_BY_TURN_PROTOCOL + "q=" + destination; if(!isNull(transportMode)){ logMsg += " by transportMode=" + transportMode; url += "&mode=" + transportMode; } logMsg += " in turn-by-turn mode"; }else{ //url = MAPS_PROTOCOL + "daddr=" + destination; url = MAPS_PROTOCOL + "&destination=" + destination; if(!isNull(start)){ logMsg += " from " + start; url += "&origin=" + start; }else{ logMsg += " from current location"; } logMsg += " in maps mode"; } String extras = parseExtrasToUrl(params); if(!isNull(extras)){ url += extras; logMsg += " - extras="+extras; } /** -------------- NEW ADDITIONS FOR WAYPOINTS -------------- */ String waypointsStr = ""; JSONArray waypoints = params.getJSONArray("waypoints"); if( waypoints.length() > 0 ) { for( int i = 0; i < waypoints.length(); i++ ) { waypointsStr += (waypointsStr.equals("") ? "" : "%7C") + waypoints.getString(i); /*if( i < waypoints.length() - 1 ) waypointsStr += "+to:";*/ } url += "&waypoints=" + waypointsStr; //url += waypointsStr; } url += "&dir_action=navigate"; Log.i("WAYPOINTS", "Waypoints data: " + waypointsStr); Log.i("WAYPOINTS URL", url ); logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.setClassName(supportedAppPackages.get(GOOGLE_MAPS), "com.google.android.maps.MapsActivity"); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Google Maps app is not installed on this device"; } logger.error("Exception occurred: ".concat(msg)); return msg; } } private String launchCitymapper(JSONObject params) throws Exception{ try { String destAddress = null; String destLatLon = null; String startAddress = null; String startLatLon = null; String destNickname = params.getString("destNickname"); String startNickname = params.getString("startNickname"); String dType = params.getString("dType"); String sType = params.getString("sType"); if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); }else{ destLatLon = getLocationFromPos(params, "dest"); } if(sType.equals("name")){ startAddress = getLocationFromName(params, "start"); }else if(sType.equals("pos")){ startLatLon = getLocationFromPos(params, "start"); } String url = "https://citymapper.com/directions?"; String logMsg = "Using Citymapper to navigate to"; if(!isNull(destAddress)){ url += "&endaddress="+Uri.encode(destAddress); logMsg += " '"+destAddress+"'"; } if(isNull(destLatLon)){ try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } } url += "&endcoord="+destLatLon; logMsg += " ["+destLatLon+"]"; if(!isNull(destNickname)){ url += "&endname="+Uri.encode(destNickname); logMsg += " ("+destNickname+")"; } if(!sType.equals("none")){ logMsg += " from"; if(!isNull(startAddress)){ url += "&startaddress="+Uri.encode(startAddress); logMsg += " '"+startAddress+"'"; } if(isNull(startLatLon)){ try{ startLatLon = geocodeAddressToLatLon(params.getString("start")); }catch(Exception e){ return "Unable to geocode start address to coordinates: " + e.getMessage(); } } url += "&startcoord="+startLatLon; logMsg += " ["+startLatLon+"]"; if(!isNull(startNickname)){ url += "&startname="+Uri.encode(startNickname); logMsg += " ("+startNickname+")"; } } String extras = parseExtrasToUrl(params); if(!isNull(extras)){ url += extras; logMsg += " - extras="+extras; } logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Citymapper app is not installed on this device"; } return msg; } } private String launchUber(JSONObject params) throws Exception{ try { String destAddress = null; String destLatLon = null; String startAddress = null; String startLatLon = null; String destNickname = params.getString("destNickname"); String startNickname = params.getString("startNickname"); String dType = params.getString("dType"); String sType = params.getString("sType"); if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); }else{ destLatLon = getLocationFromPos(params, "dest"); } if(sType.equals("name")){ startAddress = getLocationFromName(params, "start"); }else if(sType.equals("pos")){ startLatLon = getLocationFromPos(params, "start"); } String url = "uber://?action=setPickup"; String logMsg = "Using Uber to navigate to"; if(!isNull(destAddress)){ url += "&dropoff[formatted_address]="+destAddress; logMsg += " '"+destAddress+"'"; } if(!isNull(destLatLon)){ String[] parts = splitLatLon(destLatLon); url += "&dropoff[latitude]="+parts[0]+"&dropoff[longitude]="+parts[1]; logMsg += " ["+destLatLon+"]"; } if(!isNull(destNickname)){ url += "&dropoff[nickname]="+destNickname; logMsg += " ("+destNickname+")"; } logMsg += " from"; if(!sType.equals("none")){ if(!isNull(startAddress)){ url += "&pickup[formatted_address]=="+startAddress; logMsg += " '"+startAddress+"'"; } if(!isNull(startLatLon)){ String[] parts = splitLatLon(startLatLon); url += "&pickup[latitude]="+parts[0]+"&pickup[longitude]="+parts[1]; logMsg += " ["+startLatLon+"]"; } if(!isNull(startNickname)){ url += "&pickup[nickname]="+startNickname; logMsg += " ("+startNickname+")"; } }else{ url += "&pickup=my_location"; logMsg += " current location"; } String extras = parseExtrasToUrl(params); if(!isNull(extras)){ url += extras; logMsg += " - extras="+extras; } logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Uber app is not installed on this device"; } return msg; } } private String launchWaze(JSONObject params) throws Exception{ try { String destAddress = null; String destLatLon = null; String dType = params.getString("dType"); if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); }else{ destLatLon = getLocationFromPos(params, "dest"); } String url = "waze://?"; String logMsg = "Using Waze to navigate to"; if(!isNull(destLatLon)){ url += "ll="+destLatLon; logMsg += " ["+destLatLon+"]"; }else{ url += "q="+destAddress; logMsg += " '"+destAddress+"'"; } url += "&navigate=yes"; logMsg += " from current location"; String extras = parseExtrasToUrl(params); if(!isNull(extras)){ url += extras; logMsg += " - extras="+extras; } logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Waze app is not installed on this device"; } return msg; } } private String launchYandex(JSONObject params) throws Exception{ try { String destAddress = null; String destLatLon = null; String startAddress = null; String startLatLon = null; String dType = params.getString("dType"); String sType = params.getString("sType"); if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } }else{ destLatLon = getLocationFromPos(params, "dest"); } if(sType.equals("name")){ startAddress = getLocationFromName(params, "start"); try{ startLatLon = geocodeAddressToLatLon(params.getString("start")); }catch(Exception e){ return "Unable to geocode start address to coordinates: " + e.getMessage(); } }else if(sType.equals("pos")){ startLatLon = getLocationFromPos(params, "start"); } Intent intent = new Intent(supportedAppPackages.get(YANDEX)+".action.BUILD_ROUTE_ON_MAP"); intent.setPackage(supportedAppPackages.get(YANDEX)); String logMsg = "Using Yandex to navigate to"; String[] parts = splitLatLon(destLatLon); intent.putExtra("lat_to", parts[0]); intent.putExtra("lon_to", parts[1]); logMsg += " ["+destLatLon+"]"; if(!isNull(destAddress)){ logMsg += " ('"+destAddress+"')"; } logMsg += " from"; if(!sType.equals("none")){ parts = splitLatLon(startLatLon); intent.putExtra("lat_from", parts[0]); intent.putExtra("lon_from", parts[1]); logMsg += " ["+startLatLon+"]"; if(!isNull(startAddress)){ logMsg += " ('"+startAddress+"')"; } }else{ logMsg += " current location"; } String jsonStringExtras = params.getString("extras"); JSONObject oExtras = null; if(!isNull(jsonStringExtras)){ oExtras = new JSONObject(jsonStringExtras); } if(oExtras != null){ Iterator<?> keys = oExtras.keys(); while( keys.hasNext() ) { String key = (String)keys.next(); String value = oExtras.getString(key); intent.putExtra(key, value); } } logger.debug(logMsg); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Yandex app is not installed on this device"; } return msg; } } private String launchSygic(JSONObject params) throws Exception{ try { String destAddress = null; String destLatLon = null; String dType = params.getString("dType"); String transportMode = params.getString("transportMode"); String url = supportedAppPackages.get(SYGIC)+"://coordinate|"; String logMsg = "Using Sygic to navigate to"; if(transportMode.equals("w")){ transportMode = "walk"; }else{ transportMode = "drive"; } if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); logMsg += " '"+destAddress+"'"; try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } }else{ destLatLon = getLocationFromPos(params, "dest"); } logMsg += " ["+destLatLon+"]"; String[] pos = splitLatLon(destLatLon); url += pos[1]+"|"+pos[0]+"|"+transportMode; logMsg += " by " + transportMode; String extras = parseExtrasToUrl(params); if(!isNull(extras)){ url += extras; logMsg += " - extras="+extras; } logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Sygic app is not installed on this device"; } return msg; } } private String launchHereMaps(JSONObject params) throws Exception{ try { String destAddress; String destLatLon = null; String startAddress; String startLatLon = null; String destNickname = params.getString("destNickname"); String startNickname = params.getString("startNickname"); String dType = params.getString("dType"); String sType = params.getString("sType"); String url = "https://share.here.com/r/"; String logMsg = "Using HERE Maps to navigate"; logMsg += " from"; if(sType.equals("none")){ url += "mylocation"; logMsg += " Current Location"; }else{ if(sType.equals("name")){ startAddress = getLocationFromName(params, "start"); logMsg += " '"+startAddress+"'"; try{ startLatLon = geocodeAddressToLatLon(params.getString("start")); }catch(Exception e){ return "Unable to geocode start address to coordinates: " + e.getMessage(); } }else if(sType.equals("pos")){ startLatLon = getLocationFromPos(params, "start"); } url += startLatLon; logMsg += " ["+startLatLon+"]"; if(!isNull(startNickname)){ url += ","+startNickname; logMsg += " ("+startNickname+")"; } } url += "/"; logMsg += " to"; if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); logMsg += " '"+destAddress+"'"; try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } }else{ destLatLon = getLocationFromPos(params, "dest"); } logMsg += " ["+destLatLon+"]"; url += destLatLon; if(!isNull(destNickname)){ url += ","+destNickname; logMsg += " ("+destNickname+")"; } String extras = parseExtrasToUrl(params); if(!isNull(extras)){ url += "?" + extras; logMsg += " - extras="+extras; } logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "HERE Maps app is not installed on this device"; } return msg; } } private String launchMoovit(JSONObject params) throws Exception{ try { String destAddress; String destLatLon = null; String startAddress; String startLatLon = null; String destNickname = params.getString("destNickname"); String startNickname = params.getString("startNickname"); String dType = params.getString("dType"); String sType = params.getString("sType"); String url = "moovit://directions"; String logMsg = "Using Moovit to navigate"; logMsg += " to"; if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); logMsg += " '"+destAddress+"'"; try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } }else{ destLatLon = getLocationFromPos(params, "dest"); } logMsg += " ["+destLatLon+"]"; String[] destPos = splitLatLon(destLatLon); url += "?dest_lat=" + destPos[0] + "&dest_lon=" + destPos[1]; if(!isNull(destNickname)){ url += "&dest_name="+destNickname; logMsg += " ("+destNickname+")"; } logMsg += " from"; if(sType.equals("none")){ logMsg += " Current Location"; }else{ if(sType.equals("name")){ startAddress = getLocationFromName(params, "start"); logMsg += " '"+startAddress+"'"; try{ startLatLon = geocodeAddressToLatLon(params.getString("start")); }catch(Exception e){ return "Unable to geocode start address to coordinates: " + e.getMessage(); } }else if(sType.equals("pos")){ startLatLon = getLocationFromPos(params, "start"); } String[] startPos = splitLatLon(startLatLon); url += "&orig_lat=" + startPos[0] + "&orig_lon=" + startPos[1]; logMsg += " ["+startLatLon+"]"; if(!isNull(startNickname)){ url += "&orig_name="+startNickname; logMsg += " ("+startNickname+")"; } } String extras = parseExtrasToUrl(params); if(!isNull(extras)){ url += extras; logMsg += " - extras="+extras; } logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Moovit app is not installed on this device"; } return msg; } } private String launchLyft(JSONObject params) throws Exception{ try { String destAddress; String destLatLon = null; String startAddress; String startLatLon = null; String dType = params.getString("dType"); String sType = params.getString("sType"); String url = "lyft://ridetype?"; String logMsg = "Using Lyft to navigate"; String extras = parseExtrasToUrl(params); if(!isNull(extras)){ url += extras; logMsg += " - extras="+extras; } if(isNull(extras) || !extras.contains("id=")){ url += "id=lyft"; } logMsg += " to"; if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); logMsg += " '"+destAddress+"'"; try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } }else{ destLatLon = getLocationFromPos(params, "dest"); } logMsg += " ["+destLatLon+"]"; String[] destPos = splitLatLon(destLatLon); url += "&destination[latitude]=" + destPos[0] + "&destination[longitude]=" + destPos[1]; logMsg += " from"; if(sType.equals("none")){ logMsg += " Current Location"; }else{ if(sType.equals("name")){ startAddress = getLocationFromName(params, "start"); logMsg += " '"+startAddress+"'"; try{ startLatLon = geocodeAddressToLatLon(params.getString("start")); }catch(Exception e){ return "Unable to geocode start address to coordinates: " + e.getMessage(); } }else if(sType.equals("pos")){ startLatLon = getLocationFromPos(params, "start"); } String[] startPos = splitLatLon(startLatLon); url += "&pickup[latitude]=" + startPos[0] + "&pickup[longitude]=" + startPos[1]; logMsg += " ["+startLatLon+"]"; } logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Lyft app is not installed on this device"; } return msg; } } private String launchMapsMe(JSONObject params) throws Exception{ try { String destAddress; String destLatLon = null; String startAddress; String startLatLon = null; String dType = params.getString("dType"); String sType = params.getString("sType"); String transportMode = params.getString("transportMode"); Intent intent = new Intent(supportedAppPackages.get(MAPS_ME).concat(".action.BUILD_ROUTE")); intent.setPackage(supportedAppPackages.get(MAPS_ME)); String logMsg = "Using MAPs.ME to navigate"; logMsg += " to"; if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); logMsg += " '"+destAddress+"'"; try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } }else{ destLatLon = getLocationFromPos(params, "dest"); } logMsg += " ["+destLatLon+"]"; String[] destPos = splitLatLon(destLatLon); intent.putExtra("lat_to", Double.parseDouble(destPos[0])); intent.putExtra("lon_to", Double.parseDouble(destPos[1])); logMsg += " from"; if(sType.equals("none")){ logMsg += " Current Location"; }else{ if(sType.equals("name")){ startAddress = getLocationFromName(params, "start"); logMsg += " '"+startAddress+"'"; try{ startLatLon = geocodeAddressToLatLon(params.getString("start")); }catch(Exception e){ return "Unable to geocode start address to coordinates: " + e.getMessage(); } }else if(sType.equals("pos")){ startLatLon = getLocationFromPos(params, "start"); } String[] startPos = splitLatLon(startLatLon); intent.putExtra("lat_from", Double.parseDouble(startPos[0])); intent.putExtra("lon_from", Double.parseDouble(startPos[1])); logMsg += " ["+startLatLon+"]"; } if(transportMode.equals("d")){ transportMode = "vehicle"; }else if(transportMode.equals("w")){ transportMode = "pedestrian"; }else if(transportMode.equals("b")){ transportMode = "bicycle"; }else if(transportMode.equals("t")){ transportMode = "taxi"; } if(!isNull(transportMode)){ intent.putExtra("router", transportMode); logMsg += " by transportMode=" + transportMode; } logger.debug(logMsg); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "MAPS.ME app is not installed on this device"; } return msg; } } private String launchCabify(JSONObject params) throws Exception{ try { String destAddress; String destLatLon = null; String startAddress; String startLatLon = null; String destNickname = params.getString("destNickname"); String startNickname = params.getString("startNickname"); String dType = params.getString("dType"); String sType = params.getString("sType"); String url = "cabify://cabify/journey?json="; String logMsg = "Using Cabify to navigate"; JSONObject oJson = new JSONObject(); // Parse dest JSONObject oDest = new JSONObject(); logMsg += " to"; if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); logMsg += " '"+destAddress+"'"; try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } }else{ destLatLon = getLocationFromPos(params, "dest"); } logMsg += " ["+destLatLon+"]"; String[] destPos = splitLatLon(destLatLon); JSONObject oDestLoc = new JSONObject(); oDestLoc.put("latitude", destPos[0]); oDestLoc.put("longitude", destPos[1]); oDest.put("loc", oDestLoc); if(!isNull(destNickname)){ oDest.put("name", destNickname); logMsg += " ("+destNickname+")"; } // Parse start JSONObject oStart = new JSONObject(); logMsg += " from"; if(sType.equals("none")){ logMsg += " Current Location"; oStart.put("loc", "current"); }else{ if(sType.equals("name")){ startAddress = getLocationFromName(params, "start"); logMsg += " '"+startAddress+"'"; try{ startLatLon = geocodeAddressToLatLon(params.getString("start")); }catch(Exception e){ return "Unable to geocode start address to coordinates: " + e.getMessage(); } }else if(sType.equals("pos")){ startLatLon = getLocationFromPos(params, "start"); } logMsg += " ["+startLatLon+"]"; String[] startPos = splitLatLon(startLatLon); JSONObject oStartLoc = new JSONObject(); oStartLoc.put("latitude", startPos[0]); oStartLoc.put("longitude", startPos[1]); oStart.put("loc", oStartLoc); } if(!isNull(startNickname)){ oStart.put("name", startNickname); logMsg += " ("+startNickname+")"; } String extras = params.getString("extras"); if(!isNull(extras)){ oJson = new JSONObject(extras); logMsg += " - extras="+extras; } // Assemble JSON JSONArray aStops = new JSONArray(); aStops.put(oStart); if(oJson.has("stops")){ JSONArray stops = oJson.getJSONArray("stops"); for (int i = 0; i < stops.length(); i++) { aStops.put(stops.getJSONObject(i)); } } aStops.put(oDest); oJson.put("stops", aStops); url += oJson.toString(); logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Cabify app is not installed on this device"; } return msg; } } private String launchBaidu(JSONObject params) throws Exception{ try { String start; String dest; String destNickname = params.getString("destNickname"); String startNickname = params.getString("startNickname"); String dType = params.getString("dType"); String sType = params.getString("sType"); String transportMode = params.getString("transportMode"); String url = "baidumap://map/direction"; String logMsg = "Using Baidu Maps to navigate"; String extras = parseExtrasToUrl(params); if(isNull(extras)){ extras = ""; } if(!extras.contains("coord_type=")){ extras += "&coord_type=wgs84"; } // Destination logMsg += " to"; if(dType.equals("name")){ dest = getLocationFromName(params, "dest"); logMsg += dest; }else{ dest = getLocationFromPos(params, "dest"); logMsg += " ["+dest+"]"; if(!isNull(destNickname)){ dest = "latlng:" + dest + "|name:" + destNickname; logMsg += " ("+destNickname+")"; } } url += "?destination=" + dest; // Start logMsg += " from"; if(sType.equals("none")){ logMsg += " Current Location"; }else{ if(sType.equals("name")){ start = getLocationFromName(params, "start"); logMsg += start; }else{ start = getLocationFromPos(params, "start"); logMsg += " ["+start+"]"; if(!isNull(startNickname)){ start = "latlng:" + start + "|name:" + startNickname; logMsg += " ("+startNickname+")"; } } url += "&origin=" + start; } // Transport mode if(transportMode.equals("d")){ transportMode = "driving"; }else if(transportMode.equals("w")){ transportMode = "walking"; }else if(transportMode.equals("b")){ transportMode = "riding"; }else if(transportMode.equals("t")){ transportMode = "transit"; }else{ transportMode = "driving"; } url += "&mode="+transportMode; logMsg += " by transportMode=" + transportMode; // Extras url += extras; logMsg += " - extras="+extras; logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(); intent.setData(Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Baidu Maps app is not installed on this device"; } return msg; } } private String launchGaode(JSONObject params) throws Exception{ try { String destAddress = null; String destLatLon = null; String startAddress = null; String startLatLon = null; String destNickname = params.getString("destNickname"); String startNickname = params.getString("startNickname"); String dType = params.getString("dType"); String sType = params.getString("sType"); String transportMode = params.getString("transportMode"); String url = "amapuri://route/plan/?"; String logMsg = "Using Gaode Maps to navigate"; String extras = parseExtrasToUrl(params); if(isNull(extras)){ extras = ""; } if(!extras.contains("sourceApplication=")){ extras += "&sourceApplication="+Uri.encode(getThisAppName()); } // Destination logMsg += " to"; if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); logMsg += " '"+destAddress+"'"; try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } }else{ destLatLon = getLocationFromPos(params, "dest"); } logMsg += " ["+destLatLon+"]"; String[] pos = splitLatLon(destLatLon); url += "dlat="+pos[0]+"&dlon="+pos[1]; // Dest name if(!isNull(destNickname)){ logMsg += " ("+destNickname+")"; url += "&dname="+destNickname; } // Start logMsg += " from"; if(sType.equals("none")){ logMsg += " Current Location"; }else { if (sType.equals("name")) { startAddress = getLocationFromName(params, "start"); logMsg += " '" + startAddress + "'"; try{ startLatLon = geocodeAddressToLatLon(params.getString("start")); }catch(Exception e){ startLatLon = null; } } else{ startLatLon = getLocationFromPos(params, "start"); } if (!isNull(startLatLon)) { logMsg += " [" + startLatLon + "]"; pos = splitLatLon(startLatLon); url += "&slat=" + pos[0] + "&slon=" + pos[1]; // Start name if(!isNull(startNickname)){ logMsg += " ("+startNickname+")"; url += "&sname="+startNickname; } } } // Transport mode String transportModeName; if(transportMode.equals("d")){ transportModeName = "driving"; transportMode = "0"; }else if(transportMode.equals("w")){ transportModeName = "walking"; transportMode = "2"; }else if(transportMode.equals("b")){ transportModeName = "bicycle"; transportMode = "3"; }else if(transportMode.equals("t")){ transportModeName = "transit"; transportMode = "1"; }else{ transportModeName = "driving"; transportMode = "0"; } url += "&t="+transportMode; logMsg += " by transportMode=" + transportModeName; // Extras url += extras; logMsg += " - extras="+extras; logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(); intent.setData(Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "Gaode Maps app is not installed on this device"; } return msg; } } private String launch99Taxis(JSONObject params) throws Exception{ try { String destAddress = null; String destLatLon = null; String startAddress = null; String startLatLon = null; String destNickname = params.getString("destNickname"); String startNickname = params.getString("startNickname"); String dType = params.getString("dType"); String sType = params.getString("sType"); String url = "taxis99://call?"; String logMsg = "Using 99 Taxi to navigate"; String extras = parseExtrasToUrl(params); if(isNull(extras)){ extras = ""; } if(!extras.contains("deep_link_product_id")){ extras += "&deep_link_product_id=316"; } if(!extras.contains("client_id")){ extras += "&client_id=MAP_123"; } // Destination logMsg += " to"; if(dType.equals("name")){ destAddress = getLocationFromName(params, "dest"); logMsg += " '"+destAddress+"'"; try{ destLatLon = geocodeAddressToLatLon(params.getString("dest")); }catch(Exception e){ return "Unable to geocode destination address to coordinates: " + e.getMessage(); } }else{ destLatLon = getLocationFromPos(params, "dest"); } logMsg += " ["+destLatLon+"]"; String[] pos = splitLatLon(destLatLon); url += "dropoff_latitude="+pos[0]+"&dropoff_longitude="+pos[1]; // Dest name if(isNull(destNickname)){ if(!isNull(destAddress)){ destNickname = destAddress; }else{ destNickname = "Dropoff"; } } logMsg += " ("+destNickname+")"; url += "&dropoff_title="+destNickname; // Start logMsg += " from"; if(sType.equals("name")){ startAddress = getLocationFromName(params, "start"); logMsg += " '"+startAddress+"'"; try{ startLatLon = geocodeAddressToLatLon(params.getString("start")); }catch(Exception e){ return "Unable to geocode start address to coordinates: " + e.getMessage(); } }else if(sType.equals("pos")){ startLatLon = getLocationFromPos(params, "start"); }else{ return "start location is a required parameter for 99 Taxi and must be specified"; } logMsg += " ["+startLatLon+"]"; pos = splitLatLon(startLatLon); url += "&pickup_latitude="+pos[0]+"&pickup_longitude="+pos[1]; // Start name if(isNull(startNickname)){ if(!isNull(startAddress)){ startNickname = startAddress; }else{ startNickname = "Pickup"; } } logMsg += " ("+startNickname+")"; url += "&pickup_title="+startNickname; // Extras url += extras; logMsg += " - extras="+extras; logger.debug(logMsg); logger.debug("URI: " + url); Intent intent = new Intent(); intent.setData(Uri.parse(url)); invokeIntent(intent); return null; }catch( JSONException e ) { String msg = e.getMessage(); if(msg.contains(NO_APP_FOUND)){ msg = "99 Taxis app is not installed on this device"; } return msg; } } /* * Utilities */ private void invokeIntent(Intent intent){ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } private String parseExtrasToUrl(JSONObject params) throws JSONException{ String extras = null; String jsonStringExtras = params.getString("extras"); JSONObject oExtras = null; if(!isNull(jsonStringExtras)){ oExtras = new JSONObject(jsonStringExtras); } if(oExtras != null){ Iterator<?> keys = oExtras.keys(); extras = ""; while( keys.hasNext() ) { String key = (String)keys.next(); String value = oExtras.getString(key); extras += "&"+key+"="+value; } } return extras; } private String getLocationFromPos(JSONObject params, String key) throws Exception{ String location; JSONArray pos = new JSONArray(params.getString(key)); String lat = pos.getString(0); String lon = pos.getString(1); if (isNull(lat) || lat.length() == 0 || isNull(lon) || lon.length() == 0) { throw new Exception("Expected two non-empty string arguments for lat/lon."); } location = lat + "," + lon; return location; } private String getLocationFromName(JSONObject params, String key) throws Exception{ String name = params.getString(key); if (isNull(name) || name.length() == 0) { throw new Exception("Expected non-empty string argument for place name."); } return name; } private String[] splitLatLon(String latlon){ return latlon.split(","); } private String getAppName(String packageName){ ApplicationInfo ai; try { ai = packageManager.getApplicationInfo(packageName, 0); } catch (final PackageManager.NameNotFoundException e) { ai = null; } final String applicationName = (String) (ai != null ? packageManager.getApplicationLabel(ai) : null); return applicationName; } private boolean isPackageInstalled(String packagename, PackageManager packageManager) { try { packageManager.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES); ApplicationInfo ai = packageManager.getApplicationInfo(packagename, 0); return ai.enabled; } catch (PackageManager.NameNotFoundException e) { return false; } } private String geocodeAddressToLatLon(String address) throws Exception { String result; String errMsg = "Unable to geocode coords from address '"+address; if(!geocodingEnabled){ throw new Exception("Geocoding disabled: "+errMsg); } if(!isNetworkAvailable()){ throw new Exception("No internet connection: "+errMsg); } address = address.replaceAll(" ", "%20"); JSONObject oResponse = doGeocode("address=" + address); double longitude = oResponse .getJSONObject("geometry").getJSONObject("location") .getDouble("lng"); double latitude = oResponse .getJSONObject("geometry").getJSONObject("location") .getDouble("lat"); result = latitude+","+longitude; logger.debug("Geocoded '"+address+"' to '"+result+"'"); return result; } private String reverseGeocodeLatLonToAddress(String latLon) throws Exception { String result; String errMsg = "Unable to reverse geocode address from coords '"+latLon; if(!geocodingEnabled){ throw new Exception("Geocoding is disabled: "+errMsg); } if(!isNetworkAvailable()){ throw new Exception("No internet connection: "+errMsg); } JSONObject oResponse = doGeocode("latlng=" + latLon); result = oResponse.getString("formatted_address"); logger.debug("Reverse geocoded '"+latLon+"' to '"+result+"'"); return result; } private JSONObject doGeocode(String query) throws Exception{ if(this.googleApiKey == null){ throw new Exception("Google API key has not been specified"); } String url = "https://maps.google.com/maps/api/geocode/json?" + query + "&sensor=false&key="+this.googleApiKey; Request request = new Request.Builder() .url(url) .build(); Response response = httpClient.newCall(request).execute(); String responseBody = response.body().string(); JSONObject oResponse = new JSONObject(responseBody); if(oResponse.has("error_message")){ throw new Exception(oResponse.getString("error_message")); } return ((JSONArray)oResponse.get("results")).getJSONObject(0); } private boolean isNull(String arg){ return arg == null || arg.equals("null"); } private JSONObject ensureNavigateKeys(JSONObject params) throws Exception{ for(String param : navigateParams){ if(!params.has(param)){ params.put(param, "null"); } } return params; } private String getAppDisplayName(String packageName){ String name = "[Not found]"; if(packageName.equals(GEO)){ return "[Native chooser]"; } for (Map.Entry<String, String> entry : availableApps.entrySet()) { String _appName = entry.getKey(); String _packageName = entry.getValue(); if(packageName.equals(_packageName)){ name = _appName; break; } } return name; } private String getThisAppName(){ return context.getApplicationInfo().loadLabel(packageManager).toString(); } private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } }
b2cb9880b6012d86311b3bc3744e7f09dab100a2
e268a12329c43ed983c9701fae4675570b0154d8
/app/src/main/java/com/info/movies/fargments/watchlist/WatchlistFragment.java
c175c2e7d9cde03ab7cf2dbfd0ab4d5a4f39fd72
[]
no_license
EhabSalah/InfoMovies
46d77a9029681215c28b45ffb04c2f09bfe31fc8
84c05ba443b9dbc5ff30563a062e8886cf7835d2
refs/heads/master
2021-06-25T02:52:15.180931
2020-11-13T15:47:28
2020-11-13T15:47:28
148,693,769
0
1
null
null
null
null
UTF-8
Java
false
false
6,083
java
package com.info.movies.fargments.watchlist; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.AppBarLayout; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SearchView; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.TextView; import com.info.movies.R; import com.info.movies.db.DBHelper; import com.info.movies.models.WatchlistItem; import com.info.movies.MainActivity; import com.info.movies.fargments.movie.MovieFragment; import com.info.movies.fargments.watchlist.adapters.WatchlistAdapter; import java.util.ArrayList; /** * A simple {@link Fragment} subclass. */ public class WatchlistFragment extends Fragment implements WatchlistView { private Toolbar toolbar; private TextView title; private OnWatchlistFragmentInteractionListener mListener; public WatchlistFragment() { // Required empty public constructor } RelativeLayout empty_watchlist_layout; RecyclerView watchlist_recyclerview; WatchlistPresenter mWatchlistPresenter; private RecyclerView.LayoutManager layoutManager; private WatchlistAdapter mAdapter; @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof OnWatchlistFragmentInteractionListener) { mListener = (OnWatchlistFragmentInteractionListener) context; } else { throw new RuntimeException(context.toString() + " must implement OnAboutFragmentInteractionListener"); } } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); mWatchlistPresenter = new WatchlistPresenterIMP(this); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_watchlist, container, false); initViews(v); DBHelper mDb = new DBHelper(getContext()); initToolbar(toolbar, title); mWatchlistPresenter.onCreate(mDb); return v; } void initToolbar(Toolbar toolbar, TextView title) { SearchView mSearchView = toolbar.findViewById(R.id.mySearchView); mSearchView.setVisibility(View.GONE); // hide the search view title.setText(R.string.watchlist); title.setVisibility(View.VISIBLE); } private void initViews(View v) { empty_watchlist_layout = v.findViewById(R.id.watchlist_fragment_empty_watchlist_layout); watchlist_recyclerview = v.findViewById(R.id.watchlist_fragment_reciclerview); toolbar = getActivity().findViewById(R.id.toolbar); title = toolbar.findViewById(R.id.toolbar_title); ((MainActivity) getActivity()).showAppBarIfCollapsed(); AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams(); params.setScrollFlags(0); } @Override public void onResume() { super.onResume(); mListener.onWatchlistFragmentOpened(); } @Override public void onPrepareOptionsMenu(Menu menu) { MenuItem item_search = menu.findItem(R.id.action_search).setVisible(false); MenuItem item_sort = menu.findItem(R.id.action_sort).setVisible(false); MenuItem item_select_date = menu.findItem(R.id.action_date_select).setVisible(false); MenuItem item_genre = menu.findItem(R.id.action_genre).setVisible(false); } @Override public void showRecyclerview() { watchlist_recyclerview.setVisibility(View.VISIBLE); } @Override public void hideRecyclerview() { watchlist_recyclerview.setVisibility(View.GONE); } @Override public void showEmptyLayout() { empty_watchlist_layout.setVisibility(View.VISIBLE); } @Override public void hideEmptyLayout() { empty_watchlist_layout.setVisibility(View.GONE); } public void receiveWatchlist(ArrayList<WatchlistItem> w) { Log.d("TAG_W", "receiveWatchlist: " + w.size()); layoutManager = new LinearLayoutManager(getActivity()); watchlist_recyclerview.setLayoutManager(layoutManager); watchlist_recyclerview.setHasFixedSize(true); mAdapter = new WatchlistAdapter(w, getActivity(), mWatchlistPresenter); watchlist_recyclerview.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); } @Override public void setToolbarTitle(String size) { Log.d("TAG_W", "setToolbarTitle: " + size); if (TextUtils.isEmpty(size)) { title.setText(R.string.watchlist); } else { title.setText(getResources().getString(R.string.watchlist) + " (" + size + ")"); } } @Override public void moveToMoviePage(String id, String title) { MovieFragment mMovieFragment = new MovieFragment(); Bundle bundle = new Bundle(); bundle.putString("movie_id_key", id); bundle.putString("movie_title_key", title); mMovieFragment.setArguments(bundle); getActivity().getSupportFragmentManager(). beginTransaction(). replace(R.id.main_container, mMovieFragment). addToBackStack(null). commit(); } @Override public void onDetach() { super.onDetach(); mListener = null; } public interface OnWatchlistFragmentInteractionListener { // TODO: Update argument type and name void onWatchlistFragmentOpened(); } }
5994db3253d012f5fcc6bf9db6251cbf008e521a
ccc4c1a3e5d7a358e904cae2737e7d523a1a5571
/L7/src/Pair.java
bea8f7062d91dca9313721d437f6e1904e06a8ca
[]
no_license
WILLYWZ/C343-Class
b686748732d42781892ebd010054fb0bc2c5d1a1
a83d7139220d9b47c0a15b9135ffad3ff88baf52
refs/heads/master
2023-07-11T07:42:48.742893
2021-08-22T05:41:54
2021-08-22T05:41:54
398,723,379
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
class Pair<A,B> { private A a; private B b; Pair (A a, B b) { this.a = a; this.b = b; } A getFirst () { return a; } B getSecond () { return b; } @Override public boolean equals(Object o) { if (!(o instanceof Pair)) return false; else { Pair<A,B> that = (Pair<A,B>) o; return a.equals(that.a) && b.equals(that.b); } } @Override public int hashCode() { return a.hashCode() + 31 * b.hashCode(); } @Override public String toString () { return "<" + a + "," + b + ">"; } }
756516a3b21fe7fd6f13c62420f5895302198a61
e2a7b4a6957e7dbc7d9ff140f1c905f0a5b95e79
/seashop_api/src/main/java/com/haojing/controller/admin/AdminCarouselController.java
59885a2ab10295a1a9c577f4777610e093265248
[]
no_license
qq1071215950/seashop
b57689ae9bf91d12ccb19b6a70572e9ae08bf964
a3319fdff48b334d357949f75beafd657399549a
refs/heads/master
2022-06-27T16:24:24.858108
2020-02-13T07:20:24
2020-02-13T07:20:24
238,824,245
0
0
null
2022-06-21T02:45:18
2020-02-07T02:01:33
Java
UTF-8
Java
false
false
2,912
java
package com.haojing.controller.admin; import com.haojing.bo.CarouselBO; import com.haojing.result.ResponseResult; import com.haojing.service.CarouselService; import com.haojing.service.CategoryService; import com.haojing.service.ItemService; import io.jsonwebtoken.Claims; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @Api(value = "首页轮播图", tags = {"管理员操作首页轮播图管理"}) @RestController @RequestMapping("carousle") @CrossOrigin public class AdminCarouselController { @Autowired private CarouselService carouselService; @Autowired private ItemService itemService; @Autowired private CategoryService categoryService; @Autowired private HttpServletRequest request; @ApiOperation(value = "添加首页轮播", notes = "添加首页轮播对象", httpMethod = "POST") @PostMapping("/add") public ResponseResult addCarousel(@RequestBody CarouselBO carouselBO) { Claims claims = (Claims) request.getAttribute("admin_claims"); if (claims == null){ return ResponseResult.errorMsg("您还没有登录,没有权限操作"); } if (StringUtils.isBlank(carouselBO.getImageUrl()) || StringUtils.isBlank(carouselBO.getItemId()) || StringUtils.isBlank(carouselBO.getCatId())) { return ResponseResult.errorMsg("轮播信息的图片或者所属商品或者所属分类为空"); } if (carouselBO.getIsShow() == null) { carouselBO.setIsShow(1); } if (carouselBO.getType() == null) { carouselBO.setType(4); } Boolean flag1 = categoryService.queryCategoryIsExit(carouselBO.getCatId()); if (!flag1){ return ResponseResult.errorMsg("分类信息不存在"); } Boolean flag2 = itemService.queryItemIsExit(carouselBO.getItemId()); if (!flag2){ return ResponseResult.errorMsg("商品信息不存在"); } carouselService.addCarousel(carouselBO); return ResponseResult.ok(); } @ApiOperation(value = "删除首页轮播", notes = "删除首页轮播", httpMethod = "PUT") @PutMapping("/delete") public ResponseResult deleteCarousel(@RequestParam String carouselId) { Claims claims = (Claims) request.getAttribute("admin_claims"); if (claims == null){ return ResponseResult.errorMsg("您还没有登录,没有权限操作"); } if (StringUtils.isBlank(carouselId)){ return ResponseResult.errorMsg("请选择分类"); } carouselService.deleteCarouselById(carouselId); return ResponseResult.ok(); } }
bfec61881e48acf6bc4c4f585ec9d06be61dd20b
2cf417b9c3d5f26720043b64e7b1c31acb897902
/src/test/java/com/cashkaro/test/TestCases.java
50e9034c9794eac013331927ddd7e93c2b969912
[]
no_license
shivavelu/cashkaroassign
c496025956646391ee03e43ecba13028d02c5a48
8119647b87ae072ce347d7c1c34aadad16dd70e4
refs/heads/master
2020-04-04T01:14:14.296389
2018-11-02T07:35:32
2018-11-02T07:35:32
155,673,876
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
package com.cashkaro.test; import org.openqa.selenium.WebDriver; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.cashkaro.base.TestBase; import com.cashkaro.pages.HomePage; import com.cashkaro.pages.LoginPage; import com.cashkaro.pages.UserPage; public class TestCases extends TestBase { public WebDriver driver; public HomePage homePage; public LoginPage loginPage; public UserPage userPage; @BeforeClass public void setUp() { this.driver = initialization("browser"); homePage = new HomePage(driver); loginPage= new LoginPage(driver); userPage= new UserPage(driver); } @Test public void loginApp() { homePage.clickJinFree().joinFB().performLoginPopupWindow(prop.getProperty("userEmail"), prop.getProperty("userPassword")).getEmail(); Assert.assertEquals(prop.getProperty("fullName"), userPage.txtUserEmail.getAttribute("value")); } @Test public void forgotPassword() { userPage.logOut().forgetPasswordClick(); } }