blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
b68adde2677aabd25ca91479b11fcd013884fe5a
9af66513ec14de12e8307d59ae03348d93f6a68a
/Variables/src/com/java21days/InstanceCounter.java
bec7b2c081a9ee5fa5d762a9b30a4bd42dbcf2ee
[]
no_license
WeStudyTogether/xqyjstudy
79e206b5c9c61591a78759dfc60a8a3973481153
2d1fffc6e38b8bdabe422b2750e503e660415bf6
refs/heads/master
2020-12-21T05:24:05.225747
2020-05-04T13:35:31
2020-05-04T13:35:31
236,321,418
0
0
null
null
null
null
UTF-8
Java
false
false
686
java
package com.java21days; public class InstanceCounter { private static int numInstances = 0; protected static int getCount() { return numInstances; } private static void addInstance() { numInstances++; } InstanceCounter(){ InstanceCounter.addInstance(); } public static void main(String[] arguments) { System.out.println("starting with " + InstanceCounter.getCount() + " objects"); for (int i = 0; i < 500; ++i) { new InstanceCounter(); } System.out.println("Created " + InstanceCounter.getCount() + "objects"); } }
0d96abb1359585eb78aed8e6668e33c5bffbe2b5
15c2ce849ae58aca9742438bc0be411e458159bf
/backend/src/main/java/com/common/utils/file/FileUtils.java
0c1adef6c1066875a7a7df116ddd666edea6869c
[]
no_license
wangershu/neusoft-BSP
eabfc8852214172a6f8ff783c7277abaa392eea6
1fce40212e1feedff6f49f25cc004ea7651bd79b
refs/heads/master
2022-11-18T12:05:01.656133
2020-07-19T11:18:49
2020-07-19T11:18:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,822
java
package com.common.utils.file; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import javax.servlet.http.HttpServletRequest; /** * 文件处理工具类 */ public class FileUtils { public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; public static void writeBytes(String filePath, OutputStream os) throws IOException { FileInputStream fis = null; try { File file = new File(filePath); if (!file.exists()) { throw new FileNotFoundException(filePath); } fis = new FileInputStream(file); byte[] b = new byte[1024]; int length; while ((length = fis.read(b)) > 0) { os.write(b, 0, length); } } catch (IOException e) { throw e; } finally { if (os != null) { try { os.close(); } catch (IOException e1) { e1.printStackTrace(); } } if (fis != null) { try { fis.close(); } catch (IOException e1) { e1.printStackTrace(); } } } } public static boolean deleteFile(String filePath) { boolean flag = false; File file = new File(filePath); if (file.isFile() && file.exists()) { file.delete(); flag = true; } return flag; } public static boolean isValidFilename(String filename) { return filename.matches(FILENAME_PATTERN); } public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException { final String agent = request.getHeader("USER-AGENT"); String filename = fileName; if (agent.contains("MSIE")) { filename = URLEncoder.encode(filename, "utf-8"); filename = filename.replace("+", " "); } else if (agent.contains("Firefox")) { filename = new String(fileName.getBytes(), "ISO8859-1"); } else if (agent.contains("Chrome")) { filename = URLEncoder.encode(filename, "utf-8"); } else { filename = URLEncoder.encode(filename, "utf-8"); } return filename; } }
a0f5cca5e066b633760e638a4c9bfa6459aeeb7a
b3dce67c9d47e82d709836ee73869efa090290d2
/designpattern/src/main/java/com/example/designpattern/creationalpattern/abstractfactorypattern/Bank.java
7ff673502d23d802988cc63123760d0a5b4cbd26
[ "MIT" ]
permissive
moktar/DesignPattern
d4c8e05658a3e2f921ab2175b10a2bc8c0d8958f
c18716be1fc7d7dd5e20c030d31e4f30deea1d45
refs/heads/master
2021-06-19T04:46:35.154205
2021-02-09T10:14:32
2021-02-09T10:14:32
172,329,360
1
0
null
null
null
null
UTF-8
Java
false
false
146
java
package com.example.designpattern.creationalpattern.abstractfactorypattern; import java.io.*; public interface Bank { String getBankName(); }
f16a733c676f6e8ed8bbd35cd1890220cfe3119a
7e07c5d5b0568400a4e60bb8ea4ab764d9252abc
/ProvaCorsoKennedy/src/com/itskennedy/corsoCloudDeveloper/ClasseProva.java
d8c13ef79344ee2be7f9c1c330dc7a0fb24b45c0
[]
no_license
y994379/ProvaCorsoKennedy
e90402dcb7e219e5b5c18c67ac44ca7e47e10f04
64908d9c342c4933596c703353c3dd1fad9b160b
refs/heads/master
2023-03-12T07:27:15.035167
2021-03-03T09:13:34
2021-03-03T09:13:34
344,056,949
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package com.itskennedy.corsoCloudDeveloper; public class ClasseProva { public static void main(String[] args) { // TODO Auto-generated method stub String s = new String(""); } private void test() { System.out.println(""); } private void secondoTest() { System.out.println("riciao"); } }
de6b4dcf4bde718219fc2d5c7171ea02db29babf
350ca0471d643d7b4af3d576506cfa66db4ae138
/app/src/main/java/com/autoever/apay_user_app/ui/auth/AuthNavigator.java
a9e50e683145d802c67aa4c0a8a38aeff64b1bd5
[]
no_license
myhency/apay-user-app-mvvm
4b057e5a4a6c218e045f70dd3bff13fd056f1b0d
ac92b388ef2196658e7aa60e53f082ae633e31c3
refs/heads/master
2022-12-11T17:00:00.098757
2020-09-20T02:02:47
2020-09-20T02:02:47
278,596,429
0
0
null
null
null
null
UTF-8
Java
false
false
80
java
package com.autoever.apay_user_app.ui.auth; public interface AuthNavigator { }
5f21ddb9a16412d7b4fb8f6dfb61637b73d570fd
ce7fd7addd97c744fb9a6c315efbf2887b362233
/app/build/generated/not_namespaced_r_class_sources/release/processReleaseResources/r/android/support/swiperefreshlayout/R.java
546dd17ab0586280bec1e0b15996e6ce87f21170
[]
no_license
irwan75/Apfiqro
b9763173021c52543706a12448c1bbc864713579
79a4ba8d326277ec5e15f5d6f06d0079612fd2dc
refs/heads/master
2022-11-18T14:56:39.998653
2020-07-19T14:44:41
2020-07-19T14:44:41
280,885,390
0
0
null
null
null
null
UTF-8
Java
false
false
10,465
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.swiperefreshlayout; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f030027; public static final int font = 0x7f0300d7; public static final int fontProviderAuthority = 0x7f0300d9; public static final int fontProviderCerts = 0x7f0300da; public static final int fontProviderFetchStrategy = 0x7f0300db; public static final int fontProviderFetchTimeout = 0x7f0300dc; public static final int fontProviderPackage = 0x7f0300dd; public static final int fontProviderQuery = 0x7f0300de; public static final int fontStyle = 0x7f0300df; public static final int fontVariationSettings = 0x7f0300e0; public static final int fontWeight = 0x7f0300e1; public static final int ttcIndex = 0x7f030208; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f050075; public static final int notification_icon_bg_color = 0x7f050076; public static final int ripple_material_light = 0x7f050081; public static final int secondary_text_default_material_light = 0x7f050083; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f06004e; public static final int compat_button_inset_vertical_material = 0x7f06004f; public static final int compat_button_padding_horizontal_material = 0x7f060050; public static final int compat_button_padding_vertical_material = 0x7f060051; public static final int compat_control_corner_material = 0x7f060052; public static final int compat_notification_large_icon_max_height = 0x7f060053; public static final int compat_notification_large_icon_max_width = 0x7f060054; public static final int notification_action_icon_size = 0x7f0600c0; public static final int notification_action_text_size = 0x7f0600c1; public static final int notification_big_circle_margin = 0x7f0600c2; public static final int notification_content_margin_start = 0x7f0600c3; public static final int notification_large_icon_height = 0x7f0600c4; public static final int notification_large_icon_width = 0x7f0600c5; public static final int notification_main_column_padding_top = 0x7f0600c6; public static final int notification_media_narrow_margin = 0x7f0600c7; public static final int notification_right_icon_size = 0x7f0600c8; public static final int notification_right_side_padding_top = 0x7f0600c9; public static final int notification_small_icon_background_padding = 0x7f0600ca; public static final int notification_small_icon_size_as_large = 0x7f0600cb; public static final int notification_subtext_size = 0x7f0600cc; public static final int notification_top_pad = 0x7f0600cd; public static final int notification_top_pad_large_text = 0x7f0600ce; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f070090; public static final int notification_bg = 0x7f070091; public static final int notification_bg_low = 0x7f070092; public static final int notification_bg_low_normal = 0x7f070093; public static final int notification_bg_low_pressed = 0x7f070094; public static final int notification_bg_normal = 0x7f070095; public static final int notification_bg_normal_pressed = 0x7f070096; public static final int notification_icon_background = 0x7f070097; public static final int notification_template_icon_bg = 0x7f070098; public static final int notification_template_icon_low_bg = 0x7f070099; public static final int notification_tile_bg = 0x7f07009a; public static final int notify_panel_notification_icon_bg = 0x7f07009b; } public static final class id { private id() {} public static final int action_container = 0x7f08000e; public static final int action_divider = 0x7f080010; public static final int action_image = 0x7f080011; public static final int action_text = 0x7f080017; public static final int actions = 0x7f080018; public static final int async = 0x7f08001f; public static final int blocking = 0x7f080023; public static final int chronometer = 0x7f08002d; public static final int forever = 0x7f08004f; public static final int icon = 0x7f080057; public static final int icon_group = 0x7f080058; public static final int info = 0x7f08005c; public static final int italic = 0x7f08005f; public static final int line1 = 0x7f080066; public static final int line3 = 0x7f080067; public static final int normal = 0x7f080076; public static final int notification_background = 0x7f080077; public static final int notification_main_column = 0x7f080078; public static final int notification_main_column_container = 0x7f080079; public static final int right_icon = 0x7f08008f; public static final int right_side = 0x7f080090; public static final int tag_transition_group = 0x7f0800bf; public static final int tag_unhandled_key_event_manager = 0x7f0800c0; public static final int tag_unhandled_key_listeners = 0x7f0800c1; public static final int text = 0x7f0800c2; public static final int text2 = 0x7f0800c3; public static final int time = 0x7f0800cb; public static final int title = 0x7f0800cc; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f09000e; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0b0036; public static final int notification_action_tombstone = 0x7f0b0037; public static final int notification_template_custom_big = 0x7f0b003e; public static final int notification_template_icon_group = 0x7f0b003f; public static final int notification_template_part_chronometer = 0x7f0b0043; public static final int notification_template_part_time = 0x7f0b0044; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0d0037; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0e0115; public static final int TextAppearance_Compat_Notification_Info = 0x7f0e0116; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e0118; public static final int TextAppearance_Compat_Notification_Time = 0x7f0e011b; public static final int TextAppearance_Compat_Notification_Title = 0x7f0e011d; public static final int Widget_Compat_NotificationActionContainer = 0x7f0e01c4; public static final int Widget_Compat_NotificationActionText = 0x7f0e01c5; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f030027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0300d9, 0x7f0300da, 0x7f0300db, 0x7f0300dc, 0x7f0300dd, 0x7f0300de }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0300d7, 0x7f0300df, 0x7f0300e0, 0x7f0300e1, 0x7f030208 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
7feacd6b2f762306079993db80def8e97785838c
6cd396562999711f741c42aa107b4f19eafb3009
/src/com/javaex/ex02/Friend.java
ffd3fbfde6c5e11be8eed014765aba2859373934
[]
no_license
Yaezy-Hwang/Practice09
563c354c2154c3eab84c7cb2a5abc0716b56ca47
d8465b4c38fc7da3c1c3cdc755053aa7d0de3df6
refs/heads/master
2022-09-14T19:06:23.248887
2020-05-28T07:03:12
2020-05-28T07:03:12
267,268,506
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.javaex.ex02; public class Friend { //필드 private String name; private String hp; private String school; //생성자 public Friend() {} public Friend(String name, String hp, String school) { this.name = name; this.hp = hp; this.school = school; } //getter setter public String getName() { return name; } public void setName(String name) { this.name = name; } public String getHp() { return hp; } public void setHp(String hp) { this.hp = hp; } public String getSchool() { return school; } public void setSchool(String school) { this.school = school; } //일반 메소드 public void showInfo() { System.out.println("이름: "+name+"\t핸드폰: "+hp+"\t학교:"+school); } }
5622a4204e043dc4fb2926d23d58ef660b9da605
5edb2bb9c663fbcff2c8b708667b4dc387987834
/Assignment3/src/ManagerofSystem.java
485f8c2b25b60cae597665fc149b25af9bd2afc0
[]
no_license
b21727762/Assignment3
908772982daea3f5f51760adb70af7f04f76a1e6
557eb2a2e7d74d4e87d9826492425ec94cde8563
refs/heads/master
2020-03-13T19:57:41.384406
2018-04-27T07:56:49
2018-04-27T07:56:49
131,264,279
0
0
null
null
null
null
UTF-8
Java
false
false
11,968
java
import java.io.*; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class ManagerofSystem extends CostumerDAOImp{ public static void ReadFile(ArrayList<Customer> customerList,ArrayList<Order> orderlist) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { Scanner scanner = null; FileOutputStream customerout =null; try { customerout = new FileOutputStream("output.txt"); } catch (FileNotFoundException e) { e.printStackTrace(); } /*input file reading*/ CustomerDAO customerDAO = new CostumerDAOImp(); /* created an object for reach the DAO*/ OrderDAO orderDAO=new OrderDAOImp(); FileInputStream customer = null; try { scanner = new Scanner(new FileReader("input.txt")); int counter = 0; while (scanner.hasNextLine()) { String customerInformation = scanner.nextLine(); String[] customerArray = customerInformation.split(" ",6); if (customerArray[0].equalsIgnoreCase("AddCustomer")){ Customer customerobj = new Customer(customerArray[1],customerArray[2],customerArray[3],customerArray[4],customerArray[5]); customerDAO.addCustomer(customerobj,customerList); System.out.println("Costumer "+customerobj.getName()+" created"); String s = "Costumer " + customerobj.getName()+" created"+"\n"; byte[] yaz = s.getBytes(); customerout.write(yaz); } else if(customerArray[0].equalsIgnoreCase("RemoveCustomer")){ String searchingID = customerArray[1]; for(int a = 0; a<customerList.size();a++) { if(customerList.get(a).getID().equals(searchingID)) { System.out.println("Customer "+customerList.get(a).getID()+" "+customerList.get(a).getName()+" removed"); String s = "Customer "+customerList.get(a).getID()+" "+customerList.get(a).getName()+" removed\n"; byte[] yaz = s.getBytes(); customerout.write(yaz); } } customerDAO.deleteCustomer(customerArray[1],customerList); } else if(customerArray[0].equalsIgnoreCase("CreateOrder")){ ArrayList<String > currentList = new ArrayList<String>(); ArrayList<Integer > costList = new ArrayList<Integer>(); Order orderobj = new Order(customerArray[1],customerArray[2],currentList,costList); orderDAO.addOrder(orderobj,orderlist); } /*remove oorder cmmand*/ else if(customerArray[0].equalsIgnoreCase("RemoveOrder")){ orderDAO.deleteOrder(customerArray[1],orderlist); } else if(customerArray[0].equalsIgnoreCase("ListCustomers")){ //Collections.sort(customerList, Customer.customerComp); System.out.println("Costumer List:"); String s = "Costumer List:\n"; byte[] yaz = s.getBytes(); customerout.write(yaz); for(int a = 0; a<customerList.size();a++) { System.out.println(customerList.get(a).getID()+" "+customerList.get(a).getName()+" "+customerList.get(a).getSurname()+" "+customerList.get(a).getTphone()); String s1 =(customerList.get(a).getID()+" "+customerList.get(a).getName()+" "+customerList.get(a).getSurname()+" "+customerList.get(a).getTphone()+"\n"); byte[] yaz1 = s1.getBytes(); customerout.write(yaz1); } customerDAO.getAllCustomer(customerList); } else if(customerArray[0].equalsIgnoreCase("AddPizza")) { String orderID = customerArray[1]; int lineLenght = customerArray.length; for (int a = 0; a < orderlist.size(); a++) { if (orderlist.get(a).getOrderID().equals(orderID)) { if (lineLenght > 6) { System.out.println("Unacceptable Order!!"); String s = "Unacceptable Order!!\n"; byte[] yaz = s.getBytes(); customerout.write(yaz); } else { boolean control = true; for (int i = 2; i < lineLenght; i++) { if (!(customerArray[i].equalsIgnoreCase("AmericanPan") || customerArray[i].equalsIgnoreCase("Neopolitan") || customerArray[i].equalsIgnoreCase("Onion") || customerArray[i].equalsIgnoreCase("Salami") || customerArray[i].equalsIgnoreCase("Soudjouk") || customerArray[i].equalsIgnoreCase("HotPepper"))) { System.out.println("Unacceptabe Topping"); String s = ("Unacceptabe Topping\n"); byte[] yaz = s.getBytes(); customerout.write(yaz); control = false; } } if (control) { PlainPizza newPizza = new PlainPizza(); for (int w = 2; w < lineLenght; w++) { Class<ToppingDecorator> classA = (Class<ToppingDecorator>) Class.forName(customerArray[w]); Constructor AConst = classA.getConstructor(); newPizza.addTopping((ToppingDecorator) AConst.newInstance()); } orderlist.get(a).pizzaList.add(newPizza.getTopping()); orderlist.get(a).costList.add((int)newPizza.getCost()); if (customerArray[2].equalsIgnoreCase("AmericanPan")) { System.out.println("AmericianPan pizza added to order " + orderID); String s = ("AmericianPan pizza added to order " + orderID+"\n"); byte[] yaz = s.getBytes(); customerout.write(yaz); } else{ System.out.println("Neopolitan pizza added to order " + orderID); String s =("Neopolitan pizza added to order " + orderID+"\n"); byte[] yaz = s.getBytes(); customerout.write(yaz); } } } } } }else if(customerArray[0].equalsIgnoreCase("AddDrink")){ String orderID = customerArray[1]; for(int a = 0;a<orderlist.size();a++){ if(orderlist.get(a).getOrderID().equals(orderID)){ System.out.println("Drink added to "+customerArray[1]); String s = "Drink added to "+customerArray[1]+"\n"; byte[] yaz = s.getBytes(); customerout.write(yaz); orderlist.get(a).pizzaList.add(" softdrink"); orderlist.get(a).costList.add(1); } } } else if(customerArray[0].equalsIgnoreCase("PayCheck")){ System.out.println("PayCheck for order "+customerArray[1]); String s ="PayCheck for order "+customerArray[1]+"\n"; byte[] yaz = s.getBytes(); customerout.write(yaz); int sum = 0; for(int a=0 ; a<orderlist.size();a++){ if((orderlist.get(a).getOrderID()).equalsIgnoreCase(customerArray[1])){ for (int i=0;i<orderlist.get(a).pizzaList.size(); i++){ System.out.println(" "+orderlist.get(a).pizzaList.get(i)+" "+orderlist.get(a).costList.get(i)+"$"); String s1 = " "+orderlist.get(a).pizzaList.get(i)+" "+orderlist.get(a).costList.get(i)+"$"+"\n"; byte[] yaz1 = s1.getBytes(); customerout.write(yaz1); sum += orderlist.get(a).costList.get(i); } System.out.println(" Total: "+sum); String s2 = (" Total: "+sum)+"\n"; byte[] yaz1 = s2.getBytes(); customerout.write(yaz1); } } } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } FileOutputStream cusout =null; try { cusout = new FileOutputStream("customer.txt"); System.out.println("******************************"); for (int count = 0;count<customerList.size();count++){ System.out.println(customerList.get(count).getID()+" "+customerList.get(count).getName()+" "+customerList.get(count).getSurname()+" "+customerList.get(count).getTphone()+" "+customerList.get(count).getAdress()); String s = (customerList.get(count).getID()+" "+customerList.get(count).getName()+" "+customerList.get(count).getSurname()+" "+customerList.get(count).getTphone()+" "+customerList.get(count).getAdress()+"\n"); byte[] yaz1 = s.getBytes(); cusout.write(yaz1); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } FileOutputStream orderout =null; try { orderout = new FileOutputStream("order.txt"); for (int counter = 0;counter<orderlist.size();counter++){ System.out.println(orderlist.get(counter).getOrderID()+" "+orderlist.get(counter).getWhospizza()); String s = orderlist.get(counter).getOrderID()+" "+orderlist.get(counter).getWhospizza()+"\n"; byte[] yaz1 = s.getBytes(); orderout.write(yaz1); for (int a =0;a<orderlist.get(counter).pizzaList.size();a++){ System.out.println(orderlist.get(counter).pizzaList.get(a).toString()); String s1 = orderlist.get(counter).pizzaList.get(a).toString()+"\n"; byte[] yaz = s1.getBytes(); orderout.write(yaz); } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
b1f49614b0bf1b73b50185b7bb70648083e132a5
7a4d77cd8f59f87c6773b5b7a691ae47aa6aed72
/gateway/gateway/src/main/java/com/example/gateway/Zone1.java
30632d1e4992a74b7db649fe5030a70a128d7944
[]
no_license
venkatesh010/EurekaClusterWithSSL
8bc1d76be02c7a5645f93d8f6b1a215ddf46d554
dc57617b62999439d849d35f34708b4562258d28
refs/heads/master
2023-05-25T03:56:09.441425
2019-08-04T16:47:07
2019-08-04T16:47:07
197,930,887
0
0
null
2021-06-04T02:05:28
2019-07-20T13:00:57
Java
UTF-8
Java
false
false
337
java
package com.example.gateway; import org.springframework.context.annotation.Profile; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController @Profile("zone1") public class Zone1 { @GetMapping("/hello") public String hello(){ return "Gateway"; } }
f55262c2964a1c1a81abd6ed9c189a815366c8b3
bb3baeeb430d073a2a8f9e9c8fd457718fc8c691
/common/src/main/java/com/pilot/common/log/printer/Printer.java
39689303e62796c4e2881bc6e613ee6c061c75ff
[]
no_license
tuacy/DesignWidget
02d337ae27a53996335a707fa476a412857d7fe7
f876a6ebfe242ce35248d70e8d6b2e885e97da12
refs/heads/master
2021-05-01T13:17:43.773026
2018-03-15T10:43:02
2018-03-15T10:43:02
121,074,524
5
1
null
null
null
null
UTF-8
Java
false
false
143
java
package com.pilot.common.log.printer; import com.pilot.common.log.bean.LogInfo; public interface Printer { void print(LogInfo logInfo); }
8aacb37e7b098f986f52956a5d1e177eb722c900
77170083cf40544b78393cc91f7b12a952916a6f
/InvalidDateException.java
8292a9c8334ab847476bcd5d95103f9dc8124e63
[]
no_license
rosscreav/3rdyr-Assignment-2
22da5dd03f1671e1890879d6200f970c18a0e449
45b92d063085a286aaab6b49c08c7cf060da7408
refs/heads/master
2020-08-07T08:50:00.590749
2019-10-07T12:34:04
2019-10-07T12:34:04
213,378,289
0
0
null
null
null
null
UTF-8
Java
false
false
242
java
//My Details //ID:17473436 //Name:Ross Creaven //Creates an Exception class public class InvalidDateException extends Exception { //Constructor for Exception public InvalidDateException(String Error) { super(Error); } }
1fc5e42885b09f866b15ef1336fc3f2df3c56d64
e29ad00b43044f44c80b09be84378542e39aee9f
/spring-redis-pubsub/src/main/java/tujuh/suganda/model/Student.java
8cd7080111234bfba27088e4cc6b255cfd43fc66
[]
no_license
ridergalau/git-project-spring-example
26c1d3c37e78a74b7891d02299ad29ace50af89f
cf02e442522f44b58b51dc0f2dcaa486811929d1
refs/heads/master
2021-08-30T13:45:45.042547
2017-12-18T06:21:32
2017-12-18T06:21:32
103,476,510
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package tujuh.suganda.model; import java.io.Serializable; public class Student implements Serializable { public enum Gender { MALE, FEMALE } private String id; private String name; private Gender gender; private int grade; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Gender getGender() { return gender; } public void setGender(Gender gender) { this.gender = gender; } public int getGrade() { return grade; } public void setGrade(int grade) { this.grade = grade; } @Override public String toString() { return "Student [id=" + id + ", name=" + name + ", gender=" + gender + ", grade=" + grade + "]"; } }
15e21db306ede556d3e5c08a9c9078446db150d1
75e42966ec1358d0396b50d378ca8105649e64f9
/src/main/java/com/gumi/freemarker/freemarker/freeMarkerTest.java
912229b7acf729518e415ed1703249d8c35502d7
[]
no_license
jackywy/converter
76348f9f7669b9bda41eab86d1d2629b93e52a23
25228ebf8a47d6ec3311f6e2fed7b38465907b1f
refs/heads/master
2020-03-20T03:30:40.066143
2018-06-13T02:08:52
2018-06-13T02:08:52
137,148,732
0
0
null
null
null
null
UTF-8
Java
false
false
2,577
java
package com.gumi.freemarker.freemarker; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; import java.io.*; import java.util.HashMap; import java.util.Map; /** * Created by wangyang on 2018/6/5. */ public class freeMarkerTest { public static void main(String args[]) throws IOException, TemplateException { //1.创建配置实例Cofiguration Configuration cfg = new Configuration(); //2.设置模板文件目录 //(1)src目录下的目录(template在src下) //cfg.setDirectoryForTemplateLoading(new File("src/template")); //(2)完整路径(template在src下) //cfg.setDirectoryForTemplateLoading(new File( // "D:/cpic-env/workspace/javaFreemarker/src/template")); //cfg.setDirectoryForTemplateLoading(new File("src/template")); //(3)工程目录下的目录(template/main在工程下)--推荐 cfg.setDirectoryForTemplateLoading(new File("C:\\freemarker")); //cfg.setObjectWrapper(new DefaultObjectWrapper()); //获取模板(template) Template template = cfg.getTemplate("1.flt"); //建立数据模型(Map) Map<String, String> root = new HashMap<String, String>(); root.put("insuranceNumber", "100000001"); root.put("carOwner", "测试9898"); root.put("telephone", "13566993355"); root.put("idNumber", "其他 222"); root.put("acquisitionPrice", "0.01元"); root.put("address", "上海市宝山区亿博大厦"); root.put("carType", "ARCFOX/LITE/2017款 原力版"); root.put("licenseNumber", "沪A123456"); root.put("vin", "FGYKRVLM62XS295JS"); root.put("engineNumber", "222"); root.put("recordDate", "2018-06-05"); root.put("imeis", "864298010048390,864298010048408"); root.put("repayment", "测试9898"); root.put("insuranceDate", "2018-06-06"); //获取输出流(指定到控制台(标准输出)) // Writer out = new OutputStreamWriter(System.out); // 输出文档路径及名称 File outFile = new File("C:\\freemarker\\freemarkertest.doc"); Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"),10240); //StringWriter out = new StringWriter(); //System.out.println(out.toString()); //数据与模板合并(数据+模板=输出) template.process(root, out); out.flush(); } }
[ "5201314lp" ]
5201314lp
d2a2bf049b923b6535e01e74554db796beb82068
0893fd485517a0b6049246e57e301c240b4c95fb
/contrib/src/test/java/daoo/encoder/InverseEncoderTest.java
a0a90435c2c92650e5a0493523cca786f7af6d8c
[]
no_license
megamingus/taskServerOld
78e6edcb9e9e26afe7768b0b00565748a9be1844
ff231b6e516376904459fe8a56f60e077d5eb73a
refs/heads/master
2020-04-10T00:21:46.553522
2013-05-31T07:12:20
2013-05-31T07:12:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
726
java
package daoo.encoder; /** * Created with IntelliJ IDEA. * User: keevstessens * Date: 17/05/13 * Time: 17:57 * To change this template use File | Settings | File Templates. */ public class InverseEncoderTest extends EncoderTest<InvertEncoder> { private static final InvertEncoder encoder = new InvertEncoder(); public void testEncode(){ String s2 = encoder.encode("Mingus RoxZ"); assertEquals(s2, ("ZxoR sugniM")); } public void testDecode() { String s2 = encoder.decode("OtaG"); assertEquals(s2, ("GatO")); } public void testEncodeDecode() { String s = "OtaG"; String s2 = encoder.decode(s); assertTrue(s2.equals("OtaG")); } }
6fecb0d8a768184a9ee0b5b82948b50a4c3da678
64b9382b4df579a15b59caea977c3b36e204b5cf
/app/src/test/java/com/example/a11201/godsavemeapplication/ExampleUnitTest.java
0a9294a9deb7a4262338929c3d32b64465ac0af5
[]
no_license
callmedingding/MSCS
0e9deb667afafa18e412eafb3a556cfdfbd84a21
96b6906b8d7a6b666636e6d3878ea40db1bea686
refs/heads/master
2020-05-28T08:59:08.226020
2019-06-02T16:03:57
2019-06-02T16:03:57
188,948,100
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
package com.example.a11201.godsavemeapplication; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
126ca733f6d7f56e7398e7be2d5254aa09821d25
d034f3b64a9e5e34e245e75fc7ab8452bd74623b
/src/main/java/com/playernguyen/partyevent/runnable/PartyEventPeriod.java
23caca3be6700f640d1efd30a2ef18af355af031
[]
no_license
PlayerNguyen/PartyEvent
c44c00574bd4badb8d147f5448295bb9ad3ba5b3
f9c861ae95ced9b492bbb1200a0dcaa57f8b9cd8
refs/heads/master
2022-04-16T19:03:25.117787
2020-04-11T20:36:12
2020-04-11T20:36:12
254,521,515
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
package com.playernguyen.partyevent.runnable; import com.playernguyen.partyevent.object.Event; import com.playernguyen.partyevent.time.Realtime; public class PartyEventPeriod extends PartyEventRunnable { private Event event; public PartyEventPeriod(Event event) { this.event = event; } public Event getEvent() { return event; } public void run() { } public Realtime getRealTime() { return getPluginInstance().getRealtime(); } }
a50e3c16be5b9be018f7aac89871d4718f04ce00
90b558ada2110ed2c745ab8de9a54f365b2205fc
/captcha-images/src/main/java/me/zouzhipeng/GeneratorMentor.java
da7e32e548ed5e72dd2f414d966458ce50763056
[ "MIT" ]
permissive
aslongaspossible/captcha-recognition
9306ca79a3f5e0072dc6946f0a915ae2f37c0267
05b43461f37925d7e0f228ca183d2288e007ca0a
refs/heads/master
2023-07-09T11:58:23.418736
2021-08-12T16:19:14
2021-08-12T16:19:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,424
java
package me.zouzhipeng; import java.util.Properties; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.apache.log4j.Logger; import me.zouzhipeng.config.Config; import me.zouzhipeng.config.ConfigConstants; public class GeneratorMentor implements Generator { private static final Logger LOG = Logger.getLogger(GeneratorMentor.class); @Override public void generate(Config config) { int count = Integer.parseInt(config.get(ConfigConstants.COUNT)); int kind = Integer.parseInt(config.get(ConfigConstants.KIND)); String mode = config.get(ConfigConstants.MODE); if (mode.equals(ConfigConstants.EASY_CAPTCHA)) { startWorking(mode, count, kind, config); if (LOG.isInfoEnabled()) { LOG.info("Starting task, current mode: " + mode + "."); } } else if (mode.equals(ConfigConstants.KAPTCHA)) { startWorking(mode, count, kind, config); if (LOG.isInfoEnabled()) { LOG.info("Starting task, current mode: " + mode + "."); } } else { if (LOG.isInfoEnabled()) { LOG.info("WARN: " + mode + " is not be supported, skip this task."); } } } @Override public void generate(Properties prop) { Config cfg = new Config(prop); generate(cfg); } /** * * @param mode * @param count * @param kind * @param config * @throws NullPointerException */ protected void startWorking(String mode, int count, int kind, final Config config) { int size = Integer.parseInt(config.get(ConfigConstants.POOL_SIZE, "20")); ExecutorService pool = Executors.newFixedThreadPool(size); CaptchaGenerator generator = null; for (int i = 0; i < count; i++) { CaptchaTaskRunner runner = new CaptchaTaskRunner(); if (i % (count / kind) == 0) { if (mode.equals(ConfigConstants.KAPTCHA)) { generator = new KaptchaGeneratorWorker(config); } else if (mode.equals(ConfigConstants.EASY_CAPTCHA)) { generator = new EasyCaptchaGeneratorWorker(config); } else { NullPointerException nullGeneratorEx = new NullPointerException("Unsupported mode made generator null."); if (LOG.isTraceEnabled()) { LOG.trace(nullGeneratorEx); } throw nullGeneratorEx; } } runner.setGenerator(generator); pool.submit(runner); } pool.shutdown(); } }
c945ff83e507f788b880f23b0225aebaa75160a7
d86d19d34ef117c96d6b8cb8f896e0fe2421810d
/src/main/java/com/gochinatv/cdn/api/test/maincase/EntityDepthComparison.java
e9ffd1ff2c2bb6c2aeeb48822ef5e91268e9942c
[ "Apache-2.0" ]
permissive
jacktomcat/cdn-api
aa7ec3694bed0b6665ee0181f7802a5caf40ada7
46b3fe5d07a7423429688bbaf2e7089a05057faf
refs/heads/master
2022-12-27T21:16:40.770986
2019-12-26T02:53:55
2019-12-26T02:53:55
84,321,114
0
0
Apache-2.0
2022-12-16T06:16:48
2017-03-08T13:05:56
Java
UTF-8
Java
false
false
1,549
java
package com.gochinatv.cdn.api.test.maincase; import java.util.HashSet; import java.util.Set; import com.gochinatv.cdn.api.test.entity.Album; import com.gochinatv.cdn.api.test.entity.Video; public class EntityDepthComparison { public static void main(String[] args) throws Exception { Set<Video> videos = new HashSet<>(); Set<Album> albums = new HashSet<>(); Album album1 = new Album(); album1.setId(123); album1.setName("album1"); Video video1 = new Video(); video1.setId(1); video1.setName("video1"); video1.setAlbum(album1); video1.setDuration("30"); Album album2 = new Album(); album2.setId(123); album2.setName("album3"); Video video2 = new Video(); video2.setId(1); video2.setAlbum(album2); video2.setName("video1"); video2.setDuration("30"); videos.add(video1); videos.add(video2); albums.add(album1); albums.add(album2); Video video3 = (Video)video2.clone(); video2.setName("after-video2"); video3.setName("after-video3"); video3.getAlbum().setName("after-album3"); System.out.println("albums:"+albums.size()); System.out.println("videos:"+videos.size()); System.out.println("clone album2 to album3"); //这里video2.getAlbum().getName() 只有video里面的album实现了深度clone指向的引用才不是一个引用 System.out.println("video2 name:"+video2.getName()+"---album name ::"+video2.getAlbum().getName()); System.out.println("video3 name:"+video3.getName()+"---album name ::"+video3.getAlbum().getName()); } }
c0169f1ac236a76b8af8581d72103576ca542dcb
4421f7c7149b13fc7e5e2ecba3839cc73c571101
/src/LeetCodeChallenge/Oct2022/LinkedList/LC138.java
afe55b4e8f62c8ea65dbd6d13b0d7318136682c3
[]
no_license
MyvinB/Algo-Learn
ade78c6587cbd892d9622351e0420e1dade338e7
7da34a9d1cf21931c77a3a5acb132a4239ab37f0
refs/heads/master
2023-08-18T15:29:45.561872
2023-08-12T11:11:17
2023-08-12T11:11:17
211,624,753
4
1
null
null
null
null
UTF-8
Java
false
false
1,235
java
package LeetCodeChallenge.Oct2022.LinkedList; class Node { int val; Node next; Node random; public Node(int val) { this.val = val; this.next = null; this.random = null; } } public class LC138 { public static void main(String[] args) { } public Node copyRandomList(Node head) { if(head ==null) return head; //Populate next pointer with the copy Node n = head; //Storing the copy in the next pointer while(n!=null) { Node next = n.next; n.next = new Node(n.val); n.next.next = next; n = n.next.next; } // //Now accomodating the random pointers for copy n = head; while(n!=null){ if(n.random!=null){ n.next.random = n.random.next; } n = n.next.next; } //Deconstructing both the list n = head; Node copy = n.next; Node copyHead = copy; while(copy.next!=null){ n.next = n.next.next; n = n.next; copy.next = copy.next.next; copy = copy.next; } n.next = null; return copyHead; } }
4ffcfa98de59628a43e6bc4b448bb2a36f27f46f
2d3684e26374c456cc352535367973bdab235d22
/java/src/main/java/com/techelevator/dao/UserDao.java
ab5c2e0599ddd01578b259fb68c1640c96f17553
[]
no_license
tjordanv/LMTV
ce9ba3fd8398f468d1a32a79eb629e25d382fab4
d78567bbc7e178a730c34cdcd6af706194bf84e2
refs/heads/main
2023-08-23T02:05:30.979816
2021-10-14T20:38:41
2021-10-14T20:38:41
417,275,422
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.techelevator.dao; import com.techelevator.model.User; import java.util.List; public interface UserDao { List<User> findAll(); User getUserById(Long userId); User findByUsername(String username); int findIdByUsername(String username); boolean create(String username, String email, String password, String role); }
e81792c7784d0dca34155c74cd0510a854bdbb56
7dc02d14c431c549f600897351eac1a30a013803
/manager/src/main/java/com/cms/manager/service/ContentCategoryService.java
6482b0d95c01c2378deb3a2af22c1c67df174aed
[]
no_license
beggar1982/CmsStudy
6e34323c25253b1045ffa3adebcbee4e0f19b941
9522676bb13ae18834461e2844aa768f16c8aadc
refs/heads/master
2022-02-18T09:55:43.996978
2019-09-20T20:19:50
2019-09-20T20:19:50
209,820,191
0
0
null
null
null
null
UTF-8
Java
false
false
579
java
package com.cms.manager.service; import java.util.List; import com.cms.manager.model.vo.CmsResult; import com.cms.manager.model.vo.EUTreeNode; /** * 内容分类管理服务接口定义 * * @author xianfu.xia * @since 2018/12/10 */ public interface ContentCategoryService { List<EUTreeNode> getCategoryList(long parentId); String getCateName(Long cateId); List<EUTreeNode> getCategoryTree(); CmsResult insertContentCategory(long parentId, String nodeName); CmsResult modifyContentCategory(long id, String newName); CmsResult removeContentCategory(long id); }
873bb22abe0d4278ea29c3e372c21bcce6c4ecf3
dc6ac6a03bc1bb7117c3698b24049117c4907093
/android/PilotExample/app/src/main/java/com/kodroid/pilotexample/android/ui/view/FirstView.java
c04e5074458d1ea2a0a6a63aed4460e9f52a5238
[ "Apache-2.0" ]
permissive
doridori/Pilot
f0816dd517875b3fdc0f626e0f71cdfa5f04e285
af603669471a75298edd6a62658d32a684e94453
refs/heads/master
2021-12-11T14:34:21.297647
2021-12-08T10:30:07
2021-12-08T10:30:07
43,503,262
137
16
Apache-2.0
2018-03-10T16:13:25
2015-10-01T15:06:15
Java
UTF-8
Java
false
false
1,357
java
package com.kodroid.pilotexample.android.ui.view; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.widget.FrameLayout; import com.kodroid.pilot.lib.android.frameBacking.PilotFrameBackedUI; import com.kodroid.pilotexample.R; import com.kodroid.pilotexample.android.frames.state.FirstState; public class FirstView extends FrameLayout implements PilotFrameBackedUI<FirstState> { private FirstState backingPilotFrame; //==================================================================// // Constructor //==================================================================// public FirstView(Context context) { super(context); LayoutInflater.from(getContext()).inflate( R.layout.view_first, this, true); setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { backingPilotFrame.moveToNextState(); } }); } @Override public View setBackingPilotFrame(FirstState backingPilotFrame) { this.backingPilotFrame = backingPilotFrame; return this; } @Override public boolean hasBackingFrameSet() { return backingPilotFrame != null; } }
2c9cae865d0cbcc356cffc3cc5d70e8dd936d49c
421f0a75a6b62c5af62f89595be61f406328113b
/generated_tests/model_seeding/102_squirrel-sql-net.sourceforge.squirrel_sql.fw.util.StringManagerFactory-0.5-2/net/sourceforge/squirrel_sql/fw/util/StringManagerFactory_ESTest.java
a1087f6161ec36547a468ce4c95a6fdffc75e0c1
[]
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
682
java
/* * This file was automatically generated by EvoSuite * Tue Oct 29 10:17:21 GMT 2019 */ package net.sourceforge.squirrel_sql.fw.util; 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 StringManagerFactory_ESTest extends StringManagerFactory_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
3beb4406a26c0907fd689697f28e7b97a83a1ea5
723786cfa2a0411609443c61c758a528a4ff3983
/org.insightech.er/src/org/insightech/er/editor/controller/editpart/outline/dictionary/WordOutlineEditPart.java
95c4a667dc49b5579bc67d4ce99e9b3b9ccad731
[]
no_license
houxianghui/ermaster-git
3e825255e5547271e00fffcf1e24055adb51bc84
21ac9c051a5a4f066257b3aeaae50166f177f57a
refs/heads/master
2022-12-15T03:55:34.487716
2020-09-06T07:37:25
2020-09-06T07:37:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,076
java
package org.insightech.er.editor.controller.editpart.outline.dictionary; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.eclipse.gef.DragTracker; import org.eclipse.gef.Request; import org.eclipse.gef.RequestConstants; import org.eclipse.gef.tools.SelectEditPartTracker; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.ui.PlatformUI; import org.insightech.er.ERDiagramActivator; import org.insightech.er.ImageKey; import org.insightech.er.editor.controller.command.diagram_contents.not_element.dictionary.EditWordCommand; import org.insightech.er.editor.controller.editpart.outline.AbstractOutlineEditPart; import org.insightech.er.editor.model.ERDiagram; import org.insightech.er.editor.model.diagram_contents.element.node.category.Category; import org.insightech.er.editor.model.diagram_contents.element.node.table.ERTable; import org.insightech.er.editor.model.diagram_contents.element.node.table.column.ColumnHolder; import org.insightech.er.editor.model.diagram_contents.element.node.table.column.NormalColumn; import org.insightech.er.editor.model.diagram_contents.element.node.view.View; import org.insightech.er.editor.model.diagram_contents.not_element.dictionary.Word; import org.insightech.er.editor.model.diagram_contents.not_element.group.ColumnGroup; import org.insightech.er.editor.model.settings.Settings; import org.insightech.er.editor.view.dialog.word.word.WordDialog; public class WordOutlineEditPart extends AbstractOutlineEditPart { /** * {@inheritDoc} */ @Override protected List getModelChildren() { List<ColumnHolder> wordHolderList = new ArrayList<ColumnHolder>(); List<ERTable> wordHolderList1 = new ArrayList<ERTable>(); List<View> wordHolderList2 = new ArrayList<View>(); List<ColumnGroup> wordHolderList3 = new ArrayList<ColumnGroup>(); ERDiagram diagram = (ERDiagram) this.getRoot().getContents().getModel(); Word word = (Word) this.getModel(); List<NormalColumn> normalColumns = diagram.getDiagramContents() .getDictionary().getColumnList(word); Category category = this.getCurrentCategory(); for (NormalColumn normalColumn : normalColumns) { ColumnHolder columnHolder = normalColumn.getColumnHolder(); if (columnHolder instanceof ERTable) { ERTable table = (ERTable) columnHolder; if (wordHolderList1.contains(table)) { continue; } if (category != null && !category.contains(table)) { continue; } wordHolderList1.add(table); } else if (columnHolder instanceof View) { View view = (View) columnHolder; if (wordHolderList2.contains(view)) { continue; } if (category != null && !category.contains(view)) { continue; } wordHolderList2.add(view); } else if (columnHolder instanceof ColumnGroup) { if (wordHolderList3.contains(columnHolder)) { continue; } wordHolderList3.add((ColumnGroup) columnHolder); } } Collections.sort(wordHolderList1); Collections.sort(wordHolderList2); Collections.sort(wordHolderList3); wordHolderList.addAll(wordHolderList1); wordHolderList.addAll(wordHolderList2); wordHolderList.addAll(wordHolderList3); return wordHolderList; } /** * {@inheritDoc} */ @Override protected void refreshOutlineVisuals() { Word word = (Word) this.getModel(); ERDiagram diagram = (ERDiagram) this.getRoot().getContents().getModel(); int viewMode = diagram.getDiagramContents().getSettings() .getOutlineViewMode(); String name = null; if (viewMode == Settings.VIEW_MODE_PHYSICAL) { if (word.getPhysicalName() != null) { name = word.getPhysicalName(); } else { name = ""; } } else if (viewMode == Settings.VIEW_MODE_LOGICAL) { if (word.getLogicalName() != null) { name = word.getLogicalName(); } else { name = ""; } } else { if (word.getLogicalName() != null) { name = word.getLogicalName(); } else { name = ""; } name += "/"; if (word.getPhysicalName() != null) { name += word.getPhysicalName(); } } this.setWidgetText(diagram.filter(name)); this.setWidgetImage(ERDiagramActivator.getImage(ImageKey.WORD)); } /** * {@inheritDoc} */ @Override public void performRequest(Request request) { Word word = (Word) this.getModel(); ERDiagram diagram = this.getDiagram(); if (request.getType().equals(RequestConstants.REQ_OPEN)) { WordDialog dialog = new WordDialog(PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(), word, false, diagram); if (dialog.open() == IDialogConstants.OK_ID) { EditWordCommand command = new EditWordCommand(word, dialog.getWord(), diagram); this.execute(command); } } super.performRequest(request); } /** * {@inheritDoc} */ @Override public DragTracker getDragTracker(Request req) { return new SelectEditPartTracker(this); } }
a8752b7518383a9167be16650b9a2adef67185ce
e1b3a433bd0c7ee5f867f093f43b9ca09df2ee51
/problem_3/src/problem_3/problem_3.java
5c6703eb33cb5b7850dac2c70868a3ed58fdce03
[]
no_license
AsmaaHasan100/Hw_2
33fb1c44ee5bedce5afe651bceb246ee330168df
ef1c5ad2beb2e46bfe141ed48e9a7b1201eca8d0
refs/heads/master
2020-03-31T15:29:45.683774
2018-10-10T00:37:56
2018-10-10T00:37:56
152,339,587
0
0
null
null
null
null
UTF-8
Java
false
false
48
java
package problem_3; public class problem_3 { }
5a9d1563cb4bd440ad43782b82cfaa38dd16ecc3
d2f36938a30393e6f5fd2d4766b8e1bc1f04a8b1
/src/br/com/simed/crud/CadastroEstados.java
c6195236992a9ffc244efb7963192c13adafdbb0
[]
no_license
windsonsm/SIMED
b660723070631aa73d10456449157dfa793aec9a
990544b84d3a6df1fafe61cb4001a91cf2f13bf7
refs/heads/master
2021-09-08T03:16:56.332689
2018-01-24T17:29:28
2018-01-24T17:29:28
118,165,997
0
0
null
null
null
null
UTF-8
Java
false
false
4,260
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.com.simed.crud; import br.com.simed.dao.conexaoDB; import br.com.simed.model.Estado; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author windsonsm */ public class CadastroEstados { private Connection con; private PreparedStatement stm; private String sql; private ResultSet rs; //Metodo para Incluir Estado public void incluirEstado(Estado estado) throws SQLException{ try { con = conexaoDB.getConexao(); stm = con.prepareStatement(sql="INSERT INTO TBL_ESTADOS(E_SIGLA,E_NOME) VALUES (?,?)"); stm.setString(1, estado.getSiglaEstado()); stm.setString(2, estado.getNomeEstado()); stm.execute(); con.close(); stm.close(); } catch (SQLException | NullPointerException ex) { Logger.getLogger(CadastroEstados.class.getName()).log(Level.SEVERE, null, ex); } } //Metodo para Excluir Estado public void excluirEstado(Estado estado) throws SQLException{ try { con = conexaoDB.getConexao(); stm = con.prepareStatement(sql="DELETE FROM TBL_ESTADOS WHERE E_CODIGO = ?"); stm.setInt(1, estado.getCodigoEstado()); stm.execute(); } catch (SQLException ex) { Logger.getLogger(CadastroEstados.class.getName()).log(Level.SEVERE, null, ex); } } //Metodo para atualizar Estado public void atualizarEstado(Estado estado) throws SQLException{ try { con = conexaoDB.getConexao(); stm = con.prepareStatement(sql="UPDATE TBL_ESTADOS SET E_NOME=?,E_SIGLA=? WHERE E_CODIGO=?"); stm.setString(1, estado.getNomeEstado()); stm.setString(2, estado.getSiglaEstado()); stm.setInt(3,estado.getCodigoEstado()); stm.executeUpdate(); } catch (SQLException ex) { Logger.getLogger(CadastroEstados.class.getName()).log(Level.SEVERE, null, ex); } } //Metodo para listar os estados public ArrayList listarEstados(){ ArrayList dados = new ArrayList(); try { con = conexaoDB.getConexao(); stm = con.prepareStatement(sql="SELECT E_CODIGO,E_NOME,E_SIGLA FROM TBL_ESTADOS ORDER BY E_CODIGO"); rs = stm.executeQuery(); while(rs.next()){ dados.add(new Object[]{rs.getInt("e_codigo"),rs.getString("e_nome"),rs.getString("e_sigla")}); } con.close(); stm.close(); rs.close(); } catch (SQLException ex) { Logger.getLogger(CadastroEstados.class.getName()).log(Level.SEVERE, null, ex); } return dados; } //Metodo para buscar estado por Nome public ArrayList localizarEstado(Estado estado) throws SQLException { ArrayList dados = new ArrayList(); try{ con = conexaoDB.getConexao(); stm = con.prepareStatement(sql="SELECT E_CODIGO,E_NOME,E_SIGLA FROM TBL_ESTADOS WHERE E_NOME LIKE ?"); stm.setString(1,estado.getNomeEstado()+"%"); rs = stm.executeQuery(); while(rs.next()) { dados.add(new Object[]{rs.getInt("e_codigo"),rs.getString("e_nome"),rs.getString("e_sigla")}); } con.close(); rs.close(); stm.close(); }catch(SQLException | NullPointerException ex) { Logger.getLogger(CadastroEstados.class.getName()).log(Level.SEVERE, null, ex); } return dados; } }
[ "Windson@Windson-PC" ]
Windson@Windson-PC
8eb53b3842c8049ba5e55fda108b827e53b2720a
326d03412eaa4d279a5d3d032baea5c556f3ca4c
/src/main/java/com/example/demo/view/RegionsDTO.java
1ab4bffa117803be5a7e4fc17d3c333defc40035
[]
no_license
Mirayne/coursework
f098b9731b7ba11f62160f3b64d344eaeebe593e
bec65fdb2651b208897609ad46771ccc208e3a08
refs/heads/master
2023-06-01T02:12:50.370300
2021-07-11T13:00:20
2021-07-11T13:00:20
384,942,680
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
package com.example.demo.view; import lombok.Data; @Data public class RegionsDTO { private Integer regionId; private String regionBeginAddress; private String regionEndAddress; }
0c5b7e42c2818d96ce624e3c32e71a4f6de615ea
9c00036cd97ed9de538d03ca36012c1e65cb01e4
/app/src/androidTest/java/com/mytaxi/android_demo/model/Constants.java
04d6c65a6cba7a008ce3a8213db48907b40ec465
[]
no_license
rachanab19/AndroidApp-TestAutomation
bada04f63cea3012729799752086b3061d77209d
2be27222690a7bebb3d54322279d8735d63dda33
refs/heads/master
2020-05-30T15:24:18.802422
2019-06-02T10:07:17
2019-06-02T10:07:17
189,817,784
0
0
null
null
null
null
UTF-8
Java
false
false
617
java
package com.mytaxi.android_demo.model; /** * This is a class for constants used in the test framework */ public interface Constants { public static final String URL = "https://randomuser.me/api/?seed=a1f30d446f820665"; public static final String VALID = "valid"; public static final String INVALID = "invalid"; public static final String WITHSPECIALCHARS = "specialchars"; //APP ELEMENT TEXT CONSTANTS public static final String OPEN_NAVIGATION_BAR = "Open navigation drawer"; public static final String LOGOUT = "Logout"; public static final String APPNAME = "mytaxi demo"; }
e19ec49fc81c9046f314255a6e28e4cf2b9356e3
4e7c29d7c0454164992f043765221aeb12adedf6
/src/main/java/br/edu/ulbra/election/election/api/v1/VoteApi.java
7c1ffbde61aa7f1a5a875d03bd943e071a35c78b
[]
no_license
LucasPellisoli/Election
b9eb119ce0b19022dd32b3f1ba818f2b7660099f
0a32071ee1cca6aebaca2e64df8e8b6bb33b3f9a
refs/heads/master
2020-04-02T19:58:42.788325
2018-12-06T21:50:05
2018-12-06T21:50:05
154,753,498
0
0
null
null
null
null
UTF-8
Java
false
false
1,024
java
package br.edu.ulbra.election.election.api.v1; import br.edu.ulbra.election.election.input.v1.VoteInput; import br.edu.ulbra.election.election.output.v1.GenericOutput; import br.edu.ulbra.election.election.service.VoteService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/v1/vote") public class VoteApi { private final VoteService voteService; public VoteApi(VoteService voteService) { this.voteService = voteService; } @PostMapping("/{voteInput}") public GenericOutput electionVote(@RequestHeader(value = "x-token") String token, @RequestBody VoteInput voteInput){ return voteService.electionVote(token, voteInput); } @PutMapping("/multiple") public GenericOutput multipleElectionVote(@RequestHeader(value = "x-token") String token,@RequestBody List<VoteInput> voteInputList){ return voteService.multipleElectionVote(token, voteInputList); } }
a335e2c06fe14ba6012433d14eabb21505418dfd
d8e241630128b88e841c874990231f3253b7ba3a
/src/main/java/com/cqtiq/controller/SwitchController.java
121d50fca3f4a98087dd1ab2e8bbf41c16283e3c
[]
no_license
sxgluxw/cqtiq_project
d458e092d4f7b612b46e3c56738bb13e51dae9c5
755d796bad54b81f7be981742bea2bf5721ec7f4
refs/heads/master
2020-03-15T23:33:46.989416
2018-07-26T03:13:25
2018-07-26T03:13:25
132,396,531
0
0
null
2018-07-26T03:13:26
2018-05-07T02:29:08
JavaScript
UTF-8
Java
false
false
1,681
java
package com.cqtiq.controller; import javax.servlet.http.HttpServletRequest; import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.alibaba.fastjson.JSONArray; import com.cqtiq.mqtt.Server; import com.cqtiq.pojo.Test; import com.cqtiq.service.SwitchService; @Controller public class SwitchController { @Autowired private SwitchService switchService; // @Autowired // private Server server; @RequestMapping("/switch/save") public void saveSwitch(HttpServletRequest request) throws Exception { //保存灯光状态 String parameter = request.getParameter("name"); System.out.println(parameter); Server server = new Server(); server.message = new MqttMessage(); server.message.setQos(2); server.message.setRetained(true); server.message.setPayload(parameter.getBytes()); System.out.println(new String(server.message.getPayload())); server.publish(server.topic , server.message); Test test = switchService.findTest(1); test.setOnoff(parameter); switchService.saveSwitch(test); } @RequestMapping("/switch/query") @ResponseBody public Test querySwitch(Model model) { Test test = switchService.querySwitch(1); // System.out.println("======"+test.getOnoff()); model.addAttribute("list", test); return test; } }
[ "luxuanwang@DESKTOP-MLRP99E" ]
luxuanwang@DESKTOP-MLRP99E
5d1c09d600724a34529a2765def32e063f7c8bc4
06c971b06e89c1d2f31a5ae668ca0b811a348d93
/src/com/topoos/registerpos/MainActivity.java
9aadbd71c0a8e066989f6bc8dd95cca20c1db1c8
[]
no_license
topoos/android_sdk_register_position_example
275d3e63ceac5388f05508561e13818c65aaf98b
f3c17c44d338b601cc6e5f8a0f09e0b1c7d831c1
refs/heads/master
2021-04-12T04:17:06.606949
2012-12-19T17:06:56
2012-12-19T17:06:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,559
java
package com.topoos.registerpos; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.Handler.Callback; import android.app.Activity; import android.content.Context; import android.widget.TextView; import android.widget.Toast; /** * This app is a very simple project that show an example about using Get Position SDK Operation * * www.topoos.com * Read documentation and examples in http://docs.topoos.com */ public class MainActivity extends Activity { private static final String APPTOKEN_USER = "XXXXXXXXXXXXXXXXXXXXXXXX"; public final int WORKER_ERROR = -1; public final int WORKER_OK = 1; private Handler handler = new Handler(new WorkerResultMessageCallback()); private LocationManager mLocationManager; private CustomLocationListener mCustomLocationListener; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //build and save topoos access token in preferences topoos.AccessTokenOAuth token = new topoos.AccessTokenOAuth(APPTOKEN_USER); token.save_Token(this); mCustomLocationListener = new CustomLocationListener(); mLocationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 0, mCustomLocationListener); } @Override protected void onDestroy() { super.onDestroy(); if (mLocationManager != null && mCustomLocationListener != null) { mLocationManager.removeUpdates(mCustomLocationListener); mLocationManager = null; } } /** * Detects changes on device location */ private class CustomLocationListener implements LocationListener{ public void onLocationChanged(Location argLocation) { RegisterPositionWorker worker = new RegisterPositionWorker(argLocation); Thread thread = new Thread(worker); thread.start(); } public void onProviderDisabled(String provider) {} public void onProviderEnabled(String provider) {} public void onStatusChanged(String provider, int status, Bundle extras) {} } /** * Register position on topoos */ private class RegisterPositionWorker implements Runnable { public Location position; public RegisterPositionWorker(Location loc) { position = loc; } public void run(){ try { topoos.Objects.Position p = topoos.Positions.Operations.Add(MainActivity.this, position.getLatitude(), position.getLongitude(), null, null, null, null, null, null, null); Message msg = new Message(); msg.what = WORKER_OK; msg.obj = p; handler.sendMessage(msg); } catch (Exception e) { e.printStackTrace(); handler.sendEmptyMessage(WORKER_ERROR); } } } private class WorkerResultMessageCallback implements Callback { public boolean handleMessage(Message arg0) { switch(arg0.what) { case WORKER_ERROR: Toast.makeText(MainActivity.this, "Error", Toast.LENGTH_LONG).show(); break; case WORKER_OK: topoos.Objects.Position p = (topoos.Objects.Position)arg0.obj; ((TextView)MainActivity.this.findViewById(R.id.positionid)).setText(p.getId().toString()); break; } return true; } } }
15f29fa0a1f1f147d139c0f981d58c66254b075b
9497dd370e2050c5810e611b3e888dd8e7858166
/app/src/main/java/com/example/virtualenvironmentmon/models/daos/LocationsDao.java
3c4db5465a5086cd1e5fb7a65e69963e690b6081
[]
no_license
VertUnix/ProxmoxAndroidMonitor
ace1235a0eb5aed0c7e21e91544c6c159ac7df4b
c88b8bf1931e68e68373a187390cf6fbb3622d35
refs/heads/master
2023-04-29T23:02:22.491058
2021-05-18T10:18:58
2021-05-18T10:18:58
367,419,902
1
0
null
null
null
null
UTF-8
Java
false
false
709
java
package com.example.virtualenvironmentmon.models.daos; import androidx.room.Dao; import androidx.room.Delete; import androidx.room.Insert; import androidx.room.Query; import androidx.room.Update; import com.example.virtualenvironmentmon.models.Locations; import java.util.List; @Dao public interface LocationsDao { @Insert void insert(Locations location); @Query("select * from places") List<Locations> getAll(); @Query("delete from places") void deleteAll(); @Delete void delete(Locations location); @Update void update(Locations location); @Query("select * from places where place_name=:lname limit 1") Locations getLocationByName(String lname); }
145d38ba499e2926a6253b725cbde952eceac369
07f4aa9da52915fc9fb9a787da18ae30b432ca45
/src/com/evs/doctor/model/Comment.java
833f69ce6a6e831857a4d8559ba3ace7be25b84a
[]
no_license
abrysov/Doctor
67c644051dd4e6e156bd196fe9732f7d5ee936d6
232f22e390e59d1e37025e7935ad09a5c076ee20
refs/heads/master
2016-09-15T02:06:20.854798
2016-01-10T09:24:39
2016-01-10T09:24:39
49,340,198
0
0
null
null
null
null
UTF-8
Java
false
false
3,271
java
package com.evs.doctor.model; public class Comment { private Long id; private String authorName; private String authorFullName; private String authorSpecialty; private String authorDegree; private String authorAvatarUrl; private int authorSexId; private String authorId; private String content; private String createdAt; /* * @return Comment's id */ public final Long getId() { return id; } /** * @param Comment's id to set */ public final void setId(Long id) { this.id = id; } /** * @return Comment's author name */ public final String getAuthorName() { return authorName; } /** * @param Comment's author name to set */ public final void setAuthorName(String authorName) { this.authorName = authorName; } /** * @return Comment's author's speciality */ public final String getAuthorSpecialty() { return authorSpecialty; } /** * @param Comment's author's speciality to set */ public final void setAuthorSpecialty(String authorSpecialty) { this.authorSpecialty = authorSpecialty; } /** * @return Comment's author's degree */ public final String getAuthorDegree() { return authorDegree; } /** * @param Comment's author's degree to set */ public final void setAuthorDegree(String authorDegree) { this.authorDegree = authorDegree; } /** * @return Comment's author's avatar url */ public final String getAuthorAvatarUrl() { return authorAvatarUrl; } /** * @param Comment's author's avatar url to set */ public final void setAuthorAvatarUrl(String authorAvatarUrl) { this.authorAvatarUrl = authorAvatarUrl; } /** * @return Comment's author's sex id */ public final int getAuthorSexId() { return authorSexId; } /** * @param Comment's author's sex id to set */ public final void setAuthorSexId(int authorSexId) { this.authorSexId = authorSexId; } /** * @return Comment's author's id */ public final String getAuthorId() { return authorId; } /** * @param Comment's author's id to set */ public final void setAuthorId(String authorId) { this.authorId = authorId; } /** * @return Comment's content */ public final String getContent() { return content; } /** * @param Comment's content to set */ public final void setContent(String content) { this.content = content; } /** * @return Comment's createdAt */ public final String getCreatedAt() { return createdAt; } /** * @param Comment's createdAt to set */ public final void setCreatedAt(String createdAt) { this.createdAt = createdAt; } /** * @return Comment's author's full name */ public final String getAuthorFullName() { return authorFullName; } /** * @param Comment's author's full name to set */ public final void setAuthorFullName(String authorFullName) { this.authorFullName = authorFullName; } }
17cfa96d75b4ab85904475c3ea3e040b3ea2c2d1
9219ab5adeebd481dca2621a2afda3ace0b0bb8d
/src/org/html/parser/ParseUrl.java
f58cbb1c5c15fe1967f2188793e9920184bbeaaa
[]
no_license
mariuso28/UrbanParadigm-candice
bc7f521b61d8d520ad7621fb34b9a284ad54a459
a36af37d1cf3eb3960631c6640343364950273cb
refs/heads/master
2021-01-22T23:00:54.449509
2018-01-03T06:49:48
2018-01-03T06:49:48
92,792,663
0
0
null
null
null
null
UTF-8
Java
false
false
7,542
java
package org.html.parser; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.log4j.Logger; public class ParseUrl { private static final Logger log = Logger.getLogger(ParseUrl.class .getName()); private String name; private UrlParser parser; private HashMap<String,ParseBlock> parseBlocks; private List<ParseBlock> orderedParseBlocks; private String currentField; public ParseUrl(String name) { setName( name ); parseBlocks = new HashMap<String,ParseBlock>(); orderedParseBlocks = new ArrayList<ParseBlock>(); setCurrentField(""); } public void parseUnordered(String source) throws UrlParserException { for (ParseBlock parseBlock : orderedParseBlocks) { setParser( new UrlParser( source ) ); // must go back to start every time parseBlock.parse( parser ); } } public void parse(String source, boolean exitOnFail) throws UrlParserException { setParser( new UrlParser( source, exitOnFail ) ); for (ParseBlock parseBlock : orderedParseBlocks) { parseBlock.parse( parser ); } } public void parse(String source) throws UrlParserException { setParser( new UrlParser( source ) ); for (ParseBlock parseBlock : orderedParseBlocks) { parseBlock.parse( parser ); } } private void setParser(UrlParser parser) { this.parser = parser; } public void addParseBlock(ParseBlock parseBlock) throws UrlParserException { int dot = parseBlock.getName().indexOf( '.' ); if (dot<0) { parseBlocks.put( parseBlock.getName(), parseBlock ); orderedParseBlocks.add(parseBlock); return; } ParseBlock parentParseBlock = getParseBlock( parseBlock.getName().substring(0,dot)); parentParseBlock.addParseBlock( parseBlock.getName().substring(dot+1), parseBlock ); } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { String str = "ParseUrl [name =" + name + " parser=" + parser + ", parseBlocks: \n"; for (ParseBlock parseBlock : parseBlocks.values()) str += parseBlock + "\n"; return str; } public ParseBlock getParseBlock( String blockName ) { int dot = blockName.indexOf('.'); ParseBlock parseBlock; if (dot < 0) { parseBlock = ParseBlock.locateBlock( parseBlocks, blockName); return parseBlock; } parseBlock = ParseBlock.locateBlock( parseBlocks, blockName.substring(0,dot) ); return parseBlock.getParseBlock( blockName.substring(dot+1) ); } class ParseLookup { private ParseBlock block; private String target; ParseLookup(String target) throws UrlParserException { int dot = target.lastIndexOf('.'); if (dot < 0) { log.error("ParseUrl:getValue - malformed target: " + target ); throw new UrlParserException( "ParseUrl:getValue - malformed target: " + target ); } ParseBlock parseBlock = getParseBlock( target.substring(0, dot) ); if (parseBlock == null) { log.error("Entry : " + target + " for ParseUrl : " + getName() + " not found" ); throw new UrlParserException( "Entry : " + target + " for ParseUrl : " + getName() + " not found" ); } setBlock(parseBlock); setTarget(target.substring(dot+1)); } public ParseBlock getBlock() { return block; } public void setBlock(ParseBlock block) { this.block = block; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } } private ParseEntry getParseEntry( ParseLookup parseLookup ) throws UrlParserException { ParseEntry parseEntry = parseLookup.getBlock().getParseEntry( parseLookup.getTarget() ); if (parseEntry == null) { log.error("Entry : " + getCurrentField() + " for ParseUrl : " + getName() + " not found" ); throw new UrlParserException( "Entry : " + getCurrentField() + " for ParseUrl : " + getName() + " not found" ); } return parseEntry; } private String getValueAtIndex( ParseLookup parseLookup ) throws UrlParserException { String target = parseLookup.getTarget(); int epos = target.lastIndexOf(']'); int spos = target.lastIndexOf('['); int index = Integer.parseInt(target.substring(spos+1,epos)); target = target.substring(0,spos); ParseEntryList pel = null; try { int pos = target.indexOf(':'); if (pos < 0) { parseLookup.setTarget(target); pel = (ParseEntryList) getParseEntry(parseLookup); return pel.getValue( index ); } parseLookup.setTarget(target.substring(0,pos)); pel = (ParseEntryList) getParseEntry( parseLookup ); return pel.getValue( target.substring(pos+1), index ); } catch (ClassCastException e) { return null; } } public String getValue( String target ) throws UrlParserException { setCurrentField(target); ParseLookup parseLookup = new ParseLookup(target); target = parseLookup.getTarget(); int pos = target.lastIndexOf(']'); if (pos > 0) return getValueAtIndex( parseLookup ); pos = target.indexOf(':'); if (pos < 0) return getParseEntry(parseLookup).getValue(); parseLookup.setTarget(target.substring(0,pos)); ParseEntry pe = getParseEntry( parseLookup ); return pe.getValue( target.substring(pos+1) ); } public List<String> getValues( String target ) throws UrlParserException { setCurrentField(target); ParseLookup parseLookup = new ParseLookup(target); target = parseLookup.getTarget(); ParseEntryList pel = null; try { int pos = target.indexOf(':'); if (pos < 0) { pel = (ParseEntryList) getParseEntry(parseLookup); return pel.getValues(); } parseLookup.setTarget(target.substring(0,pos)); pel = (ParseEntryList) getParseEntry( parseLookup ); return pel.getValues( target.substring(pos+1) ); } catch (ClassCastException e) { List<String> texts = new ArrayList<String>(); texts.add( pel.getValue()); return texts; } } private int getEntrySize( String target ) throws UrlParserException { setCurrentField(target); ParseBlock parseBlock = getParseBlock( target ); // for block list if (parseBlock != null) { try { ParseBlockList parseBlockList = (ParseBlockList) parseBlock; return parseBlockList.getBlocks().size(); } catch (ClassCastException e) { return 1; } } ParseEntryList pel = null; try { ParseLookup parseLookup = new ParseLookup(target); target = parseLookup.getTarget(); int pos = target.indexOf(':'); if (pos < 0) { pel = (ParseEntryList) getParseEntry(parseLookup); return pel.getValues().size(); } parseLookup.setTarget(target.substring(0,pos)); pel = (ParseEntryList) getParseEntry( parseLookup ); return pel.getValues( target.substring(pos+1) ).size(); } catch (ClassCastException e) { return 1; } } public int getSize( String target ) throws UrlParserException { ParseBlockList pbl = (ParseBlockList) getParseBlock(target); if (pbl==null) return getEntrySize(target); return pbl.getBlocks().size(); } public void setCurrentField(String currentField) { this.currentField = currentField; } public String getCurrentField() { return currentField; } public UrlParser getParser() { return parser; } }
9083fa5d67ee9334656f2ef26289d115bf61923f
973d6ef5bcef331ab24a76d15e6574388507764c
/src/com/cy/rms/basedata/dao/CategoryDao4MySqlImpl.java
8b2234d2253bb4e6eafd4d0e09a8b364435c66c4
[]
no_license
jayson9602/MyRepository
138e951a458d62a73d0b7df4073ce6780f97da8a
3b33e1919517fb7047d67205b5e812a46adae5c3
refs/heads/master
2020-03-21T10:47:05.238571
2018-06-24T09:50:18
2018-06-24T09:50:18
138,470,903
0
0
null
null
null
null
UTF-8
Java
false
false
5,573
java
package com.cy.rms.basedata.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import com.cy.rms.basedata.domain.Category; import com.cy.rms.util.ApplicationException; import com.cy.rms.util.DbUtil; import com.cy.rms.util.PageModel; public class CategoryDao4MySqlImpl implements CategoryDao { @Override public void addCategory(Connection conn, Category category) { String sql = "insert into category values (null , ? ,? )"; PreparedStatement pstmt = null; try { pstmt = conn.prepareStatement(sql); pstmt.setString(1, category.getCategoryName()); pstmt.setString(2, category.getRemark()); pstmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { DbUtil.close(pstmt); DbUtil.close(conn); } } @Override public void update(Connection conn, Category category) { String sql = "update category set categoryName = ? ,remark = ? where id = ?"; PreparedStatement pstmt = null; try { pstmt = conn.prepareStatement(sql); pstmt.setString(1, category.getCategoryName()); pstmt.setString(2, category.getRemark()); pstmt.setInt(3, category.getId()); pstmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { DbUtil.close(pstmt); DbUtil.close(conn); } } @Override public List<Category> getAllCategories(Connection conn) { String sql = "select*from category"; PreparedStatement pstmt = null; ResultSet rs = null; List<Category> categoryList = null; try { categoryList = new ArrayList<Category>(); pstmt = conn.prepareStatement(sql); rs = pstmt.executeQuery(); while (rs.next()) { Category category = new Category(); category.setId(rs.getInt("id")); category.setCategoryName(rs.getString("categoryName")); category.setRemark(rs.getString("remark")); categoryList.add(category); } } catch (SQLException e) { e.printStackTrace(); } finally { DbUtil.close(rs); DbUtil.close(pstmt); DbUtil.close(conn); } return categoryList; } @Override public PageModel getCategorys(Connection conn, int pageNo, int pageSize, String searchId,String searchName) { StringBuffer sbSql = new StringBuffer(); sbSql.append("select*from category "); if (searchId != null && !"".equals(searchId)) { sbSql.append("and id = "+ searchId +" "); } if (searchName != null && !"".equals(searchName)) { sbSql.append("and categoryName like '%" + searchName + "%'"); } sbSql.append(" limit ?,? "); String sql = sbSql.toString().replaceFirst("and","where"); PreparedStatement pstmt = null; ResultSet rs = null; PageModel pageModel = null; try { pstmt = conn.prepareStatement(sql); pstmt.setInt(1, (pageNo-1)*pageSize); pstmt.setInt(2, pageSize); rs = pstmt.executeQuery(); List categoryList = new ArrayList(); while (rs.next()) { Category category = new Category(); category.setId(rs.getInt("id")); category.setCategoryName(rs.getString("categoryName")); category.setRemark(rs.getString("remark")); categoryList.add(category); } pageModel = new PageModel(); pageModel.setPageNo(pageNo); pageModel.setPageSize(pageSize); pageModel.setList(categoryList); // 根据条件取得记录数 int totalRecords = getTotalRecords(conn, searchId,searchName); pageModel.setTotalRecords(totalRecords); } catch (SQLException e) { e.printStackTrace(); // 记录到日志文件 error throw new ApplicationException("分页查询失败"); } finally { DbUtil.close(rs); DbUtil.close(pstmt); DbUtil.close(conn); } return pageModel; } private int getTotalRecords(Connection conn, String searchId,String searchName) throws SQLException { StringBuffer sbSql = new StringBuffer(); sbSql.append("select count(*) from category "); if (searchId != null && !"".equals(searchId)) { sbSql.append("and id = "+ searchId +" "); } if (searchName != null && !"".equals(searchName)) { sbSql.append("and categoryName like '%" + searchName + "%'"); } String sql = sbSql.toString().replaceFirst("and", "where"); //System.out.println(sql); PreparedStatement pstmt = null; ResultSet rs = null; int temp = 0; try { pstmt = conn.prepareStatement(sql); rs = pstmt.executeQuery(); rs.next(); temp = rs.getInt(1); } finally { DbUtil.close(rs); DbUtil.close(pstmt); } return temp; } @Override public void delete(Connection conn, String id) { String sql = "delete from category where id = ?"; PreparedStatement pstmt = null; try { pstmt = conn.prepareStatement(sql); pstmt.setString(1, id); pstmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { DbUtil.close(pstmt); DbUtil.close(conn); } } @Override public Category findCategoryById(Connection conn, String id) { String sql = "select*from category where id = ?"; PreparedStatement pstmt = null; ResultSet rs = null; Category category = null; try { pstmt = conn.prepareStatement(sql); pstmt.setString(1, id); rs = pstmt.executeQuery(); if(rs.next()) { category = new Category(); category.setId(rs.getInt("id")); category.setCategoryName(rs.getString("categoryName")); category.setRemark(rs.getString("remark")); } } catch (SQLException e) { e.printStackTrace(); } finally { DbUtil.close(rs); DbUtil.close(pstmt); DbUtil.close(conn); } return category; } }
780d9df85fd18884f68945348ffb08a56961f447
369ed3e9c8a9d0f72d46b89e954e1b87d021d4e4
/src/main/java/ch/lukas/ts/model/Player.java
5d34a49c13621877903d33d97d9b448a854b326d
[]
no_license
lbuchli/TschauSepp
6be91e6e4db8eb52080f948192da07a08e50985f
1ceee290e1aff2801fed2f8e38b6465311e2f2bd
refs/heads/master
2022-12-02T15:56:23.823535
2020-08-21T06:56:49
2020-08-21T06:56:49
273,951,201
0
0
null
null
null
null
UTF-8
Java
false
false
2,827
java
package ch.lukas.ts.model; import java.util.ArrayList; import java.util.List; import javax.swing.DefaultListModel; /** * A player that participates in a game. * @author lukas */ public class Player extends DefaultListModel<Card> { private static final long serialVersionUID = 6132068650994968305L; private List<Card> handCards; private CardDeck deck; private int score; private boolean hasPlayedOrPickedUp; private boolean hasPlayed; public Player(CardDeck deck) { handCards = new ArrayList<Card>(); this.deck = deck; score = 0; hasPlayedOrPickedUp = false; } /** * Pick up a card from the spare cards */ public void pickUpCard() { if (!hasPlayedOrPickedUp) { addElement(deck.pickUpCard()); setHasPlayedOrPickedUp(true); } } /** * Play a hand card * @param index The hand card's index * @return Wheter it was possible to play that card */ public boolean playCard(int index) { if (index < handCards.size() && !hasPlayedOrPickedUp && deck.playCard(handCards.get(index))) { Card played = handCards.remove(index); fireIntervalRemoved(this, index, index); if (!played.getValue().equals(CardValue.ACE) || !Settings.getInstance().isSpecial(CardValue.ACE)) { setHasPlayedOrPickedUp(true); setHasPlayed(true); } return true; } return false; } /** * End a round. Clears the hand cards and adds points * @param points The amount of points this player gained from the round */ public void endRound(int points) { int handCardSize = handCards.size(); handCards.clear(); fireIntervalRemoved(this, 0, handCardSize); score = getScore() + points; } /** * Calculates this player's hand card score * @return The score */ public int calcHandScore() { return handCards.parallelStream() .mapToInt((c) -> c.getValue().getPoints()) .sum(); } public List<Card> getHandCards() { return handCards; } public int getScore() { return score; } @Override public Card getElementAt(int index) { return handCards.get(index); } @Override public int getSize() { return handCards.size(); } @Override public void addElement(Card card) { handCards.add(card); int addedIndex = handCards.size() - 1; fireIntervalAdded(this, addedIndex, addedIndex); } @Override public boolean removeElement(Object card) { boolean found = handCards.remove(card); if (found) { fireContentsChanged(this, 0, handCards.size()); } return found; } public boolean getHasPlayedOrPickedUp() { return hasPlayedOrPickedUp; } public void setHasPlayedOrPickedUp(boolean hasPlayedOrPickedUp) { this.hasPlayedOrPickedUp = hasPlayedOrPickedUp; } public boolean getHasPlayed() { return hasPlayed; } public void setHasPlayed(boolean hasPlayed) { this.hasPlayed = hasPlayed; } }
5a66e913ac7b86f4cb7173329ae4166a72414039
8571e29943c3417b43d5d94138ba4ebe710595e0
/sample/src/main/java/com/greenfrvr/hashtagview/sample/fragments/ContactsFragment.java
fc947f11ddf4b0dbc87f7d17e6b0899c24a94075
[ "MIT" ]
permissive
claudiopastorini/hashtag-view
4c138ba3dca03cf02cc4b67b9afac8eaa72de01e
b7e076fafe18552e380e96a551a2b7fe178822b4
refs/heads/master
2021-01-21T19:28:07.758527
2015-10-04T12:08:59
2015-10-04T12:08:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,409
java
package com.greenfrvr.hashtagview.sample.fragments; import android.os.Bundle; import android.support.annotation.Nullable; import android.text.SpannableString; import android.text.Spanned; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import com.greenfrvr.hashtagview.sample.R; import com.greenfrvr.hashtagview.sample.utils.IntentFactory; import butterknife.Bind; /** * Created by greenfrvr */ public class ContactsFragment extends BaseFragment { protected @Bind(R.id.next_button) Button nextButton; protected @Bind(R.id.contact) TextView contactTextView; protected @Bind(R.id.sources) TextView sourcesTextView; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_contacts, container, false); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); nextButton.setVisibility(View.GONE); contactTextView.setMovementMethod(LinkMovementMethod.getInstance()); sourcesTextView.setMovementMethod(LinkMovementMethod.getInstance()); contactTextView.setText(getContactText()); sourcesTextView.setText(getSourcesText()); } private CharSequence getSourcesText() { SpannableString spannable = new SpannableString(getString(R.string.sources)); spannable.setSpan(new ClickableSpan() { @Override public void onClick(View widget) { IntentFactory.explore(getActivity(), getString(R.string.github)); } }, spannable.toString().length() - 6, spannable.toString().length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannable; } private CharSequence getContactText() { SpannableString spannable = new SpannableString(getString(R.string.contact)); spannable.setSpan(new ClickableSpan() { @Override public void onClick(View widget) { IntentFactory.email(getActivity(), getString(R.string.email)); } }, 8, 31, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return spannable; } }
1636101815ee8a9e2e50f9ed0f502525ed84f789
a2a13157252777721037b5b6741e130963cda989
/app/src/main/java/com/jarhero790/eub/message/bean/GeRenBean.java
3dcbe7bf026468ba27caf495f579c7e7b1f81f54
[]
no_license
370721734/ee
fc042d8ad5707de764c309fc93c53d44298afd39
d83160edf7b568a57692c5ff4bddfe5f53d0d309
refs/heads/master
2020-07-05T23:38:31.776166
2019-10-30T10:27:18
2019-10-30T10:27:18
202,816,814
0
0
null
null
null
null
UTF-8
Java
false
false
10,028
java
package com.jarhero790.eub.message.bean; import android.os.Parcel; import android.os.Parcelable; public class GeRenBean implements Parcelable { /** * code : 200 * data : {"user":{"id":5044,"openid":"","token":"0442062541812d7dfe98bc77155ba5b4","nickname":"5044","sex":1,"addr":null,"country":"","province":"","city":"北京市东城区","headimgurl":"/upload/avatar/5d5e5e3b451af.png","subscribe":0,"money":50,"state":0,"sign":"本天上午,人告诉你们","age":null,"freemoney":"0.00","is_admin":0,"type":0,"rong_id":5044,"rong_token":"6a34mMUkLbpLqCOH7kzHD2e7NDDI6gS2aE/afdMaQWwiF5mo1RSLHd4a3r3cubMOxTrpQ2lZSbdx0tHHFX6Z9w==","username":"13243831328","pwd":null,"signtime":"2019-08-23 08:34:21","user_id":5044},"videoList":5,"zan":7,"like":1,"fensi":1,"myzan":0} * msg : */ private int code; private DataBean data; private String msg; private GeRenBean(Parcel in) { code = in.readInt(); msg = in.readString(); } public static final Creator<GeRenBean> CREATOR = new Creator<GeRenBean>() { @Override public GeRenBean createFromParcel(Parcel in) { return new GeRenBean(in); } @Override public GeRenBean[] newArray(int size) { return new GeRenBean[size]; } }; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public DataBean getData() { return data; } public void setData(DataBean data) { this.data = data; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeInt(code); parcel.writeString(msg); } public static class DataBean { /** * user : {"id":5044,"openid":"","token":"0442062541812d7dfe98bc77155ba5b4","nickname":"5044","sex":1,"addr":null,"country":"","province":"","city":"北京市东城区","headimgurl":"/upload/avatar/5d5e5e3b451af.png","subscribe":0,"money":50,"state":0,"sign":"本天上午,人告诉你们","age":null,"freemoney":"0.00","is_admin":0,"type":0,"rong_id":5044,"rong_token":"6a34mMUkLbpLqCOH7kzHD2e7NDDI6gS2aE/afdMaQWwiF5mo1RSLHd4a3r3cubMOxTrpQ2lZSbdx0tHHFX6Z9w==","username":"13243831328","pwd":null,"signtime":"2019-08-23 08:34:21","user_id":5044} * videoList : 5 * zan : 7 * like : 1 * fensi : 1 * myzan : 0 */ private UserBean user; private int videoList; private int zan; private int like; private int fensi; private int myzan; public UserBean getUser() { return user; } public void setUser(UserBean user) { this.user = user; } public int getVideoList() { return videoList; } public void setVideoList(int videoList) { this.videoList = videoList; } public int getZan() { return zan; } public void setZan(int zan) { this.zan = zan; } public int getLike() { return like; } public void setLike(int like) { this.like = like; } public int getFensi() { return fensi; } public void setFensi(int fensi) { this.fensi = fensi; } public int getMyzan() { return myzan; } public void setMyzan(int myzan) { this.myzan = myzan; } public static class UserBean { /** * id : 5044 * openid : * token : 0442062541812d7dfe98bc77155ba5b4 * nickname : 5044 * sex : 1 * addr : null * country : * province : * city : 北京市东城区 * headimgurl : /upload/avatar/5d5e5e3b451af.png * subscribe : 0 * money : 50 * state : 0 * sign : 本天上午,人告诉你们 * age : null * freemoney : 0.00 * is_admin : 0 * type : 0 * rong_id : 5044 * rong_token : 6a34mMUkLbpLqCOH7kzHD2e7NDDI6gS2aE/afdMaQWwiF5mo1RSLHd4a3r3cubMOxTrpQ2lZSbdx0tHHFX6Z9w== * username : 13243831328 * pwd : null * signtime : 2019-08-23 08:34:21 * user_id : 5044 */ private int id; private String openid; private String token; private String nickname; private int sex; private Object addr; private String country; private String province; private String city; private String headimgurl; private int subscribe; private int money; private int state; private String sign; private Object age; private String freemoney; private int is_admin; private int type; private int rong_id; private String rong_token; private String username; private Object pwd; private String signtime; private int user_id; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getOpenid() { return openid; } public void setOpenid(String openid) { this.openid = openid; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public int getSex() { return sex; } public void setSex(int sex) { this.sex = sex; } public Object getAddr() { return addr; } public void setAddr(Object addr) { this.addr = addr; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getHeadimgurl() { return headimgurl; } public void setHeadimgurl(String headimgurl) { this.headimgurl = headimgurl; } public int getSubscribe() { return subscribe; } public void setSubscribe(int subscribe) { this.subscribe = subscribe; } public int getMoney() { return money; } public void setMoney(int money) { this.money = money; } public int getState() { return state; } public void setState(int state) { this.state = state; } public String getSign() { return sign; } public void setSign(String sign) { this.sign = sign; } public Object getAge() { return age; } public void setAge(Object age) { this.age = age; } public String getFreemoney() { return freemoney; } public void setFreemoney(String freemoney) { this.freemoney = freemoney; } public int getIs_admin() { return is_admin; } public void setIs_admin(int is_admin) { this.is_admin = is_admin; } public int getType() { return type; } public void setType(int type) { this.type = type; } public int getRong_id() { return rong_id; } public void setRong_id(int rong_id) { this.rong_id = rong_id; } public String getRong_token() { return rong_token; } public void setRong_token(String rong_token) { this.rong_token = rong_token; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public Object getPwd() { return pwd; } public void setPwd(Object pwd) { this.pwd = pwd; } public String getSigntime() { return signtime; } public void setSigntime(String signtime) { this.signtime = signtime; } public int getUser_id() { return user_id; } public void setUser_id(int user_id) { this.user_id = user_id; } } } }
746f1865b6c1b4d6058756899be8e4bdeccf1962
56adea945b27ccaf880decadb7f7cb86de450a8d
/querylanguage/ep-querylanguage/src/test/java/com/elasticpath/ql/parser/EpCustomerProfileAttributeQueryParserTest.java
d9f0632f835f86929d8b69c9e2732e62a5e9c3f6
[]
no_license
ryanlfoster/ep-commerce-engine-68
89b56878806ca784eca453d58fb91836782a0987
7364bce45d25892e06df2e1c51da84dbdcebce5d
refs/heads/master
2020-04-16T04:27:40.577543
2013-12-10T19:31:52
2013-12-10T20:01:08
40,164,760
1
1
null
2015-08-04T05:15:25
2015-08-04T05:15:25
null
UTF-8
Java
false
false
1,950
java
package com.elasticpath.ql.parser; import static com.elasticpath.ql.asserts.ParseAssert.assertParseInvalid; import static com.elasticpath.ql.asserts.ParseAssert.assertParseSuccessfull; import java.util.HashMap; import java.util.Map; import org.junit.Before; import org.junit.Test; import com.elasticpath.ql.custom.customer.CustomerProfileAttributeConfiguration; import com.elasticpath.ql.parser.gen.EpQueryParserImpl; import com.elasticpath.ql.parser.querybuilder.impl.JPQLQueryBuilder; import com.elasticpath.ql.parser.valueresolver.impl.JPQLValueResolver; /** * Test cases for JavaCC based implementation of EpQueryParser. */ public class EpCustomerProfileAttributeQueryParserTest { // NOPMD private EpQueryParser queryParser; /** * Setup test. */ @Before public void setUp() { CustomerProfileAttributeConfiguration customerProfileAttributesConf = new CustomerProfileAttributeConfiguration(); customerProfileAttributesConf.setEpQLValueResolver(new JPQLValueResolver()); customerProfileAttributesConf.setCompleteQueryBuilder(new JPQLQueryBuilder()); customerProfileAttributesConf.initialize(); Map<EPQueryType, AbstractEpQLCustomConfiguration> epQLObjectConfiguration = new HashMap<EPQueryType, AbstractEpQLCustomConfiguration>(); epQLObjectConfiguration.put(EPQueryType.CUSTOMERPROFILE_ATTRIBUTE, customerProfileAttributesConf); EpQueryAssembler epQueryAssembler = new EpQueryAssembler(); epQueryAssembler.setEpQLObjectConfiguration(epQLObjectConfiguration); queryParser = new EpQueryParserImpl(); queryParser.setEpQueryAssembler(epQueryAssembler); } /** * Should parse it. */ @Test public void testSuccessfulParse() { assertParseSuccessfull("FIND CustomerProfileAttribute", queryParser); } /** * Should not parse it. */ @Test public void testInvalidParse() { assertParseInvalid("FIND CustomerProfileAttribute WHERE name = \"hello\"", "Should not parse it.", queryParser); } }
32c2f136013981c126a90d3f74e04543421150e0
d51f530078404a24f1844b53b037bbfed238a784
/javav2/example_code/kendra/src/main/java/com/example/kendra/ListDataSourceSyncJobs.java
1bd03bdc2a8b483b42998cdeaf557620c6d70058
[ "Apache-2.0", "MIT" ]
permissive
awsdocs/aws-doc-sdk-examples
fff85d1b4119fe3331174396a5723c7f054203eb
dec41fb589043ac9d8667aac36fb88a53c3abe50
refs/heads/main
2023-09-03T19:50:57.809260
2023-09-01T16:23:01
2023-09-01T16:23:01
66,023,605
8,240
6,037
Apache-2.0
2023-09-14T16:52:02
2016-08-18T19:06:57
Java
UTF-8
Java
false
false
3,159
java
//snippet-sourcedescription:[ListDataSourceSyncJobs.java demonstrates how to get statistics about synchronizing Amazon Kendra with a data source.] //snippet-keyword:[SDK for Java v2] //snippet-service:[Amazon Kendra] /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package com.example.kendra; // snippet-start:[kendra.java2.list.sync.import] import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.kendra.KendraClient; import software.amazon.awssdk.services.kendra.model.DataSourceSyncJob; import software.amazon.awssdk.services.kendra.model.KendraException; import software.amazon.awssdk.services.kendra.model.ListDataSourceSyncJobsRequest; import software.amazon.awssdk.services.kendra.model.ListDataSourceSyncJobsResponse; import java.util.List; // snippet-end:[kendra.java2.list.sync.import] /** * Before running this Java V2 code example, set up your development environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class ListDataSourceSyncJobs { public static void main(String[] args) { final String usage = "\n" + "Usage:\n" + " <indexId> <dataSourceId> \n\n" + "Where:\n" + " indexId - The id value of the index.\n" + " dataSourceId - The id value of the data source.\n" ; if (args.length != 2) { System.out.println(usage); System.exit(1); } String indexId = args[0]; String dataSourceId = args[1]; System.out.println(String.format("Gets statistics about synchronizing Amazon Kendra with a data source %s", dataSourceId)); KendraClient kendra = KendraClient.builder() .region(Region.US_EAST_1) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); listSyncJobs(kendra, indexId, dataSourceId); } // snippet-start:[kendra.java2.list.sync.main] public static void listSyncJobs( KendraClient kendra, String indexId, String dataSourceId){ try { ListDataSourceSyncJobsRequest jobsRequest = ListDataSourceSyncJobsRequest.builder() .indexId(indexId) .maxResults(10) .id(dataSourceId) .build(); ListDataSourceSyncJobsResponse response = kendra.listDataSourceSyncJobs(jobsRequest); List<DataSourceSyncJob> jobs = response.history(); for (DataSourceSyncJob job: jobs) { System.out.println("Execution id is "+job.executionId()); System.out.println("Job status "+job.status()); } } catch (KendraException e) { System.err.println(e.getMessage()); System.exit(1); } } // snippet-end:[kendra.java2.list.sync.main] }
02cfc2aa99e41ed5919bced7a619229bb8e6d9a3
1c8341a5bc7ffff7330812dbef785a52085a0b7a
/app/src/test/java/com/example/keerthi/dictionary/ExampleUnitTest.java
0c3d75acc12112b9fcbe6bc151d1d890f6ad702c
[]
no_license
keerthireddy02/dictionary
eb9f10dbd7aa4065c3349356438df5d14f39ce8d
a975cb24da6e4aa1c60dc0f673e693d272b471f8
refs/heads/master
2020-04-10T01:27:15.058406
2018-12-06T18:42:28
2018-12-06T18:42:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.example.keerthi.dictionary; 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); } }
727dc7c49b86c3913ae9f29de877f386c6c76785
0b967b0a8d3f6f8a0e580e649b9fa29110ace062
/minecraft/pixelmon/client/PixelmonServerStore.java
d5bdf409575ea8e6fdfedc781c4b1c5be028a1c7
[]
no_license
bazzceeh/Pixelmon
ffeadab3f228dc86606723c0e8bdb155a517b994
f0848790ef3c4a86fe663a0a0cf24593c6c2ba93
refs/heads/master
2021-01-17T05:49:01.558384
2013-08-01T09:13:22
2013-08-01T09:13:22
11,812,885
1
0
null
null
null
null
UTF-8
Java
false
false
1,719
java
package pixelmon.client; import java.io.DataInputStream; import java.io.IOException; import java.util.ArrayList; import pixelmon.comm.PixelmonDataPacket; import pixelmon.storage.ComputerBox; import pixelmon.storage.PlayerComputerStorage; public class PixelmonServerStore { private static PixelmonDataPacket[][] store = new PixelmonDataPacket[PlayerComputerStorage.boxCount][ComputerBox.boxLimit]; private static PixelmonDataPacket mousePokemon; public static void addToList(DataInputStream dataStream) { PixelmonDataPacket p = new PixelmonDataPacket(); try { p.readPacketData(dataStream); store[p.boxNumber][p.order] = p; } catch (IOException e) { e.printStackTrace(); } } public static void clearList() { for (int i = 0; i < PlayerComputerStorage.boxCount; i++) for (int j = 0; j < ComputerBox.boxLimit; j++) store[i][j] = null; } public static PixelmonDataPacket getFromBox(int i, int j) { return store[i][j]; } public static PixelmonDataPacket getPixelmonDataFromID(int id) { for (int i = 0; i < PlayerComputerStorage.boxCount; i++) for (int j = 0; j < ComputerBox.boxLimit; j++) if (store[i][j] != null) if (store[i][j].pokemonID == id) return store[i][j]; return null; } public static void removeFromList(int box, int pos) { store[box][pos] = null; } public static void setMousePokemon(DataInputStream dataStream) { PixelmonDataPacket p = new PixelmonDataPacket(); try { p.readPacketData(dataStream); mousePokemon = p; } catch (IOException e) { e.printStackTrace(); } } public static void clearMousePokemon() { mousePokemon = null; } public static PixelmonDataPacket getMousePokemon() { return mousePokemon; } }
bd880457d8460e91de841e36df79506e2575fae3
6e2f80810eab5c58896e7e86de04f89ba68356af
/src/Actividad7InterfazRefuerzo/Interfaz.java
49e5e7b86e8d66f26dec61efe983153a8a00f8af
[]
no_license
Pagorn07/Tema1Ejercicios
f60f1b2a4a9d4fd4528084b80d0d4cf4982db63b
002dab53faef11b9a7a1380a4d3a17f4fc4390e5
refs/heads/master
2021-01-22T21:23:18.850930
2017-03-18T19:15:51
2017-03-18T19:15:51
85,425,510
0
0
null
null
null
null
UTF-8
Java
false
false
278
java
package Actividad7InterfazRefuerzo; /** * Created by shironatsu22 on 18/03/17. */ public interface Interfaz { Student getStudent(Student student); void removeStudent(Student student); void addStudent(Student student); void contractStudent(Student student); }
b5c73c5132f949ac337983194e59b95d8ff0a9e8
2b468cde90bbd8c1a9f87d7823d7df67578161fb
/2015/processDOC/5_classModeling_implementation/socialPro/src/action/CooperatorInsertAction.java
da23bfae63effc30bd00e41da9c0bb925eaaae31
[]
no_license
RuuuvyGo/myProjects
0e589a60507bfb6c31304de63e445e8e5cbe514f
dc23209dc3f83ca8b47983eaf330da79a3a155d2
refs/heads/master
2021-01-13T03:16:42.805319
2017-01-13T02:57:40
2017-01-13T02:57:40
77,597,985
0
0
null
null
null
null
UTF-8
Java
false
false
302
java
package action; import java.util.List; import socialProExceptions.DAOException; public interface CooperatorInsertAction { public boolean insertCooper(String memberCode,String setCode) throws DAOException; public boolean insertCooper(List<String> memberCode,String setCode) throws DAOException; }
d0fcd582e94c7b2803980cd2e98191e8933e033a
f447eae25c6f7342b5213b9d032743b931993d20
/src/com/arpablue/gui/GridPanel.java
5ff4049245bffdabc0ac3bed67eb367917fd8423
[ "MIT" ]
permissive
augusto-flores-arpablue-com/arpablue_java
e524bffab740bd6257236a975f526edf8e1faf6e
e3729ed48bfd0da7e73d3cb6d6dfca14c1192d96
refs/heads/master
2021-07-18T10:27:21.006715
2020-08-20T12:37:09
2020-08-20T12:37:09
169,479,172
0
0
null
null
null
null
UTF-8
Java
false
false
1,219
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.arpablue.gui; import java.awt.GridLayout; /** * * @author 5v */ public class GridPanel extends APanel{ public GridPanel() { this(3,3); } public GridPanel(int rows, int cols ) { super(); this.setLayout(new GridLayout(rows,cols)); } public int getRows() { return ((GridLayout)this.getLayout()).getRows(); } public void setRows(int rows) { ((GridLayout)this.getLayout()).setRows(rows); } public int getColumns() { return ((GridLayout)this.getLayout()).getColumns(); } public void setColumns(int cols) { ((GridLayout)this.getLayout()).setColumns(cols); } public void setHgap(int hgap) { ((GridLayout)this.getLayout()).setHgap(hgap); } public void setVgap(int vgap) { ((GridLayout)this.getLayout()).setVgap(vgap); } public int getHgap() { return ((GridLayout)this.getLayout()).getHgap(); } public int getVgap() { return ((GridLayout)this.getLayout()).getVgap(); } }
3620b5aea368506abf9b70ae9ba56ef73373ae83
bfca20537874a3f7afe9149874d915b0c056841b
/src/br/edu/fatec/les/strategy/IStrategy.java
ec0245d1aa78d121cb664dae49e639ba77692340
[ "MIT" ]
permissive
henriquevalentim/Zero-1-Games
ca0e3b066d555dff0a1316154b2d4fcaa33d86c1
2d7cee064c349ef38bcad92bc229f29896f9008a
refs/heads/master
2020-11-27T13:36:20.384742
2019-12-21T18:21:34
2019-12-21T18:21:34
229,465,028
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
package br.edu.fatec.les.strategy; import br.edu.fatec.les.dominio.EntidadeDominio; public interface IStrategy { public String processar(EntidadeDominio entidade); }
e03cc1b22258358dc086e239f00c258136d414ee
3334bee9484db954c4508ad507f6de0d154a939f
/d3n/java-src/event-service/src/main/java/de/ascendro/f4m/service/event/client/EventServiceClientMessageHandler.java
6aca88b022c3d785946b4fb24aec5239c7506e7a
[]
no_license
VUAN86/d3n
c2fc46fc1f188d08fa6862e33cac56762e006f71
e5d6ac654821f89b7f4f653e2aaef3de7c621f8b
refs/heads/master
2020-05-07T19:25:43.926090
2019-04-12T07:25:55
2019-04-12T07:25:55
180,806,736
0
1
null
null
null
null
UTF-8
Java
false
false
8,047
java
package de.ascendro.f4m.service.event.client; import java.net.URI; import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import de.ascendro.f4m.client.json.JsonWebSocketClientSessionPool; import de.ascendro.f4m.service.config.F4MConfig; import de.ascendro.f4m.service.config.F4MConfigImpl; import de.ascendro.f4m.service.event.EventMessageTypes; import de.ascendro.f4m.service.event.activemq.BrokerNetworkActiveMQ; import de.ascendro.f4m.service.event.config.EventConfig; import de.ascendro.f4m.service.event.model.info.InfoRequest; import de.ascendro.f4m.service.event.model.info.InfoResponse; import de.ascendro.f4m.service.exception.F4MException; import de.ascendro.f4m.service.exception.server.F4MIOException; import de.ascendro.f4m.service.exception.validation.F4MValidationFailedException; import de.ascendro.f4m.service.json.RequestContext; import de.ascendro.f4m.service.json.handler.DefaultJsonMessageHandler; import de.ascendro.f4m.service.json.model.JsonMessage; import de.ascendro.f4m.service.json.model.JsonMessageContent; import de.ascendro.f4m.service.json.model.user.ClientInfo; import de.ascendro.f4m.service.registry.EventServiceStore; import de.ascendro.f4m.service.registry.ServiceRegistryMessageTypes; import de.ascendro.f4m.service.registry.model.ServiceConnectionInformation; import de.ascendro.f4m.service.registry.model.ServiceRegistryListResponse; /** * Web Socket Client response message handler for Event Service. */ public class EventServiceClientMessageHandler extends DefaultJsonMessageHandler { private static final Logger LOGGER = LoggerFactory.getLogger(EventServiceClientMessageHandler.class); private final EventServiceStore eventServiceStore; private final JsonWebSocketClientSessionPool webSocketClient; private final BrokerNetworkActiveMQ brokerNetworkActiveMq; public EventServiceClientMessageHandler(EventServiceStore eventServiceStore, BrokerNetworkActiveMQ brokerNetworkActiveMq, JsonWebSocketClientSessionPool webSocketClient) { this.eventServiceStore = eventServiceStore; this.brokerNetworkActiveMq = brokerNetworkActiveMq; this.webSocketClient = webSocketClient; } @Override public JsonMessageContent onUserMessage(JsonMessage<? extends JsonMessageContent> message) throws F4MException { final ServiceRegistryMessageTypes serviceRegistryType = message.getType(ServiceRegistryMessageTypes.class); if (serviceRegistryType != null) { onServiceRegistryMessage(serviceRegistryType, message); } else { final EventMessageTypes eventMessageType = message.getType(EventMessageTypes.class); if (eventMessageType != null) { onEventServiceMessage(eventMessageType, message); } else { throw new F4MValidationFailedException("Unsupported message type by name [" + message.getName() + "]"); } } return null; } /** * Handles Service Registry messages * * @param serviceRegistryType * - Service Regsitry message type * @param message * - Message received * @throws F4MException * - Failed to process message or messag * @throws UnsupportedOperationException * - */ @SuppressWarnings("unchecked") @Override protected JsonMessageContent onServiceRegistryMessage(ServiceRegistryMessageTypes serviceRegistryType, JsonMessage<? extends JsonMessageContent> message) throws F4MException, UnsupportedOperationException { JsonMessageContent result = null; if (serviceRegistryType == ServiceRegistryMessageTypes.LIST_RESPONSE) { onListResponse((JsonMessage<ServiceRegistryListResponse>) message); } else { result = super.onServiceRegistryMessage(serviceRegistryType, message); } return result; } /** * Handles Event Service messages * * @param eventMessageType * - Event Service message type * @param message * - Message received */ @SuppressWarnings("unchecked") protected void onEventServiceMessage(EventMessageTypes eventMessageType, JsonMessage<? extends JsonMessageContent> message) { switch (eventMessageType) { case INFO_RESPONSE: onInfoResponse((JsonMessage<InfoResponse>) message); break; default: throw new UnsupportedOperationException("Unsupported Service Registry message type by name [" + message.getName() + "]"); } } /** * Handles Event Service infoResponse Message * * @param message * - InfoResponse JSON message */ protected void onInfoResponse(JsonMessage<InfoResponse> message) { final URI externalEventServiceURI = getSessionWrapper().getLocalClientSessionURI(); final InfoResponse infoResponse = message.getContent(); try { final String activeMqExternalProtocol = config .getProperty(EventConfig.ACTIVE_MQ_EXTERNAL_COMMUNICATION_PROTOCOL); final String activeMqExternalHost = config.getProperty(EventConfig.ACTIVE_MQ_EXTERNAL_COMMUNICATION_HOST); final URI activeMqURI = new URI(activeMqExternalProtocol, externalEventServiceURI.getUserInfo(), activeMqExternalHost, infoResponse.getJmsPort(), null, null, null); brokerNetworkActiveMq.addBrokerIntoNetwork(activeMqURI); eventServiceStore.addEventServiceInfo(externalEventServiceURI.toString(), infoResponse); } catch (Exception e) { LOGGER.error("Failed to add ActiveQM Broker to Network, External Event Service URI [" + externalEventServiceURI + "] and JMS-PORT[" + infoResponse.getJmsPort() + "]", e); } } /** * Handles Service Registry listResponse message * * @param message * - ServiceRegistryListResponse JSON message * @throws F4MException * - failed to process message */ protected void onListResponse(JsonMessage<ServiceRegistryListResponse> message) throws F4MException { final ServiceRegistryListResponse eventServiceListResponse = message.getContent(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Received message with ServiceRegistryListResponse[{}] content", message.getContent()); LOGGER.debug("Current service info[host={}, port={}]", config.getProperty(F4MConfig.SERVICE_HOST), config.getProperty(F4MConfigImpl.JETTY_SSL_PORT)); } if (CollectionUtils.isEmpty(eventServiceListResponse.getServices())) { eventServiceStore.setAllKnownEventServicesAreConnected(true); } for (ServiceConnectionInformation serviceConnectionInfo : eventServiceListResponse.getServices()) { try { if (!isMe(serviceConnectionInfo)) { LOGGER.debug("Adding EventService info[{}] into registry to build network", serviceConnectionInfo); final JsonMessage<InfoRequest> infoRequestMessage = jsonMessageUtil.createNewMessage( EventMessageTypes.INFO, new InfoRequest()); eventServiceStore.addService(serviceConnectionInfo.getServiceName(), serviceConnectionInfo.getUri(), serviceConnectionInfo.getServiceNamespaces()); webSocketClient.sendAsyncMessage(serviceConnectionInfo, infoRequestMessage); }else{ LOGGER.debug("Skipping serviceConnectionInfo[{}] as it's myself", serviceConnectionInfo); } } catch (F4MIOException e) { LOGGER.error( "Cannot request info of Event Service at location[" + serviceConnectionInfo.getUri() + "]", e); } } } /** * Determines if received Service connection info is referencing to myself * * @param serviceConnectionInfo * - ServiceConnectionInformation with not null URI * @return true if service connection URI references to myself, false otherwise */ protected boolean isMe(ServiceConnectionInformation serviceConnectionInfo) { final int jettySslPort = config.getPropertyAsInteger(F4MConfigImpl.JETTY_SSL_PORT); final String serviceHost = config.getProperty(F4MConfigImpl.SERVICE_HOST); final URI serviceURI = URI.create(serviceConnectionInfo.getUri()); return serviceURI.getHost().equalsIgnoreCase(serviceHost) && serviceURI.getPort() == jettySslPort; } /** * No authentication is performed */ @Override public ClientInfo onAuthentication(RequestContext context) { return null; } }
e230c107a43c69f429f6f355ba3d9df747392a41
183ac3ecc121e1ccf9242477ce96b8c92152fd89
/kanban_project/src/main/java/pl/adrian/kanbantool/services/UserService.java
56abcecdf367e8df099c14be183c239d080c0277
[]
no_license
AdrianZawadzkiDDay/Kanban_Manger_Tool
6fd9cd28e4eeb34605420b63e640cb2bc4510982
ae8a51bd27b26c1636c21dd46e4057ebb8f2fa74
refs/heads/master
2022-12-24T06:47:03.242020
2020-09-22T08:39:51
2020-09-22T08:39:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,191
java
package pl.adrian.kanbantool.services; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import pl.adrian.kanbantool.domain.User; import pl.adrian.kanbantool.exceptions.UsernameAlreadyExistsException; import pl.adrian.kanbantool.repositories.UserRepository; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; @Service public class UserService { @Autowired private UserRepository userRepository; @Autowired private BCryptPasswordEncoder bCryptPasswordEncoder; public User saveUser (User newUser){ try{ newUser.setPassword(bCryptPasswordEncoder.encode(newUser.getPassword())); //Username has to be unique (exception) newUser.setUsername(newUser.getUsername()); // Make sure that password and confirmPassword match // We don't persist or show the confirmPassword newUser.setConfirmPassword(""); return userRepository.save(newUser); }catch (Exception e){ throw new UsernameAlreadyExistsException("Username '"+newUser.getUsername()+"' already exists"); } } }
12c25e986e82af1ecc7cdf64ef7a5df69adcbba5
567bf366e8ce748c9213a8386f57229fd0631215
/src/Tower.java
11da26ea667b9616ed05ab58d59ba5dbff54980e
[]
no_license
pridebj8/algorithm
94fa6693785845968a6f1fab74dc335ecd8c25e3
d8754ffe9e0fe985ad283cdd60a6e8ae4817d526
refs/heads/master
2023-07-16T02:16:44.924876
2021-08-23T12:55:33
2021-08-23T12:55:33
272,133,853
0
0
null
null
null
null
UTF-8
Java
false
false
107
java
/** * 문제 : 탑 * https://programmers.co.kr/learn/courses/30/lessons/42588 */ public class Tower { }
52c43ebe37678d8a01035d70678db6333f406f97
c90d3fb37dd06c3d504a0d66e69103a717ea9f76
/api/src/main/java/org/hawkular/inventory/base/Fetcher.java
83d16fb2556478d4e2f46d1f1f1abe0b0ad28ff3
[ "Apache-2.0" ]
permissive
pilhuhn/hawkular-inventory
35bae8e77e5e92728e500b2b7baedbd691f6a05b
1cb011b89d5b7a9a75b4b1af6df2bd94f8b4d98c
refs/heads/master
2021-01-22T19:04:11.725794
2015-06-23T15:29:23
2015-06-23T15:29:23
29,915,226
0
0
null
2015-01-27T13:27:08
2015-01-27T13:27:08
null
UTF-8
Java
false
false
3,235
java
/* * Copyright 2015 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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.hawkular.inventory.base; import org.hawkular.inventory.api.EntityNotFoundException; import org.hawkular.inventory.api.RelationNotFoundException; import org.hawkular.inventory.api.ResolvableToMany; import org.hawkular.inventory.api.ResolvableToSingle; import org.hawkular.inventory.api.model.AbstractElement; import org.hawkular.inventory.api.model.Entity; import org.hawkular.inventory.api.paging.Page; import org.hawkular.inventory.api.paging.Pager; import java.util.function.Function; /** * A base class for all interface impls that need to resolve the entities. * * @author Lukas Krejci * @since 0.1.0 */ abstract class Fetcher<BE, E extends AbstractElement<?, ?>> extends Traversal<BE, E> implements ResolvableToSingle<E>, ResolvableToMany<E> { public Fetcher(TraversalContext<BE, E> context) { super(context); } @SuppressWarnings("unchecked") @Override public E entity() throws EntityNotFoundException, RelationNotFoundException { return readOnly(() -> { Page<BE> results = context.backend.query(context.select().get(), Pager.single()); if (results.isEmpty()) { throwNotFoundException(); } BE entity = results.get(0); E ret = context.backend.convert(entity, context.entityClass); if (!isApplicable(ret)) { throwNotFoundException(); } return ret; }); } @Override public Page<E> entities(Pager pager) { return readOnly(() -> { Function<BE, E> conversion = (e) -> context.backend.convert(e, context.entityClass); Function<E, Boolean> filter = context.configuration.getResultFilter() == null ? null : (e) -> context.configuration.getResultFilter().isApplicable(e); return context.backend.<E>query(context.select().get(), pager, conversion, filter); }); } @SuppressWarnings("unchecked") private void throwNotFoundException() { if (Entity.class.isAssignableFrom(context.entityClass)) { throw new EntityNotFoundException((Class<Entity<?, ?>>) context.entityClass, Query.filters(context.select().get())); } else { //TODO this is not correct? throw new RelationNotFoundException((Class<Entity<?, ?>>) context.entityClass, Query.filters(context.sourcePath)); } } }
a492eb49ddd1cb2e3052495a930779fb83ce733d
efd709e73dfcb78165af17663c85e149a7745268
/kodilla-good-patterns/src/main/java/com/kodilla/good/patterns/fastfood/SupplierRequest.java
860f8391a706e49323ce4bd6c4d163d529008272
[]
no_license
pawchi/Pawel-Chilczuk-kodilla-java
7d4c743cfdbbea22e848552b5c8bd2931a188828
cf34d7dd3d17c9c211189d5bea6a0b6bea828dc5
refs/heads/master
2021-09-06T23:44:19.258723
2018-02-13T14:27:41
2018-02-13T14:27:41
108,848,315
1
0
null
null
null
null
UTF-8
Java
false
false
647
java
package com.kodilla.good.patterns.fastfood; public class SupplierRequest { private ProductParameters productParameters; private Product product; private Producer producer; public SupplierRequest(ProductParameters productParameters, Product product, Producer producer) { this.productParameters = productParameters; this.product = product; this.producer = producer; } public ProductParameters getProductParameters() { return productParameters; } public Product getProduct() { return product; } public Producer getProducer() { return producer; } }
bded68591b846e2bee8668c0918acb3b81b3cd00
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_fe44a2b874a1cb33ab1e5d08c40d7632795fe4fc/ItemEncounter/2_fe44a2b874a1cb33ab1e5d08c40d7632795fe4fc_ItemEncounter_t.java
4e8965abf5a46b2d57f565a6dc1cdfca4e0450d6
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
2,377
java
package scene.encounter; import java.util.Random; import model.Item; import model.Notification; import model.Party; import model.Item.ITEM_TYPE; /** * Generates a random number of an item, and gives them to the Party's wagon. * Displays a modal with results of the transaction. */ public class ItemEncounter extends Encounter { private enum ITEM_ENCOUNTER_TYPE { APPLE(ITEM_TYPE.APPLE, "You rest by an apple tree. You pick up %d %3$s."), BREAD(ITEM_TYPE.BREAD, "You find a basket of bread which contains %d %s %s. You decide to take it."), GUN(ITEM_TYPE.GUN, "You find a %d rusted %3$s on the trail. It seems like it still works."), OX(ITEM_TYPE.OX, "You find %d lonely %3$s. You let the %3$s join your party."); private ITEM_TYPE itemType; private String message; private ITEM_ENCOUNTER_TYPE(ITEM_TYPE itemType, String message) { this.itemType = itemType; this.message = message; } public ITEM_TYPE getItemType() { return itemType; } public String getMessage(int number) { String itemName = number > 1 ? itemType.getPluralName() : itemType.getName(); itemName = itemName.toLowerCase(); String itemPrefix = "pieces of"; if (itemType.getPluralName().equals(itemType.getName())) { // If the plural is the same as the singular if (number == 1) { itemPrefix = "piece of"; } } return String.format(message, number, itemPrefix, itemName); } } private int numItems; private ITEM_ENCOUNTER_TYPE type; public ItemEncounter(Party party, int min, int max) { super(party, min, max); Random random = new Random(); int index = random.nextInt(ITEM_ENCOUNTER_TYPE.values().length); type = ITEM_ENCOUNTER_TYPE.values()[index]; } @Override public EncounterNotification doEncounter() { // Give the party 1 to 10 items numItems = (int) (Math.random() * 10) + 1; if (party.getVehicle() != null) { for (int i = 0; i < numItems; i++) { party.getVehicle().addItemToInventory(new Item(type.getItemType())); } } return makeNotification(); } @Override protected EncounterNotification makeNotification() { String message = type.getMessage(numItems); Notification notification = new Notification(message); return new EncounterNotification(notification, null); } }
e0fc45f68b46422cf2e1cdc14735e4ca0124044b
6a57e00264d9905f9f9f92410be1e012e9bf1d35
/src/test/java/org/snakeyaml/engine/v1/scanner/SimpleKeyTest.java
d6cedfc4c3441cff121c7fb8c39a5198f41c7c79
[ "Apache-2.0" ]
permissive
develar/snakeyaml-engine
f29e9e9b662e364629f96ea0a51fba1e075a9583
307a4b3e702b71611e44322af8ba727f37980211
refs/heads/master
2020-05-19T17:24:54.937896
2019-04-13T06:57:06
2019-04-13T06:57:06
185,133,329
0
0
null
null
null
null
UTF-8
Java
false
false
1,223
java
/** * Copyright (c) 2018, http://www.snakeyaml.org * <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 org.snakeyaml.engine.v1.scanner; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Optional; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @org.junit.jupiter.api.Tag("fast") class SimpleKeyTest { @Test @DisplayName("Resolve implicit integer") void toString(TestInfo testInfo) { SimpleKey simpleKey = new SimpleKey(0, true, 0, 0, 0, Optional.empty()); assertEquals("SimpleKey - tokenNumber=0 required=true index=0 line=0 column=0", simpleKey.toString()); } }
a3d61da0244323a9d6fae92384c46b5e284f68a2
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project182/src/test/java/org/gradle/test/performance/largejavamultiproject/project182/p910/Test18217.java
78b98b45b1389b26253322b181c9d9297f44bc8c
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,112
java
package org.gradle.test.performance.largejavamultiproject.project182.p910; import org.junit.Test; import static org.junit.Assert.*; public class Test18217 { Production18217 objectUnderTest = new Production18217(); @Test public void testProperty0() { String value = "value"; objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { String value = "value"; objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { String value = "value"; objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { String value = "value"; objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { String value = "value"; objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { String value = "value"; objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
727569d01aa41e7eb30d333b42c072a5014451a9
5748d8e5ab80776e6f565f0dd1f5029d4af5b65e
/codeforces/250/A.java
2870f07cd8f330a703ea7e36152fed6a3927ad29
[]
no_license
lokiysh/cp
f50394a98eec42aa4e9ae997aa4852253fff012f
99cbf19c9db16f51de5a68a8c4989f5de36678c8
refs/heads/master
2023-02-10T21:18:51.987872
2011-07-22T13:04:00
2021-01-11T02:39:17
328,587,177
0
0
null
null
null
null
UTF-8
Java
false
false
2,617
java
import java.io.InputStreamReader; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.ArrayList; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Lokesh Khandelwal aka (codeKNIGHT | phantom11) */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); TaskA solver = new TaskA(); solver.solve(1, in, out); out.close(); } } class TaskA { public void solve(int testNumber, InputReader in, OutputWriter out) { int n=in.nextInt(),i,a[]=new int[n]; for(i=0;i<n;i++) a[i]=in.nextInt(); int neg=0,p=0; ArrayList<Integer> array=new ArrayList<Integer>(); for(i=0;i<n;i++) { if(a[i]<0) neg++; if(neg==3) { neg=1; array.add(p); p=0; } p++; } if(p>0) array.add(p); out.printLine(array.size()); for(int k :array) out.print(k+" "); } } class InputReader { BufferedReader in; StringTokenizer tokenizer=null; public InputReader(InputStream inputStream) { in=new BufferedReader(new InputStreamReader(inputStream)); } public String next() { try{ while (tokenizer==null||!tokenizer.hasMoreTokens()) { tokenizer=new StringTokenizer(in.readLine()); } return tokenizer.nextToken(); } catch (IOException e) { return null; } } public int nextInt() { return Integer.parseInt(next()); } } class OutputWriter { private final PrintWriter writer; public OutputWriter(OutputStream outputStream) { writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter(Writer writer) { this.writer = new PrintWriter(writer); } public void print(Object...objects) { for (int i = 0; i < objects.length; i++) { if (i != 0) writer.print(' '); writer.print(objects[i]); } } public void printLine(Object...objects) { print(objects); writer.println(); } public void close() { writer.close(); } }
bfde890390a4d4d1af0ba6df93bfabaa893b1041
7b06ada9b8771062f8fc23e21fbc9d5b12c8c1e8
/insurance-contract-creation-integration/src/main/java/org/lab/insurance/contract/creation/integration/ContractCreationIntegrationApp.java
7701b1913f49635ec3811a32fba4b5d4d75ad222
[]
no_license
reactjsinaction/lab-insurance
9d87b26776c104dc1194d003f6d58df74f51c07d
e5badafd683a5e2cd0ca1d54a753b489ef8173c6
refs/heads/master
2021-01-20T10:30:08.220870
2017-08-25T14:19:26
2017-08-25T14:19:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
602
java
package org.lab.insurance.contract.creation.integration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; import org.springframework.integration.annotation.IntegrationComponentScan; @SpringBootApplication @IntegrationComponentScan @EnableMongoRepositories("org.lab.insurance.model") public class ContractCreationIntegrationApp { public static void main(String[] args) { SpringApplication.run(ContractCreationIntegrationApp.class, args); } }
4e30f1f35cc79f5e90716315b9e30ef18a31dfc8
14af39e6c3c1df43611655c21614302510ae987d
/src/main/java/br/ufc/web/jornal/model/User.java
879d545de7ffa36f61ca4c3431dcd7abe250beb3
[]
no_license
nathalia45/Jornal
193f20a9b174fcce9c851de1df2ac0440af1d99f
de3913521778e0bda99fb6e265704386a3e0300d
refs/heads/master
2021-01-17T20:01:54.966947
2016-07-22T08:37:59
2016-07-22T08:37:59
63,752,125
0
0
null
null
null
null
UTF-8
Java
false
false
1,924
java
package br.ufc.web.jornal.model; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; @Entity public class User implements UserDetails { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; private String name; @Column(unique=true) private String email; private String password; @OneToMany(fetch=FetchType.EAGER, cascade = CascadeType.REFRESH) private List<Role> roles = new ArrayList<>(); public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public List<Role> getRoles() { return roles; } public void setRoles(List<Role> roles) { this.roles = roles; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return roles; } @Override public String getUsername() { return email; } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } }
0a9bfb327ba9064ef73a98fe3b9e7a3bac37369d
63b181f0d65c1e4eebec9888d469c1659f8150ae
/data/maven/sourceCode/maven-plugins/maven-site-plugin/src/test/projects/site-plugin-test8/framework/src/main/java/org/apache/maven/plugin/site/test8/App.java
ee2ae5ab37f7121f5b58c2bbe89c34bbd1274a89
[]
no_license
ceparadise/IntrermingualLang
9077570b3093b6952a37331dc604f9170a4a34e2
e212c67e9f2fc093915f388c03464564b74eb65b
refs/heads/master
2021-06-25T11:22:09.356438
2019-09-26T04:06:39
2019-09-26T04:06:39
146,329,452
0
0
null
null
null
null
UTF-8
Java
false
false
197
java
package org.apache.maven.plugin.site.test8; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
2f63d1541fec6c804d143bdda1614069325d31c6
2727b1521ffc6a0b158b9b84b2ae3990d5bfc59d
/secure-login-demo/secure-login-web/src/main/java/org/terasoluna/securelogin/app/common/validation/UploadFileNotEmpty.java
a3c4faf60333d3a99fd72f5118d1a977fd53953e
[]
no_license
btnoguchimnm/tutorial-apps
116f1449b0c77cdac0ca486402171a34393c7dfb
3ae4ea2ca0f9963483e646be226666e671812147
refs/heads/master
2020-06-11T10:26:09.138022
2016-12-13T05:51:27
2016-12-13T05:51:27
75,694,408
0
0
null
2016-12-06T04:27:23
2016-12-06T04:27:23
null
UTF-8
Java
false
false
955
java
package org.terasoluna.securelogin.app.common.validation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) @Constraint(validatedBy = UploadFileNotEmptyValidator.class) public @interface UploadFileNotEmpty { String message() default "{org.terasoluna.securelogin.app.common.validation.UploadFileNotEmpty.message}"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE }) @Retention(RetentionPolicy.RUNTIME) @Documented @interface List { UploadFileNotEmpty[] value(); } }
356cfab10358658cfd4a241708356afd28c59e61
8c619728344325cebd3fb0bc69a23bc9841f51e6
/src/main/java/dev/romashov/gameOfLife/MiscAlgorithms.java
72d14c26f45e9b6be8fd8441cb4d186e32cbaed6
[ "MIT" ]
permissive
MikeRomaa/game-of-life
32373dddce36634f846057bc05d901575e99dc9e
a81000d2a6d2d75ec12cd2dc6d4d0e4e7ea8273c
refs/heads/main
2023-02-23T18:33:36.796352
2021-01-26T04:38:08
2021-01-26T04:38:08
331,709,391
1
0
null
null
null
null
UTF-8
Java
false
false
3,006
java
package dev.romashov.gameOfLife; /** * Literally only here to check off all project requirements. * None of these are used in the processing of Conway's * Game of Life. */ public class MiscAlgorithms { public static int max(int[] arr) { int max = arr[0]; for (int n : arr) { if (n > max) max = n; } return max; } public static int min(int[] arr) { int min = arr[0]; for (int n : arr) { if (n < min) min = n; } return min; } public static int sum(int[] arr) { int sum = 0; for (int n : arr) sum += n; return sum; } public static double mean(int[] arr) { return (double) sum(arr) / arr.length; } public static int mode(int[] arr) { int mode = arr[0]; int modeCount = 1; for (int i : arr) { int count = frequency(arr, i); if (count > modeCount) { mode = i; modeCount = count; } } return mode; } public static boolean contains(int[] arr, int num) { for (int i : arr) { if (i == num) return true; } return false; } public static int frequency(int[] arr, int num) { int count = 0; for (int i : arr) { if (i == num) count++; } return count; } public static boolean anyDivisible(int[] arr, int num) { for (int i : arr) { if (i % num == 0) return true; } return false; } public static boolean allDivisible(int[] arr, int num) { for (int i : arr) { if (i % num != 0) return false; } return true; } public static boolean hasDuplicates(int[] arr) { return (frequency(arr, mode(arr)) > 1); } public static int[] shiftRight(int[] arr) { int[] newArr = new int[arr.length]; newArr[0] = arr[arr.length - 1]; for (int i = 0; i < arr.length - 1; i++) { newArr[i + 1] = arr[i]; } return newArr; } public static int[] shiftLeft(int[] arr) { int[] newArr = new int[arr.length]; for (int i = 1; i < arr.length; i++) { newArr[i - 1] = arr[i]; } newArr[arr.length - 1] = arr[0]; return newArr; } public static int[] reverse(int[] arr) { int[] newArr = new int[arr.length]; for (int i = 0; i < arr.length; i++) { newArr[arr.length - 1 - i] = arr[i]; } return newArr; } public static void printConsecutivePairs(int[] arr) { for (int i = 1; i < arr.length; i++) { System.out.println("[" + arr[i - 1] + ", " + arr[i] + "]"); } } public static int digitAtIndex(int n, int i) { return (n / (int) Math.pow(10, i)) % 10; } public static boolean isDivisible(int a, int b) { return a % b == 0 || b % a == 0; } }
28a756ea91ab80b60d8db94361df426a79493a03
e12d633119932ae7e85ebbd6c3ecc17ac0475d21
/src/org/jafer/zclient/AbstractClient.java
0aab6de82738fc4df6172176ea8373d8e0d914fd
[]
no_license
hizhangbo/jafer-master
88312a2e3f0f77c560cf06042e48bfaf6cdfe4c7
988213b650400489f2bc2ade68135cead887250a
refs/heads/master
2021-01-21T18:10:23.546844
2017-05-22T06:29:04
2017-05-22T06:29:04
92,018,699
0
0
null
null
null
null
UTF-8
Java
false
false
44,934
java
/** * JAFER Toolkit Project. * Copyright (C) 2002, JAFER Toolkit Project, Oxford University. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /** * Title: JAFER Toolkit * Description: * Copyright: Copyright (c) 2001 * Company: Oxford University * *@author Antony Corfield; Matthew Dovey; Colin Tatham *@version 1.0 */ package org.jafer.zclient; import java.util.Hashtable; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.commons.collections.iterators.ArrayIterator; import org.jafer.exception.JaferException; import org.jafer.query.QueryException; import org.jafer.query.QueryParser; import org.jafer.record.Cache; import org.jafer.record.DataObject; import org.jafer.record.Field; import org.jafer.record.HashtableCacheFactory; import org.jafer.record.RecordException; import org.jafer.record.TermRecord; import org.jafer.transport.ConnectionException; import org.jafer.util.Config; import org.jafer.util.xml.DOMFactory; import org.jafer.util.xml.XMLSerializer; import org.jafer.zclient.operations.PresentException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; public abstract class AbstractClient extends org.jafer.interfaces.Databean implements org.jafer.interfaces.Cache, org.jafer.interfaces.Logging, org.jafer.interfaces.Connection, org.jafer.interfaces.Z3950Connection, org.jafer.interfaces.Authentication, org.jafer.interfaces.Search, org.jafer.interfaces.Present, org.jafer.interfaces.Scan { /** * String DEFAULT_DATABASE_NAME */ public static final String DEFAULT_DATABASE_NAME = "xxdefault"; /** * String DEFAULT_RESULTSET_NAME */ public static final String DEFAULT_RESULTSET_NAME = "default"; // /** // * String DEFAULT_SEARCH_PROFILE // */ // public static final String DEFAULT_SEARCH_PROFILE = "0.0.0.0.0.0"; /** * String DEFAULT_ELEMENT_SPEC */ public final static String DEFAULT_ELEMENT_SPEC = "F"; /** * int DEFAULT_FETCH_SIZE */ public final static int DEFAULT_FETCH_SIZE = 10; /** * double DEFAULT_FETCH_VIEW */ public final static double DEFAULT_FETCH_VIEW = 1.0; /** * int DEFAULT_DATACACHE_SIZE */ public final static int DEFAULT_DATACACHE_SIZE = 512; /** * int MAX_DATACACHE_SIZE */ public final static int MAX_DATACACHE_SIZE = 2048; /** * int TIMEOUT */ public final static int TIMEOUT = 600000; /** * int AUTO_RECONNECT */ public final static int AUTO_RECONNECT = 5; /** * String DEFAULT_RECORD_SCHEMA */ public final static String DEFAULT_RECORD_SCHEMA = "http://www.loc.gov/mods/"; public final static int[] DEFAULT_RECORD_SYNTAX = { 1, 2, 840, 10003, 5, 10 }; // MARC21 /** * Stores a reference to exception that occured in the last search or null * if no errors occured */ private Hashtable searchExceptions = new Hashtable(); private int fetchSize; private int dataCacheSize; private int autoReconnect = -1; /** @todo temporary fix. */ private int timeout = -1; /** @todo temporary fix. */ private int attempts; private int numberOfRequestRecords; private int startRecordNumber; private int nResults; private int port; private double fetchView = 1.0; // private boolean debug = false; private boolean checkRecordFormat = false; private boolean parseQuery = true; protected Integer recordCursor; private String elementSpec; protected String userIP; private String remoteAddress; private String resultSetName; private String recordSchema; // private String recordSyntax; private int[] recordSyntax; private String host; private String username; private String password; private String group; /** * String[] dataBases */ private String[] dataBases; /** * int[] dataBases */ private Hashtable resultsByDB = new Hashtable(); /** * Session session */ private Session session; /** * Cache - cache made protected due to fact that ZClientDB still needs the * cache */ protected Cache cache; /** * Document document */ private Document document; /** @todo remove this, update cache methods */ /** * Node query */ private Object query; /** * Logger logger */ protected static Logger logger; /** * Empty Constructor for the ZClient object */ public AbstractClient() { logger = Logger.getLogger("org.jafer.zclient"); logger.log(Level.FINE, "initializing ZClient..."); setDefaults(); /** * @todo OK to take this out? Called here as well as in submitQuery()? * timeout isn't set to default value, it's initialised to 0. same * with autoreconnect. */ } /** * sets/checks default properties of the ZClient object * * @throws JaferException Description of Exception */ private void setDefaults() { if (getRemoteAddress() == null) userIP = ""; else userIP = "<" + getRemoteAddress() + ">"; if (getDocument() == null) setDocument(DOMFactory.newDocument()); if (getDatabases() == null) setDatabases(DEFAULT_DATABASE_NAME); // moved check for null to // setDatabases(); if (getDataCacheSize() < 1 || getDataCacheSize() > MAX_DATACACHE_SIZE) setDataCacheSize(DEFAULT_DATACACHE_SIZE); if (getFetchSize() < 1 || getFetchSize() > getDataCacheSize()) setFetchSize(getDataCacheSize() < DEFAULT_FETCH_SIZE ? getDataCacheSize() : DEFAULT_FETCH_SIZE); if (getFetchView() < 0.0 || getFetchView() > 1.0) setFetchView(DEFAULT_FETCH_VIEW); if (getResultSetName() == null) setResultSetName(DEFAULT_RESULTSET_NAME); if (getElementSpec() == null) setElementSpec(DEFAULT_ELEMENT_SPEC); if (getAutoReconnect() < 0) setAutoReconnect(AUTO_RECONNECT); if (getTimeout() < 0) // if getTimeout() > Integer.MAX_VALUE then // returned int is negative value setTimeout(TIMEOUT); // if (getSearchProfile() == null) // setSearchProfile(DEFAULT_SEARCH_PROFILE); if (getRecordSchema() == null) setRecordSchema(DEFAULT_RECORD_SCHEMA); try { if (getRecordSyntax() == null) setRecordSyntax(Config.convertSyntax(Config.getRecordSyntax(getRecordSchema()))); } catch (JaferException ex) { setRecordSyntax(DEFAULT_RECORD_SYNTAX); } logger.log(Level.FINER, "Java version: " + System.getProperty("java.version")); logger.log(Level.FINER, "Java home: " + System.getProperty("java.home")); logger.log(Level.FINER, "Classpath: " + System.getProperty("java.class.path")); logger.log(Level.FINER, "Operating system: " + System.getProperty("os.name")); logger.log(Level.FINER, "ZClient property dataCacheSize: " + getDataCacheSize()); logger.log(Level.FINER, "ZClient property fetchSize: " + getFetchSize()); logger.log(Level.FINER, "ZClient property fetchView: " + getFetchView()); logger.log(Level.FINER, "ZClient property elementSpec: " + getElementSpec()); logger.log(Level.FINER, "ZClient property recordSchema: " + getRecordSchema()); logger.log(Level.FINER, "ZClient property host: " + getHost()); logger.log(Level.FINER, "ZClient property port: " + getPort()); logger.log(Level.FINER, "ZClient property dataBases: " + getDatabaseNames()); } /** * Description of the Method * * @param query Description of Parameter * @return Description of the Returned Value */ public int submitQuery(Object query) throws JaferException { logger.entering("ZClient", "public int submitQuery(Object query)"); try { // reset the last search exception setSearchException((String[])null, null); resultsByDB.clear(); setDefaults(); // check if query needs parsing if (isParseQuery()) query = QueryParser.parseQuery(query); setQuery(query); // if a cache is not already configured then create a HashtableCache // as // default otherwise clear the current cache if (getCache() == null) { logger.log(Level.FINER, "No supplied cache, creating default HashtableCache"); setCache(new HashtableCacheFactory(getDataCacheSize()).getCache()); } else { getCache().clear(); } connect(); logger.exiting("ZClient", "public int submitQuery(Object query)"); return search(); } catch (QueryException e) { String message = userIP + "ZClient submitQuery(Object query); " + e.getMessage(); logger.log(Level.SEVERE, message); setSearchException((String[])null, new JaferException(e)); throw e; } catch (JaferException exc) { // store the exception and throw it on setSearchException((String[])null, exc); throw exc; } } protected abstract Session createSession(); /** * Description of the Method * * @throws JaferException Description of Exception */ private void connect() throws JaferException { logger.entering("ZClient", " private void connect()"); if (getSession() == null || getSession().getGroup() != this.getGroup() || getSession().getUsername() != this.getUsername() || getSession().getPassword() != this.getPassword()) { try { setSession(createSession()); getSession().init(getGroup(), getUsername(), getPassword()); } catch (ConnectionException e) { String message; if (allowReconnect()) { message = userIP + "ZClient Connection error - connecting again" + " (host: " + getHost() + ", port: " + getPort() + ", database: " + getDatabaseNames() + ", username: " + getUsername() + ", group: " + getGroup() + ")"; logger.log(Level.WARNING, message); reConnect(); } else { message = userIP + "Connection failure - host: " + getHost() + ", port: " + getPort() + ", username: " + getUsername() + ", group: " + getGroup() + " (" + e.getMessage() + ")"; logger.log(Level.SEVERE, message); throw new JaferException(message, e); } } catch (JaferException e) { String message = userIP + "ZClient Initialization error; " + e.getMessage(); try { logger.log(Level.SEVERE, message); } catch (NullPointerException e2) { System.err.print("SEVERE: " + message + e.toString()); } throw e; } logger.exiting("ZClient", " private void connect()"); } } /** * Description of the Method * * @throws JaferException Description of Exception */ protected void reConnect() throws JaferException { setAttempts(getAttempts() + 1); String message = "Re-starting session... (autoReconnect " + getAttempts() + ")"; logger.log(Level.INFO, userIP + message); close(); connect(); } /** * search * * @return the returned int * @throws JaferException - */ protected int search() throws JaferException { logger.entering("ZClient", "private int search()"); logger.log(Level.FINE, userIP + "Submitting query..."); try { setSearchResults(getSession().search(getQuery(), getDatabases(), getResultSetName())); setNumberOfRequestRecords(getFetchSize()); logger.log(Level.FINE, userIP + "Number of search results: " + getNumberOfResults()); logger.exiting("ZClient", "int search()"); return getNumberOfResults(); } catch (ConnectionException e) { String message; if (allowReconnect()) { message = userIP + "Connection failure whilst submitting query - connecting again"; logger.log(Level.WARNING, message); reConnect(); // return setNumberOfResults(new int[]{search()}); return search(); } else { message = userIP + "Connection failure whilst submitting query (autoReconnect = " + getAutoReconnect() + ")"; logger.log(Level.SEVERE, message); throw new JaferException(message, e); } } catch (JaferException e) { String message = userIP + "Error attempting search (" + getHost() + ":" + getPort() + ", dataBase(s) " + getDatabaseNames() + ", username " + getUsername() + "): "; message += e.getMessage(); logger.log(Level.SEVERE, message); throw new JaferException(message, e.getDiagnostic()); } } /** * Sets the RecordCursor attribute of the ZClient object * * @param nRecord The new RecordCursor value * @throws JaferException Description of Exception */ public void setRecordCursor(int nRecord) throws JaferException { logger.entering("ZClient", "public void setRecordCursor(int nRecord)"); if (nRecord > 0 && nRecord <= getNumberOfResults()) { this.recordCursor = new Integer(nRecord); if (!getCache().contains(recordCursor)) { try { setStartRecordNumber(nRecord); Vector dataObjects = getSession().present(getStartRecordNumber(), getNumberOfRequestRecords(), // Config.convertSyntax(Config.getRecordSyntax(getRecordSchema())), getRecordSyntax(), getElementSpec(), getResultSetName()); for (int n = 0; n < dataObjects.size(); n++) { Integer recordNumber = new Integer(getStartRecordNumber() + n); if (!getCache().contains(recordNumber)) getCache().put(recordNumber, (DataObject) dataObjects.get(n)); } } catch (PresentException e) { int status = e.getStatus(); switch (status) { case PresentException.STATUS_REQUEST_TERMINATED: // Present request terminated try again... handleError(userIP + "Present status = " + status + ": " + e.getMessage() + " (record " + getStartRecordNumber() + "):" + " records requested = " + getNumberOfRequestRecords() + ", records returned = " + e.getNumberOfRecordsReturned()); if (allowReconnect()) { reConnect(); search(); setRecordCursor(getRecordCursor()); } else handleError(userIP + "Persistent failure whilst retrieving records (autoReconnect = " + getAutoReconnect() + ")", e); break; case PresentException.STATUS_TO_MANY_RECORDS: // too many records requested try again... if (e.getNumberOfRecordsReturned() > 1) { handleError(userIP + "Present status = " + status + ": " + e.getMessage() + " (record " + getStartRecordNumber() + "):" + " decreasing Fetch size from " + getNumberOfRequestRecords() + " to " + e.getNumberOfRecordsReturned()); setNumberOfRequestRecords(e.getNumberOfRecordsReturned()); setRecordCursor(getRecordCursor()); } else { // message size too small - Present Failure handleError(userIP + "Present status = " + status + "; requested record was not returned - message size is too small (record " + getStartRecordNumber() + "):" + " records requested = " + getNumberOfRequestRecords() + ", records returned = " + e.getNumberOfRecordsReturned(), e); } break; case PresentException.STATUS_ORIGIN_FAILURE: // Present request terminated try again... handleError(userIP + "Present status = " + status + "; requested record was not returned - message size is too small (record " + getStartRecordNumber() + "):" + " records requested = " + getNumberOfRequestRecords() + ", records returned = " + e.getNumberOfRecordsReturned()); if (allowReconnect()) { reConnect(); search(); setRecordCursor(getRecordCursor()); } else handleError(userIP + "Persistent failure whilst retrieving records (autoReconnect = " + getAutoReconnect() + ")", e); break; case PresentException.STATUS_TARGET_FAILURE: // Present request terminated try again... handleError(userIP + "Present status = " + status + ": " + e.getMessage() + " (record " + getStartRecordNumber() + "):" + " records requested = " + getNumberOfRequestRecords() + ", records returned = " + e.getNumberOfRecordsReturned()); if (allowReconnect()) { reConnect(); search(); setRecordCursor(getRecordCursor()); } else handleError(userIP + "Persistent failure whilst retrieving records (autoReconnect = " + getAutoReconnect() + ")", e); break; case PresentException.STATUS_TERMINAL_FAILURE: // Present failure handleError(userIP + "Present failed status = " + status + ": " + e.getMessage() + " (record " + getStartRecordNumber() + ")", e); } } catch (ConnectionException e) { // Present terminated by ConnectionException try again... if (allowReconnect()) { handleError(userIP + "Connection failure whilst retrieving records (record " + getStartRecordNumber() + ") - connecting again (" + e.toString() + ")"); reConnect(); search(); setRecordCursor(getRecordCursor()); } else handleError(userIP + "Connection failure whilst retrieving records (autoReconnect = " + getAutoReconnect() + ")", e); } } } else { String message = userIP + "Record number " + nRecord + " not found (number of search results = " + getNumberOfResults() + ")"; handleError(message, new JaferException(message)); } logger.exiting("ZClient", "public void setRecordCursor(int nRecord)"); } protected void handleError(String message) { logger.log(Level.WARNING, message); } protected void handleError(String message, JaferException e) throws JaferException { logger.log(Level.SEVERE, message); throw e; } /** * Gets the RecordCursor attribute of the ZClient object * * @return The RecordCursor value as int */ public int getRecordCursor() { return recordCursor.intValue(); } public void setDocument(Document document) { this.document = document; } public Document getDocument() { return document; } /** * getDatabaseNames * * @return the returned String */ private String getDatabaseNames() { String dbNames = ""; for (int i = 0; i < getDatabases().length; i++) dbNames += getDatabases()[i] + " "; return dbNames; } protected void finalize() throws JaferException { close(); setSession(null); setCache(null); // setQueryBuilder(null); setDocument(null); // setQueryDocument(null); } /** * close * * @throws JaferException */ public void close() throws JaferException { if (getSession() != null) { getSession().close(); setSession(null); } } /** * Sets the remoteAddress attribute of the ZClient object (for Servlets) * * @param remoteAddress The new remoteAddress value */ public void setRemoteAddress(String remoteAddress) { this.remoteAddress = remoteAddress; } /** * Gets the remoteAddress attribute of the ZClient object (for Servlets) * * @return remoteAddress The remoteAddress value */ public String getRemoteAddress() { return remoteAddress; } /** * Sets the parseQuery attribute of the ZClient object * * @param parseQuery The new parseQuery value */ public void setParseQuery(boolean parseQuery) { this.parseQuery = parseQuery; } /** * Gets the parseQuery attribute of the ZClient object * * @return parseQuery The parseQuery value */ public boolean isParseQuery() { return parseQuery; } public void setRecordSchema(String recordSchema) { this.recordSchema = recordSchema; } public String getRecordSchema() { return recordSchema; } public void setRecordSyntax(int[] recordSyntax) { this.recordSyntax = recordSyntax; } public int[] getRecordSyntax() { return recordSyntax; } private void setSession(Session session) { this.session = session; } protected Session getSession() { return session; } public void setCache(Cache cache) { this.cache = cache; // double check that the fetch size in the abstract client is not bigger // than the size of the cache we are about to set as this would result // in the retrieve failing to find the record because the fetch wipes // out the record to retrieve when the cache becomes full if (getFetchSize() > cache.getDataCacheSize()) { setFetchSize(cache.getDataCacheSize()); } } public Cache getCache() { return cache; } /** * Returns the number of available slots currently in the cache * * @return The number of currently availiable slots */ public int getAvailableSlots() { return cache.getAvailableSlots(); } // // // private void setQueryDocument(Document queryDocument) { // // this.queryDocument = queryDocument; // } // // // private Document getQueryDocument() { // // return queryDocument; // } // /** * Sets the timeout attribute of the ZClient object * * @param timeout The new timeout value */ public void setTimeout(int timeout) { this.timeout = timeout; } /** * Gets the timeout attribute of the ZClient object * * @return The timeout value */ public int getTimeout() { return timeout; } /** * Sets the autoReconnect attribute of the ZClient object */ public void setAutoReconnect(int autoReconnect) { this.autoReconnect = autoReconnect; } /** * Gets the autoReconnect attribute of the ZClient object * * @return The autoReconnect value */ public int getAutoReconnect() { return autoReconnect; } /** * Sets the reTry attribute of the ZClient object */ private void setAttempts(int attempts) { this.attempts = attempts; } /** * Gets the attempts attribute of the ZClient object * * @return The attempts value */ private int getAttempts() { return attempts; } /** * returns true if ZClient should attempt reconnect * * @return true if getAttempts() <= getAutoReconnect() */ protected boolean allowReconnect() { return getAttempts() < getAutoReconnect(); } /** * Sets the numberOfRequestRecords attribute of the ZClient object * * @param numberOfRequestRecords The new numberOfRequestRecords value */ protected void setNumberOfRequestRecords(int numberOfRequestRecords) { if (numberOfRequestRecords < 1 || numberOfRequestRecords > getNumberOfResults()) this.numberOfRequestRecords = 1; else this.numberOfRequestRecords = numberOfRequestRecords; } /** * Gets the numberOfRequestRecords attribute of the ZClient object * * @return The numberOfRequestRecords value */ protected int getNumberOfRequestRecords() { return numberOfRequestRecords; } /** * sets startRecordNumber for Present * * @param nRecord The value of setRecordCursor */ protected void setStartRecordNumber(int nRecord) { int forwardOffset, backwardOffset; forwardOffset = (int) ((getNumberOfRequestRecords() - 1) * getFetchView()); if (nRecord + forwardOffset > getNumberOfResults()) { forwardOffset = getNumberOfResults() - nRecord; backwardOffset = (getNumberOfRequestRecords() - 1) - forwardOffset; } else { backwardOffset = (getNumberOfRequestRecords() - 1) - forwardOffset; if (nRecord - backwardOffset < 1) { backwardOffset = nRecord - 1; forwardOffset = (getNumberOfRequestRecords() - 1) - backwardOffset; } } this.startRecordNumber = nRecord - backwardOffset; } /** * Gets setStartRecordNumber record number for Present * * @return startRecordNumber the startRecordNumber value */ protected int getStartRecordNumber() { return startRecordNumber; } /** * Gets the CurrentRecord attribute of the ZClient object * * @return The CurrentRecord value * @throws JaferException Description of Exception */ public Field getCurrentRecord() throws JaferException { Node recordRoot = cache.getXML(getDocument(), getRecordSchema(), getRecordCursorAsInteger()); int[] syntax = Config.convertSyntax(((Element) recordRoot).getAttribute("syntax")); if (Config.isSyntaxEqual(syntax, Config.convertSyntax(Config.getRecordSyntaxFromName("DIAG_BIB1")))) throw new RecordException("Returned record is Surrogate Diagnostic", new Field(recordRoot, recordRoot.getFirstChild())); if (Config.isSyntaxEqual(syntax, Config.convertSyntax(Config.getRecordSyntaxFromName("JAFER")))) throw new RecordException("Error generating XML from returned record", new Field(recordRoot, recordRoot .getFirstChild())); if (isCheckRecordFormat()) { String schema = ((Element) recordRoot).getAttribute("schema"); if (!schema.equals(getRecordSchema())) throw new RecordException("Returned record (schema: " + schema + ") does not match requested schema " + getRecordSchema(), new Field(recordRoot, recordRoot.getFirstChild())); } return new Field(recordRoot, recordRoot.getFirstChild()); } /** * Gets the CurrentDataObject attribute of the ZClient object * * @return The CurrentDataObject value * @throws JaferException Description of Exception */ public DataObject getCurrentDataObject() throws JaferException { return cache.getDataObject(getRecordCursorAsInteger()); } /** * Gets the CurrentDataBase attribute of the ZClient object * * @return The CurrentDataBase value * @throws JaferException Description of Exception */ public String getCurrentDatabase() throws JaferException { return cache.getDataObject(getRecordCursorAsInteger()).getDatabaseName(); } /** * Gets the CurrentRecordSyntax attribute of the ZClient object * * @return The CurrentRecordSyntax value * @throws JaferException Description of Exception */ public String getCurrentRecordSyntax() throws JaferException { return Config.convertSyntax(cache.getDataObject(getRecordCursorAsInteger()).getRecordSyntax()); } /** * Gets the CurrentRecordSyntaxName value of the ZClient object * * @return The CurrentRecordSyntaxName value * @throws JaferException Description of Exception */ public String getCurrentRecordSyntaxName() throws JaferException { return Config.getRecordNameFromSyntax(getCurrentRecordSyntax()); } /** * Sets the Host attribute of the ZClient object * * @param host The new Host value */ public void setHost(String host) { if (!host.equalsIgnoreCase(this.host)) { try { close(); } catch (Exception ex) { /** * @todo: Do anything here? */ } this.host = host; } } /** * Sets the Port attribute of the ZClient object * * @param port The new Port value */ public void setPort(int port) { if (this.port != port) { try { close(); } catch (Exception ex) { /** * @todo: Do anything here? */ } this.port = port; } } /** * Sets the resultSetName attribute of the ZClient object * * @param resultSetName The new resultSetName value */ public void setResultSetName(String resultSetName) { this.resultSetName = resultSetName; } /** * Sets the Databases attribute of the ZClient object * * @param databases The new Databases value */ /** @todo throw exception if databases param is null? */ public void setDatabases(String[] databases) { if (databases != null) { Vector v = new Vector(); for (int i = 0; i < databases.length; i++) { if (databases[i] != null) v.add(databases[i]); } this.dataBases = (String[]) v.toArray(new String[] {}); this.searchExceptions = new Hashtable(this.dataBases.length); this.resultsByDB = new Hashtable(this.dataBases.length); } } /** * Sets the Databases attribute of the ZClient object * * @param database The new Databases value */ public void setDatabases(String database) { setDatabases(new String[] { database }); } /** * Sets the username attribute of the ZClient object * * @param username The new username value */ public void setUsername(String username) { this.username = username; } /** * Sets the password attribute of the ZClient object * * @param password The new password value */ public void setPassword(String password) { this.password = password; } /** * Sets the checkRecordFormat attribute of the ZClient object * * @param checkRecordFormat The new checkRecordFormat value */ public void setCheckRecordFormat(boolean checkRecordFormat) { this.checkRecordFormat = checkRecordFormat; } /** * Gets the checkRecordFormat attribute of the ZClient object * * @return checkRecordFormat The checkRecordFormat value */ public boolean isCheckRecordFormat() { return checkRecordFormat; } /** * Sets the ElementSpec attribute of the ZClient object * * @param elementSpec The new ElementSpec value */ public void setElementSpec(String elementSpec) { this.elementSpec = elementSpec; } /** * Sets the DataCacheSize attribute of the ZClient object * * @param dataCacheSize The new DataCacheSize value */ public void setDataCacheSize(int dataCacheSize) { this.dataCacheSize = dataCacheSize; } /** * Sets the fetchSize attribute of the ZClient object * * @param fetchSize The new fetchSize value */ public void setFetchSize(int fetchSize) { // if the data cache size is less than the fetch size then fetch size // can only be set to the datacache size to avoid the fetch removing the // first item it added causing an exception on retrieve. // The datacache size to compare against the fetch size should be the // one on the current cache and if that is not created yet then the // cache size on the abstract client as this will be used to create the // internal cache when one does not exist if (cache != null) { if (cache.getDataCacheSize() < fetchSize) { fetchSize = cache.getDataCacheSize(); } } else if (getDataCacheSize() < fetchSize) { fetchSize = getDataCacheSize(); } this.fetchSize = fetchSize; } /** * Sets the FetchView attribute of the ZClient object * * @param fetchView The new FetchView value */ public void setFetchView(double fetchView) { this.fetchView = fetchView; } /** * Sets the nResults attribute of the ZClient object * * @param nResults The new nResults value * @return nResults The new nResults value */ private int setSearchResults(SearchResult[] resultsByDB) { int total = 0; for (int i = 0; i < resultsByDB.length; i++) { total += resultsByDB[i].getNoOfResults(); this.setSearchException(resultsByDB[i].getDatabaseName(), resultsByDB[i].getDiagnostic()); this.setNumberOfResults(resultsByDB[i].getDatabaseName(), resultsByDB[i].getNoOfResults()); } return nResults = total; } /** * Gets the Host attribute of the ZClient object * * @return The Host value */ public String getHost() { return host; } /** * Gets the Port attribute of the ZClient object * * @return The Port value */ public int getPort() { return port; } /** * Gets the resultSetName attribute of the ZClient object * * @return The resultSetName value */ public String getResultSetName() { return resultSetName; } /** * Gets the DataBases attribute of the ZClient object * * @return The DataBases value */ public String[] getDatabases() { return dataBases; } /** * Gets the Username attribute of the ZClient object * * @return The Username value */ public String getUsername() { return username; } /** * Gets the Password attribute of the ZClient object * * @return The Password value */ public String getPassword() { return password; } public String getGroup() { return group; } public void setGroup(String group) { this.group = group; } /** * Gets the ElementSpec attribute of the ZClient object * * @return The ElementSpec value */ public String getElementSpec() { return elementSpec; } /** * Gets the query attribute of the ZClient object * * @return The query value */ public Object getQuery() { return query; } /** * Gets the DataCacheSize attribute of the ZClient object * * @return The DataCacheSize value */ public int getDataCacheSize() { return dataCacheSize; } /** * Gets the fetchSize attribute of the ZClient object * * @return The fetchSize value */ public int getFetchSize() { return fetchSize; } /** * Gets the FetchView attribute of the ZClient object * * @return The FetchView value */ public double getFetchView() { return fetchView; } /** * Gets the NumberOfResults attribute of the ZClient object * * @return The NumberOfResults value */ public int getNumberOfResults() { return nResults; } /** * Gets the NumberOfResults attribute of the ZClient object * * @return The NumberOfResults value */ public int getNumberOfResults(String databaseName) { Integer results = (Integer)this.resultsByDB.get(databaseName); if (results != null) { return results.intValue(); } return 0; } protected void setNumberOfResults(String databaseName, int numberOfResults) { if (databaseName != null) { this.resultsByDB.put(databaseName, new Integer(numberOfResults)); } else { Iterator iterate = new ArrayIterator(this.getDatabases()); while (iterate.hasNext()) { Object next = iterate.next(); if (next != null) { this.resultsByDB.put(next, new Integer(numberOfResults)); } } } } /** * Gets the RecordCursor attribute of the ZClient object * * @return The RecordCursor value as Integer */ protected Integer getRecordCursorAsInteger() { return recordCursor; } /** * Description of the Method * * @param file Description of Parameter */ public void saveQuery(String file) throws JaferException { /** @todo save other types of query objects... */ if (getQuery() instanceof Node) { try { XMLSerializer.out((Node) getQuery(), false, file); } catch (JaferException e) { String message = userIP + "ZClient, public void saveQuery(String file): cannot save query to file " + file + "; " + e.toString(); logger.log(Level.SEVERE, message, e); throw e; } } } /** * @todo: Scan added as experimental code */ public Field[] getTerms(int noOfTerms, Node term) { return getTerms(noOfTerms, 1, 1, term); } public Field[] getTerms(int noOfTerms, int termStep, int termPosition, Node term) { try { Vector rawTerms = session.scan(this.getDatabases(), noOfTerms, termStep, termPosition, term); Field[] terms = new Field[rawTerms.size()]; for (int n = 0; n < rawTerms.size(); n++) { TermRecord termRecord = (TermRecord) rawTerms.get(n); terms[n] = new Field(termRecord.getXML(this.getDocument()), termRecord.getXML(this.getDocument())); } return terms; } catch (Exception e) { /** * @todo: catch exception */ return new Field[0]; } } /** * Sets the query attribute of the ZClient object * * @param query The new query value */ private void setQuery(Object query) { this.query = query; } protected void setSearchException(String database, JaferException exception) { if (database != null) { setSearchException(new String[] {database}, exception); } else { setSearchException((String[])null, exception); } } protected void setSearchException(String[] databases, JaferException exception) { Iterator iterate; if (databases != null) { iterate = new ArrayIterator(databases); } else if (this.getDatabases() != null) { iterate = new ArrayIterator(this.getDatabases()); } else { return; } while (iterate.hasNext()) { Object next = iterate.next(); if (next != null) { if (exception == null) { try { searchExceptions.remove(next); } catch (NoSuchElementException ex) { } } else { searchExceptions.put(next, exception); } } else { setSearchException((String[])null, exception); return; } } } /* * (non-Javadoc) * * @see org.jafer.interfaces.Search#getSearchDiagnostic(java.lang.String) */ public JaferException getSearchException(String database) throws JaferException { if (database != null) { return (JaferException)searchExceptions.get(database); } return null; } /* * (non-Javadoc) * * @see org.jafer.interfaces.Search#getSearchDiagnostics(java.lang.String[]) */ public JaferException[] getSearchException(String[] databases) throws JaferException { // create empty array for success condition Vector errors = new Vector(); // make sure database names are specified and this client has a // JaferException lined up to report if the database name matches if (databases != null) { for (int i=0; i<databases.length; i++) { if (databases[i] == null) { errors.add(null); } else { errors.add(this.getSearchException(databases[i])); } } } return (JaferException[])errors.toArray(new JaferException[]{}); } }
52f32155227b3fe34d7c3b5c1ffd32c2bf1850d3
e67aa88dba5cc9d297f21b12cf16a380635b0826
/pharmaware/src/fr/mmm/pharmaware/entity/EnumModeAdministration.java
e1efb7278b607e940b80ab58396d20cfe61d26c2
[]
no_license
khalifandiaye/pharmasoft
637d1f718a68eb36754c1ff5052371a5ab55035a
5ce60b7c10be58bd66ef262ef22432094965f681
refs/heads/master
2021-01-01T08:21:03.408678
2015-03-11T21:45:48
2015-03-11T21:45:48
39,524,592
0
0
null
null
null
null
UTF-8
Java
false
false
145
java
package fr.mmm.pharmaware.entity; public enum EnumModeAdministration { ORAL, BUCAL, LINGUAL, INJECTABLE, COLLYRE, VAGINAL, }
[ "moustaphamb@11cddf64-6fb3-b167-68fa-693e53c0ab82" ]
moustaphamb@11cddf64-6fb3-b167-68fa-693e53c0ab82
fee6ec5940503cb8ecff559c64bcc650608b8bde
b0462373c6b3a52fddf3cd6b0b54f663f5e04003
/twitter-tools-rm3/src/main/java/edu/illinois/lis/utils/Integration.java
3a5e3322c373617152a7280a9de6a7c02a27e59f
[ "Apache-2.0" ]
permissive
jinfengr/twitter-tools
639ac9a36469157f0c79d846f3382a13a87f1089
719f7b4cbed73a8eeb79a355771b6b039235328d
refs/heads/master
2021-05-28T12:22:51.223860
2014-12-26T13:19:16
2014-12-26T13:19:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,079
java
package edu.illinois.lis.utils; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import com.google.common.collect.MinMaxPriorityQueue; import umd.twittertools.data.Tweet; import umd.twittertools.data.TweetSet; import umd.twittertools.model.QueryLikelihoodModel; import cc.twittertools.thrift.gen.TResult; import edu.illinois.lis.query.GQuery; public class Integration { //private static QueryLikelihoodModel qlModel = new QueryLikelihoodModel(); public static TweetSet TResultSet2TweetSet(GQuery query, List<TResult> results, boolean rmRetweet) { String queryText = query.getText(); int queryId = Integer.parseInt(query.getTitle().replaceFirst("^MB0*", "")); long queryTime = (long)query.getEpoch(); TweetSet tweetSet = new TweetSet(queryText, queryId); //qlModel.setCorpus(results); // query likelihood model set corpus. Set<Long> tweetIds = new HashSet<Long>(); for (TResult result : results) { if (!tweetIds.contains(result.id)) { if (rmRetweet) { if (result.retweeted_status_id != 0) { continue; // filter all retweets } } tweetIds.add(result.id); // compute query likelihood score // double score = qlModel.computeScore(queryText, result.text); Tweet tweet = new Tweet(result.id, result.epoch, queryTime - result.epoch, result.rsv); tweet.setText(result.text); tweet.setRsv(result.rsv); tweetSet.add(tweet); } } tweetSet.sortByQLscore(); return tweetSet; } public static List<TResult> TweetSet2TResultSet(List<Tweet> tweetSet) { List<TResult> results = new ArrayList<TResult>(); Iterator<Tweet> iterator = tweetSet.iterator(); while(iterator.hasNext()) { results.add(iterator.next().toResult()); } return results; } public static List<TResult> TweetSet2TResultSet(TweetSet tweetSet) { List<TResult> results = new ArrayList<TResult>(); Iterator<Tweet> iterator = tweetSet.iterator(); while(iterator.hasNext()) { results.add(iterator.next().toResult()); } return results; } }
5eb7d8d5111ba9cb8f3ff24cb3e1df72ea5bd538
700586b47dc58dffdabaafb2d3b61201fe6b76df
/app/src/main/java/com/aabhishekpatel/jj/Adapter/BuildAdapter.java
8facc1a7db3251cc89b9ea77bd0e78f33a3cf2da
[]
no_license
aabhishek-patel/Jj
303739f2f7e58c6a3ebf195c313b9fd9e6d98b9a
2a4a5f0dd781d31df195e0f4853f35a6db2932f5
refs/heads/master
2023-04-28T03:46:57.233226
2021-05-12T19:08:26
2021-05-12T19:08:26
366,826,101
0
0
null
null
null
null
UTF-8
Java
false
false
5,196
java
package com.aabhishekpatel.jj.Adapter; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.aabhishekpatel.jj.Model.BuildModel; import com.aabhishekpatel.jj.Model.LandModel; import com.aabhishekpatel.jj.R; import com.denzcoskun.imageslider.ImageSlider; import com.denzcoskun.imageslider.constants.ScaleTypes; import com.denzcoskun.imageslider.models.SlideModel; import com.google.android.material.snackbar.Snackbar; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.List; public class BuildAdapter extends RecyclerView.Adapter<BuildAdapter.ImageViewHolder>{ public Context mcontext; public List<BuildModel> buildModels; private FirebaseUser firebaseUser; public BuildAdapter(Context mcontext , List<BuildModel> buildModels){ this.mcontext = mcontext; this.buildModels = buildModels; } @NonNull @Override public BuildAdapter.ImageViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(mcontext).inflate(R.layout.buildproduct,viewGroup, false); return new BuildAdapter.ImageViewHolder(view); } /*------------------------------- ImageViewHolder -------------------------------*/ @Override public void onBindViewHolder(@NonNull BuildAdapter.ImageViewHolder imageViewHolder, int i) { firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); final BuildModel buildModel = buildModels.get(i); imageViewHolder.build_name.setText(buildModels.get(i).getBuildname()); imageViewHolder.build_rate.setText(buildModels.get(i).getBuildprice()); final List<SlideModel> adsimages = new ArrayList<>(); adsimages.add(new SlideModel(buildModels.get(i).getBuildimage1(), ScaleTypes.FIT)); adsimages.add(new SlideModel(buildModels.get(i).getBuildimage2(), ScaleTypes.FIT)); adsimages.add(new SlideModel(buildModels.get(i).getBuildimage3(), ScaleTypes.FIT)); adsimages.add(new SlideModel(buildModels.get(i).getBuildimage4(), ScaleTypes.FIT)); imageViewHolder.build_image.setImageList(adsimages, ScaleTypes.FIT); imageViewHolder.build_call.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String call = buildModel.getBuildphone().toString(); if (call.isEmpty()){ Toast.makeText(mcontext, "Due to some network issue please try again...", Toast.LENGTH_SHORT).show(); } else { String s = "tel:" + call; Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(s)); mcontext.startActivity(intent); } } }); imageViewHolder.build_share.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = buildModel.getBuildname().toString().toUpperCase() +"\n\n" + buildModel.getBuildprice().toString() //+"\n" + buildModel.getBuildid() +"\n\n " + "https://play.google.com/store/apps/details?id=" + mcontext.getPackageCodePath(); String shareSub = "Try Now JJ"; sharingIntent.putExtra(Intent.EXTRA_SUBJECT, shareSub); sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody); mcontext.startActivity(Intent.createChooser(sharingIntent, "Share By Using")); } }); } /*------------------------------- buildModels.size -------------------------------*/ @Override public int getItemCount() { return buildModels.size(); } /*------------------------------- Hooks -------------------------------*/ public class ImageViewHolder extends RecyclerView.ViewHolder { ImageSlider build_image; TextView build_name; TextView build_rate; Button build_call; Button build_share; public ImageViewHolder(@NonNull View itemView) { super(itemView); build_image = (ImageSlider) itemView.findViewById(R.id.build_image); build_name = (TextView) itemView.findViewById(R.id.build_name); build_rate = (TextView) itemView.findViewById(R.id.build_rate); build_call = (Button) itemView.findViewById(R.id.build_call); build_share = (Button) itemView.findViewById(R.id.build_share); } } }
e0333e30dedb41571955a5154969392bda0df4e4
ec5d1ad8418dd62039e1dd8d6d2129ed3d7504de
/factory/java/INotify.java
f0fc50aaf714f9b5db05609a728a326a11c21df4
[]
no_license
yusufyilmazfr/tasarim-desenleri-turkce-kaynak
88feba7369fd4f2609f9dfe27d314f87a5214a7b
f666e998247d683a9f734f8c8802ab38c7da6915
refs/heads/master
2023-09-01T11:29:07.908507
2023-07-31T07:08:29
2023-07-31T07:08:29
244,465,123
3,298
448
null
2023-08-20T10:37:03
2020-03-02T20:10:59
HTML
UTF-8
Java
false
false
85
java
package Factory; public interface INotify { void sendNotification(User user); }
057e0c8f0735a197fe6e3e07200c96ce9fbd1ad1
b24818a948152b06c7d85ac442e9b37cb6becbbc
/src/main/java/com/ash/experiments/performance/whitespace/Class4338.java
3dbbafe985d65d68aed2e85b11ce6823518c2199
[]
no_license
ajorpheus/whitespace-perf-test
d0797b6aa3eea1435eaa1032612f0874537c58b8
d2b695aa09c6066fbba0aceb230fa4e308670b32
refs/heads/master
2020-04-17T23:38:39.420657
2014-06-02T09:27:17
2014-06-02T09:27:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
41
java
public class Class4338 {}
ee80fde6e93240cf9ee55fba80ab3222651df626
59e4596f07b00a69feabb1fb119619aa58964dd4
/StsTool.v.1.3.3/eu.aniketos.wp1.ststool.diagram/src/eu/aniketos/wp1/ststool/diagram/parsers/MessageFormatParser.java
f30c24aaa7d3844d82df246b7d976e4c3f325ebe
[]
no_license
AniketosEU/Socio-technical-Security-Requirements
895bac6785af1a40cb55afa9cb3dd73f83f8011f
7ce04c023af6c3e77fa4741734da7edac103c875
refs/heads/master
2018-12-31T17:08:39.594985
2014-02-21T14:36:14
2014-02-21T14:36:14
15,801,803
1
1
null
null
null
null
UTF-8
Java
false
false
6,733
java
/* * MessageFormatParser.java * * This file is part of the STS-Tool project. * Copyright (c) 2011-2012 "University of Trento - DISI" All rights reserved. * * Is strictly forbidden to remove this copyright notice from this source code. * * Disclaimer of Warranty: * STS-Tool (this software) is provided "as-is" and without warranty of any kind, * express, implied or otherwise, including without limitation, any warranty of * merchantability or fitness for a particular purpose. * In no event shall the copyright holder or contributors be liable for any direct, * indirect, incidental, special, exemplary, or consequential damages * including, but not limited to, procurement of substitute goods or services; * loss of use, data, or profits; or business interruption) however caused and on * any theory of liability, whether in contract, strict liability, or tort (including * negligence or otherwise) arising in any way out of the use of this software, even * if advised of the possibility of such damage. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3 * as published by the Free Software Foundation with the addition of the * following permission added to Section 15 as permitted in Section 7(a): * FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY * "University of Trento - DISI","University of Trento - DISI" DISCLAIMS THE * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * See the GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public License * along with this program; if not, see http://www.gnu.org/licenses or write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA, 02110-1301 USA, or download the license from the following URL: * http://www.sts-tool.eu/License.php * * For more information, please contact STS-Tool group at this * address: [email protected] * */ package eu.aniketos.wp1.ststool.diagram.parsers; import java.text.FieldPosition; import java.text.MessageFormat; import java.text.ParsePosition; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.osgi.util.NLS; import eu.aniketos.wp1.ststool.diagram.part.Messages; import eu.aniketos.wp1.ststool.diagram.part.StsToolDiagramEditorPlugin; /** * @generated */ public class MessageFormatParser extends AbstractParser { /** * @generated */ private String defaultPattern; /** * @generated */ private String defaultEditablePattern; /** * @generated */ private MessageFormat viewProcessor; /** * @generated */ private MessageFormat editorProcessor; /** * @generated */ private MessageFormat editProcessor; /** * @generated */ public MessageFormatParser(EAttribute[] features) { super(features); } /** * @generated */ public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) { super(features, editableFeatures); } /** * @generated */ protected String getDefaultPattern(){ if (defaultPattern == null) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < features.length; i++) { if (i > 0) { sb.append(' '); } sb.append('{'); sb.append(i); sb.append('}'); } defaultPattern = sb.toString(); } return defaultPattern; } /** * @generated */ @Override public void setViewPattern(String viewPattern){ super.setViewPattern(viewPattern); viewProcessor = null; } /** * @generated */ @Override public void setEditorPattern(String editorPattern){ super.setEditorPattern(editorPattern); editorProcessor = null; } /** * @generated */ protected MessageFormat getViewProcessor(){ if (viewProcessor == null) { viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern()); } return viewProcessor; } /** * @generated */ protected MessageFormat getEditorProcessor(){ if (editorProcessor == null) { editorProcessor = new MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern()); } return editorProcessor; } /** * @generated */ protected String getDefaultEditablePattern(){ if (defaultEditablePattern == null) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < editableFeatures.length; i++) { if (i > 0) { sb.append(' '); } sb.append('{'); sb.append(i); sb.append('}'); } defaultEditablePattern = sb.toString(); } return defaultEditablePattern; } /** * @generated */ @Override public void setEditPattern(String editPattern){ super.setEditPattern(editPattern); editProcessor = null; } /** * @generated */ protected MessageFormat getEditProcessor(){ if (editProcessor == null) { editProcessor = new MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern()); } return editProcessor; } /** * @generated */ public String getEditString(IAdaptable adapter,int flags){ EObject element = (EObject) adapter.getAdapter(EObject.class); return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } /** * @generated */ public IParserEditStatus isValidEditString(IAdaptable adapter,String editString){ ParsePosition pos = new ParsePosition(0); Object[] values = getEditProcessor().parse(editString, pos); if (values == null) { return new ParserEditStatus(StsToolDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex()))); } return validateNewValues(values); } /** * @generated */ public ICommand getParseCommand(IAdaptable adapter,String newString,int flags){ Object[] values = getEditProcessor().parse(newString, new ParsePosition(0)); return getParseCommand(adapter, values, flags); } /** * @generated */ public String getPrintString(IAdaptable adapter,int flags){ EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } }
9936beba6be70f049acd86f02b4c95c8b490a359
08be78ee28957fe393bea727228fbe13e5c00df1
/modules/configcenter/modules/configcenter-manage/src/main/java/com/configcenter/service/OperateRecordService.java
6fd25d0529fac66bf264c5103df86ac876e88d6d
[]
no_license
javachengwc/java-apply
432259eadfca88c6f3f2b80aae8e1e8a93df5159
98a45c716f18657f0e4181d0c125a73feb402b16
refs/heads/master
2023-08-22T12:30:05.708710
2023-08-15T08:21:15
2023-08-15T08:21:15
54,971,501
10
4
null
2022-12-16T11:03:56
2016-03-29T11:50:21
Java
UTF-8
Java
false
false
913
java
package com.configcenter.service; import com.configcenter.dao.global.OperateRecordDao; import com.configcenter.model.OperateRecord; import com.configcenter.vo.CommonQueryVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * 操作记录服务类 */ @Service public class OperateRecordService { @Autowired private OperateRecordDao operateRecordDao; public OperateRecordDao getDao() { return operateRecordDao; } public int countAll() { return getDao().countAll(); } public int add(OperateRecord t) { return getDao().add(t); } public List<OperateRecord> queryList(CommonQueryVo queryVo) { return getDao().queryList(queryVo); } public int count(CommonQueryVo queryVo) { return getDao().count(queryVo); } }
a5daccf315c02b2827cea89b7ebbcf3971253ef3
2ee773cbdc216c9165029632eb36fedd8de36ca5
/app/src/main/java/com/qualcomm/robotcore/hardware/configuration/ModernRoboticsMotorControllerParamsState.java
48b2352f0a0c04797425d3fbdb0b0550eae96f18
[]
no_license
Killian-Townsend/Custom-FTC-Driver-Station-2021
6bee582afdb032ad2921b394280a2321f0f815ec
16e8999d7593ef2c4189902bf2d376db8a3a6b41
refs/heads/master
2023-03-28T04:48:30.704409
2021-03-19T01:09:18
2021-03-19T01:09:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,588
java
package com.qualcomm.robotcore.hardware.configuration; import com.google.gson.annotations.Expose; import com.qualcomm.robotcore.util.TypeConversion; import java.io.Serializable; import org.firstinspires.ftc.robotcore.internal.system.Assert; public class ModernRoboticsMotorControllerParamsState implements Serializable, Cloneable { @Expose public int d = 0; @Expose public int i = 0; @Expose public int p = 0; @Expose public int ratio = 0; public ModernRoboticsMotorControllerParamsState() { Assert.assertTrue(isDefault()); } public ModernRoboticsMotorControllerParamsState(ModernRoboticsMotorControllerParams paramModernRoboticsMotorControllerParams) { this.ratio = paramModernRoboticsMotorControllerParams.ratio(); this.p = paramModernRoboticsMotorControllerParams.P(); this.i = paramModernRoboticsMotorControllerParams.I(); this.d = paramModernRoboticsMotorControllerParams.D(); } public static ModernRoboticsMotorControllerParamsState fromByteArray(byte[] paramArrayOfbyte) { ModernRoboticsMotorControllerParamsState modernRoboticsMotorControllerParamsState = new ModernRoboticsMotorControllerParamsState(); modernRoboticsMotorControllerParamsState.ratio = TypeConversion.unsignedByteToInt(paramArrayOfbyte[0]); modernRoboticsMotorControllerParamsState.p = TypeConversion.unsignedByteToInt(paramArrayOfbyte[1]); modernRoboticsMotorControllerParamsState.i = TypeConversion.unsignedByteToInt(paramArrayOfbyte[2]); modernRoboticsMotorControllerParamsState.d = TypeConversion.unsignedByteToInt(paramArrayOfbyte[3]); return modernRoboticsMotorControllerParamsState; } public ModernRoboticsMotorControllerParamsState clone() { try { return (ModernRoboticsMotorControllerParamsState)super.clone(); } catch (CloneNotSupportedException cloneNotSupportedException) { throw new RuntimeException("internal error: Parameters not cloneable"); } } public boolean equals(Object paramObject) { boolean bool = paramObject instanceof ModernRoboticsMotorControllerParamsState; boolean bool2 = false; boolean bool1 = bool2; if (bool) { paramObject = paramObject; bool1 = bool2; if (this.ratio == ((ModernRoboticsMotorControllerParamsState)paramObject).ratio) { bool1 = bool2; if (this.p == ((ModernRoboticsMotorControllerParamsState)paramObject).p) { bool1 = bool2; if (this.i == ((ModernRoboticsMotorControllerParamsState)paramObject).i) { bool1 = bool2; if (this.d == ((ModernRoboticsMotorControllerParamsState)paramObject).d) bool1 = true; } } } } return bool1; } public int hashCode() { return this.ratio ^ this.p << 3 ^ this.i << 6 ^ this.d << 9 ^ 0xFAD11234; } public boolean isDefault() { return (this.ratio == 0 && this.p == 0 && this.i == 0 && this.d == 0); } public byte[] toByteArray() { return new byte[] { (byte)this.ratio, (byte)this.p, (byte)this.i, (byte)this.d }; } public String toString() { return String.format("ratio=%d,p=%d,i=%d,d=%d", new Object[] { Integer.valueOf(this.ratio), Integer.valueOf(this.p), Integer.valueOf(this.i), Integer.valueOf(this.d) }); } } /* Location: C:\Users\Student\Desktop\APK Decompiling\com.qualcomm.ftcdriverstation_38_apps.evozi.com\classes-dex2jar.jar!\com\qualcomm\robotcore\hardware\configuration\ModernRoboticsMotorControllerParamsState.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
0dd13b6aa81490ffdac10d00f90721787d9dc058
c35324570b856b60b34424ac785199b1cb313c79
/scre-service/src/main/java/edu/hfu/scre/dao/base/BaseDao.java
019d8935ef9b7dceec9c52f7bcb92f1a4ace758a
[]
no_license
wintersweetgao/scre
0d3cf5a276335c4916a37c2ab43b0cd3d9a8cf5e
789298a6294e07b3cc5eb9f3579e76f74438f786
refs/heads/master
2023-01-10T06:52:16.243318
2020-11-11T00:00:04
2020-11-11T00:00:04
310,468,210
0
0
null
null
null
null
UTF-8
Java
false
false
41,814
java
package edu.hfu.scre.dao.base; import java.io.Serializable; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import org.hibernate.Filter; import org.hibernate.LockOptions; import org.hibernate.ReplicationMode; import org.hibernate.Session; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.type.Type; public interface BaseDao { public Session getSession() ; /** * Return the persistent instance of the given entity class with the given * identifier, or {@code null} if not found. * <p> * This method is a thin wrapper around * {@link org.hibernate.Session#get(Class, java.io.Serializable)} for * convenience. For an explanation of the exact semantics of this method, * please do refer to the Hibernate API documentation in the first instance. * * @param entityClass * a persistent class * @param id * the identifier of the persistent instance * @return the persistent instance, or {@code null} if not found * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#get(Class, java.io.Serializable) */ public <T> T get(Class<T> entityClass, Serializable id) throws Exception; /** * Return the persistent instance of the given entity class with the given * identifier, or {@code null} if not found. * <p> * Obtains the specified lock mode if the instance exists. * <p> * This method is a thin wrapper around * {@link org.hibernate.Session#get(Class, java.io.Serializable, LockOptions)} * for convenience. For an explanation of the exact semantics of this * method, please do refer to the Hibernate API documentation in the first * instance. * * @param entityClass * a persistent class * @param id * the identifier of the persistent instance * @param lockMode * the lock mode to obtain * @return the persistent instance, or {@code null} if not found * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#get(Class, java.io.Serializable, * org.hibernate.LockOptions) */ public <T> T get(Class<T> entityClass, Serializable id, LockOptions lockMode) throws Exception; /** * Return the persistent instance of the given entity class with the given * identifier, or {@code null} if not found. * <p> * This method is a thin wrapper around * {@link org.hibernate.Session#get(String, java.io.Serializable)} for * convenience. For an explanation of the exact semantics of this method, * please do refer to the Hibernate API documentation in the first instance. * * @param entityName * the name of the persistent entity * @param id * the identifier of the persistent instance * @return the persistent instance, or {@code null} if not found * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#get(Class, java.io.Serializable) */ public Object get(String entityName, Serializable id) throws Exception; /** * Return the persistent instance of the given entity class with the given * identifier, or {@code null} if not found. Obtains the specified lock mode * if the instance exists. * <p> * This method is a thin wrapper around * {@link org.hibernate.Session#get(String, java.io.Serializable, LockOptions)} * for convenience. For an explanation of the exact semantics of this * method, please do refer to the Hibernate API documentation in the first * instance. * * @param entityName * the name of the persistent entity * @param id * the identifier of the persistent instance * @param lockMode * the lock mode to obtain * @return the persistent instance, or {@code null} if not found * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#get(Class, java.io.Serializable, * org.hibernate.LockOptions) */ public Object get(String entityName, Serializable id, LockOptions lockOptions) throws Exception; /** * Return the persistent instance of the given entity class with the given * identifier, throwing an exception if not found. * <p> * This method is a thin wrapper around * {@link org.hibernate.Session#load(Class, java.io.Serializable)} for * convenience. For an explanation of the exact semantics of this method, * please do refer to the Hibernate API documentation in the first instance. * * @param entityClass * a persistent class * @param id * the identifier of the persistent instance * @return the persistent instance * @throws org.springframework.orm.ObjectRetrievalFailureException * if not found * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#load(Class, java.io.Serializable) */ public <T> T load(Class<T> entityClass, Serializable id) throws Exception; /** * Return the persistent instance of the given entity class with the given * identifier, throwing an exception if not found. Obtains the specified * lock mode if the instance exists. * <p> * This method is a thin wrapper around * {@link org.hibernate.Session#load(Class, java.io.Serializable, LockOptions)} * for convenience. For an explanation of the exact semantics of this * method, please do refer to the Hibernate API documentation in the first * instance. * * @param entityClass * a persistent class * @param id * the identifier of the persistent instance * @param lockMode * the lock mode to obtain * @return the persistent instance * @throws org.springframework.orm.ObjectRetrievalFailureException * if not found * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#load(Class, java.io.Serializable) */ public <T> T load(Class<T> entityClass, Serializable id, LockOptions lockOptions) throws Exception; /** * Return the persistent instance of the given entity class with the given * identifier, throwing an exception if not found. * <p> * This method is a thin wrapper around * {@link org.hibernate.Session#load(String, java.io.Serializable)} for * convenience. For an explanation of the exact semantics of this method, * please do refer to the Hibernate API documentation in the first instance. * * @param entityName * the name of the persistent entity * @param id * the identifier of the persistent instance * @return the persistent instance * @throws org.springframework.orm.ObjectRetrievalFailureException * if not found * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#load(Class, java.io.Serializable) */ public Object load(String entityName, Serializable id) throws Exception; /** * Return the persistent instance of the given entity class with the given * identifier, throwing an exception if not found. * <p> * Obtains the specified lock mode if the instance exists. * <p> * This method is a thin wrapper around * {@link org.hibernate.Session#load(String, java.io.Serializable, LockOptions)} * for convenience. For an explanation of the exact semantics of this * method, please do refer to the Hibernate API documentation in the first * instance. * * @param entityName * the name of the persistent entity * @param id * the identifier of the persistent instance * @param lockMode * the lock mode to obtain * @return the persistent instance * @throws org.springframework.orm.ObjectRetrievalFailureException * if not found * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#load(Class, java.io.Serializable) */ public Object load(String entityName, Serializable id, LockOptions lockOptions) throws Exception; /** * Return all persistent instances of the given entity class. Note: Use * queries or criteria for retrieving a specific subset. * * @param entityClass * a persistent class * @return a {@link List} containing 0 or more persistent instances * @throws org.springframework.dao.Exception * if there is a Hibernate error * @see org.hibernate.Session#createCriteria */ public <T> List<T> loadAll(Class<T> entityClass) throws Exception; /** * Load the persistent instance with the given identifier into the given * object, throwing an exception if not found. * <p> * This method is a thin wrapper around * {@link org.hibernate.Session#load(Object, java.io.Serializable)} for * convenience. For an explanation of the exact semantics of this method, * please do refer to the Hibernate API documentation in the first instance. * * @param entity * the object (of the target class) to load into * @param id * the identifier of the persistent instance * @throws org.springframework.orm.ObjectRetrievalFailureException * if not found * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#load(Object, java.io.Serializable) */ public void load(Object entity, Serializable id) throws Exception; /** * Re-read the state of the given persistent instance. * * @param entity * the persistent instance to re-read * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#refresh(Object) */ public void refresh(Object entity) throws Exception; /** * Re-read the state of the given persistent instance. Obtains the specified * lock mode for the instance. * * @param entity * the persistent instance to re-read * @param lockMode * the lock mode to obtain * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#refresh(Object, org.hibernate.LockOptions) */ public void refresh(Object entity, LockOptions lockOptions) throws Exception; /** * Check whether the given object is in the Session cache. * * @param entity * the persistence instance to check * @return whether the given object is in the Session cache * @throws org.springframework.dao.Exception * if there is a Hibernate error * @see org.hibernate.Session#contains */ public boolean contains(Object entity) throws Exception; /** * Remove the given object from the {@link org.hibernate.Session} cache. * * @param entity * the persistent instance to evict * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#evict */ public void evict(Object entity) throws Exception; /** * Force initialization of a Hibernate proxy or persistent collection. * * @param proxy * a proxy for a persistent object or a persistent collection * @throws Exception * if we can't initialize the proxy, for example because it is * not associated with an active Session * @see org.hibernate.Hibernate#initialize */ public void initialize(Object proxy) throws Exception; /** * Return an enabled Hibernate {@link Filter} for the given filter name. The * returned {@code Filter} instance can be used to set filter parameters. * * @param filterName * the name of the filter * @return the enabled Hibernate {@code Filter} (either already enabled or * enabled on the fly by this operation) * @throws IllegalStateException * if we are not running within a transactional Session (in * which case this operation does not make sense) */ public Filter enableFilter(String filterName) throws IllegalStateException; // ------------------------------------------------------------------------- // Convenience methods for storing individual objects // ------------------------------------------------------------------------- /** * Persist the given transient instance. * * @param entity * the transient instance to persist * @return the generated identifier * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#save(Object) * merge() �? * * 1.如果对象的idertifier(以下�?称为id)为空或在数据库不存在,则进行inert动作(此时如果对象的id有�?�也 将被hibernate自动生成的ID覆盖�? * 2.如果id存在,则进行update动作 * * replicate() �? * * Persist the state of the given detached instance, reusing the current identifier value * * 使用背景�? * * 假设你的对象的ID是用hibernate 负责生成的,但现在你想在数据库中插入�?条已经指定ID的记录, * * 如果你用save() 不会报异常,但它会生成一条由hibernate生成的ID 的记�? * * 如果你用merge() 跟用save �?�? * * 如果用saveOrUpdate 如果数据库中不存在你指定的ID 则不会发生操作,如果存在,则会修改数据库的记录,而不是重新生成一条新记录 * * 如果用persist() 会报异常�? * * 哈哈 �?后只剩下 replicate() 方法�? * * rereplicate()会完成你心愿�? * * 注意�? 此时 ID 的生成策�? �? uuid.hex �? oracle10g �? sql2000 上都经过测试�? * * 别的生成策略在不同数据库上可能有问题,尤其像 native �? 由数据库管理生成ID �? * * 示例代码�? * * MyObject myobj = new MyObject(); * myobj.setId("encodinglife") * myobj.setOtherData("foobar"); * hsession.replicate(myobj, ReplicationMode.EXCEPTION); */ public <T> Serializable save(T t) throws Exception; /** * Persist the given transient instance. * * @param entityName * the name of the persistent entity * @param entity * the transient instance to persist * @return the generated identifier * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#save(String, Object) */ public <T> Serializable save(String entityName, T t) throws Exception; /** * Update the given persistent instance, associating it with the current * Hibernate {@link org.hibernate.Session}. * * @param entity * the persistent instance to update * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#update(Object) */ public <T> void update(T t) throws Exception; /** * Update the given persistent instance, associating it with the current * Hibernate {@link org.hibernate.Session}. * * @param entityName * the name of the persistent entity * @param entity * the persistent instance to update * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#update(String, Object) */ public <T> void update(String entityName, T t) throws Exception; /** * Save or update the given persistent instance, according to its id * (matching the configured "unsaved-value"?). Associates the instance with * the current Hibernate {@link org.hibernate.Session}. * * @param entity * the persistent instance to save or update (to be associated * with the Hibernate {@code Session}) * @throws Exception * in case of Hibernate errors * @see org.hibernate.Session#saveOrUpdate(Object) */ public <T> void saveOrUpdate(T t) throws Exception; /** * Save or update the given persistent instance, according to its id * (matching the configured "unsaved-value"?). Associates the instance with * the current Hibernate {@code Session}. * * @param entityName * the name of the persistent entity * @param entity * the persistent instance to save or update (to be associated * with the Hibernate {@code Session}) * @throws Exception * in case of Hibernate errors * @see org.hibernate.Session#saveOrUpdate(String, Object) */ public <T> void saveOrUpdate(String entityName, T t) throws Exception; /** * Persist the state of the given detached instance according to the given * replication mode, reusing the current identifier value. * * @param entity * the persistent object to replicate * @param replicationMode * the Hibernate ReplicationMode * @throws Exception * in case of Hibernate errors * @see org.hibernate.Session#replicate(Object, * org.hibernate.ReplicationMode) */ public <T> void replicate(T t, ReplicationMode replicationMode) throws Exception; /** * Persist the state of the given detached instance according to the given * replication mode, reusing the current identifier value. * * @param entityName * the name of the persistent entity * @param entity * the persistent object to replicate * @param replicationMode * the Hibernate ReplicationMode * @throws Exception * in case of Hibernate errors * @see org.hibernate.Session#replicate(String, Object, * org.hibernate.ReplicationMode) */ public <T> void replicate(String entityName, T t, ReplicationMode replicationMode) throws Exception; /** * Persist the given transient instance. Follows JSR-220 semantics. * <p> * Similar to {@code save}, associating the given object with the current * Hibernate {@link org.hibernate.Session}. * * @param entity * the persistent instance to persist * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#persist(Object) * @see #save */ public <T> void persist(T t) throws Exception; /** * Persist the given transient instance. Follows JSR-220 semantics. * <p> * Similar to {@code save}, associating the given object with the current * Hibernate {@link org.hibernate.Session}. * * @param entityName * the name of the persistent entity * @param entity * the persistent instance to persist * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#persist(String, Object) * @see #save */ public <T> void persist(String entityName, T t) throws Exception; /** * Copy the state of the given object onto the persistent object with the * same identifier. Follows JSR-220 semantics. * <p> * Similar to {@code saveOrUpdate}, but never associates the given object * with the current Hibernate Session. In case of a new entity, the state * will be copied over as well. * <p> * Note that {@code merge} will <i>not</i> update the identifiers in the * passed-in object graph (in contrast to TopLink)! Consider registering * Spring's {@code IdTransferringMergeEventListener} if you would like to * have newly assigned ids transferred to the original object graph too. * * @param entity * the object to merge with the corresponding persistence * instance * @return the updated, registered persistent instance * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#merge(Object) * @see #saveOrUpdate * @see org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener */ public <T> T merge(T entity) throws Exception; /** * Copy the state of the given object onto the persistent object with the * same identifier. Follows JSR-220 semantics. * <p> * Similar to {@code saveOrUpdate}, but never associates the given object * with the current Hibernate {@link org.hibernate.Session}. In the case of * a new entity, the state will be copied over as well. * <p> * Note that {@code merge} will <i>not</i> update the identifiers in the * passed-in object graph (in contrast to TopLink)! Consider registering * Spring's {@code IdTransferringMergeEventListener} if you would like to * have newly assigned ids transferred to the original object graph too. * * @param entityName * the name of the persistent entity * @param entity * the object to merge with the corresponding persistence * instance * @return the updated, registered persistent instance * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#merge(String, Object) * @see #saveOrUpdate */ public <T> T merge(String entityName, T entity) throws Exception; /** * Delete the given persistent instance. * * @param entity * the persistent instance to delete * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#delete(Object) */ public <T> void delete(T entity) throws Exception; /** * Delete the given persistent instance. * * @param entityName * the name of the persistent entity * @param entity * the persistent instance to delete * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#delete(Object) */ public <T> void delete(String entityName, T entity) throws Exception; /** * Delete all given persistent instances. * <p> * This can be combined with any of the find methods to delete by query in * two lines of code. * * @param entities * the persistent instances to delete * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#delete(Object) */ public <T> void deleteAll(Collection<T> entities) throws Exception; /** * Flush all pending saves, updates and deletes to the database. * <p> * Only invoke this for selective eager flushing, for example when JDBC code * needs to see certain changes within the same transaction. Else, it is * preferable to rely on auto-flushing at transaction completion. * * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#flush */ public void flush() throws Exception; /** * Remove all objects from the {@link org.hibernate.Session} cache, and * cancel all pending saves, updates and deletes. * * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#clear */ public void clear() throws Exception; // ------------------------------------------------------------------------- // Convenience finder methods for HQL strings // ------------------------------------------------------------------------- /** * Execute an HQL query. * * @param queryString * a query expressed in Hibernate's query language * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#createQuery */ public <T> List<T> find(String hql) throws Exception; public List<Map<String,Object>> findMap(String hql) throws Exception; /** * Execute an HQL query, binding one value to a "?" parameter in the query * string. * * @param queryString * a query expressed in Hibernate's query language * @param value * the value of the parameter * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#createQuery */ public <T> List<T> find(String hql, Object value) throws Exception; public List<Map<String,Object>> findMap(String hql, Object value) throws Exception; /** * Execute an HQL query, binding a number of values to "?" parameters in the * query string. * * @param queryString * a query expressed in Hibernate's query language * @param values * the values of the parameters * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#createQuery */ public <T> List<T> find(String hql, Object... values)throws Exception; /** * Execute an HQL query, binding a number of values to ":param" parameters in the * query string. * @param hql * @param params map<bindparam,bindvalue> * @return * @throws Exception */ public <T> List<T> find(String hql, Map<String,Object> params)throws Exception; /** * Execute an HQL query, binding a number of values to "?" parameters in the * query string. * @param hql * @param values * @return * @throws Exception */ public List<Map<String,Object>> findMap(String hql, Object... values)throws Exception; /** * * @param hql * @param params * @return * @throws Exception */ public List<Map<String,Object>> findMap(String hql, Map<String,Object> params)throws Exception; /** * Execute an HQL query, binding one value to a ":" named parameter in the * query string. * * @param queryString * a query expressed in Hibernate's query language * @param paramName * the name of the parameter * @param value * the value of the parameter * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ public List<Object> findByNamedParam(String hql, String paramName, Object value) throws Exception; /** * Execute an HQL query, binding a number of values to ":" named parameters * in the query string. * * @param queryString * a query expressed in Hibernate's query language * @param paramNames * the names of the parameters * @param values * the values of the parameters * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ public List<Object> findByNamedParam(String hql, String[] paramNames, Object[] values) throws Exception; /** * Execute an HQL query, binding the properties of the given bean to * <i>named</i> parameters in the query string. * * @param queryString * a query expressed in Hibernate's query language * @param valueBean * the values of the parameters * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Query#setProperties * @see org.hibernate.Session#createQuery */ public List<Object> findByValueBean(String hql, Object valueBean) throws Exception; // ------------------------------------------------------------------------- // Convenience finder methods for named queries // ------------------------------------------------------------------------- /** * Execute a named query. * <p> * A named query is defined in a Hibernate mapping file. * * @param queryName * the name of a Hibernate query in a mapping file * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ public List<Object> findByNamedQuery(String queryName) throws Exception; /** * Execute a named query, binding one value to a "?" parameter in the query * string. * <p> * A named query is defined in a Hibernate mapping file. * * @param queryName * the name of a Hibernate query in a mapping file * @param value * the value of the parameter * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ public List<Object> findByNamedQuery(String queryName, Object value) throws Exception; /** * Execute a named query binding a number of values to "?" parameters in the * query string. * <p> * A named query is defined in a Hibernate mapping file. * * @param queryName * the name of a Hibernate query in a mapping file * @param values * the values of the parameters * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ public List<Object> findByNamedQuery(String queryName, Object... values) throws Exception; /** * Execute a named query, binding one value to a ":" named parameter in the * query string. * <p> * A named query is defined in a Hibernate mapping file. * * @param queryName * the name of a Hibernate query in a mapping file * @param paramName * the name of parameter * @param value * the value of the parameter * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ public List<Object> findByNamedQueryAndNamedParam(String queryName, String paramName, Object value) throws Exception; /** * Execute a named query, binding a number of values to ":" named parameters * in the query string. * <p> * A named query is defined in a Hibernate mapping file. * * @param queryName * the name of a Hibernate query in a mapping file * @param paramNames * the names of the parameters * @param values * the values of the parameters * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#getNamedQuery(String) */ public List<Object> findByNamedQueryAndNamedParam(String queryName, String[] paramNames, Object[] values) throws Exception; /** * Execute a named query, binding the properties of the given bean to ":" * named parameters in the query string. * <p> * A named query is defined in a Hibernate mapping file. * * @param queryName * the name of a Hibernate query in a mapping file * @param valueBean * the values of the parameters * @return a {@link List} containing the results of the query execution * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Query#setProperties * @see org.hibernate.Session#getNamedQuery(String) */ public List<Object> findByNamedQueryAndValueBean(String queryName, Object valueBean) throws Exception; // ------------------------------------------------------------------------- // Convenience finder methods for detached criteria // ------------------------------------------------------------------------- /** * Execute a query based on a given Hibernate criteria object. * * @param criteria * the detached Hibernate criteria object. <b>Note: Do not reuse * criteria objects! They need to recreated per execution, due to * the suboptimal design of Hibernate's criteria facility.</b> * @return a {@link List} containing 0 or more persistent instances * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.criterion.DetachedCriteria#getExecutableCriteria(org.hibernate.Session) */ public List<Object> findByCriteria(DetachedCriteria criteria) throws Exception; /** * Execute a query based on the given Hibernate criteria object. * * @param criteria * the detached Hibernate criteria object. <b>Note: Do not reuse * criteria objects! They need to recreated per execution, due to * the suboptimal design of Hibernate's criteria facility.</b> * @param pageNo * the index of the first result object to be retrieved (numbered * from 0) * @param maxResults * the maximum number of result objects to retrieve (or <=0 for * no limit) * @return a {@link List} containing 0 or more persistent instances * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.criterion.DetachedCriteria#getExecutableCriteria(org.hibernate.Session) * @see org.hibernate.Criteria#setpageNo(int) * @see org.hibernate.Criteria#setMaxResults(int) */ public List<Object> findByCriteria(DetachedCriteria criteria, int pageNo, int maxResults) throws Exception; // ------------------------------------------------------------------------- // Convenience query methods for iteration and bulk updates/deletes // ------------------------------------------------------------------------- /** * Execute a query for persistent instances. * <p> * Returns the results as an {@link Iterator}. Entities returned are * initialized on demand. See the Hibernate API documentation for details. * * @param queryString * a query expressed in Hibernate's query language * @return an {@link Iterator} containing 0 or more persistent instances * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#createQuery * @see org.hibernate.Query#iterate */ public Iterator<?> iterate(String hql) throws Exception; /** * Execute a query for persistent instances, binding one value to a "?" * parameter in the query string. * <p> * Returns the results as an {@link Iterator}. Entities returned are * initialized on demand. See the Hibernate API documentation for details. * * @param queryString * a query expressed in Hibernate's query language * @param value * the value of the parameter * @return an {@link Iterator} containing 0 or more persistent instances * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#createQuery * @see org.hibernate.Query#iterate */ public Iterator<?> iterate(String hql, Object value) throws Exception; /** * Execute a query for persistent instances, binding a number of values to * "?" parameters in the query string. * <p> * Returns the results as an {@link Iterator}. Entities returned are * initialized on demand. See the Hibernate API documentation for details. * * @param queryString * a query expressed in Hibernate's query language * @param values * the values of the parameters * @return an {@link Iterator} containing 0 or more persistent instances * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#createQuery * @see org.hibernate.Query#iterate */ public Iterator<?> iterate(String hql, Object... values) throws Exception; /** * Immediately close an {@link Iterator} created by any of the various * {@code iterate(..)} operations, instead of waiting until the session is * closed or disconnected. * * @param it * the {@code Iterator} to close * @throws Exception * if the {@code Iterator} could not be closed * @see org.hibernate.Hibernate#close */ public void closeIterator(Iterator<?> it) throws Exception; /** * Update/delete all objects according to the given query. * * @param queryString * an update/delete query expressed in Hibernate's query language * @return the number of instances updated/deleted * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#createQuery * @see org.hibernate.Query#executeUpdate */ public int bulkUpdate(String queryString) throws Exception; public int bulkSqlUpdate(String queryString) throws Exception; /** * Update/delete all objects according to the given query, binding one value * to a "?" parameter in the query string. * * @param queryString * an update/delete query expressed in Hibernate's query language * @param value * the value of the parameter * @return the number of instances updated/deleted * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#createQuery * @see org.hibernate.Query#executeUpdate */ public int bulkUpdate(String queryString, Object value) throws Exception; public int bulkSqlUpdate(String queryString, Object value) throws Exception; /** * Update/delete all objects according to the given query, binding a number * of values to "?" parameters in the query string. * * @param queryString * an update/delete query expressed in Hibernate's query language * @param values * the values of the parameters * @return the number of instances updated/deleted * @throws org.springframework.dao.Exception * in case of Hibernate errors * @see org.hibernate.Session#createQuery * @see org.hibernate.Query#executeUpdate */ public int bulkUpdate(String queryString, Object... values) throws Exception; public int bulkSqlUpdate(String queryString, Object... values) throws Exception; /* * 分页查询 * */ public <T> List<T> findByPage(final String hql, final int pageNo, final int maxResults) throws Exception; public <T> List<T> findByPage(final String hql, final Object param, final int pageNo, final int maxResults) throws Exception; public <T> List<T> findByPage(final String hql, final Object[] params, final int pageNo, final int maxResults) throws Exception; /** * 使用 :param 方式绑定 * @param hql * @param params * @param pageNo * @param maxResults * @return * @throws Exception */ public <T> List<T> findByPage(final String hql, final Map<String,Object> params, final int pageNo, final int maxResults) throws Exception; public List<Map<String,Object>> findByPageMap(final String hql, final int pageNo, final int maxResults) throws Exception; public List<Map<String,Object>> findByPageMap(final String hql, final Object param, final int pageNo, final int maxResults) throws Exception; public List<Map<String,Object>> findByPageMap(final String hql, final Object[] params, final int pageNo, final int maxResults) throws Exception; public List<Map<String,Object>> findByPageMap(final String hql, final Map<String,Object> params, final int pageNo, final int maxResults) throws Exception; //单实体bean 查询方法,目前仅支持�?单类型查询(String Integer �?,有需要自行添�? public <T>List<T> queryBean(T t)throws Exception; //单实体bean 查询方法,目前仅支持�?单类型查询(String Integer �?,有需要自行添�? public <T>List<T> queryBean(T t,int pageNo,int maxResults)throws Exception; /**根据实体bean 形成hql以及对应的参数列�? * Map<String,Object> key="hql"-->查询语句 * key="param"-->参数列表 格式为java.util.List<String> **/ public <T>Map<String,Object> beanToHql(T t); public int queryBeanCountByHql(final String hql, final Object[] params) throws Exception; public <T> int queryBeanCount(T t)throws Exception; //原生sql语句查询 /** * 使用数据库方�?查询 * @param sql * @param params * @return * @throws Exception */ public List<Map<String,Object>> findBySQL(String sql,final Object[] params)throws Exception; /** * 使用数据库方�?查询 * * @param sql select 语句 */ public List<Map<String,Object>> findBySQL(String sql)throws Exception; /** * 使用数据库方�?查询 * * @param sql select 语句 * @param colNameANDdataType sql输出列的名字和数据库类型 */ public List<Map<String,Object>> findBySQL(String sql,Map<String,Type> colNameANDdataType)throws Exception; /** * 使用数据库方�?查询 * * @param sql select 语句 * @param params 查询条件的参�? * @param colNameANDdataType sql输出列的名字和数据库类型 */ public List<Map<String,Object>> findBySQL(String sql,final Object[] params,Map<String,Type> colNameANDdataType)throws Exception; //原生sql语句查询 分页 public List<Map<String,Object>> findBySQL(String sql,final int pageNo, final int maxResults)throws Exception; //原生sql语句查询 分页 public List<Map<String,Object>> findBySQL(String sql,Map<String,Type> colNameANDdataType,final int pageNo, final int maxResults)throws Exception; //原生sql语句查询,参数 分页 public List<Map<String,Object>> findBySQL(String sql,final Object[] params,Map<String,Type> colNameANDdataType,final int pageNo, final int maxResults)throws Exception; }
36ee22d21e335089f1cc6447baad3f23037c865f
6f3deac491bb10ab304bef83a3e99ea146b23eac
/src/secao14GenericSet/ExercicioFixacaoMap.java
9501cbb890122177ad9d71fa20eb5449711e6919
[]
no_license
ma-th-eus/revisao-java
96228bcbc7dd4e1ee4eaea1942bc530d9b724869
7f7179c768ea31f49994ecdae787a4dc16f26be3
refs/heads/master
2020-06-13T17:06:28.030736
2019-08-08T19:59:06
2019-08-08T19:59:06
194,725,280
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
package secao14GenericSet; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class ExercicioFixacaoMap { public static void main(String[] args) { String path = "/home/matheus/temp/in.txt"; Scanner sc = new Scanner(System.in); Map<String, Integer> candidatos = new HashMap<>(); try(BufferedReader br = new BufferedReader(new FileReader(path))){ String line; while(br.ready()) { line = br.readLine(); String[] fields = line.split(","); int previousCount = 0; if(candidatos.containsKey(fields[0])) previousCount = candidatos.get(fields[0]); candidatos.put(fields[0], previousCount + Integer.parseInt(fields[1])); } } catch(IOException e) { System.out.println("Error: " + e.getMessage()); } for(String key : candidatos.keySet()) { System.out.println(key + ": " + candidatos.get(key)); } } }
cfb83a54ff7787f55549152bf5741673093a4d42
fd8d27d5da91b5c22ae8091625d157b9bb017cd5
/vijay-selenium/src/testNG/TC_03Test.java
844f69c5c85173d5a797cd5f2c3f9619c498aec9
[]
no_license
tarawadevijay/TestNG_selenium
201233fd9716018f4b93003a9ad1d5b93007ae70
be3f417ad1675c5c7530d47199124a20f2708982
refs/heads/master
2023-06-10T13:13:30.974096
2021-06-25T11:55:24
2021-06-25T11:55:24
380,221,893
0
0
null
null
null
null
UTF-8
Java
false
false
430
java
package testNG; import org.testng.Reporter; import org.testng.annotations.Test; public class TC_03Test { @Test(invocationCount=5,priority=1) public void PlaceTheCursorOnMoreDropDownMenu() { //test case Reporter.log("PlaceTheCursorOnMoreDropDownMenu",true); } @Test(priority=2) public void PlaceTheCursor() { //test case Reporter.log("PlaceTheCursor",true); } }
[ "SOHAM@SOHAM-PC" ]
SOHAM@SOHAM-PC
8005f6cc54f792eac333d9e7c4ed23374bfaf615
1455f48f30a3b5378fadf148b5cb23058b852c99
/hframe-webgenerator/src/main/java/com/hframework/generator/web/container/bean/Enum.java
b00c3968ac75381430a05c93eb0af0c7f898b5bc
[]
no_license
luchao0111/hframework
764d02d40e6b3ffbc77c5604eb03aaee2b52758c
1ab0ebd8bd75c2aa305b55232fa96e7ac4cb85c4
refs/heads/master
2023-01-30T01:05:16.638719
2019-06-27T06:38:20
2019-06-27T06:38:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,289
java
package com.hframework.generator.web.container.bean; import com.hframework.common.util.BeanUtils; import java.math.BigDecimal; import java.util.Date; public class Enum { private Long hfmdEnumId; private String hfmdEnumValue; private String hfmdEnumText; private String hfmdEnumDesc; private Integer isDefault; private BigDecimal pri; private String ext1; private String ext2; private Long hfmdEnumClassId; private String hfmdEnumClassCode; private Long hfpmProgramId; private Long opId; private Date createTime; private Long modifyOpId; private Date modifyTime; private Integer delFlag; public Enum(Long hfmdEnumId, String hfmdEnumValue, String hfmdEnumText, String hfmdEnumDesc, Integer isDefault, BigDecimal pri, String ext1, String ext2, Long hfmdEnumClassId, String hfmdEnumClassCode, Long hfpmProgramId, Long opId, Date createTime, Long modifyOpId, Date modifyTime, Integer delFlag) { this.hfmdEnumId = hfmdEnumId; this.hfmdEnumValue = hfmdEnumValue; this.hfmdEnumText = hfmdEnumText; this.hfmdEnumDesc = hfmdEnumDesc; this.isDefault = isDefault; this.pri = pri; this.ext1 = ext1; this.ext2 = ext2; this.hfmdEnumClassId = hfmdEnumClassId; this.hfmdEnumClassCode = hfmdEnumClassCode; this.hfpmProgramId = hfpmProgramId; this.opId = opId; this.createTime = createTime; this.modifyOpId = modifyOpId; this.modifyTime = modifyTime; this.delFlag = delFlag; } public Long getHfmdEnumId() { return hfmdEnumId; } public String getHfmdEnumValue() { return hfmdEnumValue; } public String getHfmdEnumText() { return hfmdEnumText; } public String getHfmdEnumDesc() { return hfmdEnumDesc; } public Integer getIsDefault() { return isDefault; } public BigDecimal getPri() { return pri; } public String getExt1() { return ext1; } public String getExt2() { return ext2; } public Long getHfmdEnumClassId() { return hfmdEnumClassId; } public String getHfmdEnumClassCode() { return hfmdEnumClassCode; } public Long getHfpmProgramId() { return hfpmProgramId; } public Long getOpId() { return opId; } public Date getCreateTime() { return createTime; } public Long getModifyOpId() { return modifyOpId; } public Date getModifyTime() { return modifyTime; } public Integer getDelFlag() { return delFlag; } public void setHfmdEnumId(Long hfmdEnumId) { this.hfmdEnumId=hfmdEnumId; } public void setHfmdEnumValue(String hfmdEnumValue) { this.hfmdEnumValue=hfmdEnumValue; } public void setHfmdEnumText(String hfmdEnumText) { this.hfmdEnumText=hfmdEnumText; } public void setHfmdEnumDesc(String hfmdEnumDesc) { this.hfmdEnumDesc=hfmdEnumDesc; } public void setIsDefault(Integer isDefault) { this.isDefault=isDefault; } public void setPri(BigDecimal pri) { this.pri=pri; } public void setExt1(String ext1) { this.ext1=ext1; } public void setExt2(String ext2) { this.ext2=ext2; } public void setHfmdEnumClassId(Long hfmdEnumClassId) { this.hfmdEnumClassId=hfmdEnumClassId; } public void setHfmdEnumClassCode(String hfmdEnumClassCode) { this.hfmdEnumClassCode=hfmdEnumClassCode; } public void setHfpmProgramId(Long hfpmProgramId) { this.hfpmProgramId=hfpmProgramId; } public void setOpId(Long opId) { this.opId=opId; } public void setCreateTime(Date createTime) { this.createTime=createTime; } public void setModifyOpId(Long modifyOpId) { this.modifyOpId=modifyOpId; } public void setModifyTime(Date modifyTime) { this.modifyTime=modifyTime; } public void setDelFlag(Integer delFlag) { this.delFlag=delFlag; } public Enum() { super(); } public Object getAs(Class tClass) { return BeanUtils.convertObject(tClass, this); } }
d0070e0cd65573de4326e1b0b4de57ca50bb080a
1ed0e7930d6027aa893e1ecd4c5bba79484b7c95
/gacha/source/java/com/vungle/publisher/cw.java
49c5d220413a28381c4927c73d427962ad113a61
[]
no_license
AnKoushinist/hikaru-bottakuri-slot
36f1821e355a76865057a81221ce2c6f873f04e5
7ed60c6d53086243002785538076478c82616802
refs/heads/master
2021-01-20T05:47:00.966573
2017-08-26T06:58:25
2017-08-26T06:58:25
101,468,394
0
1
null
null
null
null
UTF-8
Java
false
false
1,146
java
package com.vungle.publisher; import com.vungle.publisher.cs.a; import dagger.MembersInjector; import javax.inject.Provider; /* compiled from: vungle */ public final class cw implements MembersInjector<cs> { static final /* synthetic */ boolean a = (!cw.class.desiredAssertionStatus()); private final Provider<cf> b; private final Provider<a> c; public final /* synthetic */ void injectMembers(Object obj) { cs csVar = (cs) obj; if (csVar == null) { throw new NullPointerException("Cannot inject members into a null reference"); } csVar.u = (cf) this.b.get(); csVar.d = (a) this.c.get(); } private cw(Provider<cf> provider, Provider<a> provider2) { if (a || provider != null) { this.b = provider; if (a || provider2 != null) { this.c = provider2; return; } throw new AssertionError(); } throw new AssertionError(); } public static MembersInjector<cs> a(Provider<cf> provider, Provider<a> provider2) { return new cw(provider, provider2); } }
5d401d11a89acb82e8fbbb9cfa7e0f4273b01d87
06e470ef0051566d7fa2dcb5f3a4be5d7d6a07ba
/rekola/src/main/java/cz/rekola/app/core/bus/dataAvailable/BikeIssuesAvailableEvent.java
cf06a25b14be356f8f2119b3c37e67bceb785f7e
[]
no_license
Krystofee/mobile-android
e5e46d585c1b45a1ab7b3a1c81a0ca3a02639258
833a90fade72a0ad619d2e7d84596065c0c73674
refs/heads/master
2020-09-07T02:16:00.331591
2015-11-25T18:00:42
2015-11-25T18:00:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
package cz.rekola.app.core.bus.dataAvailable; /** * Created by Tomas Krabac[[email protected]] on {30. 6. 2015} **/ public class BikeIssuesAvailableEvent { }
8db1ce1167f0ad23ce4911e77d497d23137e9b5a
e4b2b535b6f1e0c54f2f1424d6303db336512532
/app/src/main/java/com/exalpme/bozhilun/android/rxandroid/CommonSubscriber.java
9ea21ce454d398c5f8b82d85a1457d4dc546d82b
[ "Apache-2.0" ]
permissive
axdx1314/RaceFitPro
56a7a4cefefc56373b94eb383d130f1bd4f7c6d9
6778c6c4fb11ba8697a64c6ddde8bfe95dbbb505
refs/heads/master
2020-03-17T08:29:10.096792
2018-05-23T02:08:23
2018-05-23T02:08:23
133,440,315
0
1
null
null
null
null
UTF-8
Java
false
false
1,833
java
package com.exalpme.bozhilun.android.rxandroid; import android.content.Context; import com.exalpme.bozhilun.android.w30s.utils.httputils.CustumListener; import java.net.ConnectException; import java.net.SocketTimeoutException; import rx.Subscriber; /** * Created by thinkpad on 2016/6/22. */ public class CommonSubscriber<T> extends Subscriber<T> { private SubscriberOnNextListener mSubscriberOnNextListener; private Context context; private CustumListener custumListener; public void setCustumListener(CustumListener custumListener) { this.custumListener = custumListener; } public CommonSubscriber(SubscriberOnNextListener mSubscriberOnNextListener, Context context) { this.mSubscriberOnNextListener = mSubscriberOnNextListener; this.context=context; } @Override public void onCompleted() { //Toast.makeText(context, "Get Completed", Toast.LENGTH_SHORT).show(); if(custumListener != null){ custumListener.onCompleted(); } } @Override public void onError(Throwable e) { if(custumListener != null){ custumListener.onError(e); } if (e instanceof SocketTimeoutException) { // Toast.makeText(context, MyApp.getApplication().getResources().getString(R.string.wangluo), Toast.LENGTH_SHORT).show(); } else if (e instanceof ConnectException) { // Toast.makeText(context,MyApp.getApplication().getResources().getString(R.string.wangluo), Toast.LENGTH_SHORT).show(); } else { //Toast.makeText(context, "error:" + e.getMessage(), Toast.LENGTH_SHORT).show(); } } @Override public void onNext(T t) { if (mSubscriberOnNextListener != null) { mSubscriberOnNextListener.onNext(t); } } }
567919b7d16e0c97b2432270c6858ff840ad118a
bfe6840544dbf59aaa62a376f9ec1f32ef7ae243
/src/DoOperations.java
d2063e849a252e12ceb013d7d47992c9acb5567e
[]
no_license
ham123123/ok-but-actually-tho-final-calc
208576b7b148ac2cda0f1d99a4afe59c46869f05
3c05a75df8f1f810d7f9621f79539d1ba7cfbd61
refs/heads/master
2021-01-01T16:16:27.062846
2017-07-30T12:25:47
2017-07-30T12:25:47
97,804,517
0
0
null
null
null
null
UTF-8
Java
false
false
6,554
java
import javax.swing.JTextField; public class DoOperations { int count; double num; JTextField result; int operation; public DoOperations(double nm, int cnt, JTextField rst, int op) { num = nm; count = cnt; result = rst; operation = op; } public void doStoredOperationAndFindResult() { String text = result.getText(); if (storedOperationIsAddition()) { // if equation was addition add(text); operation = 0; } else if (storedOperationIsSubtraction()) { // if equation was subtraction subtract(text); operation = 0; } else if (storedOperationIsDivision()) { // if equation was division divide(text); operation = 0; } else if (storedOperationIsMultiplication()) { // if equation was multiplication multiply(text); operation = 0; // reset at value of equals } count = 0; } public void doStoredOperationIfAnyThenMultiply() { String text = result.getText(); if (storedOperationIsAddition()) { // if earlier stored button was addition add(text); operation = 4; } else if (storedOperationIsSubtraction()) { // if earlier stored button was subtraction subtract(text); operation = 4; } else if (storedOperationIsDivision()) { // if earlier stored button was division divide(text); operation = 4; // reset value of multiplication to store for next button } else if (storedOperationIsEquality()) { // if earlier stored button was equals count = 0; // reset values after using the equals button multiply(text); } else { multiply(text); // if there is repetitive multiplication } } /* This method performs the earlier stored equation, * then stores a new division equation */ public void doStoredOperationIfAnyThenDivide() { String text = result.getText(); if (storedOperationIsAddition()) { add(text); operation = 3; } else if (storedOperationIsSubtraction()) { subtract(text); operation = 3; } else if (storedOperationIsMultiplication()) { // if earlier stored button was multiplication multiply(text); operation = 3; } else if (storedOperationIsEquality()) { count = 0; divide(text); } else { // if there is repetitive division divide(text); } } /* This method performs the earlier stored equation, * then stores a new subtraction equation */ public void doStoredOperationIfAnyThenSubtract() { String text = result.getText(); if (storedOperationIsAddition()) { add(text); operation = 2; } else if (storedOperationIsDivision()) { divide(text); operation = 2; } else if (storedOperationIsMultiplication()) { multiply(text); operation = 2; } else if (storedOperationIsEquality()) { count = 0; subtract(text); } else { // if there is repetitive subtraction subtract(text); } } /* This method performs the earlier stored equation, * then stores a new addition equation */ public void doStoredOperationIfAnyThenAdd() { String text = result.getText(); if (storedOperationIsSubtraction()) { subtract(text); operation = 1; } else if (storedOperationIsDivision()) { divide(text); operation = 1; } else if (storedOperationIsMultiplication()) { multiply(text); operation = 1; } else if (storedOperationIsEquality()) { count = 0; add(text); } else { // if there is repetitive addition add(text); } } private void multiply(String text) { if (count == 0) { // to store the first number num = Double.parseDouble(text); count = 1; } else if (count != 0) { // to store second number and multiply double newNum = Double.parseDouble(text); num = num * newNum; result.setText("" + num); } operation = 4; // storing given multiplication value to perform function at next button } /* This method divides two consecutively inserted numbers * after the division button is clicked */ private void divide(String text) { if (count == 0) { num = Double.parseDouble(text); count = 1; } else if (count != 0) { // to store second number and multiply double newNum = Double.parseDouble(text); num = num / newNum; result.setText("" + num); } operation = 3; // storing given division value to perform function at next button } /* This method adds two consecutively inserted numbers after the addition * button is clicked */ private void add(String text) { if (count == 0) { num = Double.parseDouble(text); count = 1; } else if (count != 0) { // to store second number and add double newNum = Double.parseDouble(text); num = num + newNum; result.setText("" + num); } operation = 1; // storing given addition value to perform function at next button } /* This method subtracts two consecutively inserted numbers after the subtraction * button is clicked */ private void subtract(String text) { if (count == 0) { num = Double.parseDouble(text); count = 1; } else if (count != 0) { // to store second number and subtract double newNum = Double.parseDouble(text); num = num - newNum; result.setText("" + num); } operation = 2; // storing given subtraction value to perform function at next button } private boolean storedOperationIsMultiplication() { return operation == 4; } // This method returns whether the operation is division, presented by the value of 3 private boolean storedOperationIsDivision() { return operation == 3; } // This method returns whether the operation is subtraction, presented by the value of 2 private boolean storedOperationIsSubtraction() { return operation == 2; } // This method returns whether the operation is addition, presented by the value of 1 private boolean storedOperationIsAddition() { return operation == 1; } private boolean storedOperationIsEquality() { return operation == 0; } public int getOperation() { return operation; } public double getNum() { return num; } public int getCount() { return count; } public String getResultText() { return result.getText(); } }
9a634027d29077b7d691dc17349a2ee46a036fd4
6a89965c24f900a8516c30829d238beb360e1ad9
/exercicios-sb/src/main/java/br/alef/com/exerciciossb/controllers/ClienteController.java
2024feeb5c74a330a4cfc67c3c278e1016fbec04
[]
no_license
AlefApolinario/Exercises
5c9a21512d90087c49306b74676baabc8f884449
2e65c862005e9adb3abed54a7470a8cb9564c47f
refs/heads/main
2023-02-26T01:23:09.039831
2021-02-05T17:02:54
2021-02-05T17:02:54
327,767,246
0
0
null
null
null
null
UTF-8
Java
false
false
956
java
package br.alef.com.exerciciossb.controllers; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import br.alef.com.exerciciossb.model.entities.Cliente; @RestController @RequestMapping("/clientes") public class ClienteController { @GetMapping(path = "/qualquer") public Cliente obterCliente() { return new Cliente(10, "Alef", "123.456.789-00"); } @GetMapping("/{id}") public Cliente obterClientePorID1(@PathVariable Integer id) { return new Cliente(id, "Alef", "987.654.321-00"); } @GetMapping public Cliente obterClientePorID2( @RequestParam(name = "id",defaultValue = "1") Integer id) { return new Cliente(id, "Jessica", "987.654.321-00"); } }
605c7f581b2bb53d3ed357399196077ea9bc2b34
b8a5a13ec78dece56cffb0d036d84b4414c9d628
/build/generated/jax-wsCache/CompromissoWS/services/ExcluirCompromisso.java
861404663c0476823738bb63cf29fe7cc5829717
[]
no_license
gabrielkreusch/JPA_SOAP_CLIENT
2d5233ab020760aa3d38209961f39e3a445034f8
3b2a4ab8700fc85fe5dd73e6e02e537f97fc995d
refs/heads/main
2023-05-27T12:00:14.313557
2021-06-04T00:14:18
2021-06-04T00:14:18
373,671,556
0
0
null
null
null
null
UTF-8
Java
false
false
1,266
java
package services; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Classe Java de excluirCompromisso complex type. * * <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. * * <pre> * &lt;complexType name="excluirCompromisso"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="idcompromisso" type="{http://www.w3.org/2001/XMLSchema}long"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "excluirCompromisso", propOrder = { "idcompromisso" }) public class ExcluirCompromisso { protected long idcompromisso; /** * Obtém o valor da propriedade idcompromisso. * */ public long getIdcompromisso() { return idcompromisso; } /** * Define o valor da propriedade idcompromisso. * */ public void setIdcompromisso(long value) { this.idcompromisso = value; } }
9ee4996817373d0ab09e71c10c11674fbd19ed22
d61ce2bd5521a30add6cf90a4d74cf18b84ca532
/Batch05/src/selenium/Automation08_iFrame.java
dfe2c3236416a3c32675bfb1c592ba553f8adf4f
[]
no_license
wuikhan/jubilant-palm-tree
c8b360096dc25ca9455044f2bb6a084582536dbc
e299a6eb5061613c6b0ce77c81647375848ba421
refs/heads/main
2023-07-09T03:46:46.835908
2021-08-08T17:17:11
2021-08-08T17:17:11
394,022,914
0
0
null
null
null
null
UTF-8
Java
false
false
700
java
package selenium; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; public class Automation08_iFrame extends Utilities { public static void main(String[] args) throws Exception { openBrowser("chrome", "https://codegator.herokuapp.com/iframe.php"); // here //driver.switchTo().frame("frame1"); /* * WebElement frameOne = driver.findElement(By.xpath("//*[@id=\"frame1\"]")); * driver.switchTo().frame(frameOne); */ driver.switchTo().frame(0); driver.findElement(By.id("username")).sendKeys("Hello World"); driver.switchTo().defaultContent(); driver.switchTo().frame(1); driver.findElement(By.id("username")).sendKeys("Hello World 2"); } }
9a92b7d40ce0d69b0fbe496b4ff9e081dff70500
c1a702570ddbc4fd39b6706372913f3cc2b6e727
/src/main/java/fr/univbrest/dosi/controller/FormationController.java
6d2eac344a0232d45ee180d9998389f5e761b492
[]
no_license
BasmaElmlyh/SpringBoot_project
f0b5721454add99511a014d3bb5778ec5facba72
32e11868318e2f6a87ae4953f623916b656f2d51
refs/heads/master
2021-04-29T14:42:27.251296
2018-02-17T15:29:58
2018-02-17T15:29:58
121,781,539
0
0
null
null
null
null
UTF-8
Java
false
false
1,496
java
package fr.univbrest.dosi.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import fr.univbrest.dosi.bean.Formation; import fr.univbrest.dosi.business.FormationBusiness; @RestController //controller d'api rest de spring @RequestMapping("/formation") //c'est le controller de la ressouce /formation public class FormationController { private FormationBusiness business; @Autowired public FormationController(FormationBusiness business) { this.business=business; } @RequestMapping(method = RequestMethod.POST) //methode appeler quand on fair un poste sur la classe formationController public Formation creerformation(@RequestBody Formation formationACreer) { // return business.creerFormation(formationACreer); } @RequestMapping(method = RequestMethod.GET) public List<Formation> recupererToutesLesFormations(){ return business.recupererToutesLesFormations(); } @RequestMapping(method = RequestMethod.GET, value="/nom/{nom}") public List<Formation> recupererFormationAvecLeNom(@PathVariable String nom) { return business.rechercherFormationParNom(nom); } }
a6769fa00eca6b7f4278c5c35561d8a1fd12386b
2c508fb9d30da23d417574a96e03346c0a0fe915
/app/src/main/java/org/ocpsoft/redoculous/render/Renderer.java
1635bff806213ed863c83b4cd998a66c71a65341
[ "Apache-2.0" ]
permissive
fharms/redoculous
95305c773036b9a47a46b1c75f844e80b31efad3
49c4061028096d9f435be4069582fba3b7465779
refs/heads/master
2021-01-16T22:33:46.978584
2013-12-31T02:00:11
2013-12-31T02:00:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package org.ocpsoft.redoculous.render; import java.io.InputStream; import java.io.OutputStream; public interface Renderer { Iterable<String> getSupportedExtensions(); String getName(); void render(RenderRequest request, InputStream source, OutputStream output); }
f703017ead0817336aa6f08727d9832889fb63aa
10bd3041965b6b6d5b119fa5d2d0d4de532e33ad
/src/com/company/StudentDao.java
fe03aee89aed087a6691cfbf4abfd34eebd45ded
[]
no_license
aakash-jadhav/Student-Management-System
333f29231b3c4b45945bbb5c2f6ab998292844b9
a51eb3b2eda4c8a40386a541c7b4cc1edb21806f
refs/heads/master
2023-02-25T04:34:03.072211
2021-02-04T14:44:35
2021-02-04T14:44:35
335,984,360
0
0
null
null
null
null
UTF-8
Java
false
false
2,160
java
package com.company; import java.sql.*; import static java.sql.DriverManager.*; public class StudentDao { Connection con = null; public void connect() throws Exception{ String url = "jdbc:mysql://localhost:3306/student"; String user = "root"; String password = "123456"; con = getConnection(url, user, password); } public void addStudent(Student student) throws SQLException { String query = " INSERT INTO students (name,age,department,year)\n" + "VALUES (?, ?, ?, ?);"; PreparedStatement pst = con.prepareStatement(query); pst.setString(1,student.getName()); pst.setInt(2,student.getAge()); pst.setString(3,student.getDepartment()); pst.setInt(4,student.getYear()); int count = pst.executeUpdate(); System.out.println(count + " number of rows affected"); pst.close(); con.close(); } public ResultSet getStudents() throws SQLException { String query = "SELECT * FROM students"; Statement statement = con.createStatement(); return statement.executeQuery(query); } public void updateStudent(Student student) throws SQLException { String query = "UPDATE students\n SET\n name= ?,\n age = ?,\n department = ?,\n year = ?\n WHERE id = ?;"; PreparedStatement pst = con.prepareStatement(query); pst.setString(1,student.getName()); pst.setInt(2,student.getAge()); pst.setString(3,student.getDepartment()); pst.setInt(4,student.getYear()); pst.setInt(5,student.getId()); int count = pst.executeUpdate(); System.out.println(count + " number of rows affected"); pst.close(); con.close(); } public void deleteStudent(int id) throws SQLException { String query = "DELETE FROM students WHERE id = ?;"; PreparedStatement statement = con.prepareStatement(query); statement.setInt(1,id); int count = statement.executeUpdate(); System.out.println(count + " number of rows affected"); statement.close(); con.close(); } }
b9feb8da2a9bc99b7c7b39e2a9721958897c4dde
095acac39f75c91ad5387d9ec1e2d9cec2923286
/src/test/java/io/github/xlair/decisiontable/parkingdiscount/rules/WatchTheMovieRule.java
917db7d6f9b10882db1b5eb3bf59900442c57912
[ "MIT" ]
permissive
xlair/simple-decisiontable
d6473260a5ddec09e4ecac82e1c7ccc129e323ec
32eeef87d626d3e2d7357c3f3cd833417018ee5a
refs/heads/master
2020-04-23T07:12:51.921048
2019-02-19T14:40:59
2019-02-19T14:40:59
170,999,686
0
1
null
null
null
null
UTF-8
Java
false
false
394
java
package io.github.xlair.decisiontable.parkingdiscount.rules; import io.github.xlair.decisiontable.Rule; import io.github.xlair.decisiontable.RuleInput; public class WatchTheMovieRule implements Rule<MovieRuleInput> { @Override public Object evaluate(RuleInput input) { MovieRuleInput movieRuleInput = getInput(input); return movieRuleInput.isWatchTheMovie(); } }
df45c598ffd1913500fb4fe7468d8a2410b77fb8
f1a3e2a230c8c56c32c6363702f66c75c6440e14
/androidApk/UIBestPractice/app/src/test/java/com/example/nb/uibestpractice/ExampleUnitTest.java
25263daec5e2d051ad24e15a091f87cd40759f8e
[]
no_license
nbiao/tests
b1a0e154806ac32138844216a060c87f67ef4ca2
1e73bbb66463ad0cb3f72f49da557a50114725b1
refs/heads/master
2020-04-03T08:45:13.198539
2018-11-22T09:15:05
2018-11-22T09:15:05
155,143,121
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.example.nb.uibestpractice; 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); } }
bf56b7ac521b28416ab09bbe2e7b7a1f72fe0017
8ba66e516ff93ddeb700993400bef3276af58215
/src/main/java/org/mwebz/datim/controllers/HomeController.java
d7d9184447ec2cdfbbccc6b300c2c09ce5dc81f9
[]
no_license
mmwebaze/datim-utilities
f8ea1167895c7fedb031d9e7c06f15807d61d803
6a7d44da212cf6e8c2033c59ed85dbf41558b15c
refs/heads/master
2021-01-10T06:05:42.499379
2015-10-20T06:32:22
2015-10-20T06:32:22
44,325,181
0
0
null
null
null
null
UTF-8
Java
false
false
780
java
package org.mwebz.datim.controllers; import javax.annotation.Resource; import org.mwebz.datim.configuration.DatimUtilityConfiguration; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class HomeController { @Resource DatimUtilityConfiguration datimUtilityConfiguration; @RequestMapping(value={"/", "/index", "home"}, method = RequestMethod.GET) public String defaultPage(Model model){ model.addAttribute("working_dir",datimUtilityConfiguration.getWorkingFolder()); model.addAttribute("base_url",datimUtilityConfiguration.getBaseUrl()); return "index"; } }
38c988866241d132b2f0963375ee06079eb356d4
ffd2dbb9fc25112c8e3ac88980d1c8874e100291
/src/main/java/cn/kkworld/futuresservice/cmsTrade/CThostFtdcBrokerUserPasswordField.java
5a5e876be1b211aa14bbd2d898a07afaa422f970
[]
no_license
Spring22/thrifttest
569f2442173a2317e7f61c198f0a9491cc31b2d8
e88888d3b51806a0d74edad8be0fb04b8733e95e
refs/heads/master
2020-06-15T12:26:59.543442
2016-12-01T13:16:59
2016-12-01T13:16:59
75,294,080
0
0
null
null
null
null
UTF-8
Java
false
true
18,595
java
/** * Autogenerated by Thrift Compiler (0.9.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package cn.kkworld.futuresservice.cmsTrade; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; import org.apache.thrift.scheme.TupleScheme; import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; import org.apache.thrift.async.AsyncMethodCallback; import org.apache.thrift.server.AbstractNonblockingServer.*; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class CThostFtdcBrokerUserPasswordField implements org.apache.thrift.TBase<CThostFtdcBrokerUserPasswordField, CThostFtdcBrokerUserPasswordField._Fields>, java.io.Serializable, Cloneable, Comparable<CThostFtdcBrokerUserPasswordField> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CThostFtdcBrokerUserPasswordField"); private static final org.apache.thrift.protocol.TField BROKER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("brokerID", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)3); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new CThostFtdcBrokerUserPasswordFieldStandardSchemeFactory()); schemes.put(TupleScheme.class, new CThostFtdcBrokerUserPasswordFieldTupleSchemeFactory()); } public String brokerID; // required public String userID; // required public String password; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { BROKER_ID((short)1, "brokerID"), USER_ID((short)2, "userID"), PASSWORD((short)3, "password"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // BROKER_ID return BROKER_ID; case 2: // USER_ID return USER_ID; case 3: // PASSWORD return PASSWORD; default: return null; } } /** * Find the _Fields constant that matches fieldId, throwing an exception * if it is not found. */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.BROKER_ID, new org.apache.thrift.meta_data.FieldMetaData("brokerID", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "TThostFtdcBrokerIDType"))); tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "TThostFtdcUserIDType"))); tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "TThostFtdcPasswordType"))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CThostFtdcBrokerUserPasswordField.class, metaDataMap); } public CThostFtdcBrokerUserPasswordField() { } public CThostFtdcBrokerUserPasswordField( String brokerID, String userID, String password) { this(); this.brokerID = brokerID; this.userID = userID; this.password = password; } /** * Performs a deep copy on <i>other</i>. */ public CThostFtdcBrokerUserPasswordField(CThostFtdcBrokerUserPasswordField other) { if (other.isSetBrokerID()) { this.brokerID = other.brokerID; } if (other.isSetUserID()) { this.userID = other.userID; } if (other.isSetPassword()) { this.password = other.password; } } public CThostFtdcBrokerUserPasswordField deepCopy() { return new CThostFtdcBrokerUserPasswordField(this); } @Override public void clear() { this.brokerID = null; this.userID = null; this.password = null; } public String getBrokerID() { return this.brokerID; } public CThostFtdcBrokerUserPasswordField setBrokerID(String brokerID) { this.brokerID = brokerID; return this; } public void unsetBrokerID() { this.brokerID = null; } /** Returns true if field brokerID is set (has been assigned a value) and false otherwise */ public boolean isSetBrokerID() { return this.brokerID != null; } public void setBrokerIDIsSet(boolean value) { if (!value) { this.brokerID = null; } } public String getUserID() { return this.userID; } public CThostFtdcBrokerUserPasswordField setUserID(String userID) { this.userID = userID; return this; } public void unsetUserID() { this.userID = null; } /** Returns true if field userID is set (has been assigned a value) and false otherwise */ public boolean isSetUserID() { return this.userID != null; } public void setUserIDIsSet(boolean value) { if (!value) { this.userID = null; } } public String getPassword() { return this.password; } public CThostFtdcBrokerUserPasswordField setPassword(String password) { this.password = password; return this; } public void unsetPassword() { this.password = null; } /** Returns true if field password is set (has been assigned a value) and false otherwise */ public boolean isSetPassword() { return this.password != null; } public void setPasswordIsSet(boolean value) { if (!value) { this.password = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case BROKER_ID: if (value == null) { unsetBrokerID(); } else { setBrokerID((String)value); } break; case USER_ID: if (value == null) { unsetUserID(); } else { setUserID((String)value); } break; case PASSWORD: if (value == null) { unsetPassword(); } else { setPassword((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case BROKER_ID: return getBrokerID(); case USER_ID: return getUserID(); case PASSWORD: return getPassword(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case BROKER_ID: return isSetBrokerID(); case USER_ID: return isSetUserID(); case PASSWORD: return isSetPassword(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof CThostFtdcBrokerUserPasswordField) return this.equals((CThostFtdcBrokerUserPasswordField)that); return false; } public boolean equals(CThostFtdcBrokerUserPasswordField that) { if (that == null) return false; boolean this_present_brokerID = true && this.isSetBrokerID(); boolean that_present_brokerID = true && that.isSetBrokerID(); if (this_present_brokerID || that_present_brokerID) { if (!(this_present_brokerID && that_present_brokerID)) return false; if (!this.brokerID.equals(that.brokerID)) return false; } boolean this_present_userID = true && this.isSetUserID(); boolean that_present_userID = true && that.isSetUserID(); if (this_present_userID || that_present_userID) { if (!(this_present_userID && that_present_userID)) return false; if (!this.userID.equals(that.userID)) return false; } boolean this_present_password = true && this.isSetPassword(); boolean that_present_password = true && that.isSetPassword(); if (this_present_password || that_present_password) { if (!(this_present_password && that_present_password)) return false; if (!this.password.equals(that.password)) return false; } return true; } @Override public int hashCode() { return 0; } @Override public int compareTo(CThostFtdcBrokerUserPasswordField other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetBrokerID()).compareTo(other.isSetBrokerID()); if (lastComparison != 0) { return lastComparison; } if (isSetBrokerID()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.brokerID, other.brokerID); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetUserID()).compareTo(other.isSetUserID()); if (lastComparison != 0) { return lastComparison; } if (isSetUserID()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userID, other.userID); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword()); if (lastComparison != 0) { return lastComparison; } if (isSetPassword()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("CThostFtdcBrokerUserPasswordField("); boolean first = true; sb.append("brokerID:"); if (this.brokerID == null) { sb.append("null"); } else { sb.append(this.brokerID); } first = false; if (!first) sb.append(", "); sb.append("userID:"); if (this.userID == null) { sb.append("null"); } else { sb.append(this.userID); } first = false; if (!first) sb.append(", "); sb.append("password:"); if (this.password == null) { sb.append("null"); } else { sb.append(this.password); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private static class CThostFtdcBrokerUserPasswordFieldStandardSchemeFactory implements SchemeFactory { public CThostFtdcBrokerUserPasswordFieldStandardScheme getScheme() { return new CThostFtdcBrokerUserPasswordFieldStandardScheme(); } } private static class CThostFtdcBrokerUserPasswordFieldStandardScheme extends StandardScheme<CThostFtdcBrokerUserPasswordField> { public void read(org.apache.thrift.protocol.TProtocol iprot, CThostFtdcBrokerUserPasswordField struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // BROKER_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.brokerID = iprot.readString(); struct.setBrokerIDIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // USER_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.userID = iprot.readString(); struct.setUserIDIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // PASSWORD if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.password = iprot.readString(); struct.setPasswordIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, CThostFtdcBrokerUserPasswordField struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.brokerID != null) { oprot.writeFieldBegin(BROKER_ID_FIELD_DESC); oprot.writeString(struct.brokerID); oprot.writeFieldEnd(); } if (struct.userID != null) { oprot.writeFieldBegin(USER_ID_FIELD_DESC); oprot.writeString(struct.userID); oprot.writeFieldEnd(); } if (struct.password != null) { oprot.writeFieldBegin(PASSWORD_FIELD_DESC); oprot.writeString(struct.password); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class CThostFtdcBrokerUserPasswordFieldTupleSchemeFactory implements SchemeFactory { public CThostFtdcBrokerUserPasswordFieldTupleScheme getScheme() { return new CThostFtdcBrokerUserPasswordFieldTupleScheme(); } } private static class CThostFtdcBrokerUserPasswordFieldTupleScheme extends TupleScheme<CThostFtdcBrokerUserPasswordField> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, CThostFtdcBrokerUserPasswordField struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetBrokerID()) { optionals.set(0); } if (struct.isSetUserID()) { optionals.set(1); } if (struct.isSetPassword()) { optionals.set(2); } oprot.writeBitSet(optionals, 3); if (struct.isSetBrokerID()) { oprot.writeString(struct.brokerID); } if (struct.isSetUserID()) { oprot.writeString(struct.userID); } if (struct.isSetPassword()) { oprot.writeString(struct.password); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, CThostFtdcBrokerUserPasswordField struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.brokerID = iprot.readString(); struct.setBrokerIDIsSet(true); } if (incoming.get(1)) { struct.userID = iprot.readString(); struct.setUserIDIsSet(true); } if (incoming.get(2)) { struct.password = iprot.readString(); struct.setPasswordIsSet(true); } } } }
14c595f2203006b355c17229b0df4e4389a7f17d
40c2ebc1871ae471da4a19eaddf6a9f7051916d1
/1/src/main/java/com/ejercicio1/persistence/ClienteDaoImpl.java
0aa4b232c5c163a15a7e11e98d87074532c0b536
[]
no_license
davidperezaviles99/Prueba
3614c9ffa54a3c5194c216f501e56f59c824fe15
c11f50f77e7aa1f52ce696b0af9e51ecd91c18e2
refs/heads/main
2023-08-25T02:31:17.713761
2021-10-06T23:06:10
2021-10-06T23:06:10
414,322,635
0
0
null
null
null
null
UTF-8
Java
false
false
2,226
java
package com.ejercicio1.persistence; import org.springframework.stereotype.Repository; import java.util.List; import javax.persistence.EntityManager; import org.hibernate.Session; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.ejercicio1.persistence.Cliente; @Repository public class ClienteDaoImpl implements ClienteDao { @Autowired private EntityManager entityManager; @Override @Transactional public void insert(Cliente newCliente) { Session currentSession = entityManager.unwrap(Session.class); currentSession.save(newCliente); currentSession.close(); } @Override @Transactional public void update(final Cliente updateCliente) { Session currentSession = entityManager.unwrap(Session.class); currentSession.saveOrUpdate(updateCliente); currentSession.close(); } @Override @Transactional public void delete(Cliente deleteCliente) { Session currentSession = entityManager.unwrap(Session.class); currentSession.delete(deleteCliente); currentSession.close(); } @Override @Transactional public Cliente searchById(final Long clienteId) { Session currentSession = entityManager.unwrap(Session.class); Cliente result = currentSession.get(Cliente.class, clienteId); currentSession.close(); return result; } @SuppressWarnings("unchecked") @Transactional @Override public List<Cliente> searchAll() { Session currentSession = entityManager.unwrap(Session.class); List<Cliente> list = currentSession.createQuery("FROM Cliente").list(); currentSession.close(); return list; } @SuppressWarnings("unchecked") @Override public List<Cliente> searchByCliente(String nombre, String apellido1, String apellido2) { Session currentSession = entityManager.unwrap(Session.class); final List<Cliente> listaCliente = currentSession .createQuery("FROM Cliente WHERE nombre='" + nombre + "' AND apellido1='" + apellido1 + "' AND apellido2='" + apellido2 + "'").list(); return listaCliente; } }
6ee52e32459c535606d8b7656b25754d44ac7fd3
fb55295e60b7e5f9c88cdf7e0d904d66a708ded8
/app/src/main/java/ru/inettel/ksork/lesson2/SearchFragment.java
351eb97ff1ac5a83886b8a669d8651e02a7c57a4
[]
no_license
ksork/Lesson2
c362aec9dc99e3da9354454fe987023f3ddfa2c7
a8a9be9f45dc98823c2ec0d02ef7d183040932ba
refs/heads/master
2021-04-30T07:35:23.564470
2018-02-14T06:48:23
2018-02-14T06:48:23
121,401,194
0
0
null
null
null
null
UTF-8
Java
false
false
1,585
java
package ru.inettel.ksork.lesson2; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; public class SearchFragment extends Fragment { private TextView mQuery; private Button mSearch; private SettingsHelper mSettings; public static Fragment newInstance(SettingsHelper settingsHelper) { SearchFragment instance = new SearchFragment(); instance.setSettings(settingsHelper); return instance; } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fr_search, container, false); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mQuery = view.findViewById(R.id.etQuery); mSearch = view.findViewById(R.id.btnSearch); mSearch.setOnClickListener(v -> search()); } private void search() { String url = mSettings.loadEngineUrl() + mQuery.getText(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); startActivity(intent); } private void setSettings(SettingsHelper settingsHelper) { mSettings = settingsHelper; } }
72fc4cfc91c8c1ca5b39251db3cb725bb5ef1fb7
e75313762e5db8c5f5ebd1f261e526e9da067135
/Training/BackEnd/Spring/springcore/src/main/java/com/capgemini/springcore/beans/MessageBean2.java
395389668d3558bfe6bd67c49c3bac24a04bad08
[]
no_license
poojasharma8/TY_CG_HTD_PuneMumbai_JFS_PoojaSharma
c41b0e33bbab58e9875c29333f242e187bab09aa
8f78e8efa109770e1fc71a21b4e6e47a5ad18acb
refs/heads/master
2023-01-11T13:07:47.511207
2019-12-09T05:31:46
2019-12-09T05:31:46
225,846,018
0
0
null
2023-01-07T23:07:20
2019-12-04T11:00:45
JavaScript
UTF-8
Java
false
false
443
java
package com.capgemini.springcore.beans; public class MessageBean2 { private String message; public MessageBean2() { System.out.println("It's a constructor"); } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public void init() { System.out.println("It's init phase..."); } public void destroy() { System.out.println("It's destroy phase"); } }
1a5d66e9ff75a868cf93421bb1078e33042704d2
a0680e15199adf203d0541027463746b7794bbb3
/src/main/java/ar/com/dgarcia/usercomm/users/Programmer.java
716a1b865c6709b61ebe868147b8b7006c897dbf
[]
no_license
rainer010/pdi
753969aff100387594430ab1761b42695531d210
96c032981d78360c88e7f3fd4900eef3cc6ce8bf
refs/heads/master
2021-01-18T04:02:01.707120
2017-03-22T02:06:09
2017-03-22T02:06:09
85,770,821
0
0
null
null
null
null
UTF-8
Java
false
false
1,304
java
/** * Created on 09/01/2007 22:19:56 * Copyright (C) 2007 Dario L. Garcia * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ package ar.com.dgarcia.usercomm.users; import ar.com.dgarcia.usercomm.msgs.ProgrammerMessage; /** * Esta interfaz representa al programador de la aplicacion, mediante * esta interfaz se podra comunicar con el. * * @version 1.0 * @since 09/01/2007 * @author D. Garcia */ public interface Programmer { /** * Arbitra los medios para que el programador humano reciba el mensaje indicado * @param message Mensaje a comunicar al programador */ void receive(ProgrammerMessage message); }
c8ef2d36a5b423421e29b30f7c36bb9926527dfd
4fdf8a2f8c96c70febf26278de1e1658617b12f7
/src/main/java/org/cyetstar/clover/entity/IdEntity.java
bc260e1f63678447e380ad8d7d7099febde15c8b
[]
no_license
cyetstar/clover
527edaeb2aaea506d6df75373267fd9d0b79a9b0
dbc63de7fc260ec11bb775f33ef285cf4ba1ccc0
refs/heads/master
2016-09-11T05:49:30.516719
2013-07-12T08:50:50
2013-07-12T08:50:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package org.cyetstar.clover.entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.MappedSuperclass; @MappedSuperclass public class IdEntity { protected Long id; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long getId() { return id; } public void setId(Long id) { this.id = id; } }
7cf408f59be7a1167730dea9fae87b291cf476a0
b6f370cf406408050ea70a439262a0a0fd3bb941
/src/inmobiliariadesarrollador1/Estancia.java
85d40265e66fae44c3b5e0051d05866854049354
[]
no_license
JavierAlegre/Inmobiliaria_TFG
693e04382a38d70580230854a704796559f0a4f0
5a64b2b225013355968ae2394125c1eb6cda0625
refs/heads/master
2022-11-10T19:34:09.384780
2020-06-21T10:08:13
2020-06-21T10:08:13
273,656,210
0
0
null
null
null
null
UTF-8
Java
false
false
637
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 inmobiliariadesarrollador1; /** * * @author Usuario */ public abstract class Estancia { private double metros; public Estancia(double metros) { this.metros = metros; } public double getMetros() { return metros; } public void setMetros(double metros) { this.metros = metros; } @Override public String toString() { return "Estancia{" + "metros=" + metros + '}'; } }
[ "Usuario@DESKTOP-A1V859V" ]
Usuario@DESKTOP-A1V859V
fa5e68c70416d3b0e904ef78535dda24ed98b29d
246f2be1162532f2efb1a477b4b88aadcfc81524
/results/jsoup/fee4762322f85a1109edd75ccb67f38cf5008c80/transformed/randoop_5/RegressionTest0.java
e650d50815444265e89a4e8a47595115dcadafb6
[]
no_license
semantic-conflicts/SemanticConflicts
4d2f05bf2e5fa289233429ed8f1614b0b14c2e5e
c5684bbde00dfbd27c828b5798edbec0e284597a
refs/heads/master
2022-12-05T03:11:57.983183
2020-08-25T13:54:24
2020-08-25T13:54:24
267,826,586
0
1
null
null
null
null
UTF-8
Java
false
false
37,134
java
import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class RegressionTest0 { public static boolean debug = false; @Test public void test01() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test01"); org.jsoup.Connection.Request request0 = null; java.io.OutputStream outputStream1 = null; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.Response.writePost(request0, outputStream1, ""); org.junit.Assert.fail("Expected exception of type java.lang.NullPointerException; message: null"); } catch (java.lang.NullPointerException e) { // Expected exception. } } @Test public void test02() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test02"); java.lang.String str1 = org.jsoup.helper.HttpConnection.encodeMimeName(""); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str1 + "' != '" + "" + "'", str1.equals("")); } @Test public void test03() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test03"); org.jsoup.helper.HttpConnection.MULTIPART_FORM_DATA = "hi!"; } @Test public void test04() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test04"); java.io.InputStream inputStream2 = null; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.KeyVal keyVal3 = org.jsoup.helper.HttpConnection.KeyVal.create("", "", inputStream2); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Data key must not be empty"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } } @Test public void test05() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test05"); javax.net.ssl.SSLSocketFactory sSLSocketFactory0 = null; org.jsoup.helper.HttpConnection.Response.sslSocketFactory = sSLSocketFactory0; } @Test public void test06() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test06"); org.jsoup.helper.HttpConnection.CONTENT_ENCODING = "hi!"; } @Test public void test07() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test07"); org.jsoup.helper.HttpConnection.CONTENT_TYPE = "hi!"; } @Test public void test08() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test08"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); org.jsoup.helper.HttpConnection.KeyVal keyVal2 = keyVal0.value(""); java.lang.Class<?> wildcardClass3 = keyVal2.getClass(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(keyVal2); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(wildcardClass3); } @Test public void test09() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test09"); org.jsoup.Connection.Request request0 = null; // The following exception was thrown during execution in test generation try { java.net.HttpURLConnection httpURLConnection1 = org.jsoup.helper.HttpConnection.Response.createConnection(request0); org.junit.Assert.fail("Expected exception of type java.lang.NullPointerException; message: null"); } catch (java.lang.NullPointerException e) { // Expected exception. } } @Test public void test10() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test10"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.io.InputStream inputStream1 = null; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.KeyVal keyVal2 = keyVal0.inputStream(inputStream1); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Data input stream must not be null"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } } @Test public void test11() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test11"); org.jsoup.helper.HttpConnection.Response.initUnSecureSSL(); } @Test public void test12() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test12"); org.jsoup.Connection.Request request0 = null; // The following exception was thrown during execution in test generation try { java.lang.String str1 = org.jsoup.helper.HttpConnection.Response.getRequestCookieString(request0); org.junit.Assert.fail("Expected exception of type java.lang.NullPointerException; message: null"); } catch (java.lang.NullPointerException e) { // Expected exception. } } @Test public void test13() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test13"); int int0 = org.jsoup.helper.HttpConnection.HTTP_TEMP_REDIR; // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + int0 + "' != '" + 307 + "'", int0 == 307); } @Test public void test14() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test14"); org.jsoup.Connection.Request request0 = null; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.Response.serialiseRequestUrl(request0); org.junit.Assert.fail("Expected exception of type java.lang.NullPointerException; message: null"); } catch (java.lang.NullPointerException e) { // Expected exception. } } @Test public void test15() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test15"); org.jsoup.helper.HttpConnection.CONTENT_ENCODING = ""; } @Test public void test16() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test16"); javax.net.ssl.HostnameVerifier hostnameVerifier0 = org.jsoup.helper.HttpConnection.Response.getInsecureVerifier(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(hostnameVerifier0); } @Test public void test17() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test17"); org.jsoup.Connection.Request request0 = null; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.Response response1 = org.jsoup.helper.HttpConnection.Response.execute(request0); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Request must not be null"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } } @Test public void test18() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test18"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.lang.String str1 = keyVal0.value; java.lang.String str2 = keyVal0.toString(); java.io.InputStream inputStream3 = null; keyVal0.stream = inputStream3; java.lang.Class<?> wildcardClass5 = keyVal0.getClass(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str1); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str2 + "' != '" + "null=null" + "'", str2.equals("null=null")); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(wildcardClass5); } @Test public void test19() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test19"); org.jsoup.helper.HttpConnection.CONTENT_TYPE = ""; } @Test public void test20() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test20"); org.jsoup.helper.HttpConnection.MULTIPART_FORM_DATA = ""; } @Test public void test21() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test21"); java.io.InputStream inputStream2 = null; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.KeyVal keyVal3 = org.jsoup.helper.HttpConnection.KeyVal.create("", "hi!", inputStream2); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Data key must not be empty"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } } @Test public void test22() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test22"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.lang.String str1 = keyVal0.value(); org.jsoup.helper.HttpConnection.KeyVal keyVal3 = keyVal0.value(""); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str1); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(keyVal3); } @Test public void test23() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test23"); // The following exception was thrown during execution in test generation try { org.jsoup.Connection connection1 = org.jsoup.helper.HttpConnection.connect("hi!"); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Malformed URL: hi!"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } } @Test public void test24() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test24"); org.jsoup.helper.HttpConnection.Response.MAX_REDIRECTS = (byte) 100; } @Test public void test25() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test25"); java.util.regex.Pattern pattern0 = org.jsoup.helper.HttpConnection.Response.xmlContentTypeRxp; org.jsoup.helper.HttpConnection.Response.xmlContentTypeRxp = pattern0; // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(pattern0); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertEquals(pattern0.toString(), "application/\\w+\\+xml.*"); } @Test public void test26() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test26"); org.jsoup.Connection.Request request0 = null; org.jsoup.helper.HttpConnection.Response response1 = null; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.Response response2 = org.jsoup.helper.HttpConnection.Response.execute(request0, response1); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Request must not be null"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } } @Test public void test27() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test27"); org.jsoup.Connection.Request request0 = null; java.io.OutputStream outputStream1 = null; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.Response.writePost(request0, outputStream1, "hi!"); org.junit.Assert.fail("Expected exception of type java.lang.NullPointerException; message: null"); } catch (java.lang.NullPointerException e) { // Expected exception. } } @Test public void test28() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test28"); org.jsoup.helper.HttpConnection.HTTP_TEMP_REDIR = (short) 10; } @Test public void test29() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test29"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.lang.String str1 = keyVal0.key(); java.lang.String str2 = keyVal0.toString(); boolean boolean3 = keyVal0.hasInputStream(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str1); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str2 + "' != '" + "null=null" + "'", str2.equals("null=null")); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + boolean3 + "' != '" + false + "'", boolean3 == false); } @Test public void test30() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test30"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.lang.String str1 = keyVal0.value; java.lang.String str2 = keyVal0.toString(); java.io.InputStream inputStream3 = null; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.KeyVal keyVal4 = keyVal0.inputStream(inputStream3); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Data input stream must not be null"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str1); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str2 + "' != '" + "null=null" + "'", str2.equals("null=null")); } @Test public void test31() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test31"); org.jsoup.helper.HttpConnection.CONTENT_TYPE = "null=null"; } @Test public void test32() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test32"); org.jsoup.helper.HttpConnection.MULTIPART_FORM_DATA = "null=null"; } @Test public void test33() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test33"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.lang.String str1 = keyVal0.value(); java.io.InputStream inputStream2 = keyVal0.stream; java.lang.String str3 = keyVal0.value; // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str1); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(inputStream2); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str3); } @Test public void test34() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test34"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); // The following exception was thrown during execution in test generation try { boolean boolean3 = response1.hasCookie(""); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Cookie name must not be empty"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } } @Test public void test35() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test35"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; java.lang.String str5 = response1.header(""); java.net.URL uRL6 = response1.url(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(uRL6); } @Test public void test36() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test36"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); org.jsoup.helper.HttpConnection.KeyVal keyVal2 = keyVal0.value(""); keyVal0.value = "null=null"; java.lang.String str5 = keyVal0.toString(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(keyVal2); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str5 + "' != '" + "null=null=null" + "'", str5.equals("null=null=null")); } @Test public void test37() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test37"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.lang.String str1 = keyVal0.toString(); org.jsoup.helper.HttpConnection.KeyVal keyVal3 = keyVal0.value("null=null"); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str1 + "' != '" + "null=null" + "'", str1.equals("null=null")); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(keyVal3); } @Test public void test38() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test38"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeHeader("null=null"); java.util.Map<java.lang.String, java.lang.String> strMap6 = response1.headers(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(strMap6); } @Test public void test39() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test39"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.lang.String str1 = keyVal0.value(); java.lang.String str2 = keyVal0.value; org.jsoup.helper.HttpConnection.KeyVal keyVal4 = keyVal0.value("null=null=null"); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str1); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str2); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(keyVal4); } @Test public void test40() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test40"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeCookie("null=null"); org.jsoup.Connection.Method method6 = response1.method(); org.jsoup.helper.HttpConnection.Response response7 = new org.jsoup.helper.HttpConnection.Response(response1); // The following exception was thrown during execution in test generation try { org.jsoup.Connection.Response response10 = response1.header("", "null=null=null"); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Header name must not be empty"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(method6); } @Test public void test41() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test41"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.lang.String str1 = keyVal0.toString(); // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.KeyVal keyVal3 = keyVal0.key(""); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Data key must not be empty"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str1 + "' != '" + "null=null" + "'", str1.equals("null=null")); } @Test public void test42() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test42"); org.jsoup.helper.HttpConnection.KeyVal keyVal0 = new org.jsoup.helper.HttpConnection.KeyVal(); java.lang.String str1 = keyVal0.value(); java.lang.String str2 = keyVal0.value; keyVal0.value = "null=null"; // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str1); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str2); } @Test public void test43() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test43"); java.io.InputStream inputStream2 = null; org.jsoup.helper.HttpConnection.KeyVal keyVal3 = org.jsoup.helper.HttpConnection.KeyVal.create("hi!", "null=null", inputStream2); java.lang.String str4 = keyVal3.value(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(keyVal3); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str4 + "' != '" + "null=null" + "'", str4.equals("null=null")); } @Test public void test44() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test44"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeCookie("null=null"); org.jsoup.Connection.Method method6 = response1.method(); org.jsoup.helper.HttpConnection.Response response7 = new org.jsoup.helper.HttpConnection.Response(response1); org.jsoup.Connection.Request request8 = response1.req; // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(method6); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(request8); } @Test public void test45() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test45"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeCookie("null=null"); org.jsoup.Connection.Method method6 = response1.method(); org.jsoup.Connection.Method method7 = response1.method(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(method6); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(method7); } @Test public void test46() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test46"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeHeader("null=null"); // The following exception was thrown during execution in test generation try { org.jsoup.nodes.Document document6 = response1.parse(); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Request must be executed (with .execute(), .get(), or .post() before parsing response"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); } @Test public void test47() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test47"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeCookie("null=null"); response1.charset = "null=null"; org.jsoup.Connection.Method method8 = response1.method(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(method8); } @Test public void test48() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test48"); org.jsoup.Connection.Request request0 = null; // The following exception was thrown during execution in test generation try { java.lang.String str1 = org.jsoup.helper.HttpConnection.Response.setupMultipartModeIfNeeded(request0); org.junit.Assert.fail("Expected exception of type java.lang.NullPointerException; message: null"); } catch (java.lang.NullPointerException e) { // Expected exception. } } @Test public void test49() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test49"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeCookie("null=null"); java.util.Map<java.lang.String, java.lang.String> strMap6 = response1.cookies(); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(strMap6); } @Test public void test50() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test50"); java.lang.String str0 = org.jsoup.helper.HttpConnection.CONTENT_ENCODING; // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str0 + "' != '" + "" + "'", str0.equals("")); } @Test public void test51() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test51"); org.jsoup.Connection.Request request0 = null; org.jsoup.helper.HttpConnection.Response response1 = null; org.jsoup.helper.HttpConnection.Response response2 = new org.jsoup.helper.HttpConnection.Response(response1); java.lang.String str4 = response2.cookie("null=null"); response2.numRedirects = (byte) 0; // The following exception was thrown during execution in test generation try { org.jsoup.helper.HttpConnection.Response response7 = org.jsoup.helper.HttpConnection.Response.execute(request0, response2); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Request must not be null"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str4); } @Test public void test52() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test52"); int int0 = org.jsoup.helper.HttpConnection.Response.MAX_REDIRECTS; // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + int0 + "' != '" + 100 + "'", int0 == 100); } @Test public void test53() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test53"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); java.lang.String str3 = response1.cookie("null=null"); int int4 = response1.numRedirects; org.jsoup.Connection.Request request5 = response1.req; org.jsoup.Connection.Response response7 = response1.removeCookie("null=null"); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(str3); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + int4 + "' != '" + 0 + "'", int4 == 0); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(request5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response7); } @Test public void test54() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test54"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeCookie("null=null"); response1.charset = "null=null"; org.jsoup.Connection.Request request8 = null; response1.req = request8; org.jsoup.Connection.Response response11 = response1.removeHeader("hi!"); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response11); } @Test public void test55() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test55"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeHeader("null=null"); // The following exception was thrown during execution in test generation try { org.jsoup.Connection.Response response7 = response1.removeHeader(""); org.junit.Assert.fail("Expected exception of type java.lang.IllegalArgumentException; message: Header name must not be empty"); } catch (java.lang.IllegalArgumentException e) { // Expected exception. } // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); } @Test public void test56() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test56"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeHeader("null=null"); org.jsoup.Connection.Method method6 = response1.method(); org.jsoup.Connection.Request request7 = response1.req; // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(method6); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNull(request7); } @Test public void test57() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test57"); java.lang.String str0 = org.jsoup.helper.HttpConnection.CONTENT_TYPE; // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertTrue("'" + str0 + "' != '" + "null=null" + "'", str0.equals("null=null")); } @Test public void test58() throws Throwable { if (debug) System.out.format("%n%s%n", "RegressionTest0.test58"); org.jsoup.helper.HttpConnection.Response response0 = null; org.jsoup.helper.HttpConnection.Response response1 = new org.jsoup.helper.HttpConnection.Response(response0); response1.executed = false; org.jsoup.Connection.Response response5 = response1.removeCookie("null=null"); response1.charset = "null=null=null"; org.jsoup.Connection.Response response10 = response1.cookie("hi!", "hi!"); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response5); // Regression assertion (captures the current behavior of the code) org.junit.Assert.assertNotNull(response10); } }
73a53ac845225c9f5f5bee07ddab3d0cb2a98c26
0374434509b04d37ba59f4a24a37fa912e3f0f73
/Part_7/ThreadA.java
78caa3d6e46123e2b3c77bda1d1cfb176bfc0836
[]
no_license
dongsubkim/java_intermediate
ed5b42f247ed5765cba5f9dc6c4ff4636fe4a764
93070b45062df83173ac7bb0791d6e77f397875a
refs/heads/main
2023-06-03T00:06:19.232651
2021-06-22T18:07:52
2021-06-22T18:07:52
379,256,766
0
0
null
null
null
null
UTF-8
Java
false
false
445
java
package Part_7; public class ThreadA { public static void main(String[] args) { ThreadB b = new ThreadB(); b.start(); synchronized (b) { try { System.out.println("Wait till b finishes."); b.wait(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Total is : " + b.total); } } }
ff38b0b243322acbb3f57f2e7f7d2697e806d321
32cb19633547f95cb950ef6dc3d5ce5cec07435d
/demo/src/com/pxy/tutor/chatroom/adapter/ChatRoomOnlinePeopleAdapter.java
b90759b1f4fa62109c0c4ffde85beee2483c8999
[]
no_license
xinyupu/tutorchat
6d001efd832ec1a7ad7957d2ffbd1bc4f806e34a
ee7c3a007d3744aa1a041ced83625b3f4891c2ee
refs/heads/master
2020-03-09T21:35:51.411214
2018-04-11T00:57:13
2018-04-11T00:57:13
129,012,810
0
0
null
null
null
null
UTF-8
Java
false
false
2,111
java
package com.pxy.tutor.chatroom.adapter; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.View; import android.widget.ImageView; import com.netease.nim.demo.R; import com.pxy.tutor.chatroom.widget.ChatRoomImageView; import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseQuickAdapter; import com.netease.nim.uikit.common.ui.recyclerview.holder.BaseViewHolder; import com.netease.nimlib.sdk.chatroom.constant.MemberType; import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember; import java.util.List; /** * 聊天室在线用户数据适配器 * Created by huangjun on 2016/12/29. */ public class ChatRoomOnlinePeopleAdapter extends BaseQuickAdapter<ChatRoomMember, BaseViewHolder> { public ChatRoomOnlinePeopleAdapter(RecyclerView recyclerView, List<ChatRoomMember> members) { super(recyclerView, R.layout.online_people_item, members); } @Override protected void convert(BaseViewHolder holder, ChatRoomMember member, int position, boolean isScrolling) { // bg selector holder.getConvertView().setBackgroundResource(com.netease.nim.uikit.R.drawable.nim_touch_bg); // identity image ImageView identityImage = holder.getView(R.id.identity_image); if (member.getMemberType() == MemberType.CREATOR) { identityImage.setVisibility(View.VISIBLE); identityImage.setImageDrawable(holder.getContext().getResources().getDrawable(R.drawable.nim_master_icon)); } else if (member.getMemberType() == MemberType.ADMIN) { identityImage.setVisibility(View.VISIBLE); identityImage.setImageDrawable(holder.getContext().getResources().getDrawable(R.drawable.nim_admin_icon)); } else { identityImage.setVisibility(View.GONE); } // head image ChatRoomImageView userHeadImage = holder.getView(R.id.user_head); userHeadImage.loadAvatarByUrl(member.getAvatar()); // user name holder.setText(R.id.user_name, TextUtils.isEmpty(member.getNick()) ? "" : member.getNick()); } }
f5cd266bf1e951764252cb38d56b2dd1a15cb579
855d6f82449609226a6943c03f3e13e20cb4a892
/src/main/java/com/demo/stc/service/CompanyServiceImpl.java
7d6fc997cc24c6cf6930dac5ef5f4c6ee867643d
[]
no_license
dhayav98/Mile-stone-1-stock-marketing-
2d6cf48c02d0298e0f1b4415ec07e671c2182ceb
ce75459d1a8d9e9fb6d575ca771297af7f7ddcda
refs/heads/master
2023-08-10T01:38:55.482395
2019-08-14T09:24:15
2019-08-14T09:24:15
201,042,757
0
0
null
2023-07-22T12:56:24
2019-08-07T12:08:17
Java
UTF-8
Java
false
false
1,000
java
package com.demo.stc.service; import java.sql.SQLException; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.demo.stc.dao.CompanyDao; import com.demo.stc.dao.CompanyDaoImpl; import com.demo.stc.model.Company; @Service public class CompanyServiceImpl implements CompanyService { @Autowired private CompanyDao companyDao; public Company insertCompany(Company company) throws SQLException, ClassNotFoundException { companyDao=new CompanyDaoImpl(); return companyDao.insertCompany(company); } public Company updateCompany(Company company) { // TODO Auto-generated method stub return null; } public List<Company> getCompanyList() throws SQLException { companyDao=new CompanyDaoImpl(); List<Company> list=null; try { list=companyDao.GetAllCompany(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; } }
22ebceb5fec2a34812975c1d7d955693c3618c03
68a4a5aa1a5bc9f5c0490f3f1965197448401ce2
/Handling_Dropdown/src/main/java/handling_Dropdown/BaseClass.java
f91fb39ff137392637baf850b731f140c1b0767f
[]
no_license
starnil007/Handling_Dropdown
5d15c584c97f267d96944f42e4e6dbfe40036b1f
f062c69804829ea8fc5c3562827815bdd8ec58f5
refs/heads/master
2023-04-22T02:58:43.949687
2021-05-18T22:15:53
2021-05-18T22:15:53
367,153,429
0
0
null
null
null
null
UTF-8
Java
false
false
1,601
java
package handling_Dropdown; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.Properties; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; public class BaseClass { public WebDriver driver; String URL; String WebdriverPath; String DriverType; public void readConfigFile() throws Exception{ Properties prop = new Properties(); InputStream input = new FileInputStream("C:\\Users\\Indranil Sarkar\\Revision1\\Handling_Dropdown\\Config.properties"); prop.load(input); URL = prop.getProperty("URL"); WebdriverPath = prop.getProperty("WebdriverPath"); DriverType = prop.getProperty("DriverType"); } @BeforeMethod public void setUp() throws Exception{ readConfigFile(); driver = new ChromeDriver(); System.setProperty("DriverType", WebdriverPath); driver.manage().window().maximize(); driver.manage().deleteAllCookies(); driver.get(URL); } @AfterMethod public void tearDown(){ driver.close(); } public static void Screenshot(WebDriver driver, String filename) throws Exception{ TakesScreenshot screen = (TakesScreenshot) driver; File source = screen.getScreenshotAs(OutputType.FILE); FileUtils.copyFile(source, new File("C:\\Users\\Indranil Sarkar\\Revision1\\Handling_Dropdown\\Screenshots\\"+filename+".png")); } }
[ "Indranil Sarkar@LAPTOP-7V5QHGUR" ]
Indranil Sarkar@LAPTOP-7V5QHGUR
25dfa5d9af4bb5139e8299d2f133d20661987a42
eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3
/tags/2012-05-19/seasar2-2.4.46/seasar2/s2-framework/src/test/java/org/seasar/framework/container/customizer/MetaCustomizerTest.java
176e08f847b1f36ad8edb0b2176652adc9d18db8
[ "Apache-2.0" ]
permissive
svn2github/s2container
54ca27cf0c1200a93e1cb88884eb8226a9be677d
625adc6c4e1396654a7297d00ec206c077a78696
refs/heads/master
2020-06-04T17:15:02.140847
2013-08-09T09:38:15
2013-08-09T09:38:15
10,850,644
0
1
null
null
null
null
UTF-8
Java
false
false
1,571
java
/* * Copyright 2004-2012 the Seasar Foundation and the Others. * * 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.seasar.framework.container.customizer; import org.seasar.framework.container.ComponentDef; import org.seasar.framework.container.MetaDef; import org.seasar.framework.container.S2Container; import org.seasar.framework.container.autoregister.Greeting; import org.seasar.framework.unit.S2FrameworkTestCase; /** * @author higa */ public class MetaCustomizerTest extends S2FrameworkTestCase { private S2Container child; public void setUp() throws Exception { include("MetaCustomizerTest.dicon"); } /** * @throws Exception */ public void testCustomize() throws Exception { ComponentDef cd = child.getComponentDef(Greeting.class); assertEquals(2, cd.getMetaDefSize()); MetaDef md = cd.getMetaDef(0); assertEquals("foo", md.getName()); md = cd.getMetaDef(1); assertEquals("bar", md.getName()); } }
[ "koichik@319488c0-e101-0410-93bc-b5e51f62721a" ]
koichik@319488c0-e101-0410-93bc-b5e51f62721a
4c34aa592a7c9841ec47f7194146be0dbcc95d21
06ecbefad5d426cea6fefc69617563f477be81d7
/src/main/java/com/myclass/convert/UserConvert.java
940516fa4da7dd0746febc42c508fc1faf7f221a
[]
no_license
Hai1820/shoppingcart
d1a1a59ee400df11c9fe839d4b92876ffb8ab148
9f7fbb8519ccfd56b58004c0b19db04dc02aa7bc
refs/heads/master
2023-03-28T08:09:47.768518
2021-03-30T09:05:35
2021-03-30T09:05:35
352,686,378
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
package com.myclass.convert; import com.myclass.dto.UserDto; import com.myclass.entity.User; import org.springframework.stereotype.Component; @Component public class UserConvert { public User toEntity(UserDto userDto){ User user = new User(); user.setFirstName(userDto.getFirstName()); user.setLastName(userDto.getLastName()); user.setEmail(userDto.getEmail()); user.setPassword(userDto.getPassword()); user.setProfile(userDto.getProfile()); user.setIntro(userDto.getIntro()); user.setMobile(userDto.getMobile()); user.setConfirmPassword(userDto.getConfirmPassword()); return user; } public UserDto toDto(User user){ UserDto userDto = new UserDto(); userDto.setFirstName(user.getFirstName()); userDto.setLastName(user.getLastName()); userDto.setEmail(user.getEmail()); userDto.setPassword(user.getPassword()); userDto.setProfile(user.getProfile()); userDto.setIntro(user.getIntro()); userDto.setMobile(user.getMobile()); userDto.setConfirmPassword(user.getConfirmPassword()); return userDto; } }