blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
0c617040020712f00959ecffd93a4c5a17cddb8b
0ab870454cd57173e853934f42eaa6358f076569
/src/test/java/http/common/HttpEntityTest.java
9ae27701dcb11945929f6dca3944bc496de69f59
[]
no_license
ninjasul/jwp-was
a7127db36a84cd794e6322d8663adf2d99c18047
024dd2fc31c33eae5a951f19c9a731712a4ca8d8
refs/heads/master
2022-11-08T06:32:42.521841
2020-06-09T14:58:03
2020-06-09T14:58:03
268,470,012
0
0
null
2020-06-01T08:46:53
2020-06-01T08:46:53
null
UTF-8
Java
false
false
1,342
java
package http.common; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.NullAndEmptySource; import org.junit.jupiter.params.provider.ValueSource; import java.util.Collections; import static org.assertj.core.api.Assertions.assertThat; class HttpEntityTest { @ParameterizedTest @NullAndEmptySource void getBodyForNullAndEmpty(String body) { HttpEntity httpEntity = new HttpEntity(new HttpHeaders(Collections.emptyMap()), body); assertThat(httpEntity.getBody()).isNullOrEmpty(); assertThat(httpEntity.getBodyMap()).isEmpty(); } @Test void getBody() { String body = "userId=ninjasul&password=1234&name=%EB%B0%95%EB%8F%99%EC%97%BD&email=ninjasul%40gmail.com"; HttpEntity httpEntity = new HttpEntity(new HttpHeaders(Collections.emptyMap()), body); assertThat(httpEntity.getBody()).isNotEmpty(); assertThat(httpEntity.getBodyMap()).isNotEmpty(); assertThat(httpEntity.getBodyMap().get("userId")).isEqualTo("ninjasul"); assertThat(httpEntity.getBodyMap().get("password")).isEqualTo("1234"); assertThat(httpEntity.getBodyMap().get("name")).isEqualTo("박동엽"); assertThat(httpEntity.getBodyMap().get("email")).isEqualTo("[email protected]"); } }
1a6096909ac94c23ce81ed4e92583709d5b1776e
6975dc181e426f86c6fdb477f40ff5985b240bb2
/repos/PQ7/Alpha/ClientSide/ClientFile.java
a4c48aa529cc4ca935e7efffa786895da990bc8e
[]
no_license
thetruth2451/DiplomaSoftware-
d69eb2d58742a8f17a2a08f29453bc5a9cabc8c2
0df7c5a71d9b6029faacfb4c9f8ce95b82947b57
refs/heads/main
2023-05-25T15:03:50.253126
2021-06-20T11:52:47
2021-06-20T11:52:47
375,743,923
0
0
null
null
null
null
UTF-8
Java
false
false
580
java
package ClientSide; import javax.swing.*; import java.io.File; public class ClientFile { public String getPath() { //Select file JFileChooser fileChoser = new JFileChooser("."); File file; fileChoser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); JOptionPane.showMessageDialog(null,"PLEASE SELECT A SAVE LOCATION"); //Get file path from user int result = fileChoser.showOpenDialog(null); file = fileChoser.getSelectedFile(); String path = file.getPath(); return path; } }
514c5d1275fede9674efdf15f5c0ea4c0fd2f694
321159f229edbf5d6c015ddeba22ae48ca98aaac
/src/day29_Wrapper_ArrayList/List_Intro.java
38df37b6c07293da389ad02da9c98a65bb71bc66
[]
no_license
store13/JavaB18
6a9f5ef0bfeba04df727bb69a95bae10aae874aa
e8a53f7fe6fff6c6b6c5d7b6d14cd1b597341e40
refs/heads/master
2022-08-04T20:11:23.174753
2020-05-15T20:34:01
2020-05-15T20:34:01
259,387,153
0
0
null
null
null
null
UTF-8
Java
false
false
1,576
java
package day29_Wrapper_ArrayList; import java.util.ArrayList; public class List_Intro { /* ArrayList : part of Collection does not support primitives, only support none primitives size is dynamic, automatically adjusted has index numbers int [] arr = {1,2,3,4,5} ArrayList <DataType> listName = new ArrayList<DataType> (); methods: add(): adds Objects to the arrayList get(index): gets the object at the given index, returns the Object as it is. size() : returns the length (size) of the arrayList as an int */ public static void main(String[] args) { // ArrayList <DataType> listName = new ArrayList<DataType> (); // Mandatory Optional ArrayList<Integer> scores = new ArrayList<>(); // add 5 elements, size:5 // remove 2 elements, size = 3; scores.add(10); // Autoboxing size :1 scores.add(20); // Autoboxing size :2 scores.add(30); // Autoboxing size :3 System.out.println(scores); Integer a1 = scores.get(2); // none int a2 = scores.get(2); // unboxing double a3 = scores.get(2); // unboxing System.out.println(a1); System.out.println(a3); // System.out.println(scores.get(100)); // Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 100, Size: 3 } }
25daa29015cfa5194fea21c4b5d912528019dd45
6c18e9f37e8e78f420405bcbee1463ae472ae75c
/ShootingGame/src/shootinggame/Framework/GameViewThread.java
37a8b701952febf1e582509b02ff7e491d4e5d01
[]
no_license
nkj06/Portfolio
5c675594550c49723634c05bf48ba378ed505861
49bf48d592184fab66c712bbddf5f481586704eb
refs/heads/master
2022-12-10T14:04:23.482612
2020-09-10T02:53:08
2020-09-10T02:53:08
291,646,485
0
0
null
null
null
null
UTF-8
Java
false
false
969
java
package shootinggame.Framework; import android.graphics.Canvas; import android.view.SurfaceHolder; public class GameViewThread extends Thread { private SurfaceHolder _surfaceHolder; private GameView _gameview; private boolean _run = false; public GameViewThread(SurfaceHolder surfaceHolder, GameView gameview) { _surfaceHolder = surfaceHolder; _gameview = gameview; } public void setRunning(boolean run) { _run = run; } @Override public void run() { Canvas c; while (_run) { _gameview.Update(); c = null; try { c = _surfaceHolder.lockCanvas(null); synchronized (_surfaceHolder) { _gameview.onDraw(c); } } finally { if (c != null) { _surfaceHolder.unlockCanvasAndPost(c); } } } } }
dad817bd27ff5d4b5b34797b7daf2633f7ae2581
982c60da9963a7326084ec40281bb53acb9ebd25
/src/main/java/com/test/service/OrderService.java
8cb11d14dd2030a4b535432e74f3efb4cee97663
[]
no_license
khizersh/ecommerce1
dbe84c249b7c215dc5b1ae9ef8483f072db76311
895df4570a8643a079359789ab1a6dba17b94aeb
refs/heads/main
2023-08-10T23:54:15.695115
2021-09-11T15:24:16
2021-09-11T15:24:16
347,399,709
0
0
null
null
null
null
UTF-8
Java
false
false
2,706
java
package com.test.service; import com.test.bean.User; import com.test.bean.checkout.Checkout; import com.test.bean.checkout.CheckoutDetail; import com.test.bean.order.Order; import com.test.bean.order.OrderResponse; import com.test.repo.CheckoutRepo; import com.test.repo.OrderRepo; import com.test.repo.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service public class OrderService { @Autowired private OrderRepo orderRepo; @Autowired private CheckoutRepo checkoutRepo; @Autowired private UserRepository userRepo; public OrderResponse convertDto(Order order){ OrderResponse rep = new OrderResponse(); Checkout check = checkoutRepo.getOne(order.getCheckoutId()); if(order.getOrderDate() != null){ rep.setOrderDate(order.getOrderDate()); } rep.setOrderStatus(order.getOrderStatus()); rep.setShipStatus(order.getShipStatus()); rep.setOrderId(order.getId()); rep.setCheckoutId(check.getId()); rep.setFullName(order.getFullName()); rep.setEmail(order.getEmail()); rep.setPhoneNo(order.getPhoneNo()); rep.setCountry(order.getCountry()); rep.setState(order.getState()); rep.setCity(order.getCity()); rep.setUserId(order.getUserId()); rep.setAddressLine1(order.getAddressLine1()); rep.setAddressLine2(order.getAddressLine2()); rep.setPostalCode(order.getPostalCode()); rep.setTotalAmount(check.getTotalAmount()); rep.setCouponAmount(check.getCouponAmount()); rep.setNetAmount(check.getNetAmount()); return rep; } public List<OrderResponse> setDtoList(List<Order> list){ List<OrderResponse> responseList = new ArrayList<>(); for (Order order : list) { responseList.add(convertDto(order)); } return responseList; } public List<OrderResponse> getOrderByUserId(Long id){ List<Order> orderList = orderRepo.findByUserId(id); List<OrderResponse> responseList = setDtoList(orderList); return responseList; } public List<OrderResponse> getAllOrder(){ List<Order> orderList = orderRepo.findByOrderByIdDesc(); List<OrderResponse> responseList = setDtoList(orderList); return responseList; } public List<CheckoutDetail> getOrderDetailByCheckoutId(int id){ Checkout check = checkoutRepo.getOne(id); List<CheckoutDetail> list = new ArrayList<>(); list = check.getProductList(); return list; } }
437c788043070b122df9c5b9de6900dccf4a16dd
e960174b37c587e6419375a91350fcf03340ef6f
/src/Models/Hotel.java
61a966668366c2ef11f517b8b8c43d156a83faad
[]
no_license
ijiki16/BookInGeorgia
427740e4d994de398c50c5fb985ed9316936939e
914818b880ac0bf27b06a359aa859581ed715f23
refs/heads/master
2022-05-02T23:56:04.097079
2022-04-13T11:22:58
2022-04-13T11:22:58
189,862,570
4
0
null
null
null
null
UTF-8
Java
false
false
2,970
java
package Models; import java.util.ArrayList; import java.util.List; import DataBases.HotelsDB; public class Hotel { /** * Creates new Hotel Object * @param hotel_name * @param hotel_rating/stars * @param hotel_image * @param hotel_status * @param hotel_contact_number * @param hotel_owner_id */ private String name, img, status, number; private Integer rating, account_id, hotel_id; private Facilities facilities; private List<Room> rooms; private Location location; public Hotel(String name, Integer rating, String img, String status, String number, Integer account_id, Integer hotel_id) { setName(name); setRating(rating); setImage(img); setStatus(status); setNumber(number); setAccountId(account_id); setId(hotel_id); rooms = new ArrayList<Room>(); } /** * @return name of the Hotel. */ public String getName() { return name; } /** * Updates name of the Hotel. * @param */ public void setName(String name) { this.name = name; } /** * @return rating of the Hotel. */ public Integer getRating() { return rating; } /** * Updates rating of the Hotel. * @param */ public void setRating(Integer rating) { this.rating = rating; } /** * @return image of the Hotel. */ public String getImage() { return img; } /** * Updates image of the Hotel. * @param */ public void setImage(String img) { this.img = img; } /** * @return status of the Hotel. */ public String getStatus() { return status; } /** * Updates status of the Hotel. * @param */ public void setStatus(String status) { this.status = status; } /** * @return phone number of Hotel. */ public String getNumber() { return number; } /** * Updates phone number of Hotel. * @param */ public void setNumber(String number) { this.number = number; } /** * @return Hotel owner id. */ public Integer getAccountId() { return account_id; } /** * Updates id of the Hotel owner. * @param */ public void setAccountId(Integer account_id) { this.account_id = account_id; } /** * @return Hotel facilities. */ public Facilities getFacilities() { return facilities; } /** * Updates Hotel facilities. * @param */ public void setFacilities(Facilities facilities) { this.facilities = facilities; } /** * @return Hotel ID. */ public Integer getId() { return hotel_id; } /** * Updates Hotel ID. * @param */ public void setId(Integer hotel_id) { this.hotel_id = hotel_id; } /** * @return Hotel rooms. */ public List<Room> getRooms() { return rooms; } /** * Updates Hotel rooms. * @param */ public void setRooms(List<Room> rooms) { this.rooms = rooms; } /** * @return Hotel location. */ public Location getLocation() { return location; } /** * Updates Hotel location. * @param */ public void setLocation(Location location) { this.location = location; } }
20ed17d000b27a331325a0c01179ceb339a539db
568f672cf0c80138e18254a54ca0d2a0c1b1280b
/src/test/java/com/omwan/portfolio/service/ProjectServiceImplTest.java
ed782653cd87fa36311ee3b00218c9de16605ac4
[]
no_license
omwan/portfolio
0214ad07c0bf875137ee6ceea7b2341e09be92dd
108e7a8118a7c629cc39f6ff9d27161e13e72570
refs/heads/master
2021-01-01T06:24:57.234925
2017-09-05T21:13:22
2017-09-05T21:13:22
97,424,426
0
0
null
null
null
null
UTF-8
Java
false
false
7,629
java
package com.omwan.portfolio.service; import com.omwan.portfolio.component.ProjectComponent; import com.omwan.portfolio.domain.ProjectCategory; import com.omwan.portfolio.domain.ProjectDTO; import com.omwan.portfolio.mongo.document.Project; import com.omwan.portfolio.util.ProjectUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import mockit.Expectations; import mockit.Injectable; import mockit.Mock; import mockit.MockUp; import mockit.Tested; import mockit.integration.junit4.JMockit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** * Class to test methods from service to retrieve project data from mongo. * * Created by olivi on 07/17/2017. */ @RunWith(JMockit.class) public class ProjectServiceImplTest { @Tested private ProjectService projectService; @Injectable private ProjectComponent projectComponent; @Before public void setup() throws Exception { projectService = new ProjectServiceImpl(); } /** * Asserts that service to get all projects returns a mapping of all projects * from component. */ @Test public void testGetProjects() throws Exception { final String category1 = "category1"; final String category2 = "category2"; final List<Project> projects = new ArrayList<>(); projects.addAll(createMockedProjects(2, category1)); projects.addAll(createMockedProjects(2, category2)); new Expectations() {{ projectComponent.getAllProjects(); returns(projects); }}; Map<String, List<ProjectDTO>> actual = projectService.getProjects(false); assertTrue(actual.keySet().contains(category1)); assertTrue(actual.keySet().contains(category2)); List<ProjectDTO> projectsForCategory1 = actual.get(category1); for (int i = 0; i < projectsForCategory1.size(); i++) { ProjectDTO project = projectsForCategory1.get(i); assertEquals(project.getTitle(), projects.get(i).getTitle()); assertEquals(project.getCategory(), category1); assertEquals(project.getDescription(), projects.get(i).getDescription()); } List<ProjectDTO> projectsForCategory2 = actual.get(category2); for (int i = 0; i < projectsForCategory2.size(); i++) { ProjectDTO project = projectsForCategory2.get(i); assertEquals(project.getTitle(), projects.get(i + projectsForCategory1.size()).getTitle()); assertEquals(project.getCategory(), category2); assertEquals(project.getDescription(), projects.get(i + projectsForCategory1.size()).getDescription()); } } /** * Asserts that projects are sorted by descending endDate, and if a project has a null endDate * it comes before any projects that have an endDate, since null endDate is interpreted as * an ongoing project. */ @Test public void testGetProjectsSorted() throws Exception { final String category = "category"; final Project newProject = new Project("new project", category, "desc"); final Project oldProject = new Project("old project", category, "desc"); final Project presentProject = new Project("present project", category, "desc"); oldProject.setEndDate(new Date(0)); newProject.setEndDate(new Date(100)); final List<Project> projects = Arrays.asList(oldProject, newProject, presentProject); new Expectations() {{ projectComponent.getAllProjects(); returns(projects); }}; Map<String, List<ProjectDTO>> actual = projectService.getProjects(false); assertTrue(actual.keySet().contains(category)); List<ProjectDTO> projectsForCategory = actual.get(category); assertEquals(projects.size(), projectsForCategory.size()); assertEquals(presentProject.getTitle(), projectsForCategory.get(0).getTitle()); assertTrue(newProject.getEndDate().after(oldProject.getEndDate())); assertEquals(newProject.getTitle(), projectsForCategory.get(1).getTitle()); assertEquals(oldProject.getTitle(), projectsForCategory.get(2).getTitle()); } /** * Asserts that service to get projects for a category returns a list of projects * from component. */ @Test public void testGetProjectsForCategory() throws Exception { final String category = "category"; final List<Project> projectsForCategory = createMockedProjects(2, category); new Expectations() {{ projectComponent.getProjectsForCategory(category); returns(projectsForCategory); }}; List<ProjectDTO> actual = projectService.getProjectsForCategory(category, false); for (int i = 0; i < actual.size(); i++) { ProjectDTO project = actual.get(i); assertEquals(project.getTitle(), projectsForCategory.get(i).getTitle()); assertEquals(project.getCategory(), category); assertEquals(project.getDescription(), projectsForCategory.get(i).getDescription()); } } @Test public void testGetDeletedProjectsForCategory() throws Exception { final String category = "category1"; final List<Project> deletedProjects = createMockedProjects(2, category).stream() .map(project -> { project.setDeleted(true); return project; }).collect(Collectors.toList()); new Expectations() {{ projectComponent.getDeletedProjectsForCategory(category); returns(deletedProjects); }}; List<ProjectDTO> actual = projectService.getDeletedProjectsForCategory(category); for (ProjectDTO projectDTO : actual) { assertTrue(projectDTO.isDeleted()); } } /** * Asserts that the service to save a project calls the appropriate component method * and returns the saved project. */ @Test public void testSaveProject() throws Exception { final ProjectDTO projectToSave = new ProjectDTO(); projectToSave.setTitle("project title"); projectToSave.setCategory(ProjectCategory.WORK.toString()); final Project projectAsDocument = ProjectUtils.convertFromDomain(projectToSave); mockConvertFromDomain(projectAsDocument); new Expectations() {{ projectComponent.saveProject(projectAsDocument); returns(projectAsDocument); }}; ProjectDTO actual = projectService.saveProject(projectToSave); assertEquals(actual.getTitle(), projectToSave.getTitle()); assertEquals(actual.getCategory(), projectToSave.getCategory()); } @Test public void testDeleteProject() throws Exception { final String id = "id"; Project deletedProject = new Project("title", "category", "description"); deletedProject.setDeleted(true); new Expectations() {{ projectComponent.updateProjectDeletedFlag(id, true); returns(deletedProject); }}; ProjectDTO actual = projectService.deleteProject(id); assertTrue(actual.isDeleted()); assertEquals(actual.getTitle(), deletedProject.getTitle()); assertEquals(actual.getCategory(), deletedProject.getCategory()); assertEquals(actual.getDescription(), deletedProject.getDescription()); } private List<Project> createMockedProjects(int numProjects, String category) { List<Project> projects = new ArrayList<>(); for (int i = 0; i < numProjects; i++) { projects.add(new Project("title" + i, category, "desc2" + i)); } return projects; } private MockUp<ProjectUtils> mockConvertFromDomain(Project document) { return new MockUp<ProjectUtils>() { @Mock Project convertFromDomain(ProjectDTO projectDTO) { return document; } }; } }
dba0097a2179b3f5f6fb4820905842165fd02825
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_df4aff02b89228266070e4c4a6ea39d9b9e3aa1a/TNTDM_Alpha/5_df4aff02b89228266070e4c4a6ea39d9b9e3aa1a_TNTDM_Alpha_t.java
e709b46f506800b8af83085f5e17b9c92c194c2c
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,112
java
package com.oresomecraft.maps.arcade.maps; import com.oresomecraft.maps.MapConfig; import com.oresomecraft.maps.arcade.ArcadeMap; import org.bukkit.*; import org.bukkit.event.*; import org.bukkit.inventory.*; import com.oresomecraft.OresomeBattles.api.*; @MapConfig public class TNTDM_Alpha extends ArcadeMap implements Listener { public TNTDM_Alpha() { super.initiate(this, name, fullName, creators, modes); disableDrops(new Material[]{Material.COOKED_BEEF}); setAllowPhysicalDamage(false); } // Map details String name = "tntdm_alpha"; String fullName = "TNTDM (Alpha)"; String creators = "zachoz "; Gamemode[] modes = {Gamemode.LMS}; public void readyFFASpawns() { FFASpawns.add(new Location(w, 0, 66, 0)); } public void applyInventory(final BattlePlayer p) { Inventory i = p.getInventory(); ItemStack TNT = new ItemStack(Material.TNT, 128); ItemStack STEAK = new ItemStack(Material.COOKED_BEEF, 3); i.setItem(0, TNT); i.setItem(1, STEAK); } }
458aa3f98f434ef8aefee1fb85b64cba6dde2c06
3cd4ab4008ad24163f739705da487a7e6115b78b
/src/main/java/datahandler/Handler.java
4416d105ebb8c9a53e4097741830e5b97900a937
[]
no_license
Kononcev/University
38b962bff220b4e02f2f3951a1427d6f0d56bbb7
705d12269eb2367bcfe4f9fa127b5d0a101b5932
refs/heads/master
2021-04-03T01:04:42.947008
2018-03-16T13:41:39
2018-03-16T13:41:39
125,073,803
0
0
null
null
null
null
UTF-8
Java
false
false
1,746
java
package datahandler; import constants.Constants; import dao.UniversityDAO; import dao.implementation.University; import model.Departments; import java.util.Map; public class Handler { private String response = "Sorry data base don't contain such department\n"; private UniversityDAO university; public String showDepartmentHead(Map<String, String> departmentHead){ for (Map.Entry<String, String> entry : departmentHead.entrySet()) { response = String.format("Head of %s department is %s\n", entry.getKey(),entry.getValue()); } return response; } public String showDepartmentSummary(Map<String, Integer> departmentSummary, Departments department){ response = String.format("%s department statistics:\n",department.getName()); for (Map.Entry<String, Integer> entry : departmentSummary.entrySet()) { response += String.format("\t%s - %d\n", entry.getKey(), entry.getValue()); } return response; } public String showDepartmentAverageSalary(Map<String, Double> departmentAverageSalary){ for (Map.Entry<String, Double> entry : departmentAverageSalary.entrySet()) { response = String.format("The average salary of %s department is %s$\n", entry.getKey(), Constants.DOUBLE_WITH_TWO_DIGITS.format(entry.getValue())); } return response; } public String showDepartmentEmployeeCount(Map<String, Integer> departmentEmployeeCount){ for (Map.Entry<String, Integer> entry : departmentEmployeeCount.entrySet()) { response = String.format("%s department has %d employee\n", entry.getKey(), entry.getValue()); } return response; } }
7a1beda7c1a86b4e41d235aaadf3d28830586df7
eb3eb4dfa40b4ed43c5052a4d933a9af0ae2c45b
/android/scanlibrary/src/main/jni/sdk/java/src/org/opencv/android/JavaCameraView.java
f16a72ead3180d12a22949394c811aa1e62edb45
[]
no_license
MichaelGardiner97/scannermodule
5b5d1eb3d9954d3ac065f3129c69ce91688eeab8
0ab5888b68530c9fc31774f2aad4bf03238bb1aa
refs/heads/master
2020-03-23T10:41:08.620546
2018-08-17T18:19:22
2018-08-17T18:19:22
141,440,729
0
0
null
null
null
null
UTF-8
Java
false
false
13,609
java
package com.reactlibrary.scanlibrary.src.main.jni.sdk.java.src.org.opencv.android; import java.util.List; import android.content.Context; import android.graphics.ImageFormat; import android.graphics.SurfaceTexture; import android.hardware.Camera; import android.hardware.Camera.PreviewCallback; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.ViewGroup.LayoutParams; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.core.Size; import com.reactlibrary.scanlibrary.src.main.jni.sdk.java.src.org.opencv.imgproc.Imgproc; /** * This class is an implementation of the Bridge View between OpenCV and Java Camera. * This class relays on the functionality available in base class and only implements * required functions: * connectCamera - opens Java camera and sets the PreviewCallback to be delivered. * disconnectCamera - closes the camera and stops preview. * When frame is delivered via callback from Camera - it processed via OpenCV to be * converted to RGBA32 and then passed to the external callback for modifications if required. */ public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallback { private static final int MAGIC_TEXTURE_ID = 10; private static final String TAG = "JavaCameraView"; private byte mBuffer[]; private Mat[] mFrameChain; private int mChainIdx = 0; private Thread mThread; private boolean mStopThread; protected Camera mCamera; protected JavaCameraFrame[] mCameraFrame; private SurfaceTexture mSurfaceTexture; public static class JavaCameraSizeAccessor implements ListItemAccessor { @Override public int getWidth(Object obj) { Camera.Size size = (Camera.Size) obj; return size.width; } @Override public int getHeight(Object obj) { Camera.Size size = (Camera.Size) obj; return size.height; } } public JavaCameraView(Context context, int cameraId) { super(context, cameraId); } public JavaCameraView(Context context, AttributeSet attrs) { super(context, attrs); } protected boolean initializeCamera(int width, int height) { Log.d(TAG, "Initialize java camera"); boolean result = true; synchronized (this) { mCamera = null; if (mCameraIndex == CAMERA_ID_ANY) { Log.d(TAG, "Trying to open camera with old open()"); try { mCamera = Camera.open(); } catch (Exception e){ Log.e(TAG, "Camera is not available (in use or does not exist): " + e.getLocalizedMessage()); } if(mCamera == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { boolean connected = false; for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) { Log.d(TAG, "Trying to open camera with new open(" + Integer.valueOf(camIdx) + ")"); try { mCamera = Camera.open(camIdx); connected = true; } catch (RuntimeException e) { Log.e(TAG, "Camera #" + camIdx + "failed to open: " + e.getLocalizedMessage()); } if (connected) break; } } } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { int localCameraIndex = mCameraIndex; if (mCameraIndex == CAMERA_ID_BACK) { Log.i(TAG, "Trying to open back camera"); Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) { Camera.getCameraInfo( camIdx, cameraInfo ); if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) { localCameraIndex = camIdx; break; } } } else if (mCameraIndex == CAMERA_ID_FRONT) { Log.i(TAG, "Trying to open front camera"); Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) { Camera.getCameraInfo( camIdx, cameraInfo ); if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { localCameraIndex = camIdx; break; } } } if (localCameraIndex == CAMERA_ID_BACK) { Log.e(TAG, "Back camera not found!"); } else if (localCameraIndex == CAMERA_ID_FRONT) { Log.e(TAG, "Front camera not found!"); } else { Log.d(TAG, "Trying to open camera with new open(" + Integer.valueOf(localCameraIndex) + ")"); try { mCamera = Camera.open(localCameraIndex); } catch (RuntimeException e) { Log.e(TAG, "Camera #" + localCameraIndex + "failed to open: " + e.getLocalizedMessage()); } } } } if (mCamera == null) return false; /* Now set camera parameters */ try { Camera.Parameters params = mCamera.getParameters(); Log.d(TAG, "getSupportedPreviewSizes()"); List<android.hardware.Camera.Size> sizes = params.getSupportedPreviewSizes(); if (sizes != null) { /* Select the size that fits surface considering maximum size allowed */ Size frameSize = calculateCameraFrameSize(sizes, new JavaCameraSizeAccessor(), width, height); params.setPreviewFormat(ImageFormat.NV21); Log.d(TAG, "Set preview size to " + Integer.valueOf((int)frameSize.width) + "x" + Integer.valueOf((int)frameSize.height)); params.setPreviewSize((int)frameSize.width, (int)frameSize.height); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && !android.os.Build.MODEL.equals("GT-I9100")) params.setRecordingHint(true); List<String> FocusModes = params.getSupportedFocusModes(); if (FocusModes != null && FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } mCamera.setParameters(params); params = mCamera.getParameters(); mFrameWidth = params.getPreviewSize().width; mFrameHeight = params.getPreviewSize().height; if ((getLayoutParams().width == LayoutParams.MATCH_PARENT) && (getLayoutParams().height == LayoutParams.MATCH_PARENT)) mScale = Math.min(((float)height)/mFrameHeight, ((float)width)/mFrameWidth); else mScale = 0; if (mFpsMeter != null) { mFpsMeter.setResolution(mFrameWidth, mFrameHeight); } int size = mFrameWidth * mFrameHeight; size = size * ImageFormat.getBitsPerPixel(params.getPreviewFormat()) / 8; mBuffer = new byte[size]; mCamera.addCallbackBuffer(mBuffer); mCamera.setPreviewCallbackWithBuffer(this); mFrameChain = new Mat[2]; mFrameChain[0] = new Mat(mFrameHeight + (mFrameHeight/2), mFrameWidth, CvType.CV_8UC1); mFrameChain[1] = new Mat(mFrameHeight + (mFrameHeight/2), mFrameWidth, CvType.CV_8UC1); AllocateCache(); mCameraFrame = new JavaCameraFrame[2]; mCameraFrame[0] = new JavaCameraFrame(mFrameChain[0], mFrameWidth, mFrameHeight); mCameraFrame[1] = new JavaCameraFrame(mFrameChain[1], mFrameWidth, mFrameHeight); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mSurfaceTexture = new SurfaceTexture(MAGIC_TEXTURE_ID); mCamera.setPreviewTexture(mSurfaceTexture); } else mCamera.setPreviewDisplay(null); /* Finally we are ready to start the preview */ Log.d(TAG, "startPreview"); mCamera.startPreview(); } else result = false; } catch (Exception e) { result = false; e.printStackTrace(); } } return result; } protected void releaseCamera() { synchronized (this) { if (mCamera != null) { mCamera.stopPreview(); mCamera.setPreviewCallback(null); mCamera.release(); } mCamera = null; if (mFrameChain != null) { mFrameChain[0].release(); mFrameChain[1].release(); } if (mCameraFrame != null) { mCameraFrame[0].release(); mCameraFrame[1].release(); } } } private boolean mCameraFrameReady = false; @Override protected boolean connectCamera(int width, int height) { /* 1. We need to instantiate camera * 2. We need to start thread which will be getting frames */ /* First step - initialize camera connection */ Log.d(TAG, "Connecting to camera"); if (!initializeCamera(width, height)) return false; mCameraFrameReady = false; /* now we can start update thread */ Log.d(TAG, "Starting processing thread"); mStopThread = false; mThread = new Thread(new CameraWorker()); mThread.start(); return true; } @Override protected void disconnectCamera() { /* 1. We need to stop thread which updating the frames * 2. Stop camera and release it */ Log.d(TAG, "Disconnecting from camera"); try { mStopThread = true; Log.d(TAG, "Notify thread"); synchronized (this) { this.notify(); } Log.d(TAG, "Wating for thread"); if (mThread != null) mThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } finally { mThread = null; } /* Now release camera */ releaseCamera(); mCameraFrameReady = false; } @Override public void onPreviewFrame(byte[] frame, Camera arg1) { Log.d(TAG, "Preview Frame received. Frame size: " + frame.length); synchronized (this) { mFrameChain[mChainIdx].put(0, 0, frame); mCameraFrameReady = true; this.notify(); } if (mCamera != null) mCamera.addCallbackBuffer(mBuffer); } private class JavaCameraFrame implements CvCameraViewFrame { @Override public Mat gray() { return mYuvFrameData.submat(0, mHeight, 0, mWidth); } @Override public Mat rgba() { Imgproc.cvtColor(mYuvFrameData, mRgba, Imgproc.COLOR_YUV2RGBA_NV21, 4); return mRgba; } public JavaCameraFrame(Mat Yuv420sp, int width, int height) { super(); mWidth = width; mHeight = height; mYuvFrameData = Yuv420sp; mRgba = new Mat(); } public void release() { mRgba.release(); } private Mat mYuvFrameData; private Mat mRgba; private int mWidth; private int mHeight; }; private class CameraWorker implements Runnable { @Override public void run() { do { boolean hasFrame = false; synchronized (JavaCameraView.this) { try { while (!mCameraFrameReady && !mStopThread) { JavaCameraView.this.wait(); } } catch (InterruptedException e) { e.printStackTrace(); } if (mCameraFrameReady) { mChainIdx = 1 - mChainIdx; mCameraFrameReady = false; hasFrame = true; } } if (!mStopThread && hasFrame) { if (!mFrameChain[1 - mChainIdx].empty()) deliverAndDrawFrame(mCameraFrame[1 - mChainIdx]); } } while (!mStopThread); Log.d(TAG, "Finish processing thread"); } } }
7ea440fca70602989009097180940981b859dec3
e3170f21bea849ca7436da5363381d0cf978b3af
/src/youzheng/algorithm/beakjoon/beakjoon1/beakjoon_4299.java
0b62f83e8cc6047e2f4dbe4f79d257227a11f6c3
[]
no_license
yangfriendship/algorithmJava
ac698d82a4ab09a5172cca4719cbe32c3b31ff2c
a0bda01ba4e5955262762c53d381ecea34ad4282
refs/heads/master
2023-06-14T23:22:29.436105
2021-07-15T07:46:11
2021-07-15T07:46:11
309,068,333
0
0
null
null
null
null
UTF-8
Java
false
false
699
java
package youzheng.algorithm.beakjoon.beakjoon1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class beakjoon_4299 { static int[] dp = new int[101]; static int cnt = 0; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int a= Integer.parseInt(st.nextToken()); int b= Integer.parseInt(st.nextToken()); if((a+b)%2!=0||a<b) { System.out.println(-1); return; } int x = (a+b)/2; int y = a-x; System.out.printf("%d %d",x,y); } }
0537be73aa030cdb7485be5f66f4b5b51b17b4f2
975604bcbf1e21a44048bf7e42272d527564f209
/DesignPatterns/src/com/bridgelabz/observer/ObserverExample.java
b39cd139969b7fc1d1fa0d1ef02bc23bc7c405e3
[]
no_license
AHETESHAMS/DesignPatternsJava
3aa53b17ef53d91ec10a71b49a48d5af8eba89a1
de5c1a51409ce0b99387b1335149d4d4d603b042
refs/heads/master
2020-07-27T10:12:19.293312
2019-09-17T13:12:27
2019-09-17T13:12:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
package com.bridgelabz.observer; public class ObserverExample { public static void main(String[] args) { Person akashPerson=new Person("Akash"); Person johnPerson=new Person("John"); Product samsungMobile=new Product("Samsung", "Mobile", "Not available"); //When you opt for option "Notify me when product is available".Below registerObserver method //get executed samsungMobile.registerObserver(akashPerson); samsungMobile.registerObserver(johnPerson); //Now product is available samsungMobile.setAvailability("Available"); } }
6c3dff6612a5ca7c7b320273bcf3b6051aaf9ec2
d662fe050655a012160c5c670044992dd62925ad
/src/main/java/com/djj/languagepoints/chapter2/LambdaExpression.java
6eef7f07cdb663b9c2ec97343d481f95b34a8d34
[]
no_license
ivydjj/java8-lambda
b5d858b125cd373f44b8ea9ed709400b164ab4ff
83945634813741aa82aeb338179141bdda2543f6
refs/heads/master
2020-03-31T21:21:37.802099
2018-10-21T10:03:55
2018-10-21T10:03:55
152,577,268
3
0
null
null
null
null
UTF-8
Java
false
false
5,556
java
package com.djj.languagepoints.chapter2; import java.awt.event.ActionListener; import java.util.HashMap; import java.util.Map; import java.util.function.BinaryOperator; import java.util.function.Predicate; /* 【Lambda表达式】 Lambda 表达式都是静态类型 Lambda 表达式是一个匿名方法,将行为像数据一样进行传递。 【正确使用Lambda表达式】 明确了要达成什么转化,而不是说明如何转化: 一方面,潜在的缺陷更少,更直接地表达了程序员的意图; 另一方面在于写出的函数没有副作用。这一点非常重要,这样只通过函数的返回值就能充分理解函数的全部作用。 将Lambda 表达式传给Stream 上的高阶函数,都应该尽量避免副作用。唯一的例外是forEach 方法,它是一个终结方法。 */ public class LambdaExpression { public static void main(String[] args) { /////////////////////////////////////// 参数:类型推断 // 所有Lambda 表达式中的参数类型都是由编译器推断得出的 // 将Lambda 表达式赋值给一个局部变量,或传递给一个方法作为参数, // 局部变量或方法参数的类型就是Lambda 表达式的目标类型 // 初始化数组时,数组的类型就是根据上下文推断出来的。 // 另一个常见的例子是null,只有将null赋值给一个变量,才能知道它的类型。 final String[] array = { "hello", "world" }; // 类型推断 // Java 7 中程序员可省略构造函数的泛型类型,Java 8 更进一步,程序员可省略Lambda 表达式中的所有参数类型。 // javac 根据Lambda 表达式上下文信息就能推断出参数的正确类型。 // 程序依然要经过类型检查来保证运行的安全性,但不用再显式声明类型罢了。这就是所谓的类型推断。 // 类型推断系统相当智能,但若信息不够,类型推断系统也无能为力。类型系统不会漫无边际地瞎猜,而会中止操作并报告编译错误,寻求帮助 // Java 7 中的菱形操作符(<>),它可使javac 推断出泛型参数的类型 // 变量oldWordCounts 明确指定了泛型的类型, // 而变量diamondWordCounts则使用了菱形操作符。不用明确声明泛型类型,编译器就可以自己推断出来 Map<String, Integer> oldWordCounts = new HashMap<String, Integer>(); Map<String, Integer> diamondWordCounts = new HashMap<>(); // java7不能编译通过,java8能行 useHashmap(new HashMap<>()); // eg. // 表达式 x > 5 是Lambda 表达式的主体。这样的情况下,返回值就是Lambda 表达式主体的值。 Predicate<Integer> atLeast5 = x -> x > 5; BinaryOperator<Long> addLongs = (x, y) -> x + y; /////////////////////////////////////// 参数:final // Lambda 表达式中引用的局部变量必须是final 或既成事实上的final 变量 String name = "finalName"; Runnable runnable1 = () -> System.out.println("final: " + name); // // 如果你试图给该变量多次赋值,然后在Lambda 表达式中引用它,编译器就会报错。 // // 显示出错信息:local variables referenced from a Lambda expression must be final or effectively final1。 // String name1 = "finalName"; // name1 = "changeName"; // Runnable runnable2 = () -> System.out.println("final: " + name1); // Lambda 表达式都是静态类型 // Lambda 表达式也被称为闭包:未赋值的变量与周边环境隔离起来,进而被绑定到一个特定的值 /////////////////////////////////////// 表达式 // Lambda 表达式不包含参数,使用空括号() 表示没有参数。该Lambda 表达式 // 实现了Runnable 接口,该接口也只有一个run 方法,没有参数,且返回类型为void Runnable noArguments = () -> System.out.println("Hello World"); // Lambda 表达式包含且只包含一个参数,可省略参数的括号 ActionListener oneArgument = event -> System.out.println("button clicked"); // Lambda 表达式的主体不仅可以是一个表达式,而且也可以是一段代码块,使用大括号({})将代码块括起来 // 该代码块和普通方法遵循的规则别无二致,可以用返回或抛出异常来退出。只有一行代码的Lambda 表达式也可使用大括号, // 用以明确Lambda表达式从何处开始、到哪里结束。 Runnable multiStatement = () -> { System.out.print("Hello"); System.out.println(" World"); }; // Lambda 表达式也可以表示包含多个参数的方法 // 这时就有必要思考怎样去阅读该Lambda 表达式。这行代码并不是将两个数字相加, // 而是创建了一个函数,用来计算两个数字相加的结果。 // 变量add 的类型是BinaryOperator<Long>,它不是两个数字的和,而是将两个数字相加的那行代码。 BinaryOperator<Long> add = (x, y) -> x + y; // 可以显式声明参数类型,此时就需要使用小括号将参数括起来,多个参数的情况也是如此 BinaryOperator<Long> addExplicit = (Long x, Long y) -> x + y; } private static void useHashmap(Map<String, String> values){ } }
4f3e9dc45d1b5ad55d6f266db90c95b0c45f2d71
4a9581c84a1284cf40b53689bbe28d72958789ea
/src/main/java/com/example/demo/module/user/service/UserService.java
497458de570ba7fdc21ac134d06b48739ecaee8f
[]
no_license
XiFanYin/houtai
4db775a231633ede88c833a68a843d6de138ae65
8ef13792e34642eef5613cf85ded175e40f8a6e8
refs/heads/master
2020-05-17T00:41:28.750675
2019-04-30T06:53:13
2019-04-30T06:53:13
183,402,216
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
package com.example.demo.module.user.service; import com.example.demo.module.user.entity.User; import java.util.List; public interface UserService { List<User> selectAllUserList(Integer page); Integer insert(User user); User selectByPrimaryKey(Long userId); }
3bb781e358fd2f4e8e85db59848df5d5039e4700
8c58dfa0106db58067f32363835b2e3b3eb672f1
/src/vml/KernelSettings.java
fc0864e2c74b84dfc74fac39783eb20b94c7f943
[]
no_license
jhagelback/VisualML
0ef53054b946024a910cc45cf63651ed7bb81361
654914d8689820eef0bbaa58748a15c6d78c0f1f
refs/heads/master
2021-09-20T10:52:11.025957
2018-08-08T09:48:53
2018-08-08T09:48:53
114,816,502
1
0
null
null
null
null
UTF-8
Java
false
false
824
java
package vml; /** * Contains settings for the RBF Kernel classifier. * * @author Johan Hagelbäck, Linnaeus University ([email protected]) */ public class KernelSettings { /** * Gamma value. */ public double gamma = 1.0; /** * Sets if data shall be normalized. */ public boolean use_normalization = false; /** * Sets lower and upper bounds for normalized values. */ public int[] normalization_bounds = new int[2]; /** * Sets if training dataset shall be shuffled or not. */ public boolean shuffle = true; /** * Creates default settings. */ public KernelSettings() { gamma = 1.0; use_normalization = false; normalization_bounds = new int[2]; shuffle = true; } }
12a1e310454f30134f6912ffa239546dd34fa6a9
5e4c8a3b784e2a21bba9ba817915d0b59ed0f48b
/src/main/java/br/com/alelo/consumer/consumerpat/business/impl/CardBusinessImpl.java
c4392168e98146d8e6dd2a34aee3f7968d4a3c70
[]
no_license
anaabia/consumer-pat
81d4d8df8b7aaa6a10d3c9bab4c48c1d0cf57ddf
dbdeedf16f65f7754519fab87d4bf41fe9c3c121
refs/heads/main
2023-08-04T04:20:44.725739
2021-09-20T03:10:45
2021-09-21T01:11:26
408,236,527
0
0
null
2021-09-19T21:04:41
2021-09-19T21:04:40
null
UTF-8
Java
false
false
2,471
java
package br.com.alelo.consumer.consumerpat.business.impl; import br.com.alelo.consumer.consumerpat.business.CardBusiness; import br.com.alelo.consumer.consumerpat.business.TransactionCardBusiness; import br.com.alelo.consumer.consumerpat.entity.Extract; import br.com.alelo.consumer.consumerpat.model.dto.DtoBuy; import br.com.alelo.consumer.consumerpat.model.dto.EstablishmentTypeEnum; import br.com.alelo.consumer.consumerpat.respository.CardRepository; import br.com.alelo.consumer.consumerpat.respository.ExtractRepository; import br.com.alelo.consumer.consumerpat.utils.exception.ProcessException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; import javax.persistence.EntityNotFoundException; import java.util.Date; @Service public class CardBusinessImpl implements CardBusiness { @Autowired private ApplicationContext applicationContext; @Autowired private CardRepository cardRepository; @Autowired private ExtractRepository extractRepository; private TransactionCardBusiness getTransactionCardBusiness(EstablishmentTypeEnum establishmentTypeEnum) { return applicationContext.getBean(establishmentTypeEnum.getClazz()); } public void setBalance(long cardNumber, double value) { var card = cardRepository.findByCardNumber(cardNumber) .orElseThrow(() -> new EntityNotFoundException("Card number not found")); card.setBalance(card.getBalance() + value); cardRepository.save(card); } public void buy(DtoBuy dtoBuy) throws ProcessException { var establishment = EstablishmentTypeEnum.getEstablishmentType(dtoBuy.getEstablishmentType()); TransactionCardBusiness transactionCardBusiness = getTransactionCardBusiness(establishment); var value = transactionCardBusiness.value(dtoBuy); var card = cardRepository.findByCardTypeAndCardNumber(establishment.getType(), dtoBuy.getCardNumber()) .orElseThrow(() -> new EntityNotFoundException("Card number not found")); if (value > card.getBalance()) { throw new ProcessException("Unauthorized transaction, insufficient funds"); } card.setBalance(card.getBalance() - value); cardRepository.save(card); Extract extract = new Extract(dtoBuy.getEstablishmentName(), dtoBuy.getProductDescription(), new Date(), dtoBuy.getCardNumber(), dtoBuy.getValue()); extractRepository.save(extract); } }
80a55779af28a933ab9bd4f2c315929b606d8543
c4fbbec76f28e694358018db62504e71ec54c234
/PrettyCool/PrettyCool12/app/src/main/java/com/example/user1/prettycool/Classes/Persons/GlobalInformation.java
f73ef9fa93fcb8690be28d16034f5748bf116833
[]
no_license
Kmortyk/PrettyCoolOld
ecda0ee1b3468c882fa11ddf680a4c592190fbdf
b8cad0821bc2de35f8580d1c0dfb7fff81ed1ddb
refs/heads/master
2022-12-09T09:58:01.849308
2020-08-26T12:34:40
2020-08-26T12:34:40
290,468,425
0
0
null
null
null
null
UTF-8
Java
false
false
607
java
package com.example.user1.prettycool.Classes.Persons; import java.util.ArrayList; import java.util.Map; /** * Created by user1 on 30.03.2016. */ public class GlobalInformation { public static String isLevel = "Area1"; public static String[] monstersId = {"Zmd","Zm"}; public static String[]itemId = {"B","Pb"}; public static String[]stepableId={"O","O1"}; public static String[]allLevels={"Area1","Area2","Area3"}; public static int heroId = 0; public static void setIsLevel(String isLevel) { GlobalInformation.isLevel = isLevel; } }
09e2b8e9d8a095aa02e9b274ca1fbcdd1dbe7152
49895910442a1562c5ec9ee4694f95a01d9db8e2
/src/Measure.java
d60101b0c5adf03718fd9b5d1d7175c9d90e6441
[]
no_license
kimdaehyuun/KTDS_Java
5a73d368667637cfc0a9f4b0150d5b947c3825df
bf4143845b1b23a25203826df9eea547a64b5456
refs/heads/main
2023-07-16T14:33:28.847303
2021-08-25T10:12:32
2021-08-25T10:12:32
399,746,434
0
0
null
null
null
null
UHC
Java
false
false
644
java
public class Measure { int a; int b; public int getA() { return a; } public void setA(int a) { int sumA = 0; // 자기자신을 제외한 약수의 합을 구한다 for (int i = 1; i < a; i++) { if (a % i == 0) { sumA += i; } } // a가 입력되면 a의 약수의 합을 리턴해준다. this.a = sumA; } public int getB() { return b; } public void setB(int b) { int sumB = 0; // 자기자신을 제외한 약수의 합을 구한다 for (int i = 1; i < a; i++) { if (b % i == 0) { sumB += i; } } // b가 입력되면 b의 약수의 합을 리턴해준다. this.b = sumB; } }
c1872a8a1c97c12668c7a7ca790af9c1632e237f
bf0325c6c2f28504ae3bf3f3bcd7f0e9f9ba3d40
/src/main/java/edu/epam/multithreading/entity/state/impl/ArriveState.java
0403ea9c158e45067bf6f71992bad8cf2cb54775
[]
no_license
alena20/Port
e34803f4d7984bb10ce69b79f4be5467cfc61140
03cd0ae6bbbec69135a0594508e92822ee0e7762
refs/heads/master
2023-07-07T13:22:04.638255
2021-01-23T21:28:15
2021-01-23T21:28:15
331,628,170
0
0
null
null
null
null
UTF-8
Java
false
false
1,576
java
package edu.epam.multithreading.entity.state.impl; import edu.epam.multithreading.entity.Port; import edu.epam.multithreading.entity.Ship; import edu.epam.multithreading.entity.state.AbstractState; import edu.epam.multithreading.exception.ResourceException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class ArriveState implements AbstractState { private static final Logger logger = LogManager.getLogger(ArriveState.class); private static final ArriveState INSTANCE = new ArriveState(); private static final Port PORT = Port.getInstance(); private ArriveState() { } public static ArriveState getInstance() { return INSTANCE; } @Override public void loadContainers(Ship ship) { logger.error("Unable to load containers in arriving state!"); } @Override public void unloadContainers(Ship ship) { logger.error("Unable to unload containers in arriving state!"); } @Override public void requestPier(Ship ship) { try { PORT.requestPier(ship); } catch (ResourceException e) { throw new RuntimeException("Unable to get pier!", e); } ship.setCurrentState(MooringState.getInstance()); } @Override public void leavePier(Ship ship) { logger.error("Invalid action, ship {} is in arriving state!", ship.getShipId()); } @Override public void moorToPier(Ship ship) { logger.error("Invalid action, ship {} is in arriving state!", ship.getShipId()); } }
8c98451bdc939b88d26dee5c325e9c96bf74df37
ae2f5ba05760cf1b72484ecc0e48a9f8145fec28
/src/ExceptionHandling.java
04e5847064932ef27a9abbb6a63a3714c9b021a8
[]
no_license
Frank-dev20/Java_tutorial
e89a7f673acd13420f5ceb6b7038d958ac15f64f
eb7b4c25c0b9ea885237605197e2b3f3dd4bbeec
refs/heads/main
2023-08-25T04:36:37.315342
2021-11-01T03:59:49
2021-11-01T03:59:49
376,407,220
0
0
null
null
null
null
UTF-8
Java
false
false
56
java
package PACKAGE_NAME;public class ExceptionHandling { }
1c0317156e7be128f71a4b990a2628cb5e61b04c
bbaf4c78f7ad7fd27fdbdce0a36374d3c85e1cb6
/DROGATURA/src/DAO/VendaDAOImpl.java
64929d3f4b6671e76c22ceedd8758efc4e9b795c
[]
no_license
LuizHBasilio/AcademiaJava
479e0b718d853747d7f1c5c51787a43f9278508d
67ddc0e2951e6a68dcb18830de9d89c56a0c1922
refs/heads/master
2023-04-15T05:17:48.901866
2021-04-20T00:32:48
2021-04-20T00:32:48
295,561,845
0
0
null
null
null
null
UTF-8
Java
false
false
3,425
java
package DAO; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import entidades.Venda; import util.JdbcUtil; public class VendaDAOImpl implements VendaDAO { @Override public void inserir(Venda venda) { String sql = "INSERT INTO VENDA(ID_CLIENTE, ID_FUNCIONARIO, ID_PRODUTO, FORMA_PAGAMENTO)" + "VALUES (?,?,?,?)"; Connection conexao = null; try { conexao = JdbcUtil.getConexao(); PreparedStatement ps = conexao.prepareStatement(sql); ps.setInt(1, venda.getId_cliente()); ps.setInt(2, venda.getId_funcionario()); ps.setInt(3, venda.getId_produto()); ps.setString(4, venda.getForma_pagamento()); ps.execute(); ps.close(); conexao.close(); } catch (Exception e) { e.printStackTrace(); } } @Override public List<Venda> listarVendas() { String sql = "SELECT * FROM VENDA"; List<Venda> listaVendas = new ArrayList<Venda>(); Connection conexao; try { conexao = JdbcUtil.getConexao(); PreparedStatement ps = conexao.prepareStatement(sql); ResultSet res = ps.executeQuery(); while (res.next()) { Venda venda = new Venda(); venda.setId_venda(res.getInt("ID_VENDA")); venda.setId_cliente(res.getInt("ID_CLIENTE")); venda.setId_funcionario(res.getInt("ID_FUNCIONARIO")); venda.setId_produto(res.getInt("ID_PRODUTO")); venda.setForma_pagamento(res.getString("FORMA_PAGAMENTO")); listaVendas.add(venda); } ps.close(); res.close(); } catch (Exception e) { e.printStackTrace(); } return listaVendas; } @Override public void alterar(Venda venda) { String sql = "UPDATE VENDA SET ID_CLIENTE = ?, ID_FUNCIONARIO = ?, ID_PRODUTO = ?, FORMA_PAGAMENTO = ? " + "WHERE ID_VENDA = ?"; Connection conexao; try { conexao = JdbcUtil.getConexao(); PreparedStatement ps = conexao.prepareStatement(sql); ps.setInt(2, venda.getId_funcionario()); ps.setInt(3, venda.getId_produto()); ps.setString(4, venda.getForma_pagamento()); ps.setInt(5, venda.getId_venda()); ps.execute(); conexao.close(); ps.close(); } catch (Exception e) { e.printStackTrace(); } } @Override public void remover(int id_venda) { String sql = "DELETE FROM TIPO WHERE ID_VENDA = ?"; Connection conexao; try { conexao = JdbcUtil.getConexao(); PreparedStatement ps = conexao.prepareStatement(sql); ps.setInt(1, id_venda); ps.execute(); ps.close(); conexao.close(); } catch (Exception e) { e.printStackTrace(); } } @Override public Venda pesquisar(int id_venda) { String sql = "SELECT * FROM TIPO WHERE ID_VENDA = ?"; Connection conexao; Venda venda = new Venda(); try { conexao = JdbcUtil.getConexao(); PreparedStatement ps = conexao.prepareStatement(sql); ps.setInt(1, id_venda); ResultSet res = ps.executeQuery(); if (res.next()) { venda.setId_venda(res.getInt("ID_VENDA")); venda.setId_cliente(res.getInt("ID_CLIENTE")); venda.setId_funcionario(res.getInt("ID_FUNCIONARIO")); venda.setId_produto(res.getInt("ID_PRODUTO")); venda.setForma_pagamento(res.getString("FORMA_PAGAMENTO")); } ps.close(); conexao.close(); } catch (Exception e) { e.printStackTrace(); } return venda; } }
715109255fa937f2f54f114917b3d76710122209
ee3c938c1b105516d8ec0a226a16c2e941e12ecf
/src/ralfherzog/pwman3/activities/passwordlist/PasswordListAdapter.java
a2b57e69fd52c9eda4ca99271a531e57daa3f301
[ "MIT" ]
permissive
RalfHerzog/pwman3
e6460cd0ebf8b1bbc4df5b0c759b40d1101998b0
47c928f9b470f9ccdefe6f074ff4fa61a411fc71
refs/heads/master
2021-01-20T09:32:48.330893
2014-04-10T21:40:44
2014-04-10T21:40:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,058
java
package ralfherzog.pwman3.activities.passwordlist; import java.util.ArrayList; import ralfherzog.pwman3.R; import ralfherzog.pwman3.activities.main.MainActivity; import ralfherzog.pwman3.core.PWManContentNode; import android.app.Activity; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; public class PasswordListAdapter extends BaseAdapter { private ArrayList<PWManContentNode> data; private LayoutInflater inflater; private ClipboardManager clipboard; public PasswordListAdapter( Activity activity ) { this.data = new ArrayList<PWManContentNode>(); this.inflater = (LayoutInflater) activity.getSystemService( Context.LAYOUT_INFLATER_SERVICE ); this.clipboard = (ClipboardManager) activity.getSystemService( Context.CLIPBOARD_SERVICE ); } public void update( ArrayList<PWManContentNode> data ) { this.data = data; this.notifyDataSetChanged(); } public int getCount() { return data.size(); } public PWManContentNode getItem( int position ) { return data.get( position ); } public long getItemId( int position ) { return position; } public View getView( final int position, View convertView, ViewGroup parent ) { View vi = convertView; if( convertView == null ) vi = inflater.inflate( R.layout.password_list_item, null ); TextView title = (TextView) vi.findViewById( R.id.password_list_list_item_text ); ImageView copyPasteView = (ImageView) vi.findViewById( R.id.password_list_list_item_copy_paste ); PWManContentNode node = data.get( position ); title.setText( node.getUserName() + "@" + node.getUrl() ); copyPasteView.setOnClickListener( newPasswordListCopyPasteListenerAction( data, position ) ); // Set the listener on item // OnClickListener clickListener = FriendListAdapterListener.getFriendListListenerAction( this.friendListActivity, this.data, position ); // imageButton.setOnClickListener( clickListener ); // name.setOnClickListener( clickListener ); return vi; } private OnClickListener newPasswordListCopyPasteListenerAction(final ArrayList<PWManContentNode> data, final int position) { return new View.OnClickListener() { @Override public void onClick(View v) { PWManContentNode node = data.get( position ); ClipData clip = ClipData.newPlainText( "Password copied", node.getPassword() ); clipboard.setPrimaryClip( clip ); Toast.makeText( MainActivity.getContext(), "Password for " + node.getUserName() + "@" + node.getUrl() + " copied to clipboard", Toast.LENGTH_LONG ).show(); } }; } }
bb00901beff6fab8f45a98c337713509cb7e300a
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdas/applicationModule/src/test/java/applicationModulepackageJava19/Foo660Test.java
459efbe5609bcea016fc21a49bdd51aca46dabde
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
482
java
package applicationModulepackageJava19; import org.junit.Test; public class Foo660Test { @Test public void testFoo0() { new Foo660().foo0(); } @Test public void testFoo1() { new Foo660().foo1(); } @Test public void testFoo2() { new Foo660().foo2(); } @Test public void testFoo3() { new Foo660().foo3(); } @Test public void testFoo4() { new Foo660().foo4(); } @Test public void testFoo5() { new Foo660().foo5(); } }
a6775ebf65e958b649753df0ed8f9e2ca5f815d9
bd2b71330aa1929a0f4ebeea1c04b702e2812afe
/needDeal/vzvision_12_13/app/src/main/java/com/example/vzvision/SnapImageActivity.java
4087dc1149332ec126b352fd8a521866e6531ba6
[]
no_license
zihanbobo/myC-
1b67c4a620567fdbe70ef10fee29abd5010ffe41
eafbc7c4eca489004905e8ce155f01504419141d
refs/heads/master
2021-06-15T10:07:20.645286
2017-04-08T10:31:36
2017-04-08T10:31:36
null
0
0
null
null
null
null
GB18030
Java
false
false
6,683
java
package com.example.vzvision; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.database.SnapImageTable; import com.database.SnapImageTable.SnapImageElement; import com.example.vzvision.PlateActivity.MyAdspter; import com.example.vzvision.PlateActivity.MyAdspter.Zujian; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.Base64; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.graphics.Typeface; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; public class SnapImageActivity extends Activity { private ListView listView_snapImage = null; private MyAdspter myAdpter = null; private GlobalVariable m_gb = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_snap_image); listView_snapImage = (ListView)this.findViewById(R.id.listView_snapImage); m_gb = (GlobalVariable)getApplicationContext(); List<Map<String, Object>> list=getData(); myAdpter = new MyAdspter(this, list); listView_snapImage.setAdapter(myAdpter); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.snap_image, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } protected List<Map<String, Object>> getData() { List<Map<String, Object>> list=new ArrayList<Map<String,Object>>(); SnapImageTable pci = m_gb.getSnapImageTable(); if( pci != null) { int rowcount = pci.getRowCount(); SnapImageTable.SnapImageElement ele = pci.new SnapImageElement(); Bitmap bmp; for (int i = 0; i < rowcount; i++) { Map<String, Object> map=new HashMap<String, Object>(); // String mstrTitle = "无视频"; // Bitmap bmp = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_8888); // Canvas canvasTemp = new Canvas(bmp); // canvasTemp.drawColor(Color.BLACK); // Paint p = new Paint(); // String familyName = "宋体"; // Typeface font = Typeface.create(familyName, Typeface.BOLD); // p.setColor(Color.RED); // p.setTypeface(font); // p.setTextSize(27); // canvasTemp.drawText(mstrTitle, 0, 100, p); // BitmapFactory.decodeByteArray(data, 0, data.length); if(pci.get(i, ele)) { try { byte [] realImgData = Base64.decode(ele.ImageData, Base64.NO_PADDING); BitmapFactory.Options options = new BitmapFactory.Options(); if( realImgData.length > 50000) { options.inSampleSize = 4;//图片宽高都为原来的二分之一,即图片为原来的四分之一 options.inInputShareable = true; } else { options.inSampleSize = 1;//图片宽高都为原来的二分之一,即图片为原来的四分之一 options.inInputShareable = true; } bmp = BitmapFactory.decodeByteArray(realImgData, 0, realImgData.length,options); if( bmp !=null) { map.put("date", ele.date); map.put("img",bmp); } list.add(map); } catch(IllegalArgumentException e) { int a; a= 0; } catch(Exception e) { int a; a= 0; } } } } return list; } public class MyAdspter extends BaseAdapter { private List<Map<String, Object>> data; private LayoutInflater layoutInflater; private Context context; public MyAdspter(Context context,List<Map<String, Object>> data){ this.context=context; this.data=data; this.layoutInflater=LayoutInflater.from(context); } /** * 组件集合,对应list.xml中的控件 * @author Administrator */ public final class Zujian{ public ImageView snapImage; public TextView dateText; } @Override public int getCount() { return data.size(); } /** * 获得某一位置的数据 */ @Override public Object getItem(int position) { return data.get(position); } /** * 获得唯一标识 */ @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { Zujian zujian=null; if(convertView==null){ zujian=new Zujian(); //获得组件,实例化组件 convertView=layoutInflater.inflate(R.layout.snap_image_item, null); zujian.snapImage=(ImageView)convertView.findViewById(R.id.imageView_snapImage); zujian.dateText=(TextView)convertView.findViewById(R.id.textView_date); convertView.setTag(zujian); }else{ zujian=(Zujian)convertView.getTag(); } Bitmap t = (Bitmap)data.get(position).get("img"); //绑定数据 zujian.snapImage.setImageBitmap((Bitmap)data.get(position).get("img") );//setBackgroundResource((Integer)data.get(position).get("image")); zujian.dateText.setText((String)data.get(position).get("date")); return convertView; } } }
f4bcb6686d2494a4d58734da75fffb6e086e7225
73453b69851ca5a8e60efb4851b878b1df7b773a
/src/main/java/controller/RandomPropertiesEvent.java
429a0a3a0f6576178ea47163426c3e85d25c1b12
[]
no_license
tuephamduc/OOP-Neo4J
32166792f266558a23cbc438c3c9d047223269e4
7371e933752b6eedd6a7f9319a57a90f9d6aef0a
refs/heads/master
2021-09-11T02:39:39.812344
2019-05-29T11:12:46
2019-05-29T11:12:46
189,209,466
0
0
null
2021-09-01T18:40:11
2019-05-29T11:08:32
Java
UTF-8
Java
false
false
1,310
java
package controller; import java.util.Calendar; import java.util.Random; import data.Data; public class RandomPropertiesEvent extends RandomPropetiesNode implements IEvent { public RandomPropertiesEvent() { // TODO Auto-generated constructor stub } private String Tempid; Data data = new Data(); @Override public String randomNhan() { Tempid = data.event[new Random().nextInt(data.event.length)]; return Tempid; } @Override public String randomMoTa() { return data.event[new Random().nextInt(data.event.length)]; } @Override public String randomDinhDanh(int i) { return (Tempid).replace(" ", "_")+i; } @Override public String randomDiaDiem() { return data.location[new Random().nextInt(data.location.length)]; } @Override public String randomDaiDien() { String nhan = null ; nhan = data.firstName[new Random().nextInt(data.firstName.length)]+" "+ data.midName[new Random().nextInt(data.midName.length)]+" "+ data.lastName[new Random().nextInt(data.lastName.length)]; return nhan; } @Override public String randomTime(int i) { Calendar calendar = Calendar.getInstance(); i = i%6500+new Random().nextInt(15); calendar.add(Calendar.DATE, -i); String a = calendar.getTime().toString(); return a.substring(0,10)+" "+a.substring(24,28); } }
6690cfbeed6cac4afb9915b6f9aac6eba3aa1f03
b2b8fac233920fdebd06d1601c3c670490c0da59
/java/nepxion-swing/src/com/nepxion/swing/style/framework/JYellowStyle.java
b0c6e31d46968dbf10225f81a0344f04b297c5b9
[ "Apache-2.0" ]
permissive
DmytroRybka/nepxion
5af80829bdcf1d738bccbf14a4707fae5b9ce28e
36412c4a59d40bb4a9a7208224e53f2e4e4c55eb
refs/heads/master
2020-04-16T03:37:57.532332
2013-05-29T02:56:01
2013-05-29T02:56:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package com.nepxion.swing.style.framework; /** * <p>Title: Nepxion Swing</p> * <p>Description: Nepxion Swing Repository</p> * <p>Copyright: Copyright (c) 2010</p> * <p>Company: Nepxion</p> * @author Neptune * @email [email protected] * @version 1.0 */ import java.awt.Color; public class JYellowStyle extends JLiteStyle { /** * The identity value. */ public static final String ID = JYellowStyle.class.getName(); /** * Constructs with the default. */ public JYellowStyle() { setSelectionGradientColor(new Color(249, 224, 137)); } }
[ "HaoJun.Ren@4900acfa-993c-71f3-3719-b31e1bbe1dc8" ]
HaoJun.Ren@4900acfa-993c-71f3-3719-b31e1bbe1dc8
cf37920c6dc593365218000eb96185fc311cd678
2efb00c61f4ca9bddcc0cd1633744e3d553b3a8e
/Damon/Dynamic programming/src/ReverseVowels.java
7779d1974525f9d79019900718693e985f562a3e
[]
no_license
Anubhav007-hue/IdeaProject
f204d25e6d9033b1a94074c5d5b67d3ea41d844e
829a952184be1d2620b5241c7354e6e7fa6a15a5
refs/heads/master
2022-12-18T02:18:05.350423
2020-09-26T19:42:21
2020-09-26T19:42:21
268,597,384
0
0
null
null
null
null
UTF-8
Java
false
false
1,465
java
import java.util.HashSet; public class ReverseVowels { public static void main(String[] args ) { String s="hello"; int i=0; int j=s.length()-1; char[] arr=s.toCharArray(); HashSet<Character> set=new HashSet<>(); set.add('a'); set.add('e'); set.add('i'); set.add('o'); set.add('u'); set.add('A'); set.add('E'); set.add('I'); set.add('O'); set.add('U'); while (i<j) { if(checkVowels(arr[i],set)==true && checkVowels(arr[j],set)==true) { char temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; i++; j--; } else if (checkVowels(arr[i],set)!=true && checkVowels(arr[j],set)==true) { i++; } else if (checkVowels(arr[i],set)==true && checkVowels(arr[j],set)!=true) { j--; } else if(checkVowels(arr[i],set)!=true && checkVowels(arr[j],set)!=true) { i++; j--; } } String newString=new String(arr); System.out.println(newString); } public static boolean checkVowels(Character k, HashSet<Character> set) { if(set.contains(k)) { return true; } return false; } }
b79c9771b695bfb8f24ec95f183a35307acff1d9
82a0f02a22ad11946492212d86caae5198920da3
/app/src/main/java/com/kanishk/pricelinehack/api/SessionRequestInterceptor.java
6008eac90208d0272b5b903eda2c27c4c7100486
[]
no_license
Implementations/PriceLineIntegrate
b71cc5efe1ecff33a3f83a8426e40ccf5cd77fef
ce35ab17128c2067d2a09de747a69ef39d687f87
refs/heads/master
2021-01-10T16:29:36.638980
2015-11-08T13:12:52
2015-11-08T13:12:52
45,778,184
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package com.kanishk.pricelinehack.api; import retrofit.RequestInterceptor; /** * Created by Soham Banerjee on 13/3/15. */ public class SessionRequestInterceptor implements RequestInterceptor { private static final String TAG = SessionRequestInterceptor.class.getSimpleName(); @Override public void intercept(RequestFacade request) { request.addHeader("Content-Type", "application/json");//you can add header here if you need in your api } }
0e51815f866bc2d5698e2594a98ab5d63375b2d6
8a68badfdca57840b0200336b4469b724becde87
/app/src/main/java/com/pk/cv19/MappaESplash/Mappa.java
b412a99360346a77ac15256f5355c6e0db41c883
[]
no_license
VincenzoCoppola/CV19
86561c19a5cfebb38b518711c074be77107b8fa3
95070b61afa70c414ee0afb3dc3bd9946270f996
refs/heads/main
2022-12-21T02:33:04.776093
2020-10-06T11:26:17
2020-10-06T11:26:17
301,701,864
0
0
null
null
null
null
UTF-8
Java
false
false
6,085
java
/*Gestione della mappa tramite API di Google*/ package com.pk.cv19.MappaESplash; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentActivity; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Build; import android.os.Bundle; import android.widget.Toast; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.pk.cv19.R; public class Mappa extends FragmentActivity implements OnMapReadyCallback { /*-----Dichiarazioni-----*/ private MappaESplash_Controller Controller = new MappaESplash_Controller(this); private GoogleMap mMap; LocationManager locationManager; LocationListener locationListener; /*-----Metodi-----*/ //Metodo che verifica se il permesso al GPS è stato accettato e //si comporta di conseguenza. @RequiresApi(api = Build.VERSION_CODES.P) @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { //Controllo dei permessi if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5, 10, locationListener);//In caso di successo, recupera la posizione dell'utente AggiuntaMarkerStrutture(mMap); if(!locationManager.isLocationEnabled()) { Controller.PermessiOK(mMap); } } } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mappa); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ //Quando la mappa è pronta inizieranno i vari processi //per geolocalizzare l'utente e aggiungere i markers. @RequiresApi(api = Build.VERSION_CODES.P) @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); locationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { //Appena si cambia la posizione, viene impostata su quella dell'utente. Controller.GpsAttivo(location, mMap); //Richiamo metodo. } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public void onProviderEnabled(String provider) { Toast.makeText(Mappa.this, "Geolocalizzazione in corso...", Toast.LENGTH_LONG).show(); } @Override public void onProviderDisabled(String provider) { } }; //Controllo delle versioni SDK. if (Build.VERSION.SDK_INT >= 23){ //Se SDK >= 23. if(ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){ //Chiedo Permesso. ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},1); }else{ //Abbiamo gia i permessi. locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,5,100,locationListener); Location ultima_pos =locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); Controller.Version(ultima_pos,mMap); } if (!locationManager.isLocationEnabled()){ Toast.makeText(this,"POSIZIONE IMPOSTATA SU MSA",Toast.LENGTH_LONG).show(); } } else{ //Se SDK < 23. if(ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){ //Chiedo Permesso. ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},1); }else{ //Abbiamo gia i permessi. locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,5,100,locationListener); Location ultima_pos =locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); Controller.Version(ultima_pos,mMap); } } } //Imposta i marker delle strutture inserite nel database sulla mappa. private void AggiuntaMarkerStrutture(final GoogleMap mMap) { Controller.AggiuntaMarkerStrutture(mMap); } //Tasto back fisico. @Override public void onBackPressed() { super.onBackPressed(); Controller.btnMain(); } }
d5c319c6c55527c071e08721ba9c61b3858a0dde
0c6840955d7b3e09cf93b9f091019b363ef965a2
/c212/exam/mine/CircleDraw.java
356a08414d1cb25f9e4765fdbd8f234f2dfc2bab
[]
no_license
ZacMilano/OldSchoolFiles
fd4e67da69abf79eda6f3b2dbe206dbe0691ade0
c22fc4d6699cbf29e291173b6b8aaf57cf33db6d
refs/heads/master
2022-11-22T23:13:36.944468
2019-05-07T15:20:46
2019-05-07T15:20:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,467
java
// CircleDraw.java // import java.util.ArrayList; import javax.swing.JFrame; import javax.swing.JComponent; //forgot about this // import javax.swing.Graphics; // oops import java.awt.Graphics; import java.awt.Color; public class CircleDraw extends JComponent { // I thought it needed to ArrayList<Circle> circles = new // implement something, and ArrayList<Circle>(); // extend JFrame public CircleDraw() { for (int i = 0; i < 20; i++) { this.circles.add( new Circle( (int)(Math.random()*400), (int)(Math.random()*400), (int)(Math.random()*10 + 30), new Color( (float)Math.random(), (float)Math.random(), (float)Math.random() ) ) ); } } public static void main(String[] args) { JFrame j = new JFrame(); j.setSize(400,400); j.setVisible(true); j.add(new CircleDraw()); } public void paintComponent(Graphics g) { for (Circle c : circles) { c.draw(g); } } } class Circle { int x, y, rad; Color c; //forgot about random color public Circle(int x_, int y_, int rad_, Color c_) { this.x = x_; this.y = y_; this.rad = rad_; this.c = c_; } public void draw(Graphics g) { g.setColor(this.c); g.fillOval(this.x - this.rad, this.y - this.rad, // subtract rad from x,y 2*this.rad, 2*this.rad); } }
a54c9eaaf530e3c221e55b8d3cf8bc19ef7e8868
bc86086f8e288d1542ea78bda6f76f4272ff7230
/csparql-core/src/main/java/eu/larkc/csparql/core/old_parser/Label.java
21560411f634df6ee3d20bc1b63050e65bc255dd
[]
no_license
farahkarim/CSPARQL-engine-onDemandSemantificationV2
543605785fc97290c815e6056ae44e430a0d09ed
d4fd4af1c029ec39c49f6e16f652041ed3a4c00f
refs/heads/master
2021-08-19T14:49:39.489981
2017-11-26T18:41:50
2017-11-26T18:41:50
112,106,084
0
0
null
null
null
null
UTF-8
Java
false
false
2,642
java
/** * Copyright 2011-2015 DEIB - Politecnico di Milano * * 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. * * Acknowledgements: * We would like to thank Davide Barbieri, Emanuele Della Valle, * Marco Balduini, Soheila Dehghanzadeh, Shen Gao, and * Daniele Dell'Aglio for the effort in the development of the software. * * This work is partially supported by * - the European LarKC project (FP7-215535) of DEIB, Politecnico di * Milano * - the ERC grant “Search Computing” awarded to prof. Stefano Ceri * - the European ModaClouds project (FP7-ICT-2011-8-318484) of DEIB, * Politecnico di Milano * - the IBM Faculty Award 2013 grated to prof. Emanuele Della Valle; * - the City Data Fusion for Event Management 2013 project funded * by EIT Digital of DEIB, Politecnico di Milano * - the Dynamic and Distributed Information Systems Group of the * University of Zurich; * - INSIGHT NUIG and Science Foundation Ireland (SFI) under grant * No. SFI/12/RC/2289 */ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package eu.larkc.csparql.core.old_parser; /** * Used to decorate the TreeBox * * @author Marco */ public class Label { private int id; private int deepLevel; private int childIndex; Label() { } /** * Set the id with a deepLevel(from top to down)'.'childIndex(from left to right) notation * * @param deepLevel * @param childIndex */ Label(final int id, final int deepLevel, final int childIndex) { this.deepLevel = deepLevel; this.childIndex = childIndex; this.id = id; } public int getId() { return this.id; } public int getDeepLevel() { return this.deepLevel; } public int getChildIndex() { return this.childIndex; } @Override public String toString() { return new String("ID:" + Integer.toString(this.id) + " deepLevel:" + Integer.toString(this.deepLevel) + " childIndex:" + Integer.toString(this.childIndex)); } }
97ac9949125bad84fe1c17947cbd2a012838310a
f9b415073f78461ff75df431963e00988b914d0a
/FileSystemApp/app/src/main/java/com/ceodelhi/filesystemapp/utility/MyAppGlideModule.java
86e444c7253a8571803900a74755d298f75a1498
[]
no_license
susheelit/AndroidApps
d6a94df59095fb5ad7a3450f8177345dd3372ce3
61cd86df54291c0e0e69207e9c48bd8661f7c007
refs/heads/master
2023-06-16T15:20:19.299016
2021-07-10T12:42:21
2021-07-10T12:42:21
384,695,561
1
0
null
null
null
null
UTF-8
Java
false
false
219
java
package com.ceodelhi.filesystemapp.utility; import com.bumptech.glide.annotation.GlideModule; import com.bumptech.glide.module.AppGlideModule; @GlideModule public final class MyAppGlideModule extends AppGlideModule { }
2031ad2fa2b1daa6f7123c73d565caf266a76213
139960e2d7d55e71c15e6a63acb6609e142a2ace
/mobile_app1/module342/src/main/java/module342packageJava0/Foo596.java
d627b0c1f6a1068cdafb45786fe2dab68d0e5e0f
[ "Apache-2.0" ]
permissive
uber-common/android-build-eval
448bfe141b6911ad8a99268378c75217d431766f
7723bfd0b9b1056892cef1fef02314b435b086f2
refs/heads/master
2023-02-18T22:25:15.121902
2023-02-06T19:35:34
2023-02-06T19:35:34
294,831,672
83
7
Apache-2.0
2021-09-24T08:55:30
2020-09-11T23:27:37
Java
UTF-8
Java
false
false
511
java
package module342packageJava0; import java.lang.Integer; public class Foo596 { Integer int0; Integer int1; public void foo0() { new module342packageJava0.Foo595().foo8(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } public void foo6() { foo5(); } public void foo7() { foo6(); } public void foo8() { foo7(); } }
928401b4c8f148b6d608c0df7f7b97d124cb4ea2
c319c4729acb308c981c582349a27866eef5dc4b
/bdysysm/src/main/java/com/yootii/bdy/mailbox/service/MailBoxService.java
49461a85a0c690200964187917b4323a83927e75
[]
no_license
godlessyou/suit
866e7704407a5bfdbcf579454486d88c7455e0d6
454bb494b16ba63817eec97e45661e8a38b4516c
refs/heads/master
2020-04-16T12:25:22.429576
2019-01-14T01:59:57
2019-01-14T01:59:57
165,578,613
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package com.yootii.bdy.mailbox.service; import com.yootii.bdy.common.ReturnInfo; public interface MailBoxService { public ReturnInfo createMailbox(String email,String password,Integer userId,String tokenID); }
6137978508a09c8cc1051c0d1098d7bdd4e5b39c
db683f26b90e15f78c6a447649c1bb9e9d9423d1
/src/com/example/myfirstapp/MyActivity.java
dee78fd418027edc595340d68e644c57a7f0602a
[]
no_license
bajiraoandroid/firstapp
2b1877bad3dd47532bef64534d3407f4135ac2dd
dd7c1c53ef661a7eee699482f2a201f24a255d56
refs/heads/master
2021-01-10T13:24:50.893613
2016-03-27T09:23:34
2016-03-27T09:23:34
54,821,528
0
0
null
null
null
null
UTF-8
Java
false
false
952
java
package com.example.myfirstapp; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MyActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.my, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
acff270a81123a383943275f9f7a0b99e0394b6e
802a43db913e949524d7f0fa43adabe0188d9827
/owen-spring-boot/owen-spring-boot-demo/src/main/java/com/owen/spring/boot/demo/controller/UserController.java
aa572684d3afac0774b74ea1b5ed1cc87ca69fbb
[]
no_license
wangzhibing/owen-spring
c56329d50a2cab763483f274fdb653108c88921e
f79c6625a404886a563f0a8fece8fcfe1f0784ea
refs/heads/master
2021-01-21T09:28:42.934107
2018-09-10T11:10:52
2018-09-10T11:10:52
91,655,220
0
0
null
null
null
null
UTF-8
Java
false
false
1,538
java
package com.owen.spring.boot.demo.controller; import com.mountain.persistent.core.example.Example; import com.owen.spring.boot.demo.dao.entity.User; import com.owen.spring.boot.demo.dao.entity.example.UserExample; import com.owen.spring.boot.demo.service.atom.UserAtom; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @RestController @RequestMapping("/user") public class UserController { private final static Logger logger = LoggerFactory .getLogger(UserController.class); @Resource private UserAtom userAtom; /** * @param * @return */ @RequestMapping(value = "/initData", method = RequestMethod.GET) @ResponseBody public Map<String, Object> initData() { Map<String, Object> m = new HashMap<String, Object>(); System.out.println(new Date()); m.put("date", new Date()); return m; } @RequestMapping("/queryUser") @ResponseBody public Object queryUser(Model mv) { UserExample userExample = new UserExample(); List<User> list = userAtom.queryList(userExample); return list; } }
d1ff9e86ddac4cb965ca86a3d34d6450fa0c2ace
70262a27f2e4cd4afdd71505c08a7a246b39f7d8
/Lab0c.java
d8131151352b899c6f6d25b59de86755582a4c3b
[]
no_license
anjali-gopinathan/AnjaliCSAProject
9bee8219eb4a34f1b3bcc3a27ba0ca72eb8d8300
1ac805cec9a627435180ea49a594fd8aa621c3ab
refs/heads/master
2021-09-14T20:47:22.203577
2018-05-19T01:58:58
2018-05-19T01:58:58
null
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
1,549
java
//© A+ Computer Science - www.apluscompsci.com //Name - //Date - //Class - //Lab - import static java.lang.System.*; import java.util.Scanner; public class Lab0c { public static void main (String[] args) { Scanner keyboard = new Scanner(System.in); int intOne, intTwo; double doubleOne, doubleTwo; float floatOne, floatTwo; short shortOne, shortTwo; System.out.print("Enter an integer: "); intOne = keyboard.nextInt(); System.out.print("Enter an integer: "); intTwo = keyboard.nextInt(); System.out.print("Enter a double: "); doubleOne = keyboard.nextDouble(); System.out.print("Enter a double: "); doubleTwo = keyboard.nextDouble(); System.out.print("Enter a float: "); floatOne = keyboard.nextFloat(); System.out.print("Enter a float: "); floatTwo = keyboard.nextFloat(); /*System.out.print("Enter a short: "); shortOne = keyboard.nextShort(); System.out.print("Enter a short: "); shortTwo = keyboard.nextShort();*/ System.out.println("\n\n"); System.out.println("integer one = " + intOne ); System.out.println("integer two = " + intTwo ); System.out.println("double one = " + doubleOne ); System.out.println("double two = " + doubleTwo ); System.out.println("float one = " + floatOne ); System.out.println("float two = " + floatTwo ); /*System.out.println("short one = " + shortOne ); System.out.println("short two = " + shortTwo );*/ //add in output for all variables } }
266a276328e19510760f0174b00c1700f433309b
0bba0d0045828ced35f7faae0d9b0d560f03df36
/Task1/GMF/ExtPetriNetsMM.diagram/src/extendedPetriNets/extendedPetriNets/diagram/part/ExtPetriNetsVisualIDRegistry.java
0bd6c18af5fc5f3a9668ccaee96b5cb6584fc482
[]
no_license
mikevd92/atl2
ff89805089b7a822fd52f8690ec7172ec22b70cb
8d4af51db857138edf2a707d06b319bc7b691688
refs/heads/master
2016-09-05T13:54:41.022052
2015-04-28T11:34:16
2015-04-28T11:34:16
33,773,862
0
0
null
null
null
null
UTF-8
Java
false
false
10,543
java
package extendedPetriNets.extendedPetriNets.diagram.part; import org.eclipse.core.runtime.Platform; import org.eclipse.emf.ecore.EAnnotation; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.gmf.tooling.runtime.structure.DiagramStructure; /** * This registry is used to determine which type of visual object should be * created for the corresponding Diagram, Node, ChildNode or Link represented * by a domain model object. * * @generated */ public class ExtPetriNetsVisualIDRegistry { /** * @generated */ private static final String DEBUG_KEY = "ExtPetriNetsMM.diagram/debug/visualID"; //$NON-NLS-1$ /** * @generated */ public static int getVisualID(View view) { if (view instanceof Diagram) { if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.MODEL_ID .equals(view.getType())) { return extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.VISUAL_ID; } else { return -1; } } return extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .getVisualID(view.getType()); } /** * @generated */ public static String getModelID(View view) { View diagram = view.getDiagram(); while (view != diagram) { EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ if (annotation != null) { return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$ } view = (View) view.eContainer(); } return diagram != null ? diagram.getType() : null; } /** * @generated */ public static int getVisualID(String type) { try { return Integer.parseInt(type); } catch (NumberFormatException e) { if (Boolean.TRUE.toString().equalsIgnoreCase( Platform.getDebugOption(DEBUG_KEY))) { extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsDiagramEditorPlugin .getInstance().logError( "Unable to parse view type as a visualID number: " + type); } } return -1; } /** * @generated */ public static String getType(int visualID) { return Integer.toString(visualID); } /** * @generated */ public static int getDiagramVisualID(EObject domainElement) { if (domainElement == null) { return -1; } if (extendedPetriNets.extendedPetriNets.extendedPetriNetsPackage.eINSTANCE .getPetriNet().isSuperTypeOf(domainElement.eClass()) && isDiagram((extendedPetriNets.extendedPetriNets.PetriNet) domainElement)) { return extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.VISUAL_ID; } return -1; } /** * @generated */ public static int getNodeVisualID(View containerView, EObject domainElement) { if (domainElement == null) { return -1; } String containerModelID = extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .getModelID(containerView); if (!extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.MODEL_ID .equals(containerModelID)) { return -1; } int containerVisualID; if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.MODEL_ID .equals(containerModelID)) { containerVisualID = extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .getVisualID(containerView); } else { if (containerView instanceof Diagram) { containerVisualID = extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.VISUAL_ID; } else { return -1; } } switch (containerVisualID) { case extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.VISUAL_ID: if (extendedPetriNets.extendedPetriNets.extendedPetriNetsPackage.eINSTANCE .getTransition().isSuperTypeOf(domainElement.eClass())) { return extendedPetriNets.extendedPetriNets.diagram.edit.parts.TransitionEditPart.VISUAL_ID; } if (extendedPetriNets.extendedPetriNets.extendedPetriNetsPackage.eINSTANCE .getOutputPort().isSuperTypeOf(domainElement.eClass())) { return extendedPetriNets.extendedPetriNets.diagram.edit.parts.OutputPortEditPart.VISUAL_ID; } if (extendedPetriNets.extendedPetriNets.extendedPetriNetsPackage.eINSTANCE .getPlace().isSuperTypeOf(domainElement.eClass())) { return extendedPetriNets.extendedPetriNets.diagram.edit.parts.PlaceEditPart.VISUAL_ID; } if (extendedPetriNets.extendedPetriNets.extendedPetriNetsPackage.eINSTANCE .getInputPort().isSuperTypeOf(domainElement.eClass())) { return extendedPetriNets.extendedPetriNets.diagram.edit.parts.InputPortEditPart.VISUAL_ID; } break; } return -1; } /** * @generated */ public static boolean canCreateNode(View containerView, int nodeVisualID) { String containerModelID = extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .getModelID(containerView); if (!extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.MODEL_ID .equals(containerModelID)) { return false; } int containerVisualID; if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.MODEL_ID .equals(containerModelID)) { containerVisualID = extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .getVisualID(containerView); } else { if (containerView instanceof Diagram) { containerVisualID = extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.VISUAL_ID; } else { return false; } } switch (containerVisualID) { case extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.VISUAL_ID: if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.TransitionEditPart.VISUAL_ID == nodeVisualID) { return true; } if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.OutputPortEditPart.VISUAL_ID == nodeVisualID) { return true; } if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.PlaceEditPart.VISUAL_ID == nodeVisualID) { return true; } if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.InputPortEditPart.VISUAL_ID == nodeVisualID) { return true; } break; case extendedPetriNets.extendedPetriNets.diagram.edit.parts.TransitionEditPart.VISUAL_ID: if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.TransitionNameEditPart.VISUAL_ID == nodeVisualID) { return true; } break; case extendedPetriNets.extendedPetriNets.diagram.edit.parts.OutputPortEditPart.VISUAL_ID: if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.OutputPortNameEditPart.VISUAL_ID == nodeVisualID) { return true; } break; case extendedPetriNets.extendedPetriNets.diagram.edit.parts.PlaceEditPart.VISUAL_ID: if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.PlaceNameEditPart.VISUAL_ID == nodeVisualID) { return true; } break; case extendedPetriNets.extendedPetriNets.diagram.edit.parts.InputPortEditPart.VISUAL_ID: if (extendedPetriNets.extendedPetriNets.diagram.edit.parts.InputPortNameEditPart.VISUAL_ID == nodeVisualID) { return true; } break; } return false; } /** * @generated */ public static int getLinkWithClassVisualID(EObject domainElement) { if (domainElement == null) { return -1; } if (extendedPetriNets.extendedPetriNets.extendedPetriNetsPackage.eINSTANCE .getInputArc().isSuperTypeOf(domainElement.eClass())) { return extendedPetriNets.extendedPetriNets.diagram.edit.parts.InputArcEditPart.VISUAL_ID; } if (extendedPetriNets.extendedPetriNets.extendedPetriNetsPackage.eINSTANCE .getOutputArc().isSuperTypeOf(domainElement.eClass())) { return extendedPetriNets.extendedPetriNets.diagram.edit.parts.OutputArcEditPart.VISUAL_ID; } return -1; } /** * User can change implementation of this method to handle some specific * situations not covered by default logic. * * @generated */ private static boolean isDiagram( extendedPetriNets.extendedPetriNets.PetriNet element) { return true; } /** * @generated */ public static boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) { if (candidate == -1) { //unrecognized id is always bad return false; } int basic = getNodeVisualID(containerView, domainElement); return basic == candidate; } /** * @generated */ public static boolean isCompartmentVisualID(int visualID) { return false; } /** * @generated */ public static boolean isSemanticLeafVisualID(int visualID) { switch (visualID) { case extendedPetriNets.extendedPetriNets.diagram.edit.parts.PetriNetEditPart.VISUAL_ID: return false; case extendedPetriNets.extendedPetriNets.diagram.edit.parts.TransitionEditPart.VISUAL_ID: case extendedPetriNets.extendedPetriNets.diagram.edit.parts.OutputPortEditPart.VISUAL_ID: case extendedPetriNets.extendedPetriNets.diagram.edit.parts.PlaceEditPart.VISUAL_ID: case extendedPetriNets.extendedPetriNets.diagram.edit.parts.InputPortEditPart.VISUAL_ID: return true; default: break; } return false; } /** * @generated */ public static final DiagramStructure TYPED_INSTANCE = new DiagramStructure() { /** * @generated */ public int getVisualID(View view) { return extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .getVisualID(view); } /** * @generated */ public String getModelID(View view) { return extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .getModelID(view); } /** * @generated */ public int getNodeVisualID(View containerView, EObject domainElement) { return extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .getNodeVisualID(containerView, domainElement); } /** * @generated */ public boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) { return extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .checkNodeVisualID(containerView, domainElement, candidate); } /** * @generated */ public boolean isCompartmentVisualID(int visualID) { return extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .isCompartmentVisualID(visualID); } /** * @generated */ public boolean isSemanticLeafVisualID(int visualID) { return extendedPetriNets.extendedPetriNets.diagram.part.ExtPetriNetsVisualIDRegistry .isSemanticLeafVisualID(visualID); } }; }
f65c93b00425d1cc2e086928713973397023cae0
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/MATH-58b-10-19-SPEA2-WeightedSum:TestLen:CallDiversity/org/apache/commons/math/optimization/fitting/CurveFitter_ESTest_scaffolding.java
5d356fc67d023c66892abcbe14dc449aa1ce397f
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
460
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Mon Apr 06 15:38:47 UTC 2020 */ package org.apache.commons.math.optimization.fitting; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class CurveFitter_ESTest_scaffolding { // Empty scaffolding for empty test suite }
560df0e650a404781b0d62c791582190d8a86d72
51ea05924b12dcd42e4fc48dd522f9e53730526a
/domain/src/main/java/domainB/service/IDomainBService.java
e6a3209229ad2cd49a6b8a6b00a8f462b4f18c82
[]
no_license
WinterfellLele/domainevent
b029bdd0455c49dc1db8c915d23153b12d6e27e3
0bbaed947e65827703968c2850d5ca9e9eedd6d6
refs/heads/main
2023-04-27T09:42:46.387295
2021-05-10T02:59:51
2021-05-10T02:59:51
365,894,003
1
0
null
null
null
null
UTF-8
Java
false
false
116
java
package domainB.service; public interface IDomainBService { Object doService(DomainBContext domainBContext); }
77f0fd3282dc8826b096b987cea50cf9f2ca35d1
c10e6c9f62d1e1187f382a881a47b338779a00ce
/src/sn/esp/dic319/crudusers/beans/Album.java
85e8a3400fc1700f12902da29399719da3492cf9
[]
no_license
saalihou/jee-albums-project
59f53d0e4ba532e87ee96460542d5b065c30d34f
09359f235bcc13f1d22b37a56562ec3d67507559
refs/heads/master
2021-02-09T04:14:37.923478
2020-03-08T13:39:56
2020-03-08T13:39:56
244,238,893
0
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
package sn.esp.dic319.crudusers.beans; public class Album { private int id; private String name; private User owner; private boolean isPublic = false; public Album(String name, User owner) { super(); this.name = name; this.owner = owner; } public Album(String name, boolean isPublic, User owner) { super(); this.name = name; this.owner = owner; this.isPublic = isPublic; } public Album(int id, String name, User owner) { super(); this.id = id; this.name = name; this.owner = owner; } public Album(int id, String name, boolean isPublic, User owner) { super(); this.id = id; this.name = name; this.setPublic(isPublic); this.owner = owner; } public int getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public User getOwner() { return owner; } public void setOwner(User owner) { this.owner = owner; } public boolean isPublic() { return isPublic; } public void setPublic(boolean isPublic) { this.isPublic = isPublic; } }
e28b1f8880473a09b7d47792d298897aaa162a8b
0397d604f089ffe2b40d3ccbef5a24345535d19a
/JavaDFrawLib/JavaDFRawLib/src/com/oyosite/ticon/rawlib/material/MaterialTypeEggWhite.java
d381c3bbac0118e260f60e4f2f02f525bc11ffe2
[ "MIT" ]
permissive
eehunter/DFjava
d16dea472ef28b0c0c28600f431fd741539b9a04
df64a63395544dc0b9662923f281d7349cef9d57
refs/heads/master
2020-07-14T03:28:59.901447
2019-09-02T21:00:42
2019-09-02T21:00:42
205,226,358
1
2
MIT
2019-10-10T18:16:05
2019-08-29T18:28:10
Java
UTF-8
Java
false
false
199
java
package com.oyosite.ticon.rawlib.material; public class MaterialTypeEggWhite extends MaterialType { public MaterialTypeEggWhite() { super("eggwhite", "eggwhite", "eggwhites", "eggwhite"); } }
2d7957c3061b6bc4507d293e94b544abbe131b2f
6999813bb224f2c5237807d85e0359072b5e615d
/algorithm/_338_countingbits/_338.java
8b1af00de040e4df8b2c20654ec7d260ddb98529
[ "MIT" ]
permissive
woncz/arts
cc9467c0ee3232eadbd57a305fd156b501e7dd83
d37bf57197e8afa7331bbc80940b812aa7061429
refs/heads/master
2021-06-12T06:33:06.432492
2021-06-04T09:38:47
2021-06-04T09:38:47
196,970,690
0
0
null
null
null
null
UTF-8
Java
false
false
1,837
java
/* * Copyright [2020] * * 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 _338_countingbits; import java.util.Arrays; /** * Created by woncz on 3/3/2021. */ public class _338 { public static void main(String[] args) { ISolution solution = new Solution(); int num = 5; System.out.println(Arrays.toString(solution.countBits(num))); num = 2; System.out.println(Arrays.toString(solution.countBits(num))); num = 6; System.out.println(Arrays.toString(solution.countBits(num))); num = 3; System.out.println(Arrays.toString(solution.countBits(num))); num = 7; System.out.println(Arrays.toString(solution.countBits(num))); num = 0; System.out.println(Arrays.toString(solution.countBits(num))); num = 1; System.out.println(Arrays.toString(solution.countBits(num))); } } interface ISolution { int[] countBits(int num); } class Solution implements ISolution { @Override public int[] countBits(int num) { // init if (num == 0) return new int[] {0}; int[] dp = new int[num + 1]; dp[0] = 0; dp[1] = 1; // formula for (int i = 2; i <= num; i++) { dp[i] = dp[i & (i - 1)] + 1; } return dp; } }
3056546760fbd2fd9f8f62168c0fecee900d0d1c
aaabffe8bf55973bfb1390cf7635fd00ca8ca945
/src/main/java/com/microsoft/graph/requests/extensions/IWorkbookFunctionsDvarPRequestBuilder.java
e79e1c4b4969a4f6dd5d0d2e9c4773a6dd13a636
[ "MIT" ]
permissive
rgrebski/msgraph-sdk-java
e595e17db01c44b9c39d74d26cd925b0b0dfe863
759d5a81eb5eeda12d3ed1223deeafd108d7b818
refs/heads/master
2020-03-20T19:41:06.630857
2018-03-16T17:31:43
2018-03-16T17:31:43
137,648,798
0
0
null
2018-06-17T11:07:06
2018-06-17T11:07:05
null
UTF-8
Java
false
false
1,074
java
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ package com.microsoft.graph.requests.extensions; import com.microsoft.graph.concurrency.*; import com.microsoft.graph.core.*; import com.microsoft.graph.models.extensions.*; import com.microsoft.graph.models.generated.*; import com.microsoft.graph.http.*; import com.microsoft.graph.requests.extensions.*; import com.microsoft.graph.requests.generated.*; import com.microsoft.graph.options.*; import com.microsoft.graph.serializer.*; import java.util.Arrays; import java.util.EnumSet; // This file is available for extending, afterwards please submit a pull request. /** * The interface for the Workbook Functions Dvar PRequest Builder. */ public interface IWorkbookFunctionsDvarPRequestBuilder extends IBaseWorkbookFunctionsDvarPRequestBuilder { }
61f24abb090671dda9ba31b1ad50064686328e1c
b9852e928c537ce2e93aa7e378689e5214696ca5
/hse-osc-business/src/main/java/com/hd/hse/osc/service/checkrules/CheckHazardInfo.java
9344f98205aaf6faf96d00034989e5d95f1f94a7
[]
no_license
zhanshen1373/Hseuse
bc701c6de7fd88753caced249032f22d2ca39f32
110f9d1a8db37d5b0ea348069facab8699e251f1
refs/heads/master
2023-04-04T08:27:10.675691
2021-03-29T07:44:02
2021-03-29T07:44:02
352,548,680
0
2
null
null
null
null
UTF-8
Java
false
false
2,378
java
/** * Project Name:hse-osc-business * File Name:CheckHazardInfo.java * Package Name:com.hd.hse.osc.service.checkrules * Date:2015年3月9日 * Copyright (c) 2015, [email protected] All Rights Reserved. * */ package com.hd.hse.osc.service.checkrules; import java.util.List; import java.util.Map; import com.hd.hse.common.exception.HDException; import com.hd.hse.dao.connection.IConnection; import com.hd.hse.entity.base.HazardNotify; import com.hd.hse.entity.workorder.WorkApplyMeasure; import com.hd.hse.service.workorder.checkrules.AbstractCheckListener; import com.hd.hse.utils.UtilTools; /** * ClassName:CheckHazardInfo (校验危害信息是否满足条件).<br/> * Date: 2015年3月9日 <br/> * * @author zhaofeng * @version * @see */ public class CheckHazardInfo extends AbstractCheckListener { public CheckHazardInfo() { // TODO Auto-generated constructor stub } public CheckHazardInfo(IConnection connection) { super(connection); // TODO Auto-generated constructor stub } /** * TODO 继承自父类 * * @see com.hd.hse.service.workorder.checkrules.AbstractCheckListener#action(String, * Object[]) */ @Override public Object action(String action, Object... args) throws HDException { // TODO Auto-generated method stub Map<String, Object> mapParas = objectCast(args[0]); List<HazardNotify> hazardList = (List<HazardNotify>) UtilTools .judgeMapListValue(mapParas, HazardNotify.class, true); checkHazardInfo(hazardList); return super.action(action, args); } /** * checkHazardInfo:(检验危害中的已经被选择的项中,必填项是否已经填写). <br/> * date: 2015年3月9日 <br/> * * @author zhaofeng * @param hazardList * @throws HDException */ private void checkHazardInfo(List<HazardNotify> hazardList) throws HDException { String desc = ""; for (int i = 0; i < hazardList.size(); i++) { desc = hazardList.get(i).getDescription(); if (desc == null) continue; if (((hazardList.get(i).getIsselect() != null && hazardList.get(i) .getIsselect() == 1) || (hazardList.get(i).getIspadselect() != null && hazardList .get(i).getIspadselect() == 1)) && (desc.replace(" ", "").contains("()") || desc.replace( " ", "").contains("()"))) { throw new HDException(desc + "为必填项,未填写,不能保存!"); } } } }
a6d697635d31b4c1b415ad8c9edadcf3a5090774
736dd02075591495abfd95b44ebce73aac906cb4
/src/test/java/SpringUtilTest.java
20ba6b0cf180774a33eeb4c2e002e518d1fa005d
[]
no_license
geeeeet/SpringUtilTest
c0e595b4fa52a0bf037799433a3eaad9c916f1a2
d0930f3042b7b4f3fa7f5e2b9f6da024dda3c4da
refs/heads/master
2021-05-22T18:16:13.421086
2020-04-04T15:43:21
2020-04-04T15:43:21
253,035,417
0
0
null
2020-10-13T20:54:53
2020-04-04T15:42:58
Java
UTF-8
Java
false
false
1,925
java
import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.junit.runner.RunWith; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; /** * @author lirufeng * @date 2020/04/04 下午 9:38 */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:ApplicationContext.xml") public class SpringUtilTest { @Autowired private IUtilClassService utilClass; @Autowired private AnotherWayGetPropertiesValue anotherWay; @Test @Ignore public void utilConstant_Test(){ System.out.println(utilClass.getConstant()); } @Test @Ignore public void utilList_Test() { List<String> list = utilClass.getList(); System.out.println(list.toString()); } @Test @Ignore public void utilMap_Test() { Map<String,String> map = utilClass.getMap(); System.out.println(map.toString()); } @Test @Ignore public void utilSet_Test() { Set<String> set = utilClass.getSet(); System.out.println(set.toString()); } @Test @Ignore public void utilProperties_Test() { Properties properties = utilClass.getProperties(); System.out.println(properties.getProperty("person.name")); System.out.println(properties.getProperty("person.gender")); } @Test @Ignore public void utilPropertyPath_Test() { Object property_path = utilClass.getProperty_path(); System.out.println(property_path); } ///////////////////////////////分割线/////////////////////////////// @Test @Ignore public void utilPropertiesAnotherWay_Test() { System.out.println(anotherWay.getGender()); } }
be41a35fad723547fd8a6e60a1e2ef6b8ba7fed5
454eb75d7402c4a0da0e4c30fb91aca4856bbd03
/o2o/trunk/java/o2o-web/src/main/java/cn/com/dyninfo/o2o/old/service/SizeService.java
f60de8da932db5058666cb0ef5c867492fa99055
[]
no_license
fengclondy/guanhongshijia
15a43f6007cdf996f57c4d09f61b25143b117d73
c710fe725022fe82aefcb552ebe6d86dcb598d75
refs/heads/master
2020-04-15T16:43:37.291843
2016-09-09T05:44:14
2016-09-09T05:44:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
706
java
/* * Copyright (c) 2009-2016 SHENZHEN Eternal Dynasty Technology Co.,Ltd. * All rights reserved. * * This file contains valuable properties of SHENZHEN Eternal Dynasty * Technology Co.,Ltd., embodying substantial creative efforts and * confidential information, ideas and expressions. No part of this * file may be reproduced or distributed in any form or by any means, * or stored in a data base or a retrieval system, without the prior * written permission of SHENZHEN Eternal Dynasty Technology Co.,Ltd. * */ package cn.com.dyninfo.o2o.old.service; import cn.com.dyninfo.o2o.old.service.IBaseService; public interface SizeService extends IBaseService{ }
[ "leo.cai@9c87f486-7f2d-4350-b948-b2028470fdc6" ]
leo.cai@9c87f486-7f2d-4350-b948-b2028470fdc6
41074cac0094937f7326d943b3716892a92d3fa7
24a3912a837967f26ce0b9a74c1bdd9d4bcc691d
/diemvu-roadrage/src/model/Taxi.java
6a355c9c3adcea737f5e3ff88030d2d9e8222e97
[]
no_license
diemvu/Programming-Practicum
56c9bfeea84b3a865f6df125f232068af7edce7c
bbf3caf6dac8cd94cb6024a8bd86e532a7c4c843
refs/heads/master
2022-12-20T16:15:33.050655
2020-10-22T16:42:51
2020-10-22T16:42:51
168,897,190
0
1
null
null
null
null
UTF-8
Java
false
false
3,469
java
/* * TCSS 305 - Road Rage */ package model; import java.util.Map; /** * * @author diemvu * @version 10/26/2018 */ public class Taxi extends AbstractVehicle { /** * MY_DEATH_TIME is how many clock circle before car revive. */ private static final int MY_DEATH_TIME = 15; /** * myClockCircle how many clock circle a taxi has to wait in front of * red cross walk light until it can move through through cross walk. */ private static final int CLOCK_CIRCLE = 3; /** * myClockCircle how many clock circle a taxi has wait in front of * red cross walk light. */ private short myClockCircle; /** * * @param theX x coordinate of vehicle. * @param theY y coordinate of vehicle. * @param theDirection direction the vehicle is facing. */ public Taxi(final int theX, final int theY, final Direction theDirection) { super(theX, theY, theDirection, MY_DEATH_TIME); myClockCircle = 0; } @Override public boolean canPass(final Terrain theTerrain, final Light theLight) { boolean canPass = false; if (theTerrain == Terrain.STREET) { canPass = true; } else if (theTerrain == Terrain.LIGHT && (theLight == Light.GREEN || theLight == Light.YELLOW)) { canPass = true; } else { canPass = canPassCrossWalk(theTerrain, theLight); } return canPass; } /** * * @param theTerrain the Terrain in front of vehicle * @param theLight the light ( green, red, yellow) in front of vehicle * @return if a vehicle can move forward */ private boolean canPassCrossWalk(final Terrain theTerrain, final Light theLight) { boolean canPass = false; if (theTerrain == Terrain.CROSSWALK && theLight == Light.GREEN) { myClockCircle = 0; canPass = true; } if (theTerrain == Terrain.CROSSWALK && theLight == Light.YELLOW) { canPass = true; } if (theTerrain == Terrain.CROSSWALK && theLight == Light.RED) { if (myClockCircle == CLOCK_CIRCLE) { myClockCircle = 0; return true; } else { myClockCircle++; } } return canPass; } @Override public Direction chooseDirection(final Map<Direction, Terrain> theNeighbors) { final Direction chosenDirection; if (theNeighbors.get(getDirection()) == Terrain.CROSSWALK || theNeighbors.get(getDirection()) == Terrain.STREET || theNeighbors.get(getDirection()) == Terrain.LIGHT) { chosenDirection = getDirection(); } else if (theNeighbors.get(getDirection().left()) == Terrain.CROSSWALK || theNeighbors.get(getDirection().left()) == Terrain.STREET || theNeighbors.get(getDirection().left()) == Terrain.LIGHT) { chosenDirection = getDirection().left(); } else if (theNeighbors.get(getDirection().right()) == Terrain.CROSSWALK || theNeighbors.get(getDirection().right()) == Terrain.STREET || theNeighbors.get(getDirection().right()) == Terrain.LIGHT) { chosenDirection = getDirection().right(); } else { chosenDirection = getDirection().reverse(); } return chosenDirection; } }
ac11d8d7c5fa448fd965bc572701326cd24d3498
cbe50dfe215fb08c204e087c4a6c967f30c77bb2
/ConnectionFactory.java
1ce8e3cdd2cb70aab8083a1afd3f63048143df0b
[]
no_license
divyapothuru/Jdbccustomer
91915fdf9675581796c5ab48b33e7ccceb485071
e6c4ca55873ddaba9a74af60de0b9e4d5e799f25
refs/heads/main
2023-01-07T20:26:37.060563
2020-11-11T17:39:50
2020-11-11T17:39:50
311,378,138
0
0
null
null
null
null
UTF-8
Java
false
false
1,198
java
package connection; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream.GetField; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class ConnectionFactory { private static Connection conn; private ConnectionFactory() {} public static Connection getConnection() { InputStream is = ConnectionFactory.class .getClassLoader() .getResourceAsStream("db.properties"); Properties properties = new Properties(); try { properties.load(is); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } String driver = properties.getProperty("db.driver"); String url = properties.getProperty("db.url"); String username = properties.getProperty("db.username"); String password = properties.getProperty("db.password"); try { Class.forName(driver); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { conn = DriverManager.getConnection(url, username, password); } catch (SQLException e) { e.printStackTrace(); } return conn; } }
41d8592ca5a3f062883964fc30fa5b66ee415cf7
7d01c4cf09caf87704f9ff8a711887a102caaf43
/src/main/java/cn/weforward/gateway/plugin/AccessLoaderAware.java
0f87a23028720d6914299882f08bafc78eb34da4
[ "MIT" ]
permissive
weforward/weforward-gateway
033e36772ada4e8c3016b0cf127083cd553a1a7f
60b40b8096428e28a3e640ee6c41d0a2cdd8b9dd
refs/heads/main
2023-06-11T02:49:44.936127
2021-07-05T10:18:35
2021-07-05T10:18:35
303,877,583
0
0
null
null
null
null
UTF-8
Java
false
false
1,455
java
/** * Copyright (c) 2019,2020 honintech * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ package cn.weforward.gateway.plugin; import cn.weforward.gateway.AccessLoaderExt; /** * 插件需要依赖<code>AccessLoader</code>时,可实现此接口 * * @author zhangpengji * */ public interface AccessLoaderAware extends Aware { /** * 在加载插件时调用 * * @param loader */ void setAccessLoader(AccessLoaderExt loader); }
4633121f077ed9e21ca3c23a1d5be46b8bdb4b5b
d980b7ff701ddad4dc825e5de4500457466d1d43
/app/src/main/java/com/example/cloudmusic/SongList.java
ce18c8c88efba3a254e25767f4ee40f5cea00e54
[]
no_license
ccaong/ccaong.github.io
d3bdbb5928ec54df0730624445070960bc022a8b
665c0912c12e871d58060822244b20c4df64fb1c
refs/heads/master
2020-06-02T19:15:19.932092
2017-07-04T07:14:04
2017-07-04T07:14:04
94,103,791
2
0
null
null
null
null
UTF-8
Java
false
false
3,217
java
package com.example.cloudmusic; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; import java.util.List; /** * Created by 聪 on 2017/6/27. */ public class SongList extends AppCompatActivity { private ListView listView; private List<Music> songList; private TextView tv_top; private ImageButton img_back; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.songlist); ActionBar actionBar = getSupportActionBar(); actionBar.hide(); tv_top = (TextView) findViewById(R.id.tv_top); img_back = (ImageButton) findViewById(R.id.img_back); tv_top.setText("我的收藏"); img_back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(SongList.this,MainActivity.class); startActivity(intent); } }); //listView listView = (ListView) findViewById(R.id.songlist); songList = new ArrayList<>(); Music music = new Music(); songList.add(music); //适配器 MyAdapter adapter = new MyAdapter(); //适配器注入 listView.setAdapter(adapter); listView.setAdapter(adapter); //listview 的点击事件 listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //启动活动 Intent intent =new Intent(SongList.this,MusicPlayer.class); intent.putExtra("pos",position); startActivity(intent); } }); } class MyAdapter extends BaseAdapter { @Override public int getCount() { return songList.size(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if(convertView == null){ convertView = LayoutInflater.from(SongList.this).inflate(R.layout.item_music,null); } Music music = songList.get(position); TextView tv_name = (TextView) convertView.findViewById(R.id.tv_name); TextView tv_artist = (TextView) convertView.findViewById(R.id.tv_artist); tv_name.setText(music.getName()); tv_artist.setText(music.getArtist()); return convertView; } } }
bd687b63d4b92e16f6cf3bc09b5d850ec81672e5
3d020eab83e75ee9638b00aebdeba249a337e14f
/src/main/java/com/giridhari/preachingassistant/rest/model/followup/FollowUpDetailRequestEntity.java
caf6331c6c264c53a7f82fe067747316bea2d549
[]
no_license
rtnpro/PreachingAssistantModels
3754d3094d7391fad9df444ceec0144de74fdb03
02dab739bd188a76c568efe86e8ad12cb40d0145
refs/heads/master
2021-01-02T21:10:40.066155
2018-07-27T21:23:03
2018-07-27T21:23:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,881
java
package com.giridhari.preachingassistant.rest.model.followup; import java.util.Date; import com.giridhari.preachingassistant.model.Response; import com.giridhari.preachingassistant.rest.model.RequestEntity; public class FollowUpDetailRequestEntity extends RequestEntity{ private Long id; private Long followupForSessionId; private Long volunteerId; private Long attendeeId; private Long programId; private Response response; private String comment; private Integer rating; private Date timestamp; private Integer taskStatus; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getVolunteerId() { return volunteerId; } public void setVolunteerId(Long volunteerId) { this.volunteerId = volunteerId; } public Long getAttendeeId() { return attendeeId; } public void setAttendeeId(Long attendeeId) { this.attendeeId = attendeeId; } public Long getProgramId() { return programId; } public void setProgramId(Long programId) { this.programId = programId; } public Response getResponse() { return response; } public void setResponse(Response response) { this.response = response; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public Integer getRating() { return rating; } public void setRating(Integer rating) { this.rating = rating; } public Date getTimestamp() { return timestamp; } public void setTimestamp(Date timestamp) { this.timestamp = timestamp; } public Integer getTaskStatus() { return taskStatus; } public void setTaskStatus(Integer taskStatus) { this.taskStatus = taskStatus; } public Long getFollowupForSessionId() { return followupForSessionId; } public void setFollowupForSessionId(Long followupForSessionId) { this.followupForSessionId = followupForSessionId; } }
5cc9e0c70187657fd7030f4b2bd5f283493fd3ba
f7fbc015359f7e2a7bae421918636b608ea4cef6
/base-one/tags/hsqldb_1_7_2_ALPHA_P/src/org/hsqldb/test/TestSubQueriesInPreparedStatements.java
1ec4824075915b2a143c80d78d4e3b676261cb26
[]
no_license
svn2github/hsqldb
cdb363112cbdb9924c816811577586f0bf8aba90
52c703b4d54483899d834b1c23c1de7173558458
refs/heads/master
2023-09-03T10:33:34.963710
2019-01-18T23:07:40
2019-01-18T23:07:40
155,365,089
0
0
null
null
null
null
UTF-8
Java
false
false
4,673
java
/* Copyright (c) 2001-2002, The HSQL Development Group * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the HSQL Development Group nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * TestSubQueriesInPreparedStatements.java * * Created on July 9, 2003, 4:03 PM */ package org.hsqldb.test; import java.sql.*; /** * * @author campbell */ public class TestSubQueriesInPreparedStatements { public static void main(String[] args) throws Exception { test(); } public static void test() throws Exception { Connection conn; Statement stmnt; PreparedStatement pstmnt; Driver driver; driver = (Driver) Class.forName("org.hsqldb.jdbcDriver").newInstance(); DriverManager.registerDriver(driver); conn = DriverManager.getConnection("jdbc:hsqldb:mem:test", "sa", ""); stmnt = conn.createStatement(); stmnt.executeUpdate("drop table t if exists"); stmnt.executeUpdate("create table t(i decimal)"); pstmnt = conn.prepareStatement("insert into t values(?)"); for (int i = 0; i < 100; i++) { pstmnt.setInt(1, i); pstmnt.executeUpdate(); } pstmnt = conn.prepareStatement( "select * from (select * from t where i < ?)"); System.out.println("Expecting: 0..3"); pstmnt.setInt(1, 4); ResultSet rs = pstmnt.executeQuery(); while (rs.next()) { System.out.println(rs.getInt(1)); } System.out.println("Expecting: 0..4"); pstmnt.setInt(1, 5); rs = pstmnt.executeQuery(); while (rs.next()) { System.out.println(rs.getInt(1)); } pstmnt = conn.prepareStatement( "select sum(i) from (select i from t where i between ? and ?)"); System.out.println("Expecting: 9"); pstmnt.setInt(1, 4); pstmnt.setInt(2, 5); rs = pstmnt.executeQuery(); while (rs.next()) { System.out.println(rs.getInt(1)); } System.out.println("Expecting: 15"); pstmnt.setInt(2, 6); rs = pstmnt.executeQuery(); while (rs.next()) { System.out.println(rs.getInt(1)); } pstmnt = conn.prepareStatement( "select * from (select i as c1 from t where i < ?) a, (select i as c2 from t where i < ?) b"); System.out.println("Expecting: (0,0)"); pstmnt.setInt(1, 1); pstmnt.setInt(2, 1); rs = pstmnt.executeQuery(); while (rs.next()) { System.out.println("(" + rs.getInt(1) + "," + rs.getInt(2) + ")"); } System.out.println("Expecting: ((0,0), (0,1), (1,0), (1,1)"); pstmnt.setInt(1, 2); pstmnt.setInt(2, 2); rs = pstmnt.executeQuery(); while (rs.next()) { System.out.println("(" + rs.getInt(1) + "," + rs.getInt(2) + ")"); } System.out.println("Expecting: ((0,0) .. (3,3)"); pstmnt.setInt(1, 4); pstmnt.setInt(2, 4); rs = pstmnt.executeQuery(); while (rs.next()) { System.out.println("(" + rs.getInt(1) + "," + rs.getInt(2) + ")"); } } }
[ "(no author)@7c7dc5f5-a22d-0410-a3af-b41755a11667" ]
(no author)@7c7dc5f5-a22d-0410-a3af-b41755a11667
8d1fe7112bb8586490b19c02151b3880c9136248
ae4ecf7799b97330736a398d5da41e7e6dc53876
/src/xeus/jcl/AbstractClassLoader.java
cabd715878380e8bba4c062defa879437f352392
[]
no_license
witwall/jcl
1111a11b8a26835b1d90047f60ae51d5f8cd921a
d01a794b9e61944e8db2f9e4929079154a9de48b
refs/heads/master
2021-01-23T06:58:59.818214
2013-02-05T09:34:55
2013-02-05T09:34:55
7,931,567
0
1
null
null
null
null
UTF-8
Java
false
false
8,567
java
/** * JCL (Jar Class Loader) * * Copyright (C) 2009 Xeus Technologies * * This file is part of Jar Class Loader (JCL). * Jar Class Loader (JCL) is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JarClassLoader is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with JCL. If not, see <http://www.gnu.org/licenses/>. * * @author Kamran Zafar * * Contact Info: * Email: [email protected] * Web: http://xeustech.blogspot.com */ package xeus.jcl; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; /*import org.apache.log4j.Logger;*/ import xeus.jcl.exception.ResourceNotFoundException; import xeus.jcl.loader.Loader; /** * Abstract class loader that can load classes from different resources * * @author Kamran Zafar * */ /*@SuppressWarnings("unchecked")*/ public abstract class AbstractClassLoader extends ClassLoader { protected final List/*<Loader>*/ loaders = new ArrayList/*<Loader>*/(); private final Loader systemLoader = new SystemLoader(); private final Loader parentLoader = new ParentLoader(); private final Loader currentLoader = new CurrentLoader(); /** * No arguments constructor */ public AbstractClassLoader() { loaders.add( systemLoader ); loaders.add( parentLoader ); loaders.add( currentLoader ); } public void addLoader(Loader loader) { loaders.add( loader ); } /** * Override loadClass * * @see java.lang.ClassLoader#loadClass(java.lang.String) */ /* @Override*/ public Class loadClass(String className) throws ClassNotFoundException { return ( loadClass( className, true ) ); } /** * Overrides the loadClass method to load classes from other resources, * JarClassLoader is the only subclass in this project that loads classes * from jar files * * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean) */ /* @Override*/ public Class loadClass(String className, boolean resolveIt) throws ClassNotFoundException { Collections.sort( loaders ); Class clazz = null; /* for( Loader l : loaders ) {*/ for(int i=0;i<loaders.size();i++) { Loader l=(Loader) loaders.get(i); if( l.isEnabled() ) { clazz = l.load( className, resolveIt ); if( clazz != null ) break; } } if( clazz == null ) return getParent().loadClass(className); //throw new ClassNotFoundException( className ); return clazz; } /** * Overrides the getResourceAsStream method to load non-class resources from * other sources, JarClassLoader is the only subclass in this project that * loads non-class resources from jar files * * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String) */ /* @Override*/ public InputStream getResourceAsStream(String name) { if(name.startsWith("/")) name=name.substring(1); Collections.sort( loaders ); InputStream is = null; /* for( Loader l : loaders ) {*/ for(int i=0;i<loaders.size();i++) { Loader l=(Loader) loaders.get(i); if( l.isEnabled() ) { is = l.loadResource( name ); if( is != null ) break; } } if( is == null ) return getParent().getResourceAsStream(name); /* if( is == null ) throw new ResourceNotFoundException( "Resource " + name + " not found." );*/ return is; } /** * System class loader * */ class SystemLoader extends Loader { // private final Logger logger = Logger.getLogger( SystemLoader.class ); public SystemLoader() { order = 4; enabled = Configuration.isSystemLoaderEnabled(); } // @Override public Class load(String className, boolean resolveIt) { Class result; try { result = findSystemClass( className ); } catch (ClassNotFoundException e) { return null; } // if( logger.isTraceEnabled() ) // logger.trace( "Returning system class " + className ); return result; } // @Override public InputStream loadResource(String name) { InputStream is = getSystemResourceAsStream( name ); if( is != null ) { // if( logger.isTraceEnabled() ) // logger.trace( "Returning system resource " + name ); return is; } return null; } public int compareTo(Object o) { // TODO Auto-generated method stub // return 0; return order - ((Loader)o).getOrder(); } } /** * Parent class loader * */ class ParentLoader extends Loader { // private final Logger logger = Logger.getLogger( ParentLoader.class ); public ParentLoader() { order = 3; enabled = Configuration.isParentLoaderEnabled(); } // @Override public Class load(String className, boolean resolveIt) { Class result; try { result = getParent().loadClass( className ); } catch (ClassNotFoundException e) { return null; } // if( logger.isTraceEnabled() ) // logger.trace( "Returning class " + className + " loaded with parent classloader" ); return result; } // @Override public InputStream loadResource(String name) { InputStream is = getParent().getResourceAsStream( name ); if( is != null ) { // if( logger.isTraceEnabled() ) // logger.trace( "Returning resource " + name + " loaded with parent classloader" ); return is; } return null; } public int compareTo(Object o) { // TODO Auto-generated method stub return order - ((Loader)o).getOrder(); } } /** * Current class loader * */ class CurrentLoader extends Loader { // private final Logger logger = Logger.getLogger( CurrentLoader.class ); public CurrentLoader() { order = 2; enabled = Configuration.isCurrentLoaderEnabled(); } // @Override public Class load(String className, boolean resolveIt) { Class result; try { result = getClass().getClassLoader().loadClass( className ); } catch (ClassNotFoundException e) { return null; } // if( logger.isTraceEnabled() ) // logger.trace( "Returning class " + className + " loaded with current classloader" ); return result; } // @Override public InputStream loadResource(String name) { InputStream is = getClass().getClassLoader().getResourceAsStream( name ); if( is != null ) { // if( logger.isTraceEnabled() ) // logger.trace( "Returning resource " + name + " loaded with current classloader" ); return is; } return null; } public int compareTo(Object o) { // TODO Auto-generated method stub return order - ((Loader)o).getOrder(); } } public Loader getSystemLoader() { return systemLoader; } public Loader getParentLoader() { return parentLoader; } public Loader getCurrentLoader() { return currentLoader; } }
90908407931a6b8e21ff4f751c779ca74a4a1712
ab1e43f11297e2db5d2547ce64877928f896c5af
/src/main/java/com/thoughtworks/AnswerUtils.java
15346130a1465b332285cee3a22795a4bc72d5db
[]
no_license
HXgrowns/java_practice_basic-2020-2-26-6-31-16-14
7322fc4bf553ce337c9db3f4ce24e036fc59762f
3c33e5af8029d44bcd382851971bbb45b4bd2071
refs/heads/master
2021-01-26T20:49:23.344070
2020-03-02T13:15:54
2020-03-02T13:15:54
243,464,231
0
0
null
2020-02-27T08:05:33
2020-02-27T08:05:32
null
UTF-8
Java
false
false
2,320
java
package com.thoughtworks; import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class AnswerUtils { private static final int MAX_TIMES = 6; public static Answer getAnswer() { String answer = ""; FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream("src/main/resources/answer.txt"); Scanner scanner = new Scanner(fileInputStream); if (scanner.hasNext()) { String answerString = scanner.nextLine(); checkDataFormat(answerString); answer = answerString; } } catch (Exception e) { answer = randomAnswer(); } finally { try { if (fileInputStream != null) { fileInputStream.close(); } } catch (IOException e) { e.printStackTrace(); } } return new Answer(answer, MAX_TIMES); } private static String randomAnswer() { List<Integer> numbers = new ArrayList<>(); for (int i = 0; i < 10; i++) { numbers.add(i); } Collections.shuffle(numbers); numbers = numbers.subList(0, 4); StringBuilder answer = new StringBuilder(); for (Integer number : numbers) { answer.append(number); } return answer.toString(); } public static void checkDataFormat(String data) throws ErrorInputException { if (data == null || data.length() != 4) { throw new ErrorInputException(data); } int[] counts = calculateCounts(data); if (counts == null) { throw new ErrorInputException(data); } for (int count : counts) { if (count > 1) { throw new ErrorInputException(data); } } } public static int[] calculateCounts(String data) { int[] counts = new int[10]; for (int i = 0; i < data.length(); i++) { char charAt = data.charAt(i); if (charAt < '0' || charAt > '9') { return null; } counts[charAt - '0']++; } return counts; } }
6474bc80b0d9f8094052266f7c1199a550731a7c
87321ee11cb82ebfc60253a895f45479b88940cc
/flink/src/main/java/com/dgg/flink/FlinkDemo6.java
72297b44f3c2b98b743adac6a2098cf397d1ff6e
[]
no_license
ymjrchx/myProject
a1675b848e1e7fbec98374a87823b7c1c76a111f
284cd0355597607bf002fb066100c6a87a4d750a
refs/heads/master
2022-07-09T16:39:50.990238
2020-02-14T01:52:46
2020-02-14T01:52:46
220,406,157
0
0
null
2022-06-21T02:11:42
2019-11-08T06:59:16
Python
UTF-8
Java
false
false
1,708
java
package com.dgg.flink; import com.dgg.Bean.DggOrfInfo; import com.dgg.config.RedisConfig; import com.dgg.util.FlinkUtil; import org.apache.commons.lang.StringUtils; import org.apache.flink.api.common.functions.FilterFunction; import org.apache.flink.api.common.serialization.SimpleStringSchema; import org.apache.flink.streaming.api.datastream.DataStream; import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer011; import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumerBase; /** * @Classname FlinkDemo6 * @Description 侧输出 * @Date 2019/5/9 14:58 * @Created by dgg-yanshun */ public class FlinkDemo6 { public static void main(String[] args) throws Exception { StreamExecutionEnvironment env = FlinkUtil.getStreamExecutionEnvironment(); FlinkKafkaConsumer011<String> consumer = new FlinkKafkaConsumer011<>("ibwb_db_iboss_orf", new SimpleStringSchema(), FlinkUtil.getProperties()); FlinkKafkaConsumerBase<String> base = consumer.setStartFromEarliest(); SingleOutputStreamOperator<DggOrfInfo> process = env.addSource(base) .filter((FilterFunction<String>) line -> line.matches("\\{.+\\}")).process(new DggSplitterInfo()); DataStream<DggOrfInfo> sideOutput = process.getSideOutput(DggSplitterInfo.rejectedOrfTag); // .filter((FilterFunction<DggOrfInfo>) dggOrfInfo -> StringUtils.isNotEmpty(dggOrfInfo.getDataDate())); // process.print(); sideOutput.print(); env.execute(); } }
d754917987963fbfd44d88d1b7da5f8d0262befe
1935ba11daf79ce7293f2d880de08a2986072f3c
/src/main/java/org/mozilla/javascript/JavaAdapter.java
48019bad8c5efaf37a98e187de8172d15400a6b3
[ "CC0-1.0" ]
permissive
TechPizzaDev/AC-1.7.3
9c61a068863b08c314859244919f6f5183f84954
68205e7079c09ce8944c338348481a311dfff6bb
refs/heads/main
2023-07-04T14:52:35.125995
2021-08-04T17:35:39
2021-08-04T17:35:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
47,079
java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.javascript; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.security.CodeSource; import java.security.ProtectionDomain; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Map; import org.mozilla.classfile.ByteCode; import org.mozilla.classfile.ClassFileWriter; public final class JavaAdapter implements IdFunctionCall { /** * Provides a key with which to distinguish previously generated * adapter classes stored in a hash table. */ static class JavaAdapterSignature { Class<?> superClass; Class<?>[] interfaces; ObjToIntMap names; JavaAdapterSignature(Class<?> superClass, Class<?>[] interfaces, ObjToIntMap names) { this.superClass = superClass; this.interfaces = interfaces; this.names = names; } @Override public boolean equals(Object obj) { if (!(obj instanceof JavaAdapterSignature)) return false; JavaAdapterSignature sig = (JavaAdapterSignature) obj; if (superClass != sig.superClass) return false; if (interfaces != sig.interfaces) { if (interfaces.length != sig.interfaces.length) return false; for (int i = 0; i < interfaces.length; i++) if (interfaces[i] != sig.interfaces[i]) return false; } if (names.size() != sig.names.size()) return false; ObjToIntMap.Iterator iter = new ObjToIntMap.Iterator(names); for (iter.start(); !iter.done(); iter.next()) { String name = (String) iter.getKey(); int arity = iter.getValue(); if (arity != sig.names.get(name, arity + 1)) return false; } return true; } @Override public int hashCode() { return (superClass.hashCode() + Arrays.hashCode(interfaces)) ^ names.size(); } } public static void init(Context cx, Scriptable scope, boolean sealed) { JavaAdapter obj = new JavaAdapter(); IdFunctionObject ctor = new IdFunctionObject(obj, FTAG, Id_JavaAdapter, "JavaAdapter", 1, scope); ctor.markAsConstructor(null); if (sealed) { ctor.sealObject(); } ctor.exportAsScopeProperty(); } @Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (f.hasTag(FTAG)) { if (f.methodId() == Id_JavaAdapter) { return js_createAdapter(cx, scope, args); } } throw f.unknown(); } public static Object convertResult(Object result, Class<?> c) { if (result == Undefined.instance && (c != ScriptRuntime.ObjectClass && c != ScriptRuntime.StringClass)) { // Avoid an error for an undefined value; return null instead. return null; } return Context.jsToJava(result, c); } public static Scriptable createAdapterWrapper(Scriptable obj, Object adapter) { Scriptable scope = ScriptableObject.getTopLevelScope(obj); NativeJavaObject res = new NativeJavaObject(scope, adapter, null, true); res.setPrototype(obj); return res; } public static Object getAdapterSelf(Class<?> adapterClass, Object adapter) throws NoSuchFieldException, IllegalAccessException { Field self = adapterClass.getDeclaredField("self"); return self.get(adapter); } static Object js_createAdapter(Context cx, Scriptable scope, Object[] args) { int N = args.length; if (N == 0) { throw ScriptRuntime.typeError0("msg.adapter.zero.args"); } // Expected arguments: // Any number of NativeJavaClass objects representing the super-class // and/or interfaces to implement, followed by one NativeObject providing // the implementation, followed by any number of arguments to pass on // to the (super-class) constructor. int classCount; for (classCount = 0; classCount < N - 1; classCount++) { Object arg = args[classCount]; // We explicitly test for NativeObject here since checking for // instanceof ScriptableObject or !(instanceof NativeJavaClass) // would fail for a Java class that isn't found in the class path // as NativeJavaPackage extends ScriptableObject. if (arg instanceof NativeObject) { break; } if (!(arg instanceof NativeJavaClass)) { throw ScriptRuntime.typeError2("msg.not.java.class.arg", String.valueOf(classCount), ScriptRuntime.toString(arg)); } } Class<?> superClass = null; Class<?>[] intfs = new Class[classCount]; int interfaceCount = 0; for (int i = 0; i < classCount; ++i) { Class<?> c = ((NativeJavaClass) args[i]).getClassObject(); if (!c.isInterface()) { if (superClass != null) { throw ScriptRuntime.typeError2("msg.only.one.super", superClass.getName(), c.getName()); } superClass = c; } else { intfs[interfaceCount++] = c; } } if (superClass == null) { superClass = ScriptRuntime.ObjectClass; } Class<?>[] interfaces = new Class[interfaceCount]; System.arraycopy(intfs, 0, interfaces, 0, interfaceCount); // next argument is implementation, must be scriptable Scriptable obj = ScriptableObject.ensureScriptable(args[classCount]); Class<?> adapterClass = getAdapterClass(scope, superClass, interfaces, obj); Object adapter; int argsCount = N - classCount - 1; try { if (argsCount > 0) { // Arguments contain parameters for super-class constructor. // We use the generic Java method lookup logic to find and // invoke the right constructor. Object[] ctorArgs = new Object[argsCount + 2]; ctorArgs[0] = obj; ctorArgs[1] = cx.getFactory(); System.arraycopy(args, classCount + 1, ctorArgs, 2, argsCount); // TODO: cache class wrapper? NativeJavaClass classWrapper = new NativeJavaClass(scope, adapterClass, true); NativeJavaMethod ctors = classWrapper.members.ctors; int index = ctors.findCachedFunction(cx, ctorArgs); if (index < 0) { String sig = NativeJavaMethod.scriptSignature(args); throw Context.reportRuntimeError2( "msg.no.java.ctor", adapterClass.getName(), sig); } // Found the constructor, so try invoking it. adapter = NativeJavaClass.constructInternal(ctorArgs, ctors.methods[index]); } else { Class<?>[] ctorParms = { ScriptRuntime.ScriptableClass, ScriptRuntime.ContextFactoryClass }; Object[] ctorArgs = {obj, cx.getFactory()}; adapter = adapterClass.getConstructor(ctorParms).newInstance(ctorArgs); } Object self = getAdapterSelf(adapterClass, adapter); // Return unwrapped JavaAdapter if it implements Scriptable if (self instanceof Wrapper) { Object unwrapped = ((Wrapper) self).unwrap(); if (unwrapped instanceof Scriptable) { if (unwrapped instanceof ScriptableObject) { ScriptRuntime.setObjectProtoAndParent( (ScriptableObject) unwrapped, scope); } return unwrapped; } } return self; } catch (Exception ex) { throw Context.throwAsScriptRuntimeEx(ex); } } // Needed by NativeJavaObject serializer public static void writeAdapterObject(Object javaObject, ObjectOutputStream out) throws IOException { Class<?> cl = javaObject.getClass(); out.writeObject(cl.getSuperclass().getName()); Class<?>[] interfaces = cl.getInterfaces(); String[] interfaceNames = new String[interfaces.length]; for (int i = 0; i < interfaces.length; i++) interfaceNames[i] = interfaces[i].getName(); out.writeObject(interfaceNames); try { Object delegee = cl.getField("delegee").get(javaObject); out.writeObject(delegee); return; } catch (IllegalAccessException e) { } catch (NoSuchFieldException e) { } throw new IOException(); } // Needed by NativeJavaObject de-serializer public static Object readAdapterObject(Scriptable self, ObjectInputStream in) throws IOException, ClassNotFoundException { ContextFactory factory; Context cx = Context.getCurrentContext(); if (cx != null) { factory = cx.getFactory(); } else { factory = null; } Class<?> superClass = Class.forName((String) in.readObject()); String[] interfaceNames = (String[]) in.readObject(); Class<?>[] interfaces = new Class[interfaceNames.length]; for (int i = 0; i < interfaceNames.length; i++) interfaces[i] = Class.forName(interfaceNames[i]); Scriptable delegee = (Scriptable) in.readObject(); Class<?> adapterClass = getAdapterClass(self, superClass, interfaces, delegee); Class<?>[] ctorParms = { ScriptRuntime.ContextFactoryClass, ScriptRuntime.ScriptableClass, ScriptRuntime.ScriptableClass }; Object[] ctorArgs = {factory, delegee, self}; try { return adapterClass.getConstructor(ctorParms).newInstance(ctorArgs); } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } catch (NoSuchMethodException e) { } throw new ClassNotFoundException("adapter"); } private static ObjToIntMap getObjectFunctionNames(Scriptable obj) { Object[] ids = ScriptableObject.getPropertyIds(obj); ObjToIntMap map = new ObjToIntMap(ids.length); for (int i = 0; i != ids.length; ++i) { if (!(ids[i] instanceof String)) continue; String id = (String) ids[i]; Object value = ScriptableObject.getProperty(obj, id); if (value instanceof Function) { Function f = (Function) value; int length = ScriptRuntime.toInt32( ScriptableObject.getProperty(f, "length")); if (length < 0) { length = 0; } map.put(id, length); } } return map; } private static Class<?> getAdapterClass(Scriptable scope, Class<?> superClass, Class<?>[] interfaces, Scriptable obj) { ClassCache cache = ClassCache.get(scope); Map<JavaAdapterSignature, Class<?>> generated = cache.getInterfaceAdapterCacheMap(); ObjToIntMap names = getObjectFunctionNames(obj); JavaAdapterSignature sig; sig = new JavaAdapterSignature(superClass, interfaces, names); Class<?> adapterClass = generated.get(sig); if (adapterClass == null) { String adapterName = "adapter" + cache.newClassSerialNumber(); byte[] code = createAdapterCode(names, adapterName, superClass, interfaces, null); adapterClass = loadAdapterClass(adapterName, code); if (cache.isCachingEnabled()) { generated.put(sig, adapterClass); } } return adapterClass; } public static byte[] createAdapterCode(ObjToIntMap functionNames, String adapterName, Class<?> superClass, Class<?>[] interfaces, String scriptClassName) { ClassFileWriter cfw = new ClassFileWriter(adapterName, superClass.getName(), "<adapter>"); cfw.addField("factory", "Lorg/mozilla/javascript/ContextFactory;", (short) (ClassFileWriter.ACC_PUBLIC | ClassFileWriter.ACC_FINAL)); cfw.addField("delegee", "Lorg/mozilla/javascript/Scriptable;", (short) (ClassFileWriter.ACC_PUBLIC | ClassFileWriter.ACC_FINAL)); cfw.addField("self", "Lorg/mozilla/javascript/Scriptable;", (short) (ClassFileWriter.ACC_PUBLIC | ClassFileWriter.ACC_FINAL)); int interfacesCount = interfaces == null ? 0 : interfaces.length; for (int i = 0; i < interfacesCount; i++) { if (interfaces[i] != null) cfw.addInterface(interfaces[i].getName()); } String superName = superClass.getName().replace('.', '/'); Constructor<?>[] ctors = superClass.getDeclaredConstructors(); for (Constructor<?> ctor : ctors) { int mod = ctor.getModifiers(); if (Modifier.isPublic(mod) || Modifier.isProtected(mod)) { generateCtor(cfw, adapterName, superName, ctor); } } generateSerialCtor(cfw, adapterName, superName); if (scriptClassName != null) { generateEmptyCtor(cfw, adapterName, superName, scriptClassName); } ObjToIntMap generatedOverrides = new ObjToIntMap(); ObjToIntMap generatedMethods = new ObjToIntMap(); // generate methods to satisfy all specified interfaces. for (int i = 0; i < interfacesCount; i++) { Method[] methods = interfaces[i].getMethods(); for (int j = 0; j < methods.length; j++) { Method method = methods[j]; int mods = method.getModifiers(); if (Modifier.isStatic(mods) || Modifier.isFinal(mods) || method.isDefault()) { continue; } String methodName = method.getName(); Class<?>[] argTypes = method.getParameterTypes(); if (!functionNames.has(methodName)) { try { superClass.getMethod(methodName, argTypes); // The class we're extending implements this method and // the JavaScript object doesn't have an override. See // bug 61226. continue; } catch (NoSuchMethodException e) { // Not implemented by superclass; fall through } } // make sure to generate only one instance of a particular // method/signature. String methodSignature = getMethodSignature(method, argTypes); String methodKey = methodName + methodSignature; if (!generatedOverrides.has(methodKey)) { generateMethod(cfw, adapterName, methodName, argTypes, method.getReturnType(), true); generatedOverrides.put(methodKey, 0); generatedMethods.put(methodName, 0); } } } // Now, go through the superclass's methods, checking for abstract // methods or additional methods to override. // generate any additional overrides that the object might contain. Method[] methods = getOverridableMethods(superClass); for (int j = 0; j < methods.length; j++) { Method method = methods[j]; int mods = method.getModifiers(); // if a method is marked abstract, must implement it or the // resulting class won't be instantiable. otherwise, if the object // has a property of the same name, then an override is intended. boolean isAbstractMethod = Modifier.isAbstract(mods); String methodName = method.getName(); if (isAbstractMethod || functionNames.has(methodName)) { // make sure to generate only one instance of a particular // method/signature. Class<?>[] argTypes = method.getParameterTypes(); String methodSignature = getMethodSignature(method, argTypes); String methodKey = methodName + methodSignature; if (!generatedOverrides.has(methodKey)) { generateMethod(cfw, adapterName, methodName, argTypes, method.getReturnType(), true); generatedOverrides.put(methodKey, 0); generatedMethods.put(methodName, 0); // if a method was overridden, generate a "super$method" // which lets the delegate call the superclass' version. if (!isAbstractMethod) { generateSuper(cfw, adapterName, superName, methodName, methodSignature, argTypes, method.getReturnType()); } } } } // Generate Java methods for remaining properties that are not // overrides. ObjToIntMap.Iterator iter = new ObjToIntMap.Iterator(functionNames); for (iter.start(); !iter.done(); iter.next()) { String functionName = (String) iter.getKey(); if (generatedMethods.has(functionName)) continue; int length = iter.getValue(); Class<?>[] parms = new Class[length]; for (int k = 0; k < length; k++) parms[k] = ScriptRuntime.ObjectClass; generateMethod(cfw, adapterName, functionName, parms, ScriptRuntime.ObjectClass, false); } return cfw.toByteArray(); } static Method[] getOverridableMethods(Class<?> clazz) { ArrayList<Method> list = new ArrayList<Method>(); HashSet<String> skip = new HashSet<String>(); // Check superclasses before interfaces so we always choose // implemented methods over abstract ones, even if a subclass // re-implements an interface already implemented in a superclass // (e.g. java.util.ArrayList) for (Class<?> c = clazz; c != null; c = c.getSuperclass()) { appendOverridableMethods(c, list, skip); } for (Class<?> c = clazz; c != null; c = c.getSuperclass()) { for (Class<?> intf : c.getInterfaces()) appendOverridableMethods(intf, list, skip); } return list.toArray(new Method[list.size()]); } private static void appendOverridableMethods(Class<?> c, ArrayList<Method> list, HashSet<String> skip) { Method[] methods = c.getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { String methodKey = methods[i].getName() + getMethodSignature(methods[i], methods[i].getParameterTypes()); if (skip.contains(methodKey)) continue; // skip this method int mods = methods[i].getModifiers(); if (Modifier.isStatic(mods)) continue; if (Modifier.isFinal(mods)) { // Make sure we don't add a final method to the list // of overridable methods. skip.add(methodKey); continue; } if (Modifier.isPublic(mods) || Modifier.isProtected(mods)) { list.add(methods[i]); skip.add(methodKey); } } } static Class<?> loadAdapterClass(String className, byte[] classBytes) { Object staticDomain; Class<?> domainClass = SecurityController.getStaticSecurityDomainClass(); if (domainClass == CodeSource.class || domainClass == ProtectionDomain.class) { // use the calling script's security domain if available ProtectionDomain protectionDomain = SecurityUtilities.getScriptProtectionDomain(); if (protectionDomain == null) { protectionDomain = JavaAdapter.class.getProtectionDomain(); } if (domainClass == CodeSource.class) { staticDomain = protectionDomain == null ? null : protectionDomain.getCodeSource(); } else { staticDomain = protectionDomain; } } else { staticDomain = null; } GeneratedClassLoader loader = SecurityController.createLoader(null, staticDomain); Class<?> result = loader.defineClass(className, classBytes); loader.linkClass(result); return result; } public static Function getFunction(Scriptable obj, String functionName) { Object x = ScriptableObject.getProperty(obj, functionName); if (x == Scriptable.NOT_FOUND) { // This method used to swallow the exception from calling // an undefined method. People have come to depend on this // somewhat dubious behavior. It allows people to avoid // implementing listener methods that they don't care about, // for instance. return null; } if (!(x instanceof Function)) throw ScriptRuntime.notFunctionError(x, functionName); return (Function) x; } /** * Utility method which dynamically binds a Context to the current thread, * if none already exists. */ public static Object callMethod(ContextFactory factory, final Scriptable thisObj, final Function f, final Object[] args, final long argsToWrap) { if (f == null) { // See comments in getFunction return null; } if (factory == null) { factory = ContextFactory.getGlobal(); } final Scriptable scope = f.getParentScope(); if (argsToWrap == 0) { return Context.call(factory, f, scope, thisObj, args); } Context cx = Context.getCurrentContext(); if (cx != null) { return doCall(cx, scope, thisObj, f, args, argsToWrap); } return factory.call(cx2 -> doCall(cx2, scope, thisObj, f, args, argsToWrap)); } private static Object doCall(Context cx, Scriptable scope, Scriptable thisObj, Function f, Object[] args, long argsToWrap) { // Wrap the rest of objects for (int i = 0; i != args.length; ++i) { if (0 != (argsToWrap & (1 << i))) { Object arg = args[i]; if (!(arg instanceof Scriptable)) { args[i] = cx.getWrapFactory().wrap(cx, scope, arg, null); } } } return f.call(cx, scope, thisObj, args); } public static Scriptable runScript(final Script script) { return ContextFactory.getGlobal().call(cx -> { ScriptableObject global = ScriptRuntime.getGlobal(cx); script.exec(cx, global); return global; }); } private static void generateCtor(ClassFileWriter cfw, String adapterName, String superName, Constructor<?> superCtor) { short locals = 3; // this + factory + delegee Class<?>[] parameters = superCtor.getParameterTypes(); // Note that we swapped arguments in app-facing constructors to avoid // conflicting signatures with serial constructor defined below. if (parameters.length == 0) { cfw.startMethod("<init>", "(Lorg/mozilla/javascript/Scriptable;" + "Lorg/mozilla/javascript/ContextFactory;)V", ClassFileWriter.ACC_PUBLIC); // Invoke base class constructor cfw.add(ByteCode.ALOAD_0); // this cfw.addInvoke(ByteCode.INVOKESPECIAL, superName, "<init>", "()V"); } else { StringBuilder sig = new StringBuilder( "(Lorg/mozilla/javascript/Scriptable;" + "Lorg/mozilla/javascript/ContextFactory;"); int marker = sig.length(); // lets us reuse buffer for super signature for (Class<?> c : parameters) { appendTypeString(sig, c); } sig.append(")V"); cfw.startMethod("<init>", sig.toString(), ClassFileWriter.ACC_PUBLIC); // Invoke base class constructor cfw.add(ByteCode.ALOAD_0); // this short paramOffset = 3; for (Class<?> parameter : parameters) { paramOffset += generatePushParam(cfw, paramOffset, parameter); } locals = paramOffset; sig.delete(1, marker); cfw.addInvoke(ByteCode.INVOKESPECIAL, superName, "<init>", sig.toString()); } // Save parameter in instance variable "delegee" cfw.add(ByteCode.ALOAD_0); // this cfw.add(ByteCode.ALOAD_1); // first arg: Scriptable delegee cfw.add(ByteCode.PUTFIELD, adapterName, "delegee", "Lorg/mozilla/javascript/Scriptable;"); // Save parameter in instance variable "factory" cfw.add(ByteCode.ALOAD_0); // this cfw.add(ByteCode.ALOAD_2); // second arg: ContextFactory instance cfw.add(ByteCode.PUTFIELD, adapterName, "factory", "Lorg/mozilla/javascript/ContextFactory;"); cfw.add(ByteCode.ALOAD_0); // this for the following PUTFIELD for self // create a wrapper object to be used as "this" in method calls cfw.add(ByteCode.ALOAD_1); // the Scriptable delegee cfw.add(ByteCode.ALOAD_0); // this cfw.addInvoke(ByteCode.INVOKESTATIC, "org/mozilla/javascript/JavaAdapter", "createAdapterWrapper", "(Lorg/mozilla/javascript/Scriptable;" + "Ljava/lang/Object;" + ")Lorg/mozilla/javascript/Scriptable;"); cfw.add(ByteCode.PUTFIELD, adapterName, "self", "Lorg/mozilla/javascript/Scriptable;"); cfw.add(ByteCode.RETURN); cfw.stopMethod(locals); } private static void generateSerialCtor(ClassFileWriter cfw, String adapterName, String superName) { cfw.startMethod("<init>", "(Lorg/mozilla/javascript/ContextFactory;" + "Lorg/mozilla/javascript/Scriptable;" + "Lorg/mozilla/javascript/Scriptable;" + ")V", ClassFileWriter.ACC_PUBLIC); // Invoke base class constructor cfw.add(ByteCode.ALOAD_0); // this cfw.addInvoke(ByteCode.INVOKESPECIAL, superName, "<init>", "()V"); // Save parameter in instance variable "factory" cfw.add(ByteCode.ALOAD_0); // this cfw.add(ByteCode.ALOAD_1); // first arg: ContextFactory instance cfw.add(ByteCode.PUTFIELD, adapterName, "factory", "Lorg/mozilla/javascript/ContextFactory;"); // Save parameter in instance variable "delegee" cfw.add(ByteCode.ALOAD_0); // this cfw.add(ByteCode.ALOAD_2); // second arg: Scriptable delegee cfw.add(ByteCode.PUTFIELD, adapterName, "delegee", "Lorg/mozilla/javascript/Scriptable;"); // save self cfw.add(ByteCode.ALOAD_0); // this cfw.add(ByteCode.ALOAD_3); // third arg: Scriptable self cfw.add(ByteCode.PUTFIELD, adapterName, "self", "Lorg/mozilla/javascript/Scriptable;"); cfw.add(ByteCode.RETURN); cfw.stopMethod((short) 4); // 4: this + factory + delegee + self } private static void generateEmptyCtor(ClassFileWriter cfw, String adapterName, String superName, String scriptClassName) { cfw.startMethod("<init>", "()V", ClassFileWriter.ACC_PUBLIC); // Invoke base class constructor cfw.add(ByteCode.ALOAD_0); // this cfw.addInvoke(ByteCode.INVOKESPECIAL, superName, "<init>", "()V"); // Set factory to null to use current global when necessary cfw.add(ByteCode.ALOAD_0); cfw.add(ByteCode.ACONST_NULL); cfw.add(ByteCode.PUTFIELD, adapterName, "factory", "Lorg/mozilla/javascript/ContextFactory;"); // Load script class cfw.add(ByteCode.NEW, scriptClassName); cfw.add(ByteCode.DUP); cfw.addInvoke(ByteCode.INVOKESPECIAL, scriptClassName, "<init>", "()V"); // Run script and save resulting scope cfw.addInvoke(ByteCode.INVOKESTATIC, "org/mozilla/javascript/JavaAdapter", "runScript", "(Lorg/mozilla/javascript/Script;" + ")Lorg/mozilla/javascript/Scriptable;"); cfw.add(ByteCode.ASTORE_1); // Save the Scriptable in instance variable "delegee" cfw.add(ByteCode.ALOAD_0); // this cfw.add(ByteCode.ALOAD_1); // the Scriptable cfw.add(ByteCode.PUTFIELD, adapterName, "delegee", "Lorg/mozilla/javascript/Scriptable;"); cfw.add(ByteCode.ALOAD_0); // this for the following PUTFIELD for self // create a wrapper object to be used as "this" in method calls cfw.add(ByteCode.ALOAD_1); // the Scriptable cfw.add(ByteCode.ALOAD_0); // this cfw.addInvoke(ByteCode.INVOKESTATIC, "org/mozilla/javascript/JavaAdapter", "createAdapterWrapper", "(Lorg/mozilla/javascript/Scriptable;" + "Ljava/lang/Object;" + ")Lorg/mozilla/javascript/Scriptable;"); cfw.add(ByteCode.PUTFIELD, adapterName, "self", "Lorg/mozilla/javascript/Scriptable;"); cfw.add(ByteCode.RETURN); cfw.stopMethod((short) 2); // this + delegee } /** * Generates code to wrap Java arguments into Object[]. * Non-primitive Java types are left as-is pending conversion * in the helper method. Leaves the array object on the top of the stack. */ static void generatePushWrappedArgs(ClassFileWriter cfw, Class<?>[] argTypes, int arrayLength) { // push arguments cfw.addPush(arrayLength); cfw.add(ByteCode.ANEWARRAY, "java/lang/Object"); int paramOffset = 1; for (int i = 0; i != argTypes.length; ++i) { cfw.add(ByteCode.DUP); // duplicate array reference cfw.addPush(i); paramOffset += generateWrapArg(cfw, paramOffset, argTypes[i]); cfw.add(ByteCode.AASTORE); } } /** * Generates code to wrap Java argument into Object. * Non-primitive Java types are left unconverted pending conversion * in the helper method. Leaves the wrapper object on the top of the stack. */ private static int generateWrapArg(ClassFileWriter cfw, int paramOffset, Class<?> argType) { int size = 1; if (!argType.isPrimitive()) { cfw.add(ByteCode.ALOAD, paramOffset); } else if (argType == Boolean.TYPE) { // wrap boolean values with java.lang.Boolean. cfw.add(ByteCode.NEW, "java/lang/Boolean"); cfw.add(ByteCode.DUP); cfw.add(ByteCode.ILOAD, paramOffset); cfw.addInvoke(ByteCode.INVOKESPECIAL, "java/lang/Boolean", "<init>", "(Z)V"); } else if (argType == Character.TYPE) { // Create a string of length 1 using the character parameter. cfw.add(ByteCode.ILOAD, paramOffset); cfw.addInvoke(ByteCode.INVOKESTATIC, "java/lang/String", "valueOf", "(C)Ljava/lang/String;"); } else { // convert all numeric values to java.lang.Double. cfw.add(ByteCode.NEW, "java/lang/Double"); cfw.add(ByteCode.DUP); String typeName = argType.getName(); switch (typeName.charAt(0)) { case 'b': case 's': case 'i': // load an int value, convert to double. cfw.add(ByteCode.ILOAD, paramOffset); cfw.add(ByteCode.I2D); break; case 'l': // load a long, convert to double. cfw.add(ByteCode.LLOAD, paramOffset); cfw.add(ByteCode.L2D); size = 2; break; case 'f': // load a float, convert to double. cfw.add(ByteCode.FLOAD, paramOffset); cfw.add(ByteCode.F2D); break; case 'd': cfw.add(ByteCode.DLOAD, paramOffset); size = 2; break; } cfw.addInvoke(ByteCode.INVOKESPECIAL, "java/lang/Double", "<init>", "(D)V"); } return size; } /** * Generates code to convert a wrapped value type to a primitive type. * Handles unwrapping java.lang.Boolean, and java.lang.Number types. * Generates the appropriate RETURN bytecode. */ static void generateReturnResult(ClassFileWriter cfw, Class<?> retType, boolean callConvertResult) { // wrap boolean values with java.lang.Boolean, convert all other // primitive values to java.lang.Double. if (retType == Void.TYPE) { cfw.add(ByteCode.POP); cfw.add(ByteCode.RETURN); } else if (retType == Boolean.TYPE) { cfw.addInvoke(ByteCode.INVOKESTATIC, "org/mozilla/javascript/Context", "toBoolean", "(Ljava/lang/Object;)Z"); cfw.add(ByteCode.IRETURN); } else if (retType == Character.TYPE) { // characters are represented as strings in JavaScript. // return the first character. // first convert the value to a string if possible. cfw.addInvoke(ByteCode.INVOKESTATIC, "org/mozilla/javascript/Context", "toString", "(Ljava/lang/Object;)Ljava/lang/String;"); cfw.add(ByteCode.ICONST_0); cfw.addInvoke(ByteCode.INVOKEVIRTUAL, "java/lang/String", "charAt", "(I)C"); cfw.add(ByteCode.IRETURN); } else if (retType.isPrimitive()) { cfw.addInvoke(ByteCode.INVOKESTATIC, "org/mozilla/javascript/Context", "toNumber", "(Ljava/lang/Object;)D"); String typeName = retType.getName(); switch (typeName.charAt(0)) { case 'b': case 's': case 'i': cfw.add(ByteCode.D2I); cfw.add(ByteCode.IRETURN); break; case 'l': cfw.add(ByteCode.D2L); cfw.add(ByteCode.LRETURN); break; case 'f': cfw.add(ByteCode.D2F); cfw.add(ByteCode.FRETURN); break; case 'd': cfw.add(ByteCode.DRETURN); break; default: throw new RuntimeException("Unexpected return type " + retType); } } else { String retTypeStr = retType.getName(); if (callConvertResult) { cfw.addLoadConstant(retTypeStr); cfw.addInvoke(ByteCode.INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;"); cfw.addInvoke(ByteCode.INVOKESTATIC, "org/mozilla/javascript/JavaAdapter", "convertResult", "(Ljava/lang/Object;" + "Ljava/lang/Class;" + ")Ljava/lang/Object;"); } // Now cast to return type cfw.add(ByteCode.CHECKCAST, retTypeStr); cfw.add(ByteCode.ARETURN); } } private static void generateMethod(ClassFileWriter cfw, String genName, String methodName, Class<?>[] parms, Class<?> returnType, boolean convertResult) { StringBuilder sb = new StringBuilder(); int paramsEnd = appendMethodSignature(parms, returnType, sb); String methodSignature = sb.toString(); cfw.startMethod(methodName, methodSignature, ClassFileWriter.ACC_PUBLIC); // Prepare stack to call method // push factory cfw.add(ByteCode.ALOAD_0); cfw.add(ByteCode.GETFIELD, genName, "factory", "Lorg/mozilla/javascript/ContextFactory;"); // push self cfw.add(ByteCode.ALOAD_0); cfw.add(ByteCode.GETFIELD, genName, "self", "Lorg/mozilla/javascript/Scriptable;"); // push function cfw.add(ByteCode.ALOAD_0); cfw.add(ByteCode.GETFIELD, genName, "delegee", "Lorg/mozilla/javascript/Scriptable;"); cfw.addPush(methodName); cfw.addInvoke(ByteCode.INVOKESTATIC, "org/mozilla/javascript/JavaAdapter", "getFunction", "(Lorg/mozilla/javascript/Scriptable;" + "Ljava/lang/String;" + ")Lorg/mozilla/javascript/Function;"); // push arguments generatePushWrappedArgs(cfw, parms, parms.length); // push bits to indicate which parameters should be wrapped if (parms.length > 64) { // If it will be an issue, then passing a static boolean array // can be an option, but for now using simple bitmask throw Context.reportRuntimeError0( "JavaAdapter can not subclass methods with more then" + " 64 arguments."); } long convertionMask = 0; for (int i = 0; i != parms.length; ++i) { if (!parms[i].isPrimitive()) { convertionMask |= (1 << i); } } cfw.addPush(convertionMask); // go through utility method, which creates a Context to run the // method in. cfw.addInvoke(ByteCode.INVOKESTATIC, "org/mozilla/javascript/JavaAdapter", "callMethod", "(Lorg/mozilla/javascript/ContextFactory;" + "Lorg/mozilla/javascript/Scriptable;" + "Lorg/mozilla/javascript/Function;" + "[Ljava/lang/Object;" + "J" + ")Ljava/lang/Object;"); generateReturnResult(cfw, returnType, convertResult); cfw.stopMethod((short) paramsEnd); } /** * Generates code to push typed parameters onto the operand stack * prior to a direct Java method call. */ private static int generatePushParam(ClassFileWriter cfw, int paramOffset, Class<?> paramType) { if (!paramType.isPrimitive()) { cfw.addALoad(paramOffset); return 1; } String typeName = paramType.getName(); switch (typeName.charAt(0)) { case 'z': case 'b': case 'c': case 's': case 'i': // load an int value, convert to double. cfw.addILoad(paramOffset); return 1; case 'l': // load a long, convert to double. cfw.addLLoad(paramOffset); return 2; case 'f': // load a float, convert to double. cfw.addFLoad(paramOffset); return 1; case 'd': cfw.addDLoad(paramOffset); return 2; } throw Kit.codeBug(); } /** * Generates code to return a Java type, after calling a Java method * that returns the same type. * Generates the appropriate RETURN bytecode. */ private static void generatePopResult(ClassFileWriter cfw, Class<?> retType) { if (retType.isPrimitive()) { String typeName = retType.getName(); switch (typeName.charAt(0)) { case 'b': case 'c': case 's': case 'i': case 'z': cfw.add(ByteCode.IRETURN); break; case 'l': cfw.add(ByteCode.LRETURN); break; case 'f': cfw.add(ByteCode.FRETURN); break; case 'd': cfw.add(ByteCode.DRETURN); break; } } else { cfw.add(ByteCode.ARETURN); } } /** * Generates a method called "super$methodName()" which can be called * from JavaScript that is equivalent to calling "super.methodName()" * from Java. Eventually, this may be supported directly in JavaScript. */ private static void generateSuper(ClassFileWriter cfw, String genName, String superName, String methodName, String methodSignature, Class<?>[] parms, Class<?> returnType) { cfw.startMethod("super$" + methodName, methodSignature, ClassFileWriter.ACC_PUBLIC); // push "this" cfw.add(ByteCode.ALOAD, 0); // push the rest of the parameters. int paramOffset = 1; for (Class<?> parm : parms) { paramOffset += generatePushParam(cfw, paramOffset, parm); } // call the superclass implementation of the method. cfw.addInvoke(ByteCode.INVOKESPECIAL, superName, methodName, methodSignature); // now, handle the return type appropriately. Class<?> retType = returnType; if (!retType.equals(Void.TYPE)) { generatePopResult(cfw, retType); } else { cfw.add(ByteCode.RETURN); } cfw.stopMethod((short) (paramOffset + 1)); } /** * Returns a fully qualified method name concatenated with its signature. */ private static String getMethodSignature(Method method, Class<?>[] argTypes) { StringBuilder sb = new StringBuilder(); appendMethodSignature(argTypes, method.getReturnType(), sb); return sb.toString(); } static int appendMethodSignature(Class<?>[] argTypes, Class<?> returnType, StringBuilder sb) { sb.append('('); int firstLocal = 1 + argTypes.length; // includes this. for (Class<?> type : argTypes) { appendTypeString(sb, type); if (type == Long.TYPE || type == Double.TYPE) { // adjust for double slot ++firstLocal; } } sb.append(')'); appendTypeString(sb, returnType); return firstLocal; } private static StringBuilder appendTypeString(StringBuilder sb, Class<?> type) { while (type.isArray()) { sb.append('['); type = type.getComponentType(); } if (type.isPrimitive()) { char typeLetter; if (type == Boolean.TYPE) { typeLetter = 'Z'; } else if (type == Long.TYPE) { typeLetter = 'J'; } else { String typeName = type.getName(); typeLetter = Character.toUpperCase(typeName.charAt(0)); } sb.append(typeLetter); } else { sb.append('L'); sb.append(type.getName().replace('.', '/')); sb.append(';'); } return sb; } static int[] getArgsToConvert(Class<?>[] argTypes) { int count = 0; for (int i = 0; i != argTypes.length; ++i) { if (!argTypes[i].isPrimitive()) ++count; } if (count == 0) return null; int[] array = new int[count]; count = 0; for (int i = 0; i != argTypes.length; ++i) { if (!argTypes[i].isPrimitive()) array[count++] = i; } return array; } private static final Object FTAG = "JavaAdapter"; private static final int Id_JavaAdapter = 1; }
d288e83a006358ba2c914f860fd9da34cbbeb577
50ce3efd06f99a6a2e57bde9e770843d77ee188e
/vendor/cappu/packages/apps/FileExplorer/src/net/micode/fileexplorer/FileCategoryHelper.java
f02985627910a2b71ecc4742ebbffc320558ca2d
[]
no_license
Macheal2/CareOS
62445f7c6da5dcbe6abe0788fc53fd5ee5ecebc8
8732dfe033498df82867130458298c1665a03666
refs/heads/master
2021-01-22T10:08:28.290757
2017-09-04T08:26:36
2017-09-04T08:26:36
102,330,758
0
1
null
null
null
null
UTF-8
Java
false
false
10,563
java
/* * Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net) * * This file is part of FileExplorer. * * FileExplorer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * FileExplorer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SwiFTP. If not, see <http://www.gnu.org/licenses/>. */ package net.micode.fileexplorer; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore.Audio; import android.provider.MediaStore.Files; import android.provider.MediaStore.Files.FileColumns; import android.provider.MediaStore.Images; import android.provider.MediaStore.Video; import android.util.Log; import net.micode.fileexplorer.FileSortHelper.SortMethod; import net.micode.fileexplorer.MediaFile.MediaFileType; import java.io.FilenameFilter; import java.util.HashMap; import java.util.Iterator; public class FileCategoryHelper { public static final int COLUMN_ID = 0; public static final int COLUMN_PATH = 1; public static final int COLUMN_SIZE = 2; public static final int COLUMN_DATE = 3; private static final String LOG_TAG = "FileCategoryHelper"; public enum FileCategory { All, Music, Video, Picture, Theme, Doc, Zip, Apk, Custom, Other, Favorite } private static String APK_EXT = "apk"; private static String THEME_EXT = "mtz"; private static String[] ZIP_EXTS = new String[] { "zip", "rar" }; public static HashMap<FileCategory, FilenameExtFilter> filters = new HashMap<FileCategory, FilenameExtFilter>(); public static HashMap<FileCategory, Integer> categoryNames = new HashMap<FileCategory, Integer>(); static { categoryNames.put(FileCategory.All, R.string.category_all); categoryNames.put(FileCategory.Music, R.string.category_music); categoryNames.put(FileCategory.Video, R.string.category_video); categoryNames.put(FileCategory.Picture, R.string.category_picture); categoryNames.put(FileCategory.Theme, R.string.category_theme); categoryNames.put(FileCategory.Doc, R.string.category_document); categoryNames.put(FileCategory.Zip, R.string.category_zip); categoryNames.put(FileCategory.Apk, R.string.category_apk); categoryNames.put(FileCategory.Other, R.string.category_other); categoryNames.put(FileCategory.Favorite, R.string.category_favorite); } public static FileCategory[] sCategories = new FileCategory[] { FileCategory.Music, FileCategory.Video, FileCategory.Picture, FileCategory.Theme, FileCategory.Doc, FileCategory.Zip, FileCategory.Apk, FileCategory.Other }; private FileCategory mCategory; private Context mContext; public FileCategoryHelper(Context context) { mContext = context; mCategory = FileCategory.All; } public FileCategory getCurCategory() { return mCategory; } public void setCurCategory(FileCategory c) { mCategory = c; } public int getCurCategoryNameResId() { return categoryNames.get(mCategory); } public void setCustomCategory(String[] exts) { mCategory = FileCategory.Custom; if (filters.containsKey(FileCategory.Custom)) { filters.remove(FileCategory.Custom); } filters.put(FileCategory.Custom, new FilenameExtFilter(exts)); } public FilenameFilter getFilter() { return filters.get(mCategory); } private HashMap<FileCategory, CategoryInfo> mCategoryInfo = new HashMap<FileCategory, CategoryInfo>(); public HashMap<FileCategory, CategoryInfo> getCategoryInfos() { return mCategoryInfo; } public CategoryInfo getCategoryInfo(FileCategory fc) { if (mCategoryInfo.containsKey(fc)) { return mCategoryInfo.get(fc); } else { CategoryInfo info = new CategoryInfo(); mCategoryInfo.put(fc, info); return info; } } public class CategoryInfo { public long count; public long size; } private void setCategoryInfo(FileCategory fc, long count, long size) { CategoryInfo info = mCategoryInfo.get(fc); if (info == null) { info = new CategoryInfo(); mCategoryInfo.put(fc, info); } info.count = count; info.size = size; } private String buildDocSelection() { StringBuilder selection = new StringBuilder(); Iterator<String> iter = Util.sDocMimeTypesSet.iterator(); while(iter.hasNext()) { selection.append("(" + FileColumns.MIME_TYPE + "=='" + iter.next() + "') OR "); } return selection.substring(0, selection.lastIndexOf(")") + 1); } private String buildSelectionByCategory(FileCategory cat) { String selection = null; switch (cat) { case Theme: selection = FileColumns.DATA + " LIKE '%.mtz'"; break; case Doc: selection = buildDocSelection(); break; case Zip: selection = "(" + FileColumns.MIME_TYPE + " == '" + Util.sZipFileMimeType + "')"; break; case Apk: selection = FileColumns.DATA + " LIKE '%.apk'"; break; default: selection = null; } return selection; } private Uri getContentUriByCategory(FileCategory cat) { Uri uri; String volumeName = "external"; switch(cat) { case Theme: case Doc: case Zip: case Apk: uri = Files.getContentUri(volumeName); break; case Music: uri = Audio.Media.getContentUri(volumeName); break; case Video: uri = Video.Media.getContentUri(volumeName); break; case Picture: uri = Images.Media.getContentUri(volumeName); break; default: uri = null; } return uri; } private String buildSortOrder(SortMethod sort) { String sortOrder = null; switch (sort) { case name: sortOrder = FileColumns.TITLE + " asc"; break; case size: sortOrder = FileColumns.SIZE + " asc"; break; case date: sortOrder = FileColumns.DATE_MODIFIED + " desc"; break; case type: sortOrder = FileColumns.MIME_TYPE + " asc, " + FileColumns.TITLE + " asc"; break; } return sortOrder; } public Cursor query(FileCategory fc, SortMethod sort) { Uri uri = getContentUriByCategory(fc); String selection = buildSelectionByCategory(fc); String sortOrder = buildSortOrder(sort); if (uri == null) { Log.e(LOG_TAG, "invalid uri, category:" + fc.name()); return null; } String[] columns = new String[] { FileColumns._ID, FileColumns.DATA, FileColumns.SIZE, FileColumns.DATE_MODIFIED }; return mContext.getContentResolver().query(uri, columns, selection, null, sortOrder);//dengying } public void refreshCategoryInfo() { // clear for (FileCategory fc : sCategories) { setCategoryInfo(fc, 0, 0); } // query database String volumeName = "external"; Uri uri = Audio.Media.getContentUri(volumeName); refreshMediaCategory(FileCategory.Music, uri); uri = Video.Media.getContentUri(volumeName); refreshMediaCategory(FileCategory.Video, uri); uri = Images.Media.getContentUri(volumeName); refreshMediaCategory(FileCategory.Picture, uri); uri = Files.getContentUri(volumeName); refreshMediaCategory(FileCategory.Theme, uri); refreshMediaCategory(FileCategory.Doc, uri); refreshMediaCategory(FileCategory.Zip, uri); refreshMediaCategory(FileCategory.Apk, uri); } private boolean refreshMediaCategory(FileCategory fc, Uri uri) { String[] columns = new String[] { "COUNT(*)", "SUM(_size)" }; Cursor c = mContext.getContentResolver().query(uri, columns, buildSelectionByCategory(fc), null, null); if (c == null) { Log.e(LOG_TAG, "fail to query uri:" + uri); return false; } if (c.moveToNext()) { setCategoryInfo(fc, c.getLong(0), c.getLong(1)); Log.v(LOG_TAG, "Retrieved " + fc.name() + " info >>> count:" + c.getLong(0) + " size:" + c.getLong(1)); c.close(); return true; } return false; } public static FileCategory getCategoryFromPath(String path) { MediaFileType type = MediaFile.getFileType(path); if (type != null) { if (MediaFile.isAudioFileType(type.fileType)) return FileCategory.Music; if (MediaFile.isVideoFileType(type.fileType)) return FileCategory.Video; if (MediaFile.isImageFileType(type.fileType)) return FileCategory.Picture; if (Util.sDocMimeTypesSet.contains(type.mimeType)) return FileCategory.Doc; } int dotPosition = path.lastIndexOf('.'); if (dotPosition < 0) { return FileCategory.Other; } String ext = path.substring(dotPosition + 1); if (ext.equalsIgnoreCase(APK_EXT)) { return FileCategory.Apk; } if (ext.equalsIgnoreCase(THEME_EXT)) { return FileCategory.Theme; } if (matchExts(ext, ZIP_EXTS)) { return FileCategory.Zip; } return FileCategory.Other; } private static boolean matchExts(String ext, String[] exts) { for (String ex : exts) { if (ex.equalsIgnoreCase(ext)) return true; } return false; } }
a5a04fa95477996de2259209f53e71a6fa070adb
9c760347d5960359f1c6fae7e0c62c111e7b2703
/codeforces/30/ShootingGallery.java
7d5c5df286664c5f3c1f6ae906978113b876adda
[]
no_license
md143rbh7f/competitions
1bcfc6886c32649f8bb939f329536cec51542bb1
f241ace5a4d098fb66519b0c2eed6c45ebf212b9
refs/heads/master
2020-04-06T07:12:36.891182
2019-01-18T04:04:16
2019-01-18T07:23:23
12,464,538
8
7
null
null
null
null
UTF-8
Java
false
false
925
java
import java.io.*; import java.math.*; import java.util.*; public class ShootingGallery { static Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); public static void main(String[] args) { int n = in.nextInt(); Target[] ts = new Target[n]; for(int i = 0; i < n; i++) ts[i] = new Target(); Arrays.sort(ts); double ans = 0, best[] = new double[n]; for(int i = 0; i < n; i++) { for(int j = 0; j < i; j++) if(Math.hypot(ts[i].x - ts[j].x, ts[i].y - ts[j].y) <= ts[i].t - ts[j].t) best[i] = Math.max(best[i], best[j]); ans = Math.max(ans, best[i] += ts[i].p); } System.out.printf("%.10f\n", ans); } static class Target implements Comparable<Target> { int x, y, t; double p; Target() { x = in.nextInt(); y = in.nextInt(); t = in.nextInt(); p = in.nextDouble(); } public int compareTo(Target o) { return Integer.compare(t, o.t); } } }
56ed649da58bc1a85f0ca90730ad2096bade6424
7a7d31dec971c7799f4d0c0d3365b275a55b02f6
/JavaAdvanced/src/_39_day/ClassTest5.java
dbc5ccd979a24cf2d5c203e40f493068cc4f2460
[]
no_license
aker4m/kgitbankJava
c528abf26689f2f6655b4a2ba0313bdeb079eece
261d46e3045b345e106b6fdfce0d91f5e40d4228
refs/heads/master
2021-01-19T15:11:07.885125
2017-08-21T12:15:56
2017-08-21T12:15:56
100,948,844
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
477
java
package _39_day; import java.net.*; import java.io.*; public class ClassTest5 { public static void main(String[] args) throws IOException{ String msg = "Hello java!"; byte[] str = msg.getBytes(); InetAddress ia = InetAddress.getByName("192.168.0.92"); DatagramPacket dp = new DatagramPacket(str, str.length, ia, 12345); DatagramSocket ds = new DatagramSocket(); ds.send(dp); ds.close(); System.out.println("Àü¼Û ³¡ ............."); } }
26198a35702e2b5373ee7b293f53575da5bd0803
08bdd164c174d24e69be25bf952322b84573f216
/opencores/client/foundation classes/j2sdk-sec-1_4_2-src-scsl/jsse1.4.2-src/src/share/javax/net/ssl/SSLSession.java
57b82f3bd8a238ecc26777cf1ca9297710b422ad
[]
no_license
hagyhang/myforthprocessor
1861dcabcf2aeccf0ab49791f510863d97d89a77
210083fe71c39fa5d92f1f1acb62392a7f77aa9e
refs/heads/master
2021-05-28T01:42:50.538428
2014-07-17T14:14:33
2014-07-17T14:14:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,936
java
/* * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.net.ssl; import java.net.InetAddress; /** * In SSL, sessions are used to describe an ongoing relationship between * two entities. Each SSL connection involves one session at a time, but * that session may be used on many connections between those entities, * simultaneously or sequentially. The session used on a connection may * also be replaced by a different session. Sessions are created, or * rejoined, as part of the SSL handshaking protocol. Sessions may be * invalidated due to policies affecting security or resource usage, * or by an application explicitly calling <code>invalidate</code>. * Session management policies are typically used to tune performance. * * <P> In addition to the standard session attributes, SSL sessions expose * these read-only attributes: <UL> * * <LI> <em>Peer Identity.</em> Sessions are between a particular * client and a particular server. The identity of the peer may * have been established as part of session setup. Peers are * generally identified by X.509 certificate chains. * * <LI> <em>Cipher Suite Name.</em> Cipher suites describe the * kind of cryptographic protection that's used by connections * in a particular session. * * <LI> <em>Peer Host.</em> All connections in a session are * between the same two hosts. The address of the host on the other * side of the connection is available. * * </UL> * * <P> Sessions may be explicitly invalidated. Invalidation may also * be done implicitly, when faced with certain kinds of errors. * * @since 1.4 * @version 1.27 * @author David Brownell */ public interface SSLSession { /** * Returns the identifier assigned to this Session. * * @return the Session identifier */ public byte[] getId(); /** * Returns the context in which this session is bound. * <P> * This context may be unavailable in some environments, * in which case this method returns null. * <P> * If the context is available and there is a * security manager installed, the caller may require * permission to access it or a security exception may be thrown. * In a Java 2 environment, the security manager's * <code>checkPermission</code> method is called with a * <code>SSLPermission("getSSLSessionContext")</code> permission. * * @return the session context used for this session, or null * if the context is unavailable. */ public SSLSessionContext getSessionContext(); /** * Returns the time at which this Session representation was created, * in milliseconds since midnight, January 1, 1970 UTC. * * @return the time this Session was created */ public long getCreationTime(); /** * Returns the last time this Session representation was accessed by the * session level infrastructure, in milliseconds since * midnight, January 1, 1970 UTC. * <P> * Access indicates a new connection being established using session data. * Application level operations, such as getting or setting a value * associated with the session, are not reflected in this access time. * * <P> This information is particularly useful in session management * policies. For example, a session manager thread could leave all * sessions in a given context which haven't been used in a long time; * or, the sessions might be sorted according to age to optimize some task. * * @return the last time this Session was accessed */ public long getLastAccessedTime(); /** * Invalidates the session. * <P> * Future connections will not be able to * resume or join this session. However, any existing connection * using this session can continue to use the session until the * connection is closed. */ public void invalidate(); /** * * Binds the specified <code>value</code> object into the * session's application layer data * with the given <code>name</code>. * <P> * Any existing binding using the same <code>name</code> is * replaced. If the new (or existing) <code>value</code> implements the * <code>SSLSessionBindingListener</code> interface, the object * represented by <code>value</code> is notified appropriately. * <p> * For security reasons, the same named values may not be * visible across different access control contexts. * * @param name the name to which the data object will be bound. * This may not be null. * @param value the data object to be bound. This may not be null. * @throws IllegalArgumentException if either argument is null. */ public void putValue(String name, Object value); /** * Returns the object bound to the given name in the session's * application layer data. Returns null if there is no such binding. * <p> * For security reasons, the same named values may not be * visible across different access control contexts. * * @param name the name of the binding to find. * @return the value bound to that name, or null if the binding does * not exist. * @throws IllegalArgumentException if the argument is null. */ public Object getValue(String name); /** * Removes the object bound to the given name in the session's * application layer data. Does nothing if there is no object * bound to the given name. If the bound existing object * implements the <code>SessionBindingListener</code> interface, * it is notified appropriately. * <p> * For security reasons, the same named values may not be * visible across different access control contexts. * * @param name the name of the object to remove visible * across different access control contexts * @throws IllegalArgumentException if the argument is null. */ public void removeValue(String name); /** * Returns an array of the names of all the application layer * data objects bound into the Session. * <p> * For security reasons, the same named values may not be * visible across different access control contexts. * * @return a non-null (possibly empty) array of names of the objects * bound to this Session. */ public String [] getValueNames(); /** * Returns the identity of the peer which was established as part * of defining the session. * * @return an ordered array of peer certificates, * with the peer's own certificate first followed by any * certificate authorities. * @exception SSLPeerUnverifiedException if the peer's identity has not * been verified */ public java.security.cert.Certificate [] getPeerCertificates() throws SSLPeerUnverifiedException; /** * Returns the certificate(s) that were sent to the peer during * handshaking. * * When multiple certificates are available for use in a * handshake, the implementation chooses what it considers the * "best" certificate chain available, and transmits that to * the other side. This method allows the caller to know * which certificate chain was actually used. * * @return an ordered array of certificates, * with the local certificate first followed by any * certificate authorities. If no certificates were sent, * then null is returned. */ public java.security.cert.Certificate [] getLocalCertificates(); /** * Returns the identity of the peer which was identified as part * of defining the session. * * <p><em>Note: this method exists for compatibility with previous * releases. New applications should use * {@link #getPeerCertificates} instead.</em></p> * * @return an ordered array of peer X.509 certificates, * with the peer's own certificate first followed by any * certificate authorities. (The certificates are in * the original JSSE certificate * {@link javax.security.cert.X509Certificate} format.) * @exception SSLPeerUnverifiedException if the peer's identity * has not been verified */ public javax.security.cert.X509Certificate [] getPeerCertificateChain() throws SSLPeerUnverifiedException; /** * Returns the name of the SSL cipher suite which is used for all * connections in the session. * * <P> This defines the level of protection * provided to the data sent on the connection, including the kind * of encryption used and most aspects of how authentication is done. * * @return the name of the session's cipher suite */ public String getCipherSuite(); /** * Returns the standard name of the protocol used for all * connections in the session. * * <P> This defines the protocol used in the connection. * * @return the standard name of the protocol used for all * connections in the session. */ public String getProtocol(); /** * Returns the host name of the peer in this session. * <P> * For the server, this is the client's host; and for * the client, it is the server's host. The name may not be * a fully qualified host name or even a host name at all as * it may represent a string encoding of the peer's network address. * If such a name is desired, it might * be resolved through a name service based on the value returned * by this method. * <P> * This value is not authenticated and should not be relied upon. * * @return the host name of the peer host */ public String getPeerHost(); }
30cd5918bb7f23cd4b7989f983fcc69ad4c09c5d
2cdccd5aab49413aba1cf68173a9b2a0c9947551
/xmlsh/src/commands/org/xmlsh/commands/internal/xtee.java
3101f3f8e755213d2969a7f3b8aa26fa8269df83
[]
no_license
bryanchance/xmlsh1_3
b0d60faa7dea5cecb931899e3da3250245f79f68
626d27415ff70552a2e56374b79982f55e00070e
refs/heads/master
2020-05-24T14:25:02.538838
2015-06-18T13:14:31
2015-06-18T13:14:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,550
java
/** * $Id: $ * $Date: $ * */ package org.xmlsh.commands.internal; import java.util.ArrayList; import java.util.List; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.events.XMLEvent; import org.xmlsh.core.InputPort; import org.xmlsh.core.Options; import org.xmlsh.core.OutputPort; import org.xmlsh.core.XCommand; import org.xmlsh.core.XValue; import org.xmlsh.sh.shell.SerializeOpts; public class xtee extends XCommand { @Override public int run(List<XValue> args) throws Exception { Options opts = new Options( SerializeOpts.getOptionDefs() ); opts.parse(args); args = opts.getRemainingArgs(); // List of outputs to tee to List<XMLEventWriter> writers = new ArrayList<XMLEventWriter>(); List<OutputPort> closeme = new ArrayList<OutputPort>(); InputPort stdin = null; stdin = getStdin(); try { SerializeOpts sopts = getSerializeOpts(opts); XMLEventReader reader = stdin.asXMLEventReader(sopts); OutputPort stdout = getStdout(); writers.add(stdout.asXMLEventWriter(sopts)); for( XValue arg : args ){ OutputPort output = getEnv().getOutput(arg, false); writers.add( output.asXMLEventWriter(sopts)); closeme.add(output); } stdout.setSystemId(stdin.getSystemId()); XMLEvent e; while( reader.hasNext() ){ e = (XMLEvent) reader.next(); for( XMLEventWriter writer : writers ) writer.add(e); } reader.close(); for( XMLEventWriter writer : writers ) writer.close(); // TODO: Why doesnt writers close the underlying stream ? // TODO: Do NOT Close stdout ! for( OutputPort p : closeme ) p.close(); } finally { stdin.close(); } return 0; } } // // //Copyright (C) 2008-2014 David A. Lee. // //The contents of this file are subject to the "Simplified BSD License" (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.opensource.org/licenses/bsd-license.php // //Software distributed under the License is distributed on an "AS IS" basis, //WITHOUT WARRANTY OF ANY KIND, either express or implied. //See the License for the specific language governing rights and limitations under the License. // //The Original Code is: all this file. // //The Initial Developer of the Original Code is David A. Lee // //Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved. // //Contributor(s): none. //
43b4dd7036cba48533b526f9f846d90ad12c6ead
8d1d62db80a3742fab1307a5ceda658fce886184
/src/com/vikky/lecture11/LocalTest.java
c88b066ff9766766f82898bc93dcfdaa94967d25
[]
no_license
victoriajeniluc/OOP
4049e46ddd7fedd01bf84867114e2e63b6b41247
d877e0065221e07600af9cacba3e4a8c489e1cb6
refs/heads/master
2020-03-27T08:06:34.150066
2018-09-03T19:34:26
2018-09-03T19:34:26
146,221,174
0
0
null
null
null
null
UTF-8
Java
false
false
1,393
java
package com.vikky.lecture11; public class LocalTest { // variable args is a local variable but it is always initialized with String array instance containing 0 or more elements public static void main(String[] args) { // int i = 0; // same as int i; i = 0 // final int i = 0; // for test 3... use the final keyword int i = 0; // remove the final for the test 4 System.out.println(i); // it will give you warning if i is not being used or if it is not initialized after declaration... it NEEDS to be initialized before getting accessed. System.out.println("-----------------------------------"); String str; // TEST 1: printing out str without initializing it before accessing it: // System.out.println(str); - gave an error to initialize str first // TEST 2: using an if block to initialize str and use i: /*if(i == 0) { str = "A"; - gave an error because it doesn't understand what i really is' }*/ // TEST 3: putting int i as a final i to fix the test 2 problem.. /* if(i == 0) { str = "A"; } System.out.println(str); // A*/ // TEST 4: putting an else there after the if statement if(i == 0) { str = "A"; } else { str = "B"; } System.out.println(str); // A } }
e80ecb40c6f7babfd8fd9a47bfccbb81e3f94e45
127db17c781588952113553ed1efc02260240b1b
/src/test/java/org/atemsource/jcr/entitytype/JcrPrimitiveAttributeTest.java
e6cda9b9794f7f50c4b22fec54d9f51ff1c4e4c0
[]
no_license
stemey/atem-jcr
2d89e1c5a2b25e67563bdaa19d7de5c06fa2da03
768dcc1c993e6d1f9596ea490652bd8f10bd8c94
refs/heads/master
2016-09-15T19:01:53.723688
2014-08-30T06:53:45
2014-08-30T06:53:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
801
java
package org.atemsource.jcr.entitytype; import javax.jcr.Node; import javax.jcr.RepositoryException; import javax.jcr.nodetype.NodeType; import org.apache.jackrabbit.commons.JcrUtils; import org.atemsource.jcr.entitytype.converter.StringConverter; import org.junit.Assert; import org.junit.Test; public class JcrPrimitiveAttributeTest extends AbstractJcrTest { @Test public void testSetGet() throws RepositoryException { Node node = JcrUtils.getOrCreateByPath("a", NodeType.NT_FOLDER,NodeType.NT_UNSTRUCTURED, session,true); JcrPrimitiveAttribute<String> attribute = new JcrPrimitiveAttribute<String>(); attribute.setValueConverter(new StringConverter()); attribute.setCode("text"); attribute.setValue(node,"hallo"); Assert.assertEquals("hallo", attribute.getValue(node)); } }
0fc7ce9801f66b8cdfc42993a6e03d576bd56f53
fbf5daa27a20239b102643741248ffcbf200d272
/app/src/main/java/com/ftoul/androidclient/bean/request/ImageCodeIn.java
ecffde9bf4e41525277319fb4ab23346d1edf3d2
[]
no_license
lee3219237/Androidclient
e383d9f60dfe1ee615c7bb91b92be3f2ab6e593d
86a4eba41cefbb4996490ce4018cd2a12f7e932d
refs/heads/master
2021-01-19T14:27:58.600074
2017-08-21T02:45:59
2017-08-21T02:45:59
100,905,395
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package com.ftoul.androidclient.bean.request; import com.ftoul.androidclient.bean.AbstractBaseParamsVO; /** * Created by ftoul106 on 2017/6/8 0008. */ public class ImageCodeIn extends AbstractBaseParamsVO { private String uuid; private int codeType; public ImageCodeIn(int codeType) { this.codeType = codeType; this.uuid = getMachineCode(); } public ImageCodeIn() { this.uuid = getMachineCode(); } public int getCodeType() { return codeType; } public void setCodeType(int codeType) { this.codeType = codeType; } @Override public String toString() { return "ImageCodeIn{" + "codeType='" + codeType + '\'' + '}'; } }
fba32d1b57894b831eea7f414e0a3b826613094a
33e5ea72d48675de0a9772f777edb06c83dc56ee
/src/main/java/ru/itis/semestrovaya/controllers/ErrorController.java
03f41063115e504104e2b0c1337405eba52362ac
[]
no_license
TaliyaR/TravelDiary
5acc6e8e57bdf1704e5269ccca4f853385121d34
18f93128ab700a1f9e0b74b38862e7af88a32688
refs/heads/master
2021-05-25T13:43:48.115873
2020-06-15T15:20:13
2020-06-15T15:20:13
253,777,218
0
0
null
null
null
null
UTF-8
Java
false
false
1,367
java
package ru.itis.semestrovaya.controllers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import ru.itis.semestrovaya.helper.HandledErrorsCounterBean; import javax.servlet.RequestDispatcher; import javax.servlet.http.HttpServletRequest; @Controller public class ErrorController implements org.springframework.boot.web.servlet.error.ErrorController{ @Override public String getErrorPath() { return "/error"; } @Autowired HandledErrorsCounterBean handledErrorsCounterBean; @RequestMapping("/error") public ModelAndView handleError(HttpServletRequest request) { handledErrorsCounterBean.handleNewError(); System.out.println("Count of current errors handled: " + handledErrorsCounterBean.getCounterOfHandledErrors() + " for session with id: " + request.getSession().getId()); Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE); ModelAndView modelAndView = new ModelAndView("error"); if (status != null) { Integer statusCode = Integer.valueOf(status.toString()); modelAndView.addObject("statusCode", statusCode); } return modelAndView; } }
ef94a619c6fdb64647e482ed1f077add4b8dfef3
e4b3f665482576feb9697844f7c4e7d8a0b96282
/项目/查看代码/src/main/java/com/qhit/interfaces/EngineerHigh.java
de006bc50449769660e7a04b685f7bb139698d39
[]
no_license
zengxiangshun/Resume-the-project
f59cc5dfbf446229fc4e20f8ff60028270d98a94
bc40bcda37105a147197bb685b3ab60e9fbf8d0a
refs/heads/master
2020-05-16T07:49:04.014990
2019-06-09T01:47:17
2019-06-09T01:47:17
182,886,330
0
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.qhit.interfaces; import java.util.Arrays; /** * Created by Administrator on 2018/5/1 0001. */ public class EngineerHigh implements Engineer { public void judge(int i) { char[] arr = (i+"").toCharArray(); char[] left = new char[arr.length/2]; char[] right = new char[arr.length/2]; for (int j = 0; j <arr.length/2 ; j++) { left[j] = arr[j]; right[j] = arr[arr.length-1-j]; } Arrays.sort(left); Arrays.sort(right); if(left[left.length-1]<right[0]){ System.out.println(true); }else{ System.out.println(false); } } }
a2cb3dbffb7d627793bd970fbaab912b6a734536
7d6b962a0c009afb6cd0299e845d2e44fa6afdc3
/src/main/java/com/github/folkies/abc2pdf/PrintApi.java
acb075f7babcf65fb9015aa245a3ecaceeb58599
[]
no_license
folkies/abc2pdf
28250a774bcb8defdf67aef4b4961ed39fa83fd9
82ab0fbfc7a33f1019ea11b8e3bd2cd48e68963f
refs/heads/master
2021-03-21T17:30:24.816868
2020-03-14T16:49:14
2020-03-14T16:49:14
247,316,475
1
0
null
null
null
null
UTF-8
Java
false
false
899
java
package com.github.folkies.abc2pdf; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; @RequestScoped @Path("/print") public class PrintApi { @Inject Abc2PdfService abc2pdfService; @POST @Consumes("*/*") @Produces("application/pdf") public Response print(InputStream is) throws IOException, InterruptedException { java.nio.file.Path tempFile = Files.createTempFile("tmp", ".abc"); Files.copy(is, tempFile, StandardCopyOption.REPLACE_EXISTING); File pdfFile = abc2pdfService.convertToPdf(tempFile.toFile()); return Response.ok(pdfFile, "application/pdf").build(); } }
4edfcd9eded44242a71c24acf3b3a6264383b068
21bfd81eb16a51d143bbae08029dbf617bd13277
/src/main/java/com/ocwvar/torii/controller/core/Facility.java
2f1b53957fc6cbcff04b5b4d0bf07c5409db2679
[]
no_license
ocwvar/torii
2dabdc429f276951eb6b46746a360a82c16bc2ac
41b8598191e9f804d745c1f2c4d5317b7748c0ed
refs/heads/master
2022-05-25T09:52:51.636357
2020-03-02T16:13:11
2020-03-02T16:13:11
239,086,535
1
0
null
null
null
null
UTF-8
Java
false
false
4,551
java
package com.ocwvar.torii.controller.core; import com.ocwvar.torii.Configs; import com.ocwvar.torii.Field; import com.ocwvar.torii.utils.protocol.Protocol; import com.ocwvar.utils.Log; import com.ocwvar.utils.node.Node; import com.ocwvar.utils.node.TypeNode; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.net.InetAddress; /** * 返回当前服务器配置 */ @RestController public class Facility { /* 请求样本内容: <call model="KFC:J:A:A:2016121200" srcid="012085D5525C6F1504B0" tag="023f5d7b"> <facility encoding="SHIFT_JIS" method="get"/> </call> */ @PostMapping( path = "/torii/facility/**" ) public void function( HttpServletRequest request, HttpServletResponse response ) throws Exception { if ( Protocol.commitWithCache( request, response ) ) { return; } Protocol.encryptAndCommit( getFacilityNode(), request, response ); } private Node getFacilityNode() { String ip; try { ip = InetAddress.getLocalHost().getHostAddress(); } catch ( Exception ignore ) { ip = "127.0.0.1"; } Log.getInstance().print( "服务器地址:" + ip ); final Node root = new Node( "response" ); final Node facilityNode = new Node( "facility" ); final Node locationNode = new Node( "location" ); locationNode.addChildNode( new TypeNode( "id", "SONY" ) ); locationNode.addChildNode( new TypeNode( "country", "JP" ) ); locationNode.addChildNode( new TypeNode( "region", "." ) ); locationNode.addChildNode( new TypeNode( "type", "0", "u8" ) ); locationNode.addChildNode( new TypeNode( "latitude", "0", "u8" ) ); locationNode.addChildNode( new TypeNode( "longitude", "0", "u8" ) ); locationNode.addChildNode( new TypeNode( "accuracy", "0", "u8" ) ); locationNode.addChildNode( new TypeNode( "name", Configs.getShopName() ) ); locationNode.addChildNode( new TypeNode( "countryname", Configs.getShopName() ) ); locationNode.addChildNode( new TypeNode( "countryjname", Configs.getShopName() ) ); locationNode.addChildNode( new TypeNode( "regionname", Configs.getShopName() ) ); locationNode.addChildNode( new TypeNode( "regionjname", Configs.getShopName() ) ); locationNode.addChildNode( new TypeNode( "customercode", Configs.getShopName() ) ); locationNode.addChildNode( new TypeNode( "customercode", Configs.getShopName() ) ); final Node classNode = new Node( "class" ); classNode.addChildNode( new TypeNode( "id", "ID" ) ); classNode.addChildNode( new TypeNode( "line", "0", "u8" ) ); final Node portfwNode = new Node( "portfw" ); portfwNode.addChildNode( new TypeNode( "globalip", ip, "ip4" ) ); portfwNode.addChildNode( new TypeNode( "globalport", Configs.getPort(), "u16" ) ); portfwNode.addChildNode( new TypeNode( "privateport", Configs.getPort(), "u16" ) ); final Node publicNode = new Node( "public" ); publicNode.addChildNode( new TypeNode( "flag", "1", "u8" ) ); publicNode.addChildNode( new TypeNode( "name", Configs.getShopName() ) ); publicNode.addChildNode( new TypeNode( "latitude", "0" ) ); publicNode.addChildNode( new TypeNode( "longitude", "0" ) ); final Node eacoinNode = new Node( "eacoin" ); eacoinNode.addChildNode( new TypeNode( "notchamount", "3000", "s32" ) ); eacoinNode.addChildNode( new TypeNode( "notchcount", "3", "s32" ) ); eacoinNode.addChildNode( new TypeNode( "supplylimit", "10000", "s32" ) ); final Node eapassNode = new Node( "eapass" ); eapassNode.addChildNode( new TypeNode( "valid", "0", "u16" ) ); final Node urlNode = new Node( "url" ); urlNode.addChildNode( new TypeNode( "eapass", Configs.getPinSceneMessage() ) ); urlNode.addChildNode( new TypeNode( "arcadefan", "'www.konami.jp/am" ) ); urlNode.addChildNode( new TypeNode( "konaminetdx", "http://am.573.jp" ) ); urlNode.addChildNode( new TypeNode( "konamiid", "https://id.konami.net" ) ); urlNode.addChildNode( new TypeNode( "eagate", "http://eagate.573.jp" ) ); final Node shareNode = new Node( "share" ); shareNode.addChildNode( eacoinNode ); shareNode.addChildNode( urlNode ); shareNode.addChildNode( eapassNode ); facilityNode.addChildNode( locationNode ); facilityNode.addChildNode( classNode ); facilityNode.addChildNode( portfwNode ); facilityNode.addChildNode( publicNode ); facilityNode.addChildNode( shareNode ); root.addChildNode( facilityNode ); root.setEncodeCharset( Field.SHIFT_JIS ); return root; } }
84f41973c87683659c49ce632de3a286caa501aa
30c558b2bc879c11f2d983e4c957487a61445b00
/OnYard/onYard/src/main/java/com/iaai/onyard/dialog/FullSyncConfirmDialogFragment.java
ca0192f7c2152b6673531e0b8fdb5c55e75ec363
[]
no_license
rbgautam/AndroidProgramming
4624db5e51d9f5386a62ff9c47bd9edee829b7d2
1c53e24a5f20c153e44a4fc50db6ef63526712ed
refs/heads/master
2021-05-15T07:16:24.883405
2017-12-23T21:09:18
2017-12-23T21:09:18
111,718,487
0
0
null
null
null
null
UTF-8
Java
false
false
1,240
java
package com.iaai.onyard.dialog; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.DialogInterface; import android.os.Bundle; import com.iaai.onyard.application.OnYardApplication; import com.iaai.onyard.event.ForceFullSyncEvent; public class FullSyncConfirmDialogFragment extends DialogFragment { private static final String DIALOG_MESSAGE = "You will now be logged off and data will be reset. Do you want to continue?"; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getActivity()) .setMessage(DIALOG_MESSAGE) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { ((OnYardApplication) getActivity().getApplicationContext()).getEventBus() .post(new ForceFullSyncEvent()); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { return; } }).create(); } }
5475880f9b66c80be1129452462bff24155bd96d
ba14c6a642aa0928e44124504e43927dcee48800
/src/main/java/kr/ac/hansung/service/StudentService.java
2eb024894bacd1b3a7aaa31d859b35c9568152c4
[]
no_license
chyoun08/AdminSystem
a3baeab4c63752b6f0fdfab41e62f60cc64018b3
13789cddf4f05da38cd3fbf22fcead5ef0b6cdfa
refs/heads/master
2020-05-15T22:03:54.032805
2019-05-13T02:52:17
2019-05-13T02:52:17
182,516,893
0
0
null
null
null
null
UTF-8
Java
false
false
807
java
package kr.ac.hansung.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import kr.ac.hansung.dao.StudentDao; import kr.ac.hansung.model.Student; @Service public class StudentService { @Autowired private StudentDao studentDao; public List<Student> getStudents(){ return studentDao.getStudents(); } public boolean addStudent(Student student) { return studentDao.addStudent(student); } public boolean deleteStudent(int num) { return studentDao.deleteStudent(num); } public boolean updateStudent(Student student) { return studentDao.updateSutent(student); } public Student getStudentById(int num) { return studentDao.getStudentById(num); } }
b27182733906d855a68b506800f140ca0ddcd6ee
fd82b5042f0619036f41e04e0b3cb3f4a05c4ab6
/swagger-spring/src/main/java/io/swagger/api/NotFoundException.java
5183b5237f08b343f795adb18f89c7064b6dae49
[]
no_license
Mario4898/Tesi
fc82a5c7af51b2a66ca03a54c1b462e8ec28358c
74cf714ad32a5ba3fed9dc39c09c50a8e6b04c0d
refs/heads/main
2023-08-24T00:35:30.634094
2021-10-14T07:41:18
2021-10-14T07:41:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package io.swagger.api; @javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-10-18T12:39:28.338Z") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { super(code, msg); this.code = code; } }
a0b0bc7344b98a1b1731b3607453ac5d4d479d6d
ef40a58074fa9e8074c6a71a44e28fe5eca26d25
/bluetop-engin-api/src/main/java/com/bluetop/engin/api/webservice/GetCCWorkflowRequestCount4OSResponse.java
5f8ea1e59bf7a12982f13847aa2b38b0a6886fa5
[]
no_license
thestar111/bluetop
58311c6e6cf6f4d47df351f55cb2005a0a099085
6a7773666392db864a2f6cff0ae15669cc03806a
refs/heads/master
2023-06-06T10:06:15.253056
2021-07-01T09:00:46
2021-07-01T09:00:46
323,187,664
0
0
null
null
null
null
UTF-8
Java
false
false
1,291
java
package com.bluetop.engin.api.webservice; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * &lt;p&gt;anonymous complex type的 Java 类。 * * &lt;p&gt;以下模式片段指定包含在此类中的预期内容。 * * &lt;pre&gt; * &amp;lt;complexType&amp;gt; * &amp;lt;complexContent&amp;gt; * &amp;lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&amp;gt; * &amp;lt;sequence&amp;gt; * &amp;lt;element name="out" type="{http://www.w3.org/2001/XMLSchema}int"/&amp;gt; * &amp;lt;/sequence&amp;gt; * &amp;lt;/restriction&amp;gt; * &amp;lt;/complexContent&amp;gt; * &amp;lt;/complexType&amp;gt; * &lt;/pre&gt; * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "out" }) @XmlRootElement(name = "getCCWorkflowRequestCount4OSResponse") public class GetCCWorkflowRequestCount4OSResponse { protected int out; /** * 获取out属性的值。 * */ public int getOut() { return out; } /** * 设置out属性的值。 * */ public void setOut(int value) { this.out = value; } }
646eea5b7964f9f08ac6bd031d7c40cc7937bc08
ac8a34fd0b4127899b8a8cea1654cac71710e7a1
/app/src/main/java/com/samansepahvand/chat/adapter/NotifAdapter.java
5762fe14dd7c2992726a47fbe2e16dfb6b69e414
[]
no_license
SamanSepahvand/chat
5ba52e651a7e9faa632bc3fbdae059a794d406f9
96d9c794cdb279e062a7bf676d01d94157dc33b8
refs/heads/master
2023-02-04T00:58:45.457425
2020-12-19T20:44:31
2020-12-19T20:44:31
322,934,652
0
0
null
null
null
null
UTF-8
Java
false
false
2,071
java
package com.samansepahvand.chat.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.samansepahvand.chat.R; import com.samansepahvand.chat.model.ModelNotification; import java.util.List; public class NotifAdapter extends RecyclerView.Adapter<NotifAdapter.ViewHolder> { List<ModelNotification> models; Context context; public NotifAdapter(List<ModelNotification> models, Context context) { this.models = models; this.context = context; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view= LayoutInflater.from(context).inflate(R.layout.item_data_notification,parent,false); return new ViewHolder(view); } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { ModelNotification model=models.get(position); // holder.txtNotifId.setText(model.getId()); if (model!=null){ holder.txtNotifTitle.setText(model.getNotifTitle()); holder.txtNotifBody.setText(model.getNotifBody()); }else{ Toast.makeText(context, "Empty Notification Repository!!", Toast.LENGTH_SHORT).show(); } } @Override public int getItemCount() { return models.size(); } public class ViewHolder extends RecyclerView.ViewHolder{ TextView txtNotifTitle,txtNotifBody,txtNotifId; public ViewHolder(@NonNull View itemView) { super(itemView); initView(itemView); } private void initView(View itemView) { txtNotifBody=itemView.findViewById(R.id.txt_notif_body); txtNotifTitle=itemView.findViewById(R.id.txt_notif_title); txtNotifId=itemView.findViewById(R.id.txt_notif_id); } } }
220111f9c21acbaaf67fc9bf5f6d6928b2fee7e8
f4ac27926b837cf6d58b41388e1f89726db54f0f
/src/main/java/com/nhattan/ecommerce/repository/IOrderRepository.java
12182b642fac376c9b9fd3f1a252a9679378afea
[]
no_license
nhattan-dev/ecommerce-Rookies
39a12dc36abf5a70c13b88200d0687b5f045a155
560aaecaf506287c936ced789788e41c3204e500
refs/heads/master
2023-07-11T06:09:10.519163
2021-07-26T15:12:40
2021-07-26T15:12:40
382,337,532
0
0
null
null
null
null
UTF-8
Java
false
false
1,332
java
package com.nhattan.ecommerce.repository; import com.nhattan.ecommerce.entity.OrderEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import java.util.List; import java.util.Optional; public interface IOrderRepository extends JpaRepository<OrderEntity, Integer> { @Modifying @Query(value = "UPDATE Orders SET transactStatus = :transactStatus WHERE orderID = :orderID", nativeQuery = true) void updateTransactStutusByOrderID(@Param("transactStatus") String transactStatus, @Param("orderID") int orderID); @Query(value = "SELECT * FROM ORDERS WHERE customerID = :customerID", nativeQuery = true) List<OrderEntity> findOrdersByCustomerID(@Param("customerID") int customerID); List<OrderEntity> findOrderByTransactStatus(String transactStatus); @Query(value = "SELECT * FROM Orders WHERE orderID = :orderID AND customerID = :customerID", nativeQuery = true) Optional<OrderEntity> findOneByOrderIDAndCustomerID(@Param("orderID") int orderID, @Param("customerID") int customerID); @Query(value = "SELECT CAST(SUBSTRING(ISNULL(MAX(orderCode), 'OC000000000'), 3, 11) AS INT) FROM Orders", nativeQuery = true) int getMaxOrderCode(); }
0e70dcda9f7f1703934d5c9f094bbcd85a3f74f3
fde151611e9d6b4d370862432b9f38804186d242
/FormatCLASS/src/main/java/org/freeinternals/format/classfile/attribute/AttributeSignature.java
b679e297623d9aba1ae925718e0fe46b3ba70aa0
[]
no_license
lakecenter/freeinternals
8134cc68bcd19f3b4f4540f82a3e6a9bd613427f
008452d77c289ac0676c2d01e7cd762c27772efc
refs/heads/master
2020-06-19T12:30:53.076950
2019-06-12T21:29:19
2019-06-12T21:29:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,835
java
/* * AttributeSignature.java 10:52 AM, April 28, 2014 * * Copyright 2014, FreeInternals.org. All rights reserved. * Use is subject to license terms. */ package org.freeinternals.format.classfile.attribute; import org.freeinternals.commonlib.core.PosDataInputStream; import org.freeinternals.format.FileFormatException; import org.freeinternals.format.classfile.ClassFile; import org.freeinternals.format.classfile.constant.CPInfo; import org.freeinternals.format.classfile.JavaLangSpec; import org.freeinternals.format.classfile.JavaSEVersion; import org.freeinternals.format.classfile.u2; /** * An optional fixed-length attribute in the attributes table of a * {@code ClassFile}, {@code field_info}, or {@code method_info} structure. * * @author Amos Shi * @since Java 5 * @see <a * href="https://docs.oracle.com/javase/specs/jvms/se12/html/jvms-4.html#jvms-4.7.9"> * VM Spec: The Signature Attribute * </a> */ public class AttributeSignature extends AttributeInfo { public transient final u2 signature_index; AttributeSignature(final u2 nameIndex, final String type, final PosDataInputStream posDataInputStream, final CPInfo[] cp) throws java.io.IOException, FileFormatException { super(nameIndex, type, posDataInputStream, ClassFile.Version.Format_49_0, JavaSEVersion.Version_5_0); this.signature_index = new u2(posDataInputStream); super.checkSize(posDataInputStream.getPos()); } /** * A primitive type of the Java programming language. * * @see * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-BaseType"> * VM Spec: BaseType * </a> */ public enum BaseType { /** * signed byte. */ B('B', JavaLangSpec.Keyword.BYTE), /** * Unicode character code point in the Basic Multilingual Plane, encoded * with UTF-16. */ C('C', JavaLangSpec.Keyword.CHAR), /** * double-precision floating-point value. */ D('D', JavaLangSpec.Keyword.DOUBLE), /** * single-precision floating-point value. */ F('F', JavaLangSpec.Keyword.FLOAT), /** * integer. */ I('I', JavaLangSpec.Keyword.INT), /** * long integer. */ J('J', JavaLangSpec.Keyword.LONG), /** * signed short. */ S('S', JavaLangSpec.Keyword.SHORT), /** * true or false. */ Z('Z', JavaLangSpec.Keyword.BOOLEAN); public final char signature; public final String JavaKeyWord; private BaseType(char c, String kw) { this.signature = c; this.JavaKeyWord = kw; } /** * Get the key word of the JVM internal type signature char. * * @param typeSignature JVM internal type signature char * @return the key word or <code>error message</code> if not found */ public static String extractPrimitiveType(char typeSignature) { String kw = "[ERROR: unknown primitive type]"; for (BaseType v : BaseType.values()) { if (v.signature == typeSignature) { kw = v.JavaKeyWord; break; } } return kw; } /** * Check if a JVM internal type signature is primitive type or not. * * @param typeSignature JVM internal type signature char * @return <code>true</code> for primitive types, else * <code>false</code> */ public static Boolean isPrimitiveType(final char typeSignature) { Boolean returnValue = false; for (BaseType v : BaseType.values()) { if (v.signature == typeSignature) { returnValue = true; break; } } return returnValue; } } /** * A reference type signature represents a reference type of the Java * programming language, that is, a class or interface type, a type * variable, or an array type. * * @see <a * href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.9.1"> * VM Spec: Reference Type Signature * </a> */ public enum ReferenceType { ClassTypeSignature('L'), ClassTypeSignatureSuffix(';'), TypeVariableSignature('T'), ArrayTypeSignature('['); public final char signature; private ReferenceType(char c) { this.signature = c; } } }
c794b9a103647119aa449a317cf94d67ce356f1f
6045e1452cef90525cc245becdef008efdb774a0
/Cell/src/ACP/Operations/divHandler.java
93bc55fa9e2be593225bdbc735c080aaf397c83a
[]
no_license
StarHunter729/Proyecto-Comp-Final
faaa031d9440b67f68cf6584ddda8b0bd82dc9aa
804148930b8718bbdd35d1675ebe477ead1edc8a
refs/heads/main
2023-01-27T17:20:00.721518
2020-12-07T23:48:07
2020-12-07T23:48:07
319,473,597
0
0
null
null
null
null
UTF-8
Java
false
false
6,640
java
package ACP.Operations; import Objects.Message; import Services.Divide; import fileHandler.Clonation; import fileHandler.fileValidation; import java.io.File; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.lang.management.ManagementFactory; import java.net.MalformedURLException; import java.net.Socket; import java.net.URL; import java.net.URLClassLoader; import java.net.UnknownHostException; public class divHandler { int Min = 5000; int Max = 5010; int localPort; Socket localSocket; ObjectOutputStream oos; ObjectInputStream ois; String fingerPrint = getProcessId(); String temporalOperaton = ""; double numDiv = 0.0D; String fileFldr = "C:/temp/Services/Divide"; String file = "C:/temp/Services/Divide/Divide.jar"; String rawFile = "C:/temp/Services/Divide/Divide-Clone"; public divHandler() { this.numDiv = (double)fileValidation.getNumServices(this.fileFldr); } public void outputStream() { try { this.oos = new ObjectOutputStream(this.localSocket.getOutputStream()); } catch (IOException var2) { var2.printStackTrace(); } } public void connectToDataField() { for(int port = this.Min; port <= this.Max; ++port) { try { this.localSocket = new Socket("127.0.0.1", port); this.localPort = port; break; } catch (UnknownHostException var3) { var3.printStackTrace(); } catch (IOException var4) { var4.printStackTrace(); } } } public void reportAliveStatus() { Message msg = new Message(3); this.forwardMessage(msg); System.out.println("Sent initial message"); } public void forwardMessage(Message msg) { try { this.oos.writeObject(msg); System.out.println("A message was sent with the msg being " + msg.getMsg()); } catch (IOException var3) { System.out.println("Could not send message"); var3.printStackTrace(); } } public void getMessage() throws ClassNotFoundException { System.out.println("Listening for messages"); try { this.ois = new ObjectInputStream(this.localSocket.getInputStream()); } catch (IOException var3) { System.out.println("Lost connection"); } while(true) { while(true) { try { Message receivedMessage = (Message)this.ois.readObject(); System.out.println("Received message " + receivedMessage.getMsg() + " CC " + receivedMessage.getContentCode()); this.processObject(receivedMessage); } catch (IOException var4) { System.out.println("Error reading message"); } } } } public void processObject(Message msg) { if (this.temporalOperaton != msg.getEventId()) { this.temporalOperaton = msg.getEventId(); } switch(msg.getContentCode()) { case 8: if (msg.getSecond() != 0.0D) { double result = divideController(msg.getFirst(), msg.getSecond()); System.out.println("Divide.jar has received the parameters: " + msg.getFirst() + " " + msg.getSecond()); Message resp = new Message(result, msg); resp.setEventId(this.temporalOperaton); this.forwardMessage(resp); } case 9: case 10: case 11: case 12: default: break; case 13: System.out.println("Got a request for div acknowledgement "); Message ackMessage = new Message(); ackMessage.setContentCode(4); ackMessage.setEventId(this.fingerPrint); ackMessage.setFirst(this.numDiv); ackMessage.setMsg("d"); this.forwardMessage(ackMessage); break; case 14: int tempCells = 0; String var3; switch((var3 = msg.getMsg()).hashCode()) { case 100: if (var3.equals("d")) { tempCells = (int)this.numDiv; } } if (msg.getFirst() > this.numDiv) { for(int i = tempCells; (double)i < msg.getFirst() - 1.0D; ++i) { File from = new File(this.file); File to = Clonation.validateClone(this.file, this.rawFile); try { Clonation.copy(from, to); } catch (IOException var8) { var8.printStackTrace(); } } } this.numDiv = (double)fileValidation.getNumServices(this.fileFldr); } } public static double divideController(double val1, double val2) { double ans = 0.0D; double num1 = val1; double num2 = val2; try { URL[] classLoaderUrls = new URL[]{new URL("file:C:/temp/Services/Divide")}; URLClassLoader urlClassLoader = new URLClassLoader(classLoaderUrls); Class<?> divClass = urlClassLoader.loadClass("Services.Divide"); Divide divFunction = (Divide)divClass.newInstance(); ans = divFunction.divideOperation(num1, num2); System.out.println(ans); } catch (MalformedURLException var14) { var14.printStackTrace(); } catch (ClassNotFoundException var15) { var15.printStackTrace(); } catch (IllegalArgumentException var16) { var16.printStackTrace(); } catch (InstantiationException var17) { var17.printStackTrace(); } catch (IllegalAccessException var18) { var18.printStackTrace(); } return ans; } private static String getProcessId() { String jvmName = ManagementFactory.getRuntimeMXBean().getName(); int index = jvmName.indexOf(64); if (index < 1) { return ""; } else { try { return Long.toString(Long.parseLong(jvmName.substring(0, index))); } catch (NumberFormatException var3) { return ""; } } } }
341fb77c96905ee20a14d64fd0c8a581e9f5bfe1
64b76116ae6186bc9c84cb2717bd8631230cf69b
/USACO/src/proximity.java
0b5f51032d0238d1ae695e989f793e162435be90
[]
no_license
allenlu378/USACO-upload
87293d9d5340015cd76b022a363b18fc974d89f0
1b9a446b828c82216669743c9f052ff56c128d3f
refs/heads/master
2022-12-02T18:45:07.772413
2020-08-18T00:33:29
2020-08-18T00:33:29
288,314,717
0
0
null
null
null
null
UTF-8
Java
false
false
1,143
java
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class proximity { static int numCows, diff, maxBreed = -1; static int[] cows; public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new FileReader("proximity.in")); File file = new File("proximity.out"); PrintWriter out = new PrintWriter(file); StringTokenizer st = new StringTokenizer(f.readLine()); numCows = Integer.parseInt(st.nextToken()); diff = Integer.parseInt(st.nextToken()); cows = new int[numCows]; for (int i = 0; i < numCows; i++) { cows[i] = Integer.parseInt(f.readLine()); } maxIndex(); System.out.println(maxBreed); out.println(maxBreed); out.close(); } public static void maxIndex() { for (int i = numCows - 1; i > 0; i--) { if (cows[i] > maxBreed) { for (int j = i - 1; j > -1; j--) { if (cows[i] != cows[j]) { continue; } if (i - j > diff) { break; } else { maxBreed = cows[i]; break; } } } } } }
27e9dbd11afca1163368ff40ccef348ee6fb464c
185e581a2d29a637dc7a3bb7c102df9866c0f613
/src/main/java/com/seed/rabbit/producer/service/RabbitMQService.java
167eb355af904e62a074d348f9e31e514251e5fe
[]
no_license
rsanto27/seed-java-springboot-rabbitMQ_producer
eee9a18900eb7e1d13a2ad0a9da6b8ba0374204e
6f3a96f3e38efc2d23c5f3d6c0c4c87f6765e693
refs/heads/master
2023-02-12T07:25:17.645059
2021-01-14T13:08:21
2021-01-14T13:08:21
314,048,652
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package com.seed.rabbit.producer.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.seed.rabbit.DTO.Message; import com.seed.rabbit.producer.AMQP.IAmqpProducer; @Service public class RabbitMQService implements IAmqpService { @Autowired private IAmqpProducer<Message> amqp; @Override public void sendToConsumer(Message m) { amqp.producer(m); } }
02e6f77dfd9cc1b145ca5c9104933c8d4e11da48
fa383c81524e96ad79fb4551f8b4984f5631810a
/xmcamera/src/main/java/management/lxgdgj/com/xmcamera/listener/OnFunForgetPasswListener.java
641cc3ab006d866a0129d5a558af28950c11b4d6
[]
no_license
MrPsw/xmDemo
325ca222f82128f45ec9f195e2738b47aeb3ad63
69eabda99ac0f689cc16c59c64199558a9be45c2
refs/heads/master
2020-09-27T08:51:30.792111
2019-12-09T02:31:43
2019-12-09T02:31:43
226,478,555
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
package management.lxgdgj.com.xmcamera.listener; /** * Created by Jeff on 4/15/16. */ public interface OnFunForgetPasswListener extends OnFunListener { // 请求发送验证码成功 void onRequestCodeSuccess(); // 请求发送验证码失败 void onRequestCodeFailed(final Integer errCode); // 验证码验证成功 void onVerifyCodeSuccess(); // 验证码验证失败 void onVerifyFailed(final Integer errCode); // 密码重置成功 void onResetPasswSucess(); // 密码重置失败 void onResetPasswFailed(final Integer errCode); }
74fca144a5a8883da6fd3002aceaac4687cdf372
c0018ab1e7e78469f3bc26a69b4e30396a69a587
/nightfoodfinder/src/main/java/kr/co/nff/repository/vo/ReportReview.java
ef16d6857283375d34e699555217fae91c94608a
[]
no_license
Night-Food-Finder/java-program
46511ee412d7d244c2b284417ad6f3b4fe5c333f
2b97dc63b5ba62c2a5952c164490f847110f0950
refs/heads/master
2022-12-22T08:21:35.388085
2020-01-21T08:43:01
2020-01-21T08:43:01
220,224,627
2
6
null
2022-12-15T23:30:22
2019-11-07T11:47:23
Java
UTF-8
Java
false
false
249
java
package kr.co.nff.repository.vo; import lombok.Data; @Data public class ReportReview extends Pagination{ private int reportNo; private int userNo; private int reviewNo; private String reason; //신고한 사람들 private String nickName; }
f4023b75b42a583249c3ce272e51a682c8d5d7d7
6204f5fb17b01bc8419edd13aa91a3c1a8b75966
/app/src/main/java/com/fb/firebird/BaseFragment.java
44c460b8a6eaeb60750cd4a4bc56fe593862f6ee
[]
no_license
entropyio/firebird-android
94b64d1ae05ffea9ff262114a6dc2a4a635ff932
3a26d0c07f2db78f12767d9e787890ce39984fbb
refs/heads/master
2020-12-28T04:36:43.659707
2020-02-29T05:45:59
2020-02-29T05:45:59
238,183,365
0
0
null
null
null
null
UTF-8
Java
false
false
6,592
java
package com.fb.firebird; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import com.fb.firebird.dialog.LoadingDialog; import com.fb.firebird.dialog.LoginDialog; import com.fb.firebird.enums.RetCodeEnum; import com.fb.firebird.http.HttpCallback; import com.fb.firebird.http.HttpUtil; import com.fb.firebird.json.ResultData; import com.fb.firebird.utils.AesUtil; import com.fb.firebird.utils.FormatUtil; import com.fb.firebird.utils.JsonUtil; import java.lang.reflect.Type; import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; public abstract class BaseFragment<T> extends Fragment { private static final String TAG = BaseFragment.class.getSimpleName(); public long userId; public long symbolId; public Handler mHandler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(Message msg) { return false; } }); private LoadingDialog loadingDialog; private LoginDialog loginDialog; @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = super.onCreateView(inflater, container, savedInstanceState); userId = 1; symbolId = 0; // loading loadingDialog = new LoadingDialog(this.getActivity(), "正在加载...", R.drawable.ic_dialog_loading); return root; } public void showLoading() { if (null != loadingDialog && !loadingDialog.isShowing()) { loadingDialog.show(); } } public void hideLoading() { if (null != loadingDialog && loadingDialog.isShowing()) { loadingDialog.dismiss(); } } public void httpPost(String url, Map<String, Object> paramsMap) { httpPost(url, paramsMap, null, true); } public void httpPost(String url, Map<String, Object> paramsMap, boolean showLoading) { httpPost(url, paramsMap, null, showLoading); } public void httpPost(String url, Map<String, Object> paramsMap, final String message, boolean showLoading) { if (showLoading) { showLoading(); } // todo: append userId, ts and token to params if (null == paramsMap) { paramsMap = new HashMap<>(); } paramsMap.put("userId", 1); // get from login file paramsMap.put("ts", 1579760667789l); paramsMap.put("token", "6c1e5239c801e8f004ac5c68ad23bea4"); String params = "q=" + AesUtil.encrypt(FormatUtil.getHttpParams(paramsMap)); byte[] postData = params.getBytes(); HttpUtil.getUtil().httpPost(url, postData, new HttpCallback<String>() { @Override public void onSuccess(final String response) { Log.d(TAG, response); Type type = getDataType(); final ResultData<T> jsonData = JsonUtil.JsonToObject(response, type); mHandler.post(new Runnable() { @Override public void run() { // handle error code if (null == jsonData) { showMessage("数据格式错误"); hideLoading(); return; } if (jsonData.getRetCode() == RetCodeEnum.SUCCESS.getCode()) { if (null != message) { showMessage(message); } else { updateData(jsonData); } } else if (jsonData.getRetCode() == RetCodeEnum.NEED_LOGIN.getCode()) { // do login doLogin(); } else { showMessage(jsonData.getMessage()); } hideLoading(); } }); } @Override public void onError(final String error) { mHandler.post(new Runnable() { @Override public void run() { showMessage("网络连接失败"); hideLoading(); } }); } }); } /** * HTTP json数据解析类型,由子类返回bean类型 * * @return */ public abstract Type getDataType(); /** * 更新子类UI数据 * * @param data */ public abstract void updateData(ResultData<T> data); public void showMessage(String msg) { Toast.makeText(this.getActivity(), msg, Toast.LENGTH_SHORT).show(); } public void setViewText(TextView view, double value, String append, double colorType) { this.setViewText(view, value, 2, append, colorType); } public void setViewText(TextView view, double value, int fixed, String append, double colorType) { String text = FormatUtil.formatNumber(value, fixed); if (null != append) { text += append; } view.setText(text); BigDecimal color = new BigDecimal(colorType); BigDecimal zero = new BigDecimal(0.0); if (color.compareTo(zero) > 0) { view.setTextColor(this.getResources().getColor(R.color.positive)); } else if (color.compareTo(zero) < 0) { view.setTextColor(this.getResources().getColor(R.color.negative)); } } /** * 显示登录对话框 */ public void doLogin() { Log.i(TAG, "need do authentication."); if (null == loginDialog) { loginDialog = new LoginDialog(this.getActivity()); } loginDialog.show(); } public void doRefresh() { onResume(); } }
1e15bead94d55786c24f59f11512fe8897664e1c
6a37d7beb83e62680c6e1d222c47ff813b1b267e
/contiki/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiBeeper.java
69597ec9dcf39c71a85d0336f54b5aa7544d23a1
[ "BSD-3-Clause" ]
permissive
EDAyele/ptunes
e367a4e42da180943d39604b2cb91772da8bb875
e125eab205c32770f95d14425914b1ca9f6f8069
refs/heads/master
2020-12-28T23:05:22.520778
2013-09-24T18:25:34
2013-09-24T18:25:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,505
java
/* * Copyright (c) 2008, Swedish Institute of Computer Science. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id: ContikiBeeper.java,v 1.10 2009/05/26 14:24:20 fros4943 Exp $ */ package se.sics.cooja.contikimote.interfaces; import java.awt.Dimension; import java.awt.Toolkit; import java.util.*; import javax.swing.*; import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.*; import se.sics.cooja.contikimote.ContikiMoteInterface; import se.sics.cooja.interfaces.Beeper; import se.sics.cooja.interfaces.PolledAfterActiveTicks; /** * Beeper mote interface. * * Contiki variables: * <ul> * <li>char simBeeped (1=on, else off) * </ul> * <p> * * Core interface: * <ul> * <li>beep_interface * </ul> * <p> * * This observable is changed and notifies observers when the mote beeps. * * @author Fredrik Osterlind */ public class ContikiBeeper extends Beeper implements ContikiMoteInterface, PolledAfterActiveTicks { private Mote mote = null; private SectionMoteMemory moteMem = null; private static Logger logger = Logger.getLogger(ContikiBeeper.class); /** * Assuming beep always lasts for 0.1 seconds. ESB measured energy * consumption: 16.69 mA. Total energy consumption of a beep is then: * 0.1*16.69 */ private final double ENERGY_CONSUMPTION_BEEP; private double myEnergyConsumption = 0.0; /** * Creates an interface to the beeper at mote. * * @param mote * Beeper's mote. * @see Mote * @see se.sics.cooja.MoteInterfaceHandler */ public ContikiBeeper(Mote mote) { // Read class configurations of this mote type ENERGY_CONSUMPTION_BEEP = mote.getType().getConfig().getDoubleValue( ContikiBeeper.class, "BEEP_CONSUMPTION_mQ"); this.mote = mote; this.moteMem = (SectionMoteMemory) mote.getMemory(); } public boolean isBeeping() { return moteMem.getByteValueOf("simBeeped") == 1; } public static String[] getCoreInterfaceDependencies() { return new String[]{"beep_interface"}; } private TimeEvent stopBeepEvent = new MoteTimeEvent(mote, 0) { public void execute(long t) { myEnergyConsumption = 0.0; } }; public void doActionsAfterTick() { if (moteMem.getByteValueOf("simBeeped") == 1) { myEnergyConsumption = ENERGY_CONSUMPTION_BEEP; this.setChanged(); this.notifyObservers(mote); moteMem.setByteValueOf("simBeeped", (byte) 0); /* Schedule stop beeping (reset energy consumption) */ mote.getSimulation().scheduleEvent(stopBeepEvent, mote.getSimulation().getSimulationTime()+Simulation.MILLISECOND); } } public JPanel getInterfaceVisualizer() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); final JLabel statusLabel = new JLabel("Last beep at time: ?"); panel.add(statusLabel); Observer observer; this.addObserver(observer = new Observer() { public void update(Observable obs, Object obj) { if (!isBeeping()) { return; } long currentTime = mote.getSimulation().getSimulationTime(); statusLabel.setText("Last beep at time: " + currentTime); /* Beep on speakers */ Toolkit.getDefaultToolkit().beep(); } }); // Saving observer reference for releaseInterfaceVisualizer panel.putClientProperty("intf_obs", observer); panel.setMinimumSize(new Dimension(140, 60)); panel.setPreferredSize(new Dimension(140, 60)); return panel; } public void releaseInterfaceVisualizer(JPanel panel) { Observer observer = (Observer) panel.getClientProperty("intf_obs"); if (observer == null) { logger.fatal("Error when releasing panel, observer is null"); return; } this.deleteObserver(observer); } public double energyConsumption() { return myEnergyConsumption; } public Collection<Element> getConfigXML() { return null; } public void setConfigXML(Collection<Element> configXML, boolean visAvailable) { } }
233edaac559527ca30306a3503bd18e72198ef81
a316479a07f13a632edd3b36973ab752047f1d93
/Humour- v0.1/src/com/service/imp/ManageServiceImp.java
ffb7fbdd924837318573d2b484eafb6d9a175396
[]
no_license
shendustudyzrc/humours
9a123083b4a623078eb7843ecd0c63a06ee622b7
bfe18544564542bcbf4d32f26298b7e459e82f82
refs/heads/master
2020-03-31T03:06:52.672965
2018-10-25T13:55:13
2018-10-25T13:55:19
151,853,273
0
0
null
null
null
null
UTF-8
Java
false
false
1,232
java
package com.service.imp; import java.io.IOException; import java.io.Reader; import java.sql.SQLException; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import org.springframework.stereotype.Service; import com.domain.Manage; import com.service.IManageService; @Service public class ManageServiceImp implements IManageService{ private static SqlSessionFactory sqlSessionFactory; private static Reader reader; static{ try { reader=Resources.getResourceAsReader("mybatis-config.xml"); sqlSessionFactory=new SqlSessionFactoryBuilder().build(reader); } catch (IOException e) { e.printStackTrace(); } } @Override public boolean select(String name, String password) throws SQLException { boolean b=false; SqlSession session=null; session=sqlSessionFactory.openSession(); Manage manage=new Manage(); manage.setName(name); manage.setPassword(password); Manage m=session.selectOne("com.mybatis.ManageMapper.selectManageLogin", manage); if(m!=null){ b=true; } session.commit(); return b; } }
7a640db0923da1c98bf68ea1e2b085db33b1d485
3538406360a3ebe52f00e7b53cc06acb58b004a0
/deegree-core/trunk/src/main/java/org/deegree/metadata/persistence/MetadataStoreTransaction.java
501dc3bd1db608dacb3dd842c671f8826ce95c8e
[]
no_license
izaslavsky/incf-dai
d563e63aa7cf7147ceb5a60c2b7ade3754f502c8
4ba6954720974139388ac0f77040fabe28fb4752
refs/heads/master
2016-09-06T11:13:51.903896
2013-02-07T02:30:15
2013-02-07T02:30:15
32,130,589
0
1
null
null
null
null
UTF-8
Java
false
false
4,321
java
//$HeadURL: http://svn.wald.intevation.org/svn/deegree/deegree3/branches/3.0/deegree-core/src/main/java/org/deegree/metadata/persistence/MetadataStoreTransaction.java $ /*---------------------------------------------------------------------------- This file is part of deegree, http://deegree.org/ Copyright (C) 2001-2009 by: - Department of Geography, University of Bonn - and - lat/lon GmbH - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact information: lat/lon GmbH Aennchenstr. 19, 53177 Bonn Germany http://lat-lon.de/ Department of Geography, University of Bonn Prof. Dr. Klaus Greve Postfach 1147, 53001 Bonn Germany http://www.geographie.uni-bonn.de/deegree/ e-mail: [email protected] ----------------------------------------------------------------------------*/ package org.deegree.metadata.persistence; import java.util.List; import org.deegree.metadata.publication.DeleteTransaction; import org.deegree.metadata.publication.InsertTransaction; import org.deegree.metadata.publication.UpdateTransaction; /** * Provides transactional access to a {@link MetadataStore}. * <p> * Please note that a transaction must always be ended by calling either {@link #commit()} or {@link #rollback()}. * </p> * * @see MetadataStore#acquireTransaction() * * @author <a href="mailto:[email protected]">Markus Schneider</a> * @author last edited by: $Author: sthomas $ * * @version $Revision: 27732 $, $Date: 2010-11-03 02:52:35 -0700 (Wed, 03 Nov 2010) $ */ public interface MetadataStoreTransaction { /** * Makes the changes persistent that have been performed in this transaction and releases the transaction instance * so other clients may acquire a transaction on the {@link MetadataStore}. * * @throws MetadataStoreException * if the committing fails */ public void commit() throws MetadataStoreException; /** * Aborts the changes that have been performed in this transaction and releases the transaction instance so other * clients may acquire a transaction on the {@link MetadataStore}. * * @throws MetadataStoreException * if the rollback fails */ public void rollback() throws MetadataStoreException; /** * Performs the given {@link InsertTransaction}. * * @param insert * operation to be performed, must not be <code>null</code> * @return identifier of the inserted records, can be empty, but never <code>null</code> * @throws MetadataStoreException * if the insertion failed */ public List<String> performInsert( InsertTransaction insert ) throws MetadataStoreException, MetadataInspectorException; /** * Performs the given {@link DeleteTransaction}. * * @param delete * operation to be performed, must not be <code>null</code> * @return number of deleted records * @throws MetadataStoreException * if the deletion failed */ public int performDelete( DeleteTransaction delete ) throws MetadataStoreException; /** * Performs the given {@link UpdateTransaction}. * * @param update * operation to be performed, must not be <code>null</code> * @return number of updated records * @throws MetadataStoreException * if the update failed */ public int performUpdate( UpdateTransaction update ) throws MetadataStoreException, MetadataInspectorException; }
[ "davlit0917@7cbae6f4-d32f-11de-a711-9fae7a67fc1c" ]
davlit0917@7cbae6f4-d32f-11de-a711-9fae7a67fc1c
15e2b1c84f2c20e80a9d0c15f4aa7376c9736d50
ea0331ca8c9b3be831268d44e9abafb8460faef2
/code/src/main/java/com/nongye/p2p/service/IAccountFlowService.java
aef77b7a54cafc9a026e91aece410063097b1345
[]
no_license
hongLev/P2P
64faf3ad1c628bbe820c244ebb06271cf3657d16
88beeb7d9348103ed67de47939bdb5b646f828ff
refs/heads/master
2022-12-25T01:44:03.179800
2019-08-06T12:40:33
2019-08-06T12:40:33
200,837,279
0
0
null
2022-12-16T03:06:50
2019-08-06T11:24:01
JavaScript
UTF-8
Java
false
false
1,793
java
package com.nongye.p2p.service; import java.math.BigDecimal; import com.nongye.p2p.domain.Account; import com.nongye.p2p.domain.Bid; import com.nongye.p2p.domain.BidRequest; import com.nongye.p2p.domain.MoneyWithDraw; import com.nongye.p2p.domain.RechargeofFline; /** * 账户流水对象 * * @author Administrator * */ public interface IAccountFlowService { /** * 充值申请流水 * @param recharge * @param account */ public void insert(RechargeofFline recharge, Account account); /** * 投标流水 * @param account * @param cuurentAccount */ public void bid(BigDecimal account, Account cuurentAccount); /** * 投标失败流水 * @param account * @param cuurentAccount */ public void fullAudit1(BigDecimal account, Account cuurentAccount); /** * 提现申请流水 * @param account * @param cuurentAccount */ public void MoneyWith(BigDecimal account, Account cuurentAccount); /** * 提现手续费流水 * * @param m * @param account */ void withDrawChargeFee(MoneyWithDraw m, Account cuurentAccount); /** * 提现成功流水 * * @param m * @param account */ void withDrawSuccess(BigDecimal amount, Account cuurentAccount); /** * 生成提现申请拒绝流水 * * @param m * @param account */ void withDrawFailed(MoneyWithDraw m, Account cuurentAccount); /** * 生成借款成功流水 * @param m * @param cuurentAccount */ void borrowSuccess(BidRequest m, Account cuurentAccount); /** * 生成借款成功 扣除手续费流水 * @param account * @param cuurentAccount */ void borrowChargeFee(BigDecimal account, Account cuurentAccount); /** * 生成成功投标流水 * @param bid * @param cuurentAccount */ void bidSuccess(Bid bid, Account cuurentAccount); }
473af98c9da45e28480dafd17c617e0c9f7642fd
4446e7dd3798116d2a99fcd60c05c14ce413f9f7
/dc-platform/dc-risk/product/src/main/java/com/opengamma/strata/product/fxopt/ResolvedFxVanillaOption.java
d42c49db89cd00eafa03050f82238d1dfd52d528
[ "Apache-2.0" ]
permissive
jmptrader/daocheng
c69739650d5be61facf792272c41b6bd04f23935
2fff5774b054c69cdd8b79c5e45a84b5ade65338
refs/heads/master
2021-01-12T14:17:28.734470
2016-08-28T07:25:03
2016-08-28T07:25:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,610
java
/** * Copyright (C) 2015 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.strata.product.fxopt; import static com.opengamma.strata.collect.ArgChecker.inOrderOrEqual; import java.io.Serializable; import java.time.LocalDate; import java.time.ZonedDateTime; import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; import org.joda.beans.Bean; import org.joda.beans.BeanDefinition; import org.joda.beans.ImmutableBean; import org.joda.beans.ImmutableValidator; import org.joda.beans.JodaBeanUtils; import org.joda.beans.MetaProperty; import org.joda.beans.Property; import org.joda.beans.PropertyDefinition; import org.joda.beans.impl.direct.DirectFieldsBeanBuilder; import org.joda.beans.impl.direct.DirectMetaBean; import org.joda.beans.impl.direct.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.strata.basics.ReferenceData; import com.opengamma.strata.basics.currency.Currency; import com.opengamma.strata.product.ResolvedProduct; import com.opengamma.strata.product.common.LongShort; import com.opengamma.strata.product.common.PutCall; import com.opengamma.strata.product.fx.ResolvedFxSingle; /** * A vanilla FX option, resolved for pricing. * <p> * This is the resolved form of {@link FxVanillaOption} and is an input to the pricers. * Applications will typically create a {@code ResolvedFxVanillaOption} from a {@code FxVanillaOption} * using {@link FxVanillaOption#resolve(ReferenceData)}. * <p> * A {@code ResolvedFxVanillaOption} is bound to data that changes over time, such as holiday calendars. * If the data changes, such as the addition of a new holiday, the resolved form will not be updated. * Care must be taken when placing the resolved form in a cache or persistence layer. */ @BeanDefinition public final class ResolvedFxVanillaOption implements ResolvedProduct, ImmutableBean, Serializable { /** * Whether the option is long or short. * <p> * At expiry, the long party will have the option to enter in this transaction; * the short party will, at the option of the long party, potentially enter into the inverse transaction. */ @PropertyDefinition(validate = "notNull") private final LongShort longShort; /** * The expiry date-time of the option. * <p> * The option is European, and can only be exercised on the expiry date. */ @PropertyDefinition(validate = "notNull") private final ZonedDateTime expiry; /** * The underlying foreign exchange transaction. * <p> * At expiry, if the option is in the money, this foreign exchange will occur. * A call option permits the transaction as specified to occur. * A put option permits the inverse transaction to occur. */ @PropertyDefinition(validate = "notNull") private final ResolvedFxSingle underlying; //------------------------------------------------------------------------- @ImmutableValidator private void validate() { inOrderOrEqual(expiry.toLocalDate(), underlying.getPaymentDate(), "expiry.date", "underlying.paymentDate"); } //------------------------------------------------------------------------- /** * Gets the expiry date of the option. * * @return the expiry date */ public LocalDate getExpiryDate() { return expiry.toLocalDate(); } /** * Gets the strike rate. * * @return the strike */ public double getStrike() { return Math.abs(underlying.getCounterCurrencyPayment().getAmount() / underlying.getBaseCurrencyPayment().getAmount()); } /** * Returns the put/call flag. * <p> * This is the put/call for the base currency. * If the amount for the base currency is positive, the option is a call on the base currency (put on counter currency). * If the amount for the base currency is negative, the option is a put on the base currency (call on counter currency). * * @return the put or call */ public PutCall getPutCall() { return underlying.getCounterCurrencyPayment().getAmount() > 0d ? PutCall.PUT : PutCall.CALL; } /** * Get the counter currency of the underlying FX transaction. * * @return the counter currency */ public Currency getCounterCurrency() { return underlying.getCounterCurrencyPayment().getCurrency(); } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code ResolvedFxVanillaOption}. * @return the meta-bean, not null */ public static ResolvedFxVanillaOption.Meta meta() { return ResolvedFxVanillaOption.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(ResolvedFxVanillaOption.Meta.INSTANCE); } /** * The serialization version id. */ private static final long serialVersionUID = 1L; /** * Returns a builder used to create an instance of the bean. * @return the builder, not null */ public static ResolvedFxVanillaOption.Builder builder() { return new ResolvedFxVanillaOption.Builder(); } private ResolvedFxVanillaOption( LongShort longShort, ZonedDateTime expiry, ResolvedFxSingle underlying) { JodaBeanUtils.notNull(longShort, "longShort"); JodaBeanUtils.notNull(expiry, "expiry"); JodaBeanUtils.notNull(underlying, "underlying"); this.longShort = longShort; this.expiry = expiry; this.underlying = underlying; validate(); } @Override public ResolvedFxVanillaOption.Meta metaBean() { return ResolvedFxVanillaOption.Meta.INSTANCE; } @Override public <R> Property<R> property(String propertyName) { return metaBean().<R>metaProperty(propertyName).createProperty(this); } @Override public Set<String> propertyNames() { return metaBean().metaPropertyMap().keySet(); } //----------------------------------------------------------------------- /** * Gets whether the option is long or short. * <p> * At expiry, the long party will have the option to enter in this transaction; * the short party will, at the option of the long party, potentially enter into the inverse transaction. * @return the value of the property, not null */ public LongShort getLongShort() { return longShort; } //----------------------------------------------------------------------- /** * Gets the expiry date-time of the option. * <p> * The option is European, and can only be exercised on the expiry date. * @return the value of the property, not null */ public ZonedDateTime getExpiry() { return expiry; } //----------------------------------------------------------------------- /** * Gets the underlying foreign exchange transaction. * <p> * At expiry, if the option is in the money, this foreign exchange will occur. * A call option permits the transaction as specified to occur. * A put option permits the inverse transaction to occur. * @return the value of the property, not null */ public ResolvedFxSingle getUnderlying() { return underlying; } //----------------------------------------------------------------------- /** * Returns a builder that allows this bean to be mutated. * @return the mutable builder, not null */ public Builder toBuilder() { return new Builder(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { ResolvedFxVanillaOption other = (ResolvedFxVanillaOption) obj; return JodaBeanUtils.equal(longShort, other.longShort) && JodaBeanUtils.equal(expiry, other.expiry) && JodaBeanUtils.equal(underlying, other.underlying); } return false; } @Override public int hashCode() { int hash = getClass().hashCode(); hash = hash * 31 + JodaBeanUtils.hashCode(longShort); hash = hash * 31 + JodaBeanUtils.hashCode(expiry); hash = hash * 31 + JodaBeanUtils.hashCode(underlying); return hash; } @Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append("ResolvedFxVanillaOption{"); buf.append("longShort").append('=').append(longShort).append(',').append(' '); buf.append("expiry").append('=').append(expiry).append(',').append(' '); buf.append("underlying").append('=').append(JodaBeanUtils.toString(underlying)); buf.append('}'); return buf.toString(); } //----------------------------------------------------------------------- /** * The meta-bean for {@code ResolvedFxVanillaOption}. */ public static final class Meta extends DirectMetaBean { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code longShort} property. */ private final MetaProperty<LongShort> longShort = DirectMetaProperty.ofImmutable( this, "longShort", ResolvedFxVanillaOption.class, LongShort.class); /** * The meta-property for the {@code expiry} property. */ private final MetaProperty<ZonedDateTime> expiry = DirectMetaProperty.ofImmutable( this, "expiry", ResolvedFxVanillaOption.class, ZonedDateTime.class); /** * The meta-property for the {@code underlying} property. */ private final MetaProperty<ResolvedFxSingle> underlying = DirectMetaProperty.ofImmutable( this, "underlying", ResolvedFxVanillaOption.class, ResolvedFxSingle.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> metaPropertyMap$ = new DirectMetaPropertyMap( this, null, "longShort", "expiry", "underlying"); /** * Restricted constructor. */ private Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case 116685664: // longShort return longShort; case -1289159373: // expiry return expiry; case -1770633379: // underlying return underlying; } return super.metaPropertyGet(propertyName); } @Override public ResolvedFxVanillaOption.Builder builder() { return new ResolvedFxVanillaOption.Builder(); } @Override public Class<? extends ResolvedFxVanillaOption> beanType() { return ResolvedFxVanillaOption.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code longShort} property. * @return the meta-property, not null */ public MetaProperty<LongShort> longShort() { return longShort; } /** * The meta-property for the {@code expiry} property. * @return the meta-property, not null */ public MetaProperty<ZonedDateTime> expiry() { return expiry; } /** * The meta-property for the {@code underlying} property. * @return the meta-property, not null */ public MetaProperty<ResolvedFxSingle> underlying() { return underlying; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 116685664: // longShort return ((ResolvedFxVanillaOption) bean).getLongShort(); case -1289159373: // expiry return ((ResolvedFxVanillaOption) bean).getExpiry(); case -1770633379: // underlying return ((ResolvedFxVanillaOption) bean).getUnderlying(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { metaProperty(propertyName); if (quiet) { return; } throw new UnsupportedOperationException("Property cannot be written: " + propertyName); } } //----------------------------------------------------------------------- /** * The bean-builder for {@code ResolvedFxVanillaOption}. */ public static final class Builder extends DirectFieldsBeanBuilder<ResolvedFxVanillaOption> { private LongShort longShort; private ZonedDateTime expiry; private ResolvedFxSingle underlying; /** * Restricted constructor. */ private Builder() { } /** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(ResolvedFxVanillaOption beanToCopy) { this.longShort = beanToCopy.getLongShort(); this.expiry = beanToCopy.getExpiry(); this.underlying = beanToCopy.getUnderlying(); } //----------------------------------------------------------------------- @Override public Object get(String propertyName) { switch (propertyName.hashCode()) { case 116685664: // longShort return longShort; case -1289159373: // expiry return expiry; case -1770633379: // underlying return underlying; default: throw new NoSuchElementException("Unknown property: " + propertyName); } } @Override public Builder set(String propertyName, Object newValue) { switch (propertyName.hashCode()) { case 116685664: // longShort this.longShort = (LongShort) newValue; break; case -1289159373: // expiry this.expiry = (ZonedDateTime) newValue; break; case -1770633379: // underlying this.underlying = (ResolvedFxSingle) newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return this; } @Override public Builder set(MetaProperty<?> property, Object value) { super.set(property, value); return this; } @Override public Builder setString(String propertyName, String value) { setString(meta().metaProperty(propertyName), value); return this; } @Override public Builder setString(MetaProperty<?> property, String value) { super.setString(property, value); return this; } @Override public Builder setAll(Map<String, ? extends Object> propertyValueMap) { super.setAll(propertyValueMap); return this; } @Override public ResolvedFxVanillaOption build() { return new ResolvedFxVanillaOption( longShort, expiry, underlying); } //----------------------------------------------------------------------- /** * Sets whether the option is long or short. * <p> * At expiry, the long party will have the option to enter in this transaction; * the short party will, at the option of the long party, potentially enter into the inverse transaction. * @param longShort the new value, not null * @return this, for chaining, not null */ public Builder longShort(LongShort longShort) { JodaBeanUtils.notNull(longShort, "longShort"); this.longShort = longShort; return this; } /** * Sets the expiry date-time of the option. * <p> * The option is European, and can only be exercised on the expiry date. * @param expiry the new value, not null * @return this, for chaining, not null */ public Builder expiry(ZonedDateTime expiry) { JodaBeanUtils.notNull(expiry, "expiry"); this.expiry = expiry; return this; } /** * Sets the underlying foreign exchange transaction. * <p> * At expiry, if the option is in the money, this foreign exchange will occur. * A call option permits the transaction as specified to occur. * A put option permits the inverse transaction to occur. * @param underlying the new value, not null * @return this, for chaining, not null */ public Builder underlying(ResolvedFxSingle underlying) { JodaBeanUtils.notNull(underlying, "underlying"); this.underlying = underlying; return this; } //----------------------------------------------------------------------- @Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append("ResolvedFxVanillaOption.Builder{"); buf.append("longShort").append('=').append(JodaBeanUtils.toString(longShort)).append(',').append(' '); buf.append("expiry").append('=').append(JodaBeanUtils.toString(expiry)).append(',').append(' '); buf.append("underlying").append('=').append(JodaBeanUtils.toString(underlying)); buf.append('}'); return buf.toString(); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }
cc639c615206dc304ef12c42154951717421d33c
af96c6474835be2cc34ef21b0c2a45e950bb9148
/tests/CoreTests/android/test/TestBrowserActivityTest.java
6afbe3717a37b9ab086797975128e5d1770201ac
[ "Apache-2.0", "LicenseRef-scancode-unicode" ]
permissive
zsol/android_frameworks_base
86abe37fcd4136923cab2d6677e558826f087cf9
8d18426076382edaaea68392a0298d2c32cfa52e
refs/heads/donut
2021-07-04T17:24:05.847586
2010-01-13T19:24:55
2010-01-13T19:24:55
469,422
14
12
NOASSERTION
2020-10-01T18:05:31
2010-01-12T21:20:20
Java
UTF-8
Java
false
false
9,838
java
/* * Copyright (C) 2007 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 android.test; import android.app.Activity; import android.app.Instrumentation; import android.content.Intent; import android.net.Uri; import android.os.RemoteException; import android.os.ServiceManager; import android.view.IWindowManager; import android.widget.ListView; import com.google.android.collect.Lists; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import java.util.List; public class TestBrowserActivityTest extends InstrumentationTestCase { private TestBrowserActivity mTestBrowserActivity; private StubTestBrowserController mTestBrowserController; @Override protected void setUp() throws Exception { super.setUp(); StubTestBrowserActivity.setTopTestSuite(null); mTestBrowserController = new StubTestBrowserController(); ServiceLocator.setTestBrowserController(mTestBrowserController); } @Override protected void tearDown() throws Exception { if (mTestBrowserActivity != null) { mTestBrowserActivity.finish(); } mTestBrowserActivity = null; super.tearDown(); } public void testEmptyListContent() throws Exception { StubTestBrowserActivity.setTopTestSuite(new TestSuite()); mTestBrowserActivity = createActivity(); ListView listView = getListView(); // There is always an item on the list for running all tests. assertEquals("Unexpected number of items on list view.", 1, listView.getCount()); assertEquals("Stubbed Test Browser", mTestBrowserActivity.getTitle().toString()); } public void testOneListContent() throws Exception { List<String> testCaseNames = Lists.newArrayList("AllTests"); StubTestBrowserActivity.setTopTestSuite(createTestSuite(testCaseNames)); mTestBrowserActivity = createActivity(); ListView listView = getListView(); assertListViewContents(testCaseNames, listView); } public void testListWithTestCases() throws Exception { List<String> testCaseNames = Lists.newArrayList("AllTests", "Apples", "Bananas", "Oranges"); StubTestBrowserActivity.setTopTestSuite(createTestSuite(testCaseNames)); mTestBrowserActivity = createActivity(); ListView listView = getListView(); assertListViewContents(testCaseNames, listView); } public void testListWithTestSuite() throws Exception { List<String> testCaseNames = Lists.newArrayList(OneTestTestCase.class.getSimpleName()); StubTestBrowserActivity.setTopTestSuite(new OneTestInTestSuite()); mTestBrowserActivity = createActivity(); ListView listView = getListView(); assertListViewContents(testCaseNames, listView); } public void testSelectATestCase() throws Exception { List<String> testCaseNames = Lists.newArrayList("AllTests"); TestSuite testSuite = createTestSuite(testCaseNames); StubTestBrowserActivity.setTopTestSuite(testSuite); mTestBrowserController.setTestCase(OneTestTestCase.class); mTestBrowserActivity = createActivity(); Instrumentation.ActivityMonitor activityMonitor = getInstrumentation().addMonitor( TestBrowserControllerImpl.TEST_RUNNER_ACTIVITY_CLASS_NAME, null, false); try { assertEquals(0, activityMonitor.getHits()); ListView listView = getListView(); int invokedTestCaseIndex = 0; listView.performItemClick(listView, invokedTestCaseIndex, 0); Activity activity = activityMonitor.waitForActivityWithTimeout(2000); assertNotNull(activity); try { assertEquals(1, activityMonitor.getHits()); assertEquals(invokedTestCaseIndex, mTestBrowserController.getLastPosition()); } finally { activity.finish(); } } finally { getInstrumentation().removeMonitor(activityMonitor); } } public void testCreateFromIntentWithOneTest() throws Exception { List<String> testCaseNames = Lists.newArrayList("testOne"); mTestBrowserActivity = launchTestBrowserActivity(new TestSuite(OneTestTestCase.class)); ListView listView = getListView(); assertListViewContents(testCaseNames, listView); } public void testUpdateListOnStart() throws Exception { StubTestBrowserActivity.setTopTestSuite(new TestSuite()); mTestBrowserActivity = createActivity(); ListView listView = getListView(); assertEquals("Unexpected number of items on list view.", 1, listView.getCount()); List<String> testCaseNames = Lists.newArrayList("AllTests"); StubTestBrowserActivity.setTopTestSuite(createTestSuite(testCaseNames)); getInstrumentation().runOnMainSync(new Runnable() { public void run() { ((StubTestBrowserActivity) mTestBrowserActivity).onStart(); } }); listView = getListView(); assertListViewContents(testCaseNames, listView); } public void testTitleHasTestSuiteName() throws Exception { final String testSuiteName = "com.android.TestSuite"; StubTestBrowserActivity.setTopTestSuite(new TestSuite(testSuiteName)); mTestBrowserActivity = createActivity(); assertEquals("TestSuite", mTestBrowserActivity.getTitle().toString()); } private TestSuite createTestSuite(List<String> testCaseNames) { return createTestSuite(testCaseNames.toArray(new String[testCaseNames.size()])); } private TestSuite createTestSuite(String... testCaseNames) { TestSuite testSuite = new TestSuite(); for (String testCaseName : testCaseNames) { testSuite.addTest(new FakeTestCase(testCaseName)); } return testSuite; } public static class FakeTestCase extends TestCase { public FakeTestCase(String name) { super(name); } } public static class OneTestTestCase extends TestCase { public void testOne() throws Exception { } } public static class OneTestInTestSuite extends TestSuite { public static Test suite() { TestSuite suite = new TestSuite(OneTestInTestSuite.class.getName()); suite.addTestSuite(OneTestTestCase.class); return suite; } } private void assertListViewContents(List<String> expectedTestCaseNames, ListView listView) { assertEquals("Run All", listView.getItemAtPosition(0).toString()); assertEquals("Unexpected number of items on list view.", expectedTestCaseNames.size() + 1, listView.getCount()); for (int i = 0; i < expectedTestCaseNames.size(); i++) { String expectedTestCaseName = expectedTestCaseNames.get(i); String actualTestCaseName = listView.getItemAtPosition(i + 1).toString(); assertEquals("Unexpected test case name. Index: " + i, expectedTestCaseName, actualTestCaseName); } } private ListView getListView() { return mTestBrowserActivity.getListView(); } private TestBrowserActivity createActivity() throws RemoteException { return launchActivity("android.test", StubTestBrowserActivity.class, null); } private Intent createIntent(TestSuite testSuite) { Intent intent = new Intent(Intent.ACTION_RUN); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); String className = StubTestBrowserActivity.class.getName(); String packageName = className.substring(0, className.lastIndexOf(".")); intent.setClassName(packageName, className); intent.setData(Uri.parse(testSuite.getName())); return intent; } private TestBrowserActivity launchTestBrowserActivity(TestSuite testSuite) throws RemoteException { getInstrumentation().setInTouchMode(false); TestBrowserActivity activity = (TestBrowserActivity) getInstrumentation().startActivitySync( createIntent(testSuite)); getInstrumentation().waitForIdleSync(); return activity; } private static class StubTestBrowserController extends TestBrowserControllerImpl { private int mPosition; private Class<? extends TestCase> mTestCaseClass; public Intent getIntentForTestAt(int position) { mPosition = position; Intent intent = new Intent(); intent.setAction(Intent.ACTION_RUN); String className = TestBrowserControllerImpl.TEST_RUNNER_ACTIVITY_CLASS_NAME; String testName = mTestCaseClass.getClass().getName(); String packageName = className.substring(0, className.lastIndexOf(".")); intent.setClassName(packageName, className); intent.setData(Uri.parse(testName)); return intent; } public void setTestCase(Class<? extends TestCase> testCaseClass) { mTestCaseClass = testCaseClass; } public int getLastPosition() { return mPosition; } } }
b3c44b92d05d5510e4146ba142d8317ecbed2914
9a2af30b479be048e736e70e0db4179240de0238
/Soso/Common.java
2bb3de9bef70c50c608e76f902074fdc24233411
[]
no_license
songfeihu/-
a33d665f96fe9d1e87a3c69bf462453871066449
eec1b15cbbc07ef5661e304b62b9cbd58c2ec059
refs/heads/master
2020-03-18T18:41:00.100615
2018-05-28T04:16:32
2018-05-28T04:16:32
135,108,538
0
0
null
null
null
null
GB18030
Java
false
false
334
java
package Soso; // 公共类 public class Common { // 实例化话唠套餐 static TalkPackage talkPackage = new TalkPackage(58, 500, 30); // 实例化网虫套餐 static NetPackage netPackage = new NetPackage(68, 3 * 1024); // 实例化超人套餐 static SuperPackage superPackage = new SuperPackage(78, 200, 50, 1 * 1024); }
91b6a07485ef4a94fbc495c8c352a07b706632c4
54654285d38ed6f79ec2fd503122fea0c11138e1
/src/test/java/org/popper/gherkin/GherkinTest.java
a39e3af558ce28f74ddefb64d5a76c908308190a
[ "Apache-2.0" ]
permissive
mibutec/InlineGherkinExtension
f6ebd431389872c6b3c82f0b5e981d9c38e25620
552d86b8da3c8a403343325c56a7593806add9a9
refs/heads/master
2021-06-03T08:21:34.331116
2021-05-10T15:13:22
2021-05-10T15:13:22
136,519,988
4
0
Apache-2.0
2021-05-10T15:13:23
2018-06-07T19:08:06
Java
UTF-8
Java
false
false
5,984
java
/* * Copyright [2018] [Michael Bulla, [email protected]] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.popper.gherkin; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Random; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @Narrative(inOrderTo = "write gherkin like tests", asA = "Test developer", iWantTo = "use InlineGherkin") @GherkinConfiguration(catchCompleteOutput = true) public class GherkinTest implements GherkinMixin { @Test @Scenario("Some succeeding scenario") @DisplayName("Some succeeding scenario") public void succeedingScenario() { Given("Some given condition", () -> { }); When("Some when condition", () -> { }); Then("Some assertion succeeds", () -> { }); } @Test @Disabled @Scenario("Some failing scenario") @DisplayName("Some failing scenario") public void failingScenario() { Given("Some given condition", () -> { }); When("Some when condition", () -> { throw new Exception("TestException"); }); Then("Some assertion fails", () -> { }); } @Test @Scenario("Some scenario containing table") @DisplayName("Some scenario containing table") public void scenarioContainingTable() { Given("Some given condition", () -> { }); When("You may use a table to create structured data:" + "|Header1|Header2|Header3|" + "|value1 |value2 |value3 |", (table) -> { assertEquals("value1", table.getRow(0).get("Header1")); assertEquals("value2", table.getRow(0).get("Header2")); assertEquals("value3", table.getRow(0).get("Header3")); }); Then("You may use a tables to fill pojos:" + "| SomeInt | SomeBoolean | SomeString |" + "| 1 | true | someString |" + "| 7 | false | |", mapTo(MyPojo.class), (table) -> { assertEquals(1, table.getRow(0).getSomeInt()); assertEquals(true, table.getRow(0).isSomeBoolean()); assertEquals("someString", table.getRow(0).getSomeString()); assertEquals(7, table.getRow(1).getSomeInt()); assertEquals(false, table.getRow(1).isSomeBoolean()); assertEquals("", table.getRow(1).getSomeString()); }); Then("You may use name overrides to decouple Headers from Pojo field names:" + "| my business int expression | my business boolean expression | my business string expression |" + "| 23 | true | for your interest |", mapTo(MyPojo.class).mapHeader("my business int expression", "someInt") .mapHeader("my business boolean expression", "someBoolean") .mapHeader("my business string expression", "someString"), (table) -> { assertEquals(23, table.getRow(0).getSomeInt()); assertEquals(true, table.getRow(0).isSomeBoolean()); assertEquals("for your interest", table.getRow(0).getSomeString()); }); } @Test @Scenario("Some scenario with local reference") @DisplayName("Some scenario with local reference") public void scenarioUsingLocalReference(LocalReference<String> stringHolder) { Given("A string 'Hello' exists", () -> { stringHolder.value = "Hello"; }); When("That string is extended by ', world'", () -> { stringHolder.value += ", world"; }); Then("The reuslt is 'Hello, world'", () -> { assertEquals("Hello, world", stringHolder.value); }); } @Test @Scenario("Some scenario with eventually clause") @DisplayName("Some scenario with eventually clause") public void scenarioWithEventuellyClause(LocalReference<Integer> waitTime, LocalReference<Long> startTime) { Given("Some actions execution time takes a long time", () -> { waitTime.value = new Random().nextInt(1000) + 2000; }); When("That action is triggered", () -> { startTime.value = System.currentTimeMillis(); }); Then("Eventually clause will take care to wait for the result", () -> { assertTrue(System.currentTimeMillis() > (startTime.value + waitTime.value)); }, eventually()); } @SuppressWarnings("unused") private static class MyPojo { private int someInt; private boolean someBoolean; private String someString; public int getSomeInt() { return someInt; } public void setSomeInt(int someInt) { this.someInt = someInt; } public boolean isSomeBoolean() { return someBoolean; } public void setSomeBoolean(boolean someBoolean) { this.someBoolean = someBoolean; } public String getSomeString() { return someString; } public void setSomeString(String someString) { this.someString = someString; } } }
713c0525db6a270c27a0133b0a4eb29a5eea8a5c
ea36d200314401a59db28d217523e895af6d4987
/app/src/main/java/com/example/handschoolapplication/activity/register_dingwei.java
ca898f78e5a3633b0699cc0c26570936e319fb9a
[]
no_license
fxgwl/HandSchoolApplication
ed2e21c1c19574f882559ee21eac6ffd39052ddb
4c14a96835355a08b65de5bb8ac49f03dbaa2859
refs/heads/master
2021-07-22T20:44:39.589202
2020-07-21T02:20:19
2020-07-21T02:20:19
198,532,585
0
0
null
null
null
null
UTF-8
Java
false
false
15,243
java
package com.example.handschoolapplication.activity; import android.content.Intent; import android.location.LocationListener; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.baidu.location.BDLocation; import com.baidu.location.BDLocationListener; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.baidu.mapapi.SDKInitializer; import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BitmapDescriptor; import com.baidu.mapapi.map.BitmapDescriptorFactory; import com.baidu.mapapi.map.MapStatus; import com.baidu.mapapi.map.MapStatusUpdate; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.map.Marker; import com.baidu.mapapi.map.MarkerOptions; import com.baidu.mapapi.map.MyLocationConfiguration; import com.baidu.mapapi.map.MyLocationData; import com.baidu.mapapi.map.OverlayOptions; import com.baidu.mapapi.map.Projection; import com.baidu.mapapi.model.LatLng; import com.baidu.mapapi.search.geocode.GeoCodeResult; import com.baidu.mapapi.search.geocode.GeoCoder; import com.baidu.mapapi.search.geocode.OnGetGeoCoderResultListener; import com.baidu.mapapi.search.geocode.ReverseGeoCodeOption; import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult; import com.example.handschoolapplication.R; import com.example.handschoolapplication.base.BaseActivity; //import com.example.gjj.pingcha; /** * Created by Administrator on 2016/7/27. */ public class register_dingwei extends BaseActivity { private MapView mMapView; private BaiduMap mBaiduMap; private LocationClient locationClient = null; private BDLocationListener myListener = new MyBdlocationListener(); private LocationListener mLocationListener; private String myAddress; private double mylatitude; private double mylongitude;//获取经度坐标; private Marker marker; private boolean isdingwei = true; private Projection projection; private ImageView mycenter; private android.graphics.Point point2; private boolean mypoint = true; private Intent it; private String province, city, district;//省市区 private String currentAddress; private LatLng latLng; private final Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case 1: if (isdingwei) { if ("1".equals(a)) { // point = new LatLng(Double.parseDouble(new SPUtils("user").getString("latitude", mylatitude + "")), // Double.parseDouble(new SPUtils("user").getString("longitude", mylongitude + ""))); // point = } else { isdingwei = false; point = new LatLng(mylatitude, mylongitude); // System.out.println("point.latitude===========================" + point.latitude); // System.out.println("point.longitude===========================" + point.longitude); //设定中心点坐标 // LatLng cenpt = new LatLng(39.12087445341667,117.22135919823971); //定义地图状态 MapStatus mMapStatus = new MapStatus.Builder() .target(point) .zoom(15) .build(); //定义MapStatusUpdate对象,以便描述地图状态将要发生的变化 MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus); //改变地图状态 mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); mBaiduMap.setMapStatus(mMapStatusUpdate); } if (mypoint) { try { projection = mBaiduMap.getProjection(); point2 = projection.toScreenLocation(point); mypoint = false; } catch (Exception e) { e.printStackTrace(); } } } break; case 2: if ("1".equals(a)) { Log.e("aaa", "(register_dingwei.java:106)" + latLng.latitude + "===" + latLng.longitude); // new SPUtils("user").putString("latitude", latLng.latitude + ""); // new SPUtils("user").putString("longitude", latLng.longitude + ""); } it.putExtra("Latitude", latLng.latitude + "");//纬度 it.putExtra("Longitude", latLng.longitude + "");//经度 it.putExtra("city", currentAddress); it.putExtra("Address", currentAddress); // System.out.println("----------currentAddress------------" + currentAddress); // it.putExtra("Province", province); // it.putExtra("City", city); Log.e("aaa", "(register_dingwei.java:127)<---->" + currentAddress); Log.e("aaa", "(register_dingwei.java:132)<--获取到的经纬度-->"+latLng.latitude+" 经度为==="+latLng.longitude); etAddress.setText(currentAddress); // register_dingwei.this.setResult(RESULT_OK, it); // register_dingwei.this.finish(); break; } } }; private String a; private LatLng point; private MyLocationData locData; private GeoCoder mGeoCoder; private TextView etAddress; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SDKInitializer.initialize(getApplicationContext()); it = getIntent(); a = "1"; mMapView = (MapView) findViewById(R.id.register_dingwei_map); mycenter = (ImageView) findViewById(R.id.iv_register_dingwei_center); mBaiduMap = mMapView.getMap(); mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); mBaiduMap.setMyLocationEnabled(true); locationClient = new LocationClient(this); locationClient.registerLocationListener(myListener); initLocation();//初始化LocationgClient locationClient.start(); initMap(); mGeoCoder = GeoCoder.newInstance(); // 设置查询结果监听者 mGeoCoder.setOnGetGeoCodeResultListener(mOnGetGeoCoderResultListener); etAddress = (TextView) findViewById(R.id.tv_register_dingwei_back); TextView tvTitle = (TextView) findViewById(R.id.tv_title); tvTitle.setText("定位"); findViewById(R.id.rl_back).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); findViewById(R.id.tv_register_dingwei_true).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != latLng) { // getAddress(latLng.latitude, latLng.longitude); setResult(111, it); finish(); } // ToastUtils.showShortToast("aaaaaaaa"); } }); mBaiduMap.setOnMapStatusChangeListener(new BaiduMap.OnMapStatusChangeListener() { @Override public void onMapStatusChangeStart(MapStatus mapStatus) { // Log.e("aaa", // "(register_dingwei.java:176)<---->"+"地图状态改变时调用的"); } @Override public void onMapStatusChange(MapStatus mapStatus) { // Log.e("aaa", // "(register_dingwei.java:181)<---->"+"地图位置变化时调用的"); } @Override public void onMapStatusChangeFinish(MapStatus mapStatus) { latLng = mapStatus.target; Log.e("aaa", "(register_dingwei.java:187)<---->" + "地图状态位置结束时调用的"); Log.e("aaa", "(register_dingwei.java:198)<--获取到的定位点的纬度-->" + latLng.latitude + "<-----获取到定位点的经度---->" + latLng.longitude); getAddress(latLng.latitude, latLng.longitude); } }); } @Override public int getContentViewId() { return R.layout.register_dingwei; } private void initMap() { mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration( MyLocationConfiguration.LocationMode.FOLLOWING, true, null)); MapStatus.Builder builder = new MapStatus.Builder(); builder.overlook(0); mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); } public class MyBdlocationListener implements BDLocationListener { @Override public void onReceiveLocation(BDLocation location) { // Logger.w("", location.getAddrStr() + "8888888888888"); myAddress = location.getAddrStr(); province = location.getProvince(); city = location.getCity(); district = location.getDistrict(); Log.e("aaa", "(MyBdlocationListener.java:247)<--省市区的区-->"+district); mylatitude = location.getLatitude();//获取纬度坐标 mylongitude = location.getLongitude();//获取经度坐标 locData = new MyLocationData.Builder() .accuracy(location.getRadius()) // 此处设置开发者获取到的方向信息,顺时针0-360 .direction(0) .latitude(location.getLatitude()) .longitude(location.getLongitude()).build(); mBaiduMap.setMyLocationData(locData); // MapStatus mMapStatus = new MapStatus.Builder() // .target(new LatLng(mylatitude,mylongitude)) // .zoom(18) // .build(); // //定义MapStatusUpdate对象,以便描述地图状态将要发生的变化 // MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus); // //改变地图状态 // mBaiduMap.setMapStatus(mMapStatusUpdate); BitmapDescriptor bitmap = BitmapDescriptorFactory .fromResource(R.drawable.dingweilan); //构建MarkerOption,用于在地图上添加Marker OverlayOptions option = new MarkerOptions() .position(new LatLng(mylatitude,mylongitude)) .icon(bitmap); mBaiduMap.addOverlay(option); mBaiduMap.setMyLocationEnabled(false); } @Override public void onConnectHotSpotMessage(String s, int i) { } } private void initLocation() { LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy );//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 option.setCoorType("bd09ll");//可选,默认gcj02,设置返回的定位结果坐标系 int span = 1000; option.setScanSpan(0);//可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的 option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要 option.setOpenGps(true);//可选,默认false,设置是否使用gps option.setLocationNotify(false);//可选,默认false,设置是否当gps有效时按照1S1次频率输出GPS结果 option.setIsNeedLocationDescribe(true);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近” option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到 option.setIgnoreKillProcess(false);//可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死 option.SetIgnoreCacheException(false);//可选,默认false,设置是否收集CRASH信息,默认收集 option.setEnableSimulateGps(false);//可选,默认false,设置是否需要过滤gps仿真结果,默认需要 locationClient.setLocOption(option); } public void getAddress(double latitude, double lontitude) { Log.e("aaa", "(register_dingwei.java:236)<---->" + "获取地理位置信息"); LatLng mLatLng = new LatLng(latitude, lontitude); // 反地理编码请求参数对象 ReverseGeoCodeOption mReverseGeoCodeOption = new ReverseGeoCodeOption(); // 设置请求参数 mReverseGeoCodeOption.location(mLatLng); // 发起反地理编码请求(经纬度->地址信息) mGeoCoder.reverseGeoCode(mReverseGeoCodeOption); } private OnGetGeoCoderResultListener mOnGetGeoCoderResultListener = new OnGetGeoCoderResultListener() { @Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) { Log.e("aaa", "(register_dingwei.java:213)" + result.toString()); // System.out.println("---------address-------------" + result.getAddress()); currentAddress = result.getAddress(); city = result.getAddressDetail().city; province = result.getAddressDetail().province; String street = result.getAddressDetail().street; Log.e("aaa", "(register_dingwei.java:310)<---->" + street); Message msg = new Message(); msg.what = 2; mHandler.sendMessage(msg); } @Override public void onGetGeoCodeResult(GeoCodeResult result) { // 地理编码查询结果回调函数 Log.e("aaa", "(register_dingwei.java:308)<---->" + "详细地址转经纬度"); } }; @Override public void onDestroy() { super.onDestroy(); mMapView.onDestroy(); locationClient.stop(); } @Override public void onResume() { super.onResume(); mMapView.onResume(); } @Override public void onPause() { super.onPause(); mMapView.onPause(); } }
5f97af7bac71fb3d9503554caaa4bc1cebde2adb
fa53e0d571cb6ac2ae05a8c0a45588c4f9fe4291
/src/main/java/com/seriouscompany/business/java/fizzbuzz/packagenamingpackage/impl/visitors/FizzBuzzOutputGenerationContext.java
1503d549415e300d500ae61ee5917ba576af957d
[]
no_license
ThomasRooney/FizzBuzzEnterpriseEdition
e6a1140c3fca060da89de766445d85ad06b57239
4a8639ef5e352e5c26a6dbd3365ffd258befe665
refs/heads/master
2020-04-06T04:32:38.901187
2015-05-19T18:18:32
2015-05-19T18:25:21
35,555,388
1
0
null
2015-05-13T14:55:19
2015-05-13T14:55:19
null
UTF-8
Java
false
false
909
java
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.visitors; import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.printers.DataPrinter; import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.IsEvenlyDivisibleStrategy; import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.visitors.OutputGenerationContext; public class FizzBuzzOutputGenerationContext implements OutputGenerationContext { private DataPrinter printer; private IsEvenlyDivisibleStrategy strategy; public FizzBuzzOutputGenerationContext(IsEvenlyDivisibleStrategy strategy, DataPrinter printer) { super(); this.strategy = strategy; this.printer = printer; } @Override public DataPrinter getPrinter() { return printer; } @Override public IsEvenlyDivisibleStrategy getStrategy() { return strategy; } }
08d814ee2d86f2c10af416745fd9d86a5d8a4200
74874cfe0d2c63ab99bfa767bd203f830671dad2
/app/src/main/java/com/rizkyalkus/tugas_uas_akb_if3_10117093/activity/MainActivity.java
6c59f86cf9aec0a8173606f3947c84b8aa4d2400
[]
no_license
SyahrifalDaniS/TUGAS_AKB_UAS_10117093
9b18671e35a3b8648eed397dedf30c4c8e9d1a80
4b3aa28a5890f0593c7b262c867b84c3a4f6516d
refs/heads/master
2022-12-01T08:51:58.884510
2020-08-12T12:03:06
2020-08-12T12:03:06
286,998,287
0
0
null
null
null
null
UTF-8
Java
false
false
1,841
java
package com.rizkyalkus.tugas_uas_akb_if3_10117093.activity; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import android.os.Bundle; import android.view.MenuItem; import com.google.android.material.bottomnavigation.BottomNavigationView; import com.rizkyalkus.tugas_uas_akb_if3_10117093.R; import com.rizkyalkus.tugas_uas_akb_if3_10117093.fragment.ProfileFragment; import com.rizkyalkus.tugas_uas_akb_if3_10117093.fragment.WisataFragment; /* NIM : 10116022 Nama : Syahrifal Dani S Kelas : AKB-3 Tanggal Pengerjaan : 12 Agustus 2020 */ //Model Home public class MainActivity extends AppCompatActivity implements BottomNavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); loadFragment(new WisataFragment()); BottomNavigationView bottomNavigationView = findViewById(R.id.bn_main); bottomNavigationView.setOnNavigationItemSelectedListener(this); } private boolean loadFragment(Fragment fragment){ if (fragment != null) { getSupportFragmentManager().beginTransaction() .replace(R.id.fl_container, fragment) .commit(); return true; } return false; } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { Fragment fragment = null; switch (item.getItemId()){ case R.id.wisata_menu: fragment = new WisataFragment(); break; case R.id.profile_menu: fragment = new ProfileFragment(); break; } return loadFragment(fragment); } }
1cbc30fad504a70f820d22ec3deedf04e8988806
3e228c5329ad8cff24db39804fcab7898137fb7f
/src/Thread/ThreadSafe.java
1ce5c681c8e9fa3c80b6277d3f7fb39115c254e1
[]
no_license
cheyunfei/java
572601289a597f1afe5b575cd43d61f75c76d837
52eb01dde578a45574344f381b246f932ac9ac7c
refs/heads/master
2022-11-25T18:24:04.171572
2020-07-29T02:23:20
2020-07-29T02:23:20
283,377,857
0
0
null
null
null
null
GB18030
Java
false
false
4,417
java
package Thread; /**<p>(1)线程同步安全:避免因多个线程对同一个数据进行修改导致的错误,如火车票售票系统 * <p>(2)同步机制:使用 synchronized 关键字修饰<br><br> * (2.1)修饰代码块:即把 run() 方法中需要保护的数据操作过程,即共享资源放到 synchronized 语句 * 块(同步块)中(共享资源也可能是 run 方法调用的类静态全局变量,此时该静态全局变量为所有 * 对象公用)<br> * (2.11)修饰代码块: synchronized(Object){同步块},Object【synchronized 将锁定的目标, * 这个目标可以是任意的,this/对象名(锁定的是对象),""/类名.class(锁定的是类)】<br> * (2.12)锁定的是对象 synchronized(this/对象名):当 run() 方法所在的类实现了 Runnable 接口时,所有连接了该类同一个对象的 Thread * 对象访问的是同一块共享资源,即此时这些线程互斥。而当多个 Thread 线程对象连接的是不同的 Runnable 对象 * 时,他们访问的不是同一块共享资源,所以这些线程不互斥,互不干扰可以同时运行;但如果共享资源是类级别的成员 * 的时候加 static 修饰,两个不互锁的线程公用一个资源会发生错误<br> * (2.13)锁定的是类 synchronized(""/类名.class):其他都和 2.12 相同,但是只有最后对于锁定类来说共享资源是类级别的成员 * 的时候加 static 修饰,两个不互锁的线程公用一个资源不会冲突<br><br> * * * (2.2)修饰非静态方法:synchronized void f(){},即在方法面前修饰 synchronized 关键字,方法体中是共享资源, * 相比修饰代码块只是同步的代码量变大了而已,相当于对象锁<br> * (注意:)两个线程分别调用同一个对象的两个不同的同步方法(即线程A调用对象P的同步方法a,线程B调用对象P的同步方法b), * 两个线程互斥,即方法a被执行的时候,方法b需等待a执行完毕,即两个同步方法互斥。 * * * (2.3)修饰静态方法:synchronized static void f(){},该方法由所有对象共享,相当于当前类的class锁<br><br> * (注意:)线程A和线程B分别访问同一个对象的 synchronized static 方法和非静态synchronized 不互斥<br><br> * <p>(3) synchronized关键字不能继承,当子类方法调用父类的同步方法的时候,子类方法才有同步功能<br> * * (注意:)某个对象调用了同步方法时,该对象上的其他同步方法必须等待该同步方法执行完后才能被执行 */ public class ThreadSafe/* implements Runnable */{ private static int count=0; // public void run() { // synchronized(ThreadSafe.class) { // for (int i = 0; i < 5; i++) { // try { // System.out.println(Thread.currentThread().getName() + ":" + (count++)); // Thread.sleep(10); // } catch (InterruptedException e) { // e.printStackTrace(); // } // } // } // } public int getCount() { return count; } private int count2=0; public synchronized void add(){ count2++; System.out.println("add"+count2); } public synchronized void sub(){ count2--; System.out.println("sub"+count2); } public static void main(String[] args){ //ThreadSafe ThreadSafe = new ThreadSafe(); // Thread thread1 = new Thread(new ThreadSafe(), "ThreadSafe1"); // Thread thread2 = new Thread(new ThreadSafe(), "ThreadSafe2"); // thread1.start(); // thread2.start(); ThreadSafe s=new ThreadSafe(); Thread thread3=new Thread(new Runnable(){ public void run(){ int n=0; while(n<5){ n++; s.add(); try{ Thread.sleep(100);}catch(Exception e){} } } }); Thread thread4=new Thread(new Runnable(){ public void run(){ int n=0; while(n<5){ n++; s.add(); try{ Thread.sleep(100);}catch(Exception e){} } } }); thread4.start(); thread3.start(); } }
037b45a9b4ec45ecf6e1d64e5f9cab277452a69f
c4d804b3022cd7a05c54c038af4b3278e1991438
/src/main/java/com/hui/springbootswagger2/config/Swagger2Config.java
a738b600c574ac6e46abd0d1d6e360ad6201dde0
[]
no_license
NGHui/springboot-swagger2
dd3f8cf1845d4c90ce58a50031f2258c812843e2
58e539beb147b491941d1531eb16a93b700d8b15
refs/heads/master
2020-09-17T18:12:18.277122
2019-11-26T05:09:30
2019-11-26T05:09:30
224,107,353
0
0
null
null
null
null
UTF-8
Java
false
false
2,778
java
package com.hui.springbootswagger2.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.RequestHandler; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; import java.util.ArrayList; /** * @author 辉 * 座右铭:坚持总能遇见更好的自己! * @date 2019/11/26 */ @Configuration @EnableSwagger2 public class Swagger2Config { /** * 配置多个组 * @return */ @Bean public Docket docket1(){ return new Docket(DocumentationType.SWAGGER_2).groupName("A"); } @Bean public Docket docket2(){ return new Docket(DocumentationType.SWAGGER_2).groupName("B"); } @Bean public Docket docket3(){ return new Docket(DocumentationType.SWAGGER_2).groupName("C"); } //配置docket 的bean实例 @Bean public Docket docket(){ return new Docket(DocumentationType.SWAGGER_2) //使用自己的方法apiInfo() .apiInfo(apiInfo()) .groupName("聂广辉") .select() //表示需要扫描那个包 //basePackage("com.hui.controller")指定扫描的包 //any()表示扫描所有的注解 //none()表示全部扫描 //withClassAnnotation(RestController.class)表示扫描类上有@RestController注解的类 //withMethodAnnotation(GetMapping.class)表示扫描方法上有@GetMapping注解的方法 .apis(RequestHandlerSelectors.basePackage("com.hui.springbootswagger2.controller")) //过滤扫描表示只扫描hui/**的请求 //.paths(PathSelectors.ant("/hui/**")) .build(); } private ApiInfo apiInfo(){ //作者描述 Contact contact = new Contact("聂广辉", "http://www.nghui.cn", "[email protected]"); return new ApiInfo( "辉的文档",//文档的标题 "座右铭:坚持总能遇见更好的自己!", //描述 "1.0", "urn:tos", contact, "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList() ); } }
3e31c7a41444411b7518f1e6abfaa63cba7dc792
b111b77f2729c030ce78096ea2273691b9b63749
/db-example-large-multi-project/project37/src/test/java/org/gradle/test/performance/mediumjavamultiproject/project37/p187/Test3751.java
4ea8ef8b4a92d0cdac7542ec6ea3faa5561fdb3e
[]
no_license
WeilerWebServices/Gradle
a1a55bdb0dd39240787adf9241289e52f593ccc1
6ab6192439f891256a10d9b60f3073cab110b2be
refs/heads/master
2023-01-19T16:48:09.415529
2020-11-28T13:28:40
2020-11-28T13:28:40
256,249,773
1
0
null
null
null
null
UTF-8
Java
false
false
2,619
java
package org.gradle.test.performance.mediumjavamultiproject.project37.p187; import org.junit.Test; import static org.junit.Assert.*; public class Test3751 { Production3751 objectUnderTest = new Production3751(); @Test public void testProperty0() throws Exception { Production3748 value = new Production3748(); objectUnderTest.setProperty0(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() throws Exception { Production3749 value = new Production3749(); objectUnderTest.setProperty1(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() throws Exception { Production3750 value = new Production3750(); objectUnderTest.setProperty2(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() throws Exception { String value = "value"; objectUnderTest.setProperty3(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() throws Exception { String value = "value"; objectUnderTest.setProperty4(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() throws Exception { String value = "value"; objectUnderTest.setProperty5(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() throws Exception { String value = "value"; objectUnderTest.setProperty6(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() throws Exception { String value = "value"; objectUnderTest.setProperty7(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() throws Exception { String value = "value"; objectUnderTest.setProperty8(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() throws Exception { String value = "value"; objectUnderTest.setProperty9(value); Thread.sleep(250); assertEquals(value, objectUnderTest.getProperty9()); } }
b8e1f735a333f5a58eba62bc0e6eba2d6a32db20
ad31b250708fb6ea035bfd9bd1d78579f193dfe6
/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookkeeperAdminFormatEnsembleTest.java
bbc947bf0e81c9ee18018379bdbcd9bc46061827
[ "Apache-2.0" ]
permissive
valentino7/bookkeeper
d4bb96160cc3743e5fbbacb6f0ab0b4ce8bde404
07c22bab4843f84b1d58680e194a5ee21bc4acd1
refs/heads/master
2022-11-10T04:00:33.902374
2020-07-03T07:51:55
2020-07-03T07:51:55
271,558,058
0
0
Apache-2.0
2020-06-11T13:48:07
2020-06-11T13:48:07
null
UTF-8
Java
false
false
3,415
java
package org.apache.bookkeeper.client; import com.google.common.collect.Sets; import org.apache.bookkeeper.conf.BookKeeperClusterTestCase; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.net.BookieSocketAddress; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.awt.print.Book; import java.net.UnknownHostException; import java.util.*; import static org.apache.bookkeeper.client.BookKeeperAdmin.*; import static org.junit.Assert.*; @RunWith(Parameterized.class) public class BookkeeperAdminFormatEnsembleTest extends BookKeeperClusterTestCase { private char marker; private Set<BookieSocketAddress> bookiesSrc; private List<BookieSocketAddress> ensemble; private static final int numOfBookies = 2; private final int lostBookieRecoveryDelayInitValue = 1800; private String expected; @Before public void setUp() throws Exception { super.setUp(); } @After public void after() throws Exception { super.tearDown(); } /* public BookAdminTest(Object o, Object o2) { }*/ @Parameterized.Parameters public static Collection<?> getParameter() throws UnknownHostException { BookieSocketAddress bookie0 = new BookieSocketAddress("bookie0:3181"); BookieSocketAddress bookie1 = new BookieSocketAddress("bookie1:3181"); BookieSocketAddress bookie2 = new BookieSocketAddress("bookie2:3181"); BookieSocketAddress bookie3 = new BookieSocketAddress("ciao:2323"); List<BookieSocketAddress> ensembleOfSegment1 = new ArrayList<BookieSocketAddress>(); ensembleOfSegment1.add(bookie0); ensembleOfSegment1.add(bookie1); ensembleOfSegment1.add(bookie2); List<BookieSocketAddress> ensembleOfSegment2 = new ArrayList<BookieSocketAddress>(); ensembleOfSegment2.add(bookie3); /* bookieSrc * Source bookie that had a failure. We want to replicate the * ledger fragments that were stored there.*/ Set<BookieSocketAddress> bookiesSrc = Sets.newHashSet(bookie0); return Arrays.asList(new Object[][] { { ensembleOfSegment1, bookiesSrc, '*', "[bookie0:3181*, bookie1:3181 , bookie2:3181 ]"}, { null, null, '*', ""}, }); } public BookkeeperAdminFormatEnsembleTest(List<BookieSocketAddress> ensemble, Set<BookieSocketAddress> bookiesSrc, char marker, String expected) { super(numOfBookies, 480); baseConf.setLostBookieRecoveryDelay(lostBookieRecoveryDelayInitValue); baseConf.setOpenLedgerRereplicationGracePeriod(String.valueOf(30000)); setAutoRecoveryEnabled(true); this.ensemble = ensemble; this.bookiesSrc = bookiesSrc; this.marker = marker; this.expected = expected; } @Test public void formatEnsemble() { String result; try { result = BookKeeperAdmin.formatEnsemble(this.ensemble, this.bookiesSrc, this.marker); }catch(Exception e){ e.printStackTrace(); result = ""; } assertEquals(this.expected,result); } }
c718aabcd8ef421f4594b8ee96dd4dc362207195
762583e900fdf4a9be490e4aacc0b9826d6e59b7
/UnityAndroidProject/launcher/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/swiperefreshlayout/R.java
6d3aaa3210ba76c1fb03e555d428602f8660de4c
[]
no_license
Shambonik/MusicJump
be29cb4798a17e1fc2c4b83b12938a34c66ae5a3
c22ef5ca4f6147592395a1ef88eff1866562e106
refs/heads/main
2023-04-19T22:37:40.638539
2021-05-13T09:17:40
2021-05-13T09:17:40
344,307,880
0
0
null
null
null
null
UTF-8
Java
false
false
10,465
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.swiperefreshlayout; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f020027; public static final int font = 0x7f0200b0; public static final int fontProviderAuthority = 0x7f0200b2; public static final int fontProviderCerts = 0x7f0200b3; public static final int fontProviderFetchStrategy = 0x7f0200b4; public static final int fontProviderFetchTimeout = 0x7f0200b5; public static final int fontProviderPackage = 0x7f0200b6; public static final int fontProviderQuery = 0x7f0200b7; public static final int fontStyle = 0x7f0200b8; public static final int fontVariationSettings = 0x7f0200b9; public static final int fontWeight = 0x7f0200ba; public static final int ttcIndex = 0x7f0201b6; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f04003c; public static final int notification_icon_bg_color = 0x7f04003d; public static final int ripple_material_light = 0x7f040047; public static final int secondary_text_default_material_light = 0x7f040049; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f05004b; public static final int compat_button_inset_vertical_material = 0x7f05004c; public static final int compat_button_padding_horizontal_material = 0x7f05004d; public static final int compat_button_padding_vertical_material = 0x7f05004e; public static final int compat_control_corner_material = 0x7f05004f; public static final int compat_notification_large_icon_max_height = 0x7f050050; public static final int compat_notification_large_icon_max_width = 0x7f050051; public static final int notification_action_icon_size = 0x7f05005b; public static final int notification_action_text_size = 0x7f05005c; public static final int notification_big_circle_margin = 0x7f05005d; public static final int notification_content_margin_start = 0x7f05005e; public static final int notification_large_icon_height = 0x7f05005f; public static final int notification_large_icon_width = 0x7f050060; public static final int notification_main_column_padding_top = 0x7f050061; public static final int notification_media_narrow_margin = 0x7f050062; public static final int notification_right_icon_size = 0x7f050063; public static final int notification_right_side_padding_top = 0x7f050064; public static final int notification_small_icon_background_padding = 0x7f050065; public static final int notification_small_icon_size_as_large = 0x7f050066; public static final int notification_subtext_size = 0x7f050067; public static final int notification_top_pad = 0x7f050068; public static final int notification_top_pad_large_text = 0x7f050069; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f060054; public static final int notification_bg = 0x7f060055; public static final int notification_bg_low = 0x7f060056; public static final int notification_bg_low_normal = 0x7f060057; public static final int notification_bg_low_pressed = 0x7f060058; public static final int notification_bg_normal = 0x7f060059; public static final int notification_bg_normal_pressed = 0x7f06005a; public static final int notification_icon_background = 0x7f06005b; public static final int notification_template_icon_bg = 0x7f06005c; public static final int notification_template_icon_low_bg = 0x7f06005d; public static final int notification_tile_bg = 0x7f06005e; public static final int notify_panel_notification_icon_bg = 0x7f06005f; } public static final class id { private id() {} public static final int action_container = 0x7f070012; public static final int action_divider = 0x7f070014; public static final int action_image = 0x7f070015; public static final int action_text = 0x7f07001b; public static final int actions = 0x7f07001c; public static final int async = 0x7f070026; public static final int blocking = 0x7f07002e; public static final int chronometer = 0x7f070039; public static final int forever = 0x7f07005e; public static final int icon = 0x7f070068; public static final int icon_group = 0x7f070069; public static final int info = 0x7f07006e; public static final int italic = 0x7f070070; public static final int line1 = 0x7f070075; public static final int line3 = 0x7f070076; public static final int normal = 0x7f070080; public static final int notification_background = 0x7f070081; public static final int notification_main_column = 0x7f070082; public static final int notification_main_column_container = 0x7f070083; public static final int right_icon = 0x7f070095; public static final int right_side = 0x7f070096; public static final int tag_transition_group = 0x7f0700bf; public static final int tag_unhandled_key_event_manager = 0x7f0700c0; public static final int tag_unhandled_key_listeners = 0x7f0700c1; public static final int text = 0x7f0700c2; public static final int text2 = 0x7f0700c3; public static final int time = 0x7f0700c6; public static final int title = 0x7f0700c7; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { private layout() {} public static final int notification_action = 0x7f09001d; public static final int notification_action_tombstone = 0x7f09001e; public static final int notification_template_custom_big = 0x7f09001f; public static final int notification_template_icon_group = 0x7f090020; public static final int notification_template_part_chronometer = 0x7f090021; public static final int notification_template_part_time = 0x7f090022; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0b002a; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0c00ec; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ee; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ef; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f0; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c015a; public static final int Widget_Compat_NotificationActionText = 0x7f0c015b; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0200b2, 0x7f0200b3, 0x7f0200b4, 0x7f0200b5, 0x7f0200b6, 0x7f0200b7 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0200b0, 0x7f0200b8, 0x7f0200b9, 0x7f0200ba, 0x7f0201b6 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
505730c8dca49377baf723b2ea12b3adda7847e2
175fe401bed2505f69bde74d89cb65c83d65d615
/src/client/MapleDisease.java
110a2ca85b4459d0f9f8486f2bcf735e155f05f9
[]
no_license
TheWoif777/MapleAini
f581374ee9a050ff50efb2c2d18ab8e04a136d66
0e365374769f0b0509a21f29ab395326f93de8c0
refs/heads/master
2021-12-15T01:13:49.897713
2017-07-12T10:27:57
2017-07-12T10:27:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,222
java
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <[email protected]> Matthias Butz <[email protected]> Jan Christian Meyer <[email protected]> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation version 3 as published by the Free Software Foundation. You may not use, modify or distribute this program under any other version of the GNU Affero General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package client; public enum MapleDisease { NULL(0x0), SLOW(0x1), SEDUCE(0x80), FISHABLE(0x100), ZOMBIFY(0x4000), CONFUSE(0x80000), STUN(0x2000000000000L), POISON(0x4000000000000L), SEAL(0x8000000000000L), DARKNESS(0x10000000000000L), WEAKEN(0x4000000000000000L), CURSE(0x8000000000000000L); private long i; private boolean first; private MapleDisease(long i) { this.i = i; this.first = false; } private MapleDisease(long i, boolean first) { this.i = i; this.first = first; } public long getValue() { return i; } public boolean isFirst() { return first; } public static MapleDisease getType(int skill) { switch (skill) { case 120: return MapleDisease.SEAL; case 121: return MapleDisease.DARKNESS; case 122: return MapleDisease.WEAKEN; case 123: return MapleDisease.STUN; case 125: return MapleDisease.POISON; case 128: return MapleDisease.SEDUCE; default: return null; } } }
0fa4d83e0062cacb5d10c0540871273e754d3dbf
14d2f63da4785eaadbc3a50105be15421f74df1d
/src/main/java/io/patriot_framework/generator/network/Rest.java
edb1456be5d88af0fe5677bb417ed03ce5b30bd7
[ "Apache-2.0" ]
permissive
PatrIoT-Framework/data-generator-example
e37f79bb622f66804f296bbf397ac14a6124f42e
663dd09e45861ffe10c10f03d77464a1eab6eb2a
refs/heads/master
2021-12-10T06:48:32.180109
2019-05-30T13:43:53
2019-05-30T14:54:39
140,258,411
0
1
Apache-2.0
2021-12-09T21:14:42
2018-07-09T08:54:38
Java
UTF-8
Java
false
false
2,358
java
/* * Copyright 2019 Patriot 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 io.patriot_framework.generator.network; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import io.patriot_framework.generator.Data; import io.patriot_framework.generator.network.wrappers.DataWrapper; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import java.io.IOException; import java.util.List; public class Rest implements NetworkAdapter { private String endpoint; private DataWrapper dataWrapper; @JsonCreator public Rest(@JsonProperty("endpoint") String endpoint, @JsonProperty("wrapper") DataWrapper dataWrapper) { this.endpoint = endpoint; this.dataWrapper = dataWrapper; } @Override public void send(List<Data> data) { HttpClient httpClient = HttpClientBuilder.create().build(); dataWrapper.wrapData(data); try { HttpPost request = new HttpPost(endpoint); StringEntity se = new StringEntity(dataWrapper.wrapData(data)); request.setEntity(se); request.addHeader("content-type", "application/json"); httpClient.execute(request); } catch (IOException e) { e.printStackTrace(); } } @Override public void setDataWrapper(DataWrapper dataWrapper) { this.dataWrapper = dataWrapper; } @Override public DataWrapper getDataWrapper() { return dataWrapper; } public String getEndpoint() { return endpoint; } public void setEndpoint(String endpoint) { this.endpoint = endpoint; } }