blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
b702b5772b5f1d30ac4e9320fce5875e09d5a25b
be6a0b17782350c24a61e3ec5f159fca58babdcc
/BluetoothFinder-master/Application/src/main/java/com/example/android/bluetoothlegatt/SampleGattAttributes.java
7f430d3dc11fc572c5c5f3cb062869511afbbb53
[]
no_license
jaesika/BLE_Sample
e9c5afbfecb00442ffc625e694b50e00f6208f6a
566d7c64c56a7d4aa6b296f5e3832c1e8fa1837d
refs/heads/master
2023-07-21T14:18:55.514936
2020-06-25T04:56:40
2020-06-25T04:56:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,545
java
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.bluetoothlegatt; import java.util.HashMap; /** * This class includes a small subset of standard GATT attributes for demonstration purposes. */ public class SampleGattAttributes { private static HashMap<String, String> attributes = new HashMap(); public static String DISPLAY_RAITING_BATTERY_PERCENT = "0000180f-0000-1000-8000-00805f9b34fb"; public static String BATTERY_CHARACTERISTIC_SERVICE = "00002a19-0000-1000-8000-00805f9b34fb"; static { // // 우리가 추가 attributes.put("0000180f-0000-1000-8000-00805f9b34fb", "Battery Rate Service"); // Sample Characteristics. attributes.put("00002a19-0000-1000-8000-00805f9b34fb", "Display Battery Percent"); } public static String lookup(String uuid, String defaultName) { String name = attributes.get(uuid); return name == null ? defaultName : name; } }
0612a5974388ebaf21267f83b2f48c8d31168d62
195557c0305c6e3c31cb48cbadfa1083a49c1d30
/app/src/main/java/com/example/basicbankingapp/CustomerList.java
ea9c29b7019ef2891b637477153dbbb0ed4e64f8
[]
no_license
cr7sid/BasicBankingApp
70964d693cf1360c10f68a340b6e54a518853881
faedf25228fd12b8a68f9887616a8f481a764b90
refs/heads/main
2023-03-23T21:24:07.031183
2021-03-20T06:02:57
2021-03-20T06:02:57
348,580,870
0
1
null
2021-03-19T20:42:30
2021-03-17T04:39:24
Java
UTF-8
Java
false
false
2,377
java
package com.example.basicbankingapp; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.database.Cursor; import android.os.Build; import android.os.Bundle; import android.view.SurfaceControl; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.LinearLayout; import com.example.basicbankingapp.Adapters.CustomersListAdapter; import com.example.basicbankingapp.Handlers.DBHandler; import com.example.basicbankingapp.Models.CustomerModel; import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.util.ArrayList; public class CustomerList extends AppCompatActivity { private RecyclerView recyclerView; private CustomersListAdapter recyclerViewAdapter; private ArrayList<CustomerModel> customers = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_customer_list); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } recyclerView = findViewById(R.id.rvCustomerList); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(linearLayoutManager); customers.clear(); Cursor cursor = new DBHandler(this).showCustomers(); while(cursor.moveToNext()){ CustomerModel holder = new CustomerModel(cursor.getInt(0), cursor.getString(1), cursor.getString(2)); this.customers.add(holder); } recyclerViewAdapter = new CustomersListAdapter(CustomerList.this, customers); recyclerView.setAdapter(recyclerViewAdapter); recyclerViewAdapter.notifyDataSetChanged(); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(CustomerList.this, TransactionList.class)); } }); } }
b54dee6876ca054188bc5ae70a0214fc56fd5991
970288671457d2b79bfa7a1d6ec0e9c353c90ed0
/src/main/java/com/bridgelabs/EmployeePayrollData.java
f7d436bc39f56995722121438c0f92040f5b9f8f
[]
no_license
SamarthBM/Employee-Payroll
7c2e20be4876324b80006da7a46ff1b823721d5d
a51fae3240e4f3e799766035f0b56b4302bb806d
refs/heads/master
2023-06-29T22:40:04.875258
2021-08-06T13:27:40
2021-08-06T13:27:40
392,959,248
0
0
null
null
null
null
UTF-8
Java
false
false
897
java
package com.bridgelabs; public class EmployeePayrollData { private int id; private String name; private double salary; public EmployeePayrollData(int id, String name, double salary) { this.id = id; this.name = name; this.salary = salary; } @Override public String toString() { return "EmployeePayrollData{" + "id=" + id + ", name='" + name + '\'' + ", salary=" + salary + '}'; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } }
5c29ee439dce1e48c48f9dc72fed5ba0b7b8327d
fd13bdcaeda2ddfe18b50a514dff600d439e64b5
/clover-core/src/main/java/com/atlassian/clover/cfg/instr/StatementContextDef.java
8914aabe56a10aea3c273b1722534edb095c756f
[ "Apache-2.0" ]
permissive
andyglick/openclover-oss
d5e81e92a8f911d42a58bc81dd7645d2ded4a4da
3e82e1823e42c63e51e94c807342e2388d30acc1
refs/heads/master
2023-07-08T12:49:40.697534
2017-05-12T21:35:27
2017-05-12T21:35:27
90,255,710
1
0
NOASSERTION
2022-11-03T23:53:17
2017-05-04T11:31:58
Java
UTF-8
Java
false
false
924
java
package com.atlassian.clover.cfg.instr; import com.atlassian.clover.api.CloverException; import java.io.Serializable; /** * */ public class StatementContextDef implements Serializable { private String name; private String regexp; public StatementContextDef() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRegexp() { return regexp; } public void setRegexp(String regexp) { this.regexp = regexp; } public void validate() throws CloverException { if (name == null || name.trim().length() == 0) { throw new CloverException("Context definition requires a name"); } if (regexp == null || regexp.trim().length() == 0) { throw new CloverException("Context definition requires a regular expression"); } } }
c308a3c69f5ca7f3394c383d50205ac22595e2ef
90e19dd3d171eb19b368079f93a04bed2f21a851
/Packets/src/main/java/me/ImSpooks/core/packets/type/PacketType.java
0e87c68d1d7756b5c507ee61003838f42e3190ae
[]
no_license
ImSpooks/Socket-core
d85ee344c6d2a90f3de7243fd7192994564f6554
ce7f51a0986c5faab6d542b75c1fa1f8e2abe94b
refs/heads/master
2020-08-04T09:18:19.499065
2019-11-30T12:28:26
2019-11-30T12:28:26
212,087,315
0
0
null
null
null
null
UTF-8
Java
false
false
287
java
package me.ImSpooks.core.packets.type; import lombok.RequiredArgsConstructor; /** * Created by Nick on 01 okt. 2019. * Copyright © ImSpooks */ @RequiredArgsConstructor public enum PacketType { NETWORK(100), DATABASE(200), OTHER(300); public final int START_ID; }
36cbacee95596d57c933889f64fb0ea609b67780
f6d363141921f8d759a3ee4dcf1ecf731aaaf112
/src/com/mc/base/model/Groups.java
5d1cb2dbef71403435e73e5ec1ff31bf511c6641
[]
no_license
mybsktb/R-Info
1de778801b8454f8d7ef52d3858653070ff884a5
d60e0fee8d825ed7f08864d69386d6f567542cde
refs/heads/master
2020-05-20T22:48:46.118726
2017-03-10T13:09:49
2017-03-10T13:09:49
84,538,861
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package com.mc.base.model; import com.mc.base.BaseGroups; /** * Generated by JFinal. */ @SuppressWarnings("serial") public class Groups extends BaseGroups<Groups> { public static final Groups dao = new Groups(); }
5df247ffeca484cf0a05f3a3f53380dd41db05c5
0dd9d8baa52f7c60156e6e2d2f9f0a83b18e21e1
/src/main/java/spring/sts/team/MemberController.java
d5391f86c0d2c8f18e866f0df21e8cd2aaa54551
[]
no_license
daobs/daobs_test
d2d44830750c64b24a4c1f65f2f90923505d1d5b
730ecf0c5bca7e7424e76e5799c3cc65c65e71c6
refs/heads/master
2021-07-20T01:18:20.291357
2017-10-29T05:29:09
2017-10-29T05:29:09
108,341,501
0
0
null
null
null
null
UTF-8
Java
false
false
8,591
java
package spring.sts.team; import java.util.HashMap; import java.util.Map; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; 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.RequestMethod; import spring.model.member.MemberDAO; import spring.model.member.MemberVO; import spring.sts.utility.SecurityUtil; /** * Handles requests for the application home page. */ @Controller public class MemberController { @Autowired private MemberDAO dao; @RequestMapping(value="/member/delete_proc") public String delete_proc(MemberVO vo, HttpSession session, String id, HttpServletRequest request) { SecurityUtil securityUtil = new SecurityUtil(); String rtn1 = securityUtil.encryptSHA256(vo.getPasswd()); vo.setPasswd(rtn1); if(id==null) { id=(String)session.getAttribute("id"); } Map<String, Object> map = new HashMap<String, Object>(); map.put("id", id); map.put("passwd", vo.getPasswd()); boolean pflag = dao.passwdCheck(map); boolean flag = false; if(pflag) { flag = dao.delete(id); } if(flag) { request.getSession().invalidate(); } request.setAttribute("flag", flag); return "member/delete_proc"; } @RequestMapping(value = "/member/delete", method = RequestMethod.POST) public String delete(String id, MemberVO vo, HttpSession session, HttpServletRequest request) { return "redirect:/"; } @RequestMapping(value = "/member/delete", method = RequestMethod.GET) public String delete(String id, Model model, HttpSession session) { if(id==null) { id=(String)session.getAttribute("id"); } model.addAttribute("id", id); return "member/delete.tiles"; } @RequestMapping(value = "/member/agreement", method = RequestMethod.GET) public String home() { return "member/agreement.tiles"; } @RequestMapping(value = "/member/create", method=RequestMethod.GET) public String create() { return "member/create.tiles"; } @RequestMapping(value = "/member/create", method=RequestMethod.POST) public String create(MemberVO vo) { boolean flag = false; SecurityUtil securityUtil = new SecurityUtil(); String rtn1 = securityUtil.encryptSHA256(vo.getPasswd()); vo.setPasswd(rtn1); flag = dao.create(vo); if(flag) { return "redirect:login"; }else { return "error/error"; } } @RequestMapping(value="/member/id_proc") public String idCheck(String id,Model model) { model.addAttribute("flag",dao.duplicateId(id)); return "member/id_proc"; } @RequestMapping(value="/member/email_proc") public String emailCheck(String email,Model model, String id) { HashMap<String, Object> map = new HashMap<String, Object>(); map.put("email", email); map.put("id", id); model.addAttribute("old_flag",dao.duplicate_UpEmail(map)); model.addAttribute("flag",dao.duplicateEmail(email)); return "member/email_proc"; } @RequestMapping(value="/member/login_proc") public String login_proc(Model model, HttpServletRequest request, MemberVO vo) { String id = request.getParameter("id"); String passwd = request.getParameter("passwd"); SecurityUtil securityUtil = new SecurityUtil(); String rtn1 = securityUtil.encryptSHA256(passwd); vo.setPasswd(rtn1); Map<String,String> map = new HashMap<String,String>(); map.put("id", id); map.put("passwd", vo.getPasswd()); boolean flag = dao.loginCheck(map); model.addAttribute("flag", flag); return "member/login_proc"; } @RequestMapping(value = "/member/login", method = RequestMethod.POST) public String login(HttpServletRequest request, HttpServletResponse response, Model model, MemberVO vo) { String id = request.getParameter("id"); String passwd = request.getParameter("passwd"); boolean flag = false; SecurityUtil securityUtil = new SecurityUtil(); String rtn1 = securityUtil.encryptSHA256(passwd); vo.setPasswd(rtn1); Map<String,String> map = new HashMap<String,String>(); map.put("id", id); map.put("passwd", vo.getPasswd()); flag = dao.loginCheck(map); String grade = null;//회원등급 if(flag){//회원인경우 grade = dao.getGrade(id); request.getSession().setAttribute("id", id); request.getSession().setAttribute("grade", grade); // ---------------------------------------------- // Cookie 저장, Checkbox는 선택하지 않으면 null 임 // ---------------------------------------------- Cookie cookie = null; String c_id = request.getParameter("c_id"); // Y, 아이디 저장 여부 if (c_id != null){ // 처음에는 값이 없음으로 null 체크로 처리 cookie = new Cookie("c_id", "Y"); // 아이디 저장 여부 쿠키 cookie.setMaxAge(120); // 2 분 유지 response.addCookie(cookie); // 쿠키 기록 cookie = new Cookie("c_id_val", id); // 아이디 값 저장 쿠키 cookie.setMaxAge(120); // 2 분 유지 response.addCookie(cookie); // 쿠키 기록 }else{ cookie = new Cookie("c_id", ""); // 쿠키 삭제 cookie.setMaxAge(0); response.addCookie(cookie); cookie = new Cookie("c_id_val", ""); // 쿠키 삭제 cookie.setMaxAge(0); response.addCookie(cookie); } // --------------------------------------------- }else { return "member/login.tiles"; } return "redirect:/"; } @RequestMapping(value="member/login",method=RequestMethod.GET) public String login(HttpServletRequest request) { String c_id = ""; // ID 저장 여부를 저장하는 변수, Y String c_id_val = ""; // ID 값 Cookie[] cookies = request.getCookies(); Cookie cookie=null; if (cookies != null){ for (int i = 0; i < cookies.length; i++) { cookie = cookies[i]; if (cookie.getName().equals("c_id")){ c_id = cookie.getValue(); // Y }else if(cookie.getName().equals("c_id_val")){ c_id_val = cookie.getValue(); // user1... } } } request.setAttribute("c_id", c_id); request.setAttribute("c_id_val", c_id_val); return "member/login.tiles"; } @RequestMapping("member/logout") public String logout(HttpSession session) { session.invalidate(); return "redirect:/"; } @RequestMapping(value = "member/update", method = RequestMethod.GET) public String update(String id, HttpSession session, Model model) { if(id==null) { id=(String)session.getAttribute("id"); } MemberVO vo = dao.read(id); model.addAttribute("vo", vo); return "member/update.tiles"; } @RequestMapping(value = "member/update", method = RequestMethod.POST) public String update(MemberVO vo, Model model) { SecurityUtil securityUtil = new SecurityUtil(); String rtn1 = securityUtil.encryptSHA256(vo.getPasswd()); vo.setPasswd(rtn1); model.addAttribute("flag", dao.update(vo)); return "redirect:/"; } @RequestMapping(value = "member/popup/findIdForm") public String findIdForm() { return "member/popup/findIdForm"; } @RequestMapping(value = "member/popup/findPwForm") public String findPwForm() { return "member/popup/findPwForm"; } @RequestMapping(value = "member/popup/findPwProc") public String findPwProc(String id, String email, Model model) { Map<String, Object> map = new HashMap<String, Object>(); map.put("id", id); map.put("email", email); String passwd = null; boolean flag = false; passwd= dao.findPw(map); if(passwd!=null) { flag = true; } model.addAttribute("passwd", passwd); model.addAttribute("flag", flag); return "member/popup/findPwProc"; } @RequestMapping(value = "member/popup/findIdProc") public String findIdProc(String name, String email, Model model) { Map<String, Object> map = new HashMap<String, Object>(); map.put("name", name); map.put("email", email); String id = null; boolean flag = false; id= dao.findId(map); if(id!=null) { flag = true; } model.addAttribute("id", id); model.addAttribute("flag", flag); return "member/popup/findIdProc"; } @RequestMapping(value = "introduce/company") public String company() { return "introduce/company.tiles"; } @RequestMapping(value = "introduce/author") public String author() { return "introduce/author.tiles"; } }
[ "Beom-Seok@DESKTOP-KD2NGGU" ]
Beom-Seok@DESKTOP-KD2NGGU
72358e15ab8758659455098957a4b197d90ee0a3
e17031c912b3f039c92c50f752d37aa08536f3a1
/src/main/java/com/nickmlanglois/uid/UidInternalImp.java
5717d8124f1b507686991f1e537ed0ba215e33a4
[ "Apache-2.0" ]
permissive
heathen00/localizer
6be3d6c8978c96cbf5edff749e57deaf8045dd22
47cc9cd00c2fec197380f11653f3f7fc469647d7
refs/heads/master
2020-07-29T01:36:28.475840
2019-09-19T19:43:50
2019-09-19T19:43:50
209,618,763
0
0
null
null
null
null
UTF-8
Java
false
false
1,184
java
package com.nickmlanglois.uid; final class UidInternalImp<T> implements UidInternal<T> { private final T component; private final String key; UidInternalImp(String key, T component) { this.component = component; this.key = key; } @Override public String getKey() { return key; } @Override public T getComponent() { return component; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((key == null) ? 0 : key.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; @SuppressWarnings("rawtypes") UidInternalImp other = (UidInternalImp) obj; if (key == null) { if (other.key != null) return false; } else if (!key.equals(other.key)) return false; return true; } @Override public int compareTo(Uid<T> o) { return key.compareTo(o.getKey()); } @Override public String toString() { return "UIDImp [component=" + component + ", key=" + key + "]"; } }
bbc7b7cccc579dc33f22ce50c479c5954a92bf48
66637fff31269824a20cfa1bd12c897be2802952
/AlgoAndDataStruct/src/CollinearTest.java
63f3d7b96336f008b1e5b8345813f1f55e0f2817
[]
no_license
poppacurry/CS2010-AlgoAndDataStruct
b1fb271b69ffe104c75caff26cadbceb0085dc05
5deb103a58d1ac2562c34e55d2425e7e9d014382
refs/heads/master
2020-05-06T15:15:46.137474
2019-04-05T16:21:38
2019-04-05T16:21:38
180,179,803
1
0
null
2019-04-08T15:33:54
2019-04-08T15:33:53
null
UTF-8
Java
false
false
5,707
java
import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.util.Arrays; //------------------------------------------------------------------------- /** * Test class for Collinear.java * * @author Senán d'Art * @version 18/09/18 12:21:26 */ @RunWith(JUnit4.class) public class CollinearTest { // ~ Constructor ........................................................ @Test public void testConstructor() { new Collinear(); } // ~ Public Methods ........................................................ // ---------------------------------------------------------- /** * Check that the two methods work for empty arrays */ @Test public void testEmpty() { int expectedResult = 0; assertEquals("countCollinear failed with 3 empty arrays", expectedResult, Collinear.countCollinear(new int[0], new int[0], new int[0])); assertEquals("countCollinearFast failed with 3 empty arrays", expectedResult, Collinear.countCollinearFast(new int[0], new int[0], new int[0])); } // ---------------------------------------------------------- /** * Check for no false positives in a single-element array */ @Test public void testSingleFalse() { int[] a3 = { 15 }; int[] a2 = { 5 }; int[] a1 = { 10 }; int expectedResult = 0; assertEquals("countCollinear({10}, {5}, {15})", expectedResult, Collinear.countCollinear(a1, a2, a3)); assertEquals("countCollinearFast({10}, {5}, {15})", expectedResult, Collinear.countCollinearFast(a1, a2, a3)); } // ---------------------------------------------------------- /** * Check for no false positives in a single-element array */ @Test public void testSingleTrue() { int[] a3 = { 15, 5 }; int[] a2 = { 5 }; int[] a1 = { 10, 15, 5 }; int expectedResult = 1; assertEquals( "countCollinear(" + Arrays.toString(a1) + "," + Arrays.toString(a2) + "," + Arrays.toString(a3) + ")", expectedResult, Collinear.countCollinear(a1, a2, a3)); assertEquals("countCollinearFast(" + Arrays.toString(a1) + "," + Arrays.toString(a2) + "," + Arrays.toString(a3) + ")", expectedResult, Collinear.countCollinearFast(a1, a2, a3)); } // --------------------------------------------------------- /* * a Evaluate all binarySearch cases. * */ @Test public void evalBinarySearch() { int[] theArray = { 1, 7, 3, 5, 2 }; // 1, 2, 3, 5, 7 boolean expectedResult = true; int numToFind = 3; assertEquals("binarySearch(" + Arrays.toString(theArray) + "," + numToFind, expectedResult, Collinear.binarySearch(theArray, numToFind)); // If num to find is less than mid numToFind = 1; assertEquals("binarySearch(" + Arrays.toString(theArray) + "," + numToFind, expectedResult, Collinear.binarySearch(theArray, numToFind)); // If num to find is greater than mid numToFind = 7; assertEquals("binarySearch(" + Arrays.toString(theArray) + "," + numToFind, expectedResult, Collinear.binarySearch(theArray, numToFind)); // If the array is large. int[] bigArray = { 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }; numToFind = 2; assertEquals("binarySearch(" + Arrays.toString(theArray) + "," + numToFind, expectedResult, Collinear.binarySearch(bigArray, numToFind)); // If the array is large. numToFind = 20; assertEquals("binarySearch(" + Arrays.toString(theArray) + "," + numToFind, expectedResult, Collinear.binarySearch(bigArray, numToFind)); // If num to find is not in the array expectedResult = false; numToFind = 8; assertEquals("binarySearch(" + Arrays.toString(theArray) + "," + numToFind, expectedResult, Collinear.binarySearch(bigArray, numToFind)); //If the num to find is greater than the highest num in the array numToFind = 30; assertEquals("binarySearch(" + Arrays.toString(theArray) + "," + numToFind, expectedResult, Collinear.binarySearch(bigArray, numToFind)); //If the num to find is lower than the lowest num in the array numToFind = -1; assertEquals("binarySearch(" + Arrays.toString(theArray) + "," + numToFind, expectedResult, Collinear.binarySearch(bigArray, numToFind)); // If the array is null theArray = null; assertEquals("binarySearch(" + Arrays.toString(theArray) + "," + numToFind, expectedResult, Collinear.binarySearch(theArray, numToFind)); } // Check for null arrays in search functions. @Test public void checkForNull() { int[] a1 = { 15, 5 }; int[] a2 = { 5 }; int[] a3 = { 10, 15, 5 }; int expectedResult = 0; a1 = null; assertEquals("countCollinear(" + "NULL" + "," + Arrays.toString(a2) + "," + Arrays.toString(a3) + ")", expectedResult, Collinear.countCollinear(a1, a2, a3)); assertEquals("countCollinearFast(" + "NULL" + "," + Arrays.toString(a2) + "," + Arrays.toString(a3) + ")", expectedResult, Collinear.countCollinearFast(a1, a2, a3)); a2 = null; a1 = new int[2]; a1[0] = 15; a1[1] = 5; assertEquals("countCollinear(" + Arrays.toString(a1) + "," + "NULL" + "," + Arrays.toString(a3) + ")", expectedResult, Collinear.countCollinear(a1, a2, a3)); assertEquals("countCollinearFast(" + Arrays.toString(a1) + "," + "NULL" + "," + Arrays.toString(a3) + ")", expectedResult, Collinear.countCollinearFast(a1, a2, a3)); a3 = null; a2 = new int[1]; a2[0] = 5; assertEquals("countCollinear(" + Arrays.toString(a1) + "," + Arrays.toString(a2) + "," + "NULL" + ")", expectedResult, Collinear.countCollinear(a1, a2, a3)); assertEquals("countCollinearFast(" + Arrays.toString(a1) + "," + Arrays.toString(a2) + "," + "NULL" + ")", expectedResult, Collinear.countCollinearFast(a1, a2, a3)); } }
77ff1f524db274ed5a517b637ffc3805f4c14db7
2895d49966e7e0e2dd9280103e2e13e9317837b9
/UberUtils Scala/nz/ubermouse/uberutils/paint/components/PDialogue.java
5ee8c0b8fcd080aa2d6192e57204ae357285d820
[]
no_license
UberMouse/oldrsbuddyscripts
71eab59ae2dc5fbfa7bbec7db2378414824626d8
b460f151ec6f754a1137ae64d66c1dc644b043fb
refs/heads/master
2020-05-23T14:45:20.881479
2012-05-15T21:43:33
2012-05-15T21:43:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,527
java
package nz.ubermouse.uberutils.paint.components; import nz.ubermouse.uberutils.paint.abstracts.PComponent; import java.awt.*; import java.awt.event.MouseEvent; /** * Created by IntelliJ IDEA. * User: Taylor * Date: 4/2/11 * Time: 12:24 AM * Package: nz.uberutils.paint.components; */ public class PDialogue extends PComponent { private ColorScheme colorScheme; private Type type; private String title, content[]; private Font tFont, cFont; private FontMetrics tMetrics, cMetrics; private Button buttons[]; private boolean yesClick; private boolean disposed; public PDialogue(String title, String[] content, Font tFont, ColorScheme colorScheme, Type type) { this(-1, -1, -1, -1, title, content, tFont, colorScheme, type); } public PDialogue(int x, int y, int width, int height, String title, String[] content, Font tFont, ColorScheme colorScheme, Type type) { super(); this.x = x; this.y = y; this.width = width; this.height = height; this.title = title; this.content = content; this.colorScheme = colorScheme; this.type = type; this.tFont = tFont; this.cFont = new Font(tFont.getName(), 0, tFont.getSize() / 1.25 >= 9 ? (int) (tFont.getSize() / 1.25) : 9); if (type == Type.WARNING) this.title = "WARNING: " + title; else if (type == Type.ERROR) this.title = "ERROR: " + title; } public int getContentHeight() { int barHeight = tMetrics.getMaxAscent() + 8; int height = barHeight; for (String i : content) height += cMetrics.getMaxAscent() + 2; return height + (barHeight - 4) + 20; } public int getContentWidth() { int width = tMetrics.stringWidth(title) + 12; for (String i : content) { int temp = cMetrics.stringWidth(i) + 12; if (temp > width) width = temp; } return width; } public boolean containsPoint(Point p) { return new Rectangle(x - 8, y - 8, width + 16, height + 16).contains(p); } public Button buttonWhichPointIsIn(Point point) { for (Button button : buttons) if (button.pointInButton(point)) return button; return null; } public boolean pointInButton(Point point) { for (Button button : buttons) { if (button.pointInButton(point)) return true; } return false; } public ButtonType getButtonClicked(Point point) { for (Button button : buttons) { if (button.pointInButton(point)) { return button.getType(); } } return ButtonType.NULL; } public void setLocation(Point point) { setLocation(point.x, point.y); } public void setLocation(int x, int y) { if (this.x != x) { this.x = x; buttons = null; } if (this.y != y) { this.y = y; buttons = null; } } public void redrawButtons() { buttons = null; } public Button[] getButtons() { return buttons; } public enum Type { WARNING, INFORMATION, ERROR, YES_NO, YES_NO_CANCEL } public enum ButtonType { YES("Yes"), NO("No"), CANCEL("Cancel"), OKAY("Ok"), NULL("null"); ButtonType(String text) { this.text = text; } public String getText() { return text; } String text; } public enum ColorScheme { GRAPHITE(new Color(55, 55, 55, 240), new Color(15, 15, 15, 240), new Color(200, 200, 200, 85), new Color(80, 80, 80, 85), new Color(200, 200, 200), new Color(255, 255, 255), new Color(200, 0, 0), new Color(200, 200, 0)), LIME(new Color(0, 187, 37, 240), new Color(0, 128, 28), new Color(51, 255, 51, 120), new Color(153, 255, 51, 120), new Color(255, 153, 51), new Color(255, 128, 0), new Color(255, 38, 0), new Color(255, 217, 0)), HOT_PINK(new Color(255, 102, 204, 240), new Color(255, 0, 170), new Color(200, 200, 200, 80), new Color(100, 100, 100, 85), new Color(110, 255, 110), new Color(0, 255, 0), new Color(255, 0, 64), new Color(186, 255, 0)), WHITE(new Color(200, 200, 200, 240), new Color(180, 180, 180, 240), new Color(255, 255, 255, 85), new Color(200, 200, 200, 85), new Color(51, 51, 51), new Color(0, 0, 0), new Color(255, 0, 0), new Color(255, 255, 0)); ColorScheme(Color mainColor1, Color mainColor2, Color highlightColor1, Color highlightColor2, Color textColor, Color normalTitleColor, Color errorTitleColor, Color warningTitleColor) { main1 = mainColor1; main2 = mainColor2; highlight1 = highlightColor1; highlight2 = highlightColor2; text = textColor; nTitle = normalTitleColor; eTitle = errorTitleColor; wTitle = warningTitleColor; } private Color main1, main2, highlight1, highlight2, text, nTitle, eTitle, wTitle; } public class Button extends PFancyButton { private ButtonType type; public Button(int x, int y, int width, int height, ButtonType type) { super(x, y, type.getText()); this.x = x; this.y = y; this.width = width; this.height = height; this.type = type; } public void paint(Graphics2D g) { if (hoverArea == null) hoverArea = getBounds(g, text); Paint p = g.getPaint(); if (!hovered) g.setPaint(new GradientPaint(x, y, colorScheme.highlight1, x, y + height, colorScheme.highlight2)); else g.setPaint(new GradientPaint(x, y, colorScheme.highlight2, x, y + height, colorScheme.highlight1)); g.fillRect(x, y, width, height); g.setPaint(p); g.setColor(colorScheme.main2); g.drawRect(x, y, width - 1, height); g.setColor(colorScheme.text); g.setFont(cFont); g.drawString(type.getText(), (x + (width / 2) - (cMetrics.stringWidth(type.getText()) / 2)), y + (height / 2) + (int) (cMetrics.getMaxAscent() / (cFont.getSize() / 4.5))); g.setColor(new Color(255, 255, 255, 65)); g.fillRect(x + 1, (y + 1), width - 2, (int) (height / 2.333)); } public ButtonType getType() { return type; } } @Override public void repaint(Graphics2D g) { if (disposed) return; Paint p = g.getPaint(); g.setStroke(new BasicStroke()); tMetrics = g.getFontMetrics(tFont); cMetrics = g.getFontMetrics(cFont); width = width == -1 ? getContentWidth() : width; height = height == -1 ? getContentHeight() : height; x = x == -1 ? (g.getClipBounds().width / 2) - (width / 2) : x; y = y == -1 ? (g.getClipBounds().height / 2) - (height / 2) : y; g.setPaint(new GradientPaint(x - 8, y - 8, new Color(230, 230, 230, 180), x - 8, y + 16, new Color(200, 200, 200, 180))); g.fillRect(x - 8, y - 8, width + 16, height + 16); g.setPaint(new GradientPaint(x, y, colorScheme.main1, x, y + height, colorScheme.main2)); g.fillRect(x, y, width, height); g.setPaint(new GradientPaint(x, y, colorScheme.highlight1, x, y + tMetrics.getMaxAscent() + 8, colorScheme.highlight2)); g.fillRect(x, y, width, tMetrics.getMaxAscent() + 8); g.setPaint(p); g.setColor(colorScheme.main2); g.drawRect(x, y, width - 1, tMetrics.getMaxAscent() + 8); g.setColor(type == Type.WARNING ? colorScheme.wTitle : type == Type.ERROR ? colorScheme.eTitle : colorScheme.nTitle); g.drawString(title, (x + (width / 2) - (tMetrics.stringWidth(title) / 2)) + 1, y + ((tMetrics.getMaxAscent() + 8) / 2) + (int) (tMetrics.getMaxAscent() / (tFont.getSize() / 4.5))); g.setColor(new Color(255, 255, 255, 65)); g.fillRect(x + 1, y + 1, width - 2, (int) ((tMetrics.getMaxAscent() + 8) / 2.333)); int sY = y + tMetrics.getMaxAscent() + 8 + 4; for (String c : content) { sY += cMetrics.getMaxAscent() + 2; g.setFont(cFont); g.setColor(colorScheme.text); g.drawString(c, (x + (width / 2) - (cMetrics.stringWidth(c) / 2)) + 1, sY); } if (buttons == null) { if (type == Type.INFORMATION || type == Type.ERROR || type == Type.WARNING) { buttons = new Button[]{ new Button(x + 6, (y + (getContentHeight() - 24)), width - 12, 18, ButtonType.OKAY) }; } else if (type == Type.YES_NO) { buttons = new Button[]{ new Button(x + 6, (y + (getContentHeight() - 24)), ((width - 12) / 2) - 3, 18, ButtonType.YES), new Button(x + 6 + ((width - 12) / 2) + 3, (y + (getContentHeight() - 24)), ((width - 12) / 2) - 3, 18, ButtonType.NO) }; } else if (type == Type.YES_NO_CANCEL) { buttons = new Button[]{ new Button(x + 5, (y + (getContentHeight() - 24)), ((width - 12) / 3) - 3, 18, ButtonType.YES), new Button(x + 5 + ((width - 12) / 3) + 3, (y + (getContentHeight() - 24)), ((width - 12) / 3) - 3, 18, ButtonType.CANCEL), new Button(x + 5 + (((width - 12) / 3) + 3) * 2, (y + (getContentHeight() - 24)), ((width - 12) / 3) - 3, 18, ButtonType.NO) }; } } if (buttons != null) for (Button button : buttons) button.paint(g); } public void mouseMoved(MouseEvent mouseEvent) { if (disposed) return; for (Button button : getButtons()) { button.setHovered(button.pointInButton(mouseEvent.getPoint())); } } public void mouseClicked(MouseEvent mouseEvent) { if (disposed) return; for (Button button : getButtons()) { if (button.pointInButton(mouseEvent.getPoint())) { disposed = true; if (button.getType().getText().equals("Ok")) { yesClick = true; okClick(); } else if (button.getType().getText().equals("Yes")) { yesClick = true; yesClick(); } else if (button.getType().getText().equals("No")) noClick(); else if (button.getType().getText().equals("Cancel")) cancelClick(); } } } public void yesClick() { } public void noClick() { } public void cancelClick() { } public void okClick() { } }
b79ad948f3963ddf66255c7147e96a387bb9835b
6c6df00ee6665ab2b5375456909e1ac995c68d57
/MindMap/src/guiListener/ActionListener/NewMenuActionListener.java
ef71c02dd926a64856c7c67664b9b9199e5dd204
[]
no_license
yhb0730/-
b78e4e54ea7c7d5f6ff7e083858b0c6e7f6cd9c6
0a7d8b50e90b46a538462e1d8722cfa248fe7f07
refs/heads/master
2020-03-18T19:20:22.512815
2018-06-12T13:44:44
2018-06-12T13:44:44
135,148,626
1
0
null
null
null
null
UHC
Java
false
false
1,734
java
package guiListener.ActionListener; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import gui.*; public class NewMenuActionListener extends OptionActionListener{ @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(Constants.IS_CHANGED == true) { int input = JOptionPane.showConfirmDialog(null, "정말 새로 만드시겠습니까?", "새로만들기", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null); if(input != 0) { //Yes return ; } } AttributeEditor attrEditor = super.getAttrEditor().getAttributeEditor(); MindMapEditorPane mindMapEditor = super.getMindMapEditor(); TextEditorPane textEditor = super.getTextEditor(); textEditor.setText(null); mindMapEditor.getMindMapEditor().removeAllLabel(); for(int i=0; i < AttributeEditor.ATTRIBUTE_NUM; ++i) { attrEditor.setText(i, null); } attrEditor.setTextBackgroundColor(AttributeEditor.COLOR_ATTR, Color.WHITE); attrEditor.setNodeLabel(null); Constants.IS_CHANGED = false; } @Override public TextEditorPane getTextEditor() { return super.getTextEditor(); } @Override public void setTextEditor(TextEditorPane textEditor) { super.setTextEditor(textEditor); } @Override public MindMapEditorPane getMindMapEditor() { return super.getMindMapEditor(); } @Override public void setMindMapEditor(MindMapEditorPane mindMapEditor) { super.setMindMapEditor(mindMapEditor); } @Override public AttributeEditorPane getAttrEditor() { return super.getAttrEditor(); } @Override public void setAttrEditor(AttributeEditorPane attrEditor) { super.setAttrEditor(attrEditor); } }
008edc569de674ae43851f1382b96c2c05a91a59
3a98a63444c0363384580cdb59d090d100ab0ba4
/src/main/java/fr/kata/bank/impl/Operation.java
ece8893cbee30e74e2b453b8037752c453790257
[]
no_license
kataPlayer/repo
5e11cf6eac980c0579ee0c1b8179c51e759c5553
1bf29f9dfd6dce10a709a2f391e6413c04972cc4
refs/heads/master
2020-04-30T19:05:51.281139
2019-07-16T21:17:40
2019-07-16T21:17:40
177,028,551
0
0
null
null
null
null
UTF-8
Java
false
false
1,155
java
package fr.kata.bank.impl; import java.util.Date; import java.util.List; import fr.kata.bank.print.BankPrinterInterface; import fr.kata.bank.print.impl.BankPrinter; public class Operation { private final OperationType operationType; private final Date date; private final double amount; private static final BankPrinterInterface printer = new BankPrinter(); public Operation(OperationType operationType, Date date, double amount) { this.operationType=operationType; this.date=date; this.amount=amount; } public static Operation createDepositOperation(double amount){ return new Operation(OperationType.DEPOSIT, new Date(), amount); } public static Operation createWithdrawalOperation(double amount){ return new Operation(OperationType.WITHDRAWAL, new Date(), amount); } public static void printStatements(List<Operation>statements) { for (Operation op : statements) { printer.printOperation(op); } } public OperationType getOperationType() { return operationType; } public Date getDate() { return date; } public double getAmount() { return amount; } }
e1721cbe7d0896ffeb09660068d960eef7e653d1
18f74a117387ef42eaff2510a6416bdd2784facd
/src/com/river/business/facade/Rafter.java
d71be652b147e66ae065faa1280e5c98322b0842
[]
no_license
Ooin/FromTheLostToTheRiver
1387ff45d8b3dcc6987346841b9a46cd9f91355d
876daae0651cc1fcc55106fdc87bf3576a96879d
refs/heads/master
2016-09-10T19:57:46.795381
2015-11-17T08:48:59
2015-11-17T08:48:59
40,700,458
0
0
null
null
null
null
UTF-8
Java
false
false
235
java
package com.river.business.facade; public class Rafter { /** * As a user i want to create my rafter */ /** * As a rafter i want to edit my profile */ /** * As a rafter i want to close my account */ }
7215d00487a3b48390066fe617c92fe0494b075c
6c35446feb5baaadf1901a083442e14dc423fc0b
/TestRanger/src/main/java/com/cqx/RangerImpl.java
e0f54dbcb8619f24ff9d61fb3de75415743644b4
[ "Apache-2.0" ]
permissive
chenqixu/TestSelf
8e533d2f653828f9f92564c3918041d733505a30
7488d83ffd20734ab5ca431d13fa3c5946493c11
refs/heads/master
2023-09-01T06:18:59.417999
2023-08-21T06:16:55
2023-08-21T06:16:55
75,791,787
3
1
Apache-2.0
2022-03-02T06:47:48
2016-12-07T02:36:58
Java
UTF-8
Java
false
false
11,460
java
package com.cqx; import org.apache.log4j.Logger; import org.apache.ranger.admin.client.datatype.RESTResponse; import org.apache.ranger.plugin.model.RangerPolicy; import org.apache.ranger.plugin.util.RangerRESTUtils; import org.apache.ranger.plugin.util.ServicePolicies; import com.google.gson.Gson; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter; public class RangerImpl implements Ranger { private static Logger log = Logger.getLogger(RangerImpl.class); // private static final String EXPECTED_MIME_TYPE = PropertyUtil // .getProperty("expected_mime_type"); private static String rangerBaseUrl = PropertyUtil .getProperty("rangerBaseUrl"); private static String service = PropertyUtil.getProperty("service"); // hive的服务名 private static String adminUser = PropertyUtil.getProperty("adminUser"); private static String adminPwd = PropertyUtil.getProperty("adminPwd"); // ranger自己的登录密码(不是通过单点登录的密码) public String getAllValidPolice() { String url = rangerBaseUrl + "/service/plugins/policies/download/" + service; log.info("getAllValidPolice, reqUrl=" + url); ClientResponse response = null; Client client = null; String allPolice = null; try { client = Client.create(); WebResource webResource = client.resource(url).queryParam( RangerRESTUtils.REST_PARAM_LAST_KNOWN_POLICY_VERSION, Long.toString(68)); response = webResource.accept(RangerRESTUtils.REST_MIME_TYPE_JSON) .get(ClientResponse.class); if (response != null && response.getStatus() == 200) { ServicePolicies ret = response.getEntity(ServicePolicies.class); Gson gson = new Gson(); allPolice = gson.toJson(ret); log.info("getAllValidPolice is success , the resp=" + gson.toJson(ret)); } else { RESTResponse resp = RESTResponse.fromClientResponse(response); log.warn("getAllValidPolice is fail," + resp.toString()); } } catch (Exception e) { log.error("getAllValidPolice is fail, errMassge=" + e.getMessage()); } finally { if (response != null) { response.close(); } if (client != null) { client.destroy(); } } return allPolice; } public String getPolicyByName(String policyName) { String url = rangerBaseUrl + "/service/public/v2/api/service/" + service + "/policy/" + policyName; log.info("getPolicyByName, reqUrl=" + url); Client client = null; ClientResponse response = null; String jsonString = null; try { client = Client.create(); client.addFilter(new HTTPBasicAuthFilter(adminUser, adminPwd)); WebResource webResource = client.resource(url); response = webResource.accept(RangerRESTUtils.REST_MIME_TYPE_JSON) // response = webResource.accept(EXPECTED_MIME_TYPE).get( .get(ClientResponse.class); if (response.getStatus() == 200) { jsonString = response.getEntity(String.class); log.info("getPolicyByName is success, the response message is :" + jsonString); } else { RESTResponse resp = RESTResponse.fromClientResponse(response); jsonString = resp.toJson(); log.warn("getPolicyByName is fail, the response message is :" + resp.toString()); } } catch (Exception e) { RESTResponse resp = RESTResponse.fromClientResponse(response); jsonString = resp.toJson(); log.error("getPolicyByName is fail, the error message is :" + e.getMessage() + " and the response message is : " + jsonString); } finally { if (response != null) { response.close(); } if (client != null) { client.destroy(); } } return jsonString; } public boolean createPolice(CreatePoliceReq req) { boolean flag = false; String url = rangerBaseUrl + "/service/public/v2/api/policy"; log.info("CreatePolice of reqUrl=" + url); // 添加多个用户时将分割符逗号替换成下划线,用来生成新的策略名称 // String newPoliceUser = req.getPoliceUser(); // if (req.getPoliceUser().contains(",")) { // newPoliceUser = req.getPoliceUser().replace(",", "_"); // } // String PoliceName = newPoliceUser + "_police"; ClientResponse response = null; Client client = null; try { client = Client.create(); client.addFilter(new HTTPBasicAuthFilter(adminUser, adminPwd)); WebResource webResource = client.resource(url); Gson gson = new Gson(); RangerPolicy createOfPolicy = SupportRangerImpl.createOfPolicy( req.getPoliceName(), req.getPoliceUser(), req.getDbName(), req.getTableName(), req.getColPermissionsType(), req.getPermissionsType()); // log.info("json:"+gson.toJson(createOfPolicy)); response = webResource .accept(RangerRESTUtils.REST_EXPECTED_MIME_TYPE) .type(RangerRESTUtils.REST_EXPECTED_MIME_TYPE) .post(ClientResponse.class, gson.toJson(createOfPolicy)); if (response != null && response.getStatus() == 200) { RangerPolicy rangerPolicy = response .getEntity(RangerPolicy.class); log.info("Create Police is success, the police message is=" + rangerPolicy); flag = true; } else { log.warn("Create Police is fail, the warn message is=" + response.toString()); } } catch (Exception e) { log.error("Create Police is fail, the error message is=" + e.getMessage()); flag = false; } finally { if (response != null) { response.close(); } if (client != null) { client.destroy(); } } return flag; } public boolean deletePoliceByPoliceName(String policeName) { boolean flag = false; String url = rangerBaseUrl + "/service/public/v2/api/policy?servicename=" + service + "&policyname=" + policeName; log.info("DeletePoliceByPoliceName of requrl " + url); ClientResponse response = null; Client client = null; try { client = Client.create(); client.addFilter(new HTTPBasicAuthFilter(adminUser, adminPwd)); WebResource webResource = client.resource(url); webResource.accept(RangerRESTUtils.REST_EXPECTED_MIME_TYPE) .delete(); flag = true; log.info("DeletePoliceByPoliceName is success."); } catch (Exception e) { log.error("DeletePoliceByPoliceName is fail. the errMassage is " + e.getMessage()); flag = false; } finally { if (response != null) { response.close(); } if (client != null) { client.destroy(); } } return flag; } public boolean updatePolicyById(UpdatePoliceReq req) { boolean flag = false; String url = rangerBaseUrl + "/service/public/v2/api/policy/" + req.getPoliceId(); log.info("UpdatePolicyById of reqUrl=" + url); RangerPolicy rangerPolicy = SupportRangerImpl.updateOfPolicy( req.getPoliceName(), req.getDbName(), req.getTableName(), req.getPermissionsType(), req.getPoliceUser(), req.getColPermissionsType(), req.getIsEnabled()); ClientResponse response = null; Client client = null; try { client = Client.create(); client.addFilter(new HTTPBasicAuthFilter(adminUser, adminPwd)); WebResource webResource = client.resource(url); Gson gson = new Gson(); response = webResource .accept(RangerRESTUtils.REST_EXPECTED_MIME_TYPE) .type(RangerRESTUtils.REST_EXPECTED_MIME_TYPE) .put(ClientResponse.class, gson.toJson(rangerPolicy)); if (response != null && response.getStatus() == 200) { RangerPolicy policy = response.getEntity(RangerPolicy.class); flag = true; log.info("UpdatePolicyById is success, the police message is=" + policy); } else { log.warn("UpdatePolicyById is fail, the fail message is=" + response.toString()); } } catch (Exception e) { log.error("UpdatePolicyById is fail, the error message is=" + e.getMessage()); flag = false; } finally { if (response != null) { response.close(); } if (client != null) { client.destroy(); } } return flag; } public boolean updatePolicyByName(UpdatePoliceReq req) { boolean flag = false; String url = rangerBaseUrl + "/service/public/v2/api/service/" + service + "/policy/" + req.getPoliceName(); log.info("updatePolicyByName of reqUrl=" + url); RangerPolicy rangerPolicy = SupportRangerImpl.updateOfPolicy( req.getPoliceName(), req.getDbName(), req.getTableName(), req.getPermissionsType(), req.getPoliceUser(), req.getColPermissionsType(), req.getIsEnabled()); ClientResponse response = null; Client client = null; try { client = Client.create(); client.addFilter(new HTTPBasicAuthFilter(adminUser, adminPwd)); WebResource webResource = client.resource(url); Gson gson = new Gson(); // log.info("json:"+gson.toJson(rangerPolicy)); response = webResource .accept(RangerRESTUtils.REST_EXPECTED_MIME_TYPE) .type(RangerRESTUtils.REST_EXPECTED_MIME_TYPE) .put(ClientResponse.class, gson.toJson(rangerPolicy)); if (response != null && response.getStatus() == 200) { RangerPolicy policy = response.getEntity(RangerPolicy.class); flag = true; log.info("updatePolicyByName is success, the police message is=" + policy); } else { log.warn("updatePolicyByName is fail, the fail message is=" + response.toString()); } } catch (Exception e) { log.error("updatePolicyByName is fail, the error message is=" + e.getMessage()); flag = false; } finally { if (response != null) { response.close(); } if (client != null) { client.destroy(); } } return flag; } public boolean deletePoliceByPoliceId(String policeId) { boolean flag = false; String url = rangerBaseUrl + "/service/public/v2/api/policy/" + policeId; log.info("DeletePoliceByPoliceId of reqUrl=" + url); ClientResponse response = null; Client client = null; try { client = Client.create(); client.addFilter(new HTTPBasicAuthFilter(adminUser, adminPwd)); WebResource webResource = client.resource(url); webResource.accept(RangerRESTUtils.REST_EXPECTED_MIME_TYPE) .delete(); flag = true; } catch (Exception e) { log.error("DeletePoliceByPoliceId is fail, the error Massage is=" + e.getMessage()); flag = false; } finally { if (response != null) { response.close(); } if (client != null) { client.destroy(); } } return flag; } /** * 这里的删除只是把用户设为不可见,不可见之后在配置策略时,这个用户就变成不可选,但是原先这个用户所拥有的策略还是存在的。真正删除这个用户后, * 其所拥有的策略才不存在。 * * @param UserName * @return */ public boolean deleteUserByUserName(String UserName) { boolean flag = false; String url = rangerBaseUrl + "/service/xusers/users/userName/" + UserName; // service/xusers/secure/users/delete?forceDelete=true& log.info("deleteUserByUserName of reqUrl=" + url); ClientResponse response = null; Client client = null; try { client = Client.create(); client.addFilter(new HTTPBasicAuthFilter(adminUser, adminPwd)); WebResource webResource = client.resource(url); webResource.accept(RangerRESTUtils.REST_EXPECTED_MIME_TYPE) .delete(); flag = true; } catch (Exception e) { log.error("DeletePoliceByPoliceId is fail, the error Massage is=" + e.getMessage()); flag = false; } finally { if (response != null) { response.close(); } if (client != null) { client.destroy(); } } return flag; } }
d1f57138b23f54d23e92e4437be90ca8d6ef5fe5
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/plugin/label/e.java
12539602cff34dec082b218453b5573136ab6a19
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
2,537
java
package com.tencent.mm.plugin.label; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.cd.h.d; import com.tencent.mm.kernel.g; import com.tencent.mm.model.at; import com.tencent.mm.model.aw; import com.tencent.mm.model.bw; import com.tencent.mm.model.c; import com.tencent.mm.storage.ai; import java.util.HashMap; public class e implements at { private static HashMap<Integer, h.d> eaA; private ai nHt; private d nHu; static { AppMethodBeat.i(22519); HashMap localHashMap = new HashMap(); eaA = localHashMap; localHashMap.put(Integer.valueOf("CONTACT_LABEL_TABLE".hashCode()), new e.1()); eaA.put(Integer.valueOf("CONTACT_LABEL_CACHE_TABLE".hashCode()), new e.2()); AppMethodBeat.o(22519); } public e() { AppMethodBeat.i(22514); this.nHu = new d(); AppMethodBeat.o(22514); } private static e bIY() { AppMethodBeat.i(22515); aw.ZE(); e locale1 = (e)bw.oJ("plugin.label"); e locale2 = locale1; if (locale1 == null) { locale2 = locale1; if (locale1 != null); } try { locale2 = new com/tencent/mm/plugin/label/e; locale2.<init>(); aw.ZE().a("plugin.label", locale2); return locale2; } finally { AppMethodBeat.o(22515); } } public static ai bIZ() { AppMethodBeat.i(22518); g.RN().QU(); if (bIY().nHt == null) { localObject = bIY(); aw.ZK(); ((e)localObject).nHt = new ai(c.Ru()); } Object localObject = bIY().nHt; AppMethodBeat.o(22518); return localObject; } public final HashMap<Integer, h.d> Jx() { return eaA; } public final void bA(boolean paramBoolean) { } public final void bz(boolean paramBoolean) { AppMethodBeat.i(22516); b localb = new b(); com.tencent.mm.plugin.label.a.a.nHv = localb; com.tencent.mm.av.b.fHH = localb; com.tencent.mm.sdk.b.a.xxA.c(this.nHu); AppMethodBeat.o(22516); } public final void iy(int paramInt) { } public final void onAccountRelease() { AppMethodBeat.i(22517); com.tencent.mm.plugin.label.a.a.nHv = null; com.tencent.mm.sdk.b.a.xxA.d(this.nHu); AppMethodBeat.o(22517); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes3-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.label.e * JD-Core Version: 0.6.2 */
157816f06944be025e0273ed7673f4c962fb7414
dc1abf2d0d69e2d106269d30ace4f454bd86aa48
/src/main/java/com/coursera/forum/action/TelaTopicoAction.java
2e96c9120c7cb5014c99d4dad1901d9230e8801b
[]
no_license
LuizParo/forum-project-coursera
a96a7b94dd8b5a7d75a5af50bd6ecdc91814a71a
c87f3bc7558fd1cea127b899363e3495ea790758
refs/heads/master
2020-04-17T06:44:40.545948
2016-09-08T18:56:08
2016-09-08T18:56:08
67,375,032
0
0
null
null
null
null
UTF-8
Java
false
false
1,681
java
package com.coursera.forum.action; import java.io.Serializable; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.coursera.forum.model.Comentario; import com.coursera.forum.service.ComentarioService; import com.coursera.forum.service.TopicoService; public class TelaTopicoAction implements Action, Serializable { private static final long serialVersionUID = 1L; @Override public String execute(HttpServletRequest request, HttpServletResponse response) { String txtIdTopico = request.getParameter("topico"); if(txtIdTopico != null) { HttpSession session = request.getSession(); ComentarioService comentarioService = (ComentarioService) session.getAttribute("comentarioService"); TopicoService topicoService = (TopicoService) session.getAttribute("topicoService"); int idTopico = Integer.parseInt(txtIdTopico); List<Comentario> comentariosRecuperados = comentarioService.recuperaComentariosPorTopico(idTopico); request.setAttribute("topico", topicoService.recuperaTopico(idTopico)); if(!comentariosRecuperados.isEmpty()) { request.setAttribute("comentarios", comentariosRecuperados); } String exibicao = request.getParameter("exibicao"); if(exibicao != null && exibicao.equals("true")) { request.setAttribute("exibicao", true); } } return "topico"; } }
09953fdcd183a74bdda77e19784e0328effd4c71
12bde72aafad397ebb84f2852c867e8d26529b1e
/src/main/java/csci310/service/PasswordAuthentication.java
d18410d0d14c18de1d9d2372084c762075c4c56f
[]
no_license
nandhakumar23/StockPortfolioMngmt
bee3d0aaae3e04166575b0e26fae94ea6b8efb6c
4581a1272aa325a9c10c2e645a612e07f4749033
refs/heads/master
2023-01-25T01:23:25.227034
2020-12-11T04:57:18
2020-12-11T04:57:18
320,471,227
0
0
null
null
null
null
UTF-8
Java
false
false
1,737
java
package csci310.service; import java.security.NoSuchAlgorithmException; import java.util.Date; import java.util.List; import java.util.regex.Pattern; //Security for password hashing public class PasswordAuthentication{ //Function for MD5 hashing string, returns hashed string public String MD5(String md5) throws NoSuchAlgorithmException { java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5"); byte[] array = md.digest(md5.getBytes()); StringBuffer sb = new StringBuffer(); for (int i = 0; i < array.length; ++i) { sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1,3)); } return sb.toString(); } //Main hash function, takes in raw password, and salt and round values for password //Hashing uses MD5 and salt and rounds //Returns hashed strings public String hash(String rawPassword, Long salt, Integer rounds) throws NoSuchAlgorithmException { salt = salt != null ? salt : new Date().getTime(); rounds = rounds != null ? rounds : 10; String hashedString = MD5(rawPassword + salt); for (int i = 0; i < rounds; ++i) { hashedString = MD5(hashedString); } return Long.toString(salt) + "$" + Integer.toString(rounds) + "$" + hashedString; } //Verifies that the raw password fits with the hashedpassword in the database //Returns boolean public boolean verify(String rawPassword, String hashedPassword) throws NoSuchAlgorithmException { String[] splittedList= hashedPassword.split(Pattern.quote("$")); long saltLong = Long.valueOf(splittedList[0]); int rounds = Integer.valueOf(splittedList[1]); String hashedRawPassword = hash(rawPassword, saltLong, rounds); return hashedPassword.equals(hashedRawPassword); } }
a82c54e7ef62f123197e7d3faa5003765e7c82cb
ceed8ee18ab314b40b3e5b170dceb9adedc39b1e
/android/external/icu/android_icu4j/src/main/java/android/icu/impl/Pair.java
9d53b49466649d82c9af2b5082548e2bd15e2f7b
[ "BSD-3-Clause", "NAIST-2003", "LicenseRef-scancode-unicode", "ICU", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
BPI-SINOVOIP/BPI-H3-New-Android7
c9906db06010ed6b86df53afb6e25f506ad3917c
111cb59a0770d080de7b30eb8b6398a545497080
refs/heads/master
2023-02-28T20:15:21.191551
2018-10-08T06:51:44
2018-10-08T06:51:44
132,708,249
1
1
null
null
null
null
UTF-8
Java
false
false
1,549
java
/* GENERATED SOURCE. DO NOT MODIFY. */ /* ******************************************************************************* * Copyright (C) 2014, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* */ package android.icu.impl; /** * A pair of objects: first and second. * * @param <F> first object type * @param <S> second object type * @hide Only a subset of ICU is exposed in Android */ public class Pair<F, S> { public final F first; public final S second; protected Pair(F first, S second) { this.first = first; this.second = second; } /** * Creates a pair object * @param first must be non-null * @param second must be non-null * @return The pair object. */ public static <F, S> Pair<F, S> of(F first, S second) { if (first == null || second == null) { throw new IllegalArgumentException("Pair.of requires non null values."); } return new Pair<F, S>(first, second); } @Override public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof Pair)) { return false; } Pair<?, ?> rhs = (Pair<?, ?>) other; return first.equals(rhs.first) && second.equals(rhs.second); } @Override public int hashCode() { return first.hashCode() * 37 + second.hashCode(); } }
[ "Justin" ]
Justin
d649783831cd7c3bffd3b3ad018c02fe159b6ddb
fe87699641bda8186bb2e973121e2e2859ed712f
/Games/TowerDefense/ID.java
7cf3eb4aaa98d75abd286e42bb00f46163c8cd0f
[]
no_license
anaconda121/Java-Projects
2ac9995c88eaf5d2f33d1e798253170b0b8cb7e8
472294d47edf586b906ad5dbe96438b482a8ea8d
refs/heads/master
2023-01-28T14:49:09.755551
2020-11-29T04:14:08
2020-11-29T04:14:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
90
java
/* ids for different types of gameobjects */ public enum ID { Player(), Enemy(); }
ab720b1e13d06b7318a10352e0430dad7249e12d
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-drs/src/main/java/com/amazonaws/services/drs/model/transform/NetworkInterfaceMarshaller.java
76dc5622dbf1b7d5dda7ba439c234c7af31652e8
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
2,576
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.drs.model.transform; import java.util.List; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.drs.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * NetworkInterfaceMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class NetworkInterfaceMarshaller { private static final MarshallingInfo<List> IPS_BINDING = MarshallingInfo.builder(MarshallingType.LIST).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("ips").build(); private static final MarshallingInfo<Boolean> ISPRIMARY_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("isPrimary").build(); private static final MarshallingInfo<String> MACADDRESS_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("macAddress").build(); private static final NetworkInterfaceMarshaller instance = new NetworkInterfaceMarshaller(); public static NetworkInterfaceMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(NetworkInterface networkInterface, ProtocolMarshaller protocolMarshaller) { if (networkInterface == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(networkInterface.getIps(), IPS_BINDING); protocolMarshaller.marshall(networkInterface.getIsPrimary(), ISPRIMARY_BINDING); protocolMarshaller.marshall(networkInterface.getMacAddress(), MACADDRESS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
5c5ff44d77a0e828750f3c2efcf0b2655f4df94f
521c652a8f0266e219c1d6e1a2e23f91806c2dc2
/TimerApp/app/src/androidTest/java/kz/kbtu/timerapp/ExampleInstrumentedTest.java
c31bda6732d1efb949e403391978adb803208eb7
[]
no_license
alikhan880/Mobile-Startups
b61083f16a2e58306d95bb1fe7c6bbfa8da1f78e
b5fa2e9336c999424a13baf1acabc3868af7fc1d
refs/heads/master
2021-09-12T19:59:58.696103
2018-04-20T09:55:44
2018-04-20T09:55:44
121,529,418
0
0
null
null
null
null
UTF-8
Java
false
false
733
java
package kz.kbtu.timerapp; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("kz.kbtu.timerapp", appContext.getPackageName()); } }
4606a6042d9fb51e49b284a8961a8c347bc23297
2d442d4b6dbbf8c33b77ec97a9cbc0d4c6058159
/src/Product.java
1cc3344cc0e46ae4599a6b181c5f9ec738d3a20a
[]
no_license
Fahaanraza/online-furniture-store
64f3f18acc35c2be5333f76a60d54fde04a66548
9d0a6f795e8eaf2d5b6f60a4226daa38ae402144
refs/heads/main
2023-06-02T14:01:58.865432
2021-06-21T18:29:19
2021-06-21T18:29:19
379,025,654
0
0
null
null
null
null
UTF-8
Java
false
false
14,943
java
import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.Vector; import javax.swing.table.DefaultTableModel; /** * * @author 91805 */ public class Product extends javax.swing.JFrame { /** * Creates new form Product */ public Product() { initComponents(); table_update(); } //MAGIC STORE BY FAHAAN @SuppressWarnings("unchecked") Connection con1; ResultSet rs= null; PreparedStatement pst=null; // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jMenu1 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu3 = new javax.swing.JMenu(); jMenu4 = new javax.swing.JMenu(); jMenu5 = new javax.swing.JMenu(); jMenu8 = new javax.swing.JMenu(); jMenu10 = new javax.swing.JMenu(); pname = new javax.swing.JLabel(); pid = new javax.swing.JLabel(); pri = new javax.swing.JLabel(); var = new javax.swing.JLabel(); a = new javax.swing.JTextField(); b = new javax.swing.JTextField(); c = new javax.swing.JTextField(); d = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); addproduct = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel6 = new javax.swing.JLabel(); edit = new javax.swing.JButton(); delete = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jMenu1.setText("jMenu1"); jMenu2.setText("jMenu2"); jMenuItem1.setText("jMenuItem1"); jMenu3.setText("File"); jMenuBar1.add(jMenu3); jMenu4.setText("Edit"); jMenuBar1.add(jMenu4); jMenu5.setText("jMenu5"); jMenu8.setText("jMenu8"); jMenu10.setText("jMenu10"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null); pname.setText("Product_name"); getContentPane().add(pname); pname.setBounds(100, 450, 82, 16); pid.setText("Product_ID"); getContentPane().add(pid); pid.setBounds(120, 500, 62, 16); pri.setText("Price"); getContentPane().add(pri); pri.setBounds(160, 550, 28, 16); var.setText("variant"); getContentPane().add(var); var.setBounds(150, 590, 39, 16); a.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { aActionPerformed(evt); } }); getContentPane().add(a); a.setBounds(230, 440, 160, 22); getContentPane().add(b); b.setBounds(230, 490, 160, 22); getContentPane().add(c); c.setBounds(230, 550, 160, 22); getContentPane().add(d); d.setBounds(230, 590, 160, 22); jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N jLabel5.setText("Product"); getContentPane().add(jLabel5); jLabel5.setBounds(160, 400, 83, 28); addproduct.setText("Add Product"); addproduct.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addproductActionPerformed(evt); } }); getContentPane().add(addproduct); addproduct.setBounds(160, 630, 101, 25); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Product_id", "Price", "Product_name", "variant" } ) { Class[] types = new Class [] { java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } }); jTable1.setColumnSelectionAllowed(true); jTable1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTable1MouseClicked(evt); } }); jScrollPane1.setViewportView(jTable1); jTable1.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); getContentPane().add(jScrollPane1); jScrollPane1.setBounds(490, 230, 676, 359); jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 48)); // NOI18N jLabel6.setText("Product Inventry"); getContentPane().add(jLabel6); jLabel6.setBounds(680, 170, 360, 50); edit.setText("Edit"); edit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { editActionPerformed(evt); } }); getContentPane().add(edit); edit.setBounds(140, 680, 53, 25); delete.setText("Delete"); delete.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteActionPerformed(evt); } }); getContentPane().add(delete); delete.setBounds(220, 680, 69, 25); jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\91805\\Desktop\\3.PNG")); // NOI18N jLabel1.setText("jLabel1"); getContentPane().add(jLabel1); jLabel1.setBounds(-80, 10, 540, 380); pack(); }// </editor-fold>//GEN-END:initComponents private void table_update() { int CC; try { con1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/online_furniture", "root", "0786"); //establish the connection Class.forName("com.mysql.cj.jdbc.Driver"); //load and register the driver PreparedStatement insert = con1.prepareStatement("SELECT * FROM Product"); ResultSet Rs = insert.executeQuery(); ResultSetMetaData RSMD = Rs.getMetaData(); CC = RSMD.getColumnCount(); DefaultTableModel DFT = (DefaultTableModel) jTable1.getModel(); DFT.setRowCount(0); while (Rs.next()) { Vector v2 = new Vector(); for (int ii = 1; ii <= CC; ii++) { v2.add(Rs.getString("PID")); v2.add(Rs.getString("Price")); v2.add(Rs.getString("Product_name")); v2.add(Rs.getString("variant")); } DFT.addRow(v2); } } catch (Exception e) { } } private void aActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aActionPerformed // TODO add your handling code here: }//GEN-LAST:event_aActionPerformed private void addproductActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addproductActionPerformed // TODO add your handling code here: try { con1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/online_furniture", "root", "0786"); //establish the connection Class.forName("com.mysql.cj.jdbc.Driver"); //load and register the driver Statement st = con1.createStatement(); String Product_name = a.getText(); int Product_ID = Integer.parseInt(b.getText()); int Price = Integer.parseInt(c.getText()); String variant = d.getText(); st.executeUpdate("insert into product values ('"+Product_ID+"','"+Price+"','"+Product_name+"','"+variant+"');"); JOptionPane.showMessageDialog(this,"Product added Successfull"); a.setText(""); b.setText(""); c.setText(""); d.setText(""); con1.close(); // TODO add your handling code here: } catch (ClassNotFoundException ex) { Logger.getLogger(Product.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { System.out.println(ex); } }//GEN-LAST:event_addproductActionPerformed private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked // TODO add your handling code here: DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); int selectedIndex = jTable1.getSelectedRow(); a.setText(model.getValueAt(selectedIndex, 2).toString()); b.setText(model.getValueAt(selectedIndex, 0).toString()); c.setText(model.getValueAt(selectedIndex, 1).toString()); d.setText(model.getValueAt(selectedIndex, 3).toString()); }//GEN-LAST:event_jTable1MouseClicked private void editActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editActionPerformed // TODO add your handling code here: try { con1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/online_furniture", "root", "0786"); //establish the connection Class.forName("com.mysql.cj.jdbc.Driver"); //load and register the driver Statement st = con1.createStatement(); String Pn = a.getText(); int pi = Integer.parseInt(b.getText()); int pr = Integer.parseInt(c.getText()); String vari = d.getText(); String ins = "update product SET Price="+pr+",Product_name='"+Pn+"',Variant='"+vari+"' where PID = "+pi+";"; st.executeUpdate(ins); table_update(); a.setText(""); b.setText(""); c.setText(""); d.setText(""); JOptionPane.showMessageDialog(null, "product updated"); con1.close(); //close the connection } catch (SQLException ce) { JOptionPane.showMessageDialog(null,ce); } catch (ClassNotFoundException ex) { System.out.println(ex); } }//GEN-LAST:event_editActionPerformed private void deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteActionPerformed // TODO add your handling code here: try { con1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/online_furniture", "root", "0786"); //establish the connection Class.forName("com.mysql.cj.jdbc.Driver"); //load and register the driver Statement st = con1.createStatement(); String pId = b.getText(); String ins = "delete from product where PID = "+pId+";"; st.executeUpdate(ins); table_update(); b.setText(""); a.setText(""); c.setText(""); d.setText(""); JOptionPane.showMessageDialog(null, "product deleted"); con1.close(); //close the connection } catch (SQLException ce) { JOptionPane.showMessageDialog(null,ce); } catch (ClassNotFoundException ex) { System.out.println(ex); } }//GEN-LAST:event_deleteActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Product.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Product.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Product.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Product.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Product().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField a; private javax.swing.JButton addproduct; private javax.swing.JTextField b; private javax.swing.JTextField c; private javax.swing.JTextField d; private javax.swing.JButton delete; private javax.swing.JButton edit; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu10; private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu3; private javax.swing.JMenu jMenu4; private javax.swing.JMenu jMenu5; private javax.swing.JMenu jMenu8; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; private javax.swing.JLabel pid; private javax.swing.JLabel pname; private javax.swing.JLabel pri; private javax.swing.JLabel var; // End of variables declaration//GEN-END:variables }
f17e0601e3833ad64829078743a2e3334ea5f23b
38cc67e58294c583525b9dfb25da2d8185c80b58
/app/src/main/java/com/tae/letscook/api/apiGeocoding/Location.java
fed24cf15a40ff7749a0d1d2571121e191468359
[]
no_license
epalaciosTAE/LetsCook
1aa05e345914d32dfc3f1b798d909173f012e28e
f38768fb20c215a9a23c78e917b03dc2368434da
refs/heads/master
2016-08-11T07:36:45.144747
2016-01-29T09:36:24
2016-01-29T09:36:24
49,826,896
0
0
null
2016-01-28T23:33:10
2016-01-17T17:07:24
Java
UTF-8
Java
false
false
780
java
package com.tae.letscook.api.apiGeocoding; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Location { @SerializedName("lat") @Expose private Double lat; @SerializedName("lng") @Expose private Double lng; /** * * @return * The lat */ public Double getLat() { return lat; } /** * * @param lat * The lat */ public void setLat(Double lat) { this.lat = lat; } /** * * @return * The lng */ public Double getLng() { return lng; } /** * * @param lng * The lng */ public void setLng(Double lng) { this.lng = lng; } }
2a5dfe3743cb0280d307ac81220e6c1f22a6d481
e2c50199558628f7c70d0963ca240ad2ba271c4c
/src/main/java/com/athome/factory/APizz.java
0d2f923b28bf0cc66028d6aba3a997dff340c2a8
[]
no_license
zhangxw92/hello_ssm
20dd530a72fbfb29bce0ce23898ea44188bb6616
60a6a7f5541b763ea6148c8efea989896a0e0890
refs/heads/master
2023-04-16T19:52:29.901538
2021-04-25T03:45:31
2021-04-25T03:45:31
315,345,673
0
1
null
null
null
null
UTF-8
Java
false
false
173
java
package com.athome.factory; public class APizz extends Pizz { @Override protected void prepare() { System.out.println("准备A披萨的原材料"); } }
32306ee4bea84242eeae47efd4d519bd4fade365
a9469adda77c7833452629e2b6560d4d52e6d59e
/springFrameworkDebug/libSrc/spring-framework-4.3.6.RELEASE/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
7ec529e4d124c701ca8a54a6abe1d85b0c54b3f3
[ "Apache-2.0" ]
permissive
brunoalbrito/javacodedemo
882cee2afe742e51354ca6fd60fc3546d481244c
840e84c252967e63022197116d170b3090927591
refs/heads/master
2020-04-22T17:50:36.975840
2017-06-30T11:11:47
2017-06-30T11:11:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
69,493
java
/* * Copyright 2002-2017 the original author or authors. * * 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.springframework.beans.factory.support; import java.io.IOException; import java.io.NotSerializableException; import java.io.ObjectInputStream; import java.io.ObjectStreamException; import java.io.Serializable; import java.lang.annotation.Annotation; import java.lang.ref.Reference; import java.lang.ref.WeakReference; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.IdentityHashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import javax.inject.Provider; import org.springframework.beans.BeanUtils; import org.springframework.beans.BeansException; import org.springframework.beans.TypeConverter; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCurrentlyInCreationException; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanFactoryUtils; import org.springframework.beans.factory.BeanNotOfRequiredTypeException; import org.springframework.beans.factory.CannotLoadBeanClassException; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InjectionPoint; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.SmartFactoryBean; import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.DependencyDescriptor; import org.springframework.beans.factory.config.NamedBeanHolder; import org.springframework.core.OrderComparator; import org.springframework.core.ResolvableType; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.lang.UsesJava8; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.CompositeIterator; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; /** * Default implementation of the * {@link org.springframework.beans.factory.ListableBeanFactory} and * {@link BeanDefinitionRegistry} interfaces: a full-fledged bean factory * based on bean definition objects. * * <p>Typical usage is registering all bean definitions first (possibly read * from a bean definition file), before accessing beans. Bean definition lookup * is therefore an inexpensive operation in a local bean definition table, * operating on pre-built bean definition metadata objects. * * <p>Can be used as a standalone bean factory, or as a superclass for custom * bean factories. Note that readers for specific bean definition formats are * typically implemented separately rather than as bean factory subclasses: * see for example {@link PropertiesBeanDefinitionReader} and * {@link org.springframework.beans.factory.xml.XmlBeanDefinitionReader}. * * <p>For an alternative implementation of the * {@link org.springframework.beans.factory.ListableBeanFactory} interface, * have a look at {@link StaticListableBeanFactory}, which manages existing * bean instances rather than creating new ones based on bean definitions. * * @author Rod Johnson * @author Juergen Hoeller * @author Sam Brannen * @author Costin Leau * @author Chris Beams * @author Phillip Webb * @author Stephane Nicoll * @since 16 April 2001 * @see StaticListableBeanFactory * @see PropertiesBeanDefinitionReader * @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader */ @SuppressWarnings("serial") public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFactory implements ConfigurableListableBeanFactory, BeanDefinitionRegistry, Serializable { private static Class<?> javaUtilOptionalClass = null; private static Class<?> javaxInjectProviderClass = null; static { try { javaUtilOptionalClass = ClassUtils.forName("java.util.Optional", DefaultListableBeanFactory.class.getClassLoader()); } catch (ClassNotFoundException ex) { // Java 8 not available - Optional references simply not supported then. } try { javaxInjectProviderClass = ClassUtils.forName("javax.inject.Provider", DefaultListableBeanFactory.class.getClassLoader()); } catch (ClassNotFoundException ex) { // JSR-330 API not available - Provider interface simply not supported then. } } /** Map from serialized id to factory instance */ private static final Map<String, Reference<DefaultListableBeanFactory>> serializableFactories = new ConcurrentHashMap<String, Reference<DefaultListableBeanFactory>>(8); /** Optional id for this factory, for serialization purposes */ private String serializationId; /** Whether to allow re-registration of a different definition with the same name */ private boolean allowBeanDefinitionOverriding = true; /** Whether to allow eager class loading even for lazy-init beans */ private boolean allowEagerClassLoading = true; /** Optional OrderComparator for dependency Lists and arrays */ private Comparator<Object> dependencyComparator; /** Resolver to use for checking if a bean definition is an autowire candidate */ private AutowireCandidateResolver autowireCandidateResolver = new SimpleAutowireCandidateResolver(); /** Map from dependency type to corresponding autowired value */ private final Map<Class<?>, Object> resolvableDependencies = new ConcurrentHashMap<Class<?>, Object>(16); /** Map of bean definition objects, keyed by bean name */ private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(256); /** Map of singleton and non-singleton bean names, keyed by dependency type */ private final Map<Class<?>, String[]> allBeanNamesByType = new ConcurrentHashMap<Class<?>, String[]>(64); /** Map of singleton-only bean names, keyed by dependency type */ private final Map<Class<?>, String[]> singletonBeanNamesByType = new ConcurrentHashMap<Class<?>, String[]>(64); /** List of bean definition names, in registration order */ private volatile List<String> beanDefinitionNames = new ArrayList<String>(256); /** List of names of manually registered singletons, in registration order */ private volatile Set<String> manualSingletonNames = new LinkedHashSet<String>(16); /** Cached array of bean definition names in case of frozen configuration */ private volatile String[] frozenBeanDefinitionNames; /** Whether bean definition metadata may be cached for all beans */ private volatile boolean configurationFrozen = false; /** * Create a new DefaultListableBeanFactory. */ public DefaultListableBeanFactory() { super(); } /** * Create a new DefaultListableBeanFactory with the given parent. * @param parentBeanFactory the parent BeanFactory */ public DefaultListableBeanFactory(BeanFactory parentBeanFactory) { super(parentBeanFactory); } /** * Specify an id for serialization purposes, allowing this BeanFactory to be * deserialized from this id back into the BeanFactory object, if needed. */ public void setSerializationId(String serializationId) { if (serializationId != null) { serializableFactories.put(serializationId, new WeakReference<DefaultListableBeanFactory>(this)); } else if (this.serializationId != null) { serializableFactories.remove(this.serializationId); } this.serializationId = serializationId; } /** * Return an id for serialization purposes, if specified, allowing this BeanFactory * to be deserialized from this id back into the BeanFactory object, if needed. * @since 4.1.2 */ public String getSerializationId() { return this.serializationId; } /** * Set whether it should be allowed to override bean definitions by registering * a different definition with the same name, automatically replacing the former. * If not, an exception will be thrown. This also applies to overriding aliases. * <p>Default is "true". * @see #registerBeanDefinition */ public void setAllowBeanDefinitionOverriding(boolean allowBeanDefinitionOverriding) { this.allowBeanDefinitionOverriding = allowBeanDefinitionOverriding; } /** * Return whether it should be allowed to override bean definitions by registering * a different definition with the same name, automatically replacing the former. * @since 4.1.2 */ public boolean isAllowBeanDefinitionOverriding() { return this.allowBeanDefinitionOverriding; } /** * Set whether the factory is allowed to eagerly load bean classes * even for bean definitions that are marked as "lazy-init". * <p>Default is "true". Turn this flag off to suppress class loading * for lazy-init beans unless such a bean is explicitly requested. * In particular, by-type lookups will then simply ignore bean definitions * without resolved class name, instead of loading the bean classes on * demand just to perform a type check. * @see AbstractBeanDefinition#setLazyInit */ public void setAllowEagerClassLoading(boolean allowEagerClassLoading) { this.allowEagerClassLoading = allowEagerClassLoading; } /** * Return whether the factory is allowed to eagerly load bean classes * even for bean definitions that are marked as "lazy-init". * @since 4.1.2 */ public boolean isAllowEagerClassLoading() { return this.allowEagerClassLoading; } /** * Set a {@link java.util.Comparator} for dependency Lists and arrays. * @since 4.0 * @see org.springframework.core.OrderComparator * @see org.springframework.core.annotation.AnnotationAwareOrderComparator */ public void setDependencyComparator(Comparator<Object> dependencyComparator) { this.dependencyComparator = dependencyComparator; } /** * Return the dependency comparator for this BeanFactory (may be {@code null}. * @since 4.0 */ public Comparator<Object> getDependencyComparator() { return this.dependencyComparator; } /** * Set a custom autowire candidate resolver for this BeanFactory to use * when deciding whether a bean definition should be considered as a * candidate for autowiring. */ public void setAutowireCandidateResolver(final AutowireCandidateResolver autowireCandidateResolver) { Assert.notNull(autowireCandidateResolver, "AutowireCandidateResolver must not be null"); if (autowireCandidateResolver instanceof BeanFactoryAware) { if (System.getSecurityManager() != null) { AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { ((BeanFactoryAware) autowireCandidateResolver).setBeanFactory(DefaultListableBeanFactory.this); return null; } }, getAccessControlContext()); } else { ((BeanFactoryAware) autowireCandidateResolver).setBeanFactory(this); } } this.autowireCandidateResolver = autowireCandidateResolver; } /** * Return the autowire candidate resolver for this BeanFactory (never {@code null}). */ public AutowireCandidateResolver getAutowireCandidateResolver() { return this.autowireCandidateResolver; } @Override public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) { super.copyConfigurationFrom(otherFactory); if (otherFactory instanceof DefaultListableBeanFactory) { DefaultListableBeanFactory otherListableFactory = (DefaultListableBeanFactory) otherFactory; this.allowBeanDefinitionOverriding = otherListableFactory.allowBeanDefinitionOverriding; this.allowEagerClassLoading = otherListableFactory.allowEagerClassLoading; this.dependencyComparator = otherListableFactory.dependencyComparator; // A clone of the AutowireCandidateResolver since it is potentially BeanFactoryAware... setAutowireCandidateResolver(BeanUtils.instantiateClass(getAutowireCandidateResolver().getClass())); // Make resolvable dependencies (e.g. ResourceLoader) available here as well... this.resolvableDependencies.putAll(otherListableFactory.resolvableDependencies); } } //--------------------------------------------------------------------- // Implementation of remaining BeanFactory methods //--------------------------------------------------------------------- @Override public <T> T getBean(Class<T> requiredType) throws BeansException { return getBean(requiredType, (Object[]) null); } @Override public <T> T getBean(Class<T> requiredType, Object... args) throws BeansException { NamedBeanHolder<T> namedBean = resolveNamedBean(requiredType, args); if (namedBean != null) { return namedBean.getBeanInstance(); } BeanFactory parent = getParentBeanFactory(); if (parent != null) { return parent.getBean(requiredType, args); // 通过父类获取 } throw new NoSuchBeanDefinitionException(requiredType); } //--------------------------------------------------------------------- // Implementation of ListableBeanFactory interface //--------------------------------------------------------------------- @Override public boolean containsBeanDefinition(String beanName) { Assert.notNull(beanName, "Bean name must not be null"); return this.beanDefinitionMap.containsKey(beanName); } @Override public int getBeanDefinitionCount() { return this.beanDefinitionMap.size(); } @Override public String[] getBeanDefinitionNames() { if (this.frozenBeanDefinitionNames != null) { return this.frozenBeanDefinitionNames.clone(); } else { return StringUtils.toStringArray(this.beanDefinitionNames); } } @Override public String[] getBeanNamesForType(ResolvableType type) { return doGetBeanNamesForType(type, true, true); } @Override public String[] getBeanNamesForType(Class<?> type) { return getBeanNamesForType(type, true, true); } @Override public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) { if (!isConfigurationFrozen() || type == null || !allowEagerInit) { return doGetBeanNamesForType(ResolvableType.forRawClass(type), includeNonSingletons, allowEagerInit); } Map<Class<?>, String[]> cache = (includeNonSingletons ? this.allBeanNamesByType : this.singletonBeanNamesByType); String[] resolvedBeanNames = cache.get(type); if (resolvedBeanNames != null) { return resolvedBeanNames; } resolvedBeanNames = doGetBeanNamesForType(ResolvableType.forRawClass(type), includeNonSingletons, true);//!!! if (ClassUtils.isCacheSafe(type, getBeanClassLoader())) { cache.put(type, resolvedBeanNames); } return resolvedBeanNames; } private String[] doGetBeanNamesForType(ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit) { List<String> result = new ArrayList<String>(); // Check all bean definitions. for (String beanName : this.beanDefinitionNames) { // Only consider bean as eligible if the bean name // is not defined as alias for some other bean. if (!isAlias(beanName)) { // 不是别名 try { RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);/// // Only check bean definition if it is complete. if (!mbd.isAbstract() && (allowEagerInit || ((mbd.hasBeanClass() || !mbd.isLazyInit() || isAllowEagerClassLoading())) && !requiresEagerInitForType(mbd.getFactoryBeanName()))) { // In case of FactoryBean, match object created by FactoryBean. boolean isFactoryBean = isFactoryBean(beanName, mbd); // 是个工厂类型的bean BeanDefinitionHolder dbd = mbd.getDecoratedDefinition(); boolean matchFound = (allowEagerInit || !isFactoryBean || (dbd != null && !mbd.isLazyInit()) || containsSingleton(beanName)) && (includeNonSingletons || (dbd != null ? mbd.isSingleton() : isSingleton(beanName))) && isTypeMatch(beanName, type); if (!matchFound && isFactoryBean) { // In case of FactoryBean, try to match FactoryBean instance itself next. beanName = FACTORY_BEAN_PREFIX + beanName; matchFound = (includeNonSingletons || mbd.isSingleton()) && isTypeMatch(beanName, type); } if (matchFound) { result.add(beanName); } } } catch (CannotLoadBeanClassException ex) { if (allowEagerInit) { throw ex; } // Probably contains a placeholder: let's ignore it for type matching purposes. if (this.logger.isDebugEnabled()) { this.logger.debug("Ignoring bean class loading failure for bean '" + beanName + "'", ex); } onSuppressedException(ex); } catch (BeanDefinitionStoreException ex) { if (allowEagerInit) { throw ex; } // Probably contains a placeholder: let's ignore it for type matching purposes. if (this.logger.isDebugEnabled()) { this.logger.debug("Ignoring unresolvable metadata in bean definition '" + beanName + "'", ex); } onSuppressedException(ex); } } } // Check manually registered singletons too. for (String beanName : this.manualSingletonNames) { try { // In case of FactoryBean, match object created by FactoryBean. if (isFactoryBean(beanName)) { if ((includeNonSingletons || isSingleton(beanName)) && isTypeMatch(beanName, type)) { result.add(beanName); // Match found for this bean: do not match FactoryBean itself anymore. continue; } // In case of FactoryBean, try to match FactoryBean itself next. beanName = FACTORY_BEAN_PREFIX + beanName; } // Match raw bean instance (might be raw FactoryBean). if (isTypeMatch(beanName, type)) { result.add(beanName); } } catch (NoSuchBeanDefinitionException ex) { // Shouldn't happen - probably a result of circular reference resolution... if (logger.isDebugEnabled()) { logger.debug("Failed to check manually registered singleton with name '" + beanName + "'", ex); } } } return StringUtils.toStringArray(result); } /** * Check whether the specified bean would need to be eagerly initialized * in order to determine its type. * @param factoryBeanName a factory-bean reference that the bean definition * defines a factory method for * @return whether eager initialization is necessary */ private boolean requiresEagerInitForType(String factoryBeanName) { return (factoryBeanName != null && isFactoryBean(factoryBeanName) && !containsSingleton(factoryBeanName)); } @Override public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException { return getBeansOfType(type, true, true); } @Override public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit) throws BeansException { String[] beanNames = getBeanNamesForType(type, includeNonSingletons, allowEagerInit); Map<String, T> result = new LinkedHashMap<String, T>(beanNames.length); for (String beanName : beanNames) { try { result.put(beanName, getBean(beanName, type)); } catch (BeanCreationException ex) { Throwable rootCause = ex.getMostSpecificCause(); if (rootCause instanceof BeanCurrentlyInCreationException) { BeanCreationException bce = (BeanCreationException) rootCause; if (isCurrentlyInCreation(bce.getBeanName())) { if (this.logger.isDebugEnabled()) { this.logger.debug("Ignoring match to currently created bean '" + beanName + "': " + ex.getMessage()); } onSuppressedException(ex); // Ignore: indicates a circular reference when autowiring constructors. // We want to find matches other than the currently created bean itself. continue; } } throw ex; } } return result; } @Override public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) { List<String> results = new ArrayList<String>(); for (String beanName : this.beanDefinitionNames) { BeanDefinition beanDefinition = getBeanDefinition(beanName); if (!beanDefinition.isAbstract() && findAnnotationOnBean(beanName, annotationType) != null) { results.add(beanName); } } for (String beanName : this.manualSingletonNames) { if (!results.contains(beanName) && findAnnotationOnBean(beanName, annotationType) != null) { results.add(beanName); } } return results.toArray(new String[results.size()]); } @Override public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) { String[] beanNames = getBeanNamesForAnnotation(annotationType); Map<String, Object> results = new LinkedHashMap<String, Object>(beanNames.length); for (String beanName : beanNames) { results.put(beanName, getBean(beanName)); } return results; } /** * Find a {@link Annotation} of {@code annotationType} on the specified * bean, traversing its interfaces and super classes if no annotation can be * found on the given class itself, as well as checking its raw bean class * if not found on the exposed bean reference (e.g. in case of a proxy). */ @Override public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) throws NoSuchBeanDefinitionException{ A ann = null; Class<?> beanType = getType(beanName); if (beanType != null) { ann = AnnotationUtils.findAnnotation(beanType, annotationType); } if (ann == null && containsBeanDefinition(beanName)) { BeanDefinition bd = getMergedBeanDefinition(beanName); if (bd instanceof AbstractBeanDefinition) { AbstractBeanDefinition abd = (AbstractBeanDefinition) bd; if (abd.hasBeanClass()) { ann = AnnotationUtils.findAnnotation(abd.getBeanClass(), annotationType); } } } return ann; } //--------------------------------------------------------------------- // Implementation of ConfigurableListableBeanFactory interface //--------------------------------------------------------------------- @Override public void registerResolvableDependency(Class<?> dependencyType, Object autowiredValue) { Assert.notNull(dependencyType, "Dependency type must not be null"); if (autowiredValue != null) { if (!(autowiredValue instanceof ObjectFactory || dependencyType.isInstance(autowiredValue))) { throw new IllegalArgumentException("Value [" + autowiredValue + "] does not implement specified dependency type [" + dependencyType.getName() + "]"); } this.resolvableDependencies.put(dependencyType, autowiredValue); } } @Override public boolean isAutowireCandidate(String beanName, DependencyDescriptor descriptor) throws NoSuchBeanDefinitionException { return isAutowireCandidate(beanName, descriptor, getAutowireCandidateResolver()); // “参与自动装配的bean” } /** * Determine whether the specified bean definition qualifies as an autowire candidate, * to be injected into other beans which declare a dependency of matching type. * @param beanName the name of the bean definition to check * @param descriptor the descriptor of the dependency to resolve * @param resolver the AutowireCandidateResolver to use for the actual resolution algorithm * @return whether the bean should be considered as autowire candidate */ protected boolean isAutowireCandidate(String beanName, DependencyDescriptor descriptor, AutowireCandidateResolver resolver) throws NoSuchBeanDefinitionException { String beanDefinitionName = BeanFactoryUtils.transformedBeanName(beanName); if (containsBeanDefinition(beanDefinitionName)) { // 包含指定beanName的定义 return isAutowireCandidate(beanName, getMergedLocalBeanDefinition(beanDefinitionName), descriptor, resolver); // “参与自动装配的bean” } else if (containsSingleton(beanName)) { // 包含指定beanName的实例 return isAutowireCandidate(beanName, new RootBeanDefinition(getType(beanName)), descriptor, resolver); } BeanFactory parent = getParentBeanFactory(); if (parent instanceof DefaultListableBeanFactory) { // No bean definition found in this factory -> delegate to parent. return ((DefaultListableBeanFactory) parent).isAutowireCandidate(beanName, descriptor, resolver); } else if (parent instanceof ConfigurableListableBeanFactory) { // If no DefaultListableBeanFactory, can't pass the resolver along. return ((ConfigurableListableBeanFactory) parent).isAutowireCandidate(beanName, descriptor); } else { return true; } } /** * Determine whether the specified bean definition qualifies as an autowire candidate, * to be injected into other beans which declare a dependency of matching type. * @param beanName the name of the bean definition to check * @param mbd the merged bean definition to check * @param descriptor the descriptor of the dependency to resolve * @param resolver the AutowireCandidateResolver to use for the actual resolution algorithm * @return whether the bean should be considered as autowire candidate */ protected boolean isAutowireCandidate(String beanName, RootBeanDefinition mbd, DependencyDescriptor descriptor, AutowireCandidateResolver resolver) { String beanDefinitionName = BeanFactoryUtils.transformedBeanName(beanName); resolveBeanClass(mbd, beanDefinitionName); if (mbd.isFactoryMethodUnique) { boolean resolve; synchronized (mbd.constructorArgumentLock) { resolve = (mbd.resolvedConstructorOrFactoryMethod == null); } if (resolve) { new ConstructorResolver(this).resolveFactoryMethodIfPossible(mbd); // !!! 解析出工厂方法 } } // resolver === org.springframework.beans.factory.support.SimpleAutowireCandidateResolver return resolver.isAutowireCandidate( new BeanDefinitionHolder(mbd, beanName, getAliases(beanDefinitionName)), descriptor); // “参与自动装配的bean” } @Override public BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException { BeanDefinition bd = this.beanDefinitionMap.get(beanName); if (bd == null) { if (this.logger.isTraceEnabled()) { this.logger.trace("No bean named '" + beanName + "' found in " + this); } throw new NoSuchBeanDefinitionException(beanName); } return bd; } @Override public Iterator<String> getBeanNamesIterator() { CompositeIterator<String> iterator = new CompositeIterator<String>(); iterator.add(this.beanDefinitionNames.iterator()); iterator.add(this.manualSingletonNames.iterator()); return iterator; } @Override public void clearMetadataCache() { super.clearMetadataCache(); clearByTypeCache(); } @Override public void freezeConfiguration() { this.configurationFrozen = true; this.frozenBeanDefinitionNames = StringUtils.toStringArray(this.beanDefinitionNames); } @Override public boolean isConfigurationFrozen() { return this.configurationFrozen; } /** * Considers all beans as eligible for metadata caching * if the factory's configuration has been marked as frozen. * @see #freezeConfiguration() */ @Override protected boolean isBeanEligibleForMetadataCaching(String beanName) { return (this.configurationFrozen || super.isBeanEligibleForMetadataCaching(beanName)); } @Override public void preInstantiateSingletons() throws BeansException { if (this.logger.isDebugEnabled()) { this.logger.debug("Pre-instantiating singletons in " + this); } // Iterate over a copy to allow for init methods which in turn register new bean definitions. // While this may not be part of the regular factory bootstrap, it does otherwise work fine. List<String> beanNames = new ArrayList<String>(this.beanDefinitionNames); // Trigger initialization of all non-lazy singleton beans... for (String beanName : beanNames) { RootBeanDefinition bd = getMergedLocalBeanDefinition(beanName); if (!bd.isAbstract() && bd.isSingleton() && !bd.isLazyInit()) { // 是单例的(没有配置scope也是单例) if (isFactoryBean(beanName)) { final FactoryBean<?> factory = (FactoryBean<?>) getBean(FACTORY_BEAN_PREFIX + beanName); boolean isEagerInit; if (System.getSecurityManager() != null && factory instanceof SmartFactoryBean) { isEagerInit = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { return ((SmartFactoryBean<?>) factory).isEagerInit(); } }, getAccessControlContext()); } else { isEagerInit = (factory instanceof SmartFactoryBean && ((SmartFactoryBean<?>) factory).isEagerInit()); } if (isEagerInit) { getBean(beanName); } } else { getBean(beanName); } } } // Trigger post-initialization callback for all applicable beans... for (String beanName : beanNames) { Object singletonInstance = getSingleton(beanName); if (singletonInstance instanceof SmartInitializingSingleton) { final SmartInitializingSingleton smartSingleton = (SmartInitializingSingleton) singletonInstance; if (System.getSecurityManager() != null) { AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { smartSingleton.afterSingletonsInstantiated(); return null; } }, getAccessControlContext()); } else { smartSingleton.afterSingletonsInstantiated(); } } } } //--------------------------------------------------------------------- // Implementation of BeanDefinitionRegistry interface //--------------------------------------------------------------------- @Override public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) throws BeanDefinitionStoreException { Assert.hasText(beanName, "Bean name must not be empty"); Assert.notNull(beanDefinition, "BeanDefinition must not be null"); if (beanDefinition instanceof AbstractBeanDefinition) { try { ((AbstractBeanDefinition) beanDefinition).validate(); } catch (BeanDefinitionValidationException ex) { throw new BeanDefinitionStoreException(beanDefinition.getResourceDescription(), beanName, "Validation of bean definition failed", ex); } } BeanDefinition oldBeanDefinition; oldBeanDefinition = this.beanDefinitionMap.get(beanName); if (oldBeanDefinition != null) { if (!isAllowBeanDefinitionOverriding()) { throw new BeanDefinitionStoreException(beanDefinition.getResourceDescription(), beanName, "Cannot register bean definition [" + beanDefinition + "] for bean '" + beanName + "': There is already [" + oldBeanDefinition + "] bound."); } else if (oldBeanDefinition.getRole() < beanDefinition.getRole()) { // e.g. was ROLE_APPLICATION, now overriding with ROLE_SUPPORT or ROLE_INFRASTRUCTURE if (this.logger.isWarnEnabled()) { this.logger.warn("Overriding user-defined bean definition for bean '" + beanName + "' with a framework-generated bean definition: replacing [" + oldBeanDefinition + "] with [" + beanDefinition + "]"); } } else if (!beanDefinition.equals(oldBeanDefinition)) { if (this.logger.isInfoEnabled()) { this.logger.info("Overriding bean definition for bean '" + beanName + "' with a different definition: replacing [" + oldBeanDefinition + "] with [" + beanDefinition + "]"); } } else { if (this.logger.isDebugEnabled()) { this.logger.debug("Overriding bean definition for bean '" + beanName + "' with an equivalent definition: replacing [" + oldBeanDefinition + "] with [" + beanDefinition + "]"); } } this.beanDefinitionMap.put(beanName, beanDefinition); } else { if (hasBeanCreationStarted()) { // 已经有bean被创建 // Cannot modify startup-time collection elements anymore (for stable iteration) synchronized (this.beanDefinitionMap) { this.beanDefinitionMap.put(beanName, beanDefinition); List<String> updatedDefinitions = new ArrayList<String>(this.beanDefinitionNames.size() + 1); updatedDefinitions.addAll(this.beanDefinitionNames); updatedDefinitions.add(beanName); this.beanDefinitionNames = updatedDefinitions; if (this.manualSingletonNames.contains(beanName)) { Set<String> updatedSingletons = new LinkedHashSet<String>(this.manualSingletonNames); updatedSingletons.remove(beanName); this.manualSingletonNames = updatedSingletons; } } } else { // Still in startup registration phase this.beanDefinitionMap.put(beanName, beanDefinition); this.beanDefinitionNames.add(beanName); this.manualSingletonNames.remove(beanName); } this.frozenBeanDefinitionNames = null; } if (oldBeanDefinition != null || containsSingleton(beanName)) { resetBeanDefinition(beanName); } } @Override public void removeBeanDefinition(String beanName) throws NoSuchBeanDefinitionException { Assert.hasText(beanName, "'beanName' must not be empty"); BeanDefinition bd = this.beanDefinitionMap.remove(beanName); if (bd == null) { if (this.logger.isTraceEnabled()) { this.logger.trace("No bean named '" + beanName + "' found in " + this); } throw new NoSuchBeanDefinitionException(beanName); } if (hasBeanCreationStarted()) { // Cannot modify startup-time collection elements anymore (for stable iteration) synchronized (this.beanDefinitionMap) { List<String> updatedDefinitions = new ArrayList<String>(this.beanDefinitionNames); updatedDefinitions.remove(beanName); this.beanDefinitionNames = updatedDefinitions; } } else { // Still in startup registration phase this.beanDefinitionNames.remove(beanName); } this.frozenBeanDefinitionNames = null; resetBeanDefinition(beanName); } /** * Reset all bean definition caches for the given bean, * including the caches of beans that are derived from it. * @param beanName the name of the bean to reset */ protected void resetBeanDefinition(String beanName) { // Remove the merged bean definition for the given bean, if already created. clearMergedBeanDefinition(beanName); // Remove corresponding bean from singleton cache, if any. Shouldn't usually // be necessary, rather just meant for overriding a context's default beans // (e.g. the default StaticMessageSource in a StaticApplicationContext). destroySingleton(beanName); // Reset all bean definitions that have the given bean as parent (recursively). for (String bdName : this.beanDefinitionNames) { if (!beanName.equals(bdName)) { BeanDefinition bd = this.beanDefinitionMap.get(bdName); if (beanName.equals(bd.getParentName())) { resetBeanDefinition(bdName); } } } } /** * Only allows alias overriding if bean definition overriding is allowed. */ @Override protected boolean allowAliasOverriding() { return isAllowBeanDefinitionOverriding(); } @Override public void registerSingleton(String beanName, Object singletonObject) throws IllegalStateException { super.registerSingleton(beanName, singletonObject); if (hasBeanCreationStarted()) { // Cannot modify startup-time collection elements anymore (for stable iteration) synchronized (this.beanDefinitionMap) { if (!this.beanDefinitionMap.containsKey(beanName)) { Set<String> updatedSingletons = new LinkedHashSet<String>(this.manualSingletonNames.size() + 1); updatedSingletons.addAll(this.manualSingletonNames); updatedSingletons.add(beanName); this.manualSingletonNames = updatedSingletons; } } } else { // Still in startup registration phase if (!this.beanDefinitionMap.containsKey(beanName)) { this.manualSingletonNames.add(beanName); } } clearByTypeCache(); } @Override public void destroySingleton(String beanName) { super.destroySingleton(beanName); this.manualSingletonNames.remove(beanName); clearByTypeCache(); } @Override public void destroySingletons() { super.destroySingletons(); this.manualSingletonNames.clear(); clearByTypeCache(); } /** * Remove any assumptions about by-type mappings. */ private void clearByTypeCache() { this.allBeanNamesByType.clear(); this.singletonBeanNamesByType.clear(); } //--------------------------------------------------------------------- // Dependency resolution functionality //--------------------------------------------------------------------- @Override public <T> NamedBeanHolder<T> resolveNamedBean(Class<T> requiredType) throws BeansException { NamedBeanHolder<T> namedBean = resolveNamedBean(requiredType, (Object[]) null); if (namedBean != null) { return namedBean; } BeanFactory parent = getParentBeanFactory(); if (parent instanceof AutowireCapableBeanFactory) { return ((AutowireCapableBeanFactory) parent).resolveNamedBean(requiredType); } throw new NoSuchBeanDefinitionException(requiredType); } @SuppressWarnings("unchecked") private <T> NamedBeanHolder<T> resolveNamedBean(Class<T> requiredType, Object... args) throws BeansException { Assert.notNull(requiredType, "Required type must not be null"); String[] candidateNames = getBeanNamesForType(requiredType); // array("beanName1","beanName2") if (candidateNames.length > 1) { List<String> autowireCandidates = new ArrayList<String>(candidateNames.length); for (String beanName : candidateNames) { if (!containsBeanDefinition(beanName) || getBeanDefinition(beanName).isAutowireCandidate()) { // 自动装配 !!! autowireCandidates.add(beanName); } } if (!autowireCandidates.isEmpty()) { candidateNames = autowireCandidates.toArray(new String[autowireCandidates.size()]); } } if (candidateNames.length == 1) { String beanName = candidateNames[0]; return new NamedBeanHolder<T>(beanName, getBean(beanName, requiredType, args)); } else if (candidateNames.length > 1) { Map<String, Object> candidates = new LinkedHashMap<String, Object>(candidateNames.length); for (String beanName : candidateNames) { if (containsSingleton(beanName)) { candidates.put(beanName, getBean(beanName, requiredType, args)); } else { candidates.put(beanName, getType(beanName)); } } String candidateName = determinePrimaryCandidate(candidates, requiredType); if (candidateName == null) { candidateName = determineHighestPriorityCandidate(candidates, requiredType); } if (candidateName != null) { Object beanInstance = candidates.get(candidateName); if (beanInstance instanceof Class) { beanInstance = getBean(candidateName, requiredType, args); } return new NamedBeanHolder<T>(candidateName, (T) beanInstance); } throw new NoUniqueBeanDefinitionException(requiredType, candidates.keySet()); } return null; } @Override public Object resolveDependency(DependencyDescriptor descriptor, String requestingBeanName, Set<String> autowiredBeanNames, TypeConverter typeConverter) throws BeansException { // descriptor === org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.AutowireByTypeDependencyDescriptor descriptor.initParameterNameDiscovery(getParameterNameDiscoverer()); if (javaUtilOptionalClass == descriptor.getDependencyType()) {// !!! 参数类型是 Optional return new OptionalDependencyFactory().createOptionalDependency(descriptor, requestingBeanName); // 返回bean实例 } else if (ObjectFactory.class == descriptor.getDependencyType() || // !!! 参数类型是 ObjectFactory ObjectProvider.class == descriptor.getDependencyType()) { // !!! 参数类型是 ObjectProvider return new DependencyObjectProvider(descriptor, requestingBeanName); } else if (javaxInjectProviderClass == descriptor.getDependencyType()) { // !!! 参数类型 javax.inject.Provider return new Jsr330ProviderFactory().createDependencyProvider(descriptor, requestingBeanName); } else { // 其他参数类型 Object result = getAutowireCandidateResolver().getLazyResolutionProxyIfNecessary( descriptor, requestingBeanName); // org.springframework.beans.factory.support.SimpleAutowireCandidateResolver if (result == null) { result = doResolveDependency(descriptor, requestingBeanName, autowiredBeanNames, typeConverter);// !!! } return result; } } public Object doResolveDependency(DependencyDescriptor descriptor, String beanName, Set<String> autowiredBeanNames, TypeConverter typeConverter) throws BeansException { // descriptor === cn.java.demo.beantag.internal.beanwrapper.AutowireByTypeDependencyDescriptor InjectionPoint previousInjectionPoint = ConstructorResolver.setCurrentInjectionPoint(descriptor); try { Object shortcut = descriptor.resolveShortcut(this); if (shortcut != null) { return shortcut; } Class<?> type = descriptor.getDependencyType(); // 方法参数类型,如: Optional、Bean1、 Object value = getAutowireCandidateResolver().getSuggestedValue(descriptor); //推荐值 org.springframework.beans.factory.support.SimpleAutowireCandidateResolver if (value != null) { // value === null if (value instanceof String) { String strVal = resolveEmbeddedValue((String) value); BeanDefinition bd = (beanName != null && containsBean(beanName) ? getMergedBeanDefinition(beanName) : null); value = evaluateBeanDefinitionString(strVal, bd); } TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter()); return (descriptor.getField() != null ? converter.convertIfNecessary(value, type, descriptor.getField()) : converter.convertIfNecessary(value, type, descriptor.getMethodParameter())); } Object multipleBeans = resolveMultipleBeans(descriptor, beanName, autowiredBeanNames, typeConverter); // 参数类型是 Array/Collection/Map if (multipleBeans != null) { // multipleBeans===null return multipleBeans; } // !!!!! --- 根据autowire-candidate="true"配置选择“参与自动装配的bean”列表 Map<String, Object> matchingBeans = findAutowireCandidates(beanName, type, descriptor); // !!! 获取 “参与自动装配的bean” 列表 if (matchingBeans.isEmpty()) { if (descriptor.isRequired()) { raiseNoMatchingBeanFound(type, descriptor.getResolvableType(), descriptor);// !!!! } return null; } String autowiredBeanName; Object instanceCandidate; if (matchingBeans.size() > 1) { // 根据类型匹配到的bean超过一个 autowiredBeanName = determineAutowireCandidate(matchingBeans, descriptor); // 选择规则是:1、检查有配置primary的bean ; 2、根据bean优先权order 3、根据参数名获取到bean if (autowiredBeanName == null) { if (descriptor.isRequired() || !indicatesMultipleBeans(type)) { return descriptor.resolveNotUnique(type, matchingBeans); } else { // In case of an optional Collection/Map, silently ignore a non-unique case: // possibly it was meant to be an empty collection of multiple regular beans // (before 4.3 in particular when we didn't even look for collection beans). return null; } } instanceCandidate = matchingBeans.get(autowiredBeanName); } else { // We have exactly one match. Map.Entry<String, Object> entry = matchingBeans.entrySet().iterator().next(); autowiredBeanName = entry.getKey(); instanceCandidate = entry.getValue(); } if (autowiredBeanNames != null) { autowiredBeanNames.add(autowiredBeanName); } return (instanceCandidate instanceof Class ? // 如果instanceCandidate实现了 Class接口 descriptor.resolveCandidate(autowiredBeanName, type, this) : instanceCandidate); // !!!! } finally { ConstructorResolver.setCurrentInjectionPoint(previousInjectionPoint); } } private Object resolveMultipleBeans(DependencyDescriptor descriptor, String beanName, Set<String> autowiredBeanNames, TypeConverter typeConverter) { Class<?> type = descriptor.getDependencyType(); // 方法参数类型 Array/Collection/Map if (type.isArray()) { Class<?> componentType = type.getComponentType(); ResolvableType resolvableType = descriptor.getResolvableType(); Class<?> resolvedArrayType = resolvableType.resolve(); if (resolvedArrayType != null && resolvedArrayType != type) { type = resolvedArrayType; componentType = resolvableType.getComponentType().resolve(); } if (componentType == null) { return null; } Map<String, Object> matchingBeans = findAutowireCandidates(beanName, componentType, new MultiElementDescriptor(descriptor)); if (matchingBeans.isEmpty()) { return null; } if (autowiredBeanNames != null) { autowiredBeanNames.addAll(matchingBeans.keySet()); } TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter()); Object result = converter.convertIfNecessary(matchingBeans.values(), type); if (getDependencyComparator() != null && result instanceof Object[]) { Arrays.sort((Object[]) result, adaptDependencyComparator(matchingBeans)); } return result; } else if (Collection.class.isAssignableFrom(type) && type.isInterface()) { Class<?> elementType = descriptor.getResolvableType().asCollection().resolveGeneric(); if (elementType == null) { return null; } Map<String, Object> matchingBeans = findAutowireCandidates(beanName, elementType, new MultiElementDescriptor(descriptor)); if (matchingBeans.isEmpty()) { return null; } if (autowiredBeanNames != null) { autowiredBeanNames.addAll(matchingBeans.keySet()); } TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter()); Object result = converter.convertIfNecessary(matchingBeans.values(), type); if (getDependencyComparator() != null && result instanceof List) { Collections.sort((List<?>) result, adaptDependencyComparator(matchingBeans)); } return result; } else if (Map.class == type) { ResolvableType mapType = descriptor.getResolvableType().asMap(); Class<?> keyType = mapType.resolveGeneric(0); if (String.class != keyType) { return null; } Class<?> valueType = mapType.resolveGeneric(1); if (valueType == null) { return null; } Map<String, Object> matchingBeans = findAutowireCandidates(beanName, valueType, new MultiElementDescriptor(descriptor)); if (matchingBeans.isEmpty()) { return null; } if (autowiredBeanNames != null) { autowiredBeanNames.addAll(matchingBeans.keySet()); } return matchingBeans; } else { return null; } } private boolean indicatesMultipleBeans(Class<?> type) { return (type.isArray() || (type.isInterface() && (Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type)))); } private Comparator<Object> adaptDependencyComparator(Map<String, Object> matchingBeans) { Comparator<Object> comparator = getDependencyComparator(); if (comparator instanceof OrderComparator) { return ((OrderComparator) comparator).withSourceProvider( createFactoryAwareOrderSourceProvider(matchingBeans)); } else { return comparator; } } private FactoryAwareOrderSourceProvider createFactoryAwareOrderSourceProvider(Map<String, Object> beans) { IdentityHashMap<Object, String> instancesToBeanNames = new IdentityHashMap<Object, String>(); for (Map.Entry<String, Object> entry : beans.entrySet()) { instancesToBeanNames.put(entry.getValue(), entry.getKey()); } return new FactoryAwareOrderSourceProvider(instancesToBeanNames); } /** * Find bean instances that match the required type. * Called during autowiring for the specified bean. * @param beanName the name of the bean that is about to be wired * @param requiredType the actual type of bean to look for * (may be an array component type or collection element type) * @param descriptor the descriptor of the dependency to resolve * @return a Map of candidate names and candidate instances that match * the required type (never {@code null}) * @throws BeansException in case of errors * @see #autowireByType * @see #autowireConstructor */ protected Map<String, Object> findAutowireCandidates( String beanName, Class<?> requiredType, DependencyDescriptor descriptor) { String[] candidateNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors( this, requiredType, true, descriptor.isEager()); // 根据bean的类型获取符合条件的bean列表 Map<String, Object> result = new LinkedHashMap<String, Object>(candidateNames.length); for (Class<?> autowiringType : this.resolvableDependencies.keySet()) { if (autowiringType.isAssignableFrom(requiredType)) { // requiredType 是 autowiringType 的子类 Object autowiringValue = this.resolvableDependencies.get(autowiringType); // 父类对象 autowiringValue = AutowireUtils.resolveAutowiringValue(autowiringValue, requiredType); if (requiredType.isInstance(autowiringValue)) { result.put(ObjectUtils.identityToString(autowiringValue), autowiringValue); // 动态生成bean的id break; } } } for (String candidate : candidateNames) { // descriptor对象里面是获取不到参数名的 if (!isSelfReference(beanName, candidate) && isAutowireCandidate(candidate, descriptor)) { // “没有自引用” 且 “参与自动装配的bean” addCandidateEntry(result, candidate, descriptor, requiredType); // 符合条件,加入集合 } } if (result.isEmpty() && !indicatesMultipleBeans(requiredType)) { // 不是数组类型 // Consider fallback matches if the first pass failed to find anything... DependencyDescriptor fallbackDescriptor = descriptor.forFallbackMatch(); // !!!!!!!!! 没有匹配到,重新构造一个DependencyDescriptor // fallbackDescriptor对象里面是可以获取到参数名的 for (String candidate : candidateNames) { if (!isSelfReference(beanName, candidate) && isAutowireCandidate(candidate, fallbackDescriptor)) { // “没有自引用” 且 “参与自动装配的bean” addCandidateEntry(result, candidate, descriptor, requiredType); } } if (result.isEmpty()) { // Consider self references as a final pass... // but in the case of a dependency collection, not the very same bean itself. for (String candidate : candidateNames) { if (isSelfReference(beanName, candidate) && (!(descriptor instanceof MultiElementDescriptor) || !beanName.equals(candidate)) && isAutowireCandidate(candidate, fallbackDescriptor)) { addCandidateEntry(result, candidate, descriptor, requiredType); } } } } return result; } /** * Add an entry to the candidate map: a bean instance if available or just the resolved * type, preventing early bean initialization ahead of primary candidate selection. */ private void addCandidateEntry(Map<String, Object> candidates, String candidateName, DependencyDescriptor descriptor, Class<?> requiredType) { if (descriptor instanceof MultiElementDescriptor || containsSingleton(candidateName)) { candidates.put(candidateName, descriptor.resolveCandidate(candidateName, requiredType, this)); } else { candidates.put(candidateName, getType(candidateName)); // bean名称 ,bean类型 } } /** * Determine the autowire candidate in the given set of beans. * <p>Looks for {@code @Primary} and {@code @Priority} (in that order). * @param candidates a Map of candidate names and candidate instances * that match the required type, as returned by {@link #findAutowireCandidates} * @param descriptor the target dependency to match against * @return the name of the autowire candidate, or {@code null} if none found */ protected String determineAutowireCandidate(Map<String, Object> candidates, DependencyDescriptor descriptor) { Class<?> requiredType = descriptor.getDependencyType(); String primaryCandidate = determinePrimaryCandidate(candidates, requiredType); // 检查有配置primary的bean --- 1 if (primaryCandidate != null) { return primaryCandidate; } String priorityCandidate = determineHighestPriorityCandidate(candidates, requiredType); // 根据优先权order获取bean --- 2 if (priorityCandidate != null) { return priorityCandidate; } // Fallback for (Map.Entry<String, Object> entry : candidates.entrySet()) { String candidateName = entry.getKey(); Object beanInstance = entry.getValue(); System.out.println(descriptor.getDependencyName()); if ( (beanInstance != null && this.resolvableDependencies.containsValue(beanInstance)) || matchesBeanName(candidateName, descriptor.getDependencyName()) // AutowireByTypeDependencyDescriptor.getDependencyName() 始终返回null ) { // 根据参数名进行匹配bean --- 3 // descriptor.getDependencyName() --- 始终返回null return candidateName; } } return null; } /** * Determine the primary candidate in the given set of beans. * @param candidates a Map of candidate names and candidate instances * (or candidate classes if not created yet) that match the required type * @param requiredType the target dependency type to match against * @return the name of the primary candidate, or {@code null} if none found * @see #isPrimary(String, Object) */ protected String determinePrimaryCandidate(Map<String, Object> candidates, Class<?> requiredType) { String primaryBeanName = null; for (Map.Entry<String, Object> entry : candidates.entrySet()) { String candidateBeanName = entry.getKey(); // bean1 Object beanInstance = entry.getValue(); // cn.java.bean.Bean1 if (isPrimary(candidateBeanName, beanInstance)) { if (primaryBeanName != null) { boolean candidateLocal = containsBeanDefinition(candidateBeanName); boolean primaryLocal = containsBeanDefinition(primaryBeanName); if (candidateLocal && primaryLocal) { // 同一类型的只能有一个为primary的bean throw new NoUniqueBeanDefinitionException(requiredType, candidates.size(), "more than one 'primary' bean found among candidates: " + candidates.keySet()); } else if (candidateLocal) { primaryBeanName = candidateBeanName; } } else { primaryBeanName = candidateBeanName; } } } return primaryBeanName; } /** * Determine the candidate with the highest priority in the given set of beans. * <p>Based on {@code @javax.annotation.Priority}. As defined by the related * {@link org.springframework.core.Ordered} interface, the lowest value has * the highest priority. * @param candidates a Map of candidate names and candidate instances * (or candidate classes if not created yet) that match the required type * @param requiredType the target dependency type to match against * @return the name of the candidate with the highest priority, * or {@code null} if none found * @see #getPriority(Object) */ protected String determineHighestPriorityCandidate(Map<String, Object> candidates, Class<?> requiredType) { String highestPriorityBeanName = null; Integer highestPriority = null; for (Map.Entry<String, Object> entry : candidates.entrySet()) { String candidateBeanName = entry.getKey(); Object beanInstance = entry.getValue(); Integer candidatePriority = getPriority(beanInstance); // 实例的优先权order if (candidatePriority != null) { if (highestPriorityBeanName != null) { if (candidatePriority.equals(highestPriority)) { // 两个bean一样的优先权 throw new NoUniqueBeanDefinitionException(requiredType, candidates.size(), "Multiple beans found with the same priority ('" + highestPriority + "') among candidates: " + candidates.keySet()); } else if (candidatePriority < highestPriority) { // order值越小,权重越高 highestPriorityBeanName = candidateBeanName; highestPriority = candidatePriority; } } else { highestPriorityBeanName = candidateBeanName; highestPriority = candidatePriority; } } } return highestPriorityBeanName; } /** * Return whether the bean definition for the given bean name has been * marked as a primary bean. * @param beanName the name of the bean * @param beanInstance the corresponding bean instance (can be null) * @return whether the given bean qualifies as primary */ protected boolean isPrimary(String beanName, Object beanInstance) { if (containsBeanDefinition(beanName)) { return getMergedLocalBeanDefinition(beanName).isPrimary(); } BeanFactory parent = getParentBeanFactory(); return (parent instanceof DefaultListableBeanFactory && ((DefaultListableBeanFactory) parent).isPrimary(beanName, beanInstance)); } /** * Return the priority assigned for the given bean instance by * the {@code javax.annotation.Priority} annotation. * <p>The default implementation delegates to the specified * {@link #setDependencyComparator dependency comparator}, checking its * {@link OrderComparator#getPriority method} if it is an extension of * Spring's common {@link OrderComparator} - typically, an * {@link org.springframework.core.annotation.AnnotationAwareOrderComparator}. * If no such comparator is present, this implementation returns {@code null}. * @param beanInstance the bean instance to check (can be {@code null}) * @return the priority assigned to that bean or {@code null} if none is set */ protected Integer getPriority(Object beanInstance) { Comparator<Object> comparator = getDependencyComparator(); if (comparator instanceof OrderComparator) { return ((OrderComparator) comparator).getPriority(beanInstance); } return null; } /** * Determine whether the given candidate name matches the bean name or the aliases * stored in this bean definition. */ protected boolean matchesBeanName(String beanName, String candidateName) { return (candidateName != null && (candidateName.equals(beanName) || ObjectUtils.containsElement(getAliases(beanName), candidateName))); } /** * Determine whether the given beanName/candidateName pair indicates a self reference, * i.e. whether the candidate points back to the original bean or to a factory method * on the original bean. */ private boolean isSelfReference(String beanName, String candidateName) { return (beanName != null && candidateName != null && (beanName.equals(candidateName) || (containsBeanDefinition(candidateName) && beanName.equals(getMergedLocalBeanDefinition(candidateName).getFactoryBeanName())))); } /** * Raise a NoSuchBeanDefinitionException or BeanNotOfRequiredTypeException * for an unresolvable dependency. */ private void raiseNoMatchingBeanFound( Class<?> type, ResolvableType resolvableType, DependencyDescriptor descriptor) throws BeansException { checkBeanNotOfRequiredType(type, descriptor); //!!! throw new NoSuchBeanDefinitionException(resolvableType, "expected at least 1 bean which qualifies as autowire candidate. " + "Dependency annotations: " + ObjectUtils.nullSafeToString(descriptor.getAnnotations())); } /** * Raise a BeanNotOfRequiredTypeException for an unresolvable dependency, if applicable, * i.e. if the target type of the bean would match but an exposed proxy doesn't. */ private void checkBeanNotOfRequiredType(Class<?> type, DependencyDescriptor descriptor) { for (String beanName : this.beanDefinitionNames) { RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName); Class<?> targetType = mbd.getTargetType(); if (targetType != null && type.isAssignableFrom(targetType) && isAutowireCandidate(beanName, mbd, descriptor, getAutowireCandidateResolver())) { // Probably a proxy interfering with target type match -> throw meaningful exception. Object beanInstance = getSingleton(beanName, false); Class<?> beanType = (beanInstance != null ? beanInstance.getClass() : predictBeanType(beanName, mbd)); // !!! predictBeanType if (!type.isAssignableFrom((beanType))) { throw new BeanNotOfRequiredTypeException(beanName, type, beanType); } } } BeanFactory parent = getParentBeanFactory(); if (parent instanceof DefaultListableBeanFactory) { ((DefaultListableBeanFactory) parent).checkBeanNotOfRequiredType(type, descriptor); } } @Override public String toString() { StringBuilder sb = new StringBuilder(ObjectUtils.identityToString(this)); sb.append(": defining beans ["); sb.append(StringUtils.collectionToCommaDelimitedString(this.beanDefinitionNames)); sb.append("]; "); BeanFactory parent = getParentBeanFactory(); if (parent == null) { sb.append("root of factory hierarchy"); } else { sb.append("parent: ").append(ObjectUtils.identityToString(parent)); } return sb.toString(); } //--------------------------------------------------------------------- // Serialization support //--------------------------------------------------------------------- private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { throw new NotSerializableException("DefaultListableBeanFactory itself is not deserializable - " + "just a SerializedBeanFactoryReference is"); } protected Object writeReplace() throws ObjectStreamException { if (this.serializationId != null) { return new SerializedBeanFactoryReference(this.serializationId); } else { throw new NotSerializableException("DefaultListableBeanFactory has no serialization id"); } } /** * Minimal id reference to the factory. * Resolved to the actual factory instance on deserialization. */ private static class SerializedBeanFactoryReference implements Serializable { private final String id; public SerializedBeanFactoryReference(String id) { this.id = id; } private Object readResolve() { Reference<?> ref = serializableFactories.get(this.id); if (ref != null) { Object result = ref.get(); if (result != null) { return result; } } // Lenient fallback: dummy factory in case of original factory not found... return new StaticListableBeanFactory(Collections.<String, Object> emptyMap()); } } /** * Separate inner class for avoiding a hard dependency on the {@code javax.inject} API. */ @UsesJava8 private class OptionalDependencyFactory { public Object createOptionalDependency(DependencyDescriptor descriptor, String beanName, final Object... args) { DependencyDescriptor descriptorToUse = new NestedDependencyDescriptor(descriptor) { @Override public boolean isRequired() { return false; } @Override public Object resolveCandidate(String beanName, Class<?> requiredType, BeanFactory beanFactory) { return (!ObjectUtils.isEmpty(args) ? beanFactory.getBean(beanName, requiredType, args) : super.resolveCandidate(beanName, requiredType, beanFactory)); } }; return Optional.ofNullable(doResolveDependency(descriptorToUse, beanName, null, null)); } } /** * Serializable ObjectFactory/ObjectProvider for lazy resolution of a dependency. */ private class DependencyObjectProvider implements ObjectProvider<Object>, Serializable { private final DependencyDescriptor descriptor; private final boolean optional; private final String beanName; public DependencyObjectProvider(DependencyDescriptor descriptor, String beanName) { this.descriptor = new NestedDependencyDescriptor(descriptor); // 参数的描述 this.optional = (this.descriptor.getDependencyType() == javaUtilOptionalClass); // cn.java.bean.FooBean this.beanName = beanName; } @Override public Object getObject() throws BeansException { if (this.optional) { return new OptionalDependencyFactory().createOptionalDependency(this.descriptor, this.beanName); } else { return doResolveDependency(this.descriptor, this.beanName, null, null); } } @Override public Object getObject(final Object... args) throws BeansException { if (this.optional) { return new OptionalDependencyFactory().createOptionalDependency(this.descriptor, this.beanName, args); } else { DependencyDescriptor descriptorToUse = new DependencyDescriptor(descriptor) { @Override public Object resolveCandidate(String beanName, Class<?> requiredType, BeanFactory beanFactory) { return ((AbstractBeanFactory) beanFactory).getBean(beanName, requiredType, args); } }; return doResolveDependency(descriptorToUse, this.beanName, null, null); } } @Override public Object getIfAvailable() throws BeansException { if (this.optional) { return new OptionalDependencyFactory().createOptionalDependency(this.descriptor, this.beanName); } else { DependencyDescriptor descriptorToUse = new DependencyDescriptor(descriptor) { @Override public boolean isRequired() { return false; } }; return doResolveDependency(descriptorToUse, this.beanName, null, null); } } @Override public Object getIfUnique() throws BeansException { DependencyDescriptor descriptorToUse = new DependencyDescriptor(descriptor) { @Override public boolean isRequired() { return false; } @Override public Object resolveNotUnique(Class<?> type, Map<String, Object> matchingBeans) { return null; } }; if (this.optional) { return new OptionalDependencyFactory().createOptionalDependency(descriptorToUse, this.beanName); } else { return doResolveDependency(descriptorToUse, this.beanName, null, null); } } } /** * Serializable ObjectFactory for lazy resolution of a dependency. */ private class Jsr330DependencyProvider extends DependencyObjectProvider implements Provider<Object> { public Jsr330DependencyProvider(DependencyDescriptor descriptor, String beanName) { super(descriptor, beanName); } @Override public Object get() throws BeansException { return getObject(); } } /** * Separate inner class for avoiding a hard dependency on the {@code javax.inject} API. */ private class Jsr330ProviderFactory { public Object createDependencyProvider(DependencyDescriptor descriptor, String beanName) { return new Jsr330DependencyProvider(descriptor, beanName); } } /** * An {@link org.springframework.core.OrderComparator.OrderSourceProvider} implementation * that is aware of the bean metadata of the instances to sort. * <p>Lookup for the method factory of an instance to sort, if any, and let the * comparator retrieve the {@link org.springframework.core.annotation.Order} * value defined on it. This essentially allows for the following construct: */ private class FactoryAwareOrderSourceProvider implements OrderComparator.OrderSourceProvider { private final Map<Object, String> instancesToBeanNames; public FactoryAwareOrderSourceProvider(Map<Object, String> instancesToBeanNames) { this.instancesToBeanNames = instancesToBeanNames; } @Override public Object getOrderSource(Object obj) { RootBeanDefinition beanDefinition = getRootBeanDefinition(this.instancesToBeanNames.get(obj)); if (beanDefinition == null) { return null; } List<Object> sources = new ArrayList<Object>(2); Method factoryMethod = beanDefinition.getResolvedFactoryMethod(); if (factoryMethod != null) { sources.add(factoryMethod); } Class<?> targetType = beanDefinition.getTargetType(); if (targetType != null && targetType != obj.getClass()) { sources.add(targetType); } return sources.toArray(new Object[sources.size()]); } private RootBeanDefinition getRootBeanDefinition(String beanName) { if (beanName != null && containsBeanDefinition(beanName)) { BeanDefinition bd = getMergedBeanDefinition(beanName); if (bd instanceof RootBeanDefinition) { return (RootBeanDefinition) bd; } } return null; } } private static class NestedDependencyDescriptor extends DependencyDescriptor { public NestedDependencyDescriptor(DependencyDescriptor original) { super(original); increaseNestingLevel(); } } private static class MultiElementDescriptor extends NestedDependencyDescriptor { public MultiElementDescriptor(DependencyDescriptor original) { super(original); } } }
944f7277585c47cf8be941905fa7c450e40ec1b4
58bfe603a28c4b461219d97ce3cb62ea49fc9c43
/src/threadlocal/ThreadLocalNormalUsage01.java
c80db30834b86a74c2171fae30d9624bd7fde2d9
[]
no_license
HaomingChen/JavaThreadCourse
5ff0847556288d7f2c254bd60efc3df4efd51ede
555c8992799fd92134452c3b11da6e435604ce43
refs/heads/master
2020-06-24T06:01:49.540420
2020-04-15T10:45:31
2020-04-15T10:45:31
198,869,913
0
0
null
null
null
null
UTF-8
Java
false
false
951
java
package threadlocal; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.concurrent.locks.ReentrantLock; /** * @author Haoming Chen * Created on 2020/2/6 */ public class ThreadLocalNormalUsage01 { ReentrantLock rc = new ReentrantLock(); public static void main(String[] args) throws InterruptedException { for (int i = 0; i < 30; i++) { int finalI = i; new Thread(new Runnable() { @Override public void run() { String date = new ThreadLocalNormalUsage01().date(finalI); System.out.println(date); } }).start(); Thread.sleep(100); } } public String date(int seconds) { Date date = new Date(seconds * 1000); SimpleDateFormat dateFormat = new SimpleDateFormat(); return dateFormat.format(date); } }
4f8c787d8b734fe146bb52905b51ffca35fe59ba
043e5f73b0d69c61a8c71268f2b368c1864ff8aa
/app/src/main/java/com/iglesias/c/mercuriomovil/Presenter/LoginPresenter.java
b53e9fb011ea2c5cf02622f8128470308165bde2
[]
no_license
ciglesiascrespo/MercurioMovil
88a8919d60b1827064fd4fa9f11eacaba4e26db1
96799d5d2433c4b807702b2cedc9e18e2110d9aa
refs/heads/master
2020-03-14T11:31:09.615012
2018-05-04T11:00:17
2018-05-04T11:00:17
131,592,013
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
package com.iglesias.c.mercuriomovil.Presenter; /** * Created by Ciglesias on 17/02/2018. */ public interface LoginPresenter { void onSuccesLogin(int id); void onErrorLogin(); void onUsuarioLogueado(int id, String pattern); }
58b848c9ff4ef3619d729f9f26bfd35258c00a13
91c0027ac9dc98549e7d12c82a47099663b5f10d
/kydialog/src/main/java/com/zoe/kydialog/rclayout/RCRelativeLayout.java
dd553bed2c5f4e8266beb85baba83a4ffcd82be8
[]
no_license
hahaha28/KyDialog
d78f7f2df6058727bf31541579deea80a74ef47b
9b5468190eaf401a0e9f80bae21e83040cf8ba4f
refs/heads/master
2020-06-25T01:47:29.167918
2019-12-07T10:40:06
2019-12-07T10:40:06
199,160,163
1
0
null
null
null
null
UTF-8
Java
false
false
6,256
java
/* * Copyright 2018 GcsSloop * * 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. * * Last modified 2018-04-13 23:18:56 * * GitHub: https://github.com/GcsSloop * WeiBo: http://weibo.com/GcsSloop * WebSite: http://www.gcssloop.com */ package com.zoe.kydialog.rclayout; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.Checkable; import android.widget.RelativeLayout; import com.zoe.kydialog.rclayout.helper.RCAttrs; import com.zoe.kydialog.rclayout.helper.RCHelper; /** * 作用:圆角相对布局 * 作者:GcsSloop */ public class RCRelativeLayout extends RelativeLayout implements Checkable, RCAttrs { RCHelper mRCHelper; public RCRelativeLayout(Context context) { this(context, null); } public RCRelativeLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public RCRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mRCHelper = new RCHelper(); mRCHelper.initAttrs(context, attrs); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mRCHelper.onSizeChanged(this, w, h); } @Override protected void dispatchDraw(Canvas canvas) { canvas.saveLayer(mRCHelper.mLayer, null, Canvas.ALL_SAVE_FLAG); super.dispatchDraw(canvas); mRCHelper.onClipDraw(canvas); canvas.restore(); } @Override public void draw(Canvas canvas) { if (mRCHelper.mClipBackground) { canvas.save(); canvas.clipPath(mRCHelper.mClipPath); super.draw(canvas); canvas.restore(); } else { super.draw(canvas); } } @Override public boolean dispatchTouchEvent(MotionEvent ev) { int action = ev.getAction(); if (action == MotionEvent.ACTION_DOWN && !mRCHelper.mAreaRegion.contains((int) ev.getX(), (int) ev.getY())) { return false; } if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_UP) { refreshDrawableState(); } else if (action == MotionEvent.ACTION_CANCEL) { setPressed(false); refreshDrawableState(); } return super.dispatchTouchEvent(ev); } //--- 公开接口 ---------------------------------------------------------------------------------- public void setClipBackground(boolean clipBackground) { mRCHelper.mClipBackground = clipBackground; invalidate(); } public void setRoundAsCircle(boolean roundAsCircle) { mRCHelper.mRoundAsCircle = roundAsCircle; invalidate(); } public void setRadius(int radius) { for (int i = 0; i < mRCHelper.radii.length; i++) { mRCHelper.radii[i] = radius; } invalidate(); } public void setTopLeftRadius(int topLeftRadius) { mRCHelper.radii[0] = topLeftRadius; mRCHelper.radii[1] = topLeftRadius; invalidate(); } public void setTopRightRadius(int topRightRadius) { mRCHelper.radii[2] = topRightRadius; mRCHelper.radii[3] = topRightRadius; invalidate(); } public void setBottomLeftRadius(int bottomLeftRadius) { mRCHelper.radii[6] = bottomLeftRadius; mRCHelper.radii[7] = bottomLeftRadius; invalidate(); } public void setBottomRightRadius(int bottomRightRadius) { mRCHelper.radii[4] = bottomRightRadius; mRCHelper.radii[5] = bottomRightRadius; invalidate(); } public void setStrokeWidth(int strokeWidth) { mRCHelper.mStrokeWidth = strokeWidth; invalidate(); } public void setStrokeColor(int strokeColor) { mRCHelper.mStrokeColor = strokeColor; invalidate(); } @Override public void invalidate() { if (null != mRCHelper) mRCHelper.refreshRegion(this); super.invalidate(); } public boolean isClipBackground() { return mRCHelper.mClipBackground; } public boolean isRoundAsCircle() { return mRCHelper.mRoundAsCircle; } public float getTopLeftRadius() { return mRCHelper.radii[0]; } public float getTopRightRadius() { return mRCHelper.radii[2]; } public float getBottomLeftRadius() { return mRCHelper.radii[4]; } public float getBottomRightRadius() { return mRCHelper.radii[6]; } public int getStrokeWidth() { return mRCHelper.mStrokeWidth; } public int getStrokeColor() { return mRCHelper.mStrokeColor; } //--- Selector 支持 ---------------------------------------------------------------------------- @Override protected void drawableStateChanged() { super.drawableStateChanged(); mRCHelper.drawableStateChanged(this); } @Override public void setChecked(boolean checked) { if (mRCHelper.mChecked != checked) { mRCHelper.mChecked = checked; refreshDrawableState(); if (mRCHelper.mOnCheckedChangeListener != null) { mRCHelper.mOnCheckedChangeListener.onCheckedChanged(this, mRCHelper.mChecked); } } } @Override public boolean isChecked() { return mRCHelper.mChecked; } @Override public void toggle() { setChecked(!mRCHelper.mChecked); } public void setOnCheckedChangeListener(RCHelper.OnCheckedChangeListener listener) { mRCHelper.mOnCheckedChangeListener = listener; } }
80021d33b470224a563be796e7bfbcb66a579c82
3ef15f384a7f8bf0ee61d5b4ea0172c375f14c20
/src/pathcounter/PathCounterMain.java
fc9fce2b6c892bfd62ab66fa6880382adb73d29d
[]
no_license
ET-118314736/jennifer
366401786d17758e7d7643e90a97bebeabb2ea2d
9cad0993c5a75a3fd8269b6b88b5547297c766f2
refs/heads/master
2023-01-08T21:06:45.457915
2020-11-11T14:40:02
2020-11-11T14:40:02
312,002,360
0
0
null
null
null
null
UTF-8
Java
false
false
720
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 pathcounter; import java.util.Scanner; /** * * @author adamoc */ public class PathCounterMain { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here System.out.println("Please enter a number: "); Scanner scan = new Scanner(System.in); int inputtedNum = scan.nextInt(); PathCounter pathCounter = new PathCounter(); System.out.println(pathCounter.countPaths(inputtedNum)); } }
0dda2a9bf304167fa3888bde4e8a4357539cd02b
07ecff6f991f051ac628a99dad0d2b648e587f6e
/yx-admin/src/main/java/com/yx/service/impl/UserServiceImpl.java
157014b9f7dbc3b81a9b428f0f587641fae47eed
[ "LicenseRef-scancode-mulanpsl-1.0-en", "MulanPSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ibinq/yx
d61f7f59d6c52176f33e8ca181c03025bafb6f3a
696f5a99aceb5f4a1d35e18a555d9e4c19ad7f15
refs/heads/master
2022-06-22T11:35:24.568287
2020-03-30T08:57:12
2020-03-30T08:57:12
247,018,473
0
0
NOASSERTION
2022-06-17T03:03:17
2020-03-13T08:05:59
Java
UTF-8
Java
false
false
407
java
package com.yx.service.impl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.yx.bean.User; import com.yx.dao.UserDao; import com.yx.service.UserService; import org.springframework.stereotype.Service; /** * @author ZhouBing * @version 1.0 * @date 2020/3/13 16:49 */ @Service("userService") public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserService { }
71537976f25610f8038c274a3063d6d7c5a317a4
627e2f5df08ce8d7349ebc3ea850aae92485c8f6
/src/main/java/org/prebid/server/bidder/grid/model/ExtImpGridData.java
9706f2e2edaa9ba370ed90434690e4c33d27274e
[ "Apache-2.0" ]
permissive
ym-dan/prebid-server-java
6b2756937c1ff7c8d718d46f19c38b5faca3ebac
de0386cb9826adfa3ab763e3b44a57b8870fe8ad
refs/heads/master
2023-08-11T21:09:25.590256
2021-10-01T17:47:27
2021-10-01T17:47:27
412,561,691
0
0
Apache-2.0
2021-10-01T17:34:48
2021-10-01T17:34:47
null
UTF-8
Java
false
false
307
java
package org.prebid.server.bidder.grid.model; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Value; @Value(staticConstructor = "of") public class ExtImpGridData { @JsonProperty("pbadslot") String pbAdSlot; @JsonProperty("adserver") ExtImpGridDataAdServer adServer; }
92f1f1d34300e5d1d69312ec8bde339a150cfe81
33d5e72c5d9744616ee9b7d95cbb448367016c2a
/src/main/java/com/khanabid20/opennms/util/jmxdatacollection/generated/Attrib.java
16b3b5b43c3ca8b7d372afc27f53e624fef55478
[]
no_license
khanabid20/OpenNMS_ConfigGenerator
234e65e6fb1708bb9b70e57e0ae64dbe50016871
6ff4544f4d307b61e3057beec745d4d4c48bb7fe
refs/heads/master
2021-06-08T09:10:05.933166
2018-03-11T13:30:26
2018-03-11T13:30:26
123,068,015
0
0
null
2021-05-02T00:58:50
2018-02-27T03:35:48
Java
UTF-8
Java
false
false
954
java
package com.khanabid20.opennms.util.jmxdatacollection.generated; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Attrib { private String alias; private String name; private String type; @XmlAttribute public String getAlias () { return alias; } public void setAlias (String alias) { this.alias = alias; } @XmlAttribute public String getName () { return name; } public void setName (String name) { this.name = name; } @XmlAttribute public String getType () { return type; } public void setType (String type) { this.type = type; } @Override public String toString() { return "ClassPojo [alias = "+alias+", name = "+name+", type = "+type+"]"; } }
3e22d8bf6c215377028de01bee69991a2ec1f9b7
cd3d62cecf90c7e96766894fbd1afb73a9aa70dd
/src/nutritiontracker/NutritionReportController.java
ae6816621926f1ad531e666de644706f564394c6
[]
no_license
zarnowsk/NutritionTracker
99e5e2559bd8ffee425ebe52b5053e31e7f2ada9
33f14b0048fdd94c5bca146496bd1681684e6a34
refs/heads/master
2020-06-22T08:40:21.770930
2019-08-12T16:57:42
2019-08-12T16:57:42
197,683,640
0
0
null
null
null
null
UTF-8
Java
false
false
9,004
java
package nutritiontracker; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.net.URL; import java.util.ArrayList; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TextArea; import javafx.stage.Stage; /** * FXML Controller class in charge of the Nutrition Report Window * * @author Michal Zarnowski */ public class NutritionReportController implements Initializable { //FXML variables @FXML private Button menuBtn; @FXML private TextArea categoryTxt, productTxt, proteinTxt, carbTxt, fatTxt; //Controller variables private File recordsFile = new File("nutritionRecords.dat"); private static RandomAccessFile recordsAccess; private int recordSize = 129; //Record size in bytes /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { //Open stream to random access file try { recordsAccess = new RandomAccessFile(recordsFile, "rw"); } catch(FileNotFoundException e) { //IMPLEMENT WARNING DIALOG } //Get records from the file as an Array List ArrayList<RecordModel> records = getRecordsAsArray(); //Sort records into nutrition categories ArrayList<ArrayList<RecordModel>> sortedRecords = sortRecordsIntoCategories(records); //Display the records in text area displayRecords(sortedRecords); //Take user back to main menu on button click menuBtn.setOnAction((ActionEvent event) -> { try { //Get current window from the btn element and close it Stage stage = (Stage)menuBtn.getScene().getWindow(); stage.close(); //Creeate new window and display it FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getResource("MainMenuFXML.fxml")); Scene mainMenuScene = new Scene(fxmlLoader.load(), 700, 550); stage = new Stage(); stage.setResizable(false); stage.setTitle("Nutrition Tracker"); stage.setScene(mainMenuScene); stage.show(); recordsAccess.close(); } catch (IOException e) { Logger logger = Logger.getLogger(getClass().getName()); logger.log(Level.SEVERE, "Failed to create new Window.", e); } }); } /** * Method reads in the data from the file and converts it to an Array List of records * @return Array List containing records */ private ArrayList<RecordModel> getRecordsAsArray(){ ArrayList<RecordModel> records = new ArrayList<>(); //Create RecordModel objects by reading fields from the file try { //Find number of stored records in file by getting file length divided by size of each record long numOfRecords = recordsAccess.length() / recordSize; //Loop through all records in file for(int i = 0; i < numOfRecords; i++) { //Move pointer to beginning of record (i * 129) recordsAccess.seek(i * recordSize); //Read product name, first 30 chars String name = readString(recordsAccess, 30); //Read protein, carb and fat values double protein = recordsAccess.readDouble(); double carb = recordsAccess.readDouble(); double fat = recordsAccess.readDouble(); //Read category, nutrition category and favourite String category = readString(recordsAccess, 15); String nutrition = readString(recordsAccess, 7); //Convert boolean favourite to String String fave = ""; boolean favourite = false; if(recordsAccess.readBoolean()) { favourite = true; } if(favourite) { fave = "Favourite"; } //Add new RecordModel object to observable list records.add(new RecordModel(name, protein, carb, fat, category, nutrition, fave)); } } catch(IOException e) { //IMPLEMENT THIS } return records; } /** * Method returns a string of characters from Random Access file of length based on supplied string size * @param file Random Access File to read characters from * @param size Amount of characters to extract * @return String read from the file * @throws IOException */ private String readString(RandomAccessFile file, int size) throws IOException { String string = ""; for(int i = 0; i < size; i++){ string += file.readChar(); } return string; } /** * Method converts an Array List holding records into multiple Array Lists, one for each possible product * category. * @param records Array List holding all the records * @return Array List holding multiple Array Lists of each product category */ private ArrayList<ArrayList<RecordModel>> sortRecordsIntoCategories(ArrayList<RecordModel> records) { //Create separate array lists for each available product nutrition category ArrayList<RecordModel> proteinCat = new ArrayList<>(); ArrayList<RecordModel> carbCat = new ArrayList<>(); ArrayList<RecordModel> fatCat = new ArrayList<>(); //Cycle through all records and sort them into appropriate array lists for(int i = 0; i < records.size(); i++){ RecordModel currentRecord = records.get(i); if(currentRecord.getNutrition().trim().equals("Protein")) proteinCat.add(currentRecord); else if(currentRecord.getNutrition().trim().equals("Carb")) carbCat.add(currentRecord); else if(currentRecord.getNutrition().trim().equals("Fat")) fatCat.add(currentRecord); } //Add each individual category array list to main array list to be returned ArrayList<ArrayList<RecordModel>> sortedRecords = new ArrayList<>(); sortedRecords.add(proteinCat); sortedRecords.add(carbCat); sortedRecords.add(fatCat); return sortedRecords; } /** * Method displays all records from all Array Lists in appropriate Text Areas * @param records Array List holding all records */ private void displayRecords(ArrayList<ArrayList<RecordModel>> records) { //Initialize column headers String displayCategoryString = "Category\n\n", displayProductString = "Product\n\n", displayProteinString = "Protein\n\n", displayCarbString = "Carbs\n\n", displayFatString = "Fat\n\n"; //Cycle through each Array List containing products of specific categories for(int i = 0; i < records.size(); i++){ ArrayList<RecordModel> category = records.get(i); //Cycle through all records in the category for(int j = 0; j < category.size(); j++) { RecordModel record = category.get(j); //Add record data to appropriate String displayCategoryString += record.getNutrition().trim() + "\n"; displayProductString += record.getName().trim() + "\n"; displayProteinString += record.getProtein() + "\n"; displayCarbString += record.getCarb() + "\n"; displayFatString += record.getFat() + "\n"; } //White space formatting if(category.size() > 0) { displayCategoryString += "\n"; displayProductString += "\n"; displayProteinString += "\n"; displayCarbString += "\n"; displayFatString += "\n"; } } //DIsplay columns categoryTxt.setText(displayCategoryString); productTxt.setText(displayProductString); proteinTxt.setText(displayProteinString); carbTxt.setText(displayCarbString); fatTxt.setText(displayFatString); } }
4ddca2d78ef0e0e1e6afd2260ed46d45be136ed9
000ddfb1ef7cd75cea76c7020256e4da48de99bc
/health_common/src/main/java/com/nxl/utils/QiniuUtils.java
6a52be69188955e596734ad416b7c73b988cf189
[]
no_license
yihanglianghang/health-code
4d7181c0fb0dffa1b5a65890921d4d7aaaa4f714
0452177c0a108ae89944a75744bfa18414570a37
refs/heads/master
2023-07-16T17:02:26.247183
2021-08-13T07:22:29
2021-08-13T07:22:29
395,556,945
0
0
null
null
null
null
UTF-8
Java
false
false
3,289
java
package com.nxl.utils; import com.google.gson.Gson; import com.qiniu.common.QiniuException; import com.qiniu.common.Zone; import com.qiniu.http.Response; import com.qiniu.storage.BucketManager; import com.qiniu.storage.Configuration; import com.qiniu.storage.UploadManager; import com.qiniu.storage.model.DefaultPutRet; import com.qiniu.util.Auth; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; /** * 七牛云工具类 */ public class QiniuUtils { public static String accessKey = "OK3sAXma0pLF4bXPf6id2yX1EHfrkQLdrSe-K1NH"; public static String secretKey = "Z4ISYrXihMyG3Yw6TIlYnx6ae99f7mhDInNV1DhT"; public static String bucket = "health-nxl"; public static void upload2Qiniu(String filePath,String fileName){ //构造一个带指定Zone对象的配置类 Configuration cfg = new Configuration(Zone.zone0()); UploadManager uploadManager = new UploadManager(cfg); Auth auth = Auth.create(accessKey, secretKey); String upToken = auth.uploadToken(bucket); try { Response response = uploadManager.put(filePath, fileName, upToken); //解析上传成功的结果 DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class); } catch (QiniuException ex) { Response r = ex.response; try { System.err.println(r.bodyString()); } catch (QiniuException ex2) { //ignore } } } //上传文件 public static void upload2Qiniu(byte[] bytes, String fileName){ //构造一个带指定Zone对象的配置类 Configuration cfg = new Configuration(Zone.zone0()); //...其他参数参考类注释 UploadManager uploadManager = new UploadManager(cfg); //默认不指定key的情况下,以文件内容的hash值作为文件名 String key = fileName; Auth auth = Auth.create(accessKey, secretKey); String upToken = auth.uploadToken(bucket); try { Response response = uploadManager.put(bytes, key, upToken); //解析上传成功的结果 DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class); System.out.println(putRet.key); System.out.println(putRet.hash); } catch (QiniuException ex) { Response r = ex.response; System.err.println(r.toString()); try { System.err.println(r.bodyString()); } catch (QiniuException ex2) { //ignore } } } //删除文件 public static void deleteFileFromQiniu(String fileName){ //构造一个带指定Zone对象的配置类 Configuration cfg = new Configuration(Zone.zone0()); String key = fileName; Auth auth = Auth.create(accessKey, secretKey); BucketManager bucketManager = new BucketManager(auth, cfg); try { bucketManager.delete(bucket, key); } catch (QiniuException ex) { //如果遇到异常,说明删除失败 System.err.println(ex.code()); System.err.println(ex.response.toString()); } } }
ecdc005a787415a1b9caf7872d009ad3133421d0
400211f8ba8ee352ce4a63a8c0a768ecf46aca65
/src/dao/cn/com/atnc/ioms/entity/basedata/Equip.java
1e41192805fbee8d2ba0b7c8db45bf5a504d592a
[]
no_license
jyf666/IOMS
76003040489dc8f594c88ff35c07bd77d1447da4
6d3c8428c06298bee8d1f056aab7b21d81fd4ce2
refs/heads/master
2021-05-10T18:38:37.276724
2018-01-19T14:50:34
2018-01-19T14:50:34
118,130,382
0
2
null
null
null
null
UTF-8
Java
false
false
2,441
java
/* Copyright ? 2014 BEIJING ATNC Co.,Ltd. * All rights reserved * * created at 2014-3-19 下午7:35:50 * author:HuangYijie E-mail:[email protected] */ package cn.com.atnc.ioms.entity.basedata; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; import cn.com.atnc.ioms.entity.MyStringUUIDEntity; import cn.com.atnc.ioms.entity.basedata.satellite.SatelliteSite; import cn.com.atnc.ioms.entity.maintain.equipmobile.KuMobile; import cn.com.atnc.ioms.enums.basedata.Bureau; import cn.com.atnc.ioms.enums.basedata.NetworkType; /** * @author:HuangYijie * @date:2014-3-19 下午7:35:50 * @version:1.0 */ @Entity @Table(name = "TB_BD_EQUIP") public class Equip extends MyStringUUIDEntity { private static final long serialVersionUID = 2752447325893000910L; private String name; private String code; private NetworkType type; private String model; private Bureau bureau; private String info; private SatelliteSite satellite; private transient List<KuMobile> kuMobiles; @Transient public List<KuMobile> getKuMobiles() { return kuMobiles; } public void setKuMobiles(List<KuMobile> kuMobiles) { this.kuMobiles = kuMobiles; } public Equip() { super(); } public Equip(String id) { super(); this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } @Enumerated(EnumType.STRING) @Column public NetworkType getType() { return type; } public void setType(NetworkType type) { this.type = type; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } @Enumerated(EnumType.STRING) @Column public Bureau getBureau() { return bureau; } public void setBureau(Bureau bureau) { this.bureau = bureau; } public String getInfo() { return info; } public void setInfo(String info) { this.info = info; } @ManyToOne @JoinColumn(name = "SATELLITE_ID") public SatelliteSite getSatellite() { return satellite; } public void setSatellite(SatelliteSite satellite) { this.satellite = satellite; } }
69ba86a25dcbbc516990562d3e6c847c7e14900e
ee8e07d883ee3a22b9485cdf49a00925a71d3cad
/src/main/java/JarUtils.java
486a968854aab83a180815bada62822b4f1c45c5
[]
no_license
XOfSpades/cassandra-store
01beea320d7b2e67dfed12c5df0f0428e5f50b63
01602212b8b4cf5b9ec8c9cde2a87ee8b3a9068e
refs/heads/master
2021-01-13T14:29:03.010722
2016-11-04T17:13:54
2016-11-04T17:13:54
72,856,750
0
0
null
null
null
null
UTF-8
Java
false
false
2,737
java
package myCassandra; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import java.net.URLDecoder; import java.util.Enumeration; import java.util.HashSet; import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; public class JarUtils { /** * List directory contents for a resource folder. Not recursive. * This is basically a brute-force implementation. * Works for regular files and also JARs. * * @param clazz Any java class that lives in the same place as the resources you want. * @param path Should end with "/", but not start with one. * @return Just the name of each member item, not the full paths. * @throws java.net.URISyntaxException * @throws java.io.IOException * @author Greg Briggs */ public static String[] getResourceListing(Class clazz, String path) throws URISyntaxException, IOException { URL dirURL = clazz.getClassLoader().getResource(path); if (dirURL != null && dirURL.getProtocol().equals("file")) { /* A file path: easy enough */ return new File(dirURL.toURI()).list(); } if (dirURL == null) { /* * In case of a jar file, we can't actually find a directory. * Have to assume the same jar as clazz. */ String me = clazz.getName().replace(".", "/") + ".class"; dirURL = clazz.getClassLoader().getResource(me); } if (dirURL.getProtocol().equals("jar")) { /* A JAR path */ String jarPath = dirURL.getPath().substring(5, dirURL.getPath().indexOf("!")); //strip out only the JAR file JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8")); Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar Set<String> result = new HashSet<String>(); //avoid duplicates in case it is a subdirectory while (entries.hasMoreElements()) { String name = entries.nextElement().getName(); if (name.startsWith(path)) { //filter according to the path String entry = name.substring(path.length()); int checkSubdir = entry.indexOf("/"); if (checkSubdir >= 0) { // if it is a subdirectory, we just return the directory name entry = entry.substring(0, checkSubdir); } result.add(entry); } } return result.toArray(new String[result.size()]); } throw new UnsupportedOperationException("Cannot list files for URL " + dirURL); } }
88d667a279148bef5f6ea3473651b605db99ad6e
7c506929a79e5300b56b4cc55184bb6965cf5f4a
/src/alfredo/geom/Vector.java
0318cbe42424954b4f7a66ad630bf09b675f5d1a
[ "MIT" ]
permissive
TheMonsterFromTheDeep/worldsproject
7fb8563407a914898c00bcd28448e8ec1662c7c5
0274656d70e561e403e9893dc38147330ac2aaf6
refs/heads/master
2021-01-20T00:46:22.953654
2017-04-24T01:38:47
2017-04-24T01:38:47
89,185,789
0
0
null
null
null
null
UTF-8
Java
false
false
4,941
java
package alfredo.geom; import alfredo.Rand; /** * * @author TheMonsterOfTheDeep */ public class Vector { public float x; public float y; private boolean cached = false; private float magnitude; private float direction; public static Vector random(float sx, float sy, float ex, float ey) { return new Vector(Rand.f(sx, ex), Rand.f(sy, ey)); } public static Vector random(Vector start, Vector end) { return random(start.x, start.y, end.x, end.y); } public static Vector fromDirection(float length, float direction) { return new Vector(length * (float)Math.cos(Math.toRadians(direction)), length * (float)Math.sin(Math.toRadians(direction))); } private void checkCache() { if(!cached) { magnitude = (float)Math.sqrt(x * x + y * y); direction = (float)Math.toDegrees(Math.atan2(y, x)); cached = true; } } public Vector() { x = y = 0; } public Vector(float dupli) { x = y = dupli; } public Vector(float x, float y) { this.x = x; this.y = y; } public Vector(Vector orig) { this.x = orig.x; this.y = orig.y; } public Vector copy() { return new Vector(this); } public void set(float x, float y) { this.x = x; this.y = y; cached = false; } public void set(Vector dupli) { x = dupli.x; y = dupli.y; cached = false; } public void zero() { set(0, 0); } public void setX(float x) { this.x = x; cached = false; } public void setY(float y) { this.y = y; cached = false; } public void setX(Vector dupli) { this.x = dupli.x; cached = false; } public void setY(Vector dupli) { this.y = dupli.y; cached = false; } public void add(float x, float y) { this.x += x; this.y += y; cached = false; } public void add(Vector dupli) { this.x += dupli.x; this.y += dupli.y; cached = false; } public void addX(float x) { this.x += x; cached = false; } public void addY(float y) { this.y += y; cached = false; } public void addX(Vector dupli) { this.x += dupli.x; cached = false; } public void addY(Vector dupli) { this.y += dupli.y; cached = false; } public void subtract(float x, float y) { this.x -= x; this.y -= y; cached = false; } public void subtract(Vector dupli) { this.x -= dupli.x; this.y -= dupli.y; cached = false; } public void subtractX(float x) { this.x -= x; cached = false; } public void subtractY(float y) { this.y -= y; cached = false; } public void subtractX(Vector dupli) { this.x -= dupli.x; cached = false; } public void subtractY(Vector dupli) { this.y -= dupli.y; cached = false; } public Vector plus(Vector v) { return new Vector(this.x + v.x, this.y + v.y); } public Vector minus(Vector v) { return new Vector(this.x - v.x, this.y - v.y); } public Vector times(float scalar) { return new Vector(this.x * scalar, this.y * scalar); } public void scale(float scalar) { this.x *= scalar; this.y *= scalar; cached = false; } public void rotate(float px, float py, double theta) { float dx = x - px; float dy = y - py; theta = Math.toRadians(theta); double cos = Math.cos(theta); double sin = Math.sin(theta); x = (float)(px + (dx * cos) + (dy * sin)); y = (float)(py - (dx * sin) + (dy * cos)); cached = false; } public void move(float distance, double direction) { x += distance * Math.cos(Math.toRadians(direction)); y += distance * Math.sin(Math.toRadians(direction)); } public float getMagnitude() { checkCache(); return magnitude; } public float getDirection() { checkCache(); return direction; } public float distance(Vector other) { return (float) Math.sqrt( (other.x - x) * (other.x - x) + (other.y - y) * (other.y - y) ); } @Override public String toString() { //Only show two decimals worth of precision - I feel like this will be more useful for debugging float xd = Math.abs(x); float yd = Math.abs(y); int xi = (int)Math.floor(xd); int xf = Math.round(xd * 100) - 100 * xi; int yi = (int)Math.floor(yd); int yf = Math.round(yd * 100) - 100 * yi; if(x < 0) { xi = -xi; } if(y < 0) { yi = -yi; } return "Vector(" + xi + "." + xf + ", " + yi + "." + yf + ")"; } public boolean equal(Vector v) { return v.x == x && v.y == y; } }
95a6728c52bc78f44a76e7cdfa9bd025d94e3936
bc569d15bcd6959d9689769b1fdebbf5dd205222
/ITE1802/Module8/8_2_room/src/test/java/com/example/a8_2_room/ExampleUnitTest.java
dcf783761e647d27d23aea84401f6644c24ac735
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
Unicron2k/dte_bsc
85b6dfc355c6c6d4245168e438091b6d0c86da6e
1703c6e57e9ceec2dcce3ec6b1b363bf7147536d
refs/heads/master
2023-05-28T13:00:45.536037
2021-06-08T09:00:40
2021-06-08T09:00:40
368,521,341
0
1
null
null
null
null
UTF-8
Java
false
false
382
java
package com.example.a8_2_room; 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); } }
6efe09685c6f892267c742e2a8821b0f4f951dfe
ddbca474ece0c2ded5dc015760d45d1e44dab0d0
/src/yyang/translate/core/SyntaxException.java
92094a83afe667a0d63d33e179e8abbdbc5fb251
[]
no_license
yyang-src/Translator
475476f687c8c86690f83d158dae6e5bdefc767a
53a8e2a9cda8227c812e5d86e5273305c2945a09
refs/heads/master
2020-05-20T01:34:58.225985
2013-05-02T07:15:18
2013-05-02T07:15:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
689
java
package yyang.translate.core; public class SyntaxException extends RuntimeException { /** * */ private static final long serialVersionUID = 5481836449562271280L; private int line; private int column; public SyntaxException(String msg, int line, int column) { super(msg); this.line = line; this.column = column; } public int getLine() { return line; } public void setLine(int line) { this.line = line; } public int getColumn() { return column; } public void setColumn(int column) { this.column = column; } public String toString(){ return String.format("line:%d,column:%d, %s",line,column,getMessage()); } }
61dce7cb72e6e0b678c7f3b8484eca723465e78c
9b294c3bf262770e9bac252b018f4b6e9412e3ee
/camerazadas/source/apk/com.sonyericsson.android.camera/src-cfr-nocode/com/google/android/gms/games/leaderboard/LeaderboardVariantEntity.java
5434b02aa34bf34d90fc04a05ab7779ba400124c
[]
no_license
h265/camera
2c00f767002fd7dbb64ef4dc15ff667e493cd937
77b986a60f99c3909638a746c0ef62cca38e4235
refs/heads/master
2020-12-30T22:09:17.331958
2015-08-25T01:22:25
2015-08-25T01:22:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,674
java
/* * Decompiled with CFR 0_100. */ package com.google.android.gms.games.leaderboard; import com.google.android.gms.games.leaderboard.LeaderboardVariant; /* * Exception performing whole class analysis. */ public final class LeaderboardVariantEntity implements LeaderboardVariant { private final int abM; private final int abN; private final boolean abO; private final long abP; private final String abQ; private final long abR; private final String abS; private final String abT; private final long abU; private final String abV; private final String abW; private final String abX; public LeaderboardVariantEntity(LeaderboardVariant var1); static int a(LeaderboardVariant var0); static boolean a(LeaderboardVariant var0, Object var1); static String b(LeaderboardVariant var0); public boolean equals(Object var1); @Override public /* synthetic */ Object freeze(); @Override public int getCollection(); @Override public String getDisplayPlayerRank(); @Override public String getDisplayPlayerScore(); @Override public long getNumScores(); @Override public long getPlayerRank(); @Override public String getPlayerScoreTag(); @Override public long getRawPlayerScore(); @Override public int getTimeSpan(); @Override public boolean hasPlayerInfo(); public int hashCode(); @Override public boolean isDataValid(); @Override public String lD(); @Override public String lE(); @Override public String lF(); public LeaderboardVariant lG(); public String toString(); }
b7dfddbf9ed0c385346d7cc33aafdb8c0a1ec458
01ebbc94cd4d2c63501c2ebd64b8f757ac4b9544
/backend/gxqpt-pt/gxqpt-hardware-repository/src/main/java/com/hengyunsoft/platform/hardware/entity/apply/po/ApplyRecord.java
a9110171f0bfdf67912f90b2db1d2c943dda7890
[]
no_license
KevinAnYuan/gxq
60529e527eadbbe63a8ecbbad6aaa0dea5a61168
9b59f4e82597332a70576f43e3f365c41d5cfbee
refs/heads/main
2023-01-04T19:35:18.615146
2020-10-27T06:24:37
2020-10-27T06:24:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,202
java
package com.hengyunsoft.platform.hardware.entity.apply.po; import com.hengyunsoft.base.entity.BaseEntity; import java.io.Serializable; import java.util.Date; public class ApplyRecord extends BaseEntity<Long> implements Serializable { /** * 主键 * * @mbggenerated */ private Long id; /** * 申请表主键 * * @mbggenerated */ private Long applyKeyid; /** * 审批人id * * @mbggenerated */ private String applyUid; /** * 审批人名称 * * @mbggenerated */ private String applyUname; /** * 是否通过(1通过2不通过) * * @mbggenerated */ private String passFlag; /** * 审批意见 * * @mbggenerated */ private String apprOpinion; /** * 环节代码 * * @mbggenerated */ private String stepCode; /** * 处理环节名称 * * @mbggenerated */ private String stepName; /** * 大环节code(SQ,GL,UY,YY) * * @mbggenerated */ private String scode; /** * 大环节名称(申请方,管理员,国信优易,高新翼云) * * @mbggenerated */ private String sname; /** * 创建人 * * @mbggenerated */ private String createUser; /** * 创建时间 * * @mbggenerated */ private Date createTime; /** * 修改人 * * @mbggenerated */ private String updateUser; /** * 修改时间 * * @mbggenerated */ private Date updateTime; private static final long serialVersionUID = 1L; /** * 主键 * * @mbggenerated */ public Long getId() { return id; } /** * 主键 * * @mbggenerated */ public void setId(Long id) { this.id = id; } /** * 申请表主键 * * @mbggenerated */ public Long getApplyKeyid() { return applyKeyid; } /** * 申请表主键 * * @mbggenerated */ public void setApplyKeyid(Long applyKeyid) { this.applyKeyid = applyKeyid; } /** * 审批人id * * @mbggenerated */ public String getApplyUid() { return applyUid; } /** * 审批人id * * @mbggenerated */ public void setApplyUid(String applyUid) { this.applyUid = applyUid == null ? null : applyUid.trim(); } /** * 审批人名称 * * @mbggenerated */ public String getApplyUname() { return applyUname; } /** * 审批人名称 * * @mbggenerated */ public void setApplyUname(String applyUname) { this.applyUname = applyUname == null ? null : applyUname.trim(); } /** * 是否通过(1通过2不通过) * * @mbggenerated */ public String getPassFlag() { return passFlag; } /** * 是否通过(1通过2不通过) * * @mbggenerated */ public void setPassFlag(String passFlag) { this.passFlag = passFlag == null ? null : passFlag.trim(); } /** * 审批意见 * * @mbggenerated */ public String getApprOpinion() { return apprOpinion; } /** * 审批意见 * * @mbggenerated */ public void setApprOpinion(String apprOpinion) { this.apprOpinion = apprOpinion == null ? null : apprOpinion.trim(); } /** * 环节代码 * * @mbggenerated */ public String getStepCode() { return stepCode; } /** * 环节代码 * * @mbggenerated */ public void setStepCode(String stepCode) { this.stepCode = stepCode == null ? null : stepCode.trim(); } /** * 处理环节名称 * * @mbggenerated */ public String getStepName() { return stepName; } /** * 处理环节名称 * * @mbggenerated */ public void setStepName(String stepName) { this.stepName = stepName == null ? null : stepName.trim(); } /** * 大环节code(SQ,GL,UY,YY) * * @mbggenerated */ public String getScode() { return scode; } /** * 大环节code(SQ,GL,UY,YY) * * @mbggenerated */ public void setScode(String scode) { this.scode = scode == null ? null : scode.trim(); } /** * 大环节名称(申请方,管理员,国信优易,高新翼云) * * @mbggenerated */ public String getSname() { return sname; } /** * 大环节名称(申请方,管理员,国信优易,高新翼云) * * @mbggenerated */ public void setSname(String sname) { this.sname = sname == null ? null : sname.trim(); } /** * 创建人 * * @mbggenerated */ public String getCreateUser() { return createUser; } /** * 创建人 * * @mbggenerated */ public void setCreateUser(String createUser) { this.createUser = createUser == null ? null : createUser.trim(); } /** * 创建时间 * * @mbggenerated */ public Date getCreateTime() { return createTime; } /** * 创建时间 * * @mbggenerated */ public void setCreateTime(Date createTime) { this.createTime = createTime; } /** * 修改人 * * @mbggenerated */ public String getUpdateUser() { return updateUser; } /** * 修改人 * * @mbggenerated */ public void setUpdateUser(String updateUser) { this.updateUser = updateUser == null ? null : updateUser.trim(); } /** * 修改时间 * * @mbggenerated */ public Date getUpdateTime() { return updateTime; } /** * 修改时间 * * @mbggenerated */ public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } }
ec5c0fd1327b748e104792262dcf3715f84619e4
6f3e7d30b2e10a4c726b999e22ded94648dba82d
/src/daointerface/UsersInterface.java
0ed80f170410e5454e53bb4ac0181b628da135bc
[]
no_license
819879012/starbill
b44194314c98444b4e1767d1e3f8ddc8e5c05854
cbc27b897c2119a8090da1638c9e0e0d75140682
refs/heads/master
2020-12-01T20:22:14.938751
2019-12-30T11:41:08
2019-12-30T11:41:08
230,757,684
10
4
null
null
null
null
UTF-8
Java
false
false
367
java
package daointerface; import java.util.List; import entity.Users; public interface UsersInterface { public int getTotal(); public void add(Users user); public void update(Users user); public void delete(int id); public Users get(int id); public List<Users> list(); public List<Users> list(int start, int count); public Users getByAccount(int account); }
ecc57cf3b52e97ce95cc95ac6550eb29625c5935
dcb0e6cffe8911990cc679938b0b63046b9078ad
/jmx/plugins/org.fusesource.ide.jmx.camel/src/org/fusesource/ide/jmx/camel/editor/CamelContextNodeEditorInput.java
5ba3cbab8ec8c43fd73cc094425bfcd7e59809b1
[]
no_license
MelissaFlinn/jbosstools-fuse
6fe7ac5f83d05df05d8884a8576b9af4baac3cd6
d960f4ed562da96a82128e0a9c04e122b9e9e8b0
refs/heads/master
2021-06-25T09:30:28.876445
2019-07-15T09:10:12
2019-07-29T08:12:28
112,379,325
0
0
null
2017-11-28T19:27:42
2017-11-28T19:27:42
null
UTF-8
Java
false
false
2,405
java
/******************************************************************************* * Copyright (c) 2013 Red Hat, Inc. * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ package org.fusesource.ide.jmx.camel.editor; import java.io.IOException; import java.nio.charset.StandardCharsets; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; import org.fusesource.ide.foundation.core.util.IOUtils; import org.fusesource.ide.foundation.ui.io.CamelXMLEditorInput; import org.fusesource.ide.jmx.camel.CamelJMXPlugin; import org.fusesource.ide.jmx.camel.navigator.CamelContextNode; /** * @author lhein */ public class CamelContextNodeEditorInput extends CamelXMLEditorInput { private final CamelContextNode contextNode; private String contextId; public CamelContextNodeEditorInput(CamelContextNode contextNode, IFile camelContextTempFile) { super(camelContextTempFile, null); this.contextNode = contextNode; this.contextId = contextNode.getContextId(); setSelectedContainerId(contextId); } @Override public String getName() { String name = "Remote CamelContext: " + contextId; if(contextNode.isConnectionAvailable()){ return "<connected>" + name; } else { return "<disconnected>" + name; } } @Override public String getToolTipText() { return getName(); } @Override public void onEditorInputSave() { super.onEditorInputSave(); if(contextNode.isConnectionAvailable()){ try { getCamelContextFile().getProject().refreshLocal(IProject.DEPTH_INFINITE, new NullProgressMonitor()); String xml = IOUtils.loadText(getCamelContextFile().getContents(), StandardCharsets.UTF_8.name()); contextNode.updateXml(xml); } catch (IOException | CoreException ex) { CamelJMXPlugin.getLogger().error("Error saving changes to remote camel context " + this.contextId, ex); } } } @Override public void dispose() { super.dispose(); contextNode.dispose(); } }
693ee8cc8b236357f99b2a38dd6890301772d441
c95f019bc8f05a8c09312cce04ef9d57e2d4fd03
/src/OOP_lab/s359211110085/rmutsv/com.java
f9ff907ba9ae8f331080315be44df9141995d3ec
[]
no_license
jhondem085/OOP_359211110085
53481390ed2c9ca9b42432e9d7a97a1a6a481fa4
8982fe709121720fd7fd1f3ce8c127dddfa88b82
refs/heads/master
2021-08-16T19:36:31.020538
2017-11-20T09:03:17
2017-11-20T09:03:17
111,380,088
0
0
null
null
null
null
UTF-8
Java
false
false
60
java
package OOP_lab.s359211110085.rmutsv; public class com { }
e6924bffb04809e6bd7a4aeec31fc26916e96742
2c97503e22a1086e07561e3a7e44db33fe10ce0e
/src/main/java/com/ticket/ticketmanagement/service/TicketService.java
426e267cf3bb99760f24e006426aed1bb6469d68
[]
no_license
PYC2020/ticket
8a84af0d6e65d52e78fa61cb1b1cc951fa1291eb
2f121190b2677520ded5d52005218856cfafcf96
refs/heads/master
2023-05-13T23:02:59.668413
2021-05-28T05:11:20
2021-05-28T05:11:20
371,276,294
0
0
null
null
null
null
UTF-8
Java
false
false
371
java
package com.ticket.ticketmanagement.service; import com.ticket.ticketmanagement.entity.Cart; import com.ticket.ticketmanagement.entity.Ticket; import java.util.List; public interface TicketService { List<Ticket> selectById(int id); int addTicket(Ticket ticket); List<Ticket> selectAll(); int deleteById(int id); int update(Ticket ticket); }
4075df3ba2b6441cbd6a30a563f9684cd79d1c91
cc03b8692c72f020824e942c9dd06aadab61a0a1
/src/model/javarice/semantics/symboltable/scopes/LocalScope.java
c0dafb8b44e5fd042938a1b8809c07f8f2eda5b8
[]
no_license
fuouo/JavaRice
36c2305e2abc1a71e84fc34fd87c2aa242d50f4f
516e7e80c56e59cfcbf8a5f63b0591646341df06
refs/heads/master
2021-08-23T20:59:45.898992
2017-12-06T02:14:25
2017-12-06T02:14:25
105,872,886
0
0
null
null
null
null
UTF-8
Java
false
false
3,398
java
package model.javarice.semantics.symboltable.scopes; import java.util.ArrayList; import java.util.HashMap; import model.javarice.semantics.representations.JavaRiceValue; public class LocalScope implements IScope { private IScope parentScope = null; private ArrayList<LocalScope> childScopeList = null; private HashMap<String, JavaRiceValue> localVariables = null; public LocalScope() { } public void initLocalVariableMap() { if(this.localVariables == null) { this.localVariables = new HashMap<String, JavaRiceValue>(); } } public void initChildList() { if(this.childScopeList == null) { this.childScopeList = new ArrayList<>(); } } public void setParent(IScope parentScope) { this.parentScope = parentScope; } public void addChild(LocalScope localScope) { this.initChildList(); this.childScopeList.add(localScope); } public IScope getParent() { return this.parentScope; } public int getChildCount() { if(this.childScopeList != null) { return this.childScopeList.size(); } return 0; } public LocalScope getChildAt(int index) { if(this.childScopeList != null) { return this.childScopeList.get(index); } return null; } public boolean containsVariable(String identifier) { return (this.localVariables != null && this.localVariables.containsKey(identifier)); } public void addEmptyVariableFromKeywords(String strPrimitiveType, String strIdentifier) { this.initLocalVariableMap(); JavaRiceValue javaRiceValue = JavaRiceValue.createEmptyVariableFromKeywords(strPrimitiveType); this.localVariables.put(strIdentifier, javaRiceValue); } public void addInitializedVariableFromKeywords(String strPrimitiveType, String strIdentifier, String strValue) { this.initLocalVariableMap(); this.addEmptyVariableFromKeywords(strPrimitiveType, strIdentifier); JavaRiceValue javaRiceValue = this.localVariables.get(strIdentifier); javaRiceValue.setValue(strValue); } public void addFinalEmptyVariableFromKeywords(String strPrimitiveType, String strIdentifier) { this.initLocalVariableMap(); JavaRiceValue javaRiceValue = JavaRiceValue.createEmptyVariableFromKeywords(strPrimitiveType); javaRiceValue.markFinal(); this.localVariables.put(strIdentifier, javaRiceValue); } public void addFinalInitializedVariableFromKeywords(String strPrimitiveType, String strIdentifier, String strValue) { this.initLocalVariableMap(); this.addFinalEmptyVariableFromKeywords(strPrimitiveType, strIdentifier); JavaRiceValue javaRiceValue = this.localVariables.get(strIdentifier); javaRiceValue.setValue(strValue); } public void addJavaRiceValue(String strIdentifier, JavaRiceValue javaRiceValue) { this.initLocalVariableMap(); this.localVariables.put(strIdentifier, javaRiceValue); } public int getDepth() { int depthCount = -1; LocalScope scope = (LocalScope) this; while(scope != null) { depthCount++; IScope abstractScope = scope.getParent(); scope = (LocalScope) abstractScope; } return depthCount; } @Override public JavaRiceValue searchVariableIncludingLocal(String identifier) { if(this.containsVariable(identifier)) { return this.localVariables.get(identifier); } System.err.println(identifier + " not found!!!"); return null; } @Override public boolean isParent() { return this.parentScope == null; } }
ec96ff69a4189850e1339921bc637e390e585089
33442edcdfef376eae97d4fa5b954b64dc51b7a5
/src/main/java/test/order/OrderGroupComparator.java
98e809721f011160bed392b5a02b3472cefdedcc
[]
no_license
zhtttylz/hadoopdemo
2a01c19ea60034043be1c4bdb4534fb3d77f8ee3
cb06a22bc61d8294039b245debc54893e96c56b0
refs/heads/main
2022-12-30T17:39:31.387121
2020-10-24T04:09:18
2020-10-24T04:09:18
302,001,761
1
0
null
null
null
null
UTF-8
Java
false
false
568
java
package test.order; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator; public class OrderGroupComparator extends WritableComparator { public OrderGroupComparator() { super(OrderBean.class, true); } @Override public int compare(WritableComparable a, WritableComparable b) { OrderBean a1 = (OrderBean) a; OrderBean b1 = (OrderBean) b; if(a1.getOrder_id() > b1.getOrder_id()) return 1; if(a1.getOrder_id() < b1.getOrder_id()) return -1; return 0; } }
9b773e49fff5e93c32c0bd0685a8062f1ee0b04b
e6c0af983a10a6509a1526b8b955cd366fa979a9
/practice-23-11-2020/src/findMaxInArray.java
9926d6116eb746f940b3ae17502f91e76e39b88e
[]
no_license
vinhng2301/java-practice-4-11-2020
c181b6ac2b747fab27ab693e1be095e10ae38790
e07b26a41b5beeefbb1680be4fff4b1f61a02ed5
refs/heads/master
2023-01-23T14:11:55.992095
2020-12-01T03:10:19
2020-12-01T03:10:19
309,854,700
0
0
null
null
null
null
UTF-8
Java
false
false
1,079
java
import java.util.Scanner; public class findMaxInArray { public static void main(String[] args) { int size; int[] array; Scanner scanner = new Scanner(System.in); do { System.out.print("Enter a size:"); size = scanner.nextInt(); if (size > 20) System.out.println("Size should not exceed 20"); } while (size > 20); array = new int[size]; int i = 0; while (i< array.length){ System.out.print("Enter element" + (i+1) + " : "); array[i] = scanner.nextInt(); i++; } System.out.print("Property list: "); for (int j = 0; j < array.length; j++){ System.out.print(array[j] + "\t"); } int max = array[0]; int index = 1; for (int j = 0; j < array.length; j++){ if (array[j] > max) { max = array [j]; index = j + 1; } } System.out.println("Max is " + max + ", at position " + index); } }
74b0f52e9270c7846881768f52f7cd251581e792
db0c448dcb353860f655529f41cb7c76c9545855
/src/main/java/com/jxust/demo/dao/PersonRepository.java
e3ca857b142bbaa009068c33021d7dc033284153
[]
no_license
lmfxuegit/springBootdemo
44f734a249a3b83a0ceedb8d395eabc7ed0aea97
8c9a9a6f4bf1541cf01e0c33767128a24b35efc5
refs/heads/master
2021-05-10T11:07:06.329918
2018-01-22T03:19:49
2018-01-22T03:19:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package com.jxust.demo.dao; import com.jxust.demo.entity.Person; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; public interface PersonRepository extends JpaRepository<Person,Integer> { List<Person> findAllByAge(Integer age); }
0370dde979bd1b52e6a86f4b4beb6a90ac9f9b7e
a85576beeda0ea42cda770c5ffb2a096987a08a6
/jp-senac/first-code/metaspace/HelloWorld135.java
1da9a3c7dddbca2517e2868ab7a2ecbe675435a7
[]
no_license
Wiu0/oracle-academy
dc8b2c9f0a1211fe09084a6e6ed42c236d23664b
d8ecd71c86d942e81e19f232d610416884fcbd8e
refs/heads/master
2022-12-21T19:53:42.392000
2022-12-10T14:51:17
2022-12-10T14:51:17
160,748,651
3
3
null
null
null
null
UTF-8
Java
false
false
104
java
public class HelloWorld135{ public static void main(String[] args){ System.out.println("Hello World");}}
cbe4794279574e922c3c7b5b93b5865e6bd28ae5
b345a8f1f461e8258ee9a8a935af0a7fffaa30d6
/ServiceProvision-infrastructure/src/main/java/com/albumen/project/TimeTableMapper.java
718c299c5e31a4c293c5ec67d4fd42216ca24acb
[]
no_license
AlbumenJ/ServiceProvision
9d7ff4aefa1f5dafa7b1716b14e7c8a0a692026b
ebac92fabe8f7e2d8bcf3df8b0a8d412ebdc5a8e
refs/heads/master
2023-05-05T04:15:49.104461
2021-06-05T07:21:27
2021-06-05T07:21:27
363,675,966
0
0
null
null
null
null
UTF-8
Java
false
false
206
java
package com.albumen.project; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; @Mapper public interface TimeTableMapper extends BaseMapper<TimeTable> { }
4fbe18a00385edc10bfeae7ef3e6b2fb5e7c4b7c
6a2b13a8eb3d610b6d6008ef6937f8c467567319
/discotecaLondon/src/IoDatos/ioPersonas.java
eba3d0af3cb2fb9dadf6f010d82e8957a189c9bc
[ "Apache-2.0" ]
permissive
wherePANDA/discotecaLondon
84b23bd550c773a3e7bd5d90eed3353593efa9b1
f2390752b9b00bb1c9e4ab1d23b1900a918b4432
refs/heads/master
2022-01-19T14:35:08.336441
2019-04-12T16:39:41
2019-04-12T16:39:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,474
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 IoDatos; import Personas.Persona; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Catalin 'uNKoLL' Ciurcanu */ public class ioPersonas { public static ArrayList cargarFichero(){ ArrayList<Persona> vPersonas = new ArrayList<>(); File f = new File("invitados.txt"); if(!f.exists()){ try { f.createNewFile(); } catch (IOException ex) { Logger.getLogger(ioPersonas.class.getName()).log(Level.SEVERE, null, ex); } } try { FileReader fr = new FileReader(f); Scanner leer = new Scanner(fr); while(leer.hasNext()){ String linea = leer.nextLine(); String aux[] = linea.split(";"); vPersonas.add(new Persona(aux[0], aux[1], aux[2])); } } catch (FileNotFoundException ex) { Logger.getLogger(ioPersonas.class.getName()).log(Level.SEVERE, null, ex); } return vPersonas; } }
[ "" ]
e7479d8873560240b806639c699b621785542abd
cfb96542503e7646be4ff1a9c39bde4898b1f75a
/gen/android/support/v7/appcompat/R.java
a51757f1cd9557197b9918ece5c9a1a0aa08b4ff
[]
no_license
Gr4deA-223/AnalEyes
461fe9c00a626b2f2cc1c22fa06890cd09673989
65aea041abd5177f941ef55e1ad10963b4c2dbb6
refs/heads/master
2020-12-24T13:53:21.319932
2014-09-25T09:09:04
2014-09-25T09:09:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
41,086
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package android.support.v7.appcompat; public final class R { public static final class anim { public static final int abc_fade_in = 0x7f040000; public static final int abc_fade_out = 0x7f040001; public static final int abc_slide_in_bottom = 0x7f040002; public static final int abc_slide_in_top = 0x7f040003; public static final int abc_slide_out_bottom = 0x7f040004; public static final int abc_slide_out_top = 0x7f040005; } public static final class attr { public static final int actionBarDivider = 0x7f01000f; public static final int actionBarItemBackground = 0x7f010010; public static final int actionBarSize = 0x7f01000e; public static final int actionBarSplitStyle = 0x7f01000c; public static final int actionBarStyle = 0x7f01000b; public static final int actionBarTabBarStyle = 0x7f010008; public static final int actionBarTabStyle = 0x7f010007; public static final int actionBarTabTextStyle = 0x7f010009; public static final int actionBarWidgetTheme = 0x7f01000d; public static final int actionButtonStyle = 0x7f010016; public static final int actionDropDownStyle = 0x7f010047; public static final int actionLayout = 0x7f01004e; public static final int actionMenuTextAppearance = 0x7f010011; public static final int actionMenuTextColor = 0x7f010012; public static final int actionModeBackground = 0x7f01003c; public static final int actionModeCloseButtonStyle = 0x7f01003b; public static final int actionModeCloseDrawable = 0x7f01003e; public static final int actionModeCopyDrawable = 0x7f010040; public static final int actionModeCutDrawable = 0x7f01003f; public static final int actionModeFindDrawable = 0x7f010044; public static final int actionModePasteDrawable = 0x7f010041; public static final int actionModePopupWindowStyle = 0x7f010046; public static final int actionModeSelectAllDrawable = 0x7f010042; public static final int actionModeShareDrawable = 0x7f010043; public static final int actionModeSplitBackground = 0x7f01003d; public static final int actionModeStyle = 0x7f01003a; public static final int actionModeWebSearchDrawable = 0x7f010045; public static final int actionOverflowButtonStyle = 0x7f01000a; public static final int actionProviderClass = 0x7f010050; public static final int actionViewClass = 0x7f01004f; public static final int activityChooserViewStyle = 0x7f01006c; public static final int background = 0x7f01002f; public static final int backgroundSplit = 0x7f010031; public static final int backgroundStacked = 0x7f010030; public static final int buttonBarButtonStyle = 0x7f010018; public static final int buttonBarStyle = 0x7f010017; public static final int customNavigationLayout = 0x7f010032; public static final int disableChildrenWhenDisabled = 0x7f010054; public static final int displayOptions = 0x7f010028; public static final int divider = 0x7f01002e; public static final int dividerHorizontal = 0x7f01001b; public static final int dividerPadding = 0x7f010056; public static final int dividerVertical = 0x7f01001a; public static final int dropDownListViewStyle = 0x7f010021; public static final int dropdownListPreferredItemHeight = 0x7f010048; public static final int expandActivityOverflowButtonDrawable = 0x7f01006b; public static final int height = 0x7f010026; public static final int homeAsUpIndicator = 0x7f010013; public static final int homeLayout = 0x7f010033; public static final int icon = 0x7f01002c; public static final int iconifiedByDefault = 0x7f01005a; public static final int indeterminateProgressStyle = 0x7f010035; public static final int initialActivityCount = 0x7f01006a; public static final int isLightTheme = 0x7f010059; public static final int itemPadding = 0x7f010037; public static final int listChoiceBackgroundIndicator = 0x7f01004c; public static final int listPopupWindowStyle = 0x7f010022; public static final int listPreferredItemHeight = 0x7f01001c; public static final int listPreferredItemHeightLarge = 0x7f01001e; public static final int listPreferredItemHeightSmall = 0x7f01001d; public static final int listPreferredItemPaddingLeft = 0x7f01001f; public static final int listPreferredItemPaddingRight = 0x7f010020; public static final int logo = 0x7f01002d; public static final int navigationMode = 0x7f010027; public static final int paddingEnd = 0x7f010039; public static final int paddingStart = 0x7f010038; public static final int panelMenuListTheme = 0x7f01004b; public static final int panelMenuListWidth = 0x7f01004a; public static final int popupMenuStyle = 0x7f010049; public static final int popupPromptView = 0x7f010053; public static final int progressBarPadding = 0x7f010036; public static final int progressBarStyle = 0x7f010034; public static final int prompt = 0x7f010051; public static final int queryHint = 0x7f01005b; public static final int searchDropdownBackground = 0x7f01005c; public static final int searchResultListItemHeight = 0x7f010065; public static final int searchViewAutoCompleteTextView = 0x7f010069; public static final int searchViewCloseIcon = 0x7f01005d; public static final int searchViewEditQuery = 0x7f010061; public static final int searchViewEditQueryBackground = 0x7f010062; public static final int searchViewGoIcon = 0x7f01005e; public static final int searchViewSearchIcon = 0x7f01005f; public static final int searchViewTextField = 0x7f010063; public static final int searchViewTextFieldRight = 0x7f010064; public static final int searchViewVoiceIcon = 0x7f010060; public static final int selectableItemBackground = 0x7f010019; public static final int showAsAction = 0x7f01004d; public static final int showDividers = 0x7f010055; public static final int spinnerDropDownItemStyle = 0x7f010058; public static final int spinnerMode = 0x7f010052; public static final int spinnerStyle = 0x7f010057; public static final int subtitle = 0x7f010029; public static final int subtitleTextStyle = 0x7f01002b; public static final int textAllCaps = 0x7f01006d; public static final int textAppearanceLargePopupMenu = 0x7f010014; public static final int textAppearanceListItem = 0x7f010023; public static final int textAppearanceListItemSmall = 0x7f010024; public static final int textAppearanceSearchResultSubtitle = 0x7f010067; public static final int textAppearanceSearchResultTitle = 0x7f010066; public static final int textAppearanceSmallPopupMenu = 0x7f010015; public static final int textColorSearchUrl = 0x7f010068; public static final int title = 0x7f010025; public static final int titleTextStyle = 0x7f01002a; public static final int windowActionBar = 0x7f010000; public static final int windowActionBarOverlay = 0x7f010001; public static final int windowFixedHeightMajor = 0x7f010006; public static final int windowFixedHeightMinor = 0x7f010004; public static final int windowFixedWidthMajor = 0x7f010003; public static final int windowFixedWidthMinor = 0x7f010005; public static final int windowSplitActionBar = 0x7f010002; } public static final class bool { public static final int abc_action_bar_embed_tabs_pre_jb = 0x7f060000; public static final int abc_action_bar_expanded_action_views_exclusive = 0x7f060001; public static final int abc_config_actionMenuItemAllCaps = 0x7f060005; public static final int abc_config_allowActionMenuItemTextWithIcon = 0x7f060004; public static final int abc_config_showMenuShortcutsWhenKeyboardPresent = 0x7f060003; public static final int abc_split_action_bar_is_narrow = 0x7f060002; } public static final class color { public static final int abc_search_url_text_holo = 0x7f070003; public static final int abc_search_url_text_normal = 0x7f070000; public static final int abc_search_url_text_pressed = 0x7f070002; public static final int abc_search_url_text_selected = 0x7f070001; } public static final class dimen { public static final int abc_action_bar_default_height = 0x7f080002; public static final int abc_action_bar_icon_vertical_padding = 0x7f080003; public static final int abc_action_bar_progress_bar_size = 0x7f08000a; public static final int abc_action_bar_stacked_max_height = 0x7f080009; public static final int abc_action_bar_stacked_tab_max_width = 0x7f080001; public static final int abc_action_bar_subtitle_bottom_margin = 0x7f080007; public static final int abc_action_bar_subtitle_text_size = 0x7f080005; public static final int abc_action_bar_subtitle_top_margin = 0x7f080006; public static final int abc_action_bar_title_text_size = 0x7f080004; public static final int abc_action_button_min_width = 0x7f080008; public static final int abc_config_prefDialogWidth = 0x7f080000; public static final int abc_dropdownitem_icon_width = 0x7f080010; public static final int abc_dropdownitem_text_padding_left = 0x7f08000e; public static final int abc_dropdownitem_text_padding_right = 0x7f08000f; public static final int abc_panel_menu_list_width = 0x7f08000b; public static final int abc_search_view_preferred_width = 0x7f08000d; public static final int abc_search_view_text_min_width = 0x7f08000c; public static final int dialog_fixed_height_major = 0x7f080013; public static final int dialog_fixed_height_minor = 0x7f080014; public static final int dialog_fixed_width_major = 0x7f080011; public static final int dialog_fixed_width_minor = 0x7f080012; } public static final class drawable { public static final int abc_ab_bottom_solid_dark_holo = 0x7f020000; public static final int abc_ab_bottom_solid_light_holo = 0x7f020001; public static final int abc_ab_bottom_transparent_dark_holo = 0x7f020002; public static final int abc_ab_bottom_transparent_light_holo = 0x7f020003; public static final int abc_ab_share_pack_holo_dark = 0x7f020004; public static final int abc_ab_share_pack_holo_light = 0x7f020005; public static final int abc_ab_solid_dark_holo = 0x7f020006; public static final int abc_ab_solid_light_holo = 0x7f020007; public static final int abc_ab_stacked_solid_dark_holo = 0x7f020008; public static final int abc_ab_stacked_solid_light_holo = 0x7f020009; public static final int abc_ab_stacked_transparent_dark_holo = 0x7f02000a; public static final int abc_ab_stacked_transparent_light_holo = 0x7f02000b; public static final int abc_ab_transparent_dark_holo = 0x7f02000c; public static final int abc_ab_transparent_light_holo = 0x7f02000d; public static final int abc_cab_background_bottom_holo_dark = 0x7f02000e; public static final int abc_cab_background_bottom_holo_light = 0x7f02000f; public static final int abc_cab_background_top_holo_dark = 0x7f020010; public static final int abc_cab_background_top_holo_light = 0x7f020011; public static final int abc_ic_ab_back_holo_dark = 0x7f020012; public static final int abc_ic_ab_back_holo_light = 0x7f020013; public static final int abc_ic_cab_done_holo_dark = 0x7f020014; public static final int abc_ic_cab_done_holo_light = 0x7f020015; public static final int abc_ic_clear = 0x7f020016; public static final int abc_ic_clear_disabled = 0x7f020017; public static final int abc_ic_clear_holo_light = 0x7f020018; public static final int abc_ic_clear_normal = 0x7f020019; public static final int abc_ic_clear_search_api_disabled_holo_light = 0x7f02001a; public static final int abc_ic_clear_search_api_holo_light = 0x7f02001b; public static final int abc_ic_commit_search_api_holo_dark = 0x7f02001c; public static final int abc_ic_commit_search_api_holo_light = 0x7f02001d; public static final int abc_ic_go = 0x7f02001e; public static final int abc_ic_go_search_api_holo_light = 0x7f02001f; public static final int abc_ic_menu_moreoverflow_normal_holo_dark = 0x7f020020; public static final int abc_ic_menu_moreoverflow_normal_holo_light = 0x7f020021; public static final int abc_ic_menu_share_holo_dark = 0x7f020022; public static final int abc_ic_menu_share_holo_light = 0x7f020023; public static final int abc_ic_search = 0x7f020024; public static final int abc_ic_search_api_holo_light = 0x7f020025; public static final int abc_ic_voice_search = 0x7f020026; public static final int abc_ic_voice_search_api_holo_light = 0x7f020027; public static final int abc_item_background_holo_dark = 0x7f020028; public static final int abc_item_background_holo_light = 0x7f020029; public static final int abc_list_divider_holo_dark = 0x7f02002a; public static final int abc_list_divider_holo_light = 0x7f02002b; public static final int abc_list_focused_holo = 0x7f02002c; public static final int abc_list_longpressed_holo = 0x7f02002d; public static final int abc_list_pressed_holo_dark = 0x7f02002e; public static final int abc_list_pressed_holo_light = 0x7f02002f; public static final int abc_list_selector_background_transition_holo_dark = 0x7f020030; public static final int abc_list_selector_background_transition_holo_light = 0x7f020031; public static final int abc_list_selector_disabled_holo_dark = 0x7f020032; public static final int abc_list_selector_disabled_holo_light = 0x7f020033; public static final int abc_list_selector_holo_dark = 0x7f020034; public static final int abc_list_selector_holo_light = 0x7f020035; public static final int abc_menu_dropdown_panel_holo_dark = 0x7f020036; public static final int abc_menu_dropdown_panel_holo_light = 0x7f020037; public static final int abc_menu_hardkey_panel_holo_dark = 0x7f020038; public static final int abc_menu_hardkey_panel_holo_light = 0x7f020039; public static final int abc_search_dropdown_dark = 0x7f02003a; public static final int abc_search_dropdown_light = 0x7f02003b; public static final int abc_spinner_ab_default_holo_dark = 0x7f02003c; public static final int abc_spinner_ab_default_holo_light = 0x7f02003d; public static final int abc_spinner_ab_disabled_holo_dark = 0x7f02003e; public static final int abc_spinner_ab_disabled_holo_light = 0x7f02003f; public static final int abc_spinner_ab_focused_holo_dark = 0x7f020040; public static final int abc_spinner_ab_focused_holo_light = 0x7f020041; public static final int abc_spinner_ab_holo_dark = 0x7f020042; public static final int abc_spinner_ab_holo_light = 0x7f020043; public static final int abc_spinner_ab_pressed_holo_dark = 0x7f020044; public static final int abc_spinner_ab_pressed_holo_light = 0x7f020045; public static final int abc_tab_indicator_ab_holo = 0x7f020046; public static final int abc_tab_selected_focused_holo = 0x7f020047; public static final int abc_tab_selected_holo = 0x7f020048; public static final int abc_tab_selected_pressed_holo = 0x7f020049; public static final int abc_tab_unselected_pressed_holo = 0x7f02004a; public static final int abc_textfield_search_default_holo_dark = 0x7f02004b; public static final int abc_textfield_search_default_holo_light = 0x7f02004c; public static final int abc_textfield_search_right_default_holo_dark = 0x7f02004d; public static final int abc_textfield_search_right_default_holo_light = 0x7f02004e; public static final int abc_textfield_search_right_selected_holo_dark = 0x7f02004f; public static final int abc_textfield_search_right_selected_holo_light = 0x7f020050; public static final int abc_textfield_search_selected_holo_dark = 0x7f020051; public static final int abc_textfield_search_selected_holo_light = 0x7f020052; public static final int abc_textfield_searchview_holo_dark = 0x7f020053; public static final int abc_textfield_searchview_holo_light = 0x7f020054; public static final int abc_textfield_searchview_right_holo_dark = 0x7f020055; public static final int abc_textfield_searchview_right_holo_light = 0x7f020056; } public static final class id { public static final int action_bar = 0x7f05001c; public static final int action_bar_activity_content = 0x7f050015; public static final int action_bar_container = 0x7f05001b; public static final int action_bar_overlay_layout = 0x7f05001f; public static final int action_bar_root = 0x7f05001a; public static final int action_bar_subtitle = 0x7f050023; public static final int action_bar_title = 0x7f050022; public static final int action_context_bar = 0x7f05001d; public static final int action_menu_divider = 0x7f050016; public static final int action_menu_presenter = 0x7f050017; public static final int action_mode_close_button = 0x7f050024; public static final int activity_chooser_view_content = 0x7f050025; public static final int always = 0x7f05000b; public static final int beginning = 0x7f050011; public static final int checkbox = 0x7f05002d; public static final int collapseActionView = 0x7f05000d; public static final int default_activity_button = 0x7f050028; public static final int dialog = 0x7f05000e; public static final int disableHome = 0x7f050008; public static final int dropdown = 0x7f05000f; public static final int edit_query = 0x7f050030; public static final int end = 0x7f050013; public static final int expand_activities_button = 0x7f050026; public static final int expanded_menu = 0x7f05002c; public static final int home = 0x7f050014; public static final int homeAsUp = 0x7f050005; public static final int icon = 0x7f05002a; public static final int ifRoom = 0x7f05000a; public static final int image = 0x7f050027; public static final int listMode = 0x7f050001; public static final int list_item = 0x7f050029; public static final int middle = 0x7f050012; public static final int never = 0x7f050009; public static final int none = 0x7f050010; public static final int normal = 0x7f050000; public static final int progress_circular = 0x7f050018; public static final int progress_horizontal = 0x7f050019; public static final int radio = 0x7f05002f; public static final int search_badge = 0x7f050032; public static final int search_bar = 0x7f050031; public static final int search_button = 0x7f050033; public static final int search_close_btn = 0x7f050038; public static final int search_edit_frame = 0x7f050034; public static final int search_go_btn = 0x7f05003a; public static final int search_mag_icon = 0x7f050035; public static final int search_plate = 0x7f050036; public static final int search_src_text = 0x7f050037; public static final int search_voice_btn = 0x7f05003b; public static final int shortcut = 0x7f05002e; public static final int showCustom = 0x7f050007; public static final int showHome = 0x7f050004; public static final int showTitle = 0x7f050006; public static final int split_action_bar = 0x7f05001e; public static final int submit_area = 0x7f050039; public static final int tabMode = 0x7f050002; public static final int title = 0x7f05002b; public static final int top_action_bar = 0x7f050020; public static final int up = 0x7f050021; public static final int useLogo = 0x7f050003; public static final int withText = 0x7f05000c; } public static final class integer { public static final int abc_max_action_buttons = 0x7f090000; } public static final class layout { public static final int abc_action_bar_decor = 0x7f030000; public static final int abc_action_bar_decor_include = 0x7f030001; public static final int abc_action_bar_decor_overlay = 0x7f030002; public static final int abc_action_bar_home = 0x7f030003; public static final int abc_action_bar_tab = 0x7f030004; public static final int abc_action_bar_tabbar = 0x7f030005; public static final int abc_action_bar_title_item = 0x7f030006; public static final int abc_action_bar_view_list_nav_layout = 0x7f030007; public static final int abc_action_menu_item_layout = 0x7f030008; public static final int abc_action_menu_layout = 0x7f030009; public static final int abc_action_mode_bar = 0x7f03000a; public static final int abc_action_mode_close_item = 0x7f03000b; public static final int abc_activity_chooser_view = 0x7f03000c; public static final int abc_activity_chooser_view_include = 0x7f03000d; public static final int abc_activity_chooser_view_list_item = 0x7f03000e; public static final int abc_expanded_menu_layout = 0x7f03000f; public static final int abc_list_menu_item_checkbox = 0x7f030010; public static final int abc_list_menu_item_icon = 0x7f030011; public static final int abc_list_menu_item_layout = 0x7f030012; public static final int abc_list_menu_item_radio = 0x7f030013; public static final int abc_popup_menu_item_layout = 0x7f030014; public static final int abc_search_dropdown_item_icons_2line = 0x7f030015; public static final int abc_search_view = 0x7f030016; public static final int abc_simple_decor = 0x7f030017; public static final int support_simple_spinner_dropdown_item = 0x7f03006a; } public static final class string { public static final int abc_action_bar_home_description = 0x7f0a0001; public static final int abc_action_bar_up_description = 0x7f0a0002; public static final int abc_action_menu_overflow_description = 0x7f0a0003; public static final int abc_action_mode_done = 0x7f0a0000; public static final int abc_activity_chooser_view_see_all = 0x7f0a000a; public static final int abc_activitychooserview_choose_application = 0x7f0a0009; public static final int abc_searchview_description_clear = 0x7f0a0006; public static final int abc_searchview_description_query = 0x7f0a0005; public static final int abc_searchview_description_search = 0x7f0a0004; public static final int abc_searchview_description_submit = 0x7f0a0007; public static final int abc_searchview_description_voice = 0x7f0a0008; public static final int abc_shareactionprovider_share_with = 0x7f0a000c; public static final int abc_shareactionprovider_share_with_application = 0x7f0a000b; } public static final class style { public static final int TextAppearance_AppCompat_Base_CompactMenu_Dialog = 0x7f0b0063; public static final int TextAppearance_AppCompat_Base_SearchResult = 0x7f0b006d; public static final int TextAppearance_AppCompat_Base_SearchResult_Subtitle = 0x7f0b006f; public static final int TextAppearance_AppCompat_Base_SearchResult_Title = 0x7f0b006e; public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Large = 0x7f0b0069; public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Small = 0x7f0b006a; public static final int TextAppearance_AppCompat_Light_Base_SearchResult = 0x7f0b0070; public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Subtitle = 0x7f0b0072; public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Title = 0x7f0b0071; public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Large = 0x7f0b006b; public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Small = 0x7f0b006c; public static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle = 0x7f0b0035; public static final int TextAppearance_AppCompat_Light_SearchResult_Title = 0x7f0b0034; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f0b0030; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f0b0031; public static final int TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f0b0033; public static final int TextAppearance_AppCompat_SearchResult_Title = 0x7f0b0032; public static final int TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f0b001a; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f0b0006; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f0b0008; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f0b0005; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f0b0007; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f0b001e; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse = 0x7f0b0020; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f0b001d; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse = 0x7f0b001f; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Menu = 0x7f0b0054; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle = 0x7f0b0056; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle_Inverse = 0x7f0b0058; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title = 0x7f0b0055; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title_Inverse = 0x7f0b0057; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle = 0x7f0b0051; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle_Inverse = 0x7f0b0053; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title = 0x7f0b0050; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title_Inverse = 0x7f0b0052; public static final int TextAppearance_AppCompat_Widget_Base_DropDownItem = 0x7f0b0061; public static final int TextAppearance_AppCompat_Widget_DropDownItem = 0x7f0b0021; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f0b002e; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f0b002f; public static final int TextAppearance_Widget_AppCompat_Base_ExpandedMenu_Item = 0x7f0b0062; public static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f0b0028; public static final int Theme_AppCompat = 0x7f0b0077; public static final int Theme_AppCompat_Base_CompactMenu = 0x7f0b0083; public static final int Theme_AppCompat_Base_CompactMenu_Dialog = 0x7f0b0084; public static final int Theme_AppCompat_CompactMenu = 0x7f0b007c; public static final int Theme_AppCompat_CompactMenu_Dialog = 0x7f0b007d; public static final int Theme_AppCompat_DialogWhenLarge = 0x7f0b007a; public static final int Theme_AppCompat_Light = 0x7f0b0078; public static final int Theme_AppCompat_Light_DarkActionBar = 0x7f0b0079; public static final int Theme_AppCompat_Light_DialogWhenLarge = 0x7f0b007b; public static final int Theme_Base = 0x7f0b007e; public static final int Theme_Base_AppCompat = 0x7f0b0080; public static final int Theme_Base_AppCompat_DialogWhenLarge = 0x7f0b0085; public static final int Theme_Base_AppCompat_DialogWhenLarge_Base = 0x7f0b0089; public static final int Theme_Base_AppCompat_Dialog_FixedSize = 0x7f0b0087; public static final int Theme_Base_AppCompat_Dialog_Light_FixedSize = 0x7f0b0088; public static final int Theme_Base_AppCompat_Light = 0x7f0b0081; public static final int Theme_Base_AppCompat_Light_DarkActionBar = 0x7f0b0082; public static final int Theme_Base_AppCompat_Light_DialogWhenLarge = 0x7f0b0086; public static final int Theme_Base_AppCompat_Light_DialogWhenLarge_Base = 0x7f0b008a; public static final int Theme_Base_Light = 0x7f0b007f; public static final int Widget_AppCompat_ActionBar = 0x7f0b0000; public static final int Widget_AppCompat_ActionBar_Solid = 0x7f0b0002; public static final int Widget_AppCompat_ActionBar_TabBar = 0x7f0b0011; public static final int Widget_AppCompat_ActionBar_TabText = 0x7f0b0017; public static final int Widget_AppCompat_ActionBar_TabView = 0x7f0b0014; public static final int Widget_AppCompat_ActionButton = 0x7f0b000b; public static final int Widget_AppCompat_ActionButton_CloseMode = 0x7f0b000d; public static final int Widget_AppCompat_ActionButton_Overflow = 0x7f0b000f; public static final int Widget_AppCompat_ActionMode = 0x7f0b001b; public static final int Widget_AppCompat_ActivityChooserView = 0x7f0b0038; public static final int Widget_AppCompat_AutoCompleteTextView = 0x7f0b0036; public static final int Widget_AppCompat_Base_ActionBar = 0x7f0b003a; public static final int Widget_AppCompat_Base_ActionBar_Solid = 0x7f0b003c; public static final int Widget_AppCompat_Base_ActionBar_TabBar = 0x7f0b0045; public static final int Widget_AppCompat_Base_ActionBar_TabText = 0x7f0b004b; public static final int Widget_AppCompat_Base_ActionBar_TabView = 0x7f0b0048; public static final int Widget_AppCompat_Base_ActionButton = 0x7f0b003f; public static final int Widget_AppCompat_Base_ActionButton_CloseMode = 0x7f0b0041; public static final int Widget_AppCompat_Base_ActionButton_Overflow = 0x7f0b0043; public static final int Widget_AppCompat_Base_ActionMode = 0x7f0b004e; public static final int Widget_AppCompat_Base_ActivityChooserView = 0x7f0b0075; public static final int Widget_AppCompat_Base_AutoCompleteTextView = 0x7f0b0073; public static final int Widget_AppCompat_Base_DropDownItem_Spinner = 0x7f0b005d; public static final int Widget_AppCompat_Base_ListPopupWindow = 0x7f0b0065; public static final int Widget_AppCompat_Base_ListView_DropDown = 0x7f0b005f; public static final int Widget_AppCompat_Base_ListView_Menu = 0x7f0b0064; public static final int Widget_AppCompat_Base_PopupMenu = 0x7f0b0067; public static final int Widget_AppCompat_Base_ProgressBar = 0x7f0b005a; public static final int Widget_AppCompat_Base_ProgressBar_Horizontal = 0x7f0b0059; public static final int Widget_AppCompat_Base_Spinner = 0x7f0b005b; public static final int Widget_AppCompat_DropDownItem_Spinner = 0x7f0b0024; public static final int Widget_AppCompat_Light_ActionBar = 0x7f0b0001; public static final int Widget_AppCompat_Light_ActionBar_Solid = 0x7f0b0003; public static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse = 0x7f0b0004; public static final int Widget_AppCompat_Light_ActionBar_TabBar = 0x7f0b0012; public static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse = 0x7f0b0013; public static final int Widget_AppCompat_Light_ActionBar_TabText = 0x7f0b0018; public static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f0b0019; public static final int Widget_AppCompat_Light_ActionBar_TabView = 0x7f0b0015; public static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse = 0x7f0b0016; public static final int Widget_AppCompat_Light_ActionButton = 0x7f0b000c; public static final int Widget_AppCompat_Light_ActionButton_CloseMode = 0x7f0b000e; public static final int Widget_AppCompat_Light_ActionButton_Overflow = 0x7f0b0010; public static final int Widget_AppCompat_Light_ActionMode_Inverse = 0x7f0b001c; public static final int Widget_AppCompat_Light_ActivityChooserView = 0x7f0b0039; public static final int Widget_AppCompat_Light_AutoCompleteTextView = 0x7f0b0037; public static final int Widget_AppCompat_Light_Base_ActionBar = 0x7f0b003b; public static final int Widget_AppCompat_Light_Base_ActionBar_Solid = 0x7f0b003d; public static final int Widget_AppCompat_Light_Base_ActionBar_Solid_Inverse = 0x7f0b003e; public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar = 0x7f0b0046; public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar_Inverse = 0x7f0b0047; public static final int Widget_AppCompat_Light_Base_ActionBar_TabText = 0x7f0b004c; public static final int Widget_AppCompat_Light_Base_ActionBar_TabText_Inverse = 0x7f0b004d; public static final int Widget_AppCompat_Light_Base_ActionBar_TabView = 0x7f0b0049; public static final int Widget_AppCompat_Light_Base_ActionBar_TabView_Inverse = 0x7f0b004a; public static final int Widget_AppCompat_Light_Base_ActionButton = 0x7f0b0040; public static final int Widget_AppCompat_Light_Base_ActionButton_CloseMode = 0x7f0b0042; public static final int Widget_AppCompat_Light_Base_ActionButton_Overflow = 0x7f0b0044; public static final int Widget_AppCompat_Light_Base_ActionMode_Inverse = 0x7f0b004f; public static final int Widget_AppCompat_Light_Base_ActivityChooserView = 0x7f0b0076; public static final int Widget_AppCompat_Light_Base_AutoCompleteTextView = 0x7f0b0074; public static final int Widget_AppCompat_Light_Base_DropDownItem_Spinner = 0x7f0b005e; public static final int Widget_AppCompat_Light_Base_ListPopupWindow = 0x7f0b0066; public static final int Widget_AppCompat_Light_Base_ListView_DropDown = 0x7f0b0060; public static final int Widget_AppCompat_Light_Base_PopupMenu = 0x7f0b0068; public static final int Widget_AppCompat_Light_Base_Spinner = 0x7f0b005c; public static final int Widget_AppCompat_Light_DropDownItem_Spinner = 0x7f0b0025; public static final int Widget_AppCompat_Light_ListPopupWindow = 0x7f0b002a; public static final int Widget_AppCompat_Light_ListView_DropDown = 0x7f0b0027; public static final int Widget_AppCompat_Light_PopupMenu = 0x7f0b002c; public static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar = 0x7f0b0023; public static final int Widget_AppCompat_ListPopupWindow = 0x7f0b0029; public static final int Widget_AppCompat_ListView_DropDown = 0x7f0b0026; public static final int Widget_AppCompat_ListView_Menu = 0x7f0b002d; public static final int Widget_AppCompat_PopupMenu = 0x7f0b002b; public static final int Widget_AppCompat_ProgressBar = 0x7f0b000a; public static final int Widget_AppCompat_ProgressBar_Horizontal = 0x7f0b0009; public static final int Widget_AppCompat_Spinner_DropDown_ActionBar = 0x7f0b0022; } public static final class styleable { public static final int[] ActionBar = { 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033, 0x7f010034, 0x7f010035, 0x7f010036, 0x7f010037 }; public static final int[] ActionBarLayout = { 0x010100b3 }; public static final int ActionBarLayout_android_layout_gravity = 0; public static final int[] ActionBarWindow = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 }; public static final int ActionBarWindow_windowActionBar = 0; public static final int ActionBarWindow_windowActionBarOverlay = 1; public static final int ActionBarWindow_windowFixedHeightMajor = 6; public static final int ActionBarWindow_windowFixedHeightMinor = 4; public static final int ActionBarWindow_windowFixedWidthMajor = 3; public static final int ActionBarWindow_windowFixedWidthMinor = 5; public static final int ActionBarWindow_windowSplitActionBar = 2; public static final int ActionBar_background = 10; public static final int ActionBar_backgroundSplit = 12; public static final int ActionBar_backgroundStacked = 11; public static final int ActionBar_customNavigationLayout = 13; public static final int ActionBar_displayOptions = 3; public static final int ActionBar_divider = 9; public static final int ActionBar_height = 1; public static final int ActionBar_homeLayout = 14; public static final int ActionBar_icon = 7; public static final int ActionBar_indeterminateProgressStyle = 16; public static final int ActionBar_itemPadding = 18; public static final int ActionBar_logo = 8; public static final int ActionBar_navigationMode = 2; public static final int ActionBar_progressBarPadding = 17; public static final int ActionBar_progressBarStyle = 15; public static final int ActionBar_subtitle = 4; public static final int ActionBar_subtitleTextStyle = 6; public static final int ActionBar_title = 0; public static final int ActionBar_titleTextStyle = 5; public static final int[] ActionMenuItemView = { 0x0101013f }; public static final int ActionMenuItemView_android_minWidth = 0; public static final int[] ActionMenuView = { }; public static final int[] ActionMode = { 0x7f010026, 0x7f01002a, 0x7f01002b, 0x7f01002f, 0x7f010031 }; public static final int ActionMode_background = 3; public static final int ActionMode_backgroundSplit = 4; public static final int ActionMode_height = 0; public static final int ActionMode_subtitleTextStyle = 2; public static final int ActionMode_titleTextStyle = 1; public static final int[] ActivityChooserView = { 0x7f01006a, 0x7f01006b }; public static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 1; public static final int ActivityChooserView_initialActivityCount = 0; public static final int[] CompatTextView = { 0x7f01006d }; public static final int CompatTextView_textAllCaps = 0; public static final int[] LinearLayoutICS = { 0x7f01002e, 0x7f010055, 0x7f010056 }; public static final int LinearLayoutICS_divider = 0; public static final int LinearLayoutICS_dividerPadding = 2; public static final int LinearLayoutICS_showDividers = 1; public static final int[] MenuGroup = { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 }; public static final int MenuGroup_android_checkableBehavior = 5; public static final int MenuGroup_android_enabled = 0; public static final int MenuGroup_android_id = 1; public static final int MenuGroup_android_menuCategory = 3; public static final int MenuGroup_android_orderInCategory = 4; public static final int MenuGroup_android_visible = 2; public static final int[] MenuItem = { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050 }; public static final int MenuItem_actionLayout = 14; public static final int MenuItem_actionProviderClass = 16; public static final int MenuItem_actionViewClass = 15; public static final int MenuItem_android_alphabeticShortcut = 9; public static final int MenuItem_android_checkable = 11; public static final int MenuItem_android_checked = 3; public static final int MenuItem_android_enabled = 1; public static final int MenuItem_android_icon = 0; public static final int MenuItem_android_id = 2; public static final int MenuItem_android_menuCategory = 5; public static final int MenuItem_android_numericShortcut = 10; public static final int MenuItem_android_onClick = 12; public static final int MenuItem_android_orderInCategory = 6; public static final int MenuItem_android_title = 7; public static final int MenuItem_android_titleCondensed = 8; public static final int MenuItem_android_visible = 4; public static final int MenuItem_showAsAction = 13; public static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x01010438 }; public static final int MenuView_android_headerBackground = 4; public static final int MenuView_android_horizontalDivider = 2; public static final int MenuView_android_itemBackground = 5; public static final int MenuView_android_itemIconDisabledAlpha = 6; public static final int MenuView_android_itemTextAppearance = 1; public static final int MenuView_android_preserveIconSpacing = 7; public static final int MenuView_android_verticalDivider = 3; public static final int MenuView_android_windowAnimationStyle = 0; public static final int[] SearchView = { 0x0101011f, 0x01010220, 0x01010264, 0x7f01005a, 0x7f01005b }; public static final int SearchView_android_imeOptions = 2; public static final int SearchView_android_inputType = 1; public static final int SearchView_android_maxWidth = 0; public static final int SearchView_iconifiedByDefault = 3; public static final int SearchView_queryHint = 4; public static final int[] Spinner = { 0x010100af, 0x01010175, 0x01010176, 0x01010262, 0x010102ac, 0x010102ad, 0x7f010051, 0x7f010052, 0x7f010053, 0x7f010054 }; public static final int Spinner_android_dropDownHorizontalOffset = 4; public static final int Spinner_android_dropDownSelector = 1; public static final int Spinner_android_dropDownVerticalOffset = 5; public static final int Spinner_android_dropDownWidth = 3; public static final int Spinner_android_gravity = 0; public static final int Spinner_android_popupBackground = 2; public static final int Spinner_disableChildrenWhenDisabled = 9; public static final int Spinner_popupPromptView = 8; public static final int Spinner_prompt = 6; public static final int Spinner_spinnerMode = 7; public static final int[] Theme = { 0x7f010047, 0x7f010048, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c }; public static final int Theme_actionDropDownStyle = 0; public static final int Theme_dropdownListPreferredItemHeight = 1; public static final int Theme_listChoiceBackgroundIndicator = 5; public static final int Theme_panelMenuListTheme = 4; public static final int Theme_panelMenuListWidth = 3; public static final int Theme_popupMenuStyle = 2; public static final int[] View = { 0x010100da, 0x7f010038, 0x7f010039 }; public static final int View_android_focusable = 0; public static final int View_paddingEnd = 2; public static final int View_paddingStart = 1; } }
4444312c5a94a1c1eadb6aeabeab21017323ee77
55a50acb6b7f511143b4fb6c3cfd73d7d219be78
/ha-db/src/main/java/jp/co/ha/db/mapper/HealthInfoFileSettingMapper.java
c4de2c187b1672bf0611a8df8a3c203649486f8d
[]
no_license
newArea51/work-3g
c56c0905122a856be9b5b5c84177fff793f5e689
fda0357a9a8f1428d751e09f64565f2836b94b63
refs/heads/master
2023-02-25T08:30:04.407315
2021-01-31T04:32:44
2021-01-31T04:32:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,987
java
package jp.co.ha.db.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.session.RowBounds; import jp.co.ha.db.entity.HealthInfoFileSetting; import jp.co.ha.db.entity.HealthInfoFileSettingExample; import jp.co.ha.db.entity.HealthInfoFileSettingKey; /** * 健康情報ファイル設定情報Mapper * * @version 1.0.0 */ public interface HealthInfoFileSettingMapper { /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ long countByExample(HealthInfoFileSettingExample example); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ int deleteByExample(HealthInfoFileSettingExample example); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ int deleteByPrimaryKey(HealthInfoFileSettingKey key); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ int insert(HealthInfoFileSetting record); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ int insertSelective(HealthInfoFileSetting record); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ List<HealthInfoFileSetting> selectByExampleWithRowbounds( HealthInfoFileSettingExample example, RowBounds rowBounds); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ List<HealthInfoFileSetting> selectByExample(HealthInfoFileSettingExample example); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ HealthInfoFileSetting selectByPrimaryKey(HealthInfoFileSettingKey key); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ int updateByExampleSelective(@Param("record") HealthInfoFileSetting record, @Param("example") HealthInfoFileSettingExample example); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ int updateByExample(@Param("record") HealthInfoFileSetting record, @Param("example") HealthInfoFileSettingExample example); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ int updateByPrimaryKeySelective(HealthInfoFileSetting record); /** * This method was generated by MyBatis Generator. This method corresponds * to the database table health_info_file_setting * * @mbg.generated Sun Nov 29 14:01:10 GMT+09:00 2020 */ int updateByPrimaryKey(HealthInfoFileSetting record); }
b7185cc13128e94361d45bb0208e2e05f8609673
b5bddaee3475cfc7a38e51a2a2b1326fcb5cb0c1
/mikhail.permyakov/day5_1/src/com/DirectoryPrinterException.java
022ef8fd56cf46f94f652d1e5ef2ed2e3d5a20f5
[]
no_license
anton-tupy/java-course-2017-07
a6f633adf30f22207e36b4b86b1a9bbcd4a4b993
c01c7944d4b8a46ab58cb9fa97510d595f9a98d5
refs/heads/master
2021-01-01T05:00:00.507163
2017-08-12T09:54:30
2017-08-12T09:54:30
97,290,031
1
0
null
null
null
null
UTF-8
Java
false
false
607
java
package com; public class DirectoryPrinterException extends Exception{ public DirectoryPrinterException() { } public DirectoryPrinterException(String message) { super(message); } public DirectoryPrinterException(String message, Throwable cause) { super(message, cause); } public DirectoryPrinterException(Throwable cause) { super(cause); } public DirectoryPrinterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } }
6244d3da6689f60fa4af949556f1050d3f578ebf
194a90a313d09d3bfe073b57ccd26f1dbe27f4ea
/src/main/java/harness/LeakyContextTest.java
97376466a13bc4fe531a0a18a43ac1e629315b9b
[ "BSD-3-Clause" ]
permissive
areese/jni_cleanup
b3ec363b31c0a96053dd6919cd6b6cafadf7a560
5c6a419c4d94845a4c91a699d93b15d14d8649d7
refs/heads/master
2021-01-23T06:44:36.678717
2017-01-25T17:56:51
2017-01-25T17:56:51
40,020,866
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
/* Copyright 2015 Yahoo Inc. */ /* Licensed under the terms of the 3-Clause BSD license. See LICENSE file in the project root for details. */ package harness; import java.util.concurrent.CountDownLatch; import jni.JniContext; public class LeakyContextTest extends RunContextTest { public LeakyContextTest(CountDownLatch latch, int count) { super(latch, count); } @Override protected String execute() throws Exception { String decode = null; JniContext context = JniContext.create(); decode = context.execute(); return decode; } @Override public RunContextTest create(CountDownLatch latch, int count) { return new LeakyContextTest(latch, count); } }
caf28a6f99ea844d2631487d9e3f3cf59cf7145a
45912ff07e7963fe5558c270372c6b1ed0d0ad8d
/src/main/java/com/usx/b2bmall/controller/EcontractController.java
9cda01b6f0609593ac44b37114d08dc5c1c767a8
[]
no_license
panssdr/B2Bmallbc
4f50b7cb99d65e3a41111377dde28b76406c8ac4
13917ee5df12ebc430d15e3080310c922a2f933b
refs/heads/main
2023-08-30T19:28:45.802577
2021-11-07T15:00:09
2021-11-07T15:00:09
416,284,040
0
0
null
null
null
null
UTF-8
Java
false
false
924
java
package com.usx.b2bmall.controller; import com.usx.b2bmall.mapper.EcontractMapper; import com.usx.b2bmall.pojo.Econtract; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.stereotype.Controller; import java.time.LocalDateTime; import java.util.List; /** * <p> * 前端控制器 * </p> * * @author Panshenshen * @since 2021-10-13 */ @RestController @ResponseBody @RequestMapping("/econtract") public class EcontractController { @Autowired private EcontractMapper econtractMapper; @PostMapping("/save") public void save(@RequestBody Econtract econtract){ econtract.setCreateDate(LocalDateTime.now()); econtractMapper.insert(econtract); } @GetMapping("/getOne/{id}") public Econtract getOne(@PathVariable("id") Integer id){ return econtractMapper.getOne(id); } }
2bd0d3054887d79e552cc490b2268bb2f87924e5
42cd5ce3c9f5bb5c0f2058d3125db41437752a88
/gateway-test/src/main/java/com/pphh/demo/gw/test/SimpleApplication.java
101439911368642772de06ef0fbebb321bdced61
[]
no_license
peipeihh/sample-spring-cloud-gateway
16f3602a027bc884541f06ad25c03dad88514d68
05bfa64adbaa2c048d748d2085ba2431d8998e4d
refs/heads/master
2020-05-23T05:48:33.121065
2019-05-15T07:53:59
2019-05-15T07:53:59
186,655,011
1
0
null
null
null
null
UTF-8
Java
false
false
413
java
package com.pphh.demo.gw.test; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * Please add description here. * * @author huangyinhuang * @date 2019/4/26 */ @SpringBootApplication public class SimpleApplication { public static void main(String[] args) { SpringApplication.run(SimpleApplication.class, args); } }
8587dd1b895832cbf6ce29b123c96786cb955598
0b9589ee0e9b40716d8047ce81379e0fe569d1fd
/ddbuilder/src/jp/co/nextdesign/util/logging/BdDdbRuleCheckLogger.java
893c7759773fd372d0220c0d0ae16a093e1baa47
[ "Apache-2.0" ]
permissive
nextdesign-co-jp/DDBuilder
e5e49a2edeea0e06a1cf6e6ab62bc3b592fdc069
960550bc75ef2c7fb74a39fe55b656759b539956
refs/heads/master
2021-12-14T16:55:50.130352
2021-11-27T12:03:13
2021-11-27T12:03:13
164,640,839
1
0
null
null
null
null
UTF-8
Java
false
false
1,526
java
/* * このソフトウエアはネクストデザイン有限会社に所有される機密情報です。 * この機密情報を漏洩してはならず、当社の意図する許可の元において使用しなければなりません。 * Copyright(c) 2011 by NEXT DESIGN Ltd. All Rights Reserved. */ package jp.co.nextdesign.util.logging; import java.util.ArrayList; import java.util.List; /** * ログ * ドメインとサービスに関するDDBuilderルールのチェックログ * BdBuilderTaskが使用する * @author murayama */ public class BdDdbRuleCheckLogger { private static BdDdbRuleCheckLogger instance = null; private List<String> logList; /** ログリストを応答する */ public List<String> getLogList(){ return this.logList; } /** ログを保持しているか否か */ public boolean hasLog(){ return ! this.logList.isEmpty(); } /** 1件追加する */ public void add(String log){ this.logList.add(log); } /** 1件追加する(重複なし) */ public void addWithoutDuplication(String log){ if (! this.logList.contains(log)){ this.logList.add(log); } } /** 全件クリアする */ public void clear(){ this.logList.clear(); } /** シングルトン */ public static synchronized BdDdbRuleCheckLogger getInstance(){ if (instance == null){ instance = new BdDdbRuleCheckLogger(); } return instance; } /** コンストラクタ */ private BdDdbRuleCheckLogger(){ super(); this.logList = new ArrayList<String>(); } }
cbb651d8a2c3f159721c2b0881cab4b18a021089
d7c6887ecc000ab0fe286ee64fff23eb9d69519a
/src/test/java/com/qa/users/service/ServiceTest.java
69f501ef4af80878629cb0d65aae186d450d0653
[]
no_license
RM147/GroupUser
5afb0c96f1448d80b7fa23d64b6e32bc98d28786
c644d0a715ced2ecef5d4456bf8047b2bd34cd58
refs/heads/master
2020-05-02T07:21:53.974524
2019-03-26T15:25:29
2019-03-26T15:25:29
177,816,089
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package com.qa.users.service; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ServiceTest { }
47a8c967ab55b5c64b544781d1778baf960115e3
cba133a0a5026e0b77acd573ad3cbdef24eb83c4
/app/src/test/java/com/example/wishikawa/aferevelocidade/ExampleUnitTest.java
8483718079bcb04754b35448511b8773d31ba0b3
[]
no_license
WagnerNKI/afereVelocidade
56b826f74f43e083781fc47e37732e6ca197ffbe
21b0cae342736e54c8727885df657c0cdbf35f7d
refs/heads/master
2020-04-02T14:50:26.801607
2019-06-20T00:14:23
2019-06-20T00:14:23
154,540,956
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package com.example.wishikawa.aferevelocidade; 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); } }
b242f5660344b27a2e7a9a01b80232126ae3face
2af9d30eb6cb88d31b69bc5725aa8e156f7f0dca
/myleesite-database/src/main/java/com/fanciter/myleesite/database/mapper/GenTableMapper.java
abd6c81e20d9d75fb3624cea4764ebe20f9674d0
[]
no_license
fanciter/myleesite
6477c06985501e86aed3b4309537795a5248771e
2f47d66c6f3f01f7fe34b30009b7251a593a8de1
refs/heads/master
2021-05-11T03:51:34.900898
2018-01-19T08:06:53
2018-01-19T08:06:53
117,925,387
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package com.fanciter.myleesite.database.mapper; import com.fanciter.myleesite.database.pojo.GenTable; import com.fanciter.myleesite.database.utils.MyMapper; public interface GenTableMapper extends MyMapper<GenTable> { }
6590dada65299a9ca763571cf62f33f760d7b894
0a6cd33b52e68ae5fef57713ddb8795a8e0bf333
/app/src/main/java/com/pllug/course/behen/fragments/SignUpFragment.java
a4f8ff2477c77951ab25ce37b4a6369f28449e22
[]
no_license
behenIgor/BasicAndroidApp1
b842ab0fe8c0b1a93386637223e28ace16984d3a
f9a3e8510b005246d5da00c5937547aaac1bc347
refs/heads/master
2020-04-20T23:38:24.040227
2019-03-04T00:38:35
2019-03-04T00:38:35
169,173,539
0
0
null
null
null
null
UTF-8
Java
false
false
3,737
java
package com.pllug.course.behen.fragments; import android.os.Bundle; import android.support.v4.app.Fragment; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.pllug.course.behen.MainActivity; import com.pllug.course.behen.ProfileFragmentActivity; import com.pllug.course.behen.R; public class SignUpFragment extends Fragment { private View root; private Button signUpBtn; private TextView signInTv; private EditText loginEt, emailEt, passwordEt, confirmPasswordEt; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { root = inflater.inflate(R.layout.fragment_signup, container, false); initView(); initListeners(); return root; } private void initView() { signUpBtn = (Button) root.findViewById(R.id.signup_btn); signInTv = (TextView) root.findViewById(R.id.signin_txt); loginEt = (EditText) root.findViewById(R.id.login_et); emailEt = (EditText) root.findViewById(R.id.email_et); passwordEt = (EditText) root.findViewById(R.id.password_et); confirmPasswordEt = (EditText) root.findViewById(R.id.confirm_password_et); } private void initListeners() { signUpBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { validateInput(); } }); signInTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ((ProfileFragmentActivity) getActivity()).showSignIn(); } }); } private void validateInput() { loginEt.setError(null); emailEt.setError(null); passwordEt.setError(null); confirmPasswordEt.setError(null); String login = loginEt.getText().toString(); String email = emailEt.getText().toString(); String password = passwordEt.getText().toString(); String confirmPassword = confirmPasswordEt.getText().toString(); if (TextUtils.isEmpty(login)) { Toast.makeText(getActivity(), "Please enter login!", Toast.LENGTH_SHORT).show(); loginEt.setError("Please enter login!"); return; } if (TextUtils.isEmpty(email)) { Toast.makeText(getActivity(), "Please enter email!", Toast.LENGTH_SHORT).show(); emailEt.setError("Please enter email!"); return; } if (TextUtils.isEmpty(password)) { Toast.makeText(getActivity(), "Please enter password!", Toast.LENGTH_SHORT).show(); passwordEt.setError("Please enter password!"); return; } if (TextUtils.isEmpty(confirmPassword)) { Toast.makeText(getActivity(), "Please enter confirm password!", Toast.LENGTH_SHORT).show(); confirmPasswordEt.setError( "Please enter confirm password!"); return; } if (!password.equals(confirmPassword)) { Toast.makeText(getActivity(), "Passwords aren't equal!", Toast.LENGTH_SHORT).show(); return; } // boolean hasBigCharacter = false; // for (int i = 0; i < password.length(); i++) { // char c = password.charAt(i); // if ('A' <= c && c <= 'Z') { // hasBigCharacter = true; // } // } ((ProfileFragmentActivity)getActivity()).signUp(login, email, password); } }
df6418e38264c2fbe0f16aacf0630d304955e0f1
709ca778cb39e7a3864bed6e8f81f8b15e3f2221
/src/main/java/com/railroad/entity/Artist.java
320b9d58c94eea2d6e21d6244bfb28b540e478f1
[]
no_license
ntokozonkosi07/sty-backend-service
8d69c36286f892366fa5d274bf7e5e3e4a3cd1eb
a3c3edd75323081a115f5d8fb3e5d8eb153f1800
refs/heads/master
2022-12-08T05:00:14.328612
2020-02-26T03:29:45
2020-02-26T03:29:45
235,567,388
0
0
null
null
null
null
UTF-8
Java
false
false
1,030
java
package com.railroad.entity; import com.railroad.entity.serviceProvided.ServiceProvided; import javax.persistence.*; import java.util.Collection; @Entity @Table(name = "S_ARTIST") public class Artist extends User { private static final long serialVersionUID = 1L; @ManyToMany @JoinTable( joinColumns = @JoinColumn(name = "ARTIST_ID"), inverseJoinColumns = @JoinColumn(name = "SERVICE_ID") ) private Collection<ServiceProvided> serviceProvided; @OneToMany(mappedBy = "artist") private Collection<Reservation> reservations; public Collection<ServiceProvided> getServiceUtilities() { return serviceProvided; } public void setServiceUtilities(Collection<ServiceProvided> serviceUtilities) { this.serviceProvided = serviceUtilities; } public Collection<Reservation> getReservations() { return reservations; } public void setReservations(Collection<Reservation> reservations) { this.reservations = reservations; } }
ff6b9f55d74f386764c952d9361627996900fca7
85d7de9ece69480c9e37bbe3182056e447e000ae
/PrimitiveTypesVariablesIfElse-Homework/src/Problem14.java
53db3c5debfaa491c1c8c9fde53c66a462823adb
[]
no_license
DavidPavlov/ItTalents
2223917d2bc1b4fb775c54ad6c454ac8f863f996
bc2583e3bcd4e175f120effb082cb6e98111708c
refs/heads/master
2021-04-15T10:00:28.540523
2016-07-17T14:31:42
2016-07-17T14:31:42
63,176,210
0
0
null
null
null
null
UTF-8
Java
false
false
663
java
import java.util.Scanner; public class Problem14 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the coordinates"); int x1 = sc.nextInt(); int y1 = sc.nextInt(); int x2 = sc.nextInt(); int y2 = sc.nextInt(); if (x1 % 2 == y1 % 2) { if (x2 % 2 == y2 % 2) { System.out.println("The fields are with same color"); } else { System.out.println("The fields are not with the same color"); } } else { if (x2 % 2 != y2 % 2) { System.out.println("The fields are with same color"); } else { System.out.println("The fields are not with the same color"); } } } }
1bf936f3db90b593c949a654ebed9940b36de94a
25d052d0aaf04d5c437375772f127e04bc732b3c
/com/google/android/gms/identity/intents/zza.java
45197450c8fcf6c791347f33df4cf77c62b16129
[]
no_license
muhammed-ajmal/HseHere
6879b87a44b566321365c337c217e92f5c51a022
4667fdccc35753999c4f94793a0dbe38845fc338
refs/heads/master
2021-09-15T12:33:06.907668
2018-06-01T12:07:31
2018-06-01T12:07:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,046
java
package com.google.android.gms.identity.intents; import android.os.Parcel; import android.os.Parcelable.Creator; import com.google.android.gms.common.internal.safeparcel.zzb; import com.google.android.gms.identity.intents.model.CountrySpecification; import java.util.List; public class zza implements Creator<UserAddressRequest> { static void zza(UserAddressRequest userAddressRequest, Parcel parcel, int i) { int zzav = zzb.zzav(parcel); zzb.zzc(parcel, 1, userAddressRequest.getVersionCode()); zzb.zzc(parcel, 2, userAddressRequest.zzaMA, false); zzb.zzI(parcel, zzav); } public /* synthetic */ Object createFromParcel(Parcel parcel) { return zzeL(parcel); } public /* synthetic */ Object[] newArray(int i) { return zzhi(i); } public UserAddressRequest zzeL(Parcel parcel) { int zzau = com.google.android.gms.common.internal.safeparcel.zza.zzau(parcel); int i = 0; List list = null; while (parcel.dataPosition() < zzau) { int zzat = com.google.android.gms.common.internal.safeparcel.zza.zzat(parcel); switch (com.google.android.gms.common.internal.safeparcel.zza.zzca(zzat)) { case 1: i = com.google.android.gms.common.internal.safeparcel.zza.zzg(parcel, zzat); break; case 2: list = com.google.android.gms.common.internal.safeparcel.zza.zzc(parcel, zzat, CountrySpecification.CREATOR); break; default: com.google.android.gms.common.internal.safeparcel.zza.zzb(parcel, zzat); break; } } if (parcel.dataPosition() == zzau) { return new UserAddressRequest(i, list); } throw new com.google.android.gms.common.internal.safeparcel.zza.zza("Overread allowed size end=" + zzau, parcel); } public UserAddressRequest[] zzhi(int i) { return new UserAddressRequest[i]; } }
0de5072ce3f2f2622c8618106d1d80c3cf45893c
a7376ddc2fc649d8ddd064ee0dc5a89c53dba43c
/src/main/java/com/luispoze/TrabGA_SimModSis/Menu.java
8d664294a612c4a9655647438ccb48bec3cddeec
[]
no_license
opoze/trab_ga_mod_sim_mod_sis
526271a7ea6cd0e9eef1116d67d378557eeb98c0
6332081ba6a520143828372068268c977814c0fa
refs/heads/master
2020-05-09T19:31:44.201861
2019-04-14T23:32:23
2019-04-14T23:32:23
181,381,228
0
0
null
null
null
null
UTF-8
Java
false
false
2,547
java
package com.luispoze.TrabGA_SimModSis; import java.util.Scanner; public class Menu { Scanner sc; public Menu(Core core) { sc = new Scanner(System.in); String option = "-1"; do { option = menu(sc); switch(option) { case "L": { location(sc, core); break; } case "T": { transition(sc, core); break; } case "A": { arc(sc, core); break; } case "S": { saveXml(core); break; } case "X": { fromXml(core); break; } case "P": { process(sc, core); break; } } } while(!option.equals("0")); } private void fromXml(Core core) { Xml xml = new Xml(); xml.load(core); } private void saveXml(Core core) { Xml xml = new Xml(); xml.save(core.getGraph()); } private void clear() { // System.out.print("\033[H\033[2J"); // System.out.flush(); // try { // Runtime.getRuntime().exec("cls"); // } // catch(Exception e) { // System.out.println("Error"); // } } private String menu(Scanner sc) { clear(); System.out.println("=====Menu RDP====="); System.out.println("L - Localização"); System.out.println("T - Transição"); System.out.println("A - Arco"); System.out.println("S - Salvar XML"); System.out.println("X - Ler XML"); System.out.println("P - Processar RDP"); System.out.println("0 - Fim"); System.out.println("=====Menu====="); System.out.print("Escolha: "); return sc.nextLine(); } private void location(Scanner sc, Core core) { clear(); System.out.println("Nova Localização"); System.out.print("Nome: "); String name = sc.next(); System.out.print("Marcas: "); int marcs = sc.nextInt(); core.addLocation(name, marcs); } private void transition(Scanner sc, Core core) { clear(); System.out.println("Nova Transição"); System.out.print("Nome: "); String name = sc.next(); core.addTransition(name); } private void arc(Scanner sc, Core core) { clear(); System.out.println("Novo Arco"); System.out.print("De: "); String from = sc.next(); System.out.print("Para: "); String to = sc.next(); System.out.print("Peso: "); int weight = sc.nextInt(); core.addArc(from, to, weight); } private void process(Scanner sc, Core core) { clear(); System.out.print("Continue? "); while(sc.next() != "n" && core.canProcess()) { core.process(); core.print(); } } }
0428a1e0ec2162c3e6224de60d378159595b0d1c
52e45aa74d328816fbd95d5be0572274bdb5d88f
/src/main/java/com/pluralsight/blog/health/MaxMemoryHealthIndicator.java
a300071d9726e4bc824de9ce9e2a866ffe9d90aa
[]
no_license
djnautiyal/java-spring-basic-blog
394b4fdee67be541fc2a84a31cdea63375121521
6c159b984b3b04bd4ae1803dcd38d788a8bda54a
refs/heads/master
2022-12-08T16:44:11.734873
2020-09-13T05:02:28
2020-09-13T05:02:28
293,061,364
0
0
null
2020-09-13T05:02:29
2020-09-05T11:24:26
Java
UTF-8
Java
false
false
578
java
package com.pluralsight.blog.health; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.actuate.health.Status; import org.springframework.stereotype.Component; @Component public class MaxMemoryHealthIndicator implements HealthIndicator { @Override public Health health() { boolean invalid = Runtime.getRuntime().maxMemory() < (100 * 1024 * 1024); Status status = invalid ? Status.DOWN : Status.UP; return Health.status(status).build(); } }
fa1a346eedfc0c3b996ceccdcae2d5a2603cca16
85e41e7775bd1d76e644d310784b5b4108ccd6d9
/CardGeneratorApp.java
5f94c9ce5f81ba801409cd2b9f361a6b7c4c676c
[]
no_license
Extremeist/CardGenerator
029e2833c446917f75596168b7a1403be5b4e16b
48ea677e854fc14a5a9eea9fe07a0eaf5fed5d87
refs/heads/main
2023-01-23T19:36:39.236549
2020-12-06T22:19:02
2020-12-06T22:19:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
290
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 cardgenerator; /** * * @author porte */ public class CardGeneratorApp { }
3bd7473c628f16b8938a8d81802d288568d0cf5e
7dcc03eac499c9f6f65f5293236ed3f63a5ec5c1
/Task1_levelDb/GestioneEventiV1LevelDb/src/main/java/com/mycompany/gestioneeventi/GraficLoader.java
2532b4893bc5d4000910a316ca2db64bccec2bcc
[]
no_license
pcal93/Large-Scale
fad85f91f042c3c12d1dc654771dd3c65589bbd9
443eefe4996591c84763b8ab7fca0fab12e52afd
refs/heads/master
2022-12-30T03:26:49.880694
2020-06-02T16:17:07
2020-06-02T16:17:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.mycompany.gestioneeventi; import com.mycompany.hibernate.GestioneEventiManagerEM; import javafx.scene.*; import javafx.stage.*; /** * * @author Gianluca */ public class GraficLoader { public static void Loader(Node pageToDiscard,Node pageToLoad,Group rootGroup) { rootGroup.getChildren().remove(pageToDiscard); rootGroup.getChildren().add(pageToLoad); } }
bfd484810049f395b199a5ef0bbeba84b7e8ce1d
9807d0e4f620e649249e2997f93c27ff7b7663f5
/adraw.framework/src/main/java/io/github/adraw/framework/service/IMemberService.java
0369b96f54c61e57720be6df32a326c117c6e7ef
[]
no_license
banshow/adraw
5474836a7c7eae91a923a168a133b5c9fdaaabec
c790fa17a0ab3c0b32ecfee5ecef0f7d7825b892
refs/heads/master
2021-07-15T19:51:08.316412
2017-02-12T07:03:29
2017-02-12T07:03:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package io.github.adraw.framework.service; import java.util.List; import io.github.adraw.framework.model.Member; import io.github.adraw.framework.model.User; public interface IMemberService { void insert(Member member,User user, String uid); List<Member> list4Public(Member member); Member byUserId(Long userId); }
3e1cfb2f4c37dc10ee7ba9cdd76ddb72d1ac18a4
5396bb335fed213c0eefe38f6f3119ca33a229d4
/JavaRushTasks/2.JavaCore/src/com/javarush/task/task16/task1612/Solution.java
305a7ec38026b56dd780b06f1d2953917e29713b
[]
no_license
PetukhovDN/JavaRushTasks
83743196670e36fd7780a2aa6c898e600b40ebdd
6b8961eee41508226ca79d3b4d60ac2db2e69804
refs/heads/master
2020-09-30T20:53:42.786863
2020-03-28T12:24:41
2020-03-28T12:24:41
227,370,451
1
0
null
null
null
null
UTF-8
Java
false
false
1,758
java
package com.javarush.task.task16.task1612; /* Stopwatch (Секундомер) */ public class Solution { public static volatile boolean isStopped = false; public static void main(String[] args) throws InterruptedException { Runner ivanov = new Runner("Ivanov", 4); Runner petrov = new Runner("Petrov", 2); //на старт! //внимание! //марш! ivanov.start(); petrov.start(); Thread.sleep(2000); isStopped = true; Thread.sleep(1000); } public static class Stopwatch extends Thread { private Runner owner; private int stepNumber; public Stopwatch(Runner runner) { this.owner = runner; } public void run() { try { while (!isStopped) { doStep(); } } catch (InterruptedException e) { } } private void doStep() throws InterruptedException { stepNumber++; Thread.sleep(1000 / owner.getSpeed());//add your code here - добавь код тут System.out.println(owner.getName() + " делает шаг №" + stepNumber + "!"); } } public static class Runner { Stopwatch stopwatch; private String name; private int speed; public Runner(String name, int speed) { this.name = name; this.speed = speed; this.stopwatch = new Stopwatch(this); } public String getName() { return name; } public int getSpeed() { return speed; } public void start() { stopwatch.start(); } } }
359efb30d5a2157d598256b08f1a2c614710de48
72f086a6fc8b7f1f7f9c01dc4cdc33bf44cdc34d
/src/connectfour/NullCellException.java
89ce65292561b0e64649d27d914be18c509b895f
[]
no_license
Zhernet/Connect-Four
56ebb1fe0864dd10a2697b27ba9db5cdcf102a62
5bee213842a7cea1f0dcb8b88070ed296c0f4364
refs/heads/master
2021-03-12T21:49:29.353003
2014-07-16T14:11:41
2014-07-16T14:11:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
203
java
package connectfour; public class NullCellException extends RuntimeException { public NullCellException() { } public NullCellException(String msg) { super(msg); } }
f51cfd497aa04ea0f52beaf679ad17722645e55f
ba6b506a9b27f3a7b1e264b200a605a29184998d
/src/java/org/pegasus/patrimonio/ejb/ValorizacionFacade.java
207242ba38818152a0831827cde85e2901cc1a35
[]
no_license
davidpy3/pegasusERP
3255158ce837b2e1256ea5dd639b94ec1bfc5dfa
0b6d8653c20f6c2d776249d9dc539dfc897a37b4
refs/heads/master
2021-01-10T11:51:18.822607
2015-11-16T21:57:18
2015-11-16T21:57:18
46,126,676
0
0
null
null
null
null
UTF-8
Java
false
false
1,094
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 org.pegasus.patrimonio.ejb; import java.util.List; import javax.ejb.Stateless ;import org.jsuns.util.AbstractFacade; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.pegasus.patrimonio.jpa.Valorizacion; /** * * @author TOSHIBA */ @Stateless public class ValorizacionFacade extends AbstractFacade<Valorizacion> implements ValorizacionFacadeLocal{ @PersistenceContext(unitName = "siigaa") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public ValorizacionFacade() { super(Valorizacion.class); } @Override public List<Valorizacion> findRange(int first, int max) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
3615b859d9d2415b86ac5abe97aa279babea5ee7
21f3d35e217f577c116cfdf583c034be0b279806
/Point/Teacher.java
35dbba10ee569ccc257d93de28bdae03c5412ffa
[]
no_license
Nestling327/kaohe
37628293bc7a206192ef4e7ca82fd0442b216976
b4d9cd09324e4314d47916cfc36fe1cf20aeb9bd
refs/heads/master
2020-04-13T01:38:07.330953
2018-12-23T10:02:23
2018-12-23T10:02:23
162,879,456
0
0
null
null
null
null
UTF-8
Java
false
false
1,266
java
package kaohe.Point; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class Teacher { private String name; private int point=0; private HashMap<Goods,Integer> goods = new HashMap<>(); public Teacher(String name){ this.name = name; } public void get (Goods goods1){ if (goods.get(goods1)==null){ goods.put(goods1,1); }else { goods.put(goods1,goods.get(goods1)+1); } } public void setName(String name) { this.name = name; } public void setPoint(int point) { this.point = point; } public String getName() { return name; } public int getPoint() { return point; } public void jiafen(Student student,int point){ student.setPoint(student.getPoint()+point); } public void shou(){ Iterator iter = goods.entrySet().iterator(); while (iter.hasNext()){ Map.Entry entry = (Map.Entry) iter.next(); Goods key1 = (Goods)entry.getKey(); String key = key1.getName(); int val = (int) entry.getValue(); System.out.print("现在你有: "); System.out.println(key+val+"件"); } } }
[ "Nestling327" ]
Nestling327
f66ee917719576c9752cb5282c774258d9c81762
c9e6ba9efe515bac17cdff22b29bce94d8d304d8
/app/src/main/java/com/shenzhen/honpe/honpe_sqe/app/login_with_register/holder/RegisterHolder.java
608a29d68b2661e271ded3f11fa071c99d7d41f0
[]
no_license
lixixiang/Honpe_SQE
f36671e7365892746aba4b6a0f56dc341c72db7f
43af3103e3c98c1f8380a9ffc030f567a468b28a
refs/heads/master
2023-06-25T13:01:53.851630
2021-07-30T06:10:20
2021-07-30T06:10:20
390,951,910
0
0
null
null
null
null
UTF-8
Java
false
false
702
java
package com.shenzhen.honpe.honpe_sqe.app.login_with_register.holder; import android.view.View; import android.widget.EditText; import android.widget.TextView; import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.shenzhen.honpe.honpe_sqe.R; import org.jetbrains.annotations.NotNull; /** * FileName: RegisterHolder * Author: asus * Date: 2021/3/9 12:09 * Description: */ public class RegisterHolder extends BaseViewHolder { public TextView tvTitle; public EditText etContent; public RegisterHolder(@NotNull View view) { super(view); tvTitle = view.findViewById(R.id.item_title); etContent = view.findViewById(R.id.et_content); } }
58998655e7a69a52b6a5370f8fb9f04655f4eb60
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/MATH-100b-1-13-Single_Objective_GGA-IntegrationSingleObjective-/org/apache/commons/math/estimation/AbstractEstimator_ESTest.java
0e74ec19b5b5a333fb02e7a90c70f2a6d23bf5af
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
2,295
java
/* * This file was automatically generated by EvoSuite * Sat May 16 11:43:48 UTC 2020 */ package org.apache.commons.math.estimation; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; import org.apache.commons.math.estimation.EstimatedParameter; import org.apache.commons.math.estimation.LevenbergMarquardtEstimator; import org.apache.commons.math.estimation.LevenbergMarquardtEstimatorTest; import org.apache.commons.math.estimation.WeightedMeasurement; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class AbstractEstimator_ESTest extends AbstractEstimator_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { LevenbergMarquardtEstimator levenbergMarquardtEstimator0 = new LevenbergMarquardtEstimator(); LevenbergMarquardtEstimatorTest levenbergMarquardtEstimatorTest0 = new LevenbergMarquardtEstimatorTest("zVWKw"); LevenbergMarquardtEstimatorTest.QuadraticProblem levenbergMarquardtEstimatorTest_QuadraticProblem0 = levenbergMarquardtEstimatorTest0.new QuadraticProblem(); WeightedMeasurement weightedMeasurement0 = mock(WeightedMeasurement.class, new ViolatedAssumptionAnswer()); doReturn(0.0, 0.0, 0.0).when(weightedMeasurement0).getPartial(any(org.apache.commons.math.estimation.EstimatedParameter.class)); doReturn(0.0).when(weightedMeasurement0).getWeight(); EstimatedParameter estimatedParameter0 = new EstimatedParameter("zVWKw", (-0.405195), true); EstimatedParameter estimatedParameter1 = new EstimatedParameter(estimatedParameter0); levenbergMarquardtEstimatorTest_QuadraticProblem0.addParameter(estimatedParameter1); levenbergMarquardtEstimatorTest_QuadraticProblem0.addMeasurement(weightedMeasurement0); levenbergMarquardtEstimator0.initializeEstimate(levenbergMarquardtEstimatorTest_QuadraticProblem0); // Undeclared exception! levenbergMarquardtEstimator0.getCovariances(levenbergMarquardtEstimatorTest_QuadraticProblem0); } }
71262a9563596fd1e5db9a9f7cb685b583c2fa5b
09eb040a55573afb2571fc544a2b5e0e28b87c14
/Problems/Users and WebSites/src/Main.java
042d712429f903eea232678d9d9f5e1101d1b6af
[]
no_license
TiGeorge/Blockchain
73afde39021d1b327a2f4d58e82e45ebbc6a0c77
ce7e8304101d462e08d88692a8213cd8fee4d8c3
refs/heads/master
2022-11-13T23:45:48.215026
2020-07-11T06:44:59
2020-07-11T06:44:59
266,570,177
0
0
null
null
null
null
UTF-8
Java
false
false
1,072
java
abstract class BaseEntity { protected long id; protected long version; public long getId() { return id; } public void setId(long id) { this.id = id; } public long getVersion() { return version; } public void setVersion(long version) { this.version = version; } } class User extends BaseEntity { protected String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } class Visit extends BaseEntity { protected User user; protected WebSite site; public User getUser() { return user; } public void setUser(User user) { this.user = user; } public WebSite getSite() { return site; } public void setSite(WebSite site) { this.site = site; } } class WebSite extends BaseEntity { protected String url; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } }
9b93d8418dd3c881ee4e5e7830203c459e848275
f973c13558950c35a87c1bd7ba59822acf9b29a5
/app/src/test/java/lijingqian/example/lenovo/gwc_myselfe_dexv/ExampleUnitTest.java
28d61063702611b888a7f5fc569bbf1ccd9c0965
[]
no_license
lilingqian/Gwc_myselfe_dexv
3f3a40e7de82366106b2ff6fce0e8d35b6d5f6e8
c3c030977474a3ee9c25a77a09ba298426456e5d
refs/heads/master
2021-08-26T09:27:30.973211
2017-11-23T01:18:47
2017-11-23T01:18:47
111,748,439
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package lijingqian.example.lenovo.gwc_myselfe_dexv; 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); } }
b7dbd572c1752845bef7c924913dcfb343291fd7
d2254cb293c37332235e0833477d439bf62fb678
/app/src/main/java/com/example/administrator/zhihunews/db/model/NewsDetail.java
2daf9a24dd728d64c75087b33dff6346382ed2a1
[]
no_license
wzbcCoder/ZhiHuDaily
0c7141f440bc1d431f929c2b1ab8a9056879ff7c
01c90356ce277f04802a4f3a1ce8c95d4c590a6b
refs/heads/dev
2020-04-07T22:16:20.360715
2019-01-11T14:42:20
2019-01-11T14:42:20
158,762,518
0
1
null
2018-12-17T00:19:58
2018-11-23T00:35:00
Java
UTF-8
Java
false
false
135
java
package com.example.administrator.zhihunews.db.model; /** * Created by Administrator on 2018/11/26. */ public class NewsDetail { }
00a7bf9ce9ed5af623a0e02ff6ebb4e9bc92da90
6666f14803dfc5ddf72d61e798725cdf1c2ed37a
/app/src/main/java/com/example/attendence/third_class/third_exam_date/DataBaseHelperExamDate3.java
add8fe4cc89a4ad0fbc9d598a9726c2fd992227c
[]
no_license
Abdullah272056/Attendence
17905e8cf937afd13d1be50b184a1a721438a192
4dd793289b4d9ef9d48a8acb8d1b9d197542eab0
refs/heads/master
2023-02-13T01:46:10.945604
2021-01-22T10:25:26
2021-01-22T10:25:26
300,290,470
4
0
null
null
null
null
UTF-8
Java
false
false
3,050
java
package com.example.attendence.third_class.third_exam_date; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.widget.Toast; import androidx.annotation.Nullable; import com.example.attendence.common.DateNote; import java.util.ArrayList; import java.util.List; public class DataBaseHelperExamDate3 extends SQLiteOpenHelper { Context context; ConstantExam3 constant; public DataBaseHelperExamDate3(@Nullable Context context ){ super(context, ConstantExam3.DATE_TABLE_NAME, null, ConstantExam3.DATABASE_Version); this.context=context; } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(constant.CREATE_DATE_TABLE); Toast.makeText(context, "OnCreate is Called", Toast.LENGTH_SHORT).show(); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL(" DROP TABLE IF EXISTS "+constant.DATE_TABLE_NAME); onCreate(db); Toast.makeText(context, "onUpgrade is Called",Toast.LENGTH_SHORT).show(); } public int insertData(DateNote dateNote){ SQLiteDatabase sqLiteDatabase=getWritableDatabase(); ContentValues contentValues=new ContentValues(); contentValues.put(constant.COLUMN_DATE,dateNote.getDate()); int id= (int) sqLiteDatabase.insert(constant.DATE_TABLE_NAME,null,contentValues); return id; } public List<DateNote> getAllNotes(){ SQLiteDatabase sqLiteDatabase = getReadableDatabase(); List<DateNote> dateList = new ArrayList<>(); Cursor cursor = sqLiteDatabase.rawQuery("SELECT * FROM "+constant.DATE_TABLE_NAME,null); if (cursor.moveToFirst()){ do { DateNote note = new DateNote( cursor.getInt(cursor.getColumnIndex(constant.COLUMN_DATE_ID)), cursor.getString(cursor.getColumnIndex(constant.COLUMN_DATE)) ); dateList.add(note); }while (cursor.moveToNext()); } return dateList; } public int updateData(DateNote notes){ SQLiteDatabase sqLiteDatabase=getWritableDatabase(); ContentValues contentValues=new ContentValues(); contentValues.put(constant.COLUMN_DATE,notes.getDate()); int status = sqLiteDatabase.update(constant.DATE_TABLE_NAME,contentValues," date_id=? ",new String[]{String.valueOf(notes.getId())}); return status; } public int deleteDate(int id){ SQLiteDatabase sqLiteDatabase = getWritableDatabase(); int status = sqLiteDatabase.delete(constant.DATE_TABLE_NAME,"date_id=?",new String[]{String.valueOf(id)}); return status; } public void deleteAllExamDateData(){ SQLiteDatabase sqLiteDatabase = getWritableDatabase(); sqLiteDatabase.execSQL("delete from "+ constant.DATE_TABLE_NAME); } }
b161eb14996d1fc84df9deeced7fd1f988857440
4a7e62e2dcb2d262efbc27ecb8e7599e2fcefc9a
/src/main/java/com/example/controladores/NomeControler.java
c700f6df34428471e42cdf6ae4262c882f0fc7fc
[]
no_license
paulopppsom/cadastro
4608dfbf2fb3d0f1a8f0f2d122f5882aa9c8e75e
2b4606b206828ed84c8a1cb36a16656a8866ef8a
refs/heads/master
2021-01-10T05:25:55.523326
2015-12-01T18:32:47
2015-12-01T18:32:47
47,209,818
0
0
null
null
null
null
UTF-8
Java
false
false
1,110
java
/*package com.example.controladores; 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 com.example.entidades.Aluno; import com.example.entidades.Cidade; import com.example.repositorios.NomeRepositorio; @Controller public class NomeControler { @Autowired NomeRepositorio nomeRepositorio; @RequestMapping(value = "/nome") public String lista(Cidade cidade, Model model) { model.addAttribute("nomes",nomeRepositorio.findAll()); if (cidade.getId() != null) { model.addAttribute("nomes",nomeRepositorio.findOne(cidade.getId())); } else { model.addAttribute("nome", new Cidade()); } return "nome"; } @RequestMapping(value = "/nome/save") public String salvar(Aluno aluno) { nomeRepositorio.save(aluno); return "redirect:/nome"; } @RequestMapping(value = "/nome/del") public String deletar(Aluno aluno) { nomeRepositorio.delete(aluno); return "redirect:/nome"; } }*/
d881d7bc52c905d915402de7d17ba131b344ed25
d7bf718156c2de36967352d72d6345cb59cff3eb
/LexerTest.java
c738c7f5b5e51a0b390cbb1abb9796452d5d6e09
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
tuva/jasm6502
7df5db152ccdccd966cd62b2403afcf91c2cec00
91365c23f86e3746baa22b1961fc6d2f58fdbf00
refs/heads/master
2016-09-08T01:54:26.047161
2010-10-29T12:52:36
2010-10-29T12:52:36
1,030,788
2
0
null
null
null
null
ISO-8859-1
Java
false
false
6,801
java
import junit.framework.*; import java.io.*; /** * @test Runs a test case on Lexer6502.java. * <p> * Requiers that JUnit is installed. * It tries a small variety of symbols from the 6502 syntax, by loading the lexer with some test source files * and comparing the symbols the lexer returns with expected hardcoded ones. * <br /><br /> * To run this test from shell, type from directory containing this source: * java junit.textui.TestRunner LexerTest * </p> * @author David Schager 2006 */ public class LexerTest extends TestCase implements SymbolConstant6502 { private AbstractAssembler mAsm = null; private AbstractLexer mLexer = null; private static Symbol mHash = new Symbol ("#", OPERATOR, '#'); private static Symbol mLF = new Symbol ("", LINEFEED, NULL); private static Symbol mAssign = new Symbol ("=", ASSIGN, NULL); /** Array of symbols expected back from Lexer when passing file testconstants.asm to Lexer The contents of that file is: #$9af0 #$100 #1000 100 */ private static Symbol[] mExpectedConstants = { mHash, new Symbol ("", CONSTANT, 0x9af0), mLF, mHash, new Symbol ("", CONSTANT, 0x100), mLF, mHash, new Symbol ("", CONSTANT, 1000), mLF, new Symbol ("", CONSTANT, 100), mLF, new Symbol ("", EOF, NULL) }; /** Array of symbols expected back from Lexer when passing file testidentifiers.asm to Lexer The contents of that file is: hello label: hehh apa = hello *+-/($100)! a comment ; more comments */ private static Symbol[] mExpectedIdentifiers = { new Symbol ("hello", IDENTIFIER, NULL), mLF, new Symbol ("label", LABEL, NULL), new Symbol ("hehh", IDENTIFIER, NULL), mLF, new Symbol ("apa", IDENTIFIER, NULL), mAssign, new Symbol ("hello", IDENTIFIER, NULL), mLF, new Symbol ("*", OPERATOR, '*'), new Symbol ("+", OPERATOR, '+'), new Symbol ("-", OPERATOR, '-'), new Symbol ("/", OPERATOR, '/'), new Symbol ("(", LEFTPAREN, NULL), new Symbol ("", CONSTANT, 0x100), new Symbol (")", RIGHTPAREN, NULL), mLF, new Symbol ("", EOF, NULL) }; /** Array of symbols expected back from Lexer when passing file testprogram.asm to Lexer The contents of that file is: *=$1000 addr1=$02 ldx #$10 ldy #$00 loop: lda (addr1),y ; use indirect indexed y addressing sta ($fb,x) dex iny bne loop rts */ private static Symbol[] mExpectedProgram = { new Symbol ("*", OPERATOR, '*'), mAssign, new Symbol ("", CONSTANT, 0x1000), mLF, new Symbol ("addr1", IDENTIFIER, NULL), mAssign, new Symbol ("", CONSTANT, 2), mLF, new Symbol ("ldx", LDX, NULL), new Symbol ("#", OPERATOR, '#'), new Symbol ("", CONSTANT, 0x10), mLF, new Symbol ("ldy", LDY, NULL), new Symbol ("#", OPERATOR, '#'), new Symbol ("", CONSTANT, 0), mLF, new Symbol ("loop", LABEL, NULL), new Symbol ("lda", LDA, NULL), new Symbol ("(", LEFTPAREN, NULL), new Symbol ("addr1", IDENTIFIER, NULL), new Symbol (")", RIGHTPAREN, NULL), new Symbol (",", DELIMITER, ','), new Symbol ("y", Y, NULL), mLF, new Symbol ("sta", STA, NULL), new Symbol ("(", LEFTPAREN, NULL), new Symbol ("", CONSTANT, 0xfb), new Symbol (",", DELIMITER, ','), new Symbol ("x", X, NULL), new Symbol (")", RIGHTPAREN, NULL), mLF, new Symbol ("dex", DEX, NULL), mLF, new Symbol ("iny", INY, NULL), mLF, new Symbol ("bne", BNE, NULL), new Symbol ("loop", LABEL, NULL), mLF, new Symbol ("rts", RTS, NULL), mLF, new Symbol ("", EOF, NULL) }; /** * Constructor, calls TestCase Parent class from JUnit */ public LexerTest (String testName) { super (testName); } /** * Sets up Test * Instantiates an Assembler6502 object, and gets the lexer from it. */ public void setUp () { mAsm = new Assembler6502 (); mLexer = mAsm.getLexer (); } /** * Test the Lexers parsing of constants. * The file testconstants.asm (which must be in same directory as test) is passed by filename to Lexer. * For each passed symbol from Lexer, method compares it with expected Symbol in member array * mExpectedConstants. * The constants are both checked by symbol type, and that the lexer could interpret the constants * values, both decimal and hexadecimal, correctly. */ public void testConstants () { try { mLexer.attachInput ("test/testconstants.asm"); int i = 0; while (i < mExpectedConstants.length) { Symbol symbol = mLexer.getNext (); assertEquals (mExpectedConstants[i].getName (), symbol.getName ()); assertEquals (mExpectedConstants[i].getType (), symbol.getType ()); assertEquals (mExpectedConstants[i].getValue (), symbol.getValue ()); ++i; } } catch (Exception e) { System.err.println (e); e.printStackTrace (); } } /** * Test the Lexers parsing of Identifiers. * The file testidentifiers.asm (which must be in same directory as test) is passed by filename to Lexer. * For each passed symbol from Lexer, method compares it with expected Symbol in member array * mExpectedIdentifiers. Apart from identifiers, operators (*-+) and are checked, and proper ignoring of * comments. */ public void testIdentifiers () { try { mLexer.attachInput ("test/testidentifiers.asm"); int i = 0; while (i < mExpectedIdentifiers.length) { Symbol symbol = mLexer.getNext (); //System.err.print (symbol.getName () + " "); //System.err.println ("0x" + Integer.toHexString (symbol.getType ())); assertEquals (mExpectedIdentifiers[i].getName (), symbol.getName ()); assertEquals (mExpectedIdentifiers[i].getType (), symbol.getType ()); assertEquals (mExpectedIdentifiers[i].getValue (), symbol.getValue ()); ++i; } } catch (Exception e) { System.err.println (e); e.printStackTrace (); } } /** * Test the Lexers parsing of small assembler program. * The file testprogram.asm (which must be in same directory as test) is passed by filename to Lexer. * For each passed symbol from Lexer, method compares it with expected Symbol in member array * mExpectedProgram. This is a more realistic test, as it is a small source file. * All types of symbols are tested here. */ public void testProgram () { try { mLexer.attachInput ("test/testprogram.asm"); int i = 0; while (i < mExpectedProgram.length) { Symbol symbol = mLexer.getNext (); //System.err.print (symbol.getName () + " "); //System.err.print ("0x" + Integer.toHexString (symbol.getType ())); //System.err.println (" 0x" + Integer.toHexString (symbol.getValue ())); assertEquals (mExpectedProgram[i].getName (), symbol.getName ()); assertEquals (mExpectedProgram[i].getType (), symbol.getType ()); // Don't check values.. opcodes contains addressing constants, no need to check ++i; } } catch (Exception e) { System.err.println (e); e.printStackTrace (); } } } /* ett fel, när ingen linefeed innan eof */
70d733a14f0cb6d1ddbc27dd4a6c04dd38d4cb88
9ec3ef9efdedf2a30684af5955c7734ad1ef1629
/src/br/com/debra/nfe/schema/eventoCancSubst/SignatureValueType.java
3ee7e633f8fced723bff36f0e159389e7fdac3fb
[]
no_license
paragao01/nfe
83e3496b45a3c32012c8bd209f59b51c47d2d484
527a99d671dc3beba2eb52bed5ded66c47a5f74b
refs/heads/master
2022-04-12T13:51:07.865163
2020-04-06T14:37:08
2020-04-06T14:37:08
253,520,346
0
0
null
null
null
null
UTF-8
Java
false
false
2,203
java
package br.com.debra.nfe.schema.eventoCancSubst; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlID; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * <p>Classe Java de SignatureValueType complex type. * * <p>O seguinte fragmento do esquema especifica o contedo esperado contido dentro desta classe. * * <pre> * &lt;complexType name="SignatureValueType"> * &lt;simpleContent> * &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>base64Binary"> * &lt;attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SignatureValueType", namespace = "http://www.w3.org/2000/09/xmldsig#", propOrder = { "value" }) public class SignatureValueType { @XmlValue protected byte[] value; @XmlAttribute(name = "Id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String id; /** * Obtm o valor da propriedade value. * * @return * possible object is * byte[] */ public byte[] getValue() { return value; } /** * Define o valor da propriedade value. * * @param value * allowed object is * byte[] */ public void setValue(byte[] value) { this.value = value; } /** * Obtm o valor da propriedade id. * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * Define o valor da propriedade id. * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; } }
603e59071e545c85445e034eaf9bc61b7f63e3e3
9d28dfd9b22e43463d27ca326a41f55cd34fb5f4
/src/main/java/com/gamestore/gamestore/controllers/JuegoController.java
6d2684947b074fbd5b69e7407cd219f1bb5d9b42
[]
no_license
Juesmahe1512/pruebaSuMax
8557bab01b8c62a09a934eeb1bfbe0c4099e0431
668cdc876353b720f4c4140b56b828cb5fba3022
refs/heads/master
2022-12-01T22:53:37.277983
2020-08-17T16:38:17
2020-08-17T16:38:17
288,212,460
0
0
null
null
null
null
UTF-8
Java
false
false
1,720
java
package com.gamestore.gamestore.controllers; import com.gamestore.gamestore.models.Juego; import com.gamestore.gamestore.services.JuegoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; 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.RestController; import java.util.List; @RestController @RequestMapping("/juego") public class JuegoController { @Autowired JuegoService juegoService; @GetMapping("/director/{director}") public ResponseEntity<?> traerJuegosPorDirector(@PathVariable("director") String director){ if(director.equals("")||director==null){ return ResponseEntity.notFound().build(); } return ResponseEntity.ok().body(juegoService.consultarJuegosPorDirector(director)); } @GetMapping("/marca/{marca}") public ResponseEntity<?> traerJuegosPorMarca(@PathVariable("marca") String marca){ if(marca.equals("")||marca==null){ return ResponseEntity.notFound().build(); } return ResponseEntity.ok().body(juegoService.consultarJuegoPorMarca(marca)); } @GetMapping("/productor/{productor}") public ResponseEntity<?> traerJuegosPorProductor(@PathVariable("productor") String productor){ if(productor.equals("")||productor==null){ return ResponseEntity.notFound().build(); } return ResponseEntity.ok().body(juegoService.consultarJuegoPorProductor(productor)); } }
b3fa0e0e8e3a59b9d59571a2a1c34bdfd7bbc395
7bfb5cebc226b23f49f410e9eb4c82013154c2e6
/spring-cloud-sleuth/spring-cloud-zipkin-show/src/test/java/com/wjl327/show/SpringCloudZipkinShowApplicationTests.java
7c99d8b804ff99013514dac704b96c0e07c83df7
[]
no_license
wjl327/spring-cloud-example
67500a5e69059196a77a08bb6c712c229c17827d
cb3fd1e26db41c06e96be870b846c72d7c1c7a03
refs/heads/master
2020-05-15T21:34:13.657294
2019-07-03T15:51:56
2019-07-03T15:51:56
182,502,979
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.wjl327.show; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class SpringCloudZipkinShowApplicationTests { @Test public void contextLoads() { } }
efb1e8a3ad1e09877ec103a75cee44b0b70e7e52
b549eb3cad4cf341d33d24f450e3903c07bb9794
/test/unittesting/HurricaneCardTest.java
1127416a0d22603c81839e40760ef0b2abe1d9d8
[]
no_license
mberkc/Ultimate-Monopoly
9e8691ce294754d46d3fdfcc897163afdb7ca0fb
0d5b54ef52b585efcc9a13f002eeb05a3a1d98a4
refs/heads/master
2020-03-29T09:27:53.843849
2018-09-21T12:18:17
2018-09-21T12:18:17
149,758,546
0
0
null
null
null
null
UTF-8
Java
false
false
2,967
java
package unittesting; import GameSquares.GameSquare; import GameSquares.Land; import GameSquares.Land.state; import GameSquares.Cards.ChanceCards.Hurricane; import Main.Player; import Main.Main; import static org.junit.Assert.*; import org.junit.Test; public class HurricaneCardTest { @Test public void testUnimprovedLands() { Main.initializeGameSquares(); GameSquare [] squares = Main.gameSquares; Player temp = new Player(0,"abdullah",squares); Land testerLand1 = (Land) squares[1]; Land testerLand2 = (Land) squares[3]; temp.buySquare(testerLand1); temp.buySquare(testerLand2); Hurricane card = new Hurricane(); card.testing = true; card.onDraw(temp); assertEquals("testing if the card works when player has majority ownership but no houses",state.unImproved,testerLand1.currentState); } @Test public void testIfLandHasHouse() { Main.initializeGameSquares(); GameSquare [] squares = Main.gameSquares; Player temp = new Player(0,"abdullah",squares); Land testerLand1 = (Land) squares[1]; Land testerLand2 = (Land) squares[3]; temp.buySquare(testerLand1); temp.buySquare(testerLand2); testerLand1.setState(state.house); Hurricane card = new Hurricane(); card.testing = true; card.onDraw(temp); assertEquals("testing if works for a house built land",state.unImproved,testerLand1.currentState); } @Test public void testIfLandHasHotel() { Main.initializeGameSquares(); GameSquare [] squares = Main.gameSquares; Player temp = new Player(0,"abdullah",squares); Land testerLand1 = (Land) squares[1]; Land testerLand2 = (Land) squares[3]; temp.buySquare(testerLand1); temp.buySquare(testerLand2); testerLand1.setState(state.hotel); Hurricane card = new Hurricane(); card.testing = true; card.onDraw(temp); assertEquals("testing if works for a hotel built land",state.fourHouse,testerLand1.currentState); } @Test public void testIfLandHasSkyscraper() { Main.initializeGameSquares(); GameSquare [] squares = Main.gameSquares; Player temp = new Player(0,"abdullah",squares); Land testerLand1 = (Land) squares[1]; Land testerLand2 = (Land) squares[3]; temp.buySquare(testerLand1); temp.buySquare(testerLand2); testerLand1.setState(state.skyscraper); Hurricane card = new Hurricane(); card.testing = true; card.onDraw(temp); assertEquals("testing if works for a skyscraper built land",state.hotel,testerLand1.currentState); } @Test public void testIfPlayerDoesNotHaveMajorityOwnership() { Main.initializeGameSquares(); GameSquare [] squares = Main.gameSquares; Player temp = new Player(0,"abdullah",squares); Land testerLand1 = (Land) squares[1]; temp.buySquare(testerLand1); Hurricane card = new Hurricane(); card.testing = true; card.onDraw(temp); assertEquals("testing if works for a non-majority ownership land",state.unImproved,testerLand1.currentState); } }
ef70b1745f69af42eda2814d85f1881d65ee8bf9
5d0ad8f1a626449edba3da47fce01ca734cacc05
/app/src/main/java/com/blanink/fragment/WareHouseFragment.java
c8cca7df5c046268d2bcd6ba9e0db339e84df888
[]
no_license
liangsheng888/blanink
3ffd4dc1de0ea5bce956f77a6f4b6287e10f4373
f6a838463492a9df6dc456736d30e53e0a8b76c5
refs/heads/master
2021-01-19T20:22:08.986763
2017-08-25T10:07:10
2017-08-25T10:07:10
88,497,766
0
1
null
null
null
null
UTF-8
Java
false
false
8,779
java
package com.blanink.fragment; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.Message; 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.AbsListView; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.blanink.R; import com.blanink.adapter.WareHouseAdapter; import com.blanink.pojo.Stock; import com.blanink.utils.NetUrlUtils; import com.blanink.view.UpLoadListView; import com.google.gson.Gson; import com.scwang.smartrefresh.header.WaveSwipeHeader; import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.listener.OnRefreshListener; import java.io.IOException; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; import okhttp3.Call; import okhttp3.Callback; import okhttp3.FormBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; /** * Created by Administrator on 2017/8/14 0014. */ public class WareHouseFragment extends Fragment { @BindView(R.id.lv) UpLoadListView lv; @BindView(R.id.smartRefreshLayout) SmartRefreshLayout smartRefreshLayout; @BindView(R.id.ll_load) LinearLayout llLoad; @BindView(R.id.loading_error_img) ImageView loadingErrorImg; @BindView(R.id.rl_load_fail) RelativeLayout rlLoadFail; @BindView(R.id.tv_not) TextView tvNot; @BindView(R.id.rl_not_data) RelativeLayout rlNotData; @BindView(R.id.fl_load) FrameLayout flLoad; Unbinder unbinder; private SharedPreferences sp; private List<Stock.ResultBean.RowsBean> srr=new ArrayList<>(); private boolean isHasData=true; private WareHouseAdapter wareHouseAdapter; private Handler handler=new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); lv.completeRefresh(isHasData); if(wareHouseAdapter!=null){ wareHouseAdapter.notifyDataSetChanged(); } } }; private int pageNo=1; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = View.inflate(getActivity(), R.layout.fragment_stock, null); sp = getActivity().getSharedPreferences("DATA", Context.MODE_PRIVATE); unbinder = ButterKnife.bind(this, view); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); initData(); } @Override public void onStart() { super.onStart(); } private void initData() { loadData(); lv.setOnRefreshListener(new UpLoadListView.OnRefreshListener() { @Override public void onLoadingMore() { pageNo++; loadData(); } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); //刷新 //设置 Header 为 水波 WaveSwipeHeader waveSwipeHeader= new WaveSwipeHeader(getActivity()); waveSwipeHeader.setPrimaryColors(getResources().getColor(R.color.colorOrange)); waveSwipeHeader.setColorSchemeColors(Color.WHITE, Color.WHITE); smartRefreshLayout.setRefreshHeader(waveSwipeHeader); smartRefreshLayout.setEnableLoadmore(false);//是否开启加上拉加载功能(默认true) smartRefreshLayout.setEnableHeaderTranslationContent(false);//拖动Header的时候是否同时拖动内容(默认true) smartRefreshLayout.setDisableContentWhenRefresh(true);//是否在刷新的时候禁止内容的一切手势操作(默认false) //设置 Footer 为 球脉冲 // smartRefreshLayout.setRefreshFooter(new BallPulseFooter(this).setSpinnerStyle(SpinnerStyle.Scale)); //刷新 smartRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh(RefreshLayout refreshlayout) { pageNo=1; RefreshData(); } }); } private void RefreshData() { String url = NetUrlUtils.NET_URL + "companyInventory/list"; OkHttpClient ok = new OkHttpClient(); RequestBody body = new FormBody.Builder() .add("companyId.id", sp.getString("COMPANY_ID", null)) .add("pageNo", pageNo+"") .build(); final Request request = new Request.Builder().post(body).url(url).build(); ok.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { String result = response.body().string(); Gson gson = new Gson(); final Stock stock = gson.fromJson(result, Stock.class); getActivity().runOnUiThread(new Runnable() { @Override public void run() { llLoad.setVisibility(View.GONE); smartRefreshLayout.finishRefresh(); Toast.makeText(getActivity(), "已刷新", Toast.LENGTH_SHORT).show(); if(stock.getResult().getRows().size()==0){ }else { srr.clear(); srr.addAll(stock.getResult().getRows()); rlNotData.setVisibility(View.GONE); } handler.sendEmptyMessage(0); } }); } }); } private void loadData() { String url = NetUrlUtils.NET_URL + "companyInventory/list"; OkHttpClient ok = new OkHttpClient(); RequestBody body = new FormBody.Builder() .add("companyId.id", sp.getString("COMPANY_ID", null)) .add("pageNo", pageNo+"") .build(); final Request request = new Request.Builder().post(body).url(url).build(); ok.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { llLoad.setVisibility(View.GONE); rlLoadFail.setVisibility(View.VISIBLE); } }); } @Override public void onResponse(Call call, Response response) throws IOException { String result = response.body().string(); Gson gson = new Gson(); final Stock stock = gson.fromJson(result, Stock.class); getActivity().runOnUiThread(new Runnable() { @Override public void run() { llLoad.setVisibility(View.GONE); if(stock.getResult().getTotal()==0){ rlNotData.setVisibility(View.VISIBLE); tvNot.setText("暂无库存"); }else { if(stock.getResult().getRows().size()==0){ isHasData=false; }else { isHasData=true; srr.addAll(stock.getResult().getRows()); if(wareHouseAdapter==null){ wareHouseAdapter=new WareHouseAdapter(getActivity(),srr); lv.setAdapter(wareHouseAdapter); } } } handler.sendEmptyMessage(0); } }); } }); } @Override public void onDestroyView() { super.onDestroyView(); unbinder.unbind(); } }
c73785907aab2001e2d1f7254d7bf4074c0b79c7
796e293227c0b4ba0f71e3b09ad016fdf823c23f
/src/kr/ac/uos/ssl/bean/Ball.java
485dd1db1f0c1e22256b0fafa81b042c0d0adf0d
[]
no_license
cycho21/Bouncing-Ball-Problem
453dd7e688a0ea4cd948ad495394abde865c300c
eee24c24e70c0c667f76b61039a41c3f6f246e11
refs/heads/master
2021-05-30T19:28:56.986490
2015-11-10T00:01:15
2015-11-10T00:01:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
918
java
package kr.ac.uos.ssl.bean; import java.util.Random; /** * @author Chan Yeon, Cho * @version 0.0.1 - SnapShot * on 2015-11-03 */ public class Ball { private final Random rand; private int x; private int y; private int xDelta; private int yDelta; public Ball(int x, int y) { this.x = x; this.y = y; rand = new Random(); xDelta = 1; yDelta = 1; } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public int getxDelta() { return xDelta; } public void setxDelta(int xDelta) { this.xDelta = xDelta; } public int getyDelta() { return yDelta; } public void setyDelta(int yDelta) { this.yDelta = yDelta; } }
0dbba501bab026d920a083593f1e6946ab6278cf
50e0dd1411164a9d0169d749ecdb21777ec95832
/src/com/discordJava/classes/ApplicationCommandInteractionDataOption.java
b82726c86888c84643631828b46c5f761ec05ba8
[]
no_license
meisZWFLZ/discordJava
21e2898e5c7907e285f0eeabdbe271adb8506d70
c55c070cb8e2319ef41d04da7374c38e501f9983
refs/heads/master
2023-06-15T00:12:39.839099
2021-07-06T18:27:05
2021-07-06T18:27:05
378,529,770
0
0
null
null
null
null
UTF-8
Java
false
false
843
java
package com.discordJava.classes; public class ApplicationCommandInteractionDataOption { public String name; public Integer type; public Object value; public ApplicationCommandInteractionDataOption[] options; public String getType() { return type(this.type); } public static String getType(Integer type) { return type(type); } private static String type(Integer type) { return switch (type) { case 1 -> "SUB_COMMAND"; case 2 -> "SUB_COMMAND_GROUP"; case 3 -> "STRING"; case 4 -> "INTEGER"; case 5 -> "BOOLEAN"; case 6 -> "USER"; case 7 -> "CHANNEL"; case 8 -> "ROLE"; case 9 -> "MENTIONABLE"; default -> null; }; } }
35e3263356eb4bee88c852c0e0a26ed054520c4b
42076f0dc5e3f42fce5d37651f20404f19c0c04d
/src/main/java/es/yellowzaki/databaseapi/database/transition/Json2MySQLDatabase.java
eac381fdecfd2371e6b6bc064ed81be0866a9d08
[]
no_license
YellowZaki/DatabaseAPI
945c9b68d8cdd44103a9faac03976394cc8bfdee
bc6b1770588ad3807792e32d793b12f26ee5a8c6
refs/heads/main
2023-02-13T04:00:48.442650
2021-01-08T16:06:22
2021-01-08T16:06:22
327,944,991
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package es.yellowzaki.databaseapi.database.transition; import es.yellowzaki.databaseapi.database.AbstractDatabaseHandler; import es.yellowzaki.databaseapi.database.DatabaseSettings; import es.yellowzaki.databaseapi.database.DatabaseSetup; import es.yellowzaki.databaseapi.database.json.JSONDatabase; import es.yellowzaki.databaseapi.database.sql.mysql.MySQLDatabase; /** * @author tastybento * @since 1.5.0 */ public class Json2MySQLDatabase implements DatabaseSetup { @Override public <T> AbstractDatabaseHandler<T> getHandler(Class<T> type, DatabaseSettings settings) { return new TransitionDatabaseHandler<>(type, new JSONDatabase().getHandler(type, settings), new MySQLDatabase().getHandler(type, settings)); } }
261d982723ca63a3db1d444ab7eb42db88d62211
06fbd6b31c0a987fea9c0ac8e13882f57eaf8689
/src/com/liu/collection/ArrayListDemo.java
6e28b94e1b686bbd1d2c8ceaa187a41cdcd701f6
[]
no_license
no-yesterday/javaapi
d6abecc124da23519ba7e27b85ef00a2b7cd65e1
88579911f0e727ae4cfb35bc8456373f0bc08154
refs/heads/master
2023-06-24T02:25:41.574742
2021-07-19T15:16:46
2021-07-19T15:16:46
385,658,740
0
0
null
null
null
null
UTF-8
Java
false
false
1,189
java
package com.liu.collection; import java.util.ArrayList; import java.util.List; /** * JDK 8 的 快速 取 集合中的属性 */ public class ArrayListDemo { public static void main(String[] args) { Person diaochan = new Person(); diaochan.setName("貂蝉"); diaochan.setAge(18); diaochan.setHeight(165); Person xiaoqiao = new Person(); xiaoqiao.setName("小乔"); xiaoqiao.setHeight(20); xiaoqiao.setHeight(158); Person sunshangxiang = new Person(); sunshangxiang.setName("孙尚香"); sunshangxiang.setAge(22); sunshangxiang.setHeight(170); //需求:有个曹操,需要一个String集合,该集合中的值提取与上面三千个list中的值,把名字都存进去 List list = new ArrayList(); list.add(diaochan); list.add(xiaoqiao); list.add(sunshangxiang); System.out.println("list = " + list); List<String> names = new ArrayList<>(); names.add(diaochan.getName()); names.add(xiaoqiao.getName()); names.add(sunshangxiang.getName()); System.out.println("names = " + names); } }
43e261b662cf3744260af0ed07e818c62ced6c48
9462c3cb363ee9484ce8da17b37e9109b1ba9299
/app/src/main/java/com/example/syair/Holder/NilaiHolder.java
92f1c21fdb0f6b07c392104eda2db3c08ba3a557
[]
no_license
ASNProject/Syair-PBSI-UAD
b4995891265cf6fc32d425e1db5d4ba54de4a6b6
ed6a2a8e041ccedaa6b22516a653ddfdb046f764
refs/heads/master
2022-12-05T13:15:10.518658
2020-08-03T05:26:11
2020-08-03T05:26:11
284,608,566
0
0
null
null
null
null
UTF-8
Java
false
false
741
java
package com.example.syair.Holder; import android.view.View; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.syair.Adapter.RequestNilai; import com.example.syair.R; public class NilaiHolder extends RecyclerView.ViewHolder { public TextView datetime, values; public NilaiHolder(@NonNull View itemView) { super(itemView); datetime= itemView.findViewById(R.id.times); values = itemView.findViewById(R.id.value); } public void bindToPerusahaan(RequestNilai requestNilai, View.OnClickListener onClickListener){ datetime.setText(requestNilai.tanggal); values.setText(requestNilai.nilai); } }
c05d13704908ad696bbbd9da0f6269e18e288fe4
c18bda7a79069917c9508a0173b22cdf48617752
/transGalactica/transGalactica-fwk-reactor/transGalactica-fwk-validation/src/test/java/org/transgalactica/fwk/validation/MultipleErrorsTest.java
c583d0c0fac6feb7e01640f78229c3b674fd91f9
[]
no_license
thierrydoucet/transGalactica.old
563c30f8c5a2d5c29a71676817f18c7df5ad97d0
022d4bb592a6730eef2a5aeaf463eae49fa35d4a
refs/heads/master
2021-01-10T01:52:04.836663
2014-12-04T21:25:58
2014-12-04T21:25:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,379
java
package org.transgalactica.fwk.validation; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.Arrays; import java.util.List; import java.util.NoSuchElementException; import org.junit.Test; import org.springframework.context.MessageSourceResolvable; import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; import org.springframework.validation.DefaultMessageCodesResolver; import org.springframework.validation.MessageCodesResolver; import org.transgalactica.fwk.validation.exception.AbstractException; import org.transgalactica.fwk.validation.exception.ExceptionUtils; import org.transgalactica.fwk.validation.exception.MultipleErrorsException; @ContextConfiguration(locations = { "classpath:org/transgalactica/fwk/validation/MultipleErrorsTest.spring.xml" }) public class MultipleErrorsTest extends AbstractJUnit4SpringContextTests { private static final String ERROR_CODE = "error.code"; private static final String OBJECT_NAME = "object.name"; private static final MessageCodesResolver RESOLVER = new DefaultMessageCodesResolver(); private class MockException extends AbstractException { private static final long serialVersionUID = 1L; public MockException(String message, Object... args) { super(message); for (int i = 0; i < args.length; i++) { addArgument(args[i]); } } } @Test public void testEmptyError() { MultipleErrors errors = new MultipleErrors(); assertFalse(errors.hasErrors()); assertNotNull(errors.getAllErrorMessages()); assertEquals(0, errors.getAllErrorMessages().size()); } @Test public void testSingleError() { MultipleErrors errors = new MultipleErrors(); MessageSourceResolvable m = createMessage(1); errors.add(m); checkMessages(errors, new MessageSourceResolvable[] { m }); } @Test public void testTwoErrors() { MultipleErrors errors = new MultipleErrors(); MessageSourceResolvable m1 = createMessage(1); MessageSourceResolvable m2 = createMessage(2); errors.add(m1); errors.add(m2); checkMessages(errors, new MessageSourceResolvable[] { m1, m2 }); } @Test public void testTwoStringErrors() { MultipleErrors errors = new MultipleErrors(); MessageSourceResolvable m1 = new DefaultMessageSourceResolvable(new String[] { "message1" }, "message1"); MessageSourceResolvable m2 = new DefaultMessageSourceResolvable(new String[] { "message2" }, "message2"); errors.add("message1"); errors.add("message2"); checkMessages(errors, new MessageSourceResolvable[] { m1, m2 }); } @Test public void testAddMulitpleErrorsToEmptyList() { MultipleErrors errors1 = new MultipleErrors(); MultipleErrors errors2 = new MultipleErrors(); MessageSourceResolvable m2 = createMessage(2); errors2.add(m2); errors1.add(errors2); checkMessages(errors1, new MessageSourceResolvable[] { m2 }); } @Test public void testAddMulitpleErrorsToExistingList() { MultipleErrors errors1 = new MultipleErrors(); MessageSourceResolvable m1 = createMessage(1); errors1.add(m1); MultipleErrors errors2 = new MultipleErrors(); MessageSourceResolvable m2 = createMessage(2); errors2.add(m2); errors1.add(errors2); checkMessages(errors1, new MessageSourceResolvable[] { m1, m2 }); } @Test public void testAddBasicExceptionWithNoMessage() { Exception e = new Exception(); MultipleErrors errors = new MultipleErrors(); MessageSourceResolvable m = new DefaultMessageSourceResolvable(new String[] { "java.lang.Exception" }, new Object[] {}); errors.add(e); checkMessages(errors, new MessageSourceResolvable[] { m }); } @Test public void testAddExceptionWithOneArgument() { Exception e = new MockException("some.message{0}", "some.args"); MultipleErrors errors = new MultipleErrors(); MessageSourceResolvable m = new DefaultMessageSourceResolvable(new String[] {// MockException.class.getName(), // AbstractException.class.getName(), // RuntimeException.class.getName(), // Exception.class.getName() // }, new Object[] { new DefaultMessageSourceResolvable(new String[] { ExceptionUtils.getCauseMessage(e) }, ExceptionUtils.getCauseMessage(e)), "some.args" }); errors.add(e); checkMessages(errors, new MessageSourceResolvable[] { m }); } @Test public void testAddExceptionWithTwoArguments() { Exception e = new MockException("some.message{0}{1}", "arg1", "arg2"); MultipleErrors errors = new MultipleErrors(); MessageSourceResolvable m = new DefaultMessageSourceResolvable(new String[] {// MockException.class.getName(), // AbstractException.class.getName(), // RuntimeException.class.getName(), // Exception.class.getName() // }, new Object[] { new DefaultMessageSourceResolvable(new String[] { ExceptionUtils.getCauseMessage(e) }, ExceptionUtils.getCauseMessage(e)), "arg1", "arg2" }); errors.add(e); checkMessages(errors, new MessageSourceResolvable[] { m }); } @Test public void testAddBasicExceptionWithMessage() { Exception e = new Exception("some.message"); MultipleErrors errors = new MultipleErrors(); MessageSourceResolvable m = new DefaultMessageSourceResolvable(new String[] { "java.lang.Exception" }, new Object[] { new DefaultMessageSourceResolvable(new String[] { "some.message" }, "some.message") }); errors.add(e); checkMessages(errors, new MessageSourceResolvable[] { m }); } @Test public void testAddEmptyMultipleErrorsException() { MultipleErrors errors = new MultipleErrors(); MultipleErrors errors1 = new MultipleErrors(); MultipleErrorsException e = new MultipleErrorsException(errors1.getAllErrorMessages()); errors.add(e); assertEquals(0, errors.getAllErrorMessages().size()); } @Test public void testAddMultipleErrorsException() { MultipleErrors errors = new MultipleErrors(); Exception npe = new NullPointerException(); errors.add(npe); errors.add(new IllegalAccessException()); MultipleErrors errors1 = new MultipleErrors(); errors1.add(new NoSuchElementException()); MultipleErrorsException e = new MultipleErrorsException(errors1.getAllErrorMessages()); errors.add(e); MessageSourceResolvable m1 = new DefaultMessageSourceResolvable(new String[] { NullPointerException.class.getName(), RuntimeException.class.getName(), Exception.class.getName() }, ExceptionUtils.getArguments(npe)); MessageSourceResolvable m2 = new DefaultMessageSourceResolvable(new String[] { IllegalAccessException.class.getName(), ReflectiveOperationException.class.getName(), Exception.class.getName() }, new Object[] {}); MessageSourceResolvable m3 = new DefaultMessageSourceResolvable(new String[] { NoSuchElementException.class.getName(), RuntimeException.class.getName(), Exception.class.getName() }, new Object[] {}); checkMessages(errors, new MessageSourceResolvable[] { m1, m2, m3 }); } @Test public void testCheckErrorsWithoutError() { MultipleErrors errors = new MultipleErrors(); try { errors.checkErrors(); } catch (MultipleErrorsException mex) { fail(); } } @Test public void testCheckErrorsWithError() { MultipleErrors errors = new MultipleErrors(); errors.add(new NullPointerException()); try { errors.checkErrors(); fail(); } catch (MultipleErrorsException mex) { assertEquals(errors.getAllErrorMessages(), mex.getErrors()); } } private MessageSourceResolvable createMessage(int index) { String[] codes = RESOLVER.resolveMessageCodes(ERROR_CODE, OBJECT_NAME); MessageSourceResolvable message = new DefaultMessageSourceResolvable(codes, new Integer[] { new Integer(index) }); return message; } private void checkMessages(MultipleErrors errors, MessageSourceResolvable[] expectedMessages) { if (expectedMessages == null || expectedMessages.length == 0) { assertFalse(errors.hasErrors()); } else { assertTrue(errors.hasErrors()); List<MessageSourceResolvable> errs = errors.getAllErrorMessages(); assertNotNull(errs); assertEquals(expectedMessages.length, errs.size()); for (int i = 0; i < expectedMessages.length; i++) { assertEqualsMessage(expectedMessages[i], errs.get(i)); } } } private void assertEqualsMessage(MessageSourceResolvable expectedMessage, MessageSourceResolvable message) { assertEquals(expectedMessage != null, message != null); if (expectedMessage != null && !expectedMessage.equals(message)) { // check codes String[] expectedCodes = expectedMessage.getCodes(); String[] codes = message.getCodes(); assertEquals(expectedCodes != null, codes != null); if (expectedCodes != null) { assertEquals(Arrays.asList(expectedCodes), Arrays.asList(codes)); } // check args Object[] expectedArgs = expectedMessage.getArguments(); Object[] args = message.getArguments(); assertEquals(expectedArgs != null, args != null); if (expectedArgs != null) { assertEquals(Arrays.asList(expectedArgs), Arrays.asList(args)); } // check defaultMessage assertEquals(expectedMessage.getDefaultMessage(), message.getDefaultMessage()); } } }
99f20c53aa579b4c99d964dab3aa4a34574445db
6832918e1b21bafdc9c9037cdfbcfe5838abddc4
/jdk_8_maven/cs/rpc/grpc/artificial/grpc-scs/src/main/java/org/grpc/scs/imp/Calc.java
dc621baa84448cdf5d8b7ad15c33db3eaab37fa6
[ "Apache-2.0", "GPL-1.0-or-later", "LGPL-2.0-or-later" ]
permissive
EMResearch/EMB
200c5693fb169d5f5462d9ebaf5b61c46d6f9ac9
092c92f7b44d6265f240bcf6b1c21b8a5cba0c7f
refs/heads/master
2023-09-04T01:46:13.465229
2023-04-12T12:09:44
2023-04-12T12:09:44
94,008,854
25
14
Apache-2.0
2023-09-13T11:23:37
2017-06-11T14:13:22
Java
UTF-8
Java
false
false
1,892
java
//! futname = Subject //NAME OF FUNCTION UNDER TEST //! mutation = false //SPECIFY MUTATION COVERAGE //! textout = true //WRITE INSTRUMENTED SUBJECT TO FILE //! maxchildren = 500000 //MAX LENGTH OF SEARCH //! totalpopsize = 100 //TOTAL SIZE OF POPULATIONS //! mutationpercent = 50 //REL FREQUENCY OF GENETIC MUTATION TO CROSSOVER //! samefitcountmax = 100 //NUMBER OF CONSECUTIVE TESTS IN A POP //THAT MUST HAVE THE SAME COST FOR POP TO BE STAGNANT //! verbose = false //PRINT MESSAGES SHOWING PROGRESS OF SEARCH //! showevery = 3000 //NUMBER OF CANDIDATE INPUTS GENERATED BETWEEN EACH SHOW //! numbins = 0 //GRANULARITY OF CANDIDATE INPUT HISTOGRAM, SET TO 0 TO NOT COLLECT STATS //! trialfirst = 1 //EACH TRIAL USES A DIFFERENT RANDOM SEED //! triallast = 1 //NUMBER OF TRIALS = triallast - trialfirst + 1 //! name = calc //NAME OF EXPT, NOT COMPUTATIONALLY SIGNIFICANT package org.grpc.scs.imp; public class Calc { public static String subject(String op, double arg1 , double arg2 ) { op = op.toLowerCase(); double result = 0.0; if ("pi".equals(op)) { //CONSTANT OPERATOR result = Math.PI; } else if ("e".equals(op)) { result = Math.E; } //UNARY OPERATOR else if ("sqrt".equals(op)) { result = Math.sqrt(arg1); } else if ("log".equals(op)) { result = Math.log(arg1); } else if ("sine".equals(op)) { result = Math.sin(arg1); } else if ("cosine".equals(op)) { result = Math.cos(arg1); } else if ("tangent".equals(op)) { result = Math.tan(arg1); } //BINARY OPERATOR else if ("plus".equals(op)) { result = arg1 + arg2; } else if ("subtract".equals(op)) { result = arg1 - arg2; } else if ("multiply".equals(op)) { result = arg1 * arg2; } else if ("divide".equals(op)) { result = arg1 / arg2; } return "" + result; } }
790cf49e986e75ef992ab7ee908f1ddc8ea4cb31
fa8efa07fd2dcdd3029f9e2a43dd429bbde420ee
/app/src/main/java/com/example/sam/drawerlayoutprac/Partner/TestFragment.java
5e408652e79d00494cec5598765a2ad422c1e1fe
[]
no_license
uopsdod/DDD_mobile
6a69ac49d22dde1a74ef4071925d46fdade6a5dc
6ba3ae77f973e1ce5f9be710995715a865eefddb
refs/heads/master
2021-01-12T13:16:50.536206
2017-01-08T04:39:10
2017-01-08T04:39:10
72,176,039
2
0
null
null
null
null
UTF-8
Java
false
false
4,203
java
package com.example.sam.drawerlayoutprac.Partner; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import com.example.sam.drawerlayoutprac.Common; import com.example.sam.drawerlayoutprac.MainActivity; import com.example.sam.drawerlayoutprac.R; import com.example.sam.drawerlayoutprac.Util; import com.google.gson.JsonObject; import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.ProtocolException; import java.net.URL; import static com.example.sam.drawerlayoutprac.Partner.MyFirebaseMessagingService.TAG; public class TestFragment extends Fragment { View rootView; EditText memIdView; Button btnView; Button btn_AllSell; @Override public void onResume() { super.onResume(); MainActivity.actionbar.setTitle("測試頁面"); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment this.rootView = inflater.inflate(R.layout.fragment_blank, container, false); btn_AllSell = (Button)rootView.findViewById(R.id.btn_AllSell); btn_AllSell.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Util.showToast(getContext(),"AllSell clicked"); allSell(); } }); return this.rootView; } public void allSell(){ Thread myThread = new Thread(new Runnable() { @Override public void run() { JsonObject jsonObject = new JsonObject(); String url = Common.URL + "/android/AndroidForDevelop"; String action = "AllSell"; jsonObject.addProperty("action", action); HttpURLConnection connection = null; try { connection = (HttpURLConnection) new URL(url).openConnection(); } catch (IOException e) { e.printStackTrace(); } connection.setDoInput(true); // allow inputs connection.setDoOutput(true); // allow outputs connection.setUseCaches(false); // do not use a cached copy try { connection.setRequestMethod("POST"); } catch (ProtocolException e) { e.printStackTrace(); } BufferedWriter bw = null; try { bw = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream())); } catch (IOException e) { e.printStackTrace(); } //getOutputStream 建立 Request物件 try { bw.write(jsonObject.toString()); Log.d(TAG, "jsonOut: " + jsonObject.toString()); } catch (IOException e) { e.printStackTrace(); } try { bw.close(); } catch (IOException e) { e.printStackTrace(); } int responseCode = 0; try { responseCode = connection.getResponseCode(); } catch (IOException e) { e.printStackTrace(); } Log.d("Common","responseCode: " + responseCode); connection.disconnect(); } }); myThread.start(); try { // 重要: 要交上去,才能保證資料已經存入資料庫,之後讀取時才能保障是最新的 myThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } }
0444d500c4aed79728e3c0ecdbef799c46036e02
ce72d44134a81bcbe293f0279bb50424863a0576
/clubInwiApp/src/main/java/com/inwi/clubinwi/home_fragment.java
02081cddd49f0c1712cb8b0c1dd3c75de476a308
[]
no_license
yosraBouasker/club_inwi_App
570c0b0fdfce26022f49b7f631a0ce5e81ebb4de
1a1a717053789fd978d2f7fdca5528c24249050a
refs/heads/master
2022-12-23T22:31:30.036677
2020-09-16T14:58:22
2020-09-16T14:58:22
296,064,192
0
0
null
null
null
null
UTF-8
Java
false
false
2,035
java
package com.inwi.clubinwi; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * A simple {@link Fragment} subclass. * Use the {@link home_fragment#newInstance} factory method to * create an instance of this fragment. */ public class home_fragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; public home_fragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment home_fragment. */ // TODO: Rename and change types and number of parameters public static home_fragment newInstance(String param1, String param2) { home_fragment fragment = new home_fragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_home_fragment, container, false); } }
3e8b05836a3de473cecc2f9d4b1d404208c3518a
47f4fc65022708cecfbd59ad636d5670bd7eae61
/RecyclerAdapter/BaseAdapter/src/main/java/com/zihuan/baseadapter/StickyHeaderGridAdapter.java
7c63a40e6d0f805bb03b4240ba3d15cf0104ce32
[]
no_license
zihuan1/view-recycler-adapter
8f6ccb808aec6de025455eee1410d66cf0d6f988
1c7811b267e74e0e804e559dcdac83f576658a79
refs/heads/master
2021-08-16T20:04:02.948954
2021-07-19T03:12:14
2021-07-19T03:12:14
198,808,217
0
0
null
null
null
null
UTF-8
Java
false
false
19,544
java
package com.zihuan.baseadapter; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.fragment.app.Fragment; import com.zihuan.baseadapter.listener.ViewOnHeadClick; import java.security.InvalidParameterException; import java.util.ArrayList; import static androidx.recyclerview.widget.RecyclerView.NO_POSITION; public abstract class StickyHeaderGridAdapter extends SuperRecycleAdapter<RecyclerViewHolder> { public static final String TAG = "StickyHeaderGridAdapter"; public static final int TYPE_HEADER = 0; public static final int TYPE_ITEM = 1; private ArrayList<Section> mSections; private int[] mSectionIndices; private int mTotalItemNumber; public int[] getSectionIndices() { return mSectionIndices; } public StickyHeaderGridAdapter(Object object) { instanceofObj(object); } public Context mContext; ViewOnHeadClick onHeadClick; // ViewOnItemClick onItemClick; // ViewOnItemLongClick longClick; private Object mListener; private void instanceofObj(Object object) { mListener = object; if (object instanceof Fragment) { mContext = ((Fragment) object).getContext(); } else if (object instanceof Activity) { mContext = (Context) object; } else if (object instanceof View) { mContext = ((View) object).getContext(); } if (object instanceof ViewOnHeadClick) { this.onHeadClick = (ViewOnHeadClick) object; } // if (object instanceof ViewOnItemClick) { // this.onItemClick = (ViewOnItemClick) object; // } // if (object instanceof ViewOnItemLongClick) { // this.longClick = (ViewOnItemLongClick) object; // } } private static class Section { private int position; private int itemNumber; private int length; } public void calculateSections() { mSections = new ArrayList<>(); int total = 0; for (int s = 0, ns = getSectionCount(); s < ns; s++) { final Section section = new Section(); section.position = total; section.itemNumber = getSectionItemCount(s); section.length = section.itemNumber + 1; mSections.add(section); total += section.length; } mTotalItemNumber = total; total = 0; mSectionIndices = new int[mTotalItemNumber]; for (int s = 0, ns = getSectionCount(); s < ns; s++) { final Section section = mSections.get(s); for (int i = 0; i < section.length; i++) { mSectionIndices[total + i] = s; } total += section.length; } } protected int getItemViewInternalType(int position) { final int section = getAdapterPositionSection(position); final Section sectionObject = mSections.get(section); final int sectionPosition = position - sectionObject.position; return getItemViewInternalType(section, sectionPosition); } private int getItemViewInternalType(int section, int position) { return position == 0 ? TYPE_HEADER : TYPE_ITEM; } static private int internalViewType(int type) { return type & 0xFF; } static private int externalViewType(int type) { return type >> 8; } @Override final public int getItemCount() { if (mSections == null) { calculateSections(); } return mTotalItemNumber; } @Override final public RecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { final int internalType = internalViewType(viewType); final int externalType = externalViewType(viewType); View view = null; switch (internalType) { case TYPE_HEADER: view = LayoutInflater.from(parent.getContext()).inflate(getHeadLayoutResId(), parent, false); // return onCreateHeaderViewHolder(parent, externalType); break; case TYPE_ITEM: view = LayoutInflater.from(parent.getContext()).inflate(getItemLayoutResId(), parent, false); // return onCreateItemViewHolder(parent, externalType); break; // default: // throw new InvalidParameterException("Invalid viewType: " + viewType); } return new RecyclerViewHolder(view, mListener); } @Override final public void onBindViewHolder(final RecyclerViewHolder holder, int position) { if (mSections == null) { calculateSections(); } final int section = mSectionIndices[position]; final int internalType = internalViewType(holder.getItemViewType()); final int externalType = externalViewType(holder.getItemViewType()); final int offset = getItemSectionOffset(section, position); if (onHeadClick != null) { holder.getView().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (internalType == TYPE_HEADER) { onHeadClick.setOnHeadClick(holder.getView(), section); } else { onHeadClick.setOnItemClick(holder.getView(), section, offset); } } }); } switch (internalType) { case TYPE_HEADER: onBindHeaderViewHolder(holder, section); break; case TYPE_ITEM: final RecyclerViewHolder itemHolder = holder; onBindItemViewHolder(holder, section, offset); break; default: throw new InvalidParameterException("invalid viewType: " + internalType); } } @Override final public int getItemViewType(int position) { final int section = getAdapterPositionSection(position); final Section sectionObject = mSections.get(section); final int sectionPosition = position - sectionObject.position; final int internalType = getItemViewInternalType(section, sectionPosition); int externalType = 0; switch (internalType) { case TYPE_HEADER: externalType = getSectionHeaderViewType(section); break; case TYPE_ITEM: externalType = getSectionItemViewType(section, sectionPosition - 1); break; } return ((externalType & 0xFF) << 8) | (internalType & 0xFF); } // Helpers private int getItemSectionHeaderPosition(int position) { return getSectionHeaderPosition(getAdapterPositionSection(position)); } private int getAdapterPosition(int section, int offset) { if (mSections == null) { calculateSections(); } if (section < 0) { throw new IndexOutOfBoundsException("section " + section + " < 0"); } if (section >= mSections.size()) { throw new IndexOutOfBoundsException("section " + section + " >=" + mSections.size()); } final Section sectionObject = mSections.get(section); return sectionObject.position + offset; } /** * Given a <code>section</code> and an adapter <code>position</code> get the offset of an item * inside <code>section</code>. * * @param section section to query * @param position adapter position * @return The item offset inside the section. */ public int getItemSectionOffset(int section, int position) { if (mSections == null) { calculateSections(); } if (section < 0) { throw new IndexOutOfBoundsException("section " + section + " < 0"); } if (section >= mSections.size()) { throw new IndexOutOfBoundsException("section " + section + " >=" + mSections.size()); } final Section sectionObject = mSections.get(section); final int localPosition = position - sectionObject.position; if (localPosition >= sectionObject.length) { throw new IndexOutOfBoundsException("localPosition: " + localPosition + " >=" + sectionObject.length); } return localPosition - 1; } /** * Returns the section index having item or header with provided * provider <code>position</code>. * * @param position adapter position * @return The section containing provided adapter position. */ public int getAdapterPositionSection(int position) { if (mSections == null) { calculateSections(); } if (getItemCount() == 0) { return NO_POSITION; } if (position < 0) { throw new IndexOutOfBoundsException("position " + position + " < 0"); } if (position >= getItemCount()) { throw new IndexOutOfBoundsException("position " + position + " >=" + getItemCount()); } return mSectionIndices[position]; } /** * Returns the adapter position for given <code>section</code> header. Use * this only for {@link RecyclerView#scrollToPosition(int)} or similar functions. * Never directly manipulate adapter items using this position. * * @param section section to query * @return The adapter position. */ public int getSectionHeaderPosition(int section) { return getAdapterPosition(section, 0); } /** * Returns the adapter position for given <code>section</code> and * <code>offset</code>. Use this only for {@link RecyclerView#scrollToPosition(int)} * or similar functions. Never directly manipulate adapter items using this position. * * @param section section to query * @param position item position inside the <code>section</code> * @return The adapter position. */ public int getSectionItemPosition(int section, int position) { return getAdapterPosition(section, position + 1); } /** * Returns the total number of sections in the data set held by the adapter. * * @return The total number of section in this adapter. */ public int getSectionCount() { return 0; } /** * Returns the number of items in the <code>section</code>. * * @param section section to query * @return The total number of items in the <code>section</code>. */ public int getSectionItemCount(int section) { return 0; } /** * Return the view type of the <code>section</code> header for the purposes * of view recycling. * * <p>The default implementation of this method returns 0, making the assumption of * a single view type for the headers. Unlike ListView adapters, types need not * be contiguous. Consider using id resources to uniquely identify item view types. * * @param section section to query * @return integer value identifying the type of the view needed to represent the header in * <code>section</code>. Type codes need not be contiguous. */ public int getSectionHeaderViewType(int section) { return 0; } /** * Return the view type of the item at <code>position</code> in <code>section</code> for * the purposes of view recycling. * * <p>The default implementation of this method returns 0, making the assumption of * a single view type for the adapter. Unlike ListView adapters, types need not * be contiguous. Consider using id resources to uniquely identify item view types. * * @param section section to query * @param offset section position to query * @return integer value identifying the type of the view needed to represent the item at * <code>position</code> in <code>section</code>. Type codes need not be * contiguous. */ public int getSectionItemViewType(int section, int offset) { return 0; } /** * Returns true if header in <code>section</code> is sticky. * * @param section section to query * @return true if <code>section</code> header is sticky. */ public boolean isSectionHeaderSticky(int section) { return true; } // public abstract RecyclerViewHolder onCreateHeaderViewHolder(ViewGroup parent, int headerType); // public abstract RecyclerViewHolder onCreateItemViewHolder(ViewGroup parent, int itemType); public abstract int getHeadLayoutResId(); public abstract int getItemLayoutResId(); public abstract void onBindHeaderViewHolder(RecyclerViewHolder holder, int section); public abstract void onBindItemViewHolder(RecyclerViewHolder holder, int section, int offset); /** * Notify any registered observers that the data set has changed. * * <p>There are two different classes of data change events, item changes and structural * changes. Item changes are when a single item has its data updated but no positional * changes have occurred. Structural changes are when items are inserted, removed or moved * within the data set.</p> * * <p>This event does not specify what about the data set has changed, forcing * any observers to assume that all existing items and structure may no longer be valid. * LayoutManagers will be forced to fully rebind and relayout all visible views.</p> * * <p><code>RecyclerView</code> will attempt to synthesize visible structural change events * for adapters that report that they have {@link #hasStableIds() stable IDs} when * this method is used. This can help for the purposes of animation and visual * object persistence but individual item views will still need to be rebound * and relaid out.</p> * * <p>If you are writing an adapter it will always be more efficient to use the more * specific change events if you can. Rely on <code>notifyDataSetChanged()</code> * as a last resort.</p> * * @see #notifySectionDataSetChanged(int) * @see #notifySectionHeaderChanged(int) * @see #notifySectionItemChanged(int, int) * @see #notifySectionInserted(int) * @see #notifySectionItemInserted(int, int) * @see #notifySectionItemRangeInserted(int, int, int) * @see #notifySectionRemoved(int) * @see #notifySectionItemRemoved(int, int) * @see #notifySectionItemRangeRemoved(int, int, int) */ public void notifyAllSectionsDataSetChanged() { calculateSections(); notifyDataSetChanged(); } public void notifySectionDataSetChanged(int section) { calculateSections(); if (mSections == null) { notifyAllSectionsDataSetChanged(); } else { final Section sectionObject = mSections.get(section); notifyItemRangeChanged(sectionObject.position, sectionObject.length); } } public void notifySectionHeaderChanged(int section) { calculateSections(); if (mSections == null) { notifyAllSectionsDataSetChanged(); } else { final Section sectionObject = mSections.get(section); notifyItemRangeChanged(sectionObject.position, 1); } } public void notifySectionItemChanged(int section, int position) { calculateSections(); if (mSections == null) { notifyAllSectionsDataSetChanged(); } else { final Section sectionObject = mSections.get(section); if (position >= sectionObject.itemNumber) { throw new IndexOutOfBoundsException("Invalid index " + position + ", size is " + sectionObject.itemNumber); } notifyItemChanged(sectionObject.position + position + 1); } } public void notifySectionInserted(int section) { calculateSections(); if (mSections == null) { notifyAllSectionsDataSetChanged(); } else { final Section sectionObject = mSections.get(section); notifyItemRangeInserted(sectionObject.position, sectionObject.length); } } public void notifySectionItemInserted(int section, int position) { calculateSections(); if (mSections == null) { notifyAllSectionsDataSetChanged(); } else { final Section sectionObject = mSections.get(section); if (position < 0 || position >= sectionObject.itemNumber) { throw new IndexOutOfBoundsException("Invalid index " + position + ", size is " + sectionObject.itemNumber); } notifyItemInserted(sectionObject.position + position + 1); } } public void notifySectionItemRangeInserted(int section, int position, int count) { calculateSections(); if (mSections == null) { notifyAllSectionsDataSetChanged(); } else { final Section sectionObject = mSections.get(section); if (position < 0 || position >= sectionObject.itemNumber) { throw new IndexOutOfBoundsException("Invalid index " + position + ", size is " + sectionObject.itemNumber); } if (position + count > sectionObject.itemNumber) { throw new IndexOutOfBoundsException("Invalid index " + (position + count) + ", size is " + sectionObject.itemNumber); } notifyItemRangeInserted(sectionObject.position + position + 1, count); } } public void notifySectionRemoved(int section) { if (mSections == null) { calculateSections(); notifyAllSectionsDataSetChanged(); } else { final Section sectionObject = mSections.get(section); calculateSections(); notifyItemRangeRemoved(sectionObject.position, sectionObject.length); } } public void notifySectionItemRemoved(int section, int position) { if (mSections == null) { calculateSections(); notifyAllSectionsDataSetChanged(); } else { final Section sectionObject = mSections.get(section); if (position < 0 || position >= sectionObject.itemNumber) { throw new IndexOutOfBoundsException("Invalid index " + position + ", size is " + sectionObject.itemNumber); } calculateSections(); notifyItemRemoved(sectionObject.position + position + 1); } } public void notifySectionItemRangeRemoved(int section, int position, int count) { if (mSections == null) { calculateSections(); notifyAllSectionsDataSetChanged(); } else { final Section sectionObject = mSections.get(section); if (position < 0 || position >= sectionObject.itemNumber) { throw new IndexOutOfBoundsException("Invalid index " + position + ", size is " + sectionObject.itemNumber); } if (position + count > sectionObject.itemNumber) { throw new IndexOutOfBoundsException("Invalid index " + (position + count) + ", size is " + sectionObject.itemNumber); } calculateSections(); notifyItemRangeRemoved(sectionObject.position + position + 1, count); } } }
4755e1d34f07cfc0e761c2340c0e8c416614f541
d2cb1f4f186238ed3075c2748552e9325763a1cb
/methods_all/nonstatic_methods/java_awt_event_WindowAdapter_getClass.java
453211c1221f2fd7e60a8bab03614a44424cceb9
[]
no_license
Adabot1/data
9e5c64021261bf181b51b4141aab2e2877b9054a
352b77eaebd8efdb4d343b642c71cdbfec35054e
refs/heads/master
2020-05-16T14:22:19.491115
2019-05-25T04:35:00
2019-05-25T04:35:00
183,001,929
4
0
null
null
null
null
UTF-8
Java
false
false
163
java
class java_awt_event_WindowAdapter_getClass{ public static void function() {java.awt.event.WindowAdapter obj = new java.awt.event.WindowAdapter();obj.getClass();}}
eef9ce9e452201582498f758b9a9b09709acffbf
1ee7ac1ace3df80a7a9b3679e46df8c00a834fbc
/algo/수업/P156_StackTest.java
2c1571c498768783509702ee55ec0a458779b511
[]
no_license
kl445/algo
421d1e72d62478e691fb4fe65205a210866aafaa
73857ac8a24b00a376f042cda6439280f367d169
refs/heads/master
2022-12-03T08:54:37.223080
2020-06-08T12:31:46
2020-06-08T12:31:46
280,017,799
0
0
null
null
null
null
UTF-8
Java
false
false
516
java
package algo_day4; import java.util.Stack; public class P156_StackTest { public static void main(String[] args) { Stack<Integer> stack = new Stack<>(); stack.push(100); stack.push(200); System.out.println(stack.peek()+" : "+stack.size()); System.out.println(stack.pop()+" : "+stack.size()); System.out.println(stack.pop()+" : "+stack.size()); if(!stack.isEmpty()) { System.out.println(stack.pop()+" : "+stack.size()); } else { System.out.println("비어있음"); } } }