blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
455c437ca6c0c4a080f1ee3119314fa0cd2b18e3 | 410c3edff13b40190e3ef38aa60a42a4efc4ad67 | /base/src/main/java/io/vproxy/vfd/windows/WindowsFDs.java | 505a7e7a6d969709d5c1e7762af06ae8ab697b05 | [
"MIT"
] | permissive | wkgcass/vproxy | f3d783531688676932f60f3df57e89ddabf3f720 | 6c891d43d6b9f2d2980a7d4feee124b054fbfdb5 | refs/heads/dev | 2023-08-09T04:03:10.839390 | 2023-07-31T08:28:56 | 2023-08-04T12:04:11 | 166,255,932 | 129 | 53 | MIT | 2022-09-15T08:35:53 | 2019-01-17T16:14:58 | Java | UTF-8 | Java | false | false | 4,170 | java | package io.vproxy.vfd.windows;
import io.vproxy.base.util.Logger;
import io.vproxy.base.util.Utils;
import io.vproxy.vfd.*;
import io.vproxy.vfd.jdk.ChannelFDs;
import io.vproxy.vfd.posix.Posix;
import java.io.IOException;
import java.lang.reflect.Proxy;
public class WindowsFDs implements FDs, FDsWithTap {
private final ChannelFDs channelFDs;
private final Windows windows;
public WindowsFDs() {
channelFDs = ChannelFDs.get();
assert VFDConfig.vfdlibname != null;
String lib = VFDConfig.vfdlibname;
try {
Utils.loadDynamicLibrary(lib);
} catch (UnsatisfiedLinkError e) {
System.out.println(lib + " not found, requires lib" + lib + ".dylib or lib" + lib + ".so or " + lib + ".dll on java.library.path");
e.printStackTrace(System.out);
Utils.exit(1);
}
if (VFDConfig.vfdtrace) {
// make it difficult for graalvm native image initializer to detect the Posix.class
// however we cannot use -Dvfdtrace=1 flag when using native image
String clsStr = this.getClass().getPackage().getName() + "." + this.getClass().getSimpleName().substring(0, "Windows".length());
// clsStr should be vfd.posix.Posix
Class<?> cls;
try {
cls = Class.forName(clsStr);
} catch (ClassNotFoundException e) {
// should not happen
throw new RuntimeException(e);
}
windows = (Windows) Proxy.newProxyInstance(Posix.class.getClassLoader(), new Class[]{cls}, new TraceInvocationHandler(new GeneralWindows()));
} else {
windows = new GeneralWindows();
}
}
@Override
public SocketFD openSocketFD() throws IOException {
return channelFDs.openSocketFD();
}
@Override
public ServerSocketFD openServerSocketFD() throws IOException {
return channelFDs.openServerSocketFD();
}
@Override
public DatagramFD openDatagramFD() throws IOException {
return channelFDs.openDatagramFD();
}
@Override
public FDSelector openSelector() throws IOException {
return channelFDs.openSelector();
}
@Override
public long currentTimeMillis() {
return channelFDs.currentTimeMillis();
}
@Override
public boolean isV4V6DualStack() {
return true;
}
@Override
public TapDatagramFD openTap(String dev) throws IOException {
long handle = windows.createTapHandle(dev);
long readOverlapped;
try {
readOverlapped = windows.allocateOverlapped();
} catch (IOException e) {
try {
windows.closeHandle(handle);
} catch (Throwable t) {
Logger.shouldNotHappen("close handle " + handle + " failed when allocating readOverlapped failed", t);
}
throw e;
}
long writeOverlapped;
try {
writeOverlapped = windows.allocateOverlapped();
} catch (IOException e) {
try {
windows.closeHandle(handle);
} catch (Throwable t) {
Logger.shouldNotHappen("close handle " + handle + " failed when allocating writeOverlapped failed", t);
}
try {
windows.releaseOverlapped(readOverlapped);
} catch (Throwable t) {
Logger.shouldNotHappen("releasing readOverlapped " + readOverlapped + " failed when allocating writeOverlapped failed", t);
}
throw e;
}
return new WindowsTapDatagramFD(windows, handle, new TapInfo(dev, (int) handle), readOverlapped, writeOverlapped);
}
@Override
public boolean tapNonBlockingSupported() throws IOException {
return windows.tapNonBlockingSupported();
}
@Override
public TapDatagramFD openTun(String devPattern) throws IOException {
throw new IOException("tun unsupported");
}
@Override
public boolean tunNonBlockingSupported() throws IOException {
throw new IOException("tun unsupported");
}
}
| [
"[email protected]"
] | |
be47a172206105c28f5a6fa47ccd3fa807354c54 | eb858f8e0782c9e6844377e9aa72f352cba3ad2c | /src/main/java/ydw/services/TuitionCalculatorNationalImpl.java | 769437b90924a84e8d96216659a15e5f06629c4e | [] | no_license | davidye811/CS548_HW | 984a1866cb72280a5f305c8e77ea401bf121d824 | f5013167a6ca4be31541261b4a6c1372534641af | refs/heads/master | 2021-07-18T05:46:04.195746 | 2017-10-23T06:03:04 | 2017-10-23T06:03:04 | 107,938,165 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,322 | java | package ydw.services;
import java.util.List;
import org.springframework.stereotype.Component;
import ydw.domain.Course;
import ydw.domain.Student;
import ydw.services.TuitionCalculatorService;
@Component("TuitionCalculatorNational")
public class TuitionCalculatorNationalImpl implements TuitionCalculatorService {
double totalPrices;
int totalUnits;
public double getTotalPrices() {
return totalPrices;
}
public void setTotalPrices(double totalPrices) {
this.totalPrices = totalPrices;
}
public int getTotalUnits() {
return totalUnits;
}
public void setTotalUnits(int totalUnits) {
this.totalUnits = totalUnits;
}
public int getChemicalUnits() {
return chemicalUnits;
}
public void setChemicalUnits(int chemicalUnits) {
this.chemicalUnits = chemicalUnits;
}
int chemicalUnits;
public double computeTutition(Student student, List<Course> courses) {
// TODO Auto-generated method stub
totalPrices=0.0;
totalUnits = 0;
chemicalUnits=0;
for(Course course:courses){
if(course.getDepartmentName()=="Chemistry"){
chemicalUnits+=course.getNumberOfUnit();
}
totalUnits+=course.getNumberOfUnit();
}
totalPrices+=chemicalUnits*50.0;
if(student.isInternational()){
return totalPrices+totalUnits*500.0;
}else{
return totalPrices+totalUnits*230.0;
}
}
}
| [
"[email protected]"
] | |
1c39a9e9f19d64109a64f39bac09ed15fae7959c | acde8cfd552f63a3087f7a50bd82570d7c0c4209 | /src/main/java/com/merit/assignment6/exceptions/copy/ExceedsCombinedBalanceLimitException.java | 0115ef9720a32894f765d072da5e9f396ee96529 | [] | no_license | lifefromashes/assignment6_updates | c8ffbd41edfa07de83be1ce3cb5d8c4acff3c749 | c68d356fd98f1a122c55c9e9e2b9a581cec3a5b9 | refs/heads/master | 2022-07-18T11:15:41.549868 | 2020-05-16T20:34:08 | 2020-05-16T20:34:08 | 264,521,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.merit.assignment6.exceptions.copy;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.NOT_FOUND)
public class ExceedsCombinedBalanceLimitException extends Exception {
public ExceedsCombinedBalanceLimitException(String msg) {
super(msg);
}
}
| [
"[email protected]"
] | |
b2ce1d04c2c75e12b5d307caf4dc8102be7d5635 | 344c15ec4918269b972fdc520d25d5739f5f12b3 | /Java I Primeiros passos/Aula4/src/exercicio4/Funcionario.java | 736524ac1570d362e0f06ff0a30b04a786996223 | [] | no_license | ordnaelmedeiros/alura | ffe63ea17d64abf2288c041d6a2f98cbe7775fe3 | 199f48b8338022f93ff85de8e4a93291eeda113e | refs/heads/master | 2020-04-09T04:59:17.872037 | 2018-08-29T09:19:24 | 2018-08-29T09:19:24 | 60,308,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 117 | java | package exercicio4;
public class Funcionario {
int salario;
void mostra() {
System.out.println(salario);
}
}
| [
"[email protected]"
] | |
56162b319401cddf1a76b7aeea6409b3a4296f81 | 4fde206d2b86e7426677db808c91fa590840bb03 | /src/notusedclasses/MyPanel.java | fcbfc812a991c0fa4fcf4cdc5c7f6d95379ac1ea | [] | no_license | helghast79/WheelOfDeath | feccea640c56aa125b825925656ee698a90632a8 | 4e36f052bb14a7589d5e7835f18b8fc7ba17ea48 | refs/heads/master | 2021-01-10T11:36:22.207635 | 2016-04-28T12:06:31 | 2016-04-28T12:06:31 | 55,557,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,212 | java | package notusedclasses;
import javax.swing.*;
import javax.swing.text.FlowView;
import java.awt.*;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
/**
* Created by macha on 14/03/2016.
*/
public class MyPanel extends JPanel{
private String text;
private Graphics2D g2;
public MyPanel(String text)
{
this.text=text;
}
public void paint(Graphics g){
Graphics2D g2 = (Graphics2D) g; // local variable not an instance one
g2.setColor(Color.green);
int x= 50;
int y = 50;
int angle = 45;
g2.translate((float)x,(float)y);
g2.rotate(Math.toRadians(angle));
g2.drawString(text,0,0);
g2.rotate(-Math.toRadians(angle));
g2.translate(-(float)x,-(float)y);
}
@Override
public void paintComponent(Graphics g)
{
g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
String s = text;
Font font = new Font("Serif", Font.PLAIN, 24);
FontRenderContext frc = g2.getFontRenderContext();
g2.translate(40, 80);
GlyphVector gv = font.createGlyphVector(frc, s);
int length = gv.getNumGlyphs();
for (int i = 0; i < length; i++) {
Point2D p = gv.getGlyphPosition(i);
double theta = 0;//(double) i / (double) (length - 1) * Math.PI / 4;
AffineTransform at = AffineTransform.getTranslateInstance(p.getX(),
p.getY());
at.rotate(theta);
Shape glyph = gv.getGlyphOutline(i);
Shape transformedGlyph = at.createTransformedShape(glyph);
g2.fill(transformedGlyph);
}
}
public void drawRotate(double x, double y, int angle, String text)
{
g2.translate((float)x,(float)y);
g2.rotate(Math.toRadians(angle));
g2.drawString(text,0,0);
g2.rotate(-Math.toRadians(angle));
g2.translate(-(float)x,-(float)y);
}
}
| [
"[email protected]"
] | |
c1450ca20f832a3dced05b78da8f88a9602321a3 | c470426361a33e5a9b1e222cffc22fff06982beb | /webshelf-business/src/main/java/org/webshelf/business/data/CassandraCluster.java | ccbc5a6c9f2eae7bdef3f84cb6ad7adcd638a7a0 | [
"Apache-2.0"
] | permissive | monteirocicero/webshelf | 16d8db0890c5b47669b586c1b15dfa2e01e20296 | ca066541d962ba8e260576b77a59794c7da1f324 | refs/heads/master | 2021-01-19T05:15:56.679314 | 2016-08-17T00:53:46 | 2016-08-17T00:53:46 | 63,489,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,562 | java | package org.webshelf.business.data;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.Lock;
import javax.ejb.LockType;
import javax.ejb.Singleton;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import org.webshelf.business.model.User;
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.Statement;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.MappingManager;
@Singleton
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class CassandraCluster {
private Cluster cluster;
private Session session;
private MappingManager mappingManager;
private Map<String, PreparedStatement> preparedStatementCache = new HashMap();
@PostConstruct
public void init() {
this.cluster = Cluster.builder().addContactPoint("localhost").build();
this.session = cluster.connect();
this.mappingManager = new MappingManager(session);
}
private BoundStatement prepare(String cql) {
if (!preparedStatementCache.containsKey(cql)) {
this.preparedStatementCache.put(cql, session.prepare(cql));
}
return this.preparedStatementCache.get(cql).bind();
}
@Lock(LockType.READ)
public ResultSet execute(Statement stmt) {
return session.execute(stmt);
}
public BoundStatement boundInsertUser() {
return prepare("INSERT INTO webshelf.user(isbn, title, password) VALUES (?, ?, ?) IF NOT EXISTS;");
}
public BoundStatement boundInsertBookByISBN() {
return prepare("INSERT INTO webshelf.book_by_isbn(isbn, title, author, country, publisher, image) VALUES (?, ?, ?, ?, ?, ?) IF NOT EXISTS;");
}
public BoundStatement boundInsertBookByTitle() {
return prepare("INSERT INTO webshelf.book_by_title(isbn, title, author, country, publisher, image) VALUES (?, ?, ?, ?, ?, ?) IF NOT EXISTS;");
}
public BoundStatement boundInsertBookByAuthor() {
return prepare("INSERT INTO webshelf.book_by_author(isbn, title, author, country, publisher, image) VALUES (?, ?, ?, ?, ?, ?) IF NOT EXISTS;");
}
public Mapper<User> mapper(Class<User> clazz) {
return mappingManager.mapper(clazz);
}
@PreDestroy
public void destroy() {
this.session.close();
this.cluster.close();
}
}
| [
"[email protected]"
] | |
9122263cd423da62d91e822b22f7c5b788d53709 | 479f01152146181f9c582719f08a8018c2a748a8 | /List5/src/main/java/com/inter/admin/AdminController.java | d4f710f20a340252dd89bda438bb41baaf75dcdf | [] | no_license | YeonWooSeong/set19 | c78107834860bba738e7be86c68944a012875910 | 587c6ff71e6b4a29654406ee31210a33f4bd3419 | refs/heads/master | 2021-05-30T12:07:17.791847 | 2016-02-25T08:05:45 | 2016-02-25T08:05:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,658 | java | package com.inter.admin;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.bind.support.SessionStatus;
import com.inter.app.ArticleServiceImpl;
import com.inter.app.ArticleVO;
import com.inter.member.MemberServiceImpl;
import com.inter.member.MemberVO;
@Controller
@SessionAttributes("admin")
@RequestMapping("/admin")
public class AdminController {
private static final Logger logger = LoggerFactory.getLogger(AdminController.class);
@Autowired MemberVO member;
@Autowired ArticleVO article;
@Autowired MemberServiceImpl memberService;
@Autowired AdminServiceImpl adminService;
@Autowired ArticleServiceImpl articleService;
@RequestMapping("")
public String home(){
logger.info("AdminController-login() 진입");
System.out.println("ㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁㅁ");
return "admin/admin/login.tiles";
}
@RequestMapping("/main")
public String main(){
logger.info("AdminController-home() 진입");
return "admin/admin/main.tiles";
}
@RequestMapping("/member")
public String member(Model model){
logger.info("AdminController-home() 진입");
List<MemberVO> members = adminService.getMemberList();
model.addAttribute("list", members);
return "admin/admin/member.tiles";
}
@RequestMapping("/chart")
public String chart(){
logger.info("AdminController-home() 진입");
return "admin/admin/chart.tiles";
}
@RequestMapping("/board")
public String board(Model model){
logger.info("AdminController-home() 진입");
List<ArticleVO> articles = articleService.getAllList();
model.addAttribute("list", articles);
return "admin/admin/board.tiles";
}
@RequestMapping("/member_list")
public void memberList(
Model model
){
List<MemberVO> members = adminService.getMemberList();
model.addAttribute("list", members);
}
@RequestMapping("/member_profile")
public Model memberProfile(
String id,Model model
){
logger.info("개인 프로필 진입");
logger.info("가져온 아이디{}",id);
member = memberService.selectById(id);
model.addAttribute("member", member);
return model;
}
@RequestMapping("/insert")
public void insert(
@RequestParam("id") String id,
@RequestParam("password") String password,
String email, String phone, Model model){
logger.info("insert 진입");
logger.info("id{}",id);
logger.info("password{}",password);
logger.info("email{}",email);
logger.info("phone{}",phone);
member = memberService.selectById(id);
member.setPassword(password);
member.setEmail(email);
member.setPhone(phone);
int result = memberService.change(member);
model.addAttribute("result", id + " 님의 정보수정을 완료했습니다.");
}
@RequestMapping("/delete")
public Model delete(String id,Model model){
memberService.remove(id);
model.addAttribute("result",id+"님의 탈퇴를 완료했습니다.");
return model;
}
@RequestMapping("/logout")
public void logout(SessionStatus status){
status.setComplete();
}
@RequestMapping("/login")
public void login(
String id,
String password,
Model model
) {
System.out.println("아이디 : " + id );
System.out.println("비번 : " + password );
member = memberService.login(id, password);
if (member == null) {
System.out.println("로그인 실패");
model.addAttribute("result", "fail");
} else {
if (member.getId().equals("choa")) {
System.out.println("로그인 성공");
model.addAttribute("admin", member);
model.addAttribute("result", "success");
} else {
System.out.println("로그인 실패");
model.addAttribute("result", "fail");
}
}
}
@RequestMapping("/notice")
public String notice() {
return "admin/admin/notice.tiles";
}
@RequestMapping("/write_notice")
public void writeNotice(
String title,
String content
) {
article.setUsrSubject(title);
article.setUsrContent(content);
article.setUsrName("관리자");
articleService.write(article);
}
@RequestMapping("/delete_writing")
public void deleteWriting(String code) {
articleService.delete(Integer.parseInt(code));
}
} | [
"Administrator@MSDN-SPECIAL"
] | Administrator@MSDN-SPECIAL |
7dce088cd645ac66d8fd646aad26c00c2a1f5df6 | 5cb62785f0ae34c8be9ee9770238d40f30633901 | /kodilla-testing/src/main/java/com/kodilla/testing/statistics/CalculateStatistics.java | 7102b7c8230003716cdc51415c473b70feb5e85d | [] | no_license | laperacarlos/kg_kodilla_java | 85a0840a965d4b304931e2220b97b9c9ac7db471 | e904129c7e84907d149a66ce1bc8b9d016eaaa6d | refs/heads/master | 2023-06-07T13:58:15.304245 | 2021-07-07T11:10:34 | 2021-07-07T11:10:34 | 317,491,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,801 | java | package com.kodilla.testing.statistics;
public class CalculateStatistics {
private Statistics statistics;
private double usersNumber;
private double postsNumber;
private double commentsNumber;
private double postPerUser;
private double commentPerUser;
private double commentsPerPost;
public CalculateStatistics(Statistics statistics) {
this.statistics = statistics;
}
public void calculateAdvStatistics(Statistics statistics) {
usersNumber = statistics.usersNames().size();
postsNumber = statistics.postCount();
commentsNumber = statistics.commentsCount();
if (usersNumber == 0) {
postPerUser = 0;
} else {
postPerUser = postsNumber / usersNumber;
}
if (usersNumber == 0) {
commentPerUser = 0;
} else {
commentPerUser = commentsNumber / usersNumber;
}
if (postsNumber == 0) {
commentsPerPost = 0;
} else {
commentsPerPost = commentsNumber / postsNumber;
}
}
public void showStatistics(){
System.out.println("Forum statistics \nNumber of users: " + usersNumber);
System.out.println("Number of posts: " + postsNumber);
System.out.println("Number of comments: " + commentsNumber);
System.out.println("Number of posts per user: " + postPerUser);
System.out.println("Number of comments per user: " + commentPerUser);
System.out.println("Number of comments per post: " + commentsPerPost);
}
public double getPostPerUser() {
return postPerUser;
}
public double getCommentPerUser() {
return commentPerUser;
}
public double getCommentsPerPost() {
return commentsPerPost;
}
}
| [
"[email protected]"
] | |
7ec33f768b08d2bf1b6f0bb81e29d2e95f4538c2 | 0c6f4a7ff7201a490e106c8fcfc121b4d8696bba | /src/mHUD/mGraphicEntity/GMonsterEntity.java | c5a95155a903551f7f4a6db5d202ddde67a3bfdf | [] | no_license | Hyper-Miiko/TowerDefence | 683325b3dc3275f81be86a41f3d748dcfb6c90d5 | 8bc2bc0612a9de12246d3e7060684d3c8794d820 | refs/heads/main | 2023-03-11T13:38:51.479931 | 2021-02-11T14:18:40 | 2021-02-11T14:18:40 | 322,524,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,415 | java | package mHUD.mGraphicEntity;
import java.awt.AlphaComposite;
import java.awt.Image;
import java.awt.image.BufferedImage;
import mHUD.geometric.Vector;
public class GMonsterEntity extends GPictureEntity {
int spX = -1;
public GMonsterEntity() {
setPosition(0,0);
}
public GMonsterEntity(double x, double y, String imageName) {
setPicture(imageName);
setPosition(x,y);
}
protected Vector getPosition() {
return new Vector(super.getPosition().x+(int)(size.x/2),super.getPosition().y+(int)(size.y/2));
}
protected Image getImage() {
int directionX = 0;
int directionY = 0;
double r = 2*Math.PI-getRotation();
if((r < Math.PI/4 && r >= 0) || (r < 5*Math.PI/4 && r >= 3*Math.PI/4) || (r < 2*Math.PI && r >= 7*Math.PI/4))directionX = 68;
if(r > 3*Math.PI/4 && r < 7*Math.PI/4)directionY = 50;
if(System.nanoTime()%500000000 > 250000000)spX = 34;
else spX = 0;
imageEdit.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR));
imageEdit.fillRect(0,0,hyp,hyp);
imageEdit.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
imageEdit.drawImage(image,-directionX-spX,-directionY, null);
return imageBuffer;
}
protected void reloadCanvas() {
imageBuffer = new BufferedImage((int)(size.x)/4,(int)(size.y)/2, BufferedImage.TYPE_INT_ARGB);
imageEdit = imageBuffer.createGraphics();
}
}
| [
"[email protected]"
] | |
1dbbec673dac1e935312d336081bb3eab0d8bc3d | 776346472cdc9a3f32e01c334354daf39c47e993 | /project/DuncansProject/mygooey.java | c416d4b8d22e535eac1c9423c3eabca8c4a026c5 | [] | no_license | DuncanMilne/Fourth-year-project | 1e65e57b84e67c9bff1e9e233be49870a1bc9393 | 802f477ed2f7dbd412130a827a594c88890092ea | refs/heads/master | 2021-01-11T05:20:51.409514 | 2017-03-09T17:48:56 | 2017-03-09T17:48:56 | 71,918,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,979 | java | import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import gurobi.GRBException;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
public class mygooey {
protected Shell shell;
private Text text;
private Text text_1;
private Text text_2;
private Text text_3;
private Text text_4;
private Text text_5;
/**
* Launch the application.
* @param args
*/
public static void main(String[] args) {
try {
mygooey window = new mygooey();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Open the window.
*/
public void open() {
Display display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
/**
* Create contents of the window.
*/
protected void createContents() {
shell = new Shell();
shell.setSize(450, 300);
shell.setText("SWT Application");
Label lblNumberOfStudents = new Label(shell, SWT.NONE);
lblNumberOfStudents.setBounds(10, 10, 144, 15);
lblNumberOfStudents.setText("Number of Students");
Label lblNumberOfProjects = new Label(shell, SWT.NONE);
lblNumberOfProjects.setBounds(151, 10, 109, 15);
lblNumberOfProjects.setText("Number of Projects");
Label lblNumberOfLecturers = new Label(shell, SWT.NONE);
lblNumberOfLecturers.setBounds(283, 10, 163, 15);
lblNumberOfLecturers.setText("Number of Lecturers");
Label lblAdditionalCapacityFor = new Label(shell, SWT.NONE);
lblAdditionalCapacityFor.setBounds(10, 58, 190, 15);
lblAdditionalCapacityFor.setText("Additional Capacity for Lecturers");
Label lblAdditionalCapacityFor_1 = new Label(shell, SWT.NONE);
lblAdditionalCapacityFor_1.setBounds(206, 58, 190, 15);
lblAdditionalCapacityFor_1.setText("Additional Capacity for Projects");
text = new Text(shell, SWT.BORDER);
text.setBounds(30, 31, 76, 21);
text_1 = new Text(shell, SWT.BORDER);
text_1.setBounds(172, 31, 76, 21);
text_2 = new Text(shell, SWT.BORDER);
text_2.setBounds(293, 31, 76, 21);
text_3 = new Text(shell, SWT.BORDER);
text_3.setBounds(48, 79, 76, 21);
text_4 = new Text(shell, SWT.BORDER);
text_4.setBounds(253, 79, 76, 21);
Button btnRunAlgorithm = new Button(shell, SWT.NONE);
btnRunAlgorithm.setBounds(158, 236, 102, 25);
btnRunAlgorithm.setText("Run Algorithm");
Label lblHowManyTimes = new Label(shell, SWT.NONE);
lblHowManyTimes.setBounds(84, 187, 285, 16);
lblHowManyTimes.setText("How many times would you like the algorithm to run?");
text_5 = new Text(shell, SWT.BORDER);
text_5.setBounds(172, 209, 76, 21);
Button btnSpapapprox = new Button(shell, SWT.RADIO);
btnSpapapprox.setBounds(68, 112, 102, 16);
btnSpapapprox.setText("SPA-P-APPROX");
Button btnSpapapproxpromotion = new Button(shell, SWT.RADIO);
btnSpapapproxpromotion.setBounds(68, 134, 185, 16);
btnSpapapproxpromotion.setText("SPA-P-APPROX-PROMOTION");
Button btnBoth = new Button(shell, SWT.RADIO);
btnBoth.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
}
});
btnBoth.setBounds(254, 112, 90, 16);
btnBoth.setText("Both");
Button btnIpProgrammingModel = new Button(shell, SWT.RADIO);
btnIpProgrammingModel.setBounds(250, 134, 146, 16);
btnIpProgrammingModel.setText("IP programming model");
btnRunAlgorithm.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
int numberOfStudents = Integer.parseInt(text.getText());
int numberOfProjects = Integer.parseInt(text_1.getText());
int numberOfLecturers = Integer.parseInt(text_2.getText());
int lecturerCapacity = Integer.parseInt(text_3.getText());
int projectCapacity = Integer.parseInt(text_4.getText());
int numberOfInstances = Integer.parseInt(text_5.getText());
int[] arguments = new int[] {numberOfProjects, numberOfStudents, numberOfLecturers, lecturerCapacity, projectCapacity, numberOfInstances};
Main main = new Main();
try {
if (btnBoth.getSelection()){
main.go(arguments, 0);
main.go(arguments, 1);
} else if (btnSpapapproxpromotion.getSelection()) {
main. go(arguments, 0);
} else if (btnSpapapprox.getSelection()) {
main.go(arguments, 1);
} else if (btnIpProgrammingModel.getSelection()){
main.go(arguments, 2);
} else {
System.out.println("Please select which algorithm you would like to run");
}
} catch (GRBException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}});
}
}
| [
"[email protected]"
] | |
f22f895d69ddd72433b29e395918d4785dcf4b63 | 30194346834c2e5b4042e5dc0fbcbd187ae69bea | /app/src/main/java/timeline/lizimumu/com/log/FileLogManager.java | d7b45204230eb87f25f6693bbf142370a8b366e7 | [
"MIT"
] | permissive | GeorgyYakunin/AppUsageLimit | 318598294e0bff8b812236e5959a66db118dbaf5 | 7aae3aa42c2fc60707e84be55a4de46d01368d40 | refs/heads/master | 2021-01-06T12:25:08.903525 | 2020-02-18T09:49:03 | 2020-02-18T09:49:03 | 241,325,075 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,335 | java | package timeline.lizimumu.com.log;
import android.os.Environment;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import timeline.lizimumu.com.AppConst;
/**
* Log to file
* Created by zb on 02/01/2018.
*/
public class FileLogManager {
private static final String ALARM_LOG = "alarm.log";
private static final String LOG_PATH = Environment.getExternalStorageDirectory() + File.separator + AppConst.LOG_DIR;
private static final String LOG_FILE = LOG_PATH + File.separator + ALARM_LOG;
private static FileLogManager mInstance = new FileLogManager();
private FileLogManager() {
}
public static void init() {
new Thread(new Runnable() {
@Override
public void run() {
mInstance.doPrepare();
}
}).run();
}
public static FileLogManager getInstance() {
return mInstance;
}
private void doPrepare() {
File d = new File(LOG_PATH);
boolean m = true;
if (!d.exists()) {
m = d.mkdirs();
}
if (m) {
File f = new File(LOG_FILE);
if (!f.exists()) {
try {
boolean c = f.createNewFile();
if (!c) {
System.err.println("create file error");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public void log(String message) {
doPrepare();
if (!message.endsWith("\n")) {
message += "\n";
}
FileOutputStream outputStream = null;
PrintWriter writer = null;
try {
outputStream = new FileOutputStream(LOG_FILE, true);
writer = new PrintWriter(outputStream);
writer.write(message);
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
if (writer != null) writer.close();
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
| [
"[email protected]"
] | |
5f2f9ddc92fd52d4f7c125b460edd056071776e7 | b7cbb3cd7a25a1dcd976f596befec4b76cd43d15 | /src/main/java/com/netty/im/common/Attributes.java | 326e36dd5158f2c48c508fbc265737d6c89c3b95 | [] | no_license | TimmaWang/netty-learn-im | 22e6cbf6485babf375559caebba86d82c982dc6d | e16f11f4761eb7ef6d282876a62df723f21e4359 | refs/heads/master | 2020-04-15T05:30:48.144283 | 2019-01-15T09:07:40 | 2019-01-15T09:07:40 | 164,426,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package com.netty.im.common;
import com.netty.im.auth.Session;
import io.netty.util.AttributeKey;
/**
* Created by timma on 2018/12/11.
*/
public interface Attributes {
public static final AttributeKey<Boolean> LOGIN = AttributeKey.valueOf("login");
public static final AttributeKey<Session> SESSION = AttributeKey.valueOf("session");
}
| [
"[email protected]"
] | |
4da1615725995b22cdca0b2b5c572f73d2822fdb | 395fdaed6042b4f85663f95b8ce181305bf75968 | /java/intelijidea/chegg-i73/src/DoubleListException.java | 15f6e7f68e8e2dd2e2faee00a56109f649207b72 | [] | no_license | amitkumar-panchal/ChQuestiions | 88b6431d3428a14b0e5619ae6a30b8c851476de7 | 448ec1368eca9544fde0c40f892d68c3494ca209 | refs/heads/master | 2022-12-09T18:03:14.954130 | 2020-09-23T01:58:17 | 2020-09-23T01:58:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | /**
* DoubleListException class
*/
public class DoubleListException extends IndexOutOfBoundsException {
DoubleListException(){
}
/**
* constructor with parameter
* @param msg of exception
*/
DoubleListException(String msg){
super(msg);
}
}
| [
"="
] | = |
4e437d67ec810e200dd1e519192f40b1f53f104c | 198c4894cea5e82732f30c77f294e50ef448ab59 | /src/main/java/io/xmljim/retirement/calculator/entity/algorithms/ParameterInfo.java | 5c50ba3fdf69497fdc40b5cc6d3af128f35e7e51 | [] | no_license | xmljim/calculator | d4deccc317e83fe381cfcfe2cbf64cf90e8d6d41 | 88806ec94793781fe2b871a160ca73a45676bf30 | refs/heads/main | 2023-07-17T13:21:52.807975 | 2021-09-07T19:34:14 | 2021-09-07T19:34:14 | 403,198,659 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package io.xmljim.retirement.calculator.entity.algorithms;
import io.xmljim.algorithms.model.Parameter;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class ParameterInfo {
private String name;
private String variable;
private String parameterType;
private Object value;
public ParameterInfo(Parameter<?> parameter) {
setName(parameter.getName());
setVariable(parameter.getVariable());
setParameterType(parameter.getParameterType().toString());
setValue(parameter.getValue());
}
}
| [
"[email protected]"
] | |
c52d28dab173883d4908b097cd5975cde3ffa219 | da546bfec1fcacfce81005a794a9ca1ad535d38e | /src/com/JVComponents/Plugin/JVPluginElementToolbar.java | 23c9031032365f4353a1bfb6d6cf16fbd4b5b1bc | [] | no_license | 453897806/JavaVisualComponents | 40abb31dc787c9abd9c33e548ebff0a079e14e9b | 54b227a72922d17a6f9199396abdb840d4ffc66b | refs/heads/master | 2020-03-28T20:37:49.372874 | 2019-01-30T08:30:49 | 2019-01-30T08:30:49 | 149,088,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 922 | java | package com.JVComponents.Plugin;
import org.dom4j.Element;
import com.JVComponents.core.JVConfigXMLAttribute;
import com.JVComponents.core.JVConfigXMLFile;
import com.JVComponents.core.JVConsts;
import com.JVComponents.core.JVException;
public class JVPluginElementToolbar extends JVPluginElement {
private JVConfigXMLAttribute id;
/**
* id属性
*
* @throws JVException
*/
public JVConfigXMLAttribute getId() {
return id;
}
public JVPluginElementToolbar(JVConfigXMLFile configXMLFile, Element element) throws JVException {
super(configXMLFile, element);
}
@Override
protected void readAttributes(Element element) throws JVException {
//忽略基类
//super.readAttributes(element);
//特殊属性
id = getXMLAttribute(JVPluginConsts.JVPluginRoot.id, JVConsts.emptyString);
}
@Override
public void matchPluginElement() throws JVException {
//无需要匹配的对象
}
}
| [
"bob@localhost"
] | bob@localhost |
f459f75d774c28aa27126e7340d823ca7b915f11 | f82b6c599b85f46a93a28193e2f465acc350735b | /src/test/java/com/whatslly/rest/api/testing_project/NegativeTestWrongEndpoint.java | 78b588eceed99b38046385c39ffefebe31a53976 | [] | no_license | Hodiya2929/REST-API-testing-project | ffa72ecfd7a664a95288600d5bef1367558cc7de | 6ab09440f5a784c545c9ee2c14103ab5c1f564ce | refs/heads/main | 2023-04-15T21:22:16.609452 | 2021-04-21T09:44:46 | 2021-04-21T09:44:46 | 359,945,585 | 0 | 0 | null | 2021-04-21T09:44:47 | 2021-04-20T20:41:12 | HTML | UTF-8 | Java | false | false | 867 | java | package com.whatslly.rest.api.testing_project;
import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.config.SSLConfig;
import tests.data.DataProviders;
public class NegativeTestWrongEndpoint extends AbstractTest {
@Test(dataProvider = "unvalidEndpoints", dataProviderClass = DataProviders.class)
public void verifyWrongEndpointStatusCode(String unvalidEndpoint)
{
String url = initializeEndpoint(unvalidEndpoint);
System.out.println(url);
io.restassured.RestAssured.given()
.config(RestAssured.config().sslConfig(new SSLConfig().allowAllHostnames()))
.when().get(url)
.then().statusCode(404);
/*RestAssured.config().sslConfig(new SSLConfig().allowAllHostnames()) - this
to allow insecure get request - to bypass the SSL certificate - in order to reach to server
and get the status response
*/
}
}
| [
"[email protected]"
] | |
b7e93963b965b520c6376d8769b13c25a9d68aa1 | 1518c5b0007498020cd63df585d9d296be892b24 | /src/main/java/com/nhat/naschool/dto/UserRegistrationDto.java | 3c2420a9083d6562059b95919facd65d73717ce1 | [] | no_license | NguyenNhat98/NaSchool | ea3c2fce932101f02e1062e75b07775a829b749a | 449e949f79ca1970cf544a65b1920e07cebdead4 | refs/heads/master | 2023-05-25T22:37:08.153440 | 2021-06-01T10:57:08 | 2021-06-01T10:57:08 | 281,342,301 | 0 | 0 | null | 2021-06-01T10:51:17 | 2020-07-21T08:36:43 | CSS | UTF-8 | Java | false | false | 679 | java | package com.nhat.naschool.dto;
public class UserRegistrationDto {
private String name;
private String email;
private String password;
public UserRegistrationDto(){
}
public UserRegistrationDto( String name, String email, String password) {
this.name = name;
this.email = email;
this.password = password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"[email protected]"
] | |
31dcdd9a3dda2ab0ab510b8447f499c17ac4b755 | 962f77f9aa7feb069a814f8fbc7caf0165f1c736 | /src/main/java/net/porillo/ChatVariable.java | 292976c3373b74ad4e409ac1c665aae279d3bce1 | [] | no_license | nsporillo/ColoredGroups | 2aae2b8294cd40572f7881e3192937fff2a2d0ff | 5662d4c4493707829861d7b4569fc256a4d1c3af | refs/heads/master | 2021-01-18T22:41:40.519922 | 2019-09-29T14:02:03 | 2019-09-29T14:02:03 | 6,397,776 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | package net.porillo;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.bukkit.entity.Player;
@Data
@AllArgsConstructor
class ChatVariable {
private String root, replace, permission;
ChatVariable(String root, String replace) {
this(root, replace, "coloredgroups.variables." + root.replace("%", ""));
}
String run(Player player) {
return player != null && player.hasPermission(permission) ? replace : "";
}
}
| [
"[email protected]"
] | |
9cc90ea21543ed7673ed27bdb5efab9b69941854 | e6e3bc6aaaae82d346fdb8acb51ee87e907bdaa8 | /src/main/java/com/fiona/test/App.java | 993f3d30702bdd1aaa472105abf989ecff3b3d20 | [] | no_license | linafeng/test | cb563322ba7c65efd1f0aacd1e7e999b829d4256 | a925a96b2bb09e2b8e041c37ddf207f625f39dd9 | refs/heads/master | 2020-03-19T09:26:53.923314 | 2018-06-06T10:00:13 | 2018-06-06T10:00:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package com.fiona.test;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"[email protected]"
] | |
aad650ab8121f5ebd4e476da497ac8821f627d5e | acfa94fa53b1f78501153614132e7c671f815ae9 | /src/main/java/com/ync365/oa/repository/PeControllerDao.java | 267f6a3514f6623fe53e30c3e87665499ad6a2bb | [] | no_license | haagensensusanne53/ync_kpi | 9e6bddcb688aa5e1b9413119c018b29d0cb0d8d5 | e3a82158d64f3a9cdb571f04f1ede55755416f21 | refs/heads/master | 2023-07-20T19:13:41.120040 | 2017-07-17T13:27:05 | 2017-07-17T13:27:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 604 | java | package com.ync365.oa.repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.ync365.oa.entity.PeController;
public interface PeControllerDao
extends PagingAndSortingRepository<PeController, Long>, JpaSpecificationExecutor<PeController> {
PeController findByPeDateDepartment(String peDateDepartment);
Page<PeController> findByDepartmentId(Long departmentId,Pageable pageable);
}
| [
"[email protected]"
] | |
e3a0bf8829785daa3cd9e642a8a317456d0d99f3 | a01906e1949c482f18447874c534826099f7d951 | /src/main/java/org/shannon/function/ExceptionalSupplier.java | 27f97576e66fe889801a07b14f3ba10a1cf62319 | [
"Apache-2.0"
] | permissive | Lwelch45/ShardAllocator | 1a2c8b673b79c6caacf46d5597777bb294e2b12b | 904b11c628a8e19b4ebaa97cdf22aff29f8a0a03 | refs/heads/master | 2020-12-30T16:02:07.042203 | 2017-05-10T23:39:24 | 2017-05-10T23:39:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 150 | java | package org.shannon.function;
@FunctionalInterface
public interface ExceptionalSupplier<E extends Throwable, T> {
public T get() throws E;
}
| [
"[email protected]"
] | |
25cbddfa0a2d0a1db9074db86dd5fc0387bdb8f1 | f91017917be578a0a490dbf7c8553c26459beaf3 | /fw-core/src/main/java/com/seeyu/core/utils/BaseJsonData.java | 2fea27899956b1ed24457fd0c72204ff1d0ef9dc | [] | no_license | zhaoyongchao1991/seeyu-framework | 63195e62ec1ca823b73f468d175706ddf1554fbe | 0a3c43c5d4383926190ec7303ba2e03f4c9e28a5 | refs/heads/master | 2022-12-22T03:32:02.432110 | 2019-12-10T12:13:54 | 2019-12-10T12:13:54 | 210,003,953 | 0 | 0 | null | 2022-12-10T05:21:23 | 2019-09-21T14:57:34 | Java | UTF-8 | Java | false | false | 1,755 | java | package com.seeyu.core.utils;
import lombok.Getter;
import lombok.ToString;
@ToString
public class BaseJsonData<T> extends ServiceData<T> {
protected Exception exception;
protected String exceptionMessage;
protected Integer code;
@Getter
protected Long timestamp;
public BaseJsonData() {
this(false);
}
protected BaseJsonData(boolean success) {
super(success);
this.timestamp = System.currentTimeMillis();
}
public static BaseJsonData SUCCESS() {
return new BaseJsonData(true);
}
public static BaseJsonData ERROR() {
return new BaseJsonData(false);
}
@Override
public BaseJsonData setSuccess(boolean success) {
this.success = success;
return this;
}
@Override
public BaseJsonData setData(T data) {
this.data = data;
return this;
}
public Exception getException() {
return exception;
}
public BaseJsonData setException(Exception exception) {
this.exception = exception;
return this;
}
@Override
public String getMessage() {
return message;
}
@Override
public BaseJsonData setMessage(String message, Object...messageArgs) {
this.message = message;
this.messageArgs = messageArgs;
return this;
}
public String getExceptionMessage() {
return exceptionMessage;
}
public BaseJsonData setExceptionMessage(String exceptionMessage) {
this.exceptionMessage = exceptionMessage;
return this;
}
public Integer getCode() {
return code;
}
public BaseJsonData setCode(Integer code) {
this.code = code;
return this;
}
}
| [
"[email protected]"
] | |
768fceb7072084ed5e8e16b215b412c038c8ee5e | 282465c815ff20165481197bf5287341baf42311 | /webapp.bak/src/main/java/com/cloudlbs/web/client/composite/RegisterUserSuccess.java | 97533ebce90887609bda4e3f60961faf83a84577 | [
"MIT"
] | permissive | dmascenik/cloudlbs | d47276919c8f5f9764d0e0cf3bdf7ca48a34a3b8 | 97d3493e82edd9cb0a7995d588b26a4808b4f79f | refs/heads/master | 2020-05-09T14:28:44.279834 | 2015-09-07T15:51:15 | 2015-09-07T15:51:15 | 42,061,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | java | package com.cloudlbs.web.client.composite;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ClickEvent;
/**
* @author Dan Mascenik
*
*/
public class RegisterUserSuccess extends Composite {
public RegisterUserSuccess(String email) {
VerticalPanel verticalPanel = new VerticalPanel();
initWidget(verticalPanel);
Label lblSuccess = new Label("Success!");
lblSuccess.setStyleName("title");
verticalPanel.add(lblSuccess);
Label lblAnEmailHas = new Label("An email has been sent to " + email
+ " with a link to activate your account.");
lblAnEmailHas.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
verticalPanel.add(lblAnEmailHas);
lblAnEmailHas.setWidth("450px");
Button btnOk = new Button("Ok");
btnOk.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// TODO return to the home page
}
});
verticalPanel.add(btnOk);
verticalPanel.setCellHorizontalAlignment(btnOk,
HasHorizontalAlignment.ALIGN_CENTER);
btnOk.setWidth("92px");
}
}
| [
"[email protected]"
] | |
3823339870ef491577305348282f72531257cdc4 | fadfbc8894fbde6a92cd630cf7ae80678520a670 | /app/src/main/java/com/testapp/krish/firstapp/Day3/User.java | 01e0f8af2adf2fc052f94f24b09612dd2929607e | [] | no_license | anuvhab/AndroidCS473 | ff84ab56f8dbbc2595a30e2757afd35d72a31329 | 3e1d3cc3dfc598ec551145b452e7737725b2c54c | refs/heads/master | 2020-03-08T07:39:05.959599 | 2018-04-09T16:08:44 | 2018-04-09T16:08:44 | 127,999,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package com.testapp.krish.firstapp.Day3;
public class User {
private String firstName, lastName, eMail, password;
public User(String firstName, String lastName, String eMail, String password) {
this.firstName = firstName;
this.lastName = lastName;
this.eMail = eMail;
this.password = password;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String geteMail() {
return eMail;
}
public String getPassword() {
return password;
}
}
| [
"[email protected]"
] | |
24de8db036be30d267d101cc85aa7b249553b61a | 014df7612f49a590c5927ddaff8eae529bf1f111 | /src/com/wolfgames/framework/impl/AndroidGraphics.java | ea88f56a4af1d65538f018f312bdfe900139eb90 | [] | no_license | vvolkov-dev/tutorial | f95f593b2bc655bc0e754bd95aa4c99fac27baee | 91def5583ad1a5dbf9ad6ff0bca796bc4cffbd5e | refs/heads/master | 2021-05-31T16:02:14.766114 | 2015-11-05T16:42:15 | 2015-11-05T16:42:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,709 | java | package com.wolfgames.framework.impl;
import java.io.IOException;
import java.io.InputStream;
import com.wolfgames.framework.Graphics;
import com.wolfgames.framework.Pixmap;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory.Options;
import android.graphics.Paint.Style;
public class AndroidGraphics implements Graphics{
AssetManager assets;
Bitmap frameBuffer;
Canvas canvas;
Paint paint;
Rect sqrRect = new Rect();
Rect dstRect = new Rect();
public AndroidGraphics(AssetManager assets, Bitmap frameBuffer) {
// TODO Auto-generated constructor stub
this.assets = assets;
this.frameBuffer = frameBuffer;
this.canvas = new Canvas(frameBuffer);
this.paint = new Paint();
}
@Override
public Pixmap newPixmap(String fileName, PixmapFormat format) {
Config config = null;
if (format == PixmapFormat.RGB565)
config = Config.RGB_565;
else if (format == PixmapFormat.ARGB4444) {
config = Config.ARGB_4444;
}
else {
config = Config.ARGB_8888;
}
Options options = new Options();
options.inPreferredConfig = config;
InputStream in = null;
Bitmap bitmap = null;
try {
in = assets.open(fileName);
bitmap = BitmapFactory.decodeStream(in);
if (bitmap == null) {
throw new RuntimeException("Couldn't load bitmap from asset '" + fileName + "'");
}
} catch (IOException e) {
// TODO: handle exception
throw new RuntimeException("Couldn't load bitmap from asset '" + fileName + "'");
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e2) {
// TODO: handle exception
}
}
}
if (bitmap.getConfig() == Config.RGB_565) {
format = PixmapFormat.RGB565;
}
else if (bitmap.getConfig() == Config.ARGB_4444) {
format = PixmapFormat.ARGB4444;
} else {
format = PixmapFormat.ARGB8888;
}
return new AndroidPixmap(bitmap, format);
}
@Override
public void clear(int color) {
// TODO Auto-generated method stub
canvas.drawRGB((color & 0xff0000) >> 16, (color & 0xff00) >>8, (color & 0xff));
}
@Override
public void drawPixel(int x, int y, int color) {
paint.setColor(color);
canvas.drawPoint(x, y, paint);
}
@Override
public void drawLine(int x, int y, int x2, int y2, int color) {
// TODO Auto-generated method stub
paint.setColor(color);
canvas.drawLine(x, y, x2, y2, paint);
}
@Override
public void drawRect(int x, int y, int width, int height, int color) {
// TODO Auto-generated method stub
paint.setColor(color);
paint.setStyle(Style.FILL);
canvas.drawRect(x, y, x + width - 1, y + height - 1, paint);
}
@Override
public void drawPixmap(Pixmap pixmap, int x, int y, int srcX, int srcY, int srcWidth, int srcHeight) {
// TODO Auto-generated method stub
sqrRect.left = srcX;
sqrRect.top = srcY;
sqrRect.right = srcX + srcWidth - 1;
sqrRect.bottom = srcY + srcHeight - 1;
dstRect.left = x;
dstRect.top = y;
dstRect.right = x + srcWidth - 1;
dstRect.bottom = y + srcHeight - 1;
canvas.drawBitmap(((AndroidPixmap) pixmap).bitmap, sqrRect, dstRect, paint);
}
@Override
public void drawPixmap(Pixmap pixmap, int x, int y) {
// TODO Auto-generated method stub
canvas.drawBitmap(((AndroidPixmap) pixmap).bitmap, x, y, null);
}
@Override
public int getWidth() {
// TODO Auto-generated method stub
return frameBuffer.getWidth();
}
@Override
public int getHeight() {
// TODO Auto-generated method stub
return frameBuffer.getHeight();
}
}
| [
"[email protected]"
] | |
1984fe4bfdeda9edb356a219ecc2aec01c8123a3 | 8467168a1c6e238070431d71363e4012f7741642 | /src/main/java/org/primefaces/model/charts/optionconfig/elements/Elements.java | cdbaf30babcb37c7912ade17bf6ca2d0fba82d7f | [
"Apache-2.0"
] | permissive | vmmang/primefaces | d19d2497f73806abda53af0032f77abf5a3064b4 | 8da74386842343a4eb60ebb219e18b422553eec8 | refs/heads/master | 2020-04-01T18:07:16.918398 | 2018-10-19T10:28:49 | 2018-10-19T10:28:49 | 153,472,523 | 0 | 0 | Apache-2.0 | 2018-10-22T09:47:53 | 2018-10-17T14:37:32 | Java | UTF-8 | Java | false | false | 3,837 | java | /**
* Copyright 2009-2018 PrimeTek.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.primefaces.model.charts.optionconfig.elements;
import java.io.IOException;
import java.io.Serializable;
import org.primefaces.util.FastStringWriter;
/**
* Used to configure element option under chart options
* While chart types provide settings to configure the styling of each dataset,
* you sometimes want to style all datasets the same way.
*/
public class Elements implements Serializable {
private ElementsPoint point;
private ElementsLine line;
private ElementsRectangle rectangle;
private ElementsArc arc;
/**
* Gets the point
*
* @return point
*/
public ElementsPoint getPoint() {
return point;
}
/**
* Sets the point
*
* @param point the {@link ElementsPoint} object
*/
public void setPoint(ElementsPoint point) {
this.point = point;
}
/**
* Gets the line
*
* @return line
*/
public ElementsLine getLine() {
return line;
}
/**
* Sets the line
*
* @param line the {@link ElementsLine} object
*/
public void setLine(ElementsLine line) {
this.line = line;
}
/**
* Gets the rectangle
*
* @return rectangle
*/
public ElementsRectangle getRectangle() {
return rectangle;
}
/**
* Sets the rectangle
*
* @param rectangle the {@link ElementsRectangle} object
*/
public void setRectangle(ElementsRectangle rectangle) {
this.rectangle = rectangle;
}
/**
* Gets the arc
*
* @return arc
*/
public ElementsArc getArc() {
return arc;
}
/**
* Sets the arc
*
* @param arc the {@link ElementsArc} object
*/
public void setArc(ElementsArc arc) {
this.arc = arc;
}
/**
* Write the options of Elements
*
* @return options as JSON object
* @throws java.io.IOException If an I/O error occurs
*/
public String encode() throws IOException {
FastStringWriter fsw = new FastStringWriter();
boolean hasComma = false;
String preString;
try {
if (this.point != null) {
fsw.write("\"point\":{");
fsw.write(this.point.encode());
fsw.write("}");
hasComma = true;
}
if (this.line != null) {
preString = hasComma ? "," : "";
fsw.write(preString + "\"line\":{");
fsw.write(this.line.encode());
fsw.write("}");
hasComma = true;
}
if (this.rectangle != null) {
preString = hasComma ? "," : "";
fsw.write(preString + "\"rectangle\":{");
fsw.write(this.rectangle.encode());
fsw.write("}");
hasComma = true;
}
if (this.arc != null) {
preString = hasComma ? "," : "";
fsw.write(preString + "\"arc\":{");
fsw.write(this.arc.encode());
fsw.write("}");
}
}
finally {
fsw.close();
}
return fsw.toString();
}
}
| [
"[email protected]"
] | |
d591e0ef1e84078bf2ba39afdd7611187c822ce8 | e7403e990fa6f023bd20980b35f3e5518d585542 | /JSP/myweb2/src/listo/bbs/model/BbsDAO.java | 7d23b5278a66abce8bb3a3c944299f7c850da92b | [] | no_license | fivingo/ildream_jsp | 1e76e931d61be66580e8ed6de1507e3b667933cd | fef74d5780bf43946085b8abeedcdd3de0be04b1 | refs/heads/master | 2022-03-15T14:20:24.630824 | 2019-11-17T14:45:56 | 2019-11-17T14:45:56 | 222,226,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,403 | java | package listo.bbs.model;
import java.sql.*;
import java.util.ArrayList;
import oracle.net.aso.s;
public class BbsDAO {
private Connection conn;
private PreparedStatement ps;
private ResultSet rs;
public static final int ERROR = -1;
public BbsDAO() {
}
/** 총 게시글 개수 관련 메서드 */
public int getTotalCount() {
try {
conn = listo.db.ListoDb.getConn();
String sql = "SELECT COUNT(*) FROM jsp_bbs";
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
rs.next();
int count = rs.getInt(1);
return count == 0 ? 1 : count;
} catch (Exception e) {
e.printStackTrace();
return ERROR;
} finally {
try {
if (rs != null) rs.close();
if (ps != null) ps.close();
if (conn != null) conn.close();
} catch (Exception e2) {}
}
}
/** 목록 관련 메서드 */
public ArrayList<BbsDTO> bbsList(int cPage, int listSize) {
try {
conn = listo.db.ListoDb.getConn();
int startNumber = (cPage - 1) * listSize + 1;
int endNumber = cPage * listSize;
String sql = "SELECT * FROM "
+ "(SELECT ROWNUM AS rnum, a.* FROM "
+ "(SELECT * FROM jsp_bbs ORDER BY breference DESC, brank ASC) a) b "
+ "WHERE rnum >= ? and rnum <= ?";
ps = conn.prepareStatement(sql);
ps.setInt(1, startNumber);
ps.setInt(2, endNumber);
rs = ps.executeQuery();
ArrayList<BbsDTO> arr = new ArrayList<BbsDTO>();
while (rs.next()) {
int bidx = rs.getInt("bidx");
String bwriter = rs.getString("bwriter");
String bpwd = rs.getString("bpwd");
String bsubject = rs.getString("bsubject");
String bcontent = rs.getString("bcontent");
Date bwriteDate = rs.getDate("bwriteDate");
int breadCount = rs.getInt("breadCount");
int breference = rs.getInt("breference");
int blevel = rs.getInt("blevel");
int brank = rs.getInt("brank");
int brecommend = rs.getInt("brecommend");
BbsDTO dto = new BbsDTO(bidx, bwriter, bpwd, bsubject, bcontent,
bwriteDate, breadCount, breference, blevel, brank, brecommend);
arr.add(dto);
}
return arr;
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
try {
if (rs != null) rs.close();
if (ps != null) ps.close();
if (conn != null) conn.close();
} catch (Exception e2) {}
}
}
/** 페이징 관련 메서드 */
/** breference 마지막값 구하는 메서드 */
public int getMaxRef() {
try {
String sql = "SELECT MAX(breference) FROM jsp_bbs";
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
int max = 0;
if (rs.next()) {
max = rs.getInt(1);
}
return max;
} catch (Exception e) {
e.printStackTrace();
return ERROR;
} finally {
try {
} catch (Exception e2) {}
}
}
/** 글쓰기 관련 메서드 */
public int bbsWrite(BbsDTO dto) {
try {
conn = listo.db.ListoDb.getConn();
int ref = getMaxRef();
String sql = "INSERT INTO jsp_bbs "
+ "VALUES (jsp_bbs_idx.nextval, ?, ?, ?, ?, SYSDATE, 0, ?, 0, 0, 0)";
ps = conn.prepareStatement(sql);
ps.setString(1, dto.getBwriter());
ps.setString(2, dto.getBpwd());
ps.setString(3, dto.getBsubject());
ps.setString(4, dto.getBcontent());
ps.setInt(5, ref + 1);
int count = ps.executeUpdate();
return count;
} catch (Exception e) {
e.printStackTrace();
return ERROR;
} finally {
try {
if (ps != null) ps.close();
if (rs != null) rs.close();
} catch (Exception e2) {}
}
}
/** 본문 관련 메서드 */
public BbsDTO bbsContent(int bidx) {
try {
conn = listo.db.ListoDb.getConn();
String sql = "SELECT * FROM jsp_bbs WHERE bidx = ?";
ps = conn.prepareStatement(sql);
ps.setInt(1, bidx);
rs = ps.executeQuery();
BbsDTO dto = null;
while (rs.next()) {
String bwriter = rs.getString("bwriter");
String bpwd = rs.getString("bpwd");
String bsubject = rs.getString("bsubject");
String bcontent = rs.getString("bcontent");
Date bwriteDate = rs.getDate("bwriteDate");
int breadCount = rs.getInt("breadCount");
int breference = rs.getInt("breference");
int blevel = rs.getInt("blevel");
int brank = rs.getInt("brank");
int brecommend = rs.getInt("brecommend");
dto = new BbsDTO(bidx, bwriter, bpwd, bsubject, bcontent,
bwriteDate, breadCount, breference, blevel, brank, brecommend);
}
return dto;
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
try {
if (rs != null) rs.close();
if (ps != null) ps.close();
if (conn != null) conn.close();
} catch (Exception e2) {}
}
}
/** 게시글 조회수 관련 메서드 */
public void readCount(int bidx, int breadCount) {
try {
conn = listo.db.ListoDb.getConn();
String sql = "UPDATE jsp_bbs SET breadcount = ? WHERE bidx = ?";
ps = conn.prepareStatement(sql);
ps.setInt(2, bidx);
ps.setInt(1, breadCount + 1);
ps.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (ps != null) ps.close();
if (conn != null) conn.close();
} catch (Exception e2) {}
}
}
/** 순번변경 관련 메서드 */
public void setRankUpdate(int breference, int brank) {
try {
String sql =
"UPDATE jsp_bbs SET brank = brank + 1 WHERE breference = ? and brank >= ?";
ps = conn.prepareStatement(sql);
ps.setInt(1, breference);
ps.setInt(2, brank);
ps.executeQuery();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (ps != null) ps.close();
} catch (Exception e2) {}
}
}
/** 답변쓰기 관련 메서드 */
public int bbsReWrite(BbsDTO dto) {
try {
conn = listo.db.ListoDb.getConn();
setRankUpdate(dto.getBreference(), dto.getBrank() + 1);
String sql =
"INSERT INTO jsp_bbs VALUES(jsp_bbs_idx.nextval, ?, ?, ?, ?, SYSDATE, 0, ?, ?, ?, 0)";
ps = conn.prepareStatement(sql);
ps.setString(1, dto.getBwriter());
ps.setString(2, dto.getBpwd());
ps.setString(3, dto.getBsubject());
ps.setString(4, dto.getBcontent());
ps.setInt(5, dto.getBreference());
ps.setInt(6, dto.getBlevel() + 1);
ps.setInt(7, dto.getBrank() + 1);
int count = ps.executeUpdate();
return count;
} catch (Exception e) {
e.printStackTrace();
return ERROR;
} finally {
try {
if (ps != null) ps.close();
if (conn != null) conn.close();
} catch (Exception e2) {}
}
}
}
| [
"[email protected]"
] | |
31d561e67883b53893e497008c73e47c995734ab | c18c3f3bdc51f048f662344d032f9388dfecbd9d | /ddf-parent/ddf-service-student/src/main/java/com/ddf/student/api/BaseApi.java | bd139d34fdc8d560458aa340bd816248fbe9d451 | [] | no_license | soldiers1989/my_dev | 88d62e4f182ac68db26be3d5d3ddc8a68e36c852 | 4250267f6d6d1660178518e71b1f588b4f3926f7 | refs/heads/master | 2020-03-27T19:39:28.191729 | 2018-02-12T02:29:51 | 2018-02-12T02:29:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,245 | java | package com.ddf.student.api;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.ddf.util.DateUtil;
/**
* 控制器支持类
* @author ThinkGem
* @version 2013-3-23
*/
public abstract class BaseApi {
/**
* 日志对象
*/
protected Logger logger = LoggerFactory.getLogger(getClass());
@InitBinder
protected void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(Date.class, new DateEditor());
//binder.registerCustomEditor(Double.class, new DoubleEditor());
//binder.registerCustomEditor(Integer.class, new IntegerEditor());
}
private class DateEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
Date date = null;
try {
date = DateUtil.StringToDate(text, DateUtil.yyyy_MM_dd_HH_mm_ss);
} catch (Exception e) {
date = DateUtil.StringToDate(text, DateUtil.yyyy_MM_dd);
}
setValue(date);
}
}
}
| [
"huayan333"
] | huayan333 |
aa6265f8569efdf3cf63e887c48541369dcafa24 | 85ff83205299a337f9912abe3b1d08d90afa4416 | /MLKit-Sample/module-text/src/main/java/com/huawei/mlkit/sample/camera/LensEnginePreview.java | c518def83f0bd4172a979b73c818e2372ba188e1 | [
"Apache-2.0"
] | permissive | Hasnainninesol/hms-ml-demo | 3b3d694431b5d2db45a4c4a4293f73a58dbd2543 | a672a2dd4bae002f92c684980b9815f64f302bf3 | refs/heads/master | 2023-01-14T04:47:30.970599 | 2020-11-19T07:50:59 | 2020-11-19T07:50:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,095 | java | /**
* Copyright 2018 Google LLC
*
* 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.
* 2020.2.21-Changed name from CameraSourcePreview to LensEnginePreview, in addition, the onTouchEvent, handleZoom, handleFocusMetering method is added.
* Huawei Technologies Co., Ltd.
*/
package com.huawei.mlkit.sample.camera;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.RectF;
import android.hardware.Camera;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.huawei.hms.common.size.Size;
public class LensEnginePreview extends ViewGroup {
private static final String TAG = "LensEnginePreview";
private Context context;
private SurfaceView surfaceView;
private boolean startRequested;
private LensEngine lensEngine;
private float oldDist = 1f;
/**
* Determines whether the camera preview frame and detection result display frame are synchronous or asynchronous.
*/
private boolean isSynchronous = false;
public LensEnginePreview(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
this.startRequested = false;
this.surfaceView = new SurfaceView(context);
this.surfaceView.getHolder().addCallback(new SurfaceCallback());
this.addView(this.surfaceView);
}
public SurfaceHolder getSurfaceHolder() {
return this.surfaceView.getHolder();
}
public void start(LensEngine lensEngine, boolean isSynchronous) throws IOException {
this.isSynchronous = isSynchronous;
if (lensEngine == null) {
this.stop();
}
this.lensEngine = lensEngine;
if (this.lensEngine != null) {
this.startRequested = true;
this.startLensEngine();
}
}
public void stop() {
if (this.lensEngine != null) {
this.lensEngine.stop();
}
}
public void release() {
if (this.lensEngine != null) {
this.lensEngine.release();
this.lensEngine = null;
}
}
@SuppressLint("MissingPermission")
private void startLensEngine() throws IOException {
if (this.startRequested) {
this.lensEngine.run();
this.startRequested = false;
}
}
public void takePicture(Camera.PictureCallback pictureCallback) {
if (this.lensEngine != null) {
this.lensEngine.takePicture(pictureCallback);
}
}
private class SurfaceCallback implements SurfaceHolder.Callback {
@Override
public void surfaceCreated(SurfaceHolder surface) {
try {
LensEnginePreview.this.startLensEngine();
} catch (IOException e) {
Log.e(LensEnginePreview.TAG, "Could not start lensEngine.", e);
}
}
@Override
public void surfaceDestroyed(SurfaceHolder surface) {
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
Log.d(LensEnginePreview.TAG, "surfaceChanged");
Camera camera = LensEnginePreview.this.lensEngine.getCamera();
if (camera == null) {
return;
}
try {
camera.setPreviewDisplay(LensEnginePreview.this.surfaceView.getHolder());
} catch (IOException e) {
Log.e(LensEnginePreview.TAG, "IOException", e);
}
}
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
try {
this.startLensEngine();
} catch (IOException e) {
Log.e(LensEnginePreview.TAG, "Could not start LensEngine.", e);
}
if (this.lensEngine == null) {
return;
}
Size size = this.lensEngine.getPreviewSize();
if (size == null) {
return;
}
int width = size.getWidth();
int height = size.getHeight();
// When the phone is in portrait orientation, the width and height dimensions are interchangeable.
if (this.isVertical()) {
int tmp = width;
width = height;
height = tmp;
}
final int viewWidth = right - left;
final int viewHeight = bottom - top;
int childWidth;
int childHeight;
int childXOffset = 0;
int childYOffset = 0;
float widthRatio = (float) viewWidth / (float) width;
float heightRatio = (float) viewHeight / (float) height;
// To fill the view with the camera preview, while also preserving the correct aspect ratio,
// it is usually necessary to slightly oversize the child and to crop off portions along one
// of the dimensions. We scale up based on the dimension requiring the most correction, and
// compute a crop offset for the other dimension.
if (widthRatio > heightRatio) {
childWidth = viewWidth;
childHeight = (int) ((float) height * widthRatio);
childYOffset = (childHeight - viewHeight) / 2;
} else {
childWidth = (int) ((float) width * heightRatio);
childHeight = viewHeight;
childXOffset = (childWidth - viewWidth) / 2;
}
for (int i = 0; i < this.getChildCount(); ++i) {
// One dimension will be cropped. We shift child over or up by this offset and adjust
// the size to maintain the proper aspect ratio.
this.getChildAt(i)
.layout(-1 * childXOffset, -1 * childYOffset, childWidth - childXOffset, childHeight - childYOffset);
}
}
private boolean isVertical() {
int orientation = this.context.getResources().getConfiguration().orientation;
return orientation == Configuration.ORIENTATION_PORTRAIT;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (CameraConfiguration.getCameraFacing() == CameraConfiguration.CAMERA_FACING_FRONT) {
return true;
}
if (this.lensEngine == null) {
return true;
}
if (event.getPointerCount() == 1) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
this.handleFocusMetering(event, this.lensEngine.getCamera());
break;
}
} else {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_POINTER_DOWN:
this.oldDist = LensEnginePreview.getFingerSpacing(event);
break;
case MotionEvent.ACTION_MOVE:
Log.d(LensEnginePreview.TAG, "toby onTouch: ACTION_MOVE");
float newDist = LensEnginePreview.getFingerSpacing(event);
if (newDist > this.oldDist) {
this.handleZoom(true, this.lensEngine.getCamera());
} else if (newDist < this.oldDist) {
this.handleZoom(false, this.lensEngine.getCamera());
}
this.oldDist = newDist;
break;
default:
break;
}
}
return true;
}
private void handleZoom(boolean isZoomIn, Camera camera) {
Camera.Parameters params = camera.getParameters();
if (params.isZoomSupported()) {
int maxZoom = params.getMaxZoom();
int zoom = params.getZoom();
if (isZoomIn && zoom < maxZoom) {
zoom++;
} else if (zoom > 0) {
zoom--;
}
params.setZoom(zoom);
camera.setParameters(params);
} else {
Log.i(LensEnginePreview.TAG, "zoom not supported");
}
}
private void handleFocusMetering(MotionEvent event, Camera camera) {
int viewWidth = this.getWidth();
int viewHeight = this.getHeight();
Rect focusRect = LensEnginePreview.calculateTapArea(event.getX(), event.getY(), 1f, viewWidth, viewHeight);
Rect meteringRect = LensEnginePreview.calculateTapArea(event.getX(), event.getY(), 1.5f, viewWidth, viewHeight);
camera.cancelAutoFocus();
Camera.Parameters params = camera.getParameters();
if (params.getMaxNumFocusAreas() > 0) {
List<Camera.Area> focusAreas = new ArrayList<>();
focusAreas.add(new Camera.Area(focusRect, 800));
params.setFocusAreas(focusAreas);
} else {
Log.i(LensEnginePreview.TAG, "focus areas not supported");
}
if (params.getMaxNumMeteringAreas() > 0) {
List<Camera.Area> meteringAreas = new ArrayList<>();
meteringAreas.add(new Camera.Area(meteringRect, 800));
params.setMeteringAreas(meteringAreas);
} else {
Log.i(LensEnginePreview.TAG, "metering areas not supported");
}
final String currentFocusMode = params.getFocusMode();
Log.d(LensEnginePreview.TAG, "toby onTouch:" + currentFocusMode);
params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
camera.setParameters(params);
camera.autoFocus(new Camera.AutoFocusCallback() {
@Override
public void onAutoFocus(boolean success, Camera camera) {
Camera.Parameters params = camera.getParameters();
params.setFocusMode(currentFocusMode);
camera.setParameters(params);
}
});
}
private static float getFingerSpacing(MotionEvent event) {
float x = event.getX(0) - event.getX(1);
float y = event.getY(0) - event.getY(1);
return (float) Math.sqrt(x * x + y * y);
}
private static Rect calculateTapArea(float x, float y, float coefficient, int width, int height) {
float focusAreaSize = 300;
int areaSize = Float.valueOf(focusAreaSize * coefficient).intValue();
int centerX = (int) (x / width * 2000 - 1000);
int centerY = (int) (y / height * 2000 - 1000);
int halfAreaSize = areaSize / 2;
RectF rectF = new RectF(LensEnginePreview.clamp(centerX - halfAreaSize, -1000, 1000),
LensEnginePreview.clamp(centerY - halfAreaSize, -1000, 1000),
LensEnginePreview.clamp(centerX + halfAreaSize, -1000, 1000),
LensEnginePreview.clamp(centerY + halfAreaSize, -1000, 1000));
return new Rect(Math.round(rectF.left), Math.round(rectF.top), Math.round(rectF.right),
Math.round(rectF.bottom));
}
private static int clamp(int x, int min, int max) {
if (x > max) {
return max;
}
if (x < min) {
return min;
}
return x;
}
}
| [
"[email protected]"
] | |
e9bdeb6dd74dda9f56d92ad3e1e06b101e064de7 | e866bd9d56d6faee468745a6adf68ffcdd3591bc | /src/main/java/org/kungfu/classAttendance/Class_Attendance.java | 9afcd7e359c0bdf09d5f45a998d747f08c875e8b | [] | no_license | eshan-gill/Kung-Fu | 7a0c334954fb3d4bf155134dabe56716e62015ab | 9b228d0bcb2ecf62b2c3dfefad5b9553f525b00c | refs/heads/master | 2020-03-27T21:19:34.089985 | 2018-09-03T01:13:38 | 2018-09-03T01:13:38 | 147,135,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,947 | java | package org.kungfu.classAttendance;
import java.sql.Date;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.kungfu.classMain.Class;
import org.kungfu.classSchedule.Class_Schedule;
import org.kungfu.student.Student;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@Entity
public class Class_Attendance {
@Id
@GeneratedValue
int cls_att_num;
@ManyToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name ="std_num")
//@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@stdNum")
public Student studentFee;
@ManyToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name ="cls_code")
public Class classs;
@ManyToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name ="sch_num")
public Class_Schedule classSch;
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd",timezone="EST")
Date att_date;
//Getter and Setters
public int getCls_serial_num() {
return cls_att_num;
}
public void setCls_serial_num(int cls_serial_num) {
this.cls_att_num = cls_serial_num;
}
public Student getStudentFee() {
return studentFee;
}
public void setStudentFee(Student studentFee) {
this.studentFee = studentFee;
}
public Class getClasss() {
return classs;
}
public void setClasss(Class classs) {
this.classs = classs;
}
public Date getAtt_date() {
return att_date;
}
public void setAtt_date(Date att_date) {
this.att_date = att_date;
}
}
| [
"[email protected]"
] | |
e304114215c6df6669c08c22fc7ce008494da78d | fa1408365e2e3f372aa61e7d1e5ea5afcd652199 | /src/testcases/CWE197_Numeric_Truncation_Error/s01/CWE197_Numeric_Truncation_Error__int_console_readLine_to_byte_71b.java | a1adebb08d30fa135f080b6b4ec80ff3456fe7d2 | [] | no_license | bqcuong/Juliet-Test-Case | 31e9c89c27bf54a07b7ba547eddd029287b2e191 | e770f1c3969be76fdba5d7760e036f9ba060957d | refs/heads/master | 2020-07-17T14:51:49.610703 | 2019-09-03T16:22:58 | 2019-09-03T16:22:58 | 206,039,578 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,435 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE197_Numeric_Truncation_Error__int_console_readLine_to_byte_71b.java
Label Definition File: CWE197_Numeric_Truncation_Error__int.label.xml
Template File: sources-sink-71b.tmpl.java
*/
/*
* @description
* CWE: 197 Numeric Truncation Error
* BadSource: console_readLine Read data from the console using readLine
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: to_byte
* BadSink : Convert data to a byte
* Flow Variant: 71 Data flow: data passed as an Object reference argument from one method to another in different classes in the same package
*
* */
package testcases.CWE197_Numeric_Truncation_Error.s01;
import testcasesupport.*;
public class CWE197_Numeric_Truncation_Error__int_console_readLine_to_byte_71b
{
public void badSink(Object dataObject ) throws Throwable
{
int data = (Integer)dataObject;
{
/* POTENTIAL FLAW: Convert data to a byte, possibly causing a truncation error */
IO.writeLine((byte)data);
}
}
/* goodG2B() - use goodsource and badsink */
public void goodG2BSink(Object dataObject ) throws Throwable
{
int data = (Integer)dataObject;
{
/* POTENTIAL FLAW: Convert data to a byte, possibly causing a truncation error */
IO.writeLine((byte)data);
}
}
}
| [
"[email protected]"
] | |
537abb9a625efb477316e03e7dbc8a59bd1c160c | 97f1ca22560bafb2421855a0009808d0735cb288 | /wk03/src/d03ws02.java | 6b8c0e71014de710c0b3f510eb2b36acfbb44ed0 | [] | no_license | greenfox-zerda-raptors/bncbodrogi | 588efd106b47c99a68dfeeffbe2eabc1ec2cf064 | c5f2166222690cf7783e8b22777d8b2afbf5d09a | refs/heads/master | 2021-01-12T18:15:12.653456 | 2017-02-17T08:54:31 | 2017-02-17T08:54:31 | 71,352,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java |
public class d03ws02 {
public static void main(String[] args) {
int[] p1 = new int[] { 1, 2, 3 };
int[] p2 = new int[] {4, 5 };
// tell if p2 has more elements than p1
int l1 = p1.length;
int l2 = p2.length;
if (l1 > l2) {
System.out.println(l1);
}else {
System.out.println(l2);
}
}
}
| [
"[email protected]"
] | |
eb3492b9cb1d7469c8b412ac78aed884030b2666 | 6f367ae346b8b433e5ab881e96b55018c5c22b13 | /src/main/org/repastbs/xml/XMLSerializable.java | c94335f570632704d003f182a48d0be4318552ee | [] | no_license | blackaceatzworg/repastbs | e6447c6fd1f459dd24d7bd7703e32968d1c3b81f | d353621b4d9a31210fd8cb4d54a7039f31d9e538 | refs/heads/master | 2020-05-19T18:46:21.055952 | 2013-10-23T23:34:11 | 2013-10-23T23:34:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 779 | java | /**
* File: XMLSerializable.java
* Program: Repast BS
* Author: Ľudovít Hajzer, Zdenko Osina
* Master's Thesis: System Repast
* Supervisor: Ing. Ladislav Samuelis, CSc.
* Consultant: László Gulyás, Ph.D.
*/
package org.repastbs.xml;
import org.dom4j.Node;
import org.xml.sax.ContentHandler;
/**
* XML Serializable represents clas that can be saved/loaded to XML file
* @author Ľudovít Hajzer
*
*/
public interface XMLSerializable {
/**
* Write to xml
* @param handler
* @throws XMLSerializationException
*/
public void writeToXML(ContentHandler handler) throws XMLSerializationException;
/**
* Load from xml
* @param node
* @throws XMLSerializationException
*/
public void createFromXML(Node node) throws XMLSerializationException;
}
| [
"[email protected]"
] | |
ca21c625b01292f87f53dee5f2250ba548d71b3c | d5c52dbb0a72427608e2042825495a8f1747e036 | /ExampleProject/src/main/java/com/application/example/logging/service/impl/LoggingManagerServiceImpl.java | 8cdd1ad12073f88b08c03ab07e38b778f514a3c1 | [] | no_license | PilouUnic/ExampleProject | f0858367577d85ba2ef3151db6d6805e2575e035 | d1514cd914adedf5306fbdede158032e4e7746ff | refs/heads/master | 2021-01-22T09:58:00.278967 | 2015-06-10T07:47:20 | 2015-06-10T07:47:20 | 24,961,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,375 | java | package com.application.example.logging.service.impl;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.application.example.logging.entity.LogRowElement;
import com.application.example.logging.entity.LoggingException;
import com.application.example.logging.service.LoggingManagerService;
@Service
public class LoggingManagerServiceImpl implements LoggingManagerService {
static Logger logger = LoggerFactory.getLogger(LoggingManagerServiceImpl.class);
private static final Charset DEFAULT_ENCODING = Charset.forName("ISO-8859-15");
private static final String regexForInfoLevel = "<[0-9]{4}-[0-9]{2}-[0-9]{2}\\s[0-9]{2}:[0-9]{2}:[0-9]{2}>\\s\\|\\s(I|E|W)\\s\\|";
/**
*
* @param deployedApplicationName
* @return
*/
private List<LogRowElement> loadLogFile(final String deployedApplicationName) {
StringBuilder sbLogFilePath = new StringBuilder();
sbLogFilePath.append("G:\\ACO\\TEST_LOG.log");
final File logFile = new File(sbLogFilePath.toString());
if(logFile == null || !logFile.exists()) {
// TODO Exception
}
try {
Scanner sc = new Scanner(logFile);
String currentLine = null;
try {
while (sc.hasNextLine()) {
currentLine = sc.nextLine();
System.out.println(currentLine);
}
} finally {
if(sc != null) {
sc.close();
}
}
} catch(IOException ex){
}
return null;
}
/**
* Initilise le style de l'en-tete.
* @param workbook Objet Workbook representant le fichier Excel.
* @Return Un objet de type CellStyle.
*/
private CellStyle headerCellStyleInitialisation(final Workbook workbook) {
// Creation d'un nouveau style de cellule
logger.trace("Creation of cellstyle for header line...");
final CellStyle headerCellStyle = workbook.createCellStyle();
// Valorisation de la bordure haute
logger.trace("Initialisation of top border line...");
headerCellStyle.setBorderTop(CellStyle.BORDER_MEDIUM);
// Valorisation de la bordure basse
logger.trace("Initialisation of bottom border line...");
headerCellStyle.setBorderBottom(CellStyle.BORDER_MEDIUM);
// Valorisation de la bordure de droite
logger.trace("Initialisation of left border line...");
headerCellStyle.setBorderLeft(CellStyle.BORDER_MEDIUM);
// Valorisation de la bordure de gauche
logger.trace("Initialisation of right border line...");
headerCellStyle.setBorderRight(CellStyle.BORDER_MEDIUM);
// Valorisation de l'alignement du contenu
logger.trace("Initialisation cell content alignement...");
headerCellStyle.setAlignment(CellStyle.ALIGN_LEFT);
// Valorisation de la couleur de fond
logger.trace("Initialisation cell background color...");
headerCellStyle.setFillForegroundColor(HSSFColor.LIME.index);
headerCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
return headerCellStyle;
}
/**
* Initilise le style de l'en-tete.
* @param workbook Objet Workbook representant le fichier Excel.
* @Return Un objet de type CellStyle.
*/
private CellStyle contentCellStyleInitialisationForWarn(final Workbook workbook) {
// Creation d'un nouveau style de cellule
logger.trace("Creation of cellstyle for header line...");
final CellStyle contentCellStyle = workbook.createCellStyle();
final Font font = workbook.createFont();
// Valorisation de l'alignement du contenu
logger.trace("Initialisation cell content alignement...");
contentCellStyle.setAlignment(CellStyle.ALIGN_LEFT);
font.setColor(HSSFColor.ORANGE.index);
contentCellStyle.setFont(font);
return contentCellStyle;
}
/**
* Initilise le style de l'en-tete.
* @param workbook Objet Workbook representant le fichier Excel.
* @Return Un objet de type CellStyle.
*/
private CellStyle contentCellStyleInitialisationForError(final Workbook workbook) {
// Creation d'un nouveau style de cellule
logger.trace("Creation of cellstyle for header line...");
final CellStyle contentCellStyle = workbook.createCellStyle();
final Font font = workbook.createFont();
// Valorisation de l'alignement du contenu
logger.trace("Initialisation cell content alignement...");
contentCellStyle.setAlignment(CellStyle.ALIGN_LEFT);
font.setColor(HSSFColor.RED.index);
contentCellStyle.setFont(font);
return contentCellStyle;
}
/**
* Initilise le style de l'en-tete.
* @param workbook Objet Workbook representant le fichier Excel.
* @Return Un objet de type CellStyle.
*/
private CellStyle contentCellStyleInitialisationForInfo(final Workbook workbook) {
// Creation d'un nouveau style de cellule
logger.trace("Creation of cellstyle for header line...");
final CellStyle contentCellStyle = workbook.createCellStyle();
final Font font = workbook.createFont();
// Valorisation de l'alignement du contenu
logger.trace("Initialisation cell content alignement...");
contentCellStyle.setAlignment(CellStyle.ALIGN_LEFT);
font.setColor(HSSFColor.BLACK.index);
contentCellStyle.setFont(font);
return contentCellStyle;
}
/**
* Permet d'ecrire le contenu d'un objet workbook dans un fichier Excel passe en parametre.
* @param xlsResultFile Fichier de resultat de l'extraction.
* @param workbook Objet Workbook de POI.
* @throws ExtractionException
*/
private void writtingExcelFileContent(final File xlsResultFile, final Workbook workbook) throws LoggingException {
OutputStream xlsOutput = null;
try {
try {
xlsOutput = new FileOutputStream(xlsResultFile);
if (xlsOutput != null) {
workbook.write(xlsOutput);
}
} finally {
if (xlsOutput != null) {
xlsOutput.close();
}
}
} catch (final IOException ex) {
throw new LoggingException();
}
}
/**
* Methode de construction de la ligne d'en-tete a partir des objets resultant du parsing CSV.
* @param csvElement List d'objet RowElement representant le contenu des divers CSV parcourus.
* @param workbook Objet Workbook.
* @throws ExtractionException
*/
private void buildHeaderRow(final Workbook workbook, final Sheet sheet) throws LoggingException {
// Creation d'une premiere ligne d'en-tete
logger.debug("Creation first row header");
final Row headerRow = sheet.createRow(0);
// Mise en forme des bordures de l'en-tete
logger.debug("Initialisation of header style");
logger.trace("Calling 'headerCellStyleInitialisation' method");
final CellStyle headerCellStyle = headerCellStyleInitialisation(workbook);
Cell cell = null;
final String dateLabel = "DATE";
final String critivityLabel = "CRITICITY";
final String messageLabel = "MESSAGE";
logger.debug("Creating cell in header with value: {} ", dateLabel);
cell = headerRow.createCell(0);
cell.setCellValue(new String(dateLabel.getBytes(DEFAULT_ENCODING), DEFAULT_ENCODING));
logger.trace("Creating cell style for cell with value: {} ", dateLabel);
cell.setCellStyle(headerCellStyle);
logger.debug("Creating cell in header with value: {} ", critivityLabel);
cell = headerRow.createCell(1);
cell.setCellValue(new String(critivityLabel.getBytes(DEFAULT_ENCODING), DEFAULT_ENCODING));
logger.trace("Creating cell style for cell with value: {} ", critivityLabel);
cell.setCellStyle(headerCellStyle);
logger.debug("Creating cell in header with value: {} ", messageLabel);
cell = headerRow.createCell(2);
cell.setCellValue(new String(messageLabel.getBytes(DEFAULT_ENCODING), DEFAULT_ENCODING));
logger.trace("Creating cell style for cell with value: {} ", messageLabel);
cell.setCellStyle(headerCellStyle);
}
/**
* Methode de construction du contenu du fichier XLS.
* @param csvElement List d'objet RowElement representant le contenu des divers CSV parcourus.
* @param workbook Objet Workbook.
* @throws ExtractionException
*/
private void buildContentRow(final List<LogRowElement> logRowElement, final Workbook workbook, final Sheet sheet) throws LoggingException {
logger.debug("Building content os XLS file");
// Recuperation des elements non HEADER
logger.debug("Recovering all content lines");
int rowIndex = 1;
final CellStyle contentCellStyleforInfo = contentCellStyleInitialisationForInfo(workbook);
final CellStyle contentCellStyleforWarn = contentCellStyleInitialisationForWarn(workbook);
final CellStyle contentCellStyleforError = contentCellStyleInitialisationForError(workbook);
Cell cell = null;
for (final LogRowElement element : logRowElement) {
// Creation d'une premiere ligne d'en-tete
logger.debug("Creation first row header");
final Row contentRow = sheet.createRow(rowIndex);
if("E".equals(element.getCriticity())) {
// Valorisation de la cellule
logger.debug("Populating cell with value: {}", element.getDate());
cell = contentRow.createCell(0);
cell.setCellValue(element.getDate());
cell.setCellStyle(contentCellStyleforError);
// Valorisation de la cellule
logger.debug("Populating cell with value: {}", element.getCriticity());
cell = contentRow.createCell(1);
cell.setCellValue("ERROR");
cell.setCellStyle(contentCellStyleforError);
// Valorisation de la cellule
logger.debug("Populating cell with value: {}", element.getMessage());
cell = contentRow.createCell(2);
cell.setCellValue(element.getMessage());
cell.setCellStyle(contentCellStyleforError);
} else if("I".equals(element.getCriticity())) {
// Valorisation de la cellule
logger.debug("Populating cell with value: {}", element.getDate());
cell = contentRow.createCell(0);
cell.setCellValue(element.getDate());
cell.setCellStyle(contentCellStyleforInfo);
// Valorisation de la cellule
logger.debug("Populating cell with value: {}", element.getCriticity());
cell = contentRow.createCell(1);
cell.setCellValue("INFORMATION");
cell.setCellStyle(contentCellStyleforInfo);
// Valorisation de la cellule
logger.debug("Populating cell with value: {}", element.getMessage());
cell = contentRow.createCell(2);
cell.setCellValue(element.getMessage());
cell.setCellStyle(contentCellStyleforInfo);
} else if("W".equals(element.getCriticity())) {
// Valorisation de la cellule
logger.debug("Populating cell with value: {}", element.getDate());
cell = contentRow.createCell(0);
cell.setCellValue(element.getDate());
cell.setCellStyle(contentCellStyleforWarn);
// Valorisation de la cellule
logger.debug("Populating cell with value: {}", element.getCriticity());
cell = contentRow.createCell(1);
cell.setCellValue("WARNING");
cell.setCellStyle(contentCellStyleforWarn);
// Valorisation de la cellule
logger.debug("Populating cell with value: {}", element.getMessage());
cell = contentRow.createCell(2);
cell.setCellValue(element.getMessage());
cell.setCellStyle(contentCellStyleforWarn);
}
rowIndex++;
}
// Ajustement de la largeur des colonnes.
logger.trace("Ajusting columns width...");
final Row row = sheet.getRow(0);
for (int colNum = 0; colNum < row.getLastCellNum(); colNum++) {
workbook.getSheetAt(0).autoSizeColumn(colNum);
}
}
private void generateXlsResultFile(final File resultFile, final List<LogRowElement> logRowElement) throws LoggingException {
Workbook workbook = null;
try {
// Suppression du fichier si il existe deja
if (resultFile.exists()) {
resultFile.delete();
}
resultFile.createNewFile();
// Creation du Workbook necessaire pour la generation du fichier
// de resultat Excel.
logger.debug("Creation of Workbook object");
workbook = new HSSFWorkbook();
} catch (final IOException ex) {
throw new LoggingException();
}
// Creation d'une feuille de calcul
logger.debug("Creation sheet object from workbook");
final Sheet sheet = workbook.createSheet();
// Construction de la ligne d'en-tete
logger.trace("Calling 'buildHeaderRow' method");
buildHeaderRow(workbook, sheet);
// Construction du contenu
logger.trace("Calling 'buildContentRow' method");
buildContentRow(logRowElement, workbook, sheet);
// Ecriture du fichier
logger.trace("Calling 'write' method");
writtingExcelFileContent(resultFile, workbook);
}
@Override
public File generateExcelLogFile(final File initialLogFile) throws LoggingException {
File excelLogFile = new File("C:\\DEV\\DATA\\LOG\\TEST_LOG.xls");
StringBuilder sbLogFilePath = new StringBuilder();
sbLogFilePath.append("C:\\DEV\\DATA\\LOG\\TEST_LOG.log");
Pattern pattern = Pattern.compile(regexForInfoLevel);
Matcher matcher = null;
final File logFile = new File(sbLogFilePath.toString());
if(logFile == null || !logFile.exists()) {
// TODO Exception
}
String currentDate;
String currentCriticity;
String currentMessage;
String[] splittedCurrentLine;
LogRowElement logRowElement = null;
List<LogRowElement> result = new ArrayList<LogRowElement>();
try {
String currentLine = null;
InputStream ips = new FileInputStream(logFile);
InputStreamReader ipsr = new InputStreamReader(ips);
BufferedReader br = new BufferedReader(ipsr);
try {
while ((currentLine = br.readLine()) != null){
matcher = pattern.matcher(currentLine);
if(matcher.find()) {
splittedCurrentLine = currentLine.split("\\|");
currentDate = splittedCurrentLine[0].trim();
currentCriticity = splittedCurrentLine[1].trim();
currentMessage = splittedCurrentLine[2].trim();
System.out.println(currentLine);
System.out.println(" - " + currentDate);
System.out.println(" - " + currentCriticity);
System.out.println(" - " + currentMessage);
logRowElement = new LogRowElement(currentDate, currentCriticity, currentMessage);
result.add(logRowElement);
}
}
} finally {
if(br != null) {
br.close();
}
if(ipsr != null) {
ipsr.close();
}
if(ips != null) {
ips.close();
}
}
} catch(IOException ex){
}
generateXlsResultFile(excelLogFile, result);
logger.info("End of convertion");
return excelLogFile;
}
}
| [
"[email protected]"
] | |
817e7b45a57fe2f1fa2254bfa53781ded3784587 | 58e586ecdae559729dcc59ba2ecb084efa82b647 | /src/epfl/project/faults/RedundantWorkers.java | 55afeb8930e7313a581b47bd2426927e4b0f685e | [
"MIT"
] | permissive | ciolben/hydra-j | 4620e4d8be50e768e6c25a4c0028e48ca6f0eb0d | c5b6043e313a242dbe0cb63b3d73531784da3477 | refs/heads/master | 2021-01-10T13:41:55.980729 | 2012-06-10T17:22:51 | 2012-06-10T17:22:51 | 55,334,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,656 | java | package epfl.project.faults;
import epfl.project.common.AbstractDataCollectorSet;
import epfl.project.common.OutOfMemory;
import epfl.project.common.Tuple;
import epfl.project.nodes.ThreadManager;
import epfl.project.nodes.Worker;
import epfl.project.scheduler.TaskDescription;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ConcurrentLinkedQueue;
public class RedundantWorkers<K extends Comparable<K>, V, KR extends Comparable<KR>, VR> extends Thread {
private final int WAIT_TIME = 500;
final double PERCENT;//percentual of the result that have to be correct in order to accept the result
final int RUN_JOB_TIMES;
final int MIN_WORKERS_SAME_RESULT;
private ConcurrentLinkedQueue<ArrayList<Worker<K, V, KR, VR>>> jobsWorkersList = new ConcurrentLinkedQueue<>();
private AbstractDataCollectorSet dataCollectorSet;
private boolean stop = false;
private boolean end = false;
private final Object lock = new Object();
private TaskDescription taskDescription;
public RedundantWorkers(TaskDescription<K, V, KR, VR> taskDescription, AbstractDataCollectorSet dataCollectorSet ) {
Tuple<Integer, Double> t = taskDescription.getRedundantErrorDetector();
this.taskDescription = taskDescription;
PERCENT = t.getValue();
RUN_JOB_TIMES =t.getKey();
MIN_WORKERS_SAME_RESULT = (int) Math.ceil(RUN_JOB_TIMES * PERCENT / 100);
this.dataCollectorSet = dataCollectorSet;
// this.setPriority(Thread.MIN_PRIORITY);
}
@Override
public void run() {
while (!stop || !jobsWorkersList.isEmpty()) {
if (ThreadManager.isStop() || OutOfMemory.madeError()){
throw new Error("con't finish doing te job, the cause is mostly to be researched in another error");
}
try {
synchronized (lock) {
if (!stop) {//if i'm waiting the end no reason to keep this thread waiting so much
lock.wait(WAIT_TIME);
} else {
lock.wait(WAIT_TIME / 5);
}
}
} catch (InterruptedException e) {
e.printStackTrace();
}
for (ArrayList<Worker<K, V, KR, VR>> job : jobsWorkersList) {
//System.out.println(check(job));
check(job);
}
}
//TODO stock somewhere these stats data before end
synchronized (lock) {
end = true;
lock.notifyAll();
}
}
private boolean check(ArrayList<Worker<K, V, KR, VR>> jobWorkers) {
ConcurrentLinkedQueue<Worker<K, V, KR, VR>> doneWorkers = new ConcurrentLinkedQueue<>();
//ArrayList <Worker<K, V,KR, VR>> doneWorkers = new ArrayList<>();
for (Worker<K, V, KR, VR> worker : jobWorkers) {
if (worker.getRunnedTime() != null) {
doneWorkers.add(worker);
}
}
int size = doneWorkers.size();
if (size >= MIN_WORKERS_SAME_RESULT) {
all:
for (Worker<K, V, KR, VR> worker : doneWorkers) {
int sameResult = 1;//because clearly it is equal to himself
for (Worker<K, V, KR, VR> w : doneWorkers) {
if (worker != w) {
if (Arrays.equals(worker.getCollector().getHash(), w.getCollector().getHash())) {
sameResult++;
}
if (sameResult >= MIN_WORKERS_SAME_RESULT) {
dataCollectorSet.addCollector(worker.getCollector());
jobWorkers.remove(worker);
doneWorkers.clear();
break all;
}
}
}
}
if (size != 1 && !doneWorkers.isEmpty()) {
if (taskDescription.stopOnRedundantError()) {
throw new Error("Inconsistency Found in redundant computing");
} else {
System.err.println("Inconsistency Found, will continue doing the job, but ONLY PARTIAL RESULT will be available at the end");
}
}
for (Worker<K, V, KR, VR> worker : jobWorkers) {
ThreadManager.removeRunnable(worker);
worker.killworker(); //I can do that because i've already removed a worker from the list: jobWorkers.remove(worker);
worker.clearCollector();//useless already done in killworker
}
jobWorkers.clear();
jobsWorkersList.remove(jobWorkers);
return true;
}
return false;
}
public void add(Worker<K, V, KR, VR> worker) {
if (worker == null) {
return;
}
ArrayList<Worker<K, V, KR, VR>> workers = null;
if (taskDescription != null) {
workers = worker.clone(RUN_JOB_TIMES, taskDescription);
}
if (workers == null) {
return;
}
for (Worker<K, V, KR, VR> w : workers) {
try {
ThreadManager.addRunnable(w);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
jobsWorkersList.add(workers);
}
public synchronized boolean end() throws InterruptedException {
stop = true;
synchronized (lock) {
lock.notifyAll();
}
if (!end) {
this.join();
}
return end;
}
}
| [
"[email protected]"
] | |
b7fa51dc7d1ed336a4906e691603006c57e4a618 | f10666ba6c1c5d04f7362b3ec79ed8c4df358c86 | /platform/monitor/src/main/java/com/cola/platform/monitor/MonitorServerRunner.java | 8342de5f55d3a5d9ada6fbafe02a6cfd682947a1 | [
"Apache-2.0"
] | permissive | liuzuolin/cola | 366c8d5bfb7db46b50fe67096e0ae162aa0093db | ed6af470d4879fd703996ef0c6b1d553af2b65dc | refs/heads/master | 2020-03-30T05:50:23.207520 | 2018-09-28T09:22:24 | 2018-09-28T09:22:24 | 150,822,739 | 1 | 0 | Apache-2.0 | 2018-09-29T03:56:51 | 2018-09-29T03:56:51 | null | UTF-8 | Java | false | false | 1,509 | java | /*
* Copyright 2002-${Year} the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.cola.platform.monitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
/**
* cola
* Created by jiachen.shi on 6/16/2016.
*/
@SpringBootApplication
@EnableEurekaClient
@EnableHystrixDashboard
@EnableTurbine
public class MonitorServerRunner {
private static Logger logger = LoggerFactory.getLogger(MonitorServerRunner.class);
public static void main(String[] args) {
SpringApplication app = new SpringApplication(MonitorServerRunner.class);
//app.setShowBanner(false);
app.run(args);
}
}
| [
"[email protected]"
] | |
7a544d3ff835b4feb360954b546b53fdf96bf81b | 69311ed74923aaa73393289bbdbe2e00f10a0034 | /src/main/java/com/mjj/travelling/service/Impl/TeamPostServiceImpl.java | d732dbb4da21080f8f0e921e374453b8903083af | [] | no_license | majj1995/HaiJiao_Backend | a1487a111e0f6d4e1d8dcd353369fd46bf28b17d | 529bc466a3ecdc96feaaee254d0b92c03ecd1108 | refs/heads/master | 2020-04-20T15:16:03.482691 | 2019-02-03T08:17:37 | 2019-02-03T08:17:37 | 168,923,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,408 | java | package com.mjj.travelling.service.Impl;
import com.mjj.travelling.dao.TeamPostRepository;
import com.mjj.travelling.model.Post;
import com.mjj.travelling.model.TeamPost;
import com.mjj.travelling.model.User;
import com.mjj.travelling.service.TeamPostService;
import com.mjj.travelling.service.VO.TeamPostVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TeamPostServiceImpl implements TeamPostService {
@Autowired
private TeamPostRepository teamPostRepository;
@Autowired
private TeamServiceImpl teamService;
private final static Integer PAGE_SIZE = 10;
@Override
public TeamPost save(TeamPost teamPost) {
return teamPostRepository.save(teamPost);
}
@Override
public void delete(Integer teamPostId) {
teamPostRepository.deleteById(teamPostId);
}
@Override
public Page<TeamPost> load(Integer page) {
return load(page, PAGE_SIZE);
}
@Override
public Page<TeamPost> load(Integer page, Integer size) {
if (page == null) {
page = 0;
}
if (size == null || size == 0) {
size = PAGE_SIZE;
}
Pageable pageable = PageRequest.of(page, size);
Page<TeamPost> teamPosts = teamPostRepository.findAll(pageable);
return teamPosts;
}
@Override
public TeamPostVO loadByTeamPostId(Integer teamPostId) {
TeamPost teamPost = teamPostRepository.findById(teamPostId).orElse(null);
TeamPostVO teamPostVO = new TeamPostVO();
List<User> members = teamService.loadByTeamPostId(teamPostId);
teamPostVO.setTeamPost(teamPost);
teamPostVO.setMembers(members);
return teamPostVO;
}
@Override
public void incLikesNum(Integer teamPostId) {
TeamPost teamPost = teamPostRepository.findById(teamPostId).orElse(null);
teamPost.setLikes(teamPost.getLikes() + 1);
save(teamPost);
}
@Override
public void decLikesNum(Integer teamPostId) {
TeamPost teamPost = teamPostRepository.findById(teamPostId).orElse(null);
teamPost.setLikes(teamPost.getLikes() - 1);
save(teamPost);
}
}
| [
"[email protected]"
] | |
d924721309651043e694e11acc8dda3f265edcd3 | 0806a7984f340fed66db1fca723ce79ede258d6e | /transfuse-bootstrap/src/main/java/org/androidtransfuse/bootstrap/Bootstraps.java | da4e361fb450a83a4bdecd8d387b0594ef5415c9 | [
"Apache-2.0"
] | permissive | jschmid/transfuse | 59322fbb22790afad799cff71b20b7f26858cb98 | 8856e059d972e023fb30d5bed5575423d5bc3a67 | refs/heads/master | 2021-01-21T00:05:20.613394 | 2013-07-14T22:15:59 | 2013-07-14T22:15:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,727 | java | /**
* Copyright 2013 John Ericksen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.androidtransfuse.bootstrap;
import org.androidtransfuse.scope.Scope;
import org.androidtransfuse.scope.ScopeKey;
import org.androidtransfuse.scope.Scopes;
import org.androidtransfuse.util.GeneratedCodeRepository;
import org.androidtransfuse.util.Providers;
import java.lang.annotation.Annotation;
import java.util.HashMap;
import java.util.Map;
/**
* @author John Ericksen
*/
public final class Bootstraps {
public static final String BOOTSTRAPS_INJECTOR_PACKAGE = "org.androidtransfuse.bootstrap";
public static final String BOOTSTRAPS_INJECTOR_NAME = "Bootstraps$Factory";
public static final String BOOTSTRAPS_INJECTOR_METHOD = "inject";
public static final String BOOTSTRAPS_INJECTOR_GET = "get";
public static final String IMPL_EXT = "$Bootstrap";
private static final GeneratedCodeRepository<BootstrapInjector> REPOSITORY =
new GeneratedCodeRepository<BootstrapInjector>(BOOTSTRAPS_INJECTOR_PACKAGE, BOOTSTRAPS_INJECTOR_NAME) {
@Override
public BootstrapInjector findClass(Class clazz) {
try {
Class bootstrapClass = Class.forName(clazz.getName() + IMPL_EXT);
return new BootstrapInjectorReflectionProxy(bootstrapClass);
} catch (ClassNotFoundException e) {
return null;
}
}
};
private Bootstraps(){
//private utility constructor
}
@SuppressWarnings("unchecked")
public static <T> void inject(T input){
REPOSITORY.get(input.getClass()).inject(input);
}
@SuppressWarnings("unchecked")
public static <T> BootstrapInjector<T> getInjector(Class<T> clazz){
return REPOSITORY.get(clazz);
}
public interface BootstrapInjector<T>{
void inject(T input);
<S> BootstrapInjector<T> add(Class<? extends Annotation> scope, Class<S> singletonClass, S singleton);
}
public abstract static class BootstrapsInjectorAdapter<T> implements BootstrapInjector<T>{
private final Map<Class<? extends Annotation> , Map<Class, Object>> scoped = new HashMap<Class<? extends Annotation> , Map<Class, Object>>();
public <S> BootstrapInjector<T> add(Class<? extends Annotation> scope, Class<S> bindType, S instance){
if(!scoped.containsKey(scope)){
scoped.put(scope, new HashMap<Class, Object>());
}
scoped.get(scope).put(bindType, instance);
return this;
}
protected void scopeSingletons(Scopes scopes){
for (Map.Entry<Class<? extends Annotation>, Map<Class, Object>> scopedEntry : scoped.entrySet()) {
Scope scope = scopes.getScope(scopedEntry.getKey());
if(scope != null){
for (Map.Entry<Class, Object> scopingEntry : scopedEntry.getValue().entrySet()) {
scope.getScopedObject(ScopeKey.of(scopingEntry.getKey()), Providers.of(scopingEntry.getValue()));
}
}
}
}
}
}
| [
"[email protected]"
] | |
5f2591e394bc9110dfbf46b9714cf686517a3a91 | 175e7e6723533cbda44ebd066355b5148875aace | /core/src/main/java/org/projectfloodlight/db/data/IterableLeafListDataNode.java | 12c27cc20b55b3c6ab5ab225187aadf98cdd93e6 | [
"Apache-2.0"
] | permissive | kwanggithub/floodlight-floodlight | 582a87623b3cad3909ef71ad92a2c52f66a6f0c9 | 48082ff4680768818ed3e83a776b04b5cd0f429d | refs/heads/master | 2021-01-15T20:52:28.730025 | 2013-08-07T22:37:53 | 2013-08-07T22:37:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,357 | java | package org.projectfloodlight.db.data;
import java.util.Iterator;
import org.projectfloodlight.db.schema.LeafListSchemaNode;
import org.projectfloodlight.db.schema.SchemaNode;
public class IterableLeafListDataNode extends AbstractLeafListDataNode {
private LeafListSchemaNode leafListSchemaNode;
private Iterable<?> iterable;
private IterableLeafListDataNode(SchemaNode leafListSchemaNode,
Iterable<?> iterable) {
super();
assert leafListSchemaNode != null;
assert leafListSchemaNode instanceof LeafListSchemaNode;
assert iterable != null;
this.leafListSchemaNode = (LeafListSchemaNode) leafListSchemaNode;
this.iterable = iterable;
}
public static IterableLeafListDataNode from(SchemaNode leafListSchemaNode,
Iterable<?> iterable) {
return new IterableLeafListDataNode(leafListSchemaNode, iterable);
}
@Override
public DigestValue computeDigestValue() {
// Computing the digest values for logical data nodes would be
// expensive so for now we just don't support it.
// We'll see if it's needed.
return null;
}
@Override
public Iterator<DataNode> iterator() {
return new DataNodeMappingIterator(iterable.iterator(),
leafListSchemaNode.getLeafSchemaNode());
}
}
| [
"[email protected]"
] | |
4a1ab01f9de6cc3288af0a26564de967d43b26ca | fde1f0299cbaafd0558025db72f80c0e425ce263 | /CaelumExercicios/projetofuncionario/src/br/com/projetofuncionario/main/UsaFuncionario.java | 4643ada4d29d6beb736ad3c9b34228c9f0a9ce74 | [] | no_license | NielterBrenno/EstudoJava | 1427b69036845b573af3c8a21d5bb14ddcd69e5e | 4b3edb40821c6283553f797a6f3afc17a1a174b6 | refs/heads/master | 2023-08-10T00:21:16.648285 | 2020-06-19T18:42:22 | 2020-06-19T18:42:22 | 161,250,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | package br.com.projetofuncionario.main;
import br.com.projetofuncionario.models.Motorista;
import br.com.projetofuncionario.models.Programador;
public class UsaFuncionario {
public static void main(String[] args) {
Programador p = new Programador(289, "Ana","php");
Motorista m = new Motorista(2,"pedro");
System.out.println(p.getId());
}
}
| [
"[email protected]"
] | |
cb57d711a403f7e9c0be123c3e8d84f7b71590f7 | 1a759dd79a427c3ec541b3fedb120c1dc976e718 | /src/test/java/fr/game/advent/day08/trial/GameTwoBisTest.java | 5d89ff9c958f90a58c1ac0a51a2768c2fb8e2e8c | [] | no_license | mika44/advent-of-code-2018 | 1db2841817bad1a7374359e745aa8a8518abd6ad | fc2d30337744c5ecee8e8bb2c1e4eaa5ba911c0e | refs/heads/master | 2020-04-09T07:54:57.368391 | 2018-12-10T06:07:40 | 2018-12-10T06:07:40 | 160,175,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 450 | java | package fr.game.advent.day08.trial;
import java.util.Arrays;
import org.junit.Assert;
import org.junit.Test;
public class GameTwoBisTest {
private GameTwoBis gameTwoBis = new GameTwoBis();
@Test
public void testExemple1() {
Assert.assertEquals(new Integer(66), gameTwoBis.play(Arrays.asList("2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2")));
}
@Test
public void testGame() {
Assert.assertEquals(new Integer(19276), gameTwoBis.play());
}
}
| [
"[email protected]"
] | |
3b37e0be3797c220d9c1226b4c86893bedd3b9ed | 55e5757d7a4eee6c4d27b08985f4b9171713b06d | /src/com/imooc/page/servlet/SublistServlet.java | 3828c6669334fc72bf4a04d6af963a914382744f | [] | no_license | 511733119/Paging | bd6e39751c660639a9cd04b5619b2a342c17b604 | b329835e36593e510ae96371ecec71c81c2af0a7 | refs/heads/master | 2020-12-31T04:07:16.351513 | 2017-03-07T15:51:54 | 2017-03-07T15:51:54 | 69,638,757 | 1 | 1 | null | null | null | null | GB18030 | Java | false | false | 2,264 | java | package com.imooc.page.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.imooc.page.dao.SublistStudentDaoImpl;
import com.imooc.page.model.Pager;
import com.imooc.page.model.Student;
import com.imooc.page.server.Constant;
import com.imooc.page.server.StudentService;
import com.imooc.page.server.SublistStudentServiceImpl;
public class SublistServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private StudentService studentService = new SublistStudentServiceImpl();
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//接收request里的参数
//学生姓名
String stuName = request.getParameter("stuName");
//获取学生性别
int gender = Constant.DEFAULT_GENDER;
String genderStr = request.getParameter("gender");
if(genderStr!=null && !"".equals(genderStr.trim())){
gender = Integer.parseInt(genderStr);
}
//显示第几页数据
int pageNum = Constant.DEFAULT_PAGE_NUM;
String pageNumStr = request.getParameter("pageNum");
if(pageNumStr!=null && !"".equals(pageNumStr.trim())){
pageNum = Integer.parseInt(pageNumStr);
}
//每页显示多少条记录
int pageSize = Constant.DEFAULT_PAGE_SIZE;
String pageSizeStr = request.getParameter("pageSize");
if(pageSizeStr!=null && !"".equals(pageSizeStr.trim())){
pageSize = Integer.parseInt(pageSizeStr);
}
//组装查询条件
Student searchModel = new Student();
searchModel.setStuName(stuName);
searchModel.setGender(gender);
//调用service获取查询结果
Pager<Student> result = studentService.findStudent(searchModel, pageNum, pageSize);
//返回结果到页面
request.setAttribute("result", result);
request.getRequestDispatcher("/sublistStudent.jsp").forward(request, response);;
}
}
| [
"[email protected]"
] | |
a5f1e815c5ce82c2a5ccef46f5d508e011226948 | bb36d9d84564f52bd8408d6e877a55574ad65948 | /Q1.java | 3f725ef97b067ef4e92dc5821f4d500fda2f8211 | [] | no_license | Mohamed-Razan/Hackerrank-Java | 20e52bc98199d230a7b4287f4f92c5e8e10470d9 | b0fe097527315fac63257f2aa210b2143b5ae0e8 | refs/heads/master | 2023-04-24T03:01:47.000207 | 2021-05-16T13:03:38 | 2021-05-16T13:03:38 | 367,032,721 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | // Question: https://www.hackerrank.com/challenges/welcome-to-java/problem
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Print output to STDOUT. Your class should be named Solution. */
System.out.println("Hello, World.");
System.out.println("Hello, Java.");
}
}
| [
"[email protected]"
] | |
7abd5c3715d3f74c7a09f0ecf8cad72f6cd639e1 | 3eb360b54c646b2bdf9239696ddd7ce8409ece8d | /lm_terminal/src/com/lauvan/resource/service/impl/LegalServiceImpl.java | e56a61586ffa07c9eecaf864e6305135c3484b93 | [] | no_license | amoydream/workspace | 46a8052230a1eeede2c51b5ed2ca9e4c3f8fc39e | 72f0f1db3e4a63916634929210d0ab3512a69df5 | refs/heads/master | 2021-06-11T12:05:24.524282 | 2017-03-01T01:43:35 | 2017-03-01T01:43:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.lauvan.resource.service.impl;
import org.springframework.stereotype.Service;
import com.lauvan.base.dao.BaseDAOSupport;
import com.lauvan.resource.entity.R_Legal;
import com.lauvan.resource.service.LegalService;
@Service("legalService")
public class LegalServiceImpl extends BaseDAOSupport<R_Legal>
implements LegalService{
}
| [
"[email protected]"
] | |
c0362f77a266ca2dcf25fa0807f8df1bbf621369 | a69f0c0d1e9aa3b3027b5329fed80ced067808c7 | /JavaHometasks/src/JavaErrorsExceptions/UniversityStructure/Faculty.java | 7117335ae4a6b799f0c647e0db88fa2fcb92209c | [] | no_license | ansemch/AutomatedTestingOnlineHometasks | 8183f82e7b4d37e279887a5431b4ab08a511f35d | c7492d1aec5a0124d8541a12f8ce65cab84c58f7 | refs/heads/master | 2021-07-14T19:58:43.648803 | 2019-09-30T19:05:30 | 2019-09-30T19:05:30 | 211,783,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | package JavaErrorsExceptions.UniversityStructure;
import JavaErrorsExceptions.Exceptions.NoGroupsForFacultyException;
import java.util.HashSet;
import java.util.Set;
public class Faculty {
private int id;
private String name;
private Set <Group> groups;
public Faculty(int id, String name) {
this.id=id;
this.name=name;
groups = new HashSet <Group>();
}
public void addGroup(Group group) { groups.add(group); };
public Set <Group> getGroups() {
try {
if (groups.isEmpty()) {
System.out.println("No groups at a faculty");
throw new NoGroupsForFacultyException();
}
} catch (Exception e) {
e.printStackTrace();
}
return groups;
}
}
| [
"[email protected]"
] | |
d2a363f22ecb1fd4344a126d04f65a3e015b23d0 | 309d7d568d06de4b8798662ee783845d1dbc6799 | /WebTabanliKayitDefteri/src/main/java/com/cs/business/concretes/KayitManager.java | 6262cbe94fb773d791ab93e3c1f48f0ecd61b949 | [] | no_license | fatocan83/kayitDefteri | 21fefff763fb183aa3195b3b5cf693baae211944 | 80479e265c3bd8f468e2d1b0165afc55de8f3b14 | refs/heads/main | 2023-06-05T10:40:49.389159 | 2021-06-24T20:13:26 | 2021-06-24T20:13:26 | 380,036,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package com.cs.business.concretes;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.cs.business.abstracts.IKayitService;
import com.cs.dao.abstracts.IKayitDao;
import com.cs.model.Kayit;
@Service
public class KayitManager implements IKayitService {
@Autowired
private IKayitDao kayitDao;
@Override
@Transactional
public int addKayit(Kayit kayit) {
return kayitDao.addKayit(kayit);
}
@Override
@Transactional
public List<Kayit> listKayit() {
return kayitDao.listKayit();
}
}
| [
"[email protected]"
] | |
c84146119223b8f088d3db5cc2acbd0afbbf6d8b | bb97256378f8b107c8fcf27c9593a833dbff65e5 | /src/ncs/test15/Book.java | 68d66e629553b50933c5bb2b19fef3a3013bd658 | [] | no_license | jazzhong1/javaTest3 | 652e2e6ad7803fc84100e751217db6443aac8fe9 | a3a8b0d54728e3eb734d94a59cd3ae354fa7069c | refs/heads/master | 2021-04-15T11:49:36.010800 | 2018-04-05T23:39:34 | 2018-04-05T23:39:34 | 126,347,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,282 | java | package ncs.test15;
public class Book {
private String title;
private String author;
private int price;
private String publisher;
private double discountRate;
public Book() {
// TODO Auto-generated constructor stub
}
public Book(String title,String author,int price, String publisher,double discountRate) {
this.title=title;
this.author=author;
this.price=price;
this.publisher=publisher;
this.discountRate=discountRate;
}
@Override
public String toString() {
String result=this.getTitle()+","+this.getAuthor()+","+this.getPrice()+","+this.getPublisher()+","+(int)(this.getDiscountRate()*100)+" %할인";
return result;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public double getDiscountRate() {
return discountRate;
}
public void setDiscountRate(double discountRate) {
this.discountRate = discountRate;
}
}
| [
"[email protected]"
] | |
2029eeb4ede6f32e5ffbb37c924481db7dbc667f | 5039317afe0b5d6e901ddc7e465af488597db42b | /WEB-INF/src/com/skymiracle/wpx/models/WpxMdo_X.java | c4438f452f9a0e6ae94f3058bddcf57979b5b636 | [] | no_license | neorayer/wpx | 774b7f05c84a293d099db05033817a03e0cbbe7c | 8d34e9e74a79aea776d2ea9bfde7754ba416fbca | refs/heads/master | 2021-01-10T07:05:53.087756 | 2016-02-24T04:49:30 | 2016-02-24T04:49:30 | 52,413,781 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 264 | java | package com.skymiracle.wpx.models;
import static com.skymiracle.wpx.Singletons.*;
import com.skymiracle.mdo5.Mdo_X;
public abstract class WpxMdo_X<T extends WpxMdo<T>> extends Mdo_X<T>{
public WpxMdo_X(Class<T> mdoClass) {
super(mdoClass, appStore);
}
}
| [
"[email protected]"
] | |
996f1924d3855835a5ffae654196e4b4d8f51203 | d528fe4f3aa3a7eca7c5ba4e0aee43421e60857f | /src/xsgzgl/wjcf/general/GlobalsValue.java | 0863d14fbd0be9d202666fc140273beae869f015 | [] | no_license | gxlioper/xajd | 81bd19a7c4b9f2d1a41a23295497b6de0dae4169 | b7d4237acf7d6ffeca1c4a5a6717594ca55f1673 | refs/heads/master | 2022-03-06T15:49:34.004924 | 2019-11-19T07:43:25 | 2019-11-19T07:43:25 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 641 | java | package xsgzgl.wjcf.general;
import xgxt.action.Base;
public class GlobalsValue {
public static String xxpymc;// 学校拼音名称
public static String[] xxdmValue = new String[] {};// 学校代码
public static String[] xxmcValue = new String[] {};// 学校
// ###########################end#####################################
public static String getXxpymc(String xxdm) {
for (int i = 0; i < xxdmValue.length; i++) {
if (xxdm.equalsIgnoreCase(xxdmValue[i])) {
xxpymc = xxmcValue[i];
break;
}
}
if (Base.isNull(xxpymc)) {
xxpymc = "general";
}
return xxpymc;
}
}
| [
"[email protected]"
] | |
3bf85d4c18ecfdab581c806e7760a1a4611edfd8 | b89eb13a43cd9668393de0ee00366b160808234a | /app/src/main/java/com/aier/ardemo/http/basis/BaseSubscriber.java | ca7c144bc16298207b162bd79930b378b1b22470 | [] | no_license | xiaohualaila/demo | c01b7387c2d3b036d8d9e8fb4782f7e7d1854b8e | 2be2efcfdad53ac5cf903c72f85671b5ccb461e8 | refs/heads/master | 2020-05-16T17:12:59.793540 | 2019-05-05T11:26:05 | 2019-05-05T11:26:05 | 183,186,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,504 | java | package com.aier.ardemo.http.basis;
import com.aier.ardemo.http.basis.callback.RequestCallback;
import com.aier.ardemo.http.basis.callback.RequestMultiplyCallback;
import com.aier.ardemo.holder.ToastHolder;
import com.aier.ardemo.http.basis.config.HttpCode;
import com.aier.ardemo.http.basis.exception.base.BaseException;
import io.reactivex.observers.DisposableObserver;
/**
* 作者:leavesC
* 时间:2018/10/27 20:52
* 描述:
* GitHub:https://github.com/leavesC
* Blog:https://www.jianshu.com/u/9df45b87cfdf
*/
public class BaseSubscriber<T> extends DisposableObserver<T> {
private RequestCallback<T> requestCallback;
BaseSubscriber(RequestCallback<T> requestCallback) {
this.requestCallback = requestCallback;
}
@Override
public void onNext(T t) {
if (requestCallback != null) {
requestCallback.onSuccess(t);
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
if (requestCallback instanceof RequestMultiplyCallback) {
RequestMultiplyCallback callback = (RequestMultiplyCallback) requestCallback;
if (e instanceof BaseException) {
callback.onFail((BaseException) e);
} else {
callback.onFail(new BaseException(HttpCode.CODE_UNKNOWN, e.getMessage()));
}
} else {
ToastHolder.showToast(e.getMessage());
}
}
@Override
public void onComplete() {
}
} | [
"[email protected]"
] | |
2c7cc28ced722940a63f5e0003a56e0ecffea974 | fe83da963d2eeaf3f4fe2a5c1db6438b42f1d5cd | /com.bitcoin.dy.2.0.0/src/com/mvc/controller/PayController.java | d562840c6d1e009151479a1cd16fd1cc71c9d626 | [] | no_license | fantianmi/coins.new | 36804da687e816f2b12faa705b71ae699c5d688d | baae38d04dd2c16617e79d6418474fadbdb3824b | refs/heads/master | 2020-05-31T21:43:44.618516 | 2014-10-09T16:28:44 | 2014-10-09T16:28:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,050 | java | package com.mvc.controller;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import com.mvc.entity.Btc_profit;
import com.mvc.entity.Btc_rechargeCNY_order;
import com.mvc.entity.Btc_user;
import com.mvc.service.ProfitService;
import com.mvc.service.RechargeService;
import com.mvc.util.DataUtil;
import com.mvc.util.MD5Util;
import com.mvc.vo.pay.Yeepay;
import com.mvc.vo.pay.Zhifu;
@Controller
@RequestMapping("/pay.do")
public class PayController {
@Autowired
private RechargeService rs = new RechargeService();
@Autowired
private ProfitService profitService = new ProfitService();
@Autowired
private MD5Util md5util;
@Autowired
private DataUtil datautil;
ResourceBundle payres = ResourceBundle.getBundle("zhifu");
ResourceBundle msgres = ResourceBundle.getBundle("msg");
protected final transient Log log = LogFactory
.getLog(RechargeController.class);
@RequestMapping
public String load(ModelMap modelMap, HttpServletRequest request) {
return "index";
}
@RequestMapping(params = "CNY")
public String rechargeCNY
(ModelMap modelMap, HttpServletRequest request,HttpServletResponse response) throws IOException {
HttpSession session = request.getSession();
String code = (String) session
.getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
if (session.getAttribute("globaluser") == null) {
request.setAttribute("msg", "登陆后才能进行此操作!");
request.setAttribute("href", "index.do?recharge2bank");
return "redirect";
}
Btc_user user = (Btc_user)session.getAttribute("globaluser");
if (user.getUstatus().equals("frozen")) {
request.setAttribute("msg", "您的账户已被冻结,无法进行任何操作,请尽快联系客服人员解冻");
request.setAttribute("href", "index.do?recharge2bank");
return "redirect";
}
if (!user.getUstatus().equals("active")) {
request.setAttribute("msg", "您的账户未激活,请查看您的注册邮箱点击链接激活,或者联系客服进行人工激活");
request.setAttribute("href", "index.do?userdetail");
return "redirect";
}
Btc_profit btc_profit = profitService.getConfig();
BigDecimal bro_recharge_acount = new BigDecimal(request.getParameter("order_amount").toString());
BigDecimal rechargeCNY_limit = btc_profit.getBtc_profit_rechargeCNY_limit();
if (bro_recharge_acount.compareTo(rechargeCNY_limit) == -1) {
request.setAttribute("msg", "充值金额少于最低限制,系统不予受理,请重新输入");
request.setAttribute("href", "index.do?recharge2bank");
return "redirect";
}
//以前充值功能参数
String bro_recharge_way = request.getParameter("bro_recharge_way");
//save order
String bro_recharge_time=datautil.getTimeNow("second");
BigDecimal bro_factorage = bro_recharge_acount.multiply(btc_profit.getBtc_profit_rechargeCNY_poundage());
bro_factorage.setScale(2, BigDecimal.ROUND_HALF_UP);
String billNo= String.valueOf(System.currentTimeMillis());
Btc_rechargeCNY_order bro = new Btc_rechargeCNY_order();
bro.setBro_recharge_acount(bro_recharge_acount);
bro.setBro_recharge_time(bro_recharge_time);
bro.setBro_sname(user.getUname());
bro.setBro_rname(payres.getString("payway"));
bro.setBro_recharge_way(bro_recharge_way);
bro.setUid(user.getUid());
bro.setBro_remark("等待支付");
bro.setBro_factorage(bro_factorage);
bro.setBillNo(billNo);
rs.rechargeCNY(bro);
Zhifu zhifu = new Zhifu(bro_recharge_acount, billNo);
request.setAttribute("zhifu", zhifu);
return "gotopay4"+payres.getString("payway")+"";
}
}
| [
"[email protected]"
] | |
4d6dbe43548d9477582090f55aa093d7c8d9a9ca | 48cbc2c384d0f279bbe6713fbdee6167c0cb64be | /app/src/main/java/net/bndy/ad/service/DbHelper.java | cc899478ccaed158e1f7f0bdbca514a27285a803 | [
"MIT"
] | permissive | bndynet/android-starter | 1d6257aead017c1b2fe38048432239ff8a12423b | 30e0894121f1adb713e49a9c56696d6cc391e3b3 | refs/heads/master | 2020-03-30T04:13:36.671235 | 2019-03-31T02:31:41 | 2019-03-31T02:31:41 | 150,730,972 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package net.bndy.ad.service;
import android.content.Context;
import net.bndy.ad.framework.data.SQLiteForEntityProvider;
public class DbHelper extends SQLiteForEntityProvider {
private static final String DB_NAME = "LOG";
public DbHelper(Context context, Class<?>... clazzes) {
super(context, DB_NAME, clazzes);
}
}
| [
"[email protected]"
] | |
fe3d72e059ca8b6b1b60520285e42126cba3f173 | 66884071bc8928313136ef6766407832b1a13361 | /src/main/java/mf/uz/services/RoleService.java | 907deea427e6c0d5967778024f6d2d22f52cc755 | [] | no_license | Qurbonov/UserManagementAngular | 53b41752b103ddec092fa6434a684ef586a17b3e | fd77355733e611b6e4e297ba0e845fca9f80d65f | refs/heads/master | 2021-01-10T16:11:44.513135 | 2016-04-06T17:12:04 | 2016-04-06T17:12:04 | 49,048,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 651 | java | package mf.uz.services;
import mf.uz.domain.Role;
import mf.uz.repositories.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by qurbonov on 10/6/2015.
*/
@Service
public class RoleService {
@Autowired
RoleRepository roleRepository;
public List<Role> findAll() {
return roleRepository.findAll(new Sort(new Sort.Order(Sort.Direction.ASC, "id")));
}
public Role findOne(Long id) {
return roleRepository.findOne(id);
}
}
| [
"Qurbonov@myPC"
] | Qurbonov@myPC |
138bb0cee1b198c9d4f4af28797d409a7287a0e6 | b55fff51aba2f734f5b12d17bb947fe0f835ac4e | /org/w3c/css/atrules/css3/media/MediaResolution.java | 3f23c6553c06195888c3c704ce3526d8eae7abf0 | [
"W3C-20150513",
"W3C"
] | permissive | Handig-Eekhoorn/css-validator | ca27249b95b76d013702d9470581370ce7778bcb | f6841dadfe5ca98c891d239a3d481347bdb34502 | refs/heads/heek-master | 2023-03-23T02:54:33.121767 | 2020-01-07T22:00:37 | 2020-01-07T22:00:37 | 215,892,548 | 1 | 0 | NOASSERTION | 2022-06-07T14:46:11 | 2019-10-17T21:58:07 | Java | UTF-8 | Java | false | false | 5,088 | java | // $Id$
//
// (c) COPYRIGHT MIT, ECRIM and Keio University, 2011
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.atrules.css3.media;
import org.w3c.css.atrules.css.media.MediaFeature;
import org.w3c.css.atrules.css.media.MediaRangeFeature;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssComparator;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssResolution;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;
/**
* @spec https://www.w3.org/TR/2017/CR-mediaqueries-4-20170905/#descdef-media-resolution
*/
public class MediaResolution extends MediaRangeFeature {
/**
* Create a new MediaResolution
*/
public MediaResolution() {
}
/**
* Create a new MediaResolution
*
* @param expression The expression for this media feature
* @throws org.w3c.css.util.InvalidParamException
* Values are incorrect
*/
public MediaResolution(ApplContext ac, String modifier,
CssExpression expression, boolean check)
throws InvalidParamException {
if (expression != null) {
if (expression.getCount() > 2) {
throw new InvalidParamException("unrecognize", ac);
}
if (expression.getCount() == 0) {
throw new InvalidParamException("few-value", getFeatureName(), ac);
}
CssValue val = expression.getValue();
// it must be a >=0 integer only
switch (val.getType()) {
case CssTypes.CSS_COMPARATOR:
if (modifier != null) {
throw new InvalidParamException("nomodifierrangemedia",
getFeatureName(), ac);
}
CssComparator p = (CssComparator) val;
value = checkValue(ac, p.getParameters(), getFeatureName());
comparator = p.toString();
expression.next();
if (!expression.end()) {
val = expression.getValue();
if (val.getType() != CssTypes.CSS_COMPARATOR) {
throw new InvalidParamException("unrecognize", ac);
}
CssComparator p2;
p2 = (CssComparator) val;
otherValue = checkValue(ac, p2.getParameters(), getFeatureName());
otherComparator = p2.toString();
checkComparators(ac, p, p2, getFeatureName());
}
break;
case CssTypes.CSS_RESOLUTION:
value = checkValue(ac, expression, getFeatureName());
break;
default:
throw new InvalidParamException("unrecognize", ac);
}
expression.next();
setModifier(ac, modifier);
} else {
if (modifier != null) {
throw new InvalidParamException("nomodifiershortmedia",
getFeatureName(), ac);
}
}
}
static CssValue checkValue(ApplContext ac, CssExpression expression, String caller)
throws InvalidParamException {
if (expression.getCount() == 0) {
throw new InvalidParamException("few-value", caller, ac);
}
CssValue val = expression.getValue();
CssValue value = null;
// it must be a >=0 integer only
if (val.getType() == CssTypes.CSS_RESOLUTION) {
CssResolution valnum = (CssResolution) val;
if (valnum.getFloatValue() < 0.f) {
throw new InvalidParamException("negative-value",
val.toString(), ac);
}
value = valnum;
} else {
throw new InvalidParamException("unrecognize", ac);
}
return value;
}
public MediaResolution(ApplContext ac, String modifier, CssExpression expression)
throws InvalidParamException {
this(ac, modifier, expression, false);
}
/**
* Returns the value of this media feature.
*/
public Object get() {
return value;
}
/**
* Returns the name of this media feature.
*/
public final String getFeatureName() {
return "resolution";
}
/**
* Compares two media features for equality.
*
* @param other The other media features.
*/
public boolean equals(MediaFeature other) {
try {
MediaResolution mr = (MediaResolution) other;
return (((value == null) && (mr.value == null)) || ((value != null) && value.equals(mr.value)))
&& (((modifier == null) && (mr.modifier == null)) || ((modifier != null) && modifier.equals(mr.modifier)));
} catch (ClassCastException cce) {
return false;
}
}
}
| [
"[email protected]"
] | |
948038b9eac5bc27af2253d1421389c9b3b255dd | 68e0cdd5365490b27b91d514d21395b727447ff4 | /src/main/java/com/niule/znxj/web/dao/KnowledgeMapper.java | 635f0140943c7847bf4c44d0a6322e0dbd309da5 | [] | no_license | caidaoyu/znxj_app | 80bfa5dac339b77880c9a8251dcdcc935fe9b300 | aa8504168845383e72f12a5662ed65c05f37d9b0 | refs/heads/master | 2022-04-22T17:47:48.201562 | 2020-04-16T11:02:10 | 2020-04-16T11:02:10 | 256,189,475 | 1 | 0 | null | 2020-04-16T11:02:35 | 2020-04-16T11:02:34 | null | UTF-8 | Java | false | false | 1,057 | java | package com.niule.znxj.web.dao;
import com.niule.znxj.web.model.Knowledge;
import com.niule.znxj.web.model.KnowledgeExample;
import java.util.HashMap;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface KnowledgeMapper {
int countByExample(KnowledgeExample example);
int deleteByExample(KnowledgeExample example);
int deleteByPrimaryKey(Integer id);
int insert(Knowledge record);
int insertSelective(Knowledge record);
List<Knowledge> selectByExample(HashMap<String, Object> map);
Knowledge selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") Knowledge record, @Param("example") KnowledgeExample example);
int updateByExample(@Param("record") Knowledge record, @Param("example") KnowledgeExample example);
int updateByPrimaryKeySelective(Knowledge record);
int updateByPrimaryKey(Knowledge record);
List<Knowledge>getKnowledgeByTypeid(int typeid);
List<Knowledge>getKnowledgeByParam(String str);
} | [
"[email protected]"
] | |
95587993145c0d5ddae706325fdc467cf70044ff | 77a4aeaf5126a36fc50edae128571a1638866ffa | /sample/src/main/java/codetoart/sampleanimations/LoadingButtonActivity.java | f91e2d08a2dd72dd918d490111603da3e895fc8e | [] | no_license | codetoart/C2AAnimations | 5ead8b83fe3925aeb308500420dda2840f3e6032 | 37fb0482e33d79eb3618b7396b97b930352064bc | refs/heads/master | 2021-01-23T08:00:02.109986 | 2017-03-07T14:02:30 | 2017-03-07T14:02:30 | 80,525,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,012 | java | package codetoart.sampleanimations;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.codetoart.c2aanimations.widget.C2AAnimationLoadingButton;
public class LoadingButtonActivity extends AppCompatActivity {
private EditText mEditUsername, mEditPassword;
private C2AAnimationLoadingButton mButton;
private LinearLayout mRootLayout;
private Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading_button);
initView();
}
private void initView() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
TextView toolbarTitle = (TextView) mToolbar.findViewById(R.id.toolbar_title);
toolbarTitle.setText("Loading Button");
getSupportActionBar().setTitle("");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mEditUsername = (EditText) findViewById(R.id.edit_username);
mEditPassword = (EditText) findViewById(R.id.edit_password);
mRootLayout = (LinearLayout) findViewById(R.id.activity_loading_button);
mButton = (C2AAnimationLoadingButton) findViewById(R.id.button_login);
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mButton.startLoading();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
String username = mEditUsername.getText().toString();
String password = mEditPassword.getText().toString();
if (isValid(username, password)) {
mButton.loadingSuccess(new C2AAnimationLoadingButton.AnimationSuccess() {
@Override
public void success() {
finish();
}
});
} else
mButton.loadingFail();
}
}, 5000);
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private boolean isValid(String username, String password) {
if (username.trim().equals("admin") && password.trim().equals("admin")) {
return true;
}
return false;
}
}
| [
"[email protected]"
] | |
2c22f3bd36ad6b6223d47b33aa734fec51e54548 | 942c5021817d284f47382433eee4a5c24ca781bf | /extensions/cli/landsat8/src/test/java/mil/nga/giat/geowave/format/landsat8/SceneFeatureIteratorTest.java | ada98c55667bfd5b6ba9ccc4b2c9218e0001d02f | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain"
] | permissive | rfecher/geowave | 9e41c93ec474db7b3c32e75ebb7c30f6f1f19c1a | b5dfb64abb6efdcdc75f46222ffd2d4c3f7d64a5 | refs/heads/master | 2022-06-28T02:03:32.509352 | 2017-02-15T17:56:32 | 2017-02-15T17:56:32 | 39,567,101 | 0 | 2 | Apache-2.0 | 2018-07-23T12:23:08 | 2015-07-23T12:50:18 | Java | UTF-8 | Java | false | false | 2,920 | java | package mil.nga.giat.geowave.format.landsat8;
import static org.junit.Assert.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.geotools.filter.text.cql2.CQL;
import org.geotools.filter.text.cql2.CQLException;
import org.geotools.geometry.DirectPosition2D;
import org.geotools.geometry.Envelope2D;
import org.junit.Test;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.filter.Filter;
import org.opengis.geometry.BoundingBox;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import static org.hamcrest.core.Every.everyItem;
import static org.hamcrest.core.AllOf.allOf;
public class SceneFeatureIteratorTest
{
private Matcher<SimpleFeature> hasProperties() {
return new BaseMatcher<SimpleFeature>() {
@Override
public boolean matches(
Object item ) {
SimpleFeature feature = (SimpleFeature) item;
return feature.getProperty("entityId") != null && feature.getProperty("acquisitionDate") != null
&& feature.getProperty("cloudCover") != null && feature.getProperty("processingLevel") != null
&& feature.getProperty("path") != null && feature.getProperty("row") != null
&& feature.getProperty("sceneDownloadUrl") != null;
}
@Override
public void describeTo(
Description description ) {
description
.appendText("feature should have properties {entityId, acquisitionDate, cloudCover, processingLevel, path, row, sceneDownloadUrl}");
}
};
}
private Matcher<SimpleFeature> inBounds(
BoundingBox bounds ) {
return new BaseMatcher<SimpleFeature>() {
@Override
public boolean matches(
Object item ) {
SimpleFeature feature = (SimpleFeature) item;
return feature.getBounds().intersects(
bounds);
}
@Override
public void describeTo(
Description description ) {
description.appendText("feature should be in bounds " + bounds);
}
};
}
@Test
public void testIterate()
throws IOException,
CQLException {
boolean onlyScenesSinceLastRun = false;
boolean useCachedScenes = true;
boolean nBestScenesByPathRow = false;
int nBestScenes = 1;
Filter cqlFilter = CQL.toFilter("BBOX(shape,-76.6,42.34,-76.4,42.54) and band='BQA'");
String workspaceDir = Tests.WORKSPACE_DIR;
List<SimpleFeature> features = new ArrayList<>();
try (SceneFeatureIterator iterator = new SceneFeatureIterator(
onlyScenesSinceLastRun,
useCachedScenes,
nBestScenesByPathRow,
nBestScenes,
cqlFilter,
workspaceDir)) {
while (iterator.hasNext()) {
features.add(iterator.next());
}
}
assertEquals(
features.size(),
1);
assertThat(
features,
everyItem(allOf(
hasProperties(),
inBounds(new Envelope2D(
new DirectPosition2D(
-76.6,
42.34),
new DirectPosition2D(
-76.4,
42.54))))));
}
}
| [
"[email protected]"
] | |
ea60966133e5660b1d1b9b7553481dd1f4b55afd | afaeacf76ee1e146963544fae91c261c6df09fa0 | /src/main/java/org/example/RadioButtonPage.java | 22d9d8087a66927dbc1c1fb245ecbc27551b869f | [] | no_license | nirmohpatel/ToolaQA123 | 340ee805c6c57a9d76cb83f0308761e4d25f985a | b29e560d2a61e810a242a455568ff22903cdcad4 | refs/heads/main | 2023-03-02T22:39:29.195920 | 2021-02-15T16:13:49 | 2021-02-15T16:13:49 | 339,132,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,392 | java | package org.example;
import javafx.scene.control.RadioButton;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.asserts.SoftAssert;
public class RadioButtonPage extends Util
{
SoftAssert softAssert = new SoftAssert();
public static LoadProperty loadProperty = new LoadProperty();
public static String RadioButton = loadProperty.getProperty("RadioButton");
private String expectedText4 = "Radio Button";
private String expectedTextMassageForYes = "You have selected Yes";
private String expectedTextMassageForImpressive = "You have selected Impressive";
private By _actualText4 = By.xpath("//div[@class=\"main-header\"]");
private By _selectYes = By.xpath("//label[@for=\"yesRadio\"] ");
private By _selectImpressive = By.xpath("//label[@for=\"impressiveRadio\"] ");
private By _actualTextMassageForYes = By.xpath("//p[@class=\"mt-3\"]");
private By _actualTextMassageForImpressive = By.xpath("//p[@class=\"mt-3\"]");
public void toVerifyThatUserIsOnRadioButtonPage()
{
softAssert.assertEquals(getTextFromElement(_actualText4), expectedText4);
softAssert.assertAll("User is not on Radio button Page");
}
public void selectRadioButton ()
{
if (RadioButton.equalsIgnoreCase("yes"))
{
clickOnElement(_selectYes);
} else if (RadioButton.equalsIgnoreCase("Impressive"))
{
clickOnElement(_selectImpressive);
} else
{
System.out.println(" Please select Radio button");
}
}
public void toVerifyThatUserSuccessfullySelectRadioButton()
{
if (RadioButton.equalsIgnoreCase("yes"))
{
softAssert.assertEquals(getTextFromElement(_actualTextMassageForYes), expectedTextMassageForYes);
softAssert.assertAll("User have not click on check box successfully");
}else if(RadioButton.equalsIgnoreCase("Impressive"))
{
softAssert.assertEquals(getTextFromElement(_actualTextMassageForImpressive), expectedTextMassageForImpressive);
softAssert.assertAll("User have not click on check box successfully");
} else
{
System.out.println("User have not click on check box successfully");
}
}
}
| [
"[email protected]"
] | |
0bab26552e896ef2b660bb9931d653d796f873db | 7165a598196001af2534020e7bd63d727b264f40 | /app/src/main/java/com/tehike/client/dtc/single/app/project/execption/compat/ActivityKillerV24_V25.java | e87d21c9cc48df898ab2b0e2ae33d752b21ade3d | [] | no_license | wpfsean/Dtc_F | 65ee0105ea5b0b33a8dce14d495bc86ff8348f50 | 486a20b0a7a06136e66bbe021d39069213d8b787 | refs/heads/master | 2020-05-04T07:52:40.319849 | 2019-04-08T01:55:11 | 2019-04-08T01:55:11 | 171,991,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,538 | java | package com.tehike.client.dtc.single.app.project.execption.compat;
import android.app.Activity;
import android.content.Intent;
import android.os.IBinder;
import android.os.Message;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
* Created by wanjian on 2018/5/24.
* <p>
* android 7.1.1
* <p>
* ActivityManagerNative.getDefault().finishActivity(mToken, resultCode, resultData, finishTask))
*/
public class ActivityKillerV24_V25 implements IActivityKiller {
@Override
public void finishLaunchActivity(Message message) {
try {
Object activityClientRecord = message.obj;
Field tokenField = activityClientRecord.getClass().getDeclaredField("token");
tokenField.setAccessible(true);
IBinder binder = (IBinder) tokenField.get(activityClientRecord);
finish(binder);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void finishResumeActivity(Message message) {
finishSomeArgs(message);
}
@Override
public void finishPauseActivity(Message message) {
finishSomeArgs(message);
}
@Override
public void finishStopActivity(Message message) {
finishSomeArgs(message);
}
private void finishSomeArgs(Message message) {
try {
Object someArgs = message.obj;
Field arg1Field = someArgs.getClass().getDeclaredField("arg1");
arg1Field.setAccessible(true);
IBinder binder = (IBinder) arg1Field.get(someArgs);
finish(binder);
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
private void finish(IBinder binder) throws Exception {
/*
ActivityManagerNative.getDefault()
.finishActivity(r.token, Activity.RESULT_CANCELED, null, Activity.DONT_FINISH_TASK_WITH_ACTIVITY);
*/
Class activityManagerNativeClass = Class.forName("android.app.ActivityManagerNative");
Method getDefaultMethod = activityManagerNativeClass.getDeclaredMethod("getDefault");
Object activityManager = getDefaultMethod.invoke(null);
Method finishActivityMethod = activityManager.getClass().getDeclaredMethod("finishActivity", IBinder.class, int.class, Intent.class, int.class);
int DONT_FINISH_TASK_WITH_ACTIVITY = 0;
finishActivityMethod.invoke(activityManager, binder, Activity.RESULT_CANCELED, null, DONT_FINISH_TASK_WITH_ACTIVITY);
}
}
| [
"[email protected]"
] | |
5fa0e8ae2fb0bc611f0200eb41669407457ff26b | d767ecbb2bad9bb0358b2931097ed9164a92ec13 | /src/test/java/com/invillia/acme/provider/service/ProviderServiceTest.java | b8ac5fcafe6e0df4cd305188c52e9c0fa2aab8ff | [] | no_license | caiogallo/backend-challange | 90b33ab8e639dfd7aec00ec9b3e12400a999bb10 | ecdd621a6ce3820730d64b62dcda1f8303e87b35 | refs/heads/master | 2020-04-08T08:46:46.706669 | 2018-11-28T20:44:40 | 2018-11-28T20:44:40 | 159,193,601 | 1 | 1 | null | 2018-11-26T15:45:44 | 2018-11-26T15:45:43 | null | UTF-8 | Java | false | false | 3,843 | java | package com.invillia.acme.provider.service;
import br.com.six2six.fixturefactory.Fixture;
import br.com.six2six.fixturefactory.loader.FixtureFactoryLoader;
import com.invillia.acme.address.model.Address;
import com.invillia.acme.address.model.service.AddressSearchRequest;
import com.invillia.acme.provider.controller.v1.request.ProviderRequest;
import com.invillia.acme.provider.model.Provider;
import com.invillia.acme.provider.repository.ProviderRepository;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ProviderServiceTest {
@Autowired
private ProviderService providerService;
@Autowired
private ProviderRepository repository;
@BeforeClass
public static void setUpClass(){
FixtureFactoryLoader.loadTemplates("com.invillia.acme.fixtures");
}
@Before
public void setUp(){
repository.deleteAll();
Address address = new Address("Av Ipiranga", 123, 18099000);
repository.save(new Provider("My Provider"));
repository.save(Fixture.from(Provider.class).gimme("valid"));
repository.save(Fixture.from(Provider.class).gimme("valid"));
repository.save(Fixture.from(Provider.class).gimme("valid"));
repository.save(new Provider("Provider 1", address));
repository.save(new Provider("Provider 2", address));
repository.save(new Provider("Provider 3", address));
repository.save(new Provider("1", "Provider One"));
}
@Test
public void when_create_new_provider_return_success(){
Provider createdProvider = providerService.create(Fixture.from(Provider.class).gimme("valid-without-id"));
Assert.assertNotNull(createdProvider);
Assert.assertNotNull(createdProvider.getId());
}
@Test
public void when_update_provider_by_id_1_return_success(){
String providerName = "updated provider";
Provider provider = Fixture.from(Provider.class).gimme("valid");
provider.setName(providerName);
boolean update = providerService.update("1", provider);
Assert.assertEquals(true, update);
}
@Test
public void when_find_provider_by_id_1_return_notnull(){
Provider foundProvider = providerService.get("1");
Assert.assertNotNull(foundProvider);
Assert.assertNotNull(foundProvider.getId());
}
@Test
public void when_find_by_name_and_return_one_provider(){
String providerName = "My Provider";
List<Provider> foundProviders = providerService.find(
ProviderSearchRequest
.builder()
.name(providerName)
.build());
Assert.assertNotNull(foundProviders);
Assert.assertEquals(1, foundProviders.size());
}
@Test
public void when_find_by_address_and_return_success(){
String streetName = "Av Ipiranga";
Integer zipCode = 18099000;
List<Provider> providers = providerService.find(
ProviderSearchRequest
.builder()
.address(
AddressSearchRequest
.builder()
.street(streetName)
.zipCode(zipCode)
.build())
.build());
Assert.assertNotNull(providers);
Assert.assertEquals(3, providers.size());
}
} | [
"[email protected]"
] | |
b11c441a208f0595abcdc6ec20ed33fdb67b3e1e | 78c85e52416b6b913d3af7fa0fa27781021aae6f | /QStarter_2/build/project/src/application/WeatherPage.java | 706a0ebcbf38921b506ca1f7c8297687cf53d93c | [] | no_license | wlee2/Weather-app-client | 3371882f5ffb141d5aa079ccfff9667aec9a35b7 | b92d59c95bc18397925afa3435ca67680e8ec91e | refs/heads/master | 2020-04-30T12:32:56.064126 | 2019-03-20T23:18:57 | 2019-03-20T23:18:57 | 176,829,452 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,487 | java | package application;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.net.Socket;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.concurrent.Task;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.BorderStroke;
import javafx.scene.layout.BorderStrokeStyle;
import javafx.scene.layout.BorderWidths;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.util.Duration;
class WeatherPageMaintain extends Task<Object>{
BorderPane bp;
WDataArray wd;
public boolean threadLoop;
Socket socket;
ObjectInputStream is;
ObjectOutputStream os;
int WeatherNumber;
BorderPane infoPane;
public Date updatedTime;
String otherAddress;
WeatherPageMaintain(BorderPane root) {
this.otherAddress = "";
this.bp = root;
this.infoPane = new BorderPane();
this.infoPane.setBorder(new Border(new BorderStroke(Color.GRAY, BorderStrokeStyle.SOLID, new CornerRadii(5), new BorderWidths(1))));
wd = new WDataArray();
threadLoop = true;
this.WeatherNumber = 0;
updatedTime = new Date();
updateTimer();
mainWeather();
buildButton();
}
public int getStatus() {
int returnIndex = 0;
try {
File file = new File("resources/data/setting.txt");
if(file.exists()) {
BufferedReader br = new BufferedReader(new FileReader(file));
String line = "";
line = br.readLine();
int index = line.indexOf("=");
String option = line.substring(index+1);
line = br.readLine();
index = line.indexOf("=");
this.otherAddress = line.substring(index+1);
if(option.equals("0"))
returnIndex = 0;
else if(option.equals("1"))
returnIndex = 1;
else if(option.equals("2"))
returnIndex = 2;
else {
fixOption(0);
}
br.close();
}
} catch (Exception e){
System.out.println(e);
}
return returnIndex;
}
public void fixOption(int index) {
File file = new File("resources/data/setting.txt");
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
bw.write("option=" + index);
bw.newLine();
bw.write("otherAddress=0.0.0.0");
bw.close();
} catch(Exception e) {
System.out.println(e);
}
}
@Override
protected Void call() throws Exception {
// TODO Auto-generated method stub
int option = this.getStatus();
while(true) {
try {
if(option == 0)
socket = new Socket("my.woosenecac.com", 8750);
else if(option == 1)
socket = new Socket("192.168.2.15", 8750);
else
socket = new Socket(this.otherAddress, 8750);
is = new ObjectInputStream(socket.getInputStream());
os = new ObjectOutputStream(socket.getOutputStream());
//String str = "this user is connecting with you";
//os.writeObject(str);
while((wd = (WDataArray) is.readObject()) != null) {
for(WData temp : wd.dataList)
temp.Debug();
Platform.runLater(new Runnable() {
@Override
public void run() {
mainWeather();
updatedTime = new Date();
}
});
}
socket.close();
if(this.threadLoop == false)
break;
} catch (Exception e) {
System.out.println(e);
wd = new WDataArray();
Platform.runLater(new Runnable() {
@Override
public void run() {
mainWeather();
updatedTime = new Date();
}
});
}
try {
Thread.sleep(5 * 1000);
if(option == 0){
option = 1;
this.fixOption(1);
}
else {
option = 0;
this.fixOption(0);
}
} catch(Exception e) {
}
}
return null;
}
public void updateTimer() {
HBox hb = new HBox();
Text time = new Text();
Timeline clock = new Timeline(new KeyFrame(Duration.ZERO, e -> {
LocalDateTime now = LocalDateTime.now();
Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
Date date = Date.from(instant);
long diff = date.getTime() - updatedTime.getTime();
long secondD = 300 - TimeUnit.MILLISECONDS.toSeconds(diff);
time.setText("update: "+ secondD + " seconds left.");
}),
new KeyFrame(Duration.seconds(1))
);
clock.setCycleCount(Animation.INDEFINITE);
clock.play();
hb.getChildren().addAll(time);
time.setId("timer");
hb.setAlignment(Pos.CENTER);
hb.setPadding(new Insets(10, 50, 10, 0));
this.infoPane.setBottom(hb);
}
public void buildButton() {
Image next = new Image("file:resources/right-arrow.png");
Image nextPressed = new Image("file:resources/right-selected.png");
ImageView nextImg = new ImageView(next);
nextImg.setPreserveRatio(true);
nextImg.setFitHeight(35);
nextImg.setFitWidth(35);
nextImg.setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent evt) {
nextImg.setImage(nextPressed);
if(WeatherNumber < (wd.size() - 1)) {
WeatherNumber++;
mainWeather();
}
}
});
nextImg.setOnMouseReleased(new EventHandler<MouseEvent>() {
public void handle(MouseEvent evt) {
nextImg.setImage(next);
}
});
Image before = new Image(("file:resources/left-arrow.png"));
Image beforePressed = new Image(("file:resources/left-selected.png"));
ImageView beforeImg = new ImageView(before);
beforeImg.setPreserveRatio(true);
beforeImg.setFitHeight(35);
beforeImg.setFitWidth(35);
beforeImg.setOnMousePressed(new EventHandler<MouseEvent>() {
public void handle(MouseEvent evt) {
beforeImg.setImage(beforePressed);
if(WeatherNumber != 0) {
WeatherNumber--;
mainWeather();
}
}
});
beforeImg.setOnMouseReleased(new EventHandler<MouseEvent>() {
public void handle(MouseEvent evt) {
beforeImg.setImage(before);
}
});
VBox b1 = new VBox();
b1.getChildren().add(nextImg);
b1.setAlignment(Pos.TOP_CENTER);
b1.setPadding(new Insets(80, 10, 0, 10));
VBox b2 = new VBox();
b2.getChildren().add(beforeImg);
b2.setAlignment(Pos.TOP_CENTER);
b2.setPadding(new Insets(80, 10, 0, 10));
this.infoPane.setLeft(b2);
this.infoPane.setRight(b1);
}
public void mainWeather() {
try {
if(WeatherNumber >= (wd.size()))
WeatherNumber = wd.size() - 1;
HBox[] hb = new HBox[5];
VBox vb = new VBox(8);
Text city = new Text("Toronto , CA");
city.setId("contents");
Image image = new Image(("file:resources/" + wd.getCondition(WeatherNumber) + ".png"));
ImageView imageView = new ImageView(image);
imageView.setPreserveRatio(true);
imageView.setFitHeight(100);
imageView.setFitWidth(100);
Text condition = new Text("Condition: " + wd.getCondition(WeatherNumber));
condition.setId("contents");
Text description = new Text("Description: " + wd.getDescription(WeatherNumber));
description.setId("contents");
Text temp_max = new Text("Temp Max/Avg/Min: " + wd.getTemp_Max(WeatherNumber));
temp_max.setId("contents");
Text temp_avg = new Text("/ " + wd.getTemp(WeatherNumber));
temp_avg.setId("contents");
Text temp_min = new Text("/ " + wd.getTemp_Min(WeatherNumber));
temp_min.setId("contents");
Text date = new Text("Update date: " + wd.getDate(WeatherNumber));
date.setId("contents");
hb[0] = new HBox();
hb[0].getChildren().addAll(city);
hb[1] = new HBox();
hb[1].setSpacing(10);
if(image.isError()) {
hb[1].getChildren().addAll(condition);
}
else {
hb[1].getChildren().addAll(imageView);
}
hb[2] = new HBox();
hb[2].setSpacing(10);
hb[2].getChildren().addAll(description);
hb[3] = new HBox();
hb[3].setSpacing(10);
hb[3].getChildren().addAll(temp_max, temp_avg, temp_min);
hb[4] = new HBox();
hb[4].setSpacing(10);
hb[4].getChildren().addAll(date);
hb[4].setAlignment(Pos.CENTER);
hb[4].setPadding(new Insets(10, 50, 10, 0));
vb.getChildren().addAll(hb[0], hb[1], hb[2], hb[3]);
vb.setPadding(new Insets(10, 12, 15, 40));
vb.setAlignment(Pos.TOP_CENTER);
this.infoPane.setCenter(vb);
this.infoPane.setTop(hb[4]);
if(wd.getCondition(WeatherNumber) == null)
errControl();
} catch (Exception e) {
System.out.println(e);
}
}
public void errControl() {
HBox errBox = new HBox(10);
Text err = new Text("Error: " + wd.dataList.get(WeatherNumber).err);
err.setId("error");
errBox.getChildren().add(err);
errBox.setAlignment(Pos.CENTER);
errBox.setPadding(new Insets(10, 50, 10, 0));
this.infoPane.setTop(errBox);
}
public BorderPane getWeatherPane() {
return this.infoPane;
}
}
class WDataArray implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public ArrayList<WData> dataList;
WDataArray() {
dataList = new ArrayList<>();
this.dataList.add(new WData());
}
public void add(WData wd) {
this.dataList.add(wd);
}
public void Debug(int i) {
this.dataList.get(i).Debug();
}
public int size() {
return this.dataList.size();
}
public String getCondition(int i) {
return this.dataList.get(i).getCondition();
}
public String getDescription(int i) {
return this.dataList.get(i).getDescription();
}
public String getTemp(int i) {
return this.dataList.get(i).getTemp();
}
public String getTemp_Min(int i) {
return this.dataList.get(i).getTemp_Min();
}
public String getTemp_Max(int i) {
return this.dataList.get(i).getTemp_Max();
}
public String getDate(int i) {
return this.dataList.get(i).getDate();
}
}
class WData implements Serializable {
private static final long serialVersionUID = 1454313033318093811L;
String condition;
String description;
String temp_min;
String temp_normal;
String temp_max;
String date;
String err;
WData() {
this.condition = null;
this.description = null;
this.temp_min = null;
this.temp_normal = null;
this.temp_max = null;
this.date = null;
this.err = "Server is closed: Sorry, it can't be solved!";
}
public void Set(String condition, String description, String temp_max, String temp_min, String temp_normal, String date, String err) {
this.condition = condition;
this.description = description;
this.temp_max = temp_max;
this.temp_min = temp_min;
this.temp_normal = temp_normal;
this.date = date;
this.err = err;
}
public String getCondition() {
return this.condition;
}
public String getDescription() {
return this.description;
}
public String getTemp() {
return this.temp_normal;
}
public String getTemp_Min() {
return this.temp_min;
}
public String getTemp_Max() {
return this.temp_max;
}
public String getDate() {
return this.date;
}
public void Debug() {
System.out.println("Date: " + this.date);
System.out.println("Condition: " + this.condition);
System.out.println("Description: " + this.description);
System.out.println("Temp Max/Avg/Min: " + this.temp_max + " / " + this.temp_normal + " / " + this.temp_min);
}
}
| [
"[email protected]"
] | |
17959d268c54f1e9154cc5f73330e8ee25cae0f5 | 7933a54177ef16052648edfd377626c72e6d5d4b | /throw-common-msg/src/com/playmore/dbobject/staticdb/BossstageS.java | 39f1193946b039799c004cd32b6162a7d4df8084 | [] | no_license | China-Actor/Throw-Server | 0e6377e875409ff1133dd3e64c6d034005a75c25 | 0571ba6c78842b3674913162b6fb2bfcc5274e9c | refs/heads/master | 2022-10-12T22:25:55.963855 | 2020-04-18T09:55:55 | 2020-04-18T09:55:55 | 252,702,013 | 0 | 1 | null | 2022-10-04T23:57:17 | 2020-04-03T10:34:28 | Java | UTF-8 | Java | false | false | 1,628 | java | package com.playmore.dbobject.staticdb;
import java.io.Serializable;
import com.playmore.database.DBFieldName;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
/**
* Do not touch! Close it Now!
*/
@SuppressWarnings("serial")
public class BossstageS implements Serializable {
@DBFieldName(fieldName="阶段id", isNullable="columnNoNulls")
private int id;
@DBFieldName(fieldName="bossid", isNullable="columnNullable")
private int bossid;
@DBFieldName(fieldName="血量", isNullable="columnNullable")
private int hp;
@DBFieldName(fieldName="货币掉落包", isNullable="columnNullable")
private int drop1;
@DBFieldName(fieldName="掉落装备包", isNullable="columnNullable")
private int drop2;
@DBFieldName(fieldName="掉落钻石包", isNullable="columnNullable")
private int drop3;
public BossstageS(){
}
public void setId(int id) {
this.id=id;
}
public int getId() {
return id;
}
public void setBossid(int bossid) {
this.bossid=bossid;
}
public int getBossid() {
return bossid;
}
public void setHp(int hp) {
this.hp=hp;
}
public int getHp() {
return hp;
}
public void setDrop1(int drop1) {
this.drop1=drop1;
}
public int getDrop1() {
return drop1;
}
public void setDrop2(int drop2) {
this.drop2=drop2;
}
public int getDrop2() {
return drop2;
}
public void setDrop3(int drop3) {
this.drop3=drop3;
}
public int getDrop3() {
return drop3;
}
public String toString() {
return "BossstageS [id=" + id + " ,bossid=" + bossid + " ,hp=" + hp + " ,drop1=" + drop1 + " ,drop2=" + drop2 + " ,drop3=" + drop3+ "]";
}
}
| [
"[email protected]"
] | |
a697d90d5d12c88e343b044203e4d1f72e09068e | 93c99ee9770362d2917c9494fd6b6036487e2ebd | /server/decompiled_apps/2b7122657dcb75ede8840eff964dd94a/com.bankeen.ui.addingbankaccount/h.java | 5c62c113d2488fd59994d79056ac2fee97e30090 | [] | no_license | YashJaveri/Satic-Analysis-Tool | e644328e50167af812cb2f073e34e6b32279b9ce | d6f3be7d35ded34c6eb0e38306aec0ec21434ee4 | refs/heads/master | 2023-05-03T14:29:23.611501 | 2019-06-24T09:01:23 | 2019-06-24T09:01:23 | 192,715,309 | 0 | 1 | null | 2023-04-21T20:52:07 | 2019-06-19T11:00:47 | Smali | UTF-8 | Java | false | false | 821 | java | package com.bankeen.ui.addingbankaccount;
import android.content.Context;
import com.bankeen.data.repository.ao;
import dagger.a.c;
import javax.inject.Provider;
/* compiled from: AddingBankAccountManager_Factory */
public final class h implements c<g> {
private final Provider<Context> a;
private final Provider<ao> b;
public h(Provider<Context> provider, Provider<ao> provider2) {
this.a = provider;
this.b = provider2;
}
/* renamed from: a */
public g b() {
return a(this.a, this.b);
}
public static g a(Provider<Context> provider, Provider<ao> provider2) {
return new g((Context) provider.b(), (ao) provider2.b());
}
public static h b(Provider<Context> provider, Provider<ao> provider2) {
return new h(provider, provider2);
}
} | [
"[email protected]"
] | |
afd84775115f44a45cf123a0820443e1faf2c912 | f4ccc91a720594015963755df5bc6890739fbba2 | /app/src/main/java/com/example/tugassqlite/Adapter/SiswaAdapter.java | 482857728cb9728167678475f08c319d2d345b3c | [] | no_license | M-Alfi/PWPB_DataMahasiswa | 2305a6a7ad7c789a767bc0b03c6c30ae39e273ee | 96c912ff723e555f19794f673ee026401f03f9a7 | refs/heads/master | 2020-07-25T18:15:09.180302 | 2019-09-14T03:28:20 | 2019-09-14T03:28:20 | 208,383,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,560 | java | package com.example.tugassqlite.Adapter;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.example.tugassqlite.DetailDataActivity;
import com.example.tugassqlite.Helper.DatabaseHelper;
import com.example.tugassqlite.Models.Siswa;
import com.example.tugassqlite.R;
import com.example.tugassqlite.ShowDataActivity;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class SiswaAdapter extends RecyclerView.Adapter<SiswaAdapter.viewHolder> {
List<Siswa> siswaList;
Context context;
OnUserClickListener listener;
public SiswaAdapter(List<Siswa> siswaList, OnUserClickListener listener) {
this.siswaList = siswaList;
this.listener = listener;
}
public interface OnUserClickListener{
void onUserClick(Siswa currentSiswa, String action);
}
@NonNull
@Override
public viewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_row_data,parent,false);
viewHolder holder= new viewHolder(view);
context = parent.getContext();
return holder;
}
@Override
public void onBindViewHolder(@NonNull viewHolder holder, int position) {
final Siswa siswa = siswaList.get(position);
holder.nama.setText(siswa.getNama());
holder.nama.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
View dialogView = LayoutInflater.from(context).inflate(R.layout.alert_dialog,null);
dialog.setView(dialogView);
TextView lihat = dialogView.findViewById(R.id.lihatData);
TextView update = dialogView.findViewById(R.id.updateData);
TextView delete = dialogView.findViewById(R.id.deleteData);
final AlertDialog alertDialog = dialog.create();
alertDialog.show();
lihat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.onUserClick(siswa,"Lihat");
alertDialog.dismiss();
}
});
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.onUserClick(siswa,"Delete");
alertDialog.dismiss();
}
});
update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.onUserClick(siswa,"Update");
alertDialog.dismiss();
}
});
}
});
}
@Override
public int getItemCount() {
return siswaList.size();
}
public class viewHolder extends RecyclerView.ViewHolder {
TextView nama;
public viewHolder(@NonNull View itemView) {
super(itemView);
nama = itemView.findViewById(R.id.txtNama);
}
}
}
| [
"[email protected]"
] | |
06707624b415a142a57e45ffe5b5438e6b1f2ef5 | 1ef43fd13dd1546d9860cdec158efadbb08cd7d5 | /src/main/java/cz/cuni/mff/d3s/trupple/parser/identifierstable/types/complex/TextFileDescriptor.java | 78fa134d19850a6d85bcc56bb9a4e86861ead4c3 | [] | no_license | Aspect26/TrufflePascal | 8f399462bc7e7de4804ed5f3a9225cd1cc594c3d | 99c801edbacd13bf5129e5db836257ef293774ce | refs/heads/master | 2021-05-24T03:17:07.139935 | 2017-07-20T21:12:20 | 2017-07-20T21:12:20 | 56,541,527 | 11 | 5 | null | 2021-02-05T21:01:17 | 2016-04-18T20:56:28 | Java | UTF-8 | Java | false | false | 842 | java | package cz.cuni.mff.d3s.trupple.parser.identifierstable.types.complex;
import cz.cuni.mff.d3s.trupple.language.runtime.customvalues.TextFileValue;
import cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor;
/**
* Specialized type descriptor for text-file values.
*/
public class TextFileDescriptor extends FileDescriptor {
private TextFileDescriptor() {
super(null);
}
private static TextFileDescriptor SINGLETON = new TextFileDescriptor();
public static TextFileDescriptor getInstance() {
return SINGLETON;
}
@Override
public Object getDefaultValue() {
return new TextFileValue();
}
@Override
public boolean convertibleTo(TypeDescriptor typeDescriptor) {
return super.convertibleTo(typeDescriptor) || typeDescriptor == getInstance();
}
}
| [
"[email protected]"
] | |
c997a6b50f1ce4e0ac8d63f4b11704ce6f64fb2c | a75b8e1f4927cffec0478c3575142943a02170f7 | /src/test/java/neflis/UserServiceTest.java | 7fd47dd0007dbfdf2e257eb8cea56e5b57e51961 | [] | no_license | namcent/Neflis2.0 | 1234dbbd5d3e3ea44729f83798e10bdfbb5a898a | cc920d71557c86de7e0443ef5ff3bafb153c649b | refs/heads/master | 2022-11-23T19:21:25.288903 | 2020-07-09T20:16:25 | 2020-07-09T20:16:25 | 278,493,462 | 0 | 1 | null | 2020-07-09T23:50:02 | 2020-07-09T23:36:23 | Java | UTF-8 | Java | false | false | 2,086 | java | package neflis;
import neflis.neflisdemo.controller.UserController;
import neflis.neflisdemo.model.Contenido;
import neflis.neflisdemo.model.UserApi;
import neflis.neflisdemo.service.UserService;
import neflis.neflisdemo.util.Util;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class UserServiceTest {
private UserController userController;
private UserService userService;
private UserApi userApi;
UserApi yaz;
UserApi noe;
UserApi nadia;
Contenido titanic;
Contenido brave_heart;
Contenido breaking_bad;
List<Contenido> contenidoList;
List<String> contenidoPorgenreList;
@BeforeEach
void setUp() {
yaz = new UserApi("1L", "yaz");
noe = new UserApi("2L", "noe");
nadia = new UserApi("3L", "nadia");
titanic = mock(Contenido.class);
brave_heart = mock(Contenido.class);
breaking_bad = mock(Contenido.class);
contenidoList = new ArrayList<>();
contenidoList.add(titanic);
contenidoList.add(brave_heart);
contenidoList.add(breaking_bad);
contenidoPorgenreList = new ArrayList<>();
contenidoPorgenreList.add(titanic.getGenre());
contenidoPorgenreList.add(brave_heart.getGenre());
contenidoPorgenreList.add(breaking_bad.getGenre());
when(titanic.getGenre()).thenReturn("romance");
when(brave_heart.getGenre()).thenReturn("drama");
when(brave_heart.getGenre()).thenReturn("drama");
when(titanic.getRuntime()).thenReturn("180 min");
when(breaking_bad.getRuntime()).thenReturn("1500 min");
when(brave_heart.getRuntime()).thenReturn("120 min");
}
/* @Test
public void testGetUsuarios(){
userService.usuarios();
System.out.println(userService.usuarios());
//assertEquals(3, userService.usuarios().size());
}*/
} | [
"[email protected]"
] | |
b4d7c132367221aa69734f2e090c94c10bc75188 | d4d8e8fb1086cc8af295e00737b17a568c2be11e | /filename.java | ea2f063f1b059dce3567d7700269639d8ad4a696 | [] | no_license | EsaikaniL/GUVI-3 | c8dbef9a58abc5672541ee6988c0f38f2dd8196c | 0af0937e57ed8ac264f2b32ed4132606d7df18e7 | refs/heads/master | 2020-04-24T21:54:29.206345 | 2018-03-16T10:34:46 | 2018-03-16T10:34:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 156 | java | #include<iostream.h>
void main()
{
int=t;
scanf("%d,&t);
if(t>0)
{
cout("positive");
}
elseif(t<0)
{
cout("negative");
}
else
{
cout("zero");
}
return 0;
}
| [
"[email protected]"
] | |
7668736d948b26312e3a2c243ed611b8965930f0 | 99aebe902606f6e4e97f7bee4e4ad98891b22bfd | /mpos_test_tool/src/main/java/com/samilcts/mpaio/testtool/util/StateHandler.java | 4ec391fc518ea2d88a9042ba720fba3de5b6439b | [] | no_license | ksuh0805/kiosk | d6242ab0a3004c4b32df9c872addfa2c9dc7eb7f | 25e0e6236073da074f82f526a72648228f5067e9 | refs/heads/master | 2022-04-10T02:14:12.689639 | 2020-02-28T02:09:56 | 2020-02-28T02:09:56 | 243,659,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,655 | java | package com.samilcts.mpaio.testtool.util;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.widget.TextView;
import com.afollestad.materialdialogs.MaterialDialog;
import com.samilcts.media.State;
import com.samilcts.media.ble.BleState;
import com.samilcts.media.usb.UsbState;
import com.samilcts.mpaio.testtool.R;
import com.samilcts.sdk.mpaio.MpaioManager;
import com.samilcts.sdk.mpaio.ext.dialog.RxConnectionDialog;
import com.samilcts.util.android.Logger;
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
/**
* Created by mskim on 2016-07-13.
* [email protected]
*/
public class StateHandler {
private static final String TAG = "StateHandler";
private final TextView mLabel;
private MaterialDialog mProgressDialog;
private RxConnectionDialog mConnectionDialog;
private final MpaioManager mConnectionManager;
private Activity mActivity;
private Subscription mSubscription;
private final Logger logger = AppTool.getLogger();
public StateHandler(Activity activity, MpaioManager connectionManager, TextView label) {
mActivity = activity;
mConnectionManager = connectionManager;
mLabel = label;
}
public void stopHandle() {
if(null != mSubscription ) {
mSubscription.unsubscribe();
mSubscription = null;
}
}
public void startHandle() {
mSubscription = mConnectionManager
.onStateChanged()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<State>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
logger.i(TAG, "onError : " + e.getMessage());
}
@Override
public void onNext(State state) {
boolean isBleState = state instanceof BleState;
String type = isBleState ? "BLE" : (state instanceof UsbState ? "USB" : "UART");
logger.i(TAG, "type : " + type);
switch (state.getValue()) {
case State.CONNECTING:
logger.i(TAG, "STATE_CONNECTING");
mProgressDialog = new MaterialDialog.Builder(mActivity)
.content(setConnectionStateText(type, R.string.connection_state_connecting))
.progress(true, 0)
.cancelable(false)
.show();
break;
case State.CONNECTED:
logger.i(TAG, "STATE_CONNECTED!");
setConnectionStateText(type, R.string.connection_state_connected);
mActivity.invalidateOptionsMenu();
setPacketSetting();
if (mProgressDialog != null) mProgressDialog.dismiss();
getConnectionDialog(mActivity).dismiss();
break;
case State.DISCONNECTED:
logger.i(TAG, "STATE_DISCONNECTED");
setConnectionStateText(type, R.string.connection_state_disconnected);
//ToastUtil.show(mActivity, "disconnected");
mActivity.invalidateOptionsMenu();
if (mProgressDialog != null)
mProgressDialog.dismiss();
if (!mConnectionManager.isConnected() && !mActivity.isFinishing()) {
if (!getConnectionDialog(mActivity).isShowing())
getConnectionDialog(mActivity).show();
}
break;
}
}
});
if ( mConnectionManager.isBleConnected()) {
setConnectionStateText("BLE", R.string.connection_state_connected);
} else if (mConnectionManager.isUsbConnected()) {
setConnectionStateText("USB", R.string.connection_state_connected);
} else if (mConnectionManager.isSerialConnected()) {
setConnectionStateText("UART", R.string.connection_state_connected);
} else {
setConnectionStateText("", R.string.connection_state_none);
}
}
synchronized public RxConnectionDialog getConnectionDialog(Context context) {
if ( null == mConnectionDialog )
mConnectionDialog = new RxConnectionDialog(context, mConnectionManager);
return mConnectionDialog;
}
private String setConnectionStateText(String type, final int resId) {
String msg = mActivity.getString(resId).replace("#1", type);
if (mLabel != null)
mLabel.setText(msg);
return msg;
}
private void setPacketSetting() {
int length = 256;
int interval = 0;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
//length = 100;
interval = 50;
}
mConnectionManager.setMaximumPacketLength(length);
mConnectionManager.setBleWriteInterval(interval);
}
}
| [
"[email protected]"
] | |
e810d4be39ec01bf63370e4762be55ab06615d74 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/jdk_nashorn_api_scripting_NashornScriptEngineFactory_hashCode.java | cb93e28c16636c695921283d7b49cab9e7ceb259 | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | class jdk_nashorn_api_scripting_NashornScriptEngineFactory_hashCode{ public static void function() {jdk.nashorn.api.scripting.NashornScriptEngineFactory obj = new jdk.nashorn.api.scripting.NashornScriptEngineFactory();obj.hashCode();}} | [
"[email protected]"
] | |
737c35910dd2e8c239aa733c64315ace55cce426 | acb970cd1bcb764d702e62ed6a81940c18c99fb2 | /jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysConfig.java | 89d1ab68a89adff106d66f2446593314471b26c0 | [] | no_license | CFH-Steven/foreign-trade | 65742213cadea3da1914f8e1a84ec881004e230b | 63f9bd4c8720fbfc14ebbc5e7f31bd07e9bcba0f | refs/heads/master | 2023-01-01T06:01:20.170878 | 2020-10-26T01:35:56 | 2020-10-26T01:35:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,401 | java | package org.jeecg.modules.system.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Description: 系统配置
* @Author: jeecg-boot
* @Date: 2020-04-24
* @Version: V1.0
*/
@Data
@TableName("sys_config")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="sys_config对象", description="系统配置")
public class SysConfig {
/**id*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**配置类型*/
@Excel(name = "配置类型", width = 15)
@ApiModelProperty(value = "配置类型")
private java.lang.String configType;
/**类型值*/
@Excel(name = "类型值", width = 15)
@ApiModelProperty(value = "类型值")
private java.lang.String configValue;
/**创建人*/
@Excel(name = "创建人", width = 15)
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
/**修改人*/
@Excel(name = "修改人", width = 15)
@ApiModelProperty(value = "修改人")
private java.lang.String updateBy;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private java.util.Date updateTime;
/**删除标识0-正常,1-已删除*/
@Excel(name = "删除标识0-正常,1-已删除", width = 15)
@ApiModelProperty(value = "删除标识0-正常,1-已删除")
private java.lang.Integer delFlag;
}
| [
"[email protected]"
] | |
aae3752132ecddd14b4be468595e65596c22ffe0 | 5b47e5d0e093bd8e4ff7ffd95cff4f3225dece3b | /src/OfficeHours/Practice_04_01_2020/StringMethods2.java | f8ae7a4713de08cca926215208381d72184cf515 | [] | no_license | nedimecalis/Spring2020B18_Java | 27aeb49e8f97d8ba2b9654eff4c07dc76f5791ac | d23ece52ee84406baaf14bf308902851d5277fc4 | refs/heads/master | 2022-05-25T22:53:10.744686 | 2020-04-29T20:33:28 | 2020-04-29T20:33:28 | 258,605,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,161 | java | package OfficeHours.Practice_04_01_2020;
public class StringMethods2 {
public static void main(String[] args) {
//isEmpty(): checks if the String is empty, returns boolean
String str1 = " ";
boolean r1 = str1.isEmpty(); // false
boolean r2 = !str1.isEmpty(); // true
System.out.println(r1);
System.out.println(r2);
System.out.println("=======================================");
//equals(str): checks if the two strong of texts are equal or not, returns boolean
// equalsIgnoreCase(str): checks if the two strong of texts are equal or not(wihtout case sensitivity), returns boolean
// ==
String s1 = "cat";
String s2 = new String("cat");
String s3 = "Cat";
System.out.println(s1 == s2); // false
System.out.println( s1.equals(s2)); // true
System.out.println( s3.equals(s1) ); // false, case sensiytivity
System.out.println( s3.equalsIgnoreCase(s1) ); // true, ignores the case sensitivty
System.out.println("=======================================");
// contains(str): checks if the str is included in the string, returns boolean
String sentence = "I like to learn Java";
System.out.println( sentence.contains("Java") ); // true
String sentence2 = "Top 3 Viruses are: 1. Corona, 2. Hanta, 3. Ebola";
System.out.println( sentence2.contains("Java") ); // false
System.out.println("=======================================");
// startsWith(str): checks if the string started with given str
// endsWith(str): checks if the string ended with given str
String webAddress = "www.amazon.com";
System.out.println( webAddress.startsWith("www") ); // true
System.out.println( webAddress.startsWith("wwww") ); // false
String gmail ="[email protected]";
System.out.println( gmail.endsWith("@gmail.com") ); // true
System.out.println( gmail.endsWith("@hotmail.com") ); // false
System.out.println( gmail.endsWith("@coldmail.com") ); // false
}
} | [
"[email protected]"
] | |
61f72dcbb708bce5daf4113973032a70d75a8dd0 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_swing_JTextArea_getBounds.java | ad3ca707157cb1d7f714779fe6583df30cea0101 | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 144 | java | class javax_swing_JTextArea_getBounds{ public static void function() {javax.swing.JTextArea obj = new javax.swing.JTextArea();obj.getBounds();}} | [
"[email protected]"
] | |
f2a0235e2d4e5eb75a645c07d1fc052bd38901b0 | e264b382461679b58239a8cbff34c3fca9bc5dc1 | /listpopupwindow/src/lecho/sample/listpopupwindow/MainActivity.java | 1d3440c59dd932ab92e9332ae4aca0f2b8b6b51d | [] | no_license | lecho/android_samples | 443fcdb809865bd6aaaedd9a47b1267bc59d694d | f1859a0bfc6a21986127e94e66a685b989a8a0c7 | refs/heads/master | 2021-01-10T09:17:31.434241 | 2015-08-30T19:28:23 | 2015-08-30T19:28:23 | 8,381,590 | 16 | 9 | null | null | null | null | UTF-8 | Java | false | false | 1,979 | java | package lecho.sample.listpopupwindow;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity {
private static final String[] STRINGS = { "Option1",
"Option2", "Option3", "Option","Option1",
"Option2", "Option3", "Option","Option1",
"Option2", "Option3", "Option","Option1",
"Option2", "Option3", "Option","Option1",
"Option2", "Option3", "Option", "Option1",
"Option2", "Option3", "Option","Option1",
"Option2", "Option3", "Option","Option1",
"Option2", "Option3", "Option","Option1",
"Option2", "Option3", "Option"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showPopup(v);
}
});
}
private void showPopup(View anchorView) {
final ListPopupWindow popup = new ListPopupWindow(this);
popup.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, STRINGS));
popup.setAnchorView(anchorView);
popup.setWidth(ListPopupWindow.WRAP_CONTENT);
popup.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(MainActivity.this, "Clicked item " + position,
Toast.LENGTH_SHORT).show();
popup.dismiss();
}
});
popup.show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
| [
"[email protected]"
] | |
3df09111251bb70085fb3ee84457fdd83c11113e | 477496d43be8b24a60ac1ccee12b3c887062cebd | /shirochapter16/src/main/java/com/haien/spring/SpringUtils.java | 3a4be49efc42c18635ba39445697908aea1922a9 | [] | no_license | Eliyser/my-shiro-example | e860ba7f5b2bb77a87b2b9ec77c46207a260b985 | 75dba475dc50530820d105da87ff8b031701e564 | refs/heads/master | 2020-05-20T23:45:31.231923 | 2019-05-09T14:06:04 | 2019-05-09T14:06:04 | 185,808,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,859 | java | package com.haien.spring;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
/**
* @Author haien
* @Description 从Spring上下文获取bean信息,被Functions类调用以获取bean注入其属性中
* @Date 2019/3/16
**/
public final class SpringUtils implements BeanFactoryPostProcessor {
private static ConfigurableListableBeanFactory beanFactory; // Spring应用上下文环境
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
throws BeansException {
SpringUtils.beanFactory = beanFactory;
}
/**
* 根据name获取bean实例
* @param name
* @return Object
* @throws org.springframework.beans.BeansException
*
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) throws BeansException {
return (T) beanFactory.getBean(name);
}
/**
* 获取类型为requiredType的bean对象
* @param clz
* @return
* @throws org.springframework.beans.BeansException
*
*/
public static <T> T getBean(Class<T> clz) throws BeansException {
@SuppressWarnings("unchecked")
T result = (T) beanFactory.getBean(clz);
return result;
}
/**
* 判断beanFactory是否包含名为name的bean实例,是则返回true
* @param name
* @return boolean
*/
public static boolean containsBean(String name) {
return beanFactory.containsBean(name);
}
/**
* 判断指定name的bean是一个singleton还是一个prototype(每申请一次重新new一个返回)。
* 若该bean不存在则抛异常(NoSuchBeanDefinitionException)
* @param name
* @return boolean
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
*/
public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
return beanFactory.isSingleton(name);
}
/**
* 获取指定name的bean的类型
* @param name
* @return Class 注册对象的类型
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
*/
public static Class<?> getType(String name) throws NoSuchBeanDefinitionException {
return beanFactory.getType(name);
}
/**
* 如果指定name的bean有别名,则返回这些别名
* @param name
* @return
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
*
*/
public static String[] getAliases(String name) throws NoSuchBeanDefinitionException {
return beanFactory.getAliases(name);
}
}
| [
"[email protected]"
] | |
157c6a747561d69654077c826d36f0de2fc6b92c | 5c86661dfbbd3f03e739bedcaace460c5d7d861f | /src/Games/Random.java | 6b20d2e389980f38320ece5ae94799da14e731af | [] | no_license | bkim82/FreshEndProject | 2266c69cf403b9f58c107c2d5bd668ebf31c7a14 | 83b0c9a8b5e5bced5b6ffca58aa9a727e22c979b | refs/heads/master | 2020-09-27T00:43:40.942270 | 2019-06-13T14:00:44 | 2019-06-13T14:00:44 | 226,380,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,638 | java | package Games;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.image.Image;
import javafx.animation.AnimationTimer;
// Animation of Earth rotating around the sun. (Hello, world!)
public class Random extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage theStage) {
theStage.setTitle("AnimationTimer Example");
Group root = new Group();
Scene theScene = new Scene(root);
theStage.setScene(theScene);
Canvas canvas = new Canvas(512, 512);
root.getChildren().add(canvas);
GraphicsContext gc = canvas.getGraphicsContext2D();
Image earth = new Image("earth.jpg");
Image sun = new Image("regular_box.gif");
Image space = new Image("simon2.png");
final long startNanoTime = System.nanoTime();
new AnimationTimer() {
public void handle(long currentNanoTime) {
double t = (currentNanoTime - startNanoTime) / 1000000000.0;
double x = 232 + 128 * Math.cos(t);
double y = 232 + 128 * Math.sin(t);
// Clear the canvas
gc.clearRect(0, 0, 512, 512);
// background image clears canvas
gc.drawImage(space, 0, 0);
gc.drawImage(earth, x, y);
gc.drawImage(sun, 196, 196);
}
}.start();
theStage.show();
}
}
| [
"[email protected]"
] | |
4041d7b0b84f81a6cc0000e7640250793e60697a | db2ca48fffaf6689c9db439abaf9d98729548e0b | /zraapi/src/main/java/com/zrp/client/ItemDeliveryResource.java | 6921dd9fbe35784339b94f2d7611188b2cbe7e91 | [] | no_license | majinwen/sojourn | 46a950dbd64442e4ef333c512eb956be9faef50d | ab98247790b1951017fc7dd340e1941d5b76dc39 | refs/heads/master | 2020-03-22T07:07:05.299160 | 2018-03-18T13:45:23 | 2018-03-18T13:45:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,777 | java | package com.zrp.client;
import com.alibaba.fastjson.JSONObject;
import com.apollo.logproxy.slf4j.LoggerFactoryProxy;
import com.asura.framework.base.entity.DataTransferObject;
import com.asura.framework.base.util.JsonEntityTransform;
import com.asura.framework.base.util.RegExpUtil;
import com.asura.framework.utils.LogUtil;
import com.ziroom.minsu.services.basedata.api.inner.CityTemplateService;
import com.ziroom.minsu.services.basedata.entity.entityenum.ServiceLineEnum;
import com.ziroom.minsu.services.common.utils.DataFormat;
import com.ziroom.minsu.valenum.zrpenum.ContractTradingEnum;
import com.ziroom.zrp.houses.entity.CostStandardEntity;
import com.ziroom.zrp.houses.entity.RoomInfoEntity;
import com.ziroom.zrp.service.houses.api.ProjectService;
import com.ziroom.zrp.service.houses.api.RoomService;
import com.ziroom.zrp.service.houses.valenum.ItemTypeEnum;
import com.ziroom.zrp.service.houses.valenum.MeterTypeEnum;
import com.ziroom.zrp.service.houses.valenum.RoomTypeEnum;
import com.ziroom.zrp.service.trading.api.BindPhoneService;
import com.ziroom.zrp.service.trading.api.CallFinanceService;
import com.ziroom.zrp.service.trading.api.ItemDeliveryService;
import com.ziroom.zrp.service.trading.api.RentContractService;
import com.ziroom.zrp.service.trading.dto.ContractRoomDto;
import com.ziroom.zrp.service.trading.dto.SharerDto;
import com.ziroom.zrp.service.trading.dto.finance.ReceiptBillRequest;
import com.ziroom.zrp.service.trading.dto.finance.ReceiptBillResponse;
import com.ziroom.zrp.service.trading.valenum.CertTypeEnum;
import com.ziroom.zrp.service.trading.valenum.ContractStatusEnum;
import com.ziroom.zrp.service.trading.valenum.base.IsPayEnum;
import com.ziroom.zrp.service.trading.valenum.finance.CostCodeEnum;
import com.ziroom.zrp.service.trading.valenum.finance.DocumentTypeEnum;
import com.ziroom.zrp.service.trading.valenum.finance.VerificateStatusEnum;
import com.ziroom.zrp.trading.entity.*;
import com.zra.common.constant.BillMsgConstant;
import com.zra.common.constant.ContractMsgConstant;
import com.zra.common.enums.ErrorEnum;
import com.zra.common.enums.ItemDeliveryMsgEnum;
import com.zra.common.enums.RentTypeEunm;
import com.zra.common.result.ResponseDto;
import com.zra.common.utils.Check;
import com.zra.common.utils.DateTool;
import com.zra.common.utils.DateUtilFormate;
import com.zra.common.vo.base.*;
import com.zra.common.vo.delivery.CatalogItemVo;
import com.zra.common.vo.delivery.FeeHydropowerVo;
import com.zra.common.vo.delivery.PayFieldVo;
import com.zra.common.vo.perseon.SharerItemPersonVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.codehaus.jackson.type.TypeReference;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>物业交割相关逻辑</p>
* <p>
* <PRE>
* <BR> 修改记录
* <BR>-----------------------------------------------
* <BR> 修改日期 修改人 修改内容
* </PRE>
*
* @author jixd
* @version 1.0
* @Date Created in 2017年09月14日 11:58
* @since 1.0
*/
@Component
@Path("/itemDelivery")
@Api(value = "itemDelivery",description = "物业交割")
public class ItemDeliveryResource {
private static final Logger LOGGER = LoggerFactoryProxy.getLogger(ItemDeliveryResource.class);
@Resource(name = "trading.rentContractService")
private RentContractService rentContractService;
@Resource(name = "basedata.cityTemplateService")
private CityTemplateService cityTemplateService;
@Resource(name = "trading.itemDeliveryService")
private ItemDeliveryService itemDeliveryService;
@Resource(name = "trading.callFinanceService")
private CallFinanceService callFinanceService;
@Resource(name = "houses.projectService")
private ProjectService projectService;
@Resource(name = "houses.roomService")
private RoomService roomService;
@Resource(name = "trading.bindPhoneService")
private BindPhoneService bindPhoneService;
@Value("#{'${PIC_PREFIX_URL}'.trim()}")
private String PIC_PREFIX_URL;
/**
* 物业交割主面板
* @author jixd
* @created 2017年09月14日 12:01:23
* @param
* @return
*/
@POST
@Path("/panle/v1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@ApiOperation(value = "panle",response = ResponseDto.class)
public ResponseDto panle(@FormParam("contractId") String contractId){
LogUtil.info(LOGGER,"【panle】参数contractId={}",contractId);
try {
if (Check.NuNStr(contractId)){
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_PARAM_NULL);
}
DataTransferObject contractDto = JsonEntityTransform.json2DataTransferObject(rentContractService.findContractBaseByContractId(contractId));
if (contractDto.getCode() == DataTransferObject.ERROR){
return ResponseDto.responseDtoFail(contractDto.getMsg());
}
RentContractEntity rentContractEntity = contractDto.parseData("rentContractEntity", new TypeReference<RentContractEntity>() {});
if (!ContractStatusEnum.YQY.getStatus().equals(rentContractEntity.getConStatusCode())){
return ResponseDto.responseDtoFail("合同状态错误");
}
DataTransferObject timeDto = JsonEntityTransform.json2DataTransferObject(cityTemplateService.getTextValueForCommon(ServiceLineEnum.ZRP.getCode(),ContractTradingEnum.ContractTradingEnum007.getValue()));
if (timeDto.getCode() == DataTransferObject.ERROR){
return ResponseDto.responseDtoFail(timeDto.getMsg());
}
//首次支付时间
Date firstPayTime = rentContractEntity.getFirstPayTime();
if (Check.NuNObj(firstPayTime)){
LogUtil.error(LOGGER,"【panle】支付时间为空");
return ResponseDto.responseDtoFail("支付时间为空");
}
String time = timeDto.parseData("textValue", new TypeReference<String>() {});
String tillTimeStr = DateUtilFormate.formatDateToString(DateTool.getDatePlusHours(firstPayTime, Integer.parseInt(time)), DateUtilFormate.DATEFORMAT_6);
String msg = String.format(ContractMsgConstant.DELIVERY_TIME_MSG, tillTimeStr);
DataTransferObject roomDto = JsonEntityTransform.json2DataTransferObject(roomService.getRoomByFid(rentContractEntity.getRoomId()));
if (roomDto.getCode() == DataTransferObject.ERROR){
LogUtil.error(LOGGER,"【panle】查询房间信息错误={}",roomDto.toJsonString());
return ResponseDto.responseDtoFail(roomDto.getMsg());
}
RoomInfoEntity roomInfo = roomDto.parseData("roomInfo", new TypeReference<RoomInfoEntity>() {});
//是否支付完成
ReceiptBillRequest receiptBillRequest = new ReceiptBillRequest();
receiptBillRequest.setOutContractCode(rentContractEntity.getConRentCode());
receiptBillRequest.setDocumentType(DocumentTypeEnum.LIFE_FEE.getCode());
DataTransferObject billDto = JsonEntityTransform.json2DataTransferObject(callFinanceService.getReceivableBillInfo(JSONObject.toJSONString(receiptBillRequest)));
LogUtil.info(LOGGER,"【panle】账单查询结果result={}",billDto.toJsonString());
if (billDto.getCode() == DataTransferObject.ERROR){
LogUtil.info(LOGGER,"【panle】查询账单异常,result={}",billDto.toJsonString());
return ResponseDto.responseDtoFail(billDto.getMsg());
}
int isPay = (int)billDto.getData().get("isPay");
//部分付款按照未付款处理
isPay = (isPay == 2 ? 0:isPay);
List<BaseItemDescVo> panList = new ArrayList<>();
for (ItemDeliveryMsgEnum msgEnum : ItemDeliveryMsgEnum.values()){
if (msgEnum.getCode() == ItemDeliveryMsgEnum.SHFW.getCode()){
BaseItemDescColorVo baseItemDescColorVo = new BaseItemDescColorVo();
baseItemDescColorVo.setName(msgEnum.getName());
baseItemDescColorVo.setCode(msgEnum.getCode());
baseItemDescColorVo.setDesc(msgEnum.getDesc(isPay));
baseItemDescColorVo.setColor(msgEnum.getColor(isPay));
panList.add(baseItemDescColorVo);
continue;
}
if (msgEnum.getCode() == ItemDeliveryMsgEnum.HZXX.getCode() && roomInfo.getFtype() == RoomTypeEnum.BED.getCode()){
continue;
}
BaseItemDescVo baseItemVo = new BaseItemDescVo();
baseItemVo.setName(msgEnum.getName());
baseItemVo.setCode(msgEnum.getCode());
baseItemVo.setDesc(msgEnum.getDesc());
panList.add(baseItemVo);
}
//是否有合住人
int hasSharer = 1;
if (roomInfo.getFtype() == RoomTypeEnum.ROOM.getCode()){
DataTransferObject sharListDto = JsonEntityTransform.json2DataTransferObject(itemDeliveryService.listSharerByContractId(contractId));
if (sharListDto.getCode() == DataTransferObject.ERROR){
LogUtil.error(LOGGER,"查询合住人错误dto={}",sharListDto.toJsonString());
return ResponseDto.responseDtoFail(sharListDto.getMsg());
}
List<SharerEntity> sharerList = sharListDto.parseData("list", new TypeReference<List<SharerEntity>>() {});
if (Check.NuNCollection(sharerList)){
hasSharer = 0;
}
}else{
hasSharer = 0;
}
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("list",panList);
resultMap.put("tipMsg",msg);
resultMap.put("isPay",isPay);
resultMap.put("hasSharer",hasSharer);
LogUtil.info(LOGGER,"【panle】result={}",JsonEntityTransform.Object2Json(resultMap));
return ResponseDto.responseOK(resultMap);
}catch (Exception e){
LogUtil.info(LOGGER,"【panle】错误e={}",e);
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_FAIL);
}
}
/**
* 合住人列表
* @author jixd
* @created 2017年09月21日 10:23:42
* @param
* @return
*/
@POST
@Path("/sharerList/v1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@ApiOperation(value = "/sharerList",response = ResponseDto.class)
public ResponseDto sharerList(@FormParam("contractId") String contractId) {
LogUtil.info(LOGGER, "【sharerList】参数contractId={}", contractId);
if (Check.NuNStr(contractId)) {
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_PARAM_NULL);
}
DataTransferObject resultDto = JsonEntityTransform.json2DataTransferObject(itemDeliveryService.listSharerByContractId(contractId));
if (resultDto.getCode() == DataTransferObject.ERROR) {
return ResponseDto.responseDtoFail(resultDto.getMsg());
}
try {
List<SharerEntity> list = resultDto.parseData("list", new TypeReference<List<SharerEntity>>() {
});
List<SharerItemPersonVo> sharerList = new ArrayList<>();
for (SharerEntity sharerEntity : list) {
SharerItemPersonVo sharerItemPersonVo = new SharerItemPersonVo();
sharerItemPersonVo.setFid(sharerEntity.getFid());
sharerItemPersonVo.setName(sharerEntity.getFname());
BaseItemValueVo cardInfo = new BaseItemValueVo();
String fcerttype = sharerEntity.getFcerttype();
if (!Check.NuNStr(fcerttype)) {
cardInfo.setName(CertTypeEnum.getByCode(Integer.parseInt(fcerttype)).getName());
}
cardInfo.setValue(sharerEntity.getFcertnum());
cardInfo.setCode(Integer.parseInt(fcerttype));
sharerItemPersonVo.setCertInfo(cardInfo);
sharerItemPersonVo.setPhone(sharerEntity.getFmobile());
sharerList.add(sharerItemPersonVo);
}
List<BaseItemVo> certTypeList = new ArrayList<>();
for (CertTypeEnum certTypeEnum : CertTypeEnum.getSelectType()) {
BaseItemVo baseItemVo = new BaseItemVo();
baseItemVo.setCode(certTypeEnum.getCode());
baseItemVo.setName(certTypeEnum.getName());
certTypeList.add(baseItemVo);
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("sharerList", sharerList);
paramMap.put("certTypeList", certTypeList);
return ResponseDto.responseOK(paramMap);
} catch (Exception e) {
LogUtil.error(LOGGER, "【sharerList】异常e={}", e);
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_FAIL);
}
}
/**
* 保存或者更新合住人信息
* @author jixd
* @created 2017年09月21日 11:32:38
* @param
* @return
*/
@POST
@Path("/saveOrUpdateSharer/v1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@ApiOperation(value = "/saveOrUpdateSharer",response = ResponseDto.class)
public ResponseDto saveOrUpdateSharer(@FormParam("fid") String fid,
@FormParam("contractId") String contractId,
@FormParam("name") String name,
@FormParam("certType") String certType,
@FormParam("certNo") String certNo,
@FormParam("phone") String phone){
SharerDto sharerDto = new SharerDto();
sharerDto.setFid(fid);
sharerDto.setContractId(contractId);
sharerDto.setName(name);
sharerDto.setCertType(certType);
sharerDto.setCertNo(certNo);
sharerDto.setPhone(phone);
LogUtil.info(LOGGER,"【saveOrUpdateSharer】入参param={}",JsonEntityTransform.Object2Json(sharerDto));
try{
if (Check.NuNStr(certNo)){
return ResponseDto.responseDtoFail("证件类型为空");
}
CertTypeEnum certTypeEnum = CertTypeEnum.getByCode(Integer.parseInt(certType));
if (Check.NuNObj(certTypeEnum)){
return ResponseDto.responseDtoFail("证件类型不支持");
}
if (Integer.parseInt(certType) == CertTypeEnum.CERTCARD.getCode()){
if (!RegExpUtil.idIdentifyCardNum(certNo)){
return ResponseDto.responseDtoFail("身份证格式错误");
}
}else{
if (!Check.NuNStr(certNo) && certNo.length() > 40){
return ResponseDto.responseDtoFail(certTypeEnum.getName()+"格式错误");
}
}
String resultJson = itemDeliveryService.saveOrUpdateSharer(JsonEntityTransform.Object2Json(sharerDto));
LogUtil.info(LOGGER,"返回结果={}",resultJson);
DataTransferObject resultDto = JsonEntityTransform.json2DataTransferObject(resultJson);
return ResponseDto.responseDtoForData(resultDto);
}catch (Exception e){
LogUtil.error(LOGGER, "【sharerList】异常e={}", e);
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_FAIL);
}
}
/**
* 删除合住人
* @author jixd
* @created 2017年09月21日 12:03:10
* @param
* @return
*/
@POST
@Path("/deleteSharer/v1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@ApiOperation(value = "/deleteSharer",response = ResponseDto.class)
public ResponseDto deleteSharer(@FormParam("contractId") String contractId,@FormParam("fid") String fid){
LogUtil.info(LOGGER,"参数contractId={},fid={}",contractId,fid);
if (Check.NuNStr(contractId) || Check.NuNStr(fid)){
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_PARAM_NULL);
}
try{
return ResponseDto.responseDtoForData(JsonEntityTransform.json2DataTransferObject(itemDeliveryService.deleteSharerByFid(fid)));
}catch (Exception e){
LogUtil.error(LOGGER, "【deleteSharer】异常e={}", e);
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_FAIL);
}
}
/**
* 配置物品列表接口
* @author jixd
* @created 2017年09月21日 16:20:20
* @param
* @return
*/
@POST
@Path("/catalogItems/v1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@ApiOperation(value = "/catalogItems",response = ResponseDto.class)
public ResponseDto catalogItems(@FormParam("contractId") String contractId){
LogUtil.info(LOGGER,"【catalogItems】contractId={}",contractId);
if (Check.NuNStr(contractId)){
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_PARAM_NULL);
}
try {
DataTransferObject contractDto = JsonEntityTransform.json2DataTransferObject(rentContractService.findContractBaseByContractId(contractId));
if (contractDto.getCode() == DataTransferObject.ERROR){
return ResponseDto.responseDtoFail(contractDto.getMsg());
}
RentContractEntity rentContractEntity = contractDto.parseData("rentContractEntity", new TypeReference<RentContractEntity>() {});
ContractRoomDto contractRoomDto = new ContractRoomDto();
contractRoomDto.setContractId(contractId);
contractRoomDto.setRoomId(rentContractEntity.getRoomId());
DataTransferObject itemDto = JsonEntityTransform.json2DataTransferObject(itemDeliveryService.listValidItemByContractIdAndRoomId(JsonEntityTransform.Object2Json(contractRoomDto)));
if (itemDto.getCode() == DataTransferObject.ERROR){
return ResponseDto.responseDtoFail(itemDto.getMsg());
}
List<RentItemDeliveryEntity> list = itemDto.parseData("list", new TypeReference<List<RentItemDeliveryEntity>>() {});
if (Check.NuNCollection(list)){
LogUtil.info(LOGGER,"【catalogItems】没有物品信息");
return ResponseDto.responseDtoFail("没有物品信息");
}
//分组统计
Map<String, List<RentItemDeliveryEntity>> mapItem = list.stream().collect(Collectors.groupingBy(RentItemDeliveryEntity::getItemType));
List<CatalogItemVo> resultList = new ArrayList<>();
for (Map.Entry<String,List<RentItemDeliveryEntity>> entry : mapItem.entrySet()){
CatalogItemVo catalogItemVo = new CatalogItemVo();
ItemTypeEnum itemTypeEnum = ItemTypeEnum.getByCode(Integer.parseInt(entry.getKey()));
catalogItemVo.setName(itemTypeEnum.getName());
List<RentItemDeliveryEntity> rentList = entry.getValue();
for (RentItemDeliveryEntity itemDeliveryEntity : rentList){
CatalogItemVo.ItemInfo itemInfo = catalogItemVo.new ItemInfo();
itemInfo.setName(itemDeliveryEntity.getItemname());
itemInfo.setPrice(String.format(ContractMsgConstant.DELIVERY_ITEM_MONEY_MSG,itemDeliveryEntity.getPrice()));
itemInfo.setNum(itemDeliveryEntity.getFactualnum());
catalogItemVo.getItems().add(itemInfo);
}
resultList.add(catalogItemVo);
}
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("catalogItems",resultList);
LogUtil.info(LOGGER,"【catalogItems】result={}",JsonEntityTransform.Object2Json(paramMap));
return ResponseDto.responseOK(paramMap);
}catch (Exception e){
LogUtil.error(LOGGER, "【catalogItems】异常e={}", e);
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_FAIL);
}
}
/**
* 生活费用项
* @author jixd
* @created 2017年09月25日 16:34:42
* @param
* @return
*/
@POST
@Path("/lifeFeeItems/v1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@ApiOperation(value = "/lifeFeeItems",response = ResponseDto.class)
public ResponseDto lifeFeeItems(@FormParam("contractId") String contractId){
LogUtil.info(LOGGER,"【lifeFeeItems】contractId={}",contractId);
if (Check.NuNStr(contractId)){
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_PARAM_NULL);
}
try {
DataTransferObject contractDto = JsonEntityTransform.json2DataTransferObject(rentContractService.findContractBaseByContractId(contractId));
if (contractDto.getCode() == DataTransferObject.ERROR){
LogUtil.error(LOGGER,"【lifeFeeItems】查询合同错误dto={}",contractDto.toJsonString());
return ResponseDto.responseDtoFail(contractDto.getMsg());
}
RentContractEntity rentContractEntity = contractDto.parseData("rentContractEntity", new TypeReference<RentContractEntity>() {});
String projectId = rentContractEntity.getProjectId();
DataTransferObject constDto = JsonEntityTransform.json2DataTransferObject(projectService.findCostStandardByProjectId(projectId));
if (constDto.getCode() == DataTransferObject.ERROR){
LogUtil.error(LOGGER,"【lifeFeeItems】查询基础基础物品价格错误dto={}",constDto.toJsonString());
return ResponseDto.responseDtoFail(constDto.getMsg());
}
LogUtil.info(LOGGER,"【lifeFeeItems】查询基础基础物品价格={}",constDto.toJsonString());
FeeHydropowerVo waterVo = new FeeHydropowerVo();
waterVo.setName(MeterTypeEnum.WATER.getMachineName());
FeeHydropowerVo electricVo = new FeeHydropowerVo();
electricVo.setName(MeterTypeEnum.ELECTRICITY.getMachineName());
//填充单价数据
List<CostStandardEntity> costList = constDto.parseData("list", new TypeReference<List<CostStandardEntity>>() {});
List<PayFieldVo> feeList = new ArrayList<>();
//设置单价
for (CostStandardEntity costStandardEntity : costList){
if (costStandardEntity.getFmetertype().equals(String.valueOf(MeterTypeEnum.WATER.getCode()))){
String price = String.format(BillMsgConstant.RMB_CHINESE,costStandardEntity.getFprice());
waterVo.setUnit(String.format(ContractMsgConstant.DELIVERY_LIFEFEE_UNIT_MSG,price,MeterTypeEnum.WATER.getUnit()));
}
if (costStandardEntity.getFmetertype().equals(String.valueOf(MeterTypeEnum.ELECTRICITY.getCode()))){
String price = String.format(BillMsgConstant.RMB_CHINESE,costStandardEntity.getFprice());
electricVo.setUnit(String.format(ContractMsgConstant.DELIVERY_LIFEFEE_UNIT_MSG,price,MeterTypeEnum.ELECTRICITY.getUnit()));
}
}
feeList.add(0,waterVo);
feeList.add(1,electricVo);
//填充底表示数
ContractRoomDto contractRoomDto = new ContractRoomDto();
contractRoomDto.setContractId(contractId);
contractRoomDto.setRoomId(rentContractEntity.getRoomId());
DataTransferObject meterDetailDto = JsonEntityTransform.json2DataTransferObject(itemDeliveryService.findMeterDetailById(JsonEntityTransform.Object2Json(contractRoomDto)));
if (meterDetailDto.getCode() == DataTransferObject.ERROR){
LogUtil.error(LOGGER,"【lifeFeeItems】底表示数获取错误dto={}",meterDetailDto.toJsonString());
return ResponseDto.responseDtoFail(meterDetailDto.getMsg());
}
LogUtil.info(LOGGER,"【lifeFeeItems】底表示数={}",meterDetailDto.toJsonString());
MeterDetailEntity meterDetail = meterDetailDto.parseData("meterDetail", new TypeReference<MeterDetailEntity>() {});
if (Check.NuNObj(meterDetail)){
LogUtil.info(LOGGER,"【lifeFeeItems】水电费未录入");
return ResponseDto.responseDtoFail("水电费未录入");
}
waterVo.setNumber(String.format(ContractMsgConstant.DELIVERY_LIFEFEE_NUMBER_MSG,meterDetail.getFwatermeternumber()));
waterVo.setPicUrl(PIC_PREFIX_URL + meterDetail.getFwatermeterpic());
electricVo.setNumber(String.format(ContractMsgConstant.DELIVERY_LIFEFEE_NUMBER_MSG,meterDetail.getFelectricmeternumber()));
electricVo.setPicUrl(PIC_PREFIX_URL +meterDetail.getFelectricmeterpic());
//填充财务相关支付数据
ReceiptBillRequest receiptBillRequest = new ReceiptBillRequest();
receiptBillRequest.setOutContractCode(rentContractEntity.getConRentCode());
receiptBillRequest.setDocumentType(DocumentTypeEnum.LIFE_FEE.getCode());
DataTransferObject billDto = JsonEntityTransform.json2DataTransferObject(callFinanceService.getReceivableBillInfo(JSONObject.toJSONString(receiptBillRequest)));
LogUtil.info(LOGGER,"【lifeFeeItems】财务生活费用查询结果={}",billDto.toJsonString());
if (billDto.getCode() == DataTransferObject.ERROR){
LogUtil.error(LOGGER,"【lifeFeeItems】查询账单异常,result={}",billDto.toJsonString());
return ResponseDto.responseDtoFail(billDto.getMsg());
}
int payMoney = 0;
List<ReceiptBillResponse> listBill = billDto.parseData("listStr", new TypeReference<List<ReceiptBillResponse>>() {});
if (!Check.NuNCollection(listBill)){
for (ReceiptBillResponse receiptBillResponse : listBill){
int isPay = VerificateStatusEnum.DONE.getCode() == receiptBillResponse.getVerificateStatus() ? IsPayEnum.YES.getCode():IsPayEnum.NO.getCode();
if (receiptBillResponse.getCostCode().equals(CostCodeEnum.ZRYSF.getCode())){
waterVo.setValue(String.format(BillMsgConstant.RMB_CHINESE,DataFormat.formatHundredPrice(receiptBillResponse.getReceiptBillAmount())));
payMoney += (receiptBillResponse.getReceiptBillAmount() - receiptBillResponse.getReceivedBillAmount());
waterVo.setIsPay(isPay);
continue;
}
if (receiptBillResponse.getCostCode().equals(CostCodeEnum.ZRYDF.getCode())){
electricVo.setValue(String.format(BillMsgConstant.RMB_CHINESE,DataFormat.formatHundredPrice(receiptBillResponse.getReceiptBillAmount())));
payMoney += (receiptBillResponse.getReceiptBillAmount() - receiptBillResponse.getReceivedBillAmount());
electricVo.setIsPay(isPay);
continue;
}
CostCodeEnum costCodeEnum = CostCodeEnum.getByCode(receiptBillResponse.getCostCode());
if (!Check.NuNObj(costCodeEnum)){
PayFieldVo payFieldVo = new PayFieldVo();
payFieldVo.setName(costCodeEnum.getName());
payFieldVo.setValue(String.format(BillMsgConstant.RMB_CHINESE,DataFormat.formatHundredPrice(receiptBillResponse.getReceiptBillAmount())));
payFieldVo.setIsPay(isPay);
feeList.add(payFieldVo);
payMoney += (receiptBillResponse.getReceiptBillAmount() - receiptBillResponse.getReceivedBillAmount());
}
}
}
if (Check.NuNObj(waterVo.getValue())){
waterVo.setValue("0.0");
}
if (Check.NuNObj(electricVo.getValue())){
electricVo.setValue("0.0");
}
int isPay = (int)billDto.getData().get("isPay");
isPay = (isPay == 2 ? 0:isPay);
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("feeList",feeList);
resultMap.put("payMoney",payMoney);
resultMap.put("isPay",isPay);
LogUtil.info(LOGGER,"【lifeFeeItems】返回结果result={}",JsonEntityTransform.Object2Json(resultMap));
return ResponseDto.responseOK(resultMap);
}catch (Exception e){
LogUtil.error(LOGGER, "【lifeFeeItems】异常e={}", e);
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_FAIL);
}
}
/**
* 证件列表
* @author jixd
* @created 2017年10月20日 09:37:34
* @param
* @return
*/
@POST
@Path("/certTypeList/v1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@ApiOperation(value = "/certTypeList",response = ResponseDto.class)
public ResponseDto certTypeList(@FormParam("contractId") String contractId){
LogUtil.info(LOGGER,"【certTypeList】contractId={}",contractId);
List<BaseItemVo> certTypeList = new ArrayList<>();
for (CertTypeEnum certTypeEnum : CertTypeEnum.getSelectType()) {
BaseItemVo baseItemVo = new BaseItemVo();
baseItemVo.setCode(certTypeEnum.getCode());
baseItemVo.setName(certTypeEnum.getName());
certTypeList.add(baseItemVo);
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("certTypeList", certTypeList);
return ResponseDto.responseOK(paramMap);
}
/**
* 确认物业交割
* @author jixd
* @created 2017年09月26日 13:47:21
* @param
* @return
*/
@POST
@Path("/confirmDelivery/v1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@ApiOperation(value = "/confirmDelivery",response = ResponseDto.class)
public ResponseDto confirmDelivery(@FormParam("contractId") String contractId){
LogUtil.info(LOGGER,"【confirmDelivery】contractId={}",contractId);
if (Check.NuNStr(contractId)){
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_PARAM_NULL);
}
try {
DataTransferObject contractDto = JsonEntityTransform.json2DataTransferObject(rentContractService.findContractBaseByContractId(contractId));
if (contractDto.getCode() == DataTransferObject.ERROR){
return ResponseDto.responseDtoFail(contractDto.getMsg());
}
RentContractEntity rentContractEntity = contractDto.parseData("rentContractEntity", new TypeReference<RentContractEntity>() {});
//是否支付完成
ReceiptBillRequest receiptBillRequest = new ReceiptBillRequest();
receiptBillRequest.setOutContractCode(rentContractEntity.getConRentCode());
receiptBillRequest.setDocumentType(DocumentTypeEnum.LIFE_FEE.getCode());
DataTransferObject billDto = JsonEntityTransform.json2DataTransferObject(callFinanceService.getReceivableBillInfo(JSONObject.toJSONString(receiptBillRequest)));
LogUtil.info(LOGGER,"【confirmDelivery】账单查询结果result={}",billDto.toJsonString());
if (billDto.getCode() == DataTransferObject.ERROR){
LogUtil.info(LOGGER,"【confirmDelivery】查询账单异常,result={}",billDto.toJsonString());
return ResponseDto.responseDtoFail(billDto.getMsg());
}
int isPay = (int)billDto.getData().get("isPay");
if (isPay == 0){
return ResponseDto.responseDtoFail("您还有生活费用账单未支付完成");
}
String json = itemDeliveryService.confirmDelivery(contractId);
LogUtil.info(LOGGER,"更新结果result={}",json);
DataTransferObject dto = JsonEntityTransform.json2DataTransferObject(json);
return ResponseDto.responseDtoForData(dto);
}catch (Exception e){
LogUtil.error(LOGGER, "【confirmDelivery】异常e={}", e);
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_FAIL);
}
}
/**
* 管家是否录入物业交割信息
* @author jixd
* @created 2017年11月05日 14:41:44
* @param
* @return
*/
@POST
@Path("/isEnterDelivery/v1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@ApiOperation(value = "/isEnterDelivery",response = ResponseDto.class)
public ResponseDto isEnterDelivery(@FormParam("contractId") String contractId){
LogUtil.info(LOGGER,"【isEnterDelivery】contractId={}",contractId);
if (Check.NuNStr(contractId)){
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_PARAM_NULL);
}
try {
DataTransferObject contractDto = JsonEntityTransform.json2DataTransferObject(rentContractService.findContractBaseByContractId(contractId));
if (contractDto.getCode() == DataTransferObject.ERROR) {
return ResponseDto.responseDtoFail(contractDto.getMsg());
}
RentContractEntity rentContractEntity = contractDto.parseData("rentContractEntity", new TypeReference<RentContractEntity>() {});
String zoCode = rentContractEntity.getFhandlezocode();
ContractRoomDto contractRoomDto = new ContractRoomDto();
contractRoomDto.setContractId(contractId);
contractRoomDto.setRoomId(rentContractEntity.getRoomId());
DataTransferObject meterDetailDto = JsonEntityTransform.json2DataTransferObject(itemDeliveryService.findMeterDetailById(JsonEntityTransform.Object2Json(contractRoomDto)));
if (meterDetailDto.getCode() == DataTransferObject.ERROR){
LogUtil.error(LOGGER,"【isEnterDelivery】底表示数获取错误dto={}",meterDetailDto.toJsonString());
return ResponseDto.responseDtoFail(meterDetailDto.getMsg());
}
LogUtil.info(LOGGER,"【isEnterDelivery】底表示数={}",meterDetailDto.toJsonString());
MeterDetailEntity meterDetail = meterDetailDto.parseData("meterDetail", new TypeReference<MeterDetailEntity>() {});
int isEnter = 0;
String telephoneNum = "";
if (!Check.NuNObj(meterDetail)){
isEnter = 1;
}
LogUtil.info(LOGGER,"【isEnterDelivery】管家编号={}",zoCode);
if (isEnter == 0){
String bindPhoneJson = bindPhoneService.findBindPhoneByEmployeeCode(rentContractEntity.getProjectId(),zoCode);
LogUtil.info(LOGGER,"查询结果",bindPhoneJson);
DataTransferObject bindPhoneDto = JsonEntityTransform.json2DataTransferObject(bindPhoneJson);
if (bindPhoneDto.getCode() == DataTransferObject.ERROR){
LogUtil.error(LOGGER,"【isEnterDelivery】查询400电话错误={}",bindPhoneDto.toJsonString());
return ResponseDto.responseDtoFail(bindPhoneDto.getMsg());
}
telephoneNum = bindPhoneDto.parseData("data", new TypeReference<String>() {});
if (Check.NuNStr(telephoneNum)){
return ResponseDto.responseDtoFail("未查询到管家联系电话");
}
}
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("isEnter",isEnter);
resultMap.put("telephoneNum",telephoneNum);
resultMap.put("msg",ContractMsgConstant.DELIVERY_CUSTOMER_TIP_CONTACT);
ResponseDto responseDto = ResponseDto.responseOK(resultMap);
LogUtil.info(LOGGER,"【isEnterDelivery】返回结果={}",JsonEntityTransform.Object2Json(responseDto));
return responseDto;
}catch (Exception e){
LogUtil.error(LOGGER, "【isEnterDelivery】异常e={}", e);
return ResponseDto.responseDtoErrorEnum(ErrorEnum.MSG_FAIL);
}
}
}
| [
"068411Lsp"
] | 068411Lsp |
38fa11038a5b543d4571919c50dadf147ad16bd2 | a4ab1627b509e924962667d8fe82aeb511ed0982 | /Offer/src/com/betel/offer/controller/OfferControllerMobile.java | 690e4bc81e013dea7d8e7ce3439f837ac35d2907 | [] | no_license | betels/offer | b134563f22f4fb2653fe1a0806b2a7d32221d27e | 5a930c536341412032e37a597044f23ef2e54922 | refs/heads/master | 2016-08-11T21:19:51.490383 | 2015-05-23T19:51:51 | 2015-05-23T19:51:51 | 36,139,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,702 | java | /**
* OfferControllerMobile.java
* java Servlet class for mobile view to read(select) and write(insert,create) offers
* version:
* date: 22/05/1015
* @author Betel Samson Tadesse
* x14117649
*
*
*/
package com.betel.offer.controller;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.codehaus.jackson.map.ObjectMapper;
import com.betel.offer.data.DataManager;
import com.betel.offer.model.Coordinate;
import com.betel.offer.model.Offer;
import com.betel.offer.model.User;
@WebServlet("/publicOffers")
public class OfferControllerMobile extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/json; charset=utf-8");
response.setCharacterEncoding("utf-8");
StringBuilder sb = new StringBuilder();
BufferedReader br = request.getReader();
String str;
while ((str = br.readLine()) != null) {
sb.append(str);
}
ObjectMapper mapper = new ObjectMapper();
Coordinate coordinate = mapper.readValue(sb.toString(), Coordinate.class);
DataManager dataManager = new DataManager();
Map<String, Object> map = new HashMap<String, Object>();
List<Offer> offers = dataManager.getNearestOffers(coordinate);
map.put("results", offers);
String json = mapper.writeValueAsString(map);
PrintWriter out = response.getWriter();
out.println(json);
}
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
String mealIdString = request.getParameter("id");
Integer mealId = mealIdString != null ? Integer.parseInt(mealIdString): 0;
DataManager dataManager = new DataManager();
Offer offer = dataManager.getOffer(mealId);
Map<String, Object> map = new HashMap<>();
map.put("result", offer);
ObjectMapper mapper = new ObjectMapper();
//DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm a z");
//mapper.setDateFormat(df);
String json = mapper.writeValueAsString(map);
PrintWriter out = response.getWriter();
out.println(json);
}
/**
*
*/
private static final long serialVersionUID = 1L;
}
| [
"[email protected]"
] | |
255ee62b466412b62de5bb9fdd29ed6724dcd346 | b77bf23ba60db5794445b8204317ed8b7388a2fd | /net/minecraft/client/renderer/entity/RenderPlayer.java | bdb2611fc377666b258e2ac200fbc05c7b721f49 | [] | no_license | SulfurClient/Sulfur | f41abb5335ae9617a629ced0cde4703ef7cc5f2c | e54efe14bb52d09752f9a38d7282f0d1cd81e469 | refs/heads/main | 2022-07-29T03:18:53.078298 | 2022-02-02T15:09:34 | 2022-02-02T15:09:34 | 426,418,356 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,450 | java | package net.minecraft.client.renderer.entity;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.layers.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.ResourceLocation;
public class RenderPlayer extends RendererLivingEntity {
private boolean field_177140_a;
// private static final String __OBFID = "CL_00001020";
public RenderPlayer(RenderManager p_i46102_1_) {
this(p_i46102_1_, false);
}
public RenderPlayer(RenderManager p_i46103_1_, boolean p_i46103_2_) {
super(p_i46103_1_, new ModelPlayer(0.0F, p_i46103_2_), 0.5F);
this.field_177140_a = p_i46103_2_;
this.addLayer(new LayerBipedArmor(this));
this.addLayer(new LayerHeldItem(this));
this.addLayer(new LayerArrow(this));
this.addLayer(new LayerDeadmau5Head(this));
this.addLayer(new LayerCape(this));
this.addLayer(new LayerCustomHead(this.func_177136_g().bipedHead));
}
public ModelPlayer func_177136_g() {
return (ModelPlayer) super.getMainModel();
}
public void func_180596_a(AbstractClientPlayer p_180596_1_, double p_180596_2_, double p_180596_4_, double p_180596_6_, float p_180596_8_, float p_180596_9_) {
if (!p_180596_1_.func_175144_cb() || this.renderManager.livingPlayer == p_180596_1_) {
double var10 = p_180596_4_;
if (p_180596_1_.isSneaking() && !(p_180596_1_ instanceof EntityPlayerSP)) {
var10 = p_180596_4_ - 0.125D;
}
this.func_177137_d(p_180596_1_);
super.doRender((EntityLivingBase) p_180596_1_, p_180596_2_, var10, p_180596_6_, p_180596_8_, p_180596_9_);
}
}
private void func_177137_d(AbstractClientPlayer p_177137_1_) {
ModelPlayer var2 = this.func_177136_g();
if (p_177137_1_.func_175149_v()) {
var2.func_178719_a(false);
var2.bipedHead.showModel = true;
var2.bipedHeadwear.showModel = true;
} else {
ItemStack var3 = p_177137_1_.inventory.getCurrentItem();
var2.func_178719_a(true);
var2.bipedHeadwear.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.HAT);
var2.field_178730_v.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.JACKET);
var2.field_178733_c.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.LEFT_PANTS_LEG);
var2.field_178731_d.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.RIGHT_PANTS_LEG);
var2.field_178734_a.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.LEFT_SLEEVE);
var2.field_178732_b.showModel = p_177137_1_.func_175148_a(EnumPlayerModelParts.RIGHT_SLEEVE);
var2.heldItemLeft = 0;
var2.aimedBow = false;
var2.isSneak = p_177137_1_.isSneaking();
if (var3 == null) {
var2.heldItemRight = 0;
} else {
var2.heldItemRight = 1;
if (p_177137_1_.getItemInUseCount() > 0 || (p_177137_1_ instanceof EntityPlayerSP && ((EntityPlayerSP) p_177137_1_).getBlocking())) {
EnumAction var4 = var3.getItemUseAction();
if (var4 == EnumAction.BLOCK) {
var2.heldItemRight = 3;
} else if (var4 == EnumAction.BOW) {
var2.aimedBow = true;
}
}
}
}
}
protected ResourceLocation func_180594_a(AbstractClientPlayer p_180594_1_) {
return p_180594_1_.getLocationSkin();
}
public void func_82422_c() {
GlStateManager.translate(0.0F, 0.1875F, 0.0F);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(AbstractClientPlayer p_77041_1_, float p_77041_2_) {
float var3 = 0.9375F;
GlStateManager.scale(var3, var3, var3);
}
protected void renderOffsetLivingLabel(AbstractClientPlayer p_96449_1_, double p_96449_2_, double p_96449_4_, double p_96449_6_, String p_96449_8_, float p_96449_9_, double p_96449_10_) {
if (p_96449_10_ < 100.0D) {
Scoreboard var12 = p_96449_1_.getWorldScoreboard();
ScoreObjective var13 = var12.getObjectiveInDisplaySlot(2);
if (var13 != null) {
Score var14 = var12.getValueFromObjective(p_96449_1_.getName(), var13);
this.renderLivingLabel(p_96449_1_, var14.getScorePoints() + " " + var13.getDisplayName(), p_96449_2_, p_96449_4_, p_96449_6_, 64);
p_96449_4_ += (float) this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * p_96449_9_;
}
}
super.func_177069_a(p_96449_1_, p_96449_2_, p_96449_4_, p_96449_6_, p_96449_8_, p_96449_9_, p_96449_10_);
}
public void func_177138_b(AbstractClientPlayer p_177138_1_) {
float var2 = 1.0F;
GlStateManager.color(var2, var2, var2);
ModelPlayer var3 = this.func_177136_g();
this.func_177137_d(p_177138_1_);
var3.swingProgress = 0.0F;
var3.isSneak = false;
var3.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, p_177138_1_);
var3.func_178725_a();
}
public void func_177139_c(AbstractClientPlayer p_177139_1_) {
float var2 = 1.0F;
GlStateManager.color(var2, var2, var2);
ModelPlayer var3 = this.func_177136_g();
this.func_177137_d(p_177139_1_);
var3.isSneak = false;
var3.swingProgress = 0.0F;
var3.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, p_177139_1_);
var3.func_178726_b();
}
/**
* Sets a simple glTranslate on a LivingEntity.
*/
protected void renderLivingAt(AbstractClientPlayer p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) {
if (p_77039_1_.isEntityAlive() && p_77039_1_.isPlayerSleeping()) {
super.renderLivingAt(p_77039_1_, p_77039_2_ + (double) p_77039_1_.field_71079_bU, p_77039_4_ + (double) p_77039_1_.field_71082_cx, p_77039_6_ + (double) p_77039_1_.field_71089_bV);
} else {
super.renderLivingAt(p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_);
}
}
protected void func_180595_a(AbstractClientPlayer p_180595_1_, float p_180595_2_, float p_180595_3_, float p_180595_4_) {
if (p_180595_1_.isEntityAlive() && p_180595_1_.isPlayerSleeping()) {
GlStateManager.rotate(p_180595_1_.getBedOrientationInDegrees(), 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(this.getDeathMaxRotation(p_180595_1_), 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(270.0F, 0.0F, 1.0F, 0.0F);
} else {
super.rotateCorpse(p_180595_1_, p_180595_2_, p_180595_3_, p_180595_4_);
}
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_) {
this.preRenderCallback((AbstractClientPlayer) p_77041_1_, p_77041_2_);
}
protected void rotateCorpse(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) {
this.func_180595_a((AbstractClientPlayer) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_);
}
/**
* Sets a simple glTranslate on a LivingEntity.
*/
protected void renderLivingAt(EntityLivingBase p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) {
this.renderLivingAt((AbstractClientPlayer) p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
this.func_180596_a((AbstractClientPlayer) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
public ModelBase getMainModel() {
return this.func_177136_g();
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return this.func_180594_a((AbstractClientPlayer) p_110775_1_);
}
protected void func_177069_a(Entity p_177069_1_, double p_177069_2_, double p_177069_4_, double p_177069_6_, String p_177069_8_, float p_177069_9_, double p_177069_10_) {
this.renderOffsetLivingLabel((AbstractClientPlayer) p_177069_1_, p_177069_2_, p_177069_4_, p_177069_6_, p_177069_8_, p_177069_9_, p_177069_10_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
this.func_180596_a((AbstractClientPlayer) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}
| [
"[email protected]"
] | |
c09b5c5d9d2210115a36a4bab8f6b65ce2966e28 | 77d45452c0028564935fb85b0fa1cd324665e4c0 | /src/main/java/com/realtimecep/storm/starter/transactional/MyTransactionalWords.java | 6bcc96902409e1b7a897be71975117db1b556636 | [] | no_license | tedwon/real-time-statsS-pilot | 33fe168ea0602da841512f5a90854f6b420a5592 | 5bbb7f2ed8432127de1f5de12e4ea9ea14dc0179 | refs/heads/master | 2021-01-25T07:35:26.540572 | 2013-03-30T04:08:32 | 2013-03-30T04:08:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,583 | java | package com.realtimecep.storm.starter.transactional;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.coordination.BatchOutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.testing.MemoryTransactionalSpout;
import backtype.storm.topology.BasicOutputCollector;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseBasicBolt;
import backtype.storm.topology.base.BaseTransactionalBolt;
import backtype.storm.transactional.ICommitter;
import backtype.storm.transactional.TransactionAttempt;
import backtype.storm.transactional.TransactionalTopologyBuilder;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;
import backtype.storm.tuple.Values;
import backtype.storm.utils.Utils;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* This class defines a more involved transactional topology then TransactionalGlobalCount. This topology
* processes a stream of words and produces two outputs:
*
* 1. A count for each word (stored in a database)
* 2. The number of words for every bucket of 10 counts. So it stores in the database how many words have appeared
* 0-9 times, how many have appeared 10-19 times, and so on.
* count 수치 범위에 따라서 담는 버킷을 구분하고 처리 결과 담긴 버킷의 내용으로 데이터 통계를 파악 할 수 있다.
* top N count에 활용 할 수 있다.
*
* A batch of words can cause the bucket counts to decrement for some buckets and increment for others as words move
* between buckets as their counts accumulate.
*
* Debug - tuple object
* source: spout:7, stream: default, id: {}, [1:7101600008655646784, dog]
*
* TxID:AttemptID
* 1:7101600008655646784
*
*/
public class MyTransactionalWords {
public static class CountValue {
Integer prev_count = null;
int count = 0;
//TransactionAttempt id
BigInteger txid = null;
@Override
public String toString() {
return "CountValue{" +
"prev_count=" + prev_count +
", count=" + count +
", txid=" + txid +
'}';
}
}
public static class BucketValue {
int count = 0;
BigInteger txid;
@Override
public String toString() {
return "BucketValue{" +
"count=" + count +
", txid=" + txid +
'}';
}
}
public static final int BUCKET_SIZE = 3;
public static Map<String, CountValue> COUNT_DATABASE = new HashMap<String, CountValue>();
public static Map<Integer, BucketValue> BUCKET_DATABASE = new HashMap<Integer, BucketValue>();
public static final int PARTITION_TAKE_PER_BATCH = 3;
public static final Map<Integer, List<List<Object>>> DATA = new HashMap<Integer, List<List<Object>>>() {{
put(0, new ArrayList<List<Object>>() {{
add(new Values("cat"));
add(new Values("dog"));
add(new Values("chicken"));
add(new Values("tedwon"));
add(new Values("dog"));
add(new Values("apple"));
}});
put(1, new ArrayList<List<Object>>() {{
add(new Values("cat"));
add(new Values("dog"));
add(new Values("apple"));
add(new Values("banana"));
}});
put(2, new ArrayList<List<Object>>() {{
add(new Values("cat"));
add(new Values("cat"));
add(new Values("cat"));
add(new Values("cat"));
add(new Values("cat"));
add(new Values("dog"));
add(new Values("dog"));
add(new Values("dog"));
add(new Values("dog"));
}});
}};
public static class KeyedCountUpdater extends BaseTransactionalBolt implements ICommitter {
Map<String, Integer> _counts = new HashMap<String, Integer>();
BatchOutputCollector _collector;
TransactionAttempt _id;
int _count = 0;
@Override
public void prepare(Map conf, TopologyContext context, BatchOutputCollector collector, TransactionAttempt id) {
_collector = collector;
_id = id;
}
@Override
public void execute(Tuple tuple) {
// System.out.println(tuple);
String key = tuple.getString(1);
Integer curr = _counts.get(key);
if(curr==null) curr = 0;
// word count
_counts.put(key, curr + 1);
// System.out.println(_counts);
// Utils.sleep(1000);
}
@Override
public void finishBatch() {
// finishBatch 메소드는 execute 메소드와 상관없이 연속으로 호출됨
// System.out.println("finishBatch");
// word count 데이터가 들어있는 map을 꺼내서 외부 DATABASE에 넣는다.
for(String key: _counts.keySet()) {
CountValue val = COUNT_DATABASE.get(key);
CountValue newVal;
if(val==null || !val.txid.equals(_id)) {
// 처음이거나 다른 tx인 경우
newVal = new CountValue();
newVal.txid = _id.getTransactionId();
if(val!=null) {
newVal.prev_count = val.count;
newVal.count = val.count;
}
newVal.count = newVal.count + _counts.get(key);
COUNT_DATABASE.put(key, newVal);
// System.out.println(key + " : " + newVal);
} else {
// 두번째 이상이고 같은 tx인경우
newVal = val;
}
_collector.emit(new Values(_id, key, newVal.count, newVal.prev_count));
// System.out.println(COUNT_DATABASE);
}
}
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
// prev-count: 이전 tx에서 count했던 값
declarer.declare(new Fields("id", "key", "count", "prev-count"));
}
}
public static class Bucketize extends BaseBasicBolt {
@Override
public void execute(Tuple tuple, BasicOutputCollector collector) {
// System.out.println(tuple);
TransactionAttempt attempt = (TransactionAttempt) tuple.getValue(0);
int curr = tuple.getInteger(2);
Integer prev = tuple.getInteger(3);
int currBucket = curr / BUCKET_SIZE;
Integer prevBucket = null;
if(prev!=null) {
prevBucket = prev / BUCKET_SIZE;
}
if(prevBucket==null) {
Values tuple1 = new Values(attempt, currBucket, 1);
collector.emit(tuple1);
// System.out.println("prevBucket==null :" + tuple1);
} else if(currBucket != prevBucket) {
Values tuple1 = new Values(attempt, currBucket, 1);
collector.emit(tuple1);
// System.out.println("currBucket != prevBucket :" + tuple1);
Values tuple2 = new Values(attempt, prevBucket, -1);
collector.emit(tuple2);
// System.out.println("currBucket != prevBucket :" + tuple2);
}
}
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("attempt", "bucket", "delta"));
}
}
public static class BucketCountUpdater extends BaseTransactionalBolt {
Map<Integer, Integer> _accum = new HashMap<Integer, Integer>();
BatchOutputCollector _collector;
TransactionAttempt _attempt;
int _count = 0;
@Override
public void prepare(Map conf, TopologyContext context, BatchOutputCollector collector, TransactionAttempt attempt) {
_collector = collector;
_attempt = attempt;
}
@Override
public void execute(Tuple tuple) {
Integer bucket = tuple.getInteger(1);
Integer delta = tuple.getInteger(2);
Integer curr = _accum.get(bucket);
if(curr==null) curr = 0;
_accum.put(bucket, curr + delta);
}
@Override
public void finishBatch() {
for(Integer bucket: _accum.keySet()) {
BucketValue currVal = BUCKET_DATABASE.get(bucket);
BucketValue newVal;
if(currVal==null || !currVal.txid.equals(_attempt.getTransactionId())) {
newVal = new BucketValue();
newVal.txid = _attempt.getTransactionId();
newVal.count = _accum.get(bucket);
if(currVal!=null) newVal.count += currVal.count;
BUCKET_DATABASE.put(bucket, newVal);
} else {
newVal = currVal;
}
Values tuple = new Values(_attempt, bucket, newVal.count);
_collector.emit(tuple);
// System.out.println(tuple);
System.out.println(BUCKET_DATABASE);
}
}
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("id", "bucket", "count"));
}
}
public static void main(String[] args) throws Exception {
MemoryTransactionalSpout spout = new MemoryTransactionalSpout(DATA, new Fields("word"), PARTITION_TAKE_PER_BATCH);
TransactionalTopologyBuilder builder = new TransactionalTopologyBuilder("top-n-words", "spout", spout, 1);
// 단순 word count
builder.setBolt("count", new KeyedCountUpdater(), 5)
.fieldsGrouping("spout", new Fields("word"));
// ?
builder.setBolt("bucketize", new Bucketize())
.noneGrouping("count");
builder.setBolt("buckets", new BucketCountUpdater(), 5)
.fieldsGrouping("bucketize", new Fields("bucket"));
LocalCluster cluster = new LocalCluster();
Config config = new Config();
config.setDebug(true);
config.setMaxSpoutPending(3);
cluster.submitTopology("top-n-topology", config, builder.buildTopology());
// Thread.sleep(3000);
// cluster.shutdown();
}
}
| [
"[email protected]"
] | |
e7f8716e2da3f30aca81193186083b256309aee3 | 9be7bd85b859c94ac900345eb4055e577873e891 | /eclipseWorkspace/Classes/src/com/qa/OOP/RockHopper.java | 8217a6a2465ced46863476a7ec2da98a23ae131e | [] | no_license | mltomlins0n/QAC | f4e8f2e2d9b405f1f602d8031cffe0c7a61076ce | 0819e460b3c309c73bd89a804d5e3a3a077914e4 | refs/heads/main | 2023-04-03T20:21:44.176924 | 2021-04-20T18:29:06 | 2021-04-20T18:29:06 | 202,366,868 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package com.qa.OOP;
public class RockHopper extends Penguin {
public String hopping;
public RockHopper(String fluffiness, String hopping) {
super(fluffiness);
this.hopping = hopping;
}
}
| [
"[email protected]"
] | |
7d222d9e4d7f8a9b4af29acd53c68b80dea5023c | 517e16473e1319bccfd99689de7ad4442e4ac8c3 | /Survey_3_Public/src/main/java/com/atguigu/survey/e/RemoveAuthFailedException.java | 6e572557a9133005de087f33d947a8fc1bedcd1c | [] | no_license | jing-312/survey | a56f5aa2668e63a977fe9711c32c279d33e4b9a3 | d45acb870799a624afe23f31fb98e9bba0cfcc70 | refs/heads/master | 2021-01-24T07:30:03.058342 | 2017-06-16T01:36:35 | 2017-06-16T01:36:35 | 93,350,401 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package com.atguigu.survey.e;
public class RemoveAuthFailedException extends RuntimeException{
/**
*
*/
private static final long serialVersionUID = 1L;
public RemoveAuthFailedException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
}
| [
"[email protected]"
] | |
6b421eaaa92249242b40828b5e180caa05a65117 | 9fc727e8ddca46ea326da7d117bdba21af5bfd54 | /src/main/java/br/com/b2w/bit/planets/integration/ResultSW.java | acf9c1192f65f276ab630070bc390bd51b1eaee5 | [
"MIT"
] | permissive | matheosu/Planets | efd8cedccda0354cd6d61790d1581f0dc84372cf | b406d7c3390b8a949870e496064143007544c5e4 | refs/heads/master | 2021-01-24T10:04:53.525005 | 2018-03-01T02:08:07 | 2018-03-01T02:08:07 | 123,035,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 919 | java | package br.com.b2w.bit.planets.integration;
import java.io.Serializable;
import java.util.List;
public class ResultSW<Result> implements Serializable {
private static final long serialVersionUID = 3018206290692462813L;
private Long count;
private String next;
private String previous;
private List<Result> results;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public String getNext() {
return next;
}
public void setNext(String next) {
this.next = next;
}
public String getPrevious() {
return previous;
}
public void setPrevious(String previous) {
this.previous = previous;
}
public List<Result> getResults() {
return results;
}
public void setResults(List<Result> results) {
this.results = results;
}
}
| [
"[email protected]"
] | |
2576bce0f3ca7ed0c64d6200668506605f3940fe | ea498659ab22013e4789b169a2372700e11b9509 | /src/main/java/ar/edu/unlam/tallerweb1/servicios/ServicioUsuarioComicImpl.java | f93cdd18dff1f98c122d01b62f7630b9d56c8772 | [] | no_license | vegitojor/jarvis | 5db394cfc6b64fdf0a6e75afcfe5558e86a6eb5e | 66c42e3546c6f7f0ee5a7216d6c4ddf84a61e6bd | refs/heads/master | 2021-01-20T13:22:51.288804 | 2017-07-14T19:31:51 | 2017-07-14T19:31:51 | 90,483,089 | 1 | 0 | null | 2017-07-05T16:52:41 | 2017-05-06T18:29:13 | Java | UTF-8 | Java | false | false | 1,924 | java | package ar.edu.unlam.tallerweb1.servicios;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import javax.inject.Inject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ar.edu.unlam.tallerweb1.dao.ComicDao;
import ar.edu.unlam.tallerweb1.dao.UsuarioComicDao;
import ar.edu.unlam.tallerweb1.dao.UsuarioDao;
import ar.edu.unlam.tallerweb1.modelo.UsuarioComic;
@Service("servicioUsuarioComic")
@Transactional
public class ServicioUsuarioComicImpl implements ServicioUsuarioComic {
@Inject
private ComicDao comicDao;
@Inject
private UsuarioDao usuarioDao;
@Inject
private UsuarioComicDao usuarioComicDao;
@Override
public UsuarioComic guardarUsuarioComic(Long idUsuario, Long idComic, Boolean siguiendoActualmente) {
Date fechaRegistroDate = new Date();
UsuarioComic usuarioComic = null;
UsuarioComic usuarioComicExistente = usuarioComicDao.consultarUsuarioComic(idUsuario, idComic);
if ( usuarioComicExistente != null ) {
usuarioComic = usuarioComicExistente;
} else {
usuarioComic = new UsuarioComic();
usuarioComic.setUsuario(usuarioDao.obtenerUsuarioPorId(idUsuario));
usuarioComic.setComic(comicDao.buscarComic(idComic));
}
usuarioComic.setSiguiendoActualmente(siguiendoActualmente);
usuarioComic.setFechaRegistro( new Timestamp(fechaRegistroDate.getTime()) );
if ( usuarioComic.getId()!=null ) {
usuarioComicDao.guardarUsuarioComic(usuarioComic);
} else {
usuarioComicDao.guardarNuevoUsuarioComic(usuarioComic);
}
return usuarioComic;
}
@Override
public List<UsuarioComic> listarUsuarioComics(Long idUsuario) {
return usuarioComicDao.listarUsuarioComicsSiguiendoActualmente(idUsuario);
}
@Override
public UsuarioComic consultarUsuarioComic(Long idUsuario, Long idComic) {
return usuarioComicDao.consultarUsuarioComic(idUsuario, idComic);
}
} | [
"[email protected]"
] | |
0563f14ba00f6ca9e2c91c98c08445b226e24a0c | 1b8fbbb2fa23e21cc82c52cb3d049217aba4a423 | /app/src/main/java/com/example/webandappdevelopment/LoanFragment.java | 2360afec32d9397cf4197aa0c4e121d2afe16a29 | [] | no_license | efarioli/WebAndAppDevelopment | 266e5a81d7480a7bdafbc6e286d5084a003db220 | f7f67c0cb77b5cdf9ff7b763a079a89771d3b1ba | refs/heads/master | 2022-10-06T00:19:55.906123 | 2020-06-05T16:15:34 | 2020-06-05T16:15:34 | 269,698,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,607 | java | package com.example.webandappdevelopment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.webandappdevelopment.ModelDTO.BookDTO;
import com.example.webandappdevelopment.ModelDTO.LoanDTO;
import com.example.webandappdevelopment.Utils.Myhelper;
import com.example.webandappdevelopment.Utils.RetrofitHelper;
import com.muddzdev.styleabletoast.StyleableToast;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
public class LoanFragment extends Fragment {
private ArrayList<LoanItem> mExampleList;
private RecyclerView mRecyclerView;
private LoanAdapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
List<LoanDTO> mLoans;
TextView mTitle1;
TextView mTitle2;
TextView mTitle3;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_loan, container, false);
mTitle1 = v.findViewById(R.id.view_loans_title1);
mTitle2 = v.findViewById(R.id.view_loans_title2);
mTitle3 = v.findViewById(R.id.view_loans_title3);
mTitle1.setText(R.string.member_area);
mTitle2.setText(SessionObject.getInstance().getMemberDTO().getName());
mTitle3.setText(R.string.current_loans);
buildRecyclerView(v);
createExampleList();
return v;
}
public void renewLoan(int position, String text) {
RestFulWebServiceApi retroApi = RetrofitHelper.getRetrofitSepUP();
Call<List<LoanDTO>> call = retroApi.renewLoan(mLoans.get(position).getId(), mLoans.get(position));
Context context1 = getActivity();
RetrofitHelper.makeCall((loans) -> {
renewLoanAsync(loans, position);
}, call, position, context1
);
}
public void renewLoanAsync(List<LoanDTO> loans, int position) {
mLoans = loans;
LoanDTO loan = mLoans.get(position);
mExampleList.get(position).setmNumberRenewals("" + (loan.getNumberOfRenewals()));
mAdapter.notifyItemChanged(position);
String message = String.format("Book \"%s\" \n(Copy no %s)\nhas been renewed", loan.getCopy().getBook().getTitle(), "" + loan.getCopy().getId());
StyleableToast.makeText(getContext(), message, R.style.toast_success).show();
}
public void returnBook(int position) {
RestFulWebServiceApi retroApi = RetrofitHelper.getRetrofitSepUP();
Call<List<LoanDTO>> call = retroApi.addBookToLoanHistory(mLoans.get(position).getId(), mLoans.get(position));
RetrofitHelper.makeCall((t) -> {
returnBookAsync(t, position);
}, call, position, getActivity()
);
}
private void returnBookAsync(List<LoanDTO> loans, int position) {
mLoans.remove(position);
mExampleList.remove(position);
mAdapter.notifyItemRemoved(position);
}
private void createExampleList() {
RestFulWebServiceApi retroApi = RetrofitHelper.getRetrofitSepUP();
int userId = SessionObject.getInstance().getMemberDTO().getId();
Call<List<LoanDTO>> call = retroApi.getCurrentLoanForMember(userId);
mExampleList = new ArrayList<>();
RetrofitHelper.makeCall((t) -> {
makeAsyncList(t);
}, call, null, getActivity()
);
}
private void makeAsyncList(List<LoanDTO> loans) {
mLoans = loans;
for (LoanDTO loan : mLoans) {
BookDTO book = loan.getCopy().getBook();
LoanItem ex = new LoanItemBuilder().setExId(loan.getId())
.setmBookTitle(book.getTitle())
.setmBookAuthor(book.getAuthor())
.setmBookIsbn(book.getIsbn())
.setmBorrowed(Myhelper.CalendarToStringF(loan.getLoanDate()))
.setmDueDate(Myhelper.CalendarToStringF(loan.getDueDate()))
.setmNumberRenewals("" + loan.getNumberOfRenewals())
.createExampleItem();
mExampleList.add(ex);
}
buildRecyclerView(getView());
}
private void buildRecyclerView(View v) {
mRecyclerView = v.findViewById(R.id.recycler_view_loan);
mLayoutManager = new LinearLayoutManager(getActivity());
((LinearLayoutManager) mLayoutManager).setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(mLayoutManager);
mAdapter = new LoanAdapter(mExampleList);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnItemClickListener(new LoanAdapter.OnItemClickListener() {
@Override
public void onRenewBtnClick(int position) {
renewLoan(position, "Clicked! pos " + position);
}
@Override
public void onReturnBtnClick(int position) {
returnBook(position);
}
});
}
}
| [
"[email protected]"
] | |
33bbe3cadea42f3c0cbd33e1f0535940e643f826 | 9f3112863d975c6cbcc5abeb4b443610f6052d6d | /model/TFonctionsDB.java | deaf374d7ebb66e620cda17f4b633751363142d8 | [] | no_license | Experts-unis/gotimer | ab7e52cff85829efac06aa85ac582e13f3857e7d | b387d4123c5dac868989e55300246e61fd414bda | refs/heads/master | 2021-01-19T23:47:04.233795 | 2017-04-20T11:56:22 | 2017-04-20T16:16:50 | 89,026,389 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 18,508 | java | /**
*
*/
package model;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import org.apache.logging.log4j.LogManager;
import controleur.ExceptionTraitementSQL;
/**
* @author test
*
*/
public class TFonctionsDB extends TableDB {
static org.apache.logging.log4j.Logger log = LogManager . getLogger ( TFonctionsDB.class );
private String queryDeleteProjet;
private PreparedStatement dbPrepDeleteProjet;
private PreparedStatement dbPrepArchive;
private String queryArchive;
private PreparedStatement dbPrepArchiveDuProjet;
private String queryArchiveDuProjet;
private PreparedStatement dbPrepUpdateReport;
private String queryReport;
private PreparedStatement dbPrepUpdateReportProjet;
private String queryReportProjet;
private PreparedStatement dbPrepComplexite;
private String queryComplexite;
private PreparedStatement dbPrepComplexiteSimple;
private String queryComplexiteSimple;
protected String queryUpdateSelection;
protected PreparedStatement dbPrepUpdateSelection;
int index=0;
/**
* @param nameTable
* @param nameID
* @param driver
* @throws ExceptionTraitementSQL
*/
public TFonctionsDB() throws ExceptionTraitementSQL {
super("TFONCTIONS","IDFONC");
log.traceEntry("TFonctionsModel()") ;
prepareDeleteProjet();
prepareArchive();
prepareArchiveDuProjet();
prepareReport() ;
prepareComplexite();
prepareComplexiteSimple();
prepareUpdateSelection();
log.traceExit("TFonctionsModel()") ;
}
public void prepareUpdateSelection() throws ExceptionTraitementSQL {
// Prépare requete modification
queryUpdateSelection="UPDATE TFONCTIONS SET FOCUSED = ? WHERE IDFONC=?";
this.dbPrepUpdateSelection = prepareQuery(queryUpdateSelection);
}
/* (non-Javadoc)
* @see model.TableModel#prepareUpdate()
*/
@Override
public void prepareUpdate() throws ExceptionTraitementSQL {
log.traceEntry("prepareUpdate()");
// Prépare la modification de tprojets.libelle.
// System.out.println("Appel de prepareUpdate dans TFonctionsModel");
queryUpdate="UPDATE TFONCTIONS SET LIBELLE = ?, IDCOMPLEXITE=?, ESTIMATION=?,IDPARETO=?,IDEISENHOWER=?, IDMOTIVATION=? WHERE IDFONC=?";
this.dbPrepUpdate = prepareQuery(queryUpdate);
log.traceExit("prepareUpdate()") ;
}
/**
* @throws ExceptionTraitementSQL
*
*/
private void prepareComplexiteSimple() throws ExceptionTraitementSQL {
log.traceEntry("prepareComplexiteSimple()");
//On crée l'objet avec la requête en paramètre
queryComplexiteSimple ="UPDATE TFONCTIONS SET IDCOMPLEXITE = ?, ESTIMATION= ? WHERE IDFONC=?";
this.dbPrepComplexiteSimple = prepareQuery(queryComplexiteSimple);
log.traceExit("prepareComplexiteSimple()") ;
}
public void prepareComplexite() throws ExceptionTraitementSQL {
log.traceEntry("prepareComplexite()");
// Prépare la modification de tprojets.libelle.
// System.out.println("Appel de prepareUpdate dans TFonctionsModel");
queryComplexite="UPDATE TFONCTIONS SET IDCOMPLEXITE=?, ESTIMATION=?,IDPARETO=?,IDEISENHOWER=?, IDMOTIVATION=? WHERE IDFONC=?";
this.dbPrepComplexite = prepareQuery(queryComplexite);
log.traceExit("prepareComplexite()") ;
}
/** Préparation d'une requete de type delete paramétrée pour suppression des fonctions d'un projet
* @throws ExceptionTraitementSQL
*/
private void prepareDeleteProjet() throws ExceptionTraitementSQL {
log.traceEntry("prepareDeleteProjet()");
//On crée l'objet avec la requête en paramètre
queryDeleteProjet ="DELETE FROM TFONCTIONS WHERE IDPROJET=?";
this.dbPrepDeleteProjet = prepareQuery(queryDeleteProjet);
log.traceExit("prepareDeleteProjet()") ;
}
/**
* @throws ExceptionTraitementSQL
*
*/
private void prepareReport() throws ExceptionTraitementSQL {
log.traceEntry("prepareReport()");
//On crée l'objet avec la requête en paramètre
queryReport ="UPDATE TFONCTIONS SET REPORT=?, FOCUSED=false, ARCHIVE=false WHERE IDFONC=?";
this.dbPrepUpdateReport = prepareQuery(queryReport);
queryReportProjet ="UPDATE TFONCTIONS SET REPORT=?, FOCUSED=false, ARCHIVE=false WHERE IDPROJET=?";
this.dbPrepUpdateReportProjet = prepareQuery(queryReportProjet);
log.traceExit("prepareReport()") ;
}
/**
* @throws ExceptionTraitementSQL
*
*/
private void prepareArchive() throws ExceptionTraitementSQL {
log.traceEntry("prepareArchive()");
//On crée l'objet avec la requête en paramètre
queryArchive ="UPDATE TFONCTIONS SET ARCHIVE=?, FOCUSED=false, REPORT=false WHERE IDFONC=?";
this.dbPrepArchive = prepareQuery(queryArchive);
log.traceExit("prepareArchive()") ;
}
/**
* @throws ExceptionTraitementSQL
*
*/
private void prepareArchiveDuProjet() throws ExceptionTraitementSQL {
log.traceEntry("prepareArchiveDuProjet()");
//On crée l'objet avec la requête en paramètre
queryArchiveDuProjet ="UPDATE TFONCTIONS SET ARCHIVE=?, FOCUSED=false, REPORT=false WHERE IDPROJET=?";
this.dbPrepArchiveDuProjet = prepareQuery(queryArchiveDuProjet);
log.traceExit("prepareArchiveDuProjet()") ;
}
/* (non-Javadoc)
* @see model.TableModel#prepareInsert()
*/
@Override
public void prepareInsert() throws ExceptionTraitementSQL {
log.traceEntry("prepareInsert()");
//On crée l'objet avec la requête en paramètre
// System.out.println("Appel de prepareInsert dans TFonctionModel");
queryInsert ="INSERT INTO TFONCTIONS "
+ "("
+ "IDFONC,LIBELLE,IDPROJET,"
+ "IDPARETO, IDEISENHOWER,IDCOMPLEXITE,"
+ "ESTIMATION,IDMOTIVATION, REPORT,"
+ "FOCUSED,ARCHIVE,IDDELEGUER) "
+ "values (?,?,?,?,?,?,?,?,false,false,false,null)";
this.dbPrepInsert = prepareQuery(queryInsert);
log.traceExit("prepareInsert()") ;
}
/**
* Charge la liste des fonctions avec les données de la base
* @param lesFonctionsDuProjets
* @param idProj
* @throws ExceptionTraitementSQL
*/
// public void getList(ListModelFonction lesFonctionsDuProjets, int idProj) throws ExceptionTraitementSQL {
//
// setQueryList("SELECT IDFONC,LIBELLE,SELECTED FROM TFONCTIONS WHERE ARCHIVE=false AND IDPROJET = " + Integer.toString(idProj) + " ORDER BY LIBELLE");
// lesFonctionsDuProjets.clear();
// setIndex(0);
// setList(lesFonctionsDuProjets);
// int size;
// loadListGenerique();
//
//
// }
//
// /* (non-Javadoc)
// * @see model.DBTable#initListObject()
// */
// @Override
// protected void initListObject() {
// // Rien à faire, déjà fait !
//
// }
/* (non-Javadoc)
* @see model.DBTable#addNewElement(java.sql.ResultSet)
*/
@Override
protected void addNewElementInAVectorList(ResultSet result) {
// index++
// lesFonctionsDuProjets.addElement(new DataInfoFonction(result.getInt("IDFONC"),result.getString("LIBELLE"),idProj,result.getBoolean("SELECTED"),getIndex()));
}
/**
* @return the index
*/
public int getIndex() {
return index;
}
/**
* @param index the index to set
*/
public void setIndex(int index) {
this.index = index;
}
/*
public void getList(ListModelFonction lesFonctionsDuProjets, int idProj) throws ExceptionTraitementSQL {
log.traceEntry("getList(ListModelFonction lesFonctionsDuProjets, int idProj = "+idProj+")") ;
//TODO A GENERALISER
ResultSet result =null;
String query ="SELECT IDFONC,LIBELLE,FOCUSED,IDPARETO,IDEISENHOWER,IDCOMPLEXITE,ESTIMATION FROM TFONCTIONS WHERE ARCHIVE=false AND REPORT=false AND IDDELEGUER IS NULL AND IDPROJET = " + Integer.toString(idProj) + " ORDER BY LIBELLE";
lesFonctionsDuProjets.clear();
int index=0;
int size;
//L'objet ResultSet contient le résultat de la requête SQL
try {
result = DB.dbStatement.executeQuery(query);
while(result.next()){
lesFonctionsDuProjets.addElement(
new DataInfoFonction(
result.getInt("IDFONC"),
result.getString("LIBELLE"),
idProj,
result.getBoolean("FOCUSED"),
result.getInt("IDPARETO"),
result.getInt("IDEISENHOWER"),
result.getInt("IDCOMPLEXITE"),
result.getDouble("ESTIMATION"),
index++));
}
size=lesFonctionsDuProjets.size();
} catch (SQLException e) {
log.fatal("Rq KO "+query);
log.fatal("printStackTrace " , e);
size=-1;
throw new ExceptionTraitementSQL(e,query);
}
log.traceExit("getList - size = " + size) ;
}
*/
protected Vector<DataInfoFonction> getList(int idProj, String query) throws ExceptionTraitementSQL {
log.traceEntry("Vector<DataInfoFonction> getList(int idProj="+idProj+")");
//TODO A GENERALISER AUSSI
Vector<DataInfoFonction> listeFonctions = new Vector<DataInfoFonction>();
ResultSet result =null;
int index=0;
//L'objet ResultSet contient le résultat de la requête SQL
try {
result = DB.dbStatement.executeQuery(query);
log.trace("getList : Rq OK " +query);
while(result.next()){
listeFonctions.add(
new DataInfoFonction(
result.getInt("IDFONC"),
result.getString("LIBELLE"),
idProj,
result.getBoolean("FOCUSED"),
result.getInt("IDPARETO"),
result.getInt("IDEISENHOWER"),
result.getInt("IDCOMPLEXITE"),
result.getDouble("ESTIMATION"),
result.getInt("IDMOTIVATION"),
index++));
}
log.traceExit("getList(int idProj) OK size = "+listeFonctions.size()) ;
return listeFonctions;
} catch (SQLException e) {
log.fatal("Rq KO "+query);
log.fatal("printStackTrace " , e);
log.traceExit("getList(int idProj) KO ") ;
throw new ExceptionTraitementSQL(e,query);
}
}
public Vector<DataInfoFonction> getList(int id) throws ExceptionTraitementSQL {
String query ="SELECT IDFONC,LIBELLE,FOCUSED,IDPARETO,IDEISENHOWER,IDCOMPLEXITE,ESTIMATION,IDMOTIVATION "
+ "FROM TFONCTIONS "
+ "WHERE ARCHIVE=false AND REPORT=false AND IDPROJET = " + Integer.toString(id)
+ " ORDER BY FOCUSED DESC, IDPARETO ASC, IDEISENHOWER ASC, IDMOTIVATION ASC, LIBELLE ASC";
return getList(id,query);
}
/**
* @param id
* @return
* @throws ExceptionTraitementSQL
*/
public Vector<DataInfoFonction> getListArchive(int id) throws ExceptionTraitementSQL {
String query ="SELECT IDFONC,LIBELLE,FOCUSED,IDPARETO,IDEISENHOWER,IDCOMPLEXITE,ESTIMATION,IDMOTIVATION "
+ "FROM TFONCTIONS "
+ "WHERE ARCHIVE=true AND IDPROJET = " + Integer.toString(id)
+ " ORDER BY LIBELLE ASC";
return getList(id,query);
}
/**
* @param id
* @return
* @throws ExceptionTraitementSQL
*/
public Vector<DataInfoFonction> getListReport(int id) throws ExceptionTraitementSQL {
String query ="SELECT IDFONC,LIBELLE,FOCUSED,IDPARETO,IDEISENHOWER,IDCOMPLEXITE,ESTIMATION,IDMOTIVATION "
+ "FROM TFONCTIONS "
+ "WHERE REPORT=true AND IDPROJET = " + Integer.toString(id)
+ " ORDER BY FOCUSED DESC, IDPARETO ASC, IDEISENHOWER ASC, LIBELLE ASC";
return getList(id,query);
}
/** Fonction suppression des fonctions d'un projet
* @param id
* @throws ExceptionTraitementSQL
*/
public void deleteProjet(int id) throws ExceptionTraitementSQL {
log.traceEntry("deleteProjet(int id="+id+")");
super.delete(dbPrepDeleteProjet, id);
log.traceExit("deleteProjet(int id)") ;
}
/**
* @param nameFonc : nom de la fonction
* @param idProj : reference du projet
* @return id de la fonction
* @throws ExceptionTraitementSQL
*/
public int add(String nameFonc,int idProj,int idpareto, int ideisenhower, int idcomplexite, double estimation,int idmotivation) throws ExceptionTraitementSQL {
log.traceEntry("add(String nameFonc="+nameFonc+",int idProj="+idProj+"int idpareto="+idpareto+", int ideisenhower="+ideisenhower+", int idcomplexite="+idcomplexite+", double estimation="+estimation+",int idmotivation="+idmotivation+")");
//TODO A Généraliser
//INSERT INTO TFONCTIONS (IDFONC,LIBELLE,IDPROJET,IDPARETO, IDEISENHOWER,IDCOMPLEXITE,ESTIMATION, REPORT,FOCUSED,ARCHIVE,IDDELEGUER) values (?,?,?,false,false,false,null)";
//Ajouter une référence de fonction dans la table TFONCTIONS
try
{
//On paramètre notre requête préparée
dbPrepInsert.setInt(1, this.getNextID());
dbPrepInsert.setString(2, nameFonc);
dbPrepInsert.setInt(3, idProj);
dbPrepInsert.setInt(4, idpareto);
dbPrepInsert.setInt(5, ideisenhower);
dbPrepInsert.setInt(6, idcomplexite);
dbPrepInsert.setDouble(7, estimation);
dbPrepInsert.setInt(8, idmotivation);
//On exécute
dbPrepInsert.executeUpdate();
int ret = getCurrentID();
log.traceExit("add(String nameFonc,int idProj) OK => id="+ret) ;
return ret;
} catch (SQLException e) {
log.fatal("Rq KO "+dbPrepInsert.toString());
log.fatal("printStackTrace " , e);
log.traceExit("add(String nameFonc,int idProj) KO ") ;
throw new ExceptionTraitementSQL(e,dbPrepInsert.toString());
}
}
/**
* @param id
* @param text
* @throws ExceptionTraitementSQL
*/
public void updateFonction(int id, String nameFonction,int idcomplexite, double estimation, int idpareto, int ideisenhower,int idmotivation) throws ExceptionTraitementSQL {
log.traceEntry("updateFonction(int id="+id+", String nameFonction="+nameFonction+",int idcomplexite="+idcomplexite+", "
+ "double estimation="+estimation+", int idpareto="+idpareto
+ ", int ideisenhower="+ideisenhower+",int idmotivation="+idmotivation+")");
try
{
//queryUpdate="UPDATE TFONCTIONS SET LIBELLE = ?, IDCOMPLEXITE=?, ESTIMATION=?,IDPARETO=?,IDEISENHOWER=? WHERE IDFONC=?";
//On paramètre notre requête préparée
dbPrepUpdate.setString(1, nameFonction);
dbPrepUpdate.setInt(2, idcomplexite);
dbPrepUpdate.setDouble(3, estimation);
dbPrepUpdate.setInt(4, idpareto);
dbPrepUpdate.setInt(5, ideisenhower);
dbPrepUpdate.setInt(6, idmotivation);
dbPrepUpdate.setInt(7, id);
//On exécute
dbPrepUpdate.executeUpdate();
// System.out.println("Rq sur tfonction OK "+dbPrepUpdate.toString() );
} catch (SQLException e) {
// System.out.println("Rq sur tfonction KO "+dbPrepUpdate.toString() );
log.fatal("Rq KO "+dbPrepUpdate.toString());
log.fatal("printStackTrace " , e);
throw new ExceptionTraitementSQL(e,dbPrepUpdate.toString());
}
log.traceExit("updateFonction()") ;
}
/**
* @param id
* @throws ExceptionTraitementSQL
*/
public void archiveFonction(int id,boolean value) throws ExceptionTraitementSQL {
log.traceEntry("archiveFonction(int id="+id+")");
updateBoolean(dbPrepArchive, id, value);
log.traceExit("archiveFonction()") ;
}
/**
* @param id
* @param value
* @throws ExceptionTraitementSQL
*/
public void archiveFonctionDuProjet(int id, boolean value) throws ExceptionTraitementSQL {
log.traceEntry("archiveFonctionDuProjet(int id="+id+")");
updateBoolean(dbPrepArchiveDuProjet, id, value);
log.traceExit("archiveFonctionDuProjet()") ;
}
/**
* @param id
* @param idComplexite
* @param estimation
* @throws ExceptionTraitementSQL
*/
public void updateComplexite(int id, int idComplexite, Double estimation,int idPareto,int idEisenhower,int idmotivation) throws ExceptionTraitementSQL {
log.traceEntry("updateComplexite(int id="+id+", int idComplexite="+idComplexite+", Double estimation="+estimation+", int idmotivation="+idmotivation+") ");
//"UPDATE TFONCTIONS SET IDCOMPLEXITE=?, ESTIMATION=?,IDPARETO=?,IDEISENHOWER=?, IDMOTIVATION=? WHERE IDFONC=?
try
{
//On paramètre notre requête préparée
int n=1;
dbPrepComplexite.setInt(n, idComplexite);
dbPrepComplexite.setDouble(++n, estimation);
dbPrepComplexite.setInt(++n, idPareto);
dbPrepComplexite.setInt(++n, idEisenhower);
dbPrepComplexite.setInt(++n, idmotivation);
dbPrepComplexite.setInt(++n, id);
//On exécute
dbPrepComplexite.executeUpdate();
} catch (SQLException e) {
// System.out.println("Rq sur tfonction KO "+dbPrepDelete.toString() );
log.fatal("Rq KO "+dbPrepComplexite.toString());
log.fatal("printStackTrace " , e);
throw new ExceptionTraitementSQL(e,dbPrepComplexite.toString());
}
log.traceExit("updateComplexite()") ;
}
public void updateComplexiteSimple(int id, int idComplexite, Double estimation) throws ExceptionTraitementSQL {
log.traceEntry("updateComplexiteSimple(int id="+id+", int idComplexite="+idComplexite+", Double estimation="+estimation+") ");
//"UPDATE TFONCTIONS SET COMPLEXITE = ?, ESTIMATION= ? WHERE IDFONC=?"
try
{
//On paramètre notre requête préparée
int n=1;
dbPrepComplexiteSimple.setInt(n, idComplexite);
dbPrepComplexiteSimple.setDouble(++n, estimation);
dbPrepComplexiteSimple.setInt(++n, id);
//On exécute
dbPrepComplexiteSimple.executeUpdate();
} catch (SQLException e) {
// System.out.println("Rq sur tfonction KO "+dbPrepDelete.toString() );
log.fatal("Rq KO "+dbPrepComplexiteSimple.toString());
log.fatal("printStackTrace " , e);
throw new ExceptionTraitementSQL(e,dbPrepComplexiteSimple.toString());
}
log.traceExit("updateComplexiteSimple()") ;
}
/* (non-Javadoc)
* @see model.DBTable#initListObject()
*/
@Override
protected void initListObject() {
// Pas utilisé
}
/**
* @param id
* @param b
* @throws ExceptionTraitementSQL
*/
public void updateSelectionByDefault(int id, boolean value) throws ExceptionTraitementSQL {
log.traceEntry("updateSelectionByDefault(int id="+id+", boolean value="+value+")");
updateBoolean(dbPrepUpdateSelection, id, value);
log.traceExit("updateSelectionByDefault()");
}
/**
* @param id
* @param b
* @throws ExceptionTraitementSQL
*/
public void updateReport(int id, boolean value) throws ExceptionTraitementSQL {
log.traceEntry("updateReport(int id="+id+", boolean value="+value+")");
updateBoolean(dbPrepUpdateReport, id, value);
log.traceExit("updateReport()");
}
/** Reporter toutes les fonctions du projet
* @param id
* @param value
* @throws ExceptionTraitementSQL
*/
public void updateReportProjet(int id, boolean value) throws ExceptionTraitementSQL {
log.traceEntry("updateReportProjet(int id="+id+", boolean value="+value+")");
updateBoolean(dbPrepUpdateReportProjet, id, value);
log.traceExit("updateReportProjet()");
}
}
| [
"[email protected]"
] | |
7319451e723d09d2b17c9cb53e1fe20f8f7d5190 | 63e316e743974fc1f18f0cb87e2023e10df29872 | /app/src/main/java/com/takethecorner/kluz/Article.java | fe5fdd7c2b7a94a2e66c067f821bc63b66a18a6f | [] | no_license | kluz116/takethecornerApp | aee704e7def70527884bad652c28087f1943de71 | ac317fe10efbdfe51a9df229bd199b81db5b0d09 | refs/heads/master | 2020-12-30T15:41:34.152606 | 2017-05-13T08:48:40 | 2017-05-13T08:48:40 | 91,161,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,571 | java | package com.takethecorner.kluz;
import java.io.Serializable;
/**
* Created by com.takethecorner.kluz Musembya on 18/05/16.
*/
public class Article implements Serializable {
private int id;
private String title;
private String author;
private String thumbnail;
private String articles;
private String date_created;
public Article() {
}
public Article(int id, String title, String author, String thumbnail, String articles, String date_created) {
this.id = id;
this.title = title;
this.author = author;
this.thumbnail = thumbnail;
this.articles = articles;
this.date_created = date_created;
}
public int getId(){
return id;
}
public void setId(int id){
this.id = id;
}
public String getTitle() {
return title;
}
public void setSetTitle(String name) {
this.title = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String numOfSongs) {
this.author = numOfSongs;
}
public String getThumbnail() {
return thumbnail;
}
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
public String getArticlel() {
return articles;
}
public void setArtcile(String articles) {
this.articles = articles;
}
public String getDateCreated() {
return date_created;
}
public void setDate_created(String date_created) {
this.date_created = date_created;
}
}
| [
"engallanmusembya.com"
] | engallanmusembya.com |
2b26a1b656fe945ff226f9c443e0bf3fa67c11af | ade8459db35f299fe254f560de6f2736a6cf19f6 | /SetAndHashSet/src/com/gliga/HeavenlyBody.java | 45a5da35672091ad3b87f31c07c15e24c02213cf | [] | no_license | gliga02/learning-java | f962ed9d17d0fbd5f7491856559ecdc8600a3bff | 639314157f02f8349f9e98f28ff70e682d37d4bc | refs/heads/master | 2022-12-25T11:01:02.657396 | 2020-09-28T11:59:56 | 2020-09-28T11:59:56 | 299,292,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,317 | java | package com.gliga;
import java.util.HashSet;
import java.util.Set;
public final class HeavenlyBody {
private final String name;
private final double orbitalPeriod;
private final Set<HeavenlyBody> satellites;
public HeavenlyBody(String name, double orbitalPeriod) {
this.name = name;
this.orbitalPeriod = orbitalPeriod;
this.satellites = new HashSet<>();
}
public String getName() {
return name;
}
public double getOrbitalPeriod() {
return orbitalPeriod;
}
public boolean addMoon(HeavenlyBody moon) {
return this.satellites.add(moon);
}
public Set<HeavenlyBody> getSatellites() {
return new HashSet<>(this.satellites);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
System.out.println("o.getClass() is " + o.getClass());
System.out.println("this.getClass() is " + this.getClass());
if (o == null || o.getClass() != this.getClass()) {
return false;
}
String oName = ((HeavenlyBody)o).getName();
return this.name.equals(oName);
}
@Override
public int hashCode() {
System.out.println("hashcode called");
return this.name.hashCode() + 57;
}
}
| [
"[email protected]"
] | |
c0ea51a0a58a7da84f4c4532576e07d439898e8a | c442e7a7b53eba1835820b4dbe6cab1361eb6a20 | /src/main/java/com/cqshop/service/ParameterService.java | ed20cce4988089e5aabf9aefd1effd99d3e39ab7 | [] | no_license | gbagony-zyxy/cqshop | 99cca0e823047bbf3a17218cb126973bccd4ff03 | 4d746c70d0ba15467bb3f2faf9a0f1ae57a05fa7 | refs/heads/master | 2021-01-12T11:56:12.100259 | 2016-09-22T11:39:27 | 2016-09-22T11:39:27 | 68,842,768 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | /*
*
*
*
*/
package com.cqshop.service;
import com.cqshop.entity.Parameter;
/**
* Service - 参数
*
*
*
*/
public interface ParameterService extends BaseService<Parameter, Long> {
} | [
"[email protected]"
] | |
d5382ec51fba833c6883c6ed0c3cafb31ea82611 | 1d1c930005835cceb15e02bf6afdff7bf336a2b1 | /Codebase/SourceCode/HRIntegration/src/main/java/sdo/commonj/Type.java | 81bea6360e0e68c9c785728dd3ee426a86efb03f | [] | no_license | schandraninv/HCM-TaleoIntegration | 7d0eac2f10cb85e3e8942441a34e66149782a0b4 | b2b1c54cdbd7a9bb5a873c68e7fad75a40eaef2c | refs/heads/master | 2021-06-16T15:48:33.366609 | 2017-05-11T13:31:54 | 2017-05-11T13:31:54 | 82,793,572 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,431 | java |
package sdo.commonj;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
/**
* <p>Java class for Type complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Type">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="baseType" type="{commonj.sdo}URI" maxOccurs="unbounded" minOccurs="0"/>
* <element name="property" type="{commonj.sdo}Property" maxOccurs="unbounded" minOccurs="0"/>
* <element name="aliasName" type="{commonj.sdo}String" maxOccurs="unbounded" minOccurs="0"/>
* <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}ID" />
* <attribute name="uri" type="{commonj.sdo}URI" />
* <attribute name="dataType" type="{commonj.sdo}Boolean" />
* <attribute name="open" type="{commonj.sdo}Boolean" />
* <attribute name="sequenced" type="{commonj.sdo}Boolean" />
* <attribute name="abstract" type="{commonj.sdo}Boolean" />
* <anyAttribute processContents='lax'/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Type", propOrder = {
"baseType",
"property",
"aliasName",
"any"
})
public class Type {
@XmlSchemaType(name = "anyURI")
protected List<String> baseType;
protected List<Property> property;
protected List<String> aliasName;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute(name = "name")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String name;
@XmlAttribute(name = "uri")
protected String uri;
@XmlAttribute(name = "dataType")
protected Boolean dataType;
@XmlAttribute(name = "open")
protected Boolean open;
@XmlAttribute(name = "sequenced")
protected Boolean sequenced;
@XmlAttribute(name = "abstract")
protected Boolean _abstract;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the baseType property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the baseType property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getBaseType().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getBaseType() {
if (baseType == null) {
baseType = new ArrayList<String>();
}
return this.baseType;
}
/**
* Gets the value of the property property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the property property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getProperty().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Property }
*
*
*/
public List<Property> getProperty() {
if (property == null) {
property = new ArrayList<Property>();
}
return this.property;
}
/**
* Gets the value of the aliasName property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the aliasName property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAliasName().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getAliasName() {
if (aliasName == null) {
aliasName = new ArrayList<String>();
}
return this.aliasName;
}
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Element }
* {@link Object }
*
*
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the uri property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUri() {
return uri;
}
/**
* Sets the value of the uri property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUri(String value) {
this.uri = value;
}
/**
* Gets the value of the dataType property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isDataType() {
return dataType;
}
/**
* Sets the value of the dataType property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setDataType(Boolean value) {
this.dataType = value;
}
/**
* Gets the value of the open property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isOpen() {
return open;
}
/**
* Sets the value of the open property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setOpen(Boolean value) {
this.open = value;
}
/**
* Gets the value of the sequenced property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isSequenced() {
return sequenced;
}
/**
* Sets the value of the sequenced property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setSequenced(Boolean value) {
this.sequenced = value;
}
/**
* Gets the value of the abstract property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isAbstract() {
return _abstract;
}
/**
* Sets the value of the abstract property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setAbstract(Boolean value) {
this._abstract = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}
| [
"[email protected]"
] | |
9a5cbc3143e176a3274d394817dbe0b6063e88f0 | a7203451d2082cb0caa85361c32009440267de3c | /Crawler/src/edu/upenn/cis455/client/HttpException.java | d23da17e05420d4a475efa4113263c356dd8c1e4 | [] | no_license | p4nd3mic/MiniGoogle | 4f74270dea5c2b1ebb0f5e41f06b0e1b43c59a04 | b9c423574931085b6531056b9ab7cf924d718d3a | refs/heads/master | 2016-09-16T04:30:26.431088 | 2015-09-16T21:17:48 | 2015-09-16T21:17:48 | 29,609,924 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 623 | java | package edu.upenn.cis455.client;
/**
* Exception when something wrong with socket conneciton
* @author Ziyi Yang
*
*/
public class HttpException extends Exception {
/**
*
*/
private static final long serialVersionUID = -6528627404400412094L;
public HttpException() {
super();
}
public HttpException(String message) {
super(message);
}
public HttpException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
public HttpException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
}
| [
"cis455@vm.(none)"
] | cis455@vm.(none) |
bc62eb5966fbe493cf46cbb994521cdc2639bb07 | 96fcd5f4d1eae28d596959b29ff2bc076e1c40d7 | /CSJE_Sprouts/src/com/CSJE/Sprouts/IsoCheckerTest.java | caedc160ba1197a56b8abae05ccf3eca2382df8b | [] | no_license | Jsedwards505/sproutgame | 7d8186efe4082ad8dde7cd8348de16f5cd0d78cb | fe8001dfe259ff30a91e087ae55efdba1ec09789 | refs/heads/master | 2020-06-02T21:04:43.526835 | 2013-12-09T09:24:32 | 2013-12-09T09:24:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 853 | java | package com.CSJE.Sprouts;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class IsoCheckerTest {
String pos1 = "1,2,3,4;5;7/8,9,5,6;4,2;10,11,8/7";
String pos2 = "7/10,11,8;9,8,5,6;2,4/7;5;1,2,3,4"; //iso to 1
String pos3 = "7/10,11,8;9,8,5,6;2,4/7;5;3,2,1,4"; //iso to 1
String pos4 = "7/10,11,8;9,8,5,6;2,4/7;5;3,2,1,7"; //non-iso
String pos5 = "1,4;2/3";
String pos6 = "1,4;3/2";
@Before
public void setUp() throws Exception {
}
@Test
public void test() {
assertTrue(IsoChecker.check(pos1, pos1));
assertTrue(IsoChecker.check(pos1, pos2));
assertTrue(IsoChecker.check(pos1, pos3));
assertTrue(IsoChecker.check(pos3, pos2));
assertFalse(IsoChecker.check(pos1, pos4));
assertTrue(IsoChecker.check(pos5, pos6));
}
} | [
"[email protected]"
] | |
0cb950818976f4b9d87d614ec9fbecb68c3f0d40 | f3aed80cc181ad0edd9038afff50974a6455ca6c | /src/main/java/com/eve/service/impl/UserServiceImpl.java | 297a13979bd0c0154f1f586603e3e6bef47e4298 | [] | no_license | hanneys/my-vx-program | 17df1e384a3024ba368d7870d7b556b20d8e82ef | 9d63a6b464ee024f69729905f3525fc54e5663e8 | refs/heads/master | 2023-05-26T15:34:19.241150 | 2023-05-25T07:15:24 | 2023-05-25T07:15:24 | 362,657,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.eve.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.eve.entity.User;
import com.eve.mapper.UserMapper;
import com.eve.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author hanaijun
* @since 2021-04-27
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
@Override
public User getUserByPhone(String phone){
LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(User::getPhone,phone);
return getOne(lambdaQueryWrapper);
}
}
| [
"[email protected]"
] | |
6d6ee7328fa66284bb693c28c8cb29b95b6b54aa | 4bfb2467e61c5b4491dbef3d50c33cc59e7a2026 | /src/project/MailAuth.java | 4ef06ca02ddd19103c3addfeedb12f2a6225a2b6 | [] | no_license | leedongab/sf_mvc1 | 5249d25ebe283aee1a285f9ed5016f3fb944f62d | 909c8c5472a3394e641c419a5d4cb876192b8034 | refs/heads/master | 2022-07-28T20:06:50.914530 | 2020-05-13T02:06:37 | 2020-05-13T02:06:37 | 262,507,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package project;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
public class MailAuth extends Authenticator{
PasswordAuthentication pa;
public MailAuth() {
String mail_id = "[email protected]";
String mail_pw = "!y6593947";
pa = new PasswordAuthentication(mail_id, mail_pw);
}
public PasswordAuthentication getPasswordAuthentication() {
return pa;
}
}
| [
"[email protected]"
] | |
14af266ff269037a2c50e228ecceaded92391bed | 9e5598c804eafa621fe436afa861816787b48c09 | /Ilab/src/com/ilab/test/Application_Test.java | ec5c966ec9ed4a1d64b022fffb84c4201894a0cf | [] | no_license | DakaloDakz/Ilab | 48c0d3118bf8ad7572661009ad6a0e1b915d6378 | f0d21b7b5017236c6218a107195ed488e23d09aa | refs/heads/master | 2021-01-02T16:25:54.679605 | 2020-02-11T07:38:44 | 2020-02-11T07:38:44 | 239,701,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | package com.ilab.test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import com.ilab.base.WebDriverControl;
import com.ilab.testcase.Application;
@Listeners(WebDriverControl.class)
public class Application_Test {
protected WebDriver driver;
private Application application;
@BeforeClass(alwaysRun = true)
public void setUp() {
RemoteWebDriver driver = WebDriverControl.getDriver();
application = PageFactory.initElements(driver, Application.class);
}
//Verify Application page
@SuppressWarnings("static-access")
@Test(groups = "HomePage")
public void verifyApplicationPage() throws InterruptedException {
application.ClickApplyOnLine();
application.EnterName("Dakalo");
application.EnterEmail("[email protected]");
application.EnterPhone("083 568 7859");
application.ClickSendApplication();
Assert.assertEquals("You need to upload at least one file.", "You need to upload at least one file.");
}
} | [
"[email protected]"
] | |
2a0281926d29659590acbb31a4d781801fcd4899 | 3a996860fff9e103ea86aea445a30419c496a424 | /array.java | 7f2b84874f47af385f1b9cae102193013c440a74 | [] | no_license | ashish229/javacode | 5e64a89432fd11a91aa11ca73968580c601a276f | 0c44b891749dc2f523ed46c6b58792f1347d3420 | refs/heads/main | 2022-12-27T15:54:28.512035 | 2020-10-08T16:13:54 | 2020-10-08T16:13:54 | 300,872,782 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | public class Main
{
public static void main(String[] args)
{
int []arr={90,80,70,60,75};
for (int element: arr)
{
System.out.println(element);
}
}
}
| [
"[email protected]"
] | |
7c58da4fde131a989644dabaa24518f5c3af71df | 2f766f9200e0293da0c8ec872894c00cc791bdad | /java/simpleTest/src/main/java/com/xubao/test/simpleTest/java8Test/ITest.java | 599bb43ac387d2b92b745b2f14d682cc36d99db2 | [] | no_license | vvxubaovv/MyTest | 86f9a38057f5bd5609c95c497d8dee0506cfe7cb | 5d21888db1378103dcf589bacf1baca9a89e0974 | refs/heads/master | 2022-12-20T04:25:28.469063 | 2019-09-23T13:07:12 | 2019-09-23T13:07:12 | 125,979,707 | 0 | 0 | null | 2022-12-16T12:00:27 | 2018-03-20T07:46:53 | Java | UTF-8 | Java | false | false | 231 | java | package com.xubao.test.simpleTest.java8Test;
/**
* @author xubao
* @version 1.0
* @since 2018/11/16
*/
@FunctionalInterface//标识的接口只能有一个抽象方法
public interface ITest
{
void test(int a);
}
| [
"[email protected]"
] | |
8895afe3a0f2799cbd6412a6e094b7b921cb09bc | 6b23af68deb8a803cf289c5674033681a266d9bb | /src/main/java/se/kth/service/rest/ApplicationConfig.java | d8119a7f2b24e328dff16be79f1d9e6434be9251 | [] | no_license | amor3/IV1201 | bf7015b65491f9c7311cfa7af333720993ea13e6 | 752bde2555118f8408ee3f39b2c3ec9b272aaae2 | refs/heads/master | 2021-01-21T01:46:44.382412 | 2015-03-16T12:36:13 | 2015-03-16T12:36:13 | 30,202,581 | 0 | 0 | null | 2015-03-16T12:36:13 | 2015-02-02T18:54:49 | JavaScript | UTF-8 | Java | false | false | 782 | java | package se.kth.service.rest;
import java.util.Set;
import javax.ws.rs.core.Application;
/**
*
* @author AMore
*/
@javax.ws.rs.ApplicationPath("webresources")
public class ApplicationConfig extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<>();
addRestResourceClasses(resources);
return resources;
}
/**
* Do not modify addRestResourceClasses() method.
* It is automatically populated with
* all resources defined in the project.
* If required, comment out calling this method in getClasses().
*/
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(se.kth.service.rest.ApplicantResource.class);
}
}
| [
"[email protected]"
] | |
b6881d9d1862093ede840b0331bf672dbf86face | 5536bee6de6e43523a067a8c264cf71ff17cf1af | /Java/Java Method Overriding/Solution.java | 73f2c8b11edd976e987c991909da7996152b355a | [] | no_license | namonak/HackerRank | 6874955651f2a89c1dbcdf4de95221be77468ca8 | 54a2b9b3ddbe785e15128dd6ab611efd701dccd6 | refs/heads/master | 2022-03-15T19:09:11.479010 | 2022-02-21T14:28:35 | 2022-02-21T14:28:35 | 198,845,554 | 0 | 1 | null | 2021-05-09T13:49:02 | 2019-07-25T14:20:55 | C | UTF-8 | Java | false | false | 817 | java | import java.util.*;
class Sports{
String getName() {
return "Generic Sports";
}
void getNumberOfTeamMembers() {
System.out.println("Each team has n players in " + getName());
}
}
class Soccer extends Sports{
@Override
String getName() {
return "Soccer Class";
}
// Write your overridden getNumberOfTeamMembers method here
@Override
void getNumberOfTeamMembers() {
System.out.println("Each team has 11 players in " + getName());
}
}
public class Solution{
public static void main(String []args) {
Sports c1 = new Sports();
Soccer c2 = new Soccer();
System.out.println(c1.getName());
c1.getNumberOfTeamMembers();
System.out.println(c2.getName());
c2.getNumberOfTeamMembers();
}
}
| [
"[email protected]"
] | |
58dcbc70cbf9262a5f60ddef8de1f94c8b6bf415 | 7c310076e7b951a00e6eed93b33aba4d3ac3ad36 | /Lektion 6/DialPadApplication/src/com/kindborg/mattias/dialpadapplication/ExternalStorage.java | 04c0ba9b34a3b78f6f846a2a8383d9d88f810190 | [] | no_license | FantasticFiasco/course-applikationsutveckling-for-android | 693bdd1aefa0b6414ce7d102fffc9b26092c970f | 13f725dcff5b175ff7acbca386ca23a4bcc5f728 | refs/heads/master | 2021-01-10T17:15:38.074685 | 2016-03-03T22:45:54 | 2016-03-03T22:45:54 | 53,089,111 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,202 | java | package com.kindborg.mattias.dialpadapplication;
import java.io.*;
import java.util.*;
import android.os.*;
/**
* Class responsible for handling the external storage.
*/
public class ExternalStorage {
/**
* Gets a value indicating whether external storage is in a readable state.
*/
public static boolean isExternalStorageReadable() {
String state = Environment.getExternalStorageState();
return state.equals(Environment.MEDIA_MOUNTED) ||
state.equals(Environment.MEDIA_MOUNTED_READ_ONLY);
}
/**
* Gets a value indicating whether external storage is in a writable state.
*/
public static boolean isExternalStorageWritable() {
String state = Environment.getExternalStorageState();
return state.equals(Environment.MEDIA_MOUNTED);
}
/**
* Gets a value indicating whether file represented by specified file name
* exists.
*/
public static boolean fileExists(String fileName) {
File file = new File(fileName);
return file.exists() && file.isFile();
}
/**
* Gets a value indicating whether directory represented by directory name
* exists.
*/
public static boolean directoryExists(String directoryName) {
File file = new File(directoryName);
return file.exists() && file.isDirectory();
}
/**
* Ensures that specified directory exists.
*/
public static void ensureDirectoryExists(String path) {
new File(path).mkdirs();
}
/**
* Gets the directories in specified path.
*/
public static String[] getDirectories(String path) {
List<String> directoryList = new ArrayList<String>();
File pathFile = new File(path);
if (pathFile.exists()) {
for (File file : pathFile.listFiles()) {
if (file.isDirectory()) {
directoryList.add(file.getAbsolutePath());
}
}
}
String[] directories = new String[directoryList.size()];
return directoryList.toArray(directories);
}
/**
* Gets the names of specified directories.
*/
public static String[] getDirectoryNames(String[] directoryPaths) {
List<String> directoryNameList = new ArrayList<String>();
for (String directoryPath : directoryPaths) {
directoryNameList.add(new File(directoryPath).getName());
}
String[] directoryNames = new String[directoryNameList.size()];
return directoryNameList.toArray(directoryNames);
}
/**
* Create a path pointing to specified path on the external storage.
*/
public static String createPath(String path) {
File file = new File(
Environment.getExternalStorageDirectory(),
path);
return file.getAbsolutePath();
}
/**
* Combines specified directory name with specified file name.
*/
public static String combine(String directoryName, String fileName) {
return directoryName + File.separator + fileName;
}
} | [
"[email protected]"
] | |
4a9792fcb18c440704cb98569aa541a1376097fa | f3dc035097a90000efcce6f51d5f30a5933889ad | /src/main/java/com/yespaince/yeinio/HomeController.java | 9f974710bcaf52bdce72deb1d71683344160ff95 | [] | no_license | yespaince/yein.io | 24379f274ae1e5f8aef10559f814387f91c90c1b | bffdcc77982b4548208b169cc1257bb92f55ea1c | refs/heads/master | 2020-04-01T20:28:00.599037 | 2018-10-18T11:20:48 | 2018-10-18T11:20:48 | 153,605,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,082 | java | package com.yespaince.yeinio;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Handles requests for the application home page.
*/
@Controller
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate );
return "home";
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.