blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
โ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
45548f530b38b6d9725f27401c969aa2be40d6c8 | 6c79ce2c87b7bbfc75de648000e1b00ddde4b33c | /SController/app/src/main/java/com/fdse/scontroller/service/MessageEvent.java | a9dccfddba389a5761a5413a58a98aab56567e36 | [] | no_license | LiuJingXX/rep | 1b1cc71d1eedf7d4ffce5a395c2575ec8a727c88 | f52620c1e196bc304a2ce38370d36da3fba3dc9f | refs/heads/master | 2021-06-12T07:25:00.479538 | 2019-12-24T01:05:08 | 2019-12-24T01:05:08 | 136,163,717 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 860 | java | package com.fdse.scontroller.service;
public class MessageEvent {
//ไบไปถ็ฑปๅ
private int eventType;
//็จไบไปปๅกๆต็จ่็นๅฎๆๆถ็ๆจ้
private int taskId;
private String nodeId;
private String completeTime;
public int getEventType() {
return eventType;
}
public void setEventType(int eventType) {
this.eventType = eventType;
}
public int getTaskId() {
return taskId;
}
public void setTaskId(int taskId) {
this.taskId = taskId;
}
public String getNodeId() {
return nodeId;
}
public void setNodeId(String nodeId) {
this.nodeId = nodeId;
}
public String getCompleteTime() {
return completeTime;
}
public void setCompleteTime(String completeTime) {
this.completeTime = completeTime;
}
}
| [
"[email protected]"
] | |
7be21ea525c89737a29e65437111efa38760af8a | b4ea6e245c3d81497ffe0a5366a24eab787c877f | /base-form/src/com/dlshouwen/core/base/utils/SimpleMailSender.java | a4bfd0e11e37fefc738258c56642986d718c822a | [] | no_license | cuixubin/base-form | 4d2a0abe2a8d42cadb90c14b32b245b0bf6597c5 | 714bfe031dbfbc996aded80c8869db96b74f2368 | refs/heads/master | 2020-01-23T21:49:41.117156 | 2016-11-25T08:50:32 | 2016-11-25T08:50:32 | 74,740,990 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,127 | java | package com.dlshouwen.core.base.utils;
import java.util.List;
import java.util.Properties;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMessage.RecipientType;
import javax.mail.internet.MimeMultipart;
public class SimpleMailSender
{
private Properties props = System.getProperties();
private transient MailAuthenticator authenticator;
private transient Session session;
public SimpleMailSender(String smtpHostName, String username, String password)
{
init(username, password, smtpHostName);
}
public SimpleMailSender(String username, String password)
{
String smtpHostName = "smtp." + username.split("@")[1];
init(username, password, smtpHostName);
}
private void init(String username, String password, String smtpHostName)
{
this.props.put("mail.smtp.auth", "true");
this.props.put("mail.smtp.host", smtpHostName);
this.authenticator = new MailAuthenticator(username, password);
this.session = Session.getInstance(this.props, this.authenticator);
}
public void send(String recipient, String subject, String content)
throws AddressException, MessagingException
{
MimeMessage message = new MimeMessage(this.session);
message.setFrom(new InternetAddress(this.authenticator.getUsername()));
message.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(recipient));
message.setSubject(subject);
Multipart mp = new MimeMultipart("related");
MimeBodyPart mbp = new MimeBodyPart();
mbp.setContent(content.toString(), "text/html;charset=utf-8");
mp.addBodyPart(mbp);
message.setContent(mp);
Transport.send(message);
}
public void send(List<String> recipients, String subject, String content)
throws AddressException, MessagingException
{
MimeMessage message = new MimeMessage(this.session);
message.setFrom(new InternetAddress(this.authenticator.getUsername()));
int num = recipients.size();
InternetAddress[] addresses = new InternetAddress[num];
for (int i = 0; i < num; i++) {
addresses[i] = new InternetAddress((String)recipients.get(i));
}
message.setRecipients(MimeMessage.RecipientType.TO, addresses);
message.setSubject(subject);
message.setContent(content.toString(), "text/html;charset=utf-8");
Transport.send(message);
}
public void send(String recipient, SimpleMail mail)
throws AddressException, MessagingException
{
send(recipient, mail.getSubject(), mail.getContent());
}
public void send(List<String> recipients, SimpleMail mail)
throws AddressException, MessagingException
{
send(recipients, mail.getSubject(), mail.getContent());
}
}
| [
"[email protected]"
] | |
a19650e8ee4d8224637e77affe5ea6578e89724a | 0a4b6a83792ab567a8c27e1c8feacd8a4b66275e | /main/java/com/bdqn/controller/SystemconfigController.java | fa11c72fbb95aeba287b93a09ce05898ddd1ac59 | [
"Apache-2.0"
] | permissive | 3144207329/t12 | 837ad754c85ef23115e261c0e89e4ff73bcf9069 | 248b97caaf9d30c140f626d364e613131251ff9c | refs/heads/master | 2020-05-19T11:55:20.674202 | 2019-05-06T07:21:44 | 2019-05-06T07:21:44 | 185,003,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,887 | java | package com.bdqn.controller;
import com.bdqn.common.web.BaseController;
import com.bdqn.entity.Systemconfig;
import com.bdqn.service.SystemconfigService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@CrossOrigin
@RequestMapping("/systemconfig")
public class SystemconfigController extends BaseController {
@Resource
private SystemconfigService systemconfigService;
@PostMapping("getAllByConfigCode")
public String getAllByConfigCode(String configCode,Integer configValueId) {
List<Systemconfig> list = systemconfigService.getAllByConfigCode(configCode,configValueId);
return dealQueryResult(list, list);
}
@GetMapping("getAllByConfigCodeG")
public List<Systemconfig> getAllByConfigCodeG(String configCode,Integer configValueId) {
List<Systemconfig> list = systemconfigService.getAllByConfigCode(configCode,configValueId);
return list;
}
// ๆจก็ณๆฅ่ฏข
@PostMapping("getAll")
public String getAll(Systemconfig systemconfig) {
List result = systemconfigService.getAll(systemconfig);
return dealQueryResult(result, result);
}
// ๆน
@PostMapping("getUpOne")
public String getUpOne(Systemconfig systemconfig) {
int result = systemconfigService.getUpOne(systemconfig);
return dealSuccessResult("ไฟฎๆนๆๅ!", result);
}
// ๅ ้ค
@PostMapping("getdeleOne")
public String getdeleOne(int id) {
int result = systemconfigService.getdeleOne(id);
return dealSuccessResult("ๅ ้คๆๅ!", result);
}
// ๅขๅ
@PostMapping("getAddOne")
public String getAddOne(Systemconfig systemconfig) {
int result = systemconfigService.getAddOne(systemconfig);
return dealSuccessResult("ๅขๅ ๆๅ!", result);
}
}
| [
"โ[email protected]โ"
] | โ[email protected]โ |
f310070b442f3a2d831cfc9fec2e50b2060ddddc | 1665de8bd598d9a153382c5b916dd10cc38351b4 | /app/src/main/java/com/nisira/core/entity/Estructura_costos_clieprov.java | db25123095a3a377d6c6a9f780bd7bb84ec31f03 | [] | no_license | aburgosd91/PoliceSecurity | 14512b5adb532cac7cc539254288ffcfeb59d9be | 018aa42cb482a8cbf78399ecfc9490ca767369e7 | refs/heads/master | 2021-01-23T04:48:28.896887 | 2017-09-21T21:16:49 | 2017-09-21T21:16:49 | 80,377,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,504 | java | package com.nisira.core.entity;
import com.nisira.annotation.ClavePrimaria;
import com.nisira.annotation.Columna;
import com.nisira.annotation.Tabla;
import com.google.gson.annotations.SerializedName;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.io.Serializable;
import java.util.ArrayList;
@Tabla(nombre = "ESTRUCTURA_COSTOS_CLIEPROV")
@XStreamAlias("ESTRUCTURA_COSTOS_CLIEPROV")
public class Estructura_costos_clieprov implements Serializable {
@ClavePrimaria
@Columna
@SerializedName("idempresa")
@XStreamAlias("IDEMPRESA")
private String idempresa = "" ;
@ClavePrimaria
@Columna
@SerializedName("codigo")
@XStreamAlias("CODIGO")
private String codigo = "" ;
@ClavePrimaria
@Columna
@SerializedName("idclieprov")
@XStreamAlias("IDCLIEPROV")
private String idclieprov = "" ;
@Columna
@SerializedName("estado")
@XStreamAlias("ESTADO")
private Double estado = 0.00 ;
/* Sets & Gets */
public void setIdempresa(String idempresa) {
this.idempresa = idempresa;
}
public String getIdempresa() {
return this.idempresa;
}
public void setCodigo(String codigo) {
this.codigo = codigo;
}
public String getCodigo() {
return this.codigo;
}
public void setIdclieprov(String idclieprov) {
this.idclieprov = idclieprov;
}
public String getIdclieprov() {
return this.idclieprov;
}
public void setEstado(Double estado) {
this.estado = estado;
}
public Double getEstado() {
return this.estado;
}
/* Sets & Gets FK*/
} | [
"[email protected]"
] | |
a2e4e756e69587ba73819d2f20daa092e448a593 | 9dbb8216397ce89dcb7a25a719a74132c029a331 | /src/main/java/com/github/davidmoten/rtree2/internal/LeafHelper.java | b580be28b1a87ba7c0a4701d41c81f8c1cebb766 | [
"Apache-2.0"
] | permissive | davidmoten/rtree2 | efafb98fac0587493de03750ac71659ce0fcd133 | 0eb06b1f85f46bbf44541b34672a35cce50514a6 | refs/heads/master | 2023-08-27T22:00:22.648008 | 2023-08-03T21:42:13 | 2023-08-03T21:42:27 | 196,287,621 | 77 | 14 | Apache-2.0 | 2023-08-03T21:42:29 | 2019-07-10T23:27:17 | Java | UTF-8 | Java | false | false | 2,799 | java | package com.github.davidmoten.rtree2.internal;
import static java.util.Optional.of;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import com.github.davidmoten.rtree2.Context;
import com.github.davidmoten.rtree2.Entry;
import com.github.davidmoten.rtree2.Leaf;
import com.github.davidmoten.rtree2.Node;
import com.github.davidmoten.rtree2.geometry.Geometry;
import com.github.davidmoten.rtree2.geometry.ListPair;
public final class LeafHelper {
private LeafHelper() {
// prevent instantiation
}
public static <T, S extends Geometry> NodeAndEntries<T, S> delete(
Entry<? extends T, ? extends S> entry, boolean all, Leaf<T, S> leaf) {
List<Entry<T, S>> entries = leaf.entries();
if (!entries.contains(entry)) {
return new NodeAndEntries<T, S>(of(leaf), Collections.<Entry<T, S>> emptyList(), 0);
} else {
final List<Entry<T, S>> entries2 = new ArrayList<Entry<T, S>>(entries);
entries2.remove(entry);
int numDeleted = 1;
// keep deleting if all specified
while (all && entries2.remove(entry))
numDeleted += 1;
if (entries2.size() >= leaf.context().minChildren()) {
Leaf<T, S> node = leaf.context().factory().createLeaf(entries2, leaf.context());
return new NodeAndEntries<T, S>(of(node), Collections.<Entry<T, S>> emptyList(),
numDeleted);
} else {
return new NodeAndEntries<T, S>(Optional.<Node<T, S>> empty(), entries2,
numDeleted);
}
}
}
public static <T, S extends Geometry> List<Node<T, S>> add(
Entry<? extends T, ? extends S> entry, Leaf<T, S> leaf) {
List<Entry<T, S>> entries = leaf.entries();
Context<T, S> context = leaf.context();
@SuppressWarnings("unchecked")
final List<Entry<T, S>> entries2 = Util.add(entries, (Entry<T, S>) entry);
if (entries2.size() <= context.maxChildren())
return Collections
.singletonList((Node<T, S>) context.factory().createLeaf(entries2, context));
else {
ListPair<Entry<T, S>> pair = context.splitter().split(entries2, context.minChildren());
return makeLeaves(pair, context);
}
}
private static <T, S extends Geometry> List<Node<T, S>> makeLeaves(ListPair<Entry<T, S>> pair,
Context<T, S> context) {
List<Node<T, S>> list = new ArrayList<Node<T, S>>(2);
list.add(context.factory().createLeaf(pair.group1().list(), context));
list.add(context.factory().createLeaf(pair.group2().list(), context));
return list;
}
}
| [
"[email protected]"
] | |
87b27d01e6bcc0fa66d40cb85c033d3c3280d03a | 023169642d1b26e48eb6247a0a30a9fb3eb13e6e | /queries/Summary.java | 3ad3ae927419ced189559ca67677299152654343 | [] | no_license | Daszest/Text-File-Sorter | c0a05ec8730e5fa2c4d05c848292188e44201715 | 176e98c216b095e64976a22de7ada0ef0f83171e | refs/heads/master | 2021-01-20T06:42:38.342838 | 2017-05-01T09:07:47 | 2017-05-01T09:07:47 | 89,910,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,986 | java | package softeng251.queries;
import java.util.HashSet;
import java.util.Set;
public class Summary extends Query
{
// A String field for saving the number of dependencies declared in the file
private int _deps = 0;
// A "Set" field that contains all the names of all the different declared modules that have dependencies
private Set<String> _srcWithDepsSet = new HashSet<String>();
// A "Set" field that contains all the names of all the different declared modules that don't have have dependencies
private Set<String> _srcNoDepsSet = new HashSet<String>();
// A "Set" field that contains all the names of all the different modules being depended on, that don't have declared dependencies
private Set<String> _tgtNotSrcSet = new HashSet<String>();
// A constructor that takes in two strings fileID and queryID as inputs and sets the _fileID and _queryID fields to those Strings respectively
// Creates a Summary object
public Summary(String fileID, String queryID)
{
super._fileID = fileID;
super._queryID = queryID;
}
// Default constructor for a Summary object
public Summary()
{
}
// A method that counts:
// The total number of dependencies
// The number of dependencies each unique module has
// The number of unique modules that don't have have dependencies
// The number of modules being depended on, that don't have declared dependencies
public void inquire(String QueryCommand)
{
// Calls the "inquire" method from the abstract class"Query"
super.inquire(QueryCommand);
// Counts the number of unique modules declared by putting them into a set
_srcSet.add(moduleName());
// Adds all the modules being depended on, into a set
// This set is used to count the number of modules being depended on, that don't have declared dependencies
_tgtNotSrcSet.add(targetName());
// Checks if the the declared module has a dependency
// If so:
// Increase the dependency counter by 1
// Add the name of the module to the a set containing all the names of modules with dependencies
if(moduleHasATarget())
{
_deps++;
_srcWithDepsSet.add(moduleName());
}
// If the module does not have a dependency
// Add the module to a set containing the names of modules without dependencies
if(!moduleHasATarget())
{
_srcNoDepsSet.add(moduleName());
}
}
// A method that prints the output of the "Summary" query to the command line
public void output()
{
// Only needs to run once
// Placed here for runtime efficiency of code,
// Could have been placed in 'inquire' but would slow down code unnecessarily by ALOT.
// Puts the elements of _srcSet into an array
String[] _srcArray = _srcSet.toArray(new String[_srcSet.size()]);
// Loops through all the elements in the new array
for(int i = 0; i < _srcSet.size(); i++)
{
// Checks if the set (containing only modules being depended on) has any modules that have been declared to have dependencies
// If so, remove it from the set
if(_tgtNotSrcSet.contains(_srcArray[i]))
{
_tgtNotSrcSet.remove(_srcArray[i]);
}
}
// Calls the outputStub from the Query superclass
outputStub();
// println statements print out the relevant information to the console
// Prints out the number of dependencies are present in the data, to the console
System.out.println("DEPS\t" + _deps);
// Prints out the number of dependencies each unique module has, to the console
System.out.println("SRCWITHDEPS\t" + _srcWithDepsSet.size());
// Prints out the number of unique modules that don't have have dependencies, to the console
System.out.println("SRCNODEPS\t" + _srcNoDepsSet.size());
// Prints out the number of modules being depended on, that don't have declared dependencies, to the console
System.out.println("TGTNOTSRC\t" + _tgtNotSrcSet.size());
}
}
| [
"[email protected]"
] | |
6510948f384b11015e7f9a239119467dcdda6903 | d40601dc62d214c01a0e2ae0b7a9e548237d27e7 | /cityOfAaron/src/cityofaaron/model/TeamMembers.java | 220d4d4335174b0d26208aa63d919721b34e6817 | [] | no_license | tudonetwork/cityOfAaron | 653a049b639543a40458a7204abf00f216ea19fb | a61a3a10403a0f94f2e54f859612dafb04d1ba68 | refs/heads/master | 2020-03-17T19:29:31.463341 | 2018-05-17T20:23:46 | 2018-05-17T20:23:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 587 | java | package cityofaaron.model;
/**
*
* @author jhelst, carolmadella, ramonandrade
*/
public enum TeamMembers {
private String name;
private String title;
private TeamMembers(String name, String title) {
this.name = name;
this.title = title;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "TeamMembers [name=" + name + ", title=" + title + "]";
}
}
| [
"[email protected]"
] | |
dafc7226aa13dc4933ddcb7d1768a007107f5ad5 | 2c1d1102499ebec37e7e0820cda5abb9f2c82ffa | /Day9recursionFactorial/Solution.java | 14cf2148020169b2c6c11e4a53feddebff0ef00a | [] | no_license | codegold/HackerRank | 28d704e4cba98ab145f279aed54d3150ed8b4acf | 2cc02e780303e62763256b5fd4c3a7586110ae00 | refs/heads/master | 2022-02-23T08:04:11.069438 | 2019-11-01T13:10:29 | 2019-11-01T13:10:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 641 | java | package Day9recursionFactorial;
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
Solution ob=new Solution();
int result=ob.factorial(n);
System.out.println(result);
}
int factorial(int n)
{
if(n<=1)
return 1;
else
return n*factorial(n-1);
}
}
| [
"[email protected]"
] | |
944127225d2e456bbd340c11e6818e9b81977bbf | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/33/33_b5c36ad383f73d4ab9c319cc775287ec410ea778/Main/33_b5c36ad383f73d4ab9c319cc775287ec410ea778_Main_s.java | 7a700b03a6e9e694f30d3ddeceb2e4300b8f8b92 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 1,932 | java | import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import parser.configuration.Config;
import parser.loaders.JarClassLoader;
import parser.loaders.PropertiesFilesLoader;
import parser.parser.PropertiesParser;
import parser.parser.ReflexUtil;
import parser.parser2.PropertiesParser2Impl;
import parser.parser2.RecordFactory;
import parser.writer.ModelXmlWriter;
import java.util.List;
import java.util.Map;
import java.util.Set;
//import parser.model.ClassStructureBuilder;
/**
* Created by IntelliJ IDEA.
* User: al1
* Date: 14.03.12
*/
public class Main {
final static Logger logger = LoggerFactory.getLogger(Main.class);
private JarClassLoader classLoader;
// private ClassStructureBuilder builder;
private PropertiesFilesLoader prLoader;
private Config config;
private PropertiesParser parser;
private ModelXmlWriter writer;
private ReflexUtil util;
private RecordFactory factory;
private void init() {
config = new Config();
config.load();
classLoader = new JarClassLoader(config.getJarPath());
util = new ReflexUtil(config);
//builder = new ClassStructureBuilder(classLoader.getClasses());
factory = new RecordFactory(config);
parser = new PropertiesParser2Impl(factory);
prLoader = new PropertiesFilesLoader(parser, config);
writer = new ModelXmlWriter(config.getOutput());
}
public static void main(String[] args) {
//TODO check input params, if absent getById from properties
Main main = new Main();
main.init();
Map<String, Map<String, List<Object>>> objects = main.prLoader.readPropertieFilesMap();
Set<String> fileNames = objects.keySet();
logger.info(objects.toString());
for(String name : fileNames) {
main.writer.write(objects.get(name));
}
}
}
| [
"[email protected]"
] | |
be3ccccf6515504f11a398d3c330bfacbb10d0ff | e89f839395fb6db256705f5e269d4aa9b96cf553 | /src/main/java/com/bookstore/bookapp/BookappApplication.java | 216a7ca54965d08649af4c9d8e72e56e369abb9e | [] | no_license | Defuster/bookapp | b41bb38cc9e2d04e4e285e3b2282594e6d010579 | 3a933ec1e14e84c90f5dee35fe575094b136c105 | refs/heads/master | 2021-09-09T04:27:25.400510 | 2018-03-13T21:05:11 | 2018-03-13T21:05:11 | 119,689,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,268 | java | package com.bookstore.bookapp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.bookstore.bookapp.bean.Book;
import com.bookstore.bookapp.bean.User;
import com.bookstore.bookapp.repository.BookRepository;
import com.bookstore.bookapp.repository.UserRepository;
@SpringBootApplication
public class BookappApplication {
private static final Logger log = LoggerFactory.getLogger(BookappApplication.class);
public static void main(String[] args) {
SpringApplication.run(BookappApplication.class, args);
}
@Bean
public CommandLineRunner demo(BookRepository bRepository, UserRepository uRep) {
return (args) -> {
bRepository.save(new Book("Bob", "000-1-00-101010-0", 2000));
bRepository.save(new Book("Billy", "100-1-00-101010-1", 2001));
bRepository.save(new Book("Bolly", "010-1-01-101010-2", 2002));
bRepository.save(new Book("Illy", "001-1-10-101010-3", 2003));
bRepository.save(new Book("Olly", "200-2-00-202020-0", 1999));
BCryptPasswordEncoder bc = new BCryptPasswordEncoder();
String pwdUser = "kayttaja";
String hashPwdU = bc.encode(pwdUser);
String pwdAdmin = "adminpassu";
String hashPwdA = bc.encode(pwdAdmin);
uRep.save(new User("admin", hashPwdA, "ROLE_ADMIN", "[email protected]"));
uRep.save(new User("kayttaja", hashPwdU, "ROLE_USER", "[email protected]"));
log.info("Books found with findAll():");
log.info("---------------------------");
for (Book book : bRepository.findAll()) {
log.info(book.toString());
}
log.info("");
Book book = bRepository.findOne(1L);
log.info("Book found with findOne(1L):");
log.info("----------------------------");
log.info(book.toString());
log.info("");
log.info("Book found with findByAuthor('Bob'):");
log.info("------------------------------------");
for (Book bob : bRepository.findByAuthor("Bob")) {
log.info(bob.toString());
}
log.info("");
};
}
}
| [
"[email protected]"
] | |
9f7fa6ed4e5cbb9cb5b80e29842b947158255fdd | b8a0b865c8e28247fcbac2882349223c90494933 | /gr2_lhj/javaํ์ผ/Notice.java | 1e247a441508c6cdb513746cf521a84d8f352725 | [] | no_license | ezenteam2/ZENTAL | 048f6506c1979dd11181d9ffe2dcb7303fb7f05c | 72186846fe517f1fca4686fdff0e084cfa50381e | refs/heads/master | 2021-02-04T21:29:56.510754 | 2020-03-30T04:27:23 | 2020-03-30T04:27:23 | 243,711,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java | package zental.gr2_lhj;
public class Notice {
private String title;
private String content;
private String date;
private String img;
public Notice() {
}
public Notice(String title, String content, String img, String date) {
super();
this.title = title;
this.content = content;
this.date = date;
this.img = img;
}
public String getTitle() {
return title;
}
public String getContent() {
return content;
}
public String getDate() {
return date;
}
public String getImg() {
return img;
}
}
| [
"[email protected]"
] | |
0b5cb21853f232a7bcc631df7ac9d225e722f28d | 129b7a1fc7043eac4720e371caace6cfb6eb3b6f | /src/java/service/MD5.java | a8b21d641978dc13ad87a424f2b9b4bd75e61e24 | [] | no_license | assjava4/JavaWeb_Java4 | 8467d004b91942ee1d366628d7687f2d999fb1e7 | 6772de844b5593a5d884fe73573a1a8d08be7e08 | refs/heads/master | 2021-08-31T08:17:11.396747 | 2017-12-20T18:49:34 | 2017-12-20T18:49:34 | 114,775,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | 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 service;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
*
* @author DuongNguyen
*/
public class MD5 {
public static String Encoding(String ChuoiCanMaHoa) {
String ChuoiMaHoa = "";
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
digest.update(ChuoiCanMaHoa.getBytes());
BigInteger bigInteger = new BigInteger(1, digest.digest());
ChuoiMaHoa = bigInteger.toString(16);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return ChuoiMaHoa;
}
// public static void main(String[] args) {
// System.out.println(MD5.Encoding("123456"));
// }
}
| [
"[email protected]"
] | |
c3383b88bb62e420fa85b56dc746e306b7f1aace | d3e9df882c89aad2f674593e848c5beb2f9f6f82 | /app/src/main/java/com/jhzy/nursinghandover/beans/BindBean.java | c94d3a4df847c4bf893495a9521227ed39d6ea5b | [] | no_license | 1095309465/MutuallyBeneficialHandover | 61450c0f4dbdd1d637d959e4513d2b4edfedfa8a | 8f3f76cac961546507475ff08074d73486ac91e4 | refs/heads/master | 2021-01-23T02:06:17.563114 | 2017-05-31T05:43:21 | 2017-05-31T05:43:21 | 92,908,887 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,397 | java | package com.jhzy.nursinghandover.beans;
/**
* Created by Administrator on 2017/2/26 0026.
*/
public class BindBean {
private String floor;//ๆฅผๅฑ
private String roomName;//ๆฟ้ดๅ
private String regionCode;//ๅบๅ็ผ็
private String roomCode;//ๆฟ้ด็ผ็
private String iem;//่ฎพๅคๅท
@Override
public String toString() {
return "BindBean{" +
"floor='" + floor + '\'' +
", roomName='" + roomName + '\'' +
", regionCode='" + regionCode + '\'' +
", roomCode='" + roomCode + '\'' +
", iem='" + iem + '\'' +
'}';
}
public String getFloor() {
return floor;
}
public void setFloor(String floor) {
this.floor = floor;
}
public String getRoomName() {
return roomName;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getRegionCode() {
return regionCode;
}
public void setRegionCode(String regionCode) {
this.regionCode = regionCode;
}
public String getRoomCode() {
return roomCode;
}
public void setRoomCode(String roomCode) {
this.roomCode = roomCode;
}
public String getIem() {
return iem;
}
public void setIem(String iem) {
this.iem = iem;
}
}
| [
"[email protected]"
] | |
a082907732dbebfdf0fd9c8dcca48a30cd7c2454 | 09d0ddd512472a10bab82c912b66cbb13113fcbf | /TestApplications/WhereYouGo-0.9.3-beta/DecompiledCode/Fernflower/src/main/java/org/mapsforge/android/maps/mapgenerator/TileCache.java | 4dd872ae4ea45c8db8119e56b99a9db09ac5a4db | [] | no_license | sgros/activity_flow_plugin | bde2de3745d95e8097c053795c9e990c829a88f4 | 9e59f8b3adacf078946990db9c58f4965a5ccb48 | refs/heads/master | 2020-06-19T02:39:13.865609 | 2019-07-08T20:17:28 | 2019-07-08T20:17:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package org.mapsforge.android.maps.mapgenerator;
import android.graphics.Bitmap;
public interface TileCache {
boolean containsKey(MapGeneratorJob var1);
void destroy();
Bitmap get(MapGeneratorJob var1);
int getCapacity();
boolean isPersistent();
void put(MapGeneratorJob var1, Bitmap var2);
void setCapacity(int var1);
void setPersistent(boolean var1);
}
| [
"[email protected]"
] | |
244d4781a3f3d1aa6467cdd6208fa6411f425cc4 | 105b7fe8bbaf1b42bbebbc4456dd940058ac5528 | /QtWeb/src/main/java/com/qt/webframe/system/dao/OrganizationMapper.java | 6ce5212649e33af62cf8a17d16bbfb75daf3755d | [] | no_license | Qingtaoz/krsQtweb | 60a8679af9fcc67cb0b62d921e8fabadb26d8614 | 3aef5f7ddd06f6557af887e530e4b024ec6ac846 | refs/heads/master | 2021-01-01T04:02:01.711501 | 2017-11-29T02:11:37 | 2017-11-29T02:11:37 | 97,103,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,770 | java | package com.qt.webframe.system.dao;
import com.qt.webframe.system.pojo.Organization;
import org.springframework.stereotype.Repository;
@Repository
public interface OrganizationMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_bd_organization
*
* @mbg.generated
*/
int deleteByPrimaryKey(String orgid);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_bd_organization
*
* @mbg.generated
*/
int insert(Organization record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_bd_organization
*
* @mbg.generated
*/
int insertSelective(Organization record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_bd_organization
*
* @mbg.generated
*/
Organization selectByPrimaryKey(String orgid);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_bd_organization
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(Organization record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_bd_organization
*
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(Organization record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_bd_organization
*
* @mbg.generated
*/
int updateByPrimaryKey(Organization record);
Organization selectCurrentOrg();
} | [
"[email protected]"
] | |
712daf9502044c45050e3f2d761f3d7f7273832f | 3a9e1e4f3174b065ea296c9d48f69f7a335c4bd4 | /AndEngineWelmoHelper/src/com/welmo/andengine/scenes/descriptors/components/ColoringSpriteDescriptor.java | 36c1cfaf1ed8783c5fbf0a886ff5cdc0ab61ee54 | [] | no_license | ftorte/andenginewelmohelper | f9a43f7545625a9c572c80c542ef4d7570bf2d54 | fdba8c50279b6b136f5a44a1611dab22f99e0c64 | refs/heads/master | 2021-01-25T08:28:32.395619 | 2016-02-20T13:30:06 | 2016-02-20T13:30:06 | 41,960,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package com.welmo.andengine.scenes.descriptors.components;
import org.xml.sax.Attributes;
import com.welmo.andengine.scenes.descriptors.ScnTags;
public class ColoringSpriteDescriptor extends BasicComponentDescriptor{
protected String sImagefileName;
@Override
public void readXMLDescription(Attributes attributes) {
// TODO Auto-generated method stub
super.readXMLDescription(attributes);
String value = null;
//read the filename of the image
if((value = attributes.getValue(ScnTags.S_A_FILE_NAME))!=null)
this.sImagefileName=new String(value);
}
public String getImageFilename() {
return sImagefileName;
}
}
| [
"[email protected]"
] | |
199ba8d1f2d79e219c6beba5705fd110926ad9ad | 38b99d2704378524f900df71eca3f5f5b7f53ec6 | /medina-cms/src/main/java/com/maninman/utils/Converter.java | ca4db3576c7aa178fb81fae22c05fcf00573985f | [] | no_license | zdf8122/medina | e874dc3a0c92f735fe7f63436f9cbc202e42cac1 | d28b91d9b0233a69f92ac54342255c17f3434345 | refs/heads/master | 2022-12-25T01:01:52.783540 | 2012-02-08T06:56:18 | 2012-02-08T06:56:18 | 5,411,327 | 0 | 0 | null | 2022-12-15T23:50:32 | 2012-08-14T10:24:15 | null | UTF-8 | Java | false | false | 2,661 | java | package com.maninman.utils;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
public class Converter {
public static byte[] getBytesFromFile(File f) {
if (f == null) {
return null;
}
try {
FileInputStream stream = new FileInputStream(f);
ByteArrayOutputStream out = new ByteArrayOutputStream(1000);
byte[] b = new byte[1000];
int n;
while ((n = stream.read(b)) != -1)
out.write(b, 0, n);
stream.close();
out.close();
return out.toByteArray();
} catch (IOException e) {
}
return null;
}
/**
* ๆๅญ่ๆฐ็ปไฟๅญไธบไธไธชๆไปถ
* @Author Sean.guo
* @EditTime 2007-8-13 ไธๅ11:45:56
*/
public static File getFileFromBytes(byte[] b, String outputFile) {
BufferedOutputStream stream = null;
File file = null;
try {
file = new File(outputFile);
FileOutputStream fstream = new FileOutputStream(file);
stream = new BufferedOutputStream(fstream);
stream.write(b);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
return file;
}
/**
* ไปๅญ่ๆฐ็ป่ทๅๅฏน่ฑก
* @Author Sean.guo
* @EditTime 2007-8-13 ไธๅ11:46:34
*/
public static Object getObjectFromBytes(byte[] objBytes) throws Exception {
if (objBytes == null || objBytes.length == 0) {
return null;
}
ByteArrayInputStream bi = new ByteArrayInputStream(objBytes);
ObjectInputStream oi = new ObjectInputStream(bi);
return oi.readObject();
}
/**
* ไปๅฏน่ฑก่ทๅไธไธชๅญ่ๆฐ็ป
* @Author Sean.guo
* @EditTime 2007-8-13 ไธๅ11:46:56
*/
public static byte[] getBytesFromObject(Serializable obj) throws Exception {
if (obj == null) {
return null;
}
ByteArrayOutputStream bo = new ByteArrayOutputStream();
ObjectOutputStream oo = new ObjectOutputStream(bo);
oo.writeObject(obj);
return bo.toByteArray();
}
}
| [
"[email protected]"
] | |
4fc6a1c9d29f45f4a768adf478bca00f464d62d1 | 79cdcc45a8e2eaedf287cc7a74b05a1ed7808e42 | /src/main/java/com/funny/CalcVacationDays.java | 22a8da24ad3f1431c1a0c2527dc5c15088f46d43 | [] | no_license | Ryan-Kim/CalcVacationDays | 005b9f227d10dfed29cc00d6d308a38ed627731d | e8344076d2aeb3dd217e2a9a5bde0f0c63c63f1c | refs/heads/master | 2021-01-25T00:10:07.135475 | 2015-09-15T21:18:07 | 2015-09-15T21:23:37 | 42,547,270 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,081 | java | package com.funny;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Calendar;
public class CalcVacationDays extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String earnDaysStr = req.getParameter("earnDays");
String carriedDaysStr = req.getParameter("carriedDays");
String spentDaysStr = req.getParameter("spentDays");
int earnDays = Integer.parseInt(earnDaysStr);
int carriedDays = Integer.parseInt(carriedDaysStr);
int spentDays = Integer.parseInt(spentDaysStr);
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, -1);
int month = cal.get(Calendar.MONTH);
double rate = earnDays / 12;
double remainingDays = rate * month + carriedDays - spentDays;
int remainingDaysByThisYear = earnDays + carriedDays - spentDays;
PrintWriter out = res.getWriter();
out.println (
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" +" +
"http://www.w3.org/TR/html4/loose.dtd\">\n" +
"<html> \n" +
"<head> \n" +
"<meta http-equiv=\"Content-Type\" content=\"text/html; " +
"charset=ISO-8859-1\"> \n" +
"<title> Remaining Vacation Days </title> \n" +
"</head> \n" +
"<body> <div align='center'> \n" +
"<style= \"font-size=\"12px\" color='black'\"" + "\">" +
"Currently " + remainingDays + " days are available <br> " +
remainingDaysByThisYear + " days are available by the end of this year" +
"</font></body> \n" +
"</html>"
);
}
} | [
"[email protected]"
] | |
4611d36adab8e41e3b5b7bb34283dace7383524f | 0260ab6cb6e3211b86678287e4fb5d50894ecd72 | /app/src/main/java/mno/mohamed_youssef/myfaculty/adapter/LocationsAdapterR.java | 917817bfda745ce8329005edf3d4789b053c51f4 | [] | no_license | mohammed00101/koleaty-mesalya | f7d7f39867d342fd645175b9531c0cdb212b74b9 | 3b24c4abb7bd781b79a3fda03f8b904affe3e12d | refs/heads/master | 2021-01-11T07:01:31.321753 | 2016-10-30T01:42:24 | 2016-10-30T01:42:24 | 72,318,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,038 | java | package mno.mohamed_youssef.myfaculty.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.firebase.storage.StorageReference;
import java.util.LinkedList;
import mno.mohamed_youssef.myfaculty.R;
import mno.mohamed_youssef.myfaculty.model.Lectures;
import mno.mohamed_youssef.myfaculty.model.Location;
/**
* Created by Mohamed Yossif on 13/10/2016.
*/
public class LocationsAdapterR extends RecyclerView.Adapter<LocationsAdapterR.ViewHolder> {
private LinkedList<Location> locations;
private Context context;
private LayoutInflater inflater;
public LocationsAdapterR(Context context , LinkedList<Location> locations){
this.locations = locations;
this.context = context;
this.inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public LocationsAdapterR.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.list_locations, parent, false);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder( LocationsAdapterR.ViewHolder holder, int position) {
Location lect =locations.get(position);
holder.locationName.setText(lect.getLocation());
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemCount() {
return locations.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
// each data item is just a string in this case
private TextView locationName;
public View view;
public ViewHolder(View v ) {
super(v);
this.view=v;
locationName = (TextView) v.findViewById(R.id.textLocationsName) ;
}
}
}
| [
"[email protected]"
] | |
cd78aa9ee5060bf31d09ac5168b31b51dd726095 | 55d111fee593da3cb5bb0155775f50d2062c2e03 | /android/src/test/ConnectivityTestLauncher.java | dbc395ba63107366c9c28136bbd5d97cb4b270ee | [] | no_license | antonio-ramadas/Bowling | af8a485468aba1d65098db6ff4d8c6b2d04ffb5e | ed3abc8972183a9ec74ff5878844904961d65496 | refs/heads/master | 2021-01-21T19:58:58.413223 | 2015-06-07T19:58:24 | 2015-06-07T19:58:24 | 36,235,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | package test;
import android.content.Intent;
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
public class ConnectivityTestLauncher extends AndroidApplication implements TestSocketClient.Callback {
TestSocketClient test = new TestSocketClient();
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
test.setMyGameCallback(this);
initialize(test, config);
}
public void startScannerActivity() {
IntentIntegrator scanIntegrator = new IntentIntegrator(this);
scanIntegrator.initiateScan();
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
test.ServerIP= scanResult.getContents();
}
}
}
| [
"[email protected]"
] | |
b8920025ea3624e45ec63b3f2fa50abe18754540 | b4328b00202b1fe2fb8a3ac20691a9054592aca5 | /multiplayer/hypersonic/src/test/java/org/ndx/codingame/hypersonic/InGameTest.java | 8dbf75bd21b9ad3d421e2c28048845af0dbaa942 | [] | no_license | nmahoude/codingame-1 | 0c000cd03813439ca4174457a8c7f3ac74c056fb | e59cfd50be43d18b57d15e5500f789bd6830c53d | refs/heads/master | 2021-05-03T12:17:52.860700 | 2016-11-26T10:08:34 | 2016-11-26T10:08:34 | 70,131,858 | 0 | 0 | null | 2016-10-06T07:21:19 | 2016-10-06T07:21:19 | null | UTF-8 | Java | false | false | 7,314 | java | package org.ndx.codingame.hypersonic;
import static org.assertj.core.api.Assertions.assertThat;
import static org.ndx.codingame.hypersonic.PlayerTest.read;
import java.util.Arrays;
import org.junit.Ignore;
import org.junit.Test;
import org.ndx.codingame.hypersonic.content.Bomb;
import org.ndx.codingame.hypersonic.content.Item;
public class InGameTest {
@Test public void can_find_move_1479318135242() {
Playfield tested = read(Arrays.asList(
".........0...",
".............",
".............",
".............",
"0............",
".............",
"0............",
".............",
".0...........",
".............",
"...0.0.0.0..."
));
Gamer me = new Gamer(0, 2, 6, 0, 6);
tested.readGameEntities(
new Item(0, 3, 0, 2, 0),
new Item(0, 1, 2, 1, 0),
new Item(0, 3, 2, 2, 0),
new Item(0, 9, 2, 2, 0),
new Item(0, 11, 2, 1, 0),
new Bomb(0, 1, 4, 4, 5),
new Bomb(0, 4, 4, 2, 5),
new Bomb(0, 1, 6, 8, 6),
new Item(0, 3, 8, 2, 0),
new Gamer(1, 4, 9, 0, 6),
new Bomb(1, 5, 9, 7, 6),
new Bomb(1, 7, 9, 3, 6)
);
assertThat(me.compute(tested)).isNotEqualTo("MOVE 3 6");
}
@Test public void can_find_move_1479328110167() {
Playfield tested = read(Arrays.asList(
"..00.000.00..",
".X0X0X0X0X0X.",
".0...000...0.",
".X.X0X0X0X.X.",
"000.0.0.0.000",
"0X.X.X.X.X.X0",
"000.0.0.0.000",
".X.X0X0X0X.X.",
".0...000...0.",
".X0X0X0X0X0X.",
"..00.000.00.."
));
Gamer me = new Gamer(0, 1, 0, 0, 3);
tested.readGameEntities(
new Bomb(0, 0, 2, 2, 3),
new Bomb(1, 12, 7, 4, 3)
);
assertThat(me.compute(tested)).isEqualTo("MOVE 1 0");
}
@Test public void can_find_move_1479329573531() {
Playfield tested = read(Arrays.asList(
"..0.0.0.0.0..",
".X0X.X0X.X0X.",
"00.00...00.00",
"0X.X.X.X.X.X0",
"..00.....00..",
".X.X.X.X.X.X.",
"..00.....00..",
"0X.X.X.X.X.X0",
"00.00...00.00",
".X0X.X0X.X0X.",
"..0.0.0.0.0.."
));
Gamer me = new Gamer(1, 12, 10, 1, 3);
tested.readGameEntities(
new Gamer(0, 0, 0, 1, 3)
);
assertThat(me.compute(tested)).isNotIn("MOVE 12 10");
}
@Test public void can_find_move_1479372001821() {
Playfield tested = read(Arrays.asList(
"..00.0.0.00..",
".X0X0X.X0X0X.",
"0000..0..0000",
".X0X.X.X.X0X.",
"0.0.00000.0.0",
".X.X.X.X.X.X.",
"0.0.00000.0.0",
".X0X.X.X.X0X.",
"0000..0..0000",
".X0X0X.X0X0X.",
"..00.0.0....."
));
Gamer me = new Gamer(1, 8, 10, 1, 3);
tested.readGameEntities(
new Gamer(0, 1, 0, 1, 3),
new Bomb(1, 11, 10, 2, 3)
);
assertThat(me.compute(tested)).isNotEqualTo("MOVE 9 10");
}
@Test public void can_find_move_1479376321186() {
Playfield tested = read(Arrays.asList(
"....00000.0..",
".X0X.X.X.X0X.",
"00.0000000.00",
"0X.X0X0X0X.X0",
"00..0.0.0..00",
".X0X.X.X.X0X.",
"00..0.0.0..00",
"0X.X0X0X0X.X0",
"00.0000000.00",
".X0X.X.X.X0X.",
"..0.00000...."
));
Gamer me = new Gamer(0, 3, 0, 1, 3);
tested.readGameEntities(
new Bomb(0, 1, 0, 1, 3),
new Bomb(1, 9, 10, 4, 3)
);
assertThat(me.compute(tested)).isNotNull();
}
@Test public void should_not_drop_bomb_on_empty_ground() {
Playfield tested = read(Arrays.asList(
"...00...0....",
".X0X0X.X0X.X.",
"....0...0...0",
".X0X.X.X.X0X.",
"00..0...0..00",
".X.X.X0X.X.X.",
"00..0...0..00",
".X0X.X.X.X0X.",
"0...0...0...0",
".X.X0X.X0X0X.",
"....0...0...."
));
Gamer me = new Gamer(1, 11, 10, 1, 3);
tested.readGameEntities(
new Gamer(0, 2, 0, 1, 3),
new Item(0, 9, 0, 1, 0),
new Item(0, 10, 1, 1, 0),
new Gamer(2, 12, 1, 1, 3),
new Item(0, 0, 2, 2, 0),
new Gamer(3, 0, 9, 1, 3),
new Item(0, 2, 9, 1, 0),
new Item(0, 3, 10, 1, 0),
new Item(0, 9, 10, 1, 0)
);
assertThat(me.compute(tested)).doesNotStartWith("BOMB");
}
@Test public void bomb_that_spot() {
Playfield tested = read(Arrays.asList(
".............",
".X.X.X.X.X0X.",
".............",
".X.X.X.X.X0X.",
".............",
".X.X0X.X.X.X.",
".000.....0...",
".X.X0X.X.X.X.",
"....0........",
".X.X.X.X.X.X.",
"............."
));
Gamer me = new Gamer(2, 5, 8, 7, 9);
tested.readGameEntities(
new Item(0, 1, 2, 2, 0),
new Bomb(1, 3, 2, 3, 10),
new Bomb(1, 4, 2, 4, 10),
new Bomb(1, 2, 4, 8, 12),
new Gamer(1, 2, 5, 6, 12),
new Bomb(0, 2, 8, 1, 7),
new Item(0, 3, 8, 1, 0),
new Gamer(0, 4, 10, 4, 7)
);
assertThat(me.compute(tested)).startsWith("BOMB");
}
@Test public void should_grab_item_beside() {
Playfield tested = read(Arrays.asList(
"..........0..",
".X.X.X.X.X.X.",
".......00...0",
"0X.X.X.X.X0X0",
"........0....",
"0X.X.X.X.X.X0",
"..0..........",
"0X0X.X.X.X.X0",
"0...000......",
".X.X.X.X.X.X.",
"..0..00......"
));
Gamer me = new Gamer(1, 8, 8, 2, 5);
tested.readGameEntities(
new Gamer(0, 1, 0, 1, 6),
new Bomb(0, 2, 1, 2, 6),
new Bomb(0, 0, 2, 5, 6),
new Item(0, 6, 2, 1, 0),
new Item(0, 10, 4, 1, 0),
new Item(0, 4, 6, 1, 0),
new Item(0, 8, 6, 1, 0),
new Item(0, 7, 8, 2, 0)
);
assertThat(me.compute(tested)).isNotNull();
}
@Test public void i_should_drop_a_bomb() {
Playfield tested = read(Arrays.asList(
".............",
".X.X.X.X.X.X.",
".............",
".X.X.X.X.X.X.",
".............",
".X.X.X.X.X.X.",
".............",
".X.X.X.X.X.X.",
".............",
".X.X.X.X.X.X.",
".....0......."
));
Gamer me = new Gamer(1, 3, 10, 7, 8);
tested.readGameEntities(
new Item(0, 0, 3, 2, 0),
new Item(0, 0, 5, 2, 0),
new Item(0, 0, 7, 2, 0),
new Item(0, 12, 7, 2, 0),
new Gamer(0, 4, 8, 5, 9)
);
assertThat(me.compute(tested)).isNotNull();
}
@Test public void do_not_go_in_bomb_alley() {
Playfield tested = read(Arrays.asList(
".............",
".X.X.X.X.X.X.",
"..0..........",
".X.X.X.X.X.X.",
".....0.0.00..",
".X.X.X.X.X0X.",
".000.0.0.0...",
".X0X0X.X0X0X.",
".0000....00..",
".X.X.X.X.X.X.",
"..0..0......."
));
Gamer me = new Gamer(2, 6, 2, 6, 5);
tested.readGameEntities(
new Item(0, 2, 0, 1, 0),
new Item(0, 3, 2, 1, 0),
new Gamer(0, 4, 2, 5, 6),
new Bomb(2, 8, 3, 2, 5),
new Item(0, 11, 4, 1, 0),
new Item(0, 10, 6, 2, 0),
new Gamer(1, 6, 8, 2, 5),
new Bomb(1, 8, 8, 7, 5),
new Bomb(1, 7, 10, 4, 5)
);
assertThat(me.compute(tested)).isNotEqualTo("BOMB 6 3");
}
@Test @Ignore public void run_for_your_life_moron() {
Playfield tested = read(Arrays.asList(
".............",
".X.X.X.X.X.X.",
".............",
".X.X.X.X.X.X.",
".....0....0..",
".X.X.X.X.X0X.",
".000.0.......",
".X0X.X.X.X0X.",
".000......0..",
".X.X.X.X.X.X.",
"............."
));
Gamer me = new Gamer(2, 10, 6, 3, 6);
tested.readGameEntities(
new Gamer(0, 3, 4, 5, 8),
new Bomb(2, 6, 4, 3, 5),
new Bomb(2, 7, 4, 4, 5),
new Bomb(2, 8, 4, 5, 5),
new Item(0, 9, 4, 1, 0),
new Item(0, 11, 4, 1, 0),
new Bomb(0, 4, 6, 3, 8),
new Gamer(1, 7, 6, 5, 5),
new Bomb(2, 8, 6, 7, 5),
new Bomb(2, 9, 6, 8, 6),
new Item(0, 4, 7, 1, 0),
new Bomb(1, 6, 8, 3, 5),
new Item(0, 2, 10, 1, 0)
);
assertThat(me.compute(tested)).doesNotEndWith("10 6");
}
} | [
"[email protected]"
] | |
7e158e42894f89313a205972a5f42cffc4de92f8 | 037c2ec8a9800e6c1528cdae2fe42fe8e9e84838 | /src/day3/assignment1/Student.java | b4fcb1c92b15d254d3e9ac0249afbe6d0e32c0d4 | [] | no_license | starbhattarai/Java_Project | bed2f3ecf88850c63fbf0e7f52fa4d866eb53d71 | e7818d0a54041d2844a3640540f546d9a6b65b77 | refs/heads/master | 2020-06-04T01:41:31.572877 | 2019-06-13T19:20:42 | 2019-06-13T19:20:42 | 191,819,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,033 | java | package day3.assignment1;
public class Student {
private int studentId=550;
private static int studentCount;
private char studentType;
private String studentName;
static {
studentCount = 10;
}
public Student(){
studentCount++;
studentId = studentId+studentCount;
}
public Student(char sType,String fname,String lname){
this();
studentName = fname+" "+lname;
studentType = sType;
}
public static int getStudentCount() {
return studentCount;
}
public void displayDetails(Student ob) {
System.out.println("Student id is "+ob.studentId);
System.out.println("Student type is "+ob.studentType);
System.out.println("Student name is "+ob.studentName);
}
public static void main(String[] args) {
Student st1 = new Student('D',"Bony","Thomas");
st1.displayDetails(st1);
System.out.println("Total number of student is "+getStudentCount());
Student st2 = new Student('H',"Dinil","Bose");
st2.displayDetails(st2);
System.out.println("Total number of student is "+getStudentCount());
}
} | [
"[email protected]"
] | |
5d147af47e5d9c3c67e01e08fff478520ee26a66 | 782125c3f41986fe80ff6df1053bedf377e184e9 | /src/main/java/com/example/demo/com/boot/CursomcApplication.java | f81d6baa01178d365aff4150e130c9d7c4d537ab | [] | no_license | roberiobrito/cursomc | 84863acd4e13992eaa41b36db5bf3d31afdf6e79 | 4145f6ff65f164c0909cdc28032652bf7711e1e1 | refs/heads/master | 2023-02-15T21:59:08.158423 | 2021-01-15T00:09:38 | 2021-01-15T00:09:38 | 329,423,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,645 | java | package com.example.demo.com.boot;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.example.demo.com.boot.domain.Categoria;
import com.example.demo.com.boot.domain.Produto;
import com.example.demo.com.boot.repositories.CategoriaRepository;
import com.example.demo.com.boot.repositories.ProdutoRepository;
import com.sun.xml.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;
@SpringBootApplication
public class CursomcApplication implements CommandLineRunner {
@Autowired
private CategoriaRepository categoriaRepository;
@Autowired
private ProdutoRepository produtoRepository;
public static void main(String[] args) {
SpringApplication.run(CursomcApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
Categoria cat1 = new Categoria(null, "Informรกtica");
Categoria cat2 = new Categoria(null, "Escritorio");
Produto p1 = new Produto(null, "Computador", 2000.00);
Produto p2 = new Produto(null, "Impressora", 800.00);
Produto p3 = new Produto(null, "Mouse", 150.00);
cat1.getProdutos().addAll(Arrays.asList(p1,p2,p3));
cat2.getProdutos().addAll(Arrays.asList(p2));
p1.getCategorias().addAll(Arrays.asList(cat1));
p2.getCategorias().addAll(Arrays.asList(cat1,cat2));
p3.getCategorias().addAll(Arrays.asList(cat1));
categoriaRepository.saveAll(Arrays.asList(cat1, cat2));
produtoRepository.saveAll(Arrays.asList(p1, p2, p3));
}
}
| [
"[email protected]"
] | |
34e74412b6d7385017c6dbbf7f239be5ca65916d | 201ac33cf1fcdc54bc2133216dfa5c9531dd41f2 | /src/main/java/com/qa/persistence/repository/TrainerRepository.java | d8f9a96197c4ad28b7ad3cf85bdc7142a7a39440 | [] | no_license | scrappy1987/trainer-app-50 | 15aa82ee9bcdf4c241dfc4d199d18bc5ad6e00dc | aed467d421f7542920bc06428d02bd1e0844a99e | refs/heads/master | 2020-08-27T08:32:30.329901 | 2019-10-24T14:50:15 | 2019-10-24T14:50:15 | 217,301,274 | 0 | 0 | null | 2019-10-24T14:27:42 | 2019-10-24T13:05:44 | Java | UTF-8 | Java | false | false | 299 | java | package com.qa.persistence.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.qa.persistence.domain.Trainer;
@Repository
public interface TrainerRepository extends JpaRepository<Trainer, Long> {
} | [
"[email protected]"
] | |
196ba7b748ad4dc6b6161c8269bfaf6cc7cfa58c | b6bd3f27dc0925461495b3fce6056c4077c5d28c | /app/src/main/java/com/qhsoft/killrecord/model/remote/bean/FileUploadResultBean.java | 5567a88e27c76b545dec241b1e5f6c778e0e9eb6 | [] | no_license | woshixiaohai/KillRecord | b3b87dc6469cb3883216b99d41358bb4dd6c23d2 | b7bbc8e80db9b9da6cd608af444ee9f80337e068 | refs/heads/master | 2020-06-23T20:50:19.365199 | 2019-07-25T03:14:36 | 2019-07-25T03:14:36 | 198,748,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,301 | java | package com.qhsoft.killrecord.model.remote.bean;
/**
* Description:
* Author:lin
* Date:2017-10-19
*/
public class FileUploadResultBean {
/**
* success : true
* msg : ๆไฝๆๅ
* obj : {"fileId":"402880c25f32ba45015f32bc403e0002","filePath":"upload\\files\\20171019114518t11AGqIi.jpg","fileName":"545bd70a945afe2ff9cf7.jpg"}
* code : 200
* attributes : null
* jsonStr : {"obj":{"fileId":"402880c25f32ba45015f32bc403e0002","filePath":"upload\\files\\20171019114518t11AGqIi.jpg","fileName":"545bd70a945afe2ff9cf7.jpg"},"msg":"ๆไฝๆๅ","success":true}
*/
private boolean success;
private String msg;
private ObjBean obj;
private int code;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public ObjBean getObj() {
return obj;
}
public void setObj(ObjBean obj) {
this.obj = obj;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public static class ObjBean {
/**
* fileId : 402880c25f32ba45015f32bc403e0002
* filePath : upload\files\20171019114518t11AGqIi.jpg
* fileName : 545bd70a945afe2ff9cf7.jpg
*/
private String fileId;
private String filePath;
private String fileName;
private String localPath;
public String getLocalPath() {
return localPath;
}
public void setLocalPath(String localPath) {
this.localPath = localPath;
}
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
}
}
| [
"[email protected]"
] | |
6388b43c230031ce477a1d5e49fbffdb67e1fd4e | fcdd4b877e2855324fb47d4ecdff85b912803214 | /src/test/java/com/walleftech/csbe/CsbeApplicationTests.java | 252f783883460ff8bc17bc61b025d1e6c4f91ef5 | [] | no_license | wallefaquino/curso-springboot-expert | 839b88e6a6b680c9ad14a11a25d961468fc90ec4 | 9f86c74c12f4057e196166918892124c9e70940b | refs/heads/master | 2022-10-21T14:18:57.646214 | 2020-06-10T01:32:33 | 2020-06-10T01:32:33 | 271,144,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 209 | java | package com.walleftech.csbe;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CsbeApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
e5b10e9923a54e4447cac591aa382600d8fd677d | f8416288929f744749eab997b57bbe167c390b3a | /base-library/src/main/java/http/convert/GsonResponseBodyConverter.java | 50338e3bf976cbd487456d61ce90bb94ab892e09 | [] | no_license | IamStupidMan/modularization | 39450dcbc43a730d55d3141a9b1ddbb2418eff20 | 5527311420c3e739fe995c0562c22aa769f10e4f | refs/heads/master | 2021-07-19T22:20:03.796112 | 2020-05-06T08:43:05 | 2020-05-06T08:43:05 | 141,953,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,484 | java | /*
* Copyright (C) 2015 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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 http.convert;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;
import http.exception.ApiException;
import http.HttpStatus;
import okhttp3.MediaType;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import utils.LogUtils;
import static okhttp3.internal.Util.UTF_8;
/**
* <pre>
* author: Summer
* time : 2018/01/06
* desc : ๅฏน่ฟๅresponse้ขๅค็
* </pre>
*/
final class GsonResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private final Gson gson;
private final TypeAdapter<T> adapter;
GsonResponseBodyConverter(Gson gson, TypeAdapter<T> adapter) {
this.gson = gson;
this.adapter = adapter;
}
@Override
public T convert(ResponseBody value) throws IOException {
String response = value.string();
HttpStatus httpStatus = gson.fromJson(response, HttpStatus.class);
LogUtils.e("่ฟๅๆฐๆฎ๏ผ" + response);
if (!httpStatus.isApiSuccess()) {
LogUtils.d("httpStatus !!!!!!!!!!!!!!!!!!!!!!!!isApiSuccess");
value.close();
throw new ApiException(httpStatus.getCode(), httpStatus.getMessage());
}
MediaType contentType = value.contentType();
Charset charset = contentType != null ? contentType.charset(UTF_8) : UTF_8;
InputStream inputStream = new ByteArrayInputStream(response.getBytes());
Reader reader = new InputStreamReader(inputStream, charset);
JsonReader jsonReader = gson.newJsonReader(reader);
try {
return adapter.read(jsonReader);
} finally {
value.close();
}
}
}
| [
"[email protected]"
] | |
484981dd54961d4feb2d9145003f5d25d84e31a2 | ec633d6878dc08515654c972e9cf5f95499079ed | /app/src/androidTest/java/com/joeso/retrofit2test/ExampleInstrumentedTest.java | ca430e26e9cc1e2a7499764d02f6d02599164ba7 | [] | no_license | sujuejoeso/Retrofit2_test | f4fc0626245b499f382eb3864fce372c39eb63eb | cc1b8d951ca9c6cf59832dd3b957ffefcdcf926f | refs/heads/master | 2020-12-23T17:06:55.577833 | 2020-02-16T05:53:12 | 2020-02-16T05:53:12 | 237,212,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package com.joeso.retrofit2test;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.joeso.retrofit2test", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
578efb17e1ec8a7839fb454f3beceb906c03d0bf | 7a0dc870541776531b41e5ae4646d424a0515ca9 | /app/src/main/java/com/example/idlegame/utilities/DataCollector.java | 2f60e38a92379d2a28a9c76669cbf3e13d2f096e | [] | no_license | PhiboGit/IdleGame | 08043e773163e556fcf782647c76aabd1ec72020 | 310fb1fdb8bb43d2f7157eb43c77dd55df502d2c | refs/heads/master | 2022-11-23T17:49:45.274955 | 2020-07-24T02:06:02 | 2020-07-24T02:06:02 | 282,100,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package com.example.idlegame.utilities;
import com.example.idlegame.data.Resource;
import java.util.List;
public interface DataCollector {
void resources(List<Resource> resourceArrayList);
}
| [
"[email protected]"
] | |
7cf64681e596cba5df4a0bbfed8531af2930643a | 5c024da1bfb1de9896d53095fcfadd29ff9077c8 | /sso/src/main/java/com/dqqzj/io/sso/aliyun/model/SendSmsRequest.java | ec532b7b787223ff3aca17f89c2bafe71ca1e3e7 | [] | no_license | gonglijian600/finchley | a0bdc9e195a7aa6a3b4b3b3580876ff94cba7f26 | 1e3d51224a7752b87f29d8618fa2da8578c0de4c | refs/heads/master | 2020-04-29T22:53:35.209626 | 2019-01-22T16:00:47 | 2019-01-22T16:00:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,337 | java | package com.dqqzj.io.sso.aliyun.model;
/**
* Created by qzj on 2018/1/12
*/
import com.aliyuncs.RpcAcsRequest;
public class SendSmsRequest extends RpcAcsRequest<SendSmsResponse> {
private String templateCode;
private String phoneNumbers;
private String signName;
private String resourceOwnerAccount;
private String templateParam;
private Long resourceOwnerId;
private Long ownerId;
private String smsUpExtendCode;
private String outId;
public SendSmsRequest() {
super("Dysmsapi", "2017-05-25", "SendSms");
}
public String getTemplateCode() {
return this.templateCode;
}
public void setTemplateCode(String templateCode) {
this.templateCode = templateCode;
if (templateCode != null) {
this.putQueryParameter("TemplateCode", templateCode);
}
}
public String getPhoneNumbers() {
return this.phoneNumbers;
}
public void setPhoneNumbers(String phoneNumbers) {
this.phoneNumbers = phoneNumbers;
if (phoneNumbers != null) {
this.putQueryParameter("PhoneNumbers", phoneNumbers);
}
}
public String getSignName() {
return this.signName;
}
public void setSignName(String signName) {
this.signName = signName;
if (signName != null) {
this.putQueryParameter("SignName", signName);
}
}
public String getResourceOwnerAccount() {
return this.resourceOwnerAccount;
}
public void setResourceOwnerAccount(String resourceOwnerAccount) {
this.resourceOwnerAccount = resourceOwnerAccount;
if (resourceOwnerAccount != null) {
this.putQueryParameter("ResourceOwnerAccount", resourceOwnerAccount);
}
}
public String getTemplateParam() {
return this.templateParam;
}
public void setTemplateParam(String templateParam) {
this.templateParam = templateParam;
if (templateParam != null) {
this.putQueryParameter("TemplateParam", templateParam);
}
}
public Long getResourceOwnerId() {
return this.resourceOwnerId;
}
public void setResourceOwnerId(Long resourceOwnerId) {
this.resourceOwnerId = resourceOwnerId;
if (resourceOwnerId != null) {
this.putQueryParameter("ResourceOwnerId", resourceOwnerId.toString());
}
}
public Long getOwnerId() {
return this.ownerId;
}
public void setOwnerId(Long ownerId) {
this.ownerId = ownerId;
if (ownerId != null) {
this.putQueryParameter("OwnerId", ownerId.toString());
}
}
public String getSmsUpExtendCode() {
return this.smsUpExtendCode;
}
public void setSmsUpExtendCode(String smsUpExtendCode) {
this.smsUpExtendCode = smsUpExtendCode;
if (smsUpExtendCode != null) {
this.putQueryParameter("SmsUpExtendCode", smsUpExtendCode);
}
}
public String getOutId() {
return this.outId;
}
public void setOutId(String outId) {
this.outId = outId;
if (outId != null) {
this.putQueryParameter("OutId", outId);
}
}
public Class<SendSmsResponse> getResponseClass() {
return SendSmsResponse.class;
}
}
| [
"[email protected]"
] | |
9c5feac26399fb7335883eded7d845e8c1cee823 | 11432f168ac250f53c6ae7f19470a75e1d2e6b3a | /src/test/java/ios/favorite/FavoriteFromSearchListViewTest.java | a658a3bb5f6022d6e6d2ac350bd7a47d5a9bcbc6 | [] | no_license | mfinn-HFC/vdb-mobile-automation | 63dd5b4f28fcc784a589b78528902b8d5db892fc | a6f39e93db9c97c630c11d1380a27f9f517d6549 | refs/heads/master | 2021-01-11T12:10:18.133158 | 2017-02-17T15:58:59 | 2017-02-17T15:58:59 | 79,380,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,891 | java | package ios.favorite;
import base.iOSBaseTest;
import io.appium.java_client.ios.IOSDriver;
import junit.framework.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.annotations.Test;
import screens.ios.FavoriteScreen;
import screens.ios.SearchResultScreen;
import screens.ios.SearchScreen;
import screens.ios.TermsAndConditionsScreen;
import util.factory.EyesProvider;
/**
* Created by matt-hfc on 1/17/17.
*
* Add two favorites from list view
* Remove one favorite from list view
* Go to favorite screen
* Assert favorite is there
* Remove favorite and assert no favorites are remaining
*/
public class FavoriteFromSearchListViewTest extends iOSBaseTest {
@Test(dataProvider = "ios")
public void favoriteFromSearchListViewTest(DesiredCapabilities capabilities) throws InterruptedException {
setUp(capabilities, this.getClass());
eyesProvider = new EyesProvider(driver, appName, this.getClass().getSimpleName());
eyes = eyesProvider.getEyes();
loginScreen.acceptNotificationsButton();
registerActivateNewUser();
TermsAndConditionsScreen termsAndConditionsScreen = loginScreen.newUserLogin(user);
termsAndConditionsScreen.acceptTerms();
SearchScreen searchScreen = new SearchScreen(driver);
searchScreen.getFromValueInput().sendKeys("100");
searchScreen.getToValueInput().sendKeys("100");
searchScreen.getToText().click();
searchScreen.tapSearchButton();
SearchResultScreen searchResultScreen = new SearchResultScreen(driver);
searchResultScreen.waitForSearchResultsToLoad();
searchResultScreen.getListviewButton().click();
searchResultScreen.waitForListViewToLoad();
searchResultScreen.getFavoriteButtonsListView().get(0).click();
eyes.checkWindow("One favorite added");
searchResultScreen.getFavoriteButtonsListView().get(1).click();
eyes.checkWindow("Two favorites added");
searchResultScreen.getFavoriteButtonsListView().get(1).click();
eyes.checkWindow("One favorite removed");
searchResultScreen.getFavoriteToolbarButton().click();
FavoriteScreen favoriteScreen = new FavoriteScreen(driver);
wait.until(ExpectedConditions.elementToBeClickable(favoriteScreen.getTrashButton()));
Assert.assertTrue(favoriteScreen.getBookmarkChecks().size() == 1);
favoriteScreen.getBookmarkChecks().get(0).click();
favoriteScreen.getTrashButton().click();
favoriteScreen.getYesButtonDelete().click();
wait.until(ExpectedConditions.elementToBeClickable(favoriteScreen.getTrashButton()));
Assert.assertTrue(favoriteScreen.getBookmarkChecks().size() == 0);
}
}
| [
"iasKor12"
] | iasKor12 |
81b98a3d4b723a71e967681c414063070bc151ae | db011b9ba459ccb07acf945113a67bb853d07a86 | /src/test/java/stepDefination/SmokeTest.java | 01a40487c5602a9f41206f49bda16032b01c91d6 | [] | no_license | joydeepguha810/SeleniumAutomation | 5bf7f492ceb63c20e256bf29d398ab79cc442188 | 028357bb7024d473c7e22c1de8a84461bd148244 | refs/heads/master | 2023-03-25T11:40:36.987413 | 2020-12-21T16:41:05 | 2020-12-21T16:41:05 | 323,375,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,231 | java | package stepDefination;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class SmokeTest
{
WebDriver driver;
@Given("^Open firefox and start application$")
public void Open_firefox_and_start_application() throws Throwable {
System.setProperty("webdriver.gecko.driver","D:\\Selenium\\geckodriver.exe");
driver= new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://facebook.com");
}
@When("^I enter valid \"([^\"]*)\" and valid \"([^\"]*)\"$")
public void I_enter_valid_and_valid(String uname, String pass) throws Throwable {
driver.findElement(By.id("email")).sendKeys(uname);
driver.findElement(By.id("pass")).sendKeys(pass);
}
@Then("^user should be able to login successfully$")
public void user_should_be_able_to_login_successfully() throws Throwable {
driver.findElement(By.id("u_0_b")).click();
}
@Then("^application should be closed$")
public void application_should_be_closed() throws Throwable {
driver.quit();
}
}
| [
"[email protected]"
] | |
b92037298f110abcc494e52b3943776b117b66fc | 9d2932347b16aeace3b2a88163ffb08e37d8b6d3 | /src/ua/edu/hneu/dietapp/dao/RationDAO.java | 1134047e6d2f8c7904d47933909a85a100c1523f | [] | no_license | margaritazainullina/dietapp | 2c7a314ef4ca1186d373513631356f51a03e1e3b | dceb7f240a5bad2ee4859ef4c8e3f6950f348d14 | refs/heads/master | 2016-09-05T10:24:05.773251 | 2014-05-20T12:28:49 | 2014-05-20T12:30:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,148 | java | package ua.edu.hneu.dietapp.dao;
import java.util.HashMap;
import ua.edu.hneu.dietapp.db.DietDbHelper;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.text.TextUtils;
public class RationDAO extends ContentProvider {
public static String TABLE_NAME = "ration";
public static final String ID = "_id";
public static final String D_ID = "dish_id";
public static final String RAT_SCH_ID = "ration_schedule_id";
public static final String TIME = "time";
public static final String DAY = "day";
public static final Uri CONTENT_URI = Uri
.parse("content://ua.edu.hneu.dietapp.rationprovider/diet");
public static final int URI_CODE = 1;
public static final int URI_CODE_ID = 2;
private static final UriMatcher mUriMatcher;
private static HashMap<String, String> mContactMap;
static SQLiteDatabase db;
static {
mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
mUriMatcher.addURI("ua.hneu.languagetrainer.db", TABLE_NAME, URI_CODE);
mUriMatcher.addURI("ua.hneu.languagetrainer.db", TABLE_NAME + "/#",
URI_CODE_ID);
mContactMap = new HashMap<String, String>();
mContactMap.put(DietDbHelper._ID, DietDbHelper._ID);
mContactMap.put(RAT_SCH_ID, RAT_SCH_ID);
mContactMap.put(D_ID, D_ID);
mContactMap.put(TIME, TIME);
mContactMap.put(DAY, DAY);
}
public String getDbName() {
return (DietDbHelper.DB_NAME);
}
public static SQLiteDatabase getDb() {
return db;
}
@Override
public boolean onCreate() {
db = (new DietDbHelper(getContext())).getWritableDatabase();
return (db == null) ? false : true;
}
@Override
public Cursor query(Uri url, String[] projection, String selection,
String[] selectionArgs, String sort) {
String orderBy;
if (TextUtils.isEmpty(sort)) {
orderBy = ID;
} else {
orderBy = sort;
}
Cursor c = db.query(TABLE_NAME, projection, selection, selectionArgs,
null, null, orderBy);
c.setNotificationUri(getContext().getContentResolver(), url);
return c;
}
@Override
public Uri insert(Uri url, ContentValues inValues) {
ContentValues values = new ContentValues(inValues);
long rowId = db.insert(TABLE_NAME, ID, values);
if (rowId > 0) {
Uri uri = ContentUris.withAppendedId(CONTENT_URI, rowId);
getContext().getContentResolver().notifyChange(uri, null);
return uri;
} else {
throw new SQLException("Failed to insert row into " + url);
}
}
@Override
public int delete(Uri url, String where, String[] whereArgs) {
int retVal = db.delete(TABLE_NAME, where, whereArgs);
getContext().getContentResolver().notifyChange(url, null);
return retVal;
}
@Override
public int update(Uri url, ContentValues values, String where,
String[] whereArgs) {
int retVal = db.update(TABLE_NAME, values, where, whereArgs);
getContext().getContentResolver().notifyChange(url, null);
return retVal;
}
@Override
public String getType(Uri uri) {
return null;
}
}
| [
"[email protected]"
] | |
f6391f551a71f1dd84d27ce5e4a88eca98f423cf | 66df97cddf85090c1df49f2de9df5bd0f2d9c7f1 | /superjumper/src/main/java/com/badlogicgames/superjumper/HighscoresScreen.java | 5dcd9368c3433e23d2c1bdcb193c7c6389cdbcb4 | [] | no_license | dmitrykolesnikovich/superjumper-example | 4669edbaa68e3989456eb3cac4c9e3c16959a4b9 | 8c509a08b1ed1132b3a737c13e4a025562e52c4e | refs/heads/master | 2020-03-30T09:45:55.906102 | 2018-10-11T14:38:00 | 2018-10-11T14:38:00 | 151,090,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,710 | java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogicgames.superjumper;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector3;
public class HighscoresScreen extends ScreenAdapter {
SuperJumper game;
OrthographicCamera guiCam;
Rectangle backBounds;
Vector3 touchPoint;
String[] highScores;
float xOffset = 0;
GlyphLayout glyphLayout = new GlyphLayout();
public HighscoresScreen(SuperJumper game) {
this.game = game;
<<<<<<< HEAD
guiCam = new OrthographicCamera(320, 480);
guiCam.position.set(320 / 2, 480 / 2, 0);
backBounds = new Rectangle(0, 0, 64, 64);
touchPoint = new Vector3();
highScores = new String[5];
for (int i = 0; i < 5; i++) {
highScores[i] = i + 1 + ". " + Settings.highscores[i];
glyphLayout.setText(Assets.font, highScores[i]);
xOffset = Math.max(glyphLayout.width, xOffset);
}
xOffset = 160 - xOffset / 2 + 40 / 2;
}
=======
guiCam = new OrthographicCamera(320, 480);
guiCam.position.set(320 / 2, 480 / 2, 0);
backBounds = new Rectangle(0, 0, 64, 64);
touchPoint = new Vector3();
highScores = new String[5];
for (int i = 0; i < 5; i++) {
highScores[i] = i + 1 + ". " + Settings.highscores[i];
glyphLayout.setText(Assets.font, highScores[i]);
xOffset = Math.max(glyphLayout.width, xOffset);
}
xOffset = 160 - xOffset / 2 + Assets.font.getSpaceXadvance() / 2;
}
>>>>>>> 6a3df5ed07ffb2833446e62ff348554239b0d252
public void update() {
if (Gdx.input.justTouched()) {
guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
if (backBounds.contains(touchPoint.x, touchPoint.y)) {
Assets.playSound(Assets.clickSound);
game.setScreen(new MainMenuScreen(game));
return;
}
}
}
public void draw() {
GL20 gl = Gdx.gl;
gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
guiCam.update();
game.batcher.setProjectionMatrix(guiCam.combined);
game.batcher.disableBlending();
game.batcher.begin();
game.batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480);
game.batcher.end();
game.batcher.enableBlending();
game.batcher.begin();
game.batcher.draw(Assets.highScoresRegion, 10, 360 - 16, 300, 33);
float y = 230;
for (int i = 4; i >= 0; i--) {
Assets.font.draw(game.batcher, highScores[i], xOffset, y);
y += Assets.font.getLineHeight();
}
game.batcher.draw(Assets.arrow, 0, 0, 64, 64);
game.batcher.end();
}
@Override
public void render(float delta) {
update();
draw();
}
}
| [
"[email protected]"
] | |
5f3a58352cd627b114ebe4d5b14bb5c7cb682273 | caee4274661744e9d5eee8c515e1055f8e2a938a | /DSPNGraph/src/pipe/gui/widgets/newwidges/view/ModelGuideDialog4.java | 1c1b8ad8dfe81d6480c3925ad49cd8421cbaf443 | [] | no_license | xuchonghao/DSPNGraph | cc022f199d89dae2b695469319f521d0a7ce41ff | 7ee62c6a73fa3f5fe767bd9ffc44fc310a9e3ff2 | refs/heads/master | 2020-03-31T05:20:30.378270 | 2018-10-07T13:24:48 | 2018-10-07T13:24:48 | 151,942,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 35,966 | java | package pipe.gui.widgets.newwidges.view;
import org.jdom.Element;
import pipe.gui.ApplicationSettings;
import pipe.gui.widgets.newwidges.bean.*;
import pipe.gui.widgets.newwidges.factory.ModelFactory2;
import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.*;
import java.util.*;
import java.util.List;
/**
* Created by hanson on 2017/8/22.
* ็ฌฌไธๆญฅ๏ผ่กฅๅ
จ้พ่ทฏ็ไฟกๆฏ
*/
public class ModelGuideDialog4 extends JDialog {
/**็จๆฅๆๆถๅญๅจๆๆ็้พ่ทฏ*/
private ArrayList<VLInfo> vlList = new ArrayList<VLInfo>();
private GuideModel nowModel;
private String[] id = new String[100];
private int[] typeOfMessage = new int[100];
private String[] remarkOfRT = new String[100];
private Set<String> idCheckSet = new HashSet<String>();
//private int[] delay = new int[100];
private int[] bag = new int[100];
private int[] cache = new int[100];
private ArrayList<String>[] destin = new ArrayList[100];
private int[] packageSize = new int[100];
private int num;
private ArrayList<Element> arr = null;
/** Creates new form ModelGuideDialog1 */
public ModelGuideDialog4(Frame parent, boolean modal, GuideModel guideModel) {
super(parent, modal);
nowModel = guideModel;
this.arr = arr;
for(int i=0; i<typeOfMessage.length; i++)
{
typeOfMessage[i] = GuideModel.PERIOD_MESSAGE;
}
initComponents();
}
/**่ทๅพ่้พ่ทฏ็ๆฐ้*/
private int getVLNum(){
num = 0;
int NUMBERVL = 0;
Queue<SPM> spmList = nowModel.getSpmList();
int size = spmList.size();
for(int i=0;i<size;i++){
SPM spm = spmList.remove();
ArrayList<Paratition> parList = spm.getParList();
int parNum = spm.getParNum();
for(int j=0;j<parNum;j++){
Paratition par = parList.get(j);
int vlNum = par.getVLCount();//ๅๅบๅ
vl็ๆฐ้
num += vlNum;
//ๅๅบๅๅงๅ็ๆถๅๅฐฑnewไบ๏ผ่ฟๆ ทไนๅฏไปฅ
ArrayList<VLInfo> pvlList = par.getParititionVLInfo();
String parId = par.getParId();
for(int t=0;t<vlNum;t++){
VLInfo info = new VLInfo();
//ๅฏน่้พ่ทฏ็ID่ฟ่กไฟฎๆน ไธๅๆฏ๏ผๆฏไธชๅๅบ็t๏ผ่ๆฏๆๆ็ปไธVL็็ผๅท
info.setVlId(parId +"_VL" + (NUMBERVL++));
pvlList.add(info);
vlList.add(info);
}
}
spmList.add(spm);
}
return num;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
private void initComponents() {
num = getVLNum();
setResizable(false);
for(int i=0; i<num; i++)
{
jLabelArray1[i] = new javax.swing.JLabel();
jTextFieldArray2[i] = new javax.swing.JTextField();
jComboBoxArray3[i] = new javax.swing.JComboBox();
//jTextFieldArray4[i] = new javax.swing.JTextField();
jTextFieldArray5[i] = new javax.swing.JTextField();
jTextFieldArray6[i] = new javax.swing.JTextField();
//jTextFieldArray211[i] = new javax.swing.JTextField();
jTextFieldArray7[i] = new javax.swing.JTextField();
//jTextFieldArray8[i] = new javax.swing.JTextField();
//jComboBoxArray4[i] = new javax.swing.JComboBox();
comboBox[i] = new MultiSelectComboBox<String>();
//jButtonArray5[i] = new javax.swing.JButton();
}
buttonGroup1 = new javax.swing.ButtonGroup();
jButton6 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jButtonNextStep = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
//jLabel9 = new javax.swing.JLabel();
jLabe20 = new javax.swing.JLabel();
jLabe21 = new javax.swing.JLabel();
//jLabe211 = new javax.swing.JLabel();
jLabe22 = new javax.swing.JLabel();
jLabe23 = new javax.swing.JLabel();
jButton6.setText("ๆทปๅ ๅคๆณจ");
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("ๅปบๆจกๅๅฏผ");
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jLabel1.setText("็ฌฌไธๆญฅ");
jLabel2.setText(" ่กฅๅ
จๅๅบๆถๆฏๅๆฐ(ๅฆๅๅบๆถๆฏไผ ่พ็ฑปๅใ็ๆๅจๆใๅ
ๅคงๅฐ)ใ่้พ่ทฏๅๆฐไฟกๆฏ๏ผๅฆ่้พ่ทฏIDใBAG๏ผใๅๅบ็ผๅญๅคงๅฐๅๆฅๆถ็ซฏ็ณป็ป");
//jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/icon_guide.png"))); // NOI18N
//jLabel3.setText(" ");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
// jPanel1Layout.setAutoCreateGaps(true);
// jPanel1Layout.setAutoCreateContainerGaps(true);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 770, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 217, Short.MAX_VALUE)
.addComponent(jLabel3)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2))
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE))
.addContainerGap())
);
jButtonNextStep.setText("ไธไธๆญฅ");
jButtonNextStep.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonNextStepActionPerformed(evt);
}
});
jButton3.setText("ๅๆถ");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("ไธไธๆญฅ");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonPrevStepActionPerformed(evt);
}
});
jLabel5.setText("็ผๅท");
jLabel7.setText("VL_ID");
jLabel8.setText("่ช็ตๆถๆฏ็ฑปๅ");
//jLabel9.setText("ๅๅบไผ ่พๅจๆ(ms)");
jLabe20.setText(" BAG(ms)");
jLabe21.setText("ๅ
ๅคงๅฐ(Byte)");
//jLabe211.setText("SPM่พๅบ็ผๅญๅธง็ๆฐ้(ไธช)");
jLabe22.setText("ๆบ็ซฏ็ณป็ปๅๅบ");
jLabe23.setText("็ฎ็็ซฏ็ณป็ปๅๅบ");
//่ฟๅไธไธๆๅไธช้ฝ่ฎพ็ฝฎๅฅฝๅง ็ถๅ ่ฟ้4-10็ๅๅบๅฝๆฐ ๆฒก่ฐๆดๅข ๆณจๆ
for(int i=0; i<num; i++)
{
jLabelArray1[i].setText(" "+(i+1));
// jTextFieldArray2[i].setActionCommand("jTextFieldArray2_"+(i));
String vlId = vlList.get(i).getVlId();
jTextFieldArray2[i].setText(vlId);
jTextFieldArray2[i].addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
jTextField2_1FocusLost(evt);
}
});
jComboBoxArray3[i].setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ๅจๆๅ", "ไบไปถๅ" }));
jComboBoxArray3[i].setActionCommand("jComboBoxArray_"+(i));
jComboBoxArray3[i].addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox3_1ActionPerformed(evt);
}
});
int duNum = nowModel.getNumOfDU();
Queue<DU> duList = nowModel.getDuList();
int count = 0;
ArrayList<String> arr = new ArrayList<>();
for(int n=0;n<duNum;n++){
DU du = duList.remove();
int duParNum = du.getNumOfPar();
ArrayList<Paratition> parList = du.getParList();
for(int m=0;m<duParNum;m++){
Paratition par = parList.get(m);
String parId = par.getParId();
arr.add(parId);
count++;
}
duList.add(du);
}
int num = count;
String[] str = new String[num];
//str[0] = "";
for(int t=0;t<num;t++){
str[t] = arr.get(t);
}
final MultiSelectComboBox<String> comboBox1 = comboBox[i];
comboBox1.setModel(new javax.swing.DefaultComboBoxModel(str));
comboBox1.setForegroundAndToPopup(Color.BLACK);
comboBox1.setActionCommand("jComboBoxArray_"+(i));
comboBox1.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
//System.out.println("222้ๆฉ็ๅผ๏ผ"+comboBoxOut.getSelectedItemsString());
//List<Integer> indexs = comboBoxIn.getSelectedSortedIndexs();
// jComboBox4_1ActionPerformed(e);
List<String> names = comboBox1.getSelectedItems();
//System.out.println("out"+names);
String command = comboBox1.getActionCommand();
// String command = e.getActionCommand();
//System.out.println("command"+command);
int comboNumber = Integer.parseInt(command.substring(command.length()-1));
//System.out.println("comboNumber" + comboNumber);
int len = names.size();
//System.out.println("len:"+len);
destin[comboNumber] = new ArrayList<>();
for(int j=0;j<len;j++){
System.out.println(names.get(j));
destin[comboNumber].add(names.get(j));
//destin[comboNumber][j] = names.get(j);
}
/*String command = comboBox1.getActionCommand();
// String command = e.getActionCommand();
System.out.println("command"+command);
int comboNumber = Integer.parseInt(command.substring(command.length()-1));
int num = nowModel.getNumOfDU();
System.out.println("jComboBoxArray4[comboNumber].getSelectedIndex()"+comboNumber+"" +
","+comboBox1.getSelectedIndex());
if(comboBox[comboNumber].getSelectedIndex()<=num && comboBox[comboNumber].getSelectedIndex()>=1)
{
for(int j=0;j<len;j++){
destin[comboNumber][j] = "RES" + comboBox[comboNumber].getSelectedIndex();
}
// System.out.println(comboNumber +"," +destin[comboNumber]);
}*/
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
}
});
/*comboBox[i].addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});*/
//jTextFieldArray4[i].setToolTipText("ๅจๆ๏ผๅไฝms");
/*jButtonArray5[i].setText("ๆทปๅ ๅคๆณจ");
jButtonArray5[i].setActionCommand("jButtonArray_"+(i));
jButtonArray5[i].addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5_1ActionPerformed(evt);
}
});*/
}
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2Layout.setAutoCreateGaps(true);
jPanel2Layout.setAutoCreateContainerGaps(true);
jPanel2.setLayout(jPanel2Layout);
GroupLayout.ParallelGroup gp1 = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
gp1.addComponent(jLabel5);
for(int i=0; i<num; i++)
{
gp1.addComponent(jLabelArray1[i]);
}
GroupLayout.ParallelGroup gp2 = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
gp2.addComponent(jLabel7);
for(int i=0; i<num; i++)
{
gp2.addComponent(jTextFieldArray2[i]);
}
GroupLayout.ParallelGroup gp3 = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
gp3.addComponent(jLabel8);
for(int i=0; i<num; i++)
{
gp3.addComponent(jComboBoxArray3[i]);
}
// gp3.addComponent(jComboBox3_1);
// gp3.addComponent(jComboBox3_2);
// gp3.addComponent(jComboBox3_3);
/* GroupLayout.ParallelGroup gp4 = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
gp4.addComponent(jLabel9);
for(int i=0; i<num; i++)
{
jTextFieldArray4[i].setText("100");
gp4.addComponent(jTextFieldArray4[i]);
}*/
// gp4.addComponent(jTextField4_1,javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE);
// gp4.addComponent(jTextField4_2,javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE);
// gp4.addComponent(jTextField4_3,javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE);
GroupLayout.ParallelGroup gpp = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
gpp.addComponent(jLabe20);
for(int i=0; i<num; i++)
{
jTextFieldArray5[i].setText("4");
gpp.addComponent(jTextFieldArray5[i]);
}
GroupLayout.ParallelGroup gppp = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
gppp.addComponent(jLabe21);
for(int i=0; i<num; i++)
{
jTextFieldArray6[i].setText("64");
gppp.addComponent(jTextFieldArray6[i]);
}
/*GroupLayout.ParallelGroup g211 = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
g211.addComponent(jLabe211);
for(int i=0; i<num; i++)
{
jTextFieldArray211[i].setText("1");
g211.addComponent(jTextFieldArray211[i]);
}*/
GroupLayout.ParallelGroup g4p = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
g4p.addComponent(jLabe22);
for(int i=0; i<num; i++)
{
String vlId = vlList.get(i).getVlId();
jTextFieldArray7[i].setText(vlId.substring(0,9));
g4p.addComponent(jTextFieldArray7[i]);
}
GroupLayout.ParallelGroup g5p = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
g5p.addComponent(jLabe23);
for(int i=0; i<num; i++)
{
g5p.addComponent(comboBox[i]);
}
/* GroupLayout.ParallelGroup gp5 = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING);
for(int i=0; i<num; i++)
{
gp5.addComponent(jButtonArray5[i]);
}*/
// gp5.addComponent(jButton5_1);
// gp5.addComponent(jButton5_2);
// gp5.addComponent(jButton5_3);
jPanel2Layout.setHorizontalGroup(jPanel2Layout.createSequentialGroup()
.addGroup(gp1).addGap(30).addGroup(gp2).addGap(30).addGroup(gp3).addGap(30).addGroup(gppp).addGap(30)./*addGroup(gp4).addGap(30).*/addGroup(gpp).addGap(30)./*addGroup(g211).addGap(30).*/addGroup(g4p).addGap(30).addGroup(g5p));//.addGap(30).addGroup(gp5));
GroupLayout.ParallelGroup gp6 = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
gp6.addComponent(jLabel5);
gp6.addComponent(jLabel7);
gp6.addComponent(jLabel8);
//gp6.addComponent(jLabel9);
gp6.addComponent(jLabe20);
gp6.addComponent(jLabe21);
//gp6.addComponent(jLabe211);
gp6.addComponent(jLabe22);
gp6.addComponent(jLabe23);
GroupLayout.SequentialGroup group = jPanel2Layout.createSequentialGroup().addGroup(gp6);
for(int i=0; i<num; i++)
{
GroupLayout.ParallelGroup gpTemp = jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
gpTemp.addComponent(jLabelArray1[i]);
gpTemp.addComponent(jTextFieldArray2[i]);
gpTemp.addComponent(jComboBoxArray3[i]);
// gpTemp.addComponent(jTextFieldArray4[i]);
gpTemp.addComponent(jTextFieldArray5[i]);
//gpTemp.addComponent(jButtonArray5[i]);
gpTemp.addComponent(jTextFieldArray6[i]);
//gpTemp.addComponent(jTextFieldArray211[i]);
gpTemp.addComponent(jTextFieldArray7[i]);
gpTemp.addComponent(comboBox[i]);
group.addGroup(gpTemp);
}
jPanel2Layout.setVerticalGroup(group);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(318, Short.MAX_VALUE)
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButtonNextStep)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton3)
.addGap(8, 8, 8))
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButtonNextStep)
.addComponent(jButton4)).addContainerGap())
);
pack();
}// </editor-fold>
private void jTextField2_1FocusLost(java.awt.event.FocusEvent evt) {
// TODO add your handling code here:
// System.out.println(command+"||||||||||||||||||||");//่ฟ้ๅๆฌๆณ ๅคฑๅป็ฆ็น ็ถๅๅคๆญๆฏๅฆ้ๅค ไฝๆฏๅ ไธบไธ็ฅ้่ฟไธชไบไปถๆฏๅชไธช textFieldๅๅบๆฅ็ ๆไปฅไฝ็ฝข
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
doClose(RET_CANCEL);
}
private void jButtonPrevStepActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//ไธไธๆญฅ
Queue<VLInfo> queue = new LinkedList<VLInfo>();
int n = 0;
Queue<SPM> spmList = nowModel.getSpmList();
int size = spmList.size();
for(int i=0;i<size;i++){
SPM spm = spmList.remove();
spm.setParList(new ArrayList<>());
ArrayList<Paratition> parList = spm.getParList();
int parNum = spm.getParNum();
for(int j=0;j<parNum;j++){
Paratition par = parList.get(j);
//ๅๅบๅๅงๅ็ๆถๅๅฐฑnewไบ๏ผ่ฟๆ ทไนๅฏไปฅ
//ArrayList<VLInfo> pvlList = par.getParititionVLInfo();
ArrayList<VLInfo> pvlList = new ArrayList<>();
par.setParititionVLInfo(pvlList);
}
spmList.add(spm);
}
this.nowModel.setVlList(queue);
doClose(RET_CANCEL);
ModelGuideDialog32 guiDialog1 = new ModelGuideDialog32(ApplicationSettings.getApplicationView(), true, this.nowModel);
guiDialog1.pack();
guiDialog1.setLocationRelativeTo(null);
guiDialog1.setVisible(true);
}
private void jComboBox3_1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String command = evt.getActionCommand();
//System.out.println("command"+command);
int comboNumber = Integer.parseInt(command.substring(command.length()-1));
//System.out.println("comboNumber" + comboNumber);
if(jComboBoxArray3[comboNumber].getSelectedIndex()==1)
{
//System.out.println("jComboBoxArray3[comboNumber].getSelectedIndex():"+jComboBoxArray3[comboNumber].getSelectedIndex());
typeOfMessage[comboNumber] = GuideModel.EVENT_MESSAGE;
}
else if(jComboBoxArray3[comboNumber].getSelectedIndex()==0)
{
//System.out.println("11111jComboBoxArray3[comboNumber].getSelectedIndex():"+jComboBoxArray3[comboNumber].getSelectedIndex());
typeOfMessage[comboNumber] = GuideModel.PERIOD_MESSAGE;
//jTextFieldArray4[comboNumber].setEditable(true);
}
if(jComboBoxArray3[comboNumber].getSelectedIndex()==1)
{
//System.out.println("22222222222jComboBoxArray3[comboNumber].getSelectedIndex():"+jComboBoxArray3[comboNumber].getSelectedIndex());
//jTextFieldArray4[comboNumber].setText("");
//jTextFieldArray4[comboNumber].setEditable(false);
}
}
private void jButton5_1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println("ๅผนๅบไธไธชๅฐๆก๏ผ็ถๅๅกซๅๅคๆณจ");
String command = evt.getActionCommand();
int buttonNumber = Integer.parseInt(command.substring(command.length()-1));
String remark = JOptionPane.showInputDialog("่ฏท่พๅ
ฅๅคๆณจ");
if(remark!=null)
remarkOfRT[buttonNumber] = remark;
System.out.println(remark+buttonNumber);
}
private void jButtonNextStepActionPerformed(java.awt.event.ActionEvent evt) {//ไธไธๆญฅ
// TODO add your handling code here:
//int num = nowVo.getNumOfRTs();
for(int i=0; i<num; i++)
{
id[i] = jTextFieldArray2[i].getText().trim();
if(id[i].equals(""))
{
JOptionPane.showMessageDialog(this, "IDไธ่ฝไธบ็ฉบ", "Warning",
JOptionPane.WARNING_MESSAGE);
return;
}
if(this.idCheckSet.contains(id[i]))
{
JOptionPane.showMessageDialog(this, "IDไธ่ฝ้ๅค", "Warning",
JOptionPane.WARNING_MESSAGE);
this.idCheckSet.clear();
return;
}
this.idCheckSet.add(id[i]);
}
this.idCheckSet.clear();
/*for(int i=0; i<num; i++)
{
if(!jTextFieldArray4[i].isEditable())//่ฟไธช่ฏดๆๆฏ ไบไปถๆถๆฏ
delay[i]=0;
else
{
if(jTextFieldArray4[i].getText().trim().equals(""))
{
JOptionPane.showMessageDialog(this, "ๅจๆๅๆฐไธ่ฝไธบ็ฉบ", "Warning",
JOptionPane.WARNING_MESSAGE);
return;
}
delay[i] = Integer.parseInt(jTextFieldArray4[i].getText());
}
}*/
for(int i=0; i<num; i++)
{
if(jTextFieldArray5[i].getText().trim().equals(""))
{
JOptionPane.showMessageDialog(this, "BAGๅๆฐไธ่ฝไธบ็ฉบ", "Warning",
JOptionPane.WARNING_MESSAGE);
return;
}
//if(jTextFieldArray211[i].getText().trim().equals(""))
// cache[i]=1;
// else
// cache[i] = Integer.parseInt(jTextFieldArray211[i].getText());
/* Pattern pattern = Pattern.compile("[1|2|3|4|5|6][0-100]*");
if(!pattern.matcher(jTextFieldArray5[i].getText()).matches())
{
JOptionPane.showMessageDialog(this, "BAGๅๆฐๆ ผๅผๆ่ฏฏ๏ผ่ฏท้ๆฐ็กฎ่ฎค", "Warning",
JOptionPane.WARNING_MESSAGE);
return;
}*/
this.bag[i] = Integer.parseInt(jTextFieldArray5[i].getText());
}
for(int i=0; i<num; i++)
{
if(jTextFieldArray6[i].getText().trim().equals(""))
{
JOptionPane.showMessageDialog(this, "ๅธงๅคงๅฐไธ่ฝไธบ็ฉบ", "Warning",
JOptionPane.WARNING_MESSAGE);
return;
}
/* Pattern pattern = Pattern.compile("[1|2|3|4|5|6][0-100]*");
if(!pattern.matcher(jTextFieldArray5[i].getText()).matches())
{
JOptionPane.showMessageDialog(this, "BAGๅๆฐๆ ผๅผๆ่ฏฏ๏ผ่ฏท้ๆฐ็กฎ่ฎค", "Warning",
JOptionPane.WARNING_MESSAGE);
return;
}*/
this.packageSize[i] = Integer.parseInt(jTextFieldArray6[i].getText());
}
Queue<VLInfo> queue = new LinkedList<VLInfo>();
//System.out.println("num:"+num);
/* for(int i=0; i<num; i++)
{
VLInfo info = new VLInfo();//ๅคๆณจๆๆถๅ
ๆฒกๅ
info.setVlId(vlList.get(i).getVlId());
info.setBAG(bag[i]);
info.setCacheSize(cache[i]);
info.setTransCycle(delay[i]);
info.setSource(vlList.get(i).getVlId());
info.setDestination(destin[i]);
info.setPackageSize(packageSize[i]);
if(typeOfMessage[i] == GuideModel.EVENT_MESSAGE)
info.setPeriodical(false);
else if(typeOfMessage[i] == GuideModel.PERIOD_MESSAGE)
info.setPeriodical(true);
queue.add(info);
}*/
int n = 0;
Queue<SPM> spmList = nowModel.getSpmList();
int size = spmList.size();
for(int i=0;i<size;i++){
SPM spm = spmList.remove();
ArrayList<VLInfo> vlInfoList = spm.getInfoList();
ArrayList<Paratition> parList = spm.getParList();
int parNum = spm.getParNum();
for(int j=0;j<parNum;j++){
Paratition par = parList.get(j);
int vlNum = par.getVLCount();//ๅๅบๅ
vl็ๆฐ้
//ๅๅบๅๅงๅ็ๆถๅๅฐฑnewไบ๏ผ่ฟๆ ทไนๅฏไปฅ
//ArrayList<VLInfo> pvlList = par.getParititionVLInfo();
ArrayList<VLInfo> pvlList = new ArrayList<>();
String parId = par.getParId();
for(int t=0;t<vlNum;t++){
VLInfo info = new VLInfo();
info.setVlId(vlList.get(n).getVlId());
info.setBAG(bag[n]);
info.setCacheSize(cache[n]);
//info.setTransCycle(delay[n]);
info.setSource(vlList.get(n).getVlId());
info.setDestination(destin[n]);
info.setPackageSize(packageSize[n]);
if(typeOfMessage[n] == GuideModel.EVENT_MESSAGE)
info.setPeriodical(false);
else if(typeOfMessage[n] == GuideModel.PERIOD_MESSAGE)
info.setPeriodical(true);
vlInfoList.add(info);
pvlList.add(info);
queue.add(info);
n++;
}
par.setParititionVLInfo(pvlList);
}
spmList.add(spm);
}
//System.out.println(n +""+num);
this.nowModel.setVlList(queue);
//System.out.println("4de 556" + nowModel.getVlList().size());
doClose(RET_OK);
// ModelGuideDialog4 guiDialog = new ModelGuideDialog4(CreateGui.getApp(), true, this.nowVo); System.out.println(nowVo);
//ๅๅงๅ
GuideModel.FLAG = true;
new ModelFactory2();
ArrayList<Element> arr = ModelFactory2.buildHead();
ModelFactory2.addSPM(nowModel,arr);
//TODO ้ช่ฏๆญคๆถarr็ๅ
ๅฎนๆฏไธๆฏๅไบ
ModelGuideDialog44 guiDialog = new ModelGuideDialog44(ApplicationSettings.getApplicationView(), true, this.nowModel,arr);
guiDialog.pack();
guiDialog.setLocationRelativeTo(null);
guiDialog.setVisible(true);
}
private void doClose(int retStatus) {
returnStatus = retStatus;
setVisible(false);
dispose();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
ModelGuideDialog1 dialog = new ModelGuideDialog1(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.ButtonGroup buttonGroup1;
//ๆทปๅ ๅคๆณจbutton
//private javax.swing.JButton jButtonArray5[] = new javax.swing.JButton[100];
private javax.swing.JButton jButtonNextStep;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton6;
private javax.swing.JComboBox jComboBox10;
//็ป็ซฏๆถๆฏ็ฑปๅ
private javax.swing.JComboBox[] jComboBoxArray3 = new javax.swing.JComboBox[100];
//ๆฅๆถ็ซฏ ็ฎ็ String
// private javax.swing.JComboBox[] jComboBoxArray4 = new javax.swing.JComboBox[100];
private MultiSelectComboBox<String>[] comboBox = new MultiSelectComboBox[100];
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel5;
//็ฌฌไธๅ็็ผๅท
private javax.swing.JLabel[] jLabelArray1 = new javax.swing.JLabel[100];
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
//private javax.swing.JLabel jLabel9;
private javax.swing.JLabel jLabe20;
private javax.swing.JLabel jLabe21;
//private javax.swing.JLabel jLabe211;
private javax.swing.JLabel jLabe22;
private javax.swing.JLabel jLabe23;
// private javax.swing.JLabel jLabe24;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JSeparator jSeparator1;
//็ฌฌไบๅ ID
private javax.swing.JTextField[] jTextFieldArray2 = new javax.swing.JTextField[100];
// ็ฌฌๅๅๅๆฐ ๅ็ๅจๆ
// private javax.swing.JTextField[] jTextFieldArray4 = new javax.swing.JTextField[100];
// ็ฌฌไบๅๅๆฐbag
private javax.swing.JTextField[] jTextFieldArray5 = new javax.swing.JTextField[100];
// ็ฌฌ6ๅๅๆฐ ๅ
ๅคงๅฐ
private javax.swing.JTextField[] jTextFieldArray6 = new javax.swing.JTextField[100];
// ็ฌฌ6.5ๅๅๆฐ ็ผๅญ
// private javax.swing.JTextField[] jTextFieldArray211 = new javax.swing.JTextField[100];
// ็ฌฌ7ๅๅๆฐ ๆบ
private javax.swing.JTextField[] jTextFieldArray7 = new javax.swing.JTextField[100];
//private MultiSelectComboBox<String> comboBox;
// End of variables declaration
private int returnStatus = RET_CANCEL;
/** A return status code - returned if Cancel button has been pressed */
public static final int RET_CANCEL = 0;
/** A return status code - returned if OK button has been pressed */
public static final int RET_OK = 1;
}
| [
"[email protected]"
] | |
8de38bbddf7c92025b88e9096e7ed3e23ef76a9d | 4f5bb1fc04c95ae2b23950d5b85b7dc9bb3351f0 | /java/Fundamentals/Language/Basics/DoLoopTest.java | bcf9e89750b5fd76b0ffe71e1d2b8d644153bf0b | [] | no_license | pranav-budhkar12/hello-world | 42ebe7dfcbfa17bd3f3edb04bbb8439b83279de6 | 23b5cc2cbbb93b4762670b8f7c66b6a2156ba4f1 | refs/heads/master | 2021-01-19T16:20:02.955636 | 2017-09-10T06:56:29 | 2017-09-10T06:56:29 | 101,000,072 | 0 | 0 | null | 2017-08-21T23:36:49 | 2017-08-21T23:16:36 | null | UTF-8 | Java | false | false | 158 | java | class DoLoopTest{
public static void main(String[] args){
int i = 0;
do{
System.out.printf("Hello %s%n", args[i++]);
}while(i < args.length);
}
}
| [
"[email protected]"
] | |
32360ce5190f69e9dc12b256259ce15460acb3fb | bd8bff8b35cd108259db6d02d691a81d5f945fa8 | /Agent/src/main/java/edu/uestc/sdn/AgentHandler.java | 8066df9eb7b5d9d88c71b10ff3e05773d53570bb | [] | no_license | eftales/netty-demo | cb8e9253adab0ee7980c0c856a4ebe5dc6578031 | 6214a977de1a82b119b30aed775228de010ea684 | refs/heads/main | 2023-04-29T18:47:38.018467 | 2021-05-11T12:47:49 | 2021-05-11T12:47:49 | 361,120,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,306 | java | package edu.uestc.sdn;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import java.nio.charset.Charset;
import struct.*;
public class AgentHandler extends SimpleChannelInboundHandler<ACProtocol> {
@Override
protected void channelRead0(ChannelHandlerContext ctx, ACProtocol msg) throws Exception {
//ๆฅๆถๅฐๆฐๆฎ๏ผๅนถๅค็
int len = msg.getLen();
byte[] content = msg.getContent();
Packet_in packet_out = new Packet_in();
try {
JavaStruct.unpack(packet_out, content);
}catch(StructException e) {
e.printStackTrace();
}
switch(packet_out.reason){
case 0:
System.out.println("heart beat");
break;
default:
System.out.println("ingress :"+packet_out.ingress_port);
System.out.println("reason :"+packet_out.reason);
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
System.out.println("ๅผๅธธๆถๆฏ=" + cause.getMessage());
ctx.close();
}
}
| [
"[email protected]"
] | |
7e005e4f77b3545647f1b0fb09de1a8efeb14f07 | 06e074338468790801040762f1d738b915edad6b | /superwechat/src/cn/ucai/superwechatui/video/util/RecyclingBitmapDrawable.java | 7f525f9391410ca6d7ce411918eb171d4a984cb4 | [
"Apache-2.0"
] | permissive | yuening123456/SuperWeChat2017 | c9620836f467d94145f0a16286f67602c824d84c | 541464dd78a52baa0709c15581797616781451bf | refs/heads/master | 2021-01-21T10:38:29.193819 | 2017-06-06T10:20:09 | 2017-06-06T10:20:09 | 91,701,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,275 | java | package cn.ucai.superwechatui.video.util;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;
import cn.ucai.superwechatui.BuildConfig;
public class RecyclingBitmapDrawable extends BitmapDrawable {
static final String TAG = "CountingBitmapDrawable";
private int mCacheRefCount = 0;
private int mDisplayRefCount = 0;
private boolean mHasBeenDisplayed;
public RecyclingBitmapDrawable(Resources res, Bitmap bitmap) {
super(res, bitmap);
}
/**
* Notify the drawable that the displayed state has changed. Internally a
* count is kept so that the drawable knows when it is no longer being
* displayed.
*
* @param isDisplayed
* - Whether the drawable is being displayed or not
*/
public void setIsDisplayed(boolean isDisplayed) {
// BEGIN_INCLUDE(set_is_displayed)
synchronized (this) {
if (isDisplayed) {
mDisplayRefCount++;
mHasBeenDisplayed = true;
} else {
mDisplayRefCount--;
}
}
// Check to see if recycle() can be called
checkState();
// END_INCLUDE(set_is_displayed)
}
/**
* Notify the drawable that the cache state has changed. Internally a count
* is kept so that the drawable knows when it is no longer being cached.
*
* @param isCached
* - Whether the drawable is being cached or not
*/
public void setIsCached(boolean isCached) {
// BEGIN_INCLUDE(set_is_cached)
synchronized (this) {
if (isCached) {
mCacheRefCount++;
} else {
mCacheRefCount--;
}
}
// Check to see if recycle() can be called
checkState();
// END_INCLUDE(set_is_cached)
}
private synchronized void checkState() {
// BEGIN_INCLUDE(check_state)
// If the drawable cache and display ref counts = 0, and this drawable
// has been displayed, then recycle
if (mCacheRefCount <= 0 && mDisplayRefCount <= 0 && mHasBeenDisplayed
&& hasValidBitmap()) {
if (BuildConfig.DEBUG) {
Log.d(TAG, "No longer being used or cached so recycling. "
+ toString());
}
getBitmap().recycle();
}
// END_INCLUDE(check_state)
}
private synchronized boolean hasValidBitmap() {
Bitmap bitmap = getBitmap();
return bitmap != null && !bitmap.isRecycled();
}
}
| [
"[email protected]"
] | |
eab64c2a6437172313e0eae264c194efb3e8dfc5 | e58a8e0fb0cfc7b9a05f43e38f1d01a4d8d8cf1f | /FantastleX/src/com/puttysoftware/fantastlex/creatures/monsters/DefiniteScalingDynamicMonster.java | 7c92e4af56083e15698f30008b50e5b8a33c8acc | [
"Unlicense"
] | permissive | retropipes/older-java-games | 777574e222f30a1dffe7936ed08c8bfeb23a21ba | 786b0c165d800c49ab9977a34ec17286797c4589 | refs/heads/master | 2023-04-12T14:28:25.525259 | 2021-05-15T13:03:54 | 2021-05-15T13:03:54 | 235,693,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | /* FantastleX: A Maze/RPG Hybrid Game
Copyleft 2013 Eric Ahnell
Any questions should be directed to the author via email at: [email protected]
*/
package com.puttysoftware.fantastlex.creatures.monsters;
class DefiniteScalingDynamicMonster extends AbstractDefiniteScalingMonster {
// Constructors
DefiniteScalingDynamicMonster() {
super();
}
@Override
public boolean dynamic() {
return true;
}
}
| [
"[email protected]"
] | |
c3d50dc69ca97eeb2b0572260ba9cc25982d89d4 | 1ac62371f8ddb2c2ee785f9a703a4bb5a035d1c6 | /app/src/main/java/sdk/deamon/polylin/deamonsdk_demo/MainActivity.java | ba5e555c7f5c7f185c10c41e8f4ce85324833627 | [] | no_license | github-liuxiang/DeaMonsdk | 4f4904d7ff5f39690f60a66bb88ae728a93d6849 | 51b8d40cb35819889336471d2b8c146ad29cd0d9 | refs/heads/master | 2020-04-15T04:34:13.190800 | 2019-01-07T07:00:45 | 2019-01-07T07:00:45 | 164,388,537 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,144 | java | package sdk.deamon.polylin.deamonsdk_demo;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import polylink.sdk.pl.DeamonSdkCtrl;
import polylink.sdk.pl.c.receiver.PLReceiver;
import polylink.sdk.pl.c.receiver.PLReceiver_h;
import polylink.sdk.pl.c.service.BaseService;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// startService(new Intent(MainActivity.this,GuardService.class));
// Intent workIntent = new Intent();
// WeTalkService.enqueueWork(this,workIntent);
DeamonSdkCtrl.getInstance().setProcess1("com.sdk.sip",
WeTalkService.class.getCanonicalName(),
PLReceiver.class.getCanonicalName()).setProcess2("sdk.deamon.polylin.deamonsdk_demo:pushservice",
BaseService.class.getCanonicalName(),
PLReceiver_h.class.getCanonicalName()).Init(this);
// startService(new Intent(this,WeTalkService.class));
}
}
| [
"[email protected]"
] | |
2360a6e95f82030e6021de43fba290052b6fe189 | a25f6e21aed1768850b0e2e299b751693df22430 | /src/main/java/ua/edu/ucu/smartarr/SortDecorator.java | 7c6c614e2e34e6050128a07c354e20e2507da209 | [] | no_license | Shkredi/apps19shkredko-hw3 | bfa1bae79675581acff5512fadb09f343be9ea02 | 5f1650c03c60c94009e9faa22407820cccff1eb7 | refs/heads/master | 2021-07-20T17:33:26.718166 | 2019-11-16T14:31:54 | 2019-11-16T14:31:54 | 222,105,362 | 0 | 0 | null | 2020-10-13T17:30:51 | 2019-11-16T13:44:43 | Java | UTF-8 | Java | false | false | 838 | java | package ua.edu.ucu.smartarr;
import ua.edu.ucu.functions.MyComparator;
import java.util.Arrays;
import java.util.stream.Stream;
// Sorts elements using MyComparator to compare them
public class SortDecorator extends SmartArrayDecorator {
private MyComparator cmp;
public SortDecorator(SmartArray sa, MyComparator cmp) {
super(sa);
this.cmp = cmp;
}
@Override
public Object[] toArray() {
Object[] arr = this.smartArray.toArray();
Stream stream = Arrays.stream(arr);
arr = stream.sorted((o1, o2) -> cmp.compare(o1, o2)).toArray();
return arr;
}
@Override
public String operationDescription() {
return "sorted " + this.smartArray.operationDescription();
}
@Override
public int size() {
return this.smartArray.size();
}
}
| [
"[email protected]"
] | |
6b2fd6187b9108f255366ff4b105ce038ec381eb | 51fa3cc281eee60058563920c3c9059e8a142e66 | /Java/src/testcases/CWE80_XSS/s01/CWE80_XSS__Servlet_listen_tcp_52a.java | 9b851745b294cf71c73c7b4d45f669b7f93b4859 | [] | no_license | CU-0xff/CWE-Juliet-TestSuite-Java | 0b4846d6b283d91214fed2ab96dd78e0b68c945c | f616822e8cb65e4e5a321529aa28b79451702d30 | refs/heads/master | 2020-09-14T10:41:33.545462 | 2019-11-21T07:34:54 | 2019-11-21T07:34:54 | 223,105,798 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 4,713 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE80_XSS__Servlet_listen_tcp_52a.java
Label Definition File: CWE80_XSS__Servlet.label.xml
Template File: sources-sink-52a.tmpl.java
*/
/*
* @description
* CWE: 80 Cross Site Scripting (XSS)
* BadSource: listen_tcp Read data using a listening tcp connection
* GoodSource: A hardcoded string
* Sinks:
* BadSink : Display of data in web page without any encoding or validation
* Flow Variant: 52 Data flow: data passed as an argument from one method to another to another in three different classes in the same package
*
* */
package testcases.CWE80_XSS.s01;
import testcasesupport.*;
import javax.servlet.http.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.Socket;
import java.net.ServerSocket;
import java.util.logging.Level;
public class CWE80_XSS__Servlet_listen_tcp_52a extends AbstractTestCaseServlet
{
public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
data = ""; /* Initialize data */
/* Read data using a listening tcp connection */
{
ServerSocket listener = null;
Socket socket = null;
BufferedReader readerBuffered = null;
InputStreamReader readerInputStream = null;
/* Read data using a listening tcp connection */
try
{
listener = new ServerSocket(39543);
socket = listener.accept();
/* read input from socket */
readerInputStream = new InputStreamReader(socket.getInputStream(), "UTF-8");
readerBuffered = new BufferedReader(readerInputStream);
/* POTENTIAL FLAW: Read data using a listening tcp connection */
data = readerBuffered.readLine();
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO);
}
finally
{
/* Close stream reading objects */
try
{
if (readerBuffered != null)
{
readerBuffered.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO);
}
try
{
if (readerInputStream != null)
{
readerInputStream.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO);
}
/* Close socket objects */
try
{
if (socket != null)
{
socket.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing Socket", exceptIO);
}
try
{
if (listener != null)
{
listener.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing ServerSocket", exceptIO);
}
}
}
(new CWE80_XSS__Servlet_listen_tcp_52b()).badSink(data , request, response);
}
public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
goodG2B(request, response);
}
/* goodG2B() - use goodsource and badsink */
private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
/* FIX: Use a hardcoded string */
data = "foo";
(new CWE80_XSS__Servlet_listen_tcp_52b()).goodG2BSink(data , request, response);
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"[email protected]"
] | |
9682a97f3e58c6b27e7a1fa7b2125ec884b88892 | 9485c879c617b9c1577cbf507ddf7095b09d6da2 | /Nim.java | c16d7fc86844b9aa58e0ad0150646c48099721fb | [] | no_license | roannaz/Nim | 89709318efc8982105dd2cca197a1f7d92f3d24f | 86f1f4e77a47d35b0815e9698b631245b562ea92 | refs/heads/master | 2020-04-03T10:58:03.116357 | 2018-10-29T12:25:04 | 2018-10-29T12:25:04 | 155,206,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,263 | java | /**
* This is a program for the game Nim.
*
* @Freya Ou and Roanna Zou
* @October 28, 2018
*
*/
import java.util.Scanner;
import java.util.Random;
public class Nim{
static Scanner in = new Scanner (System.in);
static Random random = new Random ();
static int rstick; //for computer/random generator to generate sticks
//Displays main selection
public static void main(String[] args){
System.out.println("Welcome to Nim!");
System.out.println("Two opponents pick either ONE or TWO sticks in turn from a set number of sticks.");
System.out.println("Whoever gets the last stick loses.");
chooseMode();
int selection = in.nextInt();
//As long as the user doesn't press 3 and quit, the program stays in the loop
while (selection != 3){
if (selection == 1){ //Sinple-player mode
singlePlayer();
} else if (selection == 2){ //Multi-player mode
multiPlayer();
} else {
System.out.println("Invalid answer!");
}
selection = in.nextInt();
}
}
//Displays multi-player instructions
public static void multiPlayer(){
System.out.print("How many sticks do you want to start with? ");
//Asks user for the initial number of sticks
int sticksInitial = in.nextInt();
System.out.println("Players can remove one or two sticks.");
printStick(sticksInitial); //calls the printStick method to print the number of sticks
calcSticks(sticksInitial); //calls the calcSticks method
chooseMode(); //re-prints the instructions for clarity
}
//Displays single-player selections
public static void singlePlayer(){
chooseLevel(); //Calls instructions
//Asks user for input of the level of difficulty
int selection = in.nextInt();
//As long as the user doesn't press 3 and go back to main method, the program stays in this method.
while (selection != 3){
if (selection == 1){ //goes to easy mode
instructionsComp(1);
} else if (selection == 2){ //goes to casino mode
instructionsComp(2);
} else {
System.out.println("Invalid answer!");
}
selection = in.nextInt();
}
chooseMode(); //escape to main
}
//Displys the instructions for single-player mode
public static void instructionsComp(int n){
in.nextLine(); //Allows the computer to read the string input
System.out.print("What is your name? ");
String name = in.nextLine(); //Inputs name
//Gives player a description of how the computer plays and scares them.
System.out.printf("Hello %s, you are playing against the Computer.\nThe Computer will only remove one or two sticks. Good luck.\n", name);
System.out.print("How many sticks do you want to start with?\nGive a number greater than 2 please.");
int sticksInitial = in.nextInt();
System.out.println("Players can remove one or two sticks.");
printStick(sticksInitial);
//choose easy mode or casino mode
if(n==1){ //brings player to easy mode
calcSticksCompE(sticksInitial);
} else if(n==2){ //brings player to casino mode
calcSticksCompC(sticksInitial);
}
chooseLevel(); //re-prints level instructions for clarity
}
//Calculates the sticks for easy mode
public static void calcSticksCompE(int sticksLeft){
//while sticksLeft is greater than 3, repeats the code. sticksLeft > 3 to ensurea nonnegative integer output
while (sticksLeft > 3){
System.out.print("Player remove how many sticks?");
int decrease = in.nextInt();
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
compRemove(); //calls the method compRemove
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
}
//When sticksLeft is equal to 3, displays the sequence of possible events along with the corresponding winner.
if (sticksLeft == 3){
System.out.print("Player remove how many sticks?");
int decrease = in.nextInt();
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
//if player removes 1 stick, could result in sticksLeft of 2, 1, or 0
if (decrease == 1){
if (sticksLeft == 2){
compRemove();
if (decrease == 1){ //Computer wins
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
System.out.println("Computer wins!");
} else if (decrease == 2){ //Player wins
System.out.println("Player wins!");
}
} else if (sticksLeft == 1){ //Player wins
System.out.println("Player wins!");
} else if (sticksLeft == 0){ //Computer wins
System.out.println("Computer wins!");
}
} else if (decrease == 2){ //if player remove 2 sticks, player wins
System.out.println("Player wins!");
}
} //When sticksLeft is equal to 2, displays the sequence of possible events along with the corresponding winner.
else if (sticksLeft == 2){
System.out.print("Player remove how many sticks? ");
int decrease = in.nextInt();
if (decrease == 1){ //Player wins
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
System.out.println("Player wins!");
} else if (decrease == 2){ //Computer wins
System.out.println("Computer wins!");
}
} //Computer wins
else if (sticksLeft == 1){
System.out.println("Computer wins!");
} //Player wins
else if (sticksLeft == 0){
System.out.println("Player wins!");
}
}
//Casino mode. Computer uses strategies and has a very big chance of winning
public static void calcSticksCompC(int sticksLeft){
/*When the intial amount of sticks is 1 mod 3,
Computer always leaves the player with sticks with a number 1 mod 3 so that eventually there is 1 left for the player*/
if (sticksLeft % 3 == 1){
loopCasino(1, sticksLeft);
} //Initial amount of sticks is 2 mod 3.
else if (sticksLeft % 3 == 2){
System.out.print("Player remove how many sticks? ");
int decrease = in.nextInt();
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
/* Computer can only win for sure from the beginning the player choose to remove 2 sticks as their starting move.
To win, Computer always leaves the player with sticks with a number 1 mod 3 so that eventually there is 1 left for the player */
if (decrease == 2) {
System.out.println("Computer remove 2 sticks");
decrease = 2;
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
loopCasino(1, sticksLeft); //calls for the first part of loopCasino
} /*When the player chooses to remove 1 stick as their starting move,
Computer cannot follow a pattern to win so it generates sticks randomly */
else if (decrease == 1) {
loopCasino(2, sticksLeft); //calls for the second part of loopCasino
}
} //Initial amount of sticks is a multiple of 3
else if (sticksLeft % 3 == 0){
System.out.print("Player remove how many sticks? ");
int decrease = in.nextInt();
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
/* Computer can only win for sure from the beginning the player choose to remove 1 sticks as their starting move.
To win, Computer always leaves the player with sticks with a number 1 mod 3 so that eventually there is 1 left for the player */
if (decrease == 1){
System.out.println("Computer remove 1 stick");
decrease = 1;
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
loopCasino(1, sticksLeft);
} /*When the player chooses to remove 2 stick as their starting move,
Computer cannot follow a pattern to win so it generates sticks randomly */
else if (decrease == 2){
loopCasino(2, sticksLeft);
}
}
}
//A method to make the code more concise and less repetitive
public static void loopCasino(int n, int sticksLeft){
int decrease;
//repetitive code in the Casino level that allows Computer to win for sure
if (n == 1){
while (sticksLeft > 1){
System.out.print("Player remove how many sticks? ");
decrease = in.nextInt();
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
//creating a sum of 3 in both scenerios
if (decrease == 1) {
System.out.println("Computer remove 2 sticks");
decrease = 2;
} else if (decrease == 2) {
System.out.println("Computer remove 1 stick");
decrease = 1;
}
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
}
if (sticksLeft == 1){
System.out.println("Computer wins!");
}
}//repetitive code in the Casino level that allows Computer to generate randomly until it is sure it can win
else if (n == 2){
while (sticksLeft > 3){
rstick = random.nextInt(2) + 1;
if (rstick == 1){
System.out.println("Computer removes 1 stick");
} else if (rstick == 2){
System.out.println("Computer removes 2 sticks");
}
decrease = rstick;
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
System.out.print("Player remove how many sticks? ");
decrease = in.nextInt();
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
}
//At the end, if sticksLeft == 3, Computer can win and leaves 1 stick for the player
if (sticksLeft == 3){
System.out.println("Computer remove 2 sticks");
decrease = 2;
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
System.out.println("Computer wins!");
} //At the end, if sticksLeft == 2, Computer can win and leaves 1 stick for the player
else if (sticksLeft == 2){
System.out.println("Computer remove 1 stick");
decrease = 1;
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
System.out.println("Computer wins!");
} //Computer loses
else if (sticksLeft == 1){
System.out.println("Player wins!");
} //Computer wins
else if (sticksLeft == 0){
System.out.println("Computer wins!");
}
}
}
//Calculates the amount of sticks in multiplayer mode
public static void calcSticks(int sticksLeft){
//while sticksLeft is greater than 3, repeats the code. sticksLeft > 3 to ensurea nonnegative integer output
while (sticksLeft > 3){
System.out.print("Player 1 remove how many sticks? ");
int decrease = in.nextInt();
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
System.out.print("Player 2 remove how many sticks? ");
decrease = in.nextInt();
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
}
//When sticksLeft is equal to 3, displays the sequence of possible events along with the corresponding winner.
if (sticksLeft == 3){
System.out.print("Player 1 remove how many sticks? ");
int decrease = in.nextInt();
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
//if player removes 1 stick, could result in sticksLeft of 2, 1, or 0
if (decrease == 1){
if (sticksLeft == 2){
System.out.print("Player 2 remove how many sticks? ");
decrease = in.nextInt();
if (decrease == 1){ //Player 2 wins
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
System.out.println("Player 2 wins!");
} else if (decrease == 2){ //Player 1 wins
System.out.println("Player 1 wins!");
}
} else if (sticksLeft == 1){ //Player 1 wins
System.out.println("Player 1 wins!");
} else if (sticksLeft == 0){ //Player 2 wins
System.out.println("Player 2 wins!");
}
} else if (decrease == 2){ //if player 1 removes 2 sticks, player 1 wins
System.out.println("Player 1 wins!");
}
} //When sticksLeft is equal to 2, displays the sequence of possible events along with the corresponding winner.
else if (sticksLeft == 2){
System.out.print("Player 1 remove how many sticks? ");
int decrease = in.nextInt();
if (decrease == 1){ //Player 1 wins
sticksLeft = sticksLeft(decrease, sticksLeft);
printStick(sticksLeft);
System.out.println("Player 1 wins!");
} else if (decrease == 2){ //Player 2 wins
System.out.println("Player 2 wins!");
}
} else if (sticksLeft == 1){ //Player 2 wins
System.out.println("Player 2 wins!");
} else if (sticksLeft == 0){ //Player 1 wins
System.out.println("Player 1 wins!");
}
}
//Asks user to choose mode
public static void chooseMode(){
System.out.println("For Single-player, press 1");
System.out.println("For Multiplayer, press 2");
System.out.println("To Exit, press 3");
}
//Ask user to choose difficulty
public static void chooseLevel(){
System.out.println("For Easy mode, press 1");
System.out.println("For Casino mode, press 2");
System.out.println("To Escape and go back to main screen, press 3");
}
//Print sticks on screen
public static void printStick(int n){
for (int i = 0; i < n; i++){
System.out.print("|");
}
System.out.println("");
}
//Calculate number of sticks after each removal
public static int sticksLeft(int decrease, int sticksLeft){
sticksLeft = sticksLeft - decrease;
return sticksLeft;
}
//Process of computer removing sticks randomly (is grammatically correct as well!)
public static void compRemove(){
rstick = random.nextInt(2) + 1;
if (rstick == 1){
System.out.println("Computer removes 1 stick");
} else if (rstick == 2){
System.out.println("Computer removes 2 sticks");
}
int decrease = rstick;
}
} | [
"[email protected]"
] | |
b68ddaa8c7eb50379b69faa42a2b288d5f2dc5e7 | 9d9f3278b8c56fb781784c7e9d9fdac85db8f1eb | /tools/PacketSamuraiAE/src/packetsamurai/session/PSLogSession.java | a6fd315459de3664e3bdc8c2f88ce9aabcf4f8d2 | [] | no_license | zhouxiaoxiaoxujian/exs-aion-emu | 4f81d87930f065d5c26e91964a8bbce275c9e653 | 82edeace1c0e932442a82f6a9c8b738105008e6c | refs/heads/master | 2021-01-19T14:34:18.029843 | 2017-09-18T01:04:25 | 2017-09-18T01:04:25 | 14,447,053 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,047 | java | /**
*
*/
package packetsamurai.session;
import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import packetsamurai.PacketSamurai;
import packetsamurai.logwriters.PSLogWriter;
import packetsamurai.protocol.Protocol;
/**
* Basically a TCPSession that autmatically logs the packets on the fly.
*
* @author Ulysses R. Ribeiro
*
*/
public class PSLogSession extends TCPSession
{
private PSLogWriter _logWriter;
public PSLogSession(long sessionId, Protocol protocol, String prefix, boolean crypted, InetAddress serverAddr, InetAddress clientAddr) throws IOException
{
super(sessionId, protocol, prefix, crypted, PacketSamurai.DECRYPT_ACTIVE);
this.setClientIp((Inet4Address) clientAddr);
this.setServerIp((Inet4Address) serverAddr);
_logWriter = new PSLogWriter(this, true);
}
@Override
public void addPacket(byte[] data, boolean fromServer, long time)
{
// let it be added normally
super.addPacket(data, fromServer, time);
//notify writer
try
{
this.getLogWriter().writePacket(this.getPackets().getLast());
}
catch (IOException e)
{
PacketSamurai.getUserInterface().log("ERROR: While writing packet data on Session ID: "+this.getSessionId()+", attempting to continue.");
}
}
@Override
public void saveSession()
{
// we are already saving the session on the fly
// prevent the super method from doing it again
}
@Override
public void close()
{
super.close();
try
{
this.getLogWriter().close();
}
catch (IOException e)
{
PacketSamurai.getUserInterface().log("ERROR: While closing log of Session ID: "+this.getSessionId()+".");
}
}
protected PSLogWriter getLogWriter()
{
return _logWriter;
}
}
| [
"[email protected]@85287832-b594-7149-79f4-51bc24f57482"
] | [email protected]@85287832-b594-7149-79f4-51bc24f57482 |
104c7b870c9e16ae976e759caed593304f1fcaa0 | ec4f23f1370df090279910f4070e5f1e6d0b0cd0 | /src/main/java/com/basicauth/SpringBasicAuthApplication.java | 1c93664cf9d115352495283b93c0102826f959be | [] | no_license | shekar24/springbasicauth | 21c9005f62a7e5ed599c5e7e6e6e6ad43bfcf337 | 59996319e2c0f19edc0773d521b969ddad4a30a2 | refs/heads/master | 2022-04-15T06:27:53.045941 | 2020-04-12T17:42:05 | 2020-04-12T17:42:05 | 255,135,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.basicauth;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBasicAuthApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBasicAuthApplication.class, args);
}
}
| [
"[email protected]"
] | |
4b3bcb20df799e8354e8c2f7cb0c687c1fcf1ae4 | 2e3ae03c8fce73c6cb086086b9e4b0acebfa6947 | /Hometask5OOP/MyFileFilter.java | 50c929574275971ff74769693f146b24669bad1e | [] | no_license | andrewtyshkovets/HomeTask_JavaOOP | cde66c5c9bae81f1cf92206f004ddae8e95f3afb | 716473846ba4c2784e429b26a2aa223bd03b7f71 | refs/heads/master | 2020-06-15T03:22:46.891471 | 2019-07-18T10:19:00 | 2019-07-18T10:19:00 | 195,191,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 647 | java | package com.gmail.tas;
import java.io.File;
import java.io.FileFilter;
public class MyFileFilter implements FileFilter {
private String[] arr;
public MyFileFilter(String... arr) {
super();
this.arr = arr;
}
private boolean check(String ext) {
for (String stringExt : arr) {
if (stringExt.equals(ext)) {
return true;
}
}
return false;
}
@Override
public boolean accept(File pathname) {
int pointerIndex = pathname.getName().lastIndexOf(".");
if (pointerIndex == -1) {
return false;
}
String ext = pathname.getName().substring(pointerIndex + 1);
return check(ext);
}
}
| [
"[email protected]"
] | |
53c0ff3275f0c5c00c3ca5ba5f98cd166172cdff | 11fced7d40e3e46d85a2d5afea272dbc6ad8c3c2 | /src/chapter02/PE227.java | b1ffe237fc1bd70f0849664a1e8e29bc6fa1046d | [] | no_license | Lo1s/JavaIntroduction | 152c94c45f99992df9e32fc5608eda617cd8b9d5 | 9aa4f37210706ec30f49a15ed339dfff3d175f47 | refs/heads/master | 2016-09-06T17:55:26.432493 | 2015-07-03T09:34:38 | 2015-07-03T09:34:38 | 37,971,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,071 | java | package chapter02;
import javax.swing.JOptionPane;
public class PE227 {
public static void main(String[] args) {
// Employees name
String employeesName = JOptionPane.showInputDialog(null, "Enter employee's name: ", "Employee's name", JOptionPane.QUESTION_MESSAGE);
// Worktime
String numberOfHoursString = JOptionPane.showInputDialog(null, "Enter number of hours worked in a week: ", "Worktime", JOptionPane.QUESTION_MESSAGE);
int numberOfHours = Integer.parseInt(numberOfHoursString);
// Pay rate
String hourlyPayRateString = JOptionPane.showInputDialog(null, "Enter hourly pay rate: ", "Pay rate", JOptionPane.QUESTION_MESSAGE);
double hourlyPayRate = Double.parseDouble(hourlyPayRateString);
double grossPayment = hourlyPayRate * numberOfHours;
// Federal tax
String federalWithholdingRateString = JOptionPane.showInputDialog(null, "Enter federal tax withholding rate: ", "Federal Tax", JOptionPane.QUESTION_MESSAGE);
double federalWithholdingRate = Double.parseDouble(federalWithholdingRateString);
double federalTax = federalWithholdingRate * (hourlyPayRate * numberOfHours);
// State tax
String stateWithholdingRateString = JOptionPane.showInputDialog(null, "Enter a state tax withholding rate: ", "State Tax", JOptionPane.QUESTION_MESSAGE);
double stateWithholdingRate = Double.parseDouble(stateWithholdingRateString);
double stateTax = stateWithholdingRate * (hourlyPayRate * numberOfHours);
JOptionPane.showMessageDialog(null,
"\t" + "Employee name: " + employeesName + "\n" +
"\t" + "Hours worked: " + numberOfHours + "\n" +
"\t" + "Pay rate: " + "$" + hourlyPayRate + "\n" +
"\t" + "Gross Pay: " + "$" + grossPayment + "\n" +
"\t" + "Deductions: " + "\n" +
"\t" + " Federal Withholding (20.0%): " + "$" + federalTax + "\n" +
"\t" + " State Withholding (9.0%): " + "$" + stateTax + "\n" +
"\t" + " Total Deduction: " + "$" + (federalTax + stateTax) + "\n" +
"\t" + "Net pay: " + "$" + (grossPayment - (federalTax + stateTax)), "Employee information", JOptionPane.INFORMATION_MESSAGE);
}
}
| [
"[email protected]"
] | |
63c197fc2e71dc04047c2ac9143fb58b43124c41 | 4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849 | /aliyun-java-sdk-opensearch/src/main/java/com/aliyuncs/opensearch/model/v20171225/StartSlowQueryAnalyzerResponse.java | f0f16c304c9e74320ac320462476b1042bc2341c | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-java-sdk | a263fa08e261f12d45586d1b3ad8a6609bba0e91 | e19239808ad2298d32dda77db29a6d809e4f7add | refs/heads/master | 2023-09-03T12:28:09.765286 | 2023-09-01T09:03:00 | 2023-09-01T09:03:00 | 39,555,898 | 1,542 | 1,317 | NOASSERTION | 2023-09-14T07:27:05 | 2015-07-23T08:41:13 | Java | UTF-8 | Java | false | false | 1,557 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.opensearch.model.v20171225;
import java.util.Map;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.opensearch.transform.v20171225.StartSlowQueryAnalyzerResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class StartSlowQueryAnalyzerResponse extends AcsResponse {
private Map<Object,Object> result;
private String requestId;
public Map<Object,Object> getResult() {
return this.result;
}
public void setResult(Map<Object,Object> result) {
this.result = result;
}
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
@Override
public StartSlowQueryAnalyzerResponse getInstance(UnmarshallerContext context) {
return StartSlowQueryAnalyzerResponseUnmarshaller.unmarshall(this, context);
}
@Override
public boolean checkShowJsonItemName() {
return false;
}
}
| [
"[email protected]"
] | |
fe7c52bb6b82f889521ad5ad827e55eb06b33e50 | 137aad6971e771afabf4dad26decfa6276c9eed5 | /dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/InvokerWrapper.java | 277b6b4bd24407831d3282f5017daa72bac72170 | [
"Apache-2.0",
"MIT"
] | permissive | renshuaibing-aaron/dubbo-aaron-2.7.5 | 2b900d5ea75fa8c7c3f797a650b2c033910d5fa7 | 884693317c14750856bde5c4cce6e01e9fd6f8ba | refs/heads/master | 2022-12-22T07:27:57.426677 | 2020-12-10T08:54:21 | 2020-12-10T08:54:21 | 225,597,901 | 0 | 0 | Apache-2.0 | 2022-12-14T20:37:49 | 2019-12-03T10:56:46 | Java | UTF-8 | Java | false | false | 1,954 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.rpc.protocol;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;
/**
* InvokerWrapper
*/
public class InvokerWrapper<T> implements Invoker<T> {
////ListenerInvokerWrapper
private final Invoker<T> invoker;
private final URL url;
public InvokerWrapper(Invoker<T> invoker, URL url) {
this.invoker = invoker;
this.url = url;
}
@Override
public Class<T> getInterface() {
return invoker.getInterface();
}
@Override
public URL getUrl() {
return url;
}
@Override
public boolean isAvailable() {
return invoker.isAvailable();
}
@Override
public Result invoke(Invocation invocation) throws RpcException {
System.out.println("============InvokerWrapper ็ invoke ๆนๆณ===============");
// ่ฐ็จ ListenerInvokerWrapper ็ invoke ๆนๆณ
return invoker.invoke(invocation);
}
@Override
public void destroy() {
invoker.destroy();
}
}
| [
"[email protected]"
] | |
6f5b140cce0ef5bb9b71577febd3a980e7a3eae6 | c2b24019aceaa1832e65db0bc8cd5a16da55d4ea | /src/TicTacToe/Cuadruple.java | f5f90ca2fe98e761d39723b85d8b0a6b869ae201 | [] | no_license | trimarchi19/Compilador | f8fb3f343c428cfba87947c5d1d6647607b0c5f6 | d052f109212556c1ab5f3436dad32f256d21d1df | refs/heads/master | 2023-02-03T14:11:58.829741 | 2020-12-21T14:08:09 | 2020-12-21T14:08:09 | 322,514,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,008 | java | package TicTacToe;
public class Cuadruple {
String op;
String arg1;
String arg2;
String res;
public Cuadruple(String op, String arg1, String arg2, String res) {
this.op = op;
this.arg1 = arg1;
this.arg2 = arg2;
this.res = res;
}
Cuadruple(int indice, String op, String arg1, String resultado) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public String getOp() {
return op;
}
public void setOp(String op) {
this.op = op;
}
public String getArg1() {
return arg1;
}
public void setArg1(String arg1) {
this.arg1 = arg1;
}
public String getArg2() {
return arg2;
}
public void setArg2(String arg2) {
this.arg2 = arg2;
}
public String getRes() {
return res;
}
public void setRes(String res) {
this.res = res;
}
}
| [
"[email protected]"
] | |
7863cad44c1c056eddd003c92c455c71830c3694 | 3a3fed882fd95f383917154af6b1aa791b22ae7d | /app/src/main/java/app/brucelee/me/zhihudaily/ui/newsList/RecyclerItemClickListener.java | 6b50f582622b87e74b0b9df08ed2b086670e6419 | [] | no_license | gischen/ZhihuDaily | 899cfd7c8ca2809a62a235f476c7391d53faf4ff | 5a28aee477efb5ee91a2e5970f01dad7c1881543 | refs/heads/master | 2021-01-19T06:39:51.674063 | 2014-12-23T13:28:16 | 2014-12-23T13:28:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,346 | java | package app.brucelee.me.zhihudaily.ui.newsList;
/**
* Created by bruce on 14/12/3.
*/
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener {
private OnItemClickListener mListener;
public interface OnItemClickListener {
public void onItemClick(View view, int position);
}
GestureDetector mGestureDetector;
public RecyclerItemClickListener(Context context, OnItemClickListener listener) {
mListener = listener;
mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override public boolean onSingleTapUp(MotionEvent e) {
return true;
}
});
}
@Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) {
View childView = view.findChildViewUnder(e.getX(), e.getY());
if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) {
mListener.onItemClick(childView, view.getChildPosition(childView));
}
return false;
}
@Override public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) { }
} | [
"[email protected]"
] | |
e8bd4120b7ea9be42d45c5e0adc2123af76396cc | 8099f102ddf0735564506ee267191debf8fa27cd | /src/Java_How_to_Programm_Early_Objects_Paul_Deitel/Chapter_2/fig02_06/Welcome4.java | 0d90b6b2ef6570d2bfa5b20f922fe710711b8b81 | [] | no_license | AlexeiVerbitki/Spring-MVC | dc40034e857ee7d0fe6a01a1b201f649ff16b1ee | f156d3db41e78df39718fa96d25f5a8d13c21adc | refs/heads/master | 2020-03-15T10:45:17.605521 | 2018-05-11T10:18:22 | 2018-05-11T10:18:22 | 132,106,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | package Java_How_to_Programm_Early_Objects_Paul_Deitel.Chapter_2.fig02_06;// Fig. 2.6: Welcome4.java
// Displaying multiple lines with method System.out.printf.
public class Welcome4
{
// main method begins execution of Java application
public static void main(String[] args)
{
System.out.printf("%s%n%s%n",
"Welcome to", "Java Programming!");
} // end method main
} // end class Welcome4
| [
"[email protected]"
] | |
7c47200f51a5fb36d7ad7cac12953da31775cae8 | b87a8e27eab4a143611589b85eea1454594ec59d | /src/main/java/yerchik/service/TypeOfTestService.java | 93de6bd5108a71d70d3a93a6655a9ece554df2e0 | [] | no_license | Yerchik/Testing | d3bf7a9ecffb21d22a9f38f2d21bb02322a62651 | 03ffa902d90c7110b1669d5a9bb8468de9b8af89 | refs/heads/master | 2021-01-19T08:47:21.801081 | 2017-08-18T16:20:56 | 2017-08-18T16:20:56 | 87,673,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | package yerchik.service;
import yerchik.dto.AddTest;
import yerchik.entity.Subject;
import yerchik.entity.TypeOfTest;
import java.util.List;
/**
* Created by Yerchik on 28.03.2017.
*/
public interface TypeOfTestService {
void add(AddTest dto);
void edit(AddTest dto);
void delete(String topic, String subject);
void deleteList(Subject subject);
TypeOfTest findById(int id);
TypeOfTest findByTopic(String topic, String subject);
List<TypeOfTest> findBySubject (String subject);
}
| [
"[email protected]"
] | |
90bb1909615f2cd7163a826cfc45e668f0dd49fe | 102aa70d26d9a18fe9cad796e3f99af0859ca2e4 | /app/src/main/java/cn/tse/pr/ui/widget/WindowManagerView.java | 01dbeeceda5a6cfcd15e4a93e8c67769353addd3 | [] | no_license | imyetse/TopWerewolf | cfad1bd3c73d9c08eec4e42cbd9da6e0ebb81537 | f7118761dc8c65fd2d23fb5861906e6bad789484 | refs/heads/master | 2021-01-20T14:58:31.307478 | 2017-06-18T15:58:03 | 2017-06-18T15:58:03 | 90,696,233 | 34 | 13 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package cn.tse.pr.ui.widget;
import android.content.Context;
import android.support.annotation.Nullable;
import android.text.method.KeyListener;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
/**
* ็ๅฌ่พๅ
ฅๆณๅผนๅบไธ็keyEvent
* <p>
* Created by xieye on 2017/6/6.
*/
public class WindowManagerView extends LinearLayout {
public WindowManagerView(Context context) {
super(context);
}
public WindowManagerView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean dispatchKeyEventPreIme(KeyEvent event) {
if (keyListener != null) {
keyListener.onKey(this, event.getKeyCode(), event);
}
return super.dispatchKeyEventPreIme(event);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
return super.dispatchKeyEvent(event);
}
public void setKeyEvent(OnKeyListener keyListener) {
this.keyListener = keyListener;
}
private OnKeyListener keyListener;
}
| [
"[email protected]"
] | |
56d8e790dd3dfe1f7af3fb345b6e179fe43bbb0e | 7a637e9654f3b6720d996e9b9003f53e40f94814 | /aylson-admin/src/main/java/com/aylson/dc/sys/service/impl/CouponDetailServiceImpl.java | 5c7886de0e8628fabc574d6636f384718627a551 | [] | no_license | hemin1003/aylson-parent | 118161fc9f7a06b583aa4edd23d36bdd6e000f33 | 1a2a4ae404705871717969449370da8531028ff9 | refs/heads/master | 2022-12-26T14:12:19.452615 | 2019-09-20T01:58:40 | 2019-09-20T01:58:40 | 97,936,256 | 161 | 103 | null | 2022-12-16T07:38:18 | 2017-07-21T10:30:03 | JavaScript | UTF-8 | Java | false | false | 6,456 | java | package com.aylson.dc.sys.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.aylson.core.exception.ServiceException;
import com.aylson.core.frame.dao.BaseDao;
import com.aylson.core.frame.domain.Result;
import com.aylson.core.frame.domain.ResultCode;
import com.aylson.core.frame.service.impl.BaseServiceImpl;
import com.aylson.dc.sys.dao.CouponDetailDao;
import com.aylson.dc.sys.po.CouponDetail;
import com.aylson.dc.sys.po.CouponRule;
import com.aylson.dc.sys.search.CouponDetailSearch;
import com.aylson.dc.sys.service.CouponDetailService;
import com.aylson.dc.sys.service.CouponRuleService;
import com.aylson.dc.sys.vo.CouponDetailVo;
@Service
public class CouponDetailServiceImpl extends BaseServiceImpl<CouponDetail, CouponDetailSearch> implements CouponDetailService {
protected static final Logger logger = Logger.getLogger(CouponDetailServiceImpl.class);
@Autowired
private CouponDetailDao CouponDetailDao;
@Autowired
private CouponRuleService couponRuleService;
@Override
protected BaseDao<CouponDetail, CouponDetailSearch> getBaseDao() {
return CouponDetailDao;
}
@Override
@Transactional
public Result addDetailAndCouponRule(CouponDetail couponDetail, String[] startPrice, String[] endPrice,
String[] deratePrice) {
Result result = new Result();
boolean flag = this.CouponDetailDao.insert(couponDetail);
if(flag){
List<CouponRule> list = new ArrayList<CouponRule>();
for (int i = 0; i < startPrice.length; i++) {
if(null != startPrice[i] || !startPrice[i].equals("")){
CouponRule rule = new CouponRule();
rule.setCouponFkid(couponDetail.getId());
rule.setStartPrice(Integer.valueOf(startPrice[i]==""?"0":startPrice[i]));
rule.setEndPrice(Integer.valueOf(endPrice[i]==""?"0":endPrice[i]));
rule.setDeratePrice(Integer.valueOf(deratePrice[i]==""?"0":deratePrice[i]));
list.add(rule);
}
}
flag = this.couponRuleService.batchAdd(list);
if(flag){
result.setOK(ResultCode.CODE_STATE_200, "ไฟๅญๆๅ");
}else{
result.setError(ResultCode.CODE_STATE_4006, "ไฟๅญไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ๏ผ");
logger.error("ไฟๅญไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ", new ServiceException("ไฟๅญไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ"));
}
}else{
result.setError(ResultCode.CODE_STATE_4006, "ๆฐๅขไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ๏ผ");
}
return result;
}
@Override
@Transactional
public Result updateDetailAndCouponRule(CouponDetail couponDetail, String[] startPrice, String[] endPrice,
String[] deratePrice, String[] ruleId) {
Result result = new Result();
boolean flag = this.CouponDetailDao.updateById(couponDetail);
if(flag){
List<CouponRule> list = new ArrayList<CouponRule>();
for (int i = 0; i < startPrice.length; i++) {
if(null != startPrice[i] || !startPrice[i].equals("")){
CouponRule rule = new CouponRule();
rule.setId(Integer.valueOf(ruleId[i]));
rule.setStartPrice(Integer.valueOf(startPrice[i]==""?"0":startPrice[i]));
rule.setEndPrice(Integer.valueOf(endPrice[i]==""?"0":endPrice[i]));
rule.setDeratePrice(Integer.valueOf(deratePrice[i]==""?"0":deratePrice[i]));
list.add(rule);
}
}
flag = this.couponRuleService.batchUpdate(list);
if(flag){
result.setOK(ResultCode.CODE_STATE_200, "ๆดๆฐๆๅ");
}else{
result.setError(ResultCode.CODE_STATE_4006, "ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ๏ผ");
logger.error("ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ", new ServiceException("ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ"));
}
}else{
result.setError(ResultCode.CODE_STATE_4006, "ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ๏ผ");
}
return result;
}
@Override
@Transactional
public Result addDetailAndCouponRule(CouponDetailVo couponDetailVo) {
Result result = new Result();
boolean flag = this.CouponDetailDao.insert(couponDetailVo);
if(flag){
if(couponDetailVo.getCouponRuleList() != null && couponDetailVo.getCouponRuleList().size() > 0){
for(CouponRule couponRule:couponDetailVo.getCouponRuleList()){
couponRule.setCouponFkid(couponDetailVo.getId());
}
flag = this.couponRuleService.batchAdd(couponDetailVo.getCouponRuleList());
if(!flag){
result.setError(ResultCode.CODE_STATE_4006, "ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ๏ผ");
logger.error("ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ", new ServiceException("ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ"));
}
}
result.setOK(ResultCode.CODE_STATE_200, "ๆดๆฐๆๅ");
}else{
result.setError(ResultCode.CODE_STATE_4006, "ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ๏ผ");
}
return result;
}
@Override
@Transactional
public Result updateDetailAndCouponRule(CouponDetailVo couponDetailVo) {
Result result = new Result();
boolean flag = this.CouponDetailDao.updateById(couponDetailVo);
if(flag){
if(couponDetailVo.getCouponRuleList() != null && couponDetailVo.getCouponRuleList().size() > 0){
List<CouponRule> updateList = new ArrayList<CouponRule>();
List<CouponRule> addList = new ArrayList<CouponRule>();
for(CouponRule couponRule:couponDetailVo.getCouponRuleList()){
if(couponRule.getId() != null){
updateList.add(couponRule);
}else{
couponRule.setCouponFkid(couponDetailVo.getId());
addList.add(couponRule);
}
}
if(updateList.size() > 0){
flag = this.couponRuleService.batchUpdate(updateList);
if(!flag){
result.setError(ResultCode.CODE_STATE_4006, "ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ๏ผ");
logger.error("ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ", new ServiceException("ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ"));
}
}
if(addList.size() > 0 ){
flag = this.couponRuleService.batchAdd(addList);
if(!flag){
result.setError(ResultCode.CODE_STATE_4006, "ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ๏ผ");
logger.error("ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ", new ServiceException("ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ"));
}
}
}
result.setOK(ResultCode.CODE_STATE_200, "ๆดๆฐๆๅ");
}else{
result.setError(ResultCode.CODE_STATE_4006, "ๆดๆฐไผๆ ๅธ้
็ฝฎไฟกๆฏๅคฑ่ดฅ๏ผ");
}
return result;
}
}
| [
"[email protected]"
] | |
e56e575ebaa7ec54d456d5e0bcf3ff656348cbe1 | 7f537f1eacd33478849f7cbda56b24020396c738 | /app/src/main/java/ck/itheima/com/phoneplay/ui/fragment/MvFragment.java | bfae0de8d1d86ef026841ff47b90f267515a03e0 | [] | no_license | Smkai/PhonePlay | 954d6ba8d3f3ab72e1abc38066aec06adf0b7334 | fb6c2a06ff3adc8ddfe7c0ddc0e6e031cbf3a535 | refs/heads/master | 2021-01-13T12:53:42.454924 | 2017-01-19T05:10:09 | 2017-01-19T05:10:09 | 78,987,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | package ck.itheima.com.phoneplay.ui.fragment;
import ck.itheima.com.phoneplay.R;
import ck.itheima.com.phoneplay.base.BaseFragment;
/**
* ็ฑปๅ: HomeFragment
* ๅๅปบ่
: ckqu
* ๅๅปบๆถ้ด:2017/1/15 0015 ไธๅ 9:50
* ๅ
ๅ: ck.itheima.com.phoneplay.ui.fragment
* ๆดๆฐ่
: $Author$ $Date$
* ๆ่ฟฐ: TODO
*/
public class MvFragment extends BaseFragment {
@Override
public int getLayoutID() {
return R.layout.fragment_mv;
}
}
| [
"35600"
] | 35600 |
543c740b5ac85852792c3a62354425b878cfc501 | 7ffcc4a86182d0ee2dd63afa3591cf752e4700cf | /service/insplatform/.svn/pristine/a4/a475f26c9a3c05ffea244f88a46d3e5f30620a03.svn-base | 8de52548525c864d741b4d027618fb22c631a994 | [] | no_license | TrustDec/MySubentry | 447c4769c5161fcb2ca4bdd39404694f7c003b62 | 46c260ec22e1b8933d3ee682b6b8bdbdb41f4cf5 | refs/heads/master | 2022-02-26T00:27:08.595626 | 2016-12-02T21:48:39 | 2016-12-02T21:48:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,738 | package com.insplatform.module.trainingsummary.controller;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.insframework.system.base.controller.BaseController;
import com.insframework.system.context.App;
import com.insframework.system.map.Condition;
import com.insplatform.module.trainingsummary.model.TrainingSummary;
import com.insplatform.module.trainingsummary.service.TrainingSummaryService;
@Controller
@RequestMapping("/px/trainingsummary")
public class TrainingSummaryController extends BaseController{
@Autowired
private TrainingSummaryService trainingSummaryService;
/**
* ๅ ่ฝฝๆฐๆฎ
* @param request
* @param response
* @return
*/
@RequestMapping("/loadAllGrid")
public @ResponseBody Map<String, Object> loadAllGrid(
HttpServletRequest request, HttpServletResponse response){
Condition condition = this.getCondition(request,"pxTrainingScheme","name");
return trainingSummaryService.loadAllGrid(condition);
}
/**
* ๅ ่ฝฝๆฐๆฎ
* @param request
* @param response
* @return
*/
@RequestMapping("/loadAllList")
public @ResponseBody Map<String, Object> loadAllList(
HttpServletRequest request, HttpServletResponse response){
Condition condition = this.getCondition(request);
return this.getMessager().success().data(trainingSummaryService.loadAllList(condition));
}
/**
* ๅ ่ฝฝๅๆกๆฐๆฎ
* @param id
* @return
*/
@RequestMapping("/load")
public @ResponseBody Map<String, Object> load(@RequestParam("id") String id){
return this.getMessager().success().data(trainingSummaryService.load(id));
}
/**
* ๆฐๅข
* @param dict
* @return
*/
@RequestMapping("/add")
public @ResponseBody Map<String, Object> add(TrainingSummary trainingsummary, HttpServletRequest request){
trainingsummary.setCreateUserId(this.getCurrentUser(request).getId());
trainingsummary.setCreateUserName(this.getCurrentUser(request).getName());
Date date = new Date();
trainingsummary.setCreateTime(date);
trainingsummary.setUpdateTime(date);
trainingSummaryService.save(trainingsummary,request);
return this.getMessager().success();
}
/**
* ็ผ่พ
* @param dict
* @return
*/
@RequestMapping("/update")
public @ResponseBody Map<String, Object> update(
@RequestParam("id") String id,
HttpServletRequest request){
TrainingSummary trainingsummary = trainingSummaryService.get(id);
this.bindObject(request, trainingsummary);
trainingsummary.setUpdateTime(new Date());
trainingSummaryService.update(trainingsummary,request);
return this.getMessager().success();
}
/**
* ๅ ้ค
* @param request
* @return
*/
@RequestMapping("/delete")
public @ResponseBody Map<String, Object> delete(HttpServletRequest request){
String [] ids = this.getSelectedItems(request);
trainingSummaryService.deleteByIds(ids);
return this.getMessager().success();
}
/**
* ไธ่ฝฝ้ไปถ
* @param id
* @param response
*/
@RequestMapping("/downloadAttachment")
public void downloadAttachment(@RequestParam("id") String id, HttpServletResponse response){
TrainingSummary trainingsummary = trainingSummaryService.get(id);
String url = trainingsummary.getAttachment();
String path = App.FILE_SYS;
path += url.replace(App.FILE_SYS_URL, "");
downloadService.downloadFile(path, trainingsummary.getOriginalName(), response);
}
}
| [
"[email protected]"
] | ||
d76e795123f0497852695a41959ab001d1bfbf76 | ee0d3430239ccc27b4460cfbad55aedc6418c754 | /src/main/java/com/springboot/crm/config/PageInfo.java | c29f9110017a7d72058252444a9318b8e8e94118 | [] | no_license | Akash1020/CRMSystem | d15e9d627d210b116e7ab2e9bc7163f4f1237f12 | 80bd02f3f86438bf7f9c0fe36cd413ded7822a88 | refs/heads/master | 2022-11-14T00:39:22.032682 | 2020-07-02T03:29:34 | 2020-07-02T03:29:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,160 | java | package com.springboot.crm.config;
import com.github.pagehelper.Page;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
@SuppressWarnings({"rawtypes", "unchecked"})
public class PageInfo<T> implements Serializable {
private static final long serialVersionUID = 1L;
//ๅฝๅ้กต
private int pageNum;
//ๆฏ้กต็ๆฐ้
private int pageSize;
//ๆป่ฎฐๅฝๆฐ
private long total;
//ๆป้กตๆฐ
private int pages;
//็ปๆ้
private List<T> list;
//ๆฏๅฆไธบ็ฌฌไธ้กต
private boolean isFirstPage = false;
//ๆฏๅฆไธบๆๅไธ้กต
private boolean isLastPage = false;
public PageInfo() {
}
/**
* ๅ
่ฃ
Pageๅฏน่ฑก
*
* @param list
*/
public PageInfo(List<T> list) {
if (list instanceof Page) {
Page page = (Page) list;
this.pageNum = page.getPageNum();
this.pageSize = page.getPageSize();
this.pages = page.getPages();
this.list = page;
this.total = page.getTotal();
} else if (list instanceof Collection) {
this.pageNum = 1;
this.pageSize = list.size();
this.pages = 1;
this.list = list;
this.total = list.size();
}
if (list instanceof Collection) {
//ๅคๆญ้กต้ข่พน็
judgePageBoudary();
}
}
/**
* ๅคๅฎ้กต้ข่พน็
*/
private void judgePageBoudary() {
isFirstPage = pageNum == 1;
isLastPage = pageNum == pages;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
public boolean isIsFirstPage() {
return isFirstPage;
}
public void setIsFirstPage(boolean isFirstPage) {
this.isFirstPage = isFirstPage;
}
public boolean isIsLastPage() {
return isLastPage;
}
public void setIsLastPage(boolean isLastPage) {
this.isLastPage = isLastPage;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("PageInfo{");
sb.append("pageNum=").append(pageNum);
sb.append(", pageSize=").append(pageSize);
sb.append(", total=").append(total);
sb.append(", pages=").append(pages);
sb.append(", list=").append(list);
sb.append(", isFirstPage=").append(isFirstPage);
sb.append(", isLastPage=").append(isLastPage);
sb.append(", navigatepageNums=");
sb.append('}');
return sb.toString();
}
}
| [
"[email protected]"
] | |
a40a8cd967b2d79ba6e8db768ee328d48f62932f | cfcef860e355e7a8389f42002100c07a3f54e739 | /src/main/java/jpatest06/Period.java | 33c328c2f4a34d2c60290604a445cbd9a53962e4 | [] | no_license | whdals7337/jpa-study | 5459e8ba4d15ae9563bbc8ca9284f9cc8f2586f2 | 9ca5fe360febb84d7357e7f1af13d42fdb424ca5 | refs/heads/master | 2023-03-08T19:24:41.580470 | 2021-01-19T08:27:48 | 2021-02-25T19:30:00 | 329,643,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | package jpatest06;
import javax.persistence.Embeddable;
import java.time.LocalDate;
import java.util.Objects;
@Embeddable
public class Period {
private LocalDate startDate;
private LocalDate endDate;
public Period() {}
public LocalDate getStartDate() {
return startDate;
}
public LocalDate getEndDate() {
return endDate;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Period period = (Period) o;
return Objects.equals(getStartDate(), period.getStartDate()) &&
Objects.equals(getEndDate(), period.getEndDate());
}
@Override
public int hashCode() {
return Objects.hash(getStartDate(), getEndDate());
}
}
| [
"[email protected]"
] | |
2d81d1d37da1904ad369b87c59defd1dd553fa49 | 8388d3009c0be9cb4e3ea25abbce7a0ad6f9b299 | /business/ims/ims-api/src/main/java/com/sinosoft/ims/api/auth/dto/TreeNodeDto.java | f073a98c283c583f904595e5461bc4a1c4ac14c9 | [] | no_license | foxhack/NewAgri2018 | a182bd34d0c583a53c30d825d5e2fa569f605515 | be8ab05e0784c6e7e7f46fea743debb846407e4f | refs/heads/master | 2021-09-24T21:58:18.577979 | 2018-10-15T11:24:21 | 2018-10-15T11:24:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,157 | java | package com.sinosoft.ims.api.auth.dto;
import java.io.Serializable;
import java.util.List;
/**
* @description ๆบๆๆ TreeNode
* @author hzhongkai
* @date 2016ๅนด10ๆ20ๆฅไธๅ11:15:40
*/
public class TreeNodeDto implements Serializable {
private static final long serialVersionUID = 1L;
private String comCode;
private String upperComCode;
private String title;
private boolean checked;
private List<TreeNodeDto> nodes;
public String getComCode()
{
return comCode;
}
public void setComCode(String comCode)
{
this.comCode = comCode;
}
public String getUpperComCode()
{
return upperComCode;
}
public void setUpperComCode(String upperComCode)
{
this.upperComCode = upperComCode;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public List<TreeNodeDto> getNodes() {
return nodes;
}
public void setNodes(List<TreeNodeDto> nodes) {
this.nodes = nodes;
}
}
| [
"[email protected]"
] | |
10ae14ce2e5829885446b446c9725bc6b383d5eb | 53b29fbaaa1e73c9d6e26a59a0324fa8baa977ef | /src/main/java/net/wendal/nutzbook/module/NgrokModule.java | 303e95750b5f8415d060e152bd050be24d6892b8 | [
"Apache-2.0"
] | permissive | CXW0504/nutz-book-project | 1eefa567608f15b6161689dfa1a63c0c583a36c5 | ab7a30f2338634826325cc861c25bfb995ead10c | refs/heads/master | 2020-12-25T19:38:57.557993 | 2015-11-16T19:35:58 | 2015-11-16T19:35:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,269 | java | package net.wendal.nutzbook.module;
import static net.wendal.nutzbook.util.RedisInterceptor.jedis;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.nutz.dao.Cnd;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Encoding;
import org.nutz.lang.Strings;
import org.nutz.lang.random.R;
import org.nutz.mvc.Scope;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Attr;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.view.RawView;
import org.nutz.mvc.view.ViewWrapper;
import net.wendal.nutzbook.bean.OAuthUser;
import net.wendal.nutzbook.bean.User;
@IocBean
@At("/ngrok")
public class NgrokModule extends BaseModule {
@RequiresUser
@At
@Ok("->:/yvr/links/ngrok")
public Object me(@Attr(scope = Scope.SESSION, value = "me") int userId) {
String token = getAuthToken(userId);
if (token == null) {
return new ViewWrapper(new RawView(null), "ๆฑๆญ,ๅฝๅไป
ๅ
่ฎธgithub็ป้็็จๆทไฝฟ็จ");
}
return null;
}
@RequiresUser
@At("/config/download")
@Ok("raw:xml")
public Object getConfigureFile(@Attr(scope = Scope.SESSION, value = "me") int userId, HttpServletResponse resp) throws UnsupportedEncodingException {
String token = getAuthToken(userId);
if (token == null) {
return HTTP_403;
}
String filename = URLEncoder.encode("ngrok.yml", Encoding.UTF8);
resp.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
String[] lines = new String[]{
"server_addr: wendal.cn:4443",
"trust_host_root_certs: true",
"auth_token: " + token,
""
};
return Strings.join("\r\n", lines);
}
@Aop("redis")
public String getAuthToken(int userId) {
int count = dao.count(OAuthUser.class, Cnd.where("providerId", "=", "github").and("userId", "=", userId));
if (count != 1 && userId > 2) {
return null;
}
User user = dao.fetch(User.class, userId);
String token = jedis().hget("ngrok2", ""+userId);
if (token == null) {
token = R.UU32();
jedis().hset("ngrok2", ""+userId, token);
jedis().hset("ngrok", token, user.getName() + ".ngrok");
}
return token;
}
}
| [
"[email protected]"
] | |
48502546ef5d114cef8e741a6aae723fb569bf28 | 673416acc6fa0021f264728219dc8d77e49bc84c | /src/main/java/com/wnn/mycontroller/AttrController.java | b059a089fe45f46a60c565f1d3bc4d9046c48e18 | [] | no_license | ygshiliu/B2C_manager | 06d4bf8e0aa52e3277ed354ea60a88804be6708b | d54da9c504abfb059ba38b7a8e668586226f0590 | refs/heads/master | 2021-07-18T06:27:38.317379 | 2017-10-25T08:42:40 | 2017-10-25T08:42:40 | 108,242,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,886 | java | package com.wnn.mycontroller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.wnn.mybean.Model_Object_T_mall_attr;
import com.wnn.mybean.Object_T_mall_attr;
import com.wnn.myservice.AttrServiceInf;
@Controller
public class AttrController {
@Autowired
private AttrServiceInf attrService;
@RequestMapping("goto_attr")
public String goto_attr(){
return "manager_attr";
}
@ResponseBody
@RequestMapping("attr_class_2_select2")
public List<Object_T_mall_attr> attr_class_2_select2(Integer flbh2_id,String flbh2_name){
List<Object_T_mall_attr> attrList = attrService.get_attr_by_class_2(flbh2_id);
return attrList;
}
@RequestMapping("attr_class_2_select")
public String attr_class_2_select(Integer flbh2_id,String flbh2_name,Map<String,Object> map){
List<Object_T_mall_attr> attrList = attrService.get_attr_by_class_2(flbh2_id);
map.put("attrList", attrList);
map.put("flbh2_id", flbh2_id);
map.put("flbh2_name", flbh2_name);
return "manager_attr_list_inner";
}
@RequestMapping("to_add_attr_value")
public String to_add_attr_value(Integer flbh2_id,String flbh2_name,Map<String,Object> map){
map.put("flbh2_id", flbh2_id);
map.put("flbh2_name", flbh2_name);
return "manager_attr_add";
}
@RequestMapping("add_attr")
public ModelAndView add_attr(Model_Object_T_mall_attr model_attr_list){
attrService.add_attr(model_attr_list.getAttr_list());
ModelAndView modelAndView = new ModelAndView("redirect:/goto_attr.htm");
modelAndView.addObject("msg", "ๆทปๅ ๆๅ");
return modelAndView;
}
}
| [
"[email protected]"
] | |
9026d4a03c3c541af657fa94be3ff6f37dc9427b | 4eb59ded7f66c7c697b0e9118c7838942a535487 | /core/src/Logic/Mission/MissionControl.java | 0bbd922f6a9ebbf8d83745b95b4e53b3c2eae6bf | [] | no_license | mileycirusprograming/SettlerGDX | 9d5b8ee6847dcfc5d4fab40595237006d91af3e5 | d92df820a076f70e54dbe97393095f104dc2c25d | refs/heads/master | 2021-01-22T06:20:05.877072 | 2017-04-06T18:43:58 | 2017-04-06T18:43:58 | 81,752,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,830 | java | package Logic.Mission;
import Logic.Break;
import Logic.GameObject.*;
import Logic.NationObjectAccessor;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Created by landfried on 30.01.17.
*/
public class MissionControl {
private List<Mission> unassignedMissions;
private List<Mission> assignedMissions;
private int nationId;
private NationObjectAccessor objectAccessor;
public MissionControl(int nationId, NationObjectAccessor objectAccessor) {
unassignedMissions = new ArrayList<>();
assignedMissions = new ArrayList<>();
this.nationId = nationId;
this.objectAccessor = objectAccessor;
}
public void prepareMissions() {
for (Mission mission : unassignedMissions)
mission.abort();
unassignedMissions.clear();
for (Building building : objectAccessor.getBuildings()) {
for (ResourceType neededRessource : building.getNeededResources().keySet()) {
if (getFreeResource(neededRessource) == null)
continue;
for (int i = 0; i < building.getNeededResources().get(neededRessource); i++) {
Resource freeResource = getFreeResource(neededRessource);
if (freeResource == null)
break;
unassignedMissions.add(new MissionCarrier(building, freeResource));
}
}
if (building.waitingForContruction()) {
unassignedMissions.add(new MissionBuilder(building));
}
}
}
private Resource getFreeResource(ResourceType type) {
for (Resource resource : objectAccessor.getResources())
if (resource.getType().equals(type) && !resource.isUsed())
return resource;
return null;
}
private SettlerCarrier getFreeCarrier() {
for (Settler settler : objectAccessor.getSettlers())
if (settler instanceof SettlerCarrier)
if (!settler.isBusy())
return (SettlerCarrier)settler;
return null;
}
private Settler getFreeSettler(Class<? extends Settler> settlerType) {
for (Settler settler : objectAccessor.getSettlers())
if (settlerType.isInstance(settler))
if (!settler.isBusy())
return settler;
return null;
}
public void distributeMissions() {
for (Mission mission : unassignedMissions) {
if (mission instanceof MissionCarrier) {
//SettlerCarrier freeCarrier = getFreeCarrier();
SettlerCarrier freeCarrier = (SettlerCarrier)getFreeSettler(SettlerCarrier.class);
if (freeCarrier != null) {
freeCarrier.setMission(mission);
assignedMissions.add(mission);
}
}
if (mission instanceof MissionBuilder) {
SettlerBuilder freeBuilder = (SettlerBuilder)getFreeSettler(SettlerBuilder.class);
if (freeBuilder != null) {
freeBuilder.setMission(mission);
assignedMissions.add(mission); }
}
}
unassignedMissions.removeAll(assignedMissions);
}
public void removeTerminatedMissions() {
assignedMissions.removeIf(mission -> mission.getState() == MissionState.COMPLETE || mission.getState() == MissionState.FAIL);
/*
for (Iterator<Mission> iterator = assignedMissions.iterator(); iterator.hasNext();) {
Mission mission = iterator.next();
if (mission.getState() == MissionState.COMPLETE || mission.getState() == MissionState.FAIL)
iterator.remove();
}
*/
}
}
| [
"[email protected]"
] | |
e01a78a6bbbe9dc198d8af29ccb2f19c3d30483e | c40d4a2c91fc69f465b7961547bcd114821fdc55 | /src/me/trent/DB.java | 5cba850f8a302d921d52bd6389be1cc0401a9e28 | [] | no_license | TrentTheDude/DatabaseMessaging | 332c817ea8a8c09defdf62d26fb28a38aa36af60 | 773b9721def19ef4d526193d042556536f7e053c | refs/heads/master | 2023-03-31T10:30:17.991976 | 2021-04-07T23:08:37 | 2021-04-07T23:08:37 | 355,704,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,340 | java | package me.trent;
import java.sql.*;
import java.util.List;
/**
* Created by trent on 6/1/2017.
*/
public class DB {
private String ip;
private String db;
private String user;
private String pass;
private boolean started = false;
public DB(String ip, String db, String user, String pass) {
this.ip = ip;
this.db = db;
this.user = user;
this.pass = pass;
}
public Connection connection = null;
public boolean start() {
try {
// connection = DriverManager.getConnection("jdbc:mysql://" + ip + "/" + db + "?user=" + user + "&password=" + pass);
connection = DriverManager.getConnection("jdbc:mysql://" + ip + "/" + db + "?user=" + user + "&password=" + pass);
System.out.print("\n\n\n\n CONNECTED TO DATABASE \n\n\n\n");
started = true;
return true;
}catch(SQLException e){
e.printStackTrace();
System.out.print("\n\n\n");
}
return false;
}
public boolean isStarted() {
return started;
}
public Connection getConnection() {
return connection;
}
public boolean isColumn(String table, String column){
boolean a = false;
ResultSet r;
try {
DatabaseMetaData m = connection.getMetaData();
r = m.getColumns(null, null, table, column);
if (!r.next()){
a = false;
}else{
a = true;
}
}catch(SQLException e){
e.printStackTrace();
}
return a;
}
public boolean isTable(String table){
boolean a = false;
ResultSet r;
try {
DatabaseMetaData m = connection.getMetaData();
r = m.getTables(null, null, table, null);
if (!r.next()){
a = false;
}else{
a = true;
}
}catch(SQLException e){
e.printStackTrace();
}
return a;
}
public String[] player_data_columns = {"uuid", ""};
public String[] tables = {"programs"};
public void addTable(String tableName, String defaultColumn, int amount){
PreparedStatement s = preparedStatement("CREATE TABLE "+tableName+" ("+defaultColumn+" VARCHAR("+amount+") NOT NULL)");
update(s);
}
public void addColumn(String tablename, String column, String type){
PreparedStatement s = preparedStatement("ALTER TABLE "+tablename+" add "+column+" "+type+" NOT NULL");
update(s);
}
public PreparedStatement preparedStatement(String query) {
PreparedStatement s = null;
try {
s = connection.prepareStatement(query);
} catch (SQLException e) {
e.printStackTrace();
}
return s;
}
public boolean checkResultSet(String query, String lookfor){
ResultSet s;
boolean a = false;
try{
s = preparedStatement(query).executeQuery(query);
while (s.next()) {
if (s.getString(lookfor) != null) {
a = true;
}else{
a = false;
}
}
}catch(SQLException e){
e.printStackTrace();
}
return a;
}
public String readResultSet(String query){
String returned = "";
ResultSet s;
try{
s = preparedStatement(query).executeQuery(query);
while(s.next()){
returned = s.getString(1);
}
}catch(SQLException e){
e.printStackTrace();
returned = "";
}
return returned;
}
public int readResultSetInt(String query){
int returned = 0;
ResultSet s;
try{
s = preparedStatement(query).executeQuery(query);
while(s.next()){
returned = s.getInt(1);
}
}catch(SQLException e){
e.printStackTrace();
}
return returned;
}
public double readResultSetDouble(String query){
double returned = 0;
ResultSet s;
try{
s = preparedStatement(query).executeQuery(query);
while(s.next()){
returned = s.getDouble(1);
}
}catch(SQLException e){
e.printStackTrace();
}
return returned;
}
public void update(PreparedStatement statement) {
try {
try {
statement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} catch (NullPointerException e) {}
} finally {
try {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
} catch (NullPointerException e) {}
}
}
public void removeRow(String table, String column, String where_equals){
try {
PreparedStatement s;
s = preparedStatement("DELETE FROM " + table + " WHERE " + column + " = ?");
s.setString(1, where_equals);
s.executeUpdate();
}catch(SQLException e){
e.printStackTrace();
}
}
public void setColumn(String table, String column, String value, String where, String where_equals){
PreparedStatement s;
if (where_equals == null && where == null){
// s = preparedStatement("UPDATE "+table+" SET "+column+"=?");
s = preparedStatement("INSERT IGNORE INTO "+table+" ("+column+") VALUES (?) ON DUPLICATE KEY UPDATE "+column+"=?");
}else{
s = preparedStatement("UPDATE "+table+" SET "+column+"=? WHERE "+where+"='"+where_equals+"'");
}
try {
s.setString(1, value);
if (where_equals == null && where == null){
s.setString(2, value);
}
update(s);
}catch(SQLException e){
e.printStackTrace();
}
}
public void setColumnForList(String table, String column, List<String> value, String where, String where_equals){
PreparedStatement s;
if (where_equals == null && where == null){
// s = preparedStatement("UPDATE "+table+" SET "+column+"=?");
s = preparedStatement("INSERT IGNORE INTO "+table+" ("+column+") VALUES (?) ON DUPLICATE KEY UPDATE "+column+"=?");
}else{
s = preparedStatement("UPDATE "+table+" SET "+column+"=? WHERE "+where+"='"+where_equals+"'");
}
try {
String goodValue = "";
for (String strings : value){
if (goodValue.equalsIgnoreCase("")){
//is blank, new place
goodValue = strings;
}else{
//is not blank, keep adding them with commas
goodValue = goodValue+","+strings;
}
}
s.setString(1, goodValue);
if (where_equals == null && where == null){
s.setString(2, goodValue);
}
update(s);
}catch(SQLException e){
e.printStackTrace();
}
}
public void setColumn(String table, String column, int value, String where, String where_equals){
PreparedStatement s;
if (where_equals == null && where == null){
// s = preparedStatement("UPDATE "+table+" SET "+column+"=?");
s = preparedStatement("INSERT IGNORE INTO "+table+" ("+column+") VALUES (?) ON DUPLICATE KEY UPDATE "+column+"=?");
}else{
s = preparedStatement("UPDATE "+table+" SET "+column+"=? WHERE "+where+"='"+where_equals+"'");
}
try {
s.setInt(1, value);
if (where_equals == null && where == null){
s.setInt(2, value);
}
update(s);
}catch(SQLException e){
e.printStackTrace();
}
}
public String getDb() {
return db;
}
public String getIp() {
return ip;
}
public String getPass() {
return pass;
}
public String getUser() {
return user;
}
} | [
"[email protected]"
] | |
2febb710af26f9d63a93a4597ac5f402665468f2 | 3b93dfe4af208c2e7d0a3124a223acb8d39814ed | /D-Genetic-Algorithm/WordGuess.java | 14dd394213b256477ccabf6f95ca82de57fca21c | [] | no_license | pauldepalma/CPSC427 | c2ba6a066f38aa759f97c25776ce903eea87bf30 | 3b18ef392ad056b44533e4bb4fcbbe84c1650c77 | refs/heads/master | 2021-07-14T01:31:00.501699 | 2021-07-04T22:04:07 | 2021-07-04T22:04:07 | 79,282,559 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,260 | java | import java.util.*;
import java.lang.*;
public class WordGuess extends GA
{
private String WG_target;
public WordGuess(String fileName, String target)
{
super(fileName,target);
WG_target = new String(target);
GA_numGenes = WG_target.length();
if (WG_target.length() != GA_numGenes)
{
System.out.println("Error: Target size differs from number of genes");
DisplayParams();
System.exit(1);
}
InitPop();
}
public void InitPop()
{
super.InitPop();
ComputeCost();
SortPop();
TidyUp();
}
public void DisplayParams()
{
System.out.print("Target: ");
System.out.println(WG_target);
super.DisplayParams();
}
protected void ComputeCost()
{
for (int i = 0; i < GA_pop.size(); i++)
{
int cost = 0;
Chromosome chrom = GA_pop.remove(i);
for (int j = 0; j < GA_numGenes; j++)
if (chrom.GetGene(j) != WG_target.charAt(j))
cost++;
chrom.SetCost(cost);
GA_pop.add(i,chrom);
}
}
//in earlier versions (as on ada) Evolve() from GA is here
}
| [
"[email protected]"
] | |
49f6513b0f3e9d7aa950b4e4222bb58a567fe2c3 | 366bbe796136acd7de8c602eb17e436ae72b948e | /src/jp/hutcraft/otl/OthelloMain.java | 35d9f69a421b668275793e5b7c2b7c03be4505fe | [] | no_license | almirage/AIOthello | e3788cbc677695ab9b805dbf7f0ddf146e4bbf1c | 270f65d90375802c185c7827fa721c2d91f919c2 | refs/heads/master | 2021-01-01T18:41:28.907909 | 2011-09-29T10:43:21 | 2011-09-29T10:43:21 | 2,481,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package jp.hutcraft.otl;
import jp.hutcraft.otl.ui.GuiMain;
public final class OthelloMain {
public static void main(String[] args) {
new GuiMain();
}
}
| [
"[email protected]"
] | |
0a934e0422ed1dbe148a8aba50384c0a7276665b | a880956ae8968d2e206662fba441222ead9f82af | /app/src/main/java/com/example/a95795/thegreenplant/HomeActivity.java | df86b4a576cae728dc9d4ea6a447d514759c68d5 | [] | no_license | 2986292568/TheGreenPlant | 97e3cd73a5c9179970d4f25d5068ff807ca4c8f5 | 3ac18135842d61e3fa26a2ff89678d52a5f5f64a | refs/heads/master | 2022-02-04T08:38:59.696458 | 2019-06-24T05:20:34 | 2019-06-24T05:20:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,463 | java | package com.example.a95795.thegreenplant;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.location.LocationManager;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.example.a95795.thegreenplant.HomeFragment.FeedbackFragment;
import com.example.a95795.thegreenplant.HomeFragment.HomeFragment;
import com.example.a95795.thegreenplant.HomeFragment.OperationLogFragment;
import com.example.a95795.thegreenplant.adapter.BoosWorkshopAdapter;
import com.example.a95795.thegreenplant.custom.LocationService;
import com.example.a95795.thegreenplant.custom.SecretTextView;
import com.example.a95795.thegreenplant.custom.StatusBarCompat;
import com.example.a95795.thegreenplant.side.AboutFragment;
import com.example.a95795.thegreenplant.side.BoosWorkshopInformationFragmentFragment;
import com.example.a95795.thegreenplant.side.SetMaxVauleFragment;
import com.example.a95795.thegreenplant.side.UploadingFragment;
import com.example.a95795.thegreenplant.side.WorkshopInformationFragment;
import com.example.a95795.thegreenplant.tools.MyBroadcastReceiver;
import com.example.a95795.thegreenplant.tools.MyService;
import cn.pedant.SweetAlert.SweetAlertDialog;
import me.yokeyword.fragmentation.SupportActivity;
import me.yokeyword.fragmentation.SupportFragment;
import static com.mob.MobSDK.getContext;
public class HomeActivity extends SupportActivity
implements NavigationView.OnNavigationItemSelectedListener {
SecretTextView secretTextView;
ImageView imageView,imageView2;
private int GPS_REQUEST_CODE = 1;
public static final int FIRST = 0;
public static final int SECOND = 1;
public static final int THIRDLY = 2;
public static final int FOURTHLY = 3;
public static final int FOUR = 4;
public static final int FIVE = 5;
public static final int SIX = 6;
public static final int EIGHT = 7;
private LocationService locationService;
private TextView mTextView;
private int postion = 0;
private TextView textView;
private SupportFragment[] mFragments = new SupportFragment[8];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
startService(new Intent(this, MyService.class));
Context ctx = getContext();
SharedPreferences sp = ctx.getSharedPreferences("SP", MODE_PRIVATE);
String name = sp.getString("STRING_KEY3","");
openGPSSEtting();
imageView = findViewById(R.id.imageView3);
imageView2 = findViewById(R.id.pz);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("");
//ๆฒๆตธๅผ็ถๆๆ
StatusBarCompat.compat(this, Color.parseColor("#FF16A295"));
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
//่ฟ้ๅบๆฌ้ฝๆฏไพงๆป่ๅ
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
locationService = new LocationService(this);
// ๅคไธชactivity
// locationService = ((App) getApplication()).locationService;
locationService.registerListener(mListener);
locationService.setLocationOption(locationService.getDefaultLocationClientOption());
locationService.start();
//่ฎพ็ฝฎ้กถ้จๅงๅ
View headerview = navigationView.getHeaderView(0);
textView = headerview.findViewById(R.id.username);
textView.setText(name);
View headerview2 = navigationView.getHeaderView(0);
mTextView = headerview2.findViewById(R.id.price);
SupportFragment firstFragment = findFragment(HomeFragment.class);
if (firstFragment == null) {
mFragments[FIRST] = HomeFragment.newInstance();
mFragments[SECOND] = AboutFragment.newInstance();
mFragments[THIRDLY] = WorkshopInformationFragment.newInstance();
mFragments[FOURTHLY] = SetMaxVauleFragment.newInstance();
mFragments[FOUR] = FeedbackFragment.newInstance();
mFragments[FIVE] = OperationLogFragment.newInstance();
mFragments[SIX] = BoosWorkshopInformationFragmentFragment.newInstance();
mFragments[EIGHT] = UploadingFragment.newInstance();;
loadMultipleRootFragment(R.id.home, FIRST,
mFragments[FIRST],
mFragments[SECOND],
mFragments[THIRDLY],
mFragments[FOURTHLY],
mFragments[FOUR],
mFragments[FIVE],
mFragments[SIX],
mFragments[EIGHT]);
} else {
// ่ฟ้ๅบๅทฒ็ปๅไบFragmentๆขๅค,ๆๆไธ้่ฆ้ขๅค็ๅค็ไบ, ไธไผๅบ็ฐ้ๅ ้ฎ้ข
// ่ฟ้ๆไปฌ้่ฆๆฟๅฐmFragments็ๅผ็จ
mFragments[FIRST] = firstFragment;
mFragments[SECOND] = findFragment(AboutFragment.class);
mFragments[THIRDLY] = findFragment(WorkshopInformationFragment.class);
mFragments[FOURTHLY] = findFragment(SetMaxVauleFragment.class);
mFragments[FOUR] = findFragment(FeedbackFragment.class);
mFragments[FIVE] = findFragment(OperationLogFragment.class);
mFragments[SIX] = findFragment(BoosWorkshopInformationFragmentFragment.class);
mFragments[EIGHT] = findFragment(UploadingFragment.class);
}
//ไฝฟ็จๅผๆบๆงไปถSecretTextViewๅฎ็ฐๆๅญ็ๆธๅ
secretTextView = (SecretTextView)findViewById(R.id.textView);
secretTextView.setDuration(1000);
secretTextView.setIsVisible(true);
//ๅฎๆถ่งๅพ็ๆ้ฎ
imageView2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(HomeActivity.this, RealActivity.class);
startActivity(intent);
}
});
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showHideFragment(mFragments[7], mFragments[postion]);
postion = 7;
test(5);
}
});
}
//ไธไธช็ฎๅ็้ๅบ่ฝฏไปถๆ็คบ
@Override
public void onBackPressedSupport() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else if(postion!=0) {
showHideFragment(mFragments[0], mFragments[postion]);
postion = 0;
secretTextView.hide();
secretTextView.setText("้ฆ้กต");
secretTextView.show();
}else {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("ๆ็คบ๏ผ");
builder.setMessage("ๆจ็กฎๅฎ้ๅบ๏ผ");
//่ฎพ็ฝฎ็กฎๅฎๆ้ฎ
builder.setNegativeButton("็กฎๅฎ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
//่ฎพ็ฝฎๅๆถๆ้ฎ
builder.setPositiveButton("ๅๆถ", null);
//ๆพ็คบๆ็คบๆก
builder.show();
}
}
//ไพงๆป่ๅ็็นๅปไบไปถ
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
Context ctx = getContext();
SharedPreferences sp = ctx.getSharedPreferences("SP", MODE_PRIVATE);
int work = sp.getInt("STRING_KEY2",0);
// Handle navigation view item clicks here.
int id = item.getItemId();
//่ฟๅ
ฅ้ฆ้กต
if(id==R.id.homeitem){
showHideFragment(mFragments[0], mFragments[postion]);
postion = 0;
secretTextView.hide();
secretTextView.setText("้ฆ้กต");
secretTextView.show();
//ๆๅก
} else if (id == R.id.nav_camera) {
new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE)
.setTitleText("่ญฆๅ")
.setContentText("ๆญฃๅจๅผๅ...")
.setConfirmText("็กฎๅฎ")
.show();
//ๆฅ็ๆๆไบบๅนถๅธฆๆปๅจๅ ้ค
} else if (id == R.id.nav_gallery) {
if(work==0){
new SweetAlertDialog(HomeActivity.this, SweetAlertDialog.WARNING_TYPE)
.setTitleText("่ญฆๅ")
.setContentText("ๆฑๆญ๏ผไฝ ๆฒกๆๆๅฉไฝฟ็จๆญคๅ่ฝ")
.setConfirmText("็กฎๅฎ")
.show();
}else {
showHideFragment(mFragments[6], mFragments[postion]);
test(4);
postion = 6;
}
//้ๅผ่ฎพ็ฝฎ
} else if (id == R.id.nav_slideshow) {//่ฎพ็ฝฎ
if(work==0){
new SweetAlertDialog(HomeActivity.this, SweetAlertDialog.WARNING_TYPE)
.setTitleText("่ญฆๅ")
.setContentText("ๆฑๆญ๏ผไฝ ๆฒกๆๆๅฉไฝฟ็จๆญคๅ่ฝ")
.setConfirmText("็กฎๅฎ")
.show();
}else {
showHideFragment(mFragments[3], mFragments[postion]);
test(6);
postion = 3;
}
} else if (id == R.id.nav_manage) {//็จๆทๅ้ฆ
showHideFragment(mFragments[4], mFragments[postion]);
test(7);
postion = 4;
//ๅ
ณไบ้กต้ข
} else if (id == R.id.nav_share) {
showHideFragment(mFragments[1], mFragments[postion]);
postion = 1;
test(5);
} else if (id == R.id.nav_send) {
new SweetAlertDialog(HomeActivity.this, SweetAlertDialog.SUCCESS_TYPE)
.setContentText("ๆจ็็ๆฌๅทฒ็ปๆฏๆๆฐ็2.0")
.setConfirmText("็กฎๅฎ")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismissWithAnimation();
}
})
.show();
//ๆไฝๆฅๅฟ
}else if (id == R.id.feed) {
if(work==0){
new SweetAlertDialog(HomeActivity.this, SweetAlertDialog.WARNING_TYPE)
.setTitleText("่ญฆๅ")
.setContentText("ๆฑๆญ๏ผไฝ ๆฒกๆๆๅฉไฝฟ็จๆญคๅ่ฝ")
.setConfirmText("็กฎๅฎ")
.show();
}else {
showHideFragment(mFragments[5], mFragments[postion]);
test(8);
postion = 5;
}
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
//่ฎพ็ฝฎ้กถ้จๆ ้ข็ไฟฎๆน
public void test(int number) {
switch (number) {
case 1:
imageView.setVisibility(View.VISIBLE);
imageView2.setVisibility(View.GONE);
secretTextView.hide();
secretTextView.setText("่ฎพๅค็ๆต");
secretTextView.show();
break;
case 2:
imageView.setVisibility(View.GONE);
imageView2.setVisibility(View.VISIBLE);
secretTextView.hide();
secretTextView.setText("็ฏๅข็ๆต");
secretTextView.show();
break;
case 3:
imageView.setVisibility(View.GONE);
imageView2.setVisibility(View.GONE);
secretTextView.hide();
secretTextView.setText("ไธชไบบไธญๅฟ");
secretTextView.show();
break;
case 4:
imageView.setVisibility(View.GONE);
imageView2.setVisibility(View.GONE);
secretTextView.hide();
secretTextView.setText("่ฝฆ้ดไบบๅไฟกๆฏ");
secretTextView.show();
break;
case 5:
imageView.setVisibility(View.GONE);
imageView2.setVisibility(View.GONE);
secretTextView.hide();
secretTextView.setText("ๅ
ณไบ่ฝฆ้ด");
secretTextView.show();
break;
case 6:
imageView.setVisibility(View.GONE);
imageView2.setVisibility(View.GONE);
secretTextView.hide();
secretTextView.setText("็ๆต่ฎพ็ฝฎ");
secretTextView.show();
break;
case 7:
imageView.setVisibility(View.GONE);
imageView2.setVisibility(View.GONE);
secretTextView.hide();
secretTextView.setText("็จๆทๅ้ฆ");
secretTextView.show();
break;
case 8:
imageView.setVisibility(View.GONE);
imageView2.setVisibility(View.GONE);
secretTextView.hide();
secretTextView.setText("ๆไฝๆฅๅฟ");
secretTextView.show();
break;
default:
break;
}
}
//ไธไธช็ฎๅ็fragment่ทณ่ฝฌ ไฝฟ็จreplace
public void replaceFragment(Fragment fragment) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.home, fragment);
transaction.addToBackStack(null);
transaction.commit();
}
@Override
protected void onDestroy() {
super.onDestroy();
locationService.unregisterListener(mListener); //ๆณจ้ๆ็ๅฌ
locationService.stop(); //ๅๆญขๅฎไฝๆๅก
// unregisterReceiver(myBroadcastReceiver);//ๅๆญข้็ฅ
}
/*****
*
* ๅฎไฝ็ปๆๅ่ฐ๏ผ้ๅonReceiveLocationๆนๆณ๏ผๅฏไปฅ็ดๆฅๆท่ดๅฆไธไปฃ็ ๅฐ่ชๅทฑๅทฅ็จไธญไฟฎๆน
*
*/
private BDAbstractLocationListener mListener = new BDAbstractLocationListener() {
@Override
public void onReceiveLocation(BDLocation location) {
// TODO Auto-generated method stub
if (null != location && location.getLocType() != BDLocation.TypeServerError) {
mTextView.setText(location.getAddrStr());
//่ถ
็บง็ฒพ็กฎ๏ผ๏ผ๏ผ๏ผ๏ผไปฅไธๆนๆณ--ใๅจ่พนไฟกๆฏ
/* if (location.getPoiList() != null && !location.getPoiList().isEmpty()) {
for (int i = 0; i < location.getPoiList().size(); i++) {
Poi poi = (Poi) location.getPoiList().get(i);
sb.append(poi.getName() + ";");
}
}*/
}
Log.e("99999", "onReceiveLocation: "+location.getAddrStr() );
}
};
private boolean checkGpsIsOpen() {
boolean isOpen;
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
isOpen = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
return isOpen;
}
private void openGPSSEtting() {
if (checkGpsIsOpen()){
// Toast.makeText(this, "true", Toast.LENGTH_SHORT).show();
}else {
new AlertDialog.Builder(this).setTitle("open GPS")
.setMessage("go to open")
// ๅๆถ้้กน
.setNegativeButton("cancel",new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Toast.makeText(HomeActivity.this, "close", Toast.LENGTH_SHORT).show();
// ๅ
ณ้ญdialog
dialogInterface.dismiss();
}
})
// ็กฎ่ฎค้้กน
.setPositiveButton("setting", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//่ทณ่ฝฌๅฐๆๆบๅ็่ฎพ็ฝฎ้กต้ข
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivityForResult(intent,GPS_REQUEST_CODE);
}
})
.setCancelable(false)
.show();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode ==GPS_REQUEST_CODE){
openGPSSEtting();
}
}
}
| [
"[email protected]"
] | |
85dc207539906e472fda11ce100fbbedc1b44e55 | 20ecff478333bd9cb5c7e8e441b5cd292dda14c1 | /src/main/java/com/todorest/basicAuth/AuthenticationBean.java | dc9f48b769ced7b29bd7237f00091d609e39f21d | [] | no_license | Chamith95/Spring_Todo | b665b4274d96d0d9b327074cb312ac6ac6db8654 | 6104a47f37e7c6c4b56647f7874595db9bed29ff | refs/heads/master | 2020-06-09T06:09:20.094926 | 2019-06-25T05:56:16 | 2019-06-25T05:56:16 | 193,387,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.todorest.basicAuth;
public class AuthenticationBean {
private String message;
public AuthenticationBean(String message) {
this.message=message;
}
public void setMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
@Override
public String toString() {
return "HelloWorldBean [message=" + message + "]";
}
}
| [
"[email protected]"
] | |
bc1e73ce0dc59db15266da7adedc3a32c5f9979f | 0d26d715a0e66246d9a88d1ca77637c208089ec4 | /fxadmin/src/main/java/com/ylxx/fx/service/impl/price/pricecontxpimpl/PriceConxServiceImpl.java | 08d4f5605fd41033dab538b0d69a34ad9d857272 | [] | no_license | lkp7321/sour | ff997625c920ddbc8f8bd05307184afc748c22b7 | 06ac40e140bad1dc1e7b3590ce099bc02ae065f2 | refs/heads/master | 2021-04-12T12:18:22.408705 | 2018-04-26T06:22:26 | 2018-04-26T06:22:26 | 126,673,285 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 888 | java | package com.ylxx.fx.service.impl.price.pricecontxpimpl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ylxx.fx.core.domain.price.CmmFiltrate;
import com.ylxx.fx.core.domain.price.Countexp;
import com.ylxx.fx.core.mapper.price.pricemanager.PriceConTexpMapper;
import com.ylxx.fx.service.price.pricecontxp.PriceContxpService;
@Service("priceContxpService")
public class PriceConxServiceImpl implements PriceContxpService{
@Resource
private PriceConTexpMapper priceContxpMap;
//ไบคๅ็่ฎก็ฎ1
public List<Countexp> getContexpPrice() {
return priceContxpMap.selContexpPrice();
}
//็ญ็ฅๅญๅ
ธ
public List<CmmFiltrate> getPriceFile() {
return priceContxpMap.selPriceFile();
}
//ไบคๅ็่ฎก็ฎ2
public List<Countexp> getContexpPrice1() {
return priceContxpMap.selectAccExPrice();
}
}
| [
"[email protected]"
] | |
556706a26a79ba4a2e4515687d661cf89bb11daf | 2c33a0d44a50a14300d4bb01cd4d1e3bcda083e3 | /modules/pe.com.unifiedgo.report/src/pe/com/unifiedgo/report/ad_reports/ReporteContableVerificacionDocumentoVentas.java | 798fbd0e4676546248f619c5ad54409999fbcc0a | [] | no_license | rick1992/openbravo | 6b44be4e35955e00f2fb8ea93e1ec960cab1c48b | 3bd85b10304e87c66aa4e07f200a4b530bd4a9bb | refs/heads/master | 2020-03-26T12:50:36.849610 | 2018-08-16T22:40:14 | 2018-08-16T22:40:14 | 144,910,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,156 | java | /*
*************************************************************************
* The contents of this file are subject to the Openbravo Public License
* Version 1.1 (the "License"), being the Mozilla Public License
* Version 1.1 with a permitted attribution clause; you may not use this
* file except in compliance with the License. You may obtain a copy of
* the License at http://www.openbravo.com/legal/license.html
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
* All portions are Copyright (C) 2001-2014 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
*/
package pe.com.unifiedgo.report.ad_reports;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
import org.openbravo.erpCommon.businessUtility.AccountingSchemaMiscData;
import org.openbravo.erpCommon.businessUtility.Tree;
import org.openbravo.erpCommon.businessUtility.TreeData;
import org.openbravo.erpCommon.businessUtility.WindowTabs;
import org.openbravo.erpCommon.utility.ComboTableData;
import org.openbravo.erpCommon.utility.DateTimeData;
import org.openbravo.erpCommon.utility.LeftTabsBar;
import org.openbravo.erpCommon.utility.NavigationBar;
import org.openbravo.erpCommon.utility.OBError;
import org.openbravo.erpCommon.utility.ToolBar;
import org.openbravo.erpCommon.utility.Utility;
import org.openbravo.xmlEngine.XmlDocument;
public class ReporteContableVerificacionDocumentoVentas extends HttpSecureAppServlet {
private static final long serialVersionUID = 1L;
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException,
ServletException {
VariablesSecureApp vars = new VariablesSecureApp(request);
if (log4j.isDebugEnabled())
log4j.debug("Command: " + vars.getStringParameter("Command"));
if (vars.commandIn("DEFAULT")) {
String strDateFrom = vars.getGlobalVariable("inpDateFrom",
"ReporteContableVerificacionDocumentoVentas|DateFrom", "");
String strDateTo = vars.getGlobalVariable("inpDateTo",
"ReporteContableVerificacionDocumentoVentas|DateTo", "");
String strOrg = vars.getGlobalVariable("inpOrg",
"ReporteContableVerificacionDocumentoVentas|Org", "0");
String strRecord = vars.getGlobalVariable("inpRecord",
"ReporteContableVerificacionDocumentoVentas|Record", "");
String strTable = vars.getGlobalVariable("inpTable",
"ReporteContableVerificacionDocumentoVentas|Table", "");
printPageDataSheet(response, vars, strDateFrom, strDateTo, strOrg, strTable, strRecord);
} else if (vars.commandIn("DIRECT")) {
String strTable = vars.getGlobalVariable("inpTable",
"ReporteContableVerificacionDocumentoVentas|Table");
String strRecord = vars.getGlobalVariable("inpRecord",
"ReporteContableVerificacionDocumentoVentas|Record");
setHistoryCommand(request, "DIRECT");
vars.setSessionValue("ReporteContableVerificacionDocumentoVentas.initRecordNumber", "0");
printPageDataSheet(response, vars, "", "", "", strTable, strRecord);
} else if (vars.commandIn("FIND")) {
String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom",
"ReporteContableVerificacionDocumentoVentas|DateFrom");
String strDateTo = vars.getRequestGlobalVariable("inpDateTo",
"ReporteContableVerificacionDocumentoVentas|DateTo");
String strOrg = vars.getGlobalVariable("inpOrg",
"ReporteContableVerificacionDocumentoVentas|Org", "0");
vars.setSessionValue("ReporteContableVerificacionDocumentoVentas.initRecordNumber", "0");
setHistoryCommand(request, "DEFAULT");
printPageDataSheet(response, vars, strDateFrom, strDateTo, strOrg, "", "");
} else if (vars.commandIn("PDF", "XLS")) {
if (log4j.isDebugEnabled())
log4j.debug("PDF");
String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom",
"ReporteContableVerificacionDocumentoVentas|DateFrom");
String strDateTo = vars.getRequestGlobalVariable("inpDateTo",
"ReporteContableVerificacionDocumentoVentas|DateTo");
String strOrg = vars.getGlobalVariable("inpOrg",
"ReporteContableVerificacionDocumentoVentas|Org", "0");
String strTable = vars.getStringParameter("inpTable");
String strRecord = vars.getStringParameter("inpRecord");
setHistoryCommand(request, "DEFAULT");
printPagePDF(request,response, vars, strDateFrom, strDateTo, strOrg, strTable, strRecord);
} else
pageError(response);
}
private void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars,
String strDateFrom, String strDateTo, String strOrg, String strTable, String strRecord)
throws IOException, ServletException {
if (log4j.isDebugEnabled())
log4j.debug("Output: dataSheet");
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
XmlDocument xmlDocument = null;
ReporteContableVerificacionDocumentoVentasData[] data = null;
String strPosition = "0";
ToolBar toolbar = new ToolBar(this, vars.getLanguage(),
"ReporteContableVerificacionDocumentoVentas", false, "", "", "imprimir();return false;",
false, "ad_reports", strReplaceWith, false, true);
toolbar.setEmail(false);
toolbar.prepareSimpleToolBarTemplate();
toolbar.prepareRelationBarTemplate(false, false,
"imprimirXLS();return false;");
if (data == null || data.length == 0) {
String discard[] = { "secTable" };
// toolbar
// .prepareRelationBarTemplate(
// false,
// false,
// "submitCommandForm('XLS', false, null, 'ReporteContableVerificacionDocumentoVentas.xls', 'EXCEL');return false;");
xmlDocument = xmlEngine.readXmlTemplate(
"pe/com/unifiedgo/report/ad_reports/ReporteContableVerificacionDocumentoVentas", discard)
.createXmlDocument();
data = ReporteContableVerificacionDocumentoVentasData.set("0");
data[0].rownum = "0";
}
xmlDocument.setParameter("toolbar", toolbar.toString());
try {
WindowTabs tabs = new WindowTabs(this, vars,
"pe.com.unifiedgo.report.ad_reports.ReporteContableVerificacionDocumentoVentas");
xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
xmlDocument.setParameter("childTabContainer", tabs.childTabs());
xmlDocument.setParameter("theme", vars.getTheme());
NavigationBar nav = new NavigationBar(this, vars.getLanguage(),
"ReporteContableVerificacionDocumentoVentas.html", classInfo.id, classInfo.type,
strReplaceWith, tabs.breadcrumb());
xmlDocument.setParameter("navigationBar", nav.toString());
LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(),
"ReporteContableVerificacionDocumentoVentas.html", strReplaceWith);
xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
} catch (Exception ex) {
throw new ServletException(ex);
}
{
OBError myMessage = vars.getMessage("ReporteContableVerificacionDocumentoVentas");
vars.removeMessage("ReporteContableVerificacionDocumentoVentas");
if (myMessage != null) {
xmlDocument.setParameter("messageType", myMessage.getType());
xmlDocument.setParameter("messageTitle", myMessage.getTitle());
xmlDocument.setParameter("messageMessage", myMessage.getMessage());
}
}
xmlDocument.setParameter("calendar", vars.getLanguage().substring(0, 2));
try {
ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_ORG_ID", "",
"", Utility.getContext(this, vars, "#AccessibleOrgTree",
"ReporteContableVerificacionDocumentoVentas"), Utility.getContext(this, vars,
"#User_Client", "ReporteContableVerificacionDocumentoVentas"), '*');
comboTableData.fillParameters(null, "ReporteContableVerificacionDocumentoVentas", "");
xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));
} catch (Exception ex) {
throw new ServletException(ex);
}
xmlDocument.setData(
"reportC_ACCTSCHEMA_ID",
"liststructure",
AccountingSchemaMiscData.selectC_ACCTSCHEMA_ID(this,
Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportGeneralLedger"),
Utility.getContext(this, vars, "#User_Client", "ReportGeneralLedger"), ""));
xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
xmlDocument.setParameter("paramLanguage", "defaultLang=\"" + vars.getLanguage() + "\";");
xmlDocument.setParameter("dateFrom", strDateFrom);
xmlDocument.setParameter("dateFromdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("dateFromsaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("dateTo", strDateTo);
xmlDocument.setParameter("dateTodisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("dateTosaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("adOrgId", strOrg);
xmlDocument.setParameter("groupId", strPosition);
xmlDocument.setParameter("paramRecord", strRecord);
xmlDocument.setParameter("paramTable", strTable);
xmlDocument.setParameter("paramPeriodosArray", Utility.arrayInfinitasEntradas("idperiodo;periodo;fechainicial;fechafinal;idorganizacion","arrPeriodos",
ReporteContableVerificacionDocumentoVentasData
.select_periodos(this)));
vars.setSessionValue("ReporteContableVerificacionDocumentoVentas|Record", strRecord);
vars.setSessionValue("ReporteContableVerificacionDocumentoVentas|Table", strTable);
xmlDocument.setData("structure1", data);
out.println(xmlDocument.print());
out.close();
}
private String getFamily(String strTree, String strChild) throws IOException, ServletException {
return Tree.getMembers(this, strTree, (strChild == null || strChild.equals("")) ? "0"
: strChild);
/*
* ReportGeneralLedgerData [] data = ReportGeneralLedgerData.selectChildren(this, strTree,
* strChild); String strFamily = ""; if(data!=null && data.length>0) { for (int i =
* 0;i<data.length;i++){ if (i>0) strFamily = strFamily + ","; strFamily = strFamily +
* data[i].id; } return strFamily += ""; }else return "'1'";
*/
}
private void printPagePDF(HttpServletRequest request,HttpServletResponse response, VariablesSecureApp vars,
String strDateFrom, String strDateTo, String strOrg, String strTable, String strRecord)
throws IOException, ServletException {
ReporteContableVerificacionDocumentoVentasData[] data = null;
ArrayList<ReporteContableVerificacionDocumentoVentasData> listData = new ArrayList<ReporteContableVerificacionDocumentoVentasData>();
String strTreeOrg = TreeData.getTreeOrg(this, vars.getClient());
String strOrgFamily = getFamily(strTreeOrg, strOrg);
data = ReporteContableVerificacionDocumentoVentasData.select_cro_pag_imp(this, Utility
.getContext(this, vars, "#User_Client", "ReporteContableVerificacionDocumentoVentas"),
strOrgFamily, strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"));
// for (int i = 0; i < data.length; i++) {
//
// ReporteContableVerificacionDocumentoVentasData obj = data[i];
// System.out
// .println("DATOS DESDE DATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
//
// System.out.println("nDocumento: " + obj.nDocumento);
// System.out.println("numeroSerie: " + obj.numeroSerie);
// System.out.println("estado: " + obj.estado);
// System.out.println("serie: " + obj.serie);
// System.out.println("numero: " + obj.numero);
// System.out.println("tipodoc: " + obj.tipodoc);
// System.out.println("rownum: " + obj.rownum);
// System.out.println("-------------------------------------");
// }
int serieant = -1;
int numeroant = -1;
int lengthnum = -1;
int serienow = -1;
int numeronow = -1;
ReporteContableVerificacionDocumentoVentasData objant = new ReporteContableVerificacionDocumentoVentasData();
for (ReporteContableVerificacionDocumentoVentasData objeto : data) {
ReporteContableVerificacionDocumentoVentasData temp = new ReporteContableVerificacionDocumentoVentasData();
temp.nDocumento = objeto.nDocumento;
temp.numeroSerie = objeto.numeroSerie;
temp.estado = objeto.estado;
temp.serie = objeto.serie;
temp.numero = objeto.numero;
temp.serieN = objeto.serieN;
temp.numeroN = objeto.numeroN;
temp.tipodoc = objeto.tipodoc;
if (objeto.estado.compareToIgnoreCase("AA") == 0) {
serienow = Integer.parseInt(objeto.serie == "" ? "0" : objeto.serie);
numeronow = Integer.parseInt(objeto.numero == "" ? "0" : objeto.numero);
if (serieant == serienow) {
if (numeronow > (numeroant + 1)) {
lengthnum = objeto.numero.length();
temp.nDocumento = "-----";
temp.numeroSerie = Integer.toString(serieant) + "-"
+ completaconzeros(numeroant + 1, lengthnum) + " hasta "
+ Integer.toString(serieant) + "-" + completaconzeros(numeronow - 1, lengthnum);
temp.estado = "NO EXISTEN";
temp.serie = Integer.toString(serienow);
temp.numero = "0";
listData.add(temp);
} else if (numeronow == numeroant) {
objant.estado = "NUMERO REPETIDO";
objant.serie = Integer.toString(serienow);
temp.estado = "NUMERO REPETIDO";
temp.serie = Integer.toString(serienow);
listData.add(objant);
listData.add(temp);
}
}
} else {
temp.serie = "---";
temp.numero = "------";
listData.add(temp);
}
serieant = serienow;
numeroant = numeronow;
objant = objeto;
}
// PARA COMPARAR POR VARIOS ATRIBUTOS
Collections
.sort(listData,
new Comparator<ReporteContableVerificacionDocumentoVentasData>() {
@Override
public int compare(
ReporteContableVerificacionDocumentoVentasData p1,
ReporteContableVerificacionDocumentoVentasData p2) {
int resultado = new String(p1.tipodoc)
.compareTo(new String(p2.tipodoc));
if (resultado != 0) {
return resultado;
}
resultado = new String(p1.serie)
.compareTo(new String(p2.serie));
if (resultado != 0) {
return resultado;
}
resultado = new String(p1.estado)
.compareTo(new String(p2.estado));
if (resultado != 0) {
return resultado;
}
resultado = new Integer(p1.numeroN)
.compareTo(new Integer(p2.numeroN));
if (resultado != 0) {
return resultado;
}
return resultado;
}
});
ReporteContableVerificacionDocumentoVentasData[] bestData = new ReporteContableVerificacionDocumentoVentasData[listData
.size()];
for (int x = 0; x < listData.size(); x++) {
bestData[x] = listData.get(x);
}
if (bestData.length==0) {
advisePopUp(request, response, "WARNING", Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage()), Utility.messageBD(this, "NoDataFound", vars.getLanguage()));
return;
}
// ------------------------------------------------------------------------------------------------------------------------------------
// for (int i = 0; i < bestData.length; i++) {
//
// ReporteContableVerificacionDocumentoVentasData obj = bestData[i];
// System.out.println("DATOS DESDE BESTDATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
//
// // System.out.println("cInvoiceId: " + obj.cInvoiceId);
// System.out.println("nDocumento: " + obj.nDocumento);
// // System.out.println("fechaFactura: " + obj.fechaFactura);
// System.out.println("numeroSerie: " + obj.numeroSerie);
// System.out.println("estado: " + obj.estado);
// System.out.println("serie: " + obj.serie);
// System.out.println("numero: " + obj.numero);
// System.out.println("rownum: " + obj.rownum);
// System.out.println("-------------------------------------");
// }
String strSubtitle = (Utility.messageBD(this, "LegalEntity", vars.getLanguage()) + ": ")
+ ReporteContableVerificacionDocumentoVentasData.selectCompany(this, vars.getClient())
+ "\n" + "RUC:" + ReporteContableVerificacionDocumentoVentasData.selectRucOrg(this, strOrg)
+ "\n";
if (!("0".equals(strOrg)))
strSubtitle += (Utility.messageBD(this, "OBUIAPP_Organization", vars.getLanguage()) + ": ")
+ ReporteContableVerificacionDocumentoVentasData.selectOrg(this, strOrg) + "\n";
// if (!"".equals(strDateFrom) || !"".equals(strDateTo))
// strSubtitle += (Utility.messageBD(this, "From", vars.getLanguage()) +
// ": ") + strDateFrom
// + " " + (Utility.messageBD(this, "OBUIAPP_To", vars.getLanguage()) +
// ": ") + strDateTo
// + "\n";
System.out.println("Llega hasta aqui");
String strOutput;
String strReportName;
if (vars.commandIn("PDF")) {
strOutput = "pdf";
strReportName = "@basedesign@/pe/com/unifiedgo/report/ad_reports/ReporteContableVerificacionDocumentoVentas.jrxml";
} else {
strOutput = "xls";
strReportName = "@basedesign@/pe/com/unifiedgo/report/ad_reports/ReporteContableVerificacionDocumentoVentasExcel.jrxml";
}
HashMap<String, Object> parameters = new HashMap<String, Object>();
// parameters.put("Subtitle", strSubtitle);
parameters
.put("Ruc", ReporteContableVerificacionDocumentoVentasData.selectRucOrg(this, strOrg));
parameters.put("organizacion",
ReporteContableVerificacionDocumentoVentasData.selectSocialName(this, strOrg));
// parameters.put("dateFrom", StringToDate(strDateFrom));
// parameters.put("dateTo", StringToDate(strDateTo));
parameters.put("dateFrom", StringToDate(strDateFrom));
parameters.put("dateTo", StringToDate(strDateTo));
renderJR(vars, response, strReportName, "Reporte_Contable_Verificacion_Documento_Ventas",
strOutput, parameters, bestData, null);
}
private String completaconzeros(int numero, int lengthmax) {
String snum = Integer.toString(numero);
int tamori = snum.length();
String result = "";
for (int i = tamori; i <= lengthmax; i++)
result += "0";
return result + snum;
}
private Date StringToDate(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
Date date;
try {
if (!strDate.equals("")) {
date = formatter.parse(strDate);
return date;
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
public String getServletInfo() {
return "Servlet ReporteContableVerificacionDocumentoVentas. This Servlet was made by Pablo Sarobe modified by everybody";
} // end of getServletInfo() method
}
| [
"WINDOWS@USER"
] | WINDOWS@USER |
30268413ebf7174de3ad2321aa095171604062a6 | e3712168b5154d456edf3512a1424b9aea290f24 | /frontend/Tagline/sources/com/onesignal/OSDynamicTriggerTimer.java | 5e03770b1ed986e7778835c176be45015d6e3d27 | [] | no_license | uandisson/Projeto-TagLine-HACK_GOV_PE | bf3c5c106191292b3692068d41bc5e6f38f07d52 | 5e130ff990faf5c8c5dab060398c34e53e0fd896 | refs/heads/master | 2023-03-12T17:36:36.792458 | 2021-02-11T18:17:51 | 2021-02-11T18:17:51 | 338,082,674 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package com.onesignal;
import java.util.Timer;
import java.util.TimerTask;
class OSDynamicTriggerTimer {
OSDynamicTriggerTimer() {
}
static void scheduleTrigger(TimerTask task, String triggerId, long delay) {
Timer timer;
StringBuilder sb;
new StringBuilder();
new Timer(sb.append("trigger_timer:").append(triggerId).toString());
timer.schedule(task, delay);
}
}
| [
"[email protected]"
] | |
2ebfd59167506d483757ee485e1c137fb0bf43d0 | 28d64a59c5d68aa6aad6f8cf8e93a5515f60baf4 | /SlayByDay/src/main/java/SlayByDay/patches/cards/RewardItemPatch.java | eebde7608eacfc728bec074785c63b3014582aee | [
"MIT"
] | permissive | gantar22/SlayByDay | b1548a69cfce10b12fbb7fe5be869ed99bffb631 | 610130a71a4c93a464077e01c971d97601ec9523 | refs/heads/master | 2020-04-20T16:44:58.298762 | 2019-05-01T19:35:41 | 2019-05-01T19:35:41 | 168,967,524 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | package SlayByDay.patches.cards;
import SlayByDay.cards.switchCards.EntrapSkillfulDodgeSwitch;
import SlayByDay.characters.TheMedium;
import com.evacipated.cardcrawl.modthespire.lib.*;
import com.evacipated.cardcrawl.modthespire.patcher.PatchingException;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.AbstractPower;
import com.megacrit.cardcrawl.powers.DexterityPower;
import com.megacrit.cardcrawl.rewards.RewardItem;
import javassist.CannotCompileException;
import javassist.CtBehavior;
import java.util.ArrayList;
@SpirePatch(clz = RewardItem.class,method = "claimReward")
public class RewardItemPatch {
public static void Prefix(RewardItem __Instance)
{
if(__Instance.type == RewardItem.RewardType.POTION && __Instance.relicLink != null)
{
__Instance.relicLink.isDone = true;
__Instance.relicLink.ignoreReward = true;
System.out.println("patched reqard with potion links");
if(__Instance.relicLink.relicLink != null)
{
__Instance.relicLink.relicLink.isDone = true;
__Instance.relicLink.relicLink.ignoreReward = true;
}
}
}
}
| [
"[email protected]"
] | |
32b3dd44c589389f02644d37daa50c8feddbfecd | dd96792d1b3387e28f66e0989607ec509688991d | /Proyecto/sistemaDistribuido/sistema/clienteServidor/modoMonitor/Emision.java | 72a028d570345f441120e160e57c04b3bc7f3457 | [] | no_license | pachecoree/TSOA | 4a923d4045aa0c227883535afe194536f62cb8f2 | af0faa0520b3c101cd9935e1ffacbaf2e16a2185 | refs/heads/master | 2016-09-05T21:00:23.661205 | 2014-12-07T23:51:40 | 2014-12-07T23:51:40 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 587 | java | /*
* Romero Pacheco Carlos Mauricio
* Prรกctica 2
*/
package sistemaDistribuido.sistema.clienteServidor.modoMonitor;
import java.util.HashMap;
public class Emision {
HashMap<Integer,ParIpId> map;
public Emision() {
map = new HashMap<Integer,ParIpId>();
}
public void addElement(int dest,ParIpId data) {
map.put(dest, data);
}
public void deleteElement(int dest) {
if (hasElement(dest)) {
map.remove(dest);
}
}
public ParIpId getElement(int dest) {
return map.get(dest);
}
public boolean hasElement(int dest) {
return map.containsKey(dest);
}
}
| [
"[email protected]"
] | |
4eb9bc45a10cd9432abf66ae5e9fb4238f6f5bac | bfac99890aad5f43f4d20f8737dd963b857814c2 | /reg4/v0/xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-client/src/main/java/org/xwiki/gwt/wysiwyg/client/plugin/macro/input/ChoiceInput.java | 28164cead551f249aaf0ecb1a077abf19b83169c | [] | no_license | STAMP-project/dbug | 3b3776b80517c47e5cac04664cc07112ea26b2a4 | 69830c00bba4d6b37ad649aa576f569df0965c72 | refs/heads/master | 2021-01-20T03:59:39.330218 | 2017-07-12T08:03:40 | 2017-07-12T08:03:40 | 89,613,961 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,440 | java | /*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.gwt.wysiwyg.client.plugin.macro.input;
import com.google.gwt.user.client.ui.Focusable;
import com.google.gwt.user.client.ui.ListBox;
/**
* A concrete input control that allows the user to choose one of the available options.
*
* @version $Id: 49d8541bc0e79a92603fe101603078d0167d4296 $
*/
public class ChoiceInput extends AbstractInput
{
/**
* Creates a new choice input control that wraps the given {@link ListBox} widget.
*
* @param list the list box widget to be wrapped
*/
public ChoiceInput(ListBox list)
{
initWidget(list);
}
@Override
public void setFocus(boolean focused)
{
((Focusable) getWidget()).setFocus(focused);
}
@Override
public String getValue()
{
ListBox list = (ListBox) getWidget();
return list.getSelectedIndex() < 0 ? null : list.getValue(list.getSelectedIndex());
}
@Override
public void setValue(String value)
{
((ListBox) getWidget()).setSelectedIndex(indexOf(value));
}
/**
* Searches for the given value in the list of options.
*
* @param value the value to search for
* @return the index of the value in the list, if found, {@code -1} otherwise
*/
protected int indexOf(String value)
{
ListBox list = (ListBox) getWidget();
for (int i = 0; i < list.getItemCount(); i++) {
if (list.getValue(i).equalsIgnoreCase(value)) {
return i;
}
}
return -1;
}
}
| [
"[email protected]"
] | |
2d9b73a003af480d3af5a5b01a90312233d24b09 | df574c3623ee607f48813d9990a605a0d314c9d0 | /service/src/main/java/com/haomostudio/JuniorSpringMVCTemplate/service/RoleMenuService.java | a0eca9ba134ce964c5f657e823cc8c0b0e6e3c73 | [] | no_license | xumengrou1022/caxs-exam | c765772231d0305a4ac861209171ef7c804873c0 | 667b43ad62edf2cc6aaa94db0d7d5ee6b54d5af8 | refs/heads/master | 2020-03-25T03:50:06.868111 | 2018-08-03T01:33:44 | 2018-08-03T01:33:44 | 143,362,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,394 | java | package com.haomostudio.JuniorSpringMVCTemplate.service;
import com.haomostudio.JuniorSpringMVCTemplate.po.RoleMenu;
import java.util.List;
public interface RoleMenuService {
int create(RoleMenu item);
int delete(String id);
int update(RoleMenu item);
RoleMenu get(String id);
/**
* ่ทๅๅ่กจ
* @param pageNo ๆดๆฐ,ๅฆ1
* @param pageSize ๆดๆฐ,ๅฆ10
* @param sortItem ๆ ผๅผไธบ"id, name"
* @param sortOrder ๆ ผๅผไธบ"asc, desc"
* @param filters JSONๅญ็ฌฆไธฒ,ๆ ผๅผไธบ
* {
* table:
* {
* column1: {
* like: '%abc%',
* notLike: ''
* between: [1, 10],
* notBetween: [1, 10]
* isNull: true, // ๅช่ฝไธบtrue
* isNotNull: true, // ๅช่ฝไธบtrue
* equalTo: "abc",
* notEqualTo: "abc",
* greaterThan: 10,
* greaterThanOrEqualTo: 10,
* lessThan: 10,
* lessThanOrEqualTo: 10,
* in: [],
* notIn: []
* }
* }
* }
* @return ๅ่กจ
*/
List<RoleMenu> getListWithPagingAndFilter(Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters);
/**
* ่ทๅๅ่กจ
* @param pageNo ๆดๆฐ,ๅฆ1
* @param pageSize ๆดๆฐ,ๅฆ10
* @param sortItem ๆ ผๅผไธบ"id, name"
* @param sortOrder ๆ ผๅผไธบ"asc, desc"
* @param filters JSONๅญ็ฌฆไธฒ, ็จๆฅ่ฟๆปคๅ่กจ็ๆฐๆฎ, ๆ ผๅผไธบ
* {
* table:
* {
* column1: {
* like: '%abc%',
* notLike: ''
* between: [1, 10],
* notBetween: [1, 10]
* isNull: true, // ๅช่ฝไธบtrue
* isNotNull: true, // ๅช่ฝไธบtrue
* equalTo: "abc",
* notEqualTo: "abc",
* greaterThan: 10,
* greaterThanOrEqualTo: 10,
* lessThan: 10,
* lessThanOrEqualTo: 10,
* in: [],
* notIn: []
* }
* }
* }
* @param includes JSONๅญ็ฌฆไธฒ, ็จๆฅๅฐๆฌ่กจ็ๅค้พๅญๆฎต(table_id็ฑปไผผ็ๅญๆฎต)ๆๅ็ๅค้พ่กจ็ๅฎๆด่กๆฐๆฎ่ฟๅ, ๆ ผๅผไธบ
* {
* 'include_table1': {
* includes: ['include_table11', 'include_table12']
* },
* 'include_table2': {
* includes: ['include_table21', 'include_table22']
* }
* }
* @param refers JSONๅญ็ฌฆไธฒ, ็จๆฅๅฐๅ
ถไป่กจ็ๅค้พๅญๆฎตไธบๆฌ่กจ็่กจๆฐๆฎ่ฟๅ, ๆ ผๅผไธบ
* {
* 'refer_table1': {
* includes: ['include_table11', 'include_table12']
* },
* 'refer_table2': {
* includes: ['include_table21', 'include_table22']
* }
* }
* @param relates JSONๅญ็ฌฆไธฒ, ็จๆฅๅฐๅ
ถไปๆ้ดๆฅๅ
ณ็ณป็่กจ(ๆ่ฐ้ดๆฅๅ
ณ็ณป, ไธๅฎๆฏ่ทๆฌ่กจ็ๆไธชๅญๆฎตๅไธ่ด, ไธๆๅๅไธๅผ ่กจ)
* {
* 'relate_table1': ['column1', 'column2'],
* 'relate_table1': ['column3', 'column4']
* }
* @return ๅ่กจ
*/
Object getListWithPagingAndFilter(Integer pageNo, Integer pageSize,
String sortItem, String sortOrder,
String filters,
String includes,
String refers,
String relates);
/**
* ่ทๅๅ่กจๆฐ้
* @param filters JSONๅญ็ฌฆไธฒ, ็จๆฅ่ฟๆปคๅ่กจ็ๆฐๆฎ, ๆ ผๅผไธบ
* {
* table:
* {
* column1: {
* like: '%abc%',
* notLike: ''
* between: [1, 10],
* notBetween: [1, 10]
* isNull: true, // ๅช่ฝไธบtrue
* isNotNull: true, // ๅช่ฝไธบtrue
* equalTo: "abc",
* notEqualTo: "abc",
* greaterThan: 10,
* greaterThanOrEqualTo: 10,
* lessThan: 10,
* lessThanOrEqualTo: 10,
* in: [],
* notIn: []
* }
* }
* }
* @return ๅ่กจ่ฎกๆฐ
*/
Long countListWithPagingAndFilter(String filters);
}
| [
"[email protected]"
] | |
7d1555939fec23d05b60c910ab1143b4596892fd | 4aa90348abcb2119011728dc067afd501f275374 | /app/src/main/java/com/tencent/mm/plugin/clean/ui/newui/b$b.java | a9dfd62b8524d8e72ed254a8d01dea7f0495e322 | [] | no_license | jambestwick/HackWechat | 0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6 | 6a34899c8bfd50d19e5a5ec36a58218598172a6b | refs/heads/master | 2022-01-27T12:48:43.446804 | 2021-12-29T10:36:30 | 2021-12-29T10:36:30 | 249,366,791 | 0 | 0 | null | 2020-03-23T07:48:32 | 2020-03-23T07:48:32 | null | UTF-8 | Java | false | false | 410 | java | package com.tencent.mm.plugin.clean.ui.newui;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import com.tencent.mm.ui.MMImageView;
class b$b {
CheckBox iis;
MMImageView lgv;
ImageView lgw;
View lgx;
View lgy;
TextView lgz;
final /* synthetic */ b lhJ;
b$b(b bVar) {
this.lhJ = bVar;
}
}
| [
"[email protected]"
] | |
f62580f4dad0a22e37f110fbf3e097cbf2d803ed | 69c842ea614fbfbfa592c15e6e8619cd2b38966b | /src/main/java/com/epam/zt/testing/action/ShowPageAction.java | 6e900bb784b2d5bc04a6c82d44d8684fad99e8e7 | [] | no_license | Eygen/Testing | 1ae85db24ca12be4a279d4d3daae3c5d6b143c83 | e26a59a7f6ac10b3ae19b08508681aeb497c747f | refs/heads/master | 2021-01-23T14:04:24.456235 | 2015-06-15T03:05:36 | 2015-06-15T03:05:36 | 33,322,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 436 | java | package com.epam.zt.testing.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ShowPageAction implements Action {
private ActionResult result;
public ShowPageAction(String page) {
this.result = new ActionResult(page);
}
@Override
public ActionResult execute(HttpServletRequest req, HttpServletResponse resp) {
return result;
}
}
| [
"[email protected]"
] | |
ea4e305a235846d4acf8e5e894ad1dc03ef16df5 | c82adea5f5c3a23b9026bc4b99fd569661940f82 | /src/main/java/imglib/ops/operator/unary/AndConstant.java | 31b0328d52baf08a65950c6743bda8342e160a0b | [] | no_license | fiji/legacy-imglib1 | 446167f58090ab24bcab908de8d10c6496870472 | 8fc254522692a958baaa43a1b3a97131b73db392 | refs/heads/master | 2023-08-18T02:48:38.375419 | 2022-09-22T22:54:14 | 2022-09-22T22:54:14 | 16,148,483 | 2 | 1 | null | 2017-05-23T19:10:14 | 2014-01-22T18:39:29 | Java | UTF-8 | Java | false | false | 2,380 | java | /*
* #%L
* ImgLib: a general-purpose, multidimensional image processing library.
* %%
* Copyright (C) 2009 - 2013 Stephan Preibisch, Tobias Pietzsch, Barry DeZonia,
* Stephan Saalfeld, Albert Cardona, Curtis Rueden, Christian Dietz, Jean-Yves
* Tinevez, Johannes Schindelin, Lee Kamentsky, Larry Lindsey, Grant Harris,
* Mark Hiner, Aivar Grislis, Martin Horn, Nick Perry, Michael Zinsmaier,
* Steffen Jaensch, Jan Funke, Mark Longair, and Dimiter Prodanov.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of any organization.
* #L%
*/
package imglib.ops.operator.unary;
import imglib.ops.operator.UnaryOperator;
/**
* TODO
*
*/
public final class AndConstant implements UnaryOperator
{
private final long constant;
public AndConstant(final long constant)
{
this.constant = constant;
}
@Override
public double computeValue(final double input)
{
return ((long)input) & constant;
}
}
| [
"[email protected]"
] | |
dcb23a558facad0fcf3c1266f31afb1ee6d56e5a | a84ad148d0439e654dd540032cf3ba90a3e4d348 | /eclipse_java_workspace/J_SpringMain/src/spring_jasypt/JasyptSpringJunit.java | 5670d2fb098838d3e3c061bf1ae01b35cc26fb22 | [] | no_license | zhao1jin4/eclipse_java_workspace | 4b9b9f56bac0632c0d10c6f8e98160a2df48d87a | 919868eeb0ca86ebb47307aee3ef2f9c92d70b44 | refs/heads/master | 2022-12-20T09:04:47.693610 | 2021-01-30T02:31:45 | 2021-01-30T02:31:45 | 93,358,023 | 1 | 0 | null | 2022-12-16T15:31:56 | 2017-06-05T02:42:55 | Java | GB18030 | Java | false | false | 1,358 | java | package spring_jasypt;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(classes = {AppConfig.class, TestConfig.class})
@ContextConfiguration("classpath:spring_jasypt/jasypt_spring.xml")
public class JasyptSpringJunit
{
@Autowired
private GenericApplicationContext ctx; //ๆฏGenericApplicationContext
@Value("${redis.password}")
private String redisPass;//ๅฐฑ่งฃๅฏ็thePass
@Value("#{configProperties.redis_password}") //่ชๅทฑ็keyไธ่ฝๆ็น
private String redisPass2;
@BeforeClass
public static void init()//ๅฟ
้กปๆฏstatic
{
System.out.println("@BeforeClass");
}
@AfterClass
public static void destory()
{
System.out.println("@AfterClass");
}
@Test
public void testProperties() {
System.out.println("redisPass="+redisPass);//ๅฐฑ่งฃๅฏ็thePass
System.out.println("redisPass2="+redisPass2);
}
}
| [
"[email protected]"
] | |
65643ae9877d69a12a5237e7c82340d15ac35290 | e9ea927f0af796c78073ccef0389ce5f03c83718 | /src/cintral/wordcl.java | f6e5c08fccd71d18db1296a20543c82d11d407bd | [] | no_license | wangbo3/2222 | 2d11b25d12c5a1f1656713e662bf7de749127d7f | f3ce4e9fe6cb3e5279d0a37e9d92ee3e6f27935d | refs/heads/master | 2021-01-16T23:23:19.036343 | 2015-03-22T10:27:53 | 2015-03-22T10:27:53 | 32,670,934 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 1,317 | java | package cintral;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import service.wordservice;
import tool.word;
public class wordcl extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String name = request.getParameter("name");
String age = request.getParameter("age");
boolean sex =request.getParameter("sex")=="1"?true:false;
String word =request.getParameter("word");
word word1 = new word();
word1.setName(name);
// System.out.print(name);
word1.setAge(age);
word1.setSex(sex);
word1.setWord(word);
if(service.wordservice.addword(word1)){
request.setAttribute("info","รรญยผรยณรยนยฆ");
request.getRequestDispatcher("/ok.jsp").forward(request, response);
}else {
request.getRequestDispatcher("/err.jsp").forward(request, response);
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
| [
"[email protected]"
] | |
fafeeb07ff4077f2cebb699175ce6fe91cd618d4 | 19bf2c3900a36e990590b26c8dab4a56e212fca1 | /offline-cloud-common/src/main/java/com/turingmaker/common/config/Constant.java | 36781381519df88f3498d0077096e528b522deca | [] | no_license | BruceTseng315/offline-cloud | 2e0aaddc389e19275837d140750df4dda627fea1 | f8da0fab877fa52fbc9cfb067dc8beb3226d83d6 | refs/heads/master | 2020-03-22T17:27:00.539484 | 2018-07-10T07:54:43 | 2018-07-10T07:54:43 | 140,396,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package com.turingmaker.common.config;
public class Constant {
/**
* ๅญๅจsession้็่ดฆๅทๅๅญ็key
*/
public static final String SESSION_USER_KEY = "user";
public static final String DEFAULT_STUDENT_PASSWORD = "123456";
}
| [
"[email protected]"
] | |
2d97a7c317c450bed8843e3e49573ed55b89a64e | c9797d80d55a566fa130ddfb83171d109a38bbbe | /client/src/main/java/com/gitub/thorbenkuck/tears/client/network/Client.java | 631c5984de68f390fd27f7b0d7c015394dc39e2a | [] | no_license | ThorbenKuck/RemotePNP | 04cc555ef77ded782b08967860ad5a53419d7290 | 03fe41456856028be1ac29b916a1e71f19ba36a3 | refs/heads/master | 2021-06-14T12:33:12.779411 | 2019-07-31T15:54:46 | 2019-07-31T15:54:56 | 173,450,701 | 0 | 0 | null | 2021-03-31T21:10:46 | 2019-03-02T13:23:21 | HTML | UTF-8 | Java | false | false | 918 | java | package com.gitub.thorbenkuck.tears.client.network;
import com.github.thorbenkuck.tears.shared.exceptions.ConnectionEstablishmentFailedException;
import com.github.thorbenkuck.tears.shared.network.Connection;
import com.github.thorbenkuck.tears.shared.pipeline.Pipeline;
import com.gitub.thorbenkuck.tears.client.Repository;
import com.google.common.eventbus.EventBus;
import java.io.Serializable;
public interface Client {
static Client create(String address, int port, Repository repository) {
Client client = new ClientImpl(address, port);
ClientSetup.setup(client, repository);
return client;
}
Pipeline<Connection> disconnectedPipeline();
void launch() throws ConnectionEstablishmentFailedException;
void send(Serializable serializable);
void registerTo(EventBus eventBus);
<T> void handleSpecific(Class<T> type, MessageHandler<T> messageHandler);
String getAddress();
void close();
}
| [
"[email protected]"
] | |
9fa70c27046bf43a1726fdd28f99681ccfcad1bd | ac92e753181230af3a6f4fa7f522389063d2ba71 | /Cucumber-task1/src/test/java/loginDemo/task3/GoogleKittens.java | 8202e20efb0b2d997d361de9445d42353794fbed | [] | no_license | BenediktasNoreika/SeleniumCucumber | a986fdc0862a488ec6cc5fe1b8c23aeea98689b4 | 50e6f1aed73c5f76484e9e2b7f9f13882e368bfd | refs/heads/main | 2023-02-11T16:57:19.265224 | 2021-01-07T12:51:39 | 2021-01-07T12:51:39 | 327,610,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,444 | java | package loginDemo.task3;
import static org.junit.Assert.assertEquals;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class GoogleKittens {
private static WebDriver driver;
private static String URL = "http://thedemosite.co.uk";
@Before
public static void init() {
System.setProperty("webdriver.chrome.driver",
"src/test/resources/chromedriver.exe");
ChromeOptions cOptions = new ChromeOptions();
cOptions.setHeadless(false);
driver = new ChromeDriver(cOptions);
driver.manage().window().maximize();
}
@After
public void cleanUp() {
driver.quit();
}
@Given("^I can open the demo site$")
public void i_can_open_theDemoSite() {
driver.get(URL);
assertEquals("FREE example PHP code "
+ "and a MySQL database. The example is a username "
+ "and password protected site example", driver.getTitle());
}
@When("^I add a new user to the site$")
public void i_navigate_to_addUser() throws InterruptedException {
Page page = PageFactory.initElements(driver, Page.class);;
page.createUser("guest", "password");
}
@Then("^The site will show my new user created$")
public void new_created_user() throws InterruptedException {
String result = driver.findElement(By.xpath("//*[contains(text(), 'guest')]")).getText();
assertEquals("guest",result);
}
@When("^I navigate to the login page$")
public void i_nav_to_login() throws Throwable {
Page page = PageFactory.initElements(driver, Page.class);;
page.loginPage();
}
@Then("^I can log in as the created user$")
public void google_will_return_a_puppies_search() throws Throwable {
Page page = PageFactory.initElements(driver, Page.class);;
page.login("guest", "password");
String result = driver.findElement(By.xpath("//*[contains(text(), '**Succesfull login**')]")).getText();
assertEquals("**Succesfull login**", result);
}
} | [
"[email protected]"
] | |
3c35cdcb0575adaba1069418f20f813bd338c606 | 8192062734f3620b6c3fbf417db03e0834b6a75e | /SumWithUs.java | 83b8fe675243479256fb2556a2e2c3a0078279e3 | [] | no_license | JieHuiLee/Assignment3 | ea73d84e7d9964afa24bcadb382d9e468f72b3d3 | 855f69ddbb09ea75b0a00b1f91bf95e22445db08 | refs/heads/main | 2023-06-16T14:24:54.290863 | 2021-06-29T05:33:48 | 2021-06-29T05:33:48 | 380,477,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,617 | java | package Assignment3_NGO;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Image;
import java.awt.SystemColor;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileReader;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JButton;
public class SumWithUs extends JFrame {
private JPanel contentPane;
private JTextPane txtpnAbout;
/**
* Launch the application.
*/
public static void TextFromFile(JTextPane txtpnHowToJoinLuckyDraw) { //Read and import from AboutUs txtFile
try {
String path = "D:\\LeeJieHui279096\\STIA1123_Programming_A202(I)\\Assignment3\\GUI_NGO Racial Injusctice\\TextFileAss3\\Admin_UpdateDescription\\AboutUs.txt";
File file = new File(path);
FileReader fr = new FileReader(file);
while(fr.read() != -1) {
txtpnHowToJoinLuckyDraw.read(fr, null);
}
fr.close();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SumWithUs frame = new SumWithUs();//create new object
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public static String path;
public SumWithUs() { //constructor with no argument
JTextPane txtpnAbout= new JTextPane();
txtpnAbout.setEditable(false);
TextFromFile(txtpnAbout);
Font font = new Font("Monotype Corsiva",Font.PLAIN,24);
txtpnAbout.setFont(font);
txtpnAbout.setForeground(Color.black);
setTitle("Sum With Us");
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/Icon/SumWithUsicon.png")));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 1029, 664);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panelMainMenu = new JPanel();
panelMainMenu.setBackground(new Color(109,104,117)); //Old Lavender: 6D6875
panelMainMenu.setBounds(0, 0, 181, 627);
contentPane.add(panelMainMenu);
panelMainMenu.setLayout(null);
JLabel lblLogo = new JLabel();//initialization of JLabel
lblLogo.setBounds(37, 10, 105, 95);
path = "/Icon/SumWithUsiconFull.png"; //path to the image
ImageIcon MyImg = new ImageIcon(getClass().getResource(path)); //set the path to the MyImage
Image i = MyImg.getImage(); //converting ImageIcon into Image
Image newImage = i.getScaledInstance(lblLogo.getWidth(), lblLogo.getHeight(), Image.SCALE_SMOOTH); //then scaling of this image
ImageIcon Img = new ImageIcon(newImage); //finally set the image to the JLabel.
panelMainMenu.add(lblLogo);
lblLogo.setIcon(Img);
JPanel panel1 = new JPanel();
panel1.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
setColor(panel1);
panel1.setOpaque(true);
Login login = new Login(); //obj created for class Login()
login.setVisible(true); // Open the Login.java window
dispose(); // Close the SumWithUs.java window
}
});
panel1.setBackground(new Color(109,104,117)); //Old Lavender: 6D6875
panel1.setBounds(11, 103, 171, 51);
panelMainMenu.add(panel1);
panel1.setLayout(null);
JLabel lblHome = new JLabel("Home");
lblHome.setForeground(Color.BLACK);
lblHome.setHorizontalAlignment(SwingConstants.CENTER);
lblHome.setFont(new Font("Segoe UI", Font.PLAIN, 18));
lblHome.setBounds(29, 10, 108, 31);
panel1.add(lblHome);
JPanel panelHighlight1 = new JPanel();
panelHighlight1.setBounds(0, 103, 10, 52);
panelHighlight1.setOpaque(false);
panelMainMenu.add(panelHighlight1);
JPanel panelHighlight2 = new JPanel();
panelHighlight2.setBounds(0, 154, 10, 52);
panelMainMenu.add(panelHighlight2);
JPanel panel2 = new JPanel();
panel2.setLayout(null);
panel2.setBackground(new Color(109, 104, 117));
panel2.setBounds(11, 154, 171, 51);
panelMainMenu.add(panel2);
JLabel lblOrganization = new JLabel("Organization");
lblOrganization.setHorizontalAlignment(SwingConstants.CENTER);
lblOrganization.setForeground(Color.BLACK);
lblOrganization.setFont(new Font("Segoe UI", Font.PLAIN, 18));
lblOrganization.setBounds(29, 10, 115, 31);
panel2.add(lblOrganization);
JPanel panelHighlight3 = new JPanel();
panelHighlight3.setBounds(0, 203, 10, 52);
panelHighlight3.setOpaque(false);
panelMainMenu.add(panelHighlight3);
JPanel panel3 = new JPanel();
panel3.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent arg0) {
setColor(panel3);
panel3.setOpaque(true);
Event e = new Event();//obj created for class Event()
e.setVisible(true); // Open the Event.java window
dispose(); // Close the SumWithUs.java window
}
});
panel3.setLayout(null);
panel3.setBackground(new Color(109, 104, 117));
panel3.setBounds(11, 203, 171, 51);
panelMainMenu.add(panel3);
JLabel lblEvent = new JLabel("Event");
lblEvent.setHorizontalAlignment(SwingConstants.CENTER);
lblEvent.setForeground(Color.BLACK);
lblEvent.setFont(new Font("Segoe UI", Font.PLAIN, 18));
lblEvent.setBounds(29, 10, 115, 31);
panel3.add(lblEvent);
JPanel panelHighlight4 = new JPanel();
panelHighlight4.setBounds(0, 253, 10, 52);
panelHighlight4.setOpaque(false);
panelMainMenu.add(panelHighlight4);
JPanel panel4 = new JPanel();
panel4.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
setColor(panel4);
panel4.setOpaque(true);
Participant p = new Participant(); //obj created for class Participant()
p.setVisible(true); // Open the Participant.java window
dispose(); // Close the SumWithUs.java window
}
});
panel4.setLayout(null);
panel4.setBackground(new Color(109, 104, 117));
panel4.setBounds(11, 253, 171, 51);
panelMainMenu.add(panel4);
JLabel lblRegistration = new JLabel("Registration");
lblRegistration.setHorizontalAlignment(SwingConstants.CENTER);
lblRegistration.setForeground(Color.BLACK);
lblRegistration.setFont(new Font("Segoe UI", Font.PLAIN, 18));
lblRegistration.setBounds(29, 10, 115, 31);
panel4.add(lblRegistration);
JPanel panelSumWithUs = new JPanel();
panelSumWithUs.setBackground(new Color(181,131,141)); //English Lavender: B5838D
panelSumWithUs.setBounds(180, 0, 392, 627);
contentPane.add(panelSumWithUs);
panelSumWithUs.setLayout(null);
JLabel lblSumWithUs = new JLabel("Sum With Us");
lblSumWithUs.setForeground(new Color(255,180,162)); //Melon: FFB4A2
lblSumWithUs.setHorizontalAlignment(SwingConstants.CENTER);
lblSumWithUs.setFont(new Font("Algerian", Font.BOLD, 55));
lblSumWithUs.setBounds(24, 36, 347, 85);
panelSumWithUs.add(lblSumWithUs);
JLabel lblNewLabel = new JLabel("NGO Organization");
lblNewLabel.setForeground(new Color(255,180,162)); //Melon: FFB4A2
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setFont(new Font("Times New Roman", Font.BOLD, 22));
lblNewLabel.setBounds(78, 97, 238, 48);
panelSumWithUs.add(lblNewLabel);
JLabel NGOprofile = new JLabel(); //initialization of JLabel
NGOprofile.setBounds(36, 164, 320, 414);
panelSumWithUs.add(NGOprofile);
path = "/WITHOUT US, WITHOUT COUNTRY/SumWithUs.jpg"; //path to the image
ImageIcon MyImage = new ImageIcon(getClass().getResource(path)); //set the path to the MyImage
Image img = MyImage.getImage(); //converting ImageIcon into Image
Image newImg = img.getScaledInstance(NGOprofile.getWidth(), NGOprofile.getHeight(), Image.SCALE_SMOOTH); //then scaling of this image
ImageIcon image = new ImageIcon(newImg); //finally set the image to the JLabel.
panelSumWithUs.add(NGOprofile);
NGOprofile.setIcon(image);
JPanel panelRight = new JPanel();
panelRight.setBackground(new Color(255,180,162)); //Melon: FFB4A2
panelRight.setBounds(572, 0, 443, 627);
contentPane.add(panelRight);
panelRight.setLayout(null);
JLabel lblWelcome = new JLabel("Welcome to Our NGO Organization");
lblWelcome.setHorizontalAlignment(SwingConstants.CENTER);
lblWelcome.setFont(new Font("Sitka Banner", Font.PLAIN, 26));
lblWelcome.setBounds(40, 67, 376, 66);
panelRight.add(lblWelcome);
JScrollPane scrollPane = new JScrollPane(txtpnAbout);
scrollPane.setBounds(40, 156, 376, 341);
panelRight.add(scrollPane, BorderLayout.CENTER);
panelRight.add(scrollPane);
JButton btnViewEvent = new JButton("Click Here to View More Recent Event");
btnViewEvent.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Event e = new Event(); //obj created for class Event()
e.setVisible(true); // Open the Event.java window
dispose();// Close the SumWithUs.java window
}
});
btnViewEvent.setBackground(SystemColor.controlHighlight);
btnViewEvent.setForeground(new Color(204, 102, 153));
btnViewEvent.setFont(new Font("Times New Roman", Font.BOLD, 20));
btnViewEvent.setBounds(40, 532, 376, 49);
panelRight.add(btnViewEvent);
}
private void setColor(JPanel pane) {
pane.setBackground(new Color(181,131,141)); //English Lavender: B5838D
}
}
| [
"[email protected]"
] | |
8971f0bf56d4f058df55400d891d76febc79541b | d06066dbc1f7b01e7ccc4d6f706f95c5aaf4f51e | /curso_java_orientaรงรฃo_objetos_fundamentos/src/ClassificaProduto.java | 6033d0d041fdcc4a3cad7cea4a55cf218a4adc76 | [] | no_license | RafaelAmaralPaula/primeiros_teste | bdcfbe20db3928a18be70dd9b46e8ed728f72907 | 211d4b2ac5d31951f024867e10af83ed6efee0ef | refs/heads/master | 2021-05-08T13:31:49.230519 | 2018-02-19T19:41:50 | 2018-02-19T19:41:50 | 120,018,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 676 | java |
import java.util.Scanner;
public class ClassificaProduto {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int codigoProduto = 0;
do {
System.out.print("Digite o codigo do produto: ");
codigoProduto = entrada.nextInt();
if (codigoProduto != 0) {
String corredor = (codigoProduto % 2 == 0) ? "\"direita\"" : "\"esquerda\"";
for (int i = 8; i >= 1; i--) {
if (codigoProduto % i == 0) {
System.out.println("O produto de codigo: " + codigoProduto +
" ficara no corredor da " + corredor + " e na gaveta " + i);
break;
}
}
}
} while (codigoProduto != 0);
}
} | [
"rafael@localhost"
] | rafael@localhost |
872bff9c41916771f895b63667395afdcdc74cf7 | 570c78cc94eb0af3546dd2d77ee7aee859b8d168 | /sort/QuickSort.java | 990fc0a7507e37a2e41aa02f0d92d348ba9fb60f | [] | no_license | Mathilda11/Algorithms | e0e5d5708dffcb396adff28c3ac4a34a89b3f624 | 5074c20ef038fedb1f7c19ce6fda599f06f1b439 | refs/heads/master | 2020-04-03T02:39:11.866412 | 2019-07-03T13:46:50 | 2019-07-03T13:46:50 | 154,962,184 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,689 | java | package sort;
import java.util.Arrays;
/**
* ๅฟซ้ๆๅบ
* ๆ่ทฏ๏ผ
* ้ๆฉไธไธชๅ
ณ้ฎๅผไฝไธบๅบๅๅผใๆฏๅบๅๅผๅฐ็้ฝๅจๅทฆ่พนๅบๅ๏ผไธ่ฌๆฏๆ ๅบ็๏ผ๏ผๆฏๅบๅๅผๅคง็้ฝๅจๅณ่พน๏ผไธ่ฌๆฏๆ ๅบ็๏ผใไธ่ฌ้ๆฉๅบๅ็็ฌฌไธไธชๅ
็ด ใ
* ไธๆฌกๅพช็ฏ๏ผไปๅๅพๅๆฏ่พ๏ผ็จๅบๅๅผๅๆๅไธไธชๅผๆฏ่พ๏ผๅฆๆๆฏๅบๅๅผๅฐ็ไบคๆขไฝ็ฝฎ๏ผๅฆๆๆฒกๆ็ปง็ปญๆฏ่พไธไธไธช๏ผ็ดๅฐๆพๅฐ็ฌฌไธไธชๆฏๅบๅๅผๅฐ็ๅผๆไบคๆขใ
* ๆพๅฐ่ฟไธชๅผไนๅ๏ผๅไปๅๅพๅๅผๅงๆฏ่พ๏ผๅฆๆๆๆฏๅบๅๅผๅคง็๏ผไบคๆขไฝ็ฝฎ๏ผๅฆๆๆฒกๆ็ปง็ปญๆฏ่พไธไธไธช๏ผ็ดๅฐๆพๅฐ็ฌฌไธไธชๆฏๅบๅๅผๅคง็ๅผๆไบคๆขใ
* ็ดๅฐไปๅๅพๅ็ๆฏ่พ็ดขๅผ>ไปๅๅพๅๆฏ่พ็็ดขๅผ๏ผ็ปๆ็ฌฌไธๆฌกๅพช็ฏ๏ผๆญคๆถ๏ผๅฏนไบๅบๅๅผๆฅ่ฏด๏ผๅทฆๅณไธค่พนๅฐฑๆฏๆๅบ็ไบใ
* ๆฅ็ๅๅซๆฏ่พๅทฆๅณไธค่พน็ๅบๅ๏ผ้ๅคไธ่ฟฐ็ๅพช็ฏใ
*
* http://blog.51cto.com/13733462/2113397
* @author 54060
*
*/
public class QuickSort {
public static void quickSort(int [] arr,int left,int right) {
int pivot=0;
if(left<right) {
pivot=partition(arr,left,right);
quickSort(arr,left,pivot-1); //ๅทฆๅญๆฐ็ปๆๅบ
quickSort(arr,pivot+1,right); //ๅณๅญๆฐ็ปๆๅบ
}
}
private static int partition(int[] arr,int left,int right) {
int key=arr[left];
while(left<right) {
//ๅฆๆarr[right]>keyๅๆไปฌๅช้่ฆๅฐright--๏ผright--ไนๅ๏ผๅๆฟarr[right]ไธkey่ฟ่กๆฏ่พ๏ผ
//็ดๅฐarr[right]<keyไบคๆขๅ
็ด ไธบๆญขใ
while(left<right && arr[right]>=key) {
right--;
}
arr[left]=arr[right]; //ๅฆๆarr[right]<key๏ผๅarr[left]=arr[right]ๅฐ่ฟไธชๆฏkeyๅฐ็ๆฐๆพๅฐๅทฆ่พนๅป.
//ๅฆๆๅณ่พนๅญๅจarr[right]<key็ๆ
ๅต๏ผๅฐarr[left]=arr[right]ใ
//ๆฅไธๆฅ๏ผๅฐ่ฝฌๅleft็ซฏ๏ผๆฟarr[left ]ไธkey่ฟ่กๆฏ่พ๏ผ
//ๅฆๆarr[left]>key,ๅๅฐarr[right]=arr[left]๏ผๅฆๆarr[left]<key๏ผๅๅช้่ฆๅฐleft++,
//็ถๅๅ่ฟ่กarr[left]ไธkey็ๆฏ่พใ
while(left<right && arr[left]<=key) {
left++;
}
arr[right]=arr[left];
}
arr[left]=key;
return left;
}
public static void main(String[] args) {
int arr[]= {65,58,95,10,57,62,13,106,78,23,85};
System.out.println("ๆๅบๅ๏ผ"+Arrays.toString(arr));
quickSort(arr,0,arr.length-1);
System.out.println("ๆๅบๅ๏ผ"+Arrays.toString(arr));
}
}
| [
"[email protected]"
] | |
1e3ad0da7fbd8ee3585136079951d4315f355d5a | d4f535b67d58b00b9a6e5485239b58973ee590be | /src/lesson2_homework/TASK12.java | 2e72b0e0302edca7077df3f3767b0ae381cbfdf3 | [] | no_license | AlexeyBaranau/javabasic | 22936c8dd64d7f151f6891dcef63499caab3c9de | 46fb90b5129ad202db9ad3366e2259647f56b258 | refs/heads/master | 2022-11-20T22:08:15.050581 | 2020-07-20T11:09:30 | 2020-07-20T11:09:30 | 266,318,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | /*Task 12. Write a Java program to find the duplicate values of an array of integer values.*/
package lesson2_homework;
import static lesson2_homework.Homework2Util.*;
public class TASK12 {
public static void main(String[] args) {
int [] arr = {15, 68, 44, 3, 15, 94, 35};
System.out.println("ะะฐััะธะฒ ัะธัะตะป: ");
printArray(arr);
bubbleSort(arr);
findRepeatingIntElements(arr);
}
} | [
"[email protected]"
] | |
76c1a4c6217ccb3c36b6e96177a86f2a37a42ad0 | 1b9bdd4b7ff874832fda6d480d96b03b8b2e0d46 | /src/test/java/com/itheima/mapper/UserMapperTest.java | 70c4c8020dd60da49a260225099f7e828e1304f1 | [] | no_license | gaoyuan113/test01 | 78b7b411f5cd299a236b44acbbe665b64892d57c | 1996d9b1bebb6874ff9704bd4c05cd1bb577aa22 | refs/heads/master | 2022-12-23T00:27:39.406888 | 2019-06-03T15:09:02 | 2019-06-03T15:09:09 | 190,022,794 | 0 | 0 | null | 2022-12-16T06:56:51 | 2019-06-03T14:34:10 | JavaScript | UTF-8 | Java | false | false | 677 | java | package com.itheima.mapper;
import com.itheima.pojo.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.util.List;
import static org.junit.Assert.*;
public class UserMapperTest {
@Test
public void findTotal() {
// ApplicationContext applicationContext=new ClassPathXmlApplicationContext("spring/applicationContext-dao.xml");
// UserMapper userMapper= (UserMapper) applicationContext.getBean("userMapper");
// long list=userMapper.findTotal();
// System.out.println(list);
System.out.println("111111");
}
} | [
"[email protected]"
] | |
c8e8dbdd39149aac9f2d545c41022178c137f07e | 882efc980191ec1b9552e406223fe876c1192922 | /src/main/java/whu/kitchen/Vo/MainRecipeVo.java | 6bd02f3476d76ebf26d776d4c3725aaf56194dc1 | [] | no_license | Pope-Liu/kitchen | e6f93dcfdf7d2c3c00d6f7512c04f2047456ae29 | 7a2fe2b80f8ffe1c4ab9747d6ce072b1d7447fdb | refs/heads/master | 2022-07-07T03:58:00.753408 | 2020-05-13T03:37:20 | 2020-05-13T03:37:20 | 243,180,049 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,228 | java | //Author:ๅ่ก
package whu.kitchen.Vo;
public class MainRecipeVo {
private int Id;
private String name;
private String cover;
private int collectionNumber;
private int browseNumber;
public MainRecipeVo(int Id, String name, String cover, int collectionNumber, int browseNumber) {
this.Id = Id;
this.name = name;
this.cover = cover;
this.collectionNumber = collectionNumber;
this.browseNumber = browseNumber;
}
public int getId() {
return Id;
}
public void setId(int Id) {
this.Id = Id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
public int getCollectionNumber() {
return collectionNumber;
}
public void setCollectionNumber(int collectionNumber) {
this.collectionNumber = collectionNumber;
}
public int getBrowseNumber() {
return browseNumber;
}
public void setBrowseNumber(int browseNumber) {
this.browseNumber = browseNumber;
}
}
| [
"[email protected]"
] | |
c9c12a3136cd15fc62f9894b8ebce3f4efc91ef7 | e4937236e569139cb767192a1e047631e31dc42f | /Login/Login/src/java/com/UserServLet.java | b3c88c19ab6cb5cc3f1b6e5d125511cbbfcbde4b | [] | no_license | MonikaCat/Alphacab-Taxi-Booking-System | ba55b2eab874bd73d15019b6e6f1480616312227 | b9e2a279b6c816a05ba392362b83c944acbf014d | refs/heads/master | 2020-04-07T09:43:28.435043 | 2019-11-21T11:02:23 | 2019-11-21T11:02:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,430 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com;
import java.io.IOException;
//import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import model.Jdbc;
/**
*
* @author me-aydin
*/
public class UserServLet 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 {
String qry = "select * from Taxi.Customer";
String qry_drivers = "select * from Taxi.Drivers";
String qry_bookings = "select * from Taxi.Journey";
HttpSession session = request.getSession();
response.setContentType("text/html;charset=UTF-8");
Jdbc dbBean = new Jdbc();
dbBean.connect((Connection)request.getServletContext().getAttribute("connection"));
session.setAttribute("dbbean", dbBean);
if((Connection)request.getServletContext().getAttribute("connection")==null)
request.getRequestDispatcher("/WEB-INF/conErr.jsp").forward(request, response);
if (request.getAttribute("login") != null){
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
}
else if (request.getParameter("tbl").equals("List")){
String msg="No users";
try {
msg = dbBean.retrieve(qry);
} catch (SQLException ex) {
Logger.getLogger(UserServLet.class.getName()).log(Level.SEVERE, null, ex);
}
request.setAttribute("query", msg);
request.getRequestDispatcher("/WEB-INF/results.jsp").forward(request, response);
}
else if (request.getParameter("tbl").equals("ListDrivers")){
String msg="No users";
try {
msg = dbBean.retrieve(qry_drivers);
} catch (SQLException ex) {
Logger.getLogger(UserServLet.class.getName()).log(Level.SEVERE, null, ex);
}
request.setAttribute("query", msg);
request.getRequestDispatcher("/WEB-INF/results.jsp").forward(request, response);
}
else if (request.getParameter("tbl").equals("ListBookings")){
String msg="No users";
try {
msg = dbBean.retrieve(qry_bookings);
} catch (SQLException ex) {
Logger.getLogger(UserServLet.class.getName()).log(Level.SEVERE, null, ex);
}
request.setAttribute("query", msg);
request.getRequestDispatcher("/WEB-INF/results.jsp").forward(request, response);
}
else if(request.getParameter("tbl").equals("NewUser")){
String name = "user";
String action = "add";
List<String> strg = new ArrayList<String>();
strg.add(name);
strg.add(action);
request.setAttribute("msg", strg);
request.getRequestDispatcher("/WEB-INF/user.jsp").forward(request, response);
}
else if(request.getParameter("tbl").equals("NewDriver")){
String name = "driver";
String action = "add";
List<String> strg = new ArrayList<String>();
strg.add(name);
strg.add(action);
request.setAttribute("msg", strg);
request.getRequestDispatcher("/WEB-INF/user.jsp").forward(request, response);
}
else if(request.getParameter("tbl").equals("Update")){
request.getRequestDispatcher("/WEB-INF/passwdChange.jsp").forward(request, response);
}
else if(request.getParameter("tbl").equals("Book")){
request.getRequestDispatcher("/WEB-INF/booking.jsp").forward(request, response);
}
else if(request.getParameter("tbl").equals("Admin")){
request.getRequestDispatcher("/WEB-INF/adminhome.jsp").forward(request, response);
}
else if(request.getParameter("tbl").equals("Driver")){
request.getRequestDispatcher("/WEB-INF/driverhome.jsp").forward(request, response);
}
else if(request.getParameter("tbl").equals("User")){
request.getRequestDispatcher("/WEB-INF/userhome.jsp").forward(request, response);
}
else if(request.getParameter("tbl").equals("DeleteUser")){
String name = "user";
String action = "del";
List<String> strg = new ArrayList<String>();
strg.add(name);
strg.add(action);
request.setAttribute("msg", strg);
request.getRequestDispatcher("/WEB-INF/user.jsp").forward(request, response);
}
else if(request.getParameter("tbl").equals("DeleteDriver")){
String name = "driver";
String action = "del";
List<String> strg = new ArrayList<String>();
strg.add(name);
strg.add(action);
request.setAttribute("msg", strg);
request.getRequestDispatcher("/WEB-INF/user.jsp").forward(request, response);
}
else {
request.setAttribute("msg", "del");
request.getRequestDispatcher("/WEB-INF/user.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>
}
| [
"[email protected]"
] | |
eb1ac61c949ab9c1931485db5676e85a35a53c41 | 1c9e2067e3ed728d1502f87a156d31605a258c10 | /src/main/java/apiService/homeApiService.java | 123b3f8d0698c02a2139195aa1c8d4191fefe865 | [
"Apache-2.0"
] | permissive | tharaka27/EmbeddedBank | 06dee2dfddc177dc58f6fd0255746f12f74382eb | dfdfce3a5455ca2a80776a86ec23ab215e7b17ce | refs/heads/master | 2022-06-23T18:59:33.307821 | 2020-07-02T01:31:52 | 2020-07-02T01:31:52 | 225,145,503 | 0 | 2 | Apache-2.0 | 2022-06-21T03:46:53 | 2019-12-01T10:49:26 | Java | UTF-8 | Java | false | false | 16,459 | java | package apiService;
import java.sql.Date;
import java.sql.SQLException;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
//import javax.ws.rs.core.Response.ResponseBuilder;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import DAO.AccountDAO;
import DAO.AccountTypeDAO;
import DAO.DepositDAO;
import DAO.FixedDepositDAO;
import DAO.MobileTDAO;
import DAO.WithdrawlDAO;
import impl_dao.SqlAccountDAO;
import impl_dao.SqlAccountTypeDAO;
import impl_dao.SqlDepositDAO;
import impl_dao.SqlFixedDepositDAO;
import impl_dao.SqlMobileTDAO;
import impl_dao.SqlWithdrawlDAO;
import model.Account;
import model.AccountType;
import model.Deposit;
import model.FixedDeposit;
import model.Mobilet;
import model.User;
import model.Withdrawl;
import model.viewAccountModel;
import response.AuthenticationResponse;
import util.AddAccount;
import util.AddUser;
import util.CheckDeal;
import util.JwTokenHelper;
import util.viewAccount;
@Path("/")
public class homeApiService extends BaseApiService {
@POST
@Path(value="auth")
@Produces(MediaType.APPLICATION_JSON)
public Response authorizationService(
@DefaultValue("") @HeaderParam("MU_ID") String MU_ID,
@DefaultValue("") @HeaderParam("password") String password) throws JSONException, SQLException, ClassNotFoundException, IllegalAccessException {
AuthenticationResponse ar = new AuthenticationResponse();
util.authService auth = new util.authService();
/*
* Check whether the userName filed is empty in the message
* throw error : "authorized unsuccessfully. user name is empty"
*/
if(MU_ID.isEmpty() || MU_ID == "") {
return ar.errorNoMBA_ID();
}
/*
* Check whether the Password filed is empty in the message
* throw error : "authorized unsuccessfully. password is empty"
*/
else if(password.isEmpty() || password == null) {
return ar.errorNoPASSWORD();
}
/*
* Check whether the userName and Password is correct
* throw error : "authorized unsuccessfully. password incorrect"
*/
int MU_ID_return = auth.validateUsingFunction(MU_ID, password);
//System.out.println(customer_ID);
if( MU_ID_return == 0) {
return ar.unsuccess();
}
/*
* Successful connection
* return - private key
*/
String privateKey = JwTokenHelper.getInstance().generatePrivateKey(MU_ID,password);
return ar.success(privateKey);
}
@GET
@Path("ping")
@Produces(MediaType.APPLICATION_JSON)
public Response getAllDevices() {
JSONObject obj = new JSONObject();
try {
obj.put("status", "server alive");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
@POST
@Path("mDeposit")
@Produces(MediaType.APPLICATION_JSON)
public Response mobileDeposit(
@DefaultValue("") @HeaderParam("amount") String amount_arg,
@DefaultValue("") @HeaderParam("account_ID") String account_ID_arg,
@DefaultValue("") @HeaderParam("MU_ID") String MU_ID_arg) {
//System.out.println("mobile deposit called");
JSONObject obj = new JSONObject();
/*
* call mobile deposit functionality
*
* */
int amount = Integer.parseInt(amount_arg);
int account_ID = Integer.parseInt(account_ID_arg);
int MU_ID = Integer.parseInt(MU_ID_arg);
MobileTDAO accountManager = new SqlMobileTDAO();
Mobilet at = new Mobilet();
at.setAmount(amount);
at.setDep_with('D');
at.setMU_ID(MU_ID);
try {
accountManager.addMobilet(at, 'D', account_ID);
AccountDAO check_balance_Manager = new SqlAccountDAO();
Account user = check_balance_Manager.getAccount(account_ID);
long balance = user.getBalance();
CheckDeal checker = new CheckDeal();
boolean isMatch = checker.ischeckDeal(MU_ID, account_ID);
if(isMatch) {
try {
obj.put("report", "successful transaction");
obj.put("account_ID", Integer.toString(account_ID));
obj.put("balance", Long.toString(balance));
}catch (JSONException e) {
e.printStackTrace();
}
} else {
check_balance_Manager = new SqlAccountDAO();
user.setBalance(user.getBalance() - 50);
check_balance_Manager.updateBalance(user);
check_balance_Manager = new SqlAccountDAO();
user = check_balance_Manager.getAccount(account_ID);
balance = user.getBalance();
try {
obj.put("report", "successful transaction");
obj.put("account_ID", Integer.toString(account_ID));
obj.put("balance", Long.toString(balance));
obj.put("deduction", "service charge of Rs.50");
}catch (JSONException e) {
e.printStackTrace();
}
}
}
catch (SQLException e1) {
e1.printStackTrace();
try {
obj.put("report", "unsuccessful transaction. please try again");
}catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
@POST
@Path("mWithdrawal")
@Produces(MediaType.APPLICATION_JSON)
public Response mobileWithdrawl(
@DefaultValue("") @HeaderParam("amount") String amount_arg,
@DefaultValue("") @HeaderParam("account_ID") String account_ID_arg,
@DefaultValue("") @HeaderParam("MU_ID") String MU_ID_arg) {
//System.out.println("mobile deposit called");
JSONObject obj = new JSONObject();
/*
* call mobile deposit functionality
*
* */
int amount = Integer.parseInt(amount_arg);
int account_ID = Integer.parseInt(account_ID_arg);
int MU_ID = Integer.parseInt(MU_ID_arg);
MobileTDAO accountManager = new SqlMobileTDAO();
Mobilet at = new Mobilet();
at.setAmount(amount);
at.setDep_with('W');
at.setMU_ID(MU_ID);
try {
accountManager.addMobilet(at, 'W', account_ID);
AccountDAO check_balance_Manager = new SqlAccountDAO();
Account user = check_balance_Manager.getAccount(account_ID);
long balance = user.getBalance();
CheckDeal checker = new CheckDeal();
boolean isMatch = checker.ischeckDeal(MU_ID, account_ID);
if(isMatch) {
try {
obj.put("report", "successful transaction");
obj.put("account_ID", Integer.toString(account_ID));
obj.put("balance", Long.toString(balance));
}catch (JSONException e) {
e.printStackTrace();
}
} else {
check_balance_Manager = new SqlAccountDAO();
user.setBalance(user.getBalance() - 50);
check_balance_Manager.updateBalance(user);
check_balance_Manager = new SqlAccountDAO();
user = check_balance_Manager.getAccount(account_ID);
balance = user.getBalance();
try {
obj.put("report", "successful transaction");
obj.put("account_ID", Integer.toString(account_ID));
obj.put("balance", Long.toString(balance));
obj.put("deduction", "service charge of Rs.50");
}catch (JSONException e) {
e.printStackTrace();
}
}
}
catch (SQLException e1) {
e1.printStackTrace();
try {
obj.put("report", "unsuccessful transaction. please try again");
}catch (JSONException e) {
e.printStackTrace();
}
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
@POST
@Path("customer")
@Produces(MediaType.APPLICATION_JSON)
public Response getAccount(
@DefaultValue("") @HeaderParam("customer_ID") String customer_ID_arg) throws SQLException {
JSONObject obj = new JSONObject();
int customer_ID = Integer.parseInt(customer_ID_arg);
viewAccount result_manager = new viewAccount();
viewAccountModel result = result_manager.getAccount(customer_ID);
try {
obj.put("cutomer_ID", Integer.toString(result.getCustomer_ID()));
obj.put("first name", result.getFirst_name());
obj.put("last name", result.getLast_name());
obj.put("email", result.getEmail());
obj.put("account type", result.getName());
obj.put("balance", Integer.toString(result.getBalance()));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
@POST
@Path("addUser")
@Produces(MediaType.APPLICATION_JSON)
public Response addUser(
@DefaultValue("") @HeaderParam("email") String email,
@DefaultValue("") @HeaderParam("date_of_birth_arg") String date_of_birth_arg,
@DefaultValue("") @HeaderParam("first_name") String first_name,
@DefaultValue("") @HeaderParam("last_name") String last_name)
throws SQLException {
JSONObject obj = new JSONObject();
Date date_of_birth = Date.valueOf(date_of_birth_arg);
AddUser user_add_manager = new AddUser();
User user = user_add_manager.addUser(email, date_of_birth, first_name, last_name);
try {
obj.put("status", "Successfully added a new user to the system");
obj.put("customer_ID", Integer.toString(user.getCustomer_ID()));
obj.put("first name", first_name);
obj.put("last name", last_name);
obj.put("email", email);
obj.put("date of birth",date_of_birth_arg);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
@POST
@Path("addAccount")
@Produces(MediaType.APPLICATION_JSON)
public Response addAccount(
@DefaultValue("") @HeaderParam("customer_ID") String user_ID_arg,
@DefaultValue("") @HeaderParam("account_type") String account_type_arg,
@DefaultValue("") @HeaderParam("initial_deposit") String initial_deposit_arg,
@DefaultValue("") @HeaderParam("date_created") String date_created_arg)
throws SQLException {
JSONObject obj = new JSONObject();
Date date_created = Date.valueOf(date_created_arg);
int user_ID = Integer.parseInt(user_ID_arg);
int account_type = Integer.parseInt(account_type_arg);
int initial_deposit = Integer.parseInt(initial_deposit_arg);
AddAccount account_manager = new AddAccount();
account_manager.add_account(user_ID, account_type, initial_deposit, date_created);
AccountTypeDAO atdao = new SqlAccountTypeDAO();
AccountType act = atdao.getAccountType(account_type);
try {
obj.put("status", "Successfully added a new account to the system");
obj.put("customer_ID", user_ID);
obj.put("account_type", act.toString());
obj.put("date_created", date_created);
obj.put("initial_deposit", initial_deposit);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
@POST
@Path("addDeposit")
@Produces(MediaType.APPLICATION_JSON)
public Response addDeposit(
@DefaultValue("") @HeaderParam("account_ID") String account_ID_arg,
@DefaultValue("") @HeaderParam("amount") String amount_arg,
@DefaultValue("") @HeaderParam("date_of_deposit") String date_of_deposit_arg)
throws SQLException {
JSONObject obj = new JSONObject();
Date date_of_deposit = Date.valueOf(date_of_deposit_arg);
int account_ID = Integer.parseInt(account_ID_arg);
int amount = Integer.parseInt(amount_arg);
Deposit dep = new Deposit(amount, date_of_deposit );
DepositDAO depositManager = new SqlDepositDAO();
depositManager.addDeposit(dep, account_ID);
AccountDAO check_balance_Manager = new SqlAccountDAO();
Account user = check_balance_Manager.getAccount(account_ID);
long balance = user.getBalance();
try {
obj.put("status", "Successfully deposited amount of " + amount_arg + " to account id :" + account_ID_arg);
obj.put("balance", Long.toString( balance));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
@POST
@Path("addWithdrawal")
@Produces(MediaType.APPLICATION_JSON)
public Response addWithdrawal(
@DefaultValue("") @HeaderParam("account_ID") String account_ID_arg,
@DefaultValue("") @HeaderParam("amount") String amount_arg,
@DefaultValue("") @HeaderParam("date_of_deposit") String date_of_deposit_arg)
throws SQLException {
JSONObject obj = new JSONObject();
Date date_of_deposit = Date.valueOf(date_of_deposit_arg);
int account_ID = Integer.parseInt(account_ID_arg);
int amount = Integer.parseInt(amount_arg);
Withdrawl withdrawl = new Withdrawl(amount, date_of_deposit );
WithdrawlDAO depositManager = new SqlWithdrawlDAO();
depositManager.addWithdrawl(withdrawl, account_ID);
AccountDAO check_balance_Manager = new SqlAccountDAO();
Account user = check_balance_Manager.getAccount(account_ID);
long balance = user.getBalance();
try {
obj.put("status", "Successfully withdrawn amount of " + amount_arg + " to account id :" + account_ID_arg);
obj.put("balance", Long.toString( balance));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
@POST
@Path("mobileRefresh")
@Produces(MediaType.APPLICATION_JSON)
public Response mobileRefresh(
@DefaultValue("") @HeaderParam("account_ID") String account_ID_arg)
throws SQLException {
JSONObject obj = new JSONObject();
int account_ID = Integer.parseInt(account_ID_arg);
AccountDAO check_balance_Manager = new SqlAccountDAO();
Account user = check_balance_Manager.getAccount(account_ID);
long balance = user.getBalance();
System.out.println("balance of account: " + account_ID_arg + " is " + Long.toString(balance));
try {
obj.put("balance", Long.toString( balance));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
@POST
@Path("addFixedDeposit")
@Produces(MediaType.APPLICATION_JSON)
public Response addFixedDeposit(
@DefaultValue("") @HeaderParam("account_ID") String account_ID_arg,
@DefaultValue("") @HeaderParam("FD_type_ID") String FD_type_ID_arg)
throws SQLException {
JSONObject obj = new JSONObject();
int account_ID = Integer.parseInt(account_ID_arg);
int FD_type_ID = Integer.parseInt(FD_type_ID_arg);
FixedDeposit fd = new FixedDeposit(account_ID,FD_type_ID);
FixedDepositDAO fd_manager = new SqlFixedDepositDAO();
fd_manager.addFixedDeposit(fd);
System.out.println("New fixed deposit created");
try {
obj.put("status","Successfully created new fixed deposit");
obj.put("account_ID",account_ID_arg);
obj.put("FD_type_ID",FD_type_ID_arg);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Response.ok()
.type(MediaType.APPLICATION_JSON)
.entity(obj)
.build();
}
}
| [
"[email protected]"
] | |
bec88dbfb500bb7f84f41cae6f7cef83c2fe29c3 | b305a18c02fdce36353def6e306585180264734a | /DesignPatternTest/src/kr/or/ddit/creational/factory/Circle.java | 183fdf341bbb044d91906e41f784278a136bc457 | [] | no_license | hamjeonghwan/workspace | 0a1b3786568cbf3d3cf5e14bd44e19774bbed44f | 722c4dc22b702fa4f0eaa838c05706c3c8193ca8 | refs/heads/master | 2020-05-07T01:06:31.594171 | 2019-06-03T00:12:38 | 2019-06-03T00:12:38 | 180,257,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package kr.or.ddit.creational.factory;
public class Circle implements Shape {
@Override
public void draw() {
System.out.println("Circle์ draw()๋ฉ์๋ ์
๋๋ค");
}
}
| [
"[email protected]"
] | |
1753d019aaabac3a496a35d5c5308e09968c4624 | 1f1044786c3b020f49a5f56dfc34a2fba0edb287 | /find_chars_N.java | b4cbbe083f8e61ca63110e085a2645df9b14ad39 | [] | no_license | engprodigy/interview_test | 4e6358f208e4f17eb7639f651c14f901a45ae150 | 2a3806ed591aa07437a7fff6de0593f30c5b9f67 | refs/heads/master | 2020-04-05T07:04:10.840785 | 2015-08-11T09:20:37 | 2015-08-11T09:20:37 | 40,531,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | class Solution {
public string find_chars(String string1, String string2) {
string1.concat(string2);
return string1;
}
}
| [
"[email protected]"
] | |
995f2338b3797f7d2b3f7db38a1a1f7e709257d4 | 40828ffcb81d5df7c9362c01e967007c5f0a15da | /src/patters/factory/ConcreteProduct2.java | 15a151258b02a018f2f56595df5036a35259390c | [] | no_license | youhappyareok/design-patterns | f11b4f49694aa9c6bb632938bc10a44994b7753d | eb0dd2e616e18534a337a43af7748ea3edbf9853 | refs/heads/master | 2022-12-27T20:17:29.901992 | 2020-10-14T03:48:58 | 2020-10-14T03:48:58 | 303,755,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 78 | java | package patters.factory;
public class ConcreteProduct2 implements Product{
}
| [
"[email protected]"
] | |
9080447752498f7f6eba0ea52351421c34c53243 | d4c1727c13eb378c19e9b0941d36285240c84404 | /src/ExcelReader/GetDataFromExcel.java | 90221180103ab6e4260ff6e35e3066a2a6dff1bc | [] | no_license | bharadiya/TestNGTutorials | 813434dc1e333e16845db758d358eac5cda82acf | 2aa9d68f8c4ce9a51652c70a69687a41a7141861 | refs/heads/master | 2020-06-10T10:18:39.047594 | 2019-08-31T19:25:50 | 2019-08-31T19:25:50 | 193,633,719 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,778 | java | package ExcelReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class GetDataFromExcel {
public XSSFWorkbook book, workbook;
FileInputStream fis = null;
public XSSFSheet sheet, outputsheet = null;
public XSSFRow row, outputrow = null;
public FileOutputStream fos;
/*
* Parameterized constructor which takes excel file path as a String
*/
public GetDataFromExcel(String fis, int index) throws IOException {
this.fis = new FileInputStream(fis);
book = new XSSFWorkbook(fis);
sheet = book.getSheetAt(index);
}
public int getRowsCount() {
int rows = sheet.getLastRowNum() + 1;
return rows;
}
public int getColumnCount() {
row = sheet.getRow(0);
int columns = row.getLastCellNum();
return columns;
}
public Object[][] getData() {
Object[][] obj = new Object[getRowsCount()][getColumnCount()];
for (int i = 0; i < getRowsCount(); i++) {
row = sheet.getRow(i);
int columns = row.getLastCellNum();
for (int j = 0; j < columns; j++) {
obj[i][j] = row.getCell(j);
}
}
return obj;
}
public void createSheet(String filePath, String sheetName) throws FileNotFoundException {
fos = new FileOutputStream(filePath);
workbook = new XSSFWorkbook();
outputsheet = workbook.createSheet(sheetName);
}
public void writeData(int rows, int columns) throws IOException {
for (int i = 0; i < rows; i++) {
outputrow = sheet.createRow(i);
for (int j = 0; j < columns; j++) {
outputrow.createCell(j).setCellValue("Shashank");
}
}
workbook.write(fos);
fos.close();
}
} | [
"[email protected]"
] | |
0f86ada0887f2efbaab2df1befd6844f689b765f | 880fc305b041094fa7da62ae1a4ec37e5f3ba225 | /src/test/java/com/ttth/teamcaring/web/rest/IconResourceIntTest.java | e2040337e026ebed282f50cd031425b780d1844f | [] | no_license | paulmai193/team-caring | e30e77ce16a8030920009328a4e09f0c0c02f204 | ce7070da523c87c2f4296804cef9f7e66062a6d9 | refs/heads/master | 2021-09-06T21:45:44.302383 | 2018-02-12T03:20:23 | 2018-02-12T03:20:23 | 112,309,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,662 | java | /*
*
*/
package com.ttth.teamcaring.web.rest;
import static com.ttth.teamcaring.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.List;
import javax.persistence.EntityManager;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import com.ttth.teamcaring.TeamCaringApp;
import com.ttth.teamcaring.domain.Icon;
import com.ttth.teamcaring.repository.IconRepository;
import com.ttth.teamcaring.repository.search.IconSearchRepository;
import com.ttth.teamcaring.service.IconService;
import com.ttth.teamcaring.service.dto.IconDTO;
import com.ttth.teamcaring.service.mapper.IconMapper;
import com.ttth.teamcaring.web.rest.errors.ExceptionTranslator;
/**
* Test class for the IconResource REST controller.
*
* @see IconResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TeamCaringApp.class)
@Ignore
public class IconResourceIntTest {
/** The Constant DEFAULT_NAME. */
private static final String DEFAULT_NAME = "AAAAAAAAAA";
/** The Constant UPDATED_NAME. */
private static final String UPDATED_NAME = "BBBBBBBBBB";
/** The icon repository. */
@Autowired
private IconRepository iconRepository;
/** The icon mapper. */
@Autowired
private IconMapper iconMapper;
/** The icon service. */
@Autowired
private IconService iconService;
/** The icon search repository. */
@Autowired
private IconSearchRepository iconSearchRepository;
/** The jackson message converter. */
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
/** The pageable argument resolver. */
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
/** The exception translator. */
@Autowired
private ExceptionTranslator exceptionTranslator;
/** The em. */
@Autowired
private EntityManager em;
/** The rest icon mock mvc. */
private MockMvc restIconMockMvc;
/** The icon. */
private Icon icon;
/**
* Setup.
*/
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
final IconResource iconResource = new IconResource(iconService);
this.restIconMockMvc = MockMvcBuilders.standaloneSetup(iconResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setConversionService(createFormattingConversionService())
.setMessageConverters(jacksonMessageConverter).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*
* @param em
* the em
* @return the icon
*/
public static Icon createEntity(EntityManager em) {
Icon icon = new Icon().name(DEFAULT_NAME);
return icon;
}
/**
* Inits the test.
*/
@Before
public void initTest() {
iconSearchRepository.deleteAll();
icon = createEntity(em);
}
/**
* Creates the icon.
*
* @throws Exception
* the exception
*/
@Test
@Transactional
public void createIcon() throws Exception {
int databaseSizeBeforeCreate = iconRepository.findAll().size();
// Create the Icon
IconDTO iconDTO = iconMapper.toDto(icon);
restIconMockMvc
.perform(post("/api/icons").contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(iconDTO)))
.andExpect(status().isCreated());
// Validate the Icon in the database
List<Icon> iconList = iconRepository.findAll();
assertThat(iconList).hasSize(databaseSizeBeforeCreate + 1);
Icon testIcon = iconList.get(iconList.size() - 1);
assertThat(testIcon.getName()).isEqualTo(DEFAULT_NAME);
// Validate the Icon in Elasticsearch
Icon iconEs = iconSearchRepository.findOne(testIcon.getId());
assertThat(iconEs).isEqualToComparingFieldByField(testIcon);
}
/**
* Creates the icon with existing id.
*
* @throws Exception
* the exception
*/
@Test
@Transactional
public void createIconWithExistingId() throws Exception {
int databaseSizeBeforeCreate = iconRepository.findAll().size();
// Create the Icon with an existing ID
icon.setId(1L);
IconDTO iconDTO = iconMapper.toDto(icon);
// An entity with an existing ID cannot be created, so this API call
// must fail
restIconMockMvc
.perform(post("/api/icons").contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(iconDTO)))
.andExpect(status().isBadRequest());
// Validate the Icon in the database
List<Icon> iconList = iconRepository.findAll();
assertThat(iconList).hasSize(databaseSizeBeforeCreate);
}
/**
* Gets the all icons.
*
* @return the all icons
* @throws Exception
* the exception
*/
@Test
@Transactional
public void getAllIcons() throws Exception {
// Initialize the database
iconRepository.saveAndFlush(icon);
// Get all the iconList
restIconMockMvc.perform(get("/api/icons?sort=id,desc")).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(icon.getId().intValue())))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())));
}
/**
* Gets the icon.
*
* @return the icon
* @throws Exception
* the exception
*/
@Test
@Transactional
public void getIcon() throws Exception {
// Initialize the database
iconRepository.saveAndFlush(icon);
// Get the icon
restIconMockMvc.perform(get("/api/icons/{id}", icon.getId())).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(icon.getId().intValue()))
.andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()));
}
/**
* Gets the non existing icon.
*
* @return the non existing icon
* @throws Exception
* the exception
*/
@Test
@Transactional
public void getNonExistingIcon() throws Exception {
// Get the icon
restIconMockMvc.perform(get("/api/icons/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
/**
* Update icon.
*
* @throws Exception
* the exception
*/
@Test
@Transactional
public void updateIcon() throws Exception {
// Initialize the database
iconRepository.saveAndFlush(icon);
iconSearchRepository.save(icon);
int databaseSizeBeforeUpdate = iconRepository.findAll().size();
// Update the icon
Icon updatedIcon = iconRepository.findOne(icon.getId());
updatedIcon.name(UPDATED_NAME);
IconDTO iconDTO = iconMapper.toDto(updatedIcon);
restIconMockMvc
.perform(put("/api/icons").contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(iconDTO)))
.andExpect(status().isOk());
// Validate the Icon in the database
List<Icon> iconList = iconRepository.findAll();
assertThat(iconList).hasSize(databaseSizeBeforeUpdate);
Icon testIcon = iconList.get(iconList.size() - 1);
assertThat(testIcon.getName()).isEqualTo(UPDATED_NAME);
// Validate the Icon in Elasticsearch
Icon iconEs = iconSearchRepository.findOne(testIcon.getId());
assertThat(iconEs).isEqualToComparingFieldByField(testIcon);
}
/**
* Update non existing icon.
*
* @throws Exception
* the exception
*/
@Test
@Transactional
public void updateNonExistingIcon() throws Exception {
int databaseSizeBeforeUpdate = iconRepository.findAll().size();
// Create the Icon
IconDTO iconDTO = iconMapper.toDto(icon);
// If the entity doesn't have an ID, it will be created instead of just
// being updated
restIconMockMvc
.perform(put("/api/icons").contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(iconDTO)))
.andExpect(status().isCreated());
// Validate the Icon in the database
List<Icon> iconList = iconRepository.findAll();
assertThat(iconList).hasSize(databaseSizeBeforeUpdate + 1);
}
/**
* Delete icon.
*
* @throws Exception
* the exception
*/
@Test
@Transactional
public void deleteIcon() throws Exception {
// Initialize the database
iconRepository.saveAndFlush(icon);
iconSearchRepository.save(icon);
int databaseSizeBeforeDelete = iconRepository.findAll().size();
// Get the icon
restIconMockMvc.perform(
delete("/api/icons/{id}", icon.getId()).accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate Elasticsearch is empty
boolean iconExistsInEs = iconSearchRepository.exists(icon.getId());
assertThat(iconExistsInEs).isFalse();
// Validate the database is empty
List<Icon> iconList = iconRepository.findAll();
assertThat(iconList).hasSize(databaseSizeBeforeDelete - 1);
}
/**
* Search icon.
*
* @throws Exception
* the exception
*/
@Test
@Transactional
public void searchIcon() throws Exception {
// Initialize the database
iconRepository.saveAndFlush(icon);
iconSearchRepository.save(icon);
// Search the icon
restIconMockMvc.perform(get("/api/_search/icons?query=id:" + icon.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(icon.getId().intValue())))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())));
}
/**
* Equals verifier.
*
* @throws Exception
* the exception
*/
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Icon.class);
Icon icon1 = new Icon();
icon1.setId(1L);
Icon icon2 = new Icon();
icon2.setId(icon1.getId());
assertThat(icon1).isEqualTo(icon2);
icon2.setId(2L);
assertThat(icon1).isNotEqualTo(icon2);
icon1.setId(null);
assertThat(icon1).isNotEqualTo(icon2);
}
/**
* Dto equals verifier.
*
* @throws Exception
* the exception
*/
@Test
@Transactional
public void dtoEqualsVerifier() throws Exception {
TestUtil.equalsVerifier(IconDTO.class);
IconDTO iconDTO1 = new IconDTO();
iconDTO1.setId(1L);
IconDTO iconDTO2 = new IconDTO();
assertThat(iconDTO1).isNotEqualTo(iconDTO2);
iconDTO2.setId(iconDTO1.getId());
assertThat(iconDTO1).isEqualTo(iconDTO2);
iconDTO2.setId(2L);
assertThat(iconDTO1).isNotEqualTo(iconDTO2);
iconDTO1.setId(null);
assertThat(iconDTO1).isNotEqualTo(iconDTO2);
}
/**
* Test entity from id.
*/
@Test
@Transactional
public void testEntityFromId() {
assertThat(iconMapper.fromId(42L).getId()).isEqualTo(42);
assertThat(iconMapper.fromId(null)).isNull();
}
}
| [
"[email protected]"
] | |
7af9817e4653c39c77dd214ccaa86b4b4083bf3c | 6ae046256ce8db2a8188850e46fed5316486e950 | /app/src/androidTest/java/com/example/languageleaning/ExampleInstrumentedTest.java | 626428c42db953da9346e794dfb1469eac5d24ec | [] | no_license | SulfredLee/LanguageLeaning | 0fdb18e5e542a722e587240a1a576c4c9e3fc0b2 | 8319fe3c41088c78170b29bb76902c86a9784ec1 | refs/heads/master | 2020-03-21T10:53:54.191291 | 2018-07-01T05:22:00 | 2018-07-01T05:22:00 | 138,476,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.example.languageleaning;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.languageleaning", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
adc107cd8e6c4799a6ed19448c2cb59f9fa36cbe | 83d0d72e00559c3d3e92a9c74ce9747349737022 | /syslink/src/main/java/com/tongyuan/rabbit/Receiver.java | ef223ff4baaee3e4f47129283a90ea51fae93f6f | [] | no_license | secondzc/zcy_sys | 7f1c8cfcbe4276ab52a11aeddc30381783cdae77 | 032e9dd4ff486bbee0af49b3a0461effc4643234 | refs/heads/master | 2021-09-14T01:23:06.957315 | 2018-02-07T08:36:40 | 2018-02-07T08:36:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | //package com.tongyuan.rabbit;
//
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.stereotype.Component;
//
///**
// * @author xyx
// */
//@Component
//@RabbitListener(queues = "hello")
//public class Receiver {
//
// @RabbitHandler
// public void process(String hello) {
// System.out.println("Receiver : " + hello);
// }
//
//}
| [
"[email protected]"
] | |
9d17a820cead04a3deb82faa5171da90b02ffd6e | 2f30cf559a03f76a4c1aaeaad4bf10405a0e950f | /app/src/main/java/com/wicam/d_default_custom/detail_page/CustomDetailAdapter.java | 267f263b79b4910e1bb1456a42bbf4c4ae801a3e | [] | no_license | junseol86/wicam-android | cd935451a5dbe76be31df48a163997f95010a5b7 | 4a0f8da03ff78fe66d275edefba2091257c57db8 | refs/heads/master | 2020-12-30T15:08:06.609770 | 2016-08-29T06:34:26 | 2016-08-29T06:34:26 | 91,107,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,967 | java | package com.wicam.d_default_custom.detail_page;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Point;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.wicam.R;
import com.wicam.a_common_utils.CommentLikeAsyncTask;
import com.wicam.a_common_utils.ImageAsyncTask;
import com.wicam.a_common_utils.WebViewPage;
import com.wicam.a_common_utils.account_related.NickNameNeededTask;
import com.wicam.a_common_utils.account_related.comment_related.DeleteCommentAsyncTask;
import com.wicam.a_common_utils.account_related.comment_related.DetailActivityWithCommentAndReport;
import com.wicam.a_common_utils.account_related.item_detail_comment.CommentData;
import com.wicam.a_common_utils.account_related.item_detail_comment.CommentsAdapter;
import com.wicam.a_common_utils.account_related.item_detail_comment.ItemAndCommentData;
import com.wicam.a_common_utils.account_related.item_detail_comment.ItemData;
import com.wicam.a_common_utils.common_values.MyCache;
import com.wicam.a_common_utils.common_values.Security;
import com.wicam.a_common_utils.common_values.Singleton;
import com.wicam.a_common_utils.scroll_to_update.ViewholderWithComments;
import com.wicam.d_default_custom.CustomAddModifyActivity;
import com.wicam.d_default_custom.CustomData;
import com.wicam.d_default_custom.CustomDeleteAsyncTask;
import java.util.ArrayList;
/**
* Created by Hyeonmin on 2015-07-10.
*/
public class CustomDetailAdapter extends CommentsAdapter {
private DetailActivityWithCommentAndReport detailActivityWithCommentAndReport;
private CustomDetailActivity customDetailActivity;
private CustomData customDetailData;
private int screenWidth;
public CustomDetailAdapter(Activity activity, DetailActivityWithCommentAndReport detailActivityWithCommentAndReport, ArrayList<ItemAndCommentData> itemAndCommentDataList) {
this.activity = activity;
this.detailActivityWithCommentAndReport = detailActivityWithCommentAndReport;
this.customDetailActivity = (CustomDetailActivity) detailActivityWithCommentAndReport;
this.itemAndCommentDataList = itemAndCommentDataList;
Display display = customDetailActivity.getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
screenWidth = size.x;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.d_custom_detail_item, parent, false);
ViewHolder vh = new ViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(ViewholderWithComments holder, final int position) {
super.onBindViewHolder(holder, position);
if (!Singleton.create().isCanBindView()) // ํํฐ๋ฅผ ๋นจ๋ฆฌ ๋ฐ๊พธ๋๊ฐ ํด๋ ๋ฆฌ์คํธ๋ฅผ ๋ค ๋ฐ๊ธฐ ์ ์๋ BindViewํ์ง ์๋๋ก
return;
((ViewHolder)holder).customInfo.setVisibility(position == 0 ? View.VISIBLE : View.GONE);
((ViewHolder)holder).itemView.findViewById(R.id.comment_ll).setVisibility(position != 0 ? View.VISIBLE : View.GONE);
if (position == 0) { // ์
์ฒด์ ๋ณด์ผ ๊ฒฝ์ฐ
customDetailData = (CustomData)itemAndCommentDataList.get(position);
((ViewHolder)holder).writerNickname.setText(customDetailData.getModifierNickname());
((ViewHolder)holder).writeTime.setText(customDetailData.getModifyTime());
((ViewHolder)holder).customName.setText(customDetailData.getItemName());
((ViewHolder)holder).urlLink.setVisibility(customDetailData.getUrlLink().trim().equalsIgnoreCase("") ? View.GONE : View.VISIBLE);
((ViewHolder)holder).urlLink.setText(customDetailData.getUrlLink());
((ViewHolder)holder).description.setVisibility(customDetailData.getDescription().trim().equalsIgnoreCase("") ? View.GONE : View.VISIBLE);
((ViewHolder)holder).description.setText(customDetailData.getDescription());
((ViewHolder)holder).itemImageArea.setVisibility(customDetailData.getHasPhoto() == 0 ? View.GONE : View.VISIBLE);
if (customDetailData.getHasPhoto() == 1) {
((ViewHolder)holder).itemImage.getLayoutParams().height = (int)((double)screenWidth * 0.4);
((ViewHolder)holder).seeImageButton.getLayoutParams().height = (int)((double)screenWidth * 0.4);
if (customDetailData.getImage() == null)
new ImageAsyncTask(this, new Security().CUSTOM_IMAGE, "item_" + customDetailData.getItemId(), position, ((ViewHolder) holder).itemImage, customDetailData).execute();
else {
((ViewHolder) holder).itemImage.setImageBitmap(customDetailData.getImage());
}
}
}
else {
holder.commentPhoto.getLayoutParams().height = (int)((double)screenWidth * 0.4);
holder.commentPhotoButton.getLayoutParams().height = (int)((double)screenWidth * 0.4);
if (commentData.getHas_photo() == 1) {
if (commentData.getImage() == null)
new ImageAsyncTask(this, new Security().CUSTOM_IMAGE, commentData.getItem_comment_id(), position, holder.commentPhoto, commentData).execute();
else
holder.commentPhoto.setImageBitmap(commentData.getImage());
}
}
}
@Override
public int getItemCount() {
return itemAndCommentDataList.size();
}
public class ViewHolder extends ViewholderWithComments {
private LinearLayout customInfo;
private TextView writerNickname, writeTime, customName, description, urlLink;
private Button deleteModifyButton, seeImageButton;
private RelativeLayout itemImageArea;
private ImageView itemImage;
public ViewHolder(final View itemView) {
super(itemView);
customInfo = (LinearLayout)itemView.findViewById(R.id.custom_detail_custom_information);
writerNickname = (TextView)itemView.findViewById(R.id.custom_detail_writer_nickname);
writeTime = (TextView)itemView.findViewById(R.id.custom_detail_write_time);
customName = (TextView)itemView.findViewById(R.id.custom_detail_custom_name);
description = (TextView)itemView.findViewById(R.id.custom_detail_description);
urlLink = (TextView)itemView.findViewById(R.id.custom_detail_url_link);
urlLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
customDetailActivity.startActivity(new Intent(detailActivityWithCommentAndReport, WebViewPage.class).putExtra("url_link", ((CustomData) itemAndCommentDataList.get(getPosition())).getUrlLink()));
}
});
commentPhotoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
customDetailActivity.startActivity(new Intent(customDetailActivity, WebViewPage.class).putExtra("url_link",
new Security().WEB_ADDRESS + "image_show_fit.php?src=" + new Security().CUSTOM_IMAGE +
((CommentData) itemAndCommentDataList.get(getPosition())).getItem_comment_id() + ".jpg"));
}
});
urlBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
customDetailActivity.startActivity(new Intent(detailActivityWithCommentAndReport, WebViewPage.class).putExtra("url_link", ((CommentData) itemAndCommentDataList.get(getPosition())).getUrl_link()));
}
});
commentLike = (ImageButton)itemView.findViewById(R.id.comment_like_button);
commentLikeNumber = (TextView)itemView.findViewById(R.id.comment_like_number);
commentLike.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (((CommentData)itemAndCommentDataList.get(getPosition())).getWriter_id().equalsIgnoreCase(new MyCache(customDetailActivity).getMyId()))
return;
new CommentLikeAsyncTask(detailActivityWithCommentAndReport, itemAndCommentDataList, getPosition()).execute(new Security().WEB_ADDRESS
+ "comment_like_toggle.php?user_id=" + new MyCache(customDetailActivity).getMyId()
+ "&default_code=" + new MyCache(customDetailActivity).getDefaultCode()
+ "&content_id=" + new MyCache(customDetailActivity).getContentId()
+ "&content_type=" + new MyCache(customDetailActivity).getContentType()
+ "&comment_id=" + ((CommentData) itemAndCommentDataList.get(getPosition())).getItem_comment_id());
}
});
deleteComment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(customDetailActivity)
.setMessage("๋๊ธ์ ์ญ์ ํ์๊ฒ ์ต๋๊น?")
.setPositiveButton("ํ์ธ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
new DeleteCommentAsyncTask(customDetailActivity).execute(new Security().WEB_ADDRESS+ "delete_comment.php"
+ "?default_code=" + new MyCache(customDetailActivity).getDefaultCode()
+ "&content_id=" + new MyCache(customDetailActivity).getContentId()
+ "&content_type=" + new MyCache(customDetailActivity).getContentType()
+ "&device_id=" + new MyCache(customDetailActivity).getDeviceId()
+ "&authority_code=" + new MyCache(customDetailActivity).getAuthority()
+ "&item_id=" + Singleton.create().getItemDataList().get(Singleton.create().getItemPosition()).getItemId()
+ "&user_id=" + new MyCache(customDetailActivity).getMyId()
+ "&writer_id=" + ((CommentData)itemAndCommentDataList.get(getPosition())).getWriter_id()
+ "&comment_id=" + ((CommentData)itemAndCommentDataList.get(getPosition())).getItem_comment_id()
);
}
})
.setNegativeButton("์ทจ์", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
})
.show();
}
});
itemImageArea = (RelativeLayout)itemView.findViewById(R.id.custom_image_rl);
seeImageButton = (Button)itemView.findViewById(R.id.custom_image_button);
seeImageButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
((ImageView)itemView.findViewById(R.id.item_magnify_image)).setImageResource(R.drawable.image_magnify_over);
break;
case MotionEvent.ACTION_CANCEL:
((ImageView)itemView.findViewById(R.id.item_magnify_image)).setImageResource(R.drawable.image_magnify);
break;
case MotionEvent.ACTION_UP:
((ImageView)itemView.findViewById(R.id.item_magnify_image)).setImageResource(R.drawable.image_magnify);
customDetailActivity.startActivity(new Intent(customDetailActivity, WebViewPage.class).putExtra("url_link",
new Security().WEB_ADDRESS + "image_show_fit.php?src=" + new Security().CUSTOM_IMAGE + "item_" +
((ItemData)itemAndCommentDataList.get(0)).getItemId() + ".jpg"));
break;
}
return false;
}
});
itemImage = (ImageView)itemView.findViewById(R.id.custom_image);
deleteModifyButton = (Button)itemView.findViewById(R.id.custom_modify_delete_btn);
deleteModifyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (customDetailData.getAuthority() == 1) {
new AlertDialog.Builder(customDetailActivity)
.setMessage("์ ๋ณด๋ฅผ ์์ ํน์ ์ญ์ ํ์๊ฒ ์ต๋๊น?")
.setPositiveButton("์์ ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Singleton.create().setAddOrModify(1);
Singleton.create().setCustomData((CustomData) itemAndCommentDataList.get(0));
customDetailActivity.startActivityForResult(new Intent(customDetailActivity, CustomAddModifyActivity.class), 1);
}
})
.setNegativeButton("์ญ์ ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
new AlertDialog.Builder(customDetailActivity)
.setMessage("์ ๋ณด๋ฅผ ์ ๋ง๋ก ์ญ์ ํ์๊ฒ ์ต๋๊น?")
.setPositiveButton("์", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
new CustomDeleteAsyncTask(customDetailActivity).execute(new Security().WEB_ADDRESS + "delete_custom.php?user_id=" + new MyCache(customDetailActivity).getMyId()
+ "&device_id=" + new MyCache(customDetailActivity).getDeviceId() + "&item_id=" + ((CustomData)itemAndCommentDataList.get(0)).getItemId()
+ "&default_code=" + new MyCache(customDetailActivity).getDefaultCode() + "&content_id=" + new MyCache(customDetailActivity).getContentId()
);
}
})
.setNegativeButton("์๋์ค", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
})
.show();
}
})
.setNeutralButton("์ทจ์", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
})
.show();
}
else {
new AlertDialog.Builder(customDetailActivity)
.setMessage("๋ค๋ฅธ ์ฌ์ฉ์์ ์ํด ์์ฑ๋ ์ ๋ณด์
๋๋ค. ์ ๋ณด์ ์์ ยท์ญ์ ๊ถํ์ ์ ์ฒญํ์๊ฒ ์ต๋๊น?")
.setPositiveButton("ํ์ธ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
new NickNameNeededTask(customDetailActivity, 3);
}
})
.setNegativeButton("์ทจ์", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
})
.show();
}
}
});
}
}
}
| [
"[email protected]"
] | |
52176c6003e9f130b5d8280d62c9c6018dcf3734 | 3b9fc51f6439533dd3d27e38b282a3fa7f5190bf | /code/src/riwcm/component/WriteArMessage.java | 86a4e1eb6f7df07f4c81d6f0b61615711326bfe8 | [] | no_license | Fil0x/ID2203 | 1850114ac6293b02049291f68e330692d06154c9 | dcb6c4016f3e3b82f3b92197b44054a38a3ae7fd | refs/heads/master | 2021-01-10T17:19:20.447606 | 2016-03-07T21:07:25 | 2016-03-07T21:07:25 | 51,462,774 | 0 | 0 | null | 2016-02-25T08:51:37 | 2016-02-10T18:40:45 | Java | UTF-8 | Java | false | false | 779 | java | package riwcm.component;
import beb.event.BEBDeliver;
import network.TAddress;
public class WriteArMessage extends BEBDeliver {
private static final long serialVersionUID = 7119335186848859132L;
private final Integer key, rid, ts, wr, val;
public WriteArMessage(TAddress source, Integer key, Integer rid, Integer ts, Integer wr, Integer val) {
super(source);
this.key = key;
this.rid = rid;
this.ts = ts;
this.wr = wr;
this.val = val;
}
public Integer getKey() { return key; }
public Integer getRid() {
return rid;
}
public Integer getTs() {
return ts;
}
public Integer getWr() {
return wr;
}
public Integer getVal() {
return val;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.