blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c5e378cfa9fbff1bb9897a28ebe73cd89b3c3774 | e33f9a223e6f3667ec1d5879330b147f83dd0858 | /src/main/java/com/ertelecom/carrental/controller/CarBrandController.java | 911960b1f434800c8af929e145887246eaf5d11d | [] | no_license | BusyrevMV/rentalAuto | a6ecc83bab551ef1fd1ae804222c61d760575771 | 56880ceb16c2ac18f8920664d01e3a32f2c14575 | refs/heads/master | 2023-03-02T12:46:16.437206 | 2021-02-12T15:50:16 | 2021-02-12T15:50:16 | 338,235,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,945 | java | package com.ertelecom.carrental.controller;
import com.ertelecom.carrental.model.entity.CarBrand;
import com.ertelecom.carrental.model.view.CarBrandView;
import com.ertelecom.carrental.response.DataResponse;
import com.ertelecom.carrental.response.ErrorArgsResponse;
import com.ertelecom.carrental.response.ErrorResponse;
import com.ertelecom.carrental.service.ICarBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.sql.SQLException;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("api/carBrand")
public class CarBrandController {
@Autowired
private ICarBrandService carBrandService;
@RequestMapping(value = "/get", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public DataResponse get() {
DataResponse response = new DataResponse();
response.result = carBrandService.load()
.stream()
.map((s)-> new CarBrandView(s))
.collect(Collectors.toList());
return response;
}
@RequestMapping(value = "/edit", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<CarBrand> getForEdit(@RequestParam("id") long id) {
CarBrand result = carBrandService.loadById(id).orElse(null);
return new ResponseEntity<>(result, result != null ? HttpStatus.OK : HttpStatus.GONE);
}
@RequestMapping(value = "/edit", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public CarBrand edit(@Valid @RequestBody CarBrand carBrand) {
carBrand = carBrandService.save(carBrand);
return carBrand;
}
@RequestMapping(value = "/delete", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Long> delete(@RequestParam("id") long id) {
return new ResponseEntity<>(id, carBrandService.deleteById(id) ? HttpStatus.OK : HttpStatus.GONE);
}
@ExceptionHandler(SQLException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ErrorResponse handleSQLException(SQLException e) {
ErrorResponse response = new ErrorResponse();
response.error = e.getClass().getName();
response.message = e.getMessage();
return response;
}
@ExceptionHandler(ObjectOptimisticLockingFailureException.class)
@ResponseStatus(HttpStatus.CONFLICT)
public ErrorResponse handleObjectOptimisticLockingFailureException(ObjectOptimisticLockingFailureException e) {
ErrorResponse response = new ErrorResponse();
response.error = e.getClass().getName();
response.message = String.format("Запись с идентификатором \"%s\" была изменена или удалена другим пользователем", e.getIdentifier());
return response;
}
@ExceptionHandler(DataIntegrityViolationException.class)
@ResponseStatus(HttpStatus.CONFLICT)
public ErrorResponse handleDataIntegrityViolationException(DataIntegrityViolationException e) {
ErrorResponse response = new ErrorResponse();
response.error = e.getRootCause().getClass().getName();
response.message = e.getRootCause().getMessage();
return response;
}
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ErrorArgsResponse handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
ErrorArgsResponse response = new ErrorArgsResponse();
response.error = e.getClass().getName();
for (FieldError fieldError: e.getBindingResult().getFieldErrors()) {
response.message.put(fieldError.getField(), fieldError.getDefaultMessage());
}
return response;
}
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ErrorResponse handleException(Exception e) {
ErrorResponse response = new ErrorResponse();
response.error = e.getClass().getName();
response.message = e.getMessage();
Iterator<StackTraceElement> iterator = Arrays.stream(e.getStackTrace()).iterator();
while (iterator.hasNext()){
response.errorStackTrace.add(iterator.next().toString());
}
return response;
}
}
| [
"79519482895@ya.ru"
] | 79519482895@ya.ru |
c582d3d3469b8791fa3a07814892a46b045b43bd | 619108dafe4bfce14dc55ca50ec4011146d906a7 | /src/org/springframework/simple/beans/factory/propertyeditors/ClassEditor.java | b0f45b534bed47ed23a34205caad1d9f4f41c077 | [] | no_license | aeolusyansheng/spring-2.0 | da0b798e42c0ca310115b63216ba9174fca88165 | ba59408a627af563bd8020ee3236e11e980cb6a9 | refs/heads/master | 2021-08-23T09:25:34.400069 | 2017-12-04T13:50:52 | 2017-12-04T13:50:52 | 112,931,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 912 | java | package org.springframework.simple.beans.factory.propertyeditors;
import java.beans.PropertyEditorSupport;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
public class ClassEditor extends PropertyEditorSupport {
private final ClassLoader classloader;
public ClassEditor() {
this(null);
}
public ClassEditor(ClassLoader classloader) {
this.classloader = (classloader != null ? classloader : ClassUtils.getDefaultClassLoader());
}
@SuppressWarnings("rawtypes")
public void setAsText(String text) {
if (StringUtils.hasText(text)) {
Class clazz = ClassUtils.resolveClassName(text.trim(), this.classloader);
setValue(clazz);
} else {
setValue(null);
}
}
@SuppressWarnings("rawtypes")
public String getAsText() {
Class clazz = (Class) getValue();
if (clazz == null) {
return "";
}
return ClassUtils.getQualifiedName(clazz);
}
}
| [
"aeolusyansheng@gmail.com"
] | aeolusyansheng@gmail.com |
a956c242f6bdf7673ad6f30ce29f7cd9f64d3661 | 4c80edf59536d3e4d5f8ef55bee24a580db626d3 | /mw/editor/BlockAreaMode.java | 3f6b3088c792162bf0f27303b09a344515a20f3d | [] | no_license | MJKWoolnough/minecraft-mod_editor | 2ff6018e0f42a57911d9b6805bb166bc82b5090d | 00fc4b13902261814a524289498b6b320171408b | refs/heads/master | 2020-04-26T02:01:30.514595 | 2015-12-04T12:28:09 | 2015-12-04T12:28:09 | 21,302,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,630 | java | package mw.editor;
import mw.library.Area;
import mw.library.Blocks;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
public class BlockAreaMode {
protected BlockData block = new BlockData();
protected Area area;
protected World world;
protected boolean startSet = false;
protected boolean endSet = false;
protected final int[] coords = new int[6];
protected int mode = -1;
protected int rmode = -1;
protected int tmode = -1;
public int changeMode() {
this.mode++;
if (this.mode > 7 || ((!this.startSet || !this.endSet) && this.mode > 3)) {
this.mode = 0;
}
return this.mode;
}
public int changeRotatorMode() {
if (this.startSet && this.endSet) {
this.rmode++;
if (this.rmode > 4 || (this.rmode > 2 && this.area.width() != this.area.depth())) {
this.rmode = 0;
}
}
return this.rmode;
}
public int changeTemplateMode() {
if (this.startSet && this.endSet) {
this.tmode++;
if (this.tmode > 2) {
this.tmode = 0;
}
}
return this.tmode;
}
public void setMode(int modeId) {
this.mode = modeId;
}
public void setRotatorMode(int modeId) {
this.rmode = modeId;
}
public void setTemplateMode(int modeId) {
this.tmode = modeId;
}
public int getMode() {
return this.mode;
}
public int getRotatorMode() {
return this.rmode;
}
public int getTemplateMode() {
return this.tmode;
}
public void getBlock(World world, int x, int y, int z) {
this.block = new BlockData().get(world, x, y, z);
}
public boolean setBlock(World world, int x, int y, int z) {
if (this.block != null) {
this.block.set(world, x, y, z);
return true;
}
return false;
}
public void addStartPos(World world, int x, int y, int z) {
this.resetWorld(world);
this.coords[0] = x;
this.coords[1] = y;
this.coords[2] = z;
this.startSet = true;
if (this.endSet) {
this.setArea(world);
if (this.rmode > 2 && this.area.width() != this.area.depth()) {
this.rmode = -1;
}
}
}
public void addEndPos(World world, int x, int y, int z) {
this.resetWorld(world);
this.coords[3] = x;
this.coords[4] = y;
this.coords[5] = z;
this.endSet = true;
if (this.startSet) {
this.setArea(world);
if (this.rmode > 2 && this.area.width() != this.area.depth()) {
this.rmode = -1;
}
}
}
private void resetWorld(World world) {
if (this.world != world) {
this.area = null;
this.startSet = false;
this.endSet = false;
this.rmode = -1;
if (this.mode > 3) {
this.mode = 0;
}
this.world = world;
}
}
private void setArea(World world) {
if (this.area == null) {
this.area = new Area(world, this.coords[0], this.coords[1], this.coords[2], this.coords[3], this.coords[4], this.coords[5]);
} else {
this.area.setCoords(world, this.coords[0], this.coords[1], this.coords[2], this.coords[3], this.coords[4], this.coords[5]);
}
}
public void resetArea() {
this.startSet = false;
this.endSet = false;
}
public ForgeDirection fillAreaDirection(int x, int y, int z) {
int[] coords = this.area.getCoords();
if (x >= coords[0] && x <= coords[3] && y >= coords[1] && y <= coords[4]) {
if (z < coords[2]) {
return ForgeDirection.NORTH;
} else if (z > coords[5]) {
return ForgeDirection.SOUTH;
}
} else if (x >= coords[0] && x <= coords[3] && z >= coords[2] && z <= coords[5]) {
if (y < coords[1]) {
return ForgeDirection.DOWN;
} else if (y > coords[4]) {
return ForgeDirection.UP;
}
} else if (y >= coords[1] && y <= coords[4] && z >= coords[2] && z <= coords[5]) {
if (x < coords[0]) {
return ForgeDirection.WEST;
} else if (x > coords[3]) {
return ForgeDirection.EAST;
}
}
return null;
}
public void fillArea() {
if (this.startSet && this.endSet) {
this.area.fill(this.block);
}
}
public void setBlockInArea(World world, int x, int y, int z) {
if (this.startSet && this.endSet) {
this.area.replace(new Blocks().get(world, x, y, z), this.block);
}
}
public void copyArea(World world, int x, int y, int z) {
if (this.startSet && this.endSet) {
this.area.copyTo(new Area(world, x, y, z, x + this.coords[3] - this.coords[0], y + this.coords[4] - this.coords[1], z + this.coords[5] - this.coords[2]));
}
}
public void fillAreaTo(World world, int x, int y, int z) {
if (this.startSet && this.endSet && this.area.sameWorld(world)) {
ForgeDirection direction = this.fillAreaDirection(x, y, z);
if (direction != null) {
int times;
int[] coords = this.area.getCoords();
if ((direction.ordinal() & 1) == 0) {
times = direction.offsetX * (x - coords[0] - this.area.width() + 1) / this.area.width() + direction.offsetY * (y - coords[1] - this.area.height() + 1) / this.area.height() + direction.offsetZ * (z - coords[2] - this.area.depth() + 1) / this.area.depth();
} else {
times = direction.offsetX * (x - coords[0]) / this.area.width() + direction.offsetY * (y - coords[1]) / this.area.height() + direction.offsetZ * (z - coords[2]) / this.area.depth();
}
this.area.copyInDirection(direction, times);
}
}
}
public void mirrorX() {
if (this.startSet && this.endSet) {
this.area.mirrorX();
}
}
public void mirrorZ() {
if (this.startSet && this.endSet) {
this.area.mirrorZ();
}
}
public void rotate90() {
if (this.startSet && this.endSet) {
this.area.rotate90();
}
}
public void rotate180() {
if (this.startSet && this.endSet) {
this.area.rotate180();
}
}
public void rotate270() {
if (this.startSet && this.endSet) {
this.area.rotate270();
}
}
}
| [
"michael.woolnough@gmail.com"
] | michael.woolnough@gmail.com |
b0960a5abfc67633b854155b29a5e3bc41faf922 | 660ea4ee15e4b7a4f880ebbd1475b3fb381b27b8 | /DataClient/src/main/java/me/leolin/twse/rest/StockWs.java | d425e708e6f3d8ea71fe1b7a61d03094508b6e64 | [
"Apache-2.0"
] | permissive | tastypotinc/Simple-Taiwan-Stock-Server | 567df85dc75e8dda385d6d842fbb11cae1d67f97 | ccb798e0a3be4db07f73e0f4c3c5d132304e9990 | refs/heads/master | 2020-06-13T19:49:01.902131 | 2015-06-22T17:26:27 | 2015-06-22T17:26:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package me.leolin.twse.rest;
import retrofit.http.GET;
/**
* @author Leolin
*/
public interface StockWs {
@GET("/stock")
GetAllStockResult getAllStock();
}
| [
"leo@leolin.me"
] | leo@leolin.me |
e451fe51cf34dbe8511e3e8c01c280ae3ee2f6d0 | 268719952215d7064d144599990d8013292c7418 | /Bundles/UMLVisualization/data/k9mail_src/k9mail-library/src/main/java/com/fsck/k9/mail/store/imap/IdGrouper.ContiguousIdGroup.java | 7cd58eb92743d5a44ec49e0502a006de32238b0d | [
"MIT"
] | permissive | bergel/UMLDependencies | 947751fb391add1123d2debd558bf9fe097e0bbf | 898cc15a6450cf79c795b362f5d32dece96e3733 | refs/heads/master | 2020-03-23T10:16:51.529310 | 2019-03-28T13:18:53 | 2019-03-28T13:18:53 | 141,434,823 | 1 | 1 | MIT | 2018-09-09T13:17:06 | 2018-07-18T12:56:15 | Smalltalk | UTF-8 | Java | false | false | 480 | java | package com.fsck.k9.mail.store.imap;
static class ContiguousIdGroup {
public final long start;
public final long end;
ContiguousIdGroup(long start, long end) {
if (start >= end) {
throw new IllegalArgumentException("start >= end");
}
this.start = start;
this.end = end;
}
@Override
public String toString() {
return start + ":" + end;
}
} | [
"alexandre.bergel@me.com"
] | alexandre.bergel@me.com |
e44f53c229f6d7ac3101b4a11038aa430950edd2 | 2ad9bb3e902fdfec6c6d2d0e3587f46cfa183fb1 | /desia/src/main/java/com/desia/artifacts/search/TransportationsType.java | 7038490391f059d1828bdfbe82ce7b84eda2ddf5 | [] | no_license | trawat/bonton | 4940eb48c21a56d3d2e6144c4070b096c057b705 | 35d438363eb01a11fcf8f4903994b9989d2e8b82 | refs/heads/master | 2021-01-15T15:27:29.208468 | 2016-08-17T06:18:48 | 2016-08-17T06:18:48 | 60,790,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,770 | java |
package com.desia.artifacts.search;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for TransportationsType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="TransportationsType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Transportations" type="{http://www.opentravel.org/OTA/2003/05}TransportationType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TransportationsType", propOrder = {
"transportations"
})
@XmlSeeAlso({
RelativePositionType.class
})
public class TransportationsType {
@XmlElement(name = "Transportations")
protected TransportationType transportations;
/**
* Gets the value of the transportations property.
*
* @return
* possible object is
* {@link TransportationType }
*
*/
public TransportationType getTransportations() {
return transportations;
}
/**
* Sets the value of the transportations property.
*
* @param value
* allowed object is
* {@link TransportationType }
*
*/
public void setTransportations(TransportationType value) {
this.transportations = value;
}
}
| [
"tirath.rawat@hotmail.com"
] | tirath.rawat@hotmail.com |
0b1e4b64f9a56f4063950f7e77bad7e7764218e1 | aa4b00c1e2c6b324abdaa75065ab8a22f2bfaa8d | /airport/src/com/test/JDBconne.java | 055a5ced9962c5d82d38361440f6bdfc87c36e75 | [] | no_license | wanghaimi/JavaWeb | 9af407df9b55d918dbf6cedb970a309c78d476ce | 7d4f8ac9ee87c1083fd046393a5d07d2792f1c11 | refs/heads/master | 2021-01-25T00:47:19.373184 | 2017-06-17T14:44:50 | 2017-06-17T14:44:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,084 | java | package com.test;
import java.sql.*;
public final class JDBconne
{
private static Connection connection = null;
public static Connection getConnetion()
{
String url = "jdbc:mysql://localhost:3306/testhangban?characterEncoding=gb2312";
String user = "root";
String password = "fan3394";
try
{
// 娉ㄩ���ゆ�烽���ゆ�烽���ゆ��
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
// ���ゆ�烽���ゆ�烽���ゆ�蜂剑���ゆ�烽��锟�
connection = DriverManager.getConnection(url, user, password);
}
catch (SQLException e)
{
}
return connection;
}
public static void closeConnection()
{
try
{
if(connection != null) connection.close();
}
catch (SQLException e)
{
}
}
}
| [
"汤琳"
] | 汤琳 |
cb2ee8adb4cc75ed93c5fb79ec6cea042028011d | fcfe3aef2d36925500e3c32e45ede54f841fa6b2 | /src/main/java/br/com/eldertec/cursospring/domain/Estado.java | 6bdfe5158602a61974aa43fac6055112b5852c17 | [] | no_license | eldertec/cursospring | b7cddd4d7786ba9d04d79495871d474245a06bbb | 62fcecdc66a9d637d850c4840402440334db169c | refs/heads/master | 2020-03-26T00:46:12.537383 | 2018-11-02T15:00:55 | 2018-11-02T15:00:55 | 143,484,609 | 0 | 0 | null | 2018-08-04T22:17:19 | 2018-08-04T00:20:32 | Java | UTF-8 | Java | false | false | 1,632 | java | package br.com.eldertec.cursospring.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class Estado implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String nome;
@JsonIgnore
@OneToMany(mappedBy = "estado")
private List<Cidade> cidades = new ArrayList<>();
public Estado() {
super();
}
public Estado(Integer id, String nome) {
super();
this.id = id;
this.nome = nome;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public List<Cidade> getCidades() {
return cidades;
}
public void setCidades(List<Cidade> cidades) {
this.cidades = cidades;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.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;
Estado other = (Estado) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"eldertec@gmail.com"
] | eldertec@gmail.com |
e333582d7a4c7fc09593f4408045a2b6610b7369 | 3cf9cf03b9e2f64b1d4f9d455b7ae9d3dc7dd2ab | /src/main/java/com/zhiyou100/video/web/controller/AdminSpeakerController.java | fc77d713a5ef89184bef1acf93df479eaeb923fd | [] | no_license | liyuhang1994/video_maven | 4150a77a248db374e82e963aed31c64e7d6104c1 | f311753aae29edaf942fededb4694b60bf5b6ccd | refs/heads/master | 2021-08-29T23:30:46.041659 | 2017-12-15T08:26:35 | 2017-12-15T08:26:35 | 114,345,417 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,522 | java | package com.zhiyou100.video.web.controller;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.zhiyou100.video.model.Speaker;
import com.zhiyou100.video.service.AdminSpeakerService;
import com.zhiyou100.video.utils.Page;
@Controller
@RequestMapping("admin/speaker/")
public class AdminSpeakerController {
@Autowired
private AdminSpeakerService ass;
// 主讲人展示列表
@RequestMapping("speakerList.action")
public String speakerList(HttpServletRequest req,Model m){
//TODO 改为Springmvc默认参数的形式
String speakerName = req.getParameter("speakerName");
String speakerJob = req.getParameter("speakerJob");
String currentPage = req.getParameter("page");
speakerName = speakerName==null?"":speakerName;
speakerJob = speakerJob==null?"":speakerJob;
currentPage = currentPage==null?"1":currentPage;
Page<Speaker> page = ass.findAllSpeaker(speakerName,speakerJob,currentPage);
m.addAttribute("speakerName", speakerName);
m.addAttribute("speakerJob", speakerJob);
m.addAttribute("page", page);
return "/admin/speaker/speakerList";
}
// 跳转到添加主讲人
@RequestMapping("speakerAddTZ.action")
public String speakerAddTZ(){
return "/admin/speaker/speakerAdd";
}
// 添加主讲人,完成后跳转到展示列表
@RequestMapping("speakerAdd.action")
public String speakerAdd(Speaker s){
s.setInsert_time(new Date());
s.setUpdate_time(new Date());
ass.AddSpeaker(s);
return "forward:/admin/speaker/speakerList.action";
}
// 跳转到编辑主讲人
@RequestMapping("speakerEditTZ.action")
public String speakerEditTZ(Integer id,Model m){
Speaker s = ass.findSpeakerById(id);
m.addAttribute("speaker", s);
return "/admin/speaker/speakerEdit";
}
// 编辑主讲人,完成后跳转到展示列表
@RequestMapping("speakerEdit.action")
public String speakerEdit(Speaker s,Integer id){
s.setId(id);
s.setUpdate_time(new Date());
ass.updateSpeakerById(s);
return "forward:/admin/speaker/speakerList.action";
}
// 删除主讲人
@RequestMapping("speakerDelete.action")
public String speakerDelete(Integer id){
ass.deleteSpeakerById(id);
return "forward:/admin/speaker/speakerList.action";
}
}
| [
"649869350@qq.com"
] | 649869350@qq.com |
9ae0e9c6d3e10882a0e5cc8aeb4a5fa3aa492480 | 7c54226bd0277fb933715a6aa1c2dd2acc7d56e9 | /com.gongpingjia.carplay.service/src/main/java/com/gongpingjia/carplay/dao/AuthenticationAhangeHistoryDao.java | a191556403a41f3dc889d124f8ba8fa35a64b1ec | [] | no_license | shuofu/hello3 | a95f2fd5a37d68bce337db66bd4aaf7e7f0307f2 | 85185b94d0c3fa104c847fc1c8e42189acd940cd | refs/heads/master | 2021-03-12T19:58:09.552441 | 2015-09-02T08:04:07 | 2015-09-02T08:04:07 | 41,786,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.gongpingjia.carplay.dao;
import com.gongpingjia.carplay.po.AuthenticationAhangeHistory;
public interface AuthenticationAhangeHistoryDao {
int deleteByPrimaryKey(String id);
int insert(AuthenticationAhangeHistory record);
AuthenticationAhangeHistory selectByPrimaryKey(String id);
int updateByPrimaryKey(AuthenticationAhangeHistory record);
} | [
"shuofu@gongpingjia.com"
] | shuofu@gongpingjia.com |
a4febc425e77dd66c721b9e8b456cbdd457a2fe9 | fd73cd8bdcf4447a70f59f439ff5d907318e582f | /app/src/main/java/com/example/harfi/appprojectmovie3/fragments/TrailerList.java | ecf8881c8056725b96d6286e59efe881de798cdb | [] | no_license | harfinovian/appMovieProject | 8474a826ef5f888d0e17e10e30008be4bbc64e71 | f8ae01b0fef987c14e08a4b0938b5baef7a0ea98 | refs/heads/master | 2022-05-28T19:34:45.232959 | 2022-05-20T15:00:41 | 2022-05-20T15:00:41 | 75,509,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,141 | java | package com.example.harfi.appprojectmovie3.fragments;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.harfi.appprojectmovie3.R;
import com.example.harfi.appprojectmovie3.adapter_details.RecyclerDetailsAdapter;
import com.example.harfi.appprojectmovie3.model.VideoDetails;
import com.example.harfi.appprojectmovie3.model.VideoList;
import com.example.harfi.appprojectmovie3.model.api.MovieService;
import io.realm.Realm;
import io.realm.RealmResults;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by harfi on 11/25/2016.
*/
public class TrailerList extends Fragment {
RecyclerView rView;
View myFragment;
Realm realm = Realm.getDefaultInstance();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
myFragment = inflater.inflate(R.layout.recycler_trailer_list, container, false);
Long id = getArguments().getLong("id");
LinearLayoutManager lLayout = new LinearLayoutManager(getActivity()){
@Override
public boolean canScrollVertically() {
return false;
}
};
lLayout.setOrientation(LinearLayoutManager.VERTICAL);
rView = (RecyclerView)myFragment.findViewById(R.id.recycler_view_trailer);
rView.setLayoutManager(lLayout);
rView.setHasFixedSize(true);
rView.setFocusable(false);
Log.e("Test","testmasuk");
getAllVideoData(id);
return myFragment;
}
@Override
public void onAttach(Activity activity) {super.onAttach(activity);}
@Override
public void onDetach() {super.onDetach();}
private void getAllVideoData(final Long id){
final RealmResults<VideoDetails> query = realm.where(VideoDetails.class)
.equalTo("movieId",id)
.findAll();
if(query.isEmpty()) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://api.themoviedb.org/")
.addConverterFactory(GsonConverterFactory.create())
.build();
MovieService movieService = retrofit.create(MovieService.class);
movieService.getVideo(id).enqueue(new Callback<VideoList>() {
@Override
public void onResponse(Call<VideoList> call, Response<VideoList> response) {
VideoList videoList = response.body();
realm.beginTransaction();
for (int i = 0; i < videoList.getResults().size(); i++) {
VideoDetails video = realm.createObject(VideoDetails.class);
video.setMovieId(id);
video.setKey(videoList.getResults().get(i).getKey());
}
realm.commitTransaction();
RealmResults<VideoDetails> temp = realm.where(VideoDetails.class)
.equalTo("movieId",id)
.findAll();
fillLayout(temp);
Log.e("videoList", videoList.toString());
}
@Override
public void onFailure(Call<VideoList> call, Throwable t) {
Log.e("gagal", t.getMessage());
}
});
}else{
Log.e("cacheVideo", query.toString());
fillLayout(query);
}
}
private void fillLayout(RealmResults<VideoDetails> temp){
RecyclerDetailsAdapter rcAdapter = new RecyclerDetailsAdapter(getActivity(), temp);
rView.setAdapter(rcAdapter);
}
} | [
"harfinovian@yahoo.com"
] | harfinovian@yahoo.com |
d1d50450ddb35a8d845dc7607ec7494a62b98681 | 0f0a6584dde5e9e2ea432ae542c3a34640e565f5 | /3.Hafta_Odev/src/com/company/StudentManager.java | af7d802781c51584bb6894a30e87969013b96cc5 | [] | no_license | Murathansolmaz1/JAVA_REACT_KAMP | ad63e420a3d3e99c3c819d6f8263041cbfa2972d | 301087051e2921e8e2403aa5f1558e1e5e426e80 | refs/heads/main | 2023-04-20T04:54:29.822440 | 2021-05-08T14:34:31 | 2021-05-08T14:34:31 | 361,522,013 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package com.company;
public class StudentManager extends User{
public void add(User user){
System.out.println("Student eklendi : " + user.getName());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
43d96f40bd8c9233fe98e96715cabfc82d9240f7 | bcb20447c2c3dddc801204967b1c90a02d467390 | /src/main/java/com/vandream/mall/business/dto/solution/SolutionDetailDTO.java | a9a972a7fdfceb4b338b6b28e9057bbfc7206bbe | [] | no_license | darling001/vandream-mall | 067a1b886c127ecdd40ee9173845a70d7e1687ce | 54b8044289a95cbcb7c4b816cf864cb827eaac66 | refs/heads/master | 2020-04-01T22:28:02.169178 | 2018-10-19T01:36:09 | 2018-10-19T01:36:09 | 153,710,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package com.vandream.mall.business.dto.solution;
/**
* @author dingjie
* @date 2018/4/2
* @time 10:16
* Description:
*/
public class SolutionDetailDTO {
/**
*需求单id
*/
private String demandId;
/**
* 派发单id
*/
private String solutionId;
}
| [
"941812251@qq.com"
] | 941812251@qq.com |
720b162040a7ce879c6a5a36d85fd71ebc71bfba | 649ad56b6d3529c4c910107b0b478d7990613f4a | /src/main/java/com/app/offerCreditApp/repository/OfferRepository.java | 55ac9e09c5f87796fcf72adb0d39c8ca6c1aa624 | [] | no_license | MaiklZak/offerCreditApp | bbfd150470f63cdb4c5c5aeb2d66dd0673e8b07a | e1dfa6da47f7f9c4f0261d673f4820be199524a5 | refs/heads/master | 2023-08-11T01:04:54.635408 | 2021-10-07T10:49:43 | 2021-10-07T10:49:43 | 410,369,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package com.app.offerCreditApp.repository;
import com.app.offerCreditApp.entity.Offer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.UUID;
@Repository
public interface OfferRepository extends JpaRepository<Offer, UUID> {
List<Offer> findByClientId(UUID clientId);
}
| [
"maiklzak@gmail.com"
] | maiklzak@gmail.com |
da2421a9c83944de3624d5af948ed2e84365a0a7 | 81215cbf169089971da60c2c99c7717df0d2c701 | /app/src/androidTest/java/com/atmobile/atmobilelibrary/ApplicationTest.java | 0f536bce108c21ec615ce6b3121ad51f18a85dc2 | [] | no_license | ATMobile/android-dev-library | f7fefe2af7da2880933be518d22f88eafe4105b9 | 6f232a26b01c34fcb3c75e9736af5ce80ff3871e | refs/heads/master | 2021-01-16T21:45:16.986320 | 2016-07-24T13:57:27 | 2016-07-24T13:57:27 | 64,067,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.atmobile.atmobilelibrary;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"atanerhp@gmail.com"
] | atanerhp@gmail.com |
97bcbcee7b25b6c2ea125e03e07e041863c71253 | 523eb7a781076f4efe481ff8e19d98868d147c2b | /src/main/java/com/niit/shoppingcart/dao/CategoryDAOImpl.java | cf9b6e029041258e024fb2fc8268a7d86b286c6b | [] | no_license | vakula/ShoppingCart | 4e757a58820090879e9ceb829d01a7ae9139fc7d | 987001968b48ceb6c23636d94289729690b475c8 | refs/heads/master | 2020-05-21T16:17:53.890169 | 2016-12-16T05:45:38 | 2016-12-16T05:45:38 | 64,550,444 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,896 | java | package com.niit.shoppingcart.dao;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.niit.shoppingcart.model.Category;
@Repository("categoryDAO")
public class CategoryDAOImpl implements CategoryDAO {
public List<Category> list() {
return null;
}
@Autowired
private SessionFactory sessionFactory;
public CategoryDAOImpl(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Transactional
public Category get(String id) {
// TODO Auto-generated method stub
// sessionFactory.getCurrentSession().get(Category.class,id);
String hql = "from Category where categoryId=" + "'" + id + "'";
Query query = sessionFactory.getCurrentSession().createQuery(hql);
@SuppressWarnings("unchecked")
List<Category> listCategory = query.list();
if (listCategory != null && !listCategory.isEmpty()) {
return listCategory.get(0);
}
return null;
}
@Transactional
public void saveOrUpdate(Category category) {
// TODO Auto-generated method stub
sessionFactory.getCurrentSession().saveOrUpdate(category);
}
@Transactional
public void delete(String Id) {
// TODO Auto-generated method stub
Category CategoryToDelete = new Category();
CategoryToDelete.setId(Id);
sessionFactory.getCurrentSession().delete(CategoryToDelete);
}
@Transactional
public List<Category> listCategory() {
// TODO Auto-generated method stub
@SuppressWarnings("unchecked")
List<Category> listCategory = sessionFactory.getCurrentSession().createCriteria(Category.class)
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
return listCategory;
}
}
| [
"sabarishreddy@gmail.com"
] | sabarishreddy@gmail.com |
762457819a0f341d1a7b2a8727eb250dc959cb37 | 5322a2d78ba2a494462c650bf4a77c62d814811c | /app/src/main/java/com/joseludev/locatia/application/dialogs/GpsAlertDialogFragment.java | 7f5a9243cd059e4cd9ee5987274f11701fc8fb20 | [] | no_license | akbarazimifar/Locatia | 8bf8d61501839cdaad2cb43ea7fedf470e341e73 | e44c1f984b92685325c403947d709519efb63fd2 | refs/heads/master | 2023-07-28T04:49:38.221077 | 2021-09-07T12:18:26 | 2021-09-07T12:18:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,632 | java | package com.joseludev.locatia.application.dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import com.joseludev.locatia.R;
import java.util.Objects;
public class GpsAlertDialogFragment extends DialogFragment {
private GpsAlertDialogFragment() {
}
public static GpsAlertDialogFragment newInstance() {
GpsAlertDialogFragment fragment = new GpsAlertDialogFragment();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = Objects.requireNonNull(getActivity()).getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_fragment_gps_alert, null);
view.findViewById(R.id.cancel_button).setOnClickListener(v -> {
this.dismiss();
});
view.findViewById(R.id.confirm_button).setOnClickListener(v -> {
Intent callGPSSettingIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(callGPSSettingIntent);
this.dismiss();
});
builder.setView(view);
return builder.create();
}
} | [
"joseludev@gmail.com"
] | joseludev@gmail.com |
2282d4ba46e6a9a755a96f0a189e70262c63088e | 214d727317ef1b889eb1bacee31a0dd8ab408d91 | /src/model/creator/models/TerrainModel.java | 19d65766a977613a756a315f9e38e49fddc4284e | [] | no_license | bublikdrdrdr/ModelCreator | 9ef48d5182c9e78924ecb8c2cbb7ce4f9e3eff73 | 0af40246c42ecb8cbe885782892b3eb00a0806d7 | refs/heads/master | 2021-01-20T22:02:30.256429 | 2017-11-22T18:00:00 | 2017-11-22T18:00:00 | 101,796,455 | 0 | 0 | null | 2017-11-02T14:38:05 | 2017-08-29T19:01:43 | Java | UTF-8 | Java | false | false | 3,508 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package model.creator.models;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import java.util.Random;
import model.creator.graphics.Model;
import model.creator.graphics.PolyAnimation;
import model.creator.graphics.Polygon;
/**
*
* @author Bublik
*/
public class TerrainModel extends Model{
Vector3f[] points = new Vector3f[]{
new Vector3f(0,0,0),
new Vector3f(3,0,0),
new Vector3f(5,0,0),
new Vector3f(2.5f,0,1),
new Vector3f(1,0,2),
new Vector3f(4.5f, 0, 2),
new Vector3f(0,0,2.5f),
new Vector3f(3,0,2.5f),
new Vector3f(2,0,3.5f),
new Vector3f(5,0,3.5f),
new Vector3f(3.5f, 0,4),
new Vector3f(0,0,5),
new Vector3f(1.5f, 0,5),
new Vector3f(3.5f, 0,5),
new Vector3f(5,0,5)
};
float b = 256;
long dur = 200;
ColorRGBA[] colors = new ColorRGBA[]{
new ColorRGBA(118/b, 164/b, 65/b, 1),
new ColorRGBA(93/b, 145/b, 63/b, 1),
new ColorRGBA(86/b, 137/b, 62/b, 1),
new ColorRGBA(131/b, 178/b, 64/b, 1),
new ColorRGBA(46/b, 104/b, 53/b, 1),
};
public TerrainModel() {
PolyAnimation buildAnimation = new PolyAnimation("build");
Polygon[] buildPolygons = new Polygon[]{
p(0, 1, 1, 0, 3, 1, dur, d(2)),
p(1,2,2,1,5,2, dur, 0),
p(3,1,1,3,5,1, dur, d(2)),
p(5,3,3,5,3,7, dur, d(3)),
p(4,7,7,4,7,3, dur, d(1)),
p(4,3,3,4,3,0, dur, d(4)),
p(0,6,6,0,6,4, dur, 0),
p(7,9,9,7,9,5, dur, d(1)),
p(5,9,9,5,9,2, dur, d(2)),
p(7,4,4,7,4,8, dur, d(1)),
p(6,8,8,6,8,4, dur, d(2)),
p(6,11,11,6,11,8, dur, d(3)),
p(11,12,12,11,12,8, dur, 0),
p(8,10,10,8,10,7, dur, d(4)),
p(7,10,10,7,10,9, dur, d(4)),
p(14,9,9,14,9,10, dur, 0),
p(10,13,13,10,13,14, dur, d(3)),
p(8,12,12,8,12,10, dur, d(1)),
p(10,12,12,10,12,13, dur, d(2)),
};
for (Polygon polygon: buildPolygons){
buildAnimation.addPolygon(polygon);
}
this.addAnimation(buildAnimation);
}
private ColorRGBA c(int index){
return colors[index];
}
private Vector3f v(int index){
return points[index];
}
private long d(int mult){
return dur*mult;
}
Random random = new Random();
int last = -1;
private ColorRGBA pr(){
if (last==-1){
last = random.nextInt(colors.length-1);
return colors[last];
} else{
ColorRGBA res = colors[last];
last = -1;
return res;
}
}
private Polygon p(int s1, int s2, int s3, int e1, int e2, int e3, long time, long delay){
return p(s1, s2, s3, e1, e2, e3, time, delay, pr());
}
private Polygon p(int s1, int s2, int s3, int e1, int e2, int e3, long time, long delay, int color){
return p(s1, s2, s3, e1, e2, e3, time, delay, c(color));
}
private Polygon p(int s1, int s2, int s3, int e1, int e2, int e3, long time, long delay, ColorRGBA color){
return new Polygon(color, color, new Vector3f[]{v(s1), v(s2),v(s3)}, new Vector3f[]{v(e1),v(e2),v(e3)}, time, delay);
}
}
| [
"bublik.drdrdr@gmail.com"
] | bublik.drdrdr@gmail.com |
6cc6965d97b5b9317bc0d5eb715e2b32838fb0d4 | 2dddd151fe16c6b7939dad6fd47b0c1b42c64f1f | /Datastructure/src/Slow/slicing/two_three_fourtree/Node.java | 08810f5d208ab586d1ea7556261ea2441d072b7b | [] | no_license | slicing/Data-structure | 01fba28cbaf47b68f692da5f6652d323536aff14 | 03e090fef54f8b833b916ea6e754ed1e4dcda47b | refs/heads/master | 2020-03-31T13:55:04.609957 | 2018-11-13T15:27:51 | 2018-11-13T15:27:51 | 152,272,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,683 | java | package Slow.slicing.two_three_fourtree;
public class Node {
private static final int ORDER = 4;
private int numItem;
private Node parent;
private Node childArray[] = new Node[ORDER];
private DataItem itemArray[] = new DataItem[ORDER-1];
public void connectChild(int childNum,Node child){
childArray[childNum] = child;
if (child != null)
child.parent = this;
}
public Node disconnectChild(int childNum){
Node tempNode = childArray[childNum];
childArray[childNum] = null;
return tempNode;
}
public Node getChild(int childNum){
return childArray[childNum];
}
public Node getParent() {
return parent;
}
public boolean isLeaf(){
return childArray[0] == null;
}
public int getNumItem() {
return numItem;
}
public DataItem getItem(int index){
return itemArray[index];
}
public boolean isFull(){
return numItem == ORDER-1;
}
public int findItem(long key){
for (int i = 0;i<ORDER;i++){
if (itemArray[i] == null)
break;
else if (itemArray[i].dData == key)
return i;
}
return -1;
}
public int insertItem(DataItem newItem){
numItem++;
long newKey = newItem.dData;
for (int i=ORDER-2;i>=0;i--){
if (itemArray[i] == null)
continue;
else {
long itsKey = itemArray[i].dData;
if (newKey< itsKey)
itemArray[i+1] = itemArray[i];
else {
itemArray[i+1] = newItem;
return i=1;
}
}
}
itemArray[0] = newItem;
return 0;
}
public DataItem removeItem(){
DataItem temp = itemArray[numItem-1];
itemArray[numItem-1] = null;
numItem--;
return temp;
}
public void displayNode(){
for (int i = 0;i<numItem;i++)
itemArray[i].displayItem();
System.out.println("/");
}
}
| [
"slow_slicing@qq.com"
] | slow_slicing@qq.com |
a40f015aa1c61a9cce2e924ba272b534a9198c25 | 234f53c02fa0c93be43a8d9066ddabddf393e99a | /src/main/java/com/xingxue/class11/framework/interceptor/LoginInterceptor.java | 78b0fd39579f8e591ca12e6021eca3183b1ad995 | [] | no_license | JemyHe/elecDemo2015 | 89195e5e0ff37665feeab69dccce69f41147b70f | 49b19f6c23cc4548fa933e515e0b4adda15e0da7 | refs/heads/master | 2021-09-09T20:21:23.741304 | 2018-03-19T14:09:35 | 2018-03-19T14:09:37 | 125,868,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,820 | java | package com.xingxue.class11.framework.interceptor;
import com.xingxue.class11.framework.entity.WebUser;
import com.xingxue.class11.util.CookieUtil;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 登陆拦截器
*/
public class LoginInterceptor implements HandlerInterceptor {
/**
* 请求结束后执行
* @param request
* @param response
* @param obj
* @param ex
* @throws Exception
*/
@Override
public void afterCompletion(HttpServletRequest request,
HttpServletResponse response, Object obj, Exception ex)
throws Exception {
}
/**
* 请求中
* @param request
* @param response
* @param obj
* @param modelAndView
* @throws Exception
*/
@Override
public void postHandle(HttpServletRequest request,
HttpServletResponse response, Object obj, ModelAndView modelAndView)
throws Exception {
}
/**
* 在拦截之前执行
* 返回true 继续执行该请求
* 返回false 请求终止
* @param request
* @param response
* @param handler
* @return
* @throws Exception
*/
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
//判断cookie中是否有登录信息
WebUser webUser = CookieUtil.getLoginUser(request);
if (null == webUser) {
//没有登录过,跳转到登录页面
//http https + //: + localhost : 8080
String basePath = request.getScheme() + "//:" + request.getServerName() + ":" + request.getServerPort();
response.sendRedirect(basePath + "/user/login");
return false;
}
return true;
}
} | [
"546016981@qq.com"
] | 546016981@qq.com |
460dab5d267a0b36c554b90a9591907e3d4fb69a | 200d9799f7c3114bf697f55329a1676d993a6d19 | /src/main/java/com/example/manyToManyLab/repositories/EmployeeRepository.java | 22de0a82be5599e03cd199b3566af9e02f3a6b12 | [] | no_license | robbobby/many-to-many-lab | 106b7055701384ef3bfc1c9bf4abdcf20e4006b8 | 081fbff61428d6e74b015ffec4b1254bf5e5ce37 | refs/heads/main | 2023-02-24T01:53:59.399313 | 2021-01-19T11:35:50 | 2021-01-19T11:35:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package com.example.manyToManyLab.repositories;
import com.example.manyToManyLab.models.Employee;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface EmployeeRepository extends JpaRepository<Employee, Long> {
}
| [
"ruthlilfoulis@gmail.com"
] | ruthlilfoulis@gmail.com |
c39db84679a0b53be83ac9c215188c8c8fda39d3 | 70ba5ec98ee883364232f965c8e17a339806d4c1 | /Rates/src/test/java/model/DateRangeTest.java | 953c9518a9f92e1e7f7b1f4661ba869f50d2a3e3 | [] | no_license | Witek93/NbpCurrencyExchangeRates | 013461c83d18d4188d0e556b8696a2c57b78f96d | d4761a63b5aca169f48eb21ed7218b166d096f7c | refs/heads/master | 2021-03-27T13:31:29.353477 | 2017-05-05T18:26:52 | 2017-05-05T18:26:52 | 87,228,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,937 | java | package model;
import org.junit.Test;
import java.time.LocalDate;
import java.time.Year;
import java.util.Collection;
import static org.assertj.core.api.Assertions.assertThat;
public class DateRangeTest {
@Test(expected = IllegalArgumentException.class)
public void shouldFail_withNullStartDate() throws Exception {
new DateRange(null, LocalDate.now());
}
@Test(expected = IllegalArgumentException.class)
public void shouldFail_withNullEndDate() throws Exception {
new DateRange(LocalDate.now(), null);
}
@Test(expected = IllegalArgumentException.class)
public void shouldFail_withStartDateAfterEndDate() throws Exception {
LocalDate now = LocalDate.now();
new DateRange(now.plusDays(1), now);
}
@Test
public void getDays_shouldReturnOneDay_forRangeFromTodayToToday() throws Exception {
LocalDate today = LocalDate.now();
DateRange dateRange = new DateRange(today, today);
Collection<LocalDate> days = dateRange.getDays();
assertThat(days)
.hasSize(1)
.containsExactly(today);
}
@Test
public void getDays_shouldReturnMultipleDays() throws Exception {
LocalDate startDate = LocalDate.now();
LocalDate endDate = startDate.plusDays(42);
DateRange dateRange = new DateRange(startDate, endDate);
Collection<LocalDate> days = dateRange.getDays();
assertThat(days)
.containsOnlyOnce(startDate, endDate);
}
@Test
public void getYears_shouldReturnMultipleYears() throws Exception {
LocalDate startDate = LocalDate.now();
LocalDate endDate = startDate.plusYears(3);
DateRange dateRange = new DateRange(startDate, endDate);
Collection<Year> years = dateRange.getYears();
assertThat(years)
.containsOnlyOnce(Year.from(startDate), Year.from(endDate));
}
} | [
"karol.witaszczyk@gmail.com"
] | karol.witaszczyk@gmail.com |
7d7792af55ee6f43a92bd90fa1a094fd760ffc3c | 00531c2ffc11722b3c410323018bd5c4a99762ef | /src/main/java/com/pichangas/config/Constants.java | cb52e677539c105fd8fd8bfce25e4a85f0993db2 | [] | no_license | MIJAEL888/Pichangas | c875445705dffd18dfa76fe7249cd3483d8bbdb4 | 0aaf24dc1b952d554c8b915884839a2cd8411dbb | refs/heads/master | 2020-03-11T04:16:29.124602 | 2018-08-28T17:37:06 | 2018-08-28T17:37:06 | 129,772,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.pichangas.config;
/**
* Application constants.
*/
public final class Constants {
// Regex for acceptable logins
public static final String LOGIN_REGEX = "^[_.@A-Za-z0-9-]*$";
public static final String SYSTEM_ACCOUNT = "system";
public static final String ANONYMOUS_USER = "anonymoususer";
public static final String DEFAULT_LANGUAGE = "en";
private Constants() {
}
}
| [
"mijael888@gmail.com"
] | mijael888@gmail.com |
100a58c7469f38c506784442b404013730a206e8 | 9751b5aa8b59f0affb357b2e4a389374edb059c7 | /app/src/main/java/com/example/potheghate/phoneCodeOtp.java | 37bdac36f4ed2aa7a7fcb897d32a690ca6237b4a | [] | no_license | esterified/Potheghate-Android-App | c9b3aeac4f05d285950b4b616104916813179d80 | 9cd43a10d5a279588865fec3111e249a8f9a6979 | refs/heads/main | 2023-07-15T17:38:03.692387 | 2021-08-26T22:40:35 | 2021-08-26T22:40:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,940 | java | package com.example.potheghate;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.example.potheghate.utils.progressBar;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.FirebaseException;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
import com.google.firebase.auth.PhoneAuthCredential;
import com.google.firebase.auth.PhoneAuthOptions;
import com.google.firebase.auth.PhoneAuthProvider;
import com.google.firebase.database.FirebaseDatabase;
import java.util.concurrent.TimeUnit;
import static com.google.firebase.auth.FirebaseAuth.getInstance;
public class phoneCodeOtp extends AppCompatActivity {
private static final String TAG = "code";
private Button confirm;
private FirebaseAuth mAuth;
private String mVerificationId;
// private ProgressBar p_bar;
private EditText Codeview;
private LinearLayout lin;
private PhoneAuthProvider.ForceResendingToken Token;
private progressBar progBar;
//--------------------------------------------------------------------------------------------
//CODE FOR PHONE VERIFICATION
//needs no password just phone number and OTP verification everytime
//-------------------------------------------------------------------------------------------
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
progBar=new progressBar(this);
progBar.show();
setContentView(R.layout.activity_phone_code_otp);
Codeview = findViewById(R.id.regPhnOTP);
confirm = findViewById(R.id.buttonC);
//p_bar = findViewById(R.id.progressBar);
TextView resend=findViewById(R.id.viewResend);
mAuth = getInstance();
confirm.setEnabled(false);
// p_bar.setVisibility(View.VISIBLE);
String phoneNumber=getIntent().getStringExtra("phone");
phoneAuthStart(phoneNumber);
confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String t=Codeview.getText().toString();
if(!t.isEmpty()){
SignInWithCode(t);
}
}
});
resend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
resendVerificationCode(phoneNumber,Token);
}
});
}
PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(@NonNull PhoneAuthCredential credential) {
// This callback will be invoked in two situations:
// 1 - Instant verification. In some cases the phone number can be instantly
// verified without needing to send or enter a verification code.
// 2 - Auto-retrieval. On some devices Google Play services can automatically
// detect the incoming verification SMS and perform verification without
// user action.
//Log.d(TAG, "onVerificationCompleted:" + credential);
//p_bar.setVisibility(View.GONE);
progBar.dismiss();
signInWithPhoneAuthCredential(credential);
Log.d(TAG, "onVerificationCompleted: ");
Toast.makeText(getApplicationContext(), "Successful", Toast.LENGTH_LONG).show();
}
@Override
public void onVerificationFailed(@NonNull FirebaseException e) {
// This callback is invoked in an invalid request for verification is made,
// for instance if the the phone number format is not valid.
// p_bar.setVisibility(View.GONE);
progBar.dismiss();
Log.d(TAG, "verification failed ");
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
}
@Override
public void onCodeSent(@NonNull String s, @NonNull PhoneAuthProvider.ForceResendingToken forceResendingToken) {
super.onCodeSent(s, forceResendingToken);
// The SMS verification code has been sent to the provided phone number, we
// now need to ask the user to enter the code and then construct a credential
// by combining the code with a verification ID.
Log.d(TAG, "onCodeSent: ");
//Toast.makeText(getApplicationContext(), "CodeSent", Toast.LENGTH_SHORT).show();
confirm.setEnabled(true);
// p_bar.setVisibility(View.GONE);
progBar.dismiss();
mVerificationId = s;
Token=forceResendingToken;
//String code = Codeview.getText().toString();
}
@Override
public void onCodeAutoRetrievalTimeOut(@NonNull String s) {
super.onCodeAutoRetrievalTimeOut(s);
}
};
private void phoneAuthStart(String phoneNumber) {
Log.d(TAG, "verify: ");
PhoneAuthOptions options =
PhoneAuthOptions.newBuilder(mAuth)
.setPhoneNumber(phoneNumber) // Phone number to verify
.setTimeout(60L, TimeUnit.SECONDS) // Timeout and unit
.setActivity(phoneCodeOtp.this) // Activity (for callback binding)
.setCallbacks(mCallbacks) // OnVerificationStateChangedCallbacks
.build();
PhoneAuthProvider.verifyPhoneNumber(options);
Toast.makeText(getApplicationContext(), "Verifying....", Toast.LENGTH_SHORT).show();
}
private void SignInWithCode(String code) {
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(mVerificationId, code);
Log.d(TAG, code);
if(credential.getSmsCode()!=null) {
Log.d(TAG, credential.getSmsCode());
}
signInWithPhoneAuthCredential(credential);
}
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
FirebaseAuth mAuth = getInstance();
mAuth.signInWithCredential(credential)
.addOnCompleteListener(phoneCodeOtp.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
String a=FirebaseAuth.getInstance().getCurrentUser().getPhoneNumber();
String uid=FirebaseAuth.getInstance().getCurrentUser().getUid();
//migrate the phone number info from admin base to realtime database
FirebaseDatabase.getInstance().getReference().child("users").child(uid).child("phone").setValue(a);
Toast.makeText(getApplicationContext(), "Completed", Toast.LENGTH_SHORT).show();
Log.d(TAG, "onComplete: "+a);
startActivity(new Intent(getApplicationContext(), dashboardActivity.class));
}
else {
// Sign in failed, display a message and update the UI
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
// The verification code entered was invalid
Toast.makeText(getApplicationContext(), "Sign in Failed", Toast.LENGTH_SHORT).show();
}
}
}
});
}
private void resendVerificationCode(String phoneNumber,
PhoneAuthProvider.ForceResendingToken token) {
PhoneAuthOptions options =
PhoneAuthOptions.newBuilder(mAuth)
.setPhoneNumber(phoneNumber) // Phone number to verify
.setTimeout(60L, TimeUnit.SECONDS) // Timeout and unit
.setActivity(phoneCodeOtp.this) // Activity (for callback binding)
.setCallbacks(mCallbacks) // OnVerificationStateChangedCallbacks
.setForceResendingToken(token)
.build();
PhoneAuthProvider.verifyPhoneNumber(options);
}
}
| [
"fayed1589@gmail.com"
] | fayed1589@gmail.com |
5cfa627a31eb01361a5b9bad87e9fdde5aebb9cf | dfc932cb84de00de336a96d6c8aad6433c2f3ade | /app/src/main/java/com/example/vi6/tabbed/KeyboardFragment.java | 0fd02acbb8b6a9ad869975e7658294410e974837 | [] | no_license | friendfill4/stickerbox-keyboard | 867f4a399bb8fcc72ee89bb5b7363e8a77b0f3d9 | 88a61be12047702425ff64cec95dedb8b0f24dc5 | refs/heads/master | 2022-11-05T12:30:25.567185 | 2020-06-27T08:19:28 | 2020-06-27T08:19:28 | 275,317,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,825 | java | package com.example.vi6.tabbed;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
/**
* Created by vi6 on 27-Feb-17.
*/
public class KeyboardFragment extends Fragment{
String imageUrl;
FragmentActivity ctx;
/*
@Override
public void onAttach(Context context) {
ctx=(FragmentActivity)context;
super.onAttach(ctx);
}*/
/* @Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
imageUrl = getArguments().getString("imageUrl");
}*/
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_2, container, false);
com.example.vi6.tabbed.SquareImageView imageView = (SquareImageView) view.findViewById(R.id.keyboardGif);
Log.e("IMAGEURL : ",imageUrl);
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(imageView);
Glide.with(getActivity()).load(imageUrl).diskCacheStrategy(DiskCacheStrategy.ALL).placeholder(R.drawable.loading).into(imageViewTarget);
Bundle args= new Bundle();
args.putString("imageUrl",imageUrl);
setArguments(args);
return view;
}
public KeyboardFragment (String imageUrl) {
this.imageUrl = imageUrl;
}
}
| [
"jahid.dal@brainvire.com"
] | jahid.dal@brainvire.com |
95d1bc714510f0c4aa22e5b8abc0894f30554348 | 379a94b596d20c9275af067c4d5525d82f806f59 | /app/src/main/java/com/dimine/cardcar/utils/Md5Util.java | 3c8e5d2d4a823cf94e8ba804ceceb23565ff9194 | [] | no_license | zengyongsun/carapp | b624d2fa30683162bc9e508ac5aa8c3462891bbb | 2e13b330d0a079ef66142fc9e5315616c0c10e07 | refs/heads/master | 2022-12-19T12:59:00.529087 | 2020-08-12T03:28:41 | 2020-08-12T03:28:41 | 296,605,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,768 | java | package com.dimine.cardcar.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* @author : Zeyo
* e-mail : zengyongsun@163.com
* date : 2019/11/11 11:34
* desc :
* version: 1.0
*/
public class Md5Util {
public static String getFileMD5(File file) {
if (!file.exists()) {
return "";
}
FileInputStream in = null;
try {
in = new FileInputStream(file);
FileChannel channel = in.getChannel();
MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(buffer);
return bytes2Hex(md.digest());
} catch (NoSuchAlgorithmException | IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ignored) {
}
}
}
return "";
}
/**
* 一个byte转为2个hex字符
*
* @param src byte数组
* @return 16进制大写字符串
*/
public static String bytes2Hex(byte[] src) {
char[] res = new char[src.length << 1];
final char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
for (int i = 0, j = 0; i < src.length; i++) {
res[j++] = hexDigits[src[i] >>> 4 & 0x0f];
res[j++] = hexDigits[src[i] & 0x0f];
}
return new String(res);
}
}
| [
"zengyongsun@163.com"
] | zengyongsun@163.com |
c4aa5b98d1f582eee611018913b4039ad78c029d | 4a294fffe8cf42905e77bbd9aed5fc8d2e50619c | /src/main/java/com/interview/finra/exception/ControllerExceptionHandler.java | 9bfc75144a88e02f730134cc5b7a32b2aebd4347 | [] | no_license | akruthim/Finra-File-Upload | 3a95301a0b8a32633b95119ac98aae5a847845f9 | 2e5ea23a15dca0f358436384b7fc6dcf10f2b4cb | refs/heads/master | 2020-05-19T22:34:05.817631 | 2019-05-07T01:45:23 | 2019-05-07T01:45:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 956 | java | package com.interview.finra.exception;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
@ControllerAdvice
public class ControllerExceptionHandler {
private final Logger logger = LoggerFactory.getLogger(ControllerExceptionHandler.class);
@ResponseStatus(reason = "File metadata or file upload failed. Try after sometime")
@ExceptionHandler(FileUploadFailedException.class)
public void fileUploadFailureExceptionHandler(FileUploadFailedException ex) {
logger.error("Exception occurred: ", ex);
}
@ResponseStatus(reason = "Ouch. Operation failed. Please try again.")
@ExceptionHandler(Exception.class)
public void genericExceptionHandler(Exception ex) {
logger.error("Exception occurred: ", ex);
}
}
| [
"akruthimamillapalli@akruthis-MBP.fios-router.home"
] | akruthimamillapalli@akruthis-MBP.fios-router.home |
a1a3d3cf693c82cdd4430dd8b6a649ca1535e1e0 | d2310f985771b4f5b6a10223f9692425c05cf6a2 | /microraft/src/test/java/io/microraft/impl/RaftNodeLifecycleAwareTest.java | 49fc23661345b024a7f2deb6a498ea70c242bcb1 | [
"Apache-2.0"
] | permissive | mdogan/MicroRaft | 05f72efa9b26a83738df90e072b77697c5ce1edb | fee64c5936faacf9ed926d5174b7a12b77d58d06 | refs/heads/master | 2023-08-16T00:03:53.829585 | 2021-09-08T22:00:23 | 2021-09-08T22:00:23 | 402,744,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,478 | java | /*
* Copyright (c) 2020, MicroRaft.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.microraft.impl;
import io.microraft.RaftEndpoint;
import io.microraft.RaftNode;
import io.microraft.RaftNodeStatus;
import io.microraft.executor.impl.DefaultRaftNodeExecutor;
import io.microraft.impl.local.LocalRaftEndpoint;
import io.microraft.lifecycle.RaftNodeLifecycleAware;
import io.microraft.model.groupop.UpdateRaftGroupMembersOp.UpdateRaftGroupMembersOpBuilder;
import io.microraft.model.impl.DefaultRaftModelFactory;
import io.microraft.model.log.LogEntry;
import io.microraft.model.log.LogEntry.LogEntryBuilder;
import io.microraft.model.log.RaftGroupMembersView;
import io.microraft.model.log.SnapshotChunk;
import io.microraft.model.log.SnapshotChunk.SnapshotChunkBuilder;
import io.microraft.model.log.SnapshotEntry.SnapshotEntryBuilder;
import io.microraft.model.message.AppendEntriesFailureResponse.AppendEntriesFailureResponseBuilder;
import io.microraft.model.message.AppendEntriesRequest;
import io.microraft.model.message.AppendEntriesSuccessResponse;
import io.microraft.model.message.InstallSnapshotRequest.InstallSnapshotRequestBuilder;
import io.microraft.model.message.InstallSnapshotResponse.InstallSnapshotResponseBuilder;
import io.microraft.model.message.PreVoteRequest.PreVoteRequestBuilder;
import io.microraft.model.message.PreVoteResponse.PreVoteResponseBuilder;
import io.microraft.model.message.RaftMessage;
import io.microraft.model.message.TriggerLeaderElectionRequest.TriggerLeaderElectionRequestBuilder;
import io.microraft.model.message.VoteRequest.VoteRequestBuilder;
import io.microraft.model.message.VoteResponse.VoteResponseBuilder;
import io.microraft.persistence.RaftStore;
import io.microraft.report.RaftNodeReport;
import io.microraft.report.RaftNodeReportListener;
import io.microraft.statemachine.StateMachine;
import io.microraft.test.util.BaseTest;
import io.microraft.transport.Transport;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletionException;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
public class RaftNodeLifecycleAwareTest
extends BaseTest {
private final RaftEndpoint localEndpoint = LocalRaftEndpoint.newEndpoint();
private final List<RaftEndpoint> initialMembers = Arrays
.asList(localEndpoint, LocalRaftEndpoint.newEndpoint(), LocalRaftEndpoint.newEndpoint());
private final DelegatingRaftNodeExecutor executor = new DelegatingRaftNodeExecutor();
private final NopTransport transport = new NopTransport();
private final NopStateMachine stateMachine = new NopStateMachine();
private final DelegatingRaftModelFactory modelFactory = new DelegatingRaftModelFactory();
private final NopRaftNodeReportListener reportListener = new NopRaftNodeReportListener();
private final NopRaftStore store = new NopRaftStore();
private RaftNode raftNode;
@Before
public void init() {
raftNode = RaftNode.newBuilder().setGroupId("default").setLocalEndpoint(localEndpoint)
.setInitialGroupMembers(initialMembers).setExecutor(executor).setTransport(transport)
.setStateMachine(stateMachine).setModelFactory(modelFactory).setRaftNodeReportListener(reportListener)
.setStore(store).build();
}
@After
public void tearDown() {
if (raftNode != null) {
raftNode.terminate();
}
}
@Test
public void testExecutorStart() {
raftNode.start().join();
assertThat(executor.startCall).isGreaterThan(0);
assertThat(executor.executeCall).isGreaterThan(0);
assertThat(executor.executeCall).isLessThan(executor.startCall);
}
@Test
public void testExecutorTerminate() {
raftNode.start().join();
raftNode.terminate().join();
assertThat(executor.startCall).isGreaterThan(0);
assertThat(executor.executeCall).isGreaterThan(0);
assertThat(executor.terminateCall).isGreaterThan(0);
assertThat(executor.executeCall).isLessThan(executor.startCall);
assertThat(executor.lastExecuteCall).isLessThan(executor.terminateCall);
}
@Test
public void testTransportStart() {
raftNode.start().join();
assertThat(transport.startCall).isGreaterThan(0);
assertThat(transport.sendCall).isGreaterThan(0);
assertThat(transport.startCall).isLessThan(transport.sendCall);
}
@Test
public void testTransportTerminate() {
raftNode.start().join();
raftNode.terminate().join();
assertThat(transport.startCall).isGreaterThan(0);
assertThat(transport.sendCall).isGreaterThan(0);
assertThat(transport.terminateCall).isGreaterThan(0);
assertThat(transport.startCall).isLessThan(transport.sendCall);
assertThat(transport.sendCall).isLessThan(transport.terminateCall);
assertThat(transport.lastSendCall).isLessThan(transport.terminateCall);
}
@Test
public void testStateMachineStart() {
raftNode.start().join();
assertThat(stateMachine.startCall).isGreaterThan(0);
}
@Test
public void testStateMachineTerminate() {
raftNode.start().join();
raftNode.terminate().join();
assertThat(stateMachine.startCall).isGreaterThan(0);
assertThat(stateMachine.terminateCall).isGreaterThan(0);
assertThat(stateMachine.startCall).isLessThan(stateMachine.terminateCall);
}
@Test
public void testModelFactoryStart() {
raftNode.start().join();
assertThat(modelFactory.startCall).isGreaterThan(0);
assertThat(modelFactory.createCall).isGreaterThan(0);
assertThat(modelFactory.startCall).isLessThan(modelFactory.createCall);
}
@Test
public void testModelFactoryTerminate() {
raftNode.start().join();
raftNode.terminate().join();
assertThat(modelFactory.startCall).isGreaterThan(0);
assertThat(modelFactory.createCall).isGreaterThan(0);
assertThat(modelFactory.terminateCall).isGreaterThan(0);
assertThat(modelFactory.startCall).isLessThan(modelFactory.createCall);
assertThat(modelFactory.createCall).isLessThan(modelFactory.terminateCall);
assertThat(modelFactory.lastCreateCall).isLessThan(modelFactory.terminateCall);
}
@Test
public void testReportListenerStart() {
raftNode.start().join();
assertThat(reportListener.startCall).isGreaterThan(0);
assertThat(reportListener.acceptCall).isGreaterThan(0);
assertThat(reportListener.startCall).isLessThan(reportListener.acceptCall);
}
@Test
public void testReportListenerTerminate() {
raftNode.start().join();
raftNode.terminate().join();
assertThat(reportListener.startCall).isGreaterThan(0);
assertThat(reportListener.acceptCall).isGreaterThan(0);
assertThat(reportListener.terminateCall).isGreaterThan(0);
assertThat(reportListener.startCall).isLessThan(reportListener.acceptCall);
assertThat(reportListener.acceptCall).isLessThan(reportListener.terminateCall);
assertThat(reportListener.lastAcceptCall).isLessThan(reportListener.terminateCall);
}
@Test
public void testStoreStart() {
raftNode.start().join();
assertThat(store.startCall).isGreaterThan(0);
assertThat(store.persistCall).isGreaterThan(0);
assertThat(store.startCall).isLessThan(store.persistCall);
}
@Test
public void testStoreTerminate() {
raftNode.start().join();
raftNode.terminate().join();
assertThat(store.startCall).isGreaterThan(0);
assertThat(store.persistCall).isGreaterThan(0);
assertThat(store.terminateCall).isGreaterThan(0);
assertThat(store.startCall).isLessThan(store.persistCall);
assertThat(store.persistCall).isLessThan(store.terminateCall);
assertThat(store.lastPersistCall).isLessThan(store.terminateCall);
}
@Test
public void testTerminateCalledForAllComponentsWhenStartFails() {
stateMachine.failOnStart = true;
try {
raftNode.start().join();
fail("Start should fail when any component fails on start");
} catch (CompletionException ignored) {
}
assertThat(raftNode.getStatus()).isEqualTo(RaftNodeStatus.TERMINATED);
assertThat(stateMachine.terminateCall).isGreaterThan(0);
if (executor.startCall > 0) {
assertThat(executor.terminateCall).isGreaterThan(0);
}
if (transport.startCall > 0) {
assertThat(transport.terminateCall).isGreaterThan(0);
}
if (store.startCall > 0) {
assertThat(store.terminateCall).isGreaterThan(0);
}
if (modelFactory.startCall > 0) {
assertThat(modelFactory.terminateCall).isGreaterThan(0);
}
if (reportListener.startCall > 0) {
assertThat(reportListener.terminateCall).isGreaterThan(0);
}
}
@Test
public void testTerminateCalledForAllComponentsWhenStartAndTerminateFails() {
stateMachine.failOnStart = true;
stateMachine.failOnTerminate = true;
try {
raftNode.start().join();
fail("Start should fail when any component fails on start");
} catch (CompletionException ignored) {
}
assertThat(raftNode.getStatus()).isEqualTo(RaftNodeStatus.TERMINATED);
assertThat(stateMachine.terminateCall).isGreaterThan(0);
if (executor.startCall > 0) {
assertThat(executor.terminateCall).isGreaterThan(0);
}
if (transport.startCall > 0) {
assertThat(transport.terminateCall).isGreaterThan(0);
}
if (store.startCall > 0) {
assertThat(store.terminateCall).isGreaterThan(0);
}
if (modelFactory.startCall > 0) {
assertThat(modelFactory.terminateCall).isGreaterThan(0);
}
if (reportListener.startCall > 0) {
assertThat(reportListener.terminateCall).isGreaterThan(0);
}
}
private static class NopTransport
implements Transport, RaftNodeLifecycleAware {
private volatile int startCall;
private volatile int terminateCall;
private volatile int sendCall;
private volatile int lastSendCall;
private volatile int callOrder;
@Override
public void onRaftNodeStart() {
if (startCall == 0) {
startCall = ++callOrder;
}
}
@Override
public void onRaftNodeTerminate() {
if (terminateCall == 0) {
terminateCall = ++callOrder;
}
}
@Override
public void send(@Nonnull RaftEndpoint target, @Nonnull RaftMessage message) {
lastSendCall = ++callOrder;
if (sendCall == 0) {
sendCall = lastSendCall;
}
}
@Override
public boolean isReachable(@Nonnull RaftEndpoint endpoint) {
return false;
}
}
private static class NopStateMachine
implements StateMachine, RaftNodeLifecycleAware {
private volatile int startCall;
private volatile int terminateCall;
private volatile int callOrder;
private volatile boolean failOnStart;
private volatile boolean failOnTerminate;
@Override
public void onRaftNodeStart() {
if (startCall == 0) {
startCall = ++callOrder;
}
if (failOnStart) {
throw new RuntimeException("failed on purpose!");
}
}
@Override
public void onRaftNodeTerminate() {
if (terminateCall == 0) {
terminateCall = ++callOrder;
}
if (failOnTerminate) {
throw new RuntimeException("failed on purpose!");
}
}
@Override
public Object runOperation(long commitIndex, @Nonnull Object operation) {
return null;
}
@Override
public void takeSnapshot(long commitIndex, Consumer<Object> snapshotChunkConsumer) {
}
@Override
public void installSnapshot(long commitIndex, @Nonnull List<Object> snapshotChunks) {
}
@Nonnull
@Override
public Object getNewTermOperation() {
return null;
}
}
private static class DelegatingRaftNodeExecutor
extends DefaultRaftNodeExecutor
implements RaftNodeLifecycleAware {
private volatile int startCall;
private volatile int terminateCall;
private volatile int executeCall;
private volatile int lastExecuteCall;
private volatile int callOrder;
@Override
public void onRaftNodeStart() {
if (startCall == 0) {
startCall = ++callOrder;
}
}
@Override
public void onRaftNodeTerminate() {
if (terminateCall == 0) {
terminateCall = ++callOrder;
}
}
@Override
public void execute(@Nonnull Runnable task) {
lastExecuteCall = ++callOrder;
if (executeCall == 0) {
executeCall = lastExecuteCall;
}
super.execute(task);
}
@Override
public void submit(@Nonnull Runnable task) {
lastExecuteCall = ++callOrder;
if (executeCall == 0) {
executeCall = lastExecuteCall;
}
super.submit(task);
}
@Override
public void schedule(@Nonnull Runnable task, long delay, @Nonnull TimeUnit timeUnit) {
lastExecuteCall = ++callOrder;
if (executeCall == 0) {
executeCall = lastExecuteCall;
}
super.schedule(task, delay, timeUnit);
}
}
public static class DelegatingRaftModelFactory
extends DefaultRaftModelFactory
implements RaftNodeLifecycleAware {
private volatile int startCall;
private volatile int terminateCall;
private volatile int createCall;
private volatile int lastCreateCall;
private volatile int callOrder;
@Override
public void onRaftNodeStart() {
if (startCall == 0) {
startCall = ++callOrder;
}
}
@Override
public void onRaftNodeTerminate() {
if (terminateCall == 0) {
terminateCall = ++callOrder;
}
}
@Nonnull
@Override
public LogEntryBuilder createLogEntryBuilder() {
recordCall();
return super.createLogEntryBuilder();
}
@Nonnull
@Override
public SnapshotEntryBuilder createSnapshotEntryBuilder() {
recordCall();
return super.createSnapshotEntryBuilder();
}
@Nonnull
@Override
public SnapshotChunkBuilder createSnapshotChunkBuilder() {
recordCall();
return super.createSnapshotChunkBuilder();
}
@Nonnull
@Override
public AppendEntriesRequest.AppendEntriesRequestBuilder createAppendEntriesRequestBuilder() {
recordCall();
return super.createAppendEntriesRequestBuilder();
}
@Nonnull
@Override
public AppendEntriesSuccessResponse.AppendEntriesSuccessResponseBuilder createAppendEntriesSuccessResponseBuilder() {
recordCall();
return super.createAppendEntriesSuccessResponseBuilder();
}
@Nonnull
@Override
public AppendEntriesFailureResponseBuilder createAppendEntriesFailureResponseBuilder() {
recordCall();
return super.createAppendEntriesFailureResponseBuilder();
}
@Nonnull
@Override
public InstallSnapshotRequestBuilder createInstallSnapshotRequestBuilder() {
recordCall();
return super.createInstallSnapshotRequestBuilder();
}
@Nonnull
@Override
public InstallSnapshotResponseBuilder createInstallSnapshotResponseBuilder() {
recordCall();
return super.createInstallSnapshotResponseBuilder();
}
@Nonnull
@Override
public PreVoteRequestBuilder createPreVoteRequestBuilder() {
recordCall();
return super.createPreVoteRequestBuilder();
}
@Nonnull
@Override
public PreVoteResponseBuilder createPreVoteResponseBuilder() {
recordCall();
return super.createPreVoteResponseBuilder();
}
@Nonnull
@Override
public TriggerLeaderElectionRequestBuilder createTriggerLeaderElectionRequestBuilder() {
recordCall();
return super.createTriggerLeaderElectionRequestBuilder();
}
@Nonnull
@Override
public VoteRequestBuilder createVoteRequestBuilder() {
recordCall();
return super.createVoteRequestBuilder();
}
@Nonnull
@Override
public VoteResponseBuilder createVoteResponseBuilder() {
recordCall();
return super.createVoteResponseBuilder();
}
@Nonnull
@Override
public UpdateRaftGroupMembersOpBuilder createUpdateRaftGroupMembersOpBuilder() {
recordCall();
return super.createUpdateRaftGroupMembersOpBuilder();
}
private void recordCall() {
lastCreateCall = ++callOrder;
if (createCall == 0) {
createCall = lastCreateCall;
}
}
}
private static class NopRaftNodeReportListener
implements RaftNodeReportListener, RaftNodeLifecycleAware {
private volatile int startCall;
private volatile int terminateCall;
private volatile int acceptCall;
private volatile int lastAcceptCall;
private volatile int callOrder;
@Override
public void onRaftNodeStart() {
if (startCall == 0) {
startCall = ++callOrder;
}
}
@Override
public void onRaftNodeTerminate() {
if (terminateCall == 0) {
terminateCall = ++callOrder;
}
}
@Override
public void accept(RaftNodeReport report) {
lastAcceptCall = ++callOrder;
if (acceptCall == 0) {
acceptCall = lastAcceptCall;
}
}
}
private static class NopRaftStore
implements RaftStore, RaftNodeLifecycleAware {
private volatile int startCall;
private volatile int terminateCall;
private volatile int persistCall;
private volatile int lastPersistCall;
private volatile int callOrder;
@Override
public void onRaftNodeStart() {
if (startCall == 0) {
startCall = ++callOrder;
}
}
@Override public void onRaftNodeTerminate() {
if (terminateCall == 0) {
terminateCall = ++callOrder;
}
}
@Override public void persistAndFlushLocalEndpoint(RaftEndpoint localEndpoint, boolean localEndpointVoting) {
recordCall();
}
@Override public void persistAndFlushInitialGroupMembers(@Nonnull RaftGroupMembersView initialGroupMembers) {
recordCall();
}
@Override public void persistAndFlushTerm(int term, @Nullable RaftEndpoint votedFor) {
recordCall();
}
@Override public void persistLogEntry(@Nonnull LogEntry logEntry) {
recordCall();
}
@Override
public void persistSnapshotChunk(@Nonnull SnapshotChunk snapshotChunk) {
recordCall();
}
@Override
public void truncateLogEntriesFrom(long logIndexInclusive) {
recordCall();
}
@Override
public void truncateSnapshotChunksUntil(long logIndexInclusive) {
recordCall();
}
@Override
public void flush() {
recordCall();
}
private void recordCall() {
lastPersistCall = ++callOrder;
if (persistCall == 0) {
persistCall = lastPersistCall;
}
}
}
}
| [
"ebkahveci@gmail.com"
] | ebkahveci@gmail.com |
72becbdbb444328178d8c86474b85bdb9b140ea8 | 1d091a88b102ac2b133a6deb7e44c382e0b4bb9e | /dolphin/src/java/com/dolphin/webapp/vo/PhoneCharge.java | 203caed54c6a6097852a84bbfa0402008e2bca03 | [] | no_license | zhangjian800/misc | 1098fde7fdd717df1c000ad9aa33e3733738035a | f5eada6c888772bd17025839eeb45407fb7eb3bc | refs/heads/master | 2021-01-19T08:36:04.002486 | 2016-11-23T17:29:39 | 2016-11-23T17:29:39 | 74,523,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,930 | java | package com.dolphin.webapp.vo;
import com.dolphin.common.vo.DOLValueObject;
public class PhoneCharge implements DOLValueObject{
private long chargeID;
private String mobile;
private String linkid;
private String receivetimaccessID;
private String channelID;
private String ruleIDe String receivetime;
private String content;
private String imsi;
private String producttype;
private String version;
private String province;
private String private String city;
private String result;
private String yearmonth;
private String currdate;
private float failmountutil.Date updatetime = java.util.Calendar.getInstance().getTime();
public long getChargeID() {
return chargeID;
}
public void setChargeID(long chargeID) {
this.chargeID = chargeID;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getLinkid() {
return linkid;
}
public void setLinkid(String linkid) {
this.linkid = linkid;
}
public String getReceivetime() {
return receivetime;
}
public void setReceivetime(String receivetime) {
this.receivetime = receivetime;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getImsi() {
return imsi;
}
public void setImsi(String imsi) {
this.imsi = imsi;
}
public String getProducttype() {
return producttype;
}
public void setProducttype(String producttype) {
this.producttype = producttype;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public java.util.Date getUpdatetime() {
return updatetime;
}
public void setUpdatetime(java.util.Date updatetime) {
this.updatetime = updatetime;
}
}
public String getAccessID() {
return accessID;
}
public void setAccessID(String accessID) {
this.accessID = accessID;
}
public String getChannelID() {
return channelID;
}
public void setChannelID(String channelID) {
this.channelID = channelID;
}
public String getRuleID() {
return ruleID;
}
public void setRuleID(String ruleID) {
this.ruleID = ruleID;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getYearmonth() {
return yearmonth;
}
public void setYearmonth(String yearmonth) {
this.yearmonth = yearmonth;
}
public String getCurrdate() {
return currdate;
}
public void setCurrdate(String currdate) {
this.currdate = currdate;
}
public float getFailmount() {
return failmount;
}
public void setFailmount(float failmount) {
this.failmount = failmount;
}
}
| [
"jianzha2@cisco.com"
] | jianzha2@cisco.com |
0d6df5637a69187a492c31354e5914a52738829c | 38de6b6ac97be636849da93ed0481286a15e973f | /QMediaPlayer/src/main/java/com/tainzhi/qmediaplayer/render/glrender/effect/GammaEffect.java | 4361f062cc634928180d1328ee4f1ac6a90b960d | [] | no_license | tainzhi/VideoPlayer | cbecde10d17321da6f58a9760d4728d5a10d4142 | f82b1b34e7841dd20843c26cb3e6bd1ed6275cdd | refs/heads/master | 2022-02-19T15:50:13.320798 | 2022-02-14T00:08:02 | 2022-02-14T00:08:02 | 55,685,709 | 49 | 8 | null | 2022-02-14T00:08:03 | 2016-04-07T10:29:12 | C | UTF-8 | Java | false | false | 1,205 | java | package com.tainzhi.qmediaplayer.render.glrender.effect;
import android.opengl.GLSurfaceView;
/**
* Apply Gamma Effect on Video being played
*/
public class GammaEffect implements ShaderInterface {
private float gammaValue;
/**
* Initialize Effect
*
* @param gammaValue Range should be between 0.0 - 2.0 with 1.0 being normal.
*/
public GammaEffect(float gammaValue) {
if (gammaValue < 0.0f)
gammaValue = 0.0f;
if (gammaValue > 2.0f)
gammaValue = 2.0f;
this.gammaValue = gammaValue;
}
@Override
public String getShader(GLSurfaceView mGlSurfaceView) {
String shader = "#extension GL_OES_EGL_image_external : require\n"
+ "precision mediump float;\n"
+ "varying vec2 vTextureCoord;\n"
+ "uniform samplerExternalOES sTexture;\n"
+ "float gamma=" + gammaValue + ";\n"
+ "void main() {\n"
+ "vec4 textureColor = texture2D(sTexture, vTextureCoord);\n"
+ "gl_FragColor = vec4(pow(textureColor.rgb, vec3(gamma)), textureColor.w);\n"
+ "}\n";
return shader;
}
} | [
"qfq61@qq.com"
] | qfq61@qq.com |
c8d83c0fe88b55626612036c7b5f591e11a98f95 | 2e9bdd72ddce3291e3c0abda71970e23fece94fd | /app/src/main/java/com/bigjelly/shaddockvideoplayer/view/video/adapter/VideoListAdpater.java | c1bdaa90c95a74bd851d632861266bc21de4efac | [
"Apache-2.0"
] | permissive | bigjelly/ShaddockVideoPlayer | 434ee194b4bd3e36d6b1c48b64f03841b0100a8b | d311c51dc45116830ca4f47dec317dc374a69106 | refs/heads/master | 2021-01-20T01:43:38.776296 | 2017-09-07T02:57:09 | 2017-09-07T02:57:09 | 101,298,634 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,682 | java | package com.bigjelly.shaddockvideoplayer.view.video.adapter;
import android.content.Context;
import android.net.Uri;
import android.support.v4.app.FragmentManager;
import android.view.View;
import android.widget.ImageView;
import com.andfast.pullrecyclerview.BaseRecyclerAdapter;
import com.andfast.pullrecyclerview.BaseViewHolder;
import com.bigjelly.shaddockvideoplayer.R;
import com.bigjelly.shaddockvideoplayer.model.VideoInfo;
import com.bigjelly.shaddockvideoplayer.view.video.VideoActivity;
import com.bumptech.glide.Glide;
import java.io.File;
import java.util.List;
/**
* Created by mby on 17-8-25.
*/
public class VideoListAdpater extends BaseRecyclerAdapter<VideoInfo> {
private FragmentManager mFragmentManager;
public VideoListAdpater(Context context, int layoutResId, List<VideoInfo> data, FragmentManager fragmentManager) {
super(context, layoutResId, data);
mFragmentManager = fragmentManager;
}
@Override
protected void convert(BaseViewHolder holder, final VideoInfo item) {
holder.setText(R.id.tv_file_name,item.name);
holder.setText(R.id.tv_file_number,item.size);
Glide.with(mContext)
.load(Uri.fromFile(new File(item.path)))
.placeholder(R.mipmap.ic_video_bg)
.error(R.mipmap.ic_video_bg)
.crossFade()
.into((ImageView)holder.getView(R.id.img_video));
holder.getView(R.id.item_root).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
VideoActivity.intentTo(mContext, item.path,item.name);
}
});
}
}
| [
"maboyu@le.com"
] | maboyu@le.com |
45dfa83ae2f743e473b3075348215841dcf26e74 | 57ab5ccfc179da80bed6dc6aa1407c2181cee926 | /co.moviired:incomm/src/main/java/co/moviired/digitalcontent/incomm/src/main/java/co/moviired/digitalcontent/incomm/helper/BuildTxnHelper.java | caf9f99b3516f30a44135a983f88f88c0fc6fe88 | [] | no_license | sandys/filtro | 7190e8e8af7c7b138922c133a7a0ffe9b9b8efa7 | 9494d10444983577a218a2ab2e0bbce374c6484e | refs/heads/main | 2022-12-08T20:46:08.611664 | 2020-09-11T09:26:22 | 2020-09-11T09:26:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,320 | java | package co.moviired.digitalcontent.incomm.helper;
import co.moviired.digitalcontent.incomm.model.request.Input;
import co.moviired.digitalcontent.incomm.model.response.Data;
import co.moviired.digitalcontent.incomm.model.response.ErrorDetail;
import co.moviired.digitalcontent.incomm.model.response.Outcome;
import co.moviired.digitalcontent.incomm.model.response.Response;
import co.moviired.digitalcontent.incomm.properties.IncommProperties;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jpos.iso.ISOBasePackager;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOUtil;
import org.jpos.iso.packager.GenericPackager;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
@Slf4j
@Service
public final class BuildTxnHelper implements Serializable {
private static final long serialVersionUID = 2626608527218126568L;
private static final String HOUR_FORMAT = "HHmmssZ";
private static final String SHORT_DATE_FORMAT = "yyyyMMdd";
private static final String LONG_DATE_FORMAT = "yyyyMMdd'T'HHmmss'Z'";
private static final String LBL_PIN_VALUE = "Valor PIN: ";
private static final String HEALTH_CHECK = "0800";
private static final String ACTIVATION_CODE = "0200";
private static final String CODE_RESULT_FIELD = "39";
private static final String DEACTIVATION_CODE = "0400";
private static final int PROCESING_CODE_FIELD = 3;
private static final int EAN_CODE_FIELD = 54;
private static final int TERMINAL_LENGTH = 8;
private static final int USERNAME_LENGTH = 10;
private static final int TXNID_LENGTH = 12;
private static final int REFERENCE_NUMBER_LENGTH = 12;
private static final int AMOUNT_LENGTH = 12;
private static final int EAN_LENGTH = 11;
private static final int REFERENCE_LENGTH = 19;
private static final int STATUS_OK = 200;
private static final int FIELD_02 = 2;
private static final int FIELD_04 = 4;
private static final int FIELD_07 = 7;
private static final int FIELD_11 = 11;
private static final int FIELD_12 = 12;
private static final int FIELD_13 = 13;
private static final int FIELD_22 = 22;
private static final int FIELD_32 = 32;
private static final int FIELD_37 = 37;
private static final int FIELD_41 = 41;
private static final int FIELD_42 = 42;
private static final int FIELD_49 = 49;
private static final int FIELD_53 = 53;
private static final int FIELD_54 = 54;
private static final int FIELD_70 = 70;
private final IncommProperties incommProperties;
// Iso8583 Packer definitions
private transient ISOBasePackager incommPackager;
public BuildTxnHelper(@NotNull IncommProperties pincommProperties) {
super();
this.incommProperties = pincommProperties;
}
// SERVICE METHODS
private static String getTransactionId() {
String idTransaccion = "" + System.currentTimeMillis();
idTransaccion = idTransaccion.substring(idTransaccion.length() - TXNID_LENGTH);
return idTransaccion;
}
public ISOMsg requestHealthCheck() throws ISOException, IOException {
Date fechaActual = new Date();
String currentDate = new SimpleDateFormat(LONG_DATE_FORMAT).format(fechaActual);
ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(getIncommPackager());
isoMsg.setMTI(HEALTH_CHECK);
isoMsg.set(FIELD_07, currentDate);
isoMsg.set(FIELD_11, getTransactionId());
isoMsg.set(FIELD_70, "301");
return isoMsg;
}
public ISOMsg requestActivationMessage(Input request) throws ISOException, IOException {
ISOMsg isoMsg = buildMessageRequest(request);
isoMsg.set(PROCESING_CODE_FIELD, incommProperties.getProcessCodeActivationIncomm());
isoMsg.set(EAN_CODE_FIELD, request.getEanCode());
return isoMsg;
}
public ISOMsg requestDesactivationMessage(@NotNull Input request) throws ISOException, IOException {
ISOMsg isoMsg = buildMessageRequest(request);
isoMsg.set(PROCESING_CODE_FIELD, incommProperties.getProcessCodeDeactivationIncomm());
// Limitir el EANCode a 11 dígitos
String eanCode = request.getEanCode();
if (eanCode != null && eanCode.length() > EAN_LENGTH) {
eanCode = eanCode.substring(0, EAN_LENGTH);
}
isoMsg.set(EAN_CODE_FIELD, eanCode);
return isoMsg;
}
// UTILS METHOD
public ISOMsg requestReversionMessage(@NotNull Input request) throws ISOException, IOException {
String idProceso = request.getProcesingCode();
ISOMsg isoMsg = null;
if (idProceso.equals(incommProperties.getProcessCodeActivation())) {
isoMsg = requestActivationMessage(request);
} else if (idProceso.equals(incommProperties.getProcessCodeDeactivation())) {
isoMsg = requestDesactivationMessage(request);
}
if (isoMsg != null) {
isoMsg.setMTI(DEACTIVATION_CODE);
}
return isoMsg;
}
private ISOBasePackager getIncommPackager() throws ISOException, IOException {
if (incommPackager == null) {
// Cargar el ISO packager
incommPackager = new GenericPackager(new ClassPathResource("package/ISO87A_Incomm.xml").getInputStream());
log.debug("INCOMM - ISO Packager [OK]");
}
return incommPackager;
}
private ISOMsg buildMessageRequest(@NotNull Input request) throws ISOException, IOException {
Date fechaActual = new Date();
String currentDate = new SimpleDateFormat(LONG_DATE_FORMAT).format(fechaActual);
String currentHour = new SimpleDateFormat(HOUR_FORMAT).format(fechaActual);
String currentMonth = new SimpleDateFormat(SHORT_DATE_FORMAT).format(fechaActual);
String customerId = request.getCustomerId();
customerId = customerId.length() > TERMINAL_LENGTH ? customerId.substring(0, TERMINAL_LENGTH) : customerId;
// Username
String username = request.getUserName();
username = username.length() > USERNAME_LENGTH ? username.substring(0, USERNAME_LENGTH) : username;
// Valor PIN
String pinValue = String.valueOf(request.getAmount());
pinValue = ISOUtil.zeropad(pinValue.concat("00"), AMOUNT_LENGTH);
log.debug(LBL_PIN_VALUE + pinValue);
ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(getIncommPackager());
isoMsg.setMTI(ACTIVATION_CODE);
if (request.getShortReferenceNumber().length() > REFERENCE_LENGTH) {
isoMsg.set(FIELD_02, request.getShortReferenceNumber().substring(request.getShortReferenceNumber().length() - REFERENCE_LENGTH).trim());
} else {
isoMsg.set(FIELD_02, request.getShortReferenceNumber().trim());
}
isoMsg.set(FIELD_04, pinValue);
isoMsg.set(FIELD_07, currentDate);
if (request.getControlNumber().length() < TXNID_LENGTH) {
isoMsg.set(FIELD_11, ISOUtil.zeropad(request.getControlNumber(), TXNID_LENGTH));
} else {
isoMsg.set(FIELD_11, request.getControlNumber().substring(0, TXNID_LENGTH));
}
isoMsg.set(FIELD_12, currentHour);
isoMsg.set(FIELD_13, currentMonth);
isoMsg.set(FIELD_22, incommProperties.getIsoField22());
isoMsg.set(FIELD_32, request.getIncommCode());
isoMsg.set(FIELD_37, getField37(request.getControlNumber()));
isoMsg.set(FIELD_41, customerId);
isoMsg.set(FIELD_42, username);
isoMsg.set(FIELD_49, incommProperties.getIsoField49());
return isoMsg;
}
public ISOMsg requestPinSale(@NotNull Input request) throws ISOException, IOException {
Date fechaActual = new Date();
String currentDate = new SimpleDateFormat(LONG_DATE_FORMAT).format(fechaActual);
String currentHour = new SimpleDateFormat(HOUR_FORMAT).format(fechaActual);
String currentMonth = new SimpleDateFormat(SHORT_DATE_FORMAT).format(fechaActual);
// Terminal ID
String customerId = request.getCustomerId();
customerId = customerId.length() > TERMINAL_LENGTH ? customerId.substring(0, TERMINAL_LENGTH) : customerId;
// Username
String username = request.getUserName();
username = username.length() > USERNAME_LENGTH ? username.substring(0, USERNAME_LENGTH) : username;
// Valor PIN
String pinValue = String.valueOf(request.getAmount());
pinValue = ISOUtil.zeropad(pinValue.concat("00"), AMOUNT_LENGTH);
log.debug(LBL_PIN_VALUE + pinValue);
// ARMAR EL ISO MESSAGE
ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(getIncommPackager());
isoMsg.setMTI(ACTIVATION_CODE);
isoMsg.set(PROCESING_CODE_FIELD, incommProperties.getPinIncomm());
isoMsg.set(FIELD_04, pinValue);
isoMsg.set(FIELD_07, currentDate);
if (request.getControlNumber().length() < TXNID_LENGTH) {
isoMsg.set(FIELD_11, ISOUtil.zeropad(request.getControlNumber(), TXNID_LENGTH));
} else {
isoMsg.set(FIELD_11, request.getControlNumber().substring(0, TXNID_LENGTH));
}
isoMsg.set(FIELD_12, currentHour);
isoMsg.set(FIELD_13, currentMonth);
isoMsg.set(FIELD_22, incommProperties.getIsoField22());
isoMsg.set(FIELD_32, request.getIncommCode());
isoMsg.set(FIELD_37, getField37(request.getControlNumber()));
isoMsg.set(FIELD_41, customerId);
isoMsg.set(FIELD_42, username);
isoMsg.set(FIELD_49, incommProperties.getIsoField49());
isoMsg.set(FIELD_53, incommProperties.getPinTandc());
isoMsg.set(FIELD_54, request.getEanCode());
return isoMsg;
}
public ISOMsg requestPinReverso(@NotNull Input request) throws ISOException, IOException {
Date fechaActual = new Date();
String currentDate = new SimpleDateFormat(LONG_DATE_FORMAT).format(fechaActual);
String currentHour = new SimpleDateFormat(HOUR_FORMAT).format(fechaActual);
String currentMonth = new SimpleDateFormat(SHORT_DATE_FORMAT).format(fechaActual);
// Terminal ID
String customerId = request.getCustomerId();
customerId = customerId.length() > TERMINAL_LENGTH ? customerId.substring(0, TERMINAL_LENGTH) : customerId;
// Username
String username = request.getUserName();
username = username.length() > USERNAME_LENGTH ? username.substring(0, USERNAME_LENGTH) : username;
// Valor PIN
String pinValue = String.valueOf(request.getAmount());
pinValue = ISOUtil.zeropad(pinValue.concat("00"), AMOUNT_LENGTH);
log.debug(LBL_PIN_VALUE + pinValue);
// ARMAR EL ISO MESSAGE
ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(getIncommPackager());
isoMsg.setMTI(DEACTIVATION_CODE);
isoMsg.set(PROCESING_CODE_FIELD, incommProperties.getInactpinIncomm());
isoMsg.set(FIELD_04, pinValue);
isoMsg.set(FIELD_07, currentDate);
if (request.getControlNumber().length() < TXNID_LENGTH) {
isoMsg.set(FIELD_11, ISOUtil.zeropad(request.getControlNumber(), TXNID_LENGTH));
} else {
isoMsg.set(FIELD_11, request.getControlNumber().substring(0, TXNID_LENGTH));
}
isoMsg.set(FIELD_12, currentHour);
isoMsg.set(FIELD_13, currentMonth);
isoMsg.set(FIELD_22, incommProperties.getIsoField22());
isoMsg.set(FIELD_32, request.getIncommCode());
isoMsg.set(FIELD_37, getField37(request.getControlNumber()));
isoMsg.set(FIELD_41, customerId);
isoMsg.set(FIELD_42, username);
isoMsg.set(FIELD_49, incommProperties.getIsoField49());
isoMsg.set(FIELD_53, incommProperties.getPinTandc());
isoMsg.set(FIELD_54, request.getEanCode());
return isoMsg;
}
private String getField37(String request) throws ISOException {
String resp;
if (request.length() > REFERENCE_NUMBER_LENGTH) {
resp = request.substring(request.length() - REFERENCE_NUMBER_LENGTH);
} else {
resp = ISOUtil.zeropad(request, REFERENCE_NUMBER_LENGTH);
}
return resp;
}
public Response parseResponse(ISOMsg incommResponse, ErrorHelper errorHelper) {
// Estado de la transacción
Data data;
Outcome outcome = new Outcome();
// Si la respuesta es errada armar el ERROR
if ((incommResponse.getString(CODE_RESULT_FIELD).equals("00"))) {
// Si la respuesta es OK, armar el detalle
data = new Data();
data.setAuthorizationCode(incommResponse.getString("38"));
// Cifrar el PIN
if (incommResponse.getString("2") != null) {
data.setPin(AESCrypt.crypt(incommResponse.getString("2")));
}
ErrorDetail error = new ErrorDetail();
error.setErrorType(0);
error.setErrorCode("00");
error.setErrorMessage("TRANSACCION EXITOSA");
outcome.setError(error);
outcome.setStatusCode(STATUS_OK);
outcome.setMessage("TRANSACCION EXITOSA");
} else {
data = new Data();
data.setAuthorizationCode(incommResponse.getString("38"));
ErrorDetail error = new ErrorDetail();
error.setErrorType(0);
String[] arrayError = StringUtils.splitPreserveAllTokens(errorHelper.getError(incommResponse.getString(CODE_RESULT_FIELD), "Error inesperado"), '|');
error.setErrorCode(arrayError[0]);
error.setErrorMessage(arrayError[1]);
outcome.setError(error);
outcome.setStatusCode(Integer.parseInt(arrayError[0]));
outcome.setMessage(arrayError[1]);
}
// Armar la respuesta completa
Response responseDTO = new Response();
responseDTO.setOutcome(outcome);
responseDTO.setData(data);
return responseDTO;
}
}
| [
"me@deletescape.ch"
] | me@deletescape.ch |
6d605b55b302c13fd21a5dcb6f95ad9d12689b40 | 5e23b21cee9048229149b152990298c4a18819f9 | /ap/src/test/java/mdr/ap/patterns/singleton/SingletonTests.java | 27e561cdd4c27c4b7d467c7c81783ec845f7d269 | [] | no_license | noodnik2/AlgorithmPractice | 8f4da9cc4a425b2f29c09c97d4f990edb3fd1764 | 01f1ab1393298a1ff7761f781b8e794a21259f92 | refs/heads/master | 2021-04-28T04:28:35.424806 | 2018-03-26T19:17:51 | 2018-03-26T19:17:51 | 122,161,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,648 | java | package mdr.ap.patterns.singleton;
import static mdr.ap.util.TestLogger.log;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.function.Consumer;
import mdr.ap.util.NotNull;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* Tests of the singletons classes
* @author mross
*/
public class SingletonTests {
//
// Public test methods
//
/**
* Ensures the same instance is returned by the singleton's "factory" method and
* a subsequent "re-serialization" of that object
*/
@Test
public void testSameInstance() {
final Consumer<Class<?>> testSameInstanceConsumer = (
fc -> {
try {
testSameInstance(fc);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
);
runTestSubCases(
testSameInstanceConsumer,
DoubleLockingLazySingleton.class,
SerializableLazySingleton.class,
EnumSingleton.class
);
}
/**
* Ensures the same instance is returned by a call to the singleton's "factory"
* method and a subsequent "deserialization" of that (or any) object.
*/
@Test
public void testSerializableSingletons() {
final Consumer<Class<?>> testSerializableSingletonConsumer = (
fc -> {
try {
testSerializableSingleton(fc);
} catch (final Exception e) {
Assertions.fail(e);
}
}
);
runTestSubCases(
testSerializableSingletonConsumer,
SerializableLazySingleton.class
);
}
//
// Private supporting class members
//
/**
* Ensures the same instance is returned by a call to the singleton's "factory"
* method and a subsequent "deserialization" of that (or any) object.
* @param factoryClass class implementing factory of the singleton
* @throws Exception unhandled exception
*/
private void testSerializableSingleton(
@NotNull final Class<?> factoryClass
) throws Exception {
final Object firstInstance = getInstance(factoryClass);
assertTrue(firstInstance instanceof Serializable);
final ByteArrayOutputStream firstInstanceBytes = new ByteArrayOutputStream();
final ObjectOutput firstInstanceOutputStream = new ObjectOutputStream(firstInstanceBytes);
firstInstanceOutputStream.writeObject(firstInstance);
firstInstanceOutputStream.close();
// deserialize from file to object
final ByteArrayInputStream secondInstanceBytes = new ByteArrayInputStream(firstInstanceBytes.toByteArray());
final ObjectInput secondInstanceInputStream = new ObjectInputStream(secondInstanceBytes);
final Object secondInstance = secondInstanceInputStream.readObject();
secondInstanceInputStream.close();
assertEquals(firstInstance.hashCode(), secondInstance.hashCode());
}
private void testSameInstance(@NotNull final Class<?> factoryClass) throws Exception {
final Object firstInstance = getInstance(factoryClass);
assertNotNull(firstInstance);
assertEquals(firstInstance, getInstance(factoryClass));
}
private <SC> void runTestSubCases(
@NotNull final Consumer<SC> inTestRunner,
@NotNull final SC... inTestSubCases
) {
final String testMethodName = "testMethod"; // TODO get from JUnit5
for (final SC testSubCase : inTestSubCases) {
log(String.format("%s(%s)", testMethodName, testSubCase));
inTestRunner.accept(testSubCase);
}
}
@NotNull
private static <T> T getInstance(@NotNull final Class<T> inSingletonFactoryClass) throws Exception {
try {
final Method factoryMethod = inSingletonFactoryClass.getMethod("getInstance", new Class[0]);
final T instance = (T) factoryMethod.invoke(null, new Object[0]);
return instance;
} catch (final NoSuchMethodException | SecurityException e) {
throw new Exception(e);
}
}
}
| [
"mross@nuvi.local"
] | mross@nuvi.local |
52ba6cff3a83b1bbf34a0a0e0473a18875ffe410 | 1c8286a5f4470fc4a2c0206ddfb7f6507c1aa991 | /app/src/main/java/amqo/com/privaliatmdb/views/utils/NotificationsHelper.java | 46d0cb44537e77d818363d5b30619e9895ef9a54 | [] | no_license | amqo/tmdb | 4029ded7e4dc459adcf80f3f9a7b76282a5b8f86 | ed61bf45a3bac1f1cc0ba7139673a5b73379b617 | refs/heads/master | 2021-01-09T05:44:26.159945 | 2017-02-08T14:34:17 | 2017-02-08T14:34:17 | 80,823,075 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,730 | java | package amqo.com.privaliatmdb.views.utils;
import android.content.Intent;
import android.graphics.Color;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.widget.TextView;
import java.util.Locale;
import amqo.com.privaliatmdb.R;
import amqo.com.privaliatmdb.model.MoviesContext;
import amqo.com.privaliatmdb.model.contracts.MoviesContract;
public abstract class NotificationsHelper {
public static Snackbar showSnackConnectivity(final MoviesContract.View moviesView) {
if (moviesView == null || moviesView.getMoviesContext() == null) return null;
final MoviesContext moviesContext = moviesView.getMoviesContext();
if (moviesContext.view == null) return null;
String message = moviesContext.context.getString(R.string.Toast_Connection_Off);
int color = Color.WHITE;
Snackbar snackbar = Snackbar.make(moviesContext.view, message, Snackbar.LENGTH_INDEFINITE);
snackbar.setAction(moviesContext.context.getString(R.string.Notification_Action_Connect)
.toUpperCase(Locale.getDefault()), new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intentSettings = new Intent(android.provider.Settings.ACTION_SETTINGS);
intentSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
moviesContext.context.startActivity(intentSettings);
}
});
View snackbarView = snackbar.getView();
TextView textView = (TextView) snackbarView.findViewById(
android.support.design.R.id.snackbar_text);
textView.setTextColor(color);
snackbar.show();
return snackbar;
}
}
| [
"alberto.mqo@gmail.com"
] | alberto.mqo@gmail.com |
c29ba1d19ab6245cb66729c67f8985edaf041e40 | facee931629a10167569a4f03811264dc7130868 | /src/game/json/JSONClassCheckException.java | 5ea2caea3895c5fff07f4995f5623d0f2564fcc4 | [] | no_license | dos32/GameKubSU.Java | 5815af37fec3204a456fcf8eb2e1bc7d64b6716f | 2167aa544c964a147f6a804b4f93939fe43ea9cc | refs/heads/master | 2016-09-05T23:18:19.624732 | 2013-11-23T12:48:39 | 2013-11-23T12:54:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package game.json;
public class JSONClassCheckException extends Exception {
private static final long serialVersionUID = 1L;
public JSONClassCheckException(String message) {
super(message);
}
}
| [
"dos_32bit@mail.ru"
] | dos_32bit@mail.ru |
a9d65d906587dad27648f8094559c4a15bd2c85a | 590a1a1ecaa8da4a638b823d29cb11031739530e | /src/lesson18/Salary/Employee.java | e53921c6cff8f6f311075790752a953e49226407 | [] | no_license | fatihakbuluttr/homeWorkOOP | 4517137ff2b40862a9e97379bc56e2ec43257a7f | 2dcedd854684da50b32dacda4667c0a7dbd4a833 | refs/heads/main | 2023-03-24T12:59:21.689989 | 2021-03-26T06:34:07 | 2021-03-26T06:34:35 | 351,666,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package lesson18.Salary;
public class Employee extends Member{
private String specialization;
public Employee(String name, int age, int phoneNumber,
String address, int salary,String specialization) {
super(name, age, phoneNumber, address, salary);
this.specialization=specialization;
}
}
| [
"User@DESKTOP-ENT97T7"
] | User@DESKTOP-ENT97T7 |
ac52e81746a8a404b01732bf02bc6a2212669c9c | 5bb3981aacf0e232ea6d59abaa17b7fa864606c0 | /app/src/test/java/com/eebbk/stttest/myview/ExampleUnitTest.java | d2096bc33b423ce54da6543786f861027c138c41 | [] | no_license | VictorJiaChengWang/MyView | 2aada997b07f75750b136270c0ee08dd101570c0 | 629f850e32c4b1e1feb00305767e3dd0449f2633 | refs/heads/master | 2021-01-16T20:37:58.265968 | 2016-08-15T13:42:48 | 2016-08-15T13:42:48 | 65,734,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package com.eebbk.stttest.myview;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"1571753456@qq.com"
] | 1571753456@qq.com |
67e46768e17f6467c2fc1c76ac1c67c64d7d28f6 | bdc242a1541160145a7c0fb7c4a370b8766eb116 | /src/main/java/controller/CustomerController.java | d76519b2ccec5070eb811eb402eb8b76f0cd42af | [] | no_license | Mungvu18/customer-manager-week1-module4 | af789cdde488af1b1bdb30d37ecdc89650ae7bba | 280f069f5e65f3a8542bb19a699d21fb223b914e | refs/heads/master | 2023-03-12T01:29:51.586254 | 2021-03-03T05:41:32 | 2021-03-03T05:41:32 | 344,014,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,341 | java | package controller;
import model.Customer;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import service.CustomerService;
import service.ICustomerService;
import java.util.List;
@Controller
public class CustomerController {
private ICustomerService customerService = new CustomerService();
@GetMapping("/")
public String index(Model model) {
List customerList = customerService.findAll();
model.addAttribute("customers", customerList);
return "/index";
}
@GetMapping("/customer/create")
public String create(Model model) {
model.addAttribute("customer", new Customer());
return "/create";
}
@PostMapping("/customer/save")
public String save(Customer customer) {
customer.setId((int)(Math.random() * 10000));
customerService.save(customer);
return "redirect:/";
}
@GetMapping("/customer/{id}/edit")
public String edit(@PathVariable int id, Model model) {
model.addAttribute("customer", customerService.findById(id));
return "/edit";
}
@PostMapping("/customer/update")
public String update(Customer customer) {
customerService.update(customer.getId(), customer);
return "redirect:/";
}
@GetMapping("/customer/{id}/delete")
public String delete(@PathVariable int id, Model model) {
model.addAttribute("customer", customerService.findById(id));
return "/delete";
}
@PostMapping("/customer/delete")
public String delete(Customer customer, RedirectAttributes redirect) {
customerService.remove(customer.getId());
redirect.addFlashAttribute("success", "Removed customer successfully!");
return "redirect:/";
}
@GetMapping("/customer/{id}/view")
public String view(@PathVariable int id, Model model) {
model.addAttribute("customer", customerService.findById(id));
return "/view";
}
}
| [
"zhaiduong26z@gmail.com"
] | zhaiduong26z@gmail.com |
cb106f199ea09d2d64a146a8744bb6cc6acd59d8 | 6115d2fad39aabc3eb8435d335b1e1a27dd568de | /security/src/main/java/com/yangxupei/boot/security/db/model/Role.java | c19f87b3dc222f7832491d73d1bd66711c1a8a0a | [] | no_license | yangxupei/test_boot | f9a20ec713a03177ba3a075d97274e46ff9365c4 | eea50e34e4da7ec16b798e0c6937297af09594bc | refs/heads/master | 2021-05-03T18:33:57.403569 | 2018-02-06T07:19:50 | 2018-02-06T07:19:50 | 120,413,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package com.yangxupei.boot.security.db.model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author : Yang xp
* Date: 2018/2/2
* Time: 下午4:38
* Desc:
*/
@Getter
@Setter
@ToString
public class Role {
private String id;
private String role;
private String userId;
}
| [
"yangxp@oriental-finance.com"
] | yangxp@oriental-finance.com |
29fab324fe648fbdf0dce5a7c673531f14c0f2bd | b5fef56f39bc380db007a60ea8aad450834e0896 | /app/src/main/java/br/com/estudo/projetomoviedb/network/ApiService.java | e7b0ab7aa3c1ad050d4ca9b428f4e59d0bb32268 | [] | no_license | Wemerson0014/ProjetoMovieDB | ebb1ac1d5b9a65a9bd516a6b03bd8d7f1c1efd06 | 0133fa64f0ce2d34e9b7a90d30bcc82049defeb4 | refs/heads/master | 2021-06-25T09:17:35.705259 | 2021-03-09T19:13:24 | 2021-03-09T19:13:24 | 213,250,962 | 2 | 1 | null | 2019-10-06T22:29:31 | 2019-10-06T22:04:50 | Java | UTF-8 | Java | false | false | 636 | java | package br.com.estudo.projetomoviedb.network;
import br.com.estudo.projetomoviedb.model.DetalheFilme;
import br.com.estudo.projetomoviedb.model.ResponseFilme;
import br.com.estudo.projetomoviedb.model.ResponseFilmeSimilar;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;
public interface ApiService {
@GET("movie/upcoming")
Call<ResponseFilme> getTodosFilmes();
@GET("movie/{movie_id}")
Call<DetalheFilme> getDetalheFilmePorId(@Path("movie_id") int idFilme);
@GET("movie/{movie_id}/similar")
Call<ResponseFilmeSimilar> getFilmeSimilares(@Path("movie_id") int idFilmeSimilar);
} | [
"wemersonf.rangel@outlook.com"
] | wemersonf.rangel@outlook.com |
68391c3f98a9a61086d675631073b3cffbec958d | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-13303-10-17-MOEAD-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/doc/XWikiDocument_ESTest_scaffolding.java | c46ae7eb415a1b41c8e78da7846ff62d737d9ab2 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Tue Apr 07 22:29:56 UTC 2020
*/
package com.xpn.xwiki.doc;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class XWikiDocument_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
10a6604a41d8fe54335f70c60a98ef902db1c050 | eecaffe86f93ec1222bffdc1d76caf5731937273 | /src/reusing/Cartoon.java | 3987f1e17124404843435656543b4a6037ac19eb | [] | no_license | dantin/thinking-in-java | 88502b0ea811090bddf00487397b29972e043478 | 6c6a7eea0b0b58f66ab6b9f80581d849a8fbf95b | refs/heads/master | 2021-03-12T20:26:43.308871 | 2014-02-08T23:46:39 | 2014-02-08T23:46:39 | 15,959,100 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | //: reusing/Cartoon.java
// Constructor calls during inheritance.
import static net.mindview.util.Print.print;
class Art {
Art() {
print("Art constructor");
}
}
class Drawing extends Art {
Drawing() {
print("Drawing constructor");
}
}
public class Cartoon extends Drawing {
public Cartoon() {
print("Cartoon constructor");
}
public static void main(String[] args) {
Cartoon x = new Cartoon();
}
}
| [
"chengjie.ding@gmail.com"
] | chengjie.ding@gmail.com |
95c22b0402a1dec70b4ba94067b512f2436eef64 | 76e9a58e3dd2d3568bc6f878007823ad48337b2a | /part2/Main.java | 4b6cfb654c009bbba355549a8c9e6583ba48d59e | [] | no_license | lkslts64/java_translator | 2e25db95ab11c2b1a3b1647e1cf7593a648e0afa | aff2b04a86b0f0d4633a25641429e3199dc2e5bf | refs/heads/master | 2020-05-03T11:43:27.641234 | 2019-03-30T20:25:58 | 2019-03-30T20:25:58 | 178,607,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | import java_cup.runtime.*;
import java.io.*;
class Main {
public static void main(String[] argv) throws Exception{
//System.out.println("Please type your program:");
Parser p = new Parser(new Scanner(new InputStreamReader(System.in)));
//Parser p = new Parser(new Scanner(new FileInputStream("input.txt")));
p.parse();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b91145088f87d16a630bf2723c603ab0145cf486 | ac6676894a2da0cab8a08f0c4e80e6334cd38132 | /src/com/gui/admin/UpdIndgredient.java | 6f9512c94c52e0f0fee45acffc2b9342ac0f3040 | [] | no_license | deep-stuff-08/RestaurantInventroyManager | d80de815956b7e11c05c3fb2876d193f1fd6c050 | 4bfde30526f394da0e38db61a95810b84258b87b | refs/heads/master | 2023-08-12T14:22:18.811163 | 2021-10-16T05:11:40 | 2021-10-16T05:11:40 | 256,666,318 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,438 | java | package com.gui.admin;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class UpdIndgredient {
JComboBox<String> indname;
JTextField newindname;
JLabel lnewindname;
JButton submit;
JPanel main;
public UpdIndgredient() throws SQLException {
String[] s=Admin.getConnect().getAllIndgredients();
indname=new JComboBox<String>(s);
newindname=new JTextField(10);
lnewindname=new JLabel("Enter new Indgredient name");
submit=new JButton("Submit");
submit.addActionListener(getSubAction());
main=new JPanel(new FlowLayout());
main.add(indname);
main.add(lnewindname);
main.add(newindname);
main.add(submit);
}
private ActionListener getSubAction() {
ActionListener ac=new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int a=JOptionPane.showConfirmDialog(null, "Are you sure you want to update this item?");
if(a==JOptionPane.YES_OPTION) {
try {
Admin.getConnect().updateIndgredients(newindname.getText(),(String)indname.getSelectedItem());
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
};
return ac;
}
public JPanel getMain() {
return main;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
bf71ec55caeedba995b12f7e2c03ab3135e631f8 | 0fa78b8c5823f603dbde35c7e3de67fd20973aaa | /Networking/URLNetwork/src/IdentifyYourselfHTTPAuthentication.java | c0cf09f48148b0dd9db65e5fb226a88948de0189 | [] | no_license | shivam04/java-codes | 1fe5fdbc5fc66cca75c79a3d51d8e011451ed805 | 9e92dcf9d52a94d307f4697d9298bbed138b86f9 | refs/heads/master | 2021-01-11T06:37:54.186860 | 2017-02-09T07:47:13 | 2017-02-09T07:47:13 | 81,423,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java |
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class IdentifyYourselfHTTPAuthentication {
public static void main(String a[])throws Exception{
URLConnection con = new URL("http://www.yourserver.com").openConnection();
con.setDoInput(true);
con.setRequestProperty("Authorization", "asdfasdf");
con.connect();
InputStream in = con.getInputStream();
}
}
| [
"sinhahsivam04@gmail.com"
] | sinhahsivam04@gmail.com |
5e9327e5b92cd297fd82adfb6a789741b7a397b6 | 85932a806dc32ec80aa5d13e7be71f34909786ac | /2017/12/18/RandomStringUtilsTest.java | e7ded0146d2d075be7657fa2d6eb9275bb97e39b | [] | no_license | renkaigis/KeepCoding | bed679e1573595b93d484fc7a9b274817fbfad7d | fce3d953da69f3469d4a92ae8e47d238bf2c70c6 | refs/heads/master | 2021-01-20T09:59:31.883392 | 2018-11-28T06:09:18 | 2018-11-28T06:09:18 | 101,612,966 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 988 | java | /**
* 218:生成随机字符串(Commons Lang 组件简介)
*/
import org.apache.commons.lang.RandomStringUtils;
public class RandomStringUtilsTest {
public static void main(String[] args) {
System.out.println("生成长度为 5 的由字母组成的字符串");
String randomString = RandomStringUtils.randomAlphabetic(5);
System.out.println(randomString);
System.out.println("生长长度为 5 的由字母和数字组成的字符串");
randomString = RandomStringUtils.randomAlphanumeric(5);
System.out.println(randomString);
System.out.println("生长长度为 5 的由 ASCII 编码在 32~126 间的字符组成的字符串");
randomString = RandomStringUtils.randomAscii(5);
System.out.println(randomString);
System.out.println("生长长度为 5 的由数字组成的字符串");
randomString = RandomStringUtils.randomNumeric(5);
System.out.println(randomString);
}
}
| [
"renkaigis@163.com"
] | renkaigis@163.com |
5784b7bbf2638b3b139bb5e43c660255b0e68205 | cf90309e91436ffffc46ea051931ca1a6af62429 | /src/main/java/me/khmmon/freelecspringboot2webservice_practice/web/dto/PostsSaveRequestDto.java | 67c7f2077c93edba75c9374ee345fe399629b2d5 | [] | no_license | mgh3326/freelec-springboot2-webservice_practice | 90a35a15b4ee9b09c613715e4e4844ff9ba52f99 | 3d6d955c2d7751600ac8f2e9f37df3305b21cb5d | refs/heads/master | 2023-09-03T16:21:12.919920 | 2020-01-06T13:35:25 | 2020-01-06T13:35:25 | 229,744,514 | 0 | 0 | null | 2023-06-14T13:23:35 | 2019-12-23T12:04:22 | Java | UTF-8 | Java | false | false | 695 | java | package me.khmmon.freelecspringboot2webservice_practice.web.dto;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import me.khmmon.freelecspringboot2webservice_practice.domain.posts.Posts;
@Getter
@NoArgsConstructor
public class PostsSaveRequestDto {
private String title;
private String content;
private String author;
@Builder
public PostsSaveRequestDto(String title, String content, String author) {
this.title = title;
this.content = content;
this.author = author;
}
public Posts toEntity() {
return Posts.builder()
.title(title)
.content(content)
.author(author)
.build();
}
} | [
"mgh3326@naver.com"
] | mgh3326@naver.com |
6afee942ab316e06aef1b9a0973847b8fb379e9d | d542b8c925f623c17d7082b4e9fe0b524b1a650d | /src/test/java/com/pmattioli/diffresolver/service/DiffResolverServiceTest.java | 8569cba7946310da2099d8da666a893cbec93cbb | [
"Apache-2.0"
] | permissive | pmattioli/scalable-web | 3974d43c84d0813d412e4b56451ad63e5d89c14b | ab7e890cf2fc5d87dc72e4046fe79d776f6e9a4e | refs/heads/master | 2021-07-10T06:15:38.029365 | 2017-10-08T19:10:30 | 2017-10-08T19:10:30 | 105,569,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,787 | java | package com.pmattioli.diffresolver.service;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.*;
import java.nio.charset.Charset;
import java.util.Base64;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Import;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@Import(DiffResolverServiceTestConfig.class)
public class DiffResolverServiceTest {
private static final String DATA = "UGxlYXNlIGhpcmUgbWUh";
private static final String ALTERED_DATA = "UGxlYXNlIEhpcmUgTWUh";
private static final String DIFFERENT_SIZE_DATA = "UGxlYXNlIGhpcmUgbWUhIQ==";
private static final String INVALID_SIZE_DATA = "UGxlYXNlIEhpcmUgTWUh==";
private static final int DIFF_ID = 1;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Autowired
private DiffResolverService diffResolverService;
@Test
@DirtiesContext
public void shouldReturnExpectedOffsetsArrayWhenBothLefAndRightDataHaveBeenSet() throws Exception {
diffResolverService.setLeft(DIFF_ID, DATA);
diffResolverService.setRight(DIFF_ID, ALTERED_DATA);
assertThat(diffResolverService.resolveDiff(DIFF_ID),
equalTo(new int[] { 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 13, 0, 0 }));
}
@Test
@DirtiesContext
public void shouldThrowIllegalStateExceptionWhenOnlyRightDataIsSet() throws Exception {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("No left side data for ID " + DIFF_ID);
diffResolverService.setRight(DIFF_ID, DATA);
diffResolverService.resolveDiff(DIFF_ID);
}
@Test
@DirtiesContext
public void shouldThrowIllegalStateExceptionWhenOnlyLeftDataIsSet() throws Exception {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("No right side data for ID " + DIFF_ID);
diffResolverService.setLeft(DIFF_ID, DATA);
diffResolverService.resolveDiff(DIFF_ID);
}
@Test
@DirtiesContext
public void shouldThrowIllegalStateExceptionWhenDataPostedHasDifferentSizes() throws Exception {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Files have different sizes");
diffResolverService.setLeft(DIFF_ID, DATA);
diffResolverService.setRight(DIFF_ID, DIFFERENT_SIZE_DATA);
diffResolverService.resolveDiff(DIFF_ID);
}
@Test
public void shouldThrowIllegalArgumentExceptionWhenAttemptingToSetNotBase64EncodedLeftData() throws Exception {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Data has to be Base64-encoded");
diffResolverService.setLeft(DIFF_ID, INVALID_SIZE_DATA);
}
@Test
public void shouldThrowIllegalArgumentExceptionWhenAttemptingToSetNotBase64EncodedRightData() throws Exception {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Data has to be Base64-encoded");
diffResolverService.setRight(DIFF_ID, INVALID_SIZE_DATA);
}
@Test
public void shouldReturnDataSizedAllZeroArrayWhenSidesAreEqual() throws Exception {
diffResolverService.setLeft(DIFF_ID, DATA);
diffResolverService.setRight(DIFF_ID, DATA);
byte[] decodedData = Base64.getDecoder().decode(DATA.getBytes(Charset.forName("UTF-8")));
int[] actualOffsetsArray = diffResolverService.resolveDiff(DIFF_ID);
assertArrayEquals(new int[decodedData.length], actualOffsetsArray);
}
}
| [
"pablo.mattioli@infor.com"
] | pablo.mattioli@infor.com |
04f8d59f6b41f77cf82d78f1fc23856cde1eb213 | 41a0f25b35ae5484ef232fe5b563de7959187855 | /src/main/java/ReshapTheString/ReshapeTheString.java | 91b206760bdb2251731552dbae2aad13678e1037 | [] | no_license | ChunYoung0518/algorithm-datastructure | f961bf86434b934e18be3283ad2be4fbaf253ce4 | c9eba8ae88af5a5a85729217a0c99e21392b3e03 | refs/heads/master | 2023-07-02T06:18:02.176890 | 2021-08-16T04:48:30 | 2021-08-16T04:48:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package ReshapTheString;
public class ReshapeTheString {
public static String reshape(int n, String str) {
String tmp = str.replaceAll(" ", "");
String res = "";
int i = 0;
while(i*n+n <=tmp.length()) {
res = res + "\n" + tmp.substring(i*n, i*n + n);
i++;
}
res = res + "\n" + tmp.substring(i*n, tmp.length());
res = res.replaceFirst("\n", "");
return res;
}
}
| [
"chunyoung0518@gmail.com"
] | chunyoung0518@gmail.com |
0fdf3a6bf86839ddbbe94bd6b496a7826b3ea599 | bd9fecbafdde57da522bda861761f06a3be1d8ff | /src/MembreConnexionControleur.java | 95339e3c98a757f72cf751c5f4b82cd261f8b409 | [] | no_license | lisemonticelli/ac2v_Stocks | 817990de48d4d31f70e017c42be77c57e5469ff2 | f8266a337f359dbe2891c6895df546bfb0710463 | refs/heads/main | 2023-05-03T02:22:51.773912 | 2021-05-26T09:42:04 | 2021-05-26T09:42:04 | 370,975,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,705 | java |
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class MembreConnexionControleur
*/
@WebServlet("/MembreConnexionControleur")
public class MembreConnexionControleur extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public MembreConnexionControleur() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String nom_utilisateur = request.getParameter("nom_utilisateur");
MembreDAOModele membreDAOModele = new MembreDAOModele();
String nomVerify = membreDAOModele.verifier(nom_utilisateur);
if (!nomVerify.equals("")) {
request.getRequestDispatcher("MenuControleur").forward(request, response);
}
else {
System.out.printf("Utilisateur non enregistré");
request.getRequestDispatcher("/membreConnexionVue.jsp").forward(request, response);
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
caa3d017851736f2bc0e7ab33fc4a47714cca958 | 413a7af312ea52f2e11f9b7911d547538f7c661f | /common/src/main/java/com/cqjtu/mapper/ProfileMapper.java | 58612d501c30f39fe5348874a4cb95137d1bf6df | [] | no_license | CQJTU-ZCT/SmartHospital | 848750fad2f4e6732bf37d07cc0aeed1e4861626 | ef17e8f56fccf253b0afc0ac66c5047b83427710 | refs/heads/master | 2018-10-05T21:14:17.408846 | 2018-04-20T10:41:49 | 2018-04-20T10:41:49 | 113,404,812 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package com.cqjtu.mapper;
import com.cqjtu.model.Profile;
import com.cqjtu.model.ProfileExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ProfileMapper {
long countByExample(ProfileExample example);
int deleteByExample(ProfileExample example);
int deleteByPrimaryKey(String profileId);
int insert(Profile record);
int insertSelective(Profile record);
List<Profile> selectByExample(ProfileExample example);
Profile selectByPrimaryKey(String profileId);
int updateByExampleSelective(@Param("record") Profile record, @Param("example") ProfileExample example);
int updateByExample(@Param("record") Profile record, @Param("example") ProfileExample example);
int updateByPrimaryKeySelective(Profile record);
int updateByPrimaryKey(Profile record);
} | [
"799243917@qq.com"
] | 799243917@qq.com |
f75db3d61c2581a70832a32640eb98b42263c69d | 78faa42e3abc9e9ef28e51e90c16469fa97ad99d | /zhaohg-design/src/main/java/com/zhaohg/memento/Test.java | 41c96d3b398847a5c9f2e7a2e876b80283a80581 | [] | no_license | lifan149/dev | 38d932b0305fa9ec4d771c07f282cd8ea600862f | 5c2e19ecc1fec77c3acfb1693a9fa28c59e33aff | refs/heads/master | 2020-05-30T04:56:41.304909 | 2019-05-31T07:32:04 | 2019-05-31T07:32:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,083 | java | package com.zhaohg.memento;
/**
* 备忘录模式(Memento)
* <p>
* 主要目的是保存一个对象的某个状态,以便在适当的时候恢复对象,个人觉得叫备份模式更形象些,
* 通俗的讲下:假设有原始类A,A中有各种属性,A可以决定需要备份的属性,备忘录类B是用来存储A的一些内部状态,类C呢,
* 就是一个用来存储备忘录的,且只能存储,不能修改等操作。做
*/
public class Test {
public static void main(String[] args) {
// 创建原始类
Original origi = new Original("egg");
// 创建备忘录
Storage storage = new Storage(origi.createMemento());
// 修改原始类的状态
System.out.println("初始化状态为:" + origi.getValue());
origi.setValue("niu");
System.out.println("修改后的状态为:" + origi.getValue());
// 回复原始类的状态
origi.restoreMemento(storage.getMemento());
System.out.println("恢复后的状态为:" + origi.getValue());
}
}
| [
"zhaohg@chinaoly.com"
] | zhaohg@chinaoly.com |
38ec0a528e5434a363bb8afe1def3d2e6956d9d1 | e070696b98a790f0b98e1aac902ba40078298eeb | /android/src/main/java/com/reactlibrary/DataParser.java | a12165bc79848e4127f1a93bb88cb59c53bfe371 | [] | no_license | marjen0/react-native-recycler-view | 850d17e03477c7392a916b5ad657f76ef0005d87 | 24d05612e991b7a8cecb79bd51e8a39450a8b74f | refs/heads/master | 2022-12-26T12:20:33.109958 | 2020-09-28T20:32:46 | 2020-09-28T20:32:46 | 299,422,272 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 818 | java | package com.reactlibrary;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.reactlibrary.Model.Movie;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
public class DataParser {
public static ArrayList<Movie> parse(ReadableArray readableArray) {
ArrayList<Movie> parsedMovies = new ArrayList<Movie>();
for (int i = 0; i<readableArray.size(); i++) {
ReadableMap movieMap = readableArray.getMap(i);
Movie movie = new Movie();
movie.setTitle(movieMap.getString("title"));
movie.setId(movieMap.getString("_id"));
movie.setPosterSrc(movieMap.getString("posterSrc"));
parsedMovies.add(movie);
}
return parsedMovies;
}
}
| [
"m.jenulis@gmail.com"
] | m.jenulis@gmail.com |
5b3ab264b577bf2fb159fa0bf51655fe41b75382 | 988c2804bdfe4ee280f1e25e8e1388b5c07c0bc5 | /src/main/java/com/wirus006/animelist/repositories/AnimeRepo.java | a4a02821862e159682e2f1c0d2893f8f4ef2e59e | [] | no_license | mattyl006/anime-list | ebfb95141327370c53a93de3930b6dd05734df79 | 8b491389fc7fd21f031ce6bfa3b2d59946f22f1e | refs/heads/master | 2022-11-12T01:56:11.366293 | 2020-07-06T09:27:02 | 2020-07-06T09:27:02 | 262,806,112 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package com.wirus006.animelist.repositories;
import com.wirus006.animelist.entities.Anime;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface AnimeRepo extends CrudRepository<Anime, Long>, PagingAndSortingRepository<Anime, Long> {
@Query("select count(a) from Anime a where a.id = ?1")
Integer checkIfExist(Long id);
@Query("select count(a) from Anime a where a.status=:status")
Long countByStatus(@Param("status") String status);
}
| [
"wirus006@gmail.com"
] | wirus006@gmail.com |
d0b31eb030131207e1512d0ab76969405fa05a2a | bd729ef9fcd96ea62e82bb684c831d9917017d0e | /kyptLBSapi/src/java/com/kypt/c2pp/nio/SupCommunicateHandler.java | e3b66e18b756bca84b9f9b63f609873c8e81caac | [] | no_license | shanghaif/workspace-kepler | 849c7de67b1f3ee5e7da55199c05c737f036780c | ac1644be26a21f11a3a4a00319c450eb590c1176 | refs/heads/master | 2023-03-22T03:38:55.103692 | 2018-03-24T02:39:41 | 2018-03-24T02:39:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,884 | java | package com.kypt.c2pp.nio;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.kypt.c2pp.back.SupCommandQueueMap;
import com.kypt.c2pp.buffer.UpCommandBuffer;
import com.kypt.c2pp.inside.msg.InsideMsg;
import com.kypt.c2pp.inside.msg.InsideMsgFactory;
import com.kypt.c2pp.inside.msg.InsideMsgResp;
import com.kypt.c2pp.inside.msg.InsideMsgStatusCode;
import com.kypt.c2pp.inside.msg.resp.ActiveTestResp;
import com.kypt.c2pp.inside.msg.resp.LoginResp;
import com.kypt.c2pp.inside.processor.IInsideProcessor;
import com.kypt.c2pp.inside.processor.InsideProcessorMap;
import com.kypt.configuration.C2ppCfg;
import com.kypt.nio.client.AbstractNioHandler;
public class SupCommunicateHandler extends AbstractNioHandler<SupCommService> {
private Logger log = LoggerFactory.getLogger(SupCommunicateHandler.class);
private static final String NAME = "<SupCommunicateHandler>";
private boolean isLogined;
private SupActiveTest activeTest;
public SupCommunicateHandler(SupCommService nioService) {
super(nioService);
}
public void connectionClosed(SupCommService nioService) throws Exception {
log.info(NAME + "the session between ota and "
+ nioService.getRemoteAddress() + " is closed.");
isLogined = false;
cancelActiveTest();
// for(int i=0;i<Constant.array.size();i++){
// if(nioService.getRemoteAddress().equals(Constant.array.get(i))){
// Constant.array.remove(i);
// }
// }
// System.out.println("array:"+Constant.array.size());
nioService.reconnect();
}
/*
* 建立连接同时发送登录消息
*/
public void connectionOpen(SupCommService nioService) throws Exception {
byte[] bytes = (InsideMsgFactory.createLoginReq().toString())
.getBytes(C2ppCfg.props.getProperty("superviseEncoding"));
nioService.send(bytes);
StringBuilder sb = new StringBuilder();
sb.append("send a login request message.");
if (log.isDebugEnabled()) {
sb.append(new String(bytes));
}
log.info(NAME + sb.toString());
}
@SuppressWarnings("unchecked")
public void doMsg(SupCommService nioService, byte[] buf) throws Exception {
try {
/*
* while (!SpringBootStrap.getInstance().isInit()) {
* System.out.println(SpringBootStrap.getInstance().isInit());
* Thread.sleep(1000); // System.out.println("-----------"); }
*/
String msgStr = new String(buf, C2ppCfg.props
.getProperty("superviseEncoding"));
if (msgStr != null && msgStr.length() > 0) {
String message[] = msgStr.split("\\s+");
log.info(message.length + ":::");
for (int i = 0; i < message.length; i++) {
System.out.println((i + 1) + "=" + message[i]);
}
String command = getCommand(message);
if (!isLogined) {
if (command.equals(LoginResp.COMMAND)) {
// doLogin(nioService, message[0], command);
}
} else {
activeTest.clear();
if (command.equals(ActiveTestResp.COMMAND)) {
activeTest.doActiveTestResp();
} else {
IInsideProcessor processor = InsideProcessorMap
.getInstance().getProcessor(command);
if (processor != null) {
InsideMsg msg = processor.parse(message);
// processor.valid(msg);
processor.handle(msg, nioService);
} else {
log.error(NAME
+ "there is no processor for command:"
+ command);
}
}
}
}
} catch (Throwable t) {
log.error(NAME + "there is a exception when deal with the message:"
+ new String(buf), t);
}
}
@SuppressWarnings("unchecked")
private void doLogin(SupCommService nioService, String[] message,
String command) throws Exception {
/*
* while (!SpringBootStrap.getInstance().isInit()) { Thread.sleep(5000); //
* System.out.println("-----------"); }
*/
IInsideProcessor processor = InsideProcessorMap.getInstance()
.getProcessor(command);
if (processor != null) {
InsideMsg msg = processor.parse(message);
// processor.valid(msg);
if (InsideMsgStatusCode.STATUS_LOGIN_COMMON_OP.equals(msg
.getStatusCode())
|| InsideMsgStatusCode.STATUS_LOGIN_MIDDLE_OP.equals(msg
.getStatusCode())
|| InsideMsgStatusCode.STATUS_LOGIN_ADMIN_OP.equals(msg
.getStatusCode())) {
isLogined = true;
log
.info(NAME + "receive login response."
+ " ------Login "
+ nioService.getRemoteAddress()
+ " successfully------");
startActiveTest(nioService);// 开启心跳包发送线程
startSendUpCommand(nioService);// 开启向监管平台发送数据线程
// startVgSendDataService(nioService);
} else if (InsideMsgStatusCode.STATUS_LOGIN_PASSWORD_ERROR
.equals(msg.getStatusCode())) {
log
.error(NAME
+ " password in the login message is wrong. Login Failed!!!");
} else if (InsideMsgStatusCode.STATUS_LOGIN_USER_ONLINE.equals(msg
.getStatusCode())) {
log.error(NAME + " user online. Login Failed!!!");
} else if (InsideMsgStatusCode.STATUS_LOGIN_USER_LOGOFF.equals(msg
.getStatusCode())) {
log.error(NAME + " user cancelled. Login Failed!!!");
} else if (InsideMsgStatusCode.STATUS_LOGIN_USER_UNEXIST.equals(msg
.getStatusCode())) {
log.error(NAME + "user disable. Login Failed!!!");
} else if (InsideMsgStatusCode.STATUS_LOGIN_QUERY_FAILURE
.equals(msg.getStatusCode())) {
log.error(NAME + "user search failure. Login Failed!!!");
} else if (InsideMsgStatusCode.STATUS_LOGIN_DATABASE_ERROR
.equals(msg.getStatusCode())) {
log.error(NAME
+ " paltform database exception. Login Failed!!!");
} else {
log.error(NAME + "status in the login response is "
+ msg.getStatusCode() + ".Login Failed!!!");
}
} else {
log.error(NAME + "there is no processor for command:" + command);
}
}
private void startActiveTest(SupCommService nioService) throws Exception {
activeTest = new SupActiveTest(nioService, InsideMsgFactory
.createActiveTestReq().toString().getBytes(
C2ppCfg.props.getProperty("superviseEncoding")));
activeTest.start();
}
private void startSendUpCommand(SupCommService nioService) throws Exception {
System.out.print("init send up command thread!");
BlockingQueue<InsideMsgResp> bq = new LinkedBlockingQueue<InsideMsgResp>();
SupCommandQueueMap.getInstance().put(nioService.getRemoteAddress(), bq);
// 启动消息发送线程
SupUpCommandSend sus = new SupUpCommandSend(nioService);
Thread upSend = new Thread(sus);
upSend.start();
// 启动消息分发线程
UpCommandBuffer upBuffer = UpCommandBuffer.getInstance();
if (upBuffer.isShutdownFlag()) {
Thread worker = new Thread(upBuffer);
worker.start();
}
}
private void cancelActiveTest() {
if (activeTest != null) {
activeTest.cancel();
}
}
private String getCommand(String msg) {
int i = msg.indexOf("\\s+");
String command = msg.substring(0, i);
return command;
}
private String getCommand(String msg[]) {
String command = "";
if (msg[0].equals("LOGI") || msg[0].equals("LACK")
|| msg[0].equals("LOGO") || msg[0].equals("NOOP")
|| msg[0].equals("NOOP_ACK")) {
command = msg[0];
} else if (msg[0].equals("CAITS") && msg.length >= 5) {
String codingLine = msg[4];
String codingType = msg[5].substring(msg[5].indexOf(":") + 1,
msg[5].indexOf(","));
if (codingLine.equals("D_REQD")) {
if (codingType.equals("1")) {// 多媒体数据检索
command = "0x8802";
} else if (codingType.equals("2")) {// 多媒体数据上传
command = "0x0801";
}
}
if (codingLine.equals("U_REPT")) {
if (codingType.equals("0")) {// 位置信息汇报
command = "0x0200";
} else if (codingType.equals("32")) {// 提问应答
command = "0x0302";
}
}
if (codingLine.equals("D_SNDM")) {
if (codingType.equals("1")) {// 文本信息下发
command = "0x8300";
} else if (codingType.equals("5")) {// 提问下发
command = "0x8302";
}
}
if (codingLine.equals("D_CTLM")) {
if (codingType.equals("9")) {// 终端监听
command = "0x8400";
} else if (codingType.equals("10")) {// 终端拍照
command = "0x8801";
}
}
if (codingLine.equals("D_GETP")) {
if (codingType.equals("0")) {// 查询终端参数
command = "0x8104";
} else if (codingType.equals("10")) {// 终端拍照
command = "0x8801";
}
}
if (codingLine.equals("D_SETP")) {
if (codingType.equals("0")) {// 设置终端参数
command = "0x8103";
} else if (codingType.equals("11")) {// 事件设置
command = "0x8301";
}
}
}
return command;
}
public void doMsg(SupCommService nioService, String message)
throws Exception {
try {
String msgs[] = message.split("\\s+");
String command = getCommand(msgs);
if (command != null && command.length() > 0) {
if (!isLogined) {
if (command.equals(LoginResp.COMMAND)) {
doLogin(nioService, msgs, command);
}
} else {
log.info("command::::" + command);
// activeTest.clear();
if (command.equals(ActiveTestResp.COMMAND)) {
activeTest.doActiveTestResp();
} else {
IInsideProcessor processor = InsideProcessorMap
.getInstance().getProcessor(command);
if (processor != null) {
InsideMsg msg = processor.parse(msgs);
// processor.valid(msg);
processor.handle(msg, nioService);
} else {
log.error(NAME
+ "there is no processor for command:"
+ command);
}
// System.out.println(VehicleCacheManager.vehicleMap.size());
// System.out.println(VehicleCacheManager.getInstance().getValue("SUSUCTD60A1026622").getModify_time());
}
}
}
} catch (Throwable t) {
log.error(NAME + "there is a exception when deal with the message:"
+ message, t);
}
}
}
| [
"zhangjunfang0505@163.com"
] | zhangjunfang0505@163.com |
597d3075b1a6cbd104ce49abfdd758a1aa2200bd | f0bc1f548c9a1b32f8b90fe792654ebb965cb9ab | /projectEuler/P066.java | aa7d1f89c1aef874ed8c6c9af7b97289e10d8da1 | [] | no_license | jmbutler5/Project-Euler | 03423af5bdbf3f7b4355aebc1ce93174fb4877b0 | 6217e64a977f27ac4fb1ef46be6d84789036e7e5 | refs/heads/master | 2023-01-06T01:34:03.808295 | 2020-10-26T02:04:40 | 2020-10-26T02:04:40 | 245,029,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,844 | java | package projectEuler;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.ArrayList;
public class P066 extends ParameterizedProblem<Integer> {
private static class ReturnClass {
ArrayList<Integer> continuedFraction;
MathContext precision;
public ReturnClass(ArrayList<Integer> cf, MathContext pre){
continuedFraction = cf;
precision = pre;
}
}
@Override
public Integer getDefaultParameter(){
return 1000;
}
@Override
public long solve(Integer maxD, boolean printResults){
BigInteger largestX = BigInteger.ZERO;
int largestD = 0;
MathContext precision = new MathContext(10);
for(int D = 2; D <= maxD; D++){
ReturnClass returnVar = findCF(D, precision);
// this is how I'm skipping squares
if(returnVar == null)
continue;
precision = returnVar.precision;
ArrayList<Integer> continuedFraction = returnVar.continuedFraction;
// required for correct soln. I don't quite understand it
if((continuedFraction.size() - 1) % 2 == 1){
// ad an extra period
int originalSize = continuedFraction.size();
for(int j = 1; j < originalSize; j++)
continuedFraction.add(continuedFraction.get(j));
}
//get rid of last item
continuedFraction.remove(continuedFraction.size() - 1);
// in form x / y
BigInteger[] frac = computeCF(continuedFraction);
if(frac[0].compareTo(largestX) > 0) {
largestX = frac[0];
largestD = D;
}
}
if(printResults)
System.out.println("the largest minimal value of x is obtained when D = " + largestD + " for D <= "
+ maxD);
return largestD;
}
private static BigInteger[] computeCF(ArrayList<Integer> cf) {
if(cf == null)
return null;
// jump start algorithm
BigInteger num = BigInteger.ONE;
BigInteger den = BigInteger.valueOf(cf.get(cf.size() - 1));
for(int i = cf.size() - 2; i >= 0; i--){
BigInteger temp = den.multiply(BigInteger.valueOf(cf.get(i))).add(num);
num = den;
den = temp;
}
return new BigInteger[]{den, num};
}
private static ReturnClass findCF(int D, MathContext precision){
ArrayList<Integer> continuedFraction = new ArrayList<>();
int a0 = (int) Math.sqrt(D);
continuedFraction.add(a0);
// these are very minor improvements because these are so short anyways,
// but these are one's I found that do follow a pattern
if(EulerTools.isSquare(D)) {
return null;
} else if(EulerTools.isSquare(D - 1)) {
continuedFraction.add(a0 * 2);
return new ReturnClass(continuedFraction, precision);
} else if(EulerTools.isSquare(D - 2)) {
continuedFraction.add(a0);
continuedFraction.add(2 * a0);
return new ReturnClass(continuedFraction, precision);
} else if(EulerTools.isSquare(D + 1)) {
continuedFraction.add(1);
continuedFraction.add(2 * a0);
return new ReturnClass(continuedFraction, precision);
}
// these are very minor improvements because these are so short anyways,
// but these are one's I found that do follow a pattern
if(EulerTools.isSquare(D)) {
return null;
} else if(EulerTools.isSquare(D - 1)) {
continuedFraction.add(a0 * 2);
return new ReturnClass(continuedFraction, precision);
} else if(EulerTools.isSquare(D - 2)) {
continuedFraction.add(a0);
continuedFraction.add(2 * a0);
return new ReturnClass(continuedFraction, precision);
} else if(EulerTools.isSquare(D + 1)) {
continuedFraction.add(1);
continuedFraction.add(2 * a0);
return new ReturnClass(continuedFraction, precision);
}
//reinitialize variables
while(true) {
BigDecimal num = BigDecimal.ONE;
BigDecimal den = BigDecimal.valueOf(D).sqrt(precision).subtract(BigDecimal.valueOf(a0));
// catching errors of final number is not 2*a_0, which isn't something that's possible, and div by 0
// both of these are indicators that the precision is off
try {
//the last number in the period is always 2 * a0
while(num.divideToIntegralValue(den).intValue() < a0 * 2) {
int an = num.divideToIntegralValue(den).intValue();
continuedFraction.add(an);
BigDecimal temp = num.subtract(BigDecimal.valueOf(an).multiply(den));
num = den;
den = temp;
}
// if lost precision
if(num.divideToIntegralValue(den).intValue() != 2 * a0)
throw new Exception();
continuedFraction.add(2 * a0);
return new ReturnClass(continuedFraction, precision);
} catch(Exception e) {
//increase precision until it's precise enough
precision = new MathContext(precision.getPrecision() * 2);
//retry
continuedFraction.clear();
continuedFraction.add(a0);
}
}
}
@Override
public Integer getTestParameter(){
return 7;
}
@Override
public long getTestSolution(){
return 5;
}
@Override
public String getTitle(){
return "Problem 066: Diophantine Equation";
}
}
| [
"56049748+jmbutler5@users.noreply.github.com"
] | 56049748+jmbutler5@users.noreply.github.com |
20f3308b6205b61195fc7caffb560ebb93650a8e | 2f0b924dcfcdbf215a3d94d4c72433e375f432ae | /PracticePerfect/src/main/java/structures/list/SingleLinkedListH.java | 175b7b4b3950b3a562218e8edd67cebcc2dc82f2 | [] | no_license | gedu/practiceMakesPerfect | fd362a0b85d574190e5637fe1bfa956e1d3028bd | 2374f8891ba668c9d7831a9a5e04c686c30d23ab | refs/heads/master | 2021-01-25T13:24:41.277802 | 2018-03-07T20:28:26 | 2018-03-07T20:28:26 | 123,568,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,614 | java | package structures.list;
/**
* Created by eduardo.graciano on 3/6/18.
*
* This liked list only keep track of the Head node
*/
public class SingleLinkedListH<E> implements IList<E> {
private int size = 0;
private Node<E> head = null;
public SingleLinkedListH() {}
@Override
public E getFrom(int position) {
checkPositionRange(position);
if (isEmptyHeader()) return null;
Node<E> currentNode = head;
for (int i = 0; currentNode != null; i++) {
if (i == position) return currentNode.content;
currentNode = currentNode.next;
}
return null;
}
@Override
public void add(E item) {
Node<E> newNode = new Node<>(item, null);
if (head == null) {
head = newNode;
size++;
return;
}
Node<E> currentNode = head;
while (currentNode.next != null) {
currentNode = currentNode.next;
}
currentNode.next = newNode;
size++;
}
@Override
public void removeFrom(int position) {
checkPositionRange(position);
if (isEmptyHeader()) throw new IllegalStateException("List is empty");
if (position == 0) {
Node<E> nextNode = head.next;
head.content = null;
head.next = null;
head = nextNode;
--size;
return;
}
Node<E> currentNode = head.next;
Node<E> prevNode = head;
for (int i = 1; currentNode != null; i++) {
if (i == position) {
Node<E> tempNode = currentNode.next;
currentNode.content = null;
currentNode.next = null;
prevNode.next = tempNode;
--size;
break;
}
prevNode = currentNode;
currentNode = currentNode.next;
}
}
@Override
public void clear() {
if (isEmptyHeader()) return;
Node<E> currentNode = head;
while (currentNode != null) {
Node<E> nextNode = currentNode.next;
currentNode.content = null;
currentNode.next = null;
currentNode = nextNode;
}
size = 0;
}
@Override
public int size() {
return size;
}
private void checkPositionRange(int position) {
if (position > size || position < 0)
throw new IndexOutOfBoundsException("position: "+position+" size: "+size);
}
private boolean isEmptyHeader() {
return (head == null);
}
}
| [
"egraciano@humana.com"
] | egraciano@humana.com |
943e699e96f7837ea1c01da307b5feded1fe17e1 | 50d116f3db6f680ef4cf0e5eaa6155a3e1db8e05 | /app/src/main/java/com/codepath/apps/MyTwitterApp/utils/TwitterApplication.java | 872fef4a193dbccda689a74aa862a4c0b002bee5 | [
"MIT",
"Apache-2.0"
] | permissive | Dieula/MySimpleTweet | 1f410633c48889331338d0c5e08769f3f5adbcac | b169cfd990117f46e7ba86fe141bdc94c8dcab2d | refs/heads/master | 2021-01-02T22:46:15.291642 | 2017-08-15T10:29:44 | 2017-08-15T10:29:44 | 99,296,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | package com.codepath.apps.MyTwitterApp.utils;
import com.raizlabs.android.dbflow.config.FlowConfig;
import com.raizlabs.android.dbflow.config.FlowLog;
import com.raizlabs.android.dbflow.config.FlowManager;
import android.app.Application;
import android.content.Context;
/*
* This is the Android application itself and is used to configure various settings
* including the image cache in memory and on disk. This also adds a singleton
* for accessing the relevant rest client.
*
* TwitterClient client = TwitterApplication.getRestClient();
* // use client to send requests to API
*
*/
public class TwitterApplication extends Application {
private static Context context;
@Override
public void onCreate() {
super.onCreate();
FlowManager.init(new FlowConfig.Builder(this).build());
FlowLog.setMinimumLoggingLevel(FlowLog.Level.V);
TwitterApplication.context = this;
}
public static TwitterClient getRestClient() {
return (TwitterClient) TwitterClient.getInstance(TwitterClient.class, TwitterApplication.context);
}
} | [
"dareusdieula@gmail.com"
] | dareusdieula@gmail.com |
44cdba17612689aad1da2c6f152e0d5be20d50c5 | 23a74bfaff72c109fd13566ea3d4704a9c26d918 | /src/main/java/WebTest/BrowserSelector.java | 57d5fc7d5978ed489f6f635ac9d14c83df3fdb1d | [] | no_license | pbksoft2019/DemoNopCommerce | 213cb0d86d4272478c3656496c73a7451bf97be5 | b609a224290cdf8e4ac048f42d381a85d3c4da46 | refs/heads/master | 2023-05-11T19:12:21.777803 | 2020-02-26T22:07:55 | 2020-02-26T22:07:55 | 243,376,481 | 0 | 0 | null | 2023-05-09T18:44:48 | 2020-02-26T22:08:58 | Java | UTF-8 | Java | false | false | 2,205 | java | package WebTest;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.util.concurrent.TimeUnit;
public class BrowserSelector extends Utils
{
public void setUpBrowser()
{
String browser = "chrome";
if (browser.equals("chrome"))
{
System.setProperty("webdriver.chrome.driver", "src\\test\\resources\\BrowserDriver\\chromedriver.exe");
driver= new ChromeDriver();
//driver.manage().window().fullscreen();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://demo.nopcommerce.com/");
}
else if (browser.equals("firefox"))
{
System.setProperty("webdriver.gecko.driver", "src\\test\\resources\\BrowserDriver\\geckodriver.exe");
driver= new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://demo.nopcommerce.com/");
}
else if (browser.equals("ie"))
{
System.setProperty("webdriver.ie.driver", "src\\test\\resources\\BrowserDriver\\IEDriverServer.exe");
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability("nativeEvents", false);
ieCapabilities.setCapability("unexpectedAlertBehaviour", "accept");
ieCapabilities.setCapability("ignoreProtectedModeSettings", true);
ieCapabilities.setCapability("disable-popup-blocking", true);
ieCapabilities.setCapability("enablePersistentHover", true);
driver = new InternetExplorerDriver(ieCapabilities);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://demo.nopcommerce.com/");
}
else
{
System.out.println("Beowser name is wrong or empty :"+browser);
}
}
public void closeBrowser() {
driver.quit();
}
}
| [
"pbksoft2019@gmail.com"
] | pbksoft2019@gmail.com |
e3c4d9703f24e021a86efb0faec6b4dacca0597a | aec54799d8ad1dd02a973d9c715fb90580879ac6 | /app/src/main/java/com/example/Tab5/MineButton.java | 6ba939a7d355f3dfd37e6734ef8a0f3479915fad | [] | no_license | YG0122/Project2 | 1839ee91d4b851e7aaffbc1f3a2866eec3366f92 | 1bdbaa5e77456ca416b08120f9dee9d84620f8d2 | refs/heads/master | 2020-06-16T10:04:20.640007 | 2019-07-06T12:10:18 | 2019-07-06T12:10:18 | 195,532,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,067 | java | package com.example.Tab5;
import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.appcompat.widget.AppCompatImageButton;
import java.util.Random;
import java.util.Vector;
public class MineButton extends AppCompatImageButton {
private static Vector<MineButton> sBtnV = new Vector<MineButton>();
public enum BombMode {OPEN, MARK};
private static BombMode sBombMode = BombMode.OPEN;
private static int sCellCount;
private static int sMineCount = 0;
private static int sMarkedCount;
private static int sFoundMineCount;
private static int sOpenedCellCount;
public enum State { OPENED, MARKED, CLOSED, WRONG_MARKED };
int mCol, mRow;
State mState;
int mValue;
private static int sCols=0, sRows=0;
private static boolean sInitialized = false;
private static Drawable sDs[] = new Drawable[8];
private static Drawable sMarker;
private static Drawable sBomb;
private static Drawable sBtn;
private static Drawable sBombX;
public MineButton(Context context, int row, int col) {
// TODO Auto-generated constructor stub
this(context, row, col, State.CLOSED, 0);
}
private MineButton(Context context, int row, int col, State state, int value) {
super(context);
mCol = col;
mRow = row;
mState = state;
mValue = value;
sBtnV.add(this);
if (col+1 > sCols)
sCols = col+1;
if (row+1 > sRows)
sRows = row+1;
if (!sInitialized) {
sDs[0] = context.getResources().getDrawable(R.drawable.d0);
sDs[1] = context.getResources().getDrawable(R.drawable.d1);
sDs[2] = context.getResources().getDrawable(R.drawable.d2);
sDs[3] = context.getResources().getDrawable(R.drawable.d3);
sDs[4] = context.getResources().getDrawable(R.drawable.d4);
sDs[5] = context.getResources().getDrawable(R.drawable.d5);
sDs[6] = context.getResources().getDrawable(R.drawable.d6);
sDs[7] = context.getResources().getDrawable(R.drawable.d7);
sMarker = context.getResources().getDrawable(R.drawable.marker);
sBomb = context.getResources().getDrawable(R.drawable.bomb);
sBombX = context.getResources().getDrawable(R.drawable.bombx);
sBtn = context.getResources().getDrawable(R.drawable.db);
sInitialized = true;
}
}
public static void initAllMines(int totMineCnt) {
sMineCount = totMineCnt;
sMarkedCount = sOpenedCellCount = sFoundMineCount = 0;
sCellCount = sBtnV.size();
for(int i=0; i<sBtnV.size(); i++)
sBtnV.get(i).init();
Random r = new Random();
int mineCnt = 0;
int allCnt = sBtnV.size();
do {
int i = Math.abs((int)(r.nextLong() % allCnt));
MineButton btn = sBtnV.get(i);
if (btn.getValue() == 0) {
btn.setBomb();
mineCnt++;
}
} while(mineCnt < totMineCnt);
for(int i=0; i<sRows; i++) {
for(int j=0; j<sCols; j++) {
int idx = i*sCols+j;
MineButton btn = sBtnV.get(idx);
if (btn.getValue() == 0) { // not bomb
int mines = 0;
// count neighbor cells if bomb
for(int k=-1; k<=1; k++) {
for(int l=-1; l<=1; l++) {
int row = i+k;
int col = j+l;
if (row>=0 && row<sRows && col>=0 && col<sCols && !(k==0&&l==0)) {
int idx1 = row*sCols+col;
if (sBtnV.get(idx1).isBomb())
mines++;
}
}
}
btn.setValue(mines);
}
btn.setImageDrawable(btn.getContext().getResources().getDrawable(R.drawable.db));
}
}
}
private void init() {
mValue = 0;
mState = State.CLOSED;
setImageDrawable(getContext().getResources().getDrawable(R.drawable.db));
}
public static BombMode toggleBombMode() {
if (sBombMode == BombMode.MARK)
sBombMode = BombMode.OPEN;
else
sBombMode = BombMode.MARK;
return sBombMode;
}
private int getValue() {
return mValue;
}
private boolean isBomb() {
return mValue == -1;
}
private boolean isNull() {
return mValue == 0;
}
private boolean isOpened() {
return mState.equals(State.OPENED);
}
private boolean isMarked() {
return mState.equals(State.MARKED);
}
private boolean isClosed() {
return mState.equals(State.CLOSED);
}
private void setBomb() {
mValue = -1;
}
private void setValue(int value) {
this.mValue = value;
}
private int getPos() {
return mRow * sCols + mCol;
}
private void setState(State state) {
if (state.equals(State.MARKED)) {
if (mState.equals(MineButton.State.MARKED)) {
mState = State.CLOSED;
setImageDrawable(sBtn);
sMarkedCount--;
if (isBomb()) {
sFoundMineCount--;
}
} else {
mState = state;
setImageDrawable(sMarker);
sMarkedCount++;
if (isBomb()) {
sFoundMineCount++;
}
}
} else if (state.equals(State.WRONG_MARKED)) {
mState = state;
setImageDrawable(sBombX);
} else { // open
mState = state;
setImageDrawable(sDs[mValue]);
sOpenedCellCount++;
}
}
private State getState() {
return mState;
}
private void bombAllMines() {
for(int i=0; i<sBtnV.size(); i++) {
MineButton btn = sBtnV.get(i);
if (btn.isBomb() && btn.isClosed())
btn.setImageDrawable(sBomb);
}
return;
}
private void openNullCells() {
setState(MineButton.State.OPENED);
for(int k=-1; k<=1; k++) {
for(int l=-1; l<=1; l++) {
int row1 = mRow+k;
int col1 = mCol+l;
if (row1>=0 && row1<sRows && col1>=0 && col1<sCols && !(k==0&&l==0)) {
int idx = row1*sCols+col1;
MineButton btn = sBtnV.get(idx);
if (!(btn.getState().equals(State.OPENED))) {
if (btn.isNull())
btn.openNullCells();
else if (btn.getValue()>0) {
btn.setState(State.OPENED);
}
}
}
}
}
}
private boolean openNearCells() {
for(int k=-1; k<=1; k++) {
for(int l=-1; l<=1; l++) {
int row1 = mRow+k;
int col1 = mCol+l;
if (row1>=0 && row1<sRows && col1>=0 && col1<sCols && !(k==0&&l==0)) {
int idx = row1*sCols+col1;
MineButton btn = sBtnV.get(idx);
if (!btn.isBomb() && btn.isMarked()) {
btn.setState(State.WRONG_MARKED);
bombAllMines();
return false;
}
if (btn.isClosed()) {
if (btn.isBomb()) {
bombAllMines();
return false;
} else {
btn.setState(State.OPENED);
if (btn.isNull()) // �� ���̶��
if (!btn.openNearCells()) // �� �ֺ����� �� �����.
return false;
}
}
}
}
}
return true;
}
private void openRemainingCells() {
for(int i=0; i<sBtnV.size(); i++) {
if (sBtnV.get(i).isClosed())
sBtnV.get(i).setState(State.OPENED);
}
}
private int getMarkedCellCount() {
int count = 0;
for(int k=-1; k<=1; k++) {
for(int l=-1; l<=1; l++) {
int row1 = mRow+k;
int col1 = mCol+l;
if (row1>=0 && row1<sRows && col1>=0 && col1<sCols && !(k==0&&l==0)) {
int idx = row1*sCols+col1;
MineButton btn = sBtnV.get(idx);
if (btn.getState().equals(State.MARKED))
count++;
}
}
}
return count;
}
// return false if game ended
public boolean clickMine() {
if (sBombMode == BombMode.OPEN) { // open mode
if (isOpened() || isMarked()) return true; // return if already opened or marked
if (isBomb()) { // bomb all mines if bomb opened
bombAllMines();
return false;
}
if (isNull()) { // if null cell, open recursively all near null cells
openNullCells();
}
else { // if not null, open the cell
setState(State.OPENED);
}
} else { // mark mode
if (isOpened()) { // if mark already opened and nearhear bombs are marked, open remaining near cells
if (!isNull()) {
if (getValue() == getMarkedCellCount()) {
if (!openNearCells())
return false;
}
}
} else {
setState(State.MARKED);
}
}
// end if remaining mine count equals remaining unopened cell count
if (sMineCount - sFoundMineCount == sCellCount - (sOpenedCellCount + sMarkedCount)) {
for(int i=0; i<sBtnV.size(); i++) {
MineButton btn1 = sBtnV.get(i);
if (btn1.isBomb() && btn1.isClosed()) {
btn1.setState(MineButton.State.MARKED);
}
}
}
if (getFoundCount() == sMineCount) { // found all
openRemainingCells();
return false;
}
return true;
}
public static int getMarkedCount() {
return sMarkedCount;
}
public static int getFoundCount() {
return sFoundMineCount;
}
public static int getOpenedCellCount() {
return sOpenedCellCount;
}
public static int getCellCount() {
return sCellCount;
}
public static void resetAllMines() {
sBtnV.clear();
sCols = 0;
sRows = 0;
}
}
| [
"yoonkyong0122@gmail.com"
] | yoonkyong0122@gmail.com |
f77aebb506fde13a72b80a2ab419fdcd98c5e2ce | a6e6edb4f3748bb10f7da24496001d8a672feb04 | /app/src/main/java/com/example/quizapp/activity/LoginActivity.java | 9da3495f3f63bdf12282f75eb943623d1af5a442 | [] | no_license | jainavinash845/QuizApp | 98c3393495079e87201b9a7250d382f1dd9e6edb | 1ef9d27222746dbfc4d414544ee411b3a9323390 | refs/heads/master | 2023-04-19T03:42:03.992636 | 2021-05-05T07:27:45 | 2021-05-05T07:27:45 | 364,513,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,003 | java | package com.example.quizapp.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.quizapp.R;
import com.example.quizapp.utils.FireBaseAuthantication;
public class LoginActivity extends AppCompatActivity {
TextView tvSignUp;
EditText edEmail,edPassword;
Button btnLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
edEmail = findViewById(R.id.edEmail);
edPassword = findViewById(R.id.edPassword);
tvSignUp = findViewById(R.id.tvSignUp);
btnLogin = findViewById(R.id.btnLogin);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String email = edEmail.getText().toString();
String password = edPassword.getText().toString();
isValidate(email,password);
}
});
tvSignUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(),SignUpActivity.class);
startActivity(intent);
}
});
}
public boolean isValidate(String email,String password){
if(TextUtils.isEmpty(email)||TextUtils.isEmpty(password)){
Toast.makeText(getApplicationContext(), "Email and Password Can't be blank", Toast.LENGTH_SHORT).show();
}
else {
FireBaseAuthantication authantication = new FireBaseAuthantication(LoginActivity.this);
authantication.loginWithUser(email,password);
}
return true;
}
} | [
"jainavinash845@gmail.com"
] | jainavinash845@gmail.com |
f7809a47151095d69ef2313a3af9ce710ab0f821 | 1ad75b3ee6445e88bbeb93df4e064eac22e31658 | /androidweitao客户端/androidweitao-master/app/src/main/java/com/example/androidweitao/Img34.java | 650076a2f0fe01502e8f3103303538666a2f328f | [] | no_license | luyuxuan/APPvt | 212006d24169780ea071247a4bf18f60344eaefb | 314ccfce507c2ec6d77d59684bb3dd89dee5a4e2 | refs/heads/master | 2020-03-21T19:54:39.101202 | 2018-06-28T06:39:46 | 2018-06-28T06:39:46 | 138,977,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package com.example.androidweitao;
import android.app.Activity;
import android.os.Bundle;
public class Img34 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.img34);
}
}
| [
"2996545126@qq.com"
] | 2996545126@qq.com |
76b3d705b3b4753c24bc3c0e119d9d6d041c86e0 | 8e1faa4408d7c88f43ab72d902b9daafc8cfef99 | /app/src/main/java/generalassemb/ly/firebasepractice/MainActivity.java | 7ab6d5645ca821f32c023511b14c9f53e9ce944f | [] | no_license | BPhillips91/FirebaseTest | 02ca9304ab7b52f77e352381a00564b66dbf29a9 | 599d2b8d34b8541a28704c377a407c32c5bbe7da | refs/heads/master | 2021-01-19T11:21:26.036821 | 2016-07-25T15:56:59 | 2016-07-25T15:56:59 | 64,148,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,913 | java | package generalassemb.ly.firebasepractice;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.ArrayList;
import java.util.HashMap;;
import java.util.List;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
LikesAdapter mAdapter;
RecyclerView mRecyclerView;
RecyclerView.LayoutManager mLayoutManager;
List<Food> foodList;
Button mSubmit;
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference userRef = database.getReference("users").child("username2");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
foodList = new ArrayList<>();
mSubmit = (Button) findViewById(R.id.submit_button);
for (int i = 0; i < 21; i++) {
Food item = new Food(i + "", "", "");
foodList.add(item);
}
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
mAdapter = new LikesAdapter(foodList, MainActivity.this);
mRecyclerView.setAdapter(mAdapter);
final List<Food> fList = new ArrayList<>();
ChildEventListener listener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
Log.d("ADDED", "something was added:" + dataSnapshot.getKey());
// This iterates through the different children of the given user and retrives
// the vaules for my Food Class
for (int i = 0; i < dataSnapshot.getChildrenCount(); i++) {
String url = dataSnapshot.child("foodPic").getValue().toString();
String name = dataSnapshot.child("restaurantName").getValue().toString();
String id = dataSnapshot.child("foodId").getValue().toString();
Food m = new Food(url, name, id);
fList.add(m);
i += 2;
Log.d("Food", "" + fList.size());
mAdapter = new LikesAdapter(fList, MainActivity.this);
mRecyclerView.setAdapter(mAdapter);
}
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
userRef.addChildEventListener(listener);
mSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Food item = new Food("new url here", "new business name here", "new business id here");
//userRef.child("new user").setValue("liked");
String key = userRef.push().getKey().toString();
Map<String, Object> childUpdates = new HashMap<String, Object>();
childUpdates.put(key, item);
userRef.push().setValue(item);
}
});
}
}
| [
"Brendan.Phillips91@Gmail.com"
] | Brendan.Phillips91@Gmail.com |
5b689d6d5b5d05d86af5ed5378a67c6d2d92f607 | 987d9e0a4a3ced56a289914105d20f9ead32f839 | /projeto-base/src/main/java/br/com/convert/CaracteresEspeciais.java | b3b112a41e414e52ae75927dd0f61a513f2933b9 | [] | no_license | evaldobianchi/Projeto-Base | c54f51dbcb8f05c58fa38df867dc1adff1710342 | 0112706e2a81e38757adf10988bfa989bc740c7c | refs/heads/master | 2021-01-25T07:18:37.526927 | 2015-03-28T21:05:19 | 2015-03-28T21:05:19 | 18,337,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,797 | java | package br.com.convert;
public class CaracteresEspeciais {
public static String stringToHTMLString(String string) {
StringBuffer sb = new StringBuffer(string.length());
// true if last char was blank
boolean lastWasBlankChar = false;
int len = string.length();
char c;
for (int i = 0; i < len; i++) {
c = string.charAt(i);
if (c == ' ') {
// blank gets extra work,
// this solves the problem you get if you replace all
// blanks with , if you do that you loss
// word breaking
if (lastWasBlankChar) {
lastWasBlankChar = false;
sb.append(" ");
} else {
lastWasBlankChar = true;
sb.append(' ');
}
} else {
lastWasBlankChar = false;
// HTML Special Chars
if (c == '"')
sb.append(""");
else if (c == '&')
sb.append("&");
else if (c == '<')
sb.append("<");
else if (c == '>')
sb.append(">");
else if (c == '\n')
// Handle Newline
sb.append("<br/>");
else {
int ci = 0xffff & c;
if (ci < 160 )
// nothing special only 7 Bit
sb.append(c);
else {
// Not 7 Bit use the unicode system
sb.append("&#");
sb.append(new Integer(ci).toString());
sb.append(';');
}
}
}
}
return sb.toString();
}
}
| [
"bianchievaldo@gmail.com"
] | bianchievaldo@gmail.com |
ead44be4a1ee2532cd961daf6df0942d7cbdb2f2 | 347abeedc624a83e329ad9ac7c3e01990622e175 | /ch4/ex3.java | f59486588c41dfa7e349f79ca37295d587bd8f3d | [] | no_license | namgiho96/Jungsuck | 02030d630a617bf374a75c6a29ee83b6b57e16e9 | d0e14d746c43d9a087398741a2be2c2291ae42c5 | refs/heads/master | 2020-04-11T08:07:25.671167 | 2018-12-14T11:17:02 | 2018-12-14T11:17:02 | 161,632,524 | 5 | 0 | null | null | null | null | UHC | Java | false | false | 400 | java | package ch4;
import java.util.*;
public class ex3 {
public static void main(String[] args) {
System.out.println("숫자를 하나 입력하세요.>");
Scanner scanner = new Scanner(System.in);
int input = scanner.nextInt();
if(input==0){
System.out.println("입력하신 숫자는 0입니다");
}else{
System.out.println("입력하신 숫자는 0이 아닙니다");
}
}
}
| [
"namgiho96@gmail.com"
] | namgiho96@gmail.com |
2c5f4da9fb9c7ac1340b9d7cb6098b9c0c967369 | 2af5cb91f23ed9ed524da2a74dee5549b23dd44d | /Hereo/app/src/main/java/com/example/ss0051pc/hereo/BottomNavigationViewHelper.java | 6cb26d5bb79d54e0f442549e65369b90ba226709 | [] | no_license | adityazulfahmi/sosmed | 1e8ee3b20a4d0c16b4cb50db1c3bc9ac0cb08763 | 2e63ccb50dfae9471c8959a011508952267bf0d5 | refs/heads/master | 2021-01-11T22:10:35.870161 | 2017-03-12T14:44:54 | 2017-03-12T14:44:54 | 78,931,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,273 | java | package com.example.ss0051pc.hereo;
import android.support.design.internal.BottomNavigationItemView;
import android.support.design.internal.BottomNavigationMenuView;
import android.support.design.widget.BottomNavigationView;
import android.util.Log;
import java.lang.reflect.Field;
public class BottomNavigationViewHelper {
public static void disableShiftMode(BottomNavigationView view) {
BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0);
try {
Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
shiftingMode.setAccessible(true);
shiftingMode.setBoolean(menuView, false);
shiftingMode.setAccessible(false);
for (int i = 0; i < menuView.getChildCount(); i++) {
BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
item.setShiftingMode(false);
item.setChecked(item.getItemData().isChecked());
}
} catch (NoSuchFieldException e) {
Log.e("BNVHelper", "Unable to get shift mode field", e);
} catch (IllegalAccessException e) {
Log.e("BNVHelper", "Unable to change value of shift mode", e);
}
}
} | [
"adityazulfahmii@gmail.com"
] | adityazulfahmii@gmail.com |
a41c83ca354f1bd0440da0480e3bc15e9406eec0 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_de0a8d13716a2a9854c1f4333692e931749f01b2/XfoObj/9_de0a8d13716a2a9854c1f4333692e931749f01b2_XfoObj_s.java | 6eb11b5631c6bdb7cf9f3dc6441a80e7110562cc | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 11,478 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jp.co.antenna.XfoJavaCtl;
import java.io.*;
import java.util.*;
/**
* XfoObj Class is the object class of XSL Formatter
*
* @author Test User
*/
public class XfoObj {
// Consts
public static final int EST_NONE = 0;
public static final int EST_STDOUT = 1;
public static final int EST_STDERR = 2;
public static final int S_PDF_EMBALLFONT_PART = 0;
public static final int S_PDF_EMBALLFONT_ALL = 1;
public static final int S_PDF_EMBALLFONT_BASE14 = 2;
// Attributes
private String executable;
private Runtime r;
private MessageListener messageListener;
private String logPath;
private LinkedHashMap<String, String> args;
// Methods
/**
* Create the instance of XfoObj, and initialize it.
*
* @throws Exception
*/
public XfoObj () throws XfoException {
// Check EVs and test if XslCmd.exe exists.
String axf_home = System.getenv("AXF43_HOME");
if (axf_home == null)
throw new XfoException(4, 1, "Can't find %AXF43_HOME%");
this.executable = axf_home + "\\XslCmd.exe";
// setup attributes
this.clear();
}
/**
* Cleanup (initialize) XSL Formatter engine.
*/
public void clear () {
// reset attributes
this.r = Runtime.getRuntime();
this.logPath = null;
this.args = new LinkedHashMap();
this.messageListener = null;
}
/**
* Execute formatting and outputs to a PDF.
*
* @throws jp.co.antenna.XfoJavaCtl.XfoException
*/
public void execute () throws XfoException {
String cmdLine = this.executable;
for (String arg : args.keySet()) {
cmdLine += " " + arg;
if ((args.get(arg) != null) && (!args.get(arg).equals("")))
cmdLine += " \"" + args.get(arg) + "\"";
}
// Run Formatter with Runtime.exec()
Process process;
int exitCode = -1;
if (this.logPath != null) {
cmdLine += this.logPath;
}
try {
if (this.messageListener != null)
this.messageListener.onMessage(0, 0, cmdLine);
process = this.r.exec(cmdLine);
if ((this.logPath == null) && (this.messageListener != null)) {
try {
InputStream StdErr = process.getErrorStream();
(new ErrorParser(StdErr, this.messageListener)).start();
} catch (Exception e) {}
}
exitCode = process.waitFor();
} catch (Exception e) {}
if (exitCode != 0)
throw new XfoException(4, 0, "Something went wrong.");
}
public void releaseObjectEx () throws XfoException {
// fake it?
this.clear();
}
/**
* Executes the formatting of XSL-FO document specified for src, and outputs it to dst in the output form specified for dst.
*
* @param src XSL-FO Document
* @param dst output stream
* @param outDevice output device. Please refer to a setPrinterName method about the character string to specify.
* @throws jp.co.antenna.XfoJavaCtl.XfoException
*/
public void render (InputStream src, OutputStream dst, String outDevice) throws XfoException {
if (this.messageListener != null)
this.messageListener.onMessage(4, 0, "render() is not implemented yet.");
throw new XfoException(4, 0, "render() is not implemented yet.");
}
public void setBatchPrint (boolean bat) {
// Fake it.
}
/**
* Set the URI of XML document to be formatted.
* <br>If specified "@STDIN", XML document reads from stdin. The document that is read from stdin is assumed to be FO.
*
* @param uri URI of XML document
* @throws jp.co.antenna.XfoJavaCtl.XfoException
*/
public void setDocumentURI (String uri) throws XfoException {
// Set the URI...
String opt = "-d";
if (uri != null && !uri.equals("")) {
if (this.args.containsKey(opt))
this.args.remove(opt);
this.args.put(opt, uri);
}
else {
this.args.remove(opt);
}
}
public void setErrorLogPath (String path) {
if (path != null && !path.equals("")) {
this.logPath = " 2>> " + path;
} else {
this.logPath = null;
}
}
public void setErrorStreamType (int type) {
// Fake it.
}
/**
* Set the error level to abort formatting process.
* <br>XSL Formatter will stop formatting when the detected error level is equal to setExitLevel setting or higher.
* <br>The default value is 2 (Warning). Thus if an error occurred and error level is 2 (Warning) or higher, the
* formatting process will be aborted. Please use the value from 1 to 4. When the value of 5 or more is specified,
* it is considered to be the value of 4. If a error-level:4 (fatal error) occurs, the formatting process will be
* aborted unconditionally. Note: An error is not displayed regardless what value may be specified to be this property.
*
* @param level Error level to abort
* @throws jp.co.antenna.XfoJavaCtl.XfoException
*/
public void setExitLevel (int level) throws XfoException {
// Set the level...
String opt = "-extlevel";
if (this.args.containsKey(opt))
this.args.remove(opt);
this.args.put(opt, String.valueOf(level));
}
/**
* Set the command-line string for external XSLT processor. For example:
* <DL><DD>xslt -o %3 %1 %2 %param</DL>
* %1 to %3 means following:
* <DL><DD>%1 : XML Document
* <DD>%2 : XSL Stylesheet
* <DD>%3 : XSLT Output File
* <DD>%param : xsl:param</DL>
* %1 to %3 are used to express only parameter positions. Do not replace them with actual file names.
* <br>In case you use XSL:param for external XSLT processor, set the name and value here.
* <br>In Windows version, default MSXML3 will be used.
*
* @param cmd Command-line string for external XSLT processor
* @throws jp.co.antenna.XfoJavaCtl.XfoException
*/
public void setExternalXSLT (String cmd) throws XfoException {
// Fill this in....
}
/**
* Register the MessageListener interface to the instance of implemented class.
* <br>The error that occurred during the formatting process can be received as the event.
*
* @param listener The instance of implemented class
*/
public void setMessageListener (MessageListener listener) {
if (listener != null)
this.messageListener = listener;
else
this.messageListener = null;
}
public void setMultiVolume (boolean multiVol) {
String opt = "-multivol";
if (multiVol) {
this.args.put(opt, "");
} else {
this.args.remove(opt);
}
}
/**
* Specifies the output file path of the formatted result.
* <br>When the printer is specified as an output format by setPrinterName, a
* printing result is saved to the specified file by the printer driver.
* <br>When output format other than a printer is specified, it is saved at the
* specified file with the specified output format.
* <br>When omitted, or when "@STDOUT" is specified, it comes to standard output.
*
* @param path Path name of output file
* @throws jp.co.antenna.XfoJavaCtl.XfoException
*/
public void setOutputFilePath (String path) throws XfoException {
// Set the path...
String opt = "-o";
if (path != null && !path.equals("")) {
if (this.args.containsKey(opt))
this.args.remove(opt);
this.args.put(opt, path);
}
else {
this.args.remove(opt);
}
}
public void setPdfEmbedAllFontsEx (int embedLevel) throws XfoException {
// fill it in
String opt = "-peb";
if (embedLevel != -1) {
this.args.put(opt, String.valueOf(embedLevel));
} else {
this.args.remove(opt);
}
}
public void setPdfImageCompression (int compressionMethod) {
// fill it in
}
public void setPrinterName (String prn) {
String opt = "-p";
if (prn != null && !prn.equals("")) {
if (this.args.containsKey(opt))
this.args.remove(opt);
this.args.put(opt, prn);
}
else {
this.args.remove(opt);
}
}
public void setStylesheetURI (String uri) {
String opt = "-s";
if (uri != null && !uri.equals("")) {
if (this.args.containsKey(opt))
this.args.remove(opt);
this.args.put(opt, uri);
}
else {
this.args.remove(opt);
}
}
public void setOptionFileURI (String path) {
String opt = "-i";
if (path != null && !path.equals("")) {
if (this.args.containsKey(opt))
this.args.remove(opt);
this.args.put(opt, path);
}
else {
this.args.remove(opt);
}
}
public void setXSLTParam (String paramName, String value) {
// fill it in
}
}
class ErrorParser extends Thread {
private InputStream ErrorStream;
private MessageListener listener;
public ErrorParser (InputStream ErrorStream, MessageListener listener) {
this.ErrorStream = ErrorStream;
this.listener = listener;
}
@Override
public void run () {
try {
// stuff
BufferedReader reader = new BufferedReader(new InputStreamReader(this.ErrorStream));
String line = reader.readLine();
while (line != null) {
if (line.startsWith("XSLCmd :")) {
if (line.contains("Error Level")) {
try {
int ErrorLevel = Integer.parseInt(line.substring(line.length() - 1, line.length()));
line = reader.readLine();
int ErrorCode = Integer.parseInt(line.split(" ")[line.split(" ").length - 2]);
line = reader.readLine();
String ErrorMessage = line.split(" ", 3)[2];
line = reader.readLine();
if (line.startsWith("XSLCmd :")) {
ErrorMessage += "\n" + line.split(" ", 3)[2];
}
this.listener.onMessage(ErrorLevel, ErrorCode, ErrorMessage);
} catch (Exception e) {}
}
}
line = reader.readLine();
}
} catch (Exception e) {}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
a2486bc41eb3d98537a0d1002d19abbcc8c64f2c | 9110dc45918d7158dc860d1db151177248efd8e1 | /src/com/carlab/enums/ResponseCode.java | f7ad29f0d5eb2a2a1147044ef0ca6d5912575c9c | [] | no_license | gemini9640/CarLab | 83f0e87ce3f1bc41ca14cb5c85a7368f1e03f11d | d88b58835e762d8d8d75a5b18565e3956bc9a4e5 | refs/heads/master | 2020-04-25T12:03:02.196029 | 2019-08-12T17:37:50 | 2019-08-12T17:37:50 | 172,765,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package com.carlab.enums;
public enum ResponseCode {
SUCCESS(0,"SUCCESS"),
ERROR(1,"server error, try again later"),
ILLIGAL_ARGUMENT(2,"ILLIGAL_ARGUMENT"),
NEED_LOGIN(10,"NEED_LOGIN");
private int code;
private String desc;
private ResponseCode(int code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public String getDesc() {
return desc;
}
}
| [
"gemini9640@Admins-MacBook-Pro.local"
] | gemini9640@Admins-MacBook-Pro.local |
7aaf839949be9817e9809b7e279a2097dc66b775 | 94e2cb0b6e38a3666cd35f5de92b4564ae614e66 | /src/main/java/com/imooc/design/principle/dependenceinversion/JavaCourse.java | 8f9f8aca1a45d730a00a3f85451eaa34cadef104 | [] | no_license | BennyChang0/design_pattern | dc184c5cab6c1685a87c273e2e20f1100b0c3107 | 09aef216c4bd41ff7639e75833fbcba973cac928 | refs/heads/master | 2020-04-28T22:51:44.591081 | 2019-03-23T16:24:00 | 2019-03-23T16:24:00 | 175,632,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package com.imooc.design.principle.dependenceinversion;
public class JavaCourse implements ICourse {
public void studyCourse() {
System.out.println("Benny在学习java课程");
}
}
| [
"zhang.binbin@huadongmedia.com"
] | zhang.binbin@huadongmedia.com |
61c8ebab3727647b0f9320e8bb2219e8fb07ef66 | c45829dc8bfa32f50e148e56e739d9de898647b5 | /src/main/java/com/simbirsoft/belousov/specifications/TaskSpecification.java | ab3a66a87715d5e0d977602010abc1231a674b85 | [] | no_license | shnoor64/ProjectManagement | 67d1051bd54ad440806db5c224ed230daebb7f10 | 96c8008d1a706d56f5043c03ee965b78f336417a | refs/heads/master | 2023-07-19T20:29:44.411814 | 2021-08-30T09:02:21 | 2021-08-30T09:02:21 | 385,685,637 | 0 | 0 | null | 2021-08-30T09:02:22 | 2021-07-13T17:33:13 | Java | UTF-8 | Java | false | false | 3,803 | java | package com.simbirsoft.belousov.specifications;
import com.simbirsoft.belousov.entity.TaskEntity;
import org.springframework.data.jpa.domain.Specification;
import javax.persistence.criteria.*;
public class TaskSpecification {
/**
* Метод позволяет получить спецификацию для поиска задачи по имени
*
* @param taskName - искомое имя
* @return Specification<TaskEntity> - спецификация для поиска задачи
*/
public static Specification<TaskEntity> getByName(String taskName) {
if (taskName == null) {
return null;
}
return new Specification<TaskEntity>() {
@Override
public Predicate toPredicate(Root<TaskEntity> root,
CriteriaQuery<?> criteriaQuery,
CriteriaBuilder criteriaBuilder) {
return criteriaBuilder.like(root.get("name"), "%" + taskName + "%");
}
};
}
/**
* Метод позволяет получить спецификацию для поиска задачи по релизу
*
* @param taskRelease - искомый релиз
* @return Specification<TaskEntity> - спецификация для поиска задачи
*/
public static Specification<TaskEntity> GetByRelease(int taskRelease) {
if (taskRelease == 0) {
return null;
}
return new Specification<TaskEntity>() {
@Override
public Predicate toPredicate(Root<TaskEntity> root,
CriteriaQuery<?> criteriaQuery,
CriteriaBuilder criteriaBuilder) {
Join join = root.join("releaseId");
return criteriaBuilder.equal(join.get("version"), taskRelease);
}
};
}
/**
* Метод позволяет получить спецификацию для поиска задачи по автору
*
* @param taskAuthor - искомый автор
* @return Specification<TaskEntity> - спецификация для поиска задачи
*/
public static Specification<TaskEntity> GetByAuthor(String taskAuthor) {
if (taskAuthor == null) {
return null;
}
return new Specification<TaskEntity>() {
@Override
public Predicate toPredicate(Root<TaskEntity> root,
CriteriaQuery<?> criteriaQuery,
CriteriaBuilder criteriaBuilder) {
Join join = root.join("authorId");
return criteriaBuilder.equal(join.get("name"), taskAuthor);
}
};
}
/**
* Метод позволяет получить спецификацию для поиска задачи по исполнителю
*
* @param taskPerformer - искомый исполнитель
* @return Specification<TaskEntity> - спецификация для поиска задачи
*/
public static Specification<TaskEntity> GetByPerformer(String taskPerformer) {
if (taskPerformer == null) {
return null;
}
return new Specification<TaskEntity>() {
@Override
public Predicate toPredicate(Root<TaskEntity> root,
CriteriaQuery<?> criteriaQuery,
CriteriaBuilder criteriaBuilder) {
Join join = root.join("performerId");
return criteriaBuilder.equal(join.get("name"), taskPerformer);
}
};
}
}
| [
"shnooor64@gmail.com"
] | shnooor64@gmail.com |
3a4c215facd7df80e928d688f337757ad752dc90 | 3d28b62df1025ec2bd64037d646122ab06a964fc | /core/src/main/java/com/sdu/spark/SparkEnv.java | 01adafeed6c1ef4591ac854ed03db93e38e26439 | [] | no_license | feiniaoyuyu/spark-java | 4f53e66369a5e2f515edfbd51ff24df7aef4d507 | cc9e0ee3a439b9e3bc345fd334969ebd05f0d3ea | refs/heads/master | 2020-04-19T08:54:20.468409 | 2018-11-21T13:31:22 | 2018-11-21T13:31:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,199 | java | package com.sdu.spark;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps;
import com.sdu.spark.broadcast.BroadcastManager;
import com.sdu.spark.memory.MemoryManager;
import com.sdu.spark.memory.StaticMemoryManager;
import com.sdu.spark.memory.UnifiedMemoryManager;
import com.sdu.spark.network.BlockTransferService;
import com.sdu.spark.network.netty.NettyBlockTransferService;
import com.sdu.spark.rpc.RpcEndpoint;
import com.sdu.spark.rpc.RpcEndpointRef;
import com.sdu.spark.rpc.RpcEnv;
import com.sdu.spark.rpc.SparkConf;
import com.sdu.spark.scheduler.LiveListenerBus;
import com.sdu.spark.scheduler.OutputCommitCoordinator;
import com.sdu.spark.scheduler.OutputCommitCoordinatorEndpoint;
import com.sdu.spark.serializer.JavaSerializer;
import com.sdu.spark.serializer.Serializer;
import com.sdu.spark.serializer.SerializerManager;
import com.sdu.spark.shuffle.ShuffleManager;
import com.sdu.spark.shuffle.sort.SortShuffleManager;
import com.sdu.spark.storage.BlockManager;
import com.sdu.spark.storage.BlockManagerMaster;
import com.sdu.spark.storage.BlockManagerMasterEndpoint;
import com.sdu.spark.utils.Utils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import static com.google.common.base.Preconditions.checkArgument;
import static com.sdu.spark.security.CryptoStreamUtils.createKey;
import static com.sdu.spark.utils.RpcUtils.makeDriverRef;
import static com.sdu.spark.utils.Utils.classForName;
import static com.sdu.spark.utils.Utils.createTempDir;
import static com.sdu.spark.utils.Utils.deleteRecursively;
import static org.apache.commons.lang3.BooleanUtils.toBoolean;
/**
* @author hanhan.zhang
* */
public class SparkEnv {
private static final Logger LOGGER = LoggerFactory.getLogger(SparkEnv.class);
public static volatile SparkEnv env;
private static final String driverSystemName = "sparkDriver";
private static final String executorSystemName = "sparkExecutor";
private String driverTmpDir;
private boolean isStopped = false;
private Map<String, Object> hadoopJobMetadata = new MapMaker().weakValues().makeMap();
private String executorId;
public RpcEnv rpcEnv;
public SparkConf conf;
public ShuffleManager shuffleManager;
private BroadcastManager broadcastManager;
public SerializerManager serializerManager;
public OutputCommitCoordinator outputCommitCoordinator;
public BlockManager blockManager;
public MemoryManager memoryManager;
public Serializer serializer;
public Serializer closureSerializer;
public MapOutputTracker mapOutputTracker;
public SparkEnv(String executorId,
RpcEnv rpcEnv,
Serializer serializer,
Serializer closureSerializer,
MapOutputTracker mapOutputTracker,
ShuffleManager shuffleManager,
BroadcastManager broadcastManager,
BlockManager blockManager,
SerializerManager serializerManager,
MemoryManager memoryManager,
OutputCommitCoordinator outputCommitCoordinator,
SparkConf conf) {
this.executorId = executorId;
this.rpcEnv = rpcEnv;
this.mapOutputTracker = mapOutputTracker;
this.shuffleManager = shuffleManager;
this.broadcastManager = broadcastManager;
this.serializerManager = serializerManager;
this.outputCommitCoordinator = outputCommitCoordinator;
this.conf = conf;
this.blockManager = blockManager;
this.memoryManager = memoryManager;
this.serializer = serializer;
this.closureSerializer = closureSerializer;
}
public void stop() {
if (!isStopped) {
isStopped = true;
mapOutputTracker.stop();
shuffleManager.stop();
broadcastManager.stop();
blockManager.stop();
blockManager.master.stop();
outputCommitCoordinator.stop();
rpcEnv.shutdown();
rpcEnv.awaitTermination();
// If we only stop sc, but the driver process still run as a services then we need to delete
// the tmp dir, if not, it will create too many tmp dirs.
// We only need to delete the tmp dir create by driver
if (driverTmpDir != null) {
try {
deleteRecursively(new File(driverTmpDir));
} catch (Exception e) {
LOGGER.warn("Exception while deleting Spark temp dir: {}", driverTmpDir, e);
}
}
}
}
public static SparkEnv createDriverEnv(SparkConf conf,
boolean isLocal,
LiveListenerBus listenerBus,
int numCores,
OutputCommitCoordinator mockOutputCommitCoordinator) {
assert conf.contains("spark.driver.host") : "Spark Driver host is not set !";
String bindAddress = conf.get("spark.driver.bindAddress");
String advertiseAddress = conf.get("spark.driver.host");
int port = NumberUtils.toInt(conf.get("spark.driver.port"));
byte[] ioEncryptionKey = null;
boolean isEncryption = toBoolean(conf.get("spark.io.encryption.enabled"));
if (isEncryption) {
ioEncryptionKey = createKey(conf);
}
return create(conf,
SparkContext.DRIVER_IDENTIFIER,
bindAddress,
advertiseAddress,
port,
isLocal,
numCores,
ioEncryptionKey,
listenerBus,
mockOutputCommitCoordinator);
}
public static SparkEnv createExecutorEnv(SparkConf conf,
String executorId,
String hostname,
int numCores,
byte[] ioEncryptionKey,
boolean isLocal) {
SparkEnv env = create(conf, executorId, hostname, hostname, 0, isLocal,
numCores, ioEncryptionKey, null, null);
SparkEnv.env = env;
return env;
}
private static SparkEnv create(SparkConf conf,
String executorId,
String bindAddress,
String advertiseAddress,
int port,
boolean isLocal,
int numUsableCores,
byte[] ioEncryptionKey,
LiveListenerBus liveListenerBus,
OutputCommitCoordinator mockOutputCommitCoordinator) {
boolean isDriver = executorId.equals(SparkContext.DRIVER_IDENTIFIER);
// 事件监听只在Driver端处理
if (isDriver) {
checkArgument(liveListenerBus != null, "Attempted to create driver SparkEnv with null listener bus!");
}
// 安全认证
SecurityManager securityManager = new SecurityManager(conf, ioEncryptionKey);
if (!securityManager.isEncryptionEnabled()) {
LOGGER.warn("I/O encryption enabled without RPC encryption: keys will be visible on the wire.");
}
// RPC通信
String systemName = isDriver ? driverSystemName : executorSystemName;
RpcEnv rpcEnv = RpcEnv.create(systemName, bindAddress, advertiseAddress, port, conf,
securityManager, numUsableCores, !isDriver);
if (isDriver) {
conf.set("spark.driver.port", String.valueOf(rpcEnv.address().port));
}
// RPC消息序列化
Serializer serializer = instantiateClassFromConf(conf,
isDriver,
"spark.closureSerializer",
"com.sdu.spark.serializer.JavaSerializer");
LOGGER.debug("Using closureSerializer: {}", serializer.getClass());
SerializerManager serializerManager = new SerializerManager(serializer, conf, ioEncryptionKey);
JavaSerializer closureSerializer = new JavaSerializer(conf);
// 广播组件
BroadcastManager broadcastManager = new BroadcastManager(isDriver, conf, securityManager);
// Map输出管理
MapOutputTracker mapOutputTracker = isDriver ? new MapOutputTrackerMaster(conf, broadcastManager, isLocal)
: new MapOutputTrackerWorker(conf);
MapOutputTrackerRpcEndPointCreator creator = tracker -> new MapOutputTrackerMasterEndpoint(rpcEnv, tracker, conf);
mapOutputTracker.trackerEndpoint = registerOrLookupEndpoint(conf, isDriver, rpcEnv,
MapOutputTracker.ENDPOINT_NAME,
mapOutputTracker, creator);
// Shuffle管理
Map<String, String> shortShuffleMgrNames = Maps.newHashMap();
shortShuffleMgrNames.put("sort", SortShuffleManager.class.getName());
shortShuffleMgrNames.put("tungsten-sort", SortShuffleManager.class.getName());
String shuffleMgrName = shortShuffleMgrNames.get(conf.get("spark.shuffle.manager", "sort"));
ShuffleManager shuffleManager = instantiateClass(conf, isDriver, shuffleMgrName);
// Block Storage管理
// step1: Block Storage Memory内存管理
boolean useLegacyMemoryManager = conf.getBoolean("spark.memory.useLegacyMode", false);
MemoryManager memoryManager = useLegacyMemoryManager ? new StaticMemoryManager(conf, numUsableCores)
: new UnifiedMemoryManager(conf, numUsableCores);
// step2: Block传输/获取
int blockManagerPort = isDriver ? conf.getInt("spark.driver.blockManager.port", 0)
: conf.getInt("spark.blockManager.port", 0);
BlockTransferService blockTransferService = new NettyBlockTransferService(
conf,
securityManager,
bindAddress,
port,
numUsableCores
);
// step3: Block Manager Master RpcEndpoint(负责接收消息, 获取Block数据、注册及状态等)
GeneralRpcEndPointCreator endPointCreator = () -> new BlockManagerMasterEndpoint(rpcEnv, isLocal, conf, liveListenerBus);
RpcEndpointRef driverEndpointRef = registerOrLookupEndpoint(conf,
isDriver,
rpcEnv,
BlockManagerMaster.DRIVER_ENDPOINT_NAME,
endPointCreator);
BlockManagerMaster blockManagerMaster = new BlockManagerMaster(driverEndpointRef,
conf,
isDriver
);
// step4: 创建BlockManager(Executor、Driver都创建且BlockManager只有initialize()方可有效)
BlockManager blockManager = new BlockManager(
executorId,
rpcEnv,
blockManagerMaster,
serializerManager,
conf,
memoryManager,
mapOutputTracker,
shuffleManager,
blockTransferService,
securityManager,
numUsableCores
);
// TODO: Spark Metric System
OutputCommitCoordinator outputCommitCoordinator = mockOutputCommitCoordinator == null ? new OutputCommitCoordinator(conf, isDriver)
: mockOutputCommitCoordinator;
GeneralRpcEndPointCreator outputCommitRpcEndPointCreator = () -> new OutputCommitCoordinatorEndpoint(rpcEnv, outputCommitCoordinator);
outputCommitCoordinator.coordinatorRef = registerOrLookupEndpoint(conf,
isDriver,
rpcEnv,
"OutputCommitCoordinator",
outputCommitRpcEndPointCreator);
SparkEnv envInstance = new SparkEnv(executorId,
rpcEnv,
serializer,
closureSerializer,
mapOutputTracker,
shuffleManager,
broadcastManager,
blockManager,
serializerManager,
memoryManager,
outputCommitCoordinator,
conf);
// Add a reference to tmp dir created by driver, we will delete this tmp dir when stop() is
// called, and we only need to do it for driver. Because driver may run as a service, and if we
// don't delete this tmp dir when sc is stopped, then will create too many tmp dirs.
if (isDriver) {
try {
envInstance.driverTmpDir = createTempDir(Utils.getLocalDir(conf), "userFiles").getAbsolutePath();
} catch (IOException e) {
throw new SparkException(e);
}
}
return envInstance;
}
@SuppressWarnings("unchecked")
private static <T> T instantiateClass(SparkConf conf, boolean isDriver, String className) {
Class<?> cls = classForName(className);
try {
return (T) cls.getConstructor(SparkConf.class, Boolean.TYPE)
.newInstance(conf, isDriver);
} catch (Exception e) {
try {
return (T) cls.getConstructor(SparkConf.class)
.newInstance(conf);
} catch (Exception ex) {
try {
return (T) cls.getConstructor().newInstance();
} catch (Exception ey) {
throw new SparkException("Instance class " + className + " failure", e);
}
}
}
}
private static <T> T instantiateClassFromConf(SparkConf conf,
boolean isDriver,
String propertyName,
String defaultClassName) {
return instantiateClass(conf, isDriver, conf.get(propertyName, defaultClassName));
}
private static RpcEndpointRef registerOrLookupEndpoint(SparkConf conf,
boolean isDriver,
RpcEnv rpcEnv,
String name,
MapOutputTracker mapOutputTracker,
MapOutputTrackerRpcEndPointCreator creator) {
if (isDriver) {
LOGGER.info("Registering {}", name);
return rpcEnv.setRpcEndPointRef(name, creator.create((MapOutputTrackerMaster) mapOutputTracker));
} else {
return makeDriverRef(name, conf, rpcEnv);
}
}
private static RpcEndpointRef registerOrLookupEndpoint(SparkConf conf,
boolean isDriver,
RpcEnv rpcEnv,
String name,
GeneralRpcEndPointCreator creator) {
if (isDriver) {
LOGGER.info("Registering {}", name);
return rpcEnv.setRpcEndPointRef(name, creator.create());
} else {
return makeDriverRef(name, conf, rpcEnv);
}
}
private interface MapOutputTrackerRpcEndPointCreator {
RpcEndpoint create(MapOutputTrackerMaster tracker);
}
private interface GeneralRpcEndPointCreator {
RpcEndpoint create();
}
}
| [
"zhanghan13@meituan.com"
] | zhanghan13@meituan.com |
9ef12e0217823a0bbcf0a84e6b295c35fe7492c9 | c75e7cbf3a5a398a61be436903018ffa8eaac6e6 | /src/main/java/com/codeWizard/tfa/controller/CategoryController.java | 259c6107d430f90db27d0bf91f072d664109fece | [] | no_license | swapnava/TheFoodAvenueBackend | 2e9a5680b84162a34eb57560385b6475b41a953e | d42830e70696bb9c384f933e59c90ab1f98d6b12 | refs/heads/master | 2023-07-17T13:29:17.418495 | 2021-08-25T08:01:40 | 2021-08-25T08:01:40 | 399,732,322 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,834 | java | package com.codeWizard.tfa.controller;
import java.util.List;
import java.util.Map;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.codeWizard.tfa.entities.Category;
import com.codeWizard.tfa.entities.Item;
import com.codeWizard.tfa.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
/************************************************************************************
* @author Swapnava Halder
* Description It is a Controller class used for the data flow into model object
* and updates the view whenever data changes
* Version 1.0
* Created Date 27-JULY-2021
************************************************************************************/
@CrossOrigin(origins = "*", allowedHeaders="*", maxAge = 3600)
@RestController
@RequestMapping("/fdsdata/category")
@Api(value = "Online Food Delivery System", description = "Operations pertaining to Category of Online Food Delivery System")
@Validated
public class CategoryController {
private static final Logger logger = LoggerFactory.getLogger(CategoryController.class);
@Autowired
private CategoryService categoryService;
/************************************************************************************
* Method: addCategory
*Description: To create a new Category
* @return Category It returns category to the database
* @postMapping: It is used to handle POST type of request method.
* @RequestBody: It maps the HttpRequest body to a transfer or domain object
************************************************************************************/
@ApiOperation(value = "Add a Category")
@PostMapping("/add/{cName}")
public Category addCategory(@ApiParam(value = "category name to create category object store in database table", required = true)@Valid @PathVariable(value="cName") String catName) {
logger.trace("addCategory method in Category controller accessed");
return categoryService.addCategory(catName);
}
/************************************************************************************
* Method: deleteCategory
*Description: To delete a category based on ID
* @return Category It returns cart to the database
* @deleteMapping: It is used to handle DELETE type of request method.
* @RequestBody: It maps the HttpRequest body to a transfer or domain object
************************************************************************************/
@ApiOperation(value = "Delete a category")
@DeleteMapping("/delete/{cId}")
public void deleteCategory(@ApiParam(value = "Category Id to delete category object from database table") @PathVariable(value="cId") int catId) {
logger.trace("deleteCategory method in category controller accessed");
categoryService.deleteCategory(catId);
}
/************************************************************************************
* Method: updateCategory
*Description: To update a existing category
* @return category It returns cart to the database
* @putMapping: It is used to handle PUT type of request method.
* @RequestBody: It maps the HttpRequest body to a transfer or domain object
************************************************************************************/
@ApiOperation(value = "Update a cart")
@PutMapping("/update/{catId}")
public Category updateCategory(@ApiParam(value = "Category Id to update category object", required = true) @PathVariable(value="catId") int catId,@ApiParam(value = "Update category object", required = true)@Valid @RequestBody Map<String,String> catName) {
logger.trace("updateCategory method in Category controller accessed");
return categoryService.updateCategory(catId, catName.get("categoryName"));
}
/************************************************************************************
* Method: getAllCategories
*Description: To view all categories
* @return List<Category> It returns category from the database
* @getMapping: It is used to handle GETT type of request method.
* @RequestBody: It maps the HttpRequest body to a transfer or domain object
************************************************************************************/
@ApiOperation(value = "View a list of category", response = List.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully retrieved list"),
@ApiResponse(code = 401, message = "You are not authorized to view the resource"),
@ApiResponse(code = 403, message = "Accessing the resource you were trying to reach is forbidden"),
@ApiResponse(code = 404, message = "The resource you were trying to reach is not found")
})
@GetMapping("/all")
public List<Category> getAllCategories(){
logger.trace("getAllCategories method in Category controller accessed");
return categoryService.getAllCategories();
}
/************************************************************************************
* Method: getCategory
*Description: To create a new Cart
* @return Category It returns category from the database based on ID
* @getMapping: It is used to handle GET type of request method.
************************************************************************************/
@ApiOperation(value = "Get a Category by Id")
@GetMapping("/show/{id}")
public Category getCategory(@ApiParam(value = "Category id from which category object will be retrieved", required = true)@PathVariable(value="id") int catId) {
logger.trace("getCategory method in Category controller accessed");
return categoryService.getCategory(catId);
}
/************************************************************************************
* Method: getItemsByCategory
*Description: To view all items w.r.t a Category
* @return Cart It returns category from the database based on ID
* @getMapping: It is used to handle GETT type of request method.
* @RequestBody: It maps the HttpRequest body to a transfer or domain object
************************************************************************************/
@ApiOperation(value = "Get a list of Item by Category Id")
@GetMapping("/items/{id}")
public List<Item> getItemsByCategory(@PathVariable(value="id") int catId){
logger.trace("getItemsByCategory method in Category controller accessed");
return categoryService.getItemsByCategory(catId);
}
}
| [
"swapnava007@gmail.com"
] | swapnava007@gmail.com |
3cd431f167cef2d919fbc91090ca2262925eeac0 | 6df5cc4ae7df246e06ad4b977d54ce175a59507d | /org.nasdanika.amur/src/org/nasdanika/amur/ImplementationTypeFactory.java | 8f3424e4a056ab6cd6056367ec6cf77505889a70 | [] | no_license | Nasdanika/amur | dfcbb1fdf46cf2c91d9311b7586e609e4899b76f | a030ce2e5a737d7871b4b1918aa44502f1af4475 | refs/heads/master | 2020-06-03T22:09:46.828578 | 2014-07-22T01:45:52 | 2014-07-22T01:45:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,975 | java | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.nasdanika.amur;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Implementation Type Factory</b></em>'.
* <!-- end-user-doc -->
*
* <!-- begin-model-doc -->
* Extension factory creates extensions.
* <!-- end-model-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.nasdanika.amur.ImplementationTypeFactory#getVersion <em>Version</em>}</li>
* <li>{@link org.nasdanika.amur.ImplementationTypeFactory#getSpecializes <em>Specializes</em>}</li>
* </ul>
* </p>
*
* @see org.nasdanika.amur.AmurPackage#getImplementationTypeFactory()
* @model interface="true" abstract="true"
* @generated
*/
public interface ImplementationTypeFactory extends ImplementationTypeDescriptor {
/**
* Returns the value of the '<em><b>Version</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* Extension version.
* <!-- end-model-doc -->
* @return the value of the '<em>Version</em>' attribute.
* @see #setVersion(String)
* @see org.nasdanika.amur.AmurPackage#getImplementationTypeFactory_Version()
* @model
* @generated
*/
String getVersion();
/**
* Sets the value of the '{@link org.nasdanika.amur.ImplementationTypeFactory#getVersion <em>Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Version</em>' attribute.
* @see #getVersion()
* @generated
*/
void setVersion(String value);
/**
* Returns the value of the '<em><b>Specializes</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* This attribute allows to establish specialization relationship. E.g. FTP activity is a specialization of Activity.
* <!-- end-model-doc -->
* @return the value of the '<em>Specializes</em>' attribute.
* @see #setSpecializes(String)
* @see org.nasdanika.amur.AmurPackage#getImplementationTypeFactory_Specializes()
* @model
* @generated
*/
String getSpecializes();
/**
* Sets the value of the '{@link org.nasdanika.amur.ImplementationTypeFactory#getSpecializes <em>Specializes</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Specializes</em>' attribute.
* @see #getSpecializes()
* @generated
*/
void setSpecializes(String value);
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* Instantiates extension.
* <!-- end-model-doc -->
* @model
* @generated
*/
ImplementationType createImplementationType(Component modelElement);
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* Returns true if selector is empty or evaluates to true.
*
* <!-- end-model-doc -->
* @model
* @generated
*/
boolean isApplicable(Component component);
} // ImplementationTypeFactory
| [
"Pavel.Vlasov@nasdanika.org"
] | Pavel.Vlasov@nasdanika.org |
4c663bc97c7091ad07278e260cc64bf10cab77dc | 58b936be7381c232f7fff063e5dce7e904c31319 | /Spring_1000_IOC_Annotation_Autowired_Qualifier/src/com/dao/impl/UserDAOImpl.java | 46cbf0983bdf7724bd987c66e5a2db86bfe8fb1d | [] | no_license | cdx0312/spring | 8390a610d9cd6d88055e0be90491066ee7e0729b | 694f42fe2129899d3cf8a5838128e1873bb2cb9c | refs/heads/master | 2020-03-27T21:52:14.368486 | 2018-09-03T09:29:09 | 2018-09-03T09:29:09 | 147,182,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.dao.impl;
import com.dao.UserDAO;
import com.model.User;
public class UserDAOImpl implements UserDAO{
@Override
public void save(User user) {
System.out.println("User saved!!!");
}
}
| [
"cdxu0312@outlook.com"
] | cdxu0312@outlook.com |
56eaa65678ebb01d46cc51a732687327b6a79452 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5688567749672960_0/java/vdzm/Main.java | 3cc3720136c498ad3a12471db077a96975d7d3f3 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | Java | false | false | 6,127 | java | import java.util.Locale;
import java.util.concurrent.ExecutionException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.util.concurrent.Executors;
import java.io.PrintWriter;
import java.io.File;
import java.io.FilenameFilter;
import java.util.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.ArrayList;
import java.io.FileOutputStream;
import java.util.concurrent.Future;
import java.util.concurrent.ExecutorService;
import java.io.FileInputStream;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Vadim Semenov
*/
public class Main {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
InputStream inputStream;
try {
final String regex = "A-(small|large).*[.]in";
File directory = new File(".");
File[] candidates = directory.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.matches(regex);
}
});
File toRun = null;
for (File candidate : candidates) {
if (toRun == null || candidate.lastModified() > toRun.lastModified())
toRun = candidate;
}
inputStream = new FileInputStream(toRun);
} catch (IOException e) {
throw new RuntimeException(e);
}
OutputStream outputStream;
try {
outputStream = new FileOutputStream("a.out");
} catch (IOException e) {
throw new RuntimeException(e);
}
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskA solver = new TaskA();
solver.solve(1, in, out);
out.close();
}
}
class TaskA {
private static final int EXPECTED_TEST_NUMBER = 100;
private static class TestSolver implements Callable<TestSolver> {
private final int testNumber;
private String output;
private int target;
private static final int MAX = 2_000_000;
private static final int[] dp = new int[MAX + 1];
static {
for (int i = 1; i < dp.length; ++i) {
dp[i] = i + 1;
}
dp[1] = 1;
List<Integer> queue = new ArrayList<>(dp.length);
int head = 0;
queue.add(1);
while (head < queue.size()) {
int current = queue.get(head++);
for (int next = current + 1, it = 0; it < 2; ++it, next = reverse(current)) {
if (next <= MAX) {
int dist = dp[current] + 1;
if (dist < dp[next]) {
dp[next] = dist;
queue.add(next);
}
}
}
}
}
private static int reverse(int number) {
int result = 0;
while (number > 0) {
result = result * 10 + (number % 10);
number /= 10;
}
return result;
}
private void solve() {
output = Integer.toString(dp[target]);
}
public void readInput(final InputReader in) {
target = in.nextInt();
}
public void printOutput(final PrintWriter out) {
out.println("Case #" + testNumber + ": " + output);
}
public TestSolver call() {
System.err.println("In process testcase #" + testNumber);
solve();
System.err.println("Done testcase #" + testNumber);
return this;
}
public TestSolver(final int testNumber) {
this.testNumber = testNumber;
}
}
public void solve(final int foo, final InputReader in, final PrintWriter out) {
final int tests = in.nextInt();
Executor executor = new Executor(in, out);
for (int test = 1; test <= tests; ++test) {
TestSolver solver = new TestSolver(test);
executor.submit(solver);
}
executor.shutdown();
}
private static class Executor {
public static final int THREADS_NUMBER = 4;
private final long START_TIME = System.currentTimeMillis();
private final InputReader in;
private final PrintWriter out;
private final ExecutorService pool = Executors.newFixedThreadPool(THREADS_NUMBER);
private final List<Future<TestSolver>> tasks;
public Executor(final InputReader in, final PrintWriter out) {
this.in = in;
this.out = out;
this.tasks = new ArrayList<>(EXPECTED_TEST_NUMBER);
}
public void submit(final TestSolver solver) {
solver.readInput(in);
tasks.add(pool.submit(solver));
}
public void shutdown() {
pool.shutdown();
System.err.println("Began writing outputs");
for (Future<TestSolver> solution : tasks) {
try {
TestSolver solver = solution.get();
solver.printOutput(out);
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
System.err.println("Done in " + (System.currentTimeMillis() - START_TIME) + ".ms");
}
}
}
class InputReader {
private final BufferedReader reader;
private StringTokenizer tokenizer;
public InputReader(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
}
public int nextInt() {
return Integer.parseInt(next());
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(readLine());
}
return tokenizer.nextToken();
}
public String readLine() {
String line;
try {
line = reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
return line;
}
}
| [
"eewestman@gmail.com"
] | eewestman@gmail.com |
b1467811488c402176f74cbeb92b46642cf4964a | d796a25d704fd9f808290d679f61956ef47a501b | /Student-Service/src/main/java/com/spring/student/model/Marks.java | 1b73ac13d691e0c54b8917e3ca8ca7d9f12ac69d | [] | no_license | springdeveloper123/openFeign | 585e1bb78a522341b69f1a4fe84214055361cfaf | 171c94917eee1f7fc059040963cb0e98c14f8f74 | refs/heads/master | 2020-05-25T13:08:37.932735 | 2019-06-06T06:16:45 | 2019-06-06T06:16:45 | 187,806,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,021 | java | package com.spring.student.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Marks {
private Integer english;
private Integer hindhi;
private Integer maths;
private Integer science;
private Integer social;
private Integer french;
public Marks(Integer english, Integer hindhi, Integer maths) {
super();
this.english = english;
this.hindhi = hindhi;
this.maths = maths;
}
public Marks(Integer english, Integer hindhi, Integer maths, Integer science) {
this(english, hindhi, maths);
this.science = science;
}
public Marks(Integer english, Integer hindhi, Integer maths, Integer science, Integer social) {
this(english, hindhi, maths, science);
this.social = social;
}
public Marks(Integer english, Integer hindhi, Integer maths, Integer science, Integer social, Integer french) {
this(english, hindhi, maths, science, social);
this.french = french;
}
public Integer getEnglish() {
return english;
}
public void setEnglish(Integer english) {
this.english = english;
}
public Integer getHindhi() {
return hindhi;
}
public void setHindhi(Integer hindhi) {
this.hindhi = hindhi;
}
public Integer getMaths() {
return maths;
}
public void setMaths(Integer maths) {
this.maths = maths;
}
public Integer getScience() {
return science;
}
public void setScience(Integer science) {
this.science = science;
}
public Integer getSocial() {
return social;
}
public void setSocial(Integer social) {
this.social = social;
}
public Integer getFrench() {
return french;
}
public void setFrench(Integer french) {
this.french = french;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
eca3c98dcd61e545ac1cb9305281e9cbdaf289e3 | 2cadd017b584f0539caff9e44a0535b35e94f25f | /toy-projects/algorithms/a-star/src/cz/cvut/atg/zui/astar/PlannerExecutor.java | 6ea1c21a5968584de40108e908c8fc391c6eab9c | [] | no_license | vbmacher/learning-kit | 4960694b880c5c9e5381848113557e9424a65a78 | a95c46f72708d9b1b735453c68f55e8a2a4ea20d | refs/heads/master | 2021-08-09T23:01:54.090357 | 2021-01-26T16:40:53 | 2021-01-26T16:40:53 | 52,197,597 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,942 | java | package cz.cvut.atg.zui.astar;
import eu.superhub.wp5.graphcommon.graph.Graph;
import eu.superhub.wp5.graphcommon.graph.GraphBuilder;
import eu.superhub.wp5.planner.planningstructure.GraphEdge;
import eu.superhub.wp5.planner.planningstructure.GraphNode;
import eu.superhub.wp5.plannerdataimporter.kml.RoadGraphKmlCreator;
import org.openstreetmap.osm.data.coordinates.LatLon;
import student.Planner;
import java.awt.*;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* Executor of your planner. Wraps data file loading, calling your planner and extracting a KML file.
* Author: Ondrej Vanek (e-mail: ondrej.vanek@agents.fel.cvut.cz)
* Date: 2/12/13
* Time: 11:08 AM.
*/
public class PlannerExecutor {
public static final String DATA_FILE = "./data/ukhigh_filtered.dat";
public static void main(String[] args) {
PlannerExecutor executor = new PlannerExecutor();
try {
executor.run(DATA_FILE);
} catch (Exception e) {
e.printStackTrace();
}
}
private void run(String mapFileName) throws FileNotFoundException {
// load the serialized graph
Graph<GraphNode, GraphEdge> newroadGraph = deserialize(mapFileName);
RoadGraph roadGraph = new RoadGraph(newroadGraph);
System.out.println("Graph loaded.");
//picks origin and destination nodes (feel free to modify)
GraphNode origin = newroadGraph.getNodeByNodeId(13823646l);
GraphNode destination = newroadGraph.getNodeByNodeId(188755778);
System.out.println("Planning between: "+ origin.getId() + " and "+ destination.getId());
//Here will be reference to your planner
PlannerInterface astar = new Planner();
long time = System.currentTimeMillis();
//here you plan!
List<GraphEdge> plan = astar.plan(roadGraph,origin, destination);
System.out.println("Time taken: "+ (System.currentTimeMillis()-time));
System.out.println("Added to Open: " + astar.getOpenList().getCounter().getCount()+" times.");
printPlanProperties(origin,destination,plan);
exportPlan(newroadGraph, origin, destination, plan);
}
/**
* Prints properties of the plan.
* @param origin origin node.
* @param destination destination node.
* @param plan plan to be analysed.
*/
private void printPlanProperties(GraphNode origin, GraphNode destination, List<GraphEdge> plan) {
if(plan!=null){
double planLength = 0;
double planTime = 0;
for(GraphEdge edge: plan){
planLength+=edge.getLengthInMetres()/1000;
planTime +=edge.getLengthInMetres()/1000.0/edge.getAllowedMaxSpeedInKmph();
}
System.out.println("Plan length (km):" + planLength);
System.out.println("Distance in air (km): "+ LatLon.distanceInMeters(origin.getLatitude(), origin.getLongitude(), destination.getLatitude(), destination.getLongitude())/1000.0);
System.out.println("Time to travel (hrs): "+ planTime );
} else{
System.out.println("There is no plan!");
}
}
/**
* Creates a KML from a plan.
* @param newroadGraph the graph on which it is planned.
* @param origin origin node.
* @param destination destination node.
* @param plan plan to be exported.
*/
private void exportPlan(Graph<GraphNode, GraphEdge> newroadGraph, GraphNode origin, GraphNode destination, List<GraphEdge> plan) {
if(plan!=null){
double planLength = 0;
double planTime = 0;
//create graph builder
GraphBuilder<GraphNode,GraphEdge> gb = new GraphBuilder();
gb.addNode(newroadGraph.getNodeByNodeId(plan.get(0).getFromNodeId()));
//add all nodes in the plan
for(GraphEdge edge: plan){
gb.addNode(newroadGraph.getNodeByNodeId(edge.getToNodeId()));
planLength+=edge.getLengthInMetres()/1000;
planTime +=edge.getLengthInMetres()/1000.0/edge.getAllowedMaxSpeedInKmph();
}
//add all edges
for(GraphEdge edge:plan){
gb.addEdge(edge);
}
//build a graph from the plan
Graph<GraphNode, GraphEdge> graph = gb.createGraph();
RoadGraphKmlCreator.GraphProperty property = new RoadGraphKmlCreator.GraphProperty("plan",graph, Color.RED,2.0,0.5);
List<RoadGraphKmlCreator.GraphProperty> props = new ArrayList<>(1);
props.add(property);
try {
RoadGraphKmlCreator.createKml(props, new
File("plan"+System.currentTimeMillis()+".kml"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
System.out.println("Plan length (km):" + planLength);
System.out.println("Distance in air (km): "+ LatLon.distanceInMeters(origin.getLatitude(), origin.getLongitude(), destination.getLatitude(), destination.getLongitude())/1000.0);
System.out.println("Time to travel (hrs): "+ planTime );
} else{
System.out.println("There is no plan!");
}
}
/**
* Deserializes a graph from a data file.
* @param filename file with the graph.
* @return deserialized graph.
*/
private Graph<GraphNode, GraphEdge> deserialize(String filename) {
try{
//use buffering
InputStream file = new FileInputStream(filename);
InputStream buffer = new BufferedInputStream( file );
ObjectInput input = new ObjectInputStream ( buffer );
try{
//deserialize the graph
Graph<GraphNode, GraphEdge> roadGraph = (Graph<GraphNode, GraphEdge>) input.readObject();
return roadGraph;
}
finally{
input.close();
}
}
catch(Exception ex){
ex.printStackTrace();
}
//This shouldn't happen! Luckily, one does not simply reach this line.
System.exit(1);
return null;
}
/**
* Gets a dummy planner doing nothing. We hope you will be better than this ;)
* @return Ghost in the shell.
*/
public PlannerInterface getDummyPlanner() {
return new PlannerInterface() {
@Override
public List<GraphEdge> plan(RoadGraph graph, GraphNode origin, GraphNode destination) {
return new ArrayList<>();
}
@Override
public AbstractOpenList getOpenList() {
return new AbstractOpenList() {
@Override
protected boolean addItem(Object item) {
return false;
}
};
}
};
}
}
| [
"pjakubco@gmail.com"
] | pjakubco@gmail.com |
f61ec5339c1e030724ae33896b95a71462d3e9d0 | 4a53efbf1f80d8e40ad4fccb83954449edce3f8c | /java/datastructure/stack/StackDemo.java | ba32657f0b867d71497c9dc5e92a50639b931a7e | [] | no_license | kanujgit/MiscTuts | 2c529cdaafa2e5f4232ce90f48d7c73c04145eb4 | 3392ec6f21554c34d21b2190d8fee7aef2282fcc | refs/heads/main | 2023-05-07T10:11:23.257976 | 2021-05-26T13:24:14 | 2021-05-26T13:24:14 | 369,713,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | package com.kdroid.kotlintuts.java.datastructure.stack;
public class StackDemo {
}
| [
"anuj.kumar@algoworks.com"
] | anuj.kumar@algoworks.com |
49f7a76260f8f9094e3c30b2286502278dad9402 | 0b1a9109de1f41752a34374a75790af350c9d8f0 | /ontologizer/src/ontologizer/GlobalPreferences.java | f2b0c834d2f35b25ead15ce82724d67cee52577d | [] | no_license | visze/ontologizer | 1f3cb5e75f222b5a41b48211ce6ff35ca3fe4a1d | 1aba3851f54e1bb8ddd7cccd70eefb2cfb22af32 | refs/heads/master | 2021-01-13T11:08:39.231003 | 2017-03-17T16:23:29 | 2017-03-17T16:23:29 | 54,557,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,671 | java | package ontologizer;
/**
* Manages the global preferences.
*
* @author Sebastian Bauer
*
*/
public final class GlobalPreferences
{
private static String dotPath = "dot";
private static int numberOfPermutations = 500;
private static String proxyHost;
private static int proxyPort;
private static int wrapColumn = 30;
private static int mcmcSteps = 500000;
private static double b2gAlpha = Double.NaN;
private static double b2gBeta = Double.NaN;
private static int b2gDT = -1;
private static double upperAlpha = 1.;
private static double upperBeta = 1.;
static
{
/* Initialize default values */
String proxySet = System.getProperty("proxySet", "false");
proxyPort = 8888;
proxyHost = "";
if (proxySet.equalsIgnoreCase("true"))
{
proxyHost = System.getProperty("proxyHost", "");
String portString = System.getProperty("proxyPort", "8888");
try
{
proxyPort = Integer.parseInt(portString);
} catch (NumberFormatException e)
{}
}
}
/**
* Private constructor to indicate a uninstanciable
* class.
*/
private GlobalPreferences()
{
}
/**
* Returns the DOT path.
*
* @return
*/
static public String getDOTPath()
{
return dotPath;
}
/**
* Sets the DOT path.
*
* @param path specifies the new path.
*/
static public void setDOTPath(String path)
{
dotPath = path;
}
/**
* Returns the number of permutations.
*
* @return
*/
static public int getNumberOfPermutations()
{
return numberOfPermutations;
}
/**
* Sets the number of permutations.
*
* @param numberOfPermutations2
*/
static public void setNumberOfPermutations(int numberOfPermutations2)
{
numberOfPermutations = numberOfPermutations2;
}
/**
* Sets the proxy server.
*
* @param proxyServer
*/
public static void setProxyHost(String proxyServer)
{
GlobalPreferences.proxyHost = proxyServer;
}
/**
* Returns the proxy server.
*
* @return
*/
public static String getProxyHost()
{
return proxyHost;
}
/**
* Sets the proxy port.
*
* @param proxyPort
*/
public static void setProxyPort(int proxyPort)
{
GlobalPreferences.proxyPort = proxyPort;
}
/**
* Sets the proxy port.
*
* @param proxyPort
*/
public static void setProxyPort(String proxyPort)
{
try
{
GlobalPreferences.proxyPort = Integer.parseInt(proxyPort);
} catch (NumberFormatException e){}
}
/**
* Returns the proxy port.
*
* @return
*/
public static int getProxyPort()
{
return proxyPort;
}
public static int getWrapColumn()
{
return wrapColumn;
}
public static void setWrapColumn(int wrapColumn)
{
GlobalPreferences.wrapColumn = wrapColumn;
}
public static double getUpperAlpha()
{
return upperAlpha;
}
public static void setUpperAlpha(double upperAlpha)
{
GlobalPreferences.upperAlpha = upperAlpha;
}
public static double getUpperBeta()
{
return upperBeta;
}
public static void setUpperBeta(double upperBeta)
{
GlobalPreferences.upperBeta = upperBeta;
}
public static void setMcmcSteps(int mcmcSteps)
{
GlobalPreferences.mcmcSteps = mcmcSteps;
}
public static int getMcmcSteps() {
return mcmcSteps;
}
public static void setAlpha(double alpha)
{
GlobalPreferences.b2gAlpha = alpha;
}
public static double getAlpha()
{
return b2gAlpha;
}
public static void setBeta(double beta)
{
GlobalPreferences.b2gBeta = beta;
}
public static double getBeta()
{
return b2gBeta;
}
public static void setExpectedNumber(int terms)
{
b2gDT = terms;
}
/**
* Returns the expected number of terms setting for MGSA.
*
* @return
*/
public static int getExpectedNumber()
{
return b2gDT;
}
}
| [
"mail@sebastianbauer.info"
] | mail@sebastianbauer.info |
0cfc36b413510a06a8af730f200a39b5f7d88530 | 9254e7279570ac8ef687c416a79bb472146e9b35 | /sofa-20190815/src/main/java/com/aliyun/sofa20190815/models/UpdateLinkeBahamutReleasedependencyResponseBody.java | 32f5e7d735c80cd42c4e044309e53961c3dc68d3 | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,679 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.sofa20190815.models;
import com.aliyun.tea.*;
public class UpdateLinkeBahamutReleasedependencyResponseBody extends TeaModel {
@NameInMap("RequestId")
public String requestId;
@NameInMap("ResultCode")
public String resultCode;
@NameInMap("ResultMessage")
public String resultMessage;
@NameInMap("ErrorMessage")
public String errorMessage;
@NameInMap("ErrorMsgParamsMap")
public String errorMsgParamsMap;
@NameInMap("Message")
public String message;
@NameInMap("ResponseStatusCode")
public Long responseStatusCode;
@NameInMap("Success")
public Boolean success;
@NameInMap("Result")
public UpdateLinkeBahamutReleasedependencyResponseBodyResult result;
public static UpdateLinkeBahamutReleasedependencyResponseBody build(java.util.Map<String, ?> map) throws Exception {
UpdateLinkeBahamutReleasedependencyResponseBody self = new UpdateLinkeBahamutReleasedependencyResponseBody();
return TeaModel.build(map, self);
}
public UpdateLinkeBahamutReleasedependencyResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public UpdateLinkeBahamutReleasedependencyResponseBody setResultCode(String resultCode) {
this.resultCode = resultCode;
return this;
}
public String getResultCode() {
return this.resultCode;
}
public UpdateLinkeBahamutReleasedependencyResponseBody setResultMessage(String resultMessage) {
this.resultMessage = resultMessage;
return this;
}
public String getResultMessage() {
return this.resultMessage;
}
public UpdateLinkeBahamutReleasedependencyResponseBody setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
return this;
}
public String getErrorMessage() {
return this.errorMessage;
}
public UpdateLinkeBahamutReleasedependencyResponseBody setErrorMsgParamsMap(String errorMsgParamsMap) {
this.errorMsgParamsMap = errorMsgParamsMap;
return this;
}
public String getErrorMsgParamsMap() {
return this.errorMsgParamsMap;
}
public UpdateLinkeBahamutReleasedependencyResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public UpdateLinkeBahamutReleasedependencyResponseBody setResponseStatusCode(Long responseStatusCode) {
this.responseStatusCode = responseStatusCode;
return this;
}
public Long getResponseStatusCode() {
return this.responseStatusCode;
}
public UpdateLinkeBahamutReleasedependencyResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
public UpdateLinkeBahamutReleasedependencyResponseBody setResult(UpdateLinkeBahamutReleasedependencyResponseBodyResult result) {
this.result = result;
return this;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult getResult() {
return this.result;
}
public static class UpdateLinkeBahamutReleasedependencyResponseBodyResult extends TeaModel {
@NameInMap("AfterFastDevDate")
public Boolean afterFastDevDate;
@NameInMap("AoneReleaseId")
public String aoneReleaseId;
@NameInMap("AppGroup")
public String appGroup;
@NameInMap("Attachable")
public Boolean attachable;
@NameInMap("BetaRelease")
public Boolean betaRelease;
@NameInMap("ContainPreInMultiEnv")
public Boolean containPreInMultiEnv;
@NameInMap("Created")
public Long created;
@NameInMap("Creator")
public String creator;
@NameInMap("DailyRelease")
public Boolean dailyRelease;
@NameInMap("Deadlines")
public String deadlines;
@NameInMap("Deleted")
public Boolean deleted;
@NameInMap("Dependencies")
public String dependencies;
@NameInMap("ExternalId")
public String externalId;
@NameInMap("GreenChannelId")
public String greenChannelId;
@NameInMap("GreenChannelName")
public String greenChannelName;
@NameInMap("GreenChannelPortalUrl")
public String greenChannelPortalUrl;
@NameInMap("HasCreatedAppReleaseDetail")
public Boolean hasCreatedAppReleaseDetail;
@NameInMap("Id")
public String id;
@NameInMap("IterationType")
public String iterationType;
@NameInMap("LastModified")
public Long lastModified;
@NameInMap("Link")
public String link;
@NameInMap("MergeStartTime")
public Long mergeStartTime;
@NameInMap("MultiEnvProd")
public Boolean multiEnvProd;
@NameInMap("MultiEnvRelease")
public Boolean multiEnvRelease;
@NameInMap("Name")
public String name;
@NameInMap("ReleaseDate")
public Long releaseDate;
@NameInMap("Status")
public String status;
@NameInMap("TagAndMergeMasterWhenEmergency")
public Boolean tagAndMergeMasterWhenEmergency;
@NameInMap("TenantId")
public String tenantId;
@NameInMap("Ticket")
public String ticket;
@NameInMap("Type")
public String type;
@NameInMap("WindowRelease")
public Boolean windowRelease;
@NameInMap("Apps")
public java.util.List<String> apps;
@NameInMap("DelAppMetaIds")
public java.util.List<String> delAppMetaIds;
@NameInMap("Iterations")
public java.util.List<String> iterations;
@NameInMap("Managers")
public java.util.List<String> managers;
@NameInMap("MultiEnvConfigs")
public java.util.List<String> multiEnvConfigs;
@NameInMap("Stages")
public java.util.List<String> stages;
@NameInMap("TenantReleaseInfos")
public java.util.List<String> tenantReleaseInfos;
public static UpdateLinkeBahamutReleasedependencyResponseBodyResult build(java.util.Map<String, ?> map) throws Exception {
UpdateLinkeBahamutReleasedependencyResponseBodyResult self = new UpdateLinkeBahamutReleasedependencyResponseBodyResult();
return TeaModel.build(map, self);
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setAfterFastDevDate(Boolean afterFastDevDate) {
this.afterFastDevDate = afterFastDevDate;
return this;
}
public Boolean getAfterFastDevDate() {
return this.afterFastDevDate;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setAoneReleaseId(String aoneReleaseId) {
this.aoneReleaseId = aoneReleaseId;
return this;
}
public String getAoneReleaseId() {
return this.aoneReleaseId;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setAppGroup(String appGroup) {
this.appGroup = appGroup;
return this;
}
public String getAppGroup() {
return this.appGroup;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setAttachable(Boolean attachable) {
this.attachable = attachable;
return this;
}
public Boolean getAttachable() {
return this.attachable;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setBetaRelease(Boolean betaRelease) {
this.betaRelease = betaRelease;
return this;
}
public Boolean getBetaRelease() {
return this.betaRelease;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setContainPreInMultiEnv(Boolean containPreInMultiEnv) {
this.containPreInMultiEnv = containPreInMultiEnv;
return this;
}
public Boolean getContainPreInMultiEnv() {
return this.containPreInMultiEnv;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setCreated(Long created) {
this.created = created;
return this;
}
public Long getCreated() {
return this.created;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setCreator(String creator) {
this.creator = creator;
return this;
}
public String getCreator() {
return this.creator;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setDailyRelease(Boolean dailyRelease) {
this.dailyRelease = dailyRelease;
return this;
}
public Boolean getDailyRelease() {
return this.dailyRelease;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setDeadlines(String deadlines) {
this.deadlines = deadlines;
return this;
}
public String getDeadlines() {
return this.deadlines;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setDeleted(Boolean deleted) {
this.deleted = deleted;
return this;
}
public Boolean getDeleted() {
return this.deleted;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setDependencies(String dependencies) {
this.dependencies = dependencies;
return this;
}
public String getDependencies() {
return this.dependencies;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setExternalId(String externalId) {
this.externalId = externalId;
return this;
}
public String getExternalId() {
return this.externalId;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setGreenChannelId(String greenChannelId) {
this.greenChannelId = greenChannelId;
return this;
}
public String getGreenChannelId() {
return this.greenChannelId;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setGreenChannelName(String greenChannelName) {
this.greenChannelName = greenChannelName;
return this;
}
public String getGreenChannelName() {
return this.greenChannelName;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setGreenChannelPortalUrl(String greenChannelPortalUrl) {
this.greenChannelPortalUrl = greenChannelPortalUrl;
return this;
}
public String getGreenChannelPortalUrl() {
return this.greenChannelPortalUrl;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setHasCreatedAppReleaseDetail(Boolean hasCreatedAppReleaseDetail) {
this.hasCreatedAppReleaseDetail = hasCreatedAppReleaseDetail;
return this;
}
public Boolean getHasCreatedAppReleaseDetail() {
return this.hasCreatedAppReleaseDetail;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setId(String id) {
this.id = id;
return this;
}
public String getId() {
return this.id;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setIterationType(String iterationType) {
this.iterationType = iterationType;
return this;
}
public String getIterationType() {
return this.iterationType;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setLastModified(Long lastModified) {
this.lastModified = lastModified;
return this;
}
public Long getLastModified() {
return this.lastModified;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setLink(String link) {
this.link = link;
return this;
}
public String getLink() {
return this.link;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setMergeStartTime(Long mergeStartTime) {
this.mergeStartTime = mergeStartTime;
return this;
}
public Long getMergeStartTime() {
return this.mergeStartTime;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setMultiEnvProd(Boolean multiEnvProd) {
this.multiEnvProd = multiEnvProd;
return this;
}
public Boolean getMultiEnvProd() {
return this.multiEnvProd;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setMultiEnvRelease(Boolean multiEnvRelease) {
this.multiEnvRelease = multiEnvRelease;
return this;
}
public Boolean getMultiEnvRelease() {
return this.multiEnvRelease;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setName(String name) {
this.name = name;
return this;
}
public String getName() {
return this.name;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setReleaseDate(Long releaseDate) {
this.releaseDate = releaseDate;
return this;
}
public Long getReleaseDate() {
return this.releaseDate;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setStatus(String status) {
this.status = status;
return this;
}
public String getStatus() {
return this.status;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setTagAndMergeMasterWhenEmergency(Boolean tagAndMergeMasterWhenEmergency) {
this.tagAndMergeMasterWhenEmergency = tagAndMergeMasterWhenEmergency;
return this;
}
public Boolean getTagAndMergeMasterWhenEmergency() {
return this.tagAndMergeMasterWhenEmergency;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setTenantId(String tenantId) {
this.tenantId = tenantId;
return this;
}
public String getTenantId() {
return this.tenantId;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setTicket(String ticket) {
this.ticket = ticket;
return this;
}
public String getTicket() {
return this.ticket;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setType(String type) {
this.type = type;
return this;
}
public String getType() {
return this.type;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setWindowRelease(Boolean windowRelease) {
this.windowRelease = windowRelease;
return this;
}
public Boolean getWindowRelease() {
return this.windowRelease;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setApps(java.util.List<String> apps) {
this.apps = apps;
return this;
}
public java.util.List<String> getApps() {
return this.apps;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setDelAppMetaIds(java.util.List<String> delAppMetaIds) {
this.delAppMetaIds = delAppMetaIds;
return this;
}
public java.util.List<String> getDelAppMetaIds() {
return this.delAppMetaIds;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setIterations(java.util.List<String> iterations) {
this.iterations = iterations;
return this;
}
public java.util.List<String> getIterations() {
return this.iterations;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setManagers(java.util.List<String> managers) {
this.managers = managers;
return this;
}
public java.util.List<String> getManagers() {
return this.managers;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setMultiEnvConfigs(java.util.List<String> multiEnvConfigs) {
this.multiEnvConfigs = multiEnvConfigs;
return this;
}
public java.util.List<String> getMultiEnvConfigs() {
return this.multiEnvConfigs;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setStages(java.util.List<String> stages) {
this.stages = stages;
return this;
}
public java.util.List<String> getStages() {
return this.stages;
}
public UpdateLinkeBahamutReleasedependencyResponseBodyResult setTenantReleaseInfos(java.util.List<String> tenantReleaseInfos) {
this.tenantReleaseInfos = tenantReleaseInfos;
return this;
}
public java.util.List<String> getTenantReleaseInfos() {
return this.tenantReleaseInfos;
}
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
56efa9242d56bb6508ddb8af91d38351c3cc1a4d | 2be1049f684710777b6404180a92a3e96ef48de6 | /src/main/java/uk/co/jassoft/markets/collect/company/listeners/CompanyListener.java | 80a8e8935524a2e1ed9ae7787a69368e478b9163 | [] | no_license | MarketReaction/Collect | 4514ec5718392b3d0658324fd5b0640c95e436bf | 97aec7a8679c0db169a762ed8a8f9c8d596750d9 | refs/heads/master | 2021-01-12T11:52:20.509068 | 2016-12-23T13:15:37 | 2016-12-23T13:15:37 | 69,592,943 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,668 | 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 uk.co.jassoft.markets.collect.company.listeners;
import uk.co.jassoft.markets.datamodel.company.Company;
import uk.co.jassoft.markets.datamodel.company.Exchange;
import uk.co.jassoft.markets.datamodel.system.Queue;
import uk.co.jassoft.markets.repository.CompanyRepository;
import uk.co.jassoft.markets.repository.ExchangeRepository;
import uk.co.jassoft.markets.utils.article.ContentGrabber;
import uk.co.jassoft.network.Network;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import java.util.List;
/**
*
* @author Jonny
*/
@Component
public class CompanyListener implements MessageListener
{
private static final Logger LOG = LoggerFactory.getLogger(CompanyListener.class);
@Autowired
private CompanyRepository companyRepository;
@Autowired
private ExchangeRepository exchangeRepository;
@Autowired
protected MongoTemplate mongoTemplate;
@Autowired
private ContentGrabber grabber;
@Autowired
private JmsTemplate jmsTemplate;
@Autowired
private Network network;
public void setNetwork(Network network) {
this.network = network;
}
public void setGrabber(ContentGrabber grabber) {
this.grabber = grabber;
}
void send(final String message) {
jmsTemplate.convertAndSend(Queue.CompanyWithInformation.toString(), message);
}
@Override
@JmsListener(destination = "FoundCompany", concurrency = "5")
public void onMessage( final Message message )
{
if ( message instanceof TextMessage )
{
final TextMessage textMessage = (TextMessage) message;
try
{
message.acknowledge();
Company company = companyRepository.findOne(textMessage.getText());
Exchange exchange = exchangeRepository.findOne(company.getExchange());
String html = null;
String companyInformation = null;
try {
html = network.httpRequest("https://www.google.com/finance?q=" + getGoogleCode(exchange.getCode()) + "%3A" + company.getTickerSymbol(), "GET", false);
companyInformation = grabber.getContentFromWebsite(html);
}
catch (Exception exception) {
LOG.info("ERROR: " + exception.getMessage());
}
if(companyInformation != null && !companyInformation.contains("Cookies help us deliver our services") && !companyInformation.contains("Google Finance Beta available in")) {
LOG.info("Company Information collected from Google for Company [{}]", company.getName());
companyInformation = companyInformation.replace("More from FactSet »\nDescription", "");
} else {
html = network.httpRequest("http://www.reuters.com/finance/stocks/companyProfile?symbol=" + company.getTickerSymbol(), "GET", false);
companyInformation = grabber.getContentFromWebsite(html);
companyInformation = companyInformation.replace("Full Description", "");
LOG.info("Company Information collected from Reuters for Company [{}]", company.getName());
}
companyInformation = companyInformation.replaceAll("\\n", "");
// Has the information been updated
if (company.getCompanyInformation() == null || !company.getCompanyInformation().equals(companyInformation)) {
mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(company.getId())), Update.update("companyInformation", companyInformation), Company.class);
}
send(company.getId());
}
catch (final Exception exception) {
LOG.error(exception.getLocalizedMessage(), exception);
throw new RuntimeException(exception);
}
}
}
private String getGoogleCode(String exchangeCode)
{
switch (exchangeCode)
{
case "LSE":
return "LON";
default:
return exchangeCode;
}
}
@JmsListener(destination = "ExclusionAdded")
public void onExclusionMessage( final Message message )
{
if ( message instanceof TextMessage)
{
final TextMessage textMessage = (TextMessage) message;
try
{
List<Company> companiesWithName = companyRepository.findWithNamedEntity(textMessage.getText());
companiesWithName.stream().forEach(company -> {
send(company.getId());
});
}
catch (final Exception exception)
{
LOG.error(exception.getLocalizedMessage(), exception);
throw new RuntimeException(exception);
}
}
}
} | [
"jon.shaw@jassoft.co.uk"
] | jon.shaw@jassoft.co.uk |
f80976fdfd12a866b5cf8258924679f13b01abc5 | c93c9d0a5fdf669fe2dc21e536448aca0408ab29 | /src/main/java/com/bolero/boleroteam/repository/StyleRepository.java | 1c1c2f20b3abef01ab6692d578bb8d89850cd01f | [] | no_license | Xuantho01/zing-mp3-angular | 9918557be457a11e59f2356b70c68a120df81afa | ad6064b1fd3af17bf0a4e0036d26bbdc606c6112 | refs/heads/master | 2022-11-06T23:52:53.079448 | 2020-07-03T15:03:19 | 2020-07-03T15:03:19 | 276,869,559 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.bolero.boleroteam.repository;
import com.bolero.boleroteam.model.Style;
import org.springframework.data.repository.CrudRepository;
public interface StyleRepository extends CrudRepository<Style,Long> {
}
| [
"hoxuantho95@gmail.com"
] | hoxuantho95@gmail.com |
c270bf5dde2bfb9fc9f89046f9137fcd1a26a6ec | deb7a45524fa9da45467f6d6ac47a6f7159de7e0 | /src/org/ligerbots/frc2877/outreach/ExternalMedia.java | 065aa4551d7a8682f8205b076e6adb8b92354ba4 | [] | no_license | ligerbots/Outreach-Display-Control | 25df61ae7b67f26313c3a5ea034d4dd77d2352bf | ec54bf3d9f2fcf8f49b6ec98f09afcf822a8a5d9 | refs/heads/master | 2021-01-10T08:38:35.950185 | 2016-03-04T22:49:31 | 2016-03-06T19:36:36 | 53,168,834 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,559 | java | package org.ligerbots.frc2877.outreach;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Properties;
public class ExternalMedia {
/** This method finds external media devices with the proper configuration **/
public static ExternalMedia findMedia() {
//Get mounted devices
File[] mounted = new File("/mount").listFiles();
//Check each device
for(File device : mounted) {
//Get the configuration file
File configuration = new File(device, "ligerbots.ini");
//Check if the file exists
if(configuration.exists()) {
//Create and return new ExternalMedia object
return new ExternalMedia(configuration);
}
}
//No external device found
return null;
}
/** Configuration **/
private Properties configuration;
/** Error **/
public boolean somethingWentWrong = false;
public Exception thatThingThatWentWrong = null;
/** Processes **/
private ArrayList<Process> processes = new ArrayList<Process>();
/** Constructor **/
public ExternalMedia(File cfile) {
//Catch any fuck-ups in the configuration
try {
//Create a new configuration
configuration = new Properties();
//Load the thing
configuration.load(new FileInputStream(cfile));
} catch(Exception e) {
//Something went wrong
somethingWentWrong = true;
thatThingThatWentWrong = e;
}
}
/** Shows the main menu **/
public void showMainMenu() {
//Kill processes
killAll();
//Catch errors caused by process spawning
try {
//Create processes
Process mainmenu = Runtime.getRuntime().exec("omxplayer " + configuration.getProperty("mainmenu"));
//Save process
processes.add(mainmenu);
} catch(Exception e) {
//Bad
somethingWentWrong = true;
thatThingThatWentWrong = e;
}
}
/** Shows one of the videos **/
public void showVideo(int number) {
//Kill processes
killAll();
//Catch errors caused by process spawning
try {
//Create processes
Process preview = Runtime.getRuntime().exec("fbi " + configuration.getProperty("preview" + number));
Process video = Runtime.getRuntime().exec("omxplayer " + configuration.getProperty("video" + number));
//Save processes
processes.add(preview);
processes.add(video);
} catch(Exception e) {
//Bad
somethingWentWrong = true;
thatThingThatWentWrong = e;
}
}
/** Kills everything **/
public void killAll() {
//Iterate through each process
for(Process p : processes) {
//Kill the process
p.destroy();
//Remove from the list
processes.remove(p);
}
}
}
| [
"Arkazex@Gmail.com"
] | Arkazex@Gmail.com |
c6b06ccc57ebc59cabab93454990417a90fb58b1 | 6260ff341bb1e0f5e644600ffdd883aca3dabda1 | /src/main/java/sudoku/states/StateMain.java | 278acc60f6512a07af581d2600a096eecf7c90a5 | [] | no_license | lightningstudios126/ProjectSudoku | 4fff12ae7e4ee13462d9c9919e6417310a2c3d20 | 439d6a2db1ebd4b85c93960ed0dc7314702912b5 | refs/heads/master | 2021-06-27T08:39:26.578808 | 2018-06-19T03:54:13 | 2018-06-19T03:54:13 | 131,048,648 | 0 | 3 | null | 2018-06-18T17:01:09 | 2018-04-25T18:35:54 | Java | UTF-8 | Java | false | false | 3,141 | java | package main.java.sudoku.states;
import main.java.sudoku.util.Button;
import main.java.sudoku.util.Coordinate;
import main.java.sudoku.util.SolarizedColours;
import processing.core.PApplet;
import processing.core.PConstants;
import processing.core.PImage;
import java.util.ArrayList;
public class StateMain extends GameState {
private static GameState instance;
private ArrayList<Button> buttons;
PImage logo;
private StateMain(PApplet parent) {
super(parent);
}
/**
* Gets the singleton instance of this GameState
*
* @return the instance of this GameState
*/
public static GameState getInstance() {
if (instance == null) instance = new StateMain(GameEngine.getInstance().parent);
return instance;
}
@Override
public void start() {
buttons = new ArrayList<>();
int x = 650;
int y = 100;
buttons.add(new Button(
parent,
new Coordinate(x, y += 60), new Coordinate(160, 50), "Theme",
() -> {
SolarizedColours.lightTheme = !SolarizedColours.lightTheme;
// reload current state
changeState(getInstance());
}
));
buttons.add(new Button(
parent,
new Coordinate(x, y += 60), new Coordinate(160, 50), "Start",
() -> changeState(StateGame.getInstance())
));
buttons.add(new Button(
parent,
new Coordinate(x, y += 60), new Coordinate(160, 50), "About",
() -> changeState(StateInstruction.getInstance())
));
buttons.add(new Button(
parent,
new Coordinate(x, y += 60), new Coordinate(160, 50), "Scores",
() -> changeState(StateScore.getInstance())
));
buttons.add(new Button(parent,
new Coordinate(x, y += 60), new Coordinate(160, 50), "Quit",//UJML colours
() -> GameEngine.getInstance().exit()
));
// load the logo based on the theme
logo = parent.loadImage((SolarizedColours.lightTheme ? "LogoLight.png" : "LogoDark.png"));
logo.resize(logo.width / 2, logo.height / 2);
}
@Override
public void end() {
}
@Override
public void update() {
for (Button button : buttons) {
button.update();
}
}
@Override
public void draw() {
parent.image(logo, 70, parent.height / 2 - logo.height / 2);
parent.textSize(80);
parent.fill(SolarizedColours.getText());
parent.textAlign(PConstants.LEFT, PConstants.CENTER);
parent.text("Sudoku", 70 + logo.width + 60, parent.height / 2 - 30);
parent.textSize(18);
parent.text("By Timothy Chan \n and Ethan Wong", 70 + logo.width + 60 + 20, parent.height / 2 + 40);
parent.textAlign(PConstants.LEFT);
for (Button button : buttons) {
button.draw();
}
}
}
| [
"ethan.wong@hotmail.com"
] | ethan.wong@hotmail.com |
afc5ea4c2b87f936b81c60db3c1cca62db00de6a | 5cb17a0a42d434b3316b39911ae7aa30cb39eebf | /LoginSqlite/app/src/main/java/com/example/loginsqlite/welcomeActivity.java | e40acac714b1be2eadd523f1e890060b39285b3b | [] | no_license | AliKemalSahin/AndroidSmallProjects | c01774884eecc97424a833dc6934117fd8a95a7b | 2a526f8b5c7a8e625f589c4964d9d1818a44b62c | refs/heads/master | 2021-03-19T20:07:44.583514 | 2020-03-13T19:05:49 | 2020-03-13T19:05:49 | 247,143,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | package com.example.loginsqlite;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class welcomeActivity extends AppCompatActivity {
TextView tv;
String name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
tv = findViewById(R.id.tv);
name = getIntent().getStringExtra("NAME");
tv.setText(name);
}
}
| [
"49462856+AliKemalSahin@users.noreply.github.com"
] | 49462856+AliKemalSahin@users.noreply.github.com |
cff350715f5223c05e7fbe8a280d78248948712c | c5661e22b4903626d77417ad15068be5c2ddd50f | /core-lang/src/test/java/bingo/lang/reflect/testbed/StaticContainer.java | 4511e813aed3b3d631b02e656b480bbdfd399f6f | [
"Apache-2.0"
] | permissive | bingo-open-source/bingo-core | 01e70ce12f90ca5fd933903f94e22ba20b17ca69 | 3eb5512e905a7e158a5f51d9c62e9831d734da7b | refs/heads/master | 2020-04-08T08:33:42.282004 | 2013-09-06T06:30:53 | 2013-09-06T06:30:53 | 4,103,949 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,816 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 bingo.lang.reflect.testbed;
/**
* @version $Id: StaticContainer.java 1088899 2011-04-05 05:31:27Z bayard $
*/
public class StaticContainer {
public static final Object IMMUTABLE_PUBLIC = "public";
protected static final Object IMMUTABLE_PROTECTED = "protected";
static final Object IMMUTABLE_PACKAGE = "";
@SuppressWarnings("unused")
private static final Object IMMUTABLE_PRIVATE = "private";
public static Object mutablePublic;
protected static Object mutableProtected;
static Object mutablePackage;
private static Object mutablePrivate;
public static void reset() {
mutablePublic = null;
mutableProtected = null;
mutablePackage = null;
mutablePrivate = null;
}
public static Object getMutableProtected() {
return mutableProtected;
}
public static Object getMutablePackage() {
return mutablePackage;
}
public static Object getMutablePrivate() {
return mutablePrivate;
}
}
| [
"live.fenghm@gmail.com"
] | live.fenghm@gmail.com |
4a4e65dbb86cb670b6623a6d92a0ef77d879462d | 2cba2e9a62e0e2cec6de5eaffbf5ab40039e5a6f | /src/main/java/org/example/AppleMacBookPro13.java | 1dfdf0bb0d2bb88582aa7a1d26c7d74bace64de3 | [] | no_license | bakulpatel1119/practice | 94074e75e3853f2d60ec21c9fecb290192ffd492 | 1c6611a08bda34e9f254f38dc586d527eb5b32ca | refs/heads/master | 2021-04-24T02:33:15.449883 | 2020-03-25T18:42:26 | 2020-03-25T18:42:26 | 250,061,954 | 0 | 0 | null | 2020-10-13T20:39:27 | 2020-03-25T18:42:46 | Java | UTF-8 | Java | false | false | 411 | java | package org.example;
import org.openqa.selenium.By;
public class AppleMacBookPro13 extends Utils
{
private By _emailAFriend = By.xpath("//div[@class='email-a-friend']");
public void verifyUserIsOnAppleMacBookPage()
{
assertURL("apple-macbook-pro-13-inch");
}
public void clickOnEmailAFriendButton()
{
clickOnElement(_emailAFriend);
timeDelay(2);
}
}
| [
"bakulpatel1119@gmail.com"
] | bakulpatel1119@gmail.com |
c2d0e79d81ee46116c6019b2bda719e41624f95a | 447520f40e82a060368a0802a391697bc00be96f | /apks/test_apks/insb/source/com/google/android/gms/wallet/zzq.java | 0479f8fa2916468000b3c40c717bb3cd45ffea03 | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 1,783 | java | package com.google.android.gms.wallet;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.zza;
import com.google.android.gms.common.internal.safeparcel.zza.zza;
import com.google.android.gms.common.internal.safeparcel.zzb;
public class zzq
implements Parcelable.Creator<ProxyCard>
{
public zzq() {}
static void zza(ProxyCard paramProxyCard, Parcel paramParcel, int paramInt)
{
paramInt = zzb.zzac(paramParcel);
zzb.zzc(paramParcel, 1, paramProxyCard.getVersionCode());
zzb.zza(paramParcel, 2, paramProxyCard.zzaRB, false);
zzb.zza(paramParcel, 3, paramProxyCard.zzaRC, false);
zzb.zzc(paramParcel, 4, paramProxyCard.zzaRD);
zzb.zzc(paramParcel, 5, paramProxyCard.zzaRE);
zzb.zzH(paramParcel, paramInt);
}
public ProxyCard zzgq(Parcel paramParcel)
{
String str1 = null;
int i = 0;
int m = zza.zzab(paramParcel);
int j = 0;
String str2 = null;
int k = 0;
while (paramParcel.dataPosition() < m)
{
int n = zza.zzaa(paramParcel);
switch (zza.zzbA(n))
{
default:
zza.zzb(paramParcel, n);
break;
case 1:
k = zza.zzg(paramParcel, n);
break;
case 2:
str2 = zza.zzo(paramParcel, n);
break;
case 3:
str1 = zza.zzo(paramParcel, n);
break;
case 4:
j = zza.zzg(paramParcel, n);
break;
case 5:
i = zza.zzg(paramParcel, n);
}
}
if (paramParcel.dataPosition() != m) {
throw new zza.zza("Overread allowed size end=" + m, paramParcel);
}
return new ProxyCard(k, str2, str1, j, i);
}
public ProxyCard[] zzjs(int paramInt)
{
return new ProxyCard[paramInt];
}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
c3285face425ce0ccb808db149c3f73e4c7fd4f5 | 4eb6a9a33a94e344a4d7a17e05154ce1dd0fadb6 | /mcmo/src/mcmo/Driver_testConcurrent.java | 0344d1e68365ff216d9b0c6a25c930ba9e2093fd | [] | no_license | mattprivman/mcmo | 861d3e83e9481b2afff85572334c81bc5ece5789 | 1dff31346e6e75e7fa16bb6eff6d5220842abb07 | refs/heads/master | 2020-03-28T02:33:44.131161 | 2017-04-11T03:02:12 | 2017-04-11T03:02:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | package mcmo;
import java.util.*;
import java.util.concurrent.*;
import static java.util.Arrays.asList;
public class Driver_testConcurrent {
public static void main(String[] args) throws Exception{
ExecutorService executor = Executors.newFixedThreadPool(2);
List <Future<Long>> results = executor.invokeAll(asList(
new Sum(0, 10), new Sum(100, 1_000), new Sum(10_000, 1_000_000)
));
executor.shutdown();
for (Future<Long> result : results) {
System.out.println(result.get());
}
}
static class Sum implements Callable<Long> {
private final long from;
private final long to;
Sum(long from, long to) {
this.from = from;
this.to = to;
}
@Override
public Long call() {
long acc = 0;
for (long i = from; i <= to; i++) {
acc = acc + i;
}
return acc;
}
}
}
| [
"zhangh24@celgroup-1"
] | zhangh24@celgroup-1 |
258bc207e7958410ebb0cb1682e9e7a46625e58f | cbd9ee71a98c6c2214dd4092a41c0c2c2a9a594a | /app/src/main/java/com/example/bigyoung/colorfulring/view/ColorfulRing.java | b05c383a270192d429c46be7386ec04bc4201fd8 | [] | no_license | dreamBigYoung/ColorfulRing | 6e329c1a18ed21da0ba367eac40923512856df1e | 8f4492f85bececd4865a1d50fc975707a66f2491 | refs/heads/master | 2021-01-23T14:11:36.318527 | 2017-09-07T02:44:38 | 2017-09-07T02:44:38 | 102,677,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,061 | java | package com.example.bigyoung.colorfulring.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.support.annotation.Nullable;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import com.example.bigyoung.colorfulring.R;
/**
* Created by BigYoung on 2017/9/6.
*/
public class ColorfulRing extends View {
private String mTextContent;
private int mMajorColor;//主颜色
private int mSecondaryColor;//次颜色
private int mRadius;//半径
private int mCurrentValue;//当前值
private int mMaxValue;//最大值
public Paint mPaint;
public int mArcWidth;//环宽
public int mHeight;
public int mWidth;
public int WIDTH_BLANK;//横向空白
public int HEIGHT_BLANK;//纵向空白
public float mTextDimen;//文字尺寸
private Rect mTextBounds;
public ColorfulRing(Context context) {
this(context, null);
}
public ColorfulRing(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public ColorfulRing(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
//获取自定义属性
TypedArray arrayAttr = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ColorfulRing, defStyleAttr, 0);
int num = arrayAttr.getIndexCount();
for (int i = 0; i < num; i++) {//筛选目的属性
int attr = arrayAttr.getIndex(i);
switch (attr) {
case R.styleable.ColorfulRing_major_color:
mMajorColor = arrayAttr.getColor(attr, Color.BLACK);
break;
case R.styleable.ColorfulRing_secondary_color:
mSecondaryColor = arrayAttr.getColor(attr, Color.WHITE);
break;
case R.styleable.ColorfulRing_current_value:
mCurrentValue = arrayAttr.getInt(attr, 0);
break;
case R.styleable.ColorfulRing_max_value:
mMaxValue = arrayAttr.getInt(attr, 0);
break;
case R.styleable.ColorfulRing_radius:
mRadius = (int) arrayAttr.getDimension(attr, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
100, getResources().getDisplayMetrics()));
break;
case R.styleable.ColorfulRing_text_size:
mTextDimen = arrayAttr.getDimension(attr, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,
12, getResources().getDisplayMetrics()));
break;
}
}
arrayAttr.recycle();
//创造画笔
mPaint = new Paint();
mPaint.setAntiAlias(true);//抗锯齿
mPaint.setStrokeCap(Paint.Cap.ROUND);//绘制的结尾是圆弧
//环的宽度取半径的1/8
mArcWidth = mRadius / 8;
WIDTH_BLANK = 2 * mArcWidth;
HEIGHT_BLANK = 2 * mArcWidth;
//文本渲染区域
mTextBounds = new Rect();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//宽度模式必须设定为wrap_content,只需设置半径值就可以确定范围
mWidth = 2 * mRadius + 4 * mArcWidth + WIDTH_BLANK;
mHeight = mRadius + mArcWidth + mArcWidth + HEIGHT_BLANK;
setMeasuredDimension(mWidth, mHeight);
}
@Override
protected void onDraw(Canvas canvas) {
mPaint.setStrokeWidth(mArcWidth);//设置环的宽度
mPaint.setStyle(Paint.Style.STROKE);//空心
int centerX = mWidth / 2;
//确定圆弧绘制范围
RectF oval = new RectF(centerX - mRadius, HEIGHT_BLANK / 2 + mArcWidth, centerX + mRadius, HEIGHT_BLANK / 2 + mArcWidth + 2 * mRadius);
mPaint.setColor(mMajorColor);
canvas.drawArc(oval, 180, 180, false, mPaint);
//绘制代表当前进度的弧线
double percent = mCurrentValue * 1.0 / mMaxValue;
int currentArc = (int) (180 * percent);
int edgeX = (int) (mRadius + mRadius * Math.cos(Math.toRadians(180 - currentArc)));//计算当前进度圆弧在X轴上的偏移量
Shader mShader = new LinearGradient(centerX - mRadius - mArcWidth / 2, 0, centerX - mRadius + edgeX + mArcWidth, 0,
new int[]{mMajorColor, mSecondaryColor}, null, Shader.TileMode.REPEAT);//centerX-mRadius+edgeX+mArcWidth,为了保证圆弧尾端的颜色不被覆盖
mPaint.setShader(mShader);
canvas.drawArc(oval, 180, currentArc, false, mPaint);
//绘制弧底部的基线
mPaint.setShader(null);//清除渐变色
mPaint.setColor(mMajorColor);
canvas.drawLine(centerX - mRadius - mArcWidth, HEIGHT_BLANK / 2 + mRadius + mArcWidth+mArcWidth/2, centerX + mRadius + mArcWidth, HEIGHT_BLANK / 2 + mRadius + mArcWidth+mArcWidth/2, mPaint);
//绘制文字
mTextContent=mCurrentValue*100/mMaxValue+"%";//拼装待绘制文字
mPaint.setTextSize(mTextDimen);//必须在测量mTextBounds之前执行
mPaint.getTextBounds(mTextContent, 0, mTextContent.length(), mTextBounds);
mPaint.setColor(mMajorColor);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setAntiAlias(true);//抗锯齿
//居中显示
canvas.drawText(mTextContent,(mWidth-mTextBounds.width())*1.0f/2,mRadius,mPaint);
}
public void setCurrentValue(int currentValue) {
mCurrentValue = currentValue;
postInvalidate();//重新绘制
}
public void setMaxValue(int maxValue) {
mMaxValue = maxValue;
postInvalidate();//重新绘制
}
}
| [
"18355236154@163.com"
] | 18355236154@163.com |
d7396b0ce82ba9d70ff3a631d9800f4c0f3539d4 | fba311574f737e5895860c37ae5d782ad3a9bbb1 | /InventorySystemImplementation.java | 849a9bfea961435199570448a354174a047ba830 | [] | no_license | kumarpawan1/NewAssignment | ecc656d26d4efd5c000102b471d637c6950beabb | 7b8d5b4fa19b558104a759348876af98230f434f | refs/heads/master | 2021-01-25T06:17:39.838338 | 2017-06-06T17:21:20 | 2017-06-06T17:21:20 | 93,545,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,779 | java | public class InventorySystemImplementation implements InventoryManagementSystem {
private InventoryDatabase invDB;
private static boolean tempCounter = true;
public InventorySystemImplementation() {
invDB = new InventoryDatabase();
}
public void addProduct(Product p) {
invDB.addToDatabase(p);
}
@Override
public PickingResult pickProduct(String productId, int amountToPick) {
Product p = invDB.getProduct(productId);
PickingResult pr;
synchronized (p) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
int level = p.getProductLevel();
if(level < amountToPick) {
pr = new PickingResult(productId, p.getProductName(), false, 0, 0, "Not enough stock.");
}
else {
p.setProductLevel(level - amountToPick);
pr = new PickingResult(productId, p.getProductName(), true, level, level - amountToPick, "");
}
}
return pr;
}
@Override
public RestockingResult restockProduct(String productId, int amountToRestock) {
Product p = invDB.getProduct(productId);
RestockingResult rr;
synchronized (p) {
int level = p.getProductLevel();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
p.setProductLevel(level + amountToRestock);
rr = new RestockingResult(productId, p.getProductName(), true, level, level + amountToRestock, "");
}
return rr;
}
}
| [
"pawan.kumar@sjsu.edu"
] | pawan.kumar@sjsu.edu |
92930ce379be2bba56ea35ed21589ddee4f4d318 | 2f4b52aee73ae161a908718dd07bbce7fb5ab277 | /src/main/java/Organizer.java | 9b7e8f2e9f939c22b8f11b976d30bd6835060a87 | [] | no_license | dpblh/Organizer | 55369334aaec60a5daf2cf7ac5c13932e9554117 | 2ef70b6976a99d894983c5a41e20d398ae6d6194 | refs/heads/master | 2021-01-16T21:21:18.554953 | 2014-12-09T21:46:25 | 2014-12-09T21:46:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | import static utils.IOHelper.inNextLine;
import static utils.IOHelper.print;
/**
* @author Bayurov
* Точка входа в программу
*/
public class Organizer {
static {
// register action
RegisterActions.onRegister();
}
public static void main(String[] args) {
print("Органайзер запущен");
while (true) {
RegisterActions.invokeAction(inNextLine());
}
}
}
| [
"bajurovt@gmail.com"
] | bajurovt@gmail.com |
95ab6acdaef7c848c7f634d0162ef5c52729e157 | eb4db4f714d527784329257ed2548ee81e6ddce5 | /src/main/java/com/owen/favorite/util/TokenUtil.java | fd5f5437bc52fd2eb6499d7a6d7e12e6a933f656 | [
"WTFPL"
] | permissive | ikutarian/spring-token-authorization | 8c29293cf9e7587f74c0439f29e3e190186bdb16 | f4d1a7876d883f0c8ad476cda4f7081afed3bf6b | refs/heads/master | 2021-05-12T17:16:53.660138 | 2018-01-18T13:52:52 | 2018-01-18T13:52:52 | 117,040,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,345 | java | package com.owen.favorite.util;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.util.Date;
public class TokenUtil {
/**
* 1. 如果用“.”作为分隔的话,必须是如下写法:String.split("\\."),这样才能正确的分隔开,不能用String.split(".");
* 2. 如果用“|”作为分隔的话,必须是如下写法:String.split("\\|"),这样才能正确的分隔开,不能用String.split("|");
*/
private static final String SEPARATOR = "-";
/**
* Token格式:时间戳.userId.随机字符串
*/
public static String createToken(long userId) {
return new Date().getTime() + SEPARATOR + userId + SEPARATOR + RandomStringUtils.random(10, true, true);
}
/**
* 解析Token,从中取得userId
*/
public static Long getUserIdFromToken(String token) {
if (StringUtils.isEmpty(token)) {
return null;
}
String[] param = token.split(SEPARATOR);
if (param.length != 3) {
return null;
}
try {
return NumberUtils.createLong(param[1]);
} catch (NumberFormatException e) {
return null;
}
}
}
| [
"2368855203@qq.com"
] | 2368855203@qq.com |
eb0a5ce26bd740fedcb7ec9f2506207afbf94714 | 20427549791d43914be3f305b053a10e246c0bec | /custom/grocery/groceryfacades/src/org/grocery/facades/populators/GroceryWishlistEntryPopulator.java | c8e1858a80708f79331dc0d1820cc8d65ffe6e16 | [] | no_license | vaibhav29gupta/hybrisGrocery | b5fabc5598b83d1b47cd0ab2fd063d9b9a457ae6 | 31161717714c1a4d9c3267393cfda5ec05bedb9d | refs/heads/main | 2023-06-15T15:07:49.394312 | 2021-07-12T08:09:19 | 2021-07-12T08:09:19 | 385,157,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | /**
*
*/
package org.grocery.facades.populators;
import de.hybris.platform.commercefacades.product.data.ProductData;
import de.hybris.platform.selectivecartfacades.data.Wishlist2EntryData;
import de.hybris.platform.selectivecartfacades.populators.WishlistEntryForSelectiveCartPopulator;
import de.hybris.platform.wishlist2.model.Wishlist2EntryModel;
/**
* @author ankituniyal
*
*/
public class GroceryWishlistEntryPopulator extends WishlistEntryForSelectiveCartPopulator
{
@Override
public void populate(final Wishlist2EntryModel source, final Wishlist2EntryData target)
{
super.populate(source, target);
final ProductData productData = getProductConverter().convert(source.getProduct());
target.setQuantity(productData.getProductCartQuantity() != null ? productData.getProductCartQuantity().intValue()
: source.getQuantity());
}
}
| [
"vaibhav29gupta@gmail.com"
] | vaibhav29gupta@gmail.com |
3ce477d705c3f086094c6c0fbacb6eace0d3e80a | 71a1d5c79cfe469891abeff87e45c47350f47da2 | /src/com/qrwells/practices/no11/ex6/OverCapacityException.java | c8b4a758130c58ead68c42366dfe0efac4fcc72b | [
"MIT"
] | permissive | QRWells/ProgrammingA2021 | 69170ad477ed79fae68e40383082e3821c24de80 | 1e9e62032fafe14ed569e02e0c7668e19d353224 | refs/heads/master | 2023-06-12T13:56:27.191246 | 2021-06-22T21:01:35 | 2021-06-22T21:01:35 | 365,972,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 266 | java | /*
* Copyright (c) Wang Qirui. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
package com.qrwells.practices.no11.ex6;
public class OverCapacityException extends RuntimeException {
}
| [
"qirui.wang@moegi.waseda.jp"
] | qirui.wang@moegi.waseda.jp |
2ce26f1fc2e34c3b2764fe6dfb8f06e84bf61979 | 2f255d2fab78076fe5791401f3c061b61bcba22a | /Secret-webapp/src/com/mimi/core/service/impl/BlackListServiceImpl.java | fab67692d952800891d365d40c0962c04e271c01 | [] | no_license | comsince/IntegrateShareAndroid | 1f109c11951ba3e18cc6f9e7bec238488a2655b9 | 18077da28edddfa6440bd25193294536a4f4bffc | refs/heads/master | 2021-01-15T21:44:46.799503 | 2019-12-03T08:05:27 | 2019-12-03T08:05:27 | 9,512,149 | 14 | 9 | null | null | null | null | UTF-8 | Java | false | false | 1,091 | java | package com.mimi.core.service.impl;
import com.mimi.core.dao.impl.BlackListDaoImpl;
import com.mimi.core.service.BlackListService;
import com.mimi.model.BlackList;
import com.mimi.model.Page;
public class BlackListServiceImpl implements BlackListService {
private BlackListDaoImpl blackListDao;
public BlackList addOneBlackList(BlackList black) {
// TODO Auto-generated method stub
return null;
}
public Page queryBlackListByPage(byte type, Page page) {
// TODO Auto-generated method stub
return null;
}
public void deleteBlackListById(Integer id) {
// TODO Auto-generated method stub
}
public BlackList queryByIP(String ip) {
// TODO Auto-generated method stub
return blackListDao.queryByIP(ip);
}
public BlackList queryByAccount(String account) {
// TODO Auto-generated method stub
return null;
}
public void updateBlackList(BlackList black) {
// TODO Auto-generated method stub
}
public int queryBlackListAmount(byte paramByte) {
// TODO Auto-generated method stub
return 0;
}
}
| [
"liaojinlong@meizu.com"
] | liaojinlong@meizu.com |
8cd7bad007418c82c7b157b114910b272c1408ae | e6015c977dcb15efcb83c00340562da9b2660c49 | /src/study/jsp/petstudio/controller/schedule/BookingWriteOk.java | d158e55f0feb6617a86e8221b5430de633dd0706 | [] | no_license | yoominji/test | 7b67c6f06a59bc7204682749f1dca27521066f7d | 6cc4024ea069a963c23e460d16202bd3a956cc1f | refs/heads/master | 2021-01-22T08:02:45.430397 | 2017-06-28T03:19:51 | 2017-06-28T03:19:51 | 92,598,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,549 | java | package study.jsp.petstudio.controller.schedule;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.ibatis.session.SqlSession;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import study.jsp.helper.BaseController;
import study.jsp.helper.RegexHelper;
import study.jsp.helper.WebHelper;
import study.jsp.petstudio.dao.MyBatisConnectionFactory;
import study.jsp.petstudio.model.Booking;
import study.jsp.petstudio.service.BookingService;
import study.jsp.petstudio.service.impl.BookingServiceImpl;
@WebServlet("/schedule/booking_write_ok.do")
public class BookingWriteOk extends BaseController {
private static final long serialVersionUID = 1L;
/* (1) 사용하고자 하는 Helper + Service 객체 선언 */
Logger logger;
SqlSession sqlSession;
WebHelper web;
RegexHelper regex;
BookingService bookingService;
@Override
public String doRun(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/* (2) 사용하고자 하는 Helper+Service 객체 생성 */
logger = LogManager.getFormatterLogger(request.getRequestURI());
sqlSession = MyBatisConnectionFactory.getSqlSession();
web = WebHelper.getInstance(request, response);
bookingService = new BookingServiceImpl(sqlSession, logger);
/* (3) 로그인 여부 검사 */
// 로그인 중이 아니라면 이 페이지를 동작시켜서는 안된다.
// ================================================ 프로그램 연결시 주석 해제 ==============================================
/*if(web.getSession("loginInfo") == null) {
web.redirect(web.getRootPath() + "/member/login.do", "예약 신청은 로그인 후 이용 가능합니다.");
return null;
}*/
/* (4) 파라미터 받기 */
// 입력값 받기
String user_name = web.getString("user_name");
String user_hp = web.getString("user_hp");
String deposit_name = web.getString("deposit_name");
String deposit_date = web.getString("deposit_date");
String pet_name = web.getString("pet_name");
String pet_gender = web.getString("pet_gender");
String pet_age = web.getString("pet_age");
Integer admission_adult = web.getInt("admission_adult");
Integer admission_child = web.getInt("admission_child");
Integer admission_pet = web.getInt("admission_pet");
String filming_date = web.getString("filming_date");
String filming_time = web.getString("filming_time");
String camera_rental = web.getString("camera_rental");
String professional_filming = web.getString("professional_filming");
String question_content = web.getString("question_content");
logger.debug("user_name" + user_name);
logger.debug("user_hp" + user_hp);
logger.debug("deposit_name" + deposit_name);
logger.debug("deposit_date" + deposit_date);
logger.debug("pet_name" + pet_name);
logger.debug("pet_gender" + pet_gender);
logger.debug("pet_age" + pet_age);
logger.debug("admission_adult" + admission_adult);
logger.debug("admission_child" + admission_child);
logger.debug("admission_pet" + admission_pet);
logger.debug("filming_date" + filming_date);
logger.debug("filming_time" + filming_time);
logger.debug("camera_rental" + camera_rental);
logger.debug("professional_filming" + professional_filming);
logger.debug("question_content" + question_content);
// 유효성 검사
if(user_name == null) {
sqlSession.close();
web.redirect(null, "성명을 입력하세요.");
return null;
}
if(!regex.isKor(user_name)) {
sqlSession.close();
web.redirect(null, "성명은 한글만 입력 가능합니다.");
return null;
}
if(user_name.length() < 2 || user_name.length() > 5) {
sqlSession.close();
web.redirect(null, "성명은 2~5글자 까지만 가능합니다.");
return null;
}
// 연락처 검사
if(!regex.isValue(user_hp)) {
sqlSession.close();
web.redirect(null, "연락처를 입력하세요.");
return null;
}
if(!regex.isCellPhone(user_hp) && !regex.isTel(user_hp)) {
sqlSession.close();
web.redirect(null, "연락처의 형식이 잘못되었습니다.");
return null;
}
if(deposit_name == null) {
sqlSession.close();
web.redirect(null, "예약 입금자명을 입력하세요.");
return null;
}
if(deposit_name.length() > 5) {
sqlSession.close();
web.redirect(null, "예약 입금자명은 5글자 까지만 가능합니다.");
return null;
}
if(deposit_date == null) {
sqlSession.close();
web.redirect(null, "예약 입금일을 선택하세요.");
return null;
}
if(filming_date == null) {
sqlSession.close();
web.redirect(null, "촬영 희망일을 선택하세요.");
return null;
}
if(filming_time == null) {
sqlSession.close();
web.redirect(null, "촬영 희망 시간을 선택하세요.");
return null;
}
/* (5) 전달받은 파라미터를 Beans 객체에 담는다 */
Booking booking = new Booking();
booking.setUserName(user_name);
booking.setTel(user_hp);
booking.setDepositName(deposit_name);
booking.setDepositDate(deposit_date);
booking.setPetName(pet_name);
booking.setPetGender(pet_gender);
booking.setPetAge(pet_age);
booking.setAdmissionAdult(admission_adult);
booking.setAdmissionChild(admission_child);
booking.setAdmissionPet(admission_pet);
booking.setFilmingDate(filming_date);
booking.setFilmingTime(filming_time);
booking.setCameraRental(camera_rental);
booking.setProfessionalFilming(professional_filming);
booking.setQuestionContent(question_content);
booking.setMemberId(1);
/* ================================================ 프로그램 연결시 주석 해제 ==============================================
Member loginInfo = (Member) web.getSession("loginInfo");
memberId = loginInfo.getId();
booking.setMemberId(memberId);*/
/* (6) Service를 통한 데이터베이스 저장 처리 */
try {
bookingService.insertBooking(booking);
} catch (Exception e) {
sqlSession.close();
web.redirect(null, e.getLocalizedMessage());
// 예외가 발생한 경우이므로, 더이상 진행하지 않는다.
return null;
}
/* (7) 예약신청 완료 후 예약현황로 이동 */
sqlSession.close();
web.redirect(web.getRootPath() + "/schedule/calendar.do", "예약신청이 완료되었습니다. 예약현황으로 이동 합니다.");
return null;
}
}
| [
"bluishreds@gmail.com"
] | bluishreds@gmail.com |
e675ed980286bde30e04a1581f0df6d6563797f1 | ad76806fc34e6bd8b1fea57b1534ff9a7bf369ac | /FusionAutomation/src/TestCases/CommonCrm/Test8.java | 2d71912f31ef6b3d29a54eaf4e199327fed08dee | [] | no_license | seqaAutomation/FusionAutomation | 5a246e5c3f1c827131f160694be75eb9a80c38bc | 8c0f45842b2845637f221acb40e0a79d11449cba | refs/heads/master | 2022-01-27T02:47:46.082129 | 2019-07-21T04:32:38 | 2019-07-21T04:32:38 | 197,877,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 601 | java | package TestCases.CommonCrm;
import org.testng.annotations.Test;
import com.relevantcodes.extentreports.LogStatus;
import TestEngine.Base;
import TestEngine.ReportCreator;
public class Test8 extends Base{
@Test
public void f() {
System.out.println("Started Test8");
System.out.println("End Test8");
type("test", ReportCreator.getTestName());
report.log("PASS", ReportCreator.getTestName());
// System.out.println(ReportCreator.getExtentTest());
// ReportCreator.getExtentTest().log(LogStatus.INFO, "Test4");
// type("test", "Test4");
// report.log("Pass", "Test4");
}
}
| [
"ejijo@ejijo-in.oradev.oraclecorp.com"
] | ejijo@ejijo-in.oradev.oraclecorp.com |
2a2b19df4dc8057d0f81aeb7a2f1f50a7dc68817 | 114fb922fda1a339a452c3e1a4ba031e81aabd7e | /src/main/java/no/ica/elfa/gui/handlers/BatchViewHandler.java | d01a8b017a657d47f030fe1624afda7a993355e4 | [] | no_license | abrekka/fraf | bfb788b0db784925c998dcc844957657efa79fae | f8995ff2b0fece657017224a112f79cf3eb11e7d | refs/heads/master | 2021-01-22T14:45:09.740555 | 2015-07-31T09:07:00 | 2015-07-31T09:07:00 | 39,994,857 | 0 | 0 | null | null | null | null | ISO-8859-15 | Java | false | false | 25,405 | java | package no.ica.elfa.gui.handlers;
import java.awt.event.ActionEvent;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.ListModel;
import no.ica.elfa.dao.pkg.InvoicePkgDAO;
import no.ica.elfa.gui.InvoicePrinter;
import no.ica.elfa.gui.InvoiceTableModel;
import no.ica.elfa.gui.buttons.CancelButton;
import no.ica.elfa.gui.buttons.Closeable;
import no.ica.elfa.model.ActionEnum;
import no.ica.elfa.model.Invoice;
import no.ica.elfa.service.E2bPkgManager;
import no.ica.elfa.service.FileSequenceManager;
import no.ica.elfa.service.InvoiceItemVManager;
import no.ica.elfa.service.InvoiceManager;
import no.ica.elfa.service.LazyLoadBatchEnum;
import no.ica.fraf.FrafException;
import no.ica.fraf.common.Booking;
import no.ica.fraf.common.ElfaBooking;
import no.ica.fraf.common.SystemEnum;
import no.ica.fraf.common.WindowInterface;
import no.ica.fraf.dao.BokfSelskapDAO;
import no.ica.fraf.dao.BuntDAO;
import no.ica.fraf.dao.BuntStatusDAO;
import no.ica.fraf.dao.DepartmentDAO;
import no.ica.fraf.dao.LaasDAO;
import no.ica.fraf.dao.LaasTypeDAO;
import no.ica.fraf.enums.BuntStatusEnum;
import no.ica.fraf.gui.FrafMain;
import no.ica.fraf.gui.model.BuntModel;
import no.ica.fraf.gui.model.interfaces.Threadable;
import no.ica.fraf.model.ApplUser;
import no.ica.fraf.model.BokfSelskap;
import no.ica.fraf.model.Bunt;
import no.ica.fraf.model.BuntStatus;
import no.ica.fraf.modules.ModuleFactory;
import no.ica.fraf.service.PaperManager;
import no.ica.fraf.util.ApplParamUtil;
import no.ica.fraf.util.GuiUtil;
import no.ica.fraf.util.ModelUtil;
import no.ica.fraf.util.ThreadCaller;
import no.ica.fraf.xml.EGetable;
import no.ica.fraf.xml.EGetableFactory;
import no.ica.fraf.xml.InvoiceColumnEnum;
import no.ica.fraf.xml.InvoiceManagerInterface;
import org.jdesktop.swingx.JXTable;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.jgoodies.binding.PresentationModel;
import com.jgoodies.binding.adapter.AbstractTableAdapter;
import com.jgoodies.binding.adapter.SingleListSelectionAdapter;
import com.jgoodies.binding.beans.PropertyAdapter;
import com.jgoodies.binding.list.ArrayListModel;
import com.jgoodies.binding.list.SelectionInList;
import com.jgoodies.binding.value.ValueModel;
/**
* Hjelpeklasse for visning av bunter
*
* @author abr99
*
*/
public class BatchViewHandler implements Closeable {
/**
*
*/
private final ArrayListModel buntList;
/**
*
*/
final SelectionInList buntSelectionList;
/**
*
*/
InvoiceManager invoiceManager;
/**
*
*/
E2bPkgManager e2bPkgManager;
/**
*
*/
private JButton buttonXml;
/**
*
*/
private JButton buttonPrint;
/**
*
*/
private JButton buttonBook;
/**
*
*/
private JButton buttonMakeInvoices;
/**
*
*/
private PresentationModel beanPresentationModel;
/**
*
*/
private ValueModel beanProperty = null;
/**
*
*/
final SelectionInList invoiceSelectionList;
/**
*
*/
final List<Invoice> invoiceList;
/**
*
*/
private InvoiceItemVManager invoiceItemVManager;
/**
*
*/
private BokfSelskapDAO bokfSelskapDAO;
/**
*
*/
//private EflowUsersVManager eflowUsersVManager;
/**
*
*/
JXTable tableInvoices;
/**
*
*/
JButton buttonShowInvoice;
/**
*
*/
private boolean frafAdmin;
BokfSelskap bokfSelskap;
/**
*
*/
no.ica.fraf.model.ApplUser frafApplUser;
private EGetableFactory eGetableFactory;
public BatchViewHandler(InvoiceManager aInvoiceManager,
E2bPkgManager aE2bPkgManager,
InvoiceItemVManager aInvoiceItemVManager,
BokfSelskapDAO aBokfSelskapDAO,
//EflowUsersVManager aEflowUsersVManager,
boolean isFrafAdm,
no.ica.fraf.model.ApplUser aFrafApplUser) {
frafApplUser = aFrafApplUser;
frafAdmin = isFrafAdm;
this.invoiceManager = aInvoiceManager;
this.e2bPkgManager = aE2bPkgManager;
this.invoiceItemVManager = aInvoiceItemVManager;
this.bokfSelskapDAO = aBokfSelskapDAO;
//eflowUsersVManager = aEflowUsersVManager;
BuntDAO buntDAO = (BuntDAO) ModelUtil.getBean("buntDAO");
bokfSelskap = bokfSelskapDAO.findByName("110");
List<Bunt> batches = buntDAO.findAllElfaBatches();
buntList = new ArrayListModel();
if (batches != null) {
for (Bunt bunt : batches) {
buntList.add(new BuntModel(bunt));
}
beanPresentationModel = new PresentationModel(buntList.get(0));
beanProperty = new PropertyAdapter(beanPresentationModel,
PresentationModel.PROPERTYNAME_BEAN);
}
buntSelectionList = new SelectionInList((ListModel) buntList,
beanProperty);
invoiceList = new ArrayList<Invoice>();
invoiceSelectionList = new SelectionInList(invoiceList);
Injector injector=Guice.createInjector(ModuleFactory.getModules());
eGetableFactory=injector.getInstance(EGetableFactory.class);
}
/**
* Oppdaterer buntliste fra database
*/
void refreshBatchList() {
BuntDAO buntDAO = (BuntDAO) ModelUtil.getBean("buntDAO");
List<Bunt> batches = buntDAO.findAllElfaBatches();
buntList.clear();
if (batches != null) {
for (Bunt bunt : batches) {
buntList.add(new BuntModel(bunt));
}
beanPresentationModel.setBean(buntList.get(0));
}
}
/**
* Lager tabell med bunter
*
* @return tabell
*/
public JXTable getTableBatch() {
JXTable table = new JXTable();
table.setModel(new BatchTableModel(buntSelectionList));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setSelectionModel(new SingleListSelectionAdapter(
buntSelectionList.getSelectionIndexHolder()));
table.setColumnControlVisible(true);
table.setSearchable(null);
table.setDragEnabled(false);
table.setShowGrid(true);
table.packAll();
buntSelectionList.clearSelection();
return table;
}
/**
* Lager tabell for faktura
*
* @return tabell
*/
public JXTable getTableInvoices() {
tableInvoices = new JXTable();
tableInvoices.setModel(new InvoiceTableModel(invoiceSelectionList));
tableInvoices.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
tableInvoices.setSelectionModel(new SingleListSelectionAdapter(
invoiceSelectionList.getSelectionIndexHolder()));
tableInvoices.setColumnControlVisible(true);
tableInvoices.setSearchable(null);
tableInvoices.setDragEnabled(false);
tableInvoices.setShowGrid(true);
tableInvoices.packAll();
return tableInvoices;
}
/**
* Lager knapp for visning av faktura
*
* @param window
* @return knapp
*/
public JButton getButtonShowInvoice(WindowInterface window) {
buttonShowInvoice = new JButton(new ShowInvoiceAction(window));
buttonShowInvoice.setEnabled(false);
invoiceSelectionList.addPropertyChangeListener(
SelectionInList.PROPERTYNAME_SELECTION_EMPTY,
new EmptySelectionListener());
return buttonShowInvoice;
}
/**
* Lager knapp for å bokføre bunt
*
* @param window
* @return knapp
*/
public JButton getButtonBook(WindowInterface window) {
buttonBook = new JButton(new BookAction(window));
buttonBook.setEnabled(false);
return buttonBook;
}
/**
* Lager knapp for å generere faktura
*
* @param window
* @return knapp
*/
public JButton getButtonMakeInvoices(WindowInterface window) {
buttonMakeInvoices = new JButton(new MakeInvoicesAction(window,
frafApplUser));
buttonMakeInvoices.setEnabled(false);
return buttonMakeInvoices;
}
/**
* Lager utskriftsknapp
*
* @param window
* @return knapp
*/
public JButton getButtonPrint(WindowInterface window) {
buttonPrint = new JButton(new PrintAction(window));
buttonPrint.setEnabled(false);
return buttonPrint;
}
/**
* Lager knapp for xml generering
*
* @param window
* @return knapp
*/
public JButton getButtonXml(WindowInterface window) {
buttonXml = new JButton(new XmlAction(window));
buttonXml.setEnabled(false);
return buttonXml;
}
/**
* Lager oppdateringsknapp
*
* @return knapp
*/
public JButton getButtonRefresh() {
return new JButton(new RefreshAction());
}
/**
* Lager avbrytknapp
*
* @param window
* @return knapp
*/
public JButton getButtonCancel(WindowInterface window) {
return new CancelButton(window, this);
}
/**
* Initierer hendelsehåndtering
*/
public void initEventHandling() {
buntSelectionList.addPropertyChangeListener(
SelectionInList.PROPERTYNAME_SELECTION_INDEX,
new SelectionHandler());
}
/**
* Tabellmodell for bunttabell
*
* @author abr99
*
*/
private static final class BatchTableModel extends AbstractTableAdapter {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private static String[] COLUMNS = { "Id", "Opprettet", "Opprettet av",
"Fra dato", "Til dato", "Status", "Filnavn" };
/**
*
*/
private static final SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyyMMdd");
/**
* @param listModel
*/
public BatchTableModel(ListModel listModel) {
super(listModel, COLUMNS);
}
/**
* Henter verdi
*
* @param rowIndex
* @param columnIndex
* @return verdi
*/
public Object getValueAt(int rowIndex, int columnIndex) {
BuntModel buntModel = (BuntModel) getRow(rowIndex);
switch (columnIndex) {
case 0:
return buntModel.getBuntId();
case 1:
return dateFormat.format(buntModel.getCreatedDate());
case 2:
return buntModel.getApplUser();
case 3:
if (buntModel.getFraDato() != null) {
return dateFormat.format(buntModel.getFraDato());
}
return null;
case 4:
if (buntModel.getTilDato() != null) {
return dateFormat.format(buntModel.getTilDato());
}
return null;
case 5:
return buntModel.getBuntStatus();
case 6:
return buntModel.getFileName();
default:
throw new IllegalStateException("Unknown column");
}
}
}
/**
* Håndterer bokføring av bunt
*
* @author abr99
*
*/
private class BookAction extends AbstractAction implements ThreadCaller {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private WindowInterface window;
/**
* @param aWindow
*/
public BookAction(WindowInterface aWindow) {
super("Bokfør");
window = aWindow;
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
BuntModel buntModel = (BuntModel) buntSelectionList.getSelection();
Bunt bunt = buntModel.getBunt();
ElfaBooking elfaBooking = new ElfaBooking();
FileSequenceManager fileSequenceManager = (FileSequenceManager) ModelUtil
.getBean("elfaFileSequenceManager");
BuntDAO buntDAO = (BuntDAO) ModelUtil.getBean("buntDAO");
BuntStatusDAO buntStatusDAO = (BuntStatusDAO) ModelUtil
.getBean("buntStatusDAO");
if (bunt != null) {
GuiUtil.runInThreadWheel(window.getRootPane(), new Booking(
bunt, window, buntDAO, elfaBooking, buntStatusDAO,
fileSequenceManager, this, SystemEnum.ELFA,
frafApplUser), null);
}
}
/**
* @see no.ica.fraf.util.ThreadCaller#updateEnablement()
*/
public void updateEnablement() {
}
}
/**
* Skriver ut
*
* @param window
* @param invoice
*/
void doPrint(WindowInterface window, Invoice invoice) {
if (invoice != null) {
GuiUtil.runInThreadWheel(window.getRootPane(), new InvoicePrinter(
invoice, invoiceItemVManager, bokfSelskap), null);
} else {
BuntModel buntModel = (BuntModel) buntSelectionList.getSelection();
if (buntModel != null) {
Bunt bunt = buntModel.getBunt();
BuntDAO buntDAO = (BuntDAO) ModelUtil.getBean("buntDAO");
GuiUtil.runInThreadWheel(window.getRootPane(),
new InvoicePrinter(bunt, window, buntDAO,
invoiceItemVManager, bokfSelskap), null);
}
}
}
/**
* Håndterer utskrift
*
* @author abr99
*
*/
private class PrintAction extends AbstractAction {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private WindowInterface window;
/**
* @param aWindow
*/
public PrintAction(WindowInterface aWindow) {
super("Skriv ut");
window = aWindow;
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
doPrint(window, null);
}
}
/**
* Håndterer xml-generering
*
* @author abr99
*
*/
private class XmlAction extends AbstractAction {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private WindowInterface window;
/**
* @param aWindow
*/
public XmlAction(WindowInterface aWindow) {
super("Lag XML");
window = aWindow;
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
GuiUtil.runInThreadWheel(window.getRootPane(), new XmlGenerator(
window), null);
}
}
/**
* Håndterer generering av faktura
*
* @author abr99
*
*/
private class MakeInvoicesAction extends AbstractAction {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private WindowInterface window;
/**
*
*/
private ApplUser applUser1;
/**
* @param aWindow
* @param aApplUser
*/
public MakeInvoicesAction(WindowInterface aWindow, ApplUser aApplUser) {
super("Lag fakturaer");
window = aWindow;
applUser1 = aApplUser;
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
GuiUtil.runInThreadWheel(window.getRootPane(),
new CreditInvoiceGenerator(window, applUser1), null);
}
}
/**
* @see no.ica.elfa.gui.buttons.Closeable#canClose(java.lang.String)
*/
public boolean canClose(String actionString) {
return true;
}
/**
* Håndterer oppdatering
*
* @author abr99
*
*/
private class RefreshAction extends AbstractAction {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
public RefreshAction() {
super("Oppdater");
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
refreshBatchList();
}
}
/**
* Enabler/disabler knapper
*/
void updateActionEnablement() {
buttonXml.setEnabled(false);
buttonPrint.setEnabled(false);
buttonBook.setEnabled(false);
buttonMakeInvoices.setEnabled(false);
BuntModel buntModel = (BuntModel) buntSelectionList.getSelection();
if (buntModel != null) {
if (buntModel.getBuntStatus().getBuntStatusId() > 1) {
buttonPrint.setEnabled(true);
}
if (buntModel.getBuntStatus().getBeskrivelse().equalsIgnoreCase(
"Fakturert")
&& frafAdmin) {
buttonXml.setEnabled(true);
buttonBook.setEnabled(true);
}
if (buntModel.getBuntStatus().getBeskrivelse().equalsIgnoreCase(
"Xml")
&& frafAdmin) {
buttonBook.setEnabled(true);
}
if (buntModel.getBuntStatus().getBeskrivelse().equalsIgnoreCase(
"Bokført")
&& frafAdmin) {
buttonXml.setEnabled(true);
}
if (buntModel.getBuntStatus().getBeskrivelse().equalsIgnoreCase(
"Importert")
&& frafAdmin) {
buttonMakeInvoices.setEnabled(true);
}
}
}
/**
* Håndterer valg i tabell
*
* @author abr99
*
*/
private class SelectionHandler implements PropertyChangeListener {
/**
* @param evt
*/
public void propertyChange(@SuppressWarnings("unused")
PropertyChangeEvent evt) {
updateActionEnablement();
}
}
/**
* Generer xml
*
* @author abr99
*
*/
private class XmlGenerator implements Threadable {
/**
*
*/
private WindowInterface window;
/**
* @param aWindow
*/
public XmlGenerator(WindowInterface aWindow) {
window = aWindow;
}
/**
* @see no.ica.fraf.gui.model.interfaces.Threadable#enableComponents(boolean)
*/
public void enableComponents(boolean enable) {
}
/**
* @see no.ica.fraf.gui.model.interfaces.Threadable#doWork(java.lang.Object[],
* javax.swing.JLabel)
*/
public Object doWork(Object[] params, JLabel labelInfo) {
labelInfo.setText("Genererer XML-fil...");
//InvoiceCreator invoiceCreator = new ElfaInvoiceCreator();
//InvoiceCreator invoiceCreator = new InvoiceCreatorFactoryImpl().create(SystemEnum.ELFA, invoiceManager, bokfSelskap, null, null);
final BuntModel buntModel = (BuntModel) buntSelectionList
.getSelection();
String errorString = null;
try {
String exportPath = ApplParamUtil
.getStringParam("eget_export_path");
if (FrafMain.getInstance().isTest()) {
exportPath += "/test/";
}
/*final EGet eget = new EGet(exportPath,true, invoiceManager,
e2bPkgManager,true, frafApplUser);*/
//EflowUsersVManager eflowUsersVManager = (EflowUsersVManager) ModelUtil.getBean("eflowUsersVManager");
DepartmentDAO departmentDAO = (DepartmentDAO) ModelUtil.getBean(DepartmentDAO.DAO_NAME);
LaasTypeDAO laasTypeDAO = (LaasTypeDAO) ModelUtil.getBean("laasTypeDAO");
LaasDAO laasDAO = (LaasDAO) ModelUtil.getBean("laasDAO");
String onakaDir = ApplParamUtil.getStringParam("onaka_path");
PaperManager paperManager=(PaperManager)ModelUtil.getBean(PaperManager.MANAGER_NAME);
InvoiceManagerInterface invoiceManagerInterface=(InvoiceManager)ModelUtil.getBean(InvoiceManager.MANAGER_NAME);
//final EGetable eget = new EGetableFactoryImpl().getInstance(exportPath,invoiceManager,e2bPkgManager,frafApplUser,paperManager,InvoiceColumnEnum.getOrderColumn(window),new Locking(laasTypeDAO,laasDAO),departmentDAO,onakaDir);
final EGetable eget = eGetableFactory.getInstance(exportPath,frafApplUser,InvoiceColumnEnum.getOrderColumn(window),SystemEnum.ELFA,bokfSelskap,invoiceManagerInterface);
errorString = eget.createEgetDocument(buntModel.getBunt(),
labelInfo,
//invoiceCreator,
window);
if (errorString == null || errorString.length() == 0) {
BuntStatusDAO buntStatusDAO = (BuntStatusDAO) ModelUtil
.getBean("buntStatusDAO");
BuntDAO buntDAO = (BuntDAO) ModelUtil.getBean("buntDAO");
BuntStatus status = (BuntStatus) buntStatusDAO
.findStatus(buntModel.getBunt().getBuntStatus(),
ActionEnum.XML);
// fjernes når versjon 2.0.6 er lagt ut i prod
if (status == null) {
status = buntStatusDAO
.findByKode(BuntStatusEnum.XML);
}
buntModel.getBunt().setBuntStatus(status);
buntDAO.saveBunt(buntModel.getBunt());
}
} catch (FrafException e) {
e.printStackTrace();
errorString = e.getMessage();
}
return errorString;
}
/**
* @see no.ica.fraf.gui.model.interfaces.Threadable#doWhenFinished(java.lang.Object)
*/
public void doWhenFinished(Object object) {
if (object != null && object.toString().length() != 0) {
GuiUtil.showErrorMsgDialog(window.getComponent(), "Feil",
object.toString());
}
updateActionEnablement();
}
}
/**
* Generer faktura
*
* @author abr99
*
*/
private class CreditInvoiceGenerator implements Threadable {
/**
*
*/
private WindowInterface window;
/**
*
*/
private ApplUser applUser1;
/**
* @param aWindow
* @param aApplUser
*/
public CreditInvoiceGenerator(WindowInterface aWindow,
ApplUser aApplUser) {
window = aWindow;
applUser1 = aApplUser;
}
/**
* @see no.ica.fraf.gui.model.interfaces.Threadable#enableComponents(boolean)
*/
public void enableComponents(boolean enable) {
}
/**
* @see no.ica.fraf.gui.model.interfaces.Threadable#doWork(java.lang.Object[],
* javax.swing.JLabel)
*/
public Object doWork(Object[] params, JLabel labelInfo) {
final BuntModel buntModel = (BuntModel) buntSelectionList
.getSelection();
String error = null;
if (buntModel != null) {
labelInfo.setText("Fakturerer");
try {
InvoicePkgDAO invoicePkgDAO = (InvoicePkgDAO) ModelUtil
.getBean("invoicePkgDAO");
invoicePkgDAO.generateCredit(applUser1, buntModel
.getBuntId(), null);
} catch (RuntimeException e) {
error = GuiUtil.getUserExceptionMsg(e);
e.printStackTrace();
}
}
return error;
}
/**
* @see no.ica.fraf.gui.model.interfaces.Threadable#doWhenFinished(java.lang.Object)
*/
public void doWhenFinished(Object object) {
if (object != null && object.toString().length() != 0) {
GuiUtil.showErrorMsgDialog(window.getComponent(), "Feil",
object.toString());
}
refreshBatchList();
updateActionEnablement();
}
}
/**
* Henter klasse som håndterer lytting på fakturakomponent
*
* @param window
* @return lytter
*/
public ComponentListener getInvoiceComponentListener(WindowInterface window) {
return new InvoiceComponentListener(window);
}
/**
* Håndterer aktivering av fakturapanel
*
* @author abr99
*
*/
private class InvoiceComponentListener extends ComponentAdapter {
/**
*
*/
private BuntModel lastBuntModel;
/**
*
*/
private WindowInterface window;
/**
* @param aWindow
*/
public InvoiceComponentListener(WindowInterface aWindow) {
window = aWindow;
}
/**
* @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
*/
@Override
public void componentShown(ComponentEvent evt) {
BuntModel buntModel = (BuntModel) buntSelectionList.getSelection();
if (lastBuntModel == null || !lastBuntModel.equals(buntModel)) {
lastBuntModel = buntModel;
if (buntModel != null) {
GuiUtil.runInThreadWheel(window.getRootPane(),
new InvoiceLoader(buntModel), null);
}
}
}
}
/**
* Håndterer lasting av fakturaer
*
* @author abr99
*
*/
private class InvoiceLoader implements Threadable {
/**
*
*/
private BuntModel buntModel;
public InvoiceLoader(BuntModel aBuntModel) {
buntModel = aBuntModel;
}
/**
* @see no.ica.fraf.gui.model.interfaces.Threadable#enableComponents(boolean)
*/
public void enableComponents(boolean enable) {
}
/**
* @see no.ica.fraf.gui.model.interfaces.Threadable#doWork(java.lang.Object[],
* javax.swing.JLabel)
*/
public Object doWork(Object[] params, JLabel labelInfo) {
labelInfo.setText("Laster fakturaer");
BuntDAO buntDAO = (BuntDAO) ModelUtil.getBean("buntDAO");
buntDAO
.lazyLoadBatch(
buntModel.getBunt(),
new LazyLoadBatchEnum[] { LazyLoadBatchEnum.ELFA_INVOICES });
invoiceList.clear();
if (buntModel.getInvoices() != null) {
invoiceList.addAll(buntModel.getInvoices());
}
tableInvoices.packAll();
return null;
}
/**
* @see no.ica.fraf.gui.model.interfaces.Threadable#doWhenFinished(java.lang.Object)
*/
public void doWhenFinished(Object object) {
}
}
/**
* Håndtere selektering i tabell
*
* @author abr99
*
*/
private class EmptySelectionListener implements PropertyChangeListener {
/**
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent arg0) {
buttonShowInvoice.setEnabled(invoiceSelectionList.hasSelection());
}
}
/**
* Håndterer visning av faktura
*
* @author abr99
*
*/
private class ShowInvoiceAction extends AbstractAction {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private WindowInterface window;
/**
* @param aWindow
*/
public ShowInvoiceAction(WindowInterface aWindow) {
super("Vis faktura...");
window = aWindow;
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
Invoice invoice = (Invoice) invoiceSelectionList
.getElementAt(tableInvoices
.convertRowIndexToModel(invoiceSelectionList
.getSelectionIndex()));
if (invoice != null) {
doPrint(window, invoice);
}
}
}
}
| [
"atle@brekka.no"
] | atle@brekka.no |
e83e43638e181c3a8671e2ac34191252c76022ee | f45d73f315d697e5aedce0d2a7ae11abd2321e68 | /app/build/generated/source/r/debug/android/support/coreui/R.java | 4d2454e2156cb9665cd93e5ec498e8a57206d541 | [] | no_license | wenguanghua/logBatteryLife | 69ee696459eea8212623e23c9c1f21c38c41241f | 4d66dccd7767b174333663d67ad601078604c269 | refs/heads/master | 2020-04-05T20:29:53.055606 | 2018-11-16T02:35:28 | 2018-11-16T02:35:28 | 157,182,886 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,610 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.coreui;
public final class R {
public static final class attr {
public static final int font = 0x7f030070;
public static final int fontProviderAuthority = 0x7f030072;
public static final int fontProviderCerts = 0x7f030073;
public static final int fontProviderFetchStrategy = 0x7f030074;
public static final int fontProviderFetchTimeout = 0x7f030075;
public static final int fontProviderPackage = 0x7f030076;
public static final int fontProviderQuery = 0x7f030077;
public static final int fontStyle = 0x7f030078;
public static final int fontWeight = 0x7f030079;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f040000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f05003e;
public static final int notification_icon_bg_color = 0x7f05003f;
public static final int ripple_material_light = 0x7f05004a;
public static final int secondary_text_default_material_light = 0x7f05004c;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f06004a;
public static final int compat_button_inset_vertical_material = 0x7f06004b;
public static final int compat_button_padding_horizontal_material = 0x7f06004c;
public static final int compat_button_padding_vertical_material = 0x7f06004d;
public static final int compat_control_corner_material = 0x7f06004e;
public static final int notification_action_icon_size = 0x7f060058;
public static final int notification_action_text_size = 0x7f060059;
public static final int notification_big_circle_margin = 0x7f06005a;
public static final int notification_content_margin_start = 0x7f06005b;
public static final int notification_large_icon_height = 0x7f06005c;
public static final int notification_large_icon_width = 0x7f06005d;
public static final int notification_main_column_padding_top = 0x7f06005e;
public static final int notification_media_narrow_margin = 0x7f06005f;
public static final int notification_right_icon_size = 0x7f060060;
public static final int notification_right_side_padding_top = 0x7f060061;
public static final int notification_small_icon_background_padding = 0x7f060062;
public static final int notification_small_icon_size_as_large = 0x7f060063;
public static final int notification_subtext_size = 0x7f060064;
public static final int notification_top_pad = 0x7f060065;
public static final int notification_top_pad_large_text = 0x7f060066;
}
public static final class drawable {
public static final int notification_action_background = 0x7f070058;
public static final int notification_bg = 0x7f070059;
public static final int notification_bg_low = 0x7f07005a;
public static final int notification_bg_low_normal = 0x7f07005b;
public static final int notification_bg_low_pressed = 0x7f07005c;
public static final int notification_bg_normal = 0x7f07005d;
public static final int notification_bg_normal_pressed = 0x7f07005e;
public static final int notification_icon_background = 0x7f07005f;
public static final int notification_template_icon_bg = 0x7f070060;
public static final int notification_template_icon_low_bg = 0x7f070061;
public static final int notification_tile_bg = 0x7f070062;
public static final int notify_panel_notification_icon_bg = 0x7f070063;
}
public static final class id {
public static final int action_container = 0x7f08000e;
public static final int action_divider = 0x7f080010;
public static final int action_image = 0x7f080011;
public static final int action_text = 0x7f080017;
public static final int actions = 0x7f080018;
public static final int async = 0x7f08001e;
public static final int blocking = 0x7f080021;
public static final int chronometer = 0x7f080028;
public static final int forever = 0x7f080035;
public static final int icon = 0x7f080038;
public static final int icon_group = 0x7f080039;
public static final int info = 0x7f08003c;
public static final int italic = 0x7f08003d;
public static final int line1 = 0x7f08003e;
public static final int line3 = 0x7f08003f;
public static final int normal = 0x7f080049;
public static final int notification_background = 0x7f08004a;
public static final int notification_main_column = 0x7f08004b;
public static final int notification_main_column_container = 0x7f08004c;
public static final int right_icon = 0x7f080053;
public static final int right_side = 0x7f080054;
public static final int text = 0x7f080073;
public static final int text2 = 0x7f080074;
public static final int time = 0x7f08008e;
public static final int title = 0x7f08008f;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f090004;
}
public static final class layout {
public static final int notification_action = 0x7f0a001d;
public static final int notification_action_tombstone = 0x7f0a001e;
public static final int notification_template_custom_big = 0x7f0a0025;
public static final int notification_template_icon_group = 0x7f0a0026;
public static final int notification_template_part_chronometer = 0x7f0a002a;
public static final int notification_template_part_time = 0x7f0a002b;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0d0028;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0e00fa;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0e00fb;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e00fd;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0e0100;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0e0102;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0e016b;
public static final int Widget_Compat_NotificationActionText = 0x7f0e016c;
}
public static final class styleable {
public static final int[] FontFamily = { 0x7f030072, 0x7f030073, 0x7f030074, 0x7f030075, 0x7f030076, 0x7f030077 };
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 = { 0x7f030070, 0x7f030078, 0x7f030079 };
public static final int FontFamilyFont_font = 0;
public static final int FontFamilyFont_fontStyle = 1;
public static final int FontFamilyFont_fontWeight = 2;
}
}
| [
"wen.guanghua@optp.co.jp"
] | wen.guanghua@optp.co.jp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.