blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1bf398b3a064c35181747afdf4b475cf2e229e7c | 59bd301d9b5a0d58c97bd4f98487c1f5a86016b3 | /Day05_Object/src/com/iu/ex1_school/SchoolMain2.java | 7ee26017892f352ef23674213af2367c6262331e | [] | no_license | lbj0314/Javatest | ef24213517b0b605f8c50fbab18d56695a27bfe4 | b3a94a7e4a6cfbd6f5d065b83f2bbf8470d6be55 | refs/heads/master | 2020-07-19T20:54:27.120595 | 2019-09-30T06:52:22 | 2019-09-30T06:52:22 | 206,512,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package com.iu.ex1_school;
import java.util.Scanner;
import com.iu.ex1_school.Student;
public class SchoolMain2 {
public static void main(String[] args) {
Student stu = new Student();
// 멤버 변수 사용
// 참조변수명.멤버변수명
// 멤버 메서드 사용하는 방법
// 참조변수명.메서드명();
// 멤버 메서드를 호출한다.
stu.info();
}
}
| [
"sist@DESKTOP-687R3S6"
] | sist@DESKTOP-687R3S6 |
b0e58bc88413136298ad85bcd8930b5b1cbc95a0 | 71f91e76015f2d39a6b396747bd6f1ffacb7d2c1 | /CacheUnitProject/src/main/test/memory/CacheUnitTest.java | 8f7a7405b8ca818e11cbfbe0fc8225604385ae05 | [] | no_license | RachelRabinowitz/MMU-JAVA | 1e6f9197ea3a4bdc1034adb2535b7e1a62da1048 | 6e1adea7ec7dbdc9078a69ee65bfa13695db57d7 | refs/heads/main | 2023-07-19T16:04:13.035593 | 2021-10-03T16:04:52 | 2021-10-03T16:04:52 | 381,454,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,766 | java | package main.test.memory;
import main.java.com.hit.algorithm.MFUAlgoCacheImpl;
import main.java.com.hit.dao.DaoFileImpl;
import main.java.com.hit.dm.DataModel;
import main.java.com.hit.memory.CacheUnit;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* Asserting the correctness of cache unit and daoFile algorithms.
*/
public class CacheUnitTest {
public static DaoFileImpl daoFile;
private static DataModel dataModel;
private static DataModel dataModel2;
private static DataModel dataModel3;
private static DataModel dataModel4;
private static DataModel dataModel5;
public static CacheUnit cacheUnit;
public static MFUAlgoCacheImpl mfuOb;
@BeforeClass
public static void beforeTest() throws Exception {
daoFile = new DaoFileImpl("src/main/resources/datasource.json");
dataModel = new DataModel(5L, "hi");
dataModel2 = new DataModel(6L, "hi h");
dataModel3 = new DataModel(7L, "hi h");
dataModel4 = new DataModel(4L, "hi h");
dataModel5 = new DataModel(7L, "hih h");
mfuOb = new MFUAlgoCacheImpl(1024);
cacheUnit = new CacheUnit(mfuOb);
}
@Test
public void daoTest() throws Exception {
daoFile.save(dataModel);
daoFile.save(dataModel2);
daoFile.save(dataModel3);
daoFile.save(dataModel4);
Assert.assertEquals(dataModel3, daoFile.find(7L));
daoFile.save(dataModel5);
Assert.assertNotEquals(dataModel3, daoFile.find(7L));
Assert.assertEquals(dataModel5, daoFile.find(7L));
Assert.assertNull(daoFile.find(9L));
Assert.assertNotNull(daoFile.find(5L));
Assert.assertEquals(dataModel4, daoFile.find(4L));
Assert.assertEquals(dataModel2, daoFile.find(6L));
Assert.assertNotNull(daoFile.find(7L));
daoFile.delete(dataModel5);
Assert.assertNull(daoFile.find(7L));
daoFile.delete(dataModel3);
Assert.assertNull(daoFile.find(7L));
Assert.assertNotNull(daoFile.find(6L));
daoFile.delete(dataModel2);
Assert.assertNull(daoFile.find(6L));
}
@Test
public void cacheUnitTest() {
Long[] ids = new Long[15];
DataModel[] dataModels = new DataModel[15];
for (int i = 0; i < 15; i++) {
ids[i] = Long.valueOf(i);
dataModels[i] = new DataModel(Long.valueOf(i), i);
}
cacheUnit.putDataModels(dataModels);
Assert.assertEquals(cacheUnit.getDataModels(ids)[0], dataModels[0]);
cacheUnit.removeDataModels(ids);
Assert.assertNull(cacheUnit.getDataModels(ids)[0]);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b92debf59e219ebe1d7fefc2b2dc4a78d04b2ca1 | 15c086a39bcc075bfbcbdb814b1fe5480fd126df | /project/uiController/src/main/java/RuleManager/RM_Core/RuleSet.java | 0df36aa1f4896eb35a31651e6c961213a61dd013 | [] | no_license | youkkwon/smarthome | 78960b9fcd114a988793e787c0500058e5dc3134 | a2342761e75d6b48afb327ae515a43799b58c1e8 | refs/heads/master | 2021-01-10T01:08:40.726332 | 2015-09-04T04:46:29 | 2015-09-04T04:46:29 | 36,963,274 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,078 | java | package RuleManager.RM_Core;
import java.util.LinkedList;
import java.util.ListIterator;
import RuleManager.RM_Storage.RuleSetDBStorage;
import RuleManager.RM_Storage.RuleSetFileStorage;
import Utility.InvalidRuleException;
// Singleton
public class RuleSet {
private LinkedList<Rule> rules;
private String mode;
private String[] conditions = null;
private String[] actions = null;
private static RuleSet ruleset = new RuleSet();
private RuleSet ()
{
rules = new LinkedList<Rule>();
loadRuleSet();
}
private int countChar (String string, char ch)
{
int count = 0;
char[] array = string.toCharArray();
for (int i=0; i < array.length; i++)
if (array[i] == ch) count++;
return count;
}
private boolean loadRuleSet()
{
//ListIterator<String> raw_rules = RuleSetFileStorage.getInstance().loadRuleSet();
ListIterator<String> raw_rules = RuleSetDBStorage.getInstance().loadRuleSet();
while (raw_rules.hasNext())
{
String input = raw_rules.next();
parse_statement(input);
try {
Rule rule = new Rule(conditions, actions);
rules.add(rule);
} catch (InvalidRuleException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return false;
}
public static RuleSet getInstance()
{
return ruleset;
}
public void parse_statement (String input)
{
int idx, beginIndex, endIndex;
idx = input.indexOf("then");
String condStr = input.substring(2, idx).trim();
String actStr = input.substring(idx+4).trim();
conditions = new String[countChar(condStr, ',')+1];
actions = new String[countChar(actStr, ',')+1];
beginIndex=0;
for (int i=0; i < conditions.length; i++)
{
endIndex = condStr.indexOf(',', beginIndex);
if (endIndex == -1)
endIndex = condStr.length();
conditions[i] = condStr.substring(beginIndex, endIndex).trim();
beginIndex = endIndex+1;
}
beginIndex=0;
for (int i=0; i < actions.length; i++)
{
endIndex = actStr.indexOf(',', beginIndex);
if (endIndex == -1)
endIndex = actStr.length();
actions[i] = actStr.substring(beginIndex, endIndex).trim();
beginIndex = endIndex+1;
}
}
public void addRule (String input)
{
parse_statement(input);
addRule (conditions, actions);
}
public void deleteRule (String statement)
{
parse_statement(statement);
deleteRule (conditions, actions);
}
private void addRule (String[] condStr, String[] actStr)
{
boolean exist = false;
ListIterator<Rule> iterator = rules.listIterator();
try {
while (iterator.hasNext())
{
Rule rule = iterator.next();
if (rule.isSameCondition(condStr))
{
rule.addActions(actStr);
exist = true;
break;
}
}
if (!exist)
{
Rule rule = new Rule(condStr, actStr);
rules.add(rule);
//RuleSetFileStorage.getInstance().storeRuleSet(rules);
RuleSetDBStorage.getInstance().storeRuleSet(rules);
}
} catch (InvalidRuleException e) {
System.out.println(e.getExceptionMsg());
}
}
private boolean deleteRule (String[] condStr, String[] actStr)
{
boolean delete = false;
ListIterator<Rule> iterator = rules.listIterator();
try {
while (iterator.hasNext())
{
Rule rule = iterator.next();
if (rule.isSameRule(condStr, actStr))
{
rules.remove(rule);
delete = true;
break;
}
else if (rule.isSameCondition(condStr))
{
rule.deleteActions(actStr);
delete = true;
break;
}
}
} catch (InvalidRuleException e) {
System.out.println(e.getExceptionMsg());
}
if (delete) {
//RuleSetFileStorage.getInstance().storeRuleSet(rules);
RuleSetDBStorage.getInstance().storeRuleSet(rules);
}
else
System.out.println ("[RM - Process] There is no such a rule");
return delete;
}
// return rules on specific node.
public LinkedList<Rule> searchRules (String node)
{
LinkedList<Rule> searchRule = new LinkedList<Rule>();
ListIterator<Rule> iterator = rules.listIterator();
while (iterator.hasNext())
{
Rule rule = iterator.next();
if (rule.isRuleOn(node))
searchRule.add(rule);
}
return searchRule;
}
public LinkedList<Rule> getWholeRule ()
{
return rules;
}
public void setMode (String mode) throws InvalidRuleException
{
// TODO - hard card value
this.mode = "*@10==" + mode.trim() + "#Alarm";
activeRulesBasedOnMode(this.mode);
if (mode.equalsIgnoreCase("UnSet"))
Scheduler.getInstance().cancelStateAction();
}
public String getMode ()
{
return mode;
}
public LinkedList<Action> getActions (String condition)
{
ListIterator<Rule> iterator = rules.listIterator();
while (iterator.hasNext())
{
LinkedList<Action> actions = iterator.next().getActions(condition);
// find actions on condition.
if (actions != null && !actions.isEmpty())
return actions;
}
return null;
}
public void activeRules (String condition)
{
ListIterator<Rule> iterator = rules.listIterator();
while (iterator.hasNext())
{
iterator.next().activateRule(condition);;
}
}
public void deactivateRules (String condition)
{
ListIterator<Rule> iterator = rules.listIterator();
while (iterator.hasNext())
{
iterator.next().deactiveRule(condition);;
}
}
private void activeRulesBasedOnMode (String mode) throws InvalidRuleException
{
ListIterator<Rule> iterator = rules.listIterator();
while (iterator.hasNext())
{
iterator.next().activeRuleBasedOnMode(mode);
}
}
public boolean isAllow (Action action) throws InvalidRuleException
{
ListIterator<Rule> iterator = rules.listIterator();
while (iterator.hasNext())
{
LinkedList<Action> actions = iterator.next().getNoActions(mode);
// find actions on condition.
if (actions != null && !actions.isEmpty())
{
ListIterator<Action> act_iterator = actions.listIterator();
while (act_iterator.hasNext())
{
if (act_iterator.next().equals(action))
return false;
}
}
}
return true;
}
}
| [
"sweatguy@hanmail.net"
] | sweatguy@hanmail.net |
6c5f3729a3ba57081cfef381a1f42db4bf72fe8e | a6edb1ab1730b8f187ed09d45748cb1b72de2d09 | /src/main/java/com/jwtauth/model/Authority.java | d49b2f1324d3f2a2fc8093c4d534aea9f88b825b | [] | no_license | aniov/JWT-Spring-Auth | 02ab7332686145975b13fa31364150667e2a7de3 | 6941fd0fe0e12c3f99295ec60bf3cadd2f6c331d | refs/heads/master | 2021-04-18T23:06:38.059886 | 2017-06-22T18:15:18 | 2017-06-22T18:15:18 | 94,590,270 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,046 | java | package com.jwtauth.model;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
/**
* Created by Marius on 6/12/2017.
*/
@Entity
public class Authority implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonIgnore
private Long id;
@Enumerated(EnumType.STRING)
private AuthorityType authorityType;
@ManyToMany(mappedBy = "authorities", fetch = FetchType.LAZY)
@JsonBackReference
private List<User> users;
public Authority() {
}
public Long getId() {
return id;
}
public AuthorityType getAuthorityType() {
return authorityType;
}
public void setAuthorityType(AuthorityType authorityType) {
this.authorityType = authorityType;
}
public List<User> getUsers() {
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
}
| [
"aniov@yahoo.com"
] | aniov@yahoo.com |
f5ee6d97e0101bc161ae9b570f0e4beb4f165d16 | 4368ae31f7b037fe02d6c6ec1b65f38326154a56 | /src/main/java/com/example/controller/User_konto_RestController.java | 546e7b6806875663c38163a5b3835306d604cdc4 | [] | no_license | erdwys/ProjektProgramowanieObiektowe | 573cb25bffc8b83ce345fccb59e46982e809df69 | 693ffce17f2777b362ef34f7068cf93d269cff5c | refs/heads/heroku | 2021-07-13T13:13:16.760951 | 2018-11-27T21:29:01 | 2018-11-27T21:29:01 | 114,386,948 | 0 | 4 | null | 2018-05-30T17:53:06 | 2017-12-15T15:52:15 | Java | UTF-8 | Java | false | false | 2,852 | java | package com.example.controller;
import com.example.model.Dostep;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.example.model.Dzialkowicz;
import com.example.model.OdczytLicznika;
import com.example.model.imp.ImplDostep;
import com.example.model.imp.ImplDzialkowicz;
import com.example.model.imp.ImplOdczytLicznika;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.example.service.User_konto_Service;
import java.util.ArrayList;
import java.util.Objects;
import org.springframework.security.core.Authentication;
@RestController
public class User_konto_RestController {
@Autowired
private User_konto_Service user_konto_Service;
Dzialkowicz dzialkowiczLog = new Dzialkowicz();
@RequestMapping(path = "/user_konto/get", method = RequestMethod.GET)
public Iterable<Dostep> getDzialkowiczById(HttpServletRequest arg0, HttpServletResponse arg1,
Authentication authentication){
Dostep dostep = new Dostep();
ImplDostep impdostep = new ImplDostep();
dostep= impdostep.getByLogin(authentication.getName());
ImplDzialkowicz impldzialkowicz = new ImplDzialkowicz();
dzialkowiczLog = impldzialkowicz.getById(dostep.getNrDzialkowicza());
List<Dostep> listaAll = new ArrayList<>();
ImplDostep implDostep = new ImplDostep();
listaAll = implDostep.getAll();
List<Dostep> lista = new ArrayList<>();
for (Dostep item : listaAll) {
if (Objects.equals(item.getNrDzialkowicza(), dzialkowiczLog.getNrDzialkowicza())) {
lista.add(item);
}
}
return user_konto_Service.getUser_kontoDzialkowicz(lista);
}
@RequestMapping(value = "/user_konto/update",method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Dostep update(@RequestBody Dostep dostep, HttpServletRequest arg0, HttpServletResponse arg1,
Authentication authentication){
Dostep dostepLog = new Dostep();
ImplDostep impdostep = new ImplDostep();
dostepLog= impdostep.getByLogin(authentication.getName());
dostep.setNrDzialkowicza(dostepLog.getNrDzialkowicza());
return user_konto_Service.saveUser_konto(dostep);
}
}
| [
"filerd002@utp.edu.pl"
] | filerd002@utp.edu.pl |
a198583e1c3a50be0e09accaa88e312c9d1a9aaf | 5ce16717993f017e138d5e3196b9e6e8c70f951a | /PhysicsCalculator.java | 5e4b537dcf8a8db8a97c5a44c1b37085b73e2d72 | [] | no_license | shaashwat/Physics | 8a812c3a0bc6041fc454e7b39dc6061de15118e2 | 1d331ca119d1c415f8166b750af462d8c67b43ed | refs/heads/master | 2021-01-12T17:06:37.502696 | 2016-10-20T22:56:03 | 2016-10-20T22:56:03 | 71,510,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,398 | java | import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class PhysicsCalculator extends JFrame
{
private static final int WIDTH = 400;
private static final int HEIGHT = 300;
private JLabel velocityInitialL, deltaTimeL, accelerationL, velocityL;
private JTextField velocityInitialT, deltaTimeT, accelerationT, velocityT;
private JButton calculateB, exitB;
private CalculateButtonHandler cbHandler;
private ExitButtonHandler ebHandler;
public PhysicsCalculator()
{
velocityInitialL = new JLabel("Enter the initial velocity: ", SwingConstants.RIGHT);
deltaTimeL = new JLabel("Enter the time: ", SwingConstants.RIGHT);
accelerationL = new JLabel("Enter the acceleration: ", SwingConstants.RIGHT);
velocityL = new JLabel("The velocity is: ", SwingConstants.RIGHT);
velocityInitialT = new JTextField(10);
deltaTimeT = new JTextField(10);
accelerationT = new JTextField(10);
velocityT = new JTextField(10);
calculateB = new JButton("Calculate");
cbHandler = new CalculateButtonHandler();
calculateB.addActionListener(cbHandler);
exitB = new JButton("Exit");
ebHandler = new ExitButtonHandler();
exitB.addActionListener(ebHandler);
setTitle("Physics Calculator");
Container pane = getContentPane();
pane.setLayout(new GridLayout(5, 2));
//left to right, top to bottom on grid
pane.add(velocityInitialL);
pane.add(velocityInitialT);
pane.add(deltaTimeL);
pane.add(deltaTimeT);
pane.add(accelerationL);
pane.add(accelerationT);
pane.add(velocityL);
pane.add(velocityT);
pane.add(calculateB);
pane.add(exitB);
setSize(WIDTH, HEIGHT);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
private class CalculateButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
double initialvelocity, time, acceleration, velocity;
initialvelocity = Double.parseDouble(velocityInitialT.getText());
time = Double.parseDouble(deltaTimeT.getText());
acceleration = Double.parseDouble(accelerationT.getText());
velocity = initialvelocity+(time * acceleration);
velocityT.setText("" + velocity);
}
}
public class ExitButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
}
public static void main(String[] args)
{
PhysicsCalculator physcalc = new PhysicsCalculator();
}
} | [
"shaash317@gmail.com"
] | shaash317@gmail.com |
6aac95b6fe9d56baf7a20d6a07d956861db08ace | 2dcc618fc3fd06dc835ca27529c33d59b78f5be4 | /2796/EnglishChars.java | 82ffc38d4423f65e7f835e25ee92fe24a77058c1 | [] | no_license | chandru4664/Solutions | e1ee1cb639ae90297616a71bf3924dafdd15651e | 1292dc8602f5adac4bacd9938bc12f06cb9d55b1 | refs/heads/master | 2020-03-14T07:14:04.879297 | 2018-04-20T21:01:26 | 2018-04-20T21:01:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package com.htc.corejava.training;
/**
* @author Milind
*
*/
public class EnglishChars {
public static void main(String args[]) {
char ch;
for (ch = 'a'; ch <= 'z'; ch++)
System.out.println(ch);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e435c6b69a36037654ba5675fbc0d2305554f59a | ee785399265ea37c63482987eebbf98768dbc146 | /gshackchallenge-android/app/src/main/java/io/programming4food/poh/models/Review.java | 638a433cea397435b217598d2da625574b00c7f0 | [] | no_license | ProgramoxComida/gshackchallenge | 63692c4ab96bee189e46e0bd0e8a036b5a1b2dc2 | 69d94558a1df1cd28734be0d307a5eefedf12aa2 | refs/heads/master | 2020-07-10T06:03:32.345210 | 2019-08-25T17:16:00 | 2019-08-25T17:16:00 | 204,185,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package io.programming4food.poh.models;
import java.io.Serializable;
public class Review implements Serializable {
String id;
Integer produc_id;
String comment;
Float rating;
}
/*"id": "RVW-0000004",
"client_id": "1",
"product_id": 11,
"comment": "Bonita antena",
"rating": 4.5
*/
| [
"chema@iterando.mx"
] | chema@iterando.mx |
823cfaa5aa5a6d354319f5180dbba6d654477fff | 8496449f5f0f633fc4b1f3ae6c6770c99218fa42 | /CS342Garbage/BaccaratProject 2/src/main/java/BaccaratGame.java | fe14bb31a55ff9620e886522081c149ed0f2b7fb | [] | no_license | jsanchez78/moreCS342 | eb4696076b5ef98a2a2a66df748db5907d1e858e | e953f4595b59fb6ad553e46bb912f2b18c95ec2c | refs/heads/master | 2020-12-04T09:25:45.797399 | 2020-01-04T04:49:10 | 2020-01-04T04:49:10 | 231,710,026 | 0 | 0 | null | 2020-08-31T23:48:01 | 2020-01-04T04:48:28 | JavaScript | UTF-8 | Java | false | false | 8,275 | java | import javafx.animation.PauseTransition;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.MenuBar;
import javafx.scene.control.TextField;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import javafx.util.Duration;
import javax.swing.text.Element;
import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Observable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.function.Function;
import javafx.animation.PauseTransition;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.util.Duration;
import javafx.scene.shape.SVGPath;
///sceneChangeBtn --> resetBtn
//addToListBtn ----> dealBtn
public class BaccaratGame extends Application{
//Initialize variables accordingly
TextField text;
Button start;
Button twoPlayer, threePlayer, fourPlayer;
Button Exit;
Button back;
Button bid2, bid3, bid4, smudge, pass;
Button card1, card2, card3, card4, card5, card6, card7,card8,card9;
HashMap<String, Scene> sceneMap;
Stage myStage;
Scene scene, scene2;
HBox player1 = new HBox();
VBox player2 = new VBox();
HBox player3 = new HBox();
VBox player4 = new VBox();
HBox playedCards = new HBox();
BorderPane pane2 = new BorderPane();
//BackgroundFill grayBG = new BackgroundFill(Color.GRAY,new CornerRadii(1),new Insets(0.0,0.0,0.0,0.0));
//BackgroundFill darkGrayBG = new BackgroundFill(Color.GREEN, new CornerRadii(1), new Insets(0.0, 0.0, 0.0, 0.0));
ImageView card = new ImageView();
Image img = new Image("/images/donpark-scalable-css-playing-cards-d05a022/assets/club.svg");
ImageView v = new ImageView(img);
ImageView w = new ImageView(img);
ImageView x = new ImageView(img);
Button reset = new Button();
BorderPane pane = new BorderPane();
HBox paneCenter = new HBox();
HBox displayName = new HBox();
TextField displayP1Bid = new TextField();
TextField displayP2Bid = new TextField();
TextField displayP3Bid = new TextField();
TextField displayP4Bid = new TextField();
VBox bidss = new VBox();
HBox cards2 = new HBox();
VBox bidd = new VBox();
VBox options = new VBox();
boolean resetpressed = false;
//constant values java style
static final int picHeight = 275;
static final int picWidth = 250;
EventHandler<ActionEvent> returnButtons;
PauseTransition pause = new PauseTransition(Duration.seconds(3));
Button addToListBtn, resetBtn, b4,b5,b6,b7, dealBtn;
GenericQueue<String> myQueue;
ListView<String> displayQueueItems;
//use this to add and delete from ListView
ObservableList<String> storeQueueItemsInListView;
public static void main(String[] args) {
// TODO Auto-generated method stub
launch(args);
}
//feel free to remove the starter code from this method
@Override
public void start(Stage primaryStage) throws Exception {
// TODO Auto-generated method stub
primaryStage.setTitle("JavaFx Scene change and ListView");
text = new TextField();
dealBtn = new Button("Deal");
resetBtn = new Button("Reset");
//dealBtn = new Button("PrintList");
sceneMap = new HashMap<String,Scene>();
//stores strings: from your project #1
myQueue = new GenericQueue<String>(" ");
displayQueueItems = new ListView<String>();
//initialize to an observable list
storeQueueItemsInListView = FXCollections.observableArrayList();
//styling CSS way
text.setStyle("-fx-font-size: 18;"+"-fx-border-size: 20;"+
"-fx-border-color: green;");
displayQueueItems.setStyle("-fx-font-size: 25;"+"-fx-border-size: 20;"+
"-fx-border-color: green;");
//using lambda for EventHandler: press enter adds info from text field to queue
text.setOnKeyPressed(e -> {if(e.getCode().equals(KeyCode.ENTER)){
myQueue.enqueue(text.getText());
text.clear();
}
});
//pause for 3 seconds then switch scene from picture buttons to original layout
pause.setOnFinished(e->primaryStage.setScene(sceneMap.get("scene")));
//this handler is used by multiple buttons
returnButtons = new EventHandler<ActionEvent>(){
public void handle(ActionEvent event){
Button b = (Button)event.getSource();
b.setDisable(true);
// primaryStage.setScene(sceneMap.get("scene"));
pause.play(); //calls setOnFinished
}
};
/*
//add queue items to observable list and display inside of ListView
dealBtn.setOnAction(e-> {displayQueueItems.getItems().removeAll(storeQueueItemsInListView);storeQueueItemsInListView.clear();
Iterator<String> i = myQueue.createIterator();
while(i.hasNext()) {
storeQueueItemsInListView.add(i.next());
}
displayQueueItems.setItems(storeQueueItemsInListView);});
*/
resetBtn.setOnAction(e -> primaryStage.setScene(sceneMap.get("pics")));
dealBtn.setOnAction(new EventHandler<ActionEvent>(){
public void handle(ActionEvent event){
myQueue.enqueue(text.getText());;
text.clear();
}
});
//two scenes returned from two methods; put in hashmap
sceneMap.put("scene", createControlScene());
sceneMap.put("pics", createPicScene());
primaryStage.setScene(sceneMap.get("scene"));
primaryStage.show();
}
//method to create our first scene with controls
public Scene createControlScene() {
BorderPane pane = new BorderPane();
pane.setPadding(new Insets(70));
VBox paneCenter = new VBox(10, text, dealBtn, displayQueueItems);
pane.setCenter(paneCenter);
pane.setLeft(resetBtn);
pane.setStyle("-fx-background-color: #6DB47A;");
dealBtn.setTranslateX(10);
dealBtn.setTranslateY(10);
resetBtn.setTranslateX(10);
resetBtn.setTranslateY(10);
return new Scene(pane, 850, 750);
}
//method to create second scene with clickable buttons
public Scene createPicScene() {
Image pic = new Image("/images/donpark-scalable-css-playing-cards-d05a022/assets/club.svg");
ImageView v = new ImageView(pic);
v.setFitHeight(picHeight);
v.setFitWidth(picWidth);
v.setPreserveRatio(true);
Image pic2 = new Image("/images/donpark-scalable-css-playing-cards-d05a022/assets/spade.svg");
ImageView v2 = new ImageView(pic2);
v2.setFitHeight(picHeight);
v2.setFitWidth(picWidth);
v2.setPreserveRatio(true);
Image pic3 = new Image("/images/donpark-scalable-css-playing-cards-d05a022/assets/diamond.svg");
ImageView v3 = new ImageView(pic3);
v3.setFitHeight(picHeight);
v3.setFitWidth(picWidth);
v3.setPreserveRatio(true);
Image pic4 = new Image("/images/donpark-scalable-css-playing-cards-d05a022/assets/heart.svg");
ImageView v4 = new ImageView(pic4);
v4.setFitHeight(picHeight);
v4.setFitWidth(picWidth);
v4.setPreserveRatio(true);
b4 = new Button();
b4.setOnAction(returnButtons);
b4.setGraphic(v);
b5 = new Button();
b5.setOnAction(returnButtons);
b5.setGraphic(v2);
b6 = new Button();
b6.setGraphic(v3);
b6.setOnAction(returnButtons);
b7 = new Button();
b7.setGraphic(v4);
b7.setOnAction(returnButtons);
HBox root = new HBox(5, b7,b5,b6,b4);
root.setStyle("-fx-background-color: #6DB47A;");
return new Scene(root, 900,800);
}
//Data Members
private ArrayList<Card> playerHand;
private ArrayList<Card> bankerHand;
private BaccaratDealer theDealer;
private BaccaratGameLogic gameLogic;
private double currentBet;
private double totalWinnings;
//Methods
public ArrayList<Card> getBankerHand(){
return this.bankerHand;
}
public void setBankerHand(Card card){
bankerHand.add(card);
}
public ArrayList<Card> getPlayerHand(){
return this.playerHand;
}
public void setPlayerHandHand(Card card){
playerHand.add(card);
}
public double evaluateWinnings(){
return 0;
}
}
| [
"sanchezjacob60@yahoo.com"
] | sanchezjacob60@yahoo.com |
c9d082c381276f63fffd0a8c7720714929b373a8 | 221860043fe105ba197074a34ae0ea9a354948d6 | /09 Computer Network/RPCStudy/RPC_07hession/src/main/java/com/huyy/rpc/hession/HelloHession.java | 185fd92686d897131b9a700716407a1d342d563e | [] | no_license | FynKatz/JavaBasic | 8632d767b4a5605697f7fb214a5ec6ba0efde7bc | 62f1f8eb85330cd3ccf60a6347adf2363b5b365f | refs/heads/master | 2023-03-20T22:29:00.135577 | 2021-03-02T13:58:38 | 2021-03-02T13:58:38 | 277,420,752 | 0 | 0 | null | 2020-07-06T02:44:26 | 2020-07-06T02:08:53 | Java | UTF-8 | Java | false | false | 1,990 | java | package com.huyy.rpc.hession;
import com.caucho.hessian.io.Hessian2Input;
import com.caucho.hessian.io.Hessian2Output;
import com.huyy.rpc.common.User;
import java.io.*;
public class HelloHession {
public static void main(String[] args) throws Exception {
User user = new User(123, "Alice");
//测试系列化后长度
System.out.println("hessianBytes length=" + hessionSerialize(user).length);//44
System.out.println("jdk length=" + jdkSerialize(user).length);//185
}
/*序列化(对象 转 字节数组)*/
public static byte[] hessionSerialize(Object o) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Hessian2Output output = new Hessian2Output(baos);//包装
output.writeObject(o);
output.flush();
byte[] bytes = baos.toByteArray();
baos.close();
output.close();
return bytes;
}
/*反序列化(字节数组 转 对象)*/
public static Object hessionDeserialize(byte[] bytes) throws IOException {
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
Hessian2Input input = new Hessian2Input(bais);
Object o = input.readObject();
bais.close();
input.close();
return o;
}
public static byte[] jdkSerialize(Object o) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream output = new ObjectOutputStream(baos);
output.writeObject(o);
output.flush();
byte[] bytes = baos.toByteArray();
baos.close();
output.close();
return bytes;
}
public static Object jdkDeserialize(byte[] bytes) throws Exception {
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStream input = new ObjectInputStream(bais);
Object o = input.readObject();
bais.close();
input.close();
return o;
}
}
| [
"easyyhu@gmail.com"
] | easyyhu@gmail.com |
7f2af4a492aa9405e46353b50ddf32e393b12dfe | 5148293c98b0a27aa223ea157441ac7fa9b5e7a3 | /Method_Scraping/xml_scraping/NicadOutputFile_t1_beam/Nicad_t1_beam3871.java | 1e736cea4e4669743d0c4b7dacd87eb590ed699c | [] | no_license | ryosuke-ku/TestCodeSeacherPlus | cfd03a2858b67a05ecf17194213b7c02c5f2caff | d002a52251f5461598c7af73925b85a05cea85c6 | refs/heads/master | 2020-05-24T01:25:27.000821 | 2019-08-17T06:23:42 | 2019-08-17T06:23:42 | 187,005,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | // clone pairs:15392:80%
// 21868:beam/sdks/java/core/src/main/java/org/apache/beam/sdk/io/range/ByteKey.java
public class Nicad_t1_beam3871
{
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ByteKey)) {
return false;
}
ByteKey other = (ByteKey) o;
return (other.value.size() == value.size()) && this.compareTo(other) == 0;
}
} | [
"naist1020@gmail.com"
] | naist1020@gmail.com |
b2b6b1eece504cef0b7f1d156ebaed92ab506beb | 418a44913e61c5f70206b5d5ce74a60d17742399 | /comp-push/src/main/java/com/bqt/push/huaweiagent/common/CallbackResultRunnable.java | 11c6d280344442a3f2cb42fd571a58842242a387 | [] | no_license | baiqiantao/PushTest | 289584399ead3f280f714404dcf0d925f52dcab5 | d0f2d0c140d6c82d1f22fe76278faedeb156783a | refs/heads/master | 2020-03-11T06:37:22.223610 | 2018-10-27T10:12:26 | 2018-10-27T10:12:26 | 129,834,745 | 18 | 2 | null | null | null | null | UTF-8 | Java | false | false | 574 | java | package com.bqt.push.huaweiagent.common;
/**
* 回调线程
*/
public class CallbackResultRunnable<R> implements Runnable {
private ICallbackResult<R> handlerInner;
private int rtnCodeInner;
private R resultInner;
public CallbackResultRunnable(ICallbackResult<R> handler, int rtnCode, R payInfo) {
handlerInner = handler;
rtnCodeInner = rtnCode;
resultInner = payInfo;
}
@Override
public void run() {
if (handlerInner != null) {
handlerInner.onResult(rtnCodeInner, resultInner);
}
}
} | [
"baiqiantao@sina.com"
] | baiqiantao@sina.com |
ca03d4ad59ebbf99c9e05a8ab41012908fe5c995 | 7af846ccf54082cd1832c282ccd3c98eae7ad69a | /ftmap/src/main/java/taxi/nicecode/com/ftmap/generated/package_4/Foo144.java | b43d09a68d9cfd7c1ec7617c9972fe96d4daddb6 | [] | no_license | Kadanza/TestModules | 821f216be53897d7255b8997b426b359ef53971f | 342b7b8930e9491251de972e45b16f85dcf91bd4 | refs/heads/master | 2020-03-25T08:13:09.316581 | 2018-08-08T10:47:25 | 2018-08-08T10:47:25 | 143,602,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package taxi.nicecode.com.ftmap.generated.package_4;
public class Foo144 {
public void foo0(){
new Foo143().foo5();
}
public void foo1(){
foo0();
}
public void foo2(){
foo1();
}
public void foo3(){
foo2();
}
public void foo4(){
foo3();
}
public void foo5(){
foo4();
}
} | [
"1"
] | 1 |
730959d42e375daa4e5d52fb1d534436da706480 | 1d751b62b8f1e01cd95d76c7c083a54878a1ebc3 | /src/edu/monash/fit/eduard/grid/operator/GradientYZevenbergenThorneOperator.java | 1cb4bb436dcca2f9869fd68df365f74925813d10 | [] | no_license | tiuspujianto/FinalProject | 6362689e7a4b6509a5d2654a34c8d5a64c3b3e66 | 668bdcc975cc9721c54e3630e2bd8bcccad34f97 | refs/heads/master | 2022-11-30T06:23:48.866266 | 2020-08-12T12:36:53 | 2020-08-12T12:36:53 | 287,009,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,429 | java | package edu.monash.fit.eduard.grid.operator;
import edu.monash.fit.eduard.grid.Grid;
import edu.monash.fit.eduard.ui.ProgressIndicator;
/**
* Gradient in vertical direction. Computes the gradient from the cells above
* and below the central cell without considering the central value. This is the
* Zevenbergen-Thorne method, which is using two neighbors.
*
* The Evans-Young method is an alternative that uses six neighbors.
*
* Reference: Zevenbergen & Thorne, 1987. Quantitative analysis of land surface
* topography. Earth Surface Processes and Landforms 12, no. 1, 47-56.
*
* @author Bernie Jenny, Monash University
*/
public final class GradientYZevenbergenThorneOperator extends ThreadedGridOperator {
public GradientYZevenbergenThorneOperator() {
}
public GradientYZevenbergenThorneOperator(ProgressIndicator progressIndicator) {
super(progressIndicator);
}
/**
* Operate on a single cell.
*
* @param src the source grid
* @param dst the destination grid
* @param col column of the cell
* @param row row of the cell
*/
@Override
protected void operateValue(Grid src, Grid dst, int col, int row) {
// Zevenbergen-Thorne method using top and bottom neighbors
dst.setValue(src.getYGradient(col, row), col, row);
}
@Override
public String getName() {
return "Y gradient (Zevenbergen-Thorne)";
}
}
| [
"43407852+tiuspujianto@users.noreply.github.com"
] | 43407852+tiuspujianto@users.noreply.github.com |
40a8a43b3711497f892f5ef48cb3b862ec3a4996 | 5985ef4d61113aa1c0082c90271ac4a5b39ea1af | /marvinmao-admin/src/main/java/io/marvinmao/modules/sys/service/impl/SysLogServiceImpl.java | aa07f4c4d91b9c18eaa8108ea9e2d20770381fa6 | [
"Apache-2.0"
] | permissive | marvinmao/marvinmao-security | 315fa857f2865d94d3066d91e87380cbbb467058 | 377a776e56093081756bc5f5bbf85c02df317aaa | refs/heads/master | 2023-03-24T22:28:10.234392 | 2021-03-24T11:44:09 | 2021-03-24T11:44:09 | 351,056,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,236 | java | /**
* Copyright (c) 2016-2019 通用开源 All rights reserved.
*
* https://www.marvinmao.io
*
* 版权所有,侵权必究!
*/
package io.marvinmao.modules.sys.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.marvinmao.common.utils.PageUtils;
import io.marvinmao.common.utils.Query;
import io.marvinmao.modules.sys.dao.SysLogDao;
import io.marvinmao.modules.sys.entity.SysLogEntity;
import io.marvinmao.modules.sys.service.SysLogService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service("sysLogService")
public class SysLogServiceImpl extends ServiceImpl<SysLogDao, SysLogEntity> implements SysLogService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
String key = (String)params.get("key");
IPage<SysLogEntity> page = this.page(
new Query<SysLogEntity>().getPage(params),
new QueryWrapper<SysLogEntity>().like(StringUtils.isNotBlank(key),"username", key)
);
return new PageUtils(page);
}
}
| [
"1512355855@qq.com"
] | 1512355855@qq.com |
962e0b93d6831450a5feed29205e6c526cc33ba6 | b29dbaef99947f4a226f187de70cbff56d8f113d | /src/lesson20200925MockedGuessNumber/InputMock.java | 11b2e26087d609375e78fd483a9d9dc9b45068cc | [] | no_license | yuliko2020/Java-Advanced | 7e0095e793a2e37f1aea1a22d8b29cf5951739cb | ea8486dba91d3ee8915396f2db1d51160de72bab | refs/heads/master | 2023-01-29T07:32:35.065408 | 2020-12-08T17:46:14 | 2020-12-08T17:46:14 | 276,668,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package lesson20200925MockedGuessNumber;
/**
* JavaAdvanced
* 25/09/2020
*/
public class InputMock implements NumberInput {
//int nextNumber;
@Override
public int getNextNumber() {
return 2;
}
}
| [
"yuliiascicluna@gmail.com"
] | yuliiascicluna@gmail.com |
c91e9a2f1ae17470437f2a4c55d5015ce2ec1032 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_279037c120fe2676211096803ebff91bf4ec598f/PerformanceTest/9_279037c120fe2676211096803ebff91bf4ec598f_PerformanceTest_s.java | 81122a80ac3ce86c47ea7727712d42a043481132 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 13,369 | java | /**
* <copyright> Copyright (c) 2008-2009 Jonas Helming, Maximilian Koegel. All rights reserved. This program and the
* accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at http://www.eclipse.org/legal/epl-v10.html </copyright>
*/
package org.eclipse.emf.emfstore.performance.test;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.emfstore.bowling.BowlingPackage;
import org.eclipse.emf.emfstore.client.ESLocalProject;
import org.eclipse.emf.emfstore.client.test.common.cases.ESTestWithLoggedInUser;
import org.eclipse.emf.emfstore.client.test.common.util.ProjectUtil;
import org.eclipse.emf.emfstore.client.util.ESVoidCallable;
import org.eclipse.emf.emfstore.client.util.RunESCommand;
import org.eclipse.emf.emfstore.internal.client.model.ESWorkspaceProviderImpl;
import org.eclipse.emf.emfstore.internal.client.model.ProjectSpace;
import org.eclipse.emf.emfstore.internal.common.model.util.ModelUtil;
import org.eclipse.emf.emfstore.internal.modelmutator.api.ModelMutator;
import org.eclipse.emf.emfstore.internal.modelmutator.api.ModelMutatorConfiguration;
import org.eclipse.emf.emfstore.internal.modelmutator.api.ModelMutatorUtil;
import org.eclipse.emf.emfstore.server.exceptions.ESException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* This TestCase tests all methods in the main {@link org.unicase.emfstore.EmfStore} interface.
*
* @author Dmitry Litvinov
*/
public class PerformanceTest extends ESTestWithLoggedInUser {
@BeforeClass
public static void beforeClass() {
startEMFStore();
}
@AfterClass
public static void afterClass() {
stopEMFStore();
}
private final static String MODEL_KEY = "http://org/eclipse/example/bowling";
private static final int NUM_ITERATIONS = 10;
private final long seed = 1234567800;
private static MemoryMeter memoryMeter;
private long lastSeed = seed + 1;
private static final double ACCEPTED_VARIANCE = 1.5;
private double memAfterThreshold;
double[] times;
long[] memBefore, memDuring, memAfter;
/**
* Start server and gain session id.
*
* @throws ESException in case of failure
* @throws IOException
*/
@Override
public void before() {
super.before();
generateModels(getProjectSpace(), 10000);
System.out.println("MODEL SIZE: " + getLocalProject().getAllModelElements().size());
initMeasurments();
}
@Override
public void after() {
super.after();
memoryMeter.finish();
}
/**
* Opens projects of different sizes, shares them with the server and then deletes them. r
*
* @see org.unicase.emfstore.EmfStore#createProject(org.eclipse.emf.emfstore.server.model.SessionId, String, String,
* org.eclipse.emf.emfstore.server.model.versioning.LogMessage, Project)
* @see org.unicase.emfstore.EmfStore#getProjectList(org.eclipse.emf.emfstore.server.model.SessionId)
* @throws ESException in case of failure.
* @throws IOException
*/
@Test
public void testShareProject() throws ESException, IOException {
initMeasurments();
for (int i = 0; i < NUM_ITERATIONS; i++) {
memoryMeter.startMeasurements();
memBefore[i] = usedMemory();
long time = System.currentTimeMillis();
ProjectUtil.share(getUsersession(), getLocalProject());
times[i] = (System.currentTimeMillis() - time) / 1000.0;
memAfter[i] = usedMemory();
memDuring[i] = memoryMeter.stopMeasurements();
ModelUtil.logInfo("share project - iteration #" + (i + 1) + ": time=" + times[i] + ", memory used before: "
+ memBefore[i] / 1024 / 1024 + "MB, during: " + memDuring[i] / 1024 / 1024 + "MB, after: "
+ memAfter[i] / 1024 / 1024 + "MB");
// if (i > 0 && memAfter[i] > memAfterThreshold * ACCEPTED_VARIANCE) {
// fail();
// }
memAfterThreshold = memAfter[i];
// Configuration.getClientBehavior().flushCommandStack();
System.out.println(usedMemory() / 1024 / 1024 + " MB");
} // for loop with iterations
ModelUtil.logInfo("times=" + Arrays.toString(times));
}
/**
* Measures average time, spent for the checkout operation. Opens projects of different sizes, shares them with the
* server, checkouts and then deletes them.
*
* @see org.unicase.emfstore.EmfStore#createProject(org.eclipse.emf.emfstore.server.model.SessionId, String, String,
* org.eclipse.emf.emfstore.server.model.versioning.LogMessage, Project)
* @see org.unicase.emfstore.EmfStore#getProjectList(org.eclipse.emf.emfstore.server.model.SessionId)
* @throws ESException in case of failure.
*/
@Test
public void testCheckoutProject() throws ESException {
ProjectUtil.share(getUsersession(), getLocalProject());
long memAfterThreshold = 0;
for (int i = 0; i < NUM_ITERATIONS; i++) {
memoryMeter.startMeasurements();
memBefore[i] = usedMemory();
long time = System.currentTimeMillis();
ProjectUtil.checkout(getLocalProject());
times[i] = (System.currentTimeMillis() - time) / 1000.0;
memAfter[i] = usedMemory();
memDuring[i] = memoryMeter.stopMeasurements();
ModelUtil.logInfo("checkout project " + getProjectSpace().getProjectName() + " iteration #" + (i + 1)
+ ": time=" + times[i] + ", memory used before: " + memBefore[i] / 1024 / 1024 + "MB, during: "
+ memDuring[i] / 1024 / 1024 + "MB, after: " + memAfter[i] / 1024 / 1024 + "MB");
if (i > 0 && memAfter[i] > memAfterThreshold * 1.2) {
fail("Memory consumption too high.");
}
memAfterThreshold = memAfter[i];
}
ModelUtil.logInfo("times=" + Arrays.toString(times));
}
/**
* Measures average time, spent for the commit and update operations. Opens projects of different sizes, shares them
* with the server and checks it out as two different projects. Then the test generates changes in one of the
* projects, using the ModelMutator, commits them to the server, and updates the second project. The test performs
* model change, commit and update NUM_ITERATIONS times and calculates times for commit and update operations
*
* @see org.unicase.emfstore.EmfStore#createProject(org.eclipse.emf.emfstore.server.model.SessionId, String, String,
* org.eclipse.emf.emfstore.server.model.versioning.LogMessage, Project)
* @see org.unicase.emfstore.EmfStore#getProjectList(org.eclipse.emf.emfstore.server.model.SessionId)
* @throws ESException in case of failure.
*/
@Test
public void testCommitAndUpdateProject() throws ESException {
getLocalProject().shareProject(nullMonitor());
final ESLocalProject checkout = ProjectUtil.checkout(getLocalProject());
double[] modelChangeTimes = new double[NUM_ITERATIONS];
double[] commitTimes = new double[NUM_ITERATIONS];
double[] updateTimes = new double[NUM_ITERATIONS];
long[] memBeforeMut = new long[NUM_ITERATIONS];
long[] memDuringMut = new long[NUM_ITERATIONS];
long[] memAfterMut = new long[NUM_ITERATIONS];
long[] memDuringCommit = new long[NUM_ITERATIONS];
long[] memAfterCommit = new long[NUM_ITERATIONS];
long[] memDuringUpdate = new long[NUM_ITERATIONS];
long[] memAfterUpdate = new long[NUM_ITERATIONS];
for (int i = 0; i < NUM_ITERATIONS; i++) {
memoryMeter.startMeasurements();
memBeforeMut[i] = usedMemory();
long time = System.currentTimeMillis();
// TODO: Nr of changes
changeModel(getProjectSpace(), 100);
modelChangeTimes[i] = (System.currentTimeMillis() - time) / 1000.0;
memDuringMut[i] = memoryMeter.stopMeasurements();
memAfterMut[i] = usedMemory();
ModelUtil.logInfo("change model- iteration #" + (i + 1) + ": time=" + modelChangeTimes[i]
+ " memory used before:" + memBeforeMut[i] / 1024 / 1024 + "MB, during: " + memDuringMut[i] / 1024
/ 1024 + "MB, after: " + memAfterMut[i] / 1024 / 1024 + "MB");
System.out.println("VERSION BEFORE commit:" + getLocalProject().getBaseVersion().getIdentifier());
time = System.currentTimeMillis();
memoryMeter.startMeasurements();
time = System.currentTimeMillis();
getLocalProject().commit(null, null, null);
commitTimes[i] = (System.currentTimeMillis() - time) / 1000.0;
memDuringCommit[i] = memoryMeter.stopMeasurements();
memAfterCommit[i] = usedMemory();
ModelUtil.logInfo("commit project - iteration #" + (i + 1) + ": time=" + commitTimes[i]
+ ", memory used before: " + memAfterMut[i] / 1024 / 1024 + "MB, during: " + memDuringCommit[i] / 1024
/ 1024 + "MB, after: " + memAfterCommit[i] / 1024 / 1024 + "MB");
if (i > 0 && memAfter[i] > memAfterThreshold * ACCEPTED_VARIANCE) {
fail();
}
memAfterThreshold = memAfter[i];
memoryMeter.startMeasurements();
time = System.currentTimeMillis();
checkout.update(new NullProgressMonitor());
updateTimes[i] = (System.currentTimeMillis() - time) / 1000.0;
// TODO: re-enable clean memory task
// CleanMemoryTask task = new CleanMemoryTask(ESWorkspaceProviderImpl.getInstance().getCurrentWorkspace()
// .getResourceSet());
// task.run();
memDuringUpdate[i] = memoryMeter.stopMeasurements();
memAfterUpdate[i] = usedMemory();
ModelUtil.logInfo("update project - iteration #" + (i + 1) + ": time=" + updateTimes[i]
+ ", memory used before: " + memAfterCommit[i] / 1024 / 1024 + "MB, during: " + memDuringUpdate[i]
/ 1024 / 1024 + "MB, after: " + memAfterUpdate[i] / 1024 / 1024 + "MB");
if (i > 0 && memAfter[i] > memAfterThreshold * ACCEPTED_VARIANCE) {
fail();
}
memAfterThreshold = memAfter[i];
}
ModelUtil.logInfo("Mutate model - average=" + Calculate.average(modelChangeTimes) + ", min="
+ Calculate.min(modelChangeTimes) + ", max=" + Calculate.max(modelChangeTimes) + ", mean="
+ Calculate.mean(modelChangeTimes));
}
private void initMeasurments() {
memoryMeter = new MemoryMeter();
memoryMeter.start();
times = new double[NUM_ITERATIONS];
memBefore = new long[NUM_ITERATIONS];
memDuring = new long[NUM_ITERATIONS];
memAfter = new long[NUM_ITERATIONS];
}
public static long usedMemory() {
Runtime.getRuntime().gc();
return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
}
private static IProgressMonitor nullMonitor() {
return new NullProgressMonitor();
}
public void generateModels(final ProjectSpace projectSpace, int numberOfModleElements) {
lastSeed = lastSeed == seed ? seed + 1 : seed;
final ModelMutatorConfiguration mmc = new ModelMutatorConfiguration(ModelMutatorUtil.getEPackage(MODEL_KEY),
projectSpace.getProject(), lastSeed);
mmc.setMaxDeleteCount(1);
mmc.setUseEcoreUtilDelete(false);
mmc.setMinObjectsCount(numberOfModleElements);
mmc.setEditingDomain(ESWorkspaceProviderImpl.getInstance().getInternalWorkspace().getEditingDomain());
Collection<EStructuralFeature> features = new ArrayList<EStructuralFeature>();
features.add(org.eclipse.emf.emfstore.internal.common.model.ModelPackage.eINSTANCE.getProject_CutElements());
mmc.seteStructuralFeaturesToIgnore(features);
RunESCommand.run(new ESVoidCallable() {
@Override
public void run() {
ModelMutator.generateModel(mmc);
}
});
System.out.println("Number of changes: " + projectSpace.getOperations().size());
}
public void changeModel(final ProjectSpace prjSpace, final int nrOfChanges) {
lastSeed = lastSeed == seed ? seed + 1 : seed;
final ModelMutatorConfiguration mmc = new ModelMutatorConfiguration(ModelMutatorUtil.getEPackage(MODEL_KEY),
prjSpace.getProject(), lastSeed);
mmc.setMaxDeleteCount(1);
mmc.setUseEcoreUtilDelete(false);
mmc.setMinObjectsCount(1);
mmc.setEditingDomain(ESWorkspaceProviderImpl.getInstance().getInternalWorkspace().getEditingDomain());
Collection<EStructuralFeature> features = new ArrayList<EStructuralFeature>();
features.add(org.eclipse.emf.emfstore.internal.common.model.ModelPackage.eINSTANCE.getProject_CutElements());
mmc.seteStructuralFeaturesToIgnore(features);
List<EPackage> packages = new ArrayList<EPackage>();
packages.add(BowlingPackage.eINSTANCE);
mmc.setModelPackages(packages);
long time = System.currentTimeMillis();
RunESCommand.run(new ESVoidCallable() {
@Override
public void run() {
mmc.setMinObjectsCount(nrOfChanges);
ModelMutator.changeModel(mmc);
}
});
System.out.println("Changed model: " + (System.currentTimeMillis() - time) / 1000.0 + "sec");
System.out.println("Number of changes: " + prjSpace.getOperations().size());
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
3f7f2f388a61d855f24637048cef2c3f1c801592 | 6293acef0abd9087e4402f44f43a6723d69ab639 | /src/assignment1/prime.java | 8f3c0d2c6fe7afe2460eec6a410a0e23289a9c6c | [] | no_license | ashwatej11/assignment1 | 9f95e9c8aea29fa6fb4f266551e24b14d3c30482 | ad0d0dd3ad2c6baf65bcb3a8f6b488f01d769702 | refs/heads/master | 2020-03-25T15:37:34.030244 | 2018-08-07T15:31:29 | 2018-08-07T15:31:29 | 143,893,081 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package assignment1;
import java.util.Scanner;
public class prime {
public static void main(String[] args) {
int i,n;
int x=0;
Scanner a = new Scanner(System.in);
System.out.println("enter a number");
n= a.nextInt();
for(i=1;i<=n;i++)
{
if(n%i==0)
x++;
}
if(x<=2)
{
System.out.println("its a prime number");
}
else {
System.out.println("not a prime number");
}
}
}
| [
"ashwatej11@gmail.com"
] | ashwatej11@gmail.com |
23344ce1866ed78d060b672b31cac6779dc82880 | 374b5b6f60671966de2f50b36ca8e051c10c8284 | /src/main/java/com/alexrnl/gameoflife/world/Cell.java | 7a94a40a9685ea8ce9825bd2318fa28a1be91171 | [
"BSD-3-Clause"
] | permissive | AlexRNL/GameOfLife | 59a93071271546856328fd9728c13d6ca3b6a572 | 8dfd216e5fdd5e7962a282b652234db421105839 | refs/heads/master | 2020-06-03T14:44:00.134398 | 2014-12-06T22:48:10 | 2014-12-06T22:48:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,211 | java | package com.alexrnl.gameoflife.world;
import java.io.Serializable;
import java.util.Objects;
/**
* A single cell of the game of life.
* @author barfety_a
*/
public class Cell implements Serializable, Cloneable {
/** The serial version UID */
private static final long serialVersionUID = 1L;
/** The state of the cell */
private State state;
/**
* Default constructor.
* @param state
* the state of the cell.
*/
public Cell (final State state) {
super();
this.state = Objects.requireNonNull(state);
}
/**
* Check if the cell is alive.
* @return <code>true</code> if the cell is alive.
*/
public boolean isAlive () {
return State.ALIVE.equals(state);
}
/**
* Check if the cell is dead.
* @return <code>true</code> if the cell is dead.
*/
public boolean isDead () {
return State.DEAD.equals(state);
}
/**
* Provoke the death of the cell.
*/
public void die () {
state = State.DEAD;
}
/**
* Bring a cell to life.
*/
public void live () {
state = State.ALIVE;
}
@Override
protected Cell clone () throws CloneNotSupportedException {
return (Cell) super.clone();
}
}
| [
"alexbarfety@free.fr"
] | alexbarfety@free.fr |
f7fbc3449453a27a355c9e38f4224b538cc65d51 | d7e675cc9e340313d7022e9c03d62e942654b033 | /MicroService/Microservice Development with Java EE 8/Code/Section 3/acme-monolith/scheme/target/generated-sources/xjc/com/acme/schemes/ecommerce/v1/Order.java | 7a80b8d1c10f81c82cccd7726f0c44d15ae2575f | [] | no_license | ahmedyasserarafat/springLatestProjects-2021 | 4270977112ede7c19e8f9abc27f71fba3fcda707 | 60ff47db91efa24913b18b08232c3522cb79f36a | refs/heads/main | 2023-03-01T21:02:51.140260 | 2021-02-14T17:03:49 | 2021-02-14T17:03:49 | 338,852,138 | 0 | 0 | null | 2021-02-14T17:01:06 | 2021-02-14T16:46:49 | null | UTF-8 | Java | false | false | 3,904 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2021.01.20 at 03:21:32 PM IST
//
package com.acme.schemes.ecommerce.v1;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import com.acme.schemes.common.v1.BaseType;
/**
* <p>Java class for Order complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Order">
* <complexContent>
* <extension base="{http://acme.com/schemes/common/v1}BaseType">
* <sequence>
* <element name="status" type="{http://acme.com/schemes/ecommerce/v1}OrderStatus" minOccurs="0"/>
* <element name="cart" type="{http://acme.com/schemes/ecommerce/v1}OrderItemList" minOccurs="0"/>
* <element name="customer" type="{http://acme.com/schemes/ecommerce/v1}Customer" minOccurs="0"/>
* <element name="transaction" type="{http://acme.com/schemes/ecommerce/v1}Transaction" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Order", propOrder = {
"status",
"cart",
"customer",
"transaction"
})
public class Order
extends BaseType
implements Serializable
{
private final static long serialVersionUID = 1L;
@XmlSchemaType(name = "string")
protected OrderStatus status;
protected OrderItemList cart;
protected Customer customer;
protected Transaction transaction;
/**
* Gets the value of the status property.
*
* @return
* possible object is
* {@link OrderStatus }
*
*/
public OrderStatus getStatus() {
return status;
}
/**
* Sets the value of the status property.
*
* @param value
* allowed object is
* {@link OrderStatus }
*
*/
public void setStatus(OrderStatus value) {
this.status = value;
}
/**
* Gets the value of the cart property.
*
* @return
* possible object is
* {@link OrderItemList }
*
*/
public OrderItemList getCart() {
return cart;
}
/**
* Sets the value of the cart property.
*
* @param value
* allowed object is
* {@link OrderItemList }
*
*/
public void setCart(OrderItemList value) {
this.cart = value;
}
/**
* Gets the value of the customer property.
*
* @return
* possible object is
* {@link Customer }
*
*/
public Customer getCustomer() {
return customer;
}
/**
* Sets the value of the customer property.
*
* @param value
* allowed object is
* {@link Customer }
*
*/
public void setCustomer(Customer value) {
this.customer = value;
}
/**
* Gets the value of the transaction property.
*
* @return
* possible object is
* {@link Transaction }
*
*/
public Transaction getTransaction() {
return transaction;
}
/**
* Sets the value of the transaction property.
*
* @param value
* allowed object is
* {@link Transaction }
*
*/
public void setTransaction(Transaction value) {
this.transaction = value;
}
}
| [
"arafatnoor@gmail.com"
] | arafatnoor@gmail.com |
b1f3499ba92778126018f0ba71c2736d7e9751a7 | fc26b51698c4463c15f8b4786d08d0f025b5ea2e | /src/main/java/beginner/abc087b/Main.java | 77e59c2120554574bdb1e70c6aeec8388d5fecf7 | [] | no_license | sakazoo/atcoder | 2b1ddb349dc265fac85ec616eb0f2e8451b304b4 | d16269effac96bf05f9f3c73d0ed35e9aa97263d | refs/heads/master | 2020-04-24T19:16:44.851067 | 2019-03-05T14:36:51 | 2019-03-05T14:36:51 | 172,206,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package beginner.abc087b;
import java.util.Scanner;
/**
* https://atcoder.jp/contests/abs/tasks/abc087_b
* @author sakazoo
*
*/
public class Main {
public static void main(String[] args) {
// 入力
try (Scanner sc = new Scanner(System.in);) {
int coin500 = sc.nextInt();
int coin100 = sc.nextInt();
int coin50 = sc.nextInt();
int total = sc.nextInt();
int pattern = 0;
for (int i = 0; i <= coin500; i++) {
for (int j = 0; j <= coin100; j++) {
for (int k = 0; k <= coin50; k++) {
if (total == 500 * i + 100 * j + 50 * k) {
pattern++;
}
}
}
}
// 出力
System.out.println(pattern);
}
}
} | [
"qq674gzd@gmail.com"
] | qq674gzd@gmail.com |
68f51fc93250302551774f1175e87fd9527aff97 | f61a5a24858e3dd96431eb7be02327fe3892197c | /src/main/java/org/sabDav/repository/UserRepository.java | acd51845115f64122d1554681271efeb448e3d99 | [] | no_license | SabrinaFZ/project-daw | 73f252d8e6d64a939fac9cdc797d68cfd88fc5e1 | 70c542569b1c6a22aaea38d22b3065c4e7a4f9b4 | refs/heads/master | 2021-01-19T11:25:37.334733 | 2017-06-20T09:21:15 | 2017-06-20T09:21:15 | 87,964,404 | 1 | 1 | null | 2017-06-20T09:14:31 | 2017-04-11T18:03:05 | HTML | UTF-8 | Java | false | false | 364 | java | package org.sabDav.repository;
import org.sabDav.model.UserModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository("userRepository")
public interface UserRepository extends JpaRepository<UserModel, Integer>{
UserModel findById(int id);
UserModel findByUsername(String username);
}
| [
"sabrina.fer.zam@gmail.com"
] | sabrina.fer.zam@gmail.com |
cce1c950fe26d0fa35ec519f6e4a795ec74f014c | 60442d2dae1fd38d8a7414a4089285c26bf98643 | /app/src/main/java/com/scaniahack/profile/Card.java | 02035cc39938b639efdec70610eeaf683dd59b3d | [] | no_license | teddycool/Profile | fda6f51e20cab4bf6e4143fa1ab73119b6f36e83 | 692035bcb32a94959e02e254559c3800456eea4b | refs/heads/master | 2021-01-01T04:06:52.370301 | 2016-05-21T15:51:17 | 2016-05-21T15:51:17 | 59,304,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,703 | java | package com.scaniahack.profile;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.content.Context;
import com.scaniahack.profile.R;
public class Card extends RelativeLayout {
private TextView title;
private TextView description;
private TextView department;
private ImageView thumbnail;
private ImageView icon;
public Card(Context context) {
super(context);
init();
}
public Card(Context context,ResJson res_jason) {
super(context);
init();
ImageDownloader img_d = new ImageDownloader();
img_d.setImgView(thumbnail);
img_d.execute(res_jason.getImageUrl());
title.setText(res_jason.getName());
description.setText(res_jason.getRole());
department.setText(res_jason.getDepartment());
//thumbnail.setImageDrawable();
}
public Card(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public Card(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
private void init() {
inflate(getContext(), R.layout.card, this);
this.description = (TextView)findViewById(R.id.description);
this.title = (TextView)findViewById(R.id.title);
this.thumbnail = (ImageView)findViewById(R.id.thumbnail);
this.icon = (ImageView)findViewById(R.id.icon);
this.department = (TextView)findViewById(R.id.department);
}
public void setTitle(String str_title) {
title.setText(str_title);
}
} | [
"tg.tobias@gmail.com"
] | tg.tobias@gmail.com |
ea18d9298e281f0ac013dd528b2dd1736cfa5b87 | b859d31c15d53988c838b5b248116348551e17ce | /FenwickTree/src/ctrick.java | 709dc74e86bf64ec8a85173dc94e8396cb68036b | [] | no_license | PratyushS7/CompetitiveProgramming | ce4acf6d4566497a4e979c90a0f2955c1f466729 | 6e7fba782b8ce1d88825046e3662af0f10f90a0e | refs/heads/master | 2023-05-31T14:43:02.495780 | 2021-06-27T13:40:03 | 2021-06-27T13:40:03 | 380,747,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,166 | java | import java.util.*;
import java.io.*;
public class ctrick implements Runnable
{
private boolean console=false;
int n; int bit[]; int max;
public void solve()
{
int i; n=in.ni(); max=n+5; bit=new int[max]; int ans[]=new int[n]; int pos=2; int last=0;
for(i=1;i<=n;i++) update(1,i);
for(i=1;i<=n;i++)
{
int cur = pos+sum(last);
int free = n-i+1;
int ind = cur%free;
if(ind==0) ind=free;
int lo=1; int hi=n;
while(lo<hi)
{
int mid=(lo+hi)/2;
int sum=sum(mid);
if(sum<ind) lo=mid+1;
else hi=mid;
}
update(-1,lo); ans[lo-1]=i; last=lo;
pos++;
}
for(int v:ans) out.print(v+ " ");
out.println();
}
public int sum(int ind)
{
int sum=0;
for(;ind>0;ind-=ind&(-ind)) sum+=bit[ind];
return sum;
}
public void update(int k, int ind)
{
for(;ind<max;ind+=ind&(-ind)) bit[ind]+=k;
}
@Override
public void run() {
try { init(); }
catch (FileNotFoundException e) { e.printStackTrace(); }
int t= in.ni();
while(t-->0)
{
solve(); out.flush();
}
}
private FastInput in; private PrintWriter out;
public static void main(String[] args) throws Exception { new ctrick().run(); }
private void init() throws FileNotFoundException {
InputStream inputStream = System.in; OutputStream outputStream = System.out;
try { if (!console && System.getProperty("user.name").equals("sachan")) {
outputStream = new FileOutputStream("/home/sachan/Desktop/output.txt");
inputStream = new FileInputStream("/home/sachan/Desktop/input.txt"); }
} catch (Exception ignored) { }
out = new PrintWriter(outputStream); in = new FastInput(inputStream);
}
static class FastInput { InputStream obj;
public FastInput(InputStream obj) { this.obj = obj; }
byte inbuffer[] = new byte[1024]; int lenbuffer = 0, ptrbuffer = 0;
int readByte() { if (lenbuffer == -1) throw new InputMismatchException();
if (ptrbuffer >= lenbuffer) { ptrbuffer = 0;
try { lenbuffer = obj.read(inbuffer); }
catch (IOException e) { throw new InputMismatchException(); } }
if (lenbuffer <= 0) return -1;return inbuffer[ptrbuffer++]; }
String ns() { int b = skip();StringBuilder sb = new StringBuilder();
while (!(isSpaceChar(b))) { sb.appendCodePoint(b);b = readByte(); }return sb.toString();}
int ni() { int num = 0, b;boolean minus = false;
while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
if (b == '-') { minus = true;b = readByte(); }
while (true) { if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else {
return minus ? -num : num; }b = readByte(); }}
long nl() { long num = 0;int b;boolean minus = false;
while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
if (b == '-') { minus = true;b = readByte(); }
while (true) { if (b >= '0' && b <= '9') { num = num * 10L + (b - '0'); } else {
return minus ? -num : num; }b = readByte(); } }
boolean isSpaceChar(int c) { return (!(c >= 33 && c <= 126)); }
int skip() { int b;while ((b = readByte()) != -1 && isSpaceChar(b)) ;return b; }
float nf() {return Float.parseFloat(ns());}
double nd() {return Double.parseDouble(ns());}
char nc() {return (char) skip();}
}
} | [
"34002110+PratyushS7@users.noreply.github.com"
] | 34002110+PratyushS7@users.noreply.github.com |
e3d42626264ad61a0f7c0101d8c415385abcd316 | 41577de0e7dc2963c3d3969a579dea207954ae1b | /chapter3/service-feign/src/main/java/com/forezp/ServiceFeignApplication.java | d98a02653b33d0269a10f87c8f9c14d6cb9331c2 | [] | no_license | luomuhuaxiang/SpringCloudLearning | fe794a4dd5316de22859ae055119ff5294ad3e83 | 8e7bd0fbb6ad52f9d20f7b78677640712d475f19 | refs/heads/master | 2020-06-18T05:13:19.143203 | 2019-08-16T09:45:57 | 2019-08-16T09:45:57 | 196,175,849 | 5 | 0 | null | 2019-07-10T09:29:24 | 2019-07-10T09:29:24 | null | UTF-8 | Java | false | false | 497 | java | package com.forezp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class ServiceFeignApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceFeignApplication.class, args);
}
}
| [
"forezp@Pc-20130412.local"
] | forezp@Pc-20130412.local |
fb522a5aad66f1325f498a07aa3b5e78af8d77bf | 419a13c66f3049820710e4f11e7ef660ed6abd8b | /app/src/main/java/com/disappears/android/util/LastSeenFormatter.java | 1835b4f586b61128f4e6c772e95183b805f951ec | [] | no_license | AsimGardezi/test | e1d6b258a90c280089ad771f1d7036a18ff8b906 | 3817bfabbf208708676620c7ed1b56c2d84e647e | refs/heads/master | 2023-03-19T16:27:21.148242 | 2021-03-15T06:51:17 | 2021-03-15T06:51:17 | 347,853,382 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,007 | java | package com.disappears.android.util;
import android.content.Context;
import com.disappears.android.R;
import java.util.Calendar;
import java.util.concurrent.TimeUnit;
public class LastSeenFormatter {
private final Context context;
public LastSeenFormatter(Context c) {
context = c;
}
public String lastSeen(long datetimeInMillis) {
String out = "";
try {
Calendar calendar = Calendar.getInstance();
long diff = calendar.getTimeInMillis() - datetimeInMillis;
int difSeconds = (int) TimeUnit.MILLISECONDS.toSeconds(diff);
int difMinutes = (int) TimeUnit.MILLISECONDS.toMinutes(diff);
int difHours = (int) TimeUnit.MILLISECONDS.toHours(diff);
int difDay = (int) TimeUnit.MILLISECONDS.toDays(diff);
int difMonth = difDay / 30;
int difYear = difMonth / 12;
if (difSeconds <= 0) {
out = "Now";
} else if (difSeconds < 60) {
out = context.getResources().getQuantityString(R.plurals.last_modified, difSeconds, difSeconds, "second");
} else if (difMinutes < 60) {
out = context.getResources().getQuantityString(R.plurals.last_modified, difMinutes, difMinutes, "minute");
} else if (difHours < 24) {
out = context.getResources().getQuantityString(R.plurals.last_modified, difHours, difHours, "hour");
} else if (difDay < 30) {
out = context.getResources().getQuantityString(R.plurals.last_modified, difDay, difDay, "day");
} else if (difMonth < 12) {
out = context.getResources().getQuantityString(R.plurals.last_modified, difMonth, difMonth, "month");
} else {
out = context.getResources().getQuantityString(R.plurals.last_modified, difYear, difYear, "year");
}
} catch (Exception e) {
e.printStackTrace();
}
return out;
}
}
| [
"ameed.ansari@gmail.com"
] | ameed.ansari@gmail.com |
2cbd0604a75d4b385d810b654f3352c9d8228e2a | 06619f2cd332c5d7d585fc4e4317b8dbe676b880 | /app/src/main/java/com/hackhaton/androidbase/location/exception/LocationException.java | d00b83997af2718f0d8a8deddb62ca309fcf622c | [
"MIT"
] | permissive | afiqiqmal/My-Android-Base-Code | 96b5fe408565f9ba13e00c7a8605bfd767d80547 | 3b2e2bc1c94291a9ecd8b562983e8cb7c3f793f5 | refs/heads/master | 2021-01-23T05:56:07.272536 | 2017-09-05T14:28:24 | 2017-09-05T14:28:24 | 102,483,421 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package com.hackhaton.androidbase.location.exception;
/**
* @author Noorzaini Ilhami
*/
public class LocationException extends RuntimeException {
public LocationException() {
}
public LocationException(String message) {
super(message);
}
}
| [
"hafiqiqmal93@gmail.com"
] | hafiqiqmal93@gmail.com |
1649d8191c0ce9e90dafa532604675841d56273d | 9449cf5ff9e2b05429eac369f706091a4aac7dd0 | /src/taursus/remoteControl/ITransporter.java | fc978947becad3e2a8bb5a72fa8d610cc39a4430 | [
"MIT"
] | permissive | taursus96/remote-control-common | 7e36d7d2134348a1243a4b9442d73572057d4d23 | 67ee95a8abad16c09731329530c5e53e37b36ff2 | refs/heads/master | 2021-01-19T13:42:45.473735 | 2017-04-18T19:48:18 | 2017-04-18T19:48:18 | 88,103,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | java | package taursus.remoteControl;
public interface ITransporter {
public static final byte EVENT_KEEP_ALIVE = -1;
public ITransporter init();
public void close();
public abstract void run();
public ITransporter registerOnConnectedListener(IOnConnected onConnected);
public ITransporter removeOnConnectedListener(IOnConnected onConnected);
public ITransporter registerOnDisconnectedListener(IOnDisconnected onDisconnected);
public ITransporter removeOnDisconnectedListener(IOnDisconnected onDisconnected);
public ITransporter registerOnPackageReceivedListener(IOnPackageReceived onPackageReceived);
public ITransporter removeOnPackageReceivedListener(IOnPackageReceived onPackageReceived);
public ITransporter registerOnConnectionFailedListener(IOnConnectionFailed onConnectionFailed);
public ITransporter removeOnConnectionFailedListener(IOnConnectionFailed onConnectionFailed);
public ITransporter send(byte[] data);
}
| [
"TaursusCrux@gmail.com"
] | TaursusCrux@gmail.com |
4230f4475b31551af67aaeff7568eaab2ab10255 | b2637438639573eaa00f60bac54cefbbd84fdb0c | /Lab4_5/Computer/Processor.java | b5f35f995cfa1d47103f1d80d976371a2f4567bf | [] | no_license | WhiskasVS/Java | 911bfbe8930218c6e5b30900f550122e9941f9ad | 43688e586d034065903a38817d4573d31228e59c | refs/heads/main | 2023-05-26T12:12:28.060846 | 2021-06-07T08:05:01 | 2021-06-07T08:05:01 | 365,731,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 854 | java | package Computer;
import java.io.Serializable;
import java.util.Objects;
public class Processor implements Serializable {
private String name;
Processor()
{
name = "Unknown";
}
Processor(String name)
{
this.name = name;
}
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name = name;
}
@Override
public String toString()
{
return "Processor: " + getName();
}
@Override
public int hashCode()
{
return Objects.hash(name);
}
@Override
public boolean equals(Object obj) {
if(this == obj) return true;
if(obj == null || getClass() != obj.getClass()) return false;
Processor processor = (Processor) obj;
return name.equals(processor.name);
}
} | [
"noreply@github.com"
] | noreply@github.com |
65e2cb6882819a5217f266dfb9ce311bd0b57838 | 454726b8d90b28dd73b946e6409c537093648c81 | /src/org/viduus/charon/asteroids/world/WorldEngine.java | 45084486c98d70b201abb610bf8a0f7302247552 | [] | no_license | ViduusEntertainment/charon-asteroids | 40f0a90422d171bb3ba8dd0b9296939599620708 | 90aa7cadc499ac1bb3aeaddf95daa56f7549f8d9 | refs/heads/master | 2021-04-27T21:49:50.664999 | 2018-02-24T14:05:00 | 2018-02-24T14:05:00 | 122,407,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,136 | java | package org.viduus.charon.asteroids.world;
import java.util.Arrays;
import org.dyn4j.dynamics.Settings;
import org.dyn4j.dynamics.World;
import org.dyn4j.geometry.AABB;
import org.dyn4j.geometry.Vector2;
import org.viduus.charon.asteroids.GameSystems;
import org.viduus.charon.asteroids.physics.WorldBounds;
import org.viduus.charon.asteroids.world.objects.characters.playable.PlayerCharacter;
import org.viduus.charon.asteroids.world.regions.Region;
import org.viduus.charon.asteroids.world.weapon.range.DefaultGun;
import org.viduus.charon.global.GameConstants.GlobalEngineFlags;
import org.viduus.charon.global.GameConstants.Property;
import org.viduus.charon.global.GameInfo;
import org.viduus.charon.global.graphics.util.Size;
import org.viduus.charon.global.physics.twodimensional.listeners.CollisionListener;
import org.viduus.charon.global.player.PlayerParty;
import org.viduus.charon.global.util.identification.Uid;
import org.viduus.charon.global.world.AbstractWorldEngine;
import org.viduus.charon.global.world.objects.twodimensional.character.playable.PlayableCharacter2D;
import org.viduus.charon.global.world.regions.BaseRegion;
public class WorldEngine extends AbstractWorldEngine {
private Size world_size;
public WorldEngine(int fps) {
super(fps, new WorldEventEngine());
}
@Override
protected String getNpcResolverClassPath() {
return "";
}
@Override
protected String getRegionResolverClassPath() {
return "";
}
@Override
protected String getCharacterResolverClassPath() {
return "";
}
@Override
protected String getWeaponResolverClassPath() {
return "";
}
@Override
protected String getBulletResolverClassPath() {
return "";
}
@Override
protected String getEffectResolverClassPath() {
return "";
}
public Size getWorldSize() {
return world_size;
}
@Override
protected void onLoadGame(GameInfo game_info) {
super.onLoadGame(game_info);
// Create all the regions
BaseRegion[] regions = new BaseRegion[] {
new Region(game_systems, game_info.party)
};
Arrays.stream(regions).forEach(region -> {
insert(region);
region.load();
});
// Load in demo Main Character information
PlayableCharacter2D main_character = game_info.party.get(0);
main_character.set(Property.CURRENT_REGION_ID, new Uid("vid:region:region"));
// Load demo region and put player in region
BaseRegion character_region = (BaseRegion) resolve((Uid) main_character.get(Property.CURRENT_REGION_ID));
for (PlayableCharacter2D party_member : game_info.party) {
character_region.queueEntityForAddition(party_member);
}
}
@Override
protected World createWorld() {
float world_height = game_systems.graphics_engine.getScreenSize().height;
float world_width = game_systems.graphics_engine.getScreenSize().width;
World world = new World(new WorldBounds(new AABB(0, 0, world_width, world_height), this));
// world.setGravity(new Vector2(0, org.viduus.charon.global.GameConstants.PIXELS_PER_METER * 9.8));
world.addListener(new CollisionListener(this));
Settings settings = new Settings();
settings.setAutoSleepingEnabled(false);
settings.setMaximumTranslation(Double.MAX_VALUE);
world.setSettings(settings);
world_size = new Size(world_width, world_height);
return world;
}
@Override
protected void onSaveAndDisposeEngine() {}
@Override
protected void onMainThreadStart() {
Size screen_size = game_systems.graphics_engine.getScreenSize();
PlayerParty party = new PlayerParty();
// add player to party
PlayerCharacter character_1 = new PlayerCharacter((GameSystems)game_systems, "Sauran", new Vector2(350, 200));
DefaultGun character_1_primary = new DefaultGun(game_systems.world_engine, "Primary Weapon", character_1);
game_systems.world_engine.insert(character_1_primary);
game_systems.world_engine.insert(character_1);
character_1.equipPrimaryWeapon(character_1_primary);
party.add(character_1);
// start the game
GameInfo game_info = new GameInfo(GameSystems.GAME, party);
game_systems.startGame(game_info);
game_systems.world_engine.enable(GlobalEngineFlags.TICK_WORLD);
}
}
| [
"crba233@uky.edu"
] | crba233@uky.edu |
165319da51aa7e30c8e9a7a4eac9e6e30b553db3 | ea27c148cd6cdc7ab9ec7987b1d8124a1d200f12 | /Skills/SkillFirstAid.java | 3abdc52745f5e86086b9d12632f325bb04a25f61 | [] | no_license | 224leon/HeroesSkills | 2ab724c24f113231392033c7cacbd86677f88da5 | 5fcb5c9cb09ac0db56a9f709ae8b6354034a1a00 | refs/heads/master | 2021-01-15T22:41:39.193476 | 2012-10-04T22:05:20 | 2012-10-04T22:05:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,853 | java | package com.herocraftonline.heroes.characters.skill.skills;
import com.herocraftonline.heroes.Heroes;
import com.herocraftonline.heroes.api.SkillResult;
import com.herocraftonline.heroes.characters.Hero;
import com.herocraftonline.heroes.characters.skill.ActiveSkill;
import com.herocraftonline.heroes.characters.skill.SkillConfigManager;
import com.herocraftonline.heroes.characters.skill.SkillType;
import com.herocraftonline.heroes.util.Setting;
import org.bukkit.configuration.ConfigurationSection;
public class SkillFirstAid extends ActiveSkill{
public SkillFirstAid(Heroes plugin) {
super(plugin, "FirstAid");
setDescription("Heals yourself by $1");
setUsage("/skill FirstAid");
setArgumentRange(0, 0);
setIdentifiers(new String[]{"skill FirstAid"});
setTypes(SkillType.SILENCABLE, SkillType.HEAL);
}
@Override
public String getDescription(Hero hero) {
double amount = (SkillConfigManager.getUseSetting(hero, this, Setting.AMOUNT.node(), 1.0, false));
amount = amount > 0 ? amount : 0;
String description = getDescription().replace("$1", amount + "%");
//COOLDOWN
int cooldown = (SkillConfigManager.getUseSetting(hero, this, Setting.COOLDOWN.node(), 0, false)
- SkillConfigManager.getUseSetting(hero, this, Setting.COOLDOWN_REDUCE.node(), 0, false) * hero.getSkillLevel(this)) / 1000;
if (cooldown > 0) {
description += " CD:" + cooldown + "s";
}
//MANA
int mana = SkillConfigManager.getUseSetting(hero, this, Setting.MANA.node(), 10, false)
- (SkillConfigManager.getUseSetting(hero, this, Setting.MANA_REDUCE.node(), 0, false) * hero.getSkillLevel(this));
if (mana > 0) {
description += " M:" + mana;
}
//HEALTH_COST
int healthCost = SkillConfigManager.getUseSetting(hero, this, Setting.HEALTH_COST, 0, false) -
(SkillConfigManager.getUseSetting(hero, this, Setting.HEALTH_COST_REDUCE, mana, true) * hero.getSkillLevel(this));
if (healthCost > 0) {
description += " HP:" + healthCost;
}
//STAMINA
int staminaCost = SkillConfigManager.getUseSetting(hero, this, Setting.STAMINA.node(), 0, false)
- (SkillConfigManager.getUseSetting(hero, this, Setting.STAMINA_REDUCE.node(), 0, false) * hero.getSkillLevel(this));
if (staminaCost > 0) {
description += " FP:" + staminaCost;
}
//DELAY
int delay = SkillConfigManager.getUseSetting(hero, this, Setting.DELAY.node(), 0, false) / 1000;
if (delay > 0) {
description += " W:" + delay + "s";
}
//EXP
int exp = SkillConfigManager.getUseSetting(hero, this, Setting.EXP.node(), 0, false);
if (exp > 0) {
description += " XP:" + exp;
}
return description;
}
@Override
public ConfigurationSection getDefaultConfig() {
ConfigurationSection node = super.getDefaultConfig();
node.set(Setting.AMOUNT.node(), 1);
node.set("amount-increase", 0);
return node;
}
@Override
public SkillResult use(Hero hero, String[] args) {
double amount = (SkillConfigManager.getUseSetting(hero, this, Setting.AMOUNT.node(), 1.0, false) +
(SkillConfigManager.getUseSetting(hero, this, "amount-increase", 0.0, false) * hero.getSkillLevel(this)));
amount = amount > 0 ? amount : 0;
if(hero.getHealth()+(hero.getMaxHealth()*amount)<hero.getMaxHealth())hero.setHealth((int) (hero.getHealth()+(hero.getMaxHealth()*amount)));
else hero.setHealth(hero.getMaxHealth());
hero.syncHealth();
return SkillResult.NORMAL;
}
} | [
"whatshiywl@hotmail.com"
] | whatshiywl@hotmail.com |
df93160a79d5c6fe916b2ff3751c8dbd396a7459 | f0cef7cdc2ee8c598b7039d5415e41b27f8c8903 | /src/rapportprobleme/jdbc/model/dao/ResolveurDAO.java | f721d20538205e7cca4538c8b78045a5e5c73654 | [] | no_license | lucasvannoort/Rapport_probleme | c0f114d8199972f47b293b4a2f444c5df5e8718c | 426707f5e4630dd31c073e4c1f2a25b445915f70 | refs/heads/master | 2021-03-24T14:01:15.068708 | 2016-05-30T07:35:46 | 2016-05-30T07:35:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,215 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rapportprobleme.jdbc.model.dao;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import rapportprobleme.jdbc.model.beans.Resolveur;
/**
*
* @author Antho
*/
public class ResolveurDAO extends DAO<Resolveur> {
@Override
public Resolveur find(int id) {
Resolveur r = null;
try {
String sql = "SELECT * FROM Resolveur WHERE id_rsv";
PreparedStatement pst = this.connexion.prepareStatement(sql);
pst.setInt(1, id);
ResultSet rs = pst.executeQuery();
while (rs.next()) {
r = new Resolveur(
rs.getInt("id_rsv"),
rs.getString("name"),
rs.getString("first"),
rs.getInt("phone"),
rs.getString("mail")
);
}
} catch (SQLException ex) {
Logger.getLogger(ResolveurDAO.class.getName()).log(Level.SEVERE, null, ex);
}
return r;
}
@Override
public List<Resolveur> findAll() {
List<Resolveur> resolveurList = new LinkedList();
try {
String sql = "SELECT * FROM Resolveurs";
ResultSet rs = this.connexion.createStatement().executeQuery(sql);
while (rs.next()) {
resolveurList.add(new Resolveur(
rs.getInt("id_rsv"),
rs.getString("name"),
rs.getString("first"),
rs.getInt("phone"),
rs.getString("mail")
));
}
} catch (SQLException ex) {
ex.printStackTrace();
}
return resolveurList;
}
@Override
public Resolveur create(Resolveur r) {
this.setChanged();
try {
String sql = "INSERT INTO Resolveurs (name, first, phone, mail) VALUES (?,?,?,?)";
PreparedStatement pst = this.connexion.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
pst.setString(1, r.getName());
pst.setString(2, r.getFirst());
pst.setInt(3, r.getPhone());
pst.setString(4, r.getMail());
pst.executeUpdate();
ResultSet rs = pst.getGeneratedKeys();
while (rs.next()) {
r.setId_rsv(rs.getInt(1));
}
} catch (SQLException ex) {
this.notifyObservers(ex);
Logger.getLogger(ResolveurDAO.class.getName()).log(Level.SEVERE, null, ex);
}
this.notifyObservers(r);
return r;
}
@Override
public Resolveur update(Resolveur r) {
try {
String sql = "UPDATE Resolveur SET name=?, first=?, phone=?, mail=? WHERE id_rsv=?";
PreparedStatement pst = this.connexion.prepareStatement(sql);
pst.setString(1, r.getName());
pst.setString(2, r.getFirst());
pst.setInt(3, r.getPhone());
pst.setString(4, r.getMail());
pst.setInt(5, r.getId_rsv());
pst.executeUpdate();
} catch (SQLException ex) {
Logger.getLogger(ResolveurDAO.class.getName()).log(Level.SEVERE, null, ex);
}
return r;
}
@Override
public void delete(Resolveur r) {
this.setChanged();
try {
String sql = "DELETE FROM Resolveur WHERE id_rsv=?";
PreparedStatement pst = this.connexion.prepareStatement(sql);
pst.setInt(1, r.getId_rsv());
pst.executeUpdate();
} catch (SQLException ex) {
this.notifyObservers();
ex.printStackTrace();
}
this.notifyObservers();
}
}
| [
"Asus@PC-antho-1"
] | Asus@PC-antho-1 |
b7a211aab76120bddace6e7afe89249813d3d2d2 | 5be25ba66a64eed2450a5d49524083b5453b82df | /src/main/java/org/mark/demo/threadlocal/InheritableThreadLocalDemo.java | 16b172d9766ae3360a5dcc611eae4909b89800df | [] | no_license | ooccam/Lock-Learning | 8b305a1e179dbc0511fddd0a5f3cc532da8387cc | 55dd388996e5b5bfc90dd7a9a32074a38dfbf0db | refs/heads/master | 2023-05-09T04:14:54.175369 | 2021-05-21T06:11:19 | 2021-05-21T06:11:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package org.mark.demo.threadlocal;
import lombok.extern.slf4j.Slf4j;
/**
* @FileName ThreadLocalDemo
* @Description 可继承ThreadLocal支持子线程访问父线程的数据
* @Author markt
* @Date 2019-04-11
* @Version 1.0
*/
@Slf4j
public class InheritableThreadLocalDemo {
public static ThreadLocal<Integer> threadLocal = new InheritableThreadLocal<Integer>();
public static void main(String args[]) {
threadLocal.set(new Integer(123));
new MyThread().start();
log.debug("{}", threadLocal.get());
}
static class MyThread extends Thread {
@Override
public void run() {
log.debug("{}", threadLocal.get());
}
}
} | [
"tobeanengineer@foxmail.com"
] | tobeanengineer@foxmail.com |
5bc34696a51966a8bfa5606e33de551d0c1c6bb4 | 9a76bb566b7ce1bdc3cd631f326b5109d99777c3 | /src/com/paylogic/scanwarelite/PaymentCode.java | 55a7247e4e1060e38d5bf07cc3683c00ebfd817d | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | isabella232/ScanwareLitev2 | 528a218cb66525b0df53cd9e05a4d3a041d76adb | 15a44c80181d2534f56721692e554f23c500411c | refs/heads/master | 2023-03-18T12:51:47.285291 | 2014-08-26T12:44:01 | 2014-08-26T12:44:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 707 | java | package com.paylogic.scanwarelite;
public enum PaymentCode {
/*
* 202 in case automatic payment was rejected
* 211 should never occur, customer hasn't paid
* 212 should never occur, customer cancelled the order
* 213 customer has not paid the full amount, but somehow still got a ticket
* 214 paylogic has refunded this ticket, thus it is not valid anymore
* 215 something went wrong with payment, needs to be taken care of manually by customer service
*/
CHARGED_BACK(202), EXPIRED(211), CANCELLED(212), INSUFFICIENT_PAYMENT(213), REFUNDED(
214), ON_HOLD(221);
private int code;
private PaymentCode(int code) {
this.code = code;
}
public int getCode(){
return code;
}
}
| [
"kevindeboer16@gmail.com"
] | kevindeboer16@gmail.com |
d465bfb41ed1be1b1fab5deeaa68aa4ad04c8d9d | 38fcb4db9f925120a9f2f7cd8fb1fa9cd5cb37f3 | /JavaMath/Math_sqrt/Math_sqrt.java | ae17406417b44a06096edc2ef8e5a281307e1e67 | [] | no_license | Thanakrit-Bank/Hello-Java-Group1 | bce0bede02dd1ca27e4bd5b4cca8e22f0720998c | ea1d2c2a6af8a65f274b137b9427214b37ce7dd3 | refs/heads/master | 2022-12-01T16:45:24.919252 | 2020-08-17T20:31:42 | 2020-08-17T20:31:42 | 287,449,217 | 1 | 3 | null | 2020-08-17T20:31:44 | 2020-08-14T05:12:40 | Java | UTF-8 | Java | false | false | 110 | java | public class Math_sqrt {
public static void main(String[] args) {
System.out.println(Math.sqrt(64));
}
}
| [
"s6201012620091@email.kmutnb.ac.th"
] | s6201012620091@email.kmutnb.ac.th |
2f7890db28bed37f3d1d776f99b02d3ebe0f8ff3 | ebafa816e9d36170f28b9117fb47d3c4d86fc303 | /studyHadoop/src/main/java/hadoopDefinitiveGuide/chapter_5/WritableDemo.java | f2f08126d37ef6c31f887743c245fa3aa942abd0 | [] | no_license | LawsonAbs/DayProgram | f93328a610ee1418756ff63a50d88fedae181624 | 3890ecb5952983a0e8bebfec42c137b475e37456 | refs/heads/master | 2021-10-10T15:26:24.459492 | 2019-01-13T01:56:29 | 2019-01-13T01:56:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,281 | java | package hadoopDefinitiveGuide.chapter_5;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Writable;
import java.io.*;
public class WritableDemo {
public static byte[] serialize(Writable writable) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream dataOut = new DataOutputStream(out);
writable.write(dataOut);
dataOut.close();
return out.toByteArray();
}
public static byte[] deserialize(Writable writable,byte[] bytes) throws IOException {
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
DataInputStream dataIn = new DataInputStream(in);
writable.readFields(dataIn);
dataIn.close();
return bytes;
}
public static void main(String[] args) throws IOException {
/*step 1: 将 IntWritable 对象作为输入流,放到bytes中
*/
IntWritable inW = new IntWritable(163);
byte[] bytes = serialize(inW);
System.out.println("bytes.length: "+bytes.length);
/*step 2: 将上述的 bytes 作为输入流,放到outW中
*/
IntWritable outW = new IntWritable();
deserialize(outW, bytes);
System.out.println(outW.get());
}
}
| [
"shenliu@ahnu.edu.cn"
] | shenliu@ahnu.edu.cn |
f746616c85fb9228f1b5c6f5c57f21ad1cee60b2 | 6872a44ccba761817db37999f4a031f55ad51680 | /src/com/example/pagination/MainActivity.java | fefa11c98b9a9487f7cdd96a6895c51eaf666d9e | [] | no_license | yunizcom/FB_login_post_wall_photos | d264d682c4d499e62f78a27a99c75dc288745b30 | 1e0032da45aa86d98390f9e805c0dbae6c26bbd6 | refs/heads/master | 2020-05-17T21:45:13.895359 | 2013-12-25T05:24:16 | 2013-12-25T05:24:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,034 | java | package com.example.pagination;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.Bundle;
import android.os.StrictMode;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.MeasureSpec;
import android.widget.AbsoluteLayout;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
/*import com.addthis.core.AddThis;
import com.addthis.core.Config;
import com.example.pagination.R;
import com.addthis.error.ATDatabaseException;
import com.addthis.error.ATSharerException;
import com.addthis.models.ATShareItem;
import com.addthis.ui.views.ATButton;*/
import com.facebook.*;
import com.facebook.Session.StatusCallback;
import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.AsyncFacebookRunner.RequestListener;
import com.facebook.android.Facebook;
import com.facebook.model.*;
import com.example.pagination.R.string;
import com.example.pagination.helloworld2;
@SuppressWarnings("deprecation")
public class MainActivity extends Activity {
public helloworld2 helloworld2;
public ImageView imageView1;
private static final List<String> PERMISSIONS = Arrays.asList("publish_actions");
private static final String PENDING_PUBLISH_KEY = "pendingPublishReauthorization";
private boolean pendingPublishReauthorization = false;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sndpage);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
helloworld2 = new helloworld2();
Log.v("DEBUG","---" + helloworld2.bump("sdsd"));
TextView welcome = (TextView) findViewById(R.id.welcome);
EditText editText1 = (EditText) findViewById(R.id.editText1);
imageView1 = (ImageView) findViewById(R.id.imageView1);
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Bombing.ttf");
welcome.setTypeface(tf);
editText1.setTypeface(tf);
imageView1.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
switch (arg1.getAction()) {
case MotionEvent.ACTION_DOWN: {
changeBtnImg(0);
break;
}
case MotionEvent.ACTION_CANCEL:{
changeBtnImg(1);
break;
}
case MotionEvent.ACTION_UP:{
changeBtnImg(1);
break;
}
}
return true;
}
});
Session.openActiveSession(this, true, new Session.StatusCallback() {
// callback when session changes state
@SuppressWarnings("deprecation")
@Override
public void call(Session session, SessionState state, Exception exception) {
Log.v("DEBUG","FB session : " + session);
if (session.isOpened()) {
// make request to the /me API
Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
// callback after Graph API response with user object
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
//TextView welcome = (TextView) findViewById(R.id.welcome);
Log.v("DEBUG","LOGIN FB : " + user + " | " + response);
}
}
});
}
}
});
}
public void changeBtnImg(int statusId){
InputStream ims1;
Drawable d1;
switch(statusId) {
case 0: {
try
{
ims1 = getAssets().open("minion_2.png");
d1 = Drawable.createFromStream(ims1, null);
imageView1.setImageDrawable(d1);
}
catch(IOException ex)
{
return;
}
break;
}
case 1:{
try
{
ims1 = getAssets().open("minion_1.png");
d1 = Drawable.createFromStream(ims1, null);
imageView1.setImageDrawable(d1);
}
catch(IOException ex)
{
return;
}
break;
}
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}
public static byte[] loadBitmapFromView_ARRAYBYTES(View v) {
Bitmap bitmap;
View v1 = v.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
Log.v("DEBUG",(int)(bitmap.getWidth() * 0.3) + " - " + (int)(bitmap.getHeight() * 0.3));
bitmap=Bitmap.createScaledBitmap(bitmap, (int)(bitmap.getWidth() * 0.3), (int)(bitmap.getHeight() * 0.3), true);
v1.setDrawingCacheEnabled(false);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 50, stream);
byte[] byteArray = stream.toByteArray();
return byteArray;
}
public static Bitmap loadBitmapFromView_BITMAP(View v) {
Bitmap bitmap;
View v1 = v.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
Log.v("DEBUG",(int)(bitmap.getWidth() * 1) + " - " + (int)(bitmap.getHeight() * 1));
bitmap=Bitmap.createScaledBitmap(bitmap, (int)(bitmap.getWidth() * 1), (int)(bitmap.getHeight() * 1), true);
v1.setDrawingCacheEnabled(false);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 50, stream);
return bitmap;
}
public void publishPhoto(Bitmap imgData, String message) {
Session session = Session.getActiveSession();
Request request = Request.newUploadPhotoRequest(session, imgData, new Request.Callback()
{
@Override
public void onCompleted(Response response)
{
Log.v("DEBUG","DONE UPLOAD : " + response);
}
});
Bundle postParams = request.getParameters(); // <-- THIS IS IMPORTANT
postParams.putString("name", message + " install at https://www.yuniz.com/");
request.setParameters(postParams);
request.executeAsync();
}
private void publishStory() {
Session session = Session.getActiveSession();
if (session != null){
// Check for publish permissions
List<String> permissions = session.getPermissions();
if (!isSubsetOf(PERMISSIONS, permissions)) {
pendingPublishReauthorization = true;
Session.NewPermissionsRequest newPermissionsRequest = new Session
.NewPermissionsRequest(this, PERMISSIONS);
session.requestNewPublishPermissions(newPermissionsRequest);
return;
}
Bundle postParams = new Bundle();
postParams.putString("name", "Facebook SDK for Android");
postParams.putString("caption", "Build great social apps and get more installs.");
postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
postParams.putString("link", "https://developers.facebook.com/android");
postParams.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");
Request.Callback callback= new Request.Callback() {
public void onCompleted(Response response) {
Log.v("DEBUG","DONE UPLOAD : " + response);
}
};
Request request = new Request(session, "me/feed", postParams,
HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}
}
private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) {
for (String string : subset) {
if (!superset.contains(string)) {
return false;
}
}
return true;
}
public void oneBtn(View v) {
AbsoluteLayout myview = (AbsoluteLayout) findViewById(R.id.myview);
publishPhoto(loadBitmapFromView_BITMAP(myview),"test2");
//publishStory();
}
public void twoBtn(View v) {
setContentView(R.layout.sndpage);
}
}
| [
"stanly.lns@gmail.com"
] | stanly.lns@gmail.com |
fa98b974fe5ea85346c4f8e7d17d0b1c1e908850 | 58e29c58c189b7e297e567cfc8bcc3e25bda1a8b | /Layout/Scroll_View_HorizontalLayout/app/src/test/java/com/ayu/scroll_view_horizontallayout/ExampleUnitTest.java | 479401f0a05737ec42dc6f292217c8ddda27f842 | [] | no_license | ayufitriyah/B_Bondowoso_Mobile_E41191725_Fitriyah_Ayu_Ningsih | ed905a252c4f30ccdef45a4d3296da58cf0f6f2d | d8385eb18c66af9514b139790360b4758da3df6e | refs/heads/main | 2023-05-27T16:38:06.835140 | 2021-06-09T14:44:40 | 2021-06-09T14:44:40 | 352,508,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.ayu.scroll_view_horizontallayout;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"fitriyahayuningsih@gmail.com"
] | fitriyahayuningsih@gmail.com |
bb452ccd888afc73d9c4561043788f30e165a822 | f7078ee7958643c43de980d8126e3e6ef03f5683 | /src/test/java/tp10/metier/ActionTest.java | b1bc8dd14792d6ce7dc141a1a7736e32f5836396 | [] | no_license | RenjieZHAI/Coference | b329a422a43a6140403c719c7338c6c63857cc94 | 9e44b339eefa155534afaac6d040962c54a59327 | refs/heads/master | 2023-03-31T15:05:21.167649 | 2021-03-09T09:04:19 | 2021-03-09T09:04:19 | 345,599,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tp10.metier;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
*
* @author 13520
*/
public class ActionTest {
public ActionTest() {
}
@org.junit.jupiter.api.Test
public void testSomeMethod() {
}
}
| [
"64421423+RenjieZHAI@users.noreply.github.com"
] | 64421423+RenjieZHAI@users.noreply.github.com |
9ebd27a597ae031343e008c25e2f11a2ed83ea0c | 55dca62e858f1a44c2186774339823a301b48dc7 | /code/my-app/functions/4/setArrears_Market.java | d8d5038f2dedca41cf0a22970d154d739b1787ee | [] | no_license | jwiszowata/code_reaper | 4fff256250299225879d1412eb1f70b136d7a174 | 17dde61138cec117047a6ebb412ee1972886f143 | refs/heads/master | 2022-12-15T14:46:30.640628 | 2022-02-10T14:02:45 | 2022-02-10T14:02:45 | 84,747,455 | 0 | 0 | null | 2022-12-07T23:48:18 | 2017-03-12T18:26:11 | Java | UTF-8 | Java | false | false | 138 | java | public void setArrears(GoodsType goodsType, int value) {
MarketData data = requireMarketData(goodsType);
data.setArrears(value);
} | [
"wiszowata.joanna@gmail.com"
] | wiszowata.joanna@gmail.com |
7f576589d6887952b8ef2235d68e306886da158b | 204538e3d20a5b4b49b0d063788980cfd5798ac2 | /app/src/main/java/com/dobrimajstori/kucnimajstor/BidovaniPosloviRecyclerViewAdapter.java | 83598c819a2fb89c285a5de893381e9074e59686 | [] | no_license | papa/H-Work | c754b7d235a545beb6b10f7cc2e04368e6fd7f7c | 548ff744fda2874a4adcc98b69e8cbc7bed17576 | refs/heads/master | 2023-01-28T17:27:57.999701 | 2020-12-09T15:46:26 | 2020-12-09T15:46:26 | 320,002,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,063 | java | package com.dobrimajstori.kucnimajstor;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
public class BidovaniPosloviRecyclerViewAdapter extends RecyclerView.Adapter<BidovaniPosloviRecyclerViewAdapter.ViewHolder>
{
private final ArrayList<Posao> mValues;
public BidovaniPosloviRecyclerViewAdapter(ArrayList<Posao> items) {
mValues = items;
}
@Override
public BidovaniPosloviRecyclerViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.bidovani_poslovi_kartica, parent, false);
return new BidovaniPosloviRecyclerViewAdapter.ViewHolder(view);
}
@Override
public void onBindViewHolder(final BidovaniPosloviRecyclerViewAdapter.ViewHolder holder, final int position) {
final int[] mp = new int[1];
final int budz;
holder.mView.setTag(position);
budz=mValues.get(position).getBudzet();
holder.mItem = mValues.get(position);
holder.naslov.setText(mValues.get(position).getNaslovposla());
holder.opis.setText(mValues.get(position).getOpis());
holder.budzet.setText("Budzet: " + budz +" din.");
Pocetna.baza.getReference("SviPoslovi").child(mValues.get(position).getIdposla()).child("Bidovi").child(Pocetna.currentFirebaseUser.getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Bid b=dataSnapshot.getValue(Bid.class);
mp[0] =b.getNovac();
holder.mojaPonuda.setText("Moja ponuda: "+ mp[0] +" din.");
if(mp[0]>budz)
{
holder.mojaPonuda.setTextColor(Color.RED);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
/* holder.mView.setTag(position);
budz=mValues.get(position).getBudzet();
holder.mItem = mValues.get(position);
holder.naslov.setText(mValues.get(position).getNaslovposla());
holder.opis.setText(mValues.get(position).getOpis());
holder.budzet.setText("Budzet: " +Integer.toString(budz)+" din.");*/
/*if(mp[0]>budz)
{
holder.mojaPonuda.setTextColor(Color.RED);
}*/
}
@Override
public int getItemCount() {
return mValues.size();
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
public final View mView;
public final TextView naslov;
public final TextView opis;
public Posao mItem;
public final TextView budzet;
public final TextView mojaPonuda;
public ViewHolder(View view) {
super(view);
mView = view;
naslov = view.findViewById(R.id.primary_textbid);
opis = view.findViewById(R.id.sub_textbid);
budzet= view.findViewById(R.id.budzetbid);
mojaPonuda= view.findViewById(R.id.mojaponuda);
view.setOnClickListener(this);
}
@Override
public String toString() {
return super.toString() + " '" + opis.getText() + "'";
}
@Override
public void onClick(View view) {
int pos=(int)view.getTag();
// Pocetna.prenosPosla=mValues.get(pos);
// Intent i= new Intent(view.getContext(),InfoPosaoActivity.class);
// view.getContext().startActivity(i);
}
}
}
| [
"pavle.jane@gmail.com"
] | pavle.jane@gmail.com |
c0f2ef2800d3356aef6101aa9ca376fd1229d47f | f832875bd2b2aa25e04ec7e6396c77588df8d7cc | /src/main/java/com/rysource/interfaces/EnhancedTestInterface.java | 82792635fe97c1a4f4f328af83ce19b6e3a925e7 | [
"WTFPL"
] | permissive | SKLn-Rad/Enhanced-JUnit-4-Test-Runner | e76840aafa308a1d5721f74c7519b29a91b517e8 | 9f2a8df19adbbe73bfcf372867d27f85629513d8 | refs/heads/master | 2021-05-04T10:34:13.518046 | 2019-10-21T15:02:41 | 2019-10-21T15:02:41 | 47,697,282 | 3 | 1 | null | 2020-10-13T07:02:52 | 2015-12-09T14:45:59 | Java | UTF-8 | Java | false | false | 1,861 | java | package com.rysource.interfaces;
import org.junit.Ignore;
/**
* This class should be implemented in the same place as the RunWith annotation to get access to live notifications on test results.
*/
/**
* @author ryandixon1993@gmail.com
*/
public interface EnhancedTestInterface {
/**
* Fired upon the execution of a new test
*
* @param result
* the result of the test
* @param className
* The class name of the test method being executed
* @param methodName
* The method name of the test being executed
*/
public void onTestFinished(boolean result, String className, String methodName);
/**
* Fired when a test starts
*
* @param className
* The class name of the test
* @param methodName
* The method name of the test
*/
public void onTestStarted(String className, String methodName);
/**
* Fired upon a test failure
*
* @param className
* The class in which the failure was fired
* @param methodName
* The method in which the failure was fired
* @param message
* The message attached to the assertion
* @param stack
* The stack trace of the failure
*/
public void onTestFailure(String className, String methodName, String message, String stack);
/**
* Fired upon a test passing
*
* @param className
* The class name in which the test passed
* @param methodName
* The method name of the test which passed
*/
public void onTestPassed(String className, String methodName);
/**
* Fired when a test is found to have the {@link Ignore} annotation
*
* @param className
* The class name of the test
* @param methodName
* The method name of the test
*/
public void onTestIgnored(String className, String methodName);
}
| [
"ryandixon1993@gmail.com"
] | ryandixon1993@gmail.com |
4c78fc8377192620533a0e47c38f7c76a768da2e | 8640f8045efe65119faebe1b8f48286995ffbbfc | /src/main/java/com/izibiz/irsaliye/ws/MarkReceiptAdviceRequest.java | 87699622fa91a3b2e1bc3d3286231dadd8e06f79 | [] | no_license | serdarsanu/izibiz-ws-client-springboot | fc556d7bc808d8e7fd25aee285ac1af31b794fd2 | 40cf1fa2ad84142b5d37e83cdba07e5009437aaf | refs/heads/master | 2022-07-16T01:37:18.154425 | 2019-12-05T13:56:20 | 2019-12-05T13:56:20 | 226,103,051 | 1 | 0 | null | 2022-06-30T14:46:58 | 2019-12-05T12:59:29 | Java | UTF-8 | Java | false | false | 5,233 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2019.11.13 at 11:06:12 AM EET
//
package com.izibiz.irsaliye.ws;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for MarkReceiptAdviceRequest complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="MarkReceiptAdviceRequest">
* <complexContent>
* <extension base="{http://schemas.i2i.com/ei/entity}REQUEST">
* <sequence>
* <element name="MARK">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="RECEIPTADVICEINFO" type="{http://schemas.i2i.com/ei/wsdl}RECEIPTADVICEINFO" maxOccurs="unbounded"/>
* </sequence>
* <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MarkReceiptAdviceRequest", propOrder = {
"mark"
})
public class MarkReceiptAdviceRequest
extends REQUEST
{
@XmlElement(name = "MARK", required = true)
protected MarkReceiptAdviceRequest.MARK mark;
/**
* Gets the value of the mark property.
*
* @return
* possible object is
* {@link MarkReceiptAdviceRequest.MARK }
*
*/
public MarkReceiptAdviceRequest.MARK getMARK() {
return mark;
}
/**
* Sets the value of the mark property.
*
* @param value
* allowed object is
* {@link MarkReceiptAdviceRequest.MARK }
*
*/
public void setMARK(MarkReceiptAdviceRequest.MARK value) {
this.mark = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="RECEIPTADVICEINFO" type="{http://schemas.i2i.com/ei/wsdl}RECEIPTADVICEINFO" maxOccurs="unbounded"/>
* </sequence>
* <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"receiptadviceinfo"
})
public static class MARK {
@XmlElement(name = "RECEIPTADVICEINFO", required = true)
protected List<RECEIPTADVICEINFO> receiptadviceinfo;
@XmlAttribute(name = "value")
protected String value;
/**
* Gets the value of the receiptadviceinfo 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 receiptadviceinfo property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRECEIPTADVICEINFO().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link RECEIPTADVICEINFO }
*
*
*/
public List<RECEIPTADVICEINFO> getRECEIPTADVICEINFO() {
if (receiptadviceinfo == null) {
receiptadviceinfo = new ArrayList<RECEIPTADVICEINFO>();
}
return this.receiptadviceinfo;
}
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
}
}
| [
"sanuserdar@gmail.com"
] | sanuserdar@gmail.com |
59db580277c7045cd513e1edbead3bf742a4d82f | 24ec3e79ae0fb0c564e1a5cc971927e5fcd339a0 | /ProductCommunity/src/main/java/com/productcommunity/service/CommentsLikeService.java | a44cc01995f3355bec42a2817c534ebe9164b1f4 | [] | no_license | PrashukJain/Product-Communit-Website | 379a479dbbbb26526f2e9abfbf1154fb97d2cb79 | bbff0ea4716eedc6e22e71f3187fe80111c9952e | refs/heads/main | 2023-06-01T22:52:05.506192 | 2021-06-24T05:13:25 | 2021-06-24T05:13:25 | 379,809,486 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,350 | java | package com.productcommunity.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.productcommunity.model.CommentsLike;
import com.productcommunity.model.QuestionComments;
import com.productcommunity.model.User;
import com.productcommunity.repository.CommentsLikeRepository;
import com.productcommunity.repository.QuestionCommentRepository;
import com.productcommunity.repository.UserRepository;
@Service
public class CommentsLikeService {
@Autowired
private UserRepository userRepository;
@Autowired
private CommentsLikeRepository commentsLikeRepository;
@Autowired
private QuestionCommentRepository questionCommentRepository;
public long likeComment(CommentsLike like,String token) {
User user=userRepository.getUser(token);
String email=user.getEmail();
long commentId=like.getLikeCommentId();
String likeId=commentsLikeRepository.getCommentsLike(commentId, email);
if(likeId!=null) {
commentsLikeRepository.deleteById(Long.parseLong(likeId));
}
else {
like.setEmail(email);
like.setComment(questionCommentRepository.findById(commentId).get());
commentsLikeRepository.save(like);
}
QuestionComments comments=questionCommentRepository.findById(commentId).get();
return comments.getLike().size();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
cf0d414f4e899dda4b8371794210f0eb3ca9fe4c | 8efec8432cb2d9169af06c57b854e07cd7ddebed | /Unit5/FinalLab/CustomerMediumYard.java | 1a9adebd4b66ca0a20f9bac900b11b2277080077 | [] | no_license | abagali1/FoundationsCS | 30cb44d0d52c67171099752607c6521de1b9195c | 98cd216235064c7af9b53946a319e27dd28778c8 | refs/heads/master | 2022-01-07T23:58:08.446336 | 2019-06-24T04:28:23 | 2019-06-24T04:28:23 | 193,433,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | public class CustomerMediumYard implements Yard{
private String firstName, lastName;
private int size;
private double cost;
public CustomerMediumYard(String l, String f, int size){
firstName = f;
lastName = l;
this.size = size;
this.cost = (double)this.size * (double)0.004;
}
public double getCost(){
return cost;
}
public String getFirstName(){
return firstName;
}
public String getLastName(){
return lastName;
}
public String toString(){
return firstName + " " + lastName + " has a medium yard of size " + size + " and costs " + cost + " to mow.";
}
public int getSize(){
return size;
}
public int compareTo(Yard y){
if(getLastName().compareTo(y.getLastName()) > 0)
return 1;
else if(getLastName().compareTo(y.getLastName()) == 0)
return 0;
else
return -1;
}
} | [
"a.bagali815703@gmail.com"
] | a.bagali815703@gmail.com |
537075d1b545bfc877449d9d1c739f5bdaf6e946 | a0caa255f3dbe524437715adaee2094ac8eff9df | /src/main/java/p000/cbl.java | ac255468a7f693e9ee5f18616a1857809dd155f7 | [] | no_license | AndroidTVDeveloper/com.google.android.tvlauncher | 16526208b5b48fd48931b09ed702fe606fe7d694 | 0f959c41bbb5a93e981145f371afdec2b3e207bc | refs/heads/master | 2021-01-26T07:47:23.091351 | 2020-02-26T20:58:19 | 2020-02-26T20:58:19 | 243,363,961 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package p000;
/* renamed from: cbl */
/* compiled from: PG */
public final class cbl implements cbs, dgu {
/* renamed from: a */
public static final cbl f5217a = new cbl();
private cbl() {
}
/* renamed from: a */
public final void mo2623a(Throwable th) {
bog.m3834b("PrimesExecutors", "Background task failed", th, new Object[0]);
}
}
| [
"eliminater74@gmail.com"
] | eliminater74@gmail.com |
df79f57a9ae288c27eb4ed4a91964a345e097ee3 | 8725e84528834962630d2f591c87c7702711f592 | /validAnagram/ValidAnagram.java | 3b3e221e35f481b67869b95dc1bed14073c542a3 | [] | no_license | liuniandxx/leetcode | 4c3d088c5b8c4d9bbbeb747465c350780f7f28d3 | 11b411b1773394e969ebe4e8b5fef56993e97e43 | refs/heads/master | 2020-05-17T19:48:51.426568 | 2016-02-22T07:33:14 | 2016-02-22T07:33:14 | 38,061,692 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 922 | java | /**
* Created by liunian on 15-10-15.
*/
public class ValidAnagram {
public static boolean isAnagram(String s, String t) {
if(s == null && t == null) {
return true;
}
if(s == null || t == null) {
return false;
}
int lens = s.length();
int lent = t.length();
if(lens != lent) {
return false;
}
int[] cnts = new int[26];
int[] cntt = new int[26];
for(int i = 0; i < lens; i++) {
cnts[s.charAt(i) - 'a']++;
}
for(int i = 0; i < lent; i++) {
cntt[t.charAt(i) - 'a']++;
}
for(int i = 0; i < 26;i++) {
if(cnts[i] != cntt[i]) {
return false;
}
}
return true;
}
public static void main(String[] args) {
System.out.println(isAnagram("anagram", "nagaram"));
}
}
| [
"liuniandxx@163.com"
] | liuniandxx@163.com |
35156c3b052b84b807a92e932f95f0f4c66e355f | ad7d66d8f2349f65e61fc7bf6cd4455ad4b99001 | /src/main/java/com/his/dao/ChargeDao.java | a96721348eba9448a6cc08d2f8627363b48ee204 | [] | no_license | TaylorChyi/HIS | a96e8cdcfe73854884739e04e00cdb302268c6eb | 4514e4591873d5ceae29147043836d4a5f6218b7 | refs/heads/master | 2023-03-06T15:00:09.266505 | 2021-02-22T16:00:10 | 2021-02-22T16:00:10 | 341,255,178 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,963 | java | package com.his.dao;
import java.sql.Timestamp;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.his.entity.Receipt;
public interface ChargeDao
{
/**
* 添加挂号发票项目
* @param registerID
* @param price
* @param chargeID
* @param chargeType
* @return
*/
void addRegisterCharge(@Param("registerID")String registerID, @Param("receiptNumber") Integer receiptNumber, @Param("price") String price, @Param("currentTime") Timestamp currentTime, @Param("chargeID") String chargeID, @Param("chargeType") String chargeType, @Param("settlement") String settlement);
/**
* 生成一发票号在发票表中
* @return
*/
Map<String, Integer> createEmpty();
/**
* 插入一空项目发票项目
* @param chaID
* @param receiptNumber
*/
void insertEmpty(@Param("chaID")Integer chaID ,@Param("receiptNumber")Integer receiptNumber);
/**
* 修改发票项目的冲红发票内容
* @param registerID
* @param ItemType
* @param ItemID
* @param receiptNumber
*/
void modifyRefund(@Param("registerID")String registerID,@Param("ItemType")String ItemType,@Param("ItemID")String ItemID,@Param("receiptNumber")String receiptNumber);
/**
* 通过registerID查找
* @param registerID
* @return
*/
Receipt searchByRegisterID(@Param("registerID")String registerID,@Param("ItemType")String ItemType,@Param("ItemID")String ItemID);
/**
* 更改冲红发票的内容
* @param receiptNumber
* @param registerID
* @param itemID
* @param d
* @param itemType
* @param currentTime
* @param chargeID
* @param chargeType
* @param settlement
*/
void updateRefundInfo(@Param("receiptNumber") String receiptNumber, @Param("registerID") Integer registerID, @Param("itemID") Integer itemID,
@Param("price") double price, @Param("itemType") Integer itemType,
@Param("currentTime") Timestamp currentTime, @Param("chargeID") Integer chargeID,@Param("chargeType") Integer chargeType,@Param("settlement") Integer settlement);
/**
* 修改发票中drugItme项目
* @param receiptNumber
* @param itemID
* @param price
* @param currentTime
* @param chargeID
* @param chargeType
* @param caseID
*/
void updateDrugItem(@Param("receiptNumber") String receiptNumber,@Param("itemID") String itemID,@Param("price") String price,@Param("currentTime") Timestamp currentTime,@Param("chargeID") String chargeID,@Param("chargeType") String chargeType,@Param("caseID") String caseID);
/**
* 添加发票中drugItme项目
* @param receiptNumber
* @param itemID
* @param price
* @param currentTime
* @param chargeID
* @param chargeType
* @param caseID
*/
void addDrugItem(@Param("receiptNumber") String receiptNumber,@Param("itemID") String itemID,@Param("price") String price,@Param("currentTime") Timestamp currentTime,@Param("chargeID") String chargeID,@Param("chargeType") String chargeType,@Param("caseID") String caseID);
}
| [
"qity_66@outlook.com"
] | qity_66@outlook.com |
7b453b08371c639452d798063433cc936903e3e9 | ed4e155cbf7276fa51d6b830122318e79a34f694 | /src/main/java/chap16/Sample08.java | bc6e73e20faf876372eec9264d56bf4ae8b1f339 | [] | no_license | k06060212/breadBro | b90f10cc46c8f6861c64294e4ca327f9e66642eb | 5e76fadd984408f31e218cd94d36ff0c0eca4d4b | refs/heads/master | 2023-06-03T21:49:35.036051 | 2021-06-20T04:48:10 | 2021-06-20T04:48:10 | 362,500,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package chap16;
import java.util.function.Consumer;
public class Sample08 {
public static void main(String[] args) {
Consumer<String> c = x -> {
System.out.printf("%s는 1개의 매개변수는 있지만 반환할 자료형은 없습니다.", x.toUpperCase());
};
c.accept("Consumer");
}
}
| [
"k06060212@gmail.com"
] | k06060212@gmail.com |
98a960253bbee8f16259791601a9fb40c0fe91da | 65b05d1d65d396386f0d2b3bd5d6a0dcb020d3ce | /Main.java | 5b83a4b4165d3e0bfdc1090601b697f9f497eb96 | [] | no_license | Nobleemile117/Dog | dd41b3d48801b8ec23af6d3da9c98d0c806b33ee | 402d4a421138c845bc7dffecce1644d5581034eb | refs/heads/master | 2020-12-23T18:43:52.025282 | 2020-01-30T15:01:02 | 2020-01-30T15:01:02 | 237,236,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,149 | java |
import java.io.*;
public class Main{
public static void main(String []args){
File file=new File("archivo.csv");
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
int line=0;
while ((line = br.readLine()) != null)
System.out.println(line);
if(line>0){
string []params=line.split(",");
string nombre =params[0];
int age = Integer.parseint(params[1]);
Dog Dog =new Dog(age, name);
System.out.println(Dog.getname()+"otra cosa");
System.out.println(Dog.getname());
}
linenumber++;
}
public static void main1(String []args){
Owner German = new Owner(19, Gender.MALE, "German");
Owner Ow2= new Owner(20, Gender.FEMALE, "Ow2");
Owner Ow3= new Owner(25, Gender.FEMALE, "Ow3");
Owner Ow4= new Owner(38, Gender.FEMALE);
Dog Jacob= new Dog(6,Raza.PUG);
Dog D2= new Dog(6, Raza.BULL_DOG);
Dog D3= new Dog(6, Raza.BULL_DOG);
German.setdog(Jacob);
Ow2.setdog(D2);
Ow3.setdog(D3);
System.out.println(German.getname());
System.out.println(Jacob.getname());
System.out.println(Ow2.getname());
System.out.println(D2.getname());
System.out.println(Ow3.getname());
System.out.println(D3.getname());
}
} | [
"noble@DESKTOP-QG98LSK"
] | noble@DESKTOP-QG98LSK |
219a3dbc822d44637e89cde5e680eb94506d21f2 | 634fa3497f7de6f6c9df68a3034d0bf3da73bb5f | /src/main/java/com/lin/feng/sheng/session/RedisHttpSessionConfig.java | ffafcc428a38f42943d809b08352cd75a0854494 | [] | no_license | medivh11/springSessionDataRedis | 0042a68cbf02392dd0e99776e7e085584f11aa11 | bac3d18c6a7bd0e2002eff4d51201c00979aed81 | refs/heads/master | 2020-03-10T00:35:30.663292 | 2018-01-30T05:47:18 | 2018-01-30T05:47:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,218 | java | package com.lin.feng.sheng.session;
import java.io.Serializable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.session.data.redis.RedisFlushMode;
import org.springframework.session.data.redis.config.ConfigureRedisAction;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
@EnableRedisHttpSession(
maxInactiveIntervalInSeconds= 1800,
redisNamespace="icsSpringSession",
redisFlushMode=RedisFlushMode.ON_SAVE)
public class RedisHttpSessionConfig implements Serializable{
/**
*
*/
private static final long serialVersionUID = -3049060689971404123L;
//冒号后的值为没有配置文件时,制动装载的默认值
@Value("${redis.hostname:127.0.0.1}")
private String HostName;
@Value("${redis.port:6379}")
private int Port;
@Bean
public JedisConnectionFactory connectionFactory() {
JedisConnectionFactory connection = new JedisConnectionFactory();
connection.setPort(Port);
connection.setHostName(HostName);
return connection;
}
/**
*
* 因为我使用的是redis2.8+以下的版本,使用RedisHttpSessionConfiguration配置时。
* 会报错误:ERR Unsupported CONFIG parameter: notify-keyspace-events
* 是因为旧版本的redis不支持“键空间通知”功能,而RedisHttpSessionConfiguration默认是启动通知功能的
* 解决方法有:
* (1)install Redis 2.8+ on localhost and run it with the default port (6379)。
* (2)If you don't care about receiving events you can disable the keyspace notifications setup。
* 如本文件,配置ConfigureRedisAction的bean为不需要打开的模式。
* 另外一种方式是在xml中。
* <util:constant static-field="org.springframework.session.data.redis.config.ConfigureRedisAction.NO_OP"/>
*
*/
@Bean
public ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP;
}
}
| [
"lfsheng@CHR0KG2.99wuxian.com"
] | lfsheng@CHR0KG2.99wuxian.com |
048e04809920a888d0dc5a337ba8a85284b10df9 | 2d439de9edfcf772829ba023de1996d045308f9e | /appDataGenerate/src/com/test/controller/AccountCardAppService.java | e18183d3b2fb6b70ff08ae64c589affdbd2e65fe | [] | no_license | zcr1007391008/appDataGenerate | 68c414dab96190597960a6257d7941332a451e7c | 514ddbdf0b7c965c11fbde610baeb1c6857c84fa | refs/heads/master | 2021-01-10T01:43:38.998996 | 2015-11-26T06:21:58 | 2015-11-26T06:21:58 | 46,907,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,628 | java | package com.test.controller;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.test.model.AccountCard;
import com.test.sevices.AccountCardService;
import com.test.until.FileUploadtoTomcatUseBase64;
import com.test.until.GetFilePlace;
/**
* 用户卡相关操作
* @author zcr
*
*/
@Service
public class AccountCardAppService
{
//log4j日志
private final Logger log= Logger.getLogger(AccountCardAppService.class);
@Autowired
private AccountCardService accountCardService;
/**
* 添加会员卡
* @param font_picture 正面图片
* @param request
* @param back_picture 背面图片
* @return
*/
public String addAccountCard( MultipartFile font_picture,HttpServletRequest request,
MultipartFile back_picture,String account_id ,String card_id,String brand_id,String remark)
{
try {
System.out.println(null == font_picture);
System.out.println(null == back_picture);
System.out.println(font_picture.isEmpty());
String back_picture_url = null;
String font_picture_url = null;
if(null != back_picture && !back_picture.isEmpty())
{
//生成图片
back_picture_url = uploadPicture(back_picture,request,"accountPicture","picture.properties");
}
if(null != font_picture && !font_picture.isEmpty())
{
//生成图片
font_picture_url = uploadPicture(font_picture,request,"accountPicture","picture.properties");
}
System.out.println("account_id=" + account_id + ",card_id = " + card_id +",brand_id = " + brand_id + " , remark = " + remark) ;
accountCardService.insertAccountCard(account_id,card_id,brand_id,font_picture_url,back_picture_url,remark);
return "添加成功";
} catch (Exception e) {
e.printStackTrace();
return "添加失败";
}
}
/**
* 删除用户卡
* @param user_id 待删除用户卡id
* @return
*/
public String delteAccountCard(String user_id)
{
try
{
accountCardService.deleteAccountCardByUserId(user_id);
return "删除成功";
}
catch (Exception e)
{
e.printStackTrace();
return "删除失败";
}
}
/**
* 分页查找用户卡
* @param iCurrentPage 当天页数
* @param iPageSize 每页数据量
* @return 该页的数据
*/
public List<AccountCard> getAccountCardInPage(String iCurrentPage,String iPageSize)
{
for(AccountCard a : accountCardService.selectAccountCardInPage(iCurrentPage,iPageSize))
{
System.out.println(a);
}
return accountCardService.selectAccountCardInPage(iCurrentPage,iPageSize);
}
/**
* 更新用户卡,没有图片
* @param account_id
* @param user_id
* @param card_id
* @param brand_id
* @param remark
*/
public void updateAccountCardWithoutPicture(String account_id,String user_id,String card_id,String brand_id,String remark)
{
accountCardService.updateAccountCardByUserId(user_id,account_id, card_id, brand_id, remark);
System.out.println("更新");
}
/**
* 更改用户卡的图片
* @param font_picture
* @param request
* @param back_picture
*/
public void updateAccountCardPicture( MultipartFile font_picture,HttpServletRequest request,
MultipartFile back_picture,String user_id)
{
System.out.println( "user_id = "+ user_id);
Map<String,String> pictureUrlMap = accountCardService.selectAccountCardPictureUrl(user_id);
String fontPicture = "";
String backPicture = "";
if(null != font_picture && !font_picture.isEmpty())
{
System.out.println("Map = " + pictureUrlMap);
if(StringUtils.isNotBlank(pictureUrlMap.get("front_picture_url")))
{
boolean isSuccess = updatePicture(font_picture,request,"accountPicture","picture.properties",pictureUrlMap.get("front_picture_url"));
System.out.println(pictureUrlMap.get("front_picture_url"));
}
else
{
fontPicture = uploadPicture(font_picture,request,"accountPicture","picture.properties");
System.out.println("正面照片为空");
}
}
if(null != back_picture && !back_picture.isEmpty())
{
if(StringUtils.isNotBlank(pictureUrlMap.get("back_picture_url")))
{
boolean isSuccess = updatePicture(back_picture,request,"accountPicture","picture.properties",pictureUrlMap.get("back_picture_url"));
System.out.println(pictureUrlMap.get("back_picture_url"));
}
else
{
backPicture = uploadPicture(back_picture,request,"accountPicture","picture.properties");
System.out.println("背面照片为空");
}
}
Map map = new HashMap();
String sql = "update account_card set ";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sql += " last_edit_time=\""+ format.format(new Date()) +"\" ";
if(StringUtils.isNotBlank(fontPicture) || StringUtils.isNotBlank(backPicture))
{
if(StringUtils.isNotBlank(fontPicture))
{
sql += " ,front_picture_url = \"" + fontPicture +"\"";
}
if(StringUtils.isNotBlank(backPicture))
{
sql += " ,back_picture_url=\"" + backPicture +"\"";
}
}
sql += " where user_id= " + user_id ;
map.put("sql",sql);
accountCardService.updateAccountCardPicture(map);
}
/**
* 更新用户卡信息和图片
* @param font_picture
* @param request
* @param back_picture
* @param user_id
* @param account_id
* @param card_id
* @param brand_id
* @param remark
* @return
*/
public String updateAccountCardWithPictureByUserId(MultipartFile font_picture,HttpServletRequest request,
MultipartFile back_picture,String user_id,String account_id,String card_id,String brand_id,String remark)
{
String front_picture_url = "";
String back_picture_url = "";
Map<String,String> pictureUrlMap = accountCardService.selectAccountCardPictureUrl(user_id);
if(null != font_picture && !font_picture.isEmpty())
{
if(StringUtils.isNotBlank(pictureUrlMap.get("front_picture_url")))
{
boolean isSuccess = updatePicture(font_picture,request,"accountPicture","picture.properties",pictureUrlMap.get("front_picture_url"));
}
else
{
front_picture_url = uploadPicture(font_picture,request,"accountPicture","picture.properties");
System.out.println("正面照片为空");
}
}
if(null != back_picture && !back_picture.isEmpty())
{
if(StringUtils.isNotBlank(pictureUrlMap.get("back_picture_url")))
{
boolean isSuccess = updatePicture(back_picture,request,"accountPicture","picture.properties",pictureUrlMap.get("back_picture_url"));
}
else
{
back_picture_url = uploadPicture(back_picture,request,"accountPicture","picture.properties");
}
}
accountCardService.updateAccountCardWithPictureByUserId( user_id, account_id, card_id, brand_id, remark, front_picture_url, back_picture_url);
return "更新成功!";
}
/**
* 通过json格式数据添加品牌库(文件传输格式是base64)
* @param font_picture_json_str base64的正面图片
* @param request HttpServletRequest 对象,用来获取服务器tomcat的所在位置
* @param back_picture_json_str base64背面图片
* @param account_id
* @param card_id
* @param brand_id 品牌
* @param remark 备注
* @return
*/
public String addAccountCardUseJson(String font_picture_json_str,HttpServletRequest request,
String back_picture_json_str,String account_id ,String card_id,String brand_id,String remark)
{
String front_picture = null;
String back_picture = null;
String sql = "insert into account_card (";
String dataSql = "values ( ";
if(StringUtils.isNotBlank(font_picture_json_str))
{
sql += " front_picture_url,";
//上传图片
front_picture = FileUploadtoTomcatUseBase64.uploadPicture(request,"accountPicture","picture.properties",font_picture_json_str);
dataSql += "\"" + front_picture + "\",";
}
if(StringUtils.isNotBlank(back_picture_json_str))
{
sql += "back_picture_url,";
back_picture = FileUploadtoTomcatUseBase64.uploadPicture(request,"accountPicture","picture.properties",back_picture_json_str);
dataSql += "\"" + back_picture + "\",";
}
if(StringUtils.isNotBlank(account_id))
{
sql += "account_id,";
dataSql += account_id + ",";
}
if(StringUtils.isNotBlank(card_id))
{
sql += "card_id,";
dataSql += "\"" + card_id + "\",";
}
if(StringUtils.isNotBlank(brand_id))
{
sql += "brand_id,";
dataSql += brand_id +",";
}
if(StringUtils.isNotBlank(remark))
{
sql += "remark,";
dataSql += "\"" + remark + "\",";
}
sql += "last_edit_time,";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
dataSql += "\"" + format.format(now) + "\",";
sql += "add_dates) ";
dataSql += "\"" + format.format(now) + "\")";
sql += dataSql;
System.out.println("sql = " + sql);
Map<String,String> map = new HashMap<String,String>();
map.put("sql", sql);
accountCardService.addAccountCardUseJson(map);
return "添加成功";
}
/**
* 修改用户卡信息,图片传输过来的数据是base64数据,假如有数据不修改,则传入一个null即可。
* @param font_picture_str base64正面图片信息
* @param request
* @param back_picture_str base64背面图片信息
* @param user_id
* @param account_id
* @param card_id
* @param brand_id
* @param remark
* @return
*/
public String updateAccountCardWithPictureByUserIdUseJson(String font_picture_str,HttpServletRequest request,
String back_picture_str,String user_id,String account_id,String card_id,String brand_id,String remark)
{
try {
String front_picture_url = "";
String back_picture_url = "";
Map<String, String> pictureUrlMap = accountCardService
.selectAccountCardPictureUrl(user_id);
if (StringUtils.isNotBlank(font_picture_str)) {
if (StringUtils.isNotBlank(pictureUrlMap
.get("front_picture_url"))) {
//更新图片
boolean isSuccess = FileUploadtoTomcatUseBase64
.updatePicture(request, "accountPicture",
"picture.properties",
pictureUrlMap.get("front_picture_url"),
font_picture_str);
} else {
front_picture_url = FileUploadtoTomcatUseBase64
.uploadPicture(request, "accountPicture",
"picture.properties", font_picture_str);
System.out.println("正面照片为空");
}
}
if (StringUtils.isNotBlank(back_picture_str)) {
if (StringUtils.isNotBlank(pictureUrlMap
.get("back_picture_url"))) {
boolean isSuccess = FileUploadtoTomcatUseBase64
.updatePicture(request, "accountPicture",
"picture.properties",
pictureUrlMap.get("back_picture_url"),
back_picture_str);
} else {
back_picture_url = FileUploadtoTomcatUseBase64
.uploadPicture(request, "accountPicture",
"picture.properties", back_picture_str);
}
}
accountCardService.updateAccountCardWithPictureByUserId(user_id,
account_id, card_id, brand_id, remark, front_picture_url,
back_picture_url);
} catch (Exception e) {
return "更新失败!";
}
return "更新成功!";
}
/**
* 上传图片(提交表单,文件传输的是MultipartFile对象,上面实现了base64文件的方式)
* @param editfile 添加的图片
* @param request
* @return 文件存储的相对路径
*/
public String uploadPicture(@RequestParam(value = "file", required = false)MultipartFile editfile,HttpServletRequest request,String filePathName,String fileProperties)
{
System.out.println("222");
String pathSavePath = new GetFilePlace().getFileDirFromProperties(filePathName,fileProperties);
String path = request.getSession().getServletContext().getRealPath(pathSavePath);
System.out.println("path = "+path);
System.out.println("pathSavePath = "+ pathSavePath);
UUID uuid = UUID.randomUUID(); //全球唯一编码
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String fileName = format.format(new Date()) + uuid.toString() + ".jpg";
String logo_url = pathSavePath + "/" + fileName;
File targetFile = new File(path, fileName);
if(!targetFile.exists()){
targetFile.mkdirs();
}
//保存
try {
System.out.println("进入添加图片");
editfile.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(fileName);
return logo_url;
}
/**
* 更改图片(需要提交表单,文件传输的是MultipartFile对象,上面实现了base64文件的方式)
* @param editfile 更改的图片
* @param request
* @param model
* @return 更新是否成功
*/
public boolean updatePicture(MultipartFile editfile,HttpServletRequest request,String filePathName,String fileProperties,String oldFileName)
{
System.out.println("222");
String pathSavePath = new GetFilePlace().getFileDirFromProperties(filePathName,fileProperties);
String path = request.getSession().getServletContext().getRealPath(pathSavePath);
System.out.println("path = "+path);
System.out.println("pathSavePath = "+ pathSavePath);
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
System.out.println(oldFileName.lastIndexOf("/") );
String fileName = "";
if(-1 == oldFileName.lastIndexOf("/"))
{
fileName = oldFileName;
}
else
{
fileName = oldFileName.substring(oldFileName.lastIndexOf("/"));
}
System.out.println("更新的图片名称:" + fileName);
File targetFile = new File(path, fileName);
if(!targetFile.exists()){
targetFile.mkdirs();
}
//保存
try {
System.out.println("进入添加图片");
editfile.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
}
| [
"1007391008@qq.com"
] | 1007391008@qq.com |
f34f02ed3cc585d761765181cc352c7413a5e48f | 66bde34f2af40afc55d3c7231cdf9a1da44a95e2 | /TimePikerDailog/app/src/main/java/com/ultron/sahilpratap/timepikerdailog/MainActivity.java | 22336c9c7683fba7ab58da195a7fa0fc0d81253b | [] | no_license | sahilpratap/resources_ASD | b81e373055eef2159cb1ba48979afa6bb7e7576c | d89c49128d7caeaa100f048b91cdf73456a480c7 | refs/heads/master | 2020-03-23T19:23:15.909466 | 2018-07-23T07:04:32 | 2018-07-23T07:04:32 | 141,100,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,315 | java | package com.ultron.sahilpratap.timepikerdailog;
import android.app.TimePickerDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TimePicker;
import java.util.Calendar;
public class MainActivity extends AppCompatActivity {
EditText e1;
int hr;
int min;
int sec;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
e1 = findViewById(R.id.editText);
e1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar calendar = Calendar.getInstance();
hr = calendar.get(Calendar.HOUR);
min = calendar.get(Calendar.MINUTE);
sec = calendar.get(Calendar.SECOND);
new TimePickerDialog(MainActivity.this,time,hr,min,false).show();
}
});
}
TimePickerDialog.OnTimeSetListener time = new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
e1.setText(""+hourOfDay+" : "+minute);
}
};
}
| [
"sahilpratap7200@gmail.com"
] | sahilpratap7200@gmail.com |
c20960c507ad156c2ec9b109d7abcd17ea998f35 | feaa6cd290721bd5d65c2c779b6a342c56b4bccf | /src/main/java/com/code/game/api/GamePlayAreaApi.java | 05883f315196b31dc9f513d850a56a5692211cfa | [] | no_license | asifu9/test | be50d9724fd8e3aea65b2928c7aa5ea863a655d2 | 4cba9cb653263679a8eda8b7dfe97f2760f85637 | refs/heads/master | 2022-05-30T20:30:10.172303 | 2020-07-26T17:39:28 | 2020-07-26T17:39:28 | 168,980,041 | 0 | 0 | null | 2022-05-20T20:55:03 | 2019-02-03T18:46:02 | Java | UTF-8 | Java | false | false | 3,357 | java | package com.code.game.api;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.code.game.entity.PlayArea;
import com.code.game.enums.GameType;
import com.code.game.service.PlayAreaService;
/**
* Rest Controller class to create, update and list Play Area.
*/
@RestController
@RequestMapping(value="/play-area")
public class GamePlayAreaApi {
private static final Logger LOGGER = LoggerFactory.getLogger(GamePlayAreaApi.class);
/** The play area service. */
@Autowired
private PlayAreaService playAreaService;
/**
* API to create the new Play Area the.
*
* @param playArea the game
* @return the game map
* @throws Exception the exception
*/
@PostMapping(value="/",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
private PlayArea create(@RequestBody PlayArea playArea) throws Exception{
LOGGER.debug("creating new game Play area ");
return playAreaService.create(playArea);
}
/**
* API to Update play area.
*
* @param gameMapId the game map id
* @param gameMap the game map
* @return the game map
* @throws Exception the exception
*/
@PutMapping(value="/{playAreaId}",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
private PlayArea update(
@PathVariable(value="playAreaId") int playAreaId,
@RequestBody PlayArea playArea) throws Exception{
return playAreaService.update(playAreaId,playArea);
}
/**
* Find by play area for given game type
*
* @param gameType the game type
* @return the list
* @throws Exception the exception
*/
@GetMapping(value="/type/{gameType}",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
private List<PlayArea> findByGameTYpe(@PathVariable("gameType") GameType gameType) throws Exception{
return playAreaService.findByGameType(gameType);
}
/**
* Find by play area for given game type
*
* @param gameType the game type
* @return the list
* @throws Exception the exception
*/
@GetMapping(value="/{id}",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
private PlayArea findById(@PathVariable("id") int id) throws Exception{
return playAreaService.findById(id);
}
/**
* Find by play area for given game type
*
* @param gameType the game type
* @return the list
* @throws Exception the exception
*/
@DeleteMapping(value="/{id}",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
private void deleteById(@PathVariable("id") int id) throws Exception{
playAreaService.delete(id);
}
/**
* API to list all play area.
*
* @return the list
* @throws Exception the exception
*/
@GetMapping(value="/",produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
private List<PlayArea> findAll() throws Exception{
return playAreaService.findAll();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
5603a586d3b5b5c8deaeaf96db7ab94fa4598c94 | 90f17cd659cc96c8fff1d5cfd893cbbe18b1240f | /src/main/java/com/google/gson/FieldAttributes.java | c3583c4fd057f5f33572b12d93567abbccdc09e2 | [] | no_license | redpicasso/fluffy-octo-robot | c9b98d2e8745805edc8ddb92e8afc1788ceadd08 | b2b62d7344da65af7e35068f40d6aae0cd0835a6 | refs/heads/master | 2022-11-15T14:43:37.515136 | 2020-07-01T22:19:16 | 2020-07-01T22:19:16 | 276,492,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,346 | java | package com.google.gson;
import com.google.gson.internal.C$Gson$Preconditions;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collection;
public final class FieldAttributes {
private final Field field;
public FieldAttributes(Field field) {
C$Gson$Preconditions.checkNotNull(field);
this.field = field;
}
public Class<?> getDeclaringClass() {
return this.field.getDeclaringClass();
}
public String getName() {
return this.field.getName();
}
public Type getDeclaredType() {
return this.field.getGenericType();
}
public Class<?> getDeclaredClass() {
return this.field.getType();
}
public <T extends Annotation> T getAnnotation(Class<T> cls) {
return this.field.getAnnotation(cls);
}
public Collection<Annotation> getAnnotations() {
return Arrays.asList(this.field.getAnnotations());
}
public boolean hasModifier(int i) {
return (i & this.field.getModifiers()) != 0;
}
Object get(Object obj) throws IllegalAccessException {
return this.field.get(obj);
}
boolean isSynthetic() {
return this.field.isSynthetic();
}
}
| [
"aaron@goodreturn.org"
] | aaron@goodreturn.org |
166be0c2705e0426054693af488f84c8f6b8d9c4 | 6992cef1d8dec175490d554f3a1d8cb86cd44830 | /Java/JEE/EJB/ExampleJ2EE/src/ejb/entity/ProductsToBuyFromCompaniesLocalBusiness.java | 8e8befe7320e2cbe743fc8290269f3d0088d91a1 | [] | no_license | hamaenpaa/own_code_examples | efd49b62bfc96d1dec15914a529661d3ebbe448d | 202eea76a37f305dcbc5a792c9b613fc43ca8477 | refs/heads/master | 2021-01-17T14:51:03.861478 | 2019-05-06T09:28:23 | 2019-05-06T09:28:23 | 44,305,640 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java |
package ejb.entity;
/**
* This is the business interface for ProductsToBuyFromCompanies enterprise bean.
*/
public interface ProductsToBuyFromCompaniesLocalBusiness {
Integer getKey();
}
| [
"harri.maenpaa@gmail.com"
] | harri.maenpaa@gmail.com |
39564490f3b0f56b4a003c6336d0beae4a1d98ee | 9f3e02d061ea0f8cb9f3bf9345be575483025d6d | /polyominos/Main.java | ddb8acbee9505994948df8c40b23f71be4f0cc11 | [] | no_license | chomman/logicpuzzles | 16338321639533cc3fbd91def3d2e2419f34a582 | c3659a26a607dc68554a7784076821b561ad3328 | refs/heads/master | 2021-01-11T05:49:53.479721 | 2016-01-02T16:40:10 | 2016-01-02T16:40:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,249 | java | package be.samwise.logicpuzzles.polyominos;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
public class Main {
static class Block {
int size;
private int[] rows, cols;
// ctor for the rootblock
public Block() {
this(1);
this.rows[0] = this.cols[0] = 1;
}
public Block(int size) {
this.size = size;
this.rows = new int[size];
this.cols = new int[size];
}
private int nbMask(int n) {
if (n <= 0)
return 2;
return 5 << (n - 1);
}
public boolean set(int r, int c) {
if ((rows[r] & (1 << c)) != 0)
return false; // is already set
if ((rows[r] & nbMask(c)) == 0 && (cols[c] & nbMask(r)) == 0) {
return false; // no nbs are set
}
rows[r] |= 1 << c;
cols[c] |= 1 << r;
return true;
}
public void unset(int r, int c) {
rows[r] ^= 1 << c;
cols[c] ^= 1 << r;
}
public Block rotate() {
Block next = new Block(this.size);
for (int i = 0; i < size; i++) {
next.rows[i] = rev(this.cols[i], this.size);
next.cols[i] = this.rows[size - (1 + i)];
}
while (next.shiftLeft())
;
while (next.shiftUp())
;
return next;
}
private static int rev(int n, int toShift) {
int r = 0;
while (n > 0) {
r <<= 1;
r |= (n & 1);
n >>= 1;
toShift--;
}
if (toShift > 0) {
r <<= (toShift);
}
return r;
}
private void copyFrom(Block b) {
for (int i = 0; i < b.size; i++) {
this.rows[i] = b.rows[i];
this.cols[i] = b.cols[i];
}
}
private boolean shiftLeft() {
if (this.cols[0] != 0) {
return false;
}
for (int i = 1; i < size; i++) {
this.cols[i - 1] = this.cols[i];
}
this.cols[size - 1] = 0;
for (int i = 0; i < size; i++) {
this.rows[i] >>= 1;
}
return true;
}
private boolean shiftUp() {
if (this.rows[0] != 0) {
return false;
}
for (int i = 1; i < size; i++) {
this.rows[i - 1] = this.rows[i];
}
this.rows[size - 1] = 0;
for (int i = 0; i < size; i++) {
this.cols[i] >>= 1;
}
return true;
}
private boolean shiftRight() {
if (this.cols[size - 1] != 0) {
return false;
}
for (int i = size - 1; i > 0; i--) {
this.cols[i] = this.cols[i - 1];
}
this.cols[0] = 0;
for (int i = 0; i < size; i++) {
this.rows[i] <<= 1;
this.rows[i] &= (1 << size) - 1;
}
return true;
}
private boolean shiftDown() {
if (this.rows[size - 1] != 0) {
return false;
}
for (int i = size - 1; i > 0; i--) {
this.rows[i] = this.rows[i - 1];
}
this.rows[0] = 0;
for (int i = 0; i < size; i++) {
this.cols[i] <<= 1;
this.cols[i] &= (1 << size) - 1;
}
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < size; i++) {
if(rows[i]==0)break;
int n = rows[i];
while (n != 0) {
if ((n & 1) == 1) {
sb.append('X');
} else {
sb.append(' ');
}
n >>= 1;
}
sb.append('\n');
}
return sb.toString();
}
@Override
public int hashCode() {
// assumption => fully shifted to the left/top
return Arrays.hashCode(this.rows);
}
@Override
public boolean equals(Object obj) {
Block b = (Block) obj;
// assumption => fully shifted to the left/top
return this.size == b.size && Arrays.equals(this.rows, b.rows);
}
}
static class Solver {
private static final int NORMAL = 0, DOWN = 1, RIGHT = 2;
private int currentSize;
private HashSet<Block> set;
private LinkedList<Block> list, next;
private Block toAdd = null, cur = null;
private int mode;
public Solver() {
list = new LinkedList<>();
set = new HashSet<>();
list.add(new Block());
currentSize = 1;
mode = NORMAL;
}
public int getCurrentSize(){
return currentSize;
}
public void solveNextSize() {
this.currentSize++;
next = new LinkedList<>();
while (!list.isEmpty()) {
cur = list.pollFirst();
addLeft();
addTop();
addBetween();
}
set.clear();
list = next;
}
private void resetToAdd() {
toAdd = new Block(currentSize);
if (cur != null) {
toAdd.copyFrom(cur);
}
if(mode == RIGHT){
toAdd.shiftRight();
}else if(mode == DOWN){
toAdd.shiftDown();
}
}
private boolean add(int r, int c) {
if (toAdd.set(r, c)) {
if (set.add(toAdd)) {
next.add(toAdd);
// add all rotations to set
toAdd = toAdd.rotate();
set.add(toAdd);
toAdd = toAdd.rotate();
set.add(toAdd);
toAdd = toAdd.rotate();
set.add(toAdd);
// reset toAdd
resetToAdd();
return true;
} else {
toAdd.unset(r, c);
}
}
return false;
}
private void addLeft() {
mode = RIGHT;
resetToAdd();
for (int r = 0; r < currentSize; r++) {
add(r, 0);
}
}
private void addTop() {
mode = DOWN;
resetToAdd();
for (int c = 0; c < currentSize; c++) {
add(0, c);
}
}
private void addBetween() {
mode = NORMAL;
resetToAdd();
for (int r = 0; r < currentSize; r++) {
for (int c = 0; c < currentSize; c++) {
add(r,c);
}
}
}
@Override
public String toString() {
return "There are "+this.list.size()+" blocks of size "+currentSize;
}
public String allBlocks(){
StringBuilder sb = new StringBuilder();
for(Block b:list){
sb.append(b);
sb.append("-------------\n");
}
return sb.toString();
}
}
// polyominos
public static void main(String[] args) throws Exception {
final InputReader in = new InputReader(System.in);
final OutputWriter out = new OutputWriter(System.out);
// READ/ init
int N = in.readInt();
long startTime = System.currentTimeMillis();
Solver solver = new Solver();
// SOLVE
while (solver.currentSize < N) {
solver.solveNextSize();
}
// print solutions
out.printLine(solver);
//out.printLine(solver.allBlocks());
System.err.println("Time: " + (System.currentTimeMillis() - startTime) + "ms");
out.close();
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public byte readByte() {
int c = read();
while (isSpaceChar(c))
c = read();
byte res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res;
}
public int readInt() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void print(Object... objects) {
for (int i = 0; i < objects.length; i++) {
if (i != 0)
writer.print(' ');
writer.print(objects[i]);
}
}
public void printLine(Object... objects) {
print(objects);
writer.println();
}
public void close() {
writer.close();
}
}
} | [
"samsegers@hotmail.com"
] | samsegers@hotmail.com |
48ef3ff86346b937500f15dcaa68a60c6be39b4f | 0f553b68157b5f34c879d11ff4cf47e1e1670bab | /src/main/java/com/yxj/car/api/v1/dao/CarDao.java | 1d206174a2c62cf813dbb44df538a984250f2dc7 | [] | no_license | congbuzhuangsha/car | a77da2215e17d69d077e6e8a54b6732be59b509f | 45f85dad886e7d561301a9763c9b76ce5f7ed611 | refs/heads/master | 2021-04-17T16:56:32.411386 | 2020-03-23T14:40:03 | 2020-03-23T14:40:03 | 249,460,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 901 | java | package com.yxj.car.api.v1.dao;
import com.yxj.car.api.v1.pojo.Car;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
* @Auther: yangxiaojie
* @Date: 2020/3/22
* @version: 1.0
*/
@Mapper
public interface CarDao {
@Select("select * from carMessage")
List<Car> findAll();
@Select("select * from carMessage where id = #{id}")
Car findById(int id);
@Select("select * from carMessage where carName = #{carName}")
List<Car> findByCarName(String carName);
@Delete("delete from carMessage where id = #{id}")
void deleteById(int id);
@Update("update carMessage set carName=#{carName},carType=#{carType},price=#{price},carSeries=#{carSeries} where id = #{id}")
void updateById( Car car);
@Insert("insert into carMessage(carName,carType,price,carSeries) values(#{carName},#{carType},#{price},#{carSeries})")
void insertCar(Car car);
}
| [
"694306397@qq.con"
] | 694306397@qq.con |
5dd21894991dca282356ae08a252c5eab85a054e | 46bbed08ec56657a5f494372ad1329beef664660 | /src/main/java/org/testng/internal/ExpectedExceptionsHolder.java | 96b2b64085011e43e283147b11e7e9f90c907b8d | [
"Apache-2.0"
] | permissive | tengzhexiao/testng | b65cfcb7584020941854d0720c2b794693e60372 | 22d926baab879baaf2e3f9a7220027afa9fff3ae | refs/heads/master | 2020-07-10T17:37:40.141815 | 2018-02-03T07:00:42 | 2018-02-03T07:00:42 | 74,011,981 | 0 | 0 | null | 2016-11-17T09:34:57 | 2016-11-17T09:34:56 | null | UTF-8 | Java | false | false | 3,387 | java | package org.testng.internal;
import org.testng.IExpectedExceptionsHolder;
import org.testng.ITestNGMethod;
import org.testng.TestException;
import org.testng.annotations.IExpectedExceptionsAnnotation;
import org.testng.annotations.ITestAnnotation;
import org.testng.internal.annotations.IAnnotationFinder;
import java.util.Arrays;
public class ExpectedExceptionsHolder {
protected final IAnnotationFinder finder;
protected final ITestNGMethod method;
private final Class<?>[] expectedClasses;
private final IExpectedExceptionsHolder holder;
protected ExpectedExceptionsHolder(IAnnotationFinder finder, ITestNGMethod method, IExpectedExceptionsHolder holder) {
this.finder = finder;
this.method = method;
expectedClasses = findExpectedClasses(finder, method);
this.holder = holder;
}
private static Class<?>[] findExpectedClasses(IAnnotationFinder finder, ITestNGMethod method) {
IExpectedExceptionsAnnotation expectedExceptions =
finder.findAnnotation(method, IExpectedExceptionsAnnotation.class);
// Old syntax
if (expectedExceptions != null) {
return expectedExceptions.getValue();
}
// New syntax
ITestAnnotation testAnnotation = finder.findAnnotation(method, ITestAnnotation.class);
if (testAnnotation != null) {
return testAnnotation.getExpectedExceptions();
}
return new Class<?>[0];
}
/**
* @param ite The exception that was just thrown
* @return true if the exception that was just thrown is part of the
* expected exceptions
*/
public boolean isExpectedException(Throwable ite) {
if (!hasExpectedClasses()) {
return false;
}
// TestException is the wrapper exception that TestNG will be throwing when an exception was
// expected but not thrown
if (ite.getClass() == TestException.class) {
return false;
}
Class<?> realExceptionClass= ite.getClass();
for (Class<?> exception : expectedClasses) {
if (exception.isAssignableFrom(realExceptionClass) && holder.isThrowableMatching(ite)) {
return true;
}
}
return false;
}
public Throwable wrongException(Throwable ite) {
if (!hasExpectedClasses()) {
return ite;
}
if (holder.isThrowableMatching(ite)) {
return new TestException("Expected exception of " +
getExpectedExceptionsPluralize()
+ " but got " + ite, ite);
} else {
return new TestException(holder.getWrongExceptionMessage(ite), ite);
}
}
public TestException noException(ITestNGMethod testMethod) {
if (!hasExpectedClasses()) {
return null;
}
return new TestException("Method " + testMethod + " should have thrown an exception of "
+ getExpectedExceptionsPluralize());
}
private boolean hasExpectedClasses() {
return expectedClasses != null && expectedClasses.length > 0;
}
private String getExpectedExceptionsPluralize() {
StringBuilder sb = new StringBuilder();
if (expectedClasses.length > 1) {
sb.append("any of types ");
sb.append(Arrays.toString(expectedClasses));
} else {
sb.append("type ");
sb.append(expectedClasses[0]);
}
return sb.toString();
}
}
| [
"dvb-c@qq.com"
] | dvb-c@qq.com |
8c514065e9aa8d79c43d0ae2ae122a35c7077302 | a99cb524edf670ad7ef4db733859cd09ef84eedd | /pss/easyBuyNet/src/com/ch715/entity/Order.java | b09fc79363275b46d7c4c510451f676f264e627c | [] | no_license | caicainb/easybuynet | 3b859bb18e4e839090c27fb60914e68c645e9a2b | fe61d9695de52931bd1a45ebee0a436c6f09a200 | refs/heads/master | 2021-07-21T04:53:03.383607 | 2017-10-31T02:10:45 | 2017-10-31T02:10:45 | 108,787,193 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,211 | java | package com.ch715.entity;
import java.io.Serializable;
import java.util.Date;
public class Order implements Serializable {
private int id;
private int userId;
private String loginName;
private String userAddress;
private Date createTime;
private float cost;
private int status;
private int type;
private String serialNumber;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getUserAddress() {
return userAddress;
}
public void setUserAddress(String userAddress) {
this.userAddress = userAddress;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public float getCost() {
return cost;
}
public void setCost(float cost) {
this.cost = cost;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public Order() {
super();
// TODO Auto-generated constructor stub
}
public Order(int id, int userId, String loginName, String userAddress,
Date createTime, float cost, int status, int type,
String serialNumber) {
super();
this.id = id;
this.userId = userId;
this.loginName = loginName;
this.userAddress = userAddress;
this.createTime = createTime;
this.cost = cost;
this.status = status;
this.type = type;
this.serialNumber = serialNumber;
}
@Override
public String toString() {
return "Order [id=" + id + ", userId=" + userId + ", loginName="
+ loginName + ", userAddress=" + userAddress + ", createTime="
+ createTime + ", cost=" + cost + ", status=" + status
+ ", type=" + type + ", serialNumber=" + serialNumber + "]";
}
}
| [
"1019254779@qq.com"
] | 1019254779@qq.com |
38dad2b12c8e02dcf4c3c98e8fbcaef556569ff2 | 68a4146f32bdec356bdae7cfcf7a76d24d354505 | /control/src/main/java/com/ventura/control/domain/control/Moneda.java | 11370a057caa26bba4faf06c931cc8f04fbd649d | [] | no_license | amartinezh/control | b95ca13249c24eb66bfe3a047ccd4ac9ea20bb1c | 241e5ff79afec624d648b93a39cddfb9910fd62d | refs/heads/master | 2021-01-14T08:24:09.922886 | 2016-12-16T18:29:01 | 2016-12-16T18:29:01 | 30,995,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,819 | java | package com.ventura.control.domain.control;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.validator.constraints.NotEmpty;
@Entity
@Table(name="moneda", schema="admin")
public class Moneda implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 3958570611606289360L;
@Id
@Column(name = "moneda_id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="admin.moneda_moneda_id_seq")
@SequenceGenerator(name="admin.moneda_moneda_id_seq", sequenceName="admin.moneda_moneda_id_seq", allocationSize=1)
private int moneda_id;
@NotEmpty
@Column(name = "descripcion")
private String descripcion;
@Column(name = "estado")
private String estado;
public Moneda() {
// TODO Auto-generated constructor stub
}
public Moneda(String descripcion) {
this.descripcion = descripcion;
}
public Moneda(int moneda_id) {
this.moneda_id = moneda_id;
}
public Moneda(int moneda_id, String descripcion) {
this.moneda_id = moneda_id;
this.descripcion = descripcion;
}
public Moneda(int moneda_id, String descripcion, String estado) {
this.moneda_id = moneda_id;
this.descripcion = descripcion;
this.estado = estado;
}
public int getMoneda_id() {
return moneda_id;
}
public String getDescripcion() {
return descripcion;
}
public String getEstado() {
return estado;
}
public void setMoneda_id(int moneda_id) {
this.moneda_id = moneda_id;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public void setEstado(String estado) {
this.estado = estado;
}
}
| [
"amartinezh@gmail.com"
] | amartinezh@gmail.com |
0728d96d2515f0aed343916c1c9bf7de75ae6e68 | e2431df95d8c72b58948f5f6a4f222b912927ba5 | /src/IC/lir/RunTimeChecks.java | 6063571df992a682c4f0c58f5bbfbec49fcec193 | [] | no_license | sharon-rozinsky/ICCompiler | 3aef00c89085f8a6d43c1074c9de43b2a5db83d6 | 2e6323fe168df9d07d968a95e24dfd4cb4873dce | refs/heads/master | 2021-01-20T21:00:31.909027 | 2015-03-14T13:03:03 | 2015-03-14T13:03:03 | 26,328,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package IC.lir;
public class RunTimeChecks {
public static String addCheckNullRefInstruction(String reg) {
return "StaticCall __checkNullRef(a=" + reg + "),Rdummy\n";
}
public static String addCheckArrayAccessInstruction(String arr, String index) {
return "StaticCall __checkArrayAccess(a=" + arr + ", i=" + index + "),Rdummy\n";
}
public static String addCheckSizeInstruction(String size) {
return "StaticCall __checkSize(n=" + size + "),Rdummy\n";
}
public static String addCheckZeroInstruction(String reg) {
return "StaticCall __checkZero(b=" + reg + "),Rdummy\n";
}
}
| [
"Rozinsky"
] | Rozinsky |
b692c987fb47f6b67c647e9d854bcbf93fb8a424 | 76f1f55817b183499b5614e40867afe119970452 | /src/main/java/com/lin945/makefriend/dao/UsersMapper.java | 6b7be501f38b437fa297abafd8188985c6b66ff4 | [] | no_license | lin945/makefriend | 0ef95e0bfda7c31ce01f0a37d9bad07e4d33d724 | 64aa91d0978ae2f442b6a6d681a2809f8326dbd3 | refs/heads/master | 2023-03-21T05:19:54.714956 | 2021-03-08T12:30:25 | 2021-03-08T12:30:25 | 345,648,642 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.lin945.makefriend.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lin945.makefriend.pojo.model.Users;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author lin945
* @since 2020-11-12
*/
@Repository
public interface UsersMapper extends BaseMapper<Users> {
}
| [
"2315554550@qq.com"
] | 2315554550@qq.com |
327b4ecd16bb0e1202cdea7f3ff26d1e0f686755 | b7889ff394fc94a1d5c078653cf112d00c29c488 | /IW_Repo/Lab3/WebSocketsToDoClient/src/main/java/websocket/servlet/ToDoServlet.java | 76d5a995109f8958f35cb976165573bf855abfe6 | [] | no_license | gBarrerasSanz/IW_Repo | 6a96ac0b927cf6688b5ef97338d75d5cdf0221f6 | 5011e0049795824dcfc2466e9ae86c3aae3bdb39 | refs/heads/master | 2021-01-22T22:49:52.400684 | 2015-03-05T19:13:23 | 2015-03-05T19:13:23 | 25,319,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,777 | java | package websocket.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
@WebServlet(urlPatterns = { "/add","/update","/remove","/list"})
public class ToDoServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String opt = req.getServletPath();
RequestDispatcher disp = null;
switch(opt.substring(1)){
case "add":
disp = req.getRequestDispatcher("actiondone.jsp");
req.setAttribute("operation", "ADD_ELEM");
req.setAttribute("task", req.getParameter("task"));
req.setAttribute("context", req.getParameter("context"));
req.setAttribute("project", req.getParameter("project"));
req.setAttribute("priority", req.getParameter("priority"));
disp.forward(req, resp);
break;
case "update":
disp = req.getRequestDispatcher("actiondone.jsp");
req.setAttribute("operation", "UPDATE_ELEM");
req.setAttribute("id", req.getParameter("id"));
req.setAttribute("task", req.getParameter("task"));
req.setAttribute("context", req.getParameter("context"));
req.setAttribute("project", req.getParameter("project"));
req.setAttribute("priority", req.getParameter("priority"));
disp.forward(req, resp);
break;
case "remove":
disp = req.getRequestDispatcher("actiondone.jsp");
req.setAttribute("operation", "DEL_ELEM");
req.setAttribute("id", req.getParameter("id"));
disp.forward(req, resp);
break;
case "list":
disp = req.getRequestDispatcher("actiondone.jsp");
req.setAttribute("operation", "GET_LIST");
disp.forward(req, resp);
// resp.setContentType("text/html");
// PrintWriter out = resp.getWriter();
// String result = ClientBuilder.newClient()
// .target("http://localhost:8082/todo")
// .request("text/plain").get().readEntity(String.class);
//
// out.println("<html><head><title>Hello World!</title></head>"
// + "<body><h1>"+ result +"</h1></body></html>");
default:
break;
// RequestDispatcher disp = req.getRequestDispatcher("actiondone.jsp");
// req.setAttribute("action", "None");
// disp.forward(req, resp);
}
}
// private void dbg(HttpServletResponse resp) {
// try{
// resp.setContentType("text/html");
// PrintWriter out = resp.getWriter();
// out.println("<html><head><title>Hello World!</title></head>"
// + "<body><h1>Hello World!</h1></body></html>");
// }
// catch(IOException ex){
// ex.printStackTrace();
// }
//
// }
}
| [
"gbarreras93@gmail.com"
] | gbarreras93@gmail.com |
439d11c4ccd56bada02d9d1fed77a80b2e60b70b | a33aac97878b2cb15677be26e308cbc46e2862d2 | /data/libgdx/ByteArray_get.java | 76af6b5f7ce6af50e46fbf26c1f1544c0472971e | [] | no_license | GabeOchieng/ggnn.tensorflow | f5d7d0bca52258336fc12c9de6ae38223f28f786 | 7c62c0e8427bea6c8bec2cebf157b6f1ea70a213 | refs/heads/master | 2022-05-30T11:17:42.278048 | 2020-05-02T11:33:31 | 2020-05-02T11:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | public byte get(int index) {
if (index >= size)
throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size);
return items[index];
}
| [
"bdqnghi@gmail.com"
] | bdqnghi@gmail.com |
10237b297788ceede50ed6cdeca0b1976c1a4847 | 91eeaa31b696672a68f316d8143d450b9f2bbed9 | /src/main/java/wmw/i18n/Nation.java | c7c527a250863587786707cdbc0cefc0dca9d6b7 | [] | no_license | Mjlipote/guid-client | 50db82fbf92433f2ba9c36e8920d5e9f81e47522 | 2186de59ca3f95b605e7ffecb9c83554341bc73a | refs/heads/master | 2021-01-15T08:09:40.095052 | 2013-10-29T12:00:01 | 2013-10-29T12:00:01 | 18,981,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,663 | java | /**
*
* @author Wei-Ming Wu
*
*
* Copyright 2013 Wei-Ming Wu
*
* 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 wmw.i18n;
/**
*
* Nation lists all available nations of the world.
*
*/
public enum Nation {
AF("Afghanistan"), AL("Albania"), DZ("Algeria"), AS("American Samoa"), AD(
"Andorra"), AO("Angola"), AI("Anguilla"), AQ("Antarctica"), AG(
"Antigua and Barbuda"), AR("Argentina"), AM("Armenia"), AW("Aruba"), AU(
"Australia"), AT("Austria"), AZ("Azerbaijan"), BS("Bahamas"), BH(
"Bahrain"), BD("Bangladesh"), BB("Barbados"), BY("Belarus"),
BE("Belgium"), BZ("Belize"), BJ("Benin"), BM("Bermuda"), BT("Bhutan"), BO(
"Bolivia"), BA("Bosnia and Herzegovina"), BW("Botswana"), BV(
"Bouvet Island"), BR("Brazil"), IO("British Indian Ocean Territory"), BN(
"Brunei Darussalam"), BG("Bulgaria"), BF("Burkina Faso"), BI("Burundi"),
KH("Cambodia"), CM("Cameroon"), CA("Canada"), CV("Cape Verde"), KY(
"Cayman Islands"), CF("Central African Republic"), TD("Chad"),
CL("Chile"), CN("China"), CX("Christmas Island"), CC(
"Cocos (Keeling Islands)"), CO("Colombia"), KM("Comoros"), CG("Congo"),
CK("Cook Islands"), CR("Costa Rica"), CI("Cote D'Ivoire (Ivory Coast)"), HR(
"Croatia (Hrvatska"), CU("Cuba"), CY("Cyprus"), CZ("Czech Republic"), DK(
"Denmark"), DJ("Djibouti"), DM("Dominica"), DO("Dominican Republic"), TP(
"East Timor"), EC("Ecuador"), EG("Egypt"), SV("El Salvador"), GQ(
"Equatorial Guinea"), ER("Eritrea"), EE("Estonia"), ET("Ethiopia"), FK(
"Falkland Islands (Malvinas)"), FO("Faroe Islands"), FJ("Fiji"), FI(
"Finland"), FR("France"), FX("France, Metropolitan"),
GF("French Guiana"), PF("French Polynesia"),
TF("French Southern Territories"), GA("Gabon"), GM("Gambia"), GE("Georgia"),
DE("Germany"), GH("Ghana"), GI("Gibraltar"), GR("Greece"), GL("Greenland"),
GD("Grenada"), GP("Guadeloupe"), GU("Guam"), GT("Guatemala"), GN("Guinea"),
GW("Guinea-Bissau"), GY("Guyana"), HT("Haiti"), HM(
"Heard and McDonald Islands"), HN("Honduras"), HK("Hong Kong"), HU(
"Hungary"), IS("Iceland"), IN("India"), ID("Indonesia"), IR("Iran"), IQ(
"Iraq"), IE("Ireland"), IL("Israel"), IT("Italy"), JM("Jamaica"), JP(
"Japan"), JO("Jordan"), KZ("Kazakhstan"), KE("Kenya"), KI("Kiribati"),
KP("Korea (North)"), KR("Korea (South)"), KW("Kuwait"), KG("Kyrgyzstan"), LA(
"Laos"), LV("Latvia"), LB("Lebanon"), LS("Lesotho"), LR("Liberia"), LY(
"Libya"), LI("Liechtenstein"), LT("Lithuania"), LU("Luxembourg"), MO(
"Macau"), MK("Macedonia"), MG("Madagascar"), MW("Malawi"),
MY("Malaysia"), MV("Maldives"), ML("Mali"), MT("Malta"), MH(
"Marshall Islands"), MQ("Martinique"), MR("Mauritania"), MU("Mauritius"),
YT("Mayotte"), MX("Mexico"), FM("Micronesia"), MD("Moldova"), MC("Monaco"),
MN("Mongolia"), MS("Montserrat"), MA("Morocco"), MZ("Mozambique"), MM(
"Myanmar"), NA("Namibia"), NR("Nauru"), NP("Nepal"), NL("Netherlands"),
AN("Netherlands Antilles"), NC("New Caledonia"), NZ("New Zealand"), NI(
"Nicaragua"), NE("Niger"), NG("Nigeria"), NU("Niue"),
NF("Norfolk Island"), MP("Northern Mariana Islands"), NO("Norway"),
OM("Oman"), PK("Pakistan"), PW("Palau"), PA("Panama"),
PG("Papua New Guinea"), PY("Paraguay"), PE("Peru"), PH("Philippines"), PN(
"Pitcairn"), PL("Poland"), PT("Portugal"), PR("Puerto Rico"),
QA("Qatar"), RE("Reunion"), RO("Romania"), RU("Russian Federation"), RW(
"Rwanda"), KN("Saint Kitts and Nevis"), LC("Saint Lucia"), VC(
"Saint Vincent and The Grenadines"), WS("Samoa"), SM("San Marino"), ST(
"Sao Tome and Principe"), SA("Saudi Arabia"), SN("Senegal"), SC(
"Seychelles"), SL("Sierra Leone"), SG("Singapore"),
SK("Slovak Republic"), SI("Slovenia"), SB("Solomon Islands"), SO("Somalia"),
ZA("South Africa"), GS("S. Georgia and S. Sandwich Isls."), ES("Spain"), LK(
"Sri Lanka"), SH("St. Helena"), PM("St. Pierre and Miquelon"),
SD("Sudan"), SR("Suriname"), SJ("Svalbard and Jan Mayen Islands"), SZ(
"Swaziland"), SE("Sweden"), CH("Switzerland"), SY("Syria"), TW("Taiwan"),
TJ("Tajikistan"), TZ("Tanzania"), TH("Thailand"), TG("Togo"), TK("Tokelau"),
TO("Tonga"), TT("Trinidad and Tobago"), TN("Tunisia"), TR("Turkey"), TM(
"Turkmenistan"), TC("Turks and Caicos Islands"), TV("Tuvalu"), UG(
"Uganda"), UA("Ukraine"), AE("United Arab Emirates"),
UK("United Kingdom"), US("United States"), UM("US Minor Outlying Islands"),
UY("Uruguay"), UZ("Uzbekistan"), VU("Vanuatu"), VA(
"Vatican City State (Holy See)"), VE("Venezuela"), VN("Viet Nam"), VG(
"Virgin Islands (British)"), VI("Virgin Islands (US)"), WF(
"Wallis and Futuna Islands"), EH("Western Sahara"), YE("Yemen"), YU(
"Yugoslavia"), ZR("Zaire"), ZM("Zambia"), ZW("Zimbabwe");
private String name;
private Nation(String name) {
this.name = name;
}
/**
* Returns the name of a nation.
*
* @return the name of a nation
*/
public String getName() {
return name;
}
}
| [
"wnameless@gmail.com"
] | wnameless@gmail.com |
feb01eda19da18fd267fbc71c8963dc24ec809a5 | cd96825e371c52e35ba6419d174f1378e349d1bd | /src/main/java/cn/njiuyag/springboot/blog/generate/model/BlogCategoryExample.java | 966b9d01115e37b63fdc23ecb8237278c67f1ef1 | [
"Apache-2.0"
] | permissive | njiuyag/spring-boot-blog | e238af1d077d7ea467064c121923e6c7385241d3 | d86f1cb6074f061ee0c27587fd7a02a03840d49d | refs/heads/main | 2023-02-10T08:54:21.214871 | 2021-01-08T09:30:13 | 2021-01-08T09:30:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,742 | java | package cn.njiuyag.springboot.blog.generate.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class BlogCategoryExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public BlogCategoryExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andBelongUserIdIsNull() {
addCriterion("belong_user_id is null");
return (Criteria) this;
}
public Criteria andBelongUserIdIsNotNull() {
addCriterion("belong_user_id is not null");
return (Criteria) this;
}
public Criteria andBelongUserIdEqualTo(Integer value) {
addCriterion("belong_user_id =", value, "belongUserId");
return (Criteria) this;
}
public Criteria andBelongUserIdNotEqualTo(Integer value) {
addCriterion("belong_user_id <>", value, "belongUserId");
return (Criteria) this;
}
public Criteria andBelongUserIdGreaterThan(Integer value) {
addCriterion("belong_user_id >", value, "belongUserId");
return (Criteria) this;
}
public Criteria andBelongUserIdGreaterThanOrEqualTo(Integer value) {
addCriterion("belong_user_id >=", value, "belongUserId");
return (Criteria) this;
}
public Criteria andBelongUserIdLessThan(Integer value) {
addCriterion("belong_user_id <", value, "belongUserId");
return (Criteria) this;
}
public Criteria andBelongUserIdLessThanOrEqualTo(Integer value) {
addCriterion("belong_user_id <=", value, "belongUserId");
return (Criteria) this;
}
public Criteria andBelongUserIdIn(List<Integer> values) {
addCriterion("belong_user_id in", values, "belongUserId");
return (Criteria) this;
}
public Criteria andBelongUserIdNotIn(List<Integer> values) {
addCriterion("belong_user_id not in", values, "belongUserId");
return (Criteria) this;
}
public Criteria andBelongUserIdBetween(Integer value1, Integer value2) {
addCriterion("belong_user_id between", value1, value2, "belongUserId");
return (Criteria) this;
}
public Criteria andBelongUserIdNotBetween(Integer value1, Integer value2) {
addCriterion("belong_user_id not between", value1, value2, "belongUserId");
return (Criteria) this;
}
public Criteria andIconIsNull() {
addCriterion("icon is null");
return (Criteria) this;
}
public Criteria andIconIsNotNull() {
addCriterion("icon is not null");
return (Criteria) this;
}
public Criteria andIconEqualTo(String value) {
addCriterion("icon =", value, "icon");
return (Criteria) this;
}
public Criteria andIconNotEqualTo(String value) {
addCriterion("icon <>", value, "icon");
return (Criteria) this;
}
public Criteria andIconGreaterThan(String value) {
addCriterion("icon >", value, "icon");
return (Criteria) this;
}
public Criteria andIconGreaterThanOrEqualTo(String value) {
addCriterion("icon >=", value, "icon");
return (Criteria) this;
}
public Criteria andIconLessThan(String value) {
addCriterion("icon <", value, "icon");
return (Criteria) this;
}
public Criteria andIconLessThanOrEqualTo(String value) {
addCriterion("icon <=", value, "icon");
return (Criteria) this;
}
public Criteria andIconLike(String value) {
addCriterion("icon like", value, "icon");
return (Criteria) this;
}
public Criteria andIconNotLike(String value) {
addCriterion("icon not like", value, "icon");
return (Criteria) this;
}
public Criteria andIconIn(List<String> values) {
addCriterion("icon in", values, "icon");
return (Criteria) this;
}
public Criteria andIconNotIn(List<String> values) {
addCriterion("icon not in", values, "icon");
return (Criteria) this;
}
public Criteria andIconBetween(String value1, String value2) {
addCriterion("icon between", value1, value2, "icon");
return (Criteria) this;
}
public Criteria andIconNotBetween(String value1, String value2) {
addCriterion("icon not between", value1, value2, "icon");
return (Criteria) this;
}
public Criteria andRankIsNull() {
addCriterion("rank is null");
return (Criteria) this;
}
public Criteria andRankIsNotNull() {
addCriterion("rank is not null");
return (Criteria) this;
}
public Criteria andRankEqualTo(Integer value) {
addCriterion("rank =", value, "rank");
return (Criteria) this;
}
public Criteria andRankNotEqualTo(Integer value) {
addCriterion("rank <>", value, "rank");
return (Criteria) this;
}
public Criteria andRankGreaterThan(Integer value) {
addCriterion("rank >", value, "rank");
return (Criteria) this;
}
public Criteria andRankGreaterThanOrEqualTo(Integer value) {
addCriterion("rank >=", value, "rank");
return (Criteria) this;
}
public Criteria andRankLessThan(Integer value) {
addCriterion("rank <", value, "rank");
return (Criteria) this;
}
public Criteria andRankLessThanOrEqualTo(Integer value) {
addCriterion("rank <=", value, "rank");
return (Criteria) this;
}
public Criteria andRankIn(List<Integer> values) {
addCriterion("rank in", values, "rank");
return (Criteria) this;
}
public Criteria andRankNotIn(List<Integer> values) {
addCriterion("rank not in", values, "rank");
return (Criteria) this;
}
public Criteria andRankBetween(Integer value1, Integer value2) {
addCriterion("rank between", value1, value2, "rank");
return (Criteria) this;
}
public Criteria andRankNotBetween(Integer value1, Integer value2) {
addCriterion("rank not between", value1, value2, "rank");
return (Criteria) this;
}
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;
}
public Criteria andDeletedIsNotNull() {
addCriterion("deleted is not null");
return (Criteria) this;
}
public Criteria andDeletedEqualTo(Boolean value) {
addCriterion("deleted =", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotEqualTo(Boolean value) {
addCriterion("deleted <>", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThan(Boolean value) {
addCriterion("deleted >", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) {
addCriterion("deleted >=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThan(Boolean value) {
addCriterion("deleted <", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThanOrEqualTo(Boolean value) {
addCriterion("deleted <=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedIn(List<Boolean> values) {
addCriterion("deleted in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotIn(List<Boolean> values) {
addCriterion("deleted not in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedBetween(Boolean value1, Boolean value2) {
addCriterion("deleted between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) {
addCriterion("deleted not between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"yangjingliu@izuche.com"
] | yangjingliu@izuche.com |
b452933c3c1e9be7bffc083323b76514f87282ab | 707a6f5488670d3857165580b57dc1643be2a41e | /app/src/main/java/com/yan/campusbbs/rxbusaction/ActionCampusBBSFragmentFinish.java | 14da426fe98a9e89b82f302ab596239da7cf407a | [] | no_license | genius158/CampusBBS | 7fcda1a9975411bf40dcd36e9c43086d4e478bbc | 3d5d4f03ce48f33f4392f556309388e4214b621e | refs/heads/master | 2021-01-11T14:13:41.335798 | 2017-05-25T01:08:34 | 2017-05-25T01:08:34 | 81,174,174 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package com.yan.campusbbs.rxbusaction;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by yan on 2017/2/8.
*/
public class ActionCampusBBSFragmentFinish implements Parcelable {
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
public ActionCampusBBSFragmentFinish() {
}
protected ActionCampusBBSFragmentFinish(Parcel in) {
}
public static final Creator<ActionCampusBBSFragmentFinish> CREATOR = new Creator<ActionCampusBBSFragmentFinish>() {
@Override
public ActionCampusBBSFragmentFinish createFromParcel(Parcel source) {
return new ActionCampusBBSFragmentFinish(source);
}
@Override
public ActionCampusBBSFragmentFinish[] newArray(int size) {
return new ActionCampusBBSFragmentFinish[size];
}
};
}
| [
"yxw_developer@outlook.com"
] | yxw_developer@outlook.com |
c92031daad4123a6ba38f88a018fb2fb78f52b51 | 843cfea97a5f6a335017f8bb238f151ebc6c0dba | /app/src/main/java/com/dilip/cloudattendance/fragment/DeleteFacultyFragment.java | 7e8269167bffd0c88ee3350f0325db2759a8c08d | [] | no_license | DilipSingh13/Cloud-Attendance-System | afb8c3ceaa08aa9c715d27bfd9b8c4702e87b05d | 795fccb6ab41df9db57ed602063850d9c4a99e9a | refs/heads/master | 2023-03-20T10:19:14.053880 | 2021-03-02T20:10:30 | 2021-03-02T20:10:30 | 343,894,407 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,098 | java | package com.dilip.cloudattendance.fragment;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.dilip.cloudattendance.MyApplication;
import com.dilip.cloudattendance.R;
import com.dilip.cloudattendance.helper.Functions;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class DeleteFacultyFragment extends Fragment {
private ListView DetailsListView;
private TextView Result_Lable;
private static final String TAG = DeleteFacultyFragment.class.getSimpleName();
private ArrayList<HashMap<String, String>> JsonList;
private String name,email,id,surname,role="Faculty",Fullname;
private ProgressDialog pDialog;
public DeleteFacultyFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_delete_faculty, container, false);
DetailsListView = view.findViewById(R.id.listView_search_result);
Result_Lable= view.findViewById(R.id.res_lable);
JsonList = new ArrayList<>();
pDialog = new ProgressDialog(getActivity(),R.style.MyAlertDialogStyle);
pDialog.setCancelable(false);
DisplayMetrics dm = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
searchFaculty(role);
return view;
}
public void searchFaculty(final String role) {
Result_Lable.setVisibility(View.GONE);
JsonList.clear();
pDialog.setMessage("Please wait...");
showDialog();
StringRequest strReq = new StringRequest(Request.Method.POST,
Functions.VIEW_FACULTIES_URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d(TAG, "Search Response: " + response);
hideDialog();
try {
JSONArray jsonArray = new JSONArray(response);
JSONArray jsonObject = new JSONArray(response);
if(response !=null) {
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject c = jsonArray.getJSONObject(i);
name = c.getString("name");
surname=c.getString("surname");
id = c.getString("id_no");
email = c.getString("email");
HashMap<String, String> fetchOrders = new HashMap<>();
// adding each child node to HashMap key => value
fetchOrders.put("name", name);
fetchOrders.put("surname", surname);
fetchOrders.put("id_no", id);
fetchOrders.put("email",email);
JsonList.add(fetchOrders);
}
}
} catch (final Exception e ) {
JsonList.clear();
hideDialog();
Result_Lable.setVisibility(View.VISIBLE);
Result_Lable.setText("No data found try again !");
e.printStackTrace();
}
ListAdapter adapter = new SimpleAdapter(
getActivity(), JsonList,
R.layout.search_faculties_list, new String[]{"name", "surname", "id_no", "email"}, new int[]{R.id.name,R.id.surname,R.id.id_no,R.id.email});
DetailsListView.setAdapter(adapter);
DetailsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final TextView Email = (TextView) view.findViewById(R.id.email);
final TextView Name = (TextView) view.findViewById(R.id.name);
final TextView Surname = (TextView) view.findViewById(R.id.surname);
name = Name.getText().toString();
surname = Surname.getText().toString();
Fullname=name+" "+surname;
email = Email.getText().toString();
delete_Conformation();
}
});
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e(TAG, "Login Error: " + error.getMessage());
Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_LONG).show();
}
}) {
@Override
protected Map<String, String> getParams() {
// Posting parameters to login url
Map<String, String> params = new HashMap<String, String>();
params.put("role", role);
return params;
}
};
// Adding request to request queue
MyApplication.getInstance().addToRequestQueue(strReq);
}
private void delete_Conformation() {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
dialogBuilder.setTitle("Delete User?");
dialogBuilder.setMessage("Name: "+Fullname+"\n"+"Email: "+email);
dialogBuilder.setCancelable(false);
dialogBuilder.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// empty
}
});
dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
final AlertDialog alertDialog = dialogBuilder.create();
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(final DialogInterface dialog) {
final Button b = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Conform Delete Action Method
delete_User(email);
dialog.dismiss();
}
});
}
});
alertDialog.show();
}
private void delete_User(final String email) {
// Tag used to cancel the request
String tag_string_req = "req_register";
pDialog.setMessage("Deleting user please wait ...");
showDialog();
StringRequest strReq = new StringRequest(Request.Method.POST,
Functions.DELETE_USERS_URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d(TAG, "Delete user response: " + response);
hideDialog();
try {
JSONObject jObj = new JSONObject(response.substring(response.indexOf("{"), response.lastIndexOf("}") + 1));
boolean error = jObj.getBoolean("error");
if (!error) {
String Msg = jObj.getString("message");
Toast.makeText(getActivity(),Msg, Toast.LENGTH_LONG).show();
JsonList.clear();
searchFaculty(role);
} else {
// Error occurred during attendance. Get the error
// message
String errorMsg = jObj.getString("message");
Toast.makeText(getActivity(),errorMsg, Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e(TAG, "Delete user error: " + error.getMessage(), error);
Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_LONG).show();
hideDialog();
}
}) {
@Override
protected Map<String, String> getParams() {
// Posting params to register url
Map<String, String> params = new HashMap<>();
params.put("email", email);
return params;
}
};
// Adding request to request queue
MyApplication.getInstance().addToRequestQueue(strReq, tag_string_req);
}
private void showDialog() {
if (!pDialog.isShowing())
pDialog.show();
}
private void hideDialog() {
if (pDialog.isShowing())
pDialog.dismiss();
}
} | [
"dilipsingh.d98@gmail.com"
] | dilipsingh.d98@gmail.com |
08359227cfac05d5e6a56aa7610bba660dc63e43 | 892bffc2691f38a853402f3973bf8175bc8716a8 | /okr/src/main/java/com/eximbay/okr/entity/TeamMember.java | b67294eab48e22664262912c814925acb63bdda3 | [] | no_license | JeongWu/okr-system | 1aab5d440bc4e28daaeafde3d149bf47c562cf64 | 6ea91309e1c67a04c6aec2333118b96433b6874b | refs/heads/master | 2023-04-01T13:58:19.958532 | 2021-04-01T07:17:13 | 2021-04-01T07:17:13 | 351,608,127 | 0 | 0 | null | 2021-04-01T07:17:13 | 2021-03-25T23:51:52 | JavaScript | UTF-8 | Java | false | false | 982 | java | package com.eximbay.okr.entity;
import com.eximbay.okr.constant.FlagOption;
import com.eximbay.okr.entity.id.TeamMemberId;
import com.eximbay.okr.listener.AbstractAuditable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.*;
@EqualsAndHashCode(callSuper = true)
@Data
@Table(name = "team_member")
@Entity
public class TeamMember extends AbstractAuditable {
@EmbeddedId
private TeamMemberId teamMemberId;
@Column(name = "TEAM_LEAD_FLAG", length = 1, nullable = false)
private String teamLeadFlag = FlagOption.N;
@Column(name = "TEAM_MANAGER_FLAG", length = 1, nullable = false)
private String teamManagerFlag = FlagOption.N;
@Column(name = "EDIT_TEAM_OKR_FLAG", length = 1, nullable = false)
private String editTeamOkrFlag = FlagOption.N;
@Column(name = "APPLY_END_DATE", length = 10, nullable = false)
private String applyEndDate;
@Column(name = "JUSTIFICATION")
private String justification;
}
| [
"park961003@naver.com"
] | park961003@naver.com |
76d0a248843729442ff4a8def5a4aaaf383147f3 | c6066eb064460018b6ee0308e6fd30443dc1c458 | /FRC2016/src/ca/team4519/lib/Controller.java | f68f7af623eb6438239f3ff70afb29bbc13e892b | [] | no_license | Mechavaliers/Stronghold | 2f18b6d3cffd16af84c8ea0fb6ca1a3188fd8a11 | 0afe3477a8f5900aa952226784c27620f573499d | refs/heads/master | 2021-01-12T11:55:32.317302 | 2016-09-27T18:39:55 | 2016-09-27T18:39:55 | 69,318,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package ca.team4519.lib;
public abstract class Controller implements Loopable {
protected boolean enabled = false;
public abstract void update();
public abstract void reset();
public abstract double getGoal();
public void enable() {
enabled = true;
}
public void disable() {
enabled = false;
}
public boolean enabled() {
return enabled;
}
}
| [
"connor.adams@uoit.net"
] | connor.adams@uoit.net |
07d751b253f4de6f4a224c5da7821aa7bf160478 | d5e78590dab6aace002d9bc83a62d489a32ab1a7 | /src/main/java/lsieun/code/type/ReturnaddressType.java | 0b597262df35b80d9259de0d65f835f5e62d0edb | [
"MIT"
] | permissive | CodePpoi/java8-classfile-tutorial-master | 723f8ccfcd7e39fece7366e4e11f3f234c90df2e | 6f472d6e5731da2bfefdf0a43b28a6a28744b030 | refs/heads/main | 2023-07-11T22:11:37.453903 | 2021-08-16T13:10:15 | 2021-08-16T13:10:15 | 396,799,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,655 | java | package lsieun.code.type;
import lsieun.cst.TypeConst;
import lsieun.code.Instruction;
/**
* Returnaddress, the type JSR or JSR_W instructions push upon the f_stack.
*/
public class ReturnaddressType extends Type {
public static final ReturnaddressType NO_TARGET = new ReturnaddressType();
private Instruction returnTarget;
/**
* A Returnaddress [that doesn't know where to return to].
*/
private ReturnaddressType() {
super(TypeConst.T_ADDRESS, "<return address>");
}
/**
* Creates a ReturnaddressType object with a target.
*/
public ReturnaddressType(final Instruction returnTarget) {
super(TypeConst.T_ADDRESS, "<return address targeting " + returnTarget + ">");
this.returnTarget = returnTarget;
}
/**
* @return a hash code value for the object.
*/
@Override
public int hashCode() {
if (returnTarget == null) {
return 0;
}
return returnTarget.hashCode();
}
/**
* Returns if the two Returnaddresses refer to the same target.
*/
@Override
public boolean equals(final Object rat) {
if (!(rat instanceof ReturnaddressType)) {
return false;
}
final ReturnaddressType that = (ReturnaddressType) rat;
if (this.returnTarget == null || that.returnTarget == null) {
return that.returnTarget == this.returnTarget;
}
return that.returnTarget.equals(this.returnTarget);
}
/**
* @return the target of this ReturnaddressType
*/
public Instruction getTarget() {
return returnTarget;
}
}
| [
"467938742@qq.com"
] | 467938742@qq.com |
cde853fb0a5cc45a482bb75fcf0214917dddec79 | eeeb576e953d03b282e931a5848bd4560a9fdd7c | /serverbywanglong/persistence/src/main/java/com/modianli/power/persistence/repository/jpa/RoleRepository.java | be38ae7fd37d151e7e1beef62349ca70b018e884 | [] | no_license | Qingmutang/controller | 28c0666e2a2ae35cbe8b46aa08108bfe7ff1097b | 8077ed6ccb00232023aa51e5c23e42f921a57550 | refs/heads/master | 2020-03-22T06:43:30.695840 | 2018-07-04T23:05:09 | 2018-07-04T23:05:09 | 139,653,384 | 0 | 0 | null | 2018-07-04T06:43:08 | 2018-07-04T01:27:39 | null | UTF-8 | Java | false | false | 618 | java | package com.modianli.power.persistence.repository.jpa;
import com.modianli.power.domain.jpa.Role;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface RoleRepository extends JpaBaseRepository<Role, Long>, JpaSpecificationExecutor<Role> {
public Role findByName(String code);
public List<Role> findByActiveIsTrue();
@Query("update Role set active=?2 where id=?1")
@Modifying
public void updateActiveStatus(Long id, boolean b);
}
| [
"a1.com"
] | a1.com |
f1f63c861df673e800919ea0f304b1e5e8762623 | 258de8e8d556901959831bbdc3878af2d8933997 | /utopia-service/utopia-business/utopia-business-impl/src/main/java/com/voxlearning/utopia/service/business/consumer/cache/StudentWishCreationCacheManager.java | c01a104af63917ad0d3606ccf601ba2fe1737ab8 | [] | no_license | Explorer1092/vox | d40168b44ccd523748647742ec376fdc2b22160f | 701160b0417e5a3f1b942269b0e7e2fd768f4b8e | refs/heads/master | 2020-05-14T20:13:02.531549 | 2019-04-17T06:54:06 | 2019-04-17T06:54:06 | 181,923,482 | 0 | 4 | null | 2019-04-17T15:53:25 | 2019-04-17T15:53:25 | null | UTF-8 | Java | false | false | 1,562 | java | /*
* SHANGHAI SUNNY EDUCATION, INC. CONFIDENTIAL
*
* Copyright 2011-2016 Shanghai Sunny Education, Inc. All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of
* Shanghai Sunny Education, Inc. and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Shanghai Sunny
* Education, Inc. and its suppliers and may be covered by patents, patents
* in process, and are protected by trade secret or copyright law. Dissemination
* of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from Shanghai Sunny Education, Inc.
*/
package com.voxlearning.utopia.service.business.consumer.cache;
import com.voxlearning.alps.annotation.cache.CachedObjectExpirationPolicy;
import com.voxlearning.alps.annotation.cache.UtopiaCacheExpiration;
import com.voxlearning.alps.cache.support.PojoCacheObject;
import com.voxlearning.alps.spi.cache.UtopiaCache;
/**
*
* @author RuiBao
* @version 0.1
* @since 7/7/2015
*/
@UtopiaCacheExpiration(policy = CachedObjectExpirationPolicy.this_week)
public class StudentWishCreationCacheManager extends PojoCacheObject<Long, String> {
public StudentWishCreationCacheManager(UtopiaCache cache) {
super(cache);
}
public void record(Long studentId) {
if (studentId == null) return;
add(studentId, "dummy");
}
public boolean wishMadeThisWeek(Long studentId) {
return studentId == null || load(studentId) != null;
}
}
| [
"wangahai@300.cn"
] | wangahai@300.cn |
a4769cce9a184eb33bfd1fbdcbf9d8716dcb5fb7 | 19ec233baf0f95064ac048c00c66494d0918c638 | /QRCodeAPG/src/org/bouncycastle2/jce/provider/JCEElGamalCipher.java | 8e29b460ff7d8adf554081a23f37a1b479c48d8f | [] | no_license | hjyang/QRCode-APG | f3920fab7802d43a9e95394dd6b44ca9e5ab2c92 | f869529d02afb8fe0c83e8cb3c4ee9d2bf8026f3 | refs/heads/master | 2016-09-06T19:01:04.512720 | 2011-05-06T22:41:32 | 2011-05-06T22:41:32 | 1,708,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,205 | java | package org.bouncycastle2.jce.provider;
import java.security.AlgorithmParameters;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.InvalidParameterException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.MGF1ParameterSpec;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.interfaces.DHKey;
import javax.crypto.spec.OAEPParameterSpec;
import javax.crypto.spec.PSource;
import org.bouncycastle2.crypto.AsymmetricBlockCipher;
import org.bouncycastle2.crypto.BufferedAsymmetricBlockCipher;
import org.bouncycastle2.crypto.CipherParameters;
import org.bouncycastle2.crypto.Digest;
import org.bouncycastle2.crypto.InvalidCipherTextException;
import org.bouncycastle2.crypto.encodings.ISO9796d1Encoding;
import org.bouncycastle2.crypto.encodings.OAEPEncoding;
import org.bouncycastle2.crypto.encodings.PKCS1Encoding;
import org.bouncycastle2.crypto.engines.ElGamalEngine;
import org.bouncycastle2.crypto.params.ParametersWithRandom;
import org.bouncycastle2.jce.interfaces.ElGamalKey;
import org.bouncycastle2.jce.interfaces.ElGamalPrivateKey;
import org.bouncycastle2.jce.interfaces.ElGamalPublicKey;
import org.bouncycastle2.util.Strings;
public class JCEElGamalCipher extends WrapCipherSpi
{
private BufferedAsymmetricBlockCipher cipher;
private AlgorithmParameterSpec paramSpec;
private AlgorithmParameters engineParams;
public JCEElGamalCipher(
AsymmetricBlockCipher engine)
{
cipher = new BufferedAsymmetricBlockCipher(engine);
}
private void initFromSpec(
OAEPParameterSpec pSpec)
throws NoSuchPaddingException
{
MGF1ParameterSpec mgfParams = (MGF1ParameterSpec)pSpec.getMGFParameters();
Digest digest = JCEDigestUtil.getDigest(mgfParams.getDigestAlgorithm());
if (digest == null)
{
throw new NoSuchPaddingException("no match on OAEP constructor for digest algorithm: "+ mgfParams.getDigestAlgorithm());
}
cipher = new BufferedAsymmetricBlockCipher(new OAEPEncoding(new ElGamalEngine(), digest, ((PSource.PSpecified)pSpec.getPSource()).getValue()));
paramSpec = pSpec;
}
protected int engineGetBlockSize()
{
return cipher.getInputBlockSize();
}
protected byte[] engineGetIV()
{
return null;
}
protected int engineGetKeySize(
Key key)
{
if (key instanceof ElGamalKey)
{
ElGamalKey k = (ElGamalKey)key;
return k.getParameters().getP().bitLength();
}
else if (key instanceof DHKey)
{
DHKey k = (DHKey)key;
return k.getParams().getP().bitLength();
}
throw new IllegalArgumentException("not an ElGamal key!");
}
protected int engineGetOutputSize(
int inputLen)
{
return cipher.getOutputBlockSize();
}
protected AlgorithmParameters engineGetParameters()
{
if (engineParams == null)
{
if (paramSpec != null)
{
try
{
engineParams = AlgorithmParameters.getInstance("OAEP", "BC2");
engineParams.init(paramSpec);
}
catch (Exception e)
{
throw new RuntimeException(e.toString());
}
}
}
return engineParams;
}
protected void engineSetMode(
String mode)
throws NoSuchAlgorithmException
{
String md = Strings.toUpperCase(mode);
if (md.equals("NONE") || md.equals("ECB"))
{
return;
}
throw new NoSuchAlgorithmException("can't support mode " + mode);
}
protected void engineSetPadding(
String padding)
throws NoSuchPaddingException
{
String pad = Strings.toUpperCase(padding);
if (pad.equals("NOPADDING"))
{
cipher = new BufferedAsymmetricBlockCipher(new ElGamalEngine());
}
else if (pad.equals("PKCS1PADDING"))
{
cipher = new BufferedAsymmetricBlockCipher(new PKCS1Encoding(new ElGamalEngine()));
}
else if (pad.equals("ISO9796-1PADDING"))
{
cipher = new BufferedAsymmetricBlockCipher(new ISO9796d1Encoding(new ElGamalEngine()));
}
else if (pad.equals("OAEPPADDING"))
{
initFromSpec(OAEPParameterSpec.DEFAULT);
}
else if (pad.equals("OAEPWITHMD5ANDMGF1PADDING"))
{
initFromSpec(new OAEPParameterSpec("MD5", "MGF1", new MGF1ParameterSpec("MD5"), PSource.PSpecified.DEFAULT));
}
else if (pad.equals("OAEPWITHSHA1ANDMGF1PADDING"))
{
initFromSpec(OAEPParameterSpec.DEFAULT);
}
else if (pad.equals("OAEPWITHSHA224ANDMGF1PADDING"))
{
initFromSpec(new OAEPParameterSpec("SHA-224", "MGF1", new MGF1ParameterSpec("SHA-224"), PSource.PSpecified.DEFAULT));
}
else if (pad.equals("OAEPWITHSHA256ANDMGF1PADDING"))
{
initFromSpec(new OAEPParameterSpec("SHA-256", "MGF1", MGF1ParameterSpec.SHA256, PSource.PSpecified.DEFAULT));
}
else if (pad.equals("OAEPWITHSHA384ANDMGF1PADDING"))
{
initFromSpec(new OAEPParameterSpec("SHA-384", "MGF1", MGF1ParameterSpec.SHA384, PSource.PSpecified.DEFAULT));
}
else if (pad.equals("OAEPWITHSHA512ANDMGF1PADDING"))
{
initFromSpec(new OAEPParameterSpec("SHA-512", "MGF1", MGF1ParameterSpec.SHA512, PSource.PSpecified.DEFAULT));
}
else
{
throw new NoSuchPaddingException(padding + " unavailable with ElGamal.");
}
}
protected void engineInit(
int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException
{
CipherParameters param;
if (params == null)
{
if (key instanceof ElGamalPublicKey)
{
param = ElGamalUtil.generatePublicKeyParameter((PublicKey)key);
}
else if (key instanceof ElGamalPrivateKey)
{
param = ElGamalUtil.generatePrivateKeyParameter((PrivateKey)key);
}
else
{
throw new InvalidKeyException("unknown key type passed to ElGamal");
}
}
else
{
throw new IllegalArgumentException("unknown parameter type.");
}
if (random != null)
{
param = new ParametersWithRandom(param, random);
}
switch (opmode)
{
case Cipher.ENCRYPT_MODE:
case Cipher.WRAP_MODE:
cipher.init(true, param);
break;
case Cipher.DECRYPT_MODE:
case Cipher.UNWRAP_MODE:
cipher.init(false, param);
break;
default:
throw new InvalidParameterException("unknown opmode " + opmode + " passed to ElGamal");
}
}
protected void engineInit(
int opmode,
Key key,
AlgorithmParameters params,
SecureRandom random)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
throw new InvalidAlgorithmParameterException("can't handle parameters in ElGamal");
}
protected void engineInit(
int opmode,
Key key,
SecureRandom random)
throws InvalidKeyException
{
engineInit(opmode, key, (AlgorithmParameterSpec)null, random);
}
protected byte[] engineUpdate(
byte[] input,
int inputOffset,
int inputLen)
{
cipher.processBytes(input, inputOffset, inputLen);
return null;
}
protected int engineUpdate(
byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
{
cipher.processBytes(input, inputOffset, inputLen);
return 0;
}
protected byte[] engineDoFinal(
byte[] input,
int inputOffset,
int inputLen)
throws IllegalBlockSizeException, BadPaddingException
{
cipher.processBytes(input, inputOffset, inputLen);
try
{
return cipher.doFinal();
}
catch (InvalidCipherTextException e)
{
throw new BadPaddingException(e.getMessage());
}
}
protected int engineDoFinal(
byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws IllegalBlockSizeException, BadPaddingException
{
byte[] out;
cipher.processBytes(input, inputOffset, inputLen);
try
{
out = cipher.doFinal();
}
catch (InvalidCipherTextException e)
{
throw new BadPaddingException(e.getMessage());
}
for (int i = 0; i != out.length; i++)
{
output[outputOffset + i] = out[i];
}
return out.length;
}
/**
* classes that inherit from us.
*/
static public class NoPadding
extends JCEElGamalCipher
{
public NoPadding()
{
super(new ElGamalEngine());
}
}
static public class PKCS1v1_5Padding
extends JCEElGamalCipher
{
public PKCS1v1_5Padding()
{
super(new PKCS1Encoding(new ElGamalEngine()));
}
}
}
| [
"murasaki97@gmail.com"
] | murasaki97@gmail.com |
0fd66a86f939d7d7780927e1bdf61e446d8fd47d | 2b09f0ada616c1af54d2d86940ba99a6c9dc234c | /src/main/java/com/erretechnology/intranet/services/ServiceRuolo.java | cb1f7ea280fd19e0a7a341a25cccef4fcb77e32f | [] | no_license | PaoloFortErre/Intranet | 3b7f81976eb3fd2924b9147daab7e42b76358545 | a7a07f0c0e9485b0b68de1c91c5e1932cd535714 | refs/heads/main | 2023-04-17T19:33:39.130031 | 2021-04-30T14:34:36 | 2021-04-30T14:34:36 | 345,712,303 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package com.erretechnology.intranet.services;
import com.erretechnology.intranet.models.Ruolo;
public interface ServiceRuolo {
public Ruolo getById(String ruolo);
}
| [
"alberto.zaffalon@errepro.tech"
] | alberto.zaffalon@errepro.tech |
ec4910bf3156755e05f3fd153856a37fe75442ee | c0f9b7cdbda00f866dd56b923f0dd1210478aa81 | /Tamagolem/src/Supporto.java | b77aaa8e537aa58a0e1671b2fec60b5a55d5a1b3 | [] | no_license | Spalo97/PgAr2019_Eclisse_Tamagolem | 8de74a4dd4ebaa3ee06e3067e8c2e06f6a3388d0 | dc4369a36b46bb519516d17e613636f61f43a62b | refs/heads/master | 2020-05-18T18:56:08.652702 | 2019-05-08T22:48:53 | 2019-05-08T22:48:53 | 184,597,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,079 | java | import java.util.*;
public class Supporto {
private int n;
public int getN() {
return n;
}
public void introduzione() {
Scanner lettore = new Scanner(System.in);
System.out.println("Ciao!");
System.out.println("Benvenuti nel mondo dei TAMAGOLEM");
System.out.println("Avete mai giocato a tamagolem?");
System.out.println("[0] Si, conosciamo le regole");
System.out.println("[1] No, vorremmo sapere le regole");
int risposta = lettore.nextInt();
if (risposta != 0 && risposta != 1) {
do {
System.out.println("Non ho capito la risposta!");
System.out.println("[0] Si, conosciamo le regole");
System.out.println("[1] No, vorremmo sapere le regole");
risposta =lettore.nextInt();
} while (risposta != 0 && risposta != 1);
}
switch (risposta) {
case 0:
System.out.println("Bene, Allora iniziamo subito!");
break;
case 1:
System.out.println("Le regoli sono semplici!");
System.out.println("Nelle battaglie i Tamagolem si scaglieranno contro delle pietre del potere");
System.out.println("la pietra più forte colpirà il tamagolem che ha scagliato la pietra più debole");
System.out.println("Ma attenzione!");
System.out.println("I giocatori non sapranno l'equilibrio degli elementi a inzio partita!");
System.out.println("Vince il giocatore che sconfigge tutti i tamagolem dell'avversario!");
System.out.println("Ora che le regole sono chiare, Giochiamo!\n");
break;
}
}
public int sceltaLivello() {
Scanner lettore = new Scanner(System.in);
Tamagolem tama = new Tamagolem();
System.out.println("A che livello di difficoltà vuoi giocare?");
System.out.println("[0] Livello Tama-BASE: Per principianti o deboli di cuore");
System.out.println("[1] Livello Tama-MEDIO: per giocatori abili");
System.out.println("[2] Livello Tama-GOLEM: per giocatori assidui e davvero esperti!");
int risposta = lettore.nextInt();
if (risposta != 0 && risposta != 1 && risposta != 2) {
do {
System.out.println("Non ho capito la risposta!");
System.out.println("[0] Livello Tama-BASE: Per principianti o deboli di cuore");
System.out.println("[1] Livello Tama-MEDIO: per giocatori abili");
System.out.println("[2] Livello Tama-GOLEM: per giocatori assidui e davvero esperti!");
risposta=lettore.nextInt();
} while (risposta != 0 && risposta != 1 && risposta != 2);
}
int n=0;
switch(risposta) {
case 0:
//n=(int) (Math.ceil(Math.random()*((3-5)+1))+3);
n=4;
this.n=n;
return n;
case 1:
//n=(int) (Math.ceil(Math.random()*((6-8)+1))+6);
n=7;
this.n=n;
return n;
case 2:
//n=(int) (Math.ceil(Math.random()*((9-10)+1))+9);
n=9;
this.n=n;
return n;
}
//tama.setMaxPietreInTama(n);
//g.setTamagolemTotali(n, tama.getMaxPietreInTama());
//tama.setPietreTotali(n, g.getTamagolemTotali(),tama.getMaxPietreInTama());
System.out.println(n);
//System.out.println(tama.getMaxPietreInTama());
//System.out.println(g.getTamagolemTotali());
//System.out.println(tama.getPietreTotali());
return n;
}
}
| [
"c.langellotti@studenti.unibs.it"
] | c.langellotti@studenti.unibs.it |
c9f45e63c497eac11f8182357d793416234de95b | d284a58afc1b48c6767aafb5bb2e6939d966b8cf | /src/java/huudn/controllers/AdminUpdateProductChangeCity.java | d75b519f126470983c06cb1d53b23c95646db893 | [] | no_license | mrngochuu/ShoppingCart | 064d6c34103ca6deb4970d471aae6aa41410c067 | 6ac24a2f3c3157ccc225837ddc952c6ca0a9ef97 | refs/heads/master | 2020-10-01T02:25:04.450933 | 2020-04-19T12:34:37 | 2020-04-19T12:34:37 | 227,432,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,281 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package huudn.controllers;
import huudn.daos.RealEstateImageDAO;
import huudn.daos.StateDAO;
import huudn.dtos.RealEstateDTO;
import huudn.dtos.RealEstateImageDTO;
import huudn.dtos.StateDTO;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author ngochuu
*/
public class AdminUpdateProductChangeCity extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try {
RealEstateDTO realEstateDTO = new RealEstateDTO();
int cityID = Integer.parseInt(request.getParameter("cbCity"));
String realEstateID = request.getParameter("realEstateID");
realEstateDTO.setRealEstateID(Integer.parseInt(realEstateID));
String title = request.getParameter("title");
realEstateDTO.setTitle(title);
String description = request.getParameter("description");
realEstateDTO.setDescription(description);
String price = request.getParameter("price");
try {
int temp = Integer.parseInt(price);
if (temp <= 0) {
throw new Exception();
}
realEstateDTO.setPrice(temp);
} catch (Exception e) {
realEstateDTO.setPrice(0);
}
String area = request.getParameter("area");
try {
float temp = Float.parseFloat(area);
if (temp <= 0) {
throw new Exception();
}
realEstateDTO.setArea(temp);
} catch (Exception e) {
realEstateDTO.setArea(0);
}
String address = request.getParameter("address");
realEstateDTO.setAddress(address);
String active = request.getParameter("cbActive");
realEstateDTO.setActive(Boolean.parseBoolean(active));
String category = request.getParameter("cbCategory");
realEstateDTO.setCategoryID(Integer.parseInt(category));
String state = request.getParameter("cbState");
realEstateDTO.setStateID(Integer.parseInt(state));
Date date = new SimpleDateFormat("dd/MM/yyyy").parse(request.getParameter("postTime"));
realEstateDTO.setPostTime(date);
request.setAttribute("REAL_ESTATE", realEstateDTO);
RealEstateImageDAO realEstateImageDAO = new RealEstateImageDAO();
List<RealEstateImageDTO> realEstateImageDTO = realEstateImageDAO.getListImage(realEstateDTO.getRealEstateID());
request.setAttribute("IMAGES", realEstateImageDTO);
if (cityID != 0) {
StateDAO stateDAO = new StateDAO();
List<StateDTO> listState = stateDAO.getListState(cityID);
request.setAttribute("LIST_STATE", listState);
}
} catch (Exception e) {
log("ERROR at AdminUpdateProductChangeCity: " + e.getMessage());
} finally {
request.getRequestDispatcher("manageUpdateProduct.jsp").forward(request, response);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"ngochuu.bts@gmail.com"
] | ngochuu.bts@gmail.com |
f4f52768bec3efb1d4352596a8798652c390bad5 | b11229f4726f8b6f63a1547014ad12db8cc4fb97 | /src/SamplePatternQ11.java | f13afa307bc5f5b4fbaf8ac882136e4b775d9e34 | [] | no_license | github4mrunal/W6 | fe76b6a7a43ae292276576699346916136dc45f6 | f11d8cdcd6bd58ce7288a745955dbca67fd8b7c9 | refs/heads/master | 2023-04-01T15:12:57.400874 | 2021-04-13T21:19:23 | 2021-04-13T21:19:23 | 357,689,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | /*11. Write a Java program to display the following pattern.
Sample Pattern :
J a v v a
J a a v v a a
J J aaaaa V V aaaaa
J J a a V a a
*/
public class SamplePatternQ11 {//class
public static void main(String[] args) {//main method
System.out.println("J a v v a");//calling print statement
System.out.println("J a a v v a a");//calling print statement
System.out.println("J J aaaa V V aaaaa");//calling print statement
System.out.println("J J a a V a a");// calling print statement
}
}
| [
"mrunal06@gmail.com"
] | mrunal06@gmail.com |
620dd1f9872b9bb2d25a85afa8c6c0cbe1f7fcb7 | 42904636a01d353e336e6932e7415067201d35e2 | /App/android/app/build/generated/source/buildConfig/debug/com/lnf/BuildConfig.java | f79ca415e31d99be1a6b1b1172c756afa72236bc | [] | no_license | denisenricohasyim93/LNF | 467431f8b4dc3f3a5a7a8751de417325686f72f8 | 59a96cf8c673b14093934f0b1218587e31ea8696 | refs/heads/master | 2021-08-20T05:26:25.435064 | 2017-11-28T07:57:04 | 2017-11-28T07:57:04 | 111,630,003 | 0 | 0 | null | 2017-11-23T04:33:10 | 2017-11-22T03:08:34 | Java | UTF-8 | Java | false | false | 421 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.lnf;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.lnf";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"denisenricohasyim93@gmail.com"
] | denisenricohasyim93@gmail.com |
3b48cc79257c13d9684d1125928cbce8f18a09d8 | 44f1b9954dde9059c1049e5bef5810a32b5e2a46 | /Classwork/week_12/Day_02/interfaces_start_point/src/test/java/TriathleteTest.java | f3a3dc926898a75018f21a26a681782814814797 | [] | no_license | Alasdair321/CodeClan_work | ffb989842dac2312d66ec293b6abd2a56e25b1d6 | 9ce07799df6a66327921a7e6472bc08188191c5b | refs/heads/master | 2023-01-22T19:07:30.461173 | 2019-05-28T05:56:09 | 2019-05-28T05:56:09 | 173,468,668 | 1 | 3 | null | 2023-01-13T22:13:30 | 2019-03-02T16:03:26 | Java | UTF-8 | Java | false | false | 656 | java | import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TriathleteTest {
Triathlete triathlete;
@Before
public void before() {
triathlete = new Triathlete();
}
@Test
public void hasDistanceAtBeginning() {
assertEquals(0, triathlete.getDistanceTravelled());
}
@Test
public void canRunDistance() {
triathlete.run(10);
assertEquals(10, triathlete.getDistanceTravelled());
}
@Test
public void canRunTriathalon() {
triathlete.triathalon(5,40,15);
assertEquals(60, triathlete.getDistanceTravelled());
}
}
| [
"alasdaircarstairs@Agnes-MBP.broadband"
] | alasdaircarstairs@Agnes-MBP.broadband |
36c6685bd11465fe2bb588eac4a3e5876fc09619 | 01c2640cbe0efa33f5f76426a24486a8d06a86ba | /android/app/src/main/java/com/hd_app/CollectLogs.java | 454383c30957566a570e7fa1a3b155ff19cfd78a | [] | no_license | cdut007/hd5_reactnative | ca8279880dcd2ca5ba23be6eca3e9833465b59b1 | 38321df2be9af9aba91ea6a88b75215b3b160a64 | refs/heads/master | 2023-01-28T15:15:41.877387 | 2020-11-02T01:56:42 | 2020-11-02T01:56:42 | 102,852,932 | 0 | 0 | null | 2023-01-12T08:38:40 | 2017-09-08T11:09:54 | JavaScript | UTF-8 | Java | false | false | 6,879 | java | /**
* Copyright (C) 2010-2012 Regis Montoya (aka r3gis - www.r3gis.fr)
* This file is part of CSipSimple.
*
* CSipSimple is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* If you own a pjsip commercial license you can also redistribute it
* and/or modify it under the terms of the GNU Lesser General Public License
* as an android library.
*
* CSipSimple is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CSipSimple. If not, see <http://www.gnu.org/licenses/>.
*/
package com.hd_app;
import android.util.Log;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.text.SimpleDateFormat;
import java.util.Date;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.text.format.DateUtils;
public class CollectLogs {
private static final Object LINE_SEPARATOR = "\n";
private static final String THIS_FILE = "Collect Logs";
private static class LogResult {
public StringBuilder head;
public File file;
public LogResult(StringBuilder aHead, File aFile) {
head = aHead;
file = aFile;
}
};
protected final static LogResult getLogs(Context ctxt) {
//Clear old files
File file = new File(StorageUtils.getLogFile(ctxt));
File parent = file.getParentFile();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date dateAgo = new Date(System.currentTimeMillis());
String timeStr = df.format(dateAgo);
String dest = parent.getAbsolutePath()+File.separator+timeStr+"logs.zip";
try {
FileUtils.zipFolder(StorageUtils.getLogFile(ctxt),dest, false);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/* StorageUtils.cleanLogsFiles(ctxt);
final StringBuilder log = new StringBuilder();
File outFile = null;
try{
ArrayList<String> commandLine = new ArrayList<String>();
commandLine.add("logcat");
outFile = StorageUtils.getLogsFile(ctxt);
if( outFile != null) {
commandLine.add("-f");
commandLine.add(outFile.getAbsolutePath());
}
commandLine.add("-d");
commandLine.add("D");
Process process = Runtime.getRuntime().exec(commandLine.toArray(new String[0]));
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line ;
while ((line = bufferedReader.readLine()) != null){
log.append(line);
log.append(LINE_SEPARATOR);
}
}
catch (IOException e){
Log.e(THIS_FILE, "Collect logs failed : "+e.getLocalizedMessage());//$NON-NLS-1$
log.append("Unable to get logs : " + e.toString());
}
*/
return new LogResult(new StringBuilder(), new File(dest));
}
protected final static StringBuilder getDeviceInfo() {
final StringBuilder log = new StringBuilder();
log.append( "设备信息 : ");
log.append(LINE_SEPARATOR);
log.append("android.os.Build.BOARD : " + android.os.Build.BOARD );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.BRAND : " + android.os.Build.BRAND );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.DEVICE : " + android.os.Build.DEVICE );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.ID : " + android.os.Build.ID );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.MODEL : " + android.os.Build.MODEL );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.PRODUCT : " + android.os.Build.PRODUCT );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.TAGS : " + android.os.Build.TAGS );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.CPU_ABI : " + android.os.Build.CPU_ABI );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.VERSION.INCREMENTAL : " + android.os.Build.VERSION.INCREMENTAL );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.VERSION.RELEASE : " + android.os.Build.VERSION.RELEASE );
log.append(LINE_SEPARATOR);
log.append("android.os.Build.VERSION.SDK_INT : " + android.os.Build.VERSION.SDK_INT );
log.append(LINE_SEPARATOR);
return log;
}
protected final static String getApplicationInfo(Context ctx) {
String result = "";
PackageManager pm = ctx.getPackageManager();
result += "Based on ";
result += ctx.getApplicationInfo().loadLabel(pm);
result += " version : ";
PackageInfo pinfo =getCurrentPackageInfos(ctx);
if(pinfo != null) {
result += pinfo.versionName + " r" + pinfo.versionCode;
}
return result;
}
protected final static PackageInfo getCurrentPackageInfos(Context ctx) {
PackageInfo pinfo = null;
try {
pinfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0);
} catch (NameNotFoundException e) {
Log.e(THIS_FILE, "Impossible to find version of current package !!");
}
return pinfo;
}
protected static Intent getLogReportIntent(String userComment, Context ctx) {
LogResult logs = getLogs(ctx);
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "日志报告");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"316458704@qq.com"});
StringBuilder log = new StringBuilder();
log.append(userComment);
log.append(LINE_SEPARATOR);
log.append(LINE_SEPARATOR);
log.append(getApplicationInfo(ctx));
log.append(LINE_SEPARATOR);
log.append(getDeviceInfo());
log.append(LINE_SEPARATOR);
log.append(logs.head);
if(logs.file != null) {
sendIntent.putExtra( Intent.EXTRA_STREAM, Uri.fromFile(logs.file) );
}
log.append(LINE_SEPARATOR);
log.append(LINE_SEPARATOR);
log.append(userComment);
sendIntent.setType("plain/text");
sendIntent.putExtra(Intent.EXTRA_TEXT, log.toString());
return sendIntent;
}
}
| [
"lrobot.qq@gmail.com"
] | lrobot.qq@gmail.com |
09377d28a3888cd6b04a20d4e0f2e765bbec8258 | 1353af71474ac845663f290eb164274a3de2cd5a | /spring/javaprojects/src/main/java/DesignPattern/Factory/FactoryMethod/AbstractFactory.java | 8f5d4b402d110919a60dddbffea44006292c1a57 | [] | no_license | missasd/IdeaProjects | bdad51ea5f294787dd5144836867586b6ad170a9 | 00ab5c682a025bb6914ede9380735eb6d408ba41 | refs/heads/master | 2023-01-11T13:51:10.011891 | 2020-11-19T06:33:08 | 2020-11-19T06:33:08 | 314,157,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | package DesignPattern.Factory.FactoryMethod;
import DesignPattern.Factory.SimpleFactory.Phone;
public interface AbstractFactory {
Phone makePhone();
}
| [
"2432413428@qq.com"
] | 2432413428@qq.com |
72586f5bca826f5d87a9fe5fdf741229153f3d8d | c49bf2c0aa5324ea889b21a971168c6fa3b58621 | /Spring-annotation-self/src/spring/annotation/self/TennisCoach.java | c0cd62254c82882f8fa34eb52f2b8c26f92c6954 | [] | no_license | JafarSadikGhub/Spring_HiberNate_SpringBoot | d09b2ac908fff4d1a3e05eade61bf5c3a8a91a95 | 815eda40c4ddfe5b0f2ef2f3008e8af855c05baa | refs/heads/main | 2023-03-30T07:09:45.163923 | 2021-03-27T13:56:29 | 2021-03-27T13:56:29 | 333,960,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package spring.annotation.self;
import org.springframework.stereotype.Component;
@Component("thatSillyCoach")
public class TennisCoach implements Coach {
@Override
public String getDailyWorkout() {
return "Practice your backhand volley";
}
}
| [
"jafar.sadik@northsouth.edu"
] | jafar.sadik@northsouth.edu |
401b79c1b735dedc783910eb048ad3762d626e72 | cc531c9993215ba2d2b04dc3edf0f55af4af49e5 | /java/namnamparser/src/main/java/org/bytewerk/namnam/export/json/JSONWriter.java | 1bb42b0388d34eaab81f4f22c07d1047caa6c563 | [] | no_license | fake666/namnam | ccf81476a134c42551713d9e0bc212f94c01a188 | 1d8736d53917aad96f11a50e0b2120744a8a491f | refs/heads/master | 2021-01-15T12:26:19.643205 | 2013-06-24T19:26:07 | 2013-06-24T19:26:07 | 4,987,038 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,228 | java | package org.bytewerk.namnam.export.json;
import java.io.IOException;
import java.io.Writer;
/*
Copyright (c) 2006 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
* JSONWriter provides a quick and convenient way of producing JSON text.
* The texts produced strictly conform to JSON syntax rules. No whitespace is
* added, so the results are ready for transmission or storage. Each instance of
* JSONWriter can produce one JSON text.
* <p>
* A JSONWriter instance provides a <code>value</code> method for appending
* values to the
* text, and a <code>key</code>
* method for adding keys before values in objects. There are <code>array</code>
* and <code>endArray</code> methods that make and bound array values, and
* <code>object</code> and <code>endObject</code> methods which make and bound
* object values. All of these methods return the JSONWriter instance,
* permitting a cascade style. For example, <pre>
* new JSONWriter(myWriter)
* .object()
* .key("JSON")
* .value("Hello, World!")
* .endObject();</pre> which writes <pre>
* {"JSON":"Hello, World!"}</pre>
* <p>
* The first method called must be <code>array</code> or <code>object</code>.
* There are no methods for adding commas or colons. JSONWriter adds them for
* you. Objects and arrays can be nested up to 20 levels deep.
* <p>
* This can sometimes be easier than using a JSONObject to build a string.
* @author JSON.org
* @version 2008-09-18
*/
public class JSONWriter {
private static final int maxdepth = 20;
/**
* The comma flag determines if a comma should be output before the next
* value.
*/
private boolean comma;
/**
* The current mode. Values:
* 'a' (array),
* 'd' (done),
* 'i' (initial),
* 'k' (key),
* 'o' (object).
*/
protected char mode;
/**
* The object/array stack.
*/
private JSONObject stack[];
/**
* The stack top index. A value of 0 indicates that the stack is empty.
*/
private int top;
/**
* The writer that will receive the output.
*/
protected Writer writer;
/**
* Make a fresh JSONWriter. It can be used to build one JSON text.
*/
public JSONWriter(Writer w) {
this.comma = false;
this.mode = 'i';
this.stack = new JSONObject[maxdepth];
this.top = 0;
this.writer = w;
}
/**
* Append a value.
* @param s A string value.
* @return this
* @throws JSONException If the value is out of sequence.
*/
private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
}
this.writer.write(s);
} catch (IOException e) {
throw new JSONException(e);
}
if (this.mode == 'o') {
this.mode = 'k';
}
this.comma = true;
return this;
}
throw new JSONException("Value out of sequence.");
}
/**
* Begin appending a new array. All values until the balancing
* <code>endArray</code> will be appended to this array. The
* <code>endArray</code> method must be called to mark the array's end.
* @return this
* @throws JSONException If the nesting is too deep, or if the object is
* started in the wrong place (for example as a key or after the end of the
* outermost array or object).
*/
public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
}
/**
* End something.
* @param m Mode
* @param c Closing character
* @return this
* @throws JSONException If unbalanced.
*/
private JSONWriter end(char m, char c) throws JSONException {
if (this.mode != m) {
throw new JSONException(m == 'o' ? "Misplaced endObject." :
"Misplaced endArray.");
}
this.pop(m);
try {
this.writer.write(c);
} catch (IOException e) {
throw new JSONException(e);
}
this.comma = true;
return this;
}
/**
* End an array. This method most be called to balance calls to
* <code>array</code>.
* @return this
* @throws JSONException If incorrectly nested.
*/
public JSONWriter endArray() throws JSONException {
return this.end('a', ']');
}
/**
* End an object. This method most be called to balance calls to
* <code>object</code>.
* @return this
* @throws JSONException If incorrectly nested.
*/
public JSONWriter endObject() throws JSONException {
return this.end('k', '}');
}
/**
* Append a key. The key will be associated with the next value. In an
* object, every value must be preceded by a key.
* @param s A key string.
* @return this
* @throws JSONException If the key is out of place. For example, keys
* do not belong in arrays or if the key is null.
*/
public JSONWriter key(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
if (this.comma) {
this.writer.write(',');
}
stack[top - 1].putOnce(s, Boolean.TRUE);
this.writer.write(JSONObject.quote(s));
this.writer.write(':');
this.comma = false;
this.mode = 'o';
return this;
} catch (IOException e) {
throw new JSONException(e);
}
}
throw new JSONException("Misplaced key.");
}
/**
* Begin appending a new object. All keys and values until the balancing
* <code>endObject</code> will be appended to this object. The
* <code>endObject</code> method must be called to mark the object's end.
* @return this
* @throws JSONException If the nesting is too deep, or if the object is
* started in the wrong place (for example as a key or after the end of the
* outermost array or object).
*/
public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
throw new JSONException("Misplaced object.");
}
/**
* Pop an array or object scope.
* @param c The scope to close.
* @throws JSONException If nesting is wrong.
*/
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
this.mode = this.top == 0 ? 'd' : this.stack[this.top - 1] == null ? 'a' : 'k';
}
/**
* Push an array or object scope.
* @param c The scope to open.
* @throws JSONException If nesting is too deep.
*/
private void push(JSONObject jo) throws JSONException {
if (this.top >= maxdepth) {
throw new JSONException("Nesting too deep.");
}
this.stack[this.top] = jo;
this.mode = jo == null ? 'a' : 'k';
this.top += 1;
}
/**
* Append either the value <code>true</code> or the value
* <code>false</code>.
* @param b A boolean.
* @return this
* @throws JSONException
*/
public JSONWriter value(boolean b) throws JSONException {
return this.append(b ? "true" : "false");
}
/**
* Append a double value.
* @param d A double.
* @return this
* @throws JSONException If the number is not finite.
*/
public JSONWriter value(double d) throws JSONException {
return this.value(new Double(d));
}
/**
* Append a long value.
* @param l A long.
* @return this
* @throws JSONException
*/
public JSONWriter value(long l) throws JSONException {
return this.append(Long.toString(l));
}
/**
* Append an object value.
* @param o The object to append. It can be null, or a Boolean, Number,
* String, JSONObject, or JSONArray, or an object with a toJSONString()
* method.
* @return this
* @throws JSONException If the value is out of sequence.
*/
public JSONWriter value(Object o) throws JSONException {
return this.append(JSONObject.valueToString(o));
}
}
| [
"thomas@derfake.com"
] | thomas@derfake.com |
45929cd9794f3a532cf7a50fca54e6135e6c20ec | 29b71940edd98b7e016fcdfee832200ed7803568 | /abdelfadeil/Application1/src/etudiant/testEtudiant.java | 3b5772028d6c7c16a0420fa55fb8a09c19b52145 | [] | no_license | manelBHM/java | 257771a08eb49f9003d25fdbdc5b5fe0794f3682 | a5e5e1e91ca5b709360bd2348d357e29a6c24e03 | refs/heads/master | 2022-12-25T07:27:29.668413 | 2019-06-04T08:05:53 | 2019-06-04T08:05:53 | 158,882,973 | 0 | 5 | null | 2022-12-16T00:54:49 | 2018-11-23T22:26:13 | HTML | UTF-8 | Java | false | false | 295 | java | package etudiant;
public class testEtudiant {
public static void main(String[] args) {
Etudiant etudiant1 = new Etudiant("Eric");
Etudiant etudiant2 = new Etudiant("Sami");
etudiant1.travailler();
etudiant1.seReposer();
etudiant2.travailler();
etudiant2.seReposer();
}
}
| [
"abdalfadeil@gmail.com"
] | abdalfadeil@gmail.com |
3e663a486120a79573e456fe8c43c0f0402be96c | 50f3f9f6f61a0f4c711a61baefb2bab9e2c99673 | /app/src/main/java/com/example/ochiai/careyoureye/VisionTsetLevel10Activity.java | 8c3012e101b5456b71a9776493bfdf2f0ea5b10b | [] | no_license | otty0507/careyoureye | 3c2cb9e73082237b9c588a1f3899f7fd7c1bb1c9 | b5cbd7bf6c3c40cfed5ad05225ec13ee8b445a4b | refs/heads/master | 2021-05-31T08:06:37.978531 | 2016-06-26T11:07:06 | 2016-06-26T11:07:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,184 | java | package com.example.ochiai.careyoureye;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
public class VisionTsetLevel10Activity extends ActionBarActivity {
TextView level;
TextView trueNumText;
TextView falseNumText;
int trueNum;
int falseNum;
double levelNum;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vision_tset_level10);
level = (TextView)findViewById(R.id.level);
trueNumText = (TextView)findViewById(R.id.trueNumText);
falseNumText = (TextView)findViewById(R.id.falseNumText);
trueNum = 0;
falseNum = 0;
}
public void trueButton(View v){
trueNum=trueNum+1;
level.setText("視力"+levelNum);
trueNumText.setText(trueNum+"回");
if (trueNum>=2){
Intent intent = new Intent(this,VisionTsetLevel09Activity.class);
startActivity(intent);
}
}
public void falseButton(View v){
falseNum=falseNum+1;
falseNumText.setText(falseNum+"回");
if (falseNum >= 2){
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_vision_tset, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"au1234555666777@gmail.com"
] | au1234555666777@gmail.com |
ceadc105f5604cd64c3bf14427ab964d133a60ec | 7cebc1c40df73cec113e06b2f14d67b3f50bbbfa | /GeneralUpdateLib/src/com/hb/util/DownloadManagerUtil.java | 9a37ab3fe75133048f5a021ab947e487cb6259ba | [] | no_license | Huangbin1234/RssAIPro | 7245e9012ec2228740e83c7d6825e78a6f2f97c1 | 12646eb3f91dc1dda418015f675dcb2a3569a6a3 | refs/heads/master | 2021-08-07T03:14:14.326187 | 2019-09-29T08:22:35 | 2019-09-29T08:22:35 | 96,398,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,784 | java | package com.hb.util;
import android.app.DownloadManager;
import android.content.Context;
import android.net.Uri;
import android.os.Environment;
/**
* Created by Administrator
* on 2018/11/21
*/
public class DownloadManagerUtil {
private Context mContext;
public DownloadManagerUtil(Context context) {
mContext = context;
}
public long download(String url, String title, String desc) {
Uri uri = Uri.parse(url);
DownloadManager.Request req = new DownloadManager.Request(uri);
//设置WIFI下进行更新
req.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
//下载中和下载完后都显示通知栏
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
//使用系统默认的下载路径 此处为应用内 /android/data/packages ,所以兼容7.0
req.setDestinationInExternalFilesDir(mContext, Environment.DIRECTORY_DOWNLOADS, title);
//通知栏标题
req.setTitle(title);
//通知栏描述信息
req.setDescription(desc);
//设置类型为.apk
req.setMimeType("application/vnd.android.package-archive");
//获取下载任务ID
DownloadManager dm = (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE);
return dm.enqueue(req);
}
/**
* 下载前先移除前一个任务,防止重复下载
*
* @param downloadId
*/
public void clearCurrentTask(long downloadId) {
DownloadManager dm = (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE);
try {
dm.remove(downloadId);
} catch (IllegalArgumentException ex) {
ex.printStackTrace();
}
}
}
| [
"txg"
] | txg |
1b242bc6ba5aca15bf6b74744a3ccf2ab321f1d5 | 1ea016056ea15f3ccebeec2ddf435d46222680ce | /ProfileOwnerType.java | 995a98651c83dadf5b481ca44424bbf5cd00debf | [] | no_license | rgaete/ndc | c56f061d94cc80ced5ed2c502d5594b7d1837e3b | 6cf5b7c19dd1c605e53d09496ae65f7b2b529e34 | refs/heads/master | 2020-12-30T10:49:21.388487 | 2017-07-31T06:53:21 | 2017-07-31T06:53:21 | 98,857,641 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,434 | java |
package ndc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* A data type for Unique Airline Designator.
*
* <p>Java class for ProfileOwnerType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ProfileOwnerType">
* <simpleContent>
* <extension base="<http://www.iata.org/IATA/EDIST/2017.1>AirlineDesigSimpleType">
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ProfileOwnerType", namespace = "http://www.iata.org/IATA/EDIST/2017.1", propOrder = {
"value"
})
public class ProfileOwnerType {
@XmlValue
protected String value;
/**
* A data type for Airline Designator Code encoding constraint: IATA/ A4A (two or three character) Airline Designator Code
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
}
| [
"ricardo.gaete@lan.com"
] | ricardo.gaete@lan.com |
1286d0ad17f54ceab47d1fa59320572af647a708 | eb7d84e8b37c91678269d7c7836114095c4c8d3c | /src/test/java/com/socialsite/dao/hibernate/StaffRequestMsgDaoTest.java | bfe6f44db841fb0ff256224a36b94851bc755b28 | [] | no_license | ananthakumaran/socialsite | 056eb8fb4b343ae8f6f940ddbdae6373ba4b76f7 | bd42d9ac453ef3c875187e25df624d3bd0a07852 | refs/heads/master | 2021-01-20T12:00:44.372111 | 2010-04-19T06:27:51 | 2010-04-19T06:27:51 | 466,377 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,031 | java | /**
* Copyright SocialSite (C) 2009
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.socialsite.dao.hibernate;
import java.util.Date;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.transaction.annotation.Transactional;
import com.socialsite.dao.AbstractDaoTestHelper;
import com.socialsite.persistence.Admin;
import com.socialsite.persistence.Staff;
import com.socialsite.persistence.StaffRequestMsg;
import com.socialsite.persistence.University;
/**
*
* @author Ananth
*
*/
public class StaffRequestMsgDaoTest extends AbstractDaoTestHelper
{
@Test
@Transactional
public void testHasRequest()
{
// create admin for university
final Admin admin1 = new Admin("admin1", "password");
saveUsers(admin1);
// create universities
final University university1 = new University("TestUniversity", admin1);
saveUniversities(university1);
// staffs
final Staff staff1 = new Staff("staff1", "password");
final Staff staff2 = new Staff("staff2", "password");
saveUsers(staff1, staff2);
final StaffRequestMsg msg = new StaffRequestMsg(staff1);
msg.setTime(new Date());
msg.setUniversity(university1);
msg.addUser(university1.getAdmin());
staffRequestMsgDao.save(msg);
Assert.assertEquals(true, staffRequestMsgDao.hasRequest(staff1));
Assert.assertEquals(false, staffRequestMsgDao.hasRequest(staff2));
}
}
| [
"ananthakumaran@gmail.com"
] | ananthakumaran@gmail.com |
d84be8171a42e16576f0c254bf533b0f39eb6d71 | 76498ef9e820a290743faffef65998fc70488d19 | /src/android/com/huatuo/cordova/BaiduOcr.java | 39d3e8ceb9a0b385ceb8703d26b7df89bb56ff3b | [
"MIT"
] | permissive | 18189580715/cordova-plugin-baidu-ocr | 55d908042242f3c2b92ebdd481cc10f700bfaf6d | 72b6be5c82eae622620c42bb5ab44278b4f1801d | refs/heads/master | 2020-07-21T01:23:42.069170 | 2018-06-14T03:24:31 | 2018-06-14T03:24:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,644 | java | package com.huatuo.cordova;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.text.TextUtils;
import android.util.Log;
import com.baidu.ocr.sdk.OCR;
import com.baidu.ocr.sdk.OnResultListener;
import com.baidu.ocr.sdk.exception.OCRError;
import com.baidu.ocr.sdk.model.AccessToken;
import com.baidu.ocr.sdk.model.IDCardParams;
import com.baidu.ocr.sdk.model.IDCardResult;
import com.baidu.ocr.ui.camera.CameraActivity;
import com.baidu.ocr.ui.camera.CameraNativeHelper;
import com.baidu.ocr.ui.camera.CameraView;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.lang.reflect.Method;
public class BaiduOcr extends CordovaPlugin {
private static String TAG = BaiduOcr.class.getSimpleName();
private static final int REQUEST_CODE_PICK_IMAGE_FRONT = 201;
private static final int REQUEST_CODE_PICK_IMAGE_BACK = 202;
private static final int REQUEST_CODE_CAMERA = 102;
private CallbackContext mCallback;
private boolean hasGotToken = false;
public BaiduOcr() {
}
/**
* Sets the context of the Command. This can then be used to do things like
* get file paths associated with the Activity.
*
* @param cordova The context of the main Activity.
* @param webView The CordovaWebView Cordova is running in.
*/
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
//init access token
initAccessToken();
}
/**
* Executes the request and returns PluginResult.
*
* @param action The action to execute.
* @param args JSONArry of arguments for the plugin.
* @param callbackContext The callback id used when calling back into JavaScript.
* @return True if the action was valid, false if not.
*/
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
cordova.getThreadPool().execute(() -> {
try {
Method method = BaiduOcr.class.getDeclaredMethod(action, JSONArray.class, CallbackContext.class);
method.invoke(BaiduOcr.this, args, callbackContext);
} catch (Exception e) {
Log.e(TAG, e.toString());
}
});
return true;
}
/**
* 初始化
*
* @param data
* @param callbackContext
* @throws JSONException
*/
void init(JSONArray data, CallbackContext callbackContext) throws JSONException {
// 初始化本地质量控制模型,释放代码在onDestory中
// 调用身份证扫描必须加上 intent.putExtra(CameraActivity.KEY_NATIVE_MANUAL, true); 关闭自动初始化和释放本地模型
CameraNativeHelper.init(cordova.getContext(), OCR.getInstance().getLicense(),
(errorCode, e) -> {
String msg;
switch (errorCode) {
case CameraView.NATIVE_SOLOAD_FAIL:
msg = "加载so失败,请确保apk中存在ui部分的so";
break;
case CameraView.NATIVE_AUTH_FAIL:
msg = "授权本地质量控制token获取失败";
break;
case CameraView.NATIVE_INIT_FAIL:
msg = "本地质量控制";
break;
default:
msg = String.valueOf(errorCode);
}
try {
JSONObject r = new JSONObject();
r.put("code", errorCode);
r.put("message", msg);
callbackContext.error(r);
} catch (JSONException e1) {
e1.printStackTrace();
}
});
Log.e(TAG, "CameraNativeHelper.init ok");
}
/**
* 扫描
*
* @param data
* @param callbackContext
* @throws JSONException
*/
void scanId(JSONArray data, CallbackContext callbackContext) throws JSONException {
JSONObject errObj = new JSONObject();
JSONObject params = null;
Boolean nativeEnable = true;
Boolean nativeEnableManual = true;
String contentType = "";
//如果百度认证未通过,则直接返回错误
if (!hasGotToken) {
errObj.put("code", -1);
errObj.put("message", "please init ocr");
callbackContext.error(errObj);
return;
}
//判断入参是否为空
if (data != null && data.length() > 0) {
params = data.getJSONObject(0);
} else {
errObj.put("code", -1);
errObj.put("message", "params is error");
callbackContext.error(errObj);
return;
}
//如果参数为空,或者参数中未找到contentType属性,则返回错误
if (params == null || !params.has(CameraActivity.KEY_CONTENT_TYPE)) {
errObj.put("code", -1);
errObj.put("message", "contentType is null");
callbackContext.error(errObj);
return;
}
//contentType取值: IDCardFront(正面),IDCardBack(反面)
if (params.has(CameraActivity.KEY_CONTENT_TYPE)) {
contentType = params.getString(CameraActivity.KEY_CONTENT_TYPE);
}
//参数判断是否合法
if (!contentType.equals(CameraActivity.CONTENT_TYPE_ID_CARD_FRONT) && !contentType.equals(CameraActivity.CONTENT_TYPE_ID_CARD_BACK)) {
errObj.put("code", -1);
errObj.put("message", "contentType value error");
callbackContext.error(errObj);
return;
}
if (params.has(CameraActivity.KEY_NATIVE_ENABLE)) {
nativeEnable = params.getBoolean(CameraActivity.KEY_NATIVE_ENABLE);
}
if (params.has(CameraActivity.KEY_NATIVE_MANUAL)) {
nativeEnableManual = params.getBoolean(CameraActivity.KEY_NATIVE_MANUAL);
}
Intent intent = new Intent(cordova.getActivity(), CameraActivity.class);
intent.putExtra(CameraActivity.KEY_OUTPUT_FILE_PATH,
FileUtil.getSaveFile(cordova.getActivity().getApplication()).getAbsolutePath());
intent.putExtra(CameraActivity.KEY_NATIVE_ENABLE,
nativeEnable);
// KEY_NATIVE_MANUAL设置了之后CameraActivity中不再自动初始化和释放模型
// 请手动使用CameraNativeHelper初始化和释放模型
// 推荐这样做,可以避免一些activity切换导致的不必要的异常
intent.putExtra(CameraActivity.KEY_NATIVE_MANUAL,
nativeEnableManual);
intent.putExtra(CameraActivity.KEY_CONTENT_TYPE, contentType);
//设置回调
mCallback = callbackContext;
//把当前plugin设置为startActivityForResult的返回 ****重要****
cordova.setActivityResultCallback(this);
//启动扫描页面
cordova.getActivity().startActivityForResult(intent, REQUEST_CODE_CAMERA);
}
/**
* 销毁
*
* @param data
* @param callbackContext
* @throws JSONException
*/
void destroy(JSONArray data, CallbackContext callbackContext) throws JSONException {
// 释放本地质量控制模型
CameraNativeHelper.release();
callbackContext.success();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_PICK_IMAGE_FRONT && resultCode == Activity.RESULT_OK) {
Uri uri = data.getData();
String filePath = getRealPathFromURI(uri);
recIDCard(IDCardParams.ID_CARD_SIDE_FRONT, filePath);
}
if (requestCode == REQUEST_CODE_PICK_IMAGE_BACK && resultCode == Activity.RESULT_OK) {
Uri uri = data.getData();
String filePath = getRealPathFromURI(uri);
recIDCard(IDCardParams.ID_CARD_SIDE_BACK, filePath);
}
if (requestCode == REQUEST_CODE_CAMERA && resultCode == Activity.RESULT_OK) {
if (data != null) {
String contentType = data.getStringExtra(CameraActivity.KEY_CONTENT_TYPE);
String filePath = FileUtil.getSaveFile(cordova.getActivity().getApplicationContext()).getAbsolutePath();
if (!TextUtils.isEmpty(contentType)) {
if (CameraActivity.CONTENT_TYPE_ID_CARD_FRONT.equals(contentType)) {
recIDCard(IDCardParams.ID_CARD_SIDE_FRONT, filePath);
} else if (CameraActivity.CONTENT_TYPE_ID_CARD_BACK.equals(contentType)) {
recIDCard(IDCardParams.ID_CARD_SIDE_BACK, filePath);
}
}
}
}
}
/**
* 初始化
*/
private void initAccessToken() {
OCR.getInstance().initAccessToken(new OnResultListener<AccessToken>() {
@Override
public void onResult(AccessToken accessToken) {
String token = accessToken.getAccessToken();
hasGotToken = true;
toastMessage("licence方式获取token成功");
}
@Override
public void onError(OCRError error) {
error.printStackTrace();
toastMessage("licence方式获取token失败");
}
}, cordova.getContext());
}
/**
* 弹出吐司消息
*
* @param message 文本消息
*/
private void toastMessage(String message) {
cordova.getActivity().runOnUiThread(() -> {
//Toast.makeText(cordova.getContext(), message, Toast.LENGTH_LONG).show();
});
}
/**
* 判断权限
*
* @return
*/
private boolean checkGalleryPermission() {
int ret = ActivityCompat.checkSelfPermission(cordova.getContext(), Manifest.permission
.READ_EXTERNAL_STORAGE);
if (ret != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(cordova.getActivity(),
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
1000);
return false;
}
return true;
}
private String getRealPathFromURI(Uri contentURI) {
String result;
Cursor cursor = cordova.getActivity().getContentResolver().query(contentURI, null, null, null, null);
if (cursor == null) { // Source is Dropbox or other similar local file path
result = contentURI.getPath();
} else {
cursor.moveToFirst();
int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
result = cursor.getString(idx);
cursor.close();
}
return result;
}
private void recIDCard(String idCardSide, String filePath) {
IDCardParams param = new IDCardParams();
param.setImageFile(new File(filePath));
// 设置身份证正反面
param.setIdCardSide(idCardSide);
// 设置方向检测
param.setDetectDirection(true);
// 设置图像参数压缩质量0-100, 越大图像质量越好但是请求时间越长。 不设置则默认值为20
param.setImageQuality(20);
OCR.getInstance().recognizeIDCard(param, new OnResultListener<IDCardResult>() {
@Override
public void onResult(IDCardResult result) {
if (result != null && mCallback != null) {
Log.i(TAG, result.toString());
mCallback.success(JsonUtils.toJson(result));
}
}
@Override
public void onError(OCRError error) {
if (error != null && mCallback != null) {
Log.i(TAG, error.toString());
mCallback.error(JsonUtils.toJson(error));
}
}
});
}
}
| [
"259394345@qq.com"
] | 259394345@qq.com |
bff6ffc31188b1391e011edc65055b3fec387687 | cff86318a8a74c127084ce91ac5c153eeafe6a9c | /MDLib/src/main/java/cn/plugin/core/widgets/calendar/LunarCalendar.java | eb8474415aa0fcc722fb6f5422452d4284fb0c66 | [] | no_license | hunyuanqiji/QuickDemo | faeab81c5f200dae4fe182a0e4de41cab4e5f078 | 96479aca8c0db17ee9e9a1bda09b6249dd45c264 | refs/heads/master | 2020-12-19T18:36:13.415232 | 2020-01-23T15:27:24 | 2020-01-23T15:27:24 | 235,533,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,415 | java | /*
* Copyright (C) 2016 huanghaibin_dev <huanghaibin_dev@163.com>
* WebSite https://github.com/MiracleTimes-Dev
* 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 cn.plugin.core.widgets.calendar;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.TextUtils;
import java.util.HashMap;
import java.util.Map;
import cn.plugin.core.R;
final class LunarCalendar {
static void init(Context context) {
if (MONTH_STR != null) {
return;
}
SolarTermUtil.init(context);
MONTH_STR = context.getResources().getStringArray(R.array.lunar_first_of_month);
TRADITION_FESTIVAL_STR = context.getResources().getStringArray(R.array.tradition_festival);
DAY_STR = context.getResources().getStringArray(R.array.lunar_str);
SPECIAL_FESTIVAL_STR = context.getResources().getStringArray(R.array.special_festivals);
SOLAR_CALENDAR = context.getResources().getStringArray(R.array.solar_festival);
}
/**
* 农历月份第一天转写
*/
private static String[] MONTH_STR = null;
/**
* 传统农历节日
*/
private static String[] TRADITION_FESTIVAL_STR = null;
/**
* 农历大写
*/
private static String[] DAY_STR = null;
/**
* 特殊节日的数组
*/
private static String[] SPECIAL_FESTIVAL_STR = null;
/**
* 特殊节日、母亲节和父亲节,感恩节等
*/
@SuppressLint("UseSparseArrays")
private static final Map<Integer, String[]> SPECIAL_FESTIVAL = new HashMap<>();
/**
* 公历节日
*/
private static String[] SOLAR_CALENDAR = null;
/**
* 保存每年24节气
*/
@SuppressLint("UseSparseArrays")
private static final Map<Integer, String[]> SOLAR_TERMS = new HashMap<>();
/**
* 返回传统农历节日
*
* @param year 农历年
* @param month 农历月
* @param day 农历日
* @return 返回传统农历节日
*/
private static String getTraditionFestival(int year, int month, int day) {
if (month == 12) {
int count = daysInLunarMonth(year, month);
if (day == count) {
return TRADITION_FESTIVAL_STR[0];//除夕
}
}
String text = getString(month, day);
String festivalStr = "";
for (String festival : TRADITION_FESTIVAL_STR) {
if (festival.contains(text)) {
festivalStr = festival.replace(text, "");
break;
}
}
return festivalStr;
}
/**
* 数字转换为汉字月份
*
* @param month 月
* @param leap 1==闰月
* @return 数字转换为汉字月份
*/
private static String numToChineseMonth(int month, int leap) {
if (leap == 1) {
return String.format("闰%s", MONTH_STR[month - 1]);
}
return MONTH_STR[month - 1];
}
/**
* 数字转换为农历节日或者日期
*
* @param month 月
* @param day 日
* @param leap 1==闰月
* @return 数字转换为汉字日
*/
private static String numToChinese(int month, int day, int leap) {
if (day == 1) {
return numToChineseMonth(month, leap);
}
return DAY_STR[day - 1];
}
/**
* 用来表示1900年到2099年间农历年份的相关信息,共24位bit的16进制表示,其中:
* 1. 前4位表示该年闰哪个月;
* 2. 5-17位表示农历年份13个月的大小月分布,0表示小,1表示大;
* 3. 最后7位表示农历年首(正月初一)对应的公历日期。
* <p/>
* 以2014年的数据0x955ABF为例说明:
* 1001 0101 0101 1010 1011 1111
* 闰九月 农历正月初一对应公历1月31号
*/
private static final int LUNAR_INFO[] = {
0x84B6BF,/*1900*/
0x04AE53, 0x0A5748, 0x5526BD, 0x0D2650, 0x0D9544, 0x46AAB9, 0x056A4D, 0x09AD42, 0x24AEB6, 0x04AE4A,/*1901-1910*/
0x6A4DBE, 0x0A4D52, 0x0D2546, 0x5D52BA, 0x0B544E, 0x0D6A43, 0x296D37, 0x095B4B, 0x749BC1, 0x049754,/*1911-1920*/
0x0A4B48, 0x5B25BC, 0x06A550, 0x06D445, 0x4ADAB8, 0x02B64D, 0x095742, 0x2497B7, 0x04974A, 0x664B3E,/*1921-1930*/
0x0D4A51, 0x0EA546, 0x56D4BA, 0x05AD4E, 0x02B644, 0x393738, 0x092E4B, 0x7C96BF, 0x0C9553, 0x0D4A48,/*1931-1940*/
0x6DA53B, 0x0B554F, 0x056A45, 0x4AADB9, 0x025D4D, 0x092D42, 0x2C95B6, 0x0A954A, 0x7B4ABD, 0x06CA51,/*1941-1950*/
0x0B5546, 0x555ABB, 0x04DA4E, 0x0A5B43, 0x352BB8, 0x052B4C, 0x8A953F, 0x0E9552, 0x06AA48, 0x6AD53C,/*1951-1960*/
0x0AB54F, 0x04B645, 0x4A5739, 0x0A574D, 0x052642, 0x3E9335, 0x0D9549, 0x75AABE, 0x056A51, 0x096D46,/*1961-1970*/
0x54AEBB, 0x04AD4F, 0x0A4D43, 0x4D26B7, 0x0D254B, 0x8D52BF, 0x0B5452, 0x0B6A47, 0x696D3C, 0x095B50,/*1971-1980*/
0x049B45, 0x4A4BB9, 0x0A4B4D, 0xAB25C2, 0x06A554, 0x06D449, 0x6ADA3D, 0x0AB651, 0x095746, 0x5497BB,/*1981-1990*/
0x04974F, 0x064B44, 0x36A537, 0x0EA54A, 0x86B2BF, 0x05AC53, 0x0AB647, 0x5936BC, 0x092E50, 0x0C9645,/*1991-2000*/
0x4D4AB8, 0x0D4A4C, 0x0DA541, 0x25AAB6, 0x056A49, 0x7AADBD, 0x025D52, 0x092D47, 0x5C95BA, 0x0A954E,/*2001-2010*/
0x0B4A43, 0x4B5537, 0x0AD54A, 0x955ABF, 0x04BA53, 0x0A5B48, 0x652BBC, 0x052B50, 0x0A9345, 0x474AB9,/*2011-2020*/
0x06AA4C, 0x0AD541, 0x24DAB6, 0x04B64A, 0x6a573D, 0x0A4E51, 0x0D2646, 0x5E933A, 0x0D534D, 0x05AA43,/*2021-2030*/
0x36B537, 0x096D4B, 0xB4AEBF, 0x04AD53, 0x0A4D48, 0x6D25BC, 0x0D254F, 0x0D5244, 0x5DAA38, 0x0B5A4C,/*2031-2040*/
0x056D41, 0x24ADB6, 0x049B4A, 0x7A4BBE, 0x0A4B51, 0x0AA546, 0x5B52BA, 0x06D24E, 0x0ADA42, 0x355B37,/*2041-2050*/
0x09374B, 0x8497C1, 0x049753, 0x064B48, 0x66A53C, 0x0EA54F, 0x06AA44, 0x4AB638, 0x0AAE4C, 0x092E42,/*2051-2060*/
0x3C9735, 0x0C9649, 0x7D4ABD, 0x0D4A51, 0x0DA545, 0x55AABA, 0x056A4E, 0x0A6D43, 0x452EB7, 0x052D4B,/*2061-2070*/
0x8A95BF, 0x0A9553, 0x0B4A47, 0x6B553B, 0x0AD54F, 0x055A45, 0x4A5D38, 0x0A5B4C, 0x052B42, 0x3A93B6,/*2071-2080*/
0x069349, 0x7729BD, 0x06AA51, 0x0AD546, 0x54DABA, 0x04B64E, 0x0A5743, 0x452738, 0x0D264A, 0x8E933E,/*2081-2090*/
0x0D5252, 0x0DAA47, 0x66B53B, 0x056D4F, 0x04AE45, 0x4A4EB9, 0x0A4D4C, 0x0D1541, 0x2D92B5 /*2091-2099*/
};
/**
* 传回农历 year年month月的总天数,总共有13个月包括闰月
*
* @param year 将要计算的年份
* @param month 将要计算的月份
* @return 传回农历 year年month月的总天数
*/
private static int daysInLunarMonth(int year, int month) {
if ((LUNAR_INFO[year - CalendarViewDelegate.MIN_YEAR] & (0x100000 >> month)) == 0)
return 29;
else
return 30;
}
/**
* 获取公历节日
*
* @param month 公历月份
* @param day 公历日期
* @return 公历节日
*/
private static String gregorianFestival(int month, int day) {
String text = getString(month, day);
String solar = "";
for (String aMSolarCalendar : SOLAR_CALENDAR) {
if (aMSolarCalendar.contains(text)) {
solar = aMSolarCalendar.replace(text, "");
break;
}
}
return solar;
}
private static String getString(int month, int day) {
return (month >= 10 ? String.valueOf(month) : "0" + month) + (day >= 10 ? day : "0" + day);
}
/**
* 返回24节气
*
* @param year 年
* @param month 月
* @param day 日
* @return 返回24节气
*/
private static String getSolarTerm(int year, int month, int day) {
if (!SOLAR_TERMS.containsKey(year)) {
SOLAR_TERMS.put(year, SolarTermUtil.getSolarTerms(year));
}
String[] solarTerm = SOLAR_TERMS.get(year);
String text = String.format("%s%s", year, getString(month, day));
String solar = "";
for (String solarTermName : solarTerm) {
if (solarTermName.contains(text)) {
solar = solarTermName.replace(text, "");
break;
}
}
return solar;
}
/**
* 获取农历节日
*
* @param year 年
* @param month 月
* @param day 日
* @return 农历节日
*/
private static String getLunarText(int year, int month, int day) {
String termText = LunarCalendar.getSolarTerm(year, month, day);
String solar = LunarCalendar.gregorianFestival(month, day);
if (!TextUtils.isEmpty(solar))
return solar;
if (!TextUtils.isEmpty(termText))
return termText;
int[] lunar = LunarUtil.solarToLunar(year, month, day);
String festival = getTraditionFestival(lunar[0], lunar[1], lunar[2]);
if (!TextUtils.isEmpty(festival))
return festival;
return LunarCalendar.numToChinese(lunar[1], lunar[2], lunar[3]);
}
/**
* 获取特殊计算方式的节日
* 如:每年五月的第二个星期日为母亲节,六月的第三个星期日为父亲节
* 每年11月第四个星期四定为"感恩节"
*
* @param year year
* @param month month
* @param day day
* @return 获取西方节日
*/
private static String getSpecialFestival(int year, int month, int day) {
if (!SPECIAL_FESTIVAL.containsKey(year)) {
SPECIAL_FESTIVAL.put(year, getSpecialFestivals(year));
}
String[] specialFestivals = SPECIAL_FESTIVAL.get(year);
String text = String.format("%s%s", year, getString(month, day));
String solar = "";
for (String special : specialFestivals) {
if (special.contains(text)) {
solar = special.replace(text, "");
break;
}
}
return solar;
}
/**
* 获取每年的母亲节和父亲节和感恩节
* 特殊计算方式的节日
*
* @param year 年
* @return 获取每年的母亲节和父亲节、感恩节
*/
private static String[] getSpecialFestivals(int year) {
String[] festivals = new String[3];
java.util.Calendar date = java.util.Calendar.getInstance();
date.set(year, 4, 1);
int week = date.get(java.util.Calendar.DAY_OF_WEEK);
int startDiff = 7 - week + 1;
if (startDiff == 7) {
festivals[0] = dateToString(year, 5, startDiff + 1) + SPECIAL_FESTIVAL_STR[0];
} else {
festivals[0] = dateToString(year, 5, startDiff + 7 + 1) + SPECIAL_FESTIVAL_STR[0];
}
date.set(year, 5, 1);
week = date.get(java.util.Calendar.DAY_OF_WEEK);
startDiff = 7 - week + 1;
if (startDiff == 7) {
festivals[1] = dateToString(year, 6, startDiff + 7 + 1) + SPECIAL_FESTIVAL_STR[1];
} else {
festivals[1] = dateToString(year, 6, startDiff + 7 + 7 + 1) + SPECIAL_FESTIVAL_STR[1];
}
date.set(year, 10, 1);
week = date.get(java.util.Calendar.DAY_OF_WEEK);
startDiff = 7 - week + 1;
if (startDiff <= 2) {
festivals[2] = dateToString(year, 11, startDiff + 21 + 5) + SPECIAL_FESTIVAL_STR[2];
} else {
festivals[2] = dateToString(year, 11, startDiff + 14 + 5) + SPECIAL_FESTIVAL_STR[2];
}
return festivals;
}
private static String dateToString(int year, int month, int day) {
return String.format("%s%s", year, getString(month, day));
}
/**
* 初始化各种农历、节日
*
* @param calendar calendar
*/
static void setupLunarCalendar(Calendar calendar) {
int year = calendar.getYear();
int month = calendar.getMonth();
int day = calendar.getDay();
calendar.setWeekend(CalendarUtil.isWeekend(calendar));
calendar.setWeek(CalendarUtil.getWeekFormCalendar(calendar));
Calendar lunarCalendar = new Calendar();
calendar.setLunarCakendar(lunarCalendar);
int[] lunar = LunarUtil.solarToLunar(year, month, day);
lunarCalendar.setYear(lunar[0]);
lunarCalendar.setMonth(lunar[1]);
lunarCalendar.setDay(lunar[2]);
calendar.setLeapYear(CalendarUtil.isLeapYear(year));
if (lunar[3] == 1) {//如果是闰月
calendar.setLeapMonth(lunar[1]);
lunarCalendar.setLeapMonth(lunar[1]);
}
String solarTerm = LunarCalendar.getSolarTerm(year, month, day);
String gregorian = LunarCalendar.gregorianFestival(month, day);
String festival = getTraditionFestival(lunar[0], lunar[1], lunar[2]);
if (TextUtils.isEmpty(gregorian)) {
gregorian = getSpecialFestival(year, month, day);
}
calendar.setSolarTerm(solarTerm);
calendar.setGregorianFestival(gregorian);
calendar.setTraditionFestival(festival);
lunarCalendar.setTraditionFestival(festival);
lunarCalendar.setSolarTerm(solarTerm);
if (!TextUtils.isEmpty(solarTerm)) {
calendar.setLunar(solarTerm);
} else if (!TextUtils.isEmpty(gregorian)) {
calendar.setLunar(gregorian);
} else if (!TextUtils.isEmpty(festival)) {
calendar.setLunar(festival);
} else {
calendar.setLunar(LunarCalendar.numToChinese(lunar[1], lunar[2], lunar[3]));
}
lunarCalendar.setLunar(calendar.getLunar());
}
/**
* 获取农历节日
*
* @param calendar calendar
* @return 获取农历节日
*/
static String getLunarText(Calendar calendar) {
return getLunarText(calendar.getYear(), calendar.getMonth(), calendar.getDay());
}
}
| [
"2291197286@qq.com"
] | 2291197286@qq.com |
ce0751003920dde75c4bbb89dee9d271e62c6218 | 8e0033fe41b2b80534732bddb47fdf360f464c48 | /src/in/co/exceptionhandling/ExceptionTest.java | 5a80bf8c857e9b6e08a60cd1c86b3813467838f2 | [] | no_license | shashant8831/MyProject | 8b5ac14bda40eb89b984da4a6cbaa5a965b130b4 | 4b48f9c4d3dccc20b2fde832065ad8dfd7892a75 | refs/heads/master | 2022-04-27T23:15:55.382016 | 2020-05-02T11:12:36 | 2020-05-02T11:12:36 | 260,672,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 567 | java | package in.co.exceptionhandling;
class MyException extends Throwable {
}
class MyException1 extends MyException {
}
class MyException2 extends MyException {
}
class MyException3 extends MyException2 {
}
public class ExceptionTest {
void myMethod() throws MyException {
throw new MyException3();
}
public static void main(String[] args) throws MyException3 {
ExceptionTest et = new ExceptionTest();
try {
et.myMethod();
} catch (MyException me) {
System.out.println("MyException thrown");
} finally {
System.out.println(" Done");
}
}
}
| [
"Shashant31@gmail.com"
] | Shashant31@gmail.com |
8162a8816e3e5e2df764de9539efae6869d1625e | ec1b3d113b75a93174119ea6a798053ef04a341b | /src/main/java/com/management/service/impl/AuthorityServiceImpl.java | e2c6d8c064455aa823cf131da790980e414c8175 | [] | no_license | harryV361/equipment_management | 6343c66385d810056585693a241679acd6fc5805 | 081994871b51305bb529b5b229d8c811d6d56928 | refs/heads/master | 2021-01-15T22:29:22.536012 | 2015-02-13T08:39:14 | 2015-02-13T08:39:14 | 30,746,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,370 | java | package com.management.service.impl;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.infrastructure.exception.EntityOperateException;
import com.infrastructure.exception.ValidatException;
import com.infrastructure.service.impl.ChainEntityServiceImpl;
import com.infrastructure.util.PageList;
import com.infrastructure.util.PageListUtil;
import com.management.dao.AuthorityDao;
import com.management.model.Authority;
import com.management.model.AuthoritySearch;
import com.management.service.AuthorityService;
@Service("AuthorityService")
public class AuthorityServiceImpl extends
ChainEntityServiceImpl<Integer, Authority, AuthorityDao> implements
AuthorityService {
@Autowired
public AuthorityServiceImpl(
@Qualifier("AuthorityDao") AuthorityDao authorityDao) {
super(authorityDao);
}
@Override
public void update(Authority model) throws ValidatException,
EntityOperateException {
Authority dbModel = super.get(model.getId());
dbModel.setName(model.getName());
dbModel.setPosition(model.getPosition());
dbModel.setTheValue(model.getTheValue());
dbModel.setUrl(model.getUrl());
dbModel.setMatchUrl(model.getMatchUrl());
dbModel.setItemIcon(model.getItemIcon());
dbModel.setParent(model.getParent());
super.update(dbModel);
}
@Override
@SuppressWarnings("unchecked")
public PageList<Authority> listPage(AuthoritySearch search, int pageNo,
int pageSize) {
Criteria countCriteria = entityDao.getCriteria();
Criteria listCriteria = entityDao.getCriteria();
if (search != null) {
if (search.getName() != null && !search.getName().isEmpty()) {
countCriteria.add(Restrictions.eq("name", search.getName()));
listCriteria.add(Restrictions.eq("name", search.getName()));
}
}
listCriteria.setFirstResult((pageNo - 1) * pageSize);
listCriteria.setMaxResults(pageSize);
List<Authority> items = listCriteria.list();
countCriteria.setProjection(Projections.rowCount());
Integer count = Integer.parseInt(countCriteria.uniqueResult()
.toString());
return PageListUtil.getPageList(count, pageNo, items, pageSize);
}
}
| [
"916858799@qq.com"
] | 916858799@qq.com |
70f12c636d3bf28ba266bec4b0c0eac69ff45c23 | 1ac353565681f9faa7ba04794c5bdf2c888eda68 | /app/src/main/java/cz/zdrubecky/photogallery/VisibleFragment.java | 5dece8776c25dcdcb34e59080be3ecd12456d14e | [] | no_license | VitZdrubecky/PhotoGallery | 01e5ff2c1af0a52a4b90aa6d3fa5e15f62be9dc8 | 1043f40e7d0cfb8b8eaf879e6bd9a83ad39895a0 | refs/heads/master | 2021-01-21T16:48:11.615625 | 2017-07-21T15:40:29 | 2017-07-21T15:40:29 | 91,907,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,702 | java | package cz.zdrubecky.photogallery;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.app.Fragment;
import android.widget.Toast;
public abstract class VisibleFragment extends Fragment {
private static final String TAG = "VisibleFragment";
@Override
public void onStart() {
super.onStart();
// Create a filter just like the ones in a manifest
IntentFilter filter = new IntentFilter(PollService.ACTION_SHOW_NOTIFICATION);
// Register using the permission so that no one else can wake the receiver
getActivity().registerReceiver(mOnShowNotification, filter, PollService.PERM_PRIVATE, null);
}
// use these corresponding lifecycle methods for safekeeping the receiver
@Override
public void onStop() {
super.onStop();
getActivity().unregisterReceiver(mOnShowNotification);
}
// Dynamic receiver, included in this class only
// Used as a way to be sure the parent activity is running, which would be hard from a standalone receiver
private BroadcastReceiver mOnShowNotification = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Toast.makeText(context, "Got a broadcast " + intent.getAction(), Toast.LENGTH_SHORT).show();
// If we received this, the notification should not be shown as the activity is in the foreground
// This info will propagate through all the following receivers
setResultCode(Activity.RESULT_CANCELED);
}
};
}
| [
"vit.zdrubecky@gmail.com"
] | vit.zdrubecky@gmail.com |
663a13e32e9b77deff284754488e772aa69bfe2f | f089bfaa9bb0eb70c59c0f104b7326fea2768677 | /database plugin for Archi 4/sources/src/org/archicontribs/database/DBPreferenceInitializer.java | 1cb3b1702894effe255fab515e0b841c89abbdfd | [] | no_license | sksundaram-learning/database-plugin | 73ce6957d246b616d2de82a38bf826232ceab662 | bc874673a7eba0d48c3a7ae6b99532ddc02ec2fa | refs/heads/master | 2020-06-10T12:06:20.416274 | 2016-10-24T20:35:42 | 2016-12-01T19:13:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 863 | java | package org.archicontribs.database;
import org.archicontribs.database.DBPlugin.DebugLevel;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
/**
* Class used to initialize default preference values.
*/
public class DBPreferenceInitializer extends AbstractPreferenceInitializer {
public void initializeDefaultPreferences() {
DBPlugin.debug(DebugLevel.MainMethod, "DBPreferenceInitializer.initializeDefaultPreferences()");
IPreferenceStore store = DBPlugin.INSTANCE.getPreferenceStore();
store.setDefault("debugMainMethods", false);
store.setDefault("debugSecondaryMethods", false);
store.setDefault("debugVariables", false);
store.setDefault("debugSQL", false);
store.setDefault("importMode", "standalone");
store.setDefault("progressWindow", "showAndWait");
}
}
| [
"herve.jouin@gmail.com"
] | herve.jouin@gmail.com |
383dc7ad16cf9dfdefeb3b6d1fd91f4a06f7ec21 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/16/org/apache/commons/math3/special/Gamma_logGamma_307.java | 956c0cc22a07d528eeb36010d220372d032f9dfb | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 2,318 | java |
org apach common math3 special
util comput method relat
gamma gamma famili function
implement link inv gamma1pm1 invgamma1pm1
link log gamma1p loggamma1p link log gamma sum loggammasum
base algorithm
href http doi org didonato morri
comput incomplet gamma function ratio
invers tom
href http doi org didonato morri
algorithm signific digit comput
incomplet beta function ratio tom
implement
href http www dtic mil doc citat ada476840 nswc librari mathemat function
href http www ualberta cn research softwar numer nswc numericalnswc site html
librari approv releas
href http www dtic mil dtic pdf announc copyright guidanc copyrightguid pdf copyright guidanc
state code fortran function
librari licens free notic appear code
function safe port common math
version
gamma
return log nbsp gamma nbsp nbsp
implement base precis
implement nswc librari mathemat subroutin
code dgamln implement base
href http mathworld wolfram gamma function gammafunct html gamma
function equat
href http mathworld wolfram lanczo approxim lanczosapproxim html
lanczo approxim equat
href http fit gabdo gamma txt paul godfrei note
comput converg lanczo complex gamma
approxim
param argument
code log gamma code doubl nan
code
log gamma loggamma
ret
doubl isnan
ret doubl nan
log gamma1p loggamma1p fast math fastmath log
log gamma1p loggamma1p
fast math fastmath floor
prod
prod
log gamma1p loggamma1p fast math fastmath log prod
sum lanczo
tmp lanczo
ret fast math fastmath log tmp tmp
half log fast math fastmath log sum
ret
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
9a4bf8dd03995d1fd84d9d13dee179709fec57a5 | f56c130ec9d610fdfbc0bc3e3710e55b3142f08a | /src/java/br/ufrn/imd/web2/jsf/func/netbeans/Funcionario.java | 9d8b82fc307cea891b1ecd099a9efd64b10dc9a0 | [] | no_license | julianaabs/EnterpriseApplication | 37afef3c2854be2192389548402f5ccd48cf271d | c661acf7432be50c11f81c8914d520f986e32505 | refs/heads/master | 2021-09-10T03:59:45.144538 | 2018-03-20T22:54:39 | 2018-03-20T22:54:39 | 126,092,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,006 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.ufrn.imd.web2.jsf.func.netbeans;
/**
*
* @author jubss
*/
public class Funcionario {
private String nome;
private double salario;
private Departamento lotacao;
public Funcionario(){
}
public Funcionario(String nome, double salario){
}
public void setNome(String nome){
this.nome = nome;
}
public String getNome(){
return this.nome;
}
public void setSalario(double salario){
this.salario = salario;
}
public double getSalario(){
return this.salario;
}
public void setLotacao(Departamento _lotacao){
this.lotacao = _lotacao;
}
public Departamento getLotacao(){
return this.lotacao;
}
}
| [
"jubsbarbosa0@gmail.com"
] | jubsbarbosa0@gmail.com |
79460ed541db61bc06b19b20a9a3c689e6440a7b | d847df075288fef1dee3376039de0cad44119165 | /src/app/MyApp.java | ed03125afa6efaf33166e2565f390d1e683d29ca | [] | no_license | nikolalsvk/graphic-editor | 7341c447f6f5dd3b508886a85df50bacc761e25f | e2348122d912c6b30a1cf0de2f1eb4eca724a94f | refs/heads/master | 2021-01-10T06:25:51.156426 | 2015-10-25T12:48:56 | 2015-10-25T12:48:56 | 44,909,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package app;
import javax.swing.ImageIcon;
public class MyApp {
public static void main(String[] args) {
MainFrame frame = MainFrame.getInstance();
ImageIcon img = new ImageIcon("img/djuza.jpg");
frame.setIconImage(img.getImage());
frame.setVisible(true);
}
}
| [
"nikolaseap@gmail.com"
] | nikolaseap@gmail.com |
d82721a1b39c472ddf6b5d9a895c50501e71d5a1 | a1a94a97a6f3932fdc10724b0a2b0925aecb788b | /api/src/main/java/com/tinhoctainha/tms/api/dto/LedgerDetailDto.java | 62747090dce206ded15429b712d66505bed24a30 | [] | no_license | tayduivn/tms-1 | 6d883b6cb720b8023da411d947e89967aefe5afd | b082883104b22efdd23eb203f9782b6ef1a7c5b6 | refs/heads/master | 2022-01-18T16:30:59.573390 | 2019-07-25T16:22:41 | 2019-07-25T16:22:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,924 | java | package com.tinhoctainha.tms.api.dto;
import java.io.Serializable;
import java.util.Objects;
public class LedgerDetailDto implements Serializable {
private LedgerDto ledger;
private InvoiceDto invoice;
private CostDto cost;
private WaybillDto waybill;
private FeeDto fee;
private BalanceDto balance;
private ReceiptDto receipt;
private IssueDto issue;
public LedgerDto getLedger() {
return ledger;
}
public void setLedger(LedgerDto ledger) {
this.ledger = ledger;
}
public InvoiceDto getInvoice() {
return invoice;
}
public void setInvoice(InvoiceDto invoice) {
this.invoice = invoice;
}
public CostDto getCost() {
return cost;
}
public void setCost(CostDto cost) {
this.cost = cost;
}
public WaybillDto getWaybill() {
return waybill;
}
public void setWaybill(WaybillDto waybill) {
this.waybill = waybill;
}
public FeeDto getFee() {
return fee;
}
public void setFee(FeeDto fee) {
this.fee = fee;
}
public BalanceDto getBalance() {
return balance;
}
public void setBalance(BalanceDto balance) {
this.balance = balance;
}
public ReceiptDto getReceipt() {
return receipt;
}
public void setReceipt(ReceiptDto receipt) {
this.receipt = receipt;
}
public IssueDto getIssue() {
return issue;
}
public void setIssue(IssueDto issue) {
this.issue = issue;
}
@Override
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LedgerDetailDto ledgerDetail = (LedgerDetailDto) o;
return (Objects.equals(ledger, ledgerDetail.ledger));
}
@Override
public int hashCode(){
return Objects.hash(ledger);
}
}
| [
"ngoton.it@gmail.com"
] | ngoton.it@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.