blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10ce5325a599cb046ea3b8aaa23b75267af4091c | d92407f7823a8163b946cd2c7fd24511e81789fc | /src/com/example/yahoohackday/SlideAnimationThenCallLayout.java | 2b2ced145648bc9450ad1f528d6853f5b69026fd | [] | no_license | StevenKo/yahoohackday | 60f61292de8e8342d6dfb6aac88dcce3fe84d4e3 | 74fbb16d0d2cedb9ea35eb84f205ee584c979084 | refs/heads/master | 2021-01-10T22:11:30.578671 | 2012-10-20T13:13:47 | 2012-10-20T13:13:47 | 6,304,600 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,874 | java | /*
* #%L
* SlidingMenuDemo
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2012 Paul Grime
* %%
* 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.
* #L%
*/
package com.example.yahoohackday;
import java.util.Date;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.ListView;
/**
* This demo flickers when the call to app.layout() is made.
*
* Not sure how to remove this flicker.
*/
public class SlideAnimationThenCallLayout extends Activity implements AnimationListener {
View menu;
View app;
boolean menuOut = false;
AnimParams animParams = new AnimParams();
class ClickListener implements OnClickListener {
@Override
public void onClick(View v) {
System.out.println("onClick " + new Date());
SlideAnimationThenCallLayout me = SlideAnimationThenCallLayout.this;
Context context = me;
Animation anim;
int w = app.getMeasuredWidth();
int h = app.getMeasuredHeight();
int left = (int) (menu.getMeasuredWidth());
if (!menuOut) {
// anim = AnimationUtils.loadAnimation(context, R.anim.push_right_out_80);
anim = new TranslateAnimation(0, left, 0, 0);
menu.setVisibility(View.VISIBLE);
animParams.init(left, 0, left + w, h);
} else {
// anim = AnimationUtils.loadAnimation(context, R.anim.push_left_in_80);
anim = new TranslateAnimation(0, -left, 0, 0);
animParams.init(0, 0, w, h);
}
anim.setDuration(500);
anim.setAnimationListener(me);
// Only use fillEnabled and fillAfter if we don't call layout ourselves.
// We need to do the layout ourselves and not use fillEnabled and fillAfter because when the anim is finished
// although the View appears to have moved, it is actually just a drawing effect and the View hasn't moved.
// Therefore clicking on the screen where the button appears does not work, but clicking where the View *was* does
// work.
// anim.setFillEnabled(true);
// anim.setFillAfter(true);
app.startAnimation(anim);
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.slide_animation_then_call_layout);
menu = findViewById(R.id.menu);
app = findViewById(R.id.app);
// ViewUtils.printView("menu", menu);
// ViewUtils.printView("app", app);
// ListView listView = (ListView) app.findViewById(R.id.list);
// ViewUtils.initListView(this, listView, "Item ", 30, android.R.layout.simple_list_item_1);
Button btn_slide = (Button) findViewById(R.id.BtnSlide);
btn_slide.setOnClickListener(new ClickListener());
}
void layoutApp(boolean menuOut) {
System.out.println("layout [" + animParams.left + "," + animParams.top + "," + animParams.right + ","
+ animParams.bottom + "]");
app.layout(animParams.left, animParams.top, animParams.right, animParams.bottom);
}
@Override
public void onAnimationEnd(Animation animation) {
System.out.println("onAnimationEnd");
ViewUtils.printView("menu", menu);
ViewUtils.printView("app", app);
menuOut = !menuOut;
if (!menuOut) {
menu.setVisibility(View.INVISIBLE);
}
layoutApp(menuOut);
}
@Override
public void onAnimationRepeat(Animation animation) {
System.out.println("onAnimationRepeat");
}
@Override
public void onAnimationStart(Animation animation) {
System.out.println("onAnimationStart");
}
static class AnimParams {
int left, right, top, bottom;
void init(int left, int top, int right, int bottom) {
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
}
}
| [
"chunyuko85@gmaill.com"
] | chunyuko85@gmaill.com |
885cf434a8200cdd7067afb22af7f0c471fe5707 | c98573d8bf8b916facad36dd3952382107a73be6 | /src/main/java/com/elesson/pioneer/dao/EventDao.java | 68f645c1d71ef39f3084604275053fe9dcce3878 | [] | no_license | JennyHedeen/pioneer | 37a26879bf9c0907a2d510cceb56e30176ede724 | d0b5ded3c3d67bbfce0fe969c32cb713f150aa0d | refs/heads/master | 2020-03-27T20:46:59.587500 | 2018-09-06T20:28:22 | 2018-09-06T20:56:45 | 145,194,424 | 0 | 1 | null | 2018-08-31T19:56:31 | 2018-08-18T05:59:04 | Java | UTF-8 | Java | false | false | 1,952 | java | package com.elesson.pioneer.dao;
import com.elesson.pioneer.dao.exception.DBException;
import com.elesson.pioneer.dao.exception.DuplicateEntityException;
import com.elesson.pioneer.model.Event;
import java.time.LocalDate;
import java.util.List;
/**
* The {@code EventDao} interface provides the methods for interaction with database.
*
*/
public interface EventDao {
/**
* Retrieves the database for single object of {@code Event} class.
* Suppress all SQL exceptions and throws own general one.
*
* @param id the unique identifier
* @return the instance of {@code Event} class
* @throws DBException the general exception to cover all SQL exceptions
*/
Event getById(int id) throws DBException;
/**
* Inserts new record to database.
* Suppress all SQL exceptions and throws own ones.
*
* @param entity the {@code Event} class object to be stored in database
* @return true if operation successful
* @throws DuplicateEntityException in case of non-unique values (database restrictions).
* @throws DBException in all other cases.
*/
Event save(Event entity) throws DuplicateEntityException, DBException;
/**
* Deletes single record from database.
* Suppress all SQL exceptions and throws own general one.
*
* @param id the record unique identifier.
* @return true if a single record removed.
* @throws DBException the general exception to cover all SQL exceptions
*/
boolean delete(int id) throws DBException;
/**
* Retrieves the database for single object of {@code Event} class.
* Suppress all SQL exceptions and throws own general one.
*
* @param date the identifier
* @return the instance of {@code Event} class
* @throws DBException the general exception to cover all SQL exceptions
*/
List<Event> getByDate(LocalDate date) throws DBException;
}
| [
"valery.m.trebukh@gmail.com"
] | valery.m.trebukh@gmail.com |
e3f9e38dc5f66794420029f88785202c190aca57 | 65b1b1af4e3e973d7198c874829e4785d864a394 | /dragonbrain/src/main/java/in/dragonbra/dragonbrain/controller/AdminController.java | 3be1cdbd22d527be7afe8bf7bff39f6bf6f32d26 | [] | no_license | Longi94/dragonbrain-old | ffc5b2d8cab0f85c7d435db76862b7969ae48e76 | 9ff3aa87f98591d7d862cd57e028650cc55d06fa | refs/heads/master | 2021-09-28T10:20:13.123280 | 2018-11-16T21:51:10 | 2018-11-16T21:51:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,349 | java | package in.dragonbra.dragonbrain.controller;
import in.dragonbra.dragonbrain.entity.Photo;
import in.dragonbra.dragonbrain.entity.Project;
import in.dragonbra.dragonbrain.repository.PhotoRepository;
import in.dragonbra.dragonbrain.service.ProjectService;
import in.dragonbra.dragonbrain.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.security.Principal;
/**
* @author lngtr
* @since 2017-12-26
*/
@RestController
@RequestMapping("/admin")
public class AdminController {
private final ProjectService projectService;
private final PhotoRepository photoRepository;
private final UserService userService;
@Autowired
public AdminController(ProjectService projectService, PhotoRepository photoRepository,
UserService userService) {
this.projectService = projectService;
this.photoRepository = photoRepository;
this.userService = userService;
}
@PostMapping("/projects")
public Project createProject(Principal principal, @RequestBody Project project) {
userService.checkPrincipal(principal);
return projectService.createProject(project);
}
@PostMapping("/photos")
public Photo createPhoto(Principal principal, @RequestBody Photo photo) {
userService.checkPrincipal(principal);
photoRepository.save(photo);
return photo;
}
@DeleteMapping("/projects/{id}")
public void deleteProject(Principal principal, @PathVariable("id") Long id) {
userService.checkPrincipal(principal);
projectService.deleteProject(id);
}
@DeleteMapping("/photos/{id}")
public void deletePhoto(Principal principal, @PathVariable("id") Long id) {
userService.checkPrincipal(principal);
photoRepository.deleteById(id);
}
@PostMapping("/projects/{id}/move")
public void moveProject(Principal principal, @PathVariable("id") Long id, @RequestParam("up") boolean up) {
userService.checkPrincipal(principal);
projectService.moveProject(id, up);
}
@PutMapping("/projects/{id}")
public Project editProject(Principal principal, @PathVariable("id") Long id, @RequestBody Project project) {
userService.checkPrincipal(principal);
return projectService.updateProject(id, project);
}
@GetMapping("/projects/{id}")
public Project getProject(Principal principal, @PathVariable("id") Long id) {
userService.checkPrincipal(principal);
return projectService.getProject(id);
}
@PutMapping("/photos/{id}")
public Photo editProject(Principal principal, @PathVariable("id") Long id, @RequestBody Photo photo) {
userService.checkPrincipal(principal);
Photo original = photoRepository.getOne(id);
original.setDate(photo.getDate());
original.setDevice(photo.getDevice());
original.setThumbnail(photo.getThumbnail());
original.setTitle(photo.getTitle());
original.setPath(photo.getPath());
return photoRepository.save(original);
}
@GetMapping("/photos/{id}")
public Photo getPhoto(Principal principal, @PathVariable("id") Long id) {
userService.checkPrincipal(principal);
return photoRepository.getOne(id);
}
}
| [
"lngtrn94@gmail.com"
] | lngtrn94@gmail.com |
74e43f759db2fa6f6cbb2da3b6cb6093ae541043 | dce653a27669f6b00ab25768024c69d3722066d4 | /Impresiones/src/java/co/com/rempe/impresiones/negocio/delegado/ContenteditorDelegado.java | 2b42baee4566dfd49300a972be66185ea4ae22a7 | [] | no_license | Jarvanux/Impresiones | 8ec3b209311a0b3708f119279d732eacc8170005 | 8661f3526ba8c612a9bc4c87005a5e5ce15034e7 | refs/heads/master | 2021-01-11T04:57:38.110519 | 2015-03-06T00:37:13 | 2015-03-06T00:37:13 | 26,620,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,271 | java | package co.com.rempe.impresiones.negocio.delegado;
import co.com.rempe.impresiones.negocio.constantes.ECodigoRespuesta;
import co.com.rempe.impresiones.negocio.respuesta.Respuesta;
import co.com.rempe.impresiones.persistencia.dao.ContentEditorDAO;
import co.com.rempe.impresiones.persistencia.entidades.Contenteditor;
import co.com.rempe.impresiones.persistencia.entidades.conexion.BDConexion;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
public class ContenteditorDelegado {
private static ContenteditorDelegado instancia = new ContenteditorDelegado();
public ContenteditorDelegado() {
}
public static ContenteditorDelegado getInstancia() {
return instancia;
}
//Método Insertar - Method insert.
public Respuesta insertarContenteditor(String text) {
Respuesta respuesta = new Respuesta();
EntityManager em = null;
try {
em = BDConexion.getEntityManager();
em.getTransaction().begin();
ContentEditorDAO dao = new ContentEditorDAO(em);
List<Contenteditor> list = dao.buscarTodos();
if (!list.isEmpty()) {
Contenteditor c = list.get(0);
c.setText(text);
dao.editar(c);
} else {
Contenteditor c = new Contenteditor();
c.setText(text);
dao.crear(c);
}
respuesta.setCodigo(ECodigoRespuesta.CORRECTO.getCodigo());
respuesta.setMensaje("Código guardado.");
em.getTransaction().commit();
} catch (Exception ex) {
em.getTransaction().rollback();
respuesta.setCodigo(ECodigoRespuesta.ERROR.getCodigo());
respuesta.setMensaje("No se pudo guardar el código.");
respuesta.setCodigo(ECodigoRespuesta.ERROR.getCodigo());
respuesta.setMensaje("ContenteditorDelegado.insertar() >> " + ECodigoRespuesta.ERROR.getDescripcion());
System.out.println("Error " + "ContenteditorDelegado.insertar() >> " + ex.getMessage());
}
return respuesta;
}
//Método Editar - Method edit.
public Respuesta buscarContenteditor() {
Respuesta respuesta = new Respuesta();
EntityManager em = null;
try {
em = BDConexion.getEntityManager();
ContentEditorDAO dao = new ContentEditorDAO(em);
List<Contenteditor> list = dao.buscarTodos();
respuesta.setCodigo(ECodigoRespuesta.CORRECTO.getCodigo());
if (!list.isEmpty()) {
Contenteditor c = list.get(0);
respuesta.setDatos(c.getText());
}else{
respuesta.setDatos("// Su código JavaScript aquí.");
}
respuesta.setMensaje("Código Consultado");
} catch (Exception ex) {
respuesta.setCodigo(ECodigoRespuesta.ERROR.getCodigo());
respuesta.setMensaje("ContenteditorDelegado.editar() >> " + ECodigoRespuesta.ERROR.getDescripcion());
System.out.println("Error " + "ContenteditorDelegado.editar() >> " + ex.getMessage());
}
return respuesta;
}
//Método Consultar por id - Method Find by Id.
}//End class
| [
"jhonjaider1000@JJ-PC"
] | jhonjaider1000@JJ-PC |
52a095dee2c58c2a659092e51a3f34bc65b0b375 | d580718aa71af93d731f33820b221939d0507780 | /src/test/java/SquareTests.java | bd790b6f93adfe2c6b6a2f58bec5be947ee9f6e1 | [] | no_license | Neriso/Geometry | ab1f5c4a492f3f12b66cf03e1020b10bb6f2923d | 937ab98504ae2592b2a85b19a24b41265350cffb | refs/heads/master | 2022-11-08T11:12:02.131672 | 2020-06-23T23:55:53 | 2020-06-23T23:55:53 | 274,532,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,262 | java | import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
class SquareTests {
float delta = 0.00001f;
@Test
void testPositiveSides() {
float a = 3;
Square s = new Square(a);
assertAll("Square fields", () -> {
assertEquals(a, s.getA(), delta);
assertEquals(a, s.getB(), delta);
});
}
@Test
void testZeroSide() {
float a = 0;
assertThrows(IllegalArgumentException.class, () -> {
new Square(a);
});
}
@Test
void testNegativeSide() {
float a = -3;
assertThrows(IllegalArgumentException.class, () -> {
new Square(a);
});
}
@Test
void testGetArea() {
float a = 3;
double expectedArea = 9;
Square s = new Square(a);
assertEquals(expectedArea, s.calculateArea(), delta);
}
@Test
void testGetPerimeter() {
float a = 3;
double expectedPerimeter = 12;
Square s = new Square(a);
assertEquals(expectedPerimeter, s.calculatePerimeter(), delta);
}
} | [
"w.tokarz80gmail.com"
] | w.tokarz80gmail.com |
41d3b96b43edcc00cf89e8b362dd9a5d85b4ce0f | bfd6419d6d49528816f2f4d1f120a004fc220c35 | /src/com/neaea_exam_admin/view/ExamCenterAssignmentForm.java | 8a3c93ffd802b7b1a9e492592972d7d92afecdc6 | [] | no_license | brookye/neaea-exam-admin | 99bfcb596c2679d85f6dc211aa7b4245c9ab15e2 | d80434d2ab6622f345bd7dc377a109f80f67d5f4 | refs/heads/master | 2021-01-20T18:39:36.274415 | 2014-02-08T14:11:54 | 2014-02-08T14:11:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,963 | java | package com.neaea_exam_admin.view;
import java.util.List;
import com.neaea_exam_admin.DAO.ExamCenterDAO;
import com.neaea_exam_admin.DAO.RegionDAO;
import com.neaea_exam_admin.DAO.SchoolDAO;
import com.neaea_exam_admin.DAO.WoredaDAO;
import com.neaea_exam_admin.DAO.ZoneDAO;
import com.neaea_exam_admin.controller.ExamCenterAssignmentFormController;
import com.neaea_exam_admin.entity.ExamCenter;
import com.neaea_exam_admin.entity.Region;
import com.neaea_exam_admin.entity.School;
import com.neaea_exam_admin.entity.Woreda;
import com.neaea_exam_admin.entity.Zone;
import com.neaea_exam_admin.utilities.ConnManager;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
<<<<<<< HEAD
import com.vaadin.data.Validator.InvalidValueException;
import com.vaadin.data.validator.NullValidator;
=======
>>>>>>> 802585f8dc16a331acb25b38f7bf6efabef3f729
import com.vaadin.ui.Button;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.FormLayout;
@SuppressWarnings("serial")
public class ExamCenterAssignmentForm extends CustomComponent {
public ComboBox CBWoreda;
public ComboBox CBZone;
public ComboBox CBRegion;
public ComboBox CBSchoolName;
public ComboBox CBExamCenter;
SchoolDAO schoolDAO = new SchoolDAO(new ConnManager());
public Button BTAssign;
public FormLayout fl;
private ExamCenterAssignmentFormController ecafc = new ExamCenterAssignmentFormController(
this);
public ExamCenterAssignmentForm() {
init();
setCompositionRoot(fl);
fillRegion();
}
private void init() {
CBWoreda = new ComboBox("Woreda");
CBWoreda.setNullSelectionAllowed(false);
CBWoreda.setNewItemsAllowed(false);
CBWoreda.setWidth(160, Unit.POINTS);
CBZone = new ComboBox("Zone");
CBWoreda.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
fillSchool();
}
});
CBZone.setNullSelectionAllowed(false);
CBZone.setNewItemsAllowed(false);
CBZone.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
fillWoreda();
}
});
CBZone.setWidth(160, Unit.POINTS);
CBRegion = new ComboBox("Region");
CBRegion.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
fillZone();
}
});
CBRegion.addValueChangeListener(ecafc);
CBRegion.setWidth(160, Unit.POINTS);
CBRegion.setNullSelectionAllowed(false);
CBRegion.setNewItemsAllowed(false);
CBSchoolName = new ComboBox("School name");
CBSchoolName.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
fillExamCenter();
}
});
CBSchoolName.setWidth(160, Unit.POINTS);
CBSchoolName.setNullSelectionAllowed(false);
CBSchoolName.setNewItemsAllowed(false);
CBExamCenter = new ComboBox("Exam center");
CBExamCenter.setWidth(160, Unit.POINTS);
CBExamCenter.setNullSelectionAllowed(false);
CBExamCenter.setNewItemsAllowed(false);
BTAssign = new Button("Assign");
BTAssign.addClickListener(ecafc);
fl = new FormLayout();
fl.addComponent(CBRegion);
fl.addComponent(CBZone);
fl.addComponent(CBWoreda);
fl.addComponent(CBSchoolName);
fl.addComponent(CBExamCenter);
fl.addComponent(BTAssign);
CBRegion.addValidator(new NullValidator("Cannot be empty", false));
CBZone.addValidator(new NullValidator("Cannot be empty", false));
CBWoreda.addValidator(new NullValidator("Cannot be empty", false));
CBExamCenter.addValidator(new NullValidator("Cannot be empty", false));
CBSchoolName.addValidator(new NullValidator("Cannot be empty", false));
formValidatorLabelsOn(false);
}
private void fillRegion() {
RegionDAO regionDAO = new RegionDAO(new ConnManager());
List<Region> regions = regionDAO.getAll();
for (Region reg : regions) {
CBRegion.addItem(reg.getRegionCode());
CBRegion.setItemCaption(reg.getRegionCode(), reg.getRegionName());
}
}
public void fillZone() {
CBZone.removeAllItems();
ZoneDAO zoneDAO = new ZoneDAO(new ConnManager());
System.out.println("INFO:CBRegion value:"
+ (Integer) CBRegion.getValue());
List<Zone> zones = zoneDAO.getByRegionId((Integer) CBRegion.getValue());
for (Zone zn : zones) {
CBZone.addItem(zn.getZoneId());
CBZone.setItemCaption(zn.getZoneId(), zn.getZoneName());
}
}
public void fillWoreda() {
CBWoreda.removeAllItems();
WoredaDAO woredaDAO = new WoredaDAO(new ConnManager());
System.out.println("INFO" + (Integer) CBZone.getValue());
List<Woreda> woredas = woredaDAO.getByZoneId((Integer) CBZone
.getValue());
for (Woreda w : woredas) {
CBWoreda.addItem(w.getWoredaId());
CBWoreda.setItemCaption(w.getWoredaId(), w.getWoredaName());
}
}
public void fillSchool() {
CBSchoolName.removeAllItems();
List<School> schools = schoolDAO.getByWoredaId((Integer)CBWoreda.getValue());
for (School s : schools) {
CBSchoolName.addItem(s.getCode());
CBSchoolName.setItemCaption(s.getCode(), s.getSchoolName());
}
}
public void formValidatorLabelsOn(boolean isOn) {
CBRegion.setValidationVisible(isOn);
CBZone.setValidationVisible(isOn);
CBWoreda.setValidationVisible(isOn);
CBSchoolName.setValidationVisible(isOn);
CBExamCenter.setValidationVisible(isOn);
}
public void Validate() throws InvalidValueException {
CBRegion.validate();
CBZone.validate();
CBWoreda.validate();
CBSchoolName.validate();
CBExamCenter.validate();
}
public void fillExamCenter() {
CBExamCenter.removeAllItems();
ExamCenterDAO examCenterDAO=new ExamCenterDAO(new ConnManager());
List<ExamCenter> examCenters=examCenterDAO.getByWoreda((Integer)CBWoreda.getValue());
for (ExamCenter e : examCenters) {
CBExamCenter.addItem(e.getGroupNo());
CBExamCenter.setItemCaption(e.getGroupNo(),e.getSchool().getSchoolName());
}
}
}
| [
"misgana.bayetta@gmail.com"
] | misgana.bayetta@gmail.com |
3edeea4e4643f3088252663c2e52d2475e8fe8db | 6f56b338bc32a40e29b10ca8585caf5edcf667b2 | /osmdroid-android/src/main/java/org/osmdroid/LocationListenerProxy.java | 5624494cae78382ecf51ab73cac7700543fb393e | [] | no_license | SeGarVi/osmdroid-PalmaBiciFork | d56f8641cc5bf1271f226b9eedc16be19627155e | 09a8a49c1700ea84bc95d099f4679991e8f29be7 | refs/heads/master | 2021-01-20T03:31:27.331207 | 2013-12-31T18:18:21 | 2013-12-31T18:18:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,659 | java | package org.osmdroid;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
public class LocationListenerProxy implements LocationListener {
private final LocationManager mLocationManager;
private LocationListener mListener = null;
public LocationListenerProxy(final LocationManager pLocationManager) {
mLocationManager = pLocationManager;
}
public boolean startListening(final LocationListener pListener, final long pUpdateTime,
final float pUpdateDistance) {
boolean result = false;
mListener = pListener;
for (final String provider : mLocationManager.getProviders(true)) {
if (LocationManager.GPS_PROVIDER.equals(provider)
|| LocationManager.NETWORK_PROVIDER.equals(provider)) {
result = true;
mLocationManager.requestLocationUpdates(provider, pUpdateTime, pUpdateDistance,
this);
}
}
return result;
}
public void stopListening() {
mListener = null;
mLocationManager.removeUpdates(this);
}
public void onLocationChanged(final Location arg0) {
if (mListener != null) {
mListener.onLocationChanged(arg0);
}
}
public void onProviderDisabled(final String arg0) {
if (mListener != null) {
mListener.onProviderDisabled(arg0);
}
}
public void onProviderEnabled(final String arg0) {
if (mListener != null) {
mListener.onProviderEnabled(arg0);
}
}
public void onStatusChanged(final String arg0, final int arg1, final Bundle arg2) {
if (mListener != null) {
mListener.onStatusChanged(arg0, arg1, arg2);
}
}
}
| [
"yayalose@gmail.com"
] | yayalose@gmail.com |
2ba310f825f9309b77af89be68071f5e9bacd1b8 | 6c5a8273b3c677781612d18361e265a152922b6b | /src/com/bvan/javaoop/lessons7_8/generics/box/good/Box.java | 785d2f5f0eb57ac70f1205747e3091ddcfb9404c | [] | no_license | bohdanvan/javaoop-group84 | e0a5683dedc4d7fc99d92025f38e981a01d7e240 | 62b01935d1ff2a821d7336ac28c83982c385ae3b | refs/heads/master | 2020-03-27T06:34:51.827162 | 2018-10-06T20:36:31 | 2018-10-06T20:36:31 | 146,116,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package com.bvan.javaoop.lessons7_8.generics.box.good;
import com.bvan.javaoop.lessons7_8.generics.box.Cat;
/**
* @author bvanchuhov
*/
public class Box<T extends Cat> {
private final T value;
public Box(T value) {
this.value = value;
}
public T get() {
return value;
}
// public T create() {
// return new T();
// }
//
// public T[] createArray() {
// return (T[]) new Object[10];
// }
@Override
public String toString() {
return "Box{" +
"value=" + value +
'}';
}
}
| [
"bohdan.vanchuhov@globallogic.com"
] | bohdan.vanchuhov@globallogic.com |
9b8a21acd5ccaeaccb9f7d260ec7c6678ff4c016 | 2333b15565a8e74767faa88979c2b9fdc155ee60 | /Libary/src/com/libary/Square.java | 646cd10d24da4c2036a93851bac6f1f2114483f9 | [] | no_license | wesley2001/AndroidDev | 3452ae448f028c6aa5c5f51a94d8af2a7ac7c327 | 8f571a9a76cdc9fd55bbe0586e807635b1ce5f66 | refs/heads/master | 2020-06-01T06:31:37.582953 | 2012-11-21T12:54:32 | 2012-11-21T12:54:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,509 | java | package com.libary;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
public class Square {
private FloatBuffer vertexBuffer;
private ShortBuffer drawListBuffer;
// number of coordinates per vertex in this array
static final int COORDS_PER_VERTEX = 3;
static float squareCoords[] = { -0.5f, 0.5f, 0.0f, // top left
-0.5f, -0.5f, 0.0f, // bottom left
0.5f, -0.5f, 0.0f, // bottom right
0.5f, 0.5f, 0.0f }; // top right
private short drawOrder[] = { 0, 1, 2, 0, 2, 3 }; // order to draw vertices
public Square() {
// initialize vertex byte buffer for shape coordinates
ByteBuffer bb = ByteBuffer.allocateDirect(
// (# of coordinate values * 4 bytes per float)
squareCoords.length * 4);
bb.order(ByteOrder.nativeOrder());
vertexBuffer = bb.asFloatBuffer();
vertexBuffer.put(squareCoords);
vertexBuffer.position(0);
// initialize byte buffer for the draw list
ByteBuffer dlb = ByteBuffer.allocateDirect(
// (# of coordinate values * 2 bytes per short)
drawOrder.length * 2);
dlb.order(ByteOrder.nativeOrder());
drawListBuffer = dlb.asShortBuffer();
drawListBuffer.put(drawOrder);
drawListBuffer.position(0);
}
} | [
"wesley2001@hotmail.com"
] | wesley2001@hotmail.com |
d468198f1d54bcd71d65af98ef43b9e82941a27f | 580516de0039509fcc1362880ea62a1883960e7d | /Consola.java | 66f2c4a958809ae9df2b392717a46a7cd6839b16 | [] | no_license | giannyuffo/dam129t11 | 8f8201cae94db82372cf5d922158826b89e2ba7f | 5bb36ec224cd1e22b611b1ee4484c84222e0bb0a | refs/heads/master | 2021-02-10T07:43:42.191636 | 2020-04-03T14:38:18 | 2020-04-03T14:38:18 | 244,362,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,137 | java | package ejercicios;
import java.util.Scanner;
public class Consola {
public Consola (){}
public static int leerEntero (String texto, int limiteinferior, int limitesuperior) {
int valor=-1;
boolean error = true;
while (error) {
Scanner teclado = new Scanner(System.in);
System.out.print(texto + " (" + limiteinferior + "-" + limitesuperior +"):");
String txt = teclado.nextLine();
txt = txt.replaceAll("\\s","");
try {
valor = Integer.parseInt(txt);
} catch( Exception e) {}
if (valor >= limiteinferior && valor <= limitesuperior) error = false;
else System.out.println("> Valor incorrecto.");
}
return valor;
}
public static void PintarTablero (Nim tablero){
int i,j;
System.out.println ("\n-------TABLERO-----------" );
for (i=0;i<=2;i++) {
System.out.print ("Fila " + (i+1) + "(" + tablero.palillos[i]+"): " );
for (j=1;j<=tablero.palillos[i];j++)System.out.print("O ");
System.out.print ("\n");
}
System.out.println ("-------------------------\n" );
}
} //fin clase
| [
"59051445+giannyuffo@users.noreply.github.com"
] | 59051445+giannyuffo@users.noreply.github.com |
6f824d43dfb2ce1a9324a65cefd26cc8399f80dd | 2b6e3a34ec277f72a5da125afecfe3f4a61419f5 | /Ruyicai_91/v3.8.3/src/com/ruyicai/activity/buy/high/High_Frequencyrevenue_Recovery.java | d7866f3ba1703cab30a3a3aaeb60a29ed87aefdd | [] | no_license | surport/Android | 03d538fe8484b0ff0a83b8b0b2499ad14592c64b | afc2668728379caeb504c9b769011f2ba1e27d25 | refs/heads/master | 2020-04-02T10:29:40.438348 | 2013-12-18T09:55:42 | 2013-12-18T09:55:42 | 15,285,717 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 26,150 | java | package com.ruyicai.activity.buy.high;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
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.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.palmdream.RuyicaiAndroid91.R;
import com.ruyicai.activity.buy.ApplicationAddview;
import com.ruyicai.activity.common.UserLogin;
import com.ruyicai.constant.Constants;
import com.ruyicai.controller.Controller;
import com.ruyicai.handler.HandlerMsg;
import com.ruyicai.handler.MyHandler;
import com.ruyicai.net.newtransaction.BetAndGiftInterface;
import com.ruyicai.net.newtransaction.ShouyiDataInterface;
import com.ruyicai.net.newtransaction.getRecoveryBatchCode;
import com.ruyicai.net.newtransaction.pojo.BetAndGiftPojo;
import com.ruyicai.pojo.ShouyiPojo;
import com.ruyicai.util.PublicMethod;
import com.ruyicai.util.RWSharedPreferences;
import com.umeng.analytics.MobclickAgent;
/* 高频彩收益追号
* **/
public class High_Frequencyrevenue_Recovery extends Activity implements HandlerMsg {
String phonenum, sessionId, userno;
TextView title;
BetAndGiftPojo betAndGift;
TextView zhumatext;
TextView caizhong;
Spinner startqi;
EditText qishu;
EditText beishu;
EditText allshouyilv;
EditText qianshouyiqi;
EditText qianshouyilv;
EditText houshouyilv;
Button jisuan;
RadioButton all;
RadioButton qianhou;
String textzhuma = "";
String lotnostr;
AlertDialog information;
int hightball = 0;
int zhushu;
String jsonstring;
ArrayList<String> batchcodes = new ArrayList<String>();
ArrayList<RecoveryInfo> shouyidata = new ArrayList<RecoveryInfo>();
private Context context;
HighFrequencyHandler handler = new HighFrequencyHandler(this);
private Controller controller;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.high_frequencyrevenue_recovery_main);
context = this;
getInfo();
init();
getbatchcodes();
// setTitle();
zhumatext.setText(textzhuma);
}
private void initSpiner() {
// TODO Auto-generated method stub
ArrayList<String> batchcodestr = new ArrayList<String>();
for (int i = 0; i < batchcodes.size(); i++) {
if (i == 0) {
batchcodestr.add("第" + batchcodes.get(i) + "期" + "[当前期]");
} else {
batchcodestr.add("第" + batchcodes.get(i) + "期");
}
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, batchcodestr);
adapter.setDropDownViewResource(R.layout.myspinner_dropdown);
startqi.setAdapter(adapter);
}
/*
* 初始化组件 *
*/
private void init() {
zhumatext = (TextView) findViewById(R.id.shouyizhihaozhuma);
startqi = (Spinner) findViewById(R.id.shouyiqihao);
qishu = (EditText) findViewById(R.id.shouyiqishuEditext);
beishu = (EditText) findViewById(R.id.shouyibeishuEditext);
allshouyilv = (EditText) findViewById(R.id.shouyiquanchengEditext);
qianshouyiqi = (EditText) findViewById(R.id.shouyiqianEditext);
qianshouyilv = (EditText) findViewById(R.id.shouyizhihouEditext);
houshouyilv = (EditText) findViewById(R.id.shouyizhihouEditext1);
jisuan = (Button) findViewById(R.id.jisuan);
all = (RadioButton) findViewById(R.id.shouyiquancheng);
qianhou = (RadioButton) findViewById(R.id.shouyizhihou);
caizhong = (TextView) findViewById(R.id.alert_dialog_touzhu_textview_caizhong);
caizhong.setText(PublicMethod.toLotno(betAndGift.getLotno()));
all.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
if (isChecked) {
allshouyilv.setEnabled(true);
qianhou.setChecked(false);
qianshouyiqi.setEnabled(false);
qianshouyilv.setEnabled(false);
houshouyilv.setEnabled(false);
}
}
});
qianhou.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
if (isChecked) {
allshouyilv.setEnabled(false);
all.setChecked(false);
qianshouyiqi.setEnabled(true);
qianshouyilv.setEnabled(true);
houshouyilv.setEnabled(true);
}
}
});
jisuan.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String beish = beishu.getText().toString();
String qi = qishu.getText().toString();
String alledit = allshouyilv.getText().toString();
String qianqi = qianshouyiqi.getText().toString();
String qianlv = qianshouyilv.getText().toString();
String houlv = houshouyilv.getText().toString();
if (qi.equals("") || qi.equals("0")) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"请输入有效期数", Toast.LENGTH_SHORT).show();
return;
}
if (qi.length() > 3 || Integer.valueOf(qi) > 99) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"超过期数上限99期,请输入有效期数", Toast.LENGTH_SHORT).show();
return;
}
if (beish.equals("") || beish.equals("0")) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"请输入有效倍数", Toast.LENGTH_SHORT).show();
return;
}
if (beish.length() > 5 || Integer.valueOf(beish) > 9999) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"超过倍数上限9999倍,请输入有效倍数", Toast.LENGTH_SHORT).show();
return;
}
if (all.isChecked()) {
if (alledit.equals("") || alledit.equals("0")) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"请输入有效全程收益率", Toast.LENGTH_SHORT).show();
return;
}
} else {
if (qianqi.equals("") || qianqi.equals("0")) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"请输入有效期数", Toast.LENGTH_SHORT).show();
return;
}
if (qianqi.length() > 3 || Integer.valueOf(qi) > 99) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"超过期数上限99期,请输入有效期数", Toast.LENGTH_SHORT).show();
return;
}
if (qianlv.equals("") || qianlv.equals("0")) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"请输入有效收益率", Toast.LENGTH_SHORT).show();
return;
}
if (houlv.equals("") || houlv.equals("0")) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"请输入有效收益率", Toast.LENGTH_SHORT).show();
return;
}
if (Integer.valueOf(qi) < Integer.valueOf(qianqi)) {
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"追号总期数应大于前期数", Toast.LENGTH_SHORT).show();
return;
}
}
getshouyidata();
}
});
}
// private void setTitle() {
// if (lotnostr.equals(com.ruyicai.constant.Constants.LOTNO_SSC)) {
// title.setText("时时彩-收益率追号");
// } else if (lotnostr.equals(com.ruyicai.constant.Constants.LOTNO_11_5)) {
// title.setText("江西11选5-收益率追号");
// } else if (lotnostr.equals(com.ruyicai.constant.Constants.LOTNO_eleven))
// {
// title.setText("11夺金-收益率追号");
// }else if(lotnostr.equals(com.ruyicai.constant.Constants.LOTNO_GD_11_5)){
// title.setText("广东11选5-收益率追号");
// }
// }
/*
* 创建收益dialog; *
*/
public void createinformationdialog() {
Log.e("betcode", betAndGift.getBet_code());
LayoutInflater inflater = (LayoutInflater) this
.getSystemService(LAYOUT_INFLATER_SERVICE);
information = new AlertDialog.Builder(this).create();
View v = inflater.inflate(R.layout.high_frequencyrevenue_recovery_list,
null);
CheckBox checkPrize = (CheckBox) v
.findViewById(R.id.alert_dialog_shouyi_check_prize);
TextView title = (TextView) v.findViewById(R.id.titletext);
TextView moenytext = (TextView) v.findViewById(R.id.moneytext);
try {
moenytext.setText("注数:"
+ zhushu
+ "注"
+ " "
+ "金额:"
+ PublicMethod.toIntYuan(shouyidata.get(
shouyidata.size() - 1).getLeijitouru()) + "元");
} catch (Exception e) {
// TODO: handle exception
}
if (lotnostr.equals(Constants.LOTNO_SSC)) {
title.setText("重庆时时彩-收益率追号");
} else if (lotnostr.equals(Constants.LOTNO_11_5)) {
title.setText("江西11选5-收益率追号");
} else if (lotnostr.equals(Constants.LOTNO_eleven)) {
title.setText("11夺金-收益率追号");
} else if (lotnostr.equals(Constants.LOTNO_GD_11_5)) {
title.setText("广东11选5-收益率追号");
} else if (lotnostr.equals(Constants.LOTNO_ten)) {
title.setText("广东快乐十分-收益率追号");
}
ListView shouyilist = (ListView) v.findViewById(R.id.shouyilist);
Yieldadapter adapter = new Yieldadapter(
High_Frequencyrevenue_Recovery.this, shouyidata);
shouyilist.setAdapter(adapter);
checkPrize.setChecked(true);
// 设置betAndGift.prizeend与checkPrize保持一致
betAndGift.setPrizeend("1");
checkPrize.setButtonDrawable(R.drawable.check_on_off);
checkPrize.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
if (isChecked) {
betAndGift.setPrizeend("1");
} else {
betAndGift.setPrizeend("0");
}
}
});
Button cancel = (Button) v.findViewById(R.id.cancel);
Button ok = (Button) v.findViewById(R.id.ok);
cancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
information.dismiss();
}
});
ok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
RWSharedPreferences pre = new RWSharedPreferences(
High_Frequencyrevenue_Recovery.this, "addInfo");
sessionId = pre.getStringValue("sessionid");
phonenum = pre.getStringValue("phonenum");
userno = pre.getStringValue("userno");
if (userno.equals("")) {
Intent intentSession = new Intent(
High_Frequencyrevenue_Recovery.this,
UserLogin.class);
startActivityForResult(intentSession, 0);
} else {
touZhuNet();
}
}
});
information.show();
information.getWindow().setContentView(v);
}
/**
* s 从上一个页面获取信息
*/
public void getInfo() {
ApplicationAddview app = (ApplicationAddview) getApplicationContext();
betAndGift = app.getPojo();
textzhuma = app.getHtextzhuma();
lotnostr = betAndGift.getLotno();
hightball = app.getHightball();
zhushu = app.getHzhushu();
}
public void getbatchcodes() {
final Handler hand = new Handler();
final ProgressDialog dialog = onCreateDialog();
dialog.show();
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
String bathcode = getRecoveryBatchCode.getInstance().getCode(
lotnostr, "10");
try {
JSONObject json = new JSONObject(bathcode);
JSONArray array = json.getJSONArray("result");
for (int i = 0; i < array.length(); i++) {
JSONObject obj = array.getJSONObject(i);
String betcode = obj.getString("batchCode");
batchcodes.add(betcode);
}
dialog.dismiss();
hand.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
initSpiner();
}
});
} catch (JSONException e) {
// TODO: handle exception
hand.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
dialog.dismiss();
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"期号获取失败", Toast.LENGTH_SHORT).show();
}
});
}
}
}).start();
}
private String getsubscribeInfo() {
StringBuffer str = new StringBuffer();
if (shouyidata.size() != 0) {
for (int i = 0; i < shouyidata.size(); i++) {
str.append(shouyidata.get(i).getBatchcod())
.append(",")
.append(shouyidata.get(i).getDangqitouru())
.append(",")
.append(shouyidata.get(i).getBeishu())
.append(",")
.append(PublicMethod.toIntYuan(shouyidata.get(i)
.getDangqitouru()))
.append("_")
.append(PublicMethod.toIntYuan(shouyidata.get(i)
.getDangqishouyi())).append("_")
.append(shouyidata.get(i).getShouyilv());
if (i != shouyidata.size() - 1) {
str.append("!");
}
}
}
return str.toString();
}
private String getAmoot() {
String amt = "";
int onceamt = 0;
for (int i = 0; i < shouyidata.size(); i++) {
onceamt += Integer.valueOf(shouyidata.get(i).getDangqitouru());
}
amt = String.valueOf(onceamt);
return amt;
}
private void getshouyidata() {
final ShouyiPojo pojo = new ShouyiPojo();
String beish = beishu.getText().toString();
String qi = qishu.getText().toString();
String alledit = allshouyilv.getText().toString();
String qianqi = qianshouyiqi.getText().toString();
String qianlv = qianshouyilv.getText().toString();
String houlv = houshouyilv.getText().toString();
if (batchcodes.size() == 0) {
return;
}
String batchcode = batchcodes.get(startqi.getSelectedItemPosition());
pojo.setBatchcode(batchcode);
pojo.setBatchnum(qi);
pojo.setLotmulti(beish);
pojo.setLotno(lotnostr);
pojo.setBetcode(betAndGift.getBet_code());
pojo.setBetNum(String.valueOf(zhushu));
if (all.isChecked()) {
pojo.setWholeYield(alledit);
} else if (qianhou.isChecked()) {
pojo.setBeforeBatchNum(qianqi);
pojo.setBeforeYield(qianlv);
pojo.setAfterYield(houlv);
}
final Handler hand = new Handler();
final ProgressDialog dialog = onCreateDialog();
dialog.show();
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
jsonstring = ShouyiDataInterface.getInstance().getshouyidada(
pojo);
try {
JSONObject json = new JSONObject(jsonstring);
String errorcode = json.getString("error_code");
final String message = json.getString("message");
if (errorcode.equals("0000")) {
encodejson(jsonstring);
hand.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
dialog.dismiss();
createinformationdialog();
}
});
} else if (errorcode.equals("9999")) {
hand.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
dialog.dismiss();
Toast.makeText(
High_Frequencyrevenue_Recovery.this,
message, Toast.LENGTH_SHORT).show();
}
});
}
} catch (JSONException e) {
// TODO: handle exception
hand.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
dialog.dismiss();
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"获取失败", Toast.LENGTH_SHORT).show();
}
});
}
}
}).start();
}
/**
* 投注联网
*/
public void touZhuNet() {
betAndGift.setSessionid(sessionId);
betAndGift.setPhonenum(phonenum);
betAndGift.setUserno(userno);
betAndGift.setSubscribeInfo(getsubscribeInfo());
if (all.isChecked()) {
betAndGift.setDescription("全程收益率"
+ allshouyilv.getText().toString() + "%");
} else if (qianhou.isChecked()) {
betAndGift.setDescription("前" + qianshouyiqi.getText().toString()
+ "期收益率" + qianshouyilv.getText().toString() + "%之后收益率"
+ houshouyilv.getText().toString() + "%");
}
betAndGift.setIsBetAfterIssue("1");
betAndGift.setBatchcode(shouyidata.get(0).getBatchcod());
betAndGift.setBatchnum(qishu.getText().toString());
betAndGift.setLotmulti(beishu.getText().toString());
betAndGift.setAmount(getAmoot());
controller = Controller.getInstance(High_Frequencyrevenue_Recovery.this);
if (controller != null) {
controller.doBettingAction(handler, betAndGift);
}
// final Handler hand = new Handler();
// final ProgressDialog dialog = onCreateDialog();
// dialog.show();
// // 加入是否改变切入点判断 陈晨 8.11
// Thread t = new Thread(new Runnable() {
// String str = "00";
//
// @Override
// public void run() {
// str = BetAndGiftInterface.getInstance().betOrGift(betAndGift);
// try {
// JSONObject obj = new JSONObject(str);
// final String msg = obj.getString("message");
// String error = obj.getString("error_code");
// if (error.equals("0000")) {
// hand.post(new Runnable() {
//
// @Override
// public void run() {
// // TODO Auto-generated method stub
// dialog.dismiss();
// // PublicMethod.showDialog(High_Frequencyrevenue_Recovery.this,msg);
// PublicMethod
// .showDialog(High_Frequencyrevenue_Recovery.this);
// information.dismiss();
// }
// });
// } else {
// hand.post(new Runnable() {
//
// @Override
// public void run() {
// // TODO Auto-generated method stub
// dialog.dismiss();
// Toast.makeText(
// High_Frequencyrevenue_Recovery.this,
// msg, Toast.LENGTH_SHORT).show();
//
// }
// });
// }
// } catch (JSONException e) {
// e.printStackTrace();
// hand.post(new Runnable() {
//
// @Override
// public void run() {
// // TODO Auto-generated method stub
// dialog.dismiss();
// Toast.makeText(High_Frequencyrevenue_Recovery.this,
// "获取失败", Toast.LENGTH_SHORT).show();
//
// }
// });
// }
// }
//
// });
// t.start();
}
public void encodejson(String json) {
if (shouyidata.size() != 0) {
shouyidata.clear();
}
try {
JSONObject shouyidatajson = new JSONObject(json);
String data = shouyidatajson.getString("result");
JSONArray dataarray = new JSONArray(data);
for (int i = 0; i < dataarray.length(); i++) {
try {
RecoveryInfo info = new RecoveryInfo();
info.setBatchcod(dataarray.getJSONObject(i).getString(
"batchCode"));
info.setBeishu(dataarray.getJSONObject(i).getString(
"lotMulti"));
info.setDangqitouru(dataarray.getJSONObject(i).getString(
"currentIssueInput"));
info.setDangqishouyi(dataarray.getJSONObject(i).getString(
"currentIssueYield"));
info.setLeijitouru(dataarray.getJSONObject(i).getString(
"accumulatedInput"));
info.setLeijishouyi(dataarray.getJSONObject(i).getString(
"accumulatedYield"));
info.setShouyilv(dataarray.getJSONObject(i).getString(
"yieldRate"));
shouyidata.add(info);
} catch (Exception e) {
}
}
} catch (JSONException e) {
}
}
/**
* 收益数据
*/
public class Yieldadapter extends BaseAdapter {
private LayoutInflater mInflater; // 扩充主列表布局
private List<RecoveryInfo> mList;
public Yieldadapter(Context context, List<RecoveryInfo> list) {
mInflater = LayoutInflater.from(context);
mList = list;
}
public int getCount() {
return mList.size();
}
public Object getItem(int position) {
return mList.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
String bachcode = mList.get(position).getBatchcod();
String danqibeishu = mList.get(position).getBeishu();
String dangqitouru = PublicMethod.toIntYuan(mList.get(position)
.getDangqitouru());
String dangqishouyi = PublicMethod.toIntYuan(mList.get(position)
.getDangqishouyi());
String leijitouru = PublicMethod.toIntYuan(mList.get(position)
.getLeijitouru());
String leijishouyi = PublicMethod.toIntYuan(mList.get(position)
.getLeijishouyi());
String shouyilv = mList.get(position).getShouyilv();
if (convertView == null) {
convertView = mInflater.inflate(
R.layout.high_frequencyrevenue_recovery_itme, null);
holder = new ViewHolder();
holder.text = (TextView) convertView
.findViewById(R.id.shouyiitem);
} else {
holder = (ViewHolder) convertView.getTag();
}
StringBuffer str = new StringBuffer();
str.append(bachcode).append("期").append(" ")
.append(danqibeishu).append("倍").append("\n");
str.append("当期投入:").append("¥").append(dangqitouru)
.append(" ");
str.append("当期收益:").append("¥").append(dangqishouyi).append("\n")
.append("累计投入:").append("¥").append(leijitouru)
.append(" ");
str.append("累计收益:").append("¥").append(leijishouyi)
.append(" ").append("\n").append("收益率:")
.append(shouyilv);
holder.text.setText(str);
convertView.setTag(holder);
return convertView;
}
class ViewHolder {
TextView text;
}
}
public ProgressDialog onCreateDialog() {
ProgressDialog progressDialog = new ProgressDialog(
High_Frequencyrevenue_Recovery.this);
progressDialog.setMessage("网络连接中...");
progressDialog.setIndeterminate(true);
return progressDialog;
}
class RecoveryInfo {
String batchcod = "";
String beishu = "";
String dangqitouru = "";
String dangqishouyi = "";
String leijitouru = "";
String leijishouyi = "";
String shouyilv = "";
public String getBatchcod() {
return batchcod;
}
public void setBatchcod(String batchcod) {
this.batchcod = batchcod;
}
public String getBeishu() {
return beishu;
}
public void setBeishu(String beishu) {
this.beishu = beishu;
}
public String getDangqitouru() {
return dangqitouru;
}
public void setDangqitouru(String dangqitouru) {
this.dangqitouru = dangqitouru;
}
public String getDangqishouyi() {
return dangqishouyi;
}
public void setDangqishouyi(String dangqishouyi) {
this.dangqishouyi = dangqishouyi;
}
public String getLeijitouru() {
return leijitouru;
}
public void setLeijitouru(String leijitouru) {
this.leijitouru = leijitouru;
}
public String getLeijishouyi() {
return leijishouyi;
}
public void setLeijishouyi(String leijishouyi) {
this.leijishouyi = leijishouyi;
}
public String getShouyilv() {
return shouyilv;
}
public void setShouyilv(String shouyilv) {
this.shouyilv = shouyilv;
}
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
MobclickAgent.onPause(this);// BY贺思明 2012-7-24
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
MobclickAgent.onResume(this);// BY贺思明 2012-7-24
}
class HighFrequencyHandler extends MyHandler {
public HighFrequencyHandler(HandlerMsg msg) {
super(msg);
// TODO Auto-generated constructor stub
}
public void handleMessage(Message msg) {
//super.handleMessage(msg);
if (controller != null) {
JSONObject obj = controller.getRtnJSONObject();
String error;
try {
error = obj.getString("error_code");
final String returnMessage = obj.getString("message");
if (error.equals("0000")) {
handler.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
// PublicMethod.showDialog(High_Frequencyrevenue_Recovery.this,msg);
PublicMethod
.showDialog(High_Frequencyrevenue_Recovery.this);
information.dismiss();
}
});
} else {
handler.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
Toast.makeText(
High_Frequencyrevenue_Recovery.this,
returnMessage, Toast.LENGTH_SHORT).show();
}
});
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Toast.makeText(High_Frequencyrevenue_Recovery.this,
"获取失败", Toast.LENGTH_SHORT).show();
}
}
}
}
@Override
public void errorCode_0000() {
// TODO Auto-generated method stub
}
@Override
public void errorCode_000000() {
// TODO Auto-generated method stub
}
@Override
public Context getContext() {
// TODO Auto-generated method stub
return this;
}
}
| [
"zxflimit@gmail.com"
] | zxflimit@gmail.com |
ffbbefee441fec79c201a33094020315ca4b1015 | ed64d9dc7eadc47295d73d252a515ca685789e19 | /app/src/androidTest/java/com/ahf/inventoryapp/ExampleInstrumentedTest.java | 740eedc63e68ca96e22155b322587076adf67872 | [] | no_license | AhmedHF/Android_AHF_InventoryApp | 3e8a6de7b33746c6bfba24bc140c34a8ee585429 | 8e4c15aa876b9b3ff55b7d73d999990fd9afacae | refs/heads/master | 2020-04-02T17:28:39.454831 | 2018-10-25T11:24:14 | 2018-10-25T11:24:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | package com.ahf.inventoryapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.ahf.inventoryapp", appContext.getPackageName());
}
}
| [
"a.hassan19995@gmail.com"
] | a.hassan19995@gmail.com |
24f2559192083994191c1da85a3b3ae60a125f84 | 64f250ca6930cc2a3b99535377bc76858ab08c3d | /src/main/java/com/stacksimplify/restservices/HelloWorldController.java | 54262d2bb35937c4ba101881248586bd4aa9aafb | [] | no_license | Michaelselvan2010/springboot-building | 42024490ed3bf4fc5080c2b0c6ab016b11784895 | d263f00c259878b80d833b8deb2056c9d0c8a01a | refs/heads/master | 2023-07-15T18:01:49.045156 | 2021-08-27T14:38:07 | 2021-08-27T14:38:07 | 389,338,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,104 | java | package com.stacksimplify.restservices;
import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;
// Controller
@RestController
public class HelloWorldController {
@Autowired
private ResourceBundleMessageSource messageSource;
//Simple Method
// Testing
// URI -/helloworld
//GET
//@RequestMapping(method = RequestMethod.GET, path = "/helloworld")
@GetMapping("/helloworld2")
public String helloWorld() {
return "Hello World2";
}
@GetMapping("/helloworld-bean")
public UserDetails helloWorldBean() {
return new UserDetails("Kalyan","Reddy","Hyderabad");
}
@GetMapping("/hello-int")
public String getMessageInI18NFormat(@RequestHeader(name="Accept-Language",required=false) String locale) {
return messageSource.getMessage("label.hello",null,new Locale(locale));
}
}
| [
"michael.selvan2005@gmail.com"
] | michael.selvan2005@gmail.com |
bb639d194f111f3dc88f6290b458b5f5e6c54f54 | a4c98f253ef7f3246f4c2ec37a8784fa1a311142 | /homework/src/com/hefshine/constructer/Reactangle.java | 53d4e2ba1b2e51869205bdf54f54acb9fc947432 | [] | no_license | sank987/hardwork | 1118f79c6fc3e67b665714a89a29abf53594a779 | ad818ef8c13f02d83bbe03d4c3624c5cce4b7ffd | refs/heads/master | 2022-12-11T20:33:46.519213 | 2020-08-25T07:56:56 | 2020-08-25T07:56:56 | 290,151,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,193 | java | package com.hefshine.constructer;
public class Reactangle {
int length,breadth,result ;
void area(int l,int b)
{
this.length=l;
this.breadth=b;
System.out.println("length is "+length+" breadth is "+breadth);
}
void display()
{
result=length*breadth;
System.out.println("Area is "+result);
}
Reactangle()
{
System.out.println("defult constructer");
System.out.println("length is "+length+" breadth is "+breadth);
}
Reactangle(int le,int br)
{
System.out.println("1st paramater constructer values and area is ");
this.length=le;
this.breadth=br;
System.out.println(" length is "+length+"breadth is "+breadth);
result =length*breadth;
System.out.println("Area is "+result);
}
Reactangle(int lb)
{
System.out.println("2nd paramater constructer values and area is ");
this.length=this.breadth=lb;
System.out.println(" length is "+length+"breadth is "+breadth);
result =length*breadth;
System.out.println("Area is "+result);
}
public static void main(String[] args) {
Reactangle r1=new Reactangle();
Reactangle r3=new Reactangle(10,5);
Reactangle r4=new Reactangle(5);
r1.area(10, 5);
r1.display();
}
}
| [
"sanknavalikar10@gmail.com"
] | sanknavalikar10@gmail.com |
dfd304792d6436194df17f8771542f03e0f3d182 | c9ad4f89b1eeea31799acaad98c66bdbe313213d | /yyds-mq/yyds-mqtt-starter/src/main/java/tech/mystox/framework/mqtt/service/impl/MqttRestService.java | a5241122e5c6244c0f607bd45218ca0f4cc8bb8d | [] | no_license | xjbxjb2010/mystox-starter | 58f61d475319bed22e73a9aa1ad8b4dc37afaf55 | ceb5e67526c1c5825ba6383ff867f5b0afe02eba | refs/heads/master | 2022-12-26T18:57:15.747450 | 2020-10-15T07:18:29 | 2020-10-15T07:19:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,498 | java | package tech.mystox.framework.mqtt.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import tech.mystox.framework.common.util.MqttUtils;
import tech.mystox.framework.config.IaConf;
import tech.mystox.framework.config.OperaRouteConfig;
import tech.mystox.framework.core.IaContext;
import tech.mystox.framework.core.ServiceScanner;
import tech.mystox.framework.entity.AckEnum;
import tech.mystox.framework.entity.JsonResult;
import tech.mystox.framework.entity.RegisterSub;
import tech.mystox.framework.scheduler.RegScheduler;
import tech.mystox.framework.service.MsgHandler;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static tech.mystox.framework.common.util.MqttUtils.*;
import static tech.mystox.framework.entity.UnitHead.*;
/**
* Created by mystoxlol on 2019/9/11, 17:32.
* company: mystox
* description:
* update record:
*/
@Service
public class MqttRestService {
Logger logger = LoggerFactory.getLogger(MqttRestService.class);
@Autowired
IaContext iaContext;
@Value("${server.name}")
private String serverName;
@Value("${server.version}")
private String serverVersion;
@Value("${server.mark:*}")
private String serverMark;
@Value("${server.groupCode}")
private String groupCode;
@Value("${server.name}_${server.version}")
private String serverCode;
//
// @Autowired
// RegisterRunner registerRunner;
//
// @Autowired
// ServiceRegistry serviceRegistry;
@Autowired
ServiceScanner jarServiceScanner;
private OperaRouteConfig operaRouteConfig;
@Autowired
public void setOperaRouteConfig(OperaRouteConfig operaRouteConfig) {
this.operaRouteConfig = operaRouteConfig;
}
public JsonResult registerSub(JSONObject subJson) {
MsgHandler iahander= iaContext.getIaENV().getMsgScheduler().getIaHandler();
RegScheduler regScheduler=iaContext.getIaENV().getRegScheduler();
String operaCode = subJson.getString("operaCode");
String executeUnit = subJson.getString("executeUnit");
String ack = subJson.getString("ack");
String head = "";
if (executeUnit.startsWith(JAR)) head = JAR;
if (executeUnit.startsWith(LOCAL)) head = LOCAL;
if (executeUnit.startsWith(HTTP)) head = HTTP;
RegisterSub sub = new RegisterSub();
sub.setExecuteUnit(executeUnit);
sub.setOperaCode(operaCode);
sub.setAck(AckEnum.ACK.toString().equals(ack) ? AckEnum.ACK : AckEnum.NA);
try {
String topic = MqttUtils.preconditionSubTopicId(serverCode, operaCode);
boolean b = false;
if (executeUnit.startsWith(JAR)) {
b = jarServiceScanner.addSub(sub);
} else if (executeUnit.startsWith(LOCAL)) {
return new JsonResult("暂未实现" + head, false);
} else if (executeUnit.startsWith(HTTP)) {
return new JsonResult("暂未实现" + head, false);
}
regScheduler.setDataToRegistry(sub);
//暂时性的内部map
if (iahander.isExists(topic)) {
logger.info("add sub topic[{}] to mqtt broker...", topic);
iahander.addSubTopic(topic, 2);
}
return new JsonResult("add sub " + (b ? "success" : "false"), b);
} catch (Exception e) {
e.printStackTrace();
}
return new JsonResult();
}
public JsonResult deleteSub(JSONObject body) {
MsgHandler iahander= iaContext.getIaENV().getMsgScheduler().getIaHandler();
RegScheduler regScheduler=iaContext.getIaENV().getRegScheduler();
String operaCode = body.getString("operaCode");
String path = MqttUtils.preconditionSubTopicId(serverCode, operaCode);
try {
String data = regScheduler.getData(path);
RegisterSub sub = JSONObject.parseObject(data, RegisterSub.class);
String executeUnit = sub.getExecuteUnit();
if (executeUnit.startsWith(JAR)) {
//删除注册信息
if (regScheduler.exists(path)) {
logger.info("delete register");
regScheduler.deleteNode(path);
}
//删除订阅信息
if (iahander.isExists(path)) {
logger.info("delete mqtt sub");
iahander.removeSubTopic(path);
}
//删除jarRes.yml中的对应key:value
boolean b = jarServiceScanner.deleteSub(operaCode);
if (b) {
logger.info("delete jar res key");
} else {
return new JsonResult("更新jar文件失败", false);
}
}
} catch (Exception e) {
e.printStackTrace();
}
// String unitHead = body.getString("unitHead");
return new JsonResult();
}
public void updateOperaRoute(String operaCode, List<String> subGroupServerList) throws InterruptedException, IOException {
RegScheduler regScheduler=iaContext.getIaENV().getRegScheduler();
Map<String, List<String>> operaRoute = operaRouteConfig.getOperaRoute();
if (operaRoute == null) {
operaRoute = new LinkedHashMap<>();
operaRouteConfig.setOperaRoute(operaRoute);
}
List<String> oldServerArr = operaRoute.get(operaCode);
operaRoute.put(operaCode, subGroupServerList);
//写入文件
DumperOptions dumperOptions = new DumperOptions();
dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
dumperOptions.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN);
dumperOptions.setPrettyFlow(false);
Yaml yaml = new Yaml(dumperOptions);
File file = FileUtils.getFile("./config/operaRoute.yml");
try {
if (!file.exists()) {
File directory = new File("./config");
if (!directory.exists()) {
boolean mkdirs = directory.mkdirs();
}
boolean newFile = file.createNewFile();
}
// yaml.dump(JSONObject.toJSON(operaRouteConfig), new FileWriter(file));
String groupCodeServerCode = preconditionGroupServerCode(groupCode, preconditionServerCode(serverName, serverVersion));
String routePath = preconditionRoutePath(groupCodeServerCode, operaCode);
if (!regScheduler.exists(routePath))
regScheduler.create(routePath, JSONArray.toJSONBytes(subGroupServerList), IaConf.EPHEMERAL);
else
regScheduler.setData(routePath, JSONArray.toJSONBytes(subGroupServerList));
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
operaRoute.put(operaCode, oldServerArr);
yaml.dump(JSONObject.toJSON(operaRouteConfig), new FileWriter(file));
}
}
}
| [
"mystox@163.com"
] | mystox@163.com |
69652353c976170b7cf5aa3d0f3b9f9003f564be | 1340008b0c11f30d14f4ed2fbfb42849b5c5ccd5 | /test_java/java/syntax/hashCode_equals/Test.java | d7297cfbe7dcc2f5acd9136d09c39a4b496c95d5 | [] | no_license | hopana/Test | b7652532968d208bafed3d07ca4490f8961ce7f4 | 117dd8f9319bc16a24acc3e9c72be75f33b9a09f | refs/heads/master | 2023-05-03T13:37:00.370904 | 2022-06-15T02:45:45 | 2022-06-15T02:45:45 | 127,226,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 639 | java | package syntax.hashCode_equals;
public class Test {
public static void main(String[] args) {
People p1 = new People("王五", "18603043735", "深圳", 25);
People p2 = new People("王五", "13804732343", "北京", 40);
System.out.println(p1 == p2);
System.out.println("---------------------------");
System.out.println(p1.equals(p2));
System.out.println(p1.hashCode() == p2.hashCode());
System.out.println("=========================================");
Dog dog1 = new Dog("ahuang", 3);
Dog dog2 = dog1;
System.out.println(dog1.equals(dog2));
}
}
| [
"hopana@163.com"
] | hopana@163.com |
87a6e363d099e7e9af3e155148c6e779f5797b6d | 905cb42136741918cd6eb2451d5ea582f02c2d2a | /src/test/java/com/odysseusinc/arachne/portal/model/statemachine/StudyStateMachineTest.java | 822ac1ad9b2fbb44ba1ce7589097386ea2184022 | [] | no_license | MikMironov/ArachneCentralAPI | e34700de134050a29a2cdbb5fbd48de826472930 | e5ab12d89a89f9e370e17cb6ecada46c231745cf | refs/heads/master | 2021-04-26T01:11:18.558415 | 2017-10-17T16:34:32 | 2017-10-17T16:34:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,077 | java | /**
*
* Copyright 2017 Observational Health Data Sciences and Informatics
* 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.
*
* Company: Odysseus Data Services, Inc.
* Product Owner/Architecture: Gregory Klebanov
* Authors: Pavel Grafkin, Alexandr Ryabokon, Vitaly Koulakov, Anton Gackovka, Maria Pozhidaeva, Mikhail Mironov
* Created: August 03, 2017
*
*/
package com.odysseusinc.arachne.portal.model.statemachine;
import com.odysseusinc.arachne.portal.model.Analysis;
import com.odysseusinc.arachne.portal.model.Study;
import com.odysseusinc.arachne.portal.model.StudyStatus;
import com.odysseusinc.arachne.portal.model.statemachine.study.StudyState;
import com.odysseusinc.arachne.portal.model.statemachine.study.StudyStateMachine;
import com.odysseusinc.arachne.portal.model.statemachine.study.StudyTransition;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import static org.junit.Assert.*;
public class StudyStateMachineTest {
private static final String INITIATE = StudyState.INITIATE.getStateName();
private static final String ACTIVE = StudyState.ACTIVE.getStateName();
private static final String COMPLETED = StudyState.COMPLETED.getStateName();
private static final String ARCHIVED = StudyState.ARCHIVED.getStateName();
private StudyStateMachine stateMachine = new StudyStateMachine(new StudyRepo(), new StudyStatusRepo());
private static List<String> statuses = Arrays.asList(INITIATE, ACTIVE, COMPLETED, ARCHIVED);
{
stateMachine.reconfigure();
stateMachine.verifyStates(statuses);
}
@Test
public void testMoveToState() {
Study study = createStudy(INITIATE);
study = stateMachine.moveToState(study, ACTIVE);
assertEquals(ACTIVE, study.getStatus().getName());
}
@Test(expected = IllegalStateMoveException.class)
public void testMoveToIllegalState() {
Study study = createStudy(INITIATE);
stateMachine.moveToState(study, ARCHIVED);
}
@Test
public void testAvailableStates() {
Study study = createStudy(INITIATE);
List<StudyTransition> transitionsFrom = stateMachine.getTransitionsFrom(study.getStatus());
assertEquals(1, transitionsFrom.size());
assertEquals(transitionsFrom.get(0).getFrom().getName(), INITIATE);
assertEquals(transitionsFrom.get(0).getTo().getName(), ACTIVE);
}
@Test
public void testAnalysisListDiscriminatorDoingNothing() {
Study activeStudy = createStudy(ACTIVE);
List<StudyTransition> availableStates = stateMachine.getAvailableStates(activeStudy);
assertEquals(2, availableStates.size());
assertFalse(availableStates.get(0).isInfo());
assertFalse(availableStates.get(1).isInfo());
}
@Test
public void testAnalysisListDiscriminatorChangingInfo() {
Study activeStudy = createStudy(ACTIVE);
activeStudy.getAnalyses().add(new Analysis());
//now study has one analysis and transitions from Active to Initiate should have Info status
List<StudyTransition> availableStates = stateMachine.getAvailableStates(activeStudy);
assertEquals(2, availableStates.size());
assertTrue(availableStates.get(0).isInfo());
assertFalse(availableStates.get(1).isInfo());
}
private Study createStudy(String statusName) {
StudyStatus status = stateMachine.getStateByName(statusName);
Study study = new Study();
study.setStatus(status);
return study;
}
private class StudyRepo implements ObjectRepository<Study> {
@Override
public <S extends Study> S save(S var1) {
return var1;
}
}
private class StudyStatusRepo implements StateRepository<StudyStatus> {
private List<StudyStatus> repoStatuses = new ArrayList<>(4);
{
statuses.forEach((statusString) -> {
StudyStatus status = new StudyStatus();
status.setId((long) statuses.indexOf(statusString));
status.setName(statusString);
repoStatuses.add(status);
});
}
@Override
public List<StudyStatus> findAll() {
return this.repoStatuses;
}
@Override
public StudyStatus findByName(String stateName) {
return this.repoStatuses.stream().filter(status -> Objects.equals(stateName, status.getName())).findFirst().orElseGet(null);
}
}
} | [
"pavgra@gmail.com"
] | pavgra@gmail.com |
9a158f139861b4143f8777fd2b3a61a6a64498b3 | 61d6775bb3e36ce90df5bc89003b1708d092d2cf | /src/com/designpatterns/base/MountainBike.java | 15f795bd193cbf96f1c36942870f770d8d3c7547 | [] | no_license | genetakinaw1/JavaDesignPatterns | 5bb2f457e1c5e908081f97ea6227b82ccf430ff8 | fdedcd6964eae73de9c9d8915779d2e6c1e19f7b | refs/heads/master | 2020-06-17T19:31:28.684153 | 2019-07-15T16:40:23 | 2019-07-15T16:40:23 | 196,026,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.designpatterns.base;
import com.designpatterns.java.BikeColor;
public abstract class MountainBike extends AbstractBike{
protected MountainBike(WheelInterface wheel, BikeColor Color){
super(wheel,Color);
}
protected MountainBike(WheelInterface wheel){
this(wheel,BikeColor.CHROME);
}
@Override
public float getPrice() {
return 780.00f;
}
}
| [
"genet.akinaw1@gmail.com"
] | genet.akinaw1@gmail.com |
e5eefda05a349e5e822ba6d7501a20ea5f826d57 | a904125fd0c8506e81ef83645ce79084e19e074d | /src/main/java/com/liukai/design/factory/general/RouterMessageFactory.java | 81ef6908f9c57e041dd5d6fa129fc4ded099696f | [] | no_license | forfreeday/design | 91d7f5e1b70ee3ee82702de61a855656850dfcf3 | f15449c6b4db5140bbb9d4d1ed88255cde60aa0a | refs/heads/master | 2023-08-09T20:36:24.954102 | 2023-07-20T07:41:48 | 2023-07-20T07:41:48 | 137,972,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package com.liukai.design.factory.general;
/**
* Created by kayle on 16/8/27.
*/
public class RouterMessageFactory implements MessageFactory {
public void sendMessage() {
System.out.printf("发送数据");
}
public String getMessage() {
return null;
}
}
| [
"liukai@reapal.com"
] | liukai@reapal.com |
c48db44b48fec927e30dd4fcec4d31fb34b36103 | bedaff8d5b5ba585e5f8be84bfe035fe6caa4fdd | /build/app/generated/not_namespaced_r_class_sources/debug/r/com/github/opybbt/flutter_statusbar_text_color/R.java | a2a9fe15c503d9879945a7aa9affc3494b86fc2d | [] | no_license | mher-flutter/weather_app | 04e4b09d2bd476852c03c590142406e22b3252ea | a07cb16cea7bcf72f84da30d012b3ee3c89e4f9d | refs/heads/master | 2022-11-24T22:54:42.696017 | 2020-08-05T13:48:39 | 2020-08-05T13:48:39 | 283,496,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,506 | 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 com.github.opybbt.flutter_statusbar_text_color;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int font = 0x7f020076;
public static final int fontProviderAuthority = 0x7f020078;
public static final int fontProviderCerts = 0x7f020079;
public static final int fontProviderFetchStrategy = 0x7f02007a;
public static final int fontProviderFetchTimeout = 0x7f02007b;
public static final int fontProviderPackage = 0x7f02007c;
public static final int fontProviderQuery = 0x7f02007d;
public static final int fontStyle = 0x7f02007e;
public static final int fontVariationSettings = 0x7f02007f;
public static final int fontWeight = 0x7f020080;
public static final int ttcIndex = 0x7f020109;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f040047;
public static final int notification_icon_bg_color = 0x7f040048;
public static final int ripple_material_light = 0x7f040052;
public static final int secondary_text_default_material_light = 0x7f040054;
}
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 = 0x7f06006a;
public static final int notification_bg = 0x7f06006b;
public static final int notification_bg_low = 0x7f06006c;
public static final int notification_bg_low_normal = 0x7f06006d;
public static final int notification_bg_low_pressed = 0x7f06006e;
public static final int notification_bg_normal = 0x7f06006f;
public static final int notification_bg_normal_pressed = 0x7f060070;
public static final int notification_icon_background = 0x7f060071;
public static final int notification_template_icon_bg = 0x7f060072;
public static final int notification_template_icon_low_bg = 0x7f060073;
public static final int notification_tile_bg = 0x7f060074;
public static final int notify_panel_notification_icon_bg = 0x7f060075;
}
public static final class id {
private id() {}
public static final int accessibility_action_clickable_span = 0x7f070006;
public static final int accessibility_custom_action_0 = 0x7f070007;
public static final int accessibility_custom_action_1 = 0x7f070008;
public static final int accessibility_custom_action_10 = 0x7f070009;
public static final int accessibility_custom_action_11 = 0x7f07000a;
public static final int accessibility_custom_action_12 = 0x7f07000b;
public static final int accessibility_custom_action_13 = 0x7f07000c;
public static final int accessibility_custom_action_14 = 0x7f07000d;
public static final int accessibility_custom_action_15 = 0x7f07000e;
public static final int accessibility_custom_action_16 = 0x7f07000f;
public static final int accessibility_custom_action_17 = 0x7f070010;
public static final int accessibility_custom_action_18 = 0x7f070011;
public static final int accessibility_custom_action_19 = 0x7f070012;
public static final int accessibility_custom_action_2 = 0x7f070013;
public static final int accessibility_custom_action_20 = 0x7f070014;
public static final int accessibility_custom_action_21 = 0x7f070015;
public static final int accessibility_custom_action_22 = 0x7f070016;
public static final int accessibility_custom_action_23 = 0x7f070017;
public static final int accessibility_custom_action_24 = 0x7f070018;
public static final int accessibility_custom_action_25 = 0x7f070019;
public static final int accessibility_custom_action_26 = 0x7f07001a;
public static final int accessibility_custom_action_27 = 0x7f07001b;
public static final int accessibility_custom_action_28 = 0x7f07001c;
public static final int accessibility_custom_action_29 = 0x7f07001d;
public static final int accessibility_custom_action_3 = 0x7f07001e;
public static final int accessibility_custom_action_30 = 0x7f07001f;
public static final int accessibility_custom_action_31 = 0x7f070020;
public static final int accessibility_custom_action_4 = 0x7f070021;
public static final int accessibility_custom_action_5 = 0x7f070022;
public static final int accessibility_custom_action_6 = 0x7f070023;
public static final int accessibility_custom_action_7 = 0x7f070024;
public static final int accessibility_custom_action_8 = 0x7f070025;
public static final int accessibility_custom_action_9 = 0x7f070026;
public static final int action_container = 0x7f07002e;
public static final int action_divider = 0x7f070030;
public static final int action_image = 0x7f070031;
public static final int action_text = 0x7f070037;
public static final int actions = 0x7f070038;
public static final int async = 0x7f070040;
public static final int blocking = 0x7f070043;
public static final int chronometer = 0x7f07004a;
public static final int dialog_button = 0x7f070055;
public static final int forever = 0x7f07005e;
public static final int icon = 0x7f070062;
public static final int icon_group = 0x7f070063;
public static final int info = 0x7f070067;
public static final int italic = 0x7f070068;
public static final int line1 = 0x7f07006b;
public static final int line3 = 0x7f07006c;
public static final int normal = 0x7f070074;
public static final int notification_background = 0x7f070075;
public static final int notification_main_column = 0x7f070076;
public static final int notification_main_column_container = 0x7f070077;
public static final int right_icon = 0x7f07007d;
public static final int right_side = 0x7f07007e;
public static final int tag_accessibility_actions = 0x7f07009c;
public static final int tag_accessibility_clickable_spans = 0x7f07009d;
public static final int tag_accessibility_heading = 0x7f07009e;
public static final int tag_accessibility_pane_title = 0x7f07009f;
public static final int tag_screen_reader_focusable = 0x7f0700a0;
public static final int tag_transition_group = 0x7f0700a1;
public static final int tag_unhandled_key_event_manager = 0x7f0700a2;
public static final int tag_unhandled_key_listeners = 0x7f0700a3;
public static final int text = 0x7f0700a4;
public static final int text2 = 0x7f0700a5;
public static final int time = 0x7f0700a8;
public static final int title = 0x7f0700a9;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080005;
}
public static final class layout {
private layout() {}
public static final int custom_dialog = 0x7f09001c;
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 = 0x7f0b003a;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ee;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ef;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00f0;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f1;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0159;
public static final int Widget_Compat_NotificationActionText = 0x7f0c015a;
}
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 = { 0x7f020078, 0x7f020079, 0x7f02007a, 0x7f02007b, 0x7f02007c, 0x7f02007d };
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, 0x7f020076, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020109 };
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;
}
}
| [
"mher.davtyan@Mhers-MacBook-Pro.local"
] | mher.davtyan@Mhers-MacBook-Pro.local |
b618544fdc91c92cc155da5aa8fdb96bf594d637 | 7f055c80bf2e0d4ff41cf438450fe95e1642703f | /src/main/java/com/javadroider/interviewprep/lru/LRUCache.java | 5de05311e10417a621232c25d6ff0d698e945288 | [] | no_license | javadroider/interview-prep | 065d6cb7e95aebeccc5f89cb3a55fd52f1b14682 | 7cb9463a67b7a5f5cd99e736ea9e0e0319c8696c | refs/heads/master | 2023-03-02T12:46:21.705613 | 2023-02-06T15:09:20 | 2023-02-06T15:09:20 | 223,913,907 | 11 | 5 | null | 2020-10-27T09:30:00 | 2019-11-25T09:47:41 | Java | UTF-8 | Java | false | false | 1,797 | java | package com.javadroider.interviewprep.lru;
import java.util.HashMap;
import java.util.Map;
public class LRUCache {
private int size;
private Node HEAD;
private Node REAR;
private Map<Integer, Node> map = new HashMap<>();
LRUCache(int size) {
this.size = size;
this.HEAD = new Node();
this.REAR = new Node();
this.HEAD.right = this.REAR;
this.REAR.left = this.HEAD;
}
void refer(int val) {
if (map.containsKey(val)) {
Node node = map.get(val);
//H<->1<->2<->3<->R
//H<->2<->1<->3<->R
// H<->2<->3
//H<->
Node leftNode = node.left;//1
Node rightNode = node.right;//3
leftNode.right = rightNode;
rightNode.left = leftNode;
Node temp = this.HEAD.right;
node.left = this.HEAD;
this.HEAD.right = node;
node.right = temp;
} else {
//H > 1 > R
Node node = new Node();
node.val = val;
Node temp = this.HEAD.right;
node.left = this.HEAD;
this.HEAD.right = node;
node.right = temp;
map.put(val, node);
}
}
void display() {
Node temp = this.HEAD;
temp = temp.right;
while (temp != null && temp != this.REAR) {
System.out.print(temp.val + " ");
temp = temp.right;
}
}
public static void main(String[] args) {
LRUCache lruCache = new LRUCache(5);
lruCache.refer(3);
lruCache.refer(2);
lruCache.refer(1);
lruCache.refer(2);
lruCache.display();
}
private class Node {
Node left;
Node right;
int val;
}
}
| [
"javadroider@gmail.com"
] | javadroider@gmail.com |
b57507eb4d30acaa23915acae489333f58ee2d68 | 3069f97a4bf8d374ab21db27d3ca212fbe8742f2 | /base.app.backoffice.console/src/main/java/eapli/base/app/backoffice/console/presentation/catalogos/RegistarCatalogoAction.java | 9e100bdaad27eceb65fb027171bdefe2b06c36d6 | [
"MIT"
] | permissive | guilhermeDaniel10/LAPR4_ISEP | dbd4d74dce74b4abc028264404a234b0c7fcb801 | 065d4e384f480b44db04d82e9301bce3109defa7 | refs/heads/master | 2023-08-16T22:30:02.149536 | 2021-10-06T22:38:25 | 2021-10-06T22:38:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package eapli.base.app.backoffice.console.presentation.catalogos;
import eapli.framework.actions.Action;
/**
*
* @author lucas
*/
public class RegistarCatalogoAction implements Action{
@Override
public boolean execute() {
return new RegistarCatalogoUI().show();
}
}
| [
"guilhermedaniel70@gmail.com"
] | guilhermedaniel70@gmail.com |
112ac0315684e8943ebc342fc08efe6c0b2b5350 | b3ef3d34ddd1ce4566d7b5c2f7f6416eae6f063e | /wufan-security-core/src/main/java/com/wufan/security/authentication/session/CustomSessionInformationExpiredStrategy.java | 296567ae5e98c2c46905f03c6c3ad4bfd1be618e | [] | no_license | VanGogh6/wufan-security-parent | 1693e9d15c38a1573610c7119f00c057d11efe99 | e8c5e9ddd3f73031a424b3a59657f4afe4899c5c | refs/heads/master | 2022-12-04T03:17:31.815236 | 2020-08-24T09:12:34 | 2020-08-24T09:12:34 | 289,878,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,847 | java | package com.wufan.security.authentication.session;
import com.wufan.security.authentication.CustomAuthenticationFailureHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.session.SessionInformationExpiredEvent;
import org.springframework.security.web.session.SessionInformationExpiredStrategy;
import javax.servlet.ServletException;
import java.io.IOException;
/**
* 当同一用户的session达到指定数量 时,会执行该 类
* @author wufan
* @date 2020/4/11 0011 2:37
*/
public class CustomSessionInformationExpiredStrategy implements SessionInformationExpiredStrategy {
@Autowired
CustomAuthenticationFailureHandler customAuthenticationFailureHandler;
@Override
public void onExpiredSessionDetected(SessionInformationExpiredEvent event) throws IOException {
// 1. 获取用户名
UserDetails userDetails =
(UserDetails)event.getSessionInformation().getPrincipal();
AuthenticationException exception =
new AuthenticationServiceException(
String.format("[%s] 用户在另外一台电脑登录,您已被下线", userDetails.getUsername()));
try {
// 当用户在另外一台电脑登录后,交给失败处理器回到认证页面
event.getRequest().setAttribute("toAuthentication" , true);
customAuthenticationFailureHandler
.onAuthenticationFailure(event.getRequest(), event.getResponse(), exception);
} catch (ServletException e) {
e.printStackTrace();
}
}
}
| [
"520200wf@163.com"
] | 520200wf@163.com |
d3c93a6da5023c4903d68c99b2af0b3f3a569ef7 | 4b559c8d90ea4aab6549ede68951925b30f1b63b | /src/java/session/BookFacade.java | 5ca761fac63498328a1f553be67da468ed9e3e5e | [] | no_license | hailongluu/BOEC_v3_javabean | 82456e4569a22fe31d930c633e24fc715705c8cf | 6db90b12224bb6e186869df3ef3a16f6b0d41fbd | refs/heads/master | 2020-05-23T03:29:19.615952 | 2019-05-15T05:35:24 | 2019-05-15T05:35:24 | 186,617,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package session;
import entities.product.book.Book;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author hailongluu
*/
@Stateless
public class BookFacade extends AbstractFacade<Book> implements BookFacadeLocal {
@PersistenceContext(unitName = "boecdemov3PU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public BookFacade() {
super(Book.class);
}
}
| [
"hailongluu@gmail.com"
] | hailongluu@gmail.com |
09cc0416cc516b4ca092121d7dd53e3737cbbbf2 | d7a6d892aaf35875abbe20627013de61acb0a911 | /src/main/java/com/banking/acme/model/OBActiveOrHistoricCurrencyAndAmount4.java | 87c6f57992dd26d9f86643244c7bb85ecfb40ecb | [] | no_license | geraldvaras/betterbanking | e84a8b8d95e0ce7fda8351c381bf40bfa18cbb41 | 74376ecc6fa1337e15e205ec76cd58fa3ce6464a | refs/heads/master | 2023-01-23T15:13:31.819178 | 2020-11-28T12:53:07 | 2020-11-28T12:53:07 | 315,167,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,710 | java | package com.banking.acme.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.*;
/**
* The amount of the final Standing Order
*/
@Schema(description = "The amount of the final Standing Order")
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-11-24T20:22:39.797Z[GMT]")
public class OBActiveOrHistoricCurrencyAndAmount4 {
@JsonProperty("Amount")
private String amount = null;
@JsonProperty("Currency")
private String currency = null;
public OBActiveOrHistoricCurrencyAndAmount4 amount(String amount) {
this.amount = amount;
return this;
}
/**
* Get amount
* @return amount
**/
@Schema(required = true, description = "")
@NotNull
@Pattern(regexp="^\\d{1,13}$|^\\d{1,13}\\.\\d{1,5}$") public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public OBActiveOrHistoricCurrencyAndAmount4 currency(String currency) {
this.currency = currency;
return this;
}
/**
* Get currency
* @return currency
**/
@Schema(required = true, description = "")
@NotNull
@Pattern(regexp="^[A-Z]{3,3}$") public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OBActiveOrHistoricCurrencyAndAmount4 obActiveOrHistoricCurrencyAndAmount4 = (OBActiveOrHistoricCurrencyAndAmount4) o;
return Objects.equals(this.amount, obActiveOrHistoricCurrencyAndAmount4.amount) &&
Objects.equals(this.currency, obActiveOrHistoricCurrencyAndAmount4.currency);
}
@Override
public int hashCode() {
return Objects.hash(amount, currency);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OBActiveOrHistoricCurrencyAndAmount4 {\n");
sb.append(" amount: ").append(toIndentedString(amount)).append("\n");
sb.append(" currency: ").append(toIndentedString(currency)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"gerald.varas@gmail.com"
] | gerald.varas@gmail.com |
2d14fba154efebcb60dd655f77379d8c7e344624 | a31be834d3fe193194c6b773ab53a14e00a8655d | /src/com/dolphin/testcase/backtotop/NotFullscreenPortraitLongPageTest.java | 6eab2fbbe2364174b9d9d4f420f7d6b51ead0ff3 | [] | no_license | hust1994/mytest | f666723b7ed833c12c0ee0a5af0e57a24c06fc53 | 4ae767fee8b69dfe2954f54f51142af3ee4d63b0 | refs/heads/master | 2016-09-05T16:48:19.337977 | 2014-09-19T02:52:29 | 2014-09-19T02:52:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,448 | java | package com.dolphin.testcase.backtotop;
import android.graphics.Point;
import android.util.Log;
import android.view.View;
import com.adolphin.common.BaseTest;
import com.adolphin.common.Resource;
public class NotFullscreenPortraitLongPageTest extends BaseTest{
public void testNotFullscreenPortraitLongPage(){
solo.sleep(Resource.TIME_BIG);
Point screen = new Point();
getActivity().getWindowManager().getDefaultDisplay().getSize(screen);
int screenHeight = screen.y;
float high = screenHeight / 6;
float low = screenHeight * 5 / 6;
//tabbar和addressbar在第一次通过滑动显示之前id是content_view[0][0][0][0],出现过之后id变成center_screen[3]
BackToTop.addnewwindows(1,this);
solo.sleep(Resource.TIME_SMALL);
//地址栏中输入关键字sun点击搜索按钮进入搜索结果页面
solo.clickOnView("title_design");
solo.sleep(Resource.TIME_SMALL);
solo.clearEditText(0);
solo.sleep(Resource.TIME_SMALL);
//选择搜索引擎
solo.clickOnView("search_engine");
solo.sleep(Resource.TIME_SMALL);
solo.clickOnView(solo.getView("engine_item_img", 3));
solo.sleep(Resource.TIME_SMALL);
solo.enterText(0, "sun");
solo.sleep(Resource.TIME_SMALL);
solo.clickOnView("go");
solo.sleep(Resource.TIME_LONG);
//获取刷新按钮的正确位置
solo.drag(10, 10, high, low, 100);
solo.sleep(Resource.TIME_SMALL);
View RefreshBtn = solo.getViewByPath("refresh_stop_btn[0]");
int[] RefreshBtnloc = new int[2];
RefreshBtn.getLocationOnScreen(RefreshBtnloc);
solo.sleep(Resource.TIME_SMALL);
int tabbarheight = solo.getViewByPath("content_view[0][0][0][0]").getHeight();
//向上滑动使tabbar隐藏(部分网页加载完成会自动隐藏tabbar)
solo.drag(10, 10, low / 2, high / 2, 100);
solo.sleep(Resource.TIME_SMALL);
assertTrue("菜单栏没有显示", View.VISIBLE == solo.getViewByPath("main_menubar_holder[0]").getVisibility());
//手指慢慢向上滑动→直到滑到网页底部
for(int i=0;i<8;i++){
solo.drag(10, 10, low, high, 100);
solo.sleep(Resource.TIME_SMALL);
assertTrue("菜单栏没有显示", View.VISIBLE == solo.getViewByPath("main_menubar_holder[0]").getVisibility());
}
//手指按照两行文字移动的速度慢慢向下滑动(速度小于1000px/s)
solo.drag(10, 10, high * 2, low, 200);
solo.sleep(Resource.TIME_SMALL);
String[] view = solo.getViewByPath("content_view[1]").toString().split("@");
Log.i("test",view[0]);
if(view[0].toString().equals("com.dolphin.browser.ui.v".toString())){
assertTrue("backtoptop按钮显示", View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
}
//手指变为快速地向下滑动,使网页在瞬间移动了半屏的位移(速度1000px/s)
solo.drag(10, 10, high, low, 15);
solo.sleep(Resource.TIME_SMALL);
assertTrue("tabbar&addressbar没有显示", View.VISIBLE == solo.getViewByPath("center_screen[3]").getVisibility());
assertTrue("backtotop按钮没有显示",View.VISIBLE == solo.getViewByPath("content_view[1]").getVisibility());
assertTrue("菜单栏没有显示", View.VISIBLE == solo.getViewByPath("main_menubar_holder[0]").getVisibility());
// 手指慢慢向上滑动屏幕→当出现的地址栏/Tab Bar整体高度小于一半被屏幕隐藏后松手(先获取tabbar的高度在进行滑动,兼容)
solo.drag(10, 10, screenHeight / 2, (screenHeight / 2)- (tabbarheight / 4), 100);
solo.sleep(Resource.TIME_SMALL);
assertTrue("tabbar&addressbar没有显示", View.VISIBLE == solo.getViewByPath("center_screen[3]").getVisibility());
assertTrue("菜单栏没有显示", View.VISIBLE == solo.getViewByPath("main_menubar_holder[0]").getVisibility());
// 手指再继续慢慢向上滑动屏幕→使地址栏/Tab Bar整体高度超过一半被屏幕隐藏后松手
solo.drag(10, 10, screenHeight / 2, (screenHeight / 2)- (tabbarheight / 3 * 2), 100);
solo.sleep(Resource.TIME_SMALL);
assertTrue("tabbar&addressbar没有隐藏", View.VISIBLE != solo.getViewByPath("center_screen[3]").getVisibility());
assertTrue("菜单栏没有显示", View.VISIBLE == solo.getViewByPath("main_menubar_holder[0]").getVisibility());
//继续向下滑动直至网页顶部
int[] location = new int[2];
do{
solo.drag(10,10,high,low,100);
solo.sleep(Resource.TIME_SMALL);
Log.i("test", "location" + location[1]);
solo.getViewByPath("content_view[0][0][0][0]").getLocationOnScreen(location);
}while(location[1] < 0);
assertTrue("backtotop按钮没有隐藏",View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
assertTrue("菜单栏没有显示", View.VISIBLE == solo.getViewByPath("main_menubar_holder[0]").getVisibility());
//手指向上滑动→当网页滑到超过2屏的时候停止
//手指开始快速地向下滑动,使网页在瞬间移动了半屏的位移(速度1000px/s)
solo.drag(10,10,low,high,50);
solo.sleep(Resource.TIME_SMALL);
solo.drag(10,10,low,high,50);
solo.sleep(Resource.TIME_SMALL);
solo.drag(10,10,low,high,50);
solo.sleep(Resource.TIME_SMALL);
BackToTop.ShowBackToTopBtn(this);
assertTrue("tabbar&addressbar没有显示", View.VISIBLE == solo.getViewByPath("center_screen[3]").getVisibility());
assertTrue("backtotop按钮没有显示",View.VISIBLE == solo.getViewByPath("content_view[1]").getVisibility());
assertTrue("菜单栏没有显示", View.VISIBLE == solo.getViewByPath("main_menubar_holder[0]").getVisibility());
View BackwardBtn = solo.getViewByPath("main_menubar_holder[0][0]");
View ForwardBtn = solo.getViewByPath("main_menubar_holder[0][1]");
View HomeBtn = solo.getViewByPath("main_menubar_holder[0][4]");
View TabListBtn = solo.getViewByPath("main_menubar_holder[0][5]");
//等待10S
solo.sleep(10000);
assertTrue("backtotop按钮没有显示",View.VISIBLE == solo.getViewByPath("content_view[1]").getVisibility());
//点击back to top 按钮
solo.clickOnView(solo.getViewByPath("content_view[1]"));
solo.sleep(Resource.TIME_SMALL);
assertTrue("backtotop按钮没有隐藏",View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
assertTrue("tabbar&addressbar没有显示", View.VISIBLE == solo.getViewByPath("center_screen[3]").getVisibility());
assertTrue("菜单栏没有显示", View.VISIBLE == solo.getViewByPath("main_menubar_holder[0]").getVisibility());
//手指向上滑动→当网页滑到超过2屏的时候停止
//手指开始快速地向下滑动,使网页在瞬间移动了半屏的位移(速度1000px/s)
solo.drag(10,10,low,high,50);
solo.sleep(Resource.TIME_SMALL);
solo.drag(10,10,low,high,50);
solo.sleep(Resource.TIME_SMALL);
solo.drag(10,10,low,high,50);
solo.sleep(Resource.TIME_SMALL);
BackToTop.ShowBackToTopBtn(this);
assertTrue("tabbar&addressbar没有显示", View.VISIBLE == solo.getViewByPath("center_screen[3]").getVisibility());
assertTrue("backtotop按钮没有显示",View.VISIBLE == solo.getViewByPath("content_view[1]").getVisibility());
assertTrue("菜单栏没有显示", View.VISIBLE == solo.getViewByPath("main_menubar_holder[0]").getVisibility());
//点击Menu中的后退按钮或者是硬件的后退按钮
solo.clickOnView(BackwardBtn);
solo.sleep(Resource.TIME_SMALL);
assertTrue("backtotop按钮没有隐藏",View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
//再次点击前进按钮
solo.clickOnView(ForwardBtn);
solo.sleep(Resource.TIME_SMALL);
assertTrue("backtotop按钮没有隐藏",View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
//再次使Back to top按钮呼出
BackToTop.ShowBackToTopBtn(this);
assertTrue("backtotop按钮没有显示",View.VISIBLE == solo.getViewByPath("content_view[1]").getVisibility());
//切换到另一个Tab
solo.clickOnView(TabListBtn);
solo.sleep(Resource.TIME_SMALL);
solo.clickOnView(solo.getViewByPath("vertical_item_container[1]"));
solo.sleep(Resource.TIME_SMALL);
assertTrue("backtotop按钮没有隐藏",View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
//然后再切换回来
solo.clickOnView(TabListBtn);
solo.sleep(Resource.TIME_SMALL);
solo.clickOnView(solo.getViewByPath("vertical_item_container[2]"));
solo.sleep(Resource.TIME_SMALL);
assertTrue("backtotop按钮没有隐藏",View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
//再次使Back to top按钮呼出
BackToTop.ShowBackToTopBtn(this);
assertTrue("backtotop按钮没有显示",View.VISIBLE == solo.getViewByPath("content_view[1]").getVisibility());
//点击Menu中的Home按钮
solo.clickOnView(HomeBtn);
solo.sleep(Resource.TIME_SMALL);
assertTrue("backtotop按钮没有隐藏",View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
//再次从Homepage返回
while(ForwardBtn.isEnabled()){
solo.clickOnView(ForwardBtn);
solo.sleep(Resource.TIME_SMALL);
}
assertTrue("backtotop按钮没有隐藏",View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
//再次快速滑动网页使Back to top显示
BackToTop.ShowBackToTopBtn(this);
assertTrue("backtotop按钮没有显示",View.VISIBLE == solo.getViewByPath("content_view[1]").getVisibility());
//刷新网页
solo.clickOnScreen(RefreshBtnloc[0], RefreshBtnloc[1]);
solo.sleep(Resource.TIME_LONG);
assertTrue("backtotop按钮没有 隐藏",View.VISIBLE != solo.getViewByPath("content_view[1]").getVisibility());
}
}
| [
"chhzhang@bainainfo.com"
] | chhzhang@bainainfo.com |
a07baa4ea54e97739d6ef03fc80ef1c5ef5f24f7 | 98c8a9dc3ee416c5175288da1325d9d2aaa25bd5 | /src/library/MinSegmentTreeDescent.java | 3bbc7f88b642436d1ef3e8ddbdaa74b2982f307f | [] | no_license | jprakhar77/codeforces | b2d7d1e056887dcc1a23a3c19a7a227ad33d4bee | 6664ae2b63e3c9ec678ef7d41fb13550b71b6e12 | refs/heads/master | 2020-03-12T13:26:23.095423 | 2019-02-18T23:22:59 | 2019-02-18T23:22:59 | 130,642,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,653 | java | package library;
public class MinSegmentTreeDescent {
int[] st;
int[] a;
int n;
public MinSegmentTreeDescent(int n, int[] a) {
this.a = a;
st = new int[4 * n];
this.n = n;
}
int build(int i, int r1, int r2) {
if (r1 == r2) {
st[i] = r1;
return st[i];
} else {
int fi = build(i * 2 + 1, r1, (r1 + r2) / 2);
int si = build(i * 2 + 2, (r1 + r2) / 2 + 1, r2);
st[i] = (a[fi] <= a[si]) ? fi : si;
return st[i];
}
}
//Call init before query for descent to work
void init() {
rae = -1;
rbe = -1;
min = -1;
ans = -1;
ind = -1;
}
int query(int i, int ra, int rb, int r1, int r2) {
if (ra > r2 || rb < r1) {
return -1;
}
if (ra >= r1 && rb <= r2) {
if (min == -1 || a[st[i]] < min) {
min = a[st[i]];
rae = ra;
rbe = rb;
ind = i;
}
return st[i];
}
int p1 = query(i * 2 + 1, ra, (ra + rb) / 2, r1, r2);
int p2 = query(i * 2 + 2, (ra + rb) / 2 + 1, rb, r1, r2);
if (p1 == -1) {
return p2;
} else if (p2 == -1) {
return p1;
} else {
return a[p1] <= a[p2] ? p1 : p2;
}
}
int ind = -1;
int rae = -1;
int rbe = -1;
int min = -1;
int ans = -1;
//Call query before descent for this to work with these params: ind, rae, rbe, min
//ans will store the index of minimum element after the method returns
void des(int i, int r1, int r2, int min) {
if (r1 == r2) {
ans = r1;
} else {
if (a[st[i * 2 + 1]] == min) {
des(i * 2 + 1, r1, (r1 + r2) / 2, min);
} else {
des(i * 2 + 2, (r1 + r2) / 2 + 1, r2, min);
}
}
}
int first(int i, int ra, int rb) {
if (ra == rb) {
if (st[i] > 0)
return ra;
else return -1;
}
if (st[i * 2 + 1] > 0) {
return first(i * 2 + 1, ra, (ra + rb) / 2);
} else {
return first(i * 2 + 2, (ra + rb) / 2 + 1, rb);
}
}
int last(int i, int ra, int rb) {
if (ra == rb) {
if (st[i] > 0)
return ra;
else return -1;
}
if (st[i * 2 + 2] > 0) {
return last(i * 2 + 2, (ra + rb) / 2 + 1, rb);
} else {
return last(i * 2 + 1, ra, (ra + rb) / 2);
}
}
} | [
"jprakhar77@gmail.com"
] | jprakhar77@gmail.com |
328a2151cdee2bcdf42ab690d4515874fe383a2f | 4bbc98f4e9fa92f350b4816fa331d470880e1df6 | /testdocbuild11/src/main/java/com/fastcode/testdocbuild11/domain/core/address/AddressEntity.java | b6c79204f3883b058ae8ae8781f63d54c7598925 | [] | no_license | sunilfastcode/testdocbuild11 | 07d7b8a96df7d07ef8e08325463e8eb85ac0da5c | d6a22d880015ed8cd7e10dae67f6b70e222a1849 | refs/heads/master | 2023-02-12T17:43:15.443849 | 2020-12-26T22:57:11 | 2020-12-26T22:57:11 | 319,411,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,502 | java | package com.fastcode.testdocbuild11.domain.core.address;
import com.fastcode.testdocbuild11.domain.core.abstractentity.AbstractEntity;
import com.fastcode.testdocbuild11.domain.core.city.CityEntity;
import java.time.*;
import javax.persistence.*;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "address")
@Getter
@Setter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@NoArgsConstructor
public class AddressEntity extends AbstractEntity {
@Basic
@Column(name = "address", nullable = false, length = 50)
private String address;
@Basic
@Column(name = "address2", nullable = true, length = 50)
private String address2;
@Basic
@Column(name = "address3", nullable = true, length = 50)
private String address3;
@Basic
@Column(name = "phone", nullable = false, length = 20)
private String phone;
@Basic
@Column(name = "district", nullable = false, length = 20)
private String district;
@Basic
@Column(name = "last_update", nullable = false)
private LocalDateTime lastUpdate;
@Basic
@Column(name = "postal_code", nullable = true, length = 10)
private String postalCode;
@Id
@EqualsAndHashCode.Include
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "address_id", nullable = false)
private Integer addressId;
@ManyToOne
@JoinColumn(name = "city_id")
private CityEntity city;
}
| [
"info@nfinityllc.com"
] | info@nfinityllc.com |
6918f6889f00d23bed99e3c8c5584653aaacac0b | f6dea088a329c1ddd5fc7bb81b612a9634ebda86 | /yaml.helper.dsl/src/yaml/helper/dsl/YamlGenDslStandaloneSetup.java | 51012a21bfdee2937e0b4be219603ee0aa5305da | [] | no_license | zuev-stepan/yaml-helper-dsl | e9d39f6c113265e4d4af6497a05106a9089ef9ab | 1f29897e660284ccc0b4fd2ddc08cf20b240dd70 | refs/heads/master | 2022-12-23T05:58:55.162691 | 2020-09-22T19:04:16 | 2020-09-22T19:04:16 | 293,913,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | /*
* generated by Xtext 2.22.0
*/
package yaml.helper.dsl;
/**
* Initialization support for running Xtext languages without Equinox extension registry.
*/
public class YamlGenDslStandaloneSetup extends YamlGenDslStandaloneSetupGenerated {
public static void doSetup() {
new YamlGenDslStandaloneSetup().createInjectorAndDoEMFRegistration();
}
}
| [
"zuev.step4n@gmail.com"
] | zuev.step4n@gmail.com |
0ffd242912ca175ced233a6a104a14645371f1fb | 6f99975089527ff4f4bcd8074e93b821f01e2001 | /LeetCode_Java/src/Linkedin/SubarraySum.java | c2f0a826440d1a0ed5a5d4f2ebd44e75768fd1a3 | [] | no_license | cutewindy/CodingInterview | 06e3092ea50d85d7abf4a096ab372a5ef8ff27e5 | 439b9bab5f1a29b7db143656fb9436ec73407acd | refs/heads/master | 2021-01-19T11:45:06.793705 | 2020-05-11T05:03:15 | 2020-05-11T05:03:15 | 42,979,618 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package Linkedin;
/**
*
* @author wendi
*
*/
public class SubarraySum {
/**
*
* @param nums
* @return
*/
public int subarraySum(int[] nums) {
if (nums == null || nums.length == 0) return 0;
int res= 0;
int n = nums.length;
for (int i = 0; i < nums.length; i++) {
res += (i + 1) * (n - i) * nums[i];
}
return res;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
SubarraySum result = new SubarraySum();
System.out.println(result.subarraySum(new int[] {1, 2, 3}));
}
}
| [
"wendi@Wendi-Air.attlocal.net"
] | wendi@Wendi-Air.attlocal.net |
f498dadd57aba0c633e354ff697bd759d3e8a7db | 8efd5fadeed1a35976e1091b2af3f4e903d5a4d8 | /DynamixelSDK-master/java/dynamixel_functions_java/mac_x64/Dynamixel.java | 96957291ab1e5fff2f447d3da035de8607ea12bb | [
"Apache-2.0"
] | permissive | Cheezeburger94/humanoidRobots | c1e34248ab055223930634322bc09a89b4714e3f | 7309c90b2ee0c63b61933767cd97881f7fa84187 | refs/heads/master | 2021-07-17T21:00:40.929199 | 2017-10-24T12:42:48 | 2017-10-24T12:42:48 | 105,011,711 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,068 | java | /*******************************************************************************
* Copyright (c) 2016, ROBOTIS CO., LTD.
* 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 ROBOTIS 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
/* Author: Ryu Woon Jung (Leon) */
import com.sun.jna.Library;
import com.sun.jna.Native;
interface LibFunction extends Library
{
// PortHandler functions
public int portHandler(String str);
public Boolean openPort (int port_num);
public void closePort (int port_num);
public void clearPort (int port_num);
public void setPortName (int port_num, String port_name);
public String getPortName (int port_num);
public Boolean setBaudRate (int port_num, int baudrate);
public int getBaudRate (int port_num);
public int readPort (int port_num, byte[] packet, int length);
public int writePort (int port_num, byte[] packet, int length);
public void setPacketTimeout (int port_num, short packet_length);
public void setPacketTimeoutMSec (int port_num, double msec);
public Boolean isPacketTimeout (int port_num);
// PacketHandler functions
public void packetHandler ();
public void printTxRxResult (int protocol_version, int result);
public String getTxRxResult (int protocol_version, int result);
public void printRxPacketError (int protocol_version, byte error);
public String getRxPacketError (int protocol_version, byte error);
public int getLastTxRxResult (int port_num, int protocol_version);
public byte getLastRxPacketError (int port_num, int protocol_version);
public void setDataWrite (int port_num, int protocol_version, short data_length, short data_pos, int data);
public int getDataRead (int port_num, int protocol_version, short data_length, short data_pos);
public void txPacket (int port_num, int protocol_version);
public void rxPacket (int port_num, int protocol_version);
public void txRxPacket (int port_num, int protocol_version);
public void ping (int port_num, int protocol_version, byte id);
public int pingGetModelNum (int port_num, int protocol_version, byte id);
// broadcastPing
public void broadcastPing (int port_num, int protocol_version);
public Boolean getBroadcastPingResult (int port_num, int protocol_version, int id);
public void reboot (int port_num, int protocol_version, byte id);
public void factoryReset (int port_num, int protocol_version, byte id, byte option);
public void readTx (int port_num, int protocol_version, byte id, short address, short length);
public void readRx (int port_num, int protocol_version, short length);
public void readTxRx (int port_num, int protocol_version, byte id, short address, short length);
public void read1ByteTx (int port_num, int protocol_version, byte id, short address);
public byte read1ByteRx (int port_num, int protocol_version);
public byte read1ByteTxRx (int port_num, int protocol_version, byte id, short address);
public void read2ByteTx (int port_num, int protocol_version, byte id, short address);
public short read2ByteRx (int port_num, int protocol_version);
public short read2ByteTxRx (int port_num, int protocol_version, byte id, short address);
public void read4ByteTx (int port_num, int protocol_version, byte id, short address);
public int read4ByteRx (int port_num, int protocol_version);
public int read4ByteTxRx (int port_num, int protocol_version, byte id, short address);
public void writeTxOnly (int port_num, int protocol_version, byte id, short address, short length);
public void writeTxRx (int port_num, int protocol_version, byte id, short address, short length);
public void write1ByteTxOnly (int port_num, int protocol_version, byte id, short address, byte data);
public void write1ByteTxRx (int port_num, int protocol_version, byte id, short address, byte data);
public void write2ByteTxOnly (int port_num, int protocol_version, byte id, short address, short data);
public void write2ByteTxRx (int port_num, int protocol_version, byte id, short address, short data);
public void write4ByteTxOnly (int port_num, int protocol_version, byte id, short address, int data);
public void write4ByteTxRx (int port_num, int protocol_version, byte id, short address, int data);
public void regWriteTxOnly (int port_num, int protocol_version, byte id, short address, short length);
public void regWriteTxRx (int port_num, int protocol_version, byte id, short address, short length);
public void syncReadTx (int port_num, int protocol_version, short start_address, short data_length, short param_length);
// syncReadRx -> GroupSyncRead
// syncReadTxRx -> GroupSyncRead
public void syncWriteTxOnly (int port_num, int protocol_version, short start_address, short data_length, short param_length);
public void bulkReadTx (int port_num, int protocol_version, short param_length);
// bulkReadRx -> GroupBulkRead
// bulkReadTxRx -> GroupBulkRead
public void bulkWriteTxOnly (int port_num, int protocol_version, short param_length);
// GroupBulkRead
public int groupBulkRead (int port_num, int protocol_version);
public Boolean groupBulkReadAddParam (int group_num, byte id, short start_address, short data_length);
public void groupBulkReadRemoveParam (int group_num, byte id);
public void groupBulkReadClearParam (int group_num);
public void groupBulkReadTxPacket (int group_num);
public void groupBulkReadRxPacket (int group_num);
public void groupBulkReadTxRxPacket (int group_num);
public Boolean groupBulkReadIsAvailable (int group_num, byte id, short address, short data_length);
public int groupBulkReadGetData (int group_num, byte id, short address, short data_length);
// GroupBulkWrite
public int groupBulkWrite (int port_num, int protocol_version);
public Boolean groupBulkWriteAddParam (int group_num, byte id, short start_address, short data_length, int data, short input_length);
public void groupBulkWriteRemoveParam (int group_num, byte id);
public Boolean groupBulkWriteChangeParam (int group_num, byte id, short start_address, short data_length, int data, short input_length, short data_pos);
public void groupBulkWriteClearParam (int group_num);
public void groupBulkWriteTxPacket (int group_num);
// GroupSyncRead
public int groupSyncRead (int port_num, int protocol_version, short start_address, short data_length);
public Boolean groupSyncReadAddParam (int group_num, byte id);
public void groupSyncReadRemoveParam (int group_num, byte id);
public void groupSyncReadClearParam (int group_num);
public void groupSyncReadTxPacket (int group_num);
public void groupSyncReadRxPacket (int group_num);
public void groupSyncReadTxRxPacket (int group_num);
public Boolean groupSyncReadIsAvailable (int group_num, byte id, short address, short data_length);
public int groupSyncReadGetData (int group_num, byte id, short address, short data_length);
// groupSyncWrite
public int groupSyncWrite (int port_num, int protocol_version, short start_address, short data_length);
public Boolean groupSyncWriteAddParam (int group_num, byte id, int data, short data_length);
public void groupSyncWriteRemoveParam (int group_num, byte id);
public Boolean groupSyncWriteChangeParam (int group_num, byte id, int data, short data_length, short data_pos);
public void groupSyncWriteClearParam (int group_num);
public void groupSyncWriteTxPacket (int group_num);
}
public class Dynamixel
{
LibFunction libFunction = (LibFunction)Native.loadLibrary("dxl_mac_c", LibFunction.class);
// PortHandler functions
public int portHandler(String str)
{
return libFunction.portHandler(str);
}
public Boolean openPort(int port_num)
{
return libFunction.openPort(port_num);
}
public void closePort(int port_num)
{
libFunction.closePort(port_num);
}
public void clearPort(int port_num)
{
libFunction.clearPort(port_num);
}
public Boolean setBaudRate(int port_num, int baudrate)
{
return libFunction.setBaudRate(port_num, baudrate);
}
public int getBaudRate(int port_num)
{
return libFunction.getBaudRate(port_num);
}
public int readPort(int port_num, byte[] packet, int length)
{
return libFunction.readPort(port_num, packet, length);
}
public int writePort(int port_num, byte[] packet, int length)
{
return libFunction.writePort(port_num, packet, length);
}
public void setPacketTimeout(int port_num, short packet_length)
{
libFunction.setPacketTimeout(port_num, packet_length);
}
public void setPacketTimeoutMSec(int port_num, double msec)
{
libFunction.setPacketTimeoutMSec(port_num, msec);
}
public Boolean isPacketTimeout(int port_num)
{
return libFunction.isPacketTimeout(port_num);
}
// PacketHandler functions
public void packetHandler()
{
libFunction.packetHandler();
}
public void printTxRxResult(int protocol_version, int result)
{
libFunction.printTxRxResult(protocol_version, result);
}
public String getTxRxResult(int protocol_version, int result)
{
return libFunction.getTxRxResult(protocol_version, result);
}
public void printRxPacketError(int protocol_version, byte error)
{
libFunction.printRxPacketError(protocol_version, error);
}
public String getRxPacketError(int protocol_version, byte error)
{
return libFunction.getRxPacketError(protocol_version, error);
}
public int getLastTxRxResult(int port_num, int protocol_version)
{
return libFunction.getLastTxRxResult(port_num, protocol_version);
}
public byte getLastRxPacketError(int port_num, int protocol_version)
{
return libFunction.getLastRxPacketError(port_num, protocol_version);
}
public void setDataWrite(int port_num, int protocol_version, short data_length, short data_pos, int data)
{
libFunction.setDataWrite(port_num, protocol_version, data_length, data_pos, data);
}
public int getDataRead(int port_num, int protocol_version, short data_length, short data_pos)
{
return libFunction.getDataRead(port_num, protocol_version, data_length, data_pos);
}
public void txPacket(int port_num, int protocol_version)
{
libFunction.txPacket(port_num, protocol_version);
}
public void rxPacket(int port_num, int protocol_version)
{
libFunction.rxPacket(port_num, protocol_version);
}
public void txRxPacket(int port_num, int protocol_version)
{
libFunction.txRxPacket(port_num, protocol_version);
}
public void ping(int port_num, int protocol_version, byte id)
{
libFunction.ping(port_num, protocol_version, id);
}
public int pingGetModelNum(int port_num, int protocol_version, byte id)
{
return libFunction.pingGetModelNum(port_num, protocol_version, id);
}
public void broadcastPing(int port_num, int protocol_version)
{
libFunction.broadcastPing(port_num, protocol_version);
}
public Boolean getBroadcastPingResult(int port_num, int protocol_version, int id)
{
return libFunction.getBroadcastPingResult(port_num, protocol_version, id);
}
public void reboot(int port_num, int protocol_version, byte id)
{
libFunction.reboot(port_num, protocol_version, id);
}
public void factoryReset(int port_num, int protocol_version, byte id, byte option)
{
libFunction.factoryReset(port_num, protocol_version, id, option);
}
public void readTx(int port_num, int protocol_version, byte id, short address, short length)
{
libFunction.readTx(port_num, protocol_version, id, address, length);
}
public void readRx(int port_num, int protocol_version, short length)
{
libFunction.readRx(port_num, protocol_version, length);
}
public void readTxRx(int port_num, int protocol_version, byte id, short address, short length)
{
libFunction.readTxRx(port_num, protocol_version, id, address, length);
}
public void read1ByteTx(int port_num, int protocol_version, byte id, short address)
{
libFunction.read1ByteTx(port_num, protocol_version, id, address);
}
public byte read1ByteRx(int port_num, int protocol_version)
{
return libFunction.read1ByteRx(port_num, protocol_version);
}
public byte read1ByteTxRx(int port_num, int protocol_version, byte id, short address)
{
return libFunction.read1ByteTxRx(port_num, protocol_version, id, address);
}
public void read2ByteTx(int port_num, int protocol_version, byte id, short address)
{
libFunction.read2ByteTx(port_num, protocol_version, id, address);
}
public short read2ByteRx(int port_num, int protocol_version)
{
return libFunction.read2ByteRx(port_num, protocol_version);
}
public short read2ByteTxRx(int port_num, int protocol_version, byte id, short address)
{
return libFunction.read2ByteTxRx(port_num, protocol_version, id, address);
}
public void read4ByteTx(int port_num, int protocol_version, byte id, short address)
{
libFunction.read4ByteTxRx(port_num, protocol_version, id, address);
}
public int read4ByteRx(int port_num, int protocol_version)
{
return libFunction.read4ByteRx(port_num, protocol_version);
}
public int read4ByteTxRx(int port_num, int protocol_version, byte id, short address)
{
return libFunction.read4ByteTxRx(port_num, protocol_version, id, address);
}
public void writeTxOnly(int port_num, int protocol_version, byte id, short address, short length)
{
libFunction.writeTxOnly(port_num, protocol_version, id, address, length);
}
public void writeTxRx(int port_num, int protocol_version, byte id, short address, short length)
{
libFunction.writeTxRx(port_num, protocol_version, id, address, length);
}
public void write1ByteTxOnly(int port_num, int protocol_version, byte id, short address, byte data)
{
libFunction.write1ByteTxOnly(port_num, protocol_version, id, address, data);
}
public void write1ByteTxRx(int port_num, int protocol_version, byte id, short address, byte data)
{
libFunction.write1ByteTxRx(port_num, protocol_version, id, address, data);
}
public void write2ByteTxOnly(int port_num, int protocol_version, byte id, short address, short data)
{
libFunction.write2ByteTxOnly(port_num, protocol_version, id, address, data);
}
public void write2ByteTxRx(int port_num, int protocol_version, byte id, short address, short data)
{
libFunction.write2ByteTxRx(port_num, protocol_version, id, address, data);
}
public void write4ByteTxOnly(int port_num, int protocol_version, byte id, short address, int data)
{
libFunction.write4ByteTxOnly(port_num, protocol_version, id, address, data);
}
public void write4ByteTxRx(int port_num, int protocol_version, byte id, short address, int data)
{
libFunction.write4ByteTxRx(port_num, protocol_version, id, address, data);
}
public void regWriteTxOnly(int port_num, int protocol_version, byte id, short address, short length)
{
libFunction.regWriteTxOnly(port_num, protocol_version, id, address, length);
}
public void regWriteTxRx(int port_num, int protocol_version, byte id, short address, short length)
{
libFunction.regWriteTxRx(port_num, protocol_version, id, address, length);
}
public void syncReadTx(int port_num, int protocol_version, short start_address, short data_length, short param_length)
{
libFunction.syncReadTx(port_num, protocol_version, start_address, data_length, param_length);
}
public void syncWriteTxOnly(int port_num, int protocol_version, short start_address, short data_length, short param_length)
{
libFunction.syncWriteTxOnly(port_num, protocol_version, start_address, data_length, param_length);
}
public void bulkReadTx(int port_num, int protocol_version, short param_length)
{
libFunction.bulkReadTx(port_num, protocol_version, param_length);
}
public void bulkWriteTxOnly(int port_num, int protocol_version, short param_length)
{
libFunction.bulkWriteTxOnly(port_num, protocol_version, param_length);
}
// GroupBulkRead
public int groupBulkRead(int port_num, int protocol_version)
{
return libFunction.groupBulkRead(port_num, protocol_version);
}
public Boolean groupBulkReadAddParam(int group_num, byte id, short start_address, short data_length)
{
return libFunction.groupBulkReadAddParam(group_num, id, start_address, data_length);
}
public void groupBulkReadRemoveParam(int group_num, byte id)
{
libFunction.groupBulkReadRemoveParam(group_num, id);
}
public void groupBulkReadClearParam(int group_num)
{
libFunction.groupBulkReadClearParam(group_num);
}
public void groupBulkReadTxPacket(int group_num)
{
libFunction.groupBulkReadTxPacket(group_num);
}
public void groupBulkReadRxPacket(int group_num)
{
libFunction.groupBulkReadRxPacket(group_num);
}
public void groupBulkReadTxRxPacket(int group_num)
{
libFunction.groupBulkReadTxRxPacket(group_num);
}
public Boolean groupBulkReadIsAvailable(int group_num, byte id, short address, short data_length)
{
return libFunction.groupBulkReadIsAvailable(group_num, id, address, data_length);
}
public int groupBulkReadGetData(int group_num, byte id, short address, short data_length)
{
return libFunction.groupBulkReadGetData(group_num, id, address, data_length);
}
// GroupBulkWrite
public int groupBulkWrite(int port_num, int protocol_version)
{
return libFunction.groupBulkWrite(port_num, protocol_version);
}
public Boolean groupBulkWriteAddParam(int group_num, byte id, short start_address, short data_length, int data, short input_length)
{
return libFunction.groupBulkWriteAddParam(group_num, id, start_address, data_length, data, input_length);
}
public void groupBulkWriteRemoveParam(int group_num, byte id)
{
libFunction.groupBulkWriteRemoveParam(group_num, id);
}
public Boolean groupBulkWriteChangeParam(int group_num, byte id, short start_address, short data_length, int data, short input_length, short data_pos)
{
return libFunction.groupBulkWriteChangeParam(group_num, id, start_address, data_length, data, input_length, data_pos);
}
public void groupBulkWriteClearParam(int group_num)
{
libFunction.groupBulkWriteClearParam(group_num);
}
public void groupBulkWriteTxPacket(int group_num)
{
libFunction.groupBulkWriteTxPacket(group_num);
}
// GroupSyncRead
public int groupSyncRead(int port_num, int protocol_version, short start_address, short data_length)
{
return libFunction.groupSyncRead(port_num, protocol_version, start_address, data_length);
}
public Boolean groupSyncReadAddParam(int group_num, byte id)
{
return libFunction.groupSyncReadAddParam(group_num, id);
}
public void groupSyncReadRemoveParam(int group_num, byte id)
{
libFunction.groupSyncReadRemoveParam(group_num, id);
}
public void groupSyncReadClearParam(int group_num)
{
libFunction.groupSyncReadClearParam(group_num);
}
public void groupSyncReadTxPacket(int group_num)
{
libFunction.groupSyncReadTxPacket(group_num);
}
public void groupSyncReadRxPacket(int group_num)
{
libFunction.groupSyncReadRxPacket(group_num);
}
public void groupSyncReadTxRxPacket(int group_num)
{
libFunction.groupSyncReadTxRxPacket(group_num);
}
public Boolean groupSyncReadIsAvailable(int group_num, byte id, short address, short data_length)
{
return libFunction.groupSyncReadIsAvailable(group_num, id, address, data_length);
}
public int groupSyncReadGetData(int group_num, byte id, short address, short data_length)
{
return libFunction.groupSyncReadGetData(group_num, id, address, data_length);
}
// groupSyncWrite
public int groupSyncWrite(int port_num, int protocol_version, short start_address, short data_length)
{
return libFunction.groupSyncWrite(port_num, protocol_version, start_address, data_length);
}
public Boolean groupSyncWriteAddParam(int group_num, byte id, int data, short data_length)
{
return libFunction.groupSyncWriteAddParam(group_num, id, data, data_length);
}
public void groupSyncWriteRemoveParam(int group_num, byte id)
{
libFunction.groupSyncWriteRemoveParam(group_num, id);
}
public Boolean groupSyncWriteChangeParam(int group_num, byte id, int data, short data_length, short data_pos)
{
return libFunction.groupSyncWriteChangeParam(group_num, id, data, data_length, data_pos);
}
public void groupSyncWriteClearParam(int group_num)
{
libFunction.groupSyncWriteClearParam(group_num);
}
public void groupSyncWriteTxPacket(int group_num)
{
libFunction.groupSyncWriteTxPacket(group_num);
}
}
| [
"andi199424@hotmail.com"
] | andi199424@hotmail.com |
c5c0ecc7f31a9ccf1f2654887b40632b7add1307 | 8ba5c8344ea4447331fc165b36aa9a61fd9f9f4a | /src/Instructor.java | 77243fbd917cd87264ab62ae3b3469111658ace4 | [] | no_license | patKiat/ProjectJava2 | f22ea8a9439079ecd7ace5875e124a7b4a0da4b4 | 1503c46e3feee7bb73c4fc4a852ef34e1026e127 | refs/heads/master | 2021-01-22T19:15:20.078964 | 2017-03-16T10:50:10 | 2017-03-16T10:50:10 | 85,185,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | /** Name: Pattararat Kiattipadungkul
* StudentID: 5988068
* Section: 1
*/
import java.util.*;
public class Instructor extends Person {
private ArrayList<Integer> skill;
private ArrayList<String> researchInterest;
private ArrayList<RegCourse> teaching;
public Instructor(String firstName, String lastName, int age, char gender) {
//CODE HERE
super(firstName, lastName, age, gender);
teaching = new ArrayList<>();
}
//Other relevant methods should be defined here
//add a teaching course
public void setTeaching(RegCourse course) {
//CODE HERE
teaching.add(course);
}
public ArrayList<RegCourse> getTeaching(){
return teaching;
}
//Printing Instructor information @Overridding
public void printInfo(){
//CODE HERE
System.out.println(super.getFirstName() + " " + super.getLastName());
}
}
| [
"pattarara_rat@hotmail.com"
] | pattarara_rat@hotmail.com |
f2f0777751d17c418e8f0fbfc673930336ffe648 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Mate20-9.0/src/main/java/com/android/server/wifi/HostapdHal.java | f52de169f7d0aeea3cc53334c92b0631ea7513cd | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,152 | java | package com.android.server.wifi;
import android.content.Context;
import android.hardware.wifi.hostapd.V1_0.HostapdStatus;
import android.hardware.wifi.hostapd.V1_0.IHostapd;
import android.hidl.manager.V1_0.IServiceManager;
import android.hidl.manager.V1_0.IServiceNotification;
import android.net.wifi.WifiConfiguration;
import android.os.IHwBinder;
import android.os.RemoteException;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.wifi.WifiNative;
import com.android.server.wifi.util.NativeUtil;
import javax.annotation.concurrent.ThreadSafe;
@ThreadSafe
public class HostapdHal {
private static final String TAG = "HostapdHal";
private WifiNative.HostapdDeathEventHandler mDeathEventHandler;
private final boolean mEnableAcs;
private final boolean mEnableIeee80211AC;
private final IHwBinder.DeathRecipient mHostapdDeathRecipient = new IHwBinder.DeathRecipient() {
public final void serviceDied(long j) {
HostapdHal.lambda$new$1(HostapdHal.this, j);
}
};
private IHostapd mIHostapd;
private IServiceManager mIServiceManager = null;
/* access modifiers changed from: private */
public final Object mLock = new Object();
private final IHwBinder.DeathRecipient mServiceManagerDeathRecipient = new IHwBinder.DeathRecipient() {
public final void serviceDied(long j) {
HostapdHal.lambda$new$0(HostapdHal.this, j);
}
};
private final IServiceNotification mServiceNotificationCallback = new IServiceNotification.Stub() {
public void onRegistration(String fqName, String name, boolean preexisting) {
synchronized (HostapdHal.this.mLock) {
if (HostapdHal.this.mVerboseLoggingEnabled) {
Log.i(HostapdHal.TAG, "IServiceNotification.onRegistration for: " + fqName + ", " + name + " preexisting=" + preexisting);
}
if (!HostapdHal.this.initHostapdService()) {
Log.e(HostapdHal.TAG, "initalizing IHostapd failed.");
HostapdHal.this.hostapdServiceDiedHandler();
} else {
Log.i(HostapdHal.TAG, "Completed initialization of IHostapd.");
}
}
}
};
/* access modifiers changed from: private */
public boolean mVerboseLoggingEnabled = false;
public static /* synthetic */ void lambda$new$0(HostapdHal hostapdHal, long cookie) {
synchronized (hostapdHal.mLock) {
Log.w(TAG, "IServiceManager died: cookie=" + cookie);
hostapdHal.hostapdServiceDiedHandler();
hostapdHal.mIServiceManager = null;
}
}
public static /* synthetic */ void lambda$new$1(HostapdHal hostapdHal, long cookie) {
synchronized (hostapdHal.mLock) {
Log.w(TAG, "IHostapd/IHostapd died: cookie=" + cookie);
hostapdHal.hostapdServiceDiedHandler();
}
}
public HostapdHal(Context context) {
this.mEnableAcs = context.getResources().getBoolean(17957086);
this.mEnableIeee80211AC = context.getResources().getBoolean(17957087);
}
/* access modifiers changed from: package-private */
public void enableVerboseLogging(boolean enable) {
synchronized (this.mLock) {
this.mVerboseLoggingEnabled = enable;
}
}
private boolean linkToServiceManagerDeath() {
synchronized (this.mLock) {
if (this.mIServiceManager == null) {
return false;
}
try {
if (this.mIServiceManager.linkToDeath(this.mServiceManagerDeathRecipient, 0)) {
return true;
}
Log.wtf(TAG, "Error on linkToDeath on IServiceManager");
hostapdServiceDiedHandler();
this.mIServiceManager = null;
return false;
} catch (RemoteException e) {
Log.e(TAG, "IServiceManager.linkToDeath exception", e);
this.mIServiceManager = null;
return false;
}
}
}
public boolean initialize() {
synchronized (this.mLock) {
if (this.mVerboseLoggingEnabled) {
Log.i(TAG, "Registering IHostapd service ready callback.");
}
this.mIHostapd = null;
if (this.mIServiceManager != null) {
return true;
}
try {
this.mIServiceManager = getServiceManagerMockable();
if (this.mIServiceManager == null) {
Log.e(TAG, "Failed to get HIDL Service Manager");
return false;
} else if (!linkToServiceManagerDeath()) {
return false;
} else {
if (this.mIServiceManager.registerForNotifications(IHostapd.kInterfaceName, "", this.mServiceNotificationCallback)) {
return true;
}
Log.e(TAG, "Failed to register for notifications to android.hardware.wifi.hostapd@1.0::IHostapd");
this.mIServiceManager = null;
return false;
}
} catch (RemoteException e) {
Log.e(TAG, "Exception while trying to register a listener for IHostapd service: " + e);
hostapdServiceDiedHandler();
this.mIServiceManager = null;
return false;
}
}
}
private boolean linkToHostapdDeath() {
synchronized (this.mLock) {
if (this.mIHostapd == null) {
return false;
}
try {
if (this.mIHostapd.linkToDeath(this.mHostapdDeathRecipient, 0)) {
return true;
}
Log.wtf(TAG, "Error on linkToDeath on IHostapd");
hostapdServiceDiedHandler();
return false;
} catch (RemoteException e) {
Log.e(TAG, "IHostapd.linkToDeath exception", e);
return false;
}
}
}
/* access modifiers changed from: private */
public boolean initHostapdService() {
synchronized (this.mLock) {
try {
this.mIHostapd = getHostapdMockable();
if (this.mIHostapd == null) {
Log.e(TAG, "Got null IHostapd service. Stopping hostapd HIDL startup");
return false;
} else if (!linkToHostapdDeath()) {
return false;
} else {
return true;
}
} catch (RemoteException e) {
Log.e(TAG, "IHostapd.getService exception: " + e);
return false;
} catch (Throwable th) {
throw th;
}
}
}
public boolean addAccessPoint(String ifaceName, WifiConfiguration config) {
synchronized (this.mLock) {
IHostapd.IfaceParams ifaceParams = new IHostapd.IfaceParams();
ifaceParams.ifaceName = ifaceName;
ifaceParams.hwModeParams.enable80211N = true;
ifaceParams.hwModeParams.enable80211AC = this.mEnableIeee80211AC;
try {
ifaceParams.channelParams.band = getBand(config);
if (this.mEnableAcs) {
ifaceParams.channelParams.enableAcs = true;
ifaceParams.channelParams.acsShouldExcludeDfs = true;
} else {
if (ifaceParams.channelParams.band == 2) {
Log.d(TAG, "ACS is not supported on this device, using 2.4 GHz band.");
ifaceParams.channelParams.band = 0;
}
ifaceParams.channelParams.enableAcs = false;
ifaceParams.channelParams.channel = config.apChannel;
}
IHostapd.NetworkParams nwParams = new IHostapd.NetworkParams();
try {
nwParams.ssid.addAll(NativeUtil.stringToByteArrayList(config.SSID));
} catch (IllegalArgumentException e) {
Log.w(TAG, "addAccessPoint: cannot be utf-8 encoded");
nwParams.ssid.addAll(NativeUtil.byteArrayToArrayList(NativeUtil.stringToByteArray(config.SSID)));
}
nwParams.isHidden = config.hiddenSSID;
nwParams.encryptionType = getEncryptionType(config);
nwParams.pskPassphrase = config.preSharedKey != null ? config.preSharedKey : "";
if (!checkHostapdAndLogFailure("addAccessPoint")) {
return false;
}
try {
boolean checkStatusAndLogFailure = checkStatusAndLogFailure(this.mIHostapd.addAccessPoint(ifaceParams, nwParams), "addAccessPoint");
return checkStatusAndLogFailure;
} catch (RemoteException e2) {
handleRemoteException(e2, "addAccessPoint");
return false;
}
} catch (IllegalArgumentException e3) {
Log.e(TAG, "Unrecognized apBand " + config.apBand);
return false;
}
}
}
public boolean removeAccessPoint(String ifaceName) {
synchronized (this.mLock) {
if (!checkHostapdAndLogFailure("removeAccessPoint")) {
return false;
}
try {
boolean checkStatusAndLogFailure = checkStatusAndLogFailure(this.mIHostapd.removeAccessPoint(ifaceName), "removeAccessPoint");
return checkStatusAndLogFailure;
} catch (RemoteException e) {
handleRemoteException(e, "removeAccessPoint");
return false;
}
}
}
public boolean registerDeathHandler(WifiNative.HostapdDeathEventHandler handler) {
if (this.mDeathEventHandler != null) {
Log.e(TAG, "Death handler already present");
}
this.mDeathEventHandler = handler;
return true;
}
public boolean deregisterDeathHandler() {
if (this.mDeathEventHandler == null) {
Log.e(TAG, "No Death handler present");
}
this.mDeathEventHandler = null;
return true;
}
private void clearState() {
synchronized (this.mLock) {
this.mIHostapd = null;
}
}
/* access modifiers changed from: private */
public void hostapdServiceDiedHandler() {
synchronized (this.mLock) {
clearState();
if (this.mDeathEventHandler != null) {
this.mDeathEventHandler.onDeath();
}
}
}
public boolean isInitializationStarted() {
boolean z;
synchronized (this.mLock) {
z = this.mIServiceManager != null;
}
return z;
}
public boolean isInitializationComplete() {
boolean z;
synchronized (this.mLock) {
z = this.mIHostapd != null;
}
return z;
}
public void terminate() {
synchronized (this.mLock) {
if (checkHostapdAndLogFailure("terminate")) {
try {
this.mIHostapd.terminate();
} catch (RemoteException e) {
handleRemoteException(e, "terminate");
}
}
}
}
/* access modifiers changed from: protected */
@VisibleForTesting
public IServiceManager getServiceManagerMockable() throws RemoteException {
IServiceManager service;
synchronized (this.mLock) {
service = IServiceManager.getService();
}
return service;
}
/* access modifiers changed from: protected */
@VisibleForTesting
public IHostapd getHostapdMockable() throws RemoteException {
IHostapd service;
synchronized (this.mLock) {
service = IHostapd.getService();
}
return service;
}
private static int getEncryptionType(WifiConfiguration localConfig) {
int authType = localConfig.getAuthType();
if (authType == 4) {
return 2;
}
switch (authType) {
case 0:
return 0;
case 1:
return 1;
default:
return 0;
}
}
private static int getBand(WifiConfiguration localConfig) {
switch (localConfig.apBand) {
case -1:
return 2;
case 0:
return 0;
case 1:
return 1;
default:
throw new IllegalArgumentException();
}
}
private boolean checkHostapdAndLogFailure(String methodStr) {
synchronized (this.mLock) {
if (this.mIHostapd != null) {
return true;
}
Log.e(TAG, "Can't call " + methodStr + ", IHostapd is null");
return false;
}
}
private boolean checkStatusAndLogFailure(HostapdStatus status, String methodStr) {
synchronized (this.mLock) {
if (status.code != 0) {
Log.e(TAG, "IHostapd." + methodStr + " failed: " + status.code + ", " + status.debugMessage);
return false;
}
if (this.mVerboseLoggingEnabled) {
Log.d(TAG, "IHostapd." + methodStr + " succeeded");
}
return true;
}
}
private void handleRemoteException(RemoteException e, String methodStr) {
synchronized (this.mLock) {
hostapdServiceDiedHandler();
Log.e(TAG, "IHostapd." + methodStr + " failed with exception", e);
}
}
private static void logd(String s) {
Log.d(TAG, s);
}
private static void logi(String s) {
Log.i(TAG, s);
}
private static void loge(String s) {
Log.e(TAG, s);
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
45c3f2e56a87f7ba2ad5a60d2682ba899de89a3b | b2b3807a815030a79cc64d0c955c9876403289d1 | /PetHotelKiosk/src/View/ChoiceChangeView.java | 36fabfde0b89da27a51d01d2f119ef1d6d306ce4 | [] | no_license | Heekng/petHotel | 05e96ac4f30badfb40786954aace41a22d34241f | 8315db500836e111df4691eec36a8882329c5cea | refs/heads/main | 2023-05-11T16:57:36.375217 | 2021-06-01T14:34:34 | 2021-06-01T14:34:34 | 321,903,055 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 5,230 | java | package View;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import DAO.useFnc;
import DTO.Pet;
public class ChoiceChangeView extends MainView{
public JButton enterDayBt, exitDayBt;
public JButton backBt;
public JTextField petNameTf, roomNumTf, enterDayTf, exitDayTf;
public ChoiceChangeView(Pet pet) {
setTitle("수정 선택");
setSize(400, 400);
Dimension dimen = Toolkit.getDefaultToolkit().getScreenSize();
Dimension dimen2 = getSize();
int x = (dimen.width - dimen2.width)/2;
int y= (dimen.height - dimen2.height)/2;
setLocation(x, y);
JPanel guidPn = new JPanel();
JLabel guidLb = new JLabel("수정할 내용을 변경해주세요.");
guidPn.add(guidLb);
JPanel petNamePn = new JPanel(new FlowLayout());
JLabel petNameLb = new JLabel("펫 이름");
petNameTf = new JTextField(8);
petNameTf.setText(pet.getPetName());
petNamePn.add(petNameLb);
petNamePn.add(petNameTf);
JPanel roomNumPn = new JPanel(new FlowLayout());
JLabel roomNumLb = new JLabel("방 번호");
roomNumTf = new JTextField(8);
roomNumTf.setText(""+pet.getRoomNum());
roomNumPn.add(roomNumLb);
roomNumPn.add(roomNumTf);
JPanel enterDayPn = new JPanel(new FlowLayout());
JLabel enterDayLb = new JLabel("입실 날짜");
enterDayTf = new JTextField(8);
enterDayTf.setText(useFnc.dateToStr(pet.getEnterDate()));
enterDayBt = new JButton("날짜 선택");
enterDayBt.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
CalandarView cal = new CalandarView();
for (int i = 0; i < cal.dateButs.length; i++) {
for (int j = 0; j < cal.dateButs[i].length; j++) {
cal.dateButs[i][j].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int k=0,l=0;
for(int i=0 ; i<6 ; i++){
for(int j=0 ; j<7 ; j++){
if(e.getSource() == cal.dateButs[i][j]){
k=i;
l=j;
}
}
}
if(!(k ==0 && l == 0)) cal.calDayOfMon = cal.calDates[k][l];
String realYear, realMonth, realDay;
if(cal.calYear%100 < 10) realYear = "0"+(cal.calYear%100);
else realYear = ""+(cal.calYear%100);
if(cal.calMonth+1 < 10) realMonth = "0" +(cal.calMonth+1);
else realMonth = "" +(cal.calMonth+1);
if(cal.calDayOfMon < 10) realDay = "0" + (cal.calDayOfMon);
else realDay = "" + (cal.calDayOfMon);
String time = realYear+realMonth+realDay;
enterDayTf.setText(time);
cal.mainFrame.dispose();
}
});
}
}
cal.mainFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
cal.mainFrame.dispose();
}
});
}
});
enterDayPn.add(enterDayLb);
enterDayPn.add(enterDayTf);
enterDayPn.add(enterDayBt);
JPanel exitDayPn = new JPanel(new FlowLayout());
JLabel exitDayLb = new JLabel("퇴실 날짜");
exitDayTf = new JTextField(8);
exitDayTf.setText(useFnc.dateToStr(pet.getExitDate()));
exitDayBt = new JButton("날짜 선택");
exitDayBt.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
CalandarView cal = new CalandarView();
for (int i = 0; i < cal.dateButs.length; i++) {
for (int j = 0; j < cal.dateButs[i].length; j++) {
cal.dateButs[i][j].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int k=0,l=0;
for(int i=0 ; i<6 ; i++){
for(int j=0 ; j<7 ; j++){
if(e.getSource() == cal.dateButs[i][j]){
k=i;
l=j;
}
}
}
if(!(k ==0 && l == 0)) cal.calDayOfMon = cal.calDates[k][l];
String realYear, realMonth, realDay;
if(cal.calYear%100 < 10) realYear = "0"+(cal.calYear%100);
else realYear = ""+(cal.calYear%100);
if(cal.calMonth+1 < 10) realMonth = "0" +(cal.calMonth+1);
else realMonth = "" +(cal.calMonth+1);
if(cal.calDayOfMon < 10) realDay = "0" + (cal.calDayOfMon);
else realDay = "" + (cal.calDayOfMon);
String time = realYear+realMonth+realDay;
exitDayTf.setText(time);
cal.mainFrame.dispose();
}
});
}
}
cal.mainFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
cal.mainFrame.dispose();
}
});
}
});
exitDayPn.add(exitDayLb);
exitDayPn.add(exitDayTf);
exitDayPn.add(exitDayBt);
JPanel buttonPn = new JPanel();
JButton enterBt = new JButton("수정");
buttonPn.add(enterBt);
backBt = new JButton("나가기");
buttonPn.add(backBt);
add(guidPn);
add(petNamePn);
add(roomNumPn);
add(enterDayPn);
add(exitDayPn);
add(buttonPn);
setVisible(true);
}
}
| [
"rhkd1769@gmail.com"
] | rhkd1769@gmail.com |
9da4da63bedb0c7ea126dfe2e9f2d7d763afdb4f | 2905c61c46f7b309619a4b3e84f5392d9e31d2a3 | /ThreeTest/src/com/company/Main.java | d3427ec4524d2422caa0579ba71fa82e1d29f187 | [] | no_license | 316558816/HackerU_2017_Java | 8addc5a0591a0ef296b7f51b228e100ad75ca079 | 2d11619c8c3cd9aa3b20145c74cc4c52b9c4d490 | refs/heads/master | 2021-01-22T05:54:26.667111 | 2017-04-06T11:01:56 | 2017-04-06T11:01:56 | 81,721,642 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,643 | java | package com.company;
public class Main {
public static void main(String[] args) {
Node h=null;
Node n1 = new Node(2);
Node n2 = new Node(3);
Node n3 = new Node(5);
Node n4 = new Node(7);
Node n5 = new Node(9);
h=n1;
n1.next=n2;
n2.next=n3;
n3.next=n4;
n4.next=n5;
Ex2 e=new Ex2(h);
e.bubbleSort(h);
/* Node n1 = new Node(2);
Node n2 = new Node(3);
Node n3 = new Node(5);
Node n4 = new Node(7);
Node n5 = new Node(9);
n1.next = n2;
n2.next = n3;
n3.next = n4;
n4.next = n5;
NodeWithHead h1 = new NodeWithHead(n1);
Node n6 = new Node(1);
Node n7 = new Node(3);
Node n8 = new Node(6);
Node n9 = new Node(7);
Node n10 = new Node(10);
n6.next = n7;
n7.next = n8;
n8.next = n9;
n9.next = n10;
NodeWithHead h2 = new NodeWithHead(n6);
Node n11 = new Node(8);
Node n12 = new Node(10);
Node n13 = new Node(12);
Node n14 = new Node(14);
Node n15 = new Node(16);
n11.next = n12;
n12.next = n13;
n13.next = n14;
n14.next = n15;
NodeWithHead h3 = new NodeWithHead(n11);
h1.next = h2;
h2.next=h3;
Node first=h1.value;
*//* Node end= Ex1.targil(h1);
while (end.next!=null)
System.out.println(end.value);
*//*
Ex2 e=new Ex2();
e.bubbleSort(n1);*/
}
}
| [
"noreply@github.com"
] | 316558816.noreply@github.com |
64e977bed78aae0b818d6e7b71bc71e00a934403 | 5346e62ede7f277b14f27cdf759d927b57a0eb09 | /src/org/firebears/commands/ArmAngleCommand.java | 2ad485ce51487092f53c192976d807f9424ea822 | [] | no_license | firebears-frc/FB2014 | 70c99b2fdb0d1616163bb797dba18fc419542618 | 96bab4198f879471c4371cebee7949ce9ac4b9ae | refs/heads/master | 2021-01-12T21:28:16.794901 | 2014-12-03T03:02:34 | 2014-12-03T03:02:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java |
package org.firebears.commands;
import edu.wpi.first.wpilibj.command.Command;
import org.firebears.Robot;
/**
*
*/
public class ArmAngleCommand extends Command {
double targetAngle;
public ArmAngleCommand(double setAngle) {
requires(Robot.arm);
targetAngle = setAngle;
}
protected void initialize() {
Robot.arm.gotoAngle(targetAngle);
setTimeout(2);
}
protected void execute() {
}
protected boolean isFinished() {
// return Robot.arm.onTarget();
return (Math.abs(Robot.arm.m_angleSetpoint - Robot.arm.getAngle()) <= 3 )|| isTimedOut() ;//accounts for gravity comp
}
protected void end() {
}
protected void interrupted() {
}
}
| [
"KeithRieck@gmail.com"
] | KeithRieck@gmail.com |
4913e583fbab8eea91462e6daf6a4a252999e11f | 81931ad53738ff87b0a05a54252616bbeed61f50 | /app/src/main/java/me/alecrabold/android/criminalintent/CrimeLab.java | e6ddb06a0cdbaf17b4849b4280203a5f320fe54e | [] | no_license | alec-rabold/Criminal_Intent_Android_App | fd5f8ee36914693ab8c8f5486dc2a459321b6d40 | 536803eb2b48424d04ada1a422a09ae06864e350 | refs/heads/master | 2021-01-23T05:44:57.627496 | 2017-05-31T20:11:56 | 2017-05-31T20:11:56 | 92,984,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,046 | java | package me.alecrabold.android.criminalintent;
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* Created by Alec on 5/18/2017.
*/
public class CrimeLab {
private static CrimeLab sCrimeLab;
private List<Crime> mCrimes;
public static CrimeLab get(Context context) {
if (sCrimeLab == null) {
sCrimeLab = new CrimeLab(context);
}
return sCrimeLab;
}
private CrimeLab(Context context) {
mCrimes = new ArrayList<>();
for (int i = 0; i < 100; i++) {
Crime crime = new Crime();
crime.setTitle("Crime #" + i);
crime.setSolved(i % 2 == 0); // Every other one
mCrimes.add(crime);
}
}
public List<Crime> getCrimes() {
return mCrimes;
}
public Crime getCrime(UUID id) {
for (Crime crime : mCrimes) {
if (crime.getId().equals(id)) {
return crime;
}
}
return null;
}
}
| [
"alecrabold@outlook.com"
] | alecrabold@outlook.com |
bd3d14e8c9f3d0d4882418d8128b9ea2bb38609b | c2e734fb4141f2e4f49c630545715c110c51eafc | /Phase_5/GUI database only/gui/Main/GUI.java | 6ddf0e1931fa5c26a859133831cb7a80574c5d0e | [] | no_license | fudge22/cs340hyperweb | be56d15500b91e93b1b0bfee6c22e0ad059bafc2 | 8d1ee4aaf00a32d3ce47e661c1251aca568ec77b | refs/heads/master | 2021-01-23T02:53:55.501769 | 2013-12-13T05:06:46 | 2013-12-13T05:06:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,029 | java | package gui.Main;
import gui.Main.HyPeerWebDebugger;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.*;
import model.HyperWeb;
/**
* The central GUI used to display information about the HyPeerWeb and debug information
*
* @author Matthew Smith
*
*/
public class GUI extends JFrame
{
private static GUI singleton = null;
/** Main Debugger Panel**/
private HyPeerWebDebugger debugger;
private HyperWeb hypeerweb;
private JScrollPane scrollPane;
/**
* Creates and initializes the GUI as being the root
*/
public GUI(HyperWeb hypeerweb){
this.hypeerweb = hypeerweb;
this.setTitle("HyPeerWeb DEBUGGER V 1.1");
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
shutdown();
System.exit(0);
}
});
debugger = new HyPeerWebDebugger(this);
scrollPane = new JScrollPane(debugger);
scrollPane.setPreferredSize(new Dimension(debugger.WIDTH+20, debugger.HEIGHT));
this.getContentPane().add(scrollPane);
this.pack();
}
private void shutdown(){
hypeerweb.close();
}
public static GUI getSingleton(HyperWeb hypeerweb){
if(singleton == null){
try{
singleton = new GUI(hypeerweb);
singleton.setVisible(true);
}
catch(Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage(), "ERROR",JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
hypeerweb.close();
System.exit(1);
}
}
return singleton;
}
/**
* Start Point of the Program
*/
public static void main (String[] args){
GUI gui = GUI.getSingleton(HyperWeb.getHyPeerWeb());
}
/**
* Retrieves the HyPeerWeb Debugging Panel
* @return HyPeerWebDebugger
*/
public HyPeerWebDebugger getHyPeerWebDebugger() {
return debugger;
}
public HyperWeb getHyPeerWeb(){
return hypeerweb;
}
public void printToTracePanel(Object msg){
debugger.getTracePanel().print(msg);
}
public void finalize(){
hypeerweb.close();
}
}
| [
"Brian.Blackph@gmail.com"
] | Brian.Blackph@gmail.com |
7b9951f651ed3e1da0a621647736c14f89c6c1da | b786d0bfc65620d1144a33177baf369e484f7272 | /src/main/java/ua/krasun/conference_portal_servlet/model/dao/mapper/UserMapper.java | f5e220079f090e3fa37056255ef8824e65559d5d | [] | no_license | BogdanKr/conference_portal_servlet | 0c689382a2b55ae987280e7b42123fc0cc963450 | cf2adbff79c5a7b8688e0641a6c307bf5e75a92a | refs/heads/master | 2022-07-11T19:03:23.945476 | 2019-10-09T12:51:52 | 2019-10-09T12:51:52 | 206,067,128 | 0 | 0 | null | 2022-06-21T01:48:36 | 2019-09-03T12:02:25 | HTML | UTF-8 | Java | false | false | 947 | java | package ua.krasun.conference_portal_servlet.model.dao.mapper;
import ua.krasun.conference_portal_servlet.model.entity.Role;
import ua.krasun.conference_portal_servlet.model.entity.User;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
public class UserMapper implements ObjectMapper<User> {
@Override
public User extractFromResultSet(ResultSet rs) throws SQLException {
return User.builder()
.id(rs.getLong("user_id"))
.firstName(rs.getString("first_name"))
.email(rs.getString("email"))
.password(rs.getString("password"))
.role(Role.values()[rs.getInt("role")])
.active(rs.getBoolean("active"))
.build();
}
@Override
public User makeUnique(Map<Long, User> cache, User user) {
cache.putIfAbsent(user.getId(), user);
return cache.get(user.getId());
}
}
| [
"krabog@gmail.com"
] | krabog@gmail.com |
72214d5bbbb3b8dcec2c177a32e7e0e7a3162fad | ee28bdf6f8bc76e33bf925f9f5b536c7bf685c7b | /src/main/java/com/pingcap/tikv/expression/scalar/LeftShift.java | 0120b946e9d4a231df7272daa729deb6ec3f15f1 | [
"Apache-2.0"
] | permissive | ilovesoup/client-test | 69fa6e7637ae9d8f6f636de15c3fe32e38e6c80f | 21776aab896c9977c2b2c742f837e4ff5ad3787a | refs/heads/master | 2021-01-21T23:14:15.325088 | 2017-06-26T08:02:48 | 2017-06-26T08:02:48 | 95,216,579 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java | /*
* Copyright 2017 PingCAP, Inc.
*
* 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,
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.pingcap.tikv.expression.scalar;
import com.pingcap.tidb.tipb.ExprType;
import com.pingcap.tikv.expression.TiBinaryFunctionExpresson;
import com.pingcap.tikv.expression.TiExpr;
import com.pingcap.tikv.types.DataType;
public class LeftShift extends TiBinaryFunctionExpresson {
public LeftShift(TiExpr lhs, TiExpr rhs) {
super(lhs, rhs);
}
@Override
protected ExprType getExprType() {
return ExprType.LeftShift;
}
@Override
public String getName() {
return "LeftShift";
}
@Override
public DataType getType() {
throw new UnsupportedOperationException();
}
}
| [
"maxiaoyu@pingcap.com"
] | maxiaoyu@pingcap.com |
faa3e8608994946a4bd5e77c246f6011df0db9ed | d956b4b2021d8eb084c8e3e9e9815ebed15f622e | /NoSQLite4J/src/org/nosqlite4j/test/TestAlterTable.java | 0976a0d09b242cbef6a67730d4f1ce18a3a1237d | [] | no_license | mailmahee/noSQLite4j | deb4ec47168e0eeab7d99adf0a8740cd0082c7aa | 665862c2164612029480bcd989726d1c097512d7 | refs/heads/master | 2021-01-15T22:41:46.607178 | 2012-12-31T10:33:21 | 2012-12-31T10:33:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package org.nosqlite4j.test;
import java.io.IOException;
import org.nosqlite4j.core.ddl.AlterTable;
public class TestAlterTable {
public static void main(String [] args) throws IOException
{
try{
AlterTable table = new AlterTable("telecom","telecom1");
table.alter();
AlterTable table1 = new AlterTable("telecom3", "kk", "GJ");
table1.alterColumnFamily();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
| [
"debarshi@debarshi-Inspiron-1525.(none)"
] | debarshi@debarshi-Inspiron-1525.(none) |
52b6f6a155558ea5aea7d76e8048db3d6d5543c9 | 9bac6b22d956192ba16d154fca68308c75052cbb | /icmsint-ejb/src/main/java/hk/judiciary/icmsint/model/sysinf/inf/gdnid2j/FixedPenaltyCostsCodeV10CT.java | aeb8cee02a2816d420542ba03297a5c10d27876b | [] | no_license | peterso05168/icmsint | 9d4723781a6666cae8b72d42713467614699b66d | 79461c4dc34c41b2533587ea3815d6275731a0a8 | refs/heads/master | 2020-06-25T07:32:54.932397 | 2017-07-13T10:54:56 | 2017-07-13T10:54:56 | 96,960,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,177 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.06.29 at 10:32:28 AM CST
//
package hk.judiciary.icmsint.model.sysinf.inf.gdnid2j;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* fixed penalty costs code applied to the standard offence description
*
* <p>Java class for FixedPenaltyCostsCode.V1.0.CT complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="FixedPenaltyCostsCode.V1.0.CT">
* <simpleContent>
* <restriction base="<CCT>Code.CT">
* </restriction>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FixedPenaltyCostsCode.V1.0.CT")
public class FixedPenaltyCostsCodeV10CT
extends CodeCT
{
}
| [
"chiu.cheukman@gmail.com"
] | chiu.cheukman@gmail.com |
29e080be3728c1d8278ba2ee722f377ee335b85a | 05815b2cef740c07db51e14116ea0525e0fbe07c | /mxupdate-update/tags/V0.4.0/src/org/mxupdate/update/userinterface/Table_mxJPO.java | f4a966c50dfeac232cc9dbd3119a3fd1b78fb5e9 | [
"Apache-2.0"
] | permissive | moxter/mxupdate-archive | c978dcadaf739fc2a389b71b0310ada19315dbdb | 0640f790da246976af6d420011eb77b2395267a7 | refs/heads/master | 2021-01-01T03:50:10.454294 | 2014-02-07T20:48:35 | 2014-02-07T20:48:35 | 57,129,728 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,527 | java | /*
* Copyright 2008-2009 The MxUpdate Team
*
* 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.
*
* Revision: $Rev$
* Last Changed: $Date$
* Last Changed By: $Author$
*/
package org.mxupdate.update.userinterface;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import org.mxupdate.mapping.TypeDef_mxJPO;
import org.mxupdate.update.util.ParameterCache_mxJPO;
/**
*
* @author The MxUpdate Team
* @version $Id$
*/
public class Table_mxJPO
extends AbstractUIWithFields_mxJPO
{
/**
* Defines the serialize version unique identifier.
*/
private static final long serialVersionUID = -518184934631890227L;
/**
* Constructor used to initialize the type definition enumeration.
*
* @param _typeDef defines the related type definition enumeration
* @param _mxName MX name of the administration object
*/
public Table_mxJPO(final TypeDef_mxJPO _typeDef,
final String _mxName)
{
super(_typeDef, _mxName);
}
/**
* Writes each column to the appendable instance.
*
* @param _paramCache parameter cache
* @param _out appendable instance to the TCL update file
* @throws IOException if the TCL update code could not be written
* @see AbstractUIWithFields_mxJPO.Field#write(Appendable)
*/
@Override
protected void writeObject(final ParameterCache_mxJPO _paramCache,
final Appendable _out)
throws IOException
{
for (final Field column : this.getFields()) {
_out.append(" \\\n column");
column.write(_out);
}
}
/**
* The method overwrites the original method to append the MQL statements
* in the <code>_preMQLCode</code> to reset this web table. Following steps
* are done:
* <ul>
* <li>remove all columns of the web table</li>
* <li>set to not hidden</li>
* </ul>
*
* @param _paramCache parameter cache
* @param _preMQLCode MQL statements which must be called before the
* TCL code is executed
* @param _postMQLCode MQL statements which must be called after the
* TCL code is executed
* @param _preTCLCode TCL code which is defined before the source
* file is sourced
* @param _tclVariables map of all TCL variables where the key is the
* name and the value is value of the TCL variable
* (the value is automatically converted to TCL
* syntax!)
* @param _sourceFile souce file with the TCL code to update
* @throws Exception if the update from derived class failed
*/
@Override
protected void update(final ParameterCache_mxJPO _paramCache,
final CharSequence _preMQLCode,
final CharSequence _postMQLCode,
final CharSequence _preTCLCode,
final Map<String,String> _tclVariables,
final File _sourceFile)
throws Exception
{
// set to not hidden
final StringBuilder preMQLCode = new StringBuilder()
.append("mod ").append(this.getTypeDef().getMxAdminName())
.append(" \"").append(this.getName()).append('\"')
.append(' ').append(this.getTypeDef().getMxAdminSuffix())
.append(" !hidden");
// remove all columns
for (final Field column : this.getFields()) {
preMQLCode.append(" column delete name \"").append(column.getName()).append('\"');
}
// append already existing pre MQL code
preMQLCode.append(";\n")
.append(_preMQLCode);
super.update(_paramCache, preMQLCode, _postMQLCode, _preTCLCode, _tclVariables, _sourceFile);
}
} | [
"tim.moxter@d6820e0a-e98e-11dd-b00f-9fabb4b2ff13"
] | tim.moxter@d6820e0a-e98e-11dd-b00f-9fabb4b2ff13 |
0d29dfbcca8240008e2561c342c0ba3efed19d82 | c55662f7984613fecbabf989b4e934bd30f6b51d | /Challenges/CriminalIntent/DateFormat/app/src/main/java/com/libertyleo/criminalintent/CrimeFragment.java | ef9bab3d28a253498c868328da88422064322124 | [
"MIT"
] | permissive | LibertyLeo/Android-Approach | 5afc21e20b8fd1c2ad289d1105c0ba37449c393e | a1c382dbd956bf4dbed7b720d1c4f4a3abd588ea | refs/heads/master | 2021-07-01T16:55:33.412440 | 2017-09-21T06:57:12 | 2017-09-21T06:57:12 | 100,349,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,286 | java | package com.libertyleo.criminalintent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
/**
* Created by Leo_Lei on 8/17/17.
*/
public class CrimeFragment extends Fragment {
private Crime mCrime;
private EditText mTitleField;
private Button mDateButton;
private CheckBox mSolvedCheckBox;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCrime = new Crime();
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_crime, container, false);
mTitleField = (EditText)v.findViewById(R.id.crime_title);
mTitleField.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
// This space intentionally left blank
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
mCrime.setTitle(charSequence.toString());
}
@Override
public void afterTextChanged(Editable editable) {
// This one too
}
});
mDateButton = (Button)v.findViewById(R.id.crime_date);
mDateButton.setText(DateFormat.format("EEEE,MMM dd, yyyy", mCrime.getDate()));
mDateButton.setEnabled(false);
mSolvedCheckBox = (CheckBox)v.findViewById(R.id.crime_solved);
mSolvedCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
mCrime.setSolved(b);
}
});
return v;
}
}
| [
"libertyleo@163.com"
] | libertyleo@163.com |
f1d5a68ac8e891a72453abb13cb61a90749db791 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/jdbi/learning/2580/ExtensionFactory.java | 70857ae5ae9ce2040397ca8337b2058dd11e3490 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,596 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jdbi.v3.core.extension;
/**
* Factory interface used to produce Jdbi extension objects.
*/
public interface ExtensionFactory {
/**
* @param extensionType the extension type
*
* @return whether the factory can produce an extension of the given type
*/
boolean accepts(Class<?> extensionType);
/**
* @param extensionType the extension type.
* @param handle Supplies the database handle. This supplier may lazily open a Handle on the first
* invocation. Extension implementors should take care not to fetch the handle before it is
* needed, to avoid opening handles unnecessarily.
* @param <E> the extension type
*
* @return an extension of the given type, attached to the given handle.
* @throws IllegalArgumentException if the extension type is not supported by this factory.
* @see org.jdbi.v3.core.Jdbi#onDemand(Class)
*/
<E> E attach(Class<E> extensionType, HandleSupplier handle);
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
48ec36a80842db725ed06d1026c7ad0ff304e9d2 | f071247ebc4978afb3c2d211f4338e47fa5b12c4 | /src/main/java/com/bmth/bean/Account.java | 3237ac5ca652d8423a283fc9a2c1ea22e0b470cb | [] | no_license | BMTHT/DepVLFull | 29e080909c1290fd536988a86d85bae492dabaa9 | 4e8e8b34aa0e7eb57ed90942e6aa6b1addb0d243 | refs/heads/master | 2016-09-14T11:19:57.356127 | 2016-05-16T12:54:23 | 2016-05-16T12:54:23 | 57,133,593 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,118 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.bmth.bean;
import java.util.Date;
/**
*
* @author BuiNgocTruong
*/
public class Account extends User{
private int id;
private String username;
private String password;
public Account() {
}
public Account(String fullName, String nickName, Date birthDay, int gender, String email, String address, String phoneNumber, String avatarUrl, String username, String password) {
super(fullName, nickName, birthDay, gender, email, address, phoneNumber, avatarUrl);
this.username = username;
this.password = password;
}
public Account(int userId, String fullName, String nickName, Date birthDay, int gender, String email, String address, String phoneNumber, String avatarUrl, String username, String password) {
super(userId, fullName, nickName, birthDay, gender, email, address, phoneNumber, avatarUrl);
this.username = username;
this.password = password;
}
public Account(int id, int userId, String fullName, String nickName, Date birthDay, int gender, String email, String address, String phoneNumber, String avatarUrl, String username, String password) {
super(userId, fullName, nickName, birthDay, gender, email, address, phoneNumber, avatarUrl);
this.id = id;
this.username = username;
this.password = password;
}
public Account(String fullName, String nickName, Date birthDay, int gender, String email, String address, String phoneNumber, String username, String password) {
super(fullName, nickName, birthDay, gender, email, address, phoneNumber);
this.username = username;
this.password = password;
}
public Account(int userId, String fullName, String nickName, Date birthDay, int gender, String email, String address, String phoneNumber, String username, String password) {
super(userId, fullName, nickName, birthDay, gender, email, address, phoneNumber);
this.username = username;
this.password = password;
}
public Account(int id, int userId, String fullName, String nickName, Date birthDay, int gender, String email, String address, String phoneNumber, String username, String password) {
super(userId, fullName, nickName, birthDay, gender, email, address, phoneNumber);
this.id = id;
this.username = username;
this.password = password;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"bachnq214@gmail.com"
] | bachnq214@gmail.com |
e7c16c5157d8df1fd6e3a0a50b2a3912d461776c | 9222ebfbe969b6974c78f8ef442e1517ecc2319e | /src/SmallestSubArray.java | 06813b5a9fcfd41ffb0f946e7c4b7d39b450a5c5 | [] | no_license | sriram1127/Algorithms | 49c9abd1825a348d1af9387400b779f68c836eb4 | 8e282e77a312be163eb332fdccf471220e2bb195 | refs/heads/master | 2021-09-07T17:16:54.562891 | 2018-02-26T18:18:34 | 2018-02-26T18:18:34 | 113,418,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java |
public class SmallestSubArray {
public static void main(String[] args) {
getSmallestSubArray(9, new int[] { 1, 10, 5, 2, 7 });
}
private static void getSmallestSubArray(int x, int[] arr) {
if (arr.length != 0) {
long minlen = arr.length + 1;
long tempSum = 0;
int length = 0;
for (int i = 0, j = 0; i < arr.length && j < arr.length;) {
tempSum += arr[j];
if (tempSum > x) {
minlen = Math.min(minlen, j - i + 1);
while (i <= j) {
if (tempSum - arr[i] > x) {
tempSum = tempSum - arr[i];
++i;
minlen = Math.min(minlen, j - i + 1);
} else {
++j;
break;
}
}
} else {
++j;
}
}
System.out.println(minlen);
}
// return -1;
}
}
| [
"sriram.itech@gmail.com"
] | sriram.itech@gmail.com |
25e832f535b0bbdb727ee6cd1e3ece331626d0c9 | b022716538738389eac324293d6af97a1afe7827 | /common/src/main/java/net/common/utils/filegenerator/FileGenerator.java | 8f98d208dcc2d3f6c5e88126d0ff3e583c313bef | [] | no_license | qatestifs/ifs-automation | b95ef8e4dbc0fdf23f7376698ffd87e7cc5801a6 | 919f8aa091ebdfb28c5918213f8e7a7756b4d868 | refs/heads/master | 2020-06-16T08:01:43.707112 | 2016-12-02T10:40:46 | 2016-12-02T10:40:46 | 75,124,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,794 | java | package net.common.utils.filegenerator;
import java.io.*;
import java.util.Random;
/**
* Created by Ajay on 27/11/2016.
*/
public class FileGenerator {
public static File file;
public static void generateFile(String fileName, String size){
try {
//Size in Gbs of my file that I want
double wantedSize = Double.parseDouble(System.getProperty("size", size));
Random random = new Random();
file = new File(fileName);
System.out.println(file.getAbsoluteFile());
long start = System.currentTimeMillis();
PrintWriter writer = null;
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")), false);
int counter = 0;
while (true) {
String sep = "";
for (int i = 0; i < 100; i++) {
int number = random.nextInt(1000) + 1;
writer.print(sep);
writer.print(number / 1e3);
sep = " ";
}
writer.println();
//Check to see if the current size is what we want it to be
if (++counter == 20000) {
// System.out.printf("Size: %.3f GB%n", file.length() / 1e9);
if (file.length() >= wantedSize * 1e9) {
writer.close();
break;
} else {
counter = 0;
}
}
}
long time = System.currentTimeMillis() - start;
System.out.printf("Took %.1f seconds to create a file of %.3f GB", time / 1e3, file.length() / 1e9);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}}
}
| [
"ajay4hyd@gmail.com"
] | ajay4hyd@gmail.com |
e1996be681cb3b5685e485eba1d66a78ffc679ce | 8f5853cf7c203c0fbdd2421db6f8a47c6dc59bd2 | /src/main/java/datos/Conexion.java | 6aaa3ed8bb23b8883b57a0c2cf4fa5d452debea7 | [] | no_license | joser998/JavaWeb-19-ControlClientes-Ubaldo--Curso | 6428a24a34b358be1f57b1f0fea011698430b5b2 | cb3da59e8b2d6c59645df975372a99ebf54bd604 | refs/heads/main | 2022-12-31T11:55:56.731828 | 2020-10-23T21:17:29 | 2020-10-23T21:17:29 | 306,748,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,242 | java | package datos;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
//Esta clase corresponde a la capa logica de datos
//es para establecer conexion con la base de datos...
public class Conexion {
private static final String JDBC_URL = "jdbc:mysql://localhost:3306/control_clientes?useSSL=false&useTimezone=true&serverTimezone=UTC&allowPublicKeyRetrieval=true";
private static final String JDBC_USER = "root";
private static final String JDBC_PASSWORD = "admin";
/*Explicacion Pool de Conexiones:
El pool coge una de las conexiones que ya tiene abierta, la marca como que
alguien la está usando para no dársela a nadie más y la devuelve.
La siguiente llamada a este método pool.getConnection(), buscará una
conexión libre para marcarla como ocupada y la devolverá ... y así
sucesivamente...
*/
/*
Cuando el que ha pedido la conexión termina de usarla, normalmente después de
una transacción con la base de datos o varias seguidas, llama al método
connection.close().
Esta conexión que nos ha sido entregada por el pool, realmente no se cierra
con esta llamada. El método close() únicamente avisa al pool que ya hemos
terminado con la conexión, de forma que sin cerrarla, la marca como libre
para poder entregársela a otro que lo pida, sigue el siguiente esquema:
Se le pide al pool una conexion libre
Connection conexion = pool.getConnection();
Se hace una o más transacciones: select, update, insert, delete ...
Se libera la conexión para su posible uso por otro hilo
conexion.close();
*/
//Esta es la configuracion de este pool de conexiones
//retorna un objeto de tipo DataSource
public static DataSource getDataSource(){
BasicDataSource ds = new BasicDataSource();
ds.setUrl(JDBC_URL);
ds.setUsername(JDBC_USER);
ds.setPassword(JDBC_PASSWORD);
//el pool se inicia con 50 conexiones
ds.setInitialSize(50);
return ds;
}
//Metodo para obtener una conexion hacia la base de datos
public static Connection getConnection() throws SQLException{
return getDataSource().getConnection();
}
//para cerrar el objeto resultset
public static void close(ResultSet rs){
try {
rs.close();
} catch (SQLException ex) {
//se manda esta excepcion a la salida estandar
ex.printStackTrace(System.out);
}
}
//para cerrar un objeto de tipo PreparedStatement
public static void close(PreparedStatement stmt){
try {
stmt.close();
} catch (SQLException ex) {
ex.printStackTrace(System.out);
}
}
//para cerrar objeto de tipo conexion
public static void close(Connection conn){
try {
conn.close();
} catch (SQLException ex) {
ex.printStackTrace(System.out);
}
}
} | [
"jlr_99@live.com"
] | jlr_99@live.com |
bcc5e420cb43416235ff1eaef6dba05bae2d807f | 935b6063f73e5f91c867f9ea0e1e4f2d3b461048 | /ScotiaFlights/test/IslandPassengerTest.java | cf9788b31ec01891b8f36df2e3adc81dc4bbb5c1 | [] | no_license | struang93/Java_flight_system | 392d09652d2072fb6900b4b38baa738de9f6b8fa | 25c6263e012897036864a672da62b590b3f8b7eb | refs/heads/master | 2020-05-02T21:03:15.242231 | 2019-05-12T12:10:59 | 2019-05-12T12:10:59 | 178,208,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,999 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
*
* @author struan
*/
public class IslandPassengerTest {
public IslandPassengerTest() {
}
@BeforeAll
public static void setUpClass() {
}
@AfterAll
public static void tearDownClass() {
}
/**
* Test of GetName method, of class IslandPassenger.
*/
@Test
public void testGetName() {
System.out.println("GetName");
IslandPassenger instance = new IslandPassenger();
String expResult = "";
String result = instance.GetName();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of GetEmail method, of class IslandPassenger.
*/
@Test
public void testGetEmail() {
System.out.println("GetEmail");
IslandPassenger instance = new IslandPassenger();
String expResult = "";
String result = instance.GetEmail();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of GetDiscount method, of class IslandPassenger.
*/
@Test
public void testGetDiscount() {
System.out.println("GetDiscount");
IslandPassenger instance = new IslandPassenger();
float expResult = 0.0F;
float result = instance.GetDiscount();
assertEquals(expResult, result, 0.0);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of GetIsland method, of class IslandPassenger.
*/
@Test
public void testGetIsland() {
System.out.println("GetIsland");
IslandPassenger instance = new IslandPassenger();
String expResult = "";
String result = instance.GetIsland();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of ReturnName method, of class IslandPassenger.
*/
@Test
public void testReturnName() {
System.out.println("ReturnName");
IslandPassenger instance = new IslandPassenger();
String expResult = "";
String result = instance.ReturnName();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of ReturnEmail method, of class IslandPassenger.
*/
@Test
public void testReturnEmail() {
System.out.println("ReturnEmail");
IslandPassenger instance = new IslandPassenger();
String expResult = "";
String result = instance.ReturnEmail();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of ReturnDiscount method, of class IslandPassenger.
*/
@Test
public void testReturnDiscount() {
System.out.println("ReturnDiscount");
IslandPassenger instance = new IslandPassenger();
float expResult = 0.0F;
float result = instance.ReturnDiscount();
assertEquals(expResult, result, 0.0);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of DisplayDetails method, of class IslandPassenger.
*/
@Test
public void testDisplayDetails() {
System.out.println("DisplayDetails");
IslandPassenger instance = new IslandPassenger();
instance.DisplayDetails();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of returnIsland method, of class IslandPassenger.
*/
@Test
public void testReturnIsland() {
System.out.println("returnIsland");
IslandPassenger instance = new IslandPassenger();
String expResult = "";
String result = instance.returnIsland();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}
| [
"noreply@github.com"
] | struang93.noreply@github.com |
16e6ff3ddf472122c3ce44bfd2aaa47a4c9a2562 | 8833e3727fdd954a303c9c290a838bb2743228c4 | /src/main/java/fiap/sjc/labs/rest/exceptions/RecursoNaoEncontradoException.java | 710eb3d4889a2172e04f7c877d8f9bd551732fb2 | [
"Apache-2.0"
] | permissive | prof-eduardo-galego/fiap-38scj-rest | 74cfb9694ee4997e35fd3710a40adb1cd018bad3 | aad6c7d613d8b299287b0f9f96fb893737789920 | refs/heads/main | 2023-04-04T20:20:48.180175 | 2021-04-16T21:33:43 | 2021-04-16T21:33:43 | 352,093,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package fiap.sjc.labs.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(code = HttpStatus.NOT_FOUND)
public class RecursoNaoEncontradoException extends RuntimeException {
public RecursoNaoEncontradoException(String message) {
super(message);
}
}
| [
"profeduardo.galego@fiap.com.br"
] | profeduardo.galego@fiap.com.br |
7b73611dc21007a52e3c942899c9a597ab244f65 | bbed3cad4c0c978f3c2dfc6af540dd6d6b0e7674 | /bsfmerchantsversionapp/src/main/java/com/bs/john_li/bsfmerchantsversionapp/Utils/PrinterCallback.java | 615bf012f9a606928077046eed1da78515ddef6f | [] | no_license | 17710622616/BSFSlotMachine | c53ccfa5e7b05d1eaa2bd3a9ba069a3f6e5b5566 | f62f8f2b4fa5894344724279210b3073d3c4bb2a | refs/heads/master | 2021-01-02T08:17:23.303759 | 2019-03-21T10:22:00 | 2019-03-21T10:22:00 | 98,985,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | package com.bs.john_li.bsfmerchantsversionapp.Utils;
/**
* Created by Administrator on 2017/6/12.
*/
public interface PrinterCallback {
String getResult();
void onReturnString(String result);
}
| [
"m17710622616@163.com"
] | m17710622616@163.com |
763b3937fbdebeffb0e5a404f5aa93f6af490401 | 445481e4c326668e0340b8b512f9df8f5ce4430d | /src/ModifyBook.java | 86abfa5dd35beb9e99209c10f3433151aa036a0e | [] | no_license | QingyiHuang/java-gui-mysql | 7d5bc5f3fbc11195b7f11ab7f47252ca363035b3 | 5eb7b03d6ee6a56d66a6876c279827570e0d8f12 | refs/heads/master | 2021-01-21T14:48:35.715969 | 2017-06-25T04:00:12 | 2017-06-25T04:00:12 | 95,337,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,888 | java | /**
* Created by Administrator on 2017/6/23.
*/
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.border.TitledBorder;
import com.mysql.jdbc.PreparedStatement;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import java.sql.SQLException;
public class ModifyBook extends JFrame {
private JPanel contentPane;
private JTextField id_textField;
private JTextField name_textField;
private JTextField age_textField;
private JTextField school_textField;
private Student stu;
private DataBase dBase;
private Connection connection;
private java.sql.PreparedStatement ps;
private JComboBox comboBox;
/**
* Create the frame.
*/
public ModifyBook(final Student stu) {
dBase=new DataBase();
connection=dBase.getCon();
this.stu=stu;
setResizable(false);
setDefaultCloseOperation(this.DISPOSE_ON_CLOSE);
setBounds(100, 100, 185, 275);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel label_2 = new JLabel("\u4FE1\u606F\u4FEE\u6539");
//label_2.setFont(new Font("楷体", Font.PLAIN, 23));
label_2.setBounds(35, 10, 92, 32);
contentPane.add(label_2);
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(null, "\u4FE1\u606F\u4FEE\u6539", TitledBorder.LEADING, TitledBorder.TOP, null, Color.GREEN));
panel.setBounds(10, 52, 159, 186);
contentPane.add(panel);
panel.setLayout(null);
JLabel label = new JLabel("\u5B66\u53F7\uFF1A");
label.setBounds(10, 21, 52, 15);
panel.add(label);
JLabel label_1 = new JLabel("\u59D3\u540D\uFF1A");
label_1.setBounds(10, 50, 52, 15);
panel.add(label_1);
JLabel label_3 = new JLabel("\u6027\u522B\uFF1A");
label_3.setBounds(10, 75, 52, 15);
panel.add(label_3);
JLabel label_4 = new JLabel("\u5E74\u9F84\uFF1A");
label_4.setBounds(10, 100, 52, 15);
panel.add(label_4);
JLabel label_5 = new JLabel("\u5B66\u9662\uFF1A");
label_5.setBounds(10, 125, 52, 15);
panel.add(label_5);
id_textField = new JTextField(stu.getStuID());
id_textField.setBounds(72, 18, 66, 21);
id_textField.setEditable(false);
panel.add(id_textField);
id_textField.setColumns(10);
name_textField = new JTextField(stu.getStuName());
name_textField.setColumns(10);
name_textField.setBounds(72, 47, 66, 21);
panel.add(name_textField);
age_textField = new JTextField(stu.getStuAge()+"");
age_textField.setColumns(10);
age_textField.setBounds(72, 97, 66, 21);
panel.add(age_textField);
school_textField = new JTextField(stu.getStuSchool());
school_textField.setColumns(10);
school_textField.setBounds(72, 122, 66, 21);
panel.add(school_textField);
comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(new String[] {"\u7537", "\u5973"}));
if(stu.getStuSex().equals("女")){
comboBox.setSelectedIndex(1);
}
comboBox.setBounds(72, 72, 66, 21);
panel.add(comboBox);
JButton button = new JButton("\u786E\u5B9A");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(checkdatas()){
try {
System.out.println(stu.getStuID()+stu.getStuName()+stu.getStuSex()+stu.getStuSchool());
ps=connection.prepareStatement("update student set stuName=? ,stuAge=?, stuSex=? , stuSchool=? where stuId=?");
ps.setString(1, name_textField.getText());
ps.setString(2, age_textField.getText());
ps.setString(3, comboBox.getSelectedItem().toString());
ps.setString(4, school_textField.getText());
ps.setString(5, id_textField.getText());
connection.setAutoCommit(false);
ps.executeUpdate();
connection.commit();
JOptionPane.showMessageDialog(null, "信息更新成功!");
setVisible(false);
} catch (SQLException e1) {
JOptionPane.showMessageDialog(null, "信息修改时出现错误!");
try {
connection.rollback();
} catch (SQLException e2) {
JOptionPane.showMessageDialog(null, "信息修改时出现错误!");
e2.printStackTrace();
}
e1.printStackTrace();
}
}}
});
button.setBounds(55, 153, 67, 23);
panel.add(button);
}
private boolean checkdatas(){
//该方法用来检查进行数据添加的时候是否各个输入都是合法的
boolean result=true;
// String stuId=id_textField.getText();
String stuName=name_textField.getText();
String stuAge=age_textField.getText();
String stuSchool=school_textField.getText();
if(stuName==null||stuName.equals("")){
JOptionPane.showMessageDialog(null, "姓名不能为空!");
name_textField.requestFocus();
result=false;
}
else if(stuAge==null||stuAge.equals("")){
JOptionPane.showMessageDialog(null, "年龄不能为空!");
age_textField.requestFocus();
result=false;
}
else if(stuSchool==null||stuSchool.equals("")){
JOptionPane.showMessageDialog(null, "学校不能为空!");
school_textField.requestFocus();
result=false;
}
else {
try {
int age=Integer.parseInt(stuAge);
if(age<=0||age>=100){
JOptionPane.showMessageDialog(null, "输入的年龄必须介于0~100之间!");
result=false;
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "年龄格式出现错误!");
result=false;
}
}
return result;
}
}
| [
"297947067@qq.com"
] | 297947067@qq.com |
dd913e940fc5ac4ddc50d1852bfc2a45d18c6c2f | 8a766f19166e5c748f304aa3d07e6d8e07b9f887 | /securityjpademo/src/main/java/com/mani/security/SecurityConfiguer.java | f2730b2ee494d8930d05b0f3817d6e47c7c38c69 | [] | no_license | manikandanravi94/sample-spring-security | a8f0fbc4b081a26c4becfe38359a7fdb9cbbaf85 | 3bae43b025dc436f083f44cfe221bbd1b3a41bb1 | refs/heads/master | 2022-12-16T10:57:54.683823 | 2020-09-05T19:01:36 | 2020-09-05T19:01:36 | 292,427,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,428 | java | package com.mani.security;
import com.mani.service.LocalUserDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@EnableWebSecurity
public class SecurityConfiguer extends WebSecurityConfigurerAdapter {
@Autowired
private LocalUserDetailService userDetailService;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailService);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/user").hasRole("USER")
.antMatchers("/**").hasRole("ADMIN")
.antMatchers("/").permitAll().and().formLogin();
}
@Bean
protected PasswordEncoder getPasswordEncoder(){
return NoOpPasswordEncoder.getInstance();
}
}
| [
"manikandanravi94@gmail.com"
] | manikandanravi94@gmail.com |
ca66c67e46684df0781ad79afe4eb85445df735b | 02b9e67924601856e13c86164eb469b5e664f8e2 | /2019-06-12-simulazione/src/it/polito/tdp/food/model/TestModel.java | 48da2c903fcef0ba4650928929ab6e6ca763b859 | [] | no_license | mscivoli/Simulazione-2 | d926f59f57d9902a6e4fa6514f1cf74ece6f1795 | 5bfedd70d2b11d02171f1d2dc7b0b2cf0edad50f | refs/heads/master | 2020-06-17T21:01:52.250442 | 2019-07-09T17:21:52 | 2019-07-09T17:21:52 | 196,052,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package it.polito.tdp.food.model;
import java.util.Map;
import it.polito.tdp.food.db.Condiment;
public class TestModel {
public static void main(String[] args) {
Model m = new Model();
m.creaGrafo(37);
for(Condiment c : m.insiemeMigliore(91406500)) {
System.out.println(c.toString());
}
}
}
| [
"matteoscivoli@mbp-di-matteo-2.homenet.telecomitalia.it"
] | matteoscivoli@mbp-di-matteo-2.homenet.telecomitalia.it |
ce3738fe6a9f9be628c17cfb40c66da1bca67041 | 8122409d3d5ec087ecdcf429d9f213ddabd19a64 | /app/src/main/java/com/cpigeon/book/widget/mydialog/LocalShareDialogFragment.java | 08d9e5e4d98a3c2a78ae01a740825148c4bddd85 | [] | no_license | xiaohl-902/PSpectrumAndroid | 69779c2813f0c0f45354d6182e47c16c4024e702 | 365d6015c2cbbf985b14b7e7009d0b893a4790ed | refs/heads/master | 2020-04-06T13:09:13.919105 | 2018-11-14T03:43:57 | 2018-11-14T03:43:57 | 157,486,399 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,083 | java | package com.cpigeon.book.widget.mydialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;
import com.base.util.Lists;
import com.base.util.utility.ToastUtils;
import com.cpigeon.book.R;
import com.cpigeon.book.util.SendWX;
import java.io.File;
import java.io.FileNotFoundException;
/**
* Created by Administrator on 2017/1/7.
* 分享Fragment
*/
public class LocalShareDialogFragment extends DialogFragment {
private ImageButton imgbtn_wx, imgbtn_pyq, imgbtn_qq, imgbtn_qqz;//分享按钮
private Button btn_cancel;//取消
private View.OnClickListener clickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.imgbtn_wx:
//微信分享
share2WX();
LocalShareDialogFragment.this.dismiss();
break;
case R.id.imgbtn_pyq:
//微信朋友圈
break;
case R.id.imgbtn_qq:
//QQ
share2QQ();
LocalShareDialogFragment.this.dismiss();
break;
case R.id.imgbtn_qqz:
//QQ空间
break;
case R.id.btn_cancel:
dismiss();
break;
}
}
};
private String TAG = "ShareDialogFragment";
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// 使用不带Theme的构造器, 获得的dialog边框距离屏幕仍有几毫米的缝隙。
Dialog dialog = new Dialog(getActivity(), R.style.BottomDialog);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // 设置Content前设定
dialog.setContentView(R.layout.layout_share_dialog);
dialog.setCanceledOnTouchOutside(true); // 外部点击取消
// 设置宽度为屏宽, 靠近屏幕底部。
final Window window = dialog.getWindow();
assert window != null;
window.setWindowAnimations(R.style.AnimBottomDialog);
final WindowManager.LayoutParams lp = window.getAttributes();
lp.gravity = Gravity.BOTTOM; // 紧贴底部
lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度持平
// lp.height = getActivity().getWindowManager().getDefaultDisplay().getHeight() * 2 / 5;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(lp);
initView(dialog);
return dialog;
}
private void initView(Dialog dialog) {
imgbtn_wx = (ImageButton) dialog.findViewById(R.id.imgbtn_wx);
imgbtn_pyq = (ImageButton) dialog.findViewById(R.id.imgbtn_pyq);
imgbtn_qq = (ImageButton) dialog.findViewById(R.id.imgbtn_qq);
imgbtn_qqz = (ImageButton) dialog.findViewById(R.id.imgbtn_qqz);
btn_cancel = (Button) dialog.findViewById(R.id.btn_cancel);
imgbtn_pyq.setVisibility(View.GONE);
imgbtn_qqz.setVisibility(View.GONE);
imgbtn_wx.setOnClickListener(clickListener);
imgbtn_pyq.setOnClickListener(clickListener);
imgbtn_qq.setOnClickListener(clickListener);
imgbtn_qqz.setOnClickListener(clickListener);
btn_cancel.setOnClickListener(clickListener);
}
//本地分享
private boolean isUM = true;
private String localFilePath = "";
private String fileType = "video";
public void setFileType(String fileType) {
this.fileType = fileType;
}
public void setIsUM(boolean isUMShare) {
this.isUM = isUMShare;
}
public void setLocalFilePath(String localFilePath) {
this.localFilePath = localFilePath;
}
public void share2QQ() {
try {
checkFileUriExposure();
Intent qqIntent = new Intent(Intent.ACTION_SEND);
qqIntent.setPackage("com.tencent.mobileqq");
qqIntent.setClassName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.JumpActivity");
File file = new File(localFilePath);
if (fileType.equals("video")) {
qqIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(localFilePath));
qqIntent.setType("video/*");
startActivity(qqIntent);
} else {
qqIntent.putExtra(Intent.EXTRA_STREAM, insertImageToSystem(getActivity(), localFilePath));
qqIntent.setType("image/*");
startActivity(Intent.createChooser(qqIntent, "图片分享"));
}
} catch (Exception e) {
Log.d(TAG, "share2WX: " + e.getLocalizedMessage());
}
}
public void share2WX() {
try {
checkFileUriExposure();
if (SendWX.isWeixinAvilible(getActivity())) {
ComponentName comp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.tools.ShareImgUI");
Intent shareIntent = new Intent();
shareIntent.setComponent(comp);
shareIntent.putExtra("Kdescription", "11");
File file = new File(localFilePath);
if (fileType.equals("video")) {
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("video/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(localFilePath)));
startActivity(Intent.createChooser(shareIntent, "分享"));
} else {
shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
shareIntent.putExtra(Intent.EXTRA_STREAM, Lists.newArrayList(Uri.parse(insertImageToSystem(getActivity(), localFilePath))));
shareIntent.setType("image/*");
startActivity(Intent.createChooser(shareIntent, "分享"));
}
} else {
ToastUtils.showLong(getActivity(), "请先安装微信APP");
}
} catch (Exception e) {
Log.d(TAG, "share2WX: " + e.getLocalizedMessage());
}
}
/**
* 分享前必须执行本代码,主要用于兼容SDK18以上的系统
*/
private static void checkFileUriExposure() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
builder.detectFileUriExposure();
}
}
private static String insertImageToSystem(Context context, String imagePath) {
String url = "";
try {
url = MediaStore.Images.Media.insertImage(context.getContentResolver(), imagePath, "ic", "你对图片的描述");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return url;
}
// public void share2QQ_Z() {
// try {
// Intent qqIntent = new Intent(Intent.ACTION_SEND);
// qqIntent.setPackage("com.tencent.mobileqq");
// ComponentName comp = new ComponentName("com.qzone", "com.qzonex.module.maxvideo.activity.QzonePublishVideoActivity");
// qqIntent.setComponent(comp);
// File file = new File(localFilePath);
// System.out.println("file " + file.exists());
// qqIntent.putExtra(Intent.EXTRA_STREAM, getImageContentUri(file));
// qqIntent.setType("*/*");
// startActivity(qqIntent);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
//
//
// public void share2WX_pyq() {
// try {
// ComponentName comp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.tools.ShareToTimeLineUI");
// Intent shareIntent = new Intent();
// shareIntent.setComponent(comp);
// shareIntent.setAction(Intent.ACTION_SEND);
// File file = new File(localFilePath);
// shareIntent.putExtra(Intent.EXTRA_STREAM, getImageContentUri(file));
// shareIntent.setType("*/*");
// startActivity(Intent.createChooser(shareIntent, "分享"));
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
/**
* 转换 content:// uri
*
* @param imageFile
* @return
*/
public Uri getImageContentUri(File imageFile) {
String filePath = imageFile.getAbsolutePath();
Cursor cursor = getActivity().getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[]{MediaStore.Images.Media._ID},
MediaStore.Images.Media.DATA + "=? ",
new String[]{filePath}, null);
if (cursor != null && cursor.moveToFirst()) {
int id = cursor.getInt(cursor
.getColumnIndex(MediaStore.MediaColumns._ID));
Uri baseUri = Uri.parse("content://media/external/images/media");
return Uri.withAppendedPath(baseUri, "" + id);
} else {
if (imageFile.exists()) {
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATA, filePath);
return getActivity().getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
} else {
return null;
}
}
}
}
| [
"656452024@qq.com"
] | 656452024@qq.com |
bd3871ee33c9b2246d65f706ace056e80f088cfa | 704507754a9e7f300dfab163e97cd976b677661b | /src/com/sun/corba/se/spi/activation/LocatorOperations.java | b1099ddcea691b341ecff91bbd11fa101fe88e46 | [] | no_license | ossaw/jdk | 60e7ca5e9f64541d07933af25c332e806e914d2a | b9d61d6ade341b4340afb535b499c09a8be0cfc8 | refs/heads/master | 2020-03-27T02:23:14.010857 | 2019-08-07T06:32:34 | 2019-08-07T06:32:34 | 145,785,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,539 | java | package com.sun.corba.se.spi.activation;
/**
* com/sun/corba/se/spi/activation/LocatorOperations.java . Generated by the
* IDL-to-Java compiler (portable), version "3.2" from
* c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u144/9417/corba/src/share/
* classes/com/sun/corba/se/spi/activation/activation.idl Friday, July 21, 2017
* 9:58:51 PM PDT
*/
public interface LocatorOperations {
// Starts the server if it is not already running.
com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation locateServer(int serverId, String endPoint)
throws com.sun.corba.se.spi.activation.NoSuchEndPoint,
com.sun.corba.se.spi.activation.ServerNotRegistered,
com.sun.corba.se.spi.activation.ServerHeldDown;
// Starts the server if it is not already running.
com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB locateServerForORB(int serverId,
String orbId) throws com.sun.corba.se.spi.activation.InvalidORBid,
com.sun.corba.se.spi.activation.ServerNotRegistered,
com.sun.corba.se.spi.activation.ServerHeldDown;
// get the port for the endpoint of the locator
int getEndpoint(String endPointType) throws com.sun.corba.se.spi.activation.NoSuchEndPoint;
// to pick a particular port type.
int getServerPortForType(com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB location,
String endPointType) throws com.sun.corba.se.spi.activation.NoSuchEndPoint;
} // interface LocatorOperations
| [
"jianghao7625@gmail.com"
] | jianghao7625@gmail.com |
f9326bad5ab60877a446ceed45d7a3986bf56b3c | 773ad8dbd00e4b7bfe0795b4bbc2b3f138ae9d26 | /ConfiguraFacil/src/Interface/Admin_Geral.java | f13d01c18ee6401fd8396c4046ecbc1b54e2f44a | [] | no_license | diogofbraga/ConfiguraFacil | ee49bfb33d55a34818abc26f6538c6d8be830fdb | 847bf82f1ed9bfc553bf4cea4ce405694c189274 | refs/heads/master | 2020-04-19T21:23:40.656281 | 2019-01-31T01:15:44 | 2019-01-31T01:15:44 | 168,439,917 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,088 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Interface;
/**
*
* @author joao
*/
public class Admin_Geral extends javax.swing.JFrame {
/**
* Creates new form Admin_Geral
*/
public Admin_Geral() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList<>();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jList1.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = {};
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
jScrollPane1.setViewportView(jList1);
jButton1.setText("Logout");
jButton2.setText("Adicionar Funcionário");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Remover Funcionário");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(55, 55, 55)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton3)
.addGap(18, 18, 18)
.addComponent(jButton2)
.addGap(11, 11, 11)
.addComponent(jButton1)
.addGap(71, 71, 71))
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 490, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(55, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(43, 43, 43)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 56, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(26, 26, 26))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Admin_Geral.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Admin_Geral.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Admin_Geral.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Admin_Geral.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Admin_Geral().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JList<String> jList1;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}
| [
"noreply@github.com"
] | diogofbraga.noreply@github.com |
a2d2e07e5db6020d53f11d00531a3147a2d4c0f4 | 70d5f5402e43602f915cc4aa367ca814ab2752e8 | /app/src/main/java/com/example/mobilecodingchallenge/model/Center.java | 840330afda88e0f6a74e516b4c8e92ff9d203bc7 | [] | no_license | qingbo93/YelpAppMobileChallenge | a8a455ed2d75bc9f2ef077302b3b2f42976c1e86 | 13dbf12e189c7c40c7d33f521431d41c6cb02e40 | refs/heads/master | 2023-01-24T11:26:22.210633 | 2020-12-14T15:07:22 | 2020-12-14T15:07:22 | 321,384,045 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | package com.example.mobilecodingchallenge.model;
import java.io.Serializable;
public class Center extends Coordinates implements Serializable {
}
| [
"qingbo1993@gmail.com"
] | qingbo1993@gmail.com |
98c1f3ccfc56028537bdbe3b8169f362b76f9648 | b92f3bc48278f1064129d010d4b4aa9f3d38a817 | /common/MonthlyTimer.java | 71fe7798f5f0ed9cf29b80d92ee882867289e597 | [] | no_license | Elita1114/Software-Engineering-Project | 1f7eeb7599c15772918de391482f22ebb525ce5d | 47f011f767171ee8dfa06ca6b01c368ec17cc7ff | refs/heads/master | 2020-11-25T18:00:41.409315 | 2020-01-29T06:05:02 | 2020-01-29T06:05:02 | 228,782,999 | 0 | 0 | null | 2020-01-29T06:05:04 | 2019-12-18T07:27:43 | Java | UTF-8 | Java | false | false | 2,123 | java | package common;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Date;
import java.util.Calendar;
public class MonthlyTimer {
// What to do
private final Runnable whatToDo;
// when
private final int dayOfMonth;
private final int hourOfDay;
// The current timer
private Timer current = new Timer();//to avoid NPE
public void cancelCurrent() {
current.cancel();// cancel this execution;
current.purge(); // removes the timertask so it can be gc'ed
}
// create a new instance
public static MonthlyTimer schedule( Runnable runnable, int dayOfMonth, int hourOfDay ) {
return new MonthlyTimer( runnable, dayOfMonth, hourOfDay );
}
private MonthlyTimer(Runnable runnable, int day, int hour ) {
this.whatToDo = runnable;
this.dayOfMonth = day;
this.hourOfDay = hour;
schedule();
}
// Schedules the task for execution on next month.
private void schedule() {
// Do you mean like this?
// cancelCurrent();
current = new Timer(); // assigning a new instance
// will allow the previous Timer to be gc'ed
System.out.println("in schedule ");
current.schedule( new TimerTask() {
public void run() {
try {
whatToDo.run();
} finally {
schedule();// schedule for the next month
}
}
} , nextDate() );
}
// Do the next date stuff
private Date nextDate() {
System.out.println("getting next date");
Calendar runDate = Calendar.getInstance();
runDate.set(Calendar.DAY_OF_MONTH, this.dayOfMonth);
runDate.set(Calendar.HOUR_OF_DAY, this.hourOfDay);
runDate.set(Calendar.MINUTE, 0);
runDate.set(Calendar.SECOND, 0);
runDate.add(runDate.MONTH, 1);//set to next month
System.out.println("The next run date is "+ runDate.getTime());
return runDate.getTime();
}
} | [
"messermanbenjamin@gmail.com"
] | messermanbenjamin@gmail.com |
2c10b7fd58025ff022f15f43f07a0178b78e497f | bca5036b1399af44e81408262662936881c42310 | /src/proyecto2/EstacionDesconocida.java | 8f3ef937d23a2b665e7f809138bb266827816138 | [] | no_license | valenc3x/SpaniardSearch | 7ccb3e6cafc705c297c6e3f6699a200be9fec81d | e694f7647df17d25f078ec8b6fc0c67dc5e9871d | refs/heads/master | 2021-01-15T15:53:50.418570 | 2015-06-17T20:56:45 | 2015-06-17T20:56:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package proyecto2;
public class EstacionDesconocida extends Exception {
/**
*
*/
private String faltante;
public EstacionDesconocida(String nombre) {
this.faltante = nombre;
}
@Override
public String toString() {
return "No existe la estacion " + this.faltante;
}
}
| [
"ricardo.ivan91@gmail.com"
] | ricardo.ivan91@gmail.com |
ee6379325ee70dad88310eb7e739f2ca271043e0 | 79ac6c111742abe454f9a02f1e04b9a84113f112 | /src/com/part1/ArrayList/groceryList/MainGroceryList.java | b619b0126feff347760432f7bd8f904f66ae1421 | [] | no_license | Abdullah-ohida/Algorithm-Data-Structure | aab8b14c661fbf5ce5f0c3239832d51ec872452f | 1ecaf9e5df007d433ac5e6d4c5894079e076bdad | refs/heads/main | 2023-02-23T04:07:25.134549 | 2021-01-25T00:12:22 | 2021-01-25T00:12:22 | 332,585,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,490 | java | package com.part1.ArrayList.groceryList;
import java.util.Scanner;
public class MainGroceryList {
private static Scanner scanner = new Scanner(System.in);
private static GroceryList groceryList = new GroceryList();
public static void main(String[] args) {
boolean quit = false;
int choice = 0;
printInstructions();
while (!quit){
System.out.print("Enter your choice : ");
choice = scanner.nextInt();
scanner.nextLine();
switch (choice) {
case 0 -> printInstructions();
case 1 -> groceryList.printGroceryList();
case 2 -> addItem();
case 3 -> modifyItem();
case 4 -> removeItem();
case 5 -> searchForItem();
case 6 -> quit = true;
}
}
}
public static void printInstructions(){
System.out.println("\nPress");
System.out.println("\t 0 - To print choice option.");
System.out.println("\t 1 - To print the list of the grocery items.");
System.out.println("\t 2 - To add an item to the grocery list.");
System.out.println("\t 3 - To modify an item in the grocery list.");
System.out.println("\t 4 - To remove an item in the grocery list.");
System.out.println("\t 5 - To search for item in the grocery list.");
System.out.println("\t 6 - To quit the application.");
}
public static void addItem(){
System.out.print("Please enter the grocery item : ");
groceryList.addGroceryItem(scanner.nextLine());
}
public static void modifyItem(){
System.out.print("Current item name: ");
String currentItem = scanner.nextLine();;
System.out.print("new item name : ");
String newItem = scanner.nextLine();
groceryList.modifyGroceryItem(currentItem, newItem);
}
public static void removeItem(){
System.out.println("Enter remove item: ");;
String remove = scanner.nextLine();;
groceryList.removeGroceryItem(remove);
}
public static void searchForItem(){
System.out.print("Item to search for: ");
String searchItem = scanner.nextLine();
if(groceryList.onFile(searchItem)){
System.out.println("Found " + searchItem + " in or grocery list");
}else{
System.out.println(searchItem + " is not found in the shopping list");
}
}
}
| [
"ohida2001@gmail.com"
] | ohida2001@gmail.com |
3a745630aa2cf0c54a3e5d0dde890d10fa8bfc58 | 281fc20ae4900efb21e46e8de4e7c1e476f0d132 | /test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf6547/Test.java | a2c6aab12ed8e6c00a107d990a71704264cb76e6 | [] | no_license | nuxeo/richfaces-3.3 | c23b31e69668810219cf3376281f669fa4bf256f | 485749c5f49ac6169d9187cc448110d477acab3b | refs/heads/master | 2023-08-25T13:27:08.790730 | 2015-01-05T10:42:11 | 2015-01-05T10:42:11 | 10,627,040 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,379 | java | /**
* License Agreement.
*
* Rich Faces - Natural Ajax for Java Server Faces (JSF)
*
* Copyright (C) 2007 Exadel, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.testng.rf6547;
import org.richfaces.SeleniumTestBase;
/**
* @author Nick Belaevski
* @since 3.3.1
*/
public class Test extends SeleniumTestBase {
@org.testng.annotations.Test
public void testExecute() throws Exception {
renderPage();
clickAjaxCommandAndWait("form:link");
AssertNotVisible("form:table:calendar");
clickById("form:table:calendarPopupButton");
AssertVisible("form:table:calendar");
}
@Override
public String getTestUrl() {
return "pages/rf6547.xhtml";
}
}
| [
"grenard@nuxeo.com"
] | grenard@nuxeo.com |
b6a17fcddac89dfbcd530802d0f4b15bd2ee97d5 | 12822004115b616726f87bb205e1853d92331456 | /app/src/main/java/com/b07/salesandroid/models/AuthenticationModel.java | a95ebbbb1d3969a6f83f42a38e9da9559c15ed2a | [] | no_license | alacwong/Sales_Android | 456bf3433e18eaf9ba0da55952df287a1c6cf034 | 62e8fcf9c02bd4b9e0a7e3a0124d5e3a0a16ddb6 | refs/heads/master | 2022-08-05T10:16:58.853372 | 2020-05-23T16:29:23 | 2020-05-23T16:29:23 | 266,376,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,661 | java | package com.b07.salesandroid.models;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import com.b07.database.helper.DatabaseAndroidHelper;
import com.b07.database.helper.DatabaseSelectHelper;
import com.b07.exceptions.AuthenticationException;
import com.b07.exceptions.UserNotFoundException;
import com.b07.salesandroid.views.AccountChoose;
import com.b07.salesandroid.views.AccountView;
import com.b07.salesandroid.views.AdminView;
import com.b07.salesandroid.views.CustomerView;
import com.b07.salesandroid.views.EmployeeView;
import com.b07.users.Roles;
import com.b07.users.User;
import java.sql.SQLException;
public class AuthenticationModel {
public static Intent authenticateUser(int userId, String password, Context context) throws
UserNotFoundException, AuthenticationException {
DatabaseAndroidHelper db = new DatabaseAndroidHelper(context);
User user = db.getUserDetailsHelper(userId, context);
Intent intent;
if (user.authenticate(password, context)) {
if (db.getRoleHelper(userId).equals(Roles.ADMIN.toString())) {
System.out.println("admin");
intent = new Intent(context, AdminView.class);
} else if (db.getRoleHelper(userId).equals(Roles.EMPLOYEE.toString())) {
System.out.println("employee");
intent = new Intent(context, EmployeeView.class);
} else {
System.out.println("customer");
intent = new Intent(context, AccountChoose.class);
}
intent.putExtra("User", user);
System.out.println(user.getName());
} else {
throw new AuthenticationException();
}
return intent;
}
}
| [
"46137625+alacwong@users.noreply.github.com"
] | 46137625+alacwong@users.noreply.github.com |
575fe08817379f408938840ce4ce3b208a46d4cc | 230d30c1d7749421dbf865630225737517afac92 | /base_songjiang/src/main/java/com/oncloudsoft/sdk/yunxin/uikit/business/session/helper/MessageHelper.java | 50569dc2455576453c900f44401f9b5b0a0370f7 | [] | no_license | NIA1-cmd/wfw | c4e3c7c897ea6646e9e2763ca0017e01aa0fafbb | a82c68343d9b868cde0da6b52b23d9fac40fc863 | refs/heads/master | 2020-06-04T06:24:03.229979 | 2019-06-27T16:07:01 | 2019-06-27T16:07:01 | 191,903,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package com.oncloudsoft.sdk.yunxin.uikit.business.session.helper;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.msg.MessageBuilder;
import com.netease.nimlib.sdk.msg.MsgService;
import com.netease.nimlib.sdk.msg.constant.MsgStatusEnum;
import com.netease.nimlib.sdk.msg.model.CustomMessageConfig;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.oncloudsoft.sdk.yunxin.uikit.api.wrapper.MessageRevokeTip;
/**
* Created by hzxuwen on 2016/8/19.
*/
public class MessageHelper {
public static MessageHelper getInstance() {
return InstanceHolder.instance;
}
static class InstanceHolder {
final static MessageHelper instance = new MessageHelper();
}
// 消息撤回
public void onRevokeMessage(IMMessage item, String revokeAccount) {
if (item == null) {
return;
}
IMMessage message = MessageBuilder.createTipMessage(item.getSessionId(), item.getSessionType());
message.setContent(MessageRevokeTip.getRevokeTipContent(item, revokeAccount));
message.setStatus(MsgStatusEnum.success);
CustomMessageConfig config = new CustomMessageConfig();
config.enableUnreadCount = false;
message.setConfig(config);
NIMClient.getService(MsgService.class).saveMessageToLocalEx(message, true, item.getTime());
}
}
| [
"2586125596@qq.com"
] | 2586125596@qq.com |
fffdba75fa4e4ae9af2c397f0cc3b8b984f4da00 | e3e3c6fb5d8677c0bf8b394d8f28a7bc85c1c368 | /src/main/java/ss/practice/App.java | ce38be4047fa659d80c5d7ecd7b7adc7281e2502 | [] | no_license | vishalsinha27/codingproblems | e5740233bc1fe7bf5abc3b9256ee491e53fd69b4 | 980f943fddc3e63957e0a4adc0afdcdf75e9cfce | refs/heads/master | 2020-03-28T09:08:26.778473 | 2018-09-09T11:03:52 | 2018-09-09T11:03:52 | 148,016,730 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,668 | java | package ss.practice;
import java.time.Duration;
import java.time.Instant;
import java.util.Random;
import java.util.Scanner;
import java.util.concurrent.ThreadLocalRandom;
/**
* Hello world!
*
*/
public class App
{
public void startTimesTableTest(int start, int end, int timesStart, int timesEnd, int numberOfMins, Score score, Scanner scan) {
Instant startTime = Instant.now() ;
int elaspsedMins = 0 ;
do{
Instant currentTime = Instant.now() ;
Duration d = Duration.between(startTime, currentTime) ;
elaspsedMins = (int)d.getSeconds()/60 ;
int multiplier = ThreadLocalRandom.current().nextInt(start, end + 1);
int times = ThreadLocalRandom.current().nextInt(timesStart, timesEnd + 1);
System.out.print(multiplier + " X "+ times + " = ");
String answerStr = scan.next() ;
int answer = 0 ;
try{
answer = Integer.parseInt(answerStr) ;
}catch(Exception e) {
return ;
}
int correctAnswer = multiplier * times ;
score.total = score.total+1 ;
if(correctAnswer == answer) {
score.currentScore = score.currentScore+1 ;
System.out.println("Correct!");
} else {
System.out.println("Wrong! "+multiplier+" X "+times+ " = "+correctAnswer);
}
}while(elaspsedMins<numberOfMins) ;
}
public static class Score{
int currentScore ;
int total ;
String name ;
}
public static void main( String[] args )
{
System.out.print("Please enter your name ");
Scanner scanner = new Scanner(System.in) ;
String s = scanner.next() ;
//System.out.println();
//System.out.println("Welcome "+s+ ". Lets start the fun");
System.out.println();
System.out.print(s+" enter the number of mins you want to play this game ");
String mins = scanner.next() ;
int totalMins = 3 ;
if(mins!=null) {
try{
totalMins = Integer.parseInt(mins) ;
if(totalMins > 10) {
totalMins = 10 ;
}
}catch(Exception e){
}
}
System.out.println("You are going to play for "+totalMins + " mins.");
Score score = new Score() ;
score.name = s ;
if(totalMins > 0) {
App app = new App() ;
app.startTimesTableTest(12, 15, 2, 10, totalMins, score, scanner);
}
scanner.close();
System.out.println();
System.out.println(score.name + ", your score is "+score.currentScore+ " out of "+score.total+ " in "+totalMins + " mins");
System.out.println("Bye...");
}
}
| [
"sinhavis@gmail.com"
] | sinhavis@gmail.com |
ddc107e23dfac061fc49d6a8ad4133a10e36ceb8 | 3ed3bd424cf8850fd6a449f1d05e78d8e7cd4c5a | /src/leetcode/editor/cn/ConvertBinarySearchTreeToSortedDoublyLinkedList426.java | 27d6737bc5bc4c92f33f910ad40b4d88e508bdab | [] | no_license | ccfwwm/ccfjavaliba | 0b88a6a8e250bbf386b9288135ead651b3df76f0 | ae1af9a5b007acdd482e2a293550c88457e48261 | refs/heads/master | 2023-04-24T08:05:48.013390 | 2021-05-04T11:11:05 | 2021-05-04T11:11:05 | 337,269,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,835 | java | package leetcode.editor.cn;
public class ConvertBinarySearchTreeToSortedDoublyLinkedList426{
public static void main(String[] args) {
Solution solution = new ConvertBinarySearchTreeToSortedDoublyLinkedList426().new Solution();
}
/**
* 题目Id:426
* 题目:将二叉搜索树转化为排序的双向链表
* 日期:2021-03-17 22:42:56
*/
//将一个 二叉搜索树 就地转化为一个 已排序的双向循环链表 。
//
// 对于双向循环列表,你可以将左右孩子指针作为双向循环链表的前驱和后继指针,第一个节点的前驱是最后一个节点,最后一个节点的后继是第一个节点。
//
// 特别地,我们希望可以 就地 完成转换操作。当转化完成以后,树中节点的左指针需要指向前驱,树中节点的右指针需要指向后继。还需要返回链表中最小元素的指针。
//
//
//
// 示例 1:
//
//
//输入:root = [4,2,5,1,3]
//
//
//输出:[1,2,3,4,5]
//
//解释:下图显示了转化后的二叉搜索树,实线表示后继关系,虚线表示前驱关系。
//
//
//
// 示例 2:
//
//
//输入:root = [2,1,3]
//输出:[1,2,3]
//
//
// 示例 3:
//
//
//输入:root = []
//输出:[]
//解释:输入是空树,所以输出也是空链表。
//
//
// 示例 4:
//
//
//输入:root = [1]
//输出:[1]
//
//
//
//
// 提示:
//
//
// -1000 <= Node.val <= 1000
// Node.left.val < Node.val < Node.right.val
// Node.val 的所有值都是独一无二的
// 0 <= Number of Nodes <= 2000
//
// Related Topics 树 链表 分治算法
// 👍 90 👎 0
//leetcode submit region begin(Prohibit modification and deletion)
/*
// Definition for a Node.
class Node {
public int val;
public Node left;
public Node right;
public Node() {}
public Node(int _val) {
val = _val;
}
public Node(int _val,Node _left,Node _right) {
val = _val;
left = _left;
right = _right;
}
};
*/
class Solution {
Node first;
Node pre;
public Node treeToDoublyList(Node root) {
if(root ==null){
return null;
}
helper(root);
first.left = pre;
pre.right = first;
return first;
}
public void helper(Node node){
if(node ==null){
return;
}
//中序遍历
helper(node.left);
//first只赋值一次
if(first ==null){
first=node;
}
if(pre ==null){
pre = node;
}
//否则将当前节点与pre连接。同时移动pre;
else {
pre.right = node;
node.left= pre;
pre = node;
}
helper(node.right);
}
}
//leetcode submit region end(Prohibit modification and deletion)
}
| [
"ccfwwm@gmail.com"
] | ccfwwm@gmail.com |
7bc1d82e342fd8cb3bfb6b938be66f0a72ccee1d | 9416d28913378d29c4d2df6b8e3abbfae9c707ad | /src/main/java/LearningNewJava/classes/MySingleton.java | cf539479be421011aa7c2cce902d2c3175aef806 | [] | no_license | tqv8227-github/JavaStuff | 3193bd2162a3676757571c605c13c9792d7753e6 | 5a8f81b3e51ba90a930728ff7f8579e9cbbd64b3 | refs/heads/main | 2023-04-09T11:56:26.430347 | 2021-04-06T17:54:55 | 2021-04-06T17:54:55 | 354,908,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package LearningNewJava.classes;
public class MySingleton {
private static MySingleton myObj = new MySingleton();
private String myString = "Default string";
private MySingleton() {
// TODO Auto-generated constructor stub
}
public String getMyString() {
return myString;
}
public void setMyString(String thisString) {
myString = thisString.equals("")? "String is empty":thisString;
}
public static MySingleton getInstance() {
return myObj;
}
public void printString() {
System.out.println(this.myString);
}
public static void main(String... args) {
MySingleton obj = MySingleton.getInstance();
obj.setMyString("this is a test");
obj.printString();
}
}
| [
"tuyenqvu2002@yahoo.com"
] | tuyenqvu2002@yahoo.com |
d8f117f09d317672acf56593e4d63fe1e87aa279 | 9d32980f5989cd4c55cea498af5d6a413e08b7a2 | /A72n_10_0_0/src/main/java/com/oppo/statistics/agent/StaticPeriodDataRecord.java | d59bb28cdd79693d9bd5ac078f3e917a69929f66 | [] | no_license | liuhaosource/OppoFramework | e7cc3bcd16958f809eec624b9921043cde30c831 | ebe39acabf5eae49f5f991c5ce677d62b683f1b6 | refs/heads/master | 2023-06-03T23:06:17.572407 | 2020-11-30T08:40:07 | 2020-11-30T08:40:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,143 | java | package com.oppo.statistics.agent;
import android.content.Context;
import com.oppo.statistics.data.PeriodDataBean;
import com.oppo.statistics.data.SettingKeyBean;
import com.oppo.statistics.data.SettingKeyDataBean;
import com.oppo.statistics.record.RecordHandler;
import com.oppo.statistics.util.LogUtil;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
public class StaticPeriodDataRecord extends BaseAgent {
public static void updateData(Context context, String logTag, String eventID, Map<String, String> logMap) {
RecordHandler.addTask(context, new PeriodDataBean(logTag, eventID, map2JsonObject(logMap).toString()));
}
public static void updateSettingKey(Context context, String logTag, String eventID, Map<String, String> keyMap) {
RecordHandler.addTask(context, new SettingKeyDataBean(logTag, eventID, map2JsonObject(keyMap).toString()));
}
public static void updateSettingKeyList(Context context, String logTag, String eventID, List<SettingKeyBean> list) {
RecordHandler.addTask(context, new SettingKeyDataBean(logTag, eventID, list2JsonObject(list).toString()));
}
public static JSONArray list2JsonObject(List<SettingKeyBean> list) {
JSONArray jsonArray = new JSONArray();
if (list == null || list.isEmpty()) {
return jsonArray;
}
try {
for (SettingKeyBean settingKeyBean : list) {
if (settingKeyBean != null) {
JSONObject beanJson = new JSONObject();
beanJson.put(SettingKeyBean.SETTING_KEY, settingKeyBean.getSettingKey());
beanJson.put(SettingKeyBean.HTTP_POST_KEY, settingKeyBean.getHttpPostKey());
beanJson.put(SettingKeyBean.METHOD_NAME, settingKeyBean.getMethodName());
beanJson.put(SettingKeyBean.DEFAULE_VALUE, settingKeyBean.getDefaultValue());
jsonArray.put(beanJson);
}
}
} catch (Exception e) {
LogUtil.e("NearMeStatistics", e);
}
return jsonArray;
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
fe9093aef5d513674f5b1c440515c5d6f0895482 | 81eed79c67e16a3bf61306a17bd88e0fa6a70c70 | /soap_mscpool_check_new/src/main/java/com/boco/soap/cmnet/cocurrent/sync/workitem/impl/BarrierWorkItemExecutor.java | 3b84b11d7c1dded8ab46dabfd819f8981a29beb3 | [] | no_license | caoran/soap_prarent | daf1b30b3a45a6b78f9205886a84ce809d99d427 | f3c337e6ff7530995445cbe8654093173efe101a | refs/heads/master | 2020-03-24T17:31:36.629693 | 2018-07-30T10:50:16 | 2018-07-30T10:50:16 | 142,861,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,767 | java | package com.boco.soap.cmnet.cocurrent.sync.workitem.impl;
import com.boco.soap.cmnet.cocurrent.sync.IBarrierProcessor;
import com.boco.soap.cmnet.cocurrent.sync.workitem.IWorkItem;
import com.boco.soap.cmnet.cocurrent.sync.ProcessorFactory;
import com.boco.soap.cmnet.cocurrent.sync.workitem.AbstractWorkItemExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;
public class BarrierWorkItemExecutor extends AbstractWorkItemExecutor {
private Logger logger = LoggerFactory.getLogger(BarrierWorkItemExecutor.class);
private List<IBarrierProcessor> processors = new ArrayList();
private Runnable runnable;
private CyclicBarrier barrier;
public BarrierWorkItemExecutor(ExecutorService threadPool)
{
super(threadPool);
}
public void execute()
{
this.barrier = new CyclicBarrier(this.processors.size(), this.runnable);
if (this.logger.isDebugEnabled()) {
this.logger.debug("线程组[{}]运行开始,线程数为[{}]", this.name, Integer.valueOf(this.processors.size()));
}
System.out.println("线程组[" + this.name + "]运行开始,线程数为[" + this.processors.size() + "]");
long start = System.currentTimeMillis();
if (this.threadPool != null)
{
threadPoolExecut();
}
else {
newThreadExecut();
}
long end = System.currentTimeMillis();
this.executTime = (end - start);
if (this.logger.isDebugEnabled())
this.logger.debug("线程组[{}]运行结束,用时:", this.name, Long.valueOf(this.executTime));
}
private void newThreadExecut()
{
for (IBarrierProcessor processor : this.processors) {
processor.setBarrier(this.barrier);
Thread thread = new Thread(processor);
thread.start();
}
}
private void threadPoolExecut()
{
int i = 0;
for (IBarrierProcessor processor : this.processors) {
System.out.println(i++);
processor.setBarrier(this.barrier);
this.threadPool.execute(processor);
}
}
public void addWorkItem(IWorkItem workItem)
{
if (this.logger.isDebugEnabled()) {
this.logger.debug("向线程组[{}] 添加任务[{}]。", this.name, workItem
.getWorkItemName());
}
IBarrierProcessor processor =
ProcessorFactory.getInstance()
.getBarrierProcessor(workItem, this.name + ":" + workItem.getWorkItemName());
this.processors.add(processor);
}
}
| [
"caorannihao@163.com"
] | caorannihao@163.com |
3398165c07156ee4197c252256ead1408cfd03e6 | f4781c77b6ae665dc88a4a24891a8dde495c1116 | /src/main/java/com/kbi/qwertech/client/models/ModelArmorSpurs.java | 535fb4a417584391d359bd5430993b497897f9c6 | [] | no_license | NH4HCr2O7/qwertech | 37cc69534461b61657d7f316e4d60a86d81b703f | 2548d8a04897a022230f159d6d214641a57dc77e | refs/heads/master | 2021-01-24T12:12:19.142243 | 2018-04-01T09:57:28 | 2018-04-01T09:57:28 | 123,124,197 | 0 | 0 | null | 2018-02-27T14:11:15 | 2018-02-27T12:11:13 | Java | UTF-8 | Java | false | false | 2,692 | java | package com.kbi.qwertech.client.models;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
/**
* ModelArmorSpurs - Qwertygiy
* Created using Tabula 4.1.1
*/
public class ModelArmorSpurs extends ModelBiped {
public ModelRenderer bipedSpikeLeft;
public ModelRenderer bipedSpikeRight;
public ModelRenderer bipedSpikeLeft_1;
public ModelRenderer bipedSpikeRight_1;
public ModelArmorSpurs() {
this.textureWidth = 8;
this.textureHeight = 8;
this.bipedSpikeRight = new ModelRenderer(this, 0, 0);
this.bipedSpikeRight.mirror = true;
this.bipedSpikeRight.setRotationPoint(-2.4F, 12.0F, 0.0F);
this.bipedSpikeRight.addBox(-3.0F, 9.0F, 0.5F, 1, 1, 3, 0.0F);
this.bipedSpikeRight_1 = new ModelRenderer(this, 0, 0);
this.bipedSpikeRight_1.mirror = true;
this.bipedSpikeRight_1.setRotationPoint(-2.5F, 9.5F, 2.0F);
this.bipedSpikeRight_1.addBox(-0.5F, -0.5F, -1.5F, 1, 1, 3, 0.0F);
this.setRotateAngle(bipedSpikeRight_1, 1.5707963267948966F, 0.0F, 0.0F);
this.bipedSpikeLeft = new ModelRenderer(this, 0, 0);
this.bipedSpikeLeft.mirror = true;
this.bipedSpikeLeft.setRotationPoint(2.4F, 12.0F, 0.0F);
this.bipedSpikeLeft.addBox(2.0F, 9.0F, 0.5F, 1, 1, 3, 0.0F);
this.bipedSpikeLeft_1 = new ModelRenderer(this, 0, 0);
this.bipedSpikeLeft_1.mirror = true;
this.bipedSpikeLeft_1.setRotationPoint(2.5F, 9.5F, 2.0F);
this.bipedSpikeLeft_1.addBox(-0.5F, -0.5F, -1.5F, 1, 1, 3, 0.0F);
this.setRotateAngle(bipedSpikeLeft_1, 1.5707963267948966F, 0.0F, 0.0F);
this.bipedSpikeRight.addChild(this.bipedSpikeRight_1);
this.bipedSpikeLeft.addChild(this.bipedSpikeLeft_1);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
setRotateAngle(bipedSpikeRight, bipedRightLeg.rotateAngleX, bipedRightLeg.rotateAngleY, bipedRightLeg.rotateAngleZ);
setRotateAngle(bipedSpikeLeft, bipedLeftLeg.rotateAngleX, bipedLeftLeg.rotateAngleY, bipedLeftLeg.rotateAngleZ);
this.bipedSpikeRight.render(f5);
this.bipedSpikeLeft.render(f5);
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
| [
"qwertygiy@gmail.com"
] | qwertygiy@gmail.com |
a744684df72df8a282609973e9a4f62f9c0541ae | 5d9c5bc47016ee3c87619a08b113633bd9b9c9f5 | /app/src/main/java/com/wfc/app/test2/view/IJobListView.java | 555b7e40af21eb6d3edce2bfff6bdf11c598bbc6 | [] | no_license | wfc823639686/test2 | a94ebc7593cc6f9bd4350cb48885aeb19cf90995 | 9b409bbd8f004445d77d79f93c5d1a2bad8e2292 | refs/heads/master | 2021-01-09T20:07:57.255263 | 2016-10-24T06:03:57 | 2016-10-24T06:03:57 | 63,602,173 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package com.wfc.app.test2.view;
import com.wfc.app.test2.bean.JobListResult;
import java.util.List;
/**
* Created by wangfengchen on 16/7/4.
*
*/
public interface IJobListView {
String getOrderBy();
String getLast();
void onLoad(JobListResult list);
void onFailure();
void onLoadCompleted();
}
| [
"wangfengchen@okar.cn"
] | wangfengchen@okar.cn |
afd0ea5600127ac65676a95e0b0167c149139472 | 94f3f7819c38e9441fe976647e0a2d629ea4600f | /src/main/java/com/aspose/cloud/diagram/client/ApiException.java | ff4b5fefabc07aaf5433f8f74a7896009dec180d | [
"MIT"
] | permissive | aspose-diagram-cloud/aspose-diagram-cloud-android | c0834354de41e760387881bcba85ce7eec7feb4c | 3061038b83720ced5f2762471336a97564e1fca7 | refs/heads/master | 2021-06-17T12:10:01.139075 | 2021-02-11T13:41:29 | 2021-02-11T13:41:29 | 166,740,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,679 | java | /*
* Aspose.Diagram Cloud API Reference
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.aspose.cloud.diagram.client;
import java.util.Map;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-10-08T10:51:41.813+08:00")
public class ApiException extends Exception {
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;
public ApiException() {}
public ApiException(Throwable throwable) {
super(throwable);
}
public ApiException(String message) {
super(message);
}
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
super(message, throwable);
this.code = code;
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
}
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
this(message, (Throwable) null, code, responseHeaders, responseBody);
}
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
this(message, throwable, code, responseHeaders, null);
}
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
}
public ApiException(int code, String message) {
super(message);
this.code = code;
}
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
this(code, message);
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
}
/**
* Get the HTTP status code.
*
* @return HTTP status code
*/
public int getCode() {
return code;
}
/**
* Get the HTTP response headers.
*
* @return A map of list of string
*/
public Map<String, List<String>> getResponseHeaders() {
return responseHeaders;
}
/**
* Get the HTTP response body.
*
* @return Response body in the form of string
*/
public String getResponseBody() {
return responseBody;
}
}
| [
"feng.ge@aspose.com"
] | feng.ge@aspose.com |
ed8936b85cb649f467b3ed5db4d7453b525a4f1e | 267d0e80ccea67a18c916efe2eb6afeaf0bbc4e1 | /GB_D2C/src/com/turacomobile/greatbuyz/data/Gift.java | 306bb48a76b865fcdcd4f37fbc59c0215a245729 | [] | no_license | SMIdris/GreatBuyzTim | c67e7b06e2cbcac4332a8323cb5a009701efdf79 | fadfc9d7b5f68d266da8387e67892236dba3fdee | refs/heads/master | 2021-01-19T05:53:50.516711 | 2015-05-19T14:00:27 | 2015-05-19T14:00:27 | 33,447,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package com.turacomobile.greatbuyz.data;
public class Gift
{
private String _friend;
private String _msisdn;
private String _message;
public Gift(String friend, String msisdn, String message)
{
_friend = friend;
_msisdn = msisdn;
_message = message;
}
public String getFriend()
{
return _friend;
}
public String getMsisdn()
{
return _msisdn;
}
public String getMessage()
{
return _message;
}
}
| [
"sm.idris88@gmail.com"
] | sm.idris88@gmail.com |
db3506e484835720b7b68d755acfba98bb45d9c2 | 65cf39f1062d1e998b6412a8c217a1ae039d7718 | /Aula06_Heranca/AulaHeranca/src/aulaheranca/Moto.java | 5825724e12c018c78f4de6bc6fd244103edcc3a4 | [] | no_license | adaltofadergs/2020_2_ProgramacaoOrientadaObjetos | 9b47de58aa77e78682614a8a7fcaadf869a54e6b | f77d6d421aa72f52c618c3c499cde7e0e36e46f7 | refs/heads/master | 2023-01-14T00:25:05.147149 | 2020-11-20T01:26:26 | 2020-11-20T01:26:26 | 294,779,935 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package aulaheranca;
import javax.swing.JOptionPane;
/**
*
* @author adaltoss
*/
public class Moto extends Veiculo{
public int cilindradas;
public Moto(){
}
public Moto(String modelo, int cilindradas){
super(modelo);
this.cilindradas = cilindradas;
}
@Override
public void imprimir() {
String t = "Moto: " + this.modelo + " que tem " +
this.cilindradas + " cilindradas, cadastrada!";
JOptionPane.showMessageDialog(null, t );
}
@Override
protected double getConsumo(int km) {
double consumo = super.getConsumo(km) / 3;
return consumo;
}
}
| [
"adaltoss@MacBook-Pro-de-Adalto.local"
] | adaltoss@MacBook-Pro-de-Adalto.local |
f49e72fa5e5bcbaf86c49a8cd934448bb9bc39a2 | b99d25c71f664e8fee614743c9f7c7cc3e8367c7 | /app/src/main/java/tigerspike/com/tgimagegallery/flickerimage/adapter/RecycleFlickerImageAdapter.java | 513c55065910e200fe608e93bf2bacd3ab0b279b | [] | no_license | youranshul/FlickerImageDownloader | 152373d5fd0590137cfa1efd93b95708cf81c1a7 | 44c83caa5bc15d6ed2d85eed0ce2af0f6f32de62 | refs/heads/master | 2021-01-22T10:26:56.951991 | 2017-05-30T06:36:03 | 2017-05-30T06:36:03 | 92,643,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,896 | java | package tigerspike.com.tgimagegallery.flickerimage.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.tigerspike.flickerimage.model.FlickerImageData;
import butterknife.Bind;
import butterknife.ButterKnife;
import tigerspike.com.tgimagegallery.R;
import tigerspike.com.tgimagegallery.flickerimage.OnImageClickListener;
public class RecycleFlickerImageAdapter extends
RecyclerView.Adapter<RecycleFlickerImageAdapter.RecipeViewHolder> {
private OnImageClickListener onImageClickListener;
private FlickerImageData flickerImageData;
public RecycleFlickerImageAdapter(FlickerImageData flickerImageData) {
this.flickerImageData = flickerImageData;
}
public void setOnImageClickListener(OnImageClickListener listener) {
this.onImageClickListener = listener;
}
@Override
public RecipeViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.grid_content,
parent, false);
return new RecipeViewHolder(view, onImageClickListener);
}
@Override
public void onBindViewHolder(RecipeViewHolder holder, final int position) {
holder.PicName.setText(flickerImageData.getAuthorName(position));
holder.PicTitle.setText(flickerImageData.getImageTitle(position));
Picasso.with(holder.pic.getContext()).load(flickerImageData.getImageLink(position)).into(
holder.pic);
holder.pic.setTag(position);
holder.pic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onImageClickListener != null) {
onImageClickListener.onImageClick(flickerImageData.getImageLink(
(Integer) v.getTag()));
}
}
});
}
@Override
public int getItemCount() {
return flickerImageData.getItemsSize();
}
public void refreshData(FlickerImageData flickerImageData) {
this.flickerImageData = flickerImageData;
this.notifyDataSetChanged();
}
static class RecipeViewHolder extends RecyclerView.ViewHolder {
private final OnImageClickListener onImageClickListener;
@Bind(R.id.pic)
ImageView pic;
@Bind(R.id.pic_name)
TextView PicName;
@Bind(R.id.pic_title)
TextView PicTitle;
RecipeViewHolder(View itemView, OnImageClickListener onImageClickListener) {
super(itemView);
this.onImageClickListener = onImageClickListener;
ButterKnife.bind(this, itemView);
}
}
}
| [
"youranshul@gmail.com"
] | youranshul@gmail.com |
0a4b92c81809b80db69db6de75dcd35f2812fc8b | d2b6ded0631affda9734dc2fb8564b7e5900914d | /movie/src/com/movie/bean/Category.java | 4f7401cadb14cf17dda9a65ddbe3aa7f988f37c6 | [] | no_license | stackldy/FilmRecommendation | fbfa6b6506b4da3fe026557372d37de270e6e42b | dfd2bdf5b4c755f9497d0b598ecdbd0eed9f1e2c | refs/heads/master | 2020-07-07T22:03:09.713743 | 2019-08-21T04:14:26 | 2019-08-21T04:14:26 | 203,488,607 | 8 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.movie.bean;
public class Category {
private int categoryid;
private String category;
public int getCategoryid() {
return categoryid;
}
public void setCategoryid(int categoryid) {
this.categoryid = categoryid;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public Category(){
}
}
| [
"2535789760@qq.com"
] | 2535789760@qq.com |
a3611847828e8ad5732cdfc9724520a4955f1d60 | 32f9beece0ec66e015a8f0e9d761f6901ccb73b9 | /java/juc/src/main/java/com/atguigu/juc/locks/Lock8Demo.java | 30a0c6de7efd74ef0796dd5489c0db956525cbec | [
"Apache-2.0"
] | permissive | zj-dreamly/my-program-learning | 08592c15465031c2432a8b63c685030383b5b35f | cadc57095ee57392b207b0693ad1913e34312a8b | refs/heads/master | 2023-08-24T11:19:19.175806 | 2023-08-17T01:55:23 | 2023-08-17T01:55:23 | 193,616,093 | 17 | 1 | Apache-2.0 | 2023-02-22T05:54:47 | 2019-06-25T02:07:09 | HTML | UTF-8 | Java | false | false | 5,876 | java | package com.atguigu.juc.locks;
import java.util.concurrent.TimeUnit;
class Phone //资源类
{
public static synchronized void sendEmail()
{
//暂停几秒钟线程
try { TimeUnit.SECONDS.sleep(3); } catch (InterruptedException e) { e.printStackTrace(); }
System.out.println("-------sendEmail");
}
public synchronized void sendSMS()
{
System.out.println("-------sendSMS");
}
public void hello()
{
System.out.println("-------hello");
}
}
/**
* @auther zzyy
* @create 2021-03-03 15:00
题目:谈谈你对多线程锁的理解。
* 线程 操作 资源类 8锁案例说明
* 1 标准访问有ab两个线程,请问先打印邮件还是短信
* 2 sendEmail方法暂停3秒钟,请问先打印邮件还是短信
* 3 新增一个普通的hello方法,请问先打印邮件还是hello
* 4 有两部手机,请问先打印邮件还是短信
* 5 两个静态同步方法,同1部手机,请问先打印邮件还是短信
* 6 两个静态同步方法, 2部手机,请问先打印邮件还是短信
* 7 1个静态同步方法,1个普通同步方法,同1部手机,请问先打印邮件还是短信
* 8 1个静态同步方法,1个普通同步方法,2部手机,请问先打印邮件还是短信
*
* * 1-2
* * * 一个对象里面如果有多个synchronized方法,某一个时刻内,只要一个线程去调用其中的一个synchronized方法了,
* * * 其它的线程都只能等待,换句话说,某一个时刻内,只能有唯一的一个线程去访问这些synchronized方法
* * * 锁的是当前对象this,被锁定后,其它的线程都不能进入到当前对象的其它的synchronized方法
* 3-4
* * 加个普通方法后发现和同步锁无关,hello
* * 换成两个对象后,不是同一把锁了,情况立刻变化。
*
* *
* * 5-6 都换成静态同步方法后,情况又变化
* * 三种 synchronized 锁的内容有一些差别:
* * 对于普通同步方法,锁的是当前实例对象,通常指this,具体的一部部手机,所有的普通同步方法用的都是同一把锁——实例对象本身,
* * 对于静态同步方法,锁的是当前类的Class对象,如Phone.class唯一的一个模板
* * 对于同步方法块,锁的是 synchronized 括号内的对象
*
* * 7-8
* * 当一个线程试图访问同步代码时它首先必须得到锁,退出或抛出异常时必须释放锁。
* * *
* * * 所有的普通同步方法用的都是同一把锁——实例对象本身,就是new出来的具体实例对象本身,本类this
* * * 也就是说如果一个实例对象的普通同步方法获取锁后,该实例对象的其他普通同步方法必须等待获取锁的方法释放锁后才能获取锁。
* * *
* * * 所有的静态同步方法用的也是同一把锁——类对象本身,就是我们说过的唯一模板Class
* * * 具体实例对象this和唯一模板Class,这两把锁是两个不同的对象,所以静态同步方法与普通同步方法之间是不会有竞态条件的
* * * 但是一旦一个静态同步方法获取锁后,其他的静态同步方法都必须等待该方法释放锁后才能获取锁。
*
*/
public class Lock8Demo
{
public static void main(String[] args)//一切程序的入口,主线程
{
Phone phone = new Phone();//资源类1
Phone phone2 = new Phone();//资源类2
new Thread(() -> {
phone.sendEmail();
},"a").start();
//暂停毫秒
try { TimeUnit.MILLISECONDS.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); }
new Thread(() -> {
//phone.sendSMS();
//phone.hello();
phone2.sendSMS();
},"b").start();
}
}
/**
*
* ============================================
* 1-2
* * 一个对象里面如果有多个synchronized方法,某一个时刻内,只要一个线程去调用其中的一个synchronized方法了,
* * 其它的线程都只能等待,换句话说,某一个时刻内,只能有唯一的一个线程去访问这些synchronized方法
* * 锁的是当前对象this,被锁定后,其它的线程都不能进入到当前对象的其它的synchronized方法
*
* 3-4
* * 加个普通方法后发现和同步锁无关
* * 换成两个对象后,不是同一把锁了,情况立刻变化。
*
* 5-6 都换成静态同步方法后,情况又变化
* 三种 synchronized 锁的内容有一些差别:
* 对于普通同步方法,锁的是当前实例对象,通常指this,具体的一部部手机,所有的普通同步方法用的都是同一把锁——实例对象本身,
* 对于静态同步方法,锁的是当前类的Class对象,如Phone.class唯一的一个模板
* 对于同步方法块,锁的是 synchronized 括号内的对象
*
* 7-8
* 当一个线程试图访问同步代码时它首先必须得到锁,退出或抛出异常时必须释放锁。
* *
* * 所有的普通同步方法用的都是同一把锁——实例对象本身,就是new出来的具体实例对象本身,本类this
* * 也就是说如果一个实例对象的普通同步方法获取锁后,该实例对象的其他普通同步方法必须等待获取锁的方法释放锁后才能获取锁。
* *
* * 所有的静态同步方法用的也是同一把锁——类对象本身,就是我们说过的唯一模板Class
* * 具体实例对象this和唯一模板Class,这两把锁是两个不同的对象,所以静态同步方法与普通同步方法之间是不会有竞态条件的
* * 但是一旦一个静态同步方法获取锁后,其他的静态同步方法都必须等待该方法释放锁后才能获取锁。
**/ | [
"1782920040@qq.com"
] | 1782920040@qq.com |
30738f50321f7bab8459bd02d05bce97e70ff890 | e0da9a20f6d833e663097f1f23abb3c25b86c9eb | /src/main/java/com/example/dice/DiceRollerApplication.java | aaf14445877db6907c2a396341a02ebaadbe82be | [] | no_license | kkedziora/DiceSimulator | c0660ff595f0e404638e5e02e734fc0feb6804ce | b690ed99b3b96d59f5f53c2efd79c3e93345ddf0 | refs/heads/master | 2022-12-25T05:26:37.226694 | 2020-09-29T10:16:56 | 2020-09-29T10:16:56 | 299,564,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package com.example.dice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DiceRollerApplication {
public static void main(String[] args) {
SpringApplication.run(DiceRollerApplication.class, args);
}
}
| [
"krzysztof.kedziora@onwelo.com"
] | krzysztof.kedziora@onwelo.com |
f9adfeb7cbf35e183ffadec5d5d14a0980366c42 | 5ee05c3a115e99875de76482afec9e7681baa09a | /baili-account/src/main/java/com/baili/account/mapper/UserMapper.java | 9eabfd0b676d78224e74be50767697edae8c89b5 | [] | no_license | zmmjsw/baili | 8fe68bd690a291e40f9831e7c573f57f5d47793d | 31f657536569f14fb47ec1b2b596df4c81765dbc | refs/heads/master | 2020-04-16T02:59:14.055050 | 2019-01-11T09:44:21 | 2019-01-11T09:44:21 | 165,215,903 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package com.baili.account.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.baili.account.common.plugin.BaseMapper;
import com.baili.account.entity.vo.UserConditionVo;
import com.baili.core.entity.User;
/**
*
* @ClassName: MerchantMapper
* @Description: TODO(这里用一句话描述这个类的作用)
* @author zhumingming
* @date 2018年6月4日 下午3:02:05
*
*/
@Mapper
public interface UserMapper extends BaseMapper<User>{
List<User> findPageBreakByCondition(@Param("vo")UserConditionVo vo);
void deleteUserRoleByUserId(Long id);
}
| [
"ming745077881@qq.com"
] | ming745077881@qq.com |
20f0c4239a87b20ff6c930f919396164be617598 | 0596cab0adea56e671a6f1a3f5678817d49146e2 | /src/framework/FindElement.java | fbb71fdb21d009480e6d6ff9e175defeba994604 | [] | no_license | kalyanvvrn/COM | a169efdbadad2170b45b6d801cce89a8c1ac0a23 | 1b1256266b03ca215cdd736efe6211527de78d12 | refs/heads/master | 2021-01-02T09:09:15.790609 | 2014-07-18T05:36:37 | 2014-07-18T05:36:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,921 | java | package framework;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait;
public class FindElement {
public WebElement find_Element(String ObjectIdentifierType,
String ObjectIdentifier, WebDriver driver, WebDriverWait wait,
String viewPort, String testCaseno, String testCaseDescription,
String application) throws IOException {
String Status = null;
WebElement webelement = null;
//driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
if (!viewPort.contains("Appium")) {
System.out.println(ObjectIdentifierType);
String Windowid = driver.getWindowHandle();
driver.switchTo().window(Windowid);
}
if (ObjectIdentifierType.toUpperCase().equals("XPATH")) {
try {
webelement = driver.findElement(By.xpath(ObjectIdentifier));
} catch (Exception e) {
Status = "Fail";
Results r = new Results();
r.results(testCaseno, testCaseDescription, Status, viewPort,
application);
}
} else if (ObjectIdentifierType.toUpperCase().equals("CSS")) {
try {
// System.out.println("Came to CSS");
webelement = driver.findElement(By
.cssSelector(ObjectIdentifier));
} catch (Exception e) {
File scrFile = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.FILE);
// Now you can do whatever you need to do with it, for example
// copy somewhere
System.out.println("Came to link image");
org.apache.commons.io.FileUtils.copyFile(scrFile, new File(
"/Users/kalyan_v/Desktop/FRAMEWORK/linkimage.png"));
Status = "Fail";
Results r = new Results();
r.results(testCaseno, testCaseDescription, Status, viewPort,
application);
}
} else if (ObjectIdentifierType.toUpperCase().equals("ID")) {
try {
webelement = driver.findElement(By.id(ObjectIdentifier));
} catch (Exception e) {
Status = "Fail";
Results r = new Results();
r.results(testCaseno, testCaseDescription, Status, viewPort,
application);
}
} else if (ObjectIdentifierType.toUpperCase().equals("TAG")) {
try {
webelement = driver.findElement(By.tagName(ObjectIdentifier));
} catch (Exception e) {
Status = "Fail";
Results r = new Results();
r.results(testCaseno, testCaseDescription, Status, viewPort,
application);
}
} else if (ObjectIdentifier.toUpperCase().equals("Class")) {
try {
webelement = driver.findElement(By.className(ObjectIdentifier));
} catch (Exception e) {
Status = "Fail";
Results r = new Results();
r.results(testCaseno, testCaseDescription, Status, viewPort,
application);
}
}
return webelement;
}
}
| [
"kalyan_v@Kalyans-Mac-mini.local"
] | kalyan_v@Kalyans-Mac-mini.local |
a698fcb440b868c55b49fefbbae2a926b2881474 | bbe1e3f18bfea2742352fe87d174ba1ea93d8a10 | /zh-web/zh-manage/src/main/java/com/web/WebApplication.java | 35b7d1086c8aec3e51d640aa0b6ba3907553ccad | [] | no_license | zhanghongsunny/sunny-platform-parent | 119dcc55906e6cc60c7af8020ac7c6fd2b67e87c | fdf802534f2f359b9e5c71a82ff4b211ea5f5ae0 | refs/heads/master | 2022-06-23T03:07:27.925642 | 2019-06-19T06:42:40 | 2019-06-19T06:42:40 | 191,522,976 | 2 | 0 | null | 2022-06-17T02:15:32 | 2019-06-12T07:44:26 | Java | UTF-8 | Java | false | false | 462 | java | package com.web;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @描述:
* @版权: Copyright (c) 2019
* @公司:
* @author: zhanghong
* @版本: 1.0
* @创建日期: 2019-06-13
* @创建时间: 23:21
**/
@SpringBootApplication
public class WebApplication {
public static void main(String[] args) {
SpringApplication.run(WebApplication.class, args);
}
}
| [
"zhanghong@youayun.cn"
] | zhanghong@youayun.cn |
0f65031d03905a4971e666a01cd74649c3f81d5e | 5976fada6f069cb52615c0c02b2c989a7657b3cb | /desigin_pattern_advance/src/main/java/structural/facade/QualifyService.java | 7a9f69dc9ac17a9199505da78ce4a14ed87c24ec | [] | no_license | cdncn/Code | ca216a7b9256ade05f16f408dfd2e20e555a6172 | cf0b72da47156b81e47c4b984b2d7c044c215ba0 | refs/heads/master | 2022-11-13T11:16:08.109727 | 2019-07-03T17:01:09 | 2019-07-03T17:01:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package structural.facade;
/**
* @author HT
* @version V1.0
* @package structural.facade
* @date 2019-06-22 22:56
*/
public class QualifyService {
public boolean isAvailable(PointsGift pointsGift) {
System.out.println("校验" + pointsGift.getName() + "积分资格通过,库存公国");
return true;
}
}
| [
"fengyunhetao@gmail.com"
] | fengyunhetao@gmail.com |
8abc793aba665b43e595b3796b4c61883650d435 | 32dba68bb4473d2bd32f7e19db50a0628a2df445 | /src/aphi/servlet/member/Delete.java | 0dd42fbddb182a58d6a5d8e5686ce784ae0fd9dc | [] | no_license | akphi/Masta | 14b0a9ef6d29fcb48ef28a4a763d61c633f09fc7 | 41cd8a9b548c41e46c5be93202cb159580c68c39 | refs/heads/master | 2021-05-30T23:53:46.160200 | 2016-03-25T18:15:54 | 2016-03-25T18:15:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,702 | java | package aphi.servlet.member;
import java.util.Enumeration;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import org.apache.log4j.Logger;
import aphi.bean.Member;
import aphi.constant.system.*;
/**
* <p>
* Title: Member Delete Servlet
* </p>
*
* <p>
* Description: Servlet for managing member delete
* </p>
*
* @author An Phi
* @version 01.00.00
*/
public class Delete extends HttpServlet{
/**
* The internal version id of this class
*/
private static final long serialVersionUID = 19620501L;
/**
* Servlet version
*/
private static final String VERSION = "01.00.00";
/**
* Logger Instance
*/
private static Logger LOGGER = Logger.getLogger(Delete.class);
public void init(ServletConfig config) {
LOGGER.warn("Servlet init. Version: " + VERSION);
}
/**
* The constructor - no operations carried out here
*/
public Delete() {
}
/**
* Uses the controller method to process the request.
*
* @see #controller
*
* @param req
* The request
* @param resp
* The response
*
* @throws ServletException
* @throws IOException
*/
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
controller(req, resp);
}
/**
* Uses the controller method to process the request.
*
* @see #controller
*
* @param req
* The request
* @param resp
* The response
*
* @throws ServletException
* @throws IOException
*/
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
controller(req, resp);
}
/**
* The controlling method for the servlet. Manages the processing of the
* request.
*
* @param req
* The request
* @param resp
* The response
*
* @throws ServletException
* @throws IOException
*/
private void controller(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String forwardPath;
LOGGER.info("Request method: " + req.getMethod());
@SuppressWarnings("unchecked")
Enumeration<String> paramNames = req.getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = paramNames.nextElement();
LOGGER.info("Received param: " + paramName + " with value " + req.getParameter(paramName));
}
if (req.getMethod() == "POST") {
deleteMember(req);
forwardPath = setupForListDisplay(req);
} else {
forwardPath = SERVLET_PATH.MEMBER_LIST.val();
}
req.getRequestDispatcher(forwardPath).forward(req, resp);
}
/**
* Delete a member from the member list that is stored in the session
*
* @param req
* The request
*/
private void deleteMember(HttpServletRequest req) {
String memberId = req.getParameter(REQUEST_PARAM.MEMBER_ID.val());
Member member = findMember(req, memberId);
List<Member> memberList = getMemberListFromSession(req.getSession());
memberList.remove(member);
}
/**
* Setup the request with data for displaying the member list
*
* @param req
* The request
*
* @return The JSP to use for rendering the member list
*/
private String setupForListDisplay(HttpServletRequest req) {
req.setAttribute(REQUEST_ATTRIB.MEMBER_LIST.val(), req.getSession().getAttribute(SESSION_ATTRIB.MEMBER_LIST.val()));
return JSP_PATH.MEMBER_LIST.val();
}
/**
* Locate a member in the member list based on the member's id
*
* @param req
* The request
* @param id
* The member's id
*
* @return The member with the requested id
*/
private Member findMember(HttpServletRequest req, String id) {
List<Member> memberList = getMemberListFromSession(req.getSession());
Member matchingMember = null;
for (Member member : memberList) {
if (member.getId().equals(id)) {
matchingMember = member;
break;
}
}
return matchingMember;
}
/**
* Retrieve the member list from the session
*
* @param session
* The session
*
* @return The member list from the session
*/
@SuppressWarnings("unchecked")
private List<Member> getMemberListFromSession(HttpSession session) {
return (List<Member>) session.getAttribute(SESSION_ATTRIB.MEMBER_LIST.val());
}
}
| [
"aphi@skidmore.edu"
] | aphi@skidmore.edu |
5cd4bda669b64e9869cf3ea12ae70f28abcb6add | 17f3dc4cdc1eb68b4689c71e793adecaa6d5d9ee | /hutool-core/src/main/java/com/xiaoleilu/hutool/bean/DynaBean.java | 349eb6fe19c905ea5e7ffd90bd10a65cad199cc6 | [
"Apache-2.0"
] | permissive | Justonly5/hutool | 43d7ce7d3c8368d47747f84e1a2e67b09764708b | e4ea2d803b3ea7bb968161c3e0db2cb8cc38a381 | refs/heads/master | 2021-07-17T06:57:57.434431 | 2017-09-12T01:46:27 | 2017-09-12T01:46:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,220 | java | package com.xiaoleilu.hutool.bean;
import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Map;
import com.xiaoleilu.hutool.clone.CloneSupport;
import com.xiaoleilu.hutool.lang.Assert;
import com.xiaoleilu.hutool.util.BeanUtil;
import com.xiaoleilu.hutool.util.ClassUtil;
/**
* 动态Bean,通过反射对Bean的相关方法做操作<br>
* 支持Map和普通Bean
*
* @author Looly
* @since 3.0.7
*/
public class DynaBean extends CloneSupport<DynaBean> implements Serializable{
private static final long serialVersionUID = 1197818330017827323L;
private Class<?> beanClass;
private Object bean;
/**
* 创建一个{@link DynaBean}
* @param bean 普通Bean
* @return {@link DynaBean}
*/
public static DynaBean create(Object bean){
return new DynaBean(bean);
}
/**
* 创建一个{@link DynaBean}
* @param beanClass Bean类
* @param params 构造Bean所需要的参数
* @return {@link DynaBean}
*/
public static DynaBean create(Class<?> beanClass, Object... params){
return new DynaBean(beanClass, params);
}
//------------------------------------------------------------------------ Constructor start
/**
* 构造
* @param beanClass Bean类
* @param params 构造Bean所需要的参数
*/
public DynaBean(Class<?> beanClass, Object... params){
this(ClassUtil.newInstance(beanClass, params));
}
/**
* 构造
* @param bean 原始Bean
*/
public DynaBean(Object bean){
Assert.notNull(bean);
if(bean instanceof DynaBean){
bean = ((DynaBean)bean).getBean();
}
this.bean = bean;
this.beanClass = ClassUtil.getClass(bean);
}
//------------------------------------------------------------------------ Constructor end
/**
* 获得字段对应值
* @param <T> 属性值类型
* @param fieldName 字段名
* @return 字段值
* @throws BeanException 反射获取属性值或字段值导致的异常
*/
@SuppressWarnings("unchecked")
public <T> T get(String fieldName) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
return (T) ((Map<?, ?>)bean).get(fieldName);
}else{
try {
final PropertyDescriptor descriptor = BeanUtil.getPropertyDescriptor(beanClass, fieldName);
if(null == descriptor){
throw new BeanException("No PropertyDescriptor for {}", fieldName);
}
final Method method = descriptor.getReadMethod();
if(null == method){
throw new BeanException("No get method for {}", fieldName);
}
return (T) method.invoke(this.bean);
} catch (Exception e) {
throw new BeanException(e);
}
}
}
/**
* 获得字段对应值,获取异常返回{@code null}
*
* @param <T> 属性值类型
* @param fieldName 字段名
* @return 字段值
* @since 3.1.1
*/
public <T> T safeGet(String fieldName){
try {
return get(fieldName);
} catch (Exception e) {
return null;
}
}
/**
* 设置字段值
* @param fieldName 字段名
* @param value 字段值
* @throws BeanException 反射获取属性值或字段值导致的异常
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void set(String fieldName, Object value) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
((Map)bean).put(fieldName, value);
return;
}else{
try {
final PropertyDescriptor descriptor = BeanUtil.getPropertyDescriptor(beanClass, fieldName);
if(null == descriptor){
throw new BeanException("No PropertyDescriptor for {}", fieldName);
}
final Method method = descriptor.getWriteMethod();
if(null == method){
throw new BeanException("No set method for {}", fieldName);
}
method.invoke(this.bean, value);
} catch (Exception e) {
throw new BeanException(e);
}
}
}
/**
* 执行原始Bean中的方法
* @param methodName 方法名
* @param params 参数
* @return 执行结果,可能为null
*/
public Object invoke(String methodName, Object... params){
return ClassUtil.invoke(this.bean, methodName, params);
}
/**
* 获得原始Bean
* @param <T> Bean类型
* @return bean
*/
@SuppressWarnings("unchecked")
public <T> T getBean(){
return (T)this.bean;
}
/**
* 获得Bean的类型
* @param <T> Bean类型
* @return Bean类型
*/
@SuppressWarnings("unchecked")
public <T> Class<T> getBeanClass(){
return (Class<T>) this.beanClass;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((bean == null) ? 0 : bean.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DynaBean other = (DynaBean) obj;
if (bean == null) {
if (other.bean != null) {
return false;
}
} else if (!bean.equals(other.bean)) {
return false;
}
return true;
}
@Override
public String toString() {
return this.bean.toString();
}
}
| [
"loolly@gmail.com"
] | loolly@gmail.com |
27d31d2803c1dc71dbb7f4359e4144ff4554f736 | a61059140eecb973d62131f1ce49d9718649d5e4 | /northwind/src/main/java/kodlamaio/northwind/business/concretes/UserManager.java | 3e00b358bac5d1cca2617d9cf2975e641b422e00 | [] | no_license | NilgunDkaya/javaReactCampBackend | caddfaf79893573ab58ea6344ab7a218e0bb2ade | a38d4a1abbb86461afe7e3b07d46f72ed948c069 | refs/heads/main | 2023-05-10T16:05:29.689914 | 2021-06-10T16:17:57 | 2021-06-10T16:17:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | java | package kodlamaio.northwind.business.concretes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import kodlamaio.northwind.business.abstracts.UserService;
import kodlamaio.northwind.core.dataAccess.UserDao;
import kodlamaio.northwind.core.entities.User;
import kodlamaio.northwind.core.utilities.results.DataResult;
import kodlamaio.northwind.core.utilities.results.Result;
import kodlamaio.northwind.core.utilities.results.SuccessDataResult;
import kodlamaio.northwind.core.utilities.results.SuccessResult;
@Service
public class UserManager implements UserService{
private UserDao userDao;
@Autowired
public UserManager(UserDao userDao) {
super();
this.userDao = userDao;
}
@Override
public Result add(User user) {
this.userDao.save(user);
return new SuccessResult("Kullanıcı eklendi");
}
@Override
public DataResult<User> findByEmail(String email) {
return new SuccessDataResult<User>(this.userDao.findByEmail(email), "Kullanıcı Bulundu");
}
}
| [
"noreply@github.com"
] | NilgunDkaya.noreply@github.com |
0e1f5ddd74b4bb71183e20e5693d313e6f42a9ce | 17efea447af726ab0e3c6f40524adadcb0a708ed | /src/main/java/com/luv2code/springsecurity/demo/service/ApplicationService.java | 88ff7912235ad5c0139601e6c3eab6db5b4b86e2 | [] | no_license | damianx009/home-of-docs | 8d9df72a3bee104235c9c169df55edb7869e7647 | d1bfef15c5a5a3db0bfa5b21933a2acecfa2451f | refs/heads/master | 2020-04-02T06:35:46.452662 | 2018-11-05T19:56:15 | 2018-11-05T19:56:15 | 154,158,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package com.luv2code.springsecurity.demo.service;
import java.util.List;
import com.luv2code.springsecurity.demo.entity.UsersFilterPerson;
import com.luv2code.springsecurity.demo.entity.UsersFilterType;
public interface ApplicationService {
public List<UsersFilterType> getUserFilterTypes();
public List<UsersFilterPerson> getUsersToFilter();
public UsersFilterPerson getUserToFilter(int userId);
}
| [
"damianx009@onet.pl"
] | damianx009@onet.pl |
f6d3e83d480bc58e966fc1fac05ac6b27cb02ae0 | cec1602d23034a8f6372c019e5770773f893a5f0 | /sources/com/airbnb/lottie/value/LottieValueCallback.java | 3bef3aadce3f0665216b4f8a8f4f31b46de3d413 | [] | no_license | sengeiou/zeroner_app | 77fc7daa04c652a5cacaa0cb161edd338bfe2b52 | e95ae1d7cfbab5ca1606ec9913416dadf7d29250 | refs/heads/master | 2022-03-31T06:55:26.896963 | 2020-01-24T09:20:37 | 2020-01-24T09:20:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,428 | java | package com.airbnb.lottie.value;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.RestrictTo.Scope;
import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation;
public class LottieValueCallback<T> {
@Nullable
BaseKeyframeAnimation<?, ?> animation;
private final LottieFrameInfo<T> frameInfo = new LottieFrameInfo<>();
@Nullable
protected T value = null;
public LottieValueCallback() {
}
public LottieValueCallback(@Nullable T staticValue) {
this.value = staticValue;
}
public T getValue(LottieFrameInfo<T> lottieFrameInfo) {
return this.value;
}
public final void setValue(@Nullable T value2) {
this.value = value2;
if (this.animation != null) {
this.animation.notifyListeners();
}
}
@RestrictTo({Scope.LIBRARY})
public final T getValueInternal(float startFrame, float endFrame, T startValue, T endValue, float linearKeyframeProgress, float interpolatedKeyframeProgress, float overallProgress) {
return getValue(this.frameInfo.set(startFrame, endFrame, startValue, endValue, linearKeyframeProgress, interpolatedKeyframeProgress, overallProgress));
}
@RestrictTo({Scope.LIBRARY})
public final void setAnimation(@Nullable BaseKeyframeAnimation<?, ?> animation2) {
this.animation = animation2;
}
}
| [
"johan@sellstrom.me"
] | johan@sellstrom.me |
fb24a731475ca2eff0d08b7aa4aabb3a19a88c3d | cbd99db03d720ec196e3c15f670f008b34c47345 | /app/src/main/java/com/bob/android/mockactionlocation/map/overlay/util/MapLatlnUtil.java | 67b27fa8292c0bd2088a64388814e8e29f007aa2 | [] | no_license | bobLion/MockActionLocation | 186c53c128b6fa30de9f1b7c023d8beb570f5b5a | 4e8f4a9450db0972b4ea96e2c16d9685b68fcee9 | refs/heads/master | 2020-04-14T10:11:30.023687 | 2019-01-11T09:17:31 | 2019-01-11T09:17:31 | 163,780,290 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,372 | java | package com.bob.android.mockactionlocation.map.overlay.util;
public class MapLatlnUtil {
public final static String CoorType_GCJ02 = "gcj02";
public final static String CoorType_BD09LL= "bd09ll";
public final static String CoorType_BD09MC= "bd09";
/***
*61 : GPS定位结果,GPS定位成功。
*62 : 无法获取有效定位依据,定位失败,请检查运营商网络或者wifi网络是否正常开启,尝试重新请求定位。
*63 : 网络异常,没有成功向服务器发起请求,请确认当前测试手机网络是否通畅,尝试重新请求定位。
*65 : 定位缓存的结果。
*66 : 离线定位结果。通过requestOfflineLocaiton调用时对应的返回结果。
*67 : 离线定位失败。通过requestOfflineLocaiton调用时对应的返回结果。
*68 : 网络连接失败时,查找本地离线定位时对应的返回结果。
*161: 网络定位结果,网络定位定位成功。
*162: 请求串密文解析失败。
*167: 服务端定位失败,请您检查是否禁用获取位置信息权限,尝试重新请求定位。
*502: key参数错误,请按照说明文档重新申请KEY。
*505: key不存在或者非法,请按照说明文档重新申请KEY。
*601: key服务被开发者自己禁用,请按照说明文档重新申请KEY。
*602: key mcode不匹配,您的ak配置过程中安全码设置有问题,请确保:sha1正确,“;”分号是英文状态;且包名是您当前运行应用的包名,请按照说明文档重新申请KEY。
*501~700:key验证失败,请按照说明文档重新申请KEY。
*/
public static float[] EARTH_WEIGHT = {0.1f,0.2f,0.4f,0.6f,0.8f}; // 推算计算权重_地球
//public static float[] MOON_WEIGHT = {0.0167f,0.033f,0.067f,0.1f,0.133f};
//public static float[] MARS_WEIGHT = {0.034f,0.068f,0.152f,0.228f,0.304f};
//坐标转换相关
static double pi = 3.14159265358979324;
static double a = 6378245.0;
static double ee = 0.00669342162296594323;
public final static double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
public static double[] bd2wgs(double lon, double lat) {
double[] bd2Gcj = bd09togcj02(lon, lat);
return gcj02towgs84(bd2Gcj[0], bd2Gcj[1]);
}
public static double[] bd09togcj02(double bd_lon, double bd_lat) {
double x = bd_lon - 0.0065;
double y = bd_lat - 0.006;
double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
double gg_lng = z * Math.cos(theta);
double gg_lat = z * Math.sin(theta);
return new double[] { gg_lng, gg_lat };
}
public static double[] gcj02towgs84(double lng, double lat) {
// if (out_of_china(lng, lat)) {
// return new double[] { lng, lat };
// }
double dlat = transformLat(lng - 105.0, lat - 35.0);
double dlng = transformLon(lng - 105.0, lat - 35.0);
double radlat = lat / 180.0 * pi;
double magic = Math.sin(radlat);
magic = 1 - ee * magic * magic;
double sqrtmagic = Math.sqrt(magic);
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi);
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * pi);
double mglat = lat + dlat;
double mglng = lng + dlng;
return new double[] { lng * 2 - mglng, lat * 2 - mglat };
}
private static double transformLat(double lat, double lon) {
double ret = -100.0 + 2.0 * lat + 3.0 * lon + 0.2 * lon * lon + 0.1 * lat * lon + 0.2 * Math.sqrt(Math.abs(lat));
ret += (20.0 * Math.sin(6.0 * lat * pi) + 20.0 * Math.sin(2.0 * lat * pi)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(lon * pi) + 40.0 * Math.sin(lon / 3.0 * pi)) * 2.0 / 3.0;
ret += (160.0 * Math.sin(lon / 12.0 * pi) + 320 * Math.sin(lon * pi / 30.0)) * 2.0 / 3.0;
return ret;
}
private static double transformLon(double lat, double lon) {
double ret = 300.0 + lat + 2.0 * lon + 0.1 * lat * lat + 0.1 * lat * lon + 0.1 * Math.sqrt(Math.abs(lat));
ret += (20.0 * Math.sin(6.0 * lat * pi) + 20.0 * Math.sin(2.0 * lat * pi)) * 2.0 / 3.0;
ret += (20.0 * Math.sin(lat * pi) + 40.0 * Math.sin(lat / 3.0 * pi)) * 2.0 / 3.0;
ret += (150.0 * Math.sin(lat / 12.0 * pi) + 300.0 * Math.sin(lat / 30.0 * pi)) * 2.0 / 3.0;
return ret;
}
private static boolean out_of_china(double lng, double lat) {
return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271));
}
}
| [
"justlstenwind5257@Gmial.com"
] | justlstenwind5257@Gmial.com |
41f9318283750adefc028e888f591d214c501d01 | f7acbcd8ec543991bf390f8bc4097253d67db61c | /19_Sample10GoogleMap-master/app/src/main/java/com/example/dongja94/samplegooglemap/TMapPOISearchResult.java | f223f7db32e0e6bc341862bfeb3571e0d394013b | [] | no_license | LimDonghyun/tacademy_android_level4 | b4f878d13f759befb81e06f15642dc077bc0393f | 12898a1be7963725425dac516cc80ee2ed07fd53 | refs/heads/master | 2022-11-24T17:26:57.298356 | 2020-07-30T02:03:09 | 2020-07-30T02:03:09 | 283,645,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package com.example.dongja94.samplegooglemap;
/**
* Created by dongja94 on 2016-03-07.
*/
public class TMapPOISearchResult {
public TMapPOIList searchPoiInfo;
}
| [
"henly.lim@nitmus.com"
] | henly.lim@nitmus.com |
db3748c082e4dd2448edbfebb6de7624f4db50b0 | 830f271a525e08a39a4323d783632d63376fb07c | /reading/src/main/java/com/king/reading/model/ExpandNestedList.java | 6b5e70338b07038d959413095985b6835ccef183 | [] | no_license | AllynYonge/Project | ae679139b6ba0e77177f2c355babb1646360aca1 | f559ba503c962b071ca009b2bfe64bef5994ff6f | refs/heads/master | 2021-01-02T22:34:22.839434 | 2017-08-04T13:02:20 | 2017-08-04T13:02:20 | 99,343,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package com.king.reading.model;
import com.king.reading.model.BaseNestedList;
import java.util.List;
/**
* Created by AllynYonge on 15/06/2017.
*/
public class ExpandNestedList<T> extends BaseNestedList<T> {
public boolean isExpand;
public ExpandNestedList(boolean isExpand, List<T> list) {
super(list);
this.isExpand = isExpand;
}
public boolean isExpand() {
return isExpand;
}
public void setExpand(boolean expand) {
isExpand = expand;
}
}
| [
"hu.yang@kingsunsoft.com"
] | hu.yang@kingsunsoft.com |
96f003570863416f8abbb3a7e09685e0eac4dd0a | e59ad112d785fec63eed13b3fa794b0fd86b3648 | /src/main/java/com/jiaz/leetj/Q106_ConstructBinaryTreefromInorderandPostorderTraversal.java | d1172e39c53badb5e54008e1a2997929f05cabd0 | [] | no_license | jiaz/leetj | 2a684f2c7f91aad92073cced8c7a0a92808b8f78 | 9d74aad1a190a2115d21f85e8d229693b8b93298 | HEAD | 2016-09-11T02:21:41.669008 | 2014-11-14T02:25:06 | 2014-11-14T02:25:06 | 24,102,455 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.jiaz.leetj;
import java.util.*;
// Given inorder and postorder traversal of a tree, construct the binary tree.
// Note:
// You may assume that duplicates do not exist in the tree.
public class Q106_ConstructBinaryTreefromInorderandPostorderTraversal {
public TreeNode buildTree(int[] inorder, int[] postorder) {
throw new RuntimeException("not implemented");
}
}
| [
"jiaji.zhou@mihoyo.com"
] | jiaji.zhou@mihoyo.com |
1cf8820766ac289687c0875a24f0f7b7b1ea216d | 6669f26cb75fc72022918c283f5414a51c7106ff | /DesignPatterns/VisitorPattern/src/com/demo/PharmacistsVisitor.java | be6dac38f65c600c691e00ade10a6ec63c09f587 | [] | no_license | KEN51472/JAVA | 62303210ee7f855732c794cc30ceec364c9a4150 | 6537f121211f2368a7149f69d1341c57a339d695 | refs/heads/master | 2022-08-15T22:48:00.473979 | 2020-03-13T07:28:16 | 2020-03-13T07:28:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package com.demo;
/**
* 药剂师取药--访问者
*/
public class PharmacistsVisitor implements IVisitor{
//访问数据结构中的元素A
@Override
public void doVisit(MedicineA a) {
System.out.println("药剂师拿药:"+a.getName());
}
//访问数据结构中的元素B
@Override
public void doVisit(MedicineB b) {
System.out.println("药剂师拿药:"+b.getName());
}
}
| [
"AutKevin@users.noreply.github.com"
] | AutKevin@users.noreply.github.com |
28fc2ea72e3a33e600600eab9c32db6004eb2c64 | 255f4ed783515bf9456236c0e4696d1d785f3f16 | /AutoSync/src/main/java/com/ss/pojo/ctrip/Price.java | c7d8220a83b7bf6caceacc81304dd22409b8d9cb | [
"MIT"
] | permissive | PiCaQiuLory/Travel-For-Qinker | 673fe952c8ef966e3158e74ee7cf411a9dd1a2f1 | 45a791e68e80c7a46dc163d5640f4e2d821ac5a6 | refs/heads/master | 2020-03-19T09:39:09.355517 | 2018-06-06T09:41:00 | 2018-06-06T09:41:00 | 136,306,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | java | package com.ss.pojo.ctrip;
import java.util.List;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;
@Root
public class Price {
@Element(required=false,name="Price")
private String StartDate ;
@ElementList(required=false,entry="dateTime")
private List<String> DateList;
public List<String> getDateTime() {
return DateList;
}
public void setDateTime(List<String> dateTime) {
this.DateList = dateTime;
}
public String getStartDate() {
return StartDate;
}
public void setStartDate(String startdate) {
StartDate = startdate;
}
@Element(required=false)
private String EndDate ;
public String getEndDate() {
return EndDate;
}
public void setEndDate(String enddate) {
EndDate = enddate;
}
@Element(required=false)
private String DayOfWeek ;
public String getDayOfWeek() {
return DayOfWeek;
}
public void setDayOfWeek(String dayofweek) {
DayOfWeek = dayofweek;
}
@ElementList(required=false,name="PackagePriceInfoList",entry="PackagePriceInfo")
private List<PackagePriceInfo> PackagePriceInfoList ;
public List<PackagePriceInfo> getPackagePriceInfoList() {
return PackagePriceInfoList;
}
public void setPackagePriceInfoList(List<PackagePriceInfo> packagepriceinfolist) {
PackagePriceInfoList = packagepriceinfolist;
}
@ElementList(required=false)
private List<OptionPriceInfo> OptionPriceInfoList ;
public List<OptionPriceInfo> getOptionPriceInfoList() {
return OptionPriceInfoList;
}
public void setOptionPriceInfoList(List<OptionPriceInfo> optionpriceinfolist) {
OptionPriceInfoList = optionpriceinfolist;
}
}
| [
"lory.li@qinker.com"
] | lory.li@qinker.com |
83941e449342024b567b4be94e037e56969a5573 | c88cb3f82328bc57121843b8f3d1b98ecc2eb7b9 | /src/main/java/cn/stylefeng/guns/modular/system/controller/NoteController.java | 77aa2d0654f0b4e4e974176514c301f78ea2c85e | [] | no_license | xyxTest/guns_learn | 6cb653005f133559a0df8e52624db09b33c69e56 | 164e4f01b32ab48e3cbc3d6dba39a5dae17920a9 | refs/heads/master | 2020-05-24T07:51:48.116535 | 2019-05-17T07:53:14 | 2019-05-17T07:53:14 | 187,171,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,760 | java | /**
*
*/
package cn.stylefeng.guns.modular.system.controller;
import java.util.HashMap;
import java.util.Map;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.stylefeng.guns.config.properties.GunsProperties;
import cn.stylefeng.guns.core.common.annotion.BussinessLog;
import cn.stylefeng.guns.core.common.annotion.Permission;
import cn.stylefeng.guns.core.common.constant.Const;
import cn.stylefeng.guns.core.common.constant.dictmap.NoteDict;
import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import cn.stylefeng.guns.core.common.page.LayuiPageFactory;
import cn.stylefeng.guns.core.log.LogObjectHolder;
import cn.stylefeng.guns.core.shiro.ShiroKit;
import cn.stylefeng.guns.core.shiro.ShiroUser;
import cn.stylefeng.guns.modular.system.entity.Note;
import cn.stylefeng.guns.modular.system.model.NoteDto;
import cn.stylefeng.guns.modular.system.service.NoteService;
import cn.stylefeng.guns.modular.system.warpper.NoteWrapper;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.roses.core.util.ToolUtil;
import cn.stylefeng.roses.kernel.model.exception.RequestEmptyException;
import cn.stylefeng.roses.kernel.model.exception.ServiceException;
/**
* @author xyx
* @date 2019年4月11日下午3:04:27
* @version 1.0
*/
@Controller
@RequestMapping("/work_note")
public class NoteController extends BaseController{
private static String PREFIX = "/modular/system/note/";
@Autowired
private GunsProperties gunsProperties;
@Autowired
private NoteService noteService;
/**
* 跳转到查看工作记事列表的页面
*/
@RequestMapping("")
public String index(){
return PREFIX + "work_note.html";
}
/**
*跳转到工作记事新增页面
*/
@RequestMapping("/note_add")
public String addNote(){
return PREFIX + "work_note_add.html";
}
/**
*跳转到工作记事编辑页面
*/
@RequestMapping("/note_edit")
public String editNote(@RequestParam Long noteId){
if (ToolUtil.isEmpty(noteId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
Note note = this.noteService.getById(noteId);
LogObjectHolder.me().set(note);
return PREFIX + "work_note_edit.html";
}
/**
*获取工作记事详情
*/
@RequestMapping("/getNoteInfo")
@ResponseBody
public Object getNoteInfo(@RequestParam Long noteId){
if (ToolUtil.isEmpty(noteId)) {
throw new RequestEmptyException();
}
Note note = this.noteService.getById(noteId);
HashMap<Object, Object> hashMap = CollectionUtil.newHashMap();
if (note != null) {
Map<String, Object> map = BeanUtil.beanToMap(note);
map.put("createDate", DateUtil.formatDate(note.getCreateDate()));
hashMap.putAll(map);
}
return ResponseData.success(hashMap);
}
/**
*查询工作记事列表
*/
@RequestMapping("/list")
@ResponseBody
public Object list(
@RequestParam(required = false) String content,
@RequestParam(required = false) String title,
@RequestParam(required = false) String timeLimit){
//拼接查询条件
String beginTime = "";
String endTime = "";
if (ToolUtil.isNotEmpty(timeLimit)) {
String[] split = timeLimit.split(" - ");
beginTime = split[0];
endTime = split[1];
}
Page<Map<String, Object>> notes = noteService.list(content, title,beginTime, endTime);
Page wrapped = new NoteWrapper(notes).wrap();
return LayuiPageFactory.createPageInfo(wrapped);
}
/**
*添加工作记事
*/
@BussinessLog(value = "添加工作记事", key = "content", dict = NoteDict.class)
@RequestMapping(value = "/add")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData add(
@Valid NoteDto note, BindingResult result) {
if (result.hasErrors()) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
ShiroUser shiroUser = ShiroKit.getUserNotNull();
note.setCreateUserId(shiroUser.getId());
this.noteService.addNote(note);
return SUCCESS_TIP;
}
/**
* 删除工作记事(逻辑删除)
*
*/
@RequestMapping("/delete")
@BussinessLog(value = "删除工作记事", key = "noteId", dict = NoteDict.class)
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData delete(@RequestParam Long noteId) {
if (ToolUtil.isEmpty(noteId)) {
throw new ServiceException(BizExceptionEnum.REQUEST_NULL);
}
this.noteService.deleteNote(noteId);
return SUCCESS_TIP;
}
/**
* 修改工作记事
*
*/
@BussinessLog(value = "修改工作记事", key = "content", dict = NoteDict.class)
@RequestMapping(value = "/update")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public ResponseData update(Note note) {
noteService.editNote(note);
return SUCCESS_TIP;
}
}
| [
"1055337148@qq.com"
] | 1055337148@qq.com |
f225a718ab3cb653bce9ff54ded6d8056c62c7f5 | 6221edd451e03f20de05af785c77747446cfe21d | /app/src/main/java/com/example/akil/s181142_mappe3/Player.java | 21aea8b89a3aee8429eb85c30911620e14dd58ac | [] | no_license | Akil-A/Blackjack | 51a40bdebbb1d41a3590682fbbeae810e9a962a1 | f101dbd39d63301b0e924c3d202b9753799cdae2 | refs/heads/master | 2021-01-09T06:53:41.520494 | 2015-11-27T15:05:28 | 2015-11-27T15:05:28 | 46,828,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,830 | java | package com.example.akil.s181142_mappe3;
import java.util.ArrayDeque;
public class Player {
private String name;
private int refills, bet = 0;
private double money = 0;
private boolean busted = false, isBet = false, blackjack, broke = false, won = false, stand = false;
private ArrayDeque<Card> hand;
public Player(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getMoney() {
return money;
}
public void setMoney(double money) {
this.money = money;
}
public int getBet(){
return bet;
}
public void setBet(int bet){
this.bet = bet;
}
public boolean isBusted() {
return busted;
}
public void setBusted(boolean busted) {
this.busted = busted;
}
public boolean isBet() {
return isBet;
}
public void setIsBet(boolean isBet) {
this.isBet = isBet;
}
public boolean getBlackjack() {
return blackjack;
}
public void setBlackjack(boolean blackjack) {
this.blackjack = blackjack;
}
public boolean isBroke() {
return broke;
}
public ArrayDeque<Card> getHand() {
return hand;
}
public void setHand(ArrayDeque<Card> hand) {
this.hand = hand;
}
public boolean isWon() {
return won;
}
public void setWon(boolean won) {
this.won = won;
}
public boolean isStand() {
return stand;
}
public void setStand(boolean stand) {
this.stand = stand;
}
public int getRefills() {
return refills;
}
public void setRefills(int refills) {
this.refills = refills;
}
}
| [
"akil@akil.no"
] | akil@akil.no |
ad11c4ca2d8cc7d7e171417df7b184561b271f31 | 53319ceff2a9bf4e3ed58e034364ea89c805b0a2 | /android/app/src/profile/gen/com/webartistictechnosol/job_karo_floor_manager/R.java | f91d1df39d3d9f682754de16f3eb53af0b9d2cb9 | [] | no_license | jesmin123/jobkaro-floormanager | 5125706a7be69859c4ff55e269a151fdbcd14663 | 77e0825b76a054263bb30501592b7763f235aed9 | refs/heads/master | 2023-04-21T17:43:10.229324 | 2021-01-06T13:03:24 | 2021-01-06T13:03:24 | 364,304,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | /*___Generated_by_IDEA___*/
package com.webartistictechnosol.job_karo_floor_manager;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
} | [
"annopjhn137@gmail.com"
] | annopjhn137@gmail.com |
97d448a6bd2419fa928cdbb99f80b30008143997 | 21d4158094dbf64bd3ad9124791535537314d691 | /frankDoc/src/main/java/nl/nn/adapterframework/frankdoc/model/AttributeType.java | 7c8dd1e9f0048d8221229572873133b6c020f8b2 | [
"Apache-2.0"
] | permissive | woutervdschoot/iaf | 812dbf4f151f54c5b02381a9b8b33fcc5ab3e1f7 | 55b92f7397cda15d8e44f071d0a3c4051c954ba9 | refs/heads/master | 2023-07-23T12:12:29.010233 | 2021-07-19T11:42:11 | 2021-07-19T11:42:11 | 276,088,348 | 0 | 0 | Apache-2.0 | 2020-07-01T07:54:48 | 2020-06-30T12:10:21 | null | UTF-8 | Java | false | false | 3,101 | java | /*
Copyright 2021 WeAreFrank!
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 nl.nn.adapterframework.frankdoc.model;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.stream.Collectors;
import nl.nn.adapterframework.frankdoc.doclet.FrankDocException;
public enum AttributeType {
STRING(new TypeCheckerString()),
BOOL(new TypeCheckerBool()),
INT(new TypeCheckerInt());
private static final Map<String, AttributeType> JAVA_TO_TYPE = new HashMap<>();
static {
JAVA_TO_TYPE.put("int", INT);
JAVA_TO_TYPE.put("boolean", BOOL);
JAVA_TO_TYPE.put("long", INT);
JAVA_TO_TYPE.put("byte", INT);
JAVA_TO_TYPE.put("short", INT);
JAVA_TO_TYPE.put("java.lang.String", STRING);
JAVA_TO_TYPE.put("java.lang.Integer", INT);
JAVA_TO_TYPE.put("java.lang.Boolean", BOOL);
JAVA_TO_TYPE.put("java.lang.Long", INT);
JAVA_TO_TYPE.put("java.lang.Byte", INT);
JAVA_TO_TYPE.put("java.lang.Short", INT);
}
/**
* @throws IllegalArgumentException when the provided Java type is not String, boolean or int or its boxed equivalent.
*/
static AttributeType fromJavaType(String javaType) {
AttributeType result = JAVA_TO_TYPE.get(javaType);
if(result == null) {
throw new IllegalArgumentException(String.format("Java type is not one of %s: %s",
Arrays.asList(AttributeType.values()).stream().map(Enum::name).collect(Collectors.joining(", ")), javaType));
}
return result;
}
private final TypeChecker typeChecker;
private AttributeType(TypeChecker typeChecker) {
this.typeChecker = typeChecker;
}
private static abstract class TypeChecker {
abstract void typeCheck(String value) throws FrankDocException;
}
void typeCheck(String value) throws FrankDocException {
typeChecker.typeCheck(value);
}
private static class TypeCheckerString extends TypeChecker {
@Override
void typeCheck(String value) throws FrankDocException {
}
}
private static class TypeCheckerInt extends TypeChecker {
@Override
void typeCheck(String value) throws FrankDocException {
try {
Integer.parseInt(value);
} catch(Exception e) {
throw new FrankDocException(String.format("Value [%s] is not integer", value), e);
}
}
}
private static final HashSet<String> BOOLEANS = new HashSet<>(Arrays.asList("false", "true"));
private static class TypeCheckerBool extends TypeChecker {
@Override
void typeCheck(String value) throws FrankDocException {
if(! BOOLEANS.contains(value)) {
throw new FrankDocException(String.format("Value [%s] is not Boolean", value), null);
}
}
}
}
| [
"noreply@github.com"
] | woutervdschoot.noreply@github.com |
96c61fabc79d8a1afdf5b1d6aa119e9b5f2bedcc | a6a03ec2e324a58d14656d552acc85c814c32870 | /src/main/java/cn/littlelory/JitBeanUtil.java | 15e289dc448e42bc6bfb4a6d10f604a1951fadeb | [
"MIT"
] | permissive | LittleLory/jit | 97dd13e8650e2f397a502232a0d510bb841f9d8d | cd1a71e8dddb622e6f1f56a7f9986453cd59192c | refs/heads/master | 2021-09-06T09:40:46.416133 | 2018-02-05T03:32:08 | 2018-02-05T03:32:08 | 105,242,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,441 | java | package cn.littlelory;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* Created by littlelory on 2017/8/23.
*/
class JitBeanUtil {
private static final JitBeanUtil INSTANCE = new JitBeanUtil();
static JitBeanUtil getINSTANCE() {
return INSTANCE;
}
String getBeanName(Class<?> clz) {
JitBean annotation = ReflectUtil.getTypeAnnotation(clz, JitBean.class);
return annotation != null ? annotation.name() : null;
}
<T> String getKey(T t) {
Field keyField = ReflectUtil.getFieldByAnnotation(t.getClass(), JitKey.class);
keyField.setAccessible(true);
try {
return (String) keyField.get(t);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
<T> void check(T t) {
Class clz = t.getClass();
check(clz);
}
void check(Class<?> clz) {
assertHaveBeanAnnotation(clz);
assertKeyAnnotationLegal(clz);
assertFieldAnnotationLegal(clz);
}
void assertHaveBeanAnnotation(Class<?> clz) {
if (!ReflectUtil.hasTypeAnnotation(clz, JitBean.class))
throw new NoBeanAnntationFoundException("not found the annotation[" + JitBean.class + "] from the Class[" + clz + "].");
}
void assertKeyAnnotationLegal(Class<?> clz) {
List<Field> fields = ReflectUtil.getFieldsByAnnotation(clz, JitKey.class);
if (fields.size() == 0)
throw new NoKeyFoundException("not found the field associated with JitKey in the Class[" + clz + "].");
if (fields.size() > 1)
throw new MultiKeyException("found multiple fields in the Class[" + clz + "].");
}
void assertFieldAnnotationLegal(Class<?> clz) {
List<Field> fields = ReflectUtil.getFieldsByAnnotation(clz, JitField.class);
Map<Integer, Long> sortCountMap = fields.stream().map(field -> field.getDeclaredAnnotation(JitField.class)).filter(Objects::nonNull).collect(Collectors.groupingBy(JitField::sort, Collectors.counting()));
List<Long> multiSorts = sortCountMap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(Map.Entry::getValue).collect(Collectors.toList());
if (multiSorts.size() > 0)
throw new MultiSortException("found multiple field sort value in the Class[" + clz + "].");
}
}
| [
"303548901@qq.com"
] | 303548901@qq.com |
4202599f2cac9f8221c02ec89e4398f64535378e | 7aa3772715bda73adacd9ccc5980af379ee264d7 | /sync/jms-template/src/main/java/org/bsnyder/spring/jms/receiver/SimpleMessageReceiver.java | ed1b355399b62c79f2e078a4d80c7245d91ddacf | [] | no_license | rodsong/Spring-jms-sample | a51857748c80395a195e54e1a1248c4fcf46b94a | 6bf5cc57d1ba835497b46574d9577a182686cd5e | refs/heads/master | 2016-09-11T02:19:02.121718 | 2014-05-20T05:49:49 | 2014-05-20T05:49:49 | 19,803,787 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,136 | java | package org.bsnyder.spring.jms.receiver;
import javax.jms.JMSException;
import javax.jms.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jms.core.JmsTemplate;
public class SimpleMessageReceiver {
private static final Logger LOG = LoggerFactory.getLogger(SimpleMessageReceiver.class);
protected JmsTemplate jmsTemplate;
public JmsTemplate getJmsTemplate() {
return jmsTemplate;
}
public void setJmsTemplate(JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate;
}
public void receive(String receiveType) throws JMSException {
if ("jmsReceive".equalsIgnoreCase(receiveType)) {
jmsReceive();
} else if ("receiveAndConvert".equalsIgnoreCase(receiveType)) {
receiveAndConvert();
}
}
public void jmsReceive() {
Message message = jmsTemplate.receive();
LOG.debug("Received a JMS message: {}", message);
}
public void receiveAndConvert() throws JMSException {
String message = (String) jmsTemplate.receiveAndConvert();
LOG.debug("Received a text message: {}", message);
throw new RuntimeException("test");
}
}
| [
"rodsong@163.com"
] | rodsong@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.