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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
116bcc300c47b735f6689299380f84dfaf6de65e | e4508641606a271dd0bdfb6141ab23a3ff126ae6 | /ru.eclipsetrader.transaq.core/src/ru/eclipsetrader/transaq/core/model/SecurityType.java | 1f921e37fa3e62267c58255736e8351bfe0fd6d1 | [] | no_license | azyuzko/eclipsetransaq | d72b81b3d3db4e15a5999ccb37c93653b82d64d3 | 634bdcce9416f585f29629ef8bf5dcd1786fadd7 | refs/heads/master | 2021-01-10T21:04:12.185739 | 2016-09-20T12:29:48 | 2016-09-20T12:29:48 | 39,255,592 | 1 | 0 | null | null | null | null | WINDOWS-1251 | Java | false | false | 920 | java | package ru.eclipsetrader.transaq.core.model;
public enum SecurityType {
// Торгуемые инструменты:
SHARE, // - акции
BOND, // - облигации корпоративные
FUT, // - фьючерсы FORTS
OPT, // - опционы
GKO, // - гос. бумаги
FOB, // - фьючерсы ММВБ
MCT,
ETS_CURRENCY,
ETS_SWAP,
// Неторгуемые (все кроме IDX приходят только с зарубежных площадок):
IDX, // - индексы
QUOTES, // - котировки (прочие)
CURRENCY, // - валютные пары
ADR, // - АДР
NYSE, // - данные с NYSE
METAL, // - металлы
OIL, // - нефтянка
/*SHA, // это гавно приходит с продуктива!
OP,
SH,
BO,
RE,
T,
BON,
ND,
ARE,
D,
MC,
FU,
SHAR,
E,
ETS_CURRENC,
Y,
ID,
X,
ETS_SW,
ETS_CU,
AP,
ETS_CURR,*/
}
| [
"[email protected]"
] | |
35e1d74fdad96c98139cc6bad08dfecc9e575875 | 034f5cbf180917115dc26a915ad2e3a3bd704d61 | /src/main/java/me/renhai/oj/CombinationSumIII.java | 6bb444a33504f2134f64ea7f25b0be7f273d21c8 | [] | no_license | renhai/demo | f3c2a20e630a22aeedc8913cbedd02c1af5f5b2a | ca71b5a4c82262bc381ff8c90b133f2bfd589509 | refs/heads/master | 2020-07-27T21:38:36.569921 | 2016-12-17T05:43:41 | 2016-12-17T05:43:41 | 73,424,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | java | package me.renhai.oj;
import java.util.ArrayList;
import java.util.List;
/**
* https://leetcode.com/problems/combination-sum-iii/
* @author andy
*
*/
public class CombinationSumIII {
public static void main(String[] args) {
List<List<Integer>> res = new CombinationSumIII().combinationSum3(3, 7);
for (List<Integer> list : res) {
System.out.println(list);
}
}
public List<List<Integer>> combinationSum3(int k, int n) {
int[] candidates = new int[] {1,2,3,4,5,6,7,8,9};
List<List<Integer>> combs = new ArrayList<>();
helper(combs, new ArrayList<Integer>(), candidates, n, 0, k);
return combs;
}
private void helper(List<List<Integer>> combs, List<Integer> comb, int[] candidates, int target, int start, int k) {
if (target == 0 && comb.size() == k) {
combs.add(new ArrayList<>(comb));
return;
}
for (int i = start; i < candidates.length && target >= candidates[i]; i++) {
comb.add(candidates[i]);
helper(combs, comb, candidates, target - candidates[i], i + 1, k);
comb.remove(comb.size() - 1);
}
}
}
| [
"[email protected]"
] | |
18c6929324c74761dab762b542555d0f2e4383ad | 71b21c948fd54796b1e44a8184f5a7109eec3130 | /mytest/src/main/java/com/guinong/shopcart/ShopCartRequest.java | 677d058b5f70416ad8fd29a8768f1dc7db263624 | [] | no_license | yangmbin/NetClient | e357513481a125249f3fc1e0f493faa5343c1cae | 5587501ab97917bc3735e8aeac5634586db85a96 | refs/heads/master | 2021-01-19T18:43:36.529126 | 2017-07-28T08:38:27 | 2017-07-28T08:38:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 184 | java | package com.guinong.shopcart;
import java.io.Serializable;
/**
* @author csn
* @date 2017/7/27 0027 16:38
* @content
*/
public class ShopCartRequest implements Serializable {
}
| [
"chenshuangniu"
] | chenshuangniu |
64de045dd50982aaecea50c26b424f91588f54ae | dfa6b1892b1fe8ea54c8a11d2499d27530576d57 | /spring-boot-kafka-consumer-example/src/main/java/com/sreeram/kafka/springbootkafkaconsumerexample/config/KafkaConfiguration.java | a2e1e922933cc3353c5e811170b6e8d3baaf767b | [] | no_license | indysreeram/spring-boot-kafka | 7b170b0763c751749f24ef11d3844b6328ad9ceb | 40dcb61ae8f1189548529f8c1b77f2cd8d307de0 | refs/heads/master | 2022-04-19T19:01:59.400250 | 2020-04-11T16:36:34 | 2020-04-11T16:36:34 | 254,910,024 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,695 | java | package com.sreeram.kafka.springbootkafkaconsumerexample.config;
import com.sreeram.kafka.springbootkafkaconsumerexample.models.User;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.kafka.support.serializer.JsonDeserializer;
import org.springframework.kafka.support.serializer.JsonSerializer;
import java.util.HashMap;
import java.util.Map;
@EnableKafka
@Configuration
public class KafkaConfiguration {
@Bean
public ConsumerFactory<String,String> consumerFactory(){
Map<String,Object> config = new HashMap<>();
config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,"127.0.0.1:9092");
config.put(ConsumerConfig.GROUP_ID_CONFIG,"group_id");
config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringSerializer.class);
config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringSerializer.class);
return new DefaultKafkaConsumerFactory<>(config);
}
@Bean
public ConcurrentKafkaListenerContainerFactory<String,String> concurrentKafkaListenerContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String,String> factory = new ConcurrentKafkaListenerContainerFactory();
factory.setConsumerFactory(consumerFactory());
return factory;
}
@Bean
public ConsumerFactory<String, User> userConsumerFactory() {
Map<String,Object> config = new HashMap<>();
config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,"127.0.0.1:9092");
config.put(ConsumerConfig.GROUP_ID_CONFIG,"group_id");
config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringSerializer.class);
config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonSerializer.class);
return new DefaultKafkaConsumerFactory<>(config,new StringDeserializer(),new JsonDeserializer<>(User.class));
}
@Bean
public ConcurrentKafkaListenerContainerFactory<String,User> userConcurrentKafkaListenerContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String,User> factory = new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(userConsumerFactory());
return factory;
}
}
| [
"[email protected]"
] | |
67e7dae56b0bbe0e35aa7dffc9866b3c6832d012 | 8e099d4761f54f4285005a6d44d07d7fea929341 | /src/main/java/be/company/fca/service/impl/TraceServiceImpl.java | 423766ee60db3d57af68f2e2f1178d09870e4fb4 | [] | no_license | tenniscorponamur/championshipEngine | 86524f73dd05e2bd541ce20fd6634762d85295e3 | 3469ab497fdc8834de6f62f3c9da8c88f84545c8 | refs/heads/master | 2022-09-27T18:17:23.654462 | 2020-11-06T07:29:19 | 2020-11-06T07:29:19 | 169,879,560 | 0 | 0 | null | 2022-09-08T00:59:35 | 2019-02-09T15:15:22 | Java | UTF-8 | Java | false | false | 2,057 | java | package be.company.fca.service.impl;
import be.company.fca.model.Membre;
import be.company.fca.model.Trace;
import be.company.fca.model.User;
import be.company.fca.repository.TraceRepository;
import be.company.fca.repository.UserRepository;
import be.company.fca.service.TraceService;
import be.company.fca.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Service
@Transactional(readOnly = true)
public class TraceServiceImpl implements TraceService {
@Autowired
TraceRepository traceRepository;
@Autowired
private UserService userService;
@Autowired
private UserRepository userRepository;
@Override
@Transactional(readOnly = false)
public Trace addTrace(Authentication authentication, String type, String foreignKey, String message) {
Trace trace = new Trace();
trace.setDateHeure(new Date());
trace.setType(type);
trace.setForeignKey(foreignKey);
trace.setUtilisateur(getUsername(authentication));
trace.setMessage(message);
return traceRepository.save(trace);
}
private String getUsername(Authentication authentication){
// Ajout d'un utilisateur admin qui est present independamment de la table users de la DB
if ("admin".equals(authentication.getName().toLowerCase())){
return "admin";
}
if (userService.isAdmin(authentication)){
User user = userRepository.findByUsername(authentication.getName().toLowerCase());
return user.getPrenom() + " " + user.getNom();
}else{
Membre membreConnecte = userService.getMembreFromAuthentication(authentication);
if (membreConnecte!=null){
return membreConnecte.getPrenom() + " " + membreConnecte.getNom();
}
}
return "UNKNOWN";
}
}
| [
"[email protected]"
] | |
661d097aed32c3e7a9f777c76f86a71b978b3f7b | 4dd6e1f578e9872ae3cf17f8b79eca21806b8f26 | /foundation/src/main/java/com/dh/foundation/widget/afkimageview/AlphaAnimation.java | 7b252e1c82971cf7e2db95eae8ae9a709d439c4b | [] | no_license | wh2eat/FrameCode | 29932a9f58f4dca9d2e753a64d418543dab5daa9 | fbb0c741feb7a5d4ee86632b312fa8c78a2b0295 | refs/heads/master | 2020-08-26T14:28:31.617958 | 2018-05-08T02:27:00 | 2018-05-08T02:27:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 890 | java | package com.dh.foundation.widget.afkimageview;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
/**
* Created by lee on 2015/9/22.
*/
public class AlphaAnimation extends ToggleAnimation {
private int lastAlpha;
private int alpha;
@Override
public void setImage(Drawable drawable) {
super.setImage(drawable);
lastAlpha = 0;
alpha = 255;
}
@Override
protected void drawLastDrawable(Canvas canvas) {
lastAlpha = (int)(255 * progress);
mLastDrawable.setAlpha(lastAlpha);
mLastDrawable.draw(canvas);
}
@Override
protected void drawDrawable(Canvas canvas) {
alpha = (int)(255 * (1 - progress));
mDrawable.setAlpha(alpha);
mDrawable.draw(canvas);
}
@Override
protected void finish(Canvas canvas) {
mDrawable.draw(canvas);
}
}
| [
"[email protected]"
] | |
a1fd336146dbe0d6858ec588b462680186b15869 | 4cedfda65a73a2a98bfc49a2ce09bfec901cccc3 | /renderer/native/android/src/main/java/com/tencent/mtt/hippy/views/hippylist/recyclerview/helper/skikcy/StickViewListener.java | bab6a4d6f399dcc370f64fce59929f749cdfe694 | [
"MIT",
"Apache-2.0"
] | permissive | Tencent/Hippy | f71695fb4488ee3df273524593301d7c241e0177 | 8560a25750e40f8fb51a8abfa44aad0392ebb209 | refs/heads/main | 2023-09-03T22:24:38.429469 | 2023-09-01T04:16:16 | 2023-09-01T06:22:14 | 221,822,577 | 8,300 | 1,161 | Apache-2.0 | 2023-09-14T11:22:44 | 2019-11-15T01:55:31 | Java | UTF-8 | Java | false | false | 259 | java | package com.tencent.mtt.hippy.views.hippylist.recyclerview.helper.skikcy;
/**
* Created by on 2021/8/24.
* Description
*/
public interface StickViewListener {
void onStickAttached(int stickyPosition);
void onStickDetached(int stickyPosition);
}
| [
"[email protected]"
] | |
9be2bc8e2c2eab0281d514089c6f6a26eb9faa63 | 9ad4d57b46dbae590c9f228a93ef3f8b98ad2d31 | /takeout/src/main/java/com/hellojava/service/impl/CommodityServiceImpl.java | 282b1386f0a891d45b305724dfc3b7e2e302c8b5 | [] | no_license | 1903-fourth-group/takeout1 | 8a3045d91423b703f1beed5318fd545ad0d2153c | 9631d2e8f7b01b8b4af169b2bffb1ee6d4f58762 | refs/heads/master | 2022-06-02T18:59:47.160837 | 2019-07-20T02:38:17 | 2019-07-20T02:38:17 | 197,775,795 | 0 | 0 | null | 2021-04-26T19:20:59 | 2019-07-19T13:16:27 | Java | UTF-8 | Java | false | false | 1,905 | java | package com.hellojava.service.impl;
import com.hellojava.dao.BusinessDao.CommodityRepository;
import com.hellojava.entity.Commodity;
import com.hellojava.response.CommonCode;
import com.hellojava.response.QueryResponseResult;
import com.hellojava.response.QueryResult;
import com.hellojava.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Service
public class CommodityServiceImpl implements CommodityService {
@Autowired
private CommodityRepository commodityRepository;
@Override
public QueryResponseResult loadById(int comId) {
Optional<Commodity> byId = commodityRepository.findById(comId);
List<Commodity> C = new ArrayList<>();
if (byId.isPresent()){
Commodity commodity = new Commodity();
commodity.setComId(byId.get().getComId());
commodity.setComName(byId.get().getComName());
commodity.setComImg(byId.get().getComImg());
commodity.setComPrice(byId.get().getComPrice());
commodity.setComSalesPerMonth(byId.get().getComSalesPerMonth());
commodity.setComBus(byId.get().getComBus());
C.add(commodity);
}
QueryResult<Commodity> commodityQueryResult = new QueryResult<>();
commodityQueryResult.setList(C);
return new QueryResponseResult<>(CommonCode.SUCCESS,commodityQueryResult);
}
@Override
public QueryResponseResult findAllBycomBus(int comBus) {
List<Commodity> Commoditys = commodityRepository.findAllBycomBus(comBus);
QueryResult<Commodity> commodityQueryResult = new QueryResult<>();
commodityQueryResult.setList(Commoditys);
return new QueryResponseResult<>(CommonCode.SUCCESS,commodityQueryResult);
}
}
| [
"[email protected]"
] | |
dce4db1c989da2c3bb10531b8cc7910eb431cc5e | a7b64f2cf2a780654b09a083ee190067c4918686 | /DesignPattern/src/main/java/observer/Command.java | 541d589f47f39b77961f8dc34e5d05a0a72a34e6 | [] | no_license | Eyecandy/Design-Patterns- | d63d7b9e4c29d0f511b2131c6c9dc9a57a0a9945 | 8e42eee765c8d0af64cbc586935642ee6cb5f55f | refs/heads/master | 2020-03-09T00:45:36.777427 | 2018-07-28T10:50:41 | 2018-07-28T10:50:41 | 128,496,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 109 | java | package observer;
public enum Command {
FORM_POSITIONS,
COMBAT_FORMATION,
FIRE,
CHARGE
}
| [
"[email protected]"
] | |
a7fc2907a52e50b400364abad8c8d4038aae4d83 | e79f9006e70a2839ea7f33d6bb5ab9b9b4ade284 | /src/main/java/com/example/library/studentlibrary/Services/AuthorService.java | ffd9c71b106980f4d9bdab44831d3bcc7a14837d | [] | no_license | shreya2099/LibraryManagementSystem | 7ad357c4dbef523b903508963fa807f3dbd49d36 | a1baa1345be96b8c2f32e338cfcda7fa8ef7a3c1 | refs/heads/master | 2023-04-19T10:20:37.188503 | 2021-05-11T20:24:42 | 2021-05-11T20:24:42 | 360,927,319 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package com.example.library.studentlibrary.Services;
import com.example.library.studentlibrary.Model.Author;
import com.example.library.studentlibrary.Repository.AuthorRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AuthorService {
@Autowired
AuthorRepository authorRepository;
public void create(Author author){
authorRepository.save(author);
}
}
| [
"[email protected]"
] | |
bfbc0de2a11b4bbeaa08c50a93ae66a0f5d3eeb4 | 1ccbba94f0188d3252a3ab0fe8170abf504171ce | /design_pattern/src/main/java/com/design/demo/creatorPattern/factory/manoeuvre/Product.java | e984af4e8518cf7dfa9478977cc7ee636498bb23 | [] | no_license | cleverwo/codeDemo | 4a1b57d270d43a558db30ff62014a1215abcad37 | bf33a17560fea4f1df8fa99ee9906718f549d8fd | refs/heads/master | 2023-07-04T00:26:04.067698 | 2023-06-16T15:57:24 | 2023-06-16T15:57:24 | 220,234,117 | 1 | 0 | null | 2022-06-29T18:50:05 | 2019-11-07T12:39:36 | Java | UTF-8 | Java | false | false | 353 | java | package com.design.demo.creatorPattern.factory.manoeuvre;
/**
* @Auther: wangzhendong
* @Date: 2019/10/11 19:25
* @Description:
*/
public abstract class Product {
//产品共有逻辑
public void method(){
//公共逻辑
System.out.println("product start");
}
//抽象方法
public abstract void method2();
}
| [
"[email protected]"
] | |
1c45520aa63e78d13caae94b832b8f4818b113a8 | 688fd6a72dc86fdfee21063180a6287d1ed3b026 | /AlYou/src/com/imalu/alyou/net/response/AssociationSearchResponse.java | a182c6a55f26c46feada1c8da11eaa17bef45854 | [] | no_license | zzsier/AlYou | 336765683cad29f54cbb372f6b29f59affdaf69b | 9fe5ac53d490f94d50a749102170be0bd3ef0cea | refs/heads/master | 2021-01-22T06:55:08.407651 | 2015-02-10T07:03:12 | 2015-02-10T07:03:12 | 27,323,836 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package com.imalu.alyou.net.response;
import org.json.JSONException;
import com.imalu.alyou.net.NetObject;
public class AssociationSearchResponse extends NetObject{
public int getId() {
try {
return this.getJsonObject().getInt("Id");
} catch (JSONException e) {
// TODO Auto-generated catch block
return 0;
}
}
public int getJifen() {
try {
return this.getJsonObject().getInt("jifen");
} catch (JSONException e) {
// TODO Auto-generated catch block
return 0;
}
}
public String getSocietyName() {
try {
return this.getJsonObject().getString("SocietyName");
} catch (Exception e) {
// TODO Auto-generated catch block
return "";
}
}
public String getSocietySummary() {
try {
return this.getJsonObject().getString("SocietySummary");
} catch (Exception e) {
// TODO Auto-generated catch block
return "";
}
}
public String getKey() {
try {
return this.getJsonObject().getString("Key");
} catch (Exception e) {
// TODO Auto-generated catch block
return "";
}
}
}
| [
"Administrator@XT1-20141107UYY"
] | Administrator@XT1-20141107UYY |
e5d602bac52b6c422a4613b9c713d87fc1ed0bda | ebfff291a6ee38646c4d4e176f5f2eddf390ace4 | /orange-demo-flowable/orange-demo-flowable-service/common/common-online/src/main/java/com/flow/demo/common/online/object/SqlTable.java | 47c23750b78b77b0906f326b2e42bd6b845b1fc3 | [
"Apache-2.0"
] | permissive | jiazhizhong/orange-admin | a9d6b5b97cbea72e8fcb55c081b7dc6a523847df | bbe737d540fb670fd4ed5514f7faed4f076ef3d4 | refs/heads/master | 2023-08-21T11:31:22.188591 | 2021-10-30T06:06:40 | 2021-10-30T06:06:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package com.flow.demo.common.online.object;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 数据库中的表对象。
*
* @author Jerry
* @date 2021-06-06
*/
@Data
public class SqlTable {
/**
* 表名称。
*/
private String tableName;
/**
* 表注释。
*/
private String tableComment;
/**
* 创建时间。
*/
private Date createTime;
/**
* 关联的字段列表。
*/
private List<SqlTableColumn> columnList;
/**
* 数据库链接Id。
*/
private Long dblinkId;
}
| [
"[email protected]"
] | |
b3acf659201d4dafe4a3c24b8e954a00040f6dd0 | fe13060de7bac91c9b38f5b4b8c169e4e69ce626 | /common/BlockCS.java | 7f5b16f0378fa4b53e1ab2499a9ff2bb704916e2 | [] | no_license | ADennis87/Dimension-Mod | 6795e40e870719fb55d442ed4779407a46eb1343 | 3f2b99d70a98e25e506bbf49548cc83217edf6d5 | refs/heads/master | 2021-01-01T18:54:09.289800 | 2013-01-03T23:32:18 | 2013-01-03T23:32:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 991 | java | package ninjapancakes87.morestuff.common;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.src.*;
import net.minecraft.world.World;
public class BlockCS extends Block {
public BlockCS(int par1, int par2){
super(par1, par2, Material.rock);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setHardness(15);
this.setResistance(15F);
this.setStepSound(this.soundMetalFootstep);
}
/*public int GetBlockTextureFromSideAndMetadata (int i, int j){
switch(i){
case 1: mod_MoreStuff.CSTop;
defualt: mod_MoreStuff.CSSide;
}
}*/
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer) {
ModLoader.openGUI(entityplayer, new GUIComponetSeperator(null));
}
@Override
public String getTextureFile(){
return "/gfx/MoreStuff/blocks.png";
}
} | [
"[email protected]"
] | |
57aab9af03414ce8e562123addc2b00f714ffb25 | 2bc88a24998687d5284334061b0a4e6b0c1f77ba | /app/src/main/java/ffadilaputra/org/bottom_toolbar/fragment/HomeFragment.java | ca7e47a90a4a6844f1b5efed2e43e3fe5330b1db | [
"WTFPL"
] | permissive | ffadilaputra/uhuy | cab94d2298ab2505eb9a9de454ee158223473f50 | ec65ae500aca07142fbd1afc470e2d0eccd19c4d | refs/heads/master | 2020-03-30T09:25:04.096296 | 2018-12-14T00:29:24 | 2018-12-14T00:29:24 | 151,074,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,828 | java | package ffadilaputra.org.bottom_toolbar.fragment;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.PlaceLikelihood;
import com.google.android.gms.location.places.PlaceLikelihoodBuffer;
import com.google.android.gms.location.places.Places;
import com.google.android.gms.location.places.ui.PlaceAutocomplete;
import com.google.android.gms.location.places.ui.PlaceAutocompleteFragment;
import com.google.android.gms.location.places.ui.PlaceSelectionListener;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import java.util.ArrayList;
import ffadilaputra.org.bottom_toolbar.R;
import ffadilaputra.org.bottom_toolbar.adapter.PlacesAdapter;
import static android.app.Activity.RESULT_OK;
public class HomeFragment extends Fragment implements GoogleApiClient.OnConnectionFailedListener, GoogleApiClient.ConnectionCallbacks,PlaceSelectionListener {
private RecyclerView recyclerView;
private static final String LOG_TAG = "CardFragment";
protected GoogleApiClient mGoogleApiClient;
private static final int PERMISSION_REQUEST_CODE = 100;
PlacesAdapter adapter = null;
private ArrayList<Place> place = new ArrayList<>();
private static final LatLngBounds ALAMAT = new LatLngBounds(
new LatLng(-7.946529 , 112.615537), new LatLng(37.430610, -121.972090));
private static final int REQUEST_SELECT_PLACE = 1000;
private TextView locationTextView;
private TextView attributionsTextView;
public static HomeFragment newInstance(String param1, String param2) {
HomeFragment fragment = new HomeFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGoogleApiClient = new GoogleApiClient.Builder(getContext())
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.addApi(Places.PLACE_DETECTION_API)
.addApi(Places.GEO_DATA_API)
.build();
mGoogleApiClient.connect();
adapter = new PlacesAdapter(place);
retrievePlaces();
}
private void retrievePlaces() throws SecurityException {
PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi.getCurrentPlace(mGoogleApiClient, null);
result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
@Override
public void onResult(@NonNull PlaceLikelihoodBuffer likelyPlaces) {
for (PlaceLikelihood placeLikelihood : likelyPlaces) {
place.add(placeLikelihood.getPlace().freeze());
Log.i("Place = ", placeLikelihood.getPlace().getName().toString());
}
adapter.notifyDataSetChanged();
likelyPlaces.release();
}
});
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_place_list,container,false);
recyclerView = (RecyclerView)view.findViewById(R.id.places_lst);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(adapter);
PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)getActivity().
getFragmentManager().findFragmentById(R.id.place_fragment);
autocompleteFragment.setOnPlaceSelectedListener(this);
autocompleteFragment.setHint("Search a Location");
autocompleteFragment.setBoundsBias(ALAMAT);
return view;
}
@Override
public void onConnected(@Nullable Bundle bundle) {
int hasPermission = 0;
hasPermission = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION);
if (hasPermission != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSION_REQUEST_CODE);
} else {
Log.i("Client Connection", "Connected to GoogleClient");
}
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Log.e(LOG_TAG, "Google Places API connection failed with error code: " + connectionResult.getErrorCode());
Toast.makeText(getActivity(), "Google Places API connection failed with error code:" + connectionResult.getErrorCode(), Toast.LENGTH_LONG).show();
}
@Override
public void onPlaceSelected(Place place) {
Log.i(LOG_TAG, "Place Selected: " + place.getName());
locationTextView.setText(getString(R.string.formatted_place_data, place
.getName(), place.getAddress(), place.getPhoneNumber(), place
.getWebsiteUri(), place.getRating(), place.getId()));
if (!TextUtils.isEmpty(place.getAttributions())){
attributionsTextView.setText(Html.fromHtml(place.getAttributions().toString()));
}
}
@Override
public void onError(Status status) {
Log.e(LOG_TAG, "onError: Status = " + status.toString());
Toast.makeText(getActivity(), "Place selection failed: " + status.getStatusMessage(),
Toast.LENGTH_SHORT).show();
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_SELECT_PLACE) {
if (resultCode == RESULT_OK) {
Place place = PlaceAutocomplete.getPlace(getActivity(), data);
this.onPlaceSelected(place);
} else if (resultCode == PlaceAutocomplete.RESULT_ERROR) {
Status status = PlaceAutocomplete.getStatus(getActivity(), data);
this.onError(status);
}
}
super.onActivityResult(requestCode, resultCode, data);
}
}
| [
"[email protected]"
] | |
ee93d3d3eed3d15ecc4f2ef7301af37790830624 | 221007e767048fe39c4a6554d76ffa9d1fa76ce4 | /app/src/androidTest/java/com/ckc/ersin/bebetrack/ApplicationTest.java | 999219d58d166edae9f88f29eb5d911b5c8f21fd | [] | no_license | ersin88888/bebetrack | a2d07e45eeefb6ffef01637bd253f459e8e328ea | bc0b68fe6f2acac582a55490b4bc7bdc88aab91d | refs/heads/master | 2021-01-10T11:50:14.715699 | 2016-02-14T16:54:26 | 2016-02-14T16:54:26 | 51,699,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package com.ckc.ersin.bebetrack;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
73fc2ceee37280a474649bcb598ec085473a255b | 0fdd5270dc26b1635f9249a2f3712b353167e72a | /oauth2-sso/oauth2-sso-server/src/test/java/com/liaozl/demo/oauth2sso/server/Oauth2SsoServerApplicationTests.java | 21fd78b015c7a001742bdfc16c71d9d2ea0a026f | [] | no_license | liaozuliang/liaozl-demo | 30486e881fd271beaad514f76f82fa362f7b3724 | 04797a9768a1eab1c4bb3ad15d9a36badcf212bd | refs/heads/master | 2022-06-29T07:03:53.013221 | 2020-08-14T04:29:15 | 2020-08-14T04:29:15 | 187,561,053 | 0 | 0 | null | 2022-06-21T01:10:08 | 2019-05-20T03:23:08 | Java | UTF-8 | Java | false | false | 242 | java | package com.liaozl.demo.oauth2sso.server;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Oauth2SsoServerApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
c587505c3ebbb686b3ab1b80fbe528cf932c99b7 | ab768051ac546be7075a0d62d46b93bd72b9e77c | /src/main/java/com/javatpoint/SpringBootJpaApplication.java | 3af4d5535b836477001fc3e6261ef9568c043434 | [] | no_license | NasserAAA/integrantTraining | 5a99cf6f1e0b18f1f0d063c775ef2fb05f87e7d6 | e8401507fcdc1716f33c1dd7ded4dfeea6096a76 | refs/heads/master | 2020-07-16T23:29:52.307503 | 2019-09-02T11:58:45 | 2019-09-02T11:58:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,212 | java | package com.javatpoint;
import java.util.Properties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import kafka.javaapi.producer.Producer;
import kafka.producer.ProducerConfig;
@EnableAutoConfiguration(exclude = {SecurityAutoConfiguration.class})
@SpringBootApplication
public class SpringBootJpaApplication {
public static void main(String[] args) throws InterruptedException {
ConfigurableApplicationContext context =SpringApplication.run(SpringBootJpaApplication.class, args);
String api=args[1];
String apiSecret=args[2];
String accessToken=args[3];
String accessTokenSecret=args[4];
Thread myThread=new Thread(new Runnable() {
@Override
public void run() {
TwitterKafkaConsumer tfc=context.getBean(TwitterKafkaConsumer.class);
tfc.initialize();
tfc.consume();
}
});
Thread myThread2=new Thread(new Runnable() {
@Override
public void run() {
TwitterKafkaProducer tfp= context.getBean(TwitterKafkaProducer.class);
Properties props = new Properties();
props.put("metadata.broker.list","localhost:9092");
props.put("serializer.class","kafka.serializer.StringEncoder");
props.put("bootstrap.servers", "localhost:9092");
tfp.initializeSentiment();
ProducerConfig producerConfig = new ProducerConfig(props);
Producer<String, String>producer = new Producer<String, String>(producerConfig);
try {
tfp.PushTwittermessage(producer,api, apiSecret, accessToken, accessTokenSecret);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
myThread.start();
myThread2.start();
}
@Bean
public TwitterKafkaConsumer twitterConsumer() {
return new TwitterKafkaConsumer();
}
} | [
"[email protected]"
] | |
b7a4533f05c8eb552574d772b160a6d6c9a21ab0 | 150d63b6f7e40366c147675e81f385a3bd731996 | /src/VoidMethodTest.java | 47be12731f2193ded3f070aa3c95798d9ccd403e | [] | no_license | dizzygogoi/unittest | 338bc11219ee2ed9fe46d43a589a1cea9b600ca8 | cc141a763728e82e4e3bfbde22a1812d15580fee | refs/heads/master | 2022-12-15T12:51:19.145544 | 2020-09-23T06:19:41 | 2020-09-23T06:19:41 | 297,860,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,147 | java |
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.NoSuchElementException;
public class VoidMethodTest {
private VoidMethodClass lstPersons = new VoidMethodClass();
@Before
public void initialize()
{
lstPersons.add("Chetan");
lstPersons.add("Aditya");
lstPersons.add("Parth");
}
@After
public void destroy() {lstPersons.removeAll(); }
@Test
public void testSizeMethod(){
int expected=3;
Assert.assertEquals(expected,lstPersons.size());
}
@Test
public void testAddMethod(){
lstPersons.add("Ritesh");
int expected=4;
Assert.assertEquals(expected,lstPersons.size());
}
@Test
public void testRemoveMethodWorking(){
lstPersons.remove("Chetan");
int expected =2;
Assert.assertEquals(expected,lstPersons.size());
}
@Test(expected = NoSuchElementException.class)
public void testRemoveMethodForException(){
lstPersons.remove("Abc");
int expected =2;
Assert.assertEquals(expected,lstPersons.size());
}
}
| [
"[email protected]"
] | |
0b10041a26f8b5139578fa7da61092e265477412 | c01611b15315e4e32b978fe55df53694de7d80dd | /generator/src/main/java/net/matthoyt/database/writer/csharp/ColumnProcessor.java | b470562ddaa59ea20485fb5243e207f37fe62644 | [
"Apache-2.0"
] | permissive | mrh0057/mrh-database | 2ae6fe41f729439d817a49caa7352dba8ab23efe | 7a83b3bf75edea33d67d6ecf3b4e10eb02dcc144 | refs/heads/master | 2020-12-24T15:49:55.649056 | 2016-03-20T01:04:44 | 2016-03-20T01:04:44 | 39,911,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,160 | java | package net.matthoyt.database.writer.csharp;
import net.matthoyt.database.writer.Column;
import net.matthoyt.database.writer.DbGen;
import net.matthoyt.database.writer.Helpers;
import net.matthoyt.database.writer.SqlTranslation;
import java.util.ArrayList;
import java.util.List;
public class ColumnProcessor
{
/**
* Used to process the columns for the dbgen information.
*
* @param dbGen The config generation information.
* @return The columns to generate.
*/
public static CsharpModel processColumns(CsharpModel model, DbGen dbGen)
{
List<CsharpColumn> csharpColumns = new ArrayList<>(dbGen.columns.length);
List<CsharpColumn> insertColumns = new ArrayList<>(dbGen.columns.length);
List<CsharpColumn> updateColumns = new ArrayList<>(dbGen.columns.length);
for (Column column : dbGen.columns)
{
CsharpColumn csharpColumn = new CsharpColumn();
csharpColumns.add(csharpColumn);
csharpColumn.name = NameCleaner.cleanName(column.name);
csharpColumn.rawName = column.name;
csharpColumn.isAutoIncrement = column.isAutoIncrement;
csharpColumn.isReadOnly = column.isReadOnly;
csharpColumn.isPrimaryKey = dbGen.primaryKeys.contains(column.name);
if (dbGen.primaryKeys.contains(column.name))
{
model.primaryKey = csharpColumn;
}
csharpColumn.isNullable = column.isNullable;
SqlTranslation dataType = SqlToCsharpTypes.SqlTypeToDatType(column.type);
SqlTranslation readFunction = SqlToCsharpTypes.SqlTypeToRead(column.type);
if (column.isNullable)
{
csharpColumn.dataType = dataType.nullableType;
csharpColumn.rawDataType = dataType.valueType;
csharpColumn.readFunction = readFunction.nullableType;
} else
{
csharpColumn.dataType = dataType.valueType;
csharpColumn.rawDataType = dataType.valueType;
csharpColumn.readFunction = readFunction.valueType;
}
if (dbGen.enumModels.containsKey(column.name))
{
csharpColumn.dataType = Helpers.concatCbased(dbGen.enumModels.get(column.name));
csharpColumn.castType = true;
if (column.isNullable)
{
csharpColumn.dataType += "?";
}
}
csharpColumn.offset = column.offset;
if (!column.isAutoIncrement && column.isWriteAble)
{
insertColumns.add(csharpColumn);
if (!dbGen.primaryKeys.contains(column.name))
{
updateColumns.add(csharpColumn);
}
}
}
model.columns = csharpColumns.toArray(new CsharpColumn[csharpColumns.size()]);
model.insertColumns = insertColumns.toArray(new CsharpColumn[insertColumns.size()]);
model.updateColumns = updateColumns.toArray(new CsharpColumn[updateColumns.size()]);
return model;
}
}
| [
"[email protected]"
] | |
e12e0c2d75bf9c7d8f5f554d359d64de857f0fcd | 5bf355448f4e5d823e972741ce096b654ef88faf | /EconomyNPC/src/com/resolutiongaming/util/TokenHandler.java | b86876c47a64ecea9444c684c72b85a279dc9120 | [] | no_license | pdelcol/EconomyNPC | ee7f169b75be8d6090fbc0cbe7891a43be452ff6 | 1350f093815dac09df238634a92810b61d4ac65a | refs/heads/master | 2021-05-28T01:22:05.343490 | 2014-05-14T04:38:34 | 2014-05-14T04:38:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,948 | java | package com.resolutiongaming.util;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Map;
public class TokenHandler {
public Map<String, Integer> tokens = new HashMap<String, Integer>();
//Constructor
public TokenHandler()
{
//We dont need anything here for right now
}
//Load the tokens
public void load()
{
try
{
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("plugins/EconomyNPC/Token_List.bin"));
Object result = ois.readObject();
tokens = (Map<String, Integer>)result;
ois.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
//Save the tokens
public void save()
{
try
{
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("plugins/EconomyNPC/Token_List.bin"));
oos.writeObject(tokens);
oos.flush();
oos.close();
//Handle I/O exceptions
}
catch(Exception e)
{
e.printStackTrace();
}
}
//Check to see if the player is in the token list
public void checkName(String playerName)
{
if(!tokens.containsKey(playerName))
{
tokens.put(playerName, 0);
}
}
//Get the number of tokens for a given player
public int getNumTokens(String playerName)
{
if(tokens.get(playerName) == null)
{
tokens.put(playerName, 0);
}
return tokens.get(playerName);
}
//Add tokens to a given players account
public void addTokens(String playerName, int numTokens)
{
if(tokens.containsKey(playerName))
{
tokens.put(playerName, tokens.get(playerName) + numTokens);
}
}
//Remove tokens from a given players account
public boolean removeTokens(String playerName, int numTokens)
{
if(tokens.containsKey(playerName))
{
if(tokens.get(playerName) >= numTokens){
tokens.put(playerName, tokens.get(playerName) - numTokens);
return true;
}
return false;
}
return false;
}
}
| [
"[email protected]"
] | |
fe3e1e1d207b99e723142d06d12f5f225a72718e | 96a1fac3edfd19de36a1fa4f88b8f8cccd624b68 | /app/src/main/java/com/stylehair/nerdsolutions/stylehair/telas/agendamento/horarios/viewHolderServicoAgendaHorarios.java | 385cefeaa0e8ecef8b0e30f2ec5a60b13b61e92b | [] | no_license | driguin10/StyleHairApp | 38c83c757f3f299e4a925b2ebdea6a4dbd541da5 | 3e544a39e6ab8b342f323d19a6edd67fd7921db6 | refs/heads/master | 2021-09-23T14:29:15.143643 | 2018-09-24T14:39:43 | 2018-09-24T14:39:43 | 127,162,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,331 | java | package com.stylehair.nerdsolutions.stylehair.telas.agendamento.horarios;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.stylehair.nerdsolutions.stylehair.R;
import com.stylehair.nerdsolutions.stylehair.telas.agendamento.confirmar.confirma_agendamento;
import org.joda.time.Hours;
import org.joda.time.LocalTime;
import java.util.ArrayList;
public class viewHolderServicoAgendaHorarios extends ViewHolder implements View.OnClickListener {
TextView hora;
CardView card;
Context contexto;
ArrayList<String> ListaHorario;
RecyclerView lista;
String tempo;
String intervalo;
String AlmocoIni;
String AlmocoFim;
LocalTime ultimo;
TextView txtHoraEscolhido;
Button Prosseguir;
String idServicos;
String idFuncionario;
String idSalao;
ArrayList<String> vetAux;
ArrayList<String> ServicosLista;
String Data;
String NomeFuncionario;
String Imagemfuncionario;
public viewHolderServicoAgendaHorarios(View itemView, ArrayList<String> dados,Button prosseguir,ArrayList<String> vet) {
super(itemView);
hora = (TextView) itemView.findViewById(R.id.horario);
card = (CardView) itemView.findViewById(R.id.cardsHorarioEscolhido);
card.setOnClickListener(this);
Prosseguir = prosseguir;
Prosseguir.setOnClickListener(this);
ListaHorario = dados;
contexto = itemView.getContext();
itemView.setOnClickListener(this);
vetAux = vet;
}
@Override
public void onClick(View v) {
final int position = getAdapterPosition();
if(v.getId() == card.getId())
{
vetAux.clear();
ArrayList<String> ListaHorarioAux = ListaHorario;
LocalTime HoraSelect = LocalTime.parse(ListaHorarioAux.get(position));
LocalTime HoraIntervalo = LocalTime.parse(intervalo);
LocalTime HoraTotalServico = LocalTime.parse(tempo);
LocalTime HoraAlmocoIni = new LocalTime();
if(AlmocoIni !=null){
HoraAlmocoIni = LocalTime.parse(AlmocoIni);
}
//LocalTime HoraAlmocoFim = LocalTime.parse(AlmocoFim);
int ver = 0;
for (int x = 0; x < ListaHorarioAux.size(); x++) {
if (ListaHorarioAux.get(x).equals(ultimo.toString()))
ver = 1;
}
if (ver == 0) {
ListaHorarioAux.add(ultimo.toString());
}
LocalTime proximaTempo = HoraSelect.plusHours(HoraTotalServico.getHourOfDay())
.plusMinutes(HoraTotalServico.getMinuteOfHour());
vetAux.add(HoraSelect.toString());
int posAux = 0;
int flag = 0;
for (int x = position + 1; x < ListaHorarioAux.size(); x++) {
LocalTime Hvetor = LocalTime.parse(vetAux.get(posAux));
LocalTime soma = Hvetor.plusHours(HoraIntervalo.getHourOfDay())
.plusMinutes(HoraIntervalo.getMinuteOfHour());
Boolean flagHorarioPertoAlmoco = false;
if(AlmocoIni != null) {
if (proximaTempo.compareTo(HoraAlmocoIni) == -1 || proximaTempo.compareTo(HoraAlmocoIni) == 0 && proximaTempo.equals(HoraAlmocoIni)) {
flagHorarioPertoAlmoco = true;
}
}
if (soma.toString().equals(LocalTime.parse(ListaHorarioAux.get(x)).toString())) {
if (LocalTime.parse(ListaHorarioAux.get(x)).toString().equals(proximaTempo.toString()) || flagHorarioPertoAlmoco) {
vetAux.add(ListaHorarioAux.get(x));
flag = 1;
break;
} else {
vetAux.add(ListaHorarioAux.get(x));
posAux++;
}
} else {
break;
}
}
if (flag == 1) {
Toast.makeText(contexto, "horario disponivel !", Toast.LENGTH_LONG).show();
txtHoraEscolhido.setText(ListaHorarioAux.get(position).substring(0, 5));
Prosseguir.setEnabled(true);
Prosseguir.setAlpha(1f);
} else {
Toast.makeText(contexto, "O serviço não pode ser feito neste horario!", Toast.LENGTH_LONG).show();
txtHoraEscolhido.setText("");
Prosseguir.setEnabled(false);
Prosseguir.setAlpha(.4f);
}
}
else
if(v.getId() == Prosseguir.getId())
{
LocalTime HoraInicioServico = LocalTime.parse(vetAux.get(0));
//somar horarios do servicolista e somar a horainicio para dar o tempo de serviço
LocalTime horaFimAux = HoraInicioServico;
for(int x=0;x<ServicosLista.size();x++)
{
LocalTime Hservico = LocalTime.parse(ServicosLista.get(x).split("#")[3]);
horaFimAux = horaFimAux.plusHours(Hservico.getHourOfDay())
.plusMinutes(Hservico.getMinuteOfHour());
}
Intent intent = new Intent(contexto,confirma_agendamento.class);
intent.putExtra("idSalao",idSalao);
intent.putExtra("idFuncionario",idFuncionario);
intent.putExtra("idServicos",idServicos);
intent.putStringArrayListExtra("listaServicos",ServicosLista);// lista dos serviços que vai ser prestado
intent.putExtra("horaIni",HoraInicioServico.toString().substring(0,5));
intent.putExtra("horaFim",horaFimAux.toString().substring(0,5));
intent.putExtra("data",Data);
intent.putExtra("nomeFuncionario",NomeFuncionario);
intent.putExtra("imagemFuncionario",Imagemfuncionario);
contexto.startActivity(intent);
}
}
}
| [
"[email protected]"
] | |
9c9b4a78bf11a0e8de2bf496f19539a2e11d89da | e75567eb17e621a20b537ca060eef437da6f91de | /cooperativa-model/cooperativa-model-api/src/main/java/org/sistcoop/cooperativa/models/DetalleTransaccionClienteModel.java | 81dd411f60b4535130837f8f71a7a5ceb7c605f0 | [] | no_license | sistcoop/cooperativa | 2e9019cb54f8f0ec5fbccfede49b33ffb0691562 | 6b579b89a22725865c1f4fee6aebcd745a7e292e | refs/heads/master | 2016-09-03T06:33:26.543651 | 2015-10-22T22:56:11 | 2015-10-22T22:56:11 | 33,275,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 297 | java | package org.sistcoop.cooperativa.models;
import java.math.BigDecimal;
public interface DetalleTransaccionClienteModel extends Model {
String getId();
BigDecimal getValor();
int getCantidad();
BigDecimal getSubtotal();
TransaccionClienteModel getTransaccionCliente();
}
| [
"[email protected]"
] | |
b528c9b551e2b5cdc9eae3cfa1c37a5f32054c6c | b744465494b27c06e653dd3f409c0ba311326bde | /src/gol/ui/GridEvent.java | dd84da59d404e2018d1d978dac36500e93fecb5b | [] | no_license | Knifa/GameOfLife | 4df6f88834f72f64f6b71306803d74d9ee3cc3e5 | b35cdd90b09b245dddae45176dc2dd234dd9ae23 | refs/heads/master | 2020-06-04T15:57:24.522498 | 2013-02-10T00:18:33 | 2013-02-10T00:18:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package gol.ui;
import java.util.EventObject;
/**
* Event fired when a ColorGrid is clicked on.
*/
public class GridEvent extends EventObject {
private int x;
private int y;
/**
* Constructor.
* @param source Source of this event.
* @param x X-coord where the grid was clicked on.
* @param y Y-coord where the grid was clicked on.
*/
public GridEvent(Object source, int x, int y) {
super(source);
this.x = x;
this.y = y;
}
/**
* Returns the grid X-coord.
* @return Grid X-coord.
*/
public int getX() {
return this.x;
}
/**
* Returns the grid Y-coord.
* @return Grid Y-coord.
*/
public int getY() {
return this.y;
}
} | [
"[email protected]"
] | |
0019dfae7d28130bd4cde3495cd049d539ab868d | 2f035028c4dab2ee905cc7a9463df718ecd81a49 | /src/main/java/com/github/havardh/javaflow/phases/verifier/ClassGetterNamingVerifier.java | a1c5afade28e5808f30943bb7aae898f274ae0aa | [] | no_license | misino/javaflow | bfff41d53a89c10ee2ba2ceac35462d2b544b4dd | 63d9edbb94688903691a33ad0ac3c2b4754f2a0e | refs/heads/master | 2021-01-19T23:41:28.460220 | 2018-08-15T22:13:39 | 2018-08-15T22:13:39 | 89,010,550 | 0 | 0 | null | 2017-04-21T18:02:19 | 2017-04-21T18:02:19 | null | UTF-8 | Java | false | false | 3,278 | java | package com.github.havardh.javaflow.phases.verifier;
import static java.lang.String.format;
import static java.util.Collections.singletonList;
import java.util.ArrayList;
import java.util.List;
import com.github.havardh.javaflow.ast.Class;
import com.github.havardh.javaflow.ast.Field;
import com.github.havardh.javaflow.ast.Method;
import com.github.havardh.javaflow.ast.Type;
import com.github.havardh.javaflow.exceptions.AggregatedException;
import com.github.havardh.javaflow.exceptions.FieldGettersMismatchException;
public class ClassGetterNamingVerifier implements Verifier {
@Override
public void verify(List<Type> types) {
List<Exception> exceptions = new ArrayList<>();
for (Type type : types) {
if (type instanceof Class) {
exceptions.addAll(validate((Class) type));
}
}
if (!exceptions.isEmpty()) {
throw new AggregatedException("Class getter naming validation failed with following errors:\n", exceptions, true);
}
}
private List<Exception> validate(Class classToValidate) {
List<Method> getters = classToValidate.getGetters();
List<Field> fields = classToValidate.getFields();
if (getters.size() != fields.size()) {
return singletonList(new FieldGettersMismatchException(classToValidate.getCanonicalName(), format(
"Number of getters and fields is not the same.\n" +
"Fields in model: %s\n" +
"Getters in model: %s",
fields,
getters
)));
}
List<Exception> exceptions = new ArrayList<>();
for (Method getter : getters) {
try {
Field correspondingField = findFieldByGetter(classToValidate, fields, getter);
if (!correspondingField.getType().equals(getter.getType())) {
throw new FieldGettersMismatchException(
classToValidate.getCanonicalName(),
format(
"Type of getter %s (%s) does not correspond to field %s (%s)",
getter.getName(),
getter.getType(),
correspondingField.getName(),
correspondingField.getType()
)
);
}
} catch (FieldGettersMismatchException e) {
exceptions.add(e);
}
}
return exceptions;
}
private Field findFieldByGetter(Class classToValidate, List<Field> fields, Method getter)
throws FieldGettersMismatchException {
return fields.stream()
.filter(field -> field.getName().equals(convertGetterNameToFieldName(getter.getName())))
.findFirst()
.orElseThrow(() -> new FieldGettersMismatchException(
classToValidate.getCanonicalName(),
format("Name of getter %s does not correspond to any field name.", getter.getName())
));
}
private static String convertGetterNameToFieldName(String getterName) {
if (getterName.startsWith("get") && getterName.length() > 3) {
return Character.toLowerCase(getterName.charAt(3)) + (getterName.length() > 4 ? getterName.substring(4) : "");
}
if (getterName.startsWith("is") && getterName.length() > 2) {
return Character.toLowerCase(getterName.charAt(2)) + (getterName.length() > 4 ? getterName.substring(3) : "");
}
return getterName;
}
}
| [
"[email protected]"
] | |
d10c0c7ecf5eb534350fd8545defc71fbe11f856 | dfafddba00d2ec44be4f17f9352f1b45a818eb9d | /src/com/puwd/behavior/strategy/behavior/color/WhiteColorBehavior.java | b4b7b317a781a203625507363ace36c2b0161ed1 | [] | no_license | puwd-git/design-pattern | abdb6d9ded2815626fe98ebf0eda11a66b9dd562 | 3d8e7f7b543232fcfd1ec03d66e6dd56da7bc573 | refs/heads/master | 2023-03-27T12:19:42.085607 | 2021-03-24T12:18:46 | 2021-03-24T12:18:46 | 350,239,905 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package com.puwd.behavior.strategy.behavior.color;
import com.puwd.behavior.strategy.behavior.color.ColorBehavior;
/**
* @author Administrator
*/
public class WhiteColorBehavior implements ColorBehavior {
@Override
public void color() {
System.out.println("白色的!");
}
}
| [
"[email protected]"
] | |
80f521fbe553db1fc5fc53d2a939a4cbe155f2e4 | 0b97409901c47b520b33558ae2d3a3f16479c142 | /FiapStore/src/main/java/com/fiap/demo/Model/Pedido.java | 422dfc27eb946e5cae3c3f88a6e4949a4ab53c12 | [] | no_license | paulosthiven25/DBE-DigitalBusinessEnablement- | e57b75a06015fef0a64ba3b90439389c162127d2 | 67d0787d085053b22612f05bce607920feaad0f6 | refs/heads/master | 2022-12-01T04:23:45.858460 | 2019-10-01T15:04:41 | 2019-10-01T15:04:41 | 183,063,887 | 0 | 0 | null | 2022-11-24T08:16:34 | 2019-04-23T17:27:31 | Java | UTF-8 | Java | false | false | 1,793 | java | package com.fiap.demo.Model;
import com.fiap.demo.Model.Cliente;
import javax.persistence.*;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Future;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
@Entity
@SequenceGenerator(name="pedido", sequenceName = "SQ_T_PEDIDO", allocationSize = 1)
public class Pedido {
@Id
@GeneratedValue(generator = "pedido", strategy = GenerationType.SEQUENCE)
@NotNull
private int codigo;
@NotNull
@DecimalMin(value = "1",message = "O valor não pode ser menor que 0,00")
private double valor;
@NotNull
@Future(message = "A data não pode estar no passado")
private LocalDate data;
@NotNull
@Min(value = 1,message = "A quantidade mínima é 1")
private int quantidade;
private boolean pago;
@NotNull
@ManyToOne
private Cliente cliente;
public int getCodigo() {
return codigo;
}
public void setCodigo(int codigo) {
this.codigo = codigo;
}
public double getValor() {
return valor;
}
public void setValor(double valor) {
this.valor = valor;
}
public LocalDate getData() {
return data;
}
public void setData(LocalDate data) {
this.data = data;
}
public int getQuantidade() {
return quantidade;
}
public void setQuantidade(int quantidade) {
this.quantidade = quantidade;
}
public boolean isPago() {
return pago;
}
public void setPago(boolean pago) {
this.pago = pago;
}
public Cliente getCliente() {
return cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
}
| [
"[email protected]"
] | |
0699c15d0e9b79613b2ca6b626e6b406d20f6d91 | ad5b11ce6186ca76bf4098852d34b4a806906b1f | /zhao_sheng/src/main/java/com/yfy/app/album/SingePicShowActivity.java | bbd64b8384c0406bb999e0be574111e68d29fce0 | [] | no_license | Zhaoxianxv/zhao_sheng1 | 700666c2589529aee9a25597f63cc6a07dcfe78c | 9fdd9512bf38fcfe4ccbe197034a006a3d053c66 | refs/heads/master | 2022-12-14T03:07:48.096666 | 2020-09-06T03:36:17 | 2020-09-06T03:36:17 | 291,885,920 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,775 | java | package com.yfy.app.album;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import com.example.zhao_sheng.R;
import com.yfy.base.activity.BaseActivity;
import com.yfy.final_tag.TagFinal;
import com.yfy.final_tag.glide.GlideTools;
import com.yfy.view.image.PinchImageView;
public class SingePicShowActivity extends BaseActivity {
private String url,title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.singe_pic_show);
getData();
initSQToolbar();
}
private void initSQToolbar() {
Toolbar toolbar= (Toolbar) findViewById(R.id.show_pic_one_title_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (title!=null){
toolbar.setTitle(title);
}else{
toolbar.setTitle("返回");
}
toolbar.setNavigationIcon(R.drawable.ic_left_nav);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
public void getData(){
Bundle b = getIntent().getExtras();
if (b != null) {
if (b.containsKey(TagFinal.ALBUM_SINGE_URI)) {
url = b.getString(TagFinal.ALBUM_SINGE_URI);
}
if (b.containsKey("title")) {
title = b.getString("title");
}
}
initView();
}
public void initView(){
PinchImageView imageView= (PinchImageView) findViewById(R.id.big_url_pic);
GlideTools.loadImage(mActivity,url,imageView);
}
}
| [
"[email protected]"
] | |
be6711607d92550c9446db1090b4142d3a0cc8c2 | 48b22ae9936115516f533ef3c4339ca8a0c6c733 | /Hard/Bender - Episode 2.java | c420290b7421990f268ec578e71418c7d9ca022c | [] | no_license | VerifierIntegerAssignment/Codingame | 25457df977125831466c03f16c2c4aecadff9f1d | dd325cb32f1bcb58786288263ee2b0977989650f | refs/heads/master | 2020-11-28T02:30:47.752814 | 2018-03-01T12:56:34 | 2018-03-01T12:56:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,146 | java | import java.util.*;
import java.io.*;
import java.math.*;
class Solution {
static int N; // number of rooms
static int paths[][]; // possible paths from 1 room
static int money[]; // money in a room
static boolean end[]; // connection to outside
static int max[];
static int maxRev = 0; // maximum revenue
static Vector<Integer> check = new Vector<Integer>(); // set of rooms to be checked
public static void main(String args[]) throws IOException{
Scanner in = new Scanner(System.in);
//System.out.println("ENTER:");
N = in.nextInt(); // initializing
if (in.hasNextLine()) {
in.nextLine();
}
paths = new int[N][2]; // initializing
money = new int[N]; // initializing
end = new boolean[N]; // initializing
max = new int[N]; // initializing
for (int i = 0; i < N; i++) {
int room = in.nextInt(); // index of the room
int value = in.nextInt(); // money in the room
money[i] = value; // setting money
String room1 = in.next(); // index of first connection
String room2 = in.next(); // index of second connection
try {
int index = Integer.parseInt(room1); // index of room
paths[room][0] = index; // set path as true
}catch (Exception e) {end[room] = true; paths[room][0] = -1;} // if not index, connected to outside
try {
int index = Integer.parseInt(room2); // index of room
paths[room][1] = index; // set path as true
}catch (Exception e) {end[room] = true; paths[room][1] = -1;} // if not index, connected to outside
}
boolean visitable[] = new boolean[N];
visitable[0] = true;
for (int i = 0; i < N; i++) {
System.err.println("Checking room: "+i);
int cost = money[i];
int room1 = paths[i][0];
int room2 = paths[i][1];
System.err.println("Room1: "+room1+"\nRoom2: "+room2);
System.err.println("Cost: "+(max[i]+cost));
try {
if (visitable[i]) visitable[room1]=true;
if (max[room1]<cost+max[i] && visitable[room1]) {
max[room1] = cost+max[i];
System.err.println("Set value of room "+room1+" as "+(max[i]+cost));
}
}
catch (Exception e) {}
try {
if (visitable[i]) visitable[room2]=true;
if (max[room2]<cost+max[i] && visitable[room2]) {
max[room2] = cost+max[i];
System.err.println("Set value of room "+room2+" as "+(max[i]+cost));
}
}
catch (Exception e) {}
if (end[i]) maxRev = Math.max(max[i]+cost,maxRev);
}
//int checkInd = 0;
//for (int i = 0; i < N; i++) if (end[i]) {if(maxRev<max[i]+money[i])checkInd = i; maxRev = Math.max(max[i]+money[i],maxRev);}
//System.err.println(checkInd);
System.out.println(maxRev);
}
}
| [
"[email protected]"
] | |
5cd5c77e51cfa538a4cb1b26913da60b28e87c84 | 0adb936c478c6c7618cbfe0d16850030ab7dde1b | /src/main/java/gov/nih/nlm/ncbi/SplicedSeg.java | 1c83741950d2bdf575b98ecefcb2fbbddffcd2bd | [] | no_license | milton900807/arraybase | f4c613205125a0de0d8bbe2c4f080073c382f247 | 11ac473089877b15aae437f476502b2d65291f75 | refs/heads/master | 2023-06-05T02:09:31.541576 | 2021-07-03T18:02:03 | 2021-07-03T18:02:03 | 382,672,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,850 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2018.06.18 at 09:24:32 PM PDT
//
package gov.nih.nlm.ncbi;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Spliced-seg_product-id" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.ncbi.nlm.nih.gov}Seq-id"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="Spliced-seg_genomic-id" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.ncbi.nlm.nih.gov}Seq-id"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="Spliced-seg_product-strand" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.ncbi.nlm.nih.gov}Na-strand"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="Spliced-seg_genomic-strand" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.ncbi.nlm.nih.gov}Na-strand"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="Spliced-seg_product-type">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="value" use="required">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="transcript"/>
* <enumeration value="protein"/>
* </restriction>
* </simpleType>
* </attribute>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="Spliced-seg_exons">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence maxOccurs="unbounded" minOccurs="0">
* <element ref="{http://www.ncbi.nlm.nih.gov}Spliced-exon"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="Spliced-seg_poly-a" type="{http://www.w3.org/2001/XMLSchema}integer" minOccurs="0"/>
* <element name="Spliced-seg_product-length" type="{http://www.w3.org/2001/XMLSchema}integer" minOccurs="0"/>
* <element name="Spliced-seg_modifiers" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence maxOccurs="unbounded" minOccurs="0">
* <element ref="{http://www.ncbi.nlm.nih.gov}Spliced-seg-modifier"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"splicedSegProductId",
"splicedSegGenomicId",
"splicedSegProductStrand",
"splicedSegGenomicStrand",
"splicedSegProductType",
"splicedSegExons",
"splicedSegPolyA",
"splicedSegProductLength",
"splicedSegModifiers"
})
@XmlRootElement(name = "Spliced-seg")
public class SplicedSeg {
@XmlElement(name = "Spliced-seg_product-id")
protected SplicedSeg.SplicedSegProductId splicedSegProductId;
@XmlElement(name = "Spliced-seg_genomic-id")
protected SplicedSeg.SplicedSegGenomicId splicedSegGenomicId;
@XmlElement(name = "Spliced-seg_product-strand")
protected SplicedSeg.SplicedSegProductStrand splicedSegProductStrand;
@XmlElement(name = "Spliced-seg_genomic-strand")
protected SplicedSeg.SplicedSegGenomicStrand splicedSegGenomicStrand;
@XmlElement(name = "Spliced-seg_product-type", required = true)
protected SplicedSeg.SplicedSegProductType splicedSegProductType;
@XmlElement(name = "Spliced-seg_exons", required = true)
protected SplicedSeg.SplicedSegExons splicedSegExons;
@XmlElement(name = "Spliced-seg_poly-a")
protected BigInteger splicedSegPolyA;
@XmlElement(name = "Spliced-seg_product-length")
protected BigInteger splicedSegProductLength;
@XmlElement(name = "Spliced-seg_modifiers")
protected SplicedSeg.SplicedSegModifiers splicedSegModifiers;
/**
* Gets the value of the splicedSegProductId property.
*
* @return
* possible object is
* {@link SplicedSeg.SplicedSegProductId }
*
*/
public SplicedSeg.SplicedSegProductId getSplicedSegProductId() {
return splicedSegProductId;
}
/**
* Sets the value of the splicedSegProductId property.
*
* @param value
* allowed object is
* {@link SplicedSeg.SplicedSegProductId }
*
*/
public void setSplicedSegProductId(SplicedSeg.SplicedSegProductId value) {
this.splicedSegProductId = value;
}
/**
* Gets the value of the splicedSegGenomicId property.
*
* @return
* possible object is
* {@link SplicedSeg.SplicedSegGenomicId }
*
*/
public SplicedSeg.SplicedSegGenomicId getSplicedSegGenomicId() {
return splicedSegGenomicId;
}
/**
* Sets the value of the splicedSegGenomicId property.
*
* @param value
* allowed object is
* {@link SplicedSeg.SplicedSegGenomicId }
*
*/
public void setSplicedSegGenomicId(SplicedSeg.SplicedSegGenomicId value) {
this.splicedSegGenomicId = value;
}
/**
* Gets the value of the splicedSegProductStrand property.
*
* @return
* possible object is
* {@link SplicedSeg.SplicedSegProductStrand }
*
*/
public SplicedSeg.SplicedSegProductStrand getSplicedSegProductStrand() {
return splicedSegProductStrand;
}
/**
* Sets the value of the splicedSegProductStrand property.
*
* @param value
* allowed object is
* {@link SplicedSeg.SplicedSegProductStrand }
*
*/
public void setSplicedSegProductStrand(SplicedSeg.SplicedSegProductStrand value) {
this.splicedSegProductStrand = value;
}
/**
* Gets the value of the splicedSegGenomicStrand property.
*
* @return
* possible object is
* {@link SplicedSeg.SplicedSegGenomicStrand }
*
*/
public SplicedSeg.SplicedSegGenomicStrand getSplicedSegGenomicStrand() {
return splicedSegGenomicStrand;
}
/**
* Sets the value of the splicedSegGenomicStrand property.
*
* @param value
* allowed object is
* {@link SplicedSeg.SplicedSegGenomicStrand }
*
*/
public void setSplicedSegGenomicStrand(SplicedSeg.SplicedSegGenomicStrand value) {
this.splicedSegGenomicStrand = value;
}
/**
* Gets the value of the splicedSegProductType property.
*
* @return
* possible object is
* {@link SplicedSeg.SplicedSegProductType }
*
*/
public SplicedSeg.SplicedSegProductType getSplicedSegProductType() {
return splicedSegProductType;
}
/**
* Sets the value of the splicedSegProductType property.
*
* @param value
* allowed object is
* {@link SplicedSeg.SplicedSegProductType }
*
*/
public void setSplicedSegProductType(SplicedSeg.SplicedSegProductType value) {
this.splicedSegProductType = value;
}
/**
* Gets the value of the splicedSegExons property.
*
* @return
* possible object is
* {@link SplicedSeg.SplicedSegExons }
*
*/
public SplicedSeg.SplicedSegExons getSplicedSegExons() {
return splicedSegExons;
}
/**
* Sets the value of the splicedSegExons property.
*
* @param value
* allowed object is
* {@link SplicedSeg.SplicedSegExons }
*
*/
public void setSplicedSegExons(SplicedSeg.SplicedSegExons value) {
this.splicedSegExons = value;
}
/**
* Gets the value of the splicedSegPolyA property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSplicedSegPolyA() {
return splicedSegPolyA;
}
/**
* Sets the value of the splicedSegPolyA property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSplicedSegPolyA(BigInteger value) {
this.splicedSegPolyA = value;
}
/**
* Gets the value of the splicedSegProductLength property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSplicedSegProductLength() {
return splicedSegProductLength;
}
/**
* Sets the value of the splicedSegProductLength property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSplicedSegProductLength(BigInteger value) {
this.splicedSegProductLength = value;
}
/**
* Gets the value of the splicedSegModifiers property.
*
* @return
* possible object is
* {@link SplicedSeg.SplicedSegModifiers }
*
*/
public SplicedSeg.SplicedSegModifiers getSplicedSegModifiers() {
return splicedSegModifiers;
}
/**
* Sets the value of the splicedSegModifiers property.
*
* @param value
* allowed object is
* {@link SplicedSeg.SplicedSegModifiers }
*
*/
public void setSplicedSegModifiers(SplicedSeg.SplicedSegModifiers value) {
this.splicedSegModifiers = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence maxOccurs="unbounded" minOccurs="0">
* <element ref="{http://www.ncbi.nlm.nih.gov}Spliced-exon"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"splicedExon"
})
public static class SplicedSegExons {
@XmlElement(name = "Spliced-exon")
protected List<SplicedExon> splicedExon;
/**
* Gets the value of the splicedExon property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the splicedExon property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSplicedExon().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SplicedExon }
*
*
*/
public List<SplicedExon> getSplicedExon() {
if (splicedExon == null) {
splicedExon = new ArrayList<SplicedExon>();
}
return this.splicedExon;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.ncbi.nlm.nih.gov}Seq-id"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"seqId"
})
public static class SplicedSegGenomicId {
@XmlElement(name = "Seq-id", required = true)
protected SeqId seqId;
/**
* Gets the value of the seqId property.
*
* @return
* possible object is
* {@link SeqId }
*
*/
public SeqId getSeqId() {
return seqId;
}
/**
* Sets the value of the seqId property.
*
* @param value
* allowed object is
* {@link SeqId }
*
*/
public void setSeqId(SeqId value) {
this.seqId = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.ncbi.nlm.nih.gov}Na-strand"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"naStrand"
})
public static class SplicedSegGenomicStrand {
@XmlElement(name = "Na-strand", required = true)
protected NaStrand naStrand;
/**
* Gets the value of the naStrand property.
*
* @return
* possible object is
* {@link NaStrand }
*
*/
public NaStrand getNaStrand() {
return naStrand;
}
/**
* Sets the value of the naStrand property.
*
* @param value
* allowed object is
* {@link NaStrand }
*
*/
public void setNaStrand(NaStrand value) {
this.naStrand = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence maxOccurs="unbounded" minOccurs="0">
* <element ref="{http://www.ncbi.nlm.nih.gov}Spliced-seg-modifier"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"splicedSegModifier"
})
public static class SplicedSegModifiers {
@XmlElement(name = "Spliced-seg-modifier")
protected List<SplicedSegModifier> splicedSegModifier;
/**
* Gets the value of the splicedSegModifier property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the splicedSegModifier property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSplicedSegModifier().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SplicedSegModifier }
*
*
*/
public List<SplicedSegModifier> getSplicedSegModifier() {
if (splicedSegModifier == null) {
splicedSegModifier = new ArrayList<SplicedSegModifier>();
}
return this.splicedSegModifier;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.ncbi.nlm.nih.gov}Seq-id"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"seqId"
})
public static class SplicedSegProductId {
@XmlElement(name = "Seq-id", required = true)
protected SeqId seqId;
/**
* Gets the value of the seqId property.
*
* @return
* possible object is
* {@link SeqId }
*
*/
public SeqId getSeqId() {
return seqId;
}
/**
* Sets the value of the seqId property.
*
* @param value
* allowed object is
* {@link SeqId }
*
*/
public void setSeqId(SeqId value) {
this.seqId = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.ncbi.nlm.nih.gov}Na-strand"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"naStrand"
})
public static class SplicedSegProductStrand {
@XmlElement(name = "Na-strand", required = true)
protected NaStrand naStrand;
/**
* Gets the value of the naStrand property.
*
* @return
* possible object is
* {@link NaStrand }
*
*/
public NaStrand getNaStrand() {
return naStrand;
}
/**
* Sets the value of the naStrand property.
*
* @param value
* allowed object is
* {@link NaStrand }
*
*/
public void setNaStrand(NaStrand value) {
this.naStrand = value;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="value" use="required">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="transcript"/>
* <enumeration value="protein"/>
* </restriction>
* </simpleType>
* </attribute>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class SplicedSegProductType {
@XmlAttribute(name = "value", required = true)
protected String value;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
}
}
| [
"[email protected]"
] | |
226d31baa749b341a491bf2c8193aeced6b1bf2e | 46842b9a3acbe06caff27ba20294b61e9f325011 | /src/no/hiof/arcade/settings/SettingsLoader.java | 2c054eacea7b0b76ab15acd499e61f3d6c9d3d6e | [] | no_license | oyvjul/ARCADE | 012a8b26025518ebd3835c35424f64472ff85198 | 32e0d6470ad975bbb577a87cb2aa1de30095b536 | refs/heads/master | 2021-05-12T19:18:51.817820 | 2018-01-11T11:08:50 | 2018-01-11T11:08:50 | 117,089,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,330 | java | package no.hiof.arcade.settings;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author JonAre
*/
public class SettingsLoader
{
public static Properties getSettingsFromFile(SettingsType settingsType, String pathToFile)
{
File settingsFile = new File(pathToFile);
Properties availableProperties = new Properties();
InputStream inputStream;
try
{
inputStream = new FileInputStream(settingsFile);
availableProperties.load(inputStream);
}
catch(FileNotFoundException ex)
{
System.out.println("Could not find settings file. Trying to create settings file.");
createSettingsFile(settingsType, pathToFile);
return getSettingsFromFile(settingsType, pathToFile);
}
catch(IOException ex)
{
System.out.println("Could not load file. Retrying");
return getSettingsFromFile(settingsType, pathToFile);
}
return availableProperties;
}
public static void createSettingsFile(SettingsType settingsType, String pathToFile)
{
File settingsFile = new File(pathToFile);
Properties newProperties = new Properties();
OutputStream outputStream = null;
try
{
settingsFile.createNewFile();
outputStream = new FileOutputStream(pathToFile);
buildPropertiesForFileCreation(newProperties, settingsType);
newProperties.store(outputStream, null);
}
catch(IOException ex)
{
System.out.println("Could not create settings file.");
}
}
private static void buildPropertiesForFileCreation(Properties properties, SettingsType settingsType)
{
if(settingsType==SettingsType.APPLICATION_SETTINGS)
{
properties.setProperty(SettingKey.DEBUG_MODE_ENABLED, LegalSettingValue.FALSE);
properties.setProperty(SettingKey.WALK_WITHOUT_HEAD, LegalSettingValue.FALSE);
properties.setProperty(SettingKey.BATCH_MODELS_WHEN_LOADING, LegalSettingValue.FALSE);
properties.setProperty(SettingKey.USE_OCULUS_RIFT, LegalSettingValue.TRUE);
}
else if(settingsType==SettingsType.MODEL_PATH_SETTINGS)
{
properties.setProperty("DUMMYMODELPATH", "C:/temp/models/remove_line_before_use");
}
else if(settingsType == SettingsType.DISPLAY_SETTINGS)
{
properties.setProperty(SettingKey.DISPLAY_RESOLUTION_WIDTH, "1280");
properties.setProperty(SettingKey.DISPLAY_RESOLUTION_HEIGHT, "800");
properties.setProperty(SettingKey.DISPLAY_FREQUENCY, "60");
properties.setProperty(SettingKey.DISPLAY_FULL_SCREEN, LegalSettingValue.TRUE);
properties.setProperty(SettingKey.DISPLAY_ANTI_ALIASING_FACTOR, "0");
}
}
}
| [
"[email protected]"
] | |
ce246ed0cf6f98a53e93e8d5376ff2cc7380a373 | 745e4cc70b21c2c9fad2cc5a20026c29c1d73ea6 | /jte-runtime/src/main/java/gg/jte/support/LocalizationSupport.java | 8d84c097c37763d684e09d8d4e02fb949340e433 | [
"Apache-2.0"
] | permissive | patadams-company/jte | 574cc8469022e1cf34d37b8ebc9d19c4c1cedd8e | a9af62197aff631aa1044ee1a1a64924a4d67419 | refs/heads/master | 2023-03-02T02:06:47.089428 | 2020-11-25T12:29:25 | 2020-11-25T12:29:25 | 316,601,637 | 0 | 0 | Apache-2.0 | 2021-02-03T19:37:32 | 2020-11-27T21:17:04 | null | UTF-8 | Java | false | false | 3,139 | java | package gg.jte.support;
import gg.jte.TemplateOutput;
import gg.jte.Content;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public interface LocalizationSupport {
Pattern pattern = Pattern.compile("\\{(\\d+)}");
String lookup(String key);
@SuppressWarnings("unused") // Called by template code
default Content localize(String key) {
String value = lookup(key);
if (value == null) {
return null;
}
return output -> output.writeContent(value);
}
@SuppressWarnings("unused") // Called by template code
default Content localize(String key, Object ... params) {
String value = lookup(key);
if (value == null) {
return null;
}
return new Content() {
@Override
public void writeTo(TemplateOutput output) {
Matcher matcher = pattern.matcher(value);
if (matcher.find()) {
int startIndex = 0;
do {
output.writeContent(value.substring(startIndex, matcher.start()));
startIndex = matcher.end();
int argumentIndex = Integer.parseInt(matcher.group(1));
if (argumentIndex < params.length) {
Object param = params[argumentIndex];
if (param != null) {
writeParam(output, param);
}
}
} while (matcher.find());
output.writeContent(value.substring(startIndex));
} else {
output.writeContent(value);
}
}
private void writeParam(TemplateOutput output, Object param) {
if (param instanceof String) {
output.writeUserContent((String) param);
} else if (param instanceof Content) {
output.writeUserContent((Content) param);
} else if (param instanceof Enum) {
output.writeUserContent((Enum<?>) param);
} else if (param instanceof Boolean) {
output.writeUserContent((boolean) param);
} else if (param instanceof Byte) {
output.writeUserContent((byte) param);
} else if (param instanceof Short) {
output.writeUserContent((short) param);
} else if (param instanceof Integer) {
output.writeUserContent((int) param);
} else if (param instanceof Long) {
output.writeUserContent((long) param);
} else if (param instanceof Float) {
output.writeUserContent((float) param);
} else if (param instanceof Double) {
output.writeUserContent((double) param);
} else if (param instanceof Character) {
output.writeUserContent((char) param);
}
}
};
}
}
| [
"[email protected]"
] | |
da0401e76b35fc5502d40ebc0e61d043a16f8d4c | 28cb6caae5fb402b20052a47f2281baafedb9ff8 | /LeetCode_Exercise/base_dp_1/Cow_cross_river_dp.java | 830d130263eb0129e0444c3988d39977232bbfc7 | [] | no_license | FlyingLight/Learn_Algorithm | 5d4b87329bef45cc088aa655d4fe5dd829cea319 | 96e8733aa9801ff44adb5e0505bf42c3d54869ec | refs/heads/master | 2020-05-27T07:36:48.014844 | 2020-03-03T02:31:18 | 2020-03-03T02:31:18 | 188,532,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,310 | java | /**
*
*/
package base_dp_1;
import java.util.Arrays;
/**
* @author qiguangqin
*
*/
public class Cow_cross_river_dp {
/**
Farmer John has N cow
boat without row(to and back from river other side :M)
m_i(from m_i-1 m_i) add time
one cow: M+m_1 two cow together : M+m_1+m_2
5(5 cows) 10(without cow ,single trip)
3 m_1
4 m_2
6 m_3
100 m_4
1 m_5
*/
private int[] cow_time;
private int[]dp;
private int[] weight;
private final int n=5;
private final int m=10;
public Cow_cross_river_dp(int[] cow_time) {
if (cow_time.length>n) throw new IllegalArgumentException(" number of cow is not equal");
this.cow_time=cow_time;
dp= new int[cow_time.length+1];
weight= new int[cow_time.length+1];
dp[0]=m;
weight[0]=m;
for(int i=1;i<=n;i++)
dp[i]=dp[i-1]+cow_time[i-1];
for(int i=1;i<=n;i++)
weight[i]=weight[i-1]+cow_time[i-1];
}
public int get_res_recur() {
return _get_res_recur(cow_time.length);
}
public int get_res_recur_memo() {
int n=cow_time.length;
int []memo=new int[n+1];
Arrays.fill(memo, -1);
return _get_res_recur_memo(n,memo);
}
private int _get_res_recur(int n) {
if(n==0) return -m;
if(n==1) return weight[n];
int res=Integer.MAX_VALUE;
for(int i=n;i>0;i--)
res=Math.min(res, weight[i]+_get_res_recur(n-i)+m);
//System.out.println(res);
return res;
}
private int _get_res_recur_memo(int n,int[]memo) {
if(memo[n]!=-1) return memo[n];
if(n==0) return -m;
if(n==1) return weight[n];
int res=Integer.MAX_VALUE;
for(int i=n;i>0;i--) {
res=Math.min(res, weight[i]+_get_res_recur(n-i)+m);
//System.out.println(res);
}
memo[n]=res;
return res;
}
public int get_res() {
for(int i=1;i<=n;i++) {
for(int j=1;j<i;j++) {
dp[i]=Math.min(dp[i], dp[j]+dp[i-j]+m);
}
}
return dp[n];
}
public static void main(String[] args) {
int[] cow_time= {3,4,6,100,1};
Cow_cross_river_dp ccrd = new Cow_cross_river_dp(cow_time);
//for(int w:ccrd.cow_time)
//System.out.print(w+" ");
int num= ccrd.get_res();
int num2= ccrd.get_res_recur_memo();
System.out.println(num+" "+num2);
}
}
| [
"[email protected]"
] | |
ba6ca9b08eff0d3bb7c968d6c7b87e885e171d91 | 3f5c18e8384da80b72e712e2129f3442a10c3257 | /Java OOP/Working with Abstraction - Exercise/CardsWithPower/Card.java | da90ced5504687a87cc85dde94a7cd20e4ce99f9 | [] | no_license | altnum/Java-Advanced | b356928c88229f9b0aa12544a94e6d7b80bd06ec | 3741bda782048f1b9d1633e10342a7f42cb36ffe | refs/heads/master | 2023-02-04T03:38:15.746179 | 2020-12-14T18:28:44 | 2020-12-14T18:28:44 | 295,775,251 | 0 | 0 | null | 2020-10-06T18:30:44 | 2020-09-15T15:45:42 | Java | UTF-8 | Java | false | false | 549 | java | package CardsWithPower;
public class Card {
private CardRanks number;
private CardsWithPower colour;
private int power;
public Card (CardRanks rank, CardsWithPower colour) {
this.number = rank;
this.colour = colour;
this.power = rank.getPower() + colour.getPower();
}
@Override
public String toString() {
String cardName = this.number + " of " + this.colour;
return String.format("CardsWithPower.Card name: %s; CardsWithPower.Card power: %d", cardName, this.power);
}
}
| [
"[email protected]"
] | |
8b335416f2aeb8fe0c70849c1560882bfe3e023b | 58e255bc4b78cad2a59254c50a6c7dc6aa18d929 | /SpringBoot-Backend/src/test/java/com/delivery/FDMS/FdmsApplicationTests.java | 319e7df5bb2a46ca4c19fad2ed7a70f13d09b787 | [] | no_license | ashwani-hash/FDMS | d7b5b00a27bf160015bf5737d156a713e7d36c1a | bf96d4af41b2a5db12928a37241f9332b5b77f9c | refs/heads/master | 2022-11-30T21:12:28.046582 | 2020-08-19T06:30:52 | 2020-08-19T06:30:52 | 288,647,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 207 | java | package com.delivery.FDMS;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class FdmsApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
bff96979afcff5835285578d8597b1b18dbf084c | 64487c6237d2558ea5910b4132def37627d4557e | /acmesky_source_code/acmesky_java_camunda/src/main/java/it/unibo/soseng/cliente/SendInterestService.java | 4dd3a788b77187ba56aaf1ec5c8e43c70490ad61 | [
"Apache-2.0"
] | permissive | MickPerl/Service-Oriented-Architecture-Project | 35d0878b0d51f026a5ed6dec6f66afdc2509a7c3 | f8cdad7766d3453d2ce13350ca1af3cea0724653 | refs/heads/main | 2023-08-11T09:46:52.364728 | 2021-10-08T22:54:28 | 2021-10-08T22:54:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,382 | java | package it.unibo.soseng.cliente;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
public class SendInterestService {
private static SimpleDateFormat sdt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
public SendInterestService() {
}
private static String[] airports = {"BLQ",
"BGY",
"CTA",
"MXP",
"VRN",
"FCO",
"LGW",
"FRA",
"BCN",
"LIS",
"AUH",
"SVO",
"ORY"};
public static void service(DelegateExecution execution) {
Transazione t = new Transazione("");
Cliente c = new Cliente("");
c.payment_password = "1234567890";
String username = "";
if (execution.getVariable("customInterest") != null) {
try {
username = execution.getVariable("username").toString();
t.username = username;
c.payment_username = username;
StaticValues.clienti.put(username, c);
StaticValues.transazioni.add(t);
if (execution.getVariable("secondDate") != null && !execution.getVariable("secondDate").toString().isEmpty()) {
execution.getProcessEngine().getRuntimeService().createMessageCorrelation("GetInterests")
.setVariable("departure_airport", execution.getVariable("first_airport"))
.setVariable("arrival_airport", execution.getVariable("second_airport"))
.setVariable("departure_time_min", sdt.format(sdt.parse(execution.getVariable("firstDate").toString())))
.setVariable("departure_time_max", sdt.format(sdt.parse(execution.getVariable("firstDateInterval").toString())))
.setVariable("arrival_time_min", sdt.format(sdt.parse(execution.getVariable("secondDate").toString())))
.setVariable("arrival_time_max", sdt.format(sdt.parse(execution.getVariable("secondDateInterval").toString())))
.setVariable("client_id", execution.getVariable("username"))
.setVariable("clientAddress", execution.getVariable("clientAddress"))
.setVariable("cost", execution.getVariable("max_price"))
.correlate();
} else {
execution.getProcessEngine().getRuntimeService().createMessageCorrelation("GetInterests")
.setVariable("departure_airport", execution.getVariable("first_airport"))
.setVariable("arrival_airport", execution.getVariable("second_airport"))
.setVariable("departure_time_min", sdt.format(sdt.parse(execution.getVariable("firstDate").toString())))
.setVariable("departure_time_max", sdt.format(sdt.parse(execution.getVariable("firstDateInterval").toString())))
.setVariable("client_id", execution.getVariable("username"))
.setVariable("clientAddress", execution.getVariable("clientAddress"))
.setVariable("cost", execution.getVariable("max_price"))
.correlate();
}
execution.removeVariable("customInterest");
} catch(Exception e) {
e.printStackTrace();
}
} else {
t.username = "mariorossi".concat(String.valueOf(StaticValues.contatore_mario_rossi));
username = t.username;
c.payment_username = "mariorossi".concat(String.valueOf(StaticValues.contatore_mario_rossi++));
StaticValues.clienti.put(username, c);
StaticValues.transazioni.add(t);
RuntimeService runtimeService = execution.getProcessEngine().getRuntimeService();
//genera la prima data e un intervallo di tempo casualmente; poi calcola la seconda data
int year = 2021;
int min_month = 0;
int max_month = 11;
int min_day = 1;
int max_day = 31;
int min_period = 1;
int max_period = 60;
int month_range = max_month - min_month + 1;
int day_range = max_day - min_day + 1;
int period_range = max_period - min_period + 1;
// generate random numbers within 1 to 10
Calendar calendar = Calendar.getInstance();
Date firstDate, secondDate;
calendar.setLenient(false);
while(true) {
try {
firstDate = calendar.getTime();
int rand_period = (int)(Math.random() * period_range) + min_period;
calendar.add(Calendar.DATE, rand_period);
secondDate = calendar.getTime();
break;
} catch(Exception e ) {
continue;
}
}
//genera un prezzo massimo
//genera prezzi tra 200 e 1000
int max_price = (int)(Math.random() * 800)+200;
//prendi due aeroporti a caso
int first_airport_index = (int)(Math.random()*airports.length), second_airport_index;
do {
second_airport_index = (int)(Math.random()*airports.length);
} while (second_airport_index == first_airport_index);
String first_airport = airports[first_airport_index];
String second_airport = airports[second_airport_index];
//NOTA: date.getYear() restituisce l'anno, meno 1900. SIa maledetto chiunque sia l'impiegato alla sun che l'ha deciso
calendar.set(firstDate.getYear()+1900, firstDate.getMonth(), firstDate.getDate());
calendar.add(Calendar.DAY_OF_MONTH, 5);
Date firstDateInterval = calendar.getTime();
calendar.set(secondDate.getYear()+1900, secondDate.getMonth(), secondDate.getDate());
calendar.add(Calendar.DAY_OF_MONTH, 5);
Date secondDateInterval = calendar.getTime();
//Scegliamo due date, una di arrivo e una di ripartenza; c'è una tolleranza di 5 giorni su entrambe
//es. possiamo partire tra il 1 gennaio e il 6 gennaio, e ritornare tra il 20 gennaio e il 25 gennaio
runtimeService.createMessageCorrelation("GetInterests")
.setVariable("departure_airport", first_airport)
.setVariable("arrival_airport", second_airport)
.setVariable("departure_time_min", sdt.format(firstDate))
.setVariable("departure_time_max", sdt.format(firstDateInterval))
.setVariable("arrival_time_min", sdt.format(secondDate))
.setVariable("arrival_time_max", sdt.format(secondDateInterval))
.setVariable("client_id", t.username )
.setVariable("clientAddress", "via indipendenza 1, bologna, italia")
.setVariable("cost", max_price)
.correlate();
}
}
}
| [
"[email protected]"
] | |
1381fb9e9a14f16a6b1d7cb202fc5161d791322d | 543dbeae6ed5e22b41d3bb0fc3f41f5ef7ae7a28 | /core-it-suite/src/test/resources/mng-3703/maven-mng3703-plugin/src/main/java/jar/CheckMojo.java | a81f6f6ec5dd901e05e6dc50e34ca8c194fc9535 | [
"Apache-2.0"
] | permissive | famod/maven-integration-testing | f498e6e436bc09262bbea1314ddfb9deea62ce75 | 7bb6eb02e78c0d9c2a54f1713f5b8e51c11da6d2 | refs/heads/master | 2023-02-19T04:44:37.962142 | 2020-10-24T09:59:41 | 2020-12-15T08:34:03 | 147,579,983 | 0 | 0 | null | 2018-09-05T21:10:55 | 2018-09-05T21:10:55 | null | UTF-8 | Java | false | false | 983 | java | package jar;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* 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.
*/
import org.apache.maven.project.MavenProject;
/**
* @goal check
* @execute phase="compile"
*/
public class CheckMojo
extends AbstractCheckMojo
{
protected MavenProject getTestProject()
{
return getExecutionProject();
}
protected String getTestProjectLabel()
{
return "forked project";
}
}
| [
"[email protected]"
] | |
421d369f22a8e7e7179cc8ea156e71b6c4fe8e37 | 76aa67783d67d879b795fc8de3bed2746ccf3ee6 | /src/com/codepath/apps/basictwitter/fragments/TopCardFragment.java | 037717467264f95750f79bc8c2c67897d6e70159 | [] | no_license | prachiagrawal/SimpleTwitter-Codepath | eea41db3a27675e6991a8fd5049552184390d49f | f0df485e00a353d35fd386c614a4c7cdb1d9754a | refs/heads/master | 2020-12-24T15:22:36.774712 | 2014-10-09T03:50:36 | 2014-10-09T03:50:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,901 | java | package com.codepath.apps.basictwitter.fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.codepath.apps.basictwitter.R;
import com.codepath.apps.basictwitter.models.User;
import com.nostra13.universalimageloader.core.ImageLoader;
public class TopCardFragment extends Fragment {
private ImageView ivProfileBackgroundImage;
private ImageView ivProfileTopCardImage;
private TextView tvProfileScreenName;
private TextView tvProfileName;
private TextView tvTagline;
private TextView tvFollowersCount;
private TextView tvFriendsCount;
private TextView tvTweetsCount;
private ImageView ivVerified;
public TopCardFragment() {
// Empty constructor
}
public static TopCardFragment newInstance(long userId) {
TopCardFragment frag = new TopCardFragment();
Bundle args = new Bundle();
args.putLong("userId", userId);
frag.setArguments(args);
return frag;
}
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_top_card, container, false);
ivProfileBackgroundImage = (ImageView) v.findViewById(R.id.ivProfileBackgroundImage);
ivProfileTopCardImage = (ImageView) v.findViewById(R.id.ivProfileTopCardImage);
tvProfileScreenName = (TextView) v.findViewById(R.id.tvProfileScreenName);
tvProfileName = (TextView) v.findViewById(R.id.tvProfileName);
tvTagline = (TextView) v.findViewById(R.id.tvTagline);
tvFollowersCount = (TextView) v.findViewById(R.id.tvFollowersCount);
tvFriendsCount = (TextView) v.findViewById(R.id.tvFriendsCount);
tvTweetsCount = (TextView) v.findViewById(R.id.tvTweetsCount);
ivVerified = (ImageView) v.findViewById(R.id.ivVerified);
User user = User.getById(getArguments().getLong("userId"));
if (user != null) {
ivProfileBackgroundImage.setImageResource(0);
ivProfileTopCardImage.setImageResource(0);
ImageLoader imageLoader = ImageLoader.getInstance();
if (user.getUseBackgroundImage()) {
imageLoader.displayImage(user.getProfileBackgroundImageUrl(), ivProfileBackgroundImage);
}
imageLoader.displayImage(user.getProfileImageUrl(), ivProfileTopCardImage);
tvProfileName.setText(user.getName());
tvProfileScreenName.setText("@" + user.getScreenName());
tvTagline.setText(user.getDescription());
tvFollowersCount.setText(Integer.toString(user.getFollowersCount()));
tvFriendsCount.setText(Integer.toString(user.getFriendsCount()));
tvTweetsCount.setText(Integer.toString(user.getStatusesCount()));
if (!user.getIsVerified()) {
ivVerified.setVisibility(View.INVISIBLE);
}
}
return v;
}
}
| [
"[email protected]"
] | |
c1225268b47e5bdc7354ab6a2a4b3fafc84dc908 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.ocms-OCMS/sources/com/facebook/graphql/modelutil/GraphQLModelBuilder.java | e268b7b841aa46a7aec29adc72903c3b49596a02 | [] | no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 82 | java | package com.facebook.graphql.modelutil;
public interface GraphQLModelBuilder {
}
| [
"[email protected]"
] | |
99b805f8afbfb96473616f9966f837d1e0af57fd | 34cd4b755caa858b350689f65151732cd467419f | /chapter1/src/chapter1/ex13.java | f429a5717e80b3d9804b9098ca116581448810b3 | [] | no_license | CindyChow1631560/Java-Programming | 9f02521a0b5434d6fed73330c7e2159514049789 | 5e53a1fc865bc56e23a0d7cbeb10b088adbbd9b0 | refs/heads/master | 2020-03-28T05:05:37.799363 | 2018-09-07T02:01:55 | 2018-09-07T02:01:55 | 147,756,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | package chapter1;
import java.util.*;
public class ex13 {
/* public static int[][] trance(int a[][])
{
int k=a.length;
int m=a[0].length;
int[][] b=new int[k][m];
for(int j=0;j<a[0].length;j++)
for(int i=0;i<a.length;i++)
{
b[i][j]=a[j][i];
}
return b;
}*/
public static void main(String[] args) {
// TODO Auto-generated method stub
/*int[][] test=new int[5][5];
Random random=new Random();
for(int k=0;k<5;k++)
for(int m=0;m<5;m++)
{
test[k][m]=random.nextInt(10);
}*/
int[][] test={{1,2,3,4,5},{3,6,7,8,3},{6,7,8,9,1},{3,1,5,7,9},{2,4,3,8,0}};
for(int k=0;k<5;k++)
{
for(int m=0;m<5;m++)
{
System.out.print(test[k][m]+" ");
}
System.out.println();
}
//test=trance(test);
System.out.println();
for(int k=0;k<5;k++)
{
for(int m=0;m<5;m++)
{
System.out.print(test[m][k]+" ");
}
System.out.println();
}
}
}
| [
"[email protected]"
] | |
7eaf79afe59d54125aaed2662394516f4895f84f | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/29343/tar_1.java | 35aaa9309494cc8eaa9522dce60f76e2b2542086 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,451 | java | package org.eclipse.swt.graphics;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved
*/
import org.eclipse.swt.internal.SerializableCompatibility;
import org.eclipse.swt.*;
/**
* Instances of this class represent rectangular areas in an
* (x, y) coordinate system. The top left corner of the rectangle
* is specified by its x and y values, and the extent of the
* rectangle is specified by its width and height.
* <p>
* The coordinate space for rectangles and points is considered
* to have increasing values downward and to the right from its
* origin making this the normal, computer graphics oriented notion
* of (x, y) coordinates rather than the strict mathematical one.
* </p>
* <p>
* Application code does <em>not</em> need to explicitly release the
* resources managed by each instance when those instances are no longer
* required, and thus no <code>dispose()</code> method is provided.
* </p>
*
* @see Point
*/
public final class Rectangle implements SerializableCompatibility {
/**
* the x coordinate of the rectangle
*/
public int x;
/**
* the y coordinate of the rectangle
*/
public int y;
/**
* the width of the rectangle
*/
public int width;
/**
* the height of the rectangle
*/
public int height;
/**
* Construct a new instance of this class given the
* x, y, width and height values.
*
* @param x the x coordinate of the origin of the rectangle
* @param y the y coordinate of the origin of the rectangle
* @param width the width of the rectangle
* @param height the height of the rectangle
*/
public Rectangle (int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
/**
* Destructively replaces the x, y, width and height values
* in the receiver with ones which represent the union of the
* rectangles specified by the receiver and the given rectangle.
* <p>
* The union of two rectangles is the smallest single rectangle
* that completely covers both of the areas covered by the two
* given rectangles.
* </p>
*
* @param rect the rectangle to merge with the receiver
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
* </ul>
*/
public void add (Rectangle rect) {
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
int left = x < rect.x ? x : rect.x;
int top = y < rect.y ? y : rect.y;
int lhs = x + width;
int rhs = rect.x + rect.width;
int right = lhs > rhs ? lhs : rhs;
lhs = y + height;
rhs = rect.y + rect.height;
int bottom = lhs > rhs ? lhs : rhs;
x = left; y = top; width = right - left; height = bottom - top;
}
/**
* Returns <code>true</code> if the point specified by the
* arguments is inside the area specified by the receiver,
* and <code>false</code> otherwise.
*
* @param x the x coordinate of the point to test for containment
* @param y the y coordinate of the point to test for containment
* @return <code>true</code> if the rectangle contains the point and <code>false</code> otherwise
*/
public boolean contains (int x, int y) {
return (x >= this.x) && (y >= this.y) && ((x - this.x) < width) && ((y - this.y) < height);
}
/**
* Returns <code>true</code> if the given point is inside the
* area specified by the receiver, and <code>false</code>
* otherwise.
*
* @param pt the point to test for containment
* @return <code>true</code> if the rectangle contains the point and <code>false</code> otherwise
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
* </ul>
*/
public boolean contains (Point pt) {
if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
return contains(pt.x, pt.y);
}
/**
* Compares the argument to the receiver, and returns true
* if they represent the <em>same</em> object using a class
* specific comparison.
*
* @param object the object to compare with this object
* @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
*
* @see #hashCode
*/
public boolean equals (Object object) {
if (object == this) return true;
if (!(object instanceof Rectangle)) return false;
Rectangle r = (Rectangle)object;
return (r.x == this.x) && (r.y == this.y) && (r.width == this.width) && (r.height == this.height);
}
/**
* Returns an integer hash code for the receiver. Any two
* objects which return <code>true</code> when passed to
* <code>equals</code> must return the same value for this
* method.
*
* @return the receiver's hash
*
* @see #equals
*/
public int hashCode () {
return x ^ y ^ width ^ height;
}
/**
* Returns a new rectangle which represents the intersection
* of the receiver and the given rectangle.
* <p>
* The intersection of two rectangles is the rectangle that
* covers the area which is contained within both rectangles.
* </p>
*
* @param rect the rectangle to intersect with the receiver
* @return the intersection of the receiver and the argument
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
* </ul>
*/
public Rectangle intersection (Rectangle rect) {
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (this == rect) return new Rectangle (x, y, width, height);
int left = x > rect.x ? x : rect.x;
int top = y > rect.y ? y : rect.y;
int lhs = x + width;
int rhs = rect.x + rect.width;
int right = lhs < rhs ? lhs : rhs;
lhs = y + height;
rhs = rect.y + rect.height;
int bottom = lhs < rhs ? lhs : rhs;
return new Rectangle (
right < left ? 0 : left,
bottom < top ? 0 : top,
right < left ? 0 : right - left,
bottom < top ? 0 : bottom - top);
}
/**
* Returns <code>true</code> if the given rectangle intersects
* with the receiver and <code>false</code> otherwise.
* <p>
* Two rectangles intersect if the area of the rectangle
* representing their intersection is not empty.
* </p>
*
* @param rect the rectangle to test for intersection
* @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
* </ul>
*
* @see #intersection
* @see #isEmpty
*/
public boolean intersects (Rectangle rect) {
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
return (rect == this) || (rect.x < x + width) && (rect.y < y + height) &&
(rect.x + rect.width > x) && (rect.y + rect.height > y);
}
/**
* Returns <code>true</code> if the receiver does not cover any
* area in the (x, y) coordinate plane, and <code>false</code> if
* the receiver does cover some area in the plane.
* <p>
* A rectangle is considered to <em>cover area</em> in the
* (x, y) coordinate plane if both its width and height are
* non-zero.
* </p>
*
* @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
*/
public boolean isEmpty () {
return (width <= 0) || (height <= 0);
}
/**
* Returns a string containing a concise, human-readable
* description of the receiver.
*
* @return a string representation of the rectangle
*/
public String toString () {
return "Rectangle {" + x + ", " + y + ", " + width + ", " + height + "}";
}
/**
* Returns a new rectangle which represents the union of
* the receiver and the given rectangle.
* <p>
* The union of two rectangles is the smallest single rectangle
* that completely covers both of the areas covered by the two
* given rectangles.
* </p>
*
* @param rect the rectangle to perform union with
* @return the union of the receiver and the argument
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
* </ul>
*
* @see #add
*/
public Rectangle union (Rectangle rect) {
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
int left = x < rect.x ? x : rect.x;
int top = y < rect.y ? y : rect.y;
int lhs = x + width;
int rhs = rect.x + rect.width;
int right = lhs > rhs ? lhs : rhs;
lhs = y + height;
rhs = rect.y + rect.height;
int bottom = lhs > rhs ? lhs : rhs;
return new Rectangle (left, top, right - left, bottom - top);
}
}
| [
"[email protected]"
] | |
522ab9b82dffd02fcb037147416a7082f73c0b97 | 3376213e409ceada01732a875fc6951d57df5b50 | /src/entities/Rent.java | 8f49f9494f601f153ebc01b312c8c5dc825bc857 | [] | no_license | Natanfags/javaoo-study | edaca115b1b5e3e24508a1d59e70a37adf5d0d4b | 62f32572eefc4b9eb0bed5aed9309af5f831d571 | refs/heads/master | 2020-04-08T23:12:43.516633 | 2018-12-03T14:08:03 | 2018-12-03T14:08:03 | 159,815,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package entities;
public class Rent {
String name;
String email;
public Rent(String name, String email) {
super();
this.name = name;
this.email = email;
}
public Rent() {
}
public String getNome() {
return name;
}
public void setNome(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return name + ", " + email;
}
}
| [
"[email protected]"
] | |
e5cdf4a733b27353fb7528186b2f2c1d31d424f5 | 77ac5592cbbd0d48a514d088391a197656033df7 | /api/src/main/java/com/lijingyao/coffee/gateway/api/models/UserCenterModel.java | b953cc45300b506468363543ec80595096c24ae6 | [] | no_license | tanbinh123/gateway_coffeeshop | 16b230fdca1463ec697f55b40b6822408ee00a77 | 87f42098bb9731f520b8947aaa2acc7b68741a32 | refs/heads/master | 2023-06-11T16:54:17.301172 | 2021-07-12T07:30:06 | 2021-07-12T07:30:06 | 475,483,798 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 992 | java | package com.lijingyao.coffee.gateway.api.models;
import java.util.List;
/**
* Created by lijingyao on 2018/7/9 16:45.
*/
public class UserCenterModel {
private Long userId;
private Long registeredTime;
private String nickName;
private List<UserSimpleOrderModel> orderModels;
public List<UserSimpleOrderModel> getOrderModels() {
return orderModels;
}
public void setOrderModels(List<UserSimpleOrderModel> orderModels) {
this.orderModels = orderModels;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getRegisteredTime() {
return registeredTime;
}
public void setRegisteredTime(Long registeredTime) {
this.registeredTime = registeredTime;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
}
| [
"[email protected]"
] | |
7617ccaf65d687e9481d7984bf87a064f6214cb8 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/elastic--elasticsearch/636bfe846648b77dfcaed8d46e2d5963b0bc3348/after/InternalSearchHit.java | 76fbc5d519d58bcedc00d963c72ec1b6bcbf4019 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,953 | java | /*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search 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.elasticsearch.search.internal;
import org.apache.lucene.search.Explanation;
import org.elasticsearch.ElasticSearchParseException;
import org.elasticsearch.common.collect.ImmutableMap;
import org.elasticsearch.common.trove.TIntObjectHashMap;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHitField;
import org.elasticsearch.search.SearchShardTarget;
import org.elasticsearch.search.highlight.HighlightField;
import org.elasticsearch.util.Unicode;
import org.elasticsearch.util.io.stream.StreamInput;
import org.elasticsearch.util.io.stream.StreamOutput;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import static org.elasticsearch.common.lucene.Lucene.*;
import static org.elasticsearch.search.SearchShardTarget.*;
import static org.elasticsearch.search.highlight.HighlightField.*;
import static org.elasticsearch.search.internal.InternalSearchHitField.*;
/**
* @author kimchy (shay.banon)
*/
public class InternalSearchHit implements SearchHit {
private transient int docId;
private String id;
private String type;
private byte[] source;
private Map<String, SearchHitField> fields = ImmutableMap.of();
private Map<String, HighlightField> highlightFields = ImmutableMap.of();
private Explanation explanation;
@Nullable private SearchShardTarget shard;
private Map<String, Object> sourceAsMap;
private InternalSearchHit() {
}
public InternalSearchHit(int docId, String id, String type, byte[] source, Map<String, SearchHitField> fields) {
this.docId = docId;
this.id = id;
this.type = type;
this.source = source;
this.fields = fields;
}
public int docId() {
return this.docId;
}
@Override public String index() {
return shard.index();
}
@Override public String getIndex() {
return index();
}
@Override public String id() {
return id;
}
@Override public String getId() {
return id();
}
@Override public String type() {
return type;
}
@Override public String getType() {
return type();
}
@Override public byte[] source() {
return source;
}
@Override public Map<String, Object> getSource() {
return sourceAsMap();
}
@Override public String sourceAsString() {
if (source == null) {
return null;
}
return Unicode.fromBytes(source);
}
@SuppressWarnings({"unchecked"})
@Override public Map<String, Object> sourceAsMap() throws ElasticSearchParseException {
if (source == null) {
return null;
}
if (sourceAsMap != null) {
return sourceAsMap;
}
XContentParser parser = null;
try {
parser = XContentFactory.xContent(source).createParser(source);
sourceAsMap = parser.map();
parser.close();
return sourceAsMap;
} catch (Exception e) {
throw new ElasticSearchParseException("Failed to parse source to map", e);
} finally {
if (parser != null) {
parser.close();
}
}
}
@Override public Iterator<SearchHitField> iterator() {
return fields.values().iterator();
}
@Override public Map<String, SearchHitField> fields() {
return fields;
}
@Override public Map<String, SearchHitField> getFields() {
return fields();
}
public void fields(Map<String, SearchHitField> fields) {
this.fields = fields;
}
@Override public Map<String, HighlightField> highlightFields() {
return this.highlightFields;
}
@Override public Map<String, HighlightField> getHighlightFields() {
return highlightFields();
}
public void highlightFields(Map<String, HighlightField> highlightFields) {
this.highlightFields = highlightFields;
}
@Override public Explanation explanation() {
return explanation;
}
@Override public Explanation getExplanation() {
return explanation();
}
public void explanation(Explanation explanation) {
this.explanation = explanation;
}
@Override public SearchShardTarget shard() {
return shard;
}
@Override public SearchShardTarget getShard() {
return shard();
}
public void shard(SearchShardTarget target) {
this.shard = target;
}
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field("_index", shard.index());
// builder.field("_shard", shard.shardId());
// builder.field("_node", shard.nodeId());
builder.field("_type", type());
builder.field("_id", id());
if (source() != null) {
if (XContentFactory.xContentType(source()) == builder.contentType()) {
builder.rawField("_source", source());
} else {
builder.field("_source");
builder.value(source());
}
}
if (fields != null && !fields.isEmpty()) {
builder.startObject("fields");
for (SearchHitField field : fields.values()) {
if (field.values().isEmpty()) {
continue;
}
if (field.values().size() == 1) {
builder.field(field.name(), field.values().get(0));
} else {
builder.field(field.name());
builder.startArray();
for (Object value : field.values()) {
builder.value(value);
}
builder.endArray();
}
}
builder.endObject();
}
if (highlightFields != null && !highlightFields.isEmpty()) {
builder.startObject("highlight");
for (HighlightField field : highlightFields.values()) {
builder.field(field.name());
if (field.fragments() == null) {
builder.nullValue();
} else {
builder.startArray();
for (String fragment : field.fragments()) {
builder.value(fragment);
}
builder.endArray();
}
}
builder.endObject();
}
if (explanation() != null) {
builder.field("_explanation");
buildExplanation(builder, explanation());
}
builder.endObject();
}
private void buildExplanation(XContentBuilder builder, Explanation explanation) throws IOException {
builder.startObject();
builder.field("value", explanation.getValue());
builder.field("description", explanation.getDescription());
Explanation[] innerExps = explanation.getDetails();
if (innerExps != null) {
builder.startArray("details");
for (Explanation exp : innerExps) {
buildExplanation(builder, exp);
}
builder.endArray();
}
builder.endObject();
}
public static InternalSearchHit readSearchHit(StreamInput in) throws IOException {
InternalSearchHit hit = new InternalSearchHit();
hit.readFrom(in);
return hit;
}
public static InternalSearchHit readSearchHit(StreamInput in, @Nullable TIntObjectHashMap<SearchShardTarget> shardLookupMap) throws IOException {
InternalSearchHit hit = new InternalSearchHit();
hit.readFrom(in, shardLookupMap);
return hit;
}
@Override public void readFrom(StreamInput in) throws IOException {
readFrom(in, null);
}
public void readFrom(StreamInput in, @Nullable TIntObjectHashMap<SearchShardTarget> shardLookupMap) throws IOException {
id = in.readUTF();
type = in.readUTF();
int size = in.readVInt();
if (size > 0) {
source = new byte[size];
in.readFully(source);
}
if (in.readBoolean()) {
explanation = readExplanation(in);
}
size = in.readVInt();
if (size == 0) {
fields = ImmutableMap.of();
} else if (size == 1) {
SearchHitField hitField = readSearchHitField(in);
fields = ImmutableMap.of(hitField.name(), hitField);
} else if (size == 2) {
SearchHitField hitField1 = readSearchHitField(in);
SearchHitField hitField2 = readSearchHitField(in);
fields = ImmutableMap.of(hitField1.name(), hitField1, hitField2.name(), hitField2);
} else if (size == 3) {
SearchHitField hitField1 = readSearchHitField(in);
SearchHitField hitField2 = readSearchHitField(in);
SearchHitField hitField3 = readSearchHitField(in);
fields = ImmutableMap.of(hitField1.name(), hitField1, hitField2.name(), hitField2, hitField3.name(), hitField3);
} else if (size == 4) {
SearchHitField hitField1 = readSearchHitField(in);
SearchHitField hitField2 = readSearchHitField(in);
SearchHitField hitField3 = readSearchHitField(in);
SearchHitField hitField4 = readSearchHitField(in);
fields = ImmutableMap.of(hitField1.name(), hitField1, hitField2.name(), hitField2, hitField3.name(), hitField3, hitField4.name(), hitField4);
} else if (size == 5) {
SearchHitField hitField1 = readSearchHitField(in);
SearchHitField hitField2 = readSearchHitField(in);
SearchHitField hitField3 = readSearchHitField(in);
SearchHitField hitField4 = readSearchHitField(in);
SearchHitField hitField5 = readSearchHitField(in);
fields = ImmutableMap.of(hitField1.name(), hitField1, hitField2.name(), hitField2, hitField3.name(), hitField3, hitField4.name(), hitField4, hitField5.name(), hitField5);
} else {
ImmutableMap.Builder<String, SearchHitField> builder = ImmutableMap.builder();
for (int i = 0; i < size; i++) {
SearchHitField hitField = readSearchHitField(in);
builder.put(hitField.name(), hitField);
}
fields = builder.build();
}
size = in.readVInt();
if (size == 0) {
highlightFields = ImmutableMap.of();
} else if (size == 1) {
HighlightField field = readHighlightField(in);
highlightFields = ImmutableMap.of(field.name(), field);
} else if (size == 2) {
HighlightField field1 = readHighlightField(in);
HighlightField field2 = readHighlightField(in);
highlightFields = ImmutableMap.of(field1.name(), field1, field2.name(), field2);
} else if (size == 3) {
HighlightField field1 = readHighlightField(in);
HighlightField field2 = readHighlightField(in);
HighlightField field3 = readHighlightField(in);
highlightFields = ImmutableMap.of(field1.name(), field1, field2.name(), field2, field3.name(), field3);
} else if (size == 4) {
HighlightField field1 = readHighlightField(in);
HighlightField field2 = readHighlightField(in);
HighlightField field3 = readHighlightField(in);
HighlightField field4 = readHighlightField(in);
highlightFields = ImmutableMap.of(field1.name(), field1, field2.name(), field2, field3.name(), field3, field4.name(), field4);
} else {
ImmutableMap.Builder<String, HighlightField> builder = ImmutableMap.builder();
for (int i = 0; i < size; i++) {
HighlightField field = readHighlightField(in);
builder.put(field.name(), field);
}
highlightFields = builder.build();
}
if (shardLookupMap != null) {
int lookupId = in.readVInt();
if (lookupId > 0) {
shard = shardLookupMap.get(lookupId);
}
} else {
if (in.readBoolean()) {
shard = readSearchShardTarget(in);
}
}
}
@Override public void writeTo(StreamOutput out) throws IOException {
writeTo(out, null);
}
public void writeTo(StreamOutput out, @Nullable Map<SearchShardTarget, Integer> shardLookupMap) throws IOException {
out.writeUTF(id);
out.writeUTF(type);
if (source == null) {
out.writeVInt(0);
} else {
out.writeVInt(source.length);
out.writeBytes(source);
}
if (explanation == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
writeExplanation(out, explanation);
}
if (fields == null) {
out.writeVInt(0);
} else {
out.writeVInt(fields.size());
for (SearchHitField hitField : fields().values()) {
hitField.writeTo(out);
}
}
if (highlightFields == null) {
out.writeVInt(0);
} else {
out.writeVInt(highlightFields.size());
for (HighlightField highlightField : highlightFields.values()) {
highlightField.writeTo(out);
}
}
if (shardLookupMap == null) {
if (shard == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
shard.writeTo(out);
}
} else {
if (shard == null) {
out.writeVInt(0);
} else {
out.writeVInt(shardLookupMap.get(shard));
}
}
}
} | [
"[email protected]"
] | |
0f2aeacb754cfdaa6590fd9a9c52a3a4070607b5 | b21abac50f72e1b9ee188885e796a2d274ec7764 | /src/main/java/com/jianglei/mstransfer/service/UserService.java | 410ed015cb6e5ca594fd78f7b71a36a3e9b83887 | [] | no_license | hanhongyuan/springboot-mybatis-typehandler | 68b15de0af1cd17f3d8cfae0fe5126716369c414 | 6b761243f4bfeca5a9187e685ac1688fdd551dc4 | refs/heads/master | 2021-01-16T18:09:18.790109 | 2017-07-25T14:17:44 | 2017-07-25T14:17:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package com.jianglei.mstransfer.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jianglei.mstransfer.dao.CommonDao;
import com.jianglei.mstransfer.datasource.TargetDataSource;
import com.jianglei.mstransfer.model.OtherInfo2;
import com.jianglei.mstransfer.model.User;
@Service
public class UserService {
@Autowired
private CommonDao dao;
@TargetDataSource(name="ds1")
public void test() {
try {
User user = dao.selectOne("user.get", 1);
System.err.println(user);
List<OtherInfo2> list = user.getList();
System.out.println(list);
System.out.println(user.getArray());
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
6b35ec6bd64047375cc047da25ee60bd731ce0dc | bc9cc198d05d4641e350ebab9c3ad61415355deb | /src/main/java/com/imooc/mall/controller/CategoryController.java | 1effb290ef42643fb25fa5fdefd1323555b1f8b5 | [] | no_license | lhy717098106/imooc-mall | 8138db8e4dbff3e6b8ec6866e38a625595a785cd | 8e452ffe2e6bdd4155916f17f96e5500248092ad | refs/heads/master | 2023-08-28T15:10:14.888875 | 2021-10-29T22:22:57 | 2021-10-29T22:22:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,185 | java | package com.imooc.mall.controller;
import com.github.pagehelper.PageInfo;
import com.imooc.mall.common.ApiRestResponse;
import com.imooc.mall.common.Constant;
import com.imooc.mall.exception.ImoocMallExceptionEnum;
import com.imooc.mall.model.pojo.Category;
import com.imooc.mall.model.pojo.User;
import com.imooc.mall.model.request.AddCategoryReq;
import com.imooc.mall.model.request.UpdateCategoryReq;
import com.imooc.mall.model.vo.CategoryVO;
import com.imooc.mall.service.CategoryService;
import com.imooc.mall.service.UserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import java.util.List;
/**
* 描述:目录Controller
*/
@Controller
public class CategoryController {
@Autowired
UserService userService;
@Autowired
CategoryService categoryService;
/**
* 后台添加目录
* @param session
* @param addCategoryReq
* @return
*/
@ApiOperation("后台添加目录")
@PostMapping("/admin/category/add")
@ResponseBody
public ApiRestResponse addCategory(HttpSession session,@Valid @RequestBody AddCategoryReq addCategoryReq) {
User currentUser = (User) session.getAttribute(Constant.IMOOC_MALL_USER);
if (currentUser == null) {
return ApiRestResponse.error(ImoocMallExceptionEnum.NEED_LOGIN);
}
//校验是否是管理员
boolean adminRole = userService.checkAdminRole(currentUser);
if (adminRole) {
// 是管理员,执行操作
categoryService.add(addCategoryReq);
return ApiRestResponse.success();
} else {
return ApiRestResponse.error(ImoocMallExceptionEnum.NEED_ADMIN);
}
}
@ApiOperation("后台更新目录")
@PostMapping("/admin/category/update")
@ResponseBody //这这两个注解不需要 入参校验 入参格式可以为json
public ApiRestResponse updateCategory(@Valid @RequestBody UpdateCategoryReq updateCategoryReq, HttpSession session ){
User currentUser = (User) session.getAttribute(Constant.IMOOC_MALL_USER);
if (currentUser == null) {
return ApiRestResponse.error(ImoocMallExceptionEnum.NEED_LOGIN);
}
//校验是否是管理员
boolean adminRole = userService.checkAdminRole(currentUser);
if (adminRole) {
// 是管理员,执行操作
Category category = new Category();
BeanUtils.copyProperties(updateCategoryReq, category);
categoryService.update(category);
return ApiRestResponse.success();
} else {
return ApiRestResponse.error(ImoocMallExceptionEnum.NEED_ADMIN);
}
}
@ApiOperation("后台删除目录")
@PostMapping("/admin/category/delete")
@ResponseBody
public ApiRestResponse deleteCategory(@RequestParam Integer id) {
categoryService.delete(id);
return ApiRestResponse.success();
}
@ApiOperation("后台目录列表")
@PostMapping("admin/category/list") //资源前面的斜杠可以不要
@ResponseBody
public ApiRestResponse listCategoryForAdmin(@RequestParam Integer pageNum, @RequestParam Integer pageSize) {
PageInfo pageInfo = categoryService.listForAdmin(pageNum, pageSize);
return ApiRestResponse.success(pageInfo);
}
@ApiOperation("前台目录列表")
@PostMapping("category/list") //资源前面的斜杠可以不要
@ResponseBody
public ApiRestResponse listCategoryForCoustomer() {
List<CategoryVO> categoryVOS = categoryService.listCategoryForCustomer(0); // 0 把1 2 3级目录全部查出来 重构
return ApiRestResponse.success(categoryVOS);
}
} | [
"[email protected]"
] | |
505bc49ee9c02b4448a6aee0ef45e06e173a32c7 | c30c711726d87d454110f00425bc334312ee0de9 | /src/ventanas/LimaDiamantada.java | 7ad4e68d5e1830b61064ed396a25265aea0eecc3 | [] | no_license | dapuer95/Busqueda_de_productos | d99bdee489d8ecc580ab4b1e6b98e7550b665251 | 0365a92ffe774a7f62bc2ac99f5890715a92e4a2 | refs/heads/main | 2023-07-18T09:26:00.412960 | 2021-08-30T20:19:24 | 2021-08-30T20:19:24 | 378,510,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,712 | java | package ventanas;
import java.awt.Color;
import java.awt.event.ItemEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashSet;
import javax.swing.JTable;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import javax.swing.JOptionPane;
public class LimaDiamantada extends javax.swing.JFrame {
public static int k = 0;
public static LimaDiamantada obj = null;
public String form = "";
public static String cod = "";
public static String tipo = "";
public static String descripcion = new String();
public static String codigo2 = new String();
ArrayList<String> listalon = new ArrayList();
public HashSet hs = new HashSet();
String data[][] = {};
String cabeza[] = {"Codigo", "Descripción", "Info", "Cotizar", "Total", "Me", "Ca", "Bo", "Ma"};
DefaultTableModel model = new DefaultTableModel(data, cabeza) {
//Metodo que permite que no se púeda editar los valores de la tabla
@Override
public Class getColumnClass(int indiceColumna) {
Object k = getValueAt(0, indiceColumna);
if (k == null) {
return Object.class;
} else {
return k.getClass();
}
}
//Metodo que permite que no se púeda editar los valores de la tabla
@Override
public boolean isCellEditable(int filas, int columnas) {
if (columnas == 9) {
return true;
} else {
return false;
}
}
};
public LimaDiamantada() {
initComponents();
setTitle("Lima diamantada");
this.setLocationRelativeTo(null);
this.setResizable(false);
this.getContentPane().setBackground(Color.WHITE);
cargar_tipo();
cargar_imagen();
}
public static LimaDiamantada getObj() {
if (obj == null) {
obj = new LimaDiamantada();
}
return obj;
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
tabla_resultados = new javax.swing.JTable();
Espesor = new javax.swing.JLabel();
combo_tipo = new javax.swing.JComboBox<>();
label_dim = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
menu_recargar = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setText("Seleccione las caracteristicas de la lima");
tabla_resultados.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null}
},
new String [] {
"Codigo", "Descripción", "Info", "Cotizar", "Total", "Me", "Ca", "Bo", "Ma"
}
));
jScrollPane1.setViewportView(tabla_resultados);
if (tabla_resultados.getColumnModel().getColumnCount() > 0) {
tabla_resultados.getColumnModel().getColumn(0).setMaxWidth(50);
tabla_resultados.getColumnModel().getColumn(2).setMaxWidth(40);
tabla_resultados.getColumnModel().getColumn(3).setMaxWidth(50);
tabla_resultados.getColumnModel().getColumn(4).setMaxWidth(38);
tabla_resultados.getColumnModel().getColumn(5).setMaxWidth(27);
tabla_resultados.getColumnModel().getColumn(6).setMaxWidth(27);
tabla_resultados.getColumnModel().getColumn(7).setMaxWidth(27);
tabla_resultados.getColumnModel().getColumn(8).setMaxWidth(27);
}
Espesor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/forma_icono.png"))); // NOI18N
Espesor.setText("Forma de la lima");
combo_tipo.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
combo_tipoItemStateChanged(evt);
}
});
jMenu1.setText("Opciones");
menu_recargar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_NUMPAD4, java.awt.event.InputEvent.ALT_MASK));
menu_recargar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/limpiar2_icono.png"))); // NOI18N
menu_recargar.setText("Limpiar");
jMenu1.add(menu_recargar);
jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/recargar_icono.png"))); // NOI18N
jMenuItem2.setText("Regargar");
jMenu1.add(jMenuItem2);
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(18, Short.MAX_VALUE)
.addComponent(label_dim, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(128, 128, 128)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Espesor)
.addComponent(combo_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addGap(92, 92, 92)
.addComponent(jLabel1)))
.addGap(30, 30, 30))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(26, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label_dim, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(Espesor)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(combo_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(10, 10, 10))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void PropiedadesTabla() {
tabla_resultados.setRowHeight(26);
TableColumn codigo = tabla_resultados.getColumn("Codigo");
TableColumn desc = tabla_resultados.getColumn("Descripción");
TableColumn info = tabla_resultados.getColumn("Info");
TableColumn cotizar = tabla_resultados.getColumn("Cotizar");
TableColumn total = tabla_resultados.getColumn("Total");
TableColumn me = tabla_resultados.getColumn("Me");
TableColumn ca = tabla_resultados.getColumn("Ca");
TableColumn bo = tabla_resultados.getColumn("Bo");
TableColumn ma = tabla_resultados.getColumn("Ma");
codigo.setMaxWidth(50);
info.setMaxWidth(40);
cotizar.setMaxWidth(50);
total.setMaxWidth(38);
me.setMaxWidth(27);
bo.setMaxWidth(27);
ca.setMaxWidth(27);
ma.setMaxWidth(27);
}
private void combo_tipoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_combo_tipoItemStateChanged
if (evt.getStateChange() == ItemEvent.SELECTED) {
buscar();
cargar_imagen();
}
}//GEN-LAST:event_combo_tipoItemStateChanged
private void cargar_imagen() {
form = combo_tipo.getSelectedItem().toString();
System.out.println(form);
ImageIcon imagen1 = new ImageIcon("src/images/lima_diamantada" + form + ".png");
Icon icono1 = new ImageIcon(imagen1.getImage());
label_dim.setIcon(icono1);
}
private void cargar_tipo() {
combo_tipo.removeAllItems();
try {
//Conexión con la base de datos
Connection cn = DriverManager.getConnection("jdbc:mysql://localhost/catalogo", "root", "");
//Instrucciones para la busqueda en la base de datos
PreparedStatement pst = cn.prepareStatement("select distinct tipo from lima_diamantada where (total > 0) order by tipo asc");
ResultSet rs = pst.executeQuery();
//Metodo para que busque todos los resultados posible con las condiciones dadas
while (rs.next()) {
String tipo = rs.getString("tipo");
combo_tipo.addItem(tipo);
}
rs.close();
cn.close();
} catch (Exception e) {
System.out.println("Se perdio la conexión en cargar_des");
}
}
private static boolean isNumeric(String cadena) {
try {
Integer.parseInt(cadena);
return true;
} catch (NumberFormatException nfe) {
return false;
}
}
private void buscar() {
try {
//Conexión con la base de datos
Connection cn5 = DriverManager.getConnection("jdbc:mysql://localhost/catalogo", "root", "");
//Instrucciones para la busqueda en la base de datos
PreparedStatement pst5 = cn5.prepareStatement("select * from lima_diamantada where (total > 0) AND (tipo = ?)");
pst5.setString(1, combo_tipo.getSelectedItem().toString());
// Declaración de la variable que alberga el resultado de la busqueda
ResultSet rs5 = pst5.executeQuery();
//Se limpian los componentes de la tabla luego de cada busqueda
model.setRowCount(0);
//Ajuste de la tabla al JScrollPane
tabla_resultados = new JTable(model);
jScrollPane1.setViewportView(tabla_resultados);
PropiedadesTabla();
//Metodo para que busque todos los resultados posible con las condiciones dadas
while (rs5.next()) {
//txt_codigo.setText(rs.getString("codigo"));
String cod = rs5.getString("codigo");
String estado = rs5.getString("descripcion");
String total = rs5.getString("total");
String me = rs5.getString("me");
String ca = rs5.getString("ca");
String bo = rs5.getString("bo");
String ma = rs5.getString("ma");
cargar_imagen();
ImageIcon imagen1 = new ImageIcon("src/images/informacion.png");
Icon icono1 = new ImageIcon(imagen1.getImage());
ImageIcon imagen2 = new ImageIcon("src/images/carrito.png");
Icon icono2 = new ImageIcon(imagen2.getImage());
model.addRow(new Object[]{cod, estado, icono1, icono2, total, me, ca, bo, ma});
}
rs5.close();
cn5.close();
} catch (Exception e) {
System.out.println("no hay conexion en buscar");
}
//Metodo para mostrar la información del elmento que se encuentra en la fila que selecciona y se da click
tabla_resultados.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
//int fila_point = tabla_resultados.rowAtPoint(e.getPoint());
int fila_point = tabla_resultados.rowAtPoint(e.getPoint());
int columna_point = tabla_resultados.columnAtPoint(e.getPoint());
if (fila_point > -1 && columna_point == 2) {
codigo2 = (String) model.getValueAt(fila_point, columna_point = 0);
descripcion = (String) model.getValueAt(fila_point, columna_point = 1);
InformacionLimaDiamantada informacionlimadiamantada = new InformacionLimaDiamantada();
informacionlimadiamantada.setVisible(true);
codigo2 = "";
}
if (fila_point > -1 && columna_point == 3) {
pdf.contar();
if (pdf.limite <= 49) {
codigo2 = (String) model.getValueAt(fila_point, columna_point = 0);
descripcion = (String) model.getValueAt(fila_point, columna_point = 1);
String canti = JOptionPane.showInputDialog(null, "¿Cuantas unidades del codigo " + codigo2 + "\n desea agregar a la cotización?", "Cantidad", JOptionPane.QUESTION_MESSAGE);
if (isNumeric(canti)) {
k = Integer.parseInt(canti);
} else {
System.out.println("no es posible transformar el string" + canti + "a un número entero");
}
boolean n = isNumeric(canti);
if (isNumeric(canti) && n == true && k > 0) {
pdf.AddRowToJTable(new Object[]{"", codigo2, "", "", "", "", canti});
pdf.cargar_nombre();
pdf.calcular_total();
} else {
JOptionPane.showMessageDialog(null, "Debe ingresar un valor numérico mayor a 0", "Advertencia", HEIGHT);
}
} else {
JOptionPane.showMessageDialog(null, "No es posible agregar mas items a la cotización", "Advertencia", HEIGHT);
}
}
}
});
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(LimaDiamantada.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LimaDiamantada.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LimaDiamantada.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LimaDiamantada.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LimaDiamantada().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel Espesor;
private javax.swing.JComboBox<String> combo_tipo;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel label_dim;
private javax.swing.JMenuItem menu_recargar;
private javax.swing.JTable tabla_resultados;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
59a9c37ac045008709428cc5ce930fc521be0b20 | 3399c010c394c25f1966fcc97ac4fa6ef42ef4bf | /webchatapp/src/main/java/com/eugene/webchatapp/DAO/UserDAO.java | a92775f81a58f8644416938b90ff50d90c06a6eb | [] | no_license | EugeneSayko/webChat | 8d7b72ad07f22b3a6e274b8e6a860d8f35875d90 | 9f3c84a84986efd1777d43e41264dbc47ab4d684 | refs/heads/master | 2021-01-18T22:48:26.074050 | 2016-05-31T02:40:40 | 2016-05-31T02:40:40 | 51,355,143 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,156 | java | package com.eugene.webchatapp.DAO;
import com.eugene.webchatapp.models.User;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
/**
* Created by eugene on 26.05.16.
*/
public class UserDAO {
private static final String SQL_INSERT = "INSERT INTO users(id, name, password) VALUES(?, ?, ?)";
private static final String SQL_ALL_SELECT = "SELECT * FROM users";
private static final String SQL_NAME_SELECT = "SELECT name FROM users";
private static final String SQL_UPDATE_NAME = "UPDATE users set name=? WHERE name = ?";
private static final String SQL_NAME_SELECT_BY_ID = "SELECT name FROM users WHERE id = ?";
private static final String SQL_ID_SELECT_BY_NAME = "SELECT id FROM users WHERE name = ?";
private static final String SQL_USER_SELECT_BY_NAME = "SELECT * FROM users WHERE name=?";
public boolean insertUser(User user){
boolean flag = false;
try(
PreparedStatement ps = ConnectorDB.getConnection().prepareStatement(SQL_INSERT);
) {
ps.setString(1, user.getId());
ps.setString(2, user.getName());
ps.setString(3, user.getPassword());
ps.executeUpdate();
flag = true;
ConnectorDB.closeConnection();
} catch (SQLException e) {
e.printStackTrace();
}
return flag;
}
public List<User> findAll(){
List<User> users = new ArrayList<>();
try(
Statement statement = ConnectorDB.getConnection().createStatement();
) {
ResultSet resultSet = statement.executeQuery(SQL_ALL_SELECT);
while(resultSet.next()){
User user = new User();
user.setId(resultSet.getString("id"));
user.setName(resultSet.getString("name"));
user.setPassword(resultSet.getString("password"));
users.add(user);
}
ConnectorDB.closeConnection();
} catch (SQLException e) {
e.printStackTrace();
}
return users;
}
public User findUser(String username){
User user = null;
try(
PreparedStatement preparedStatement = ConnectorDB.getConnection().prepareStatement(SQL_USER_SELECT_BY_NAME);
) {
preparedStatement.setString(1, username);
ResultSet resultSet = preparedStatement.executeQuery();
if(resultSet.next()){
user = new User();
user.setId(resultSet.getString("id"));
user.setName(resultSet.getString("name"));
user.setPassword(resultSet.getString("password"));
}
ConnectorDB.closeConnection();
} catch (SQLException e) {
e.printStackTrace();
}
return user;
}
public List<String> findName(){
List<String> names = new ArrayList<>();
try(
Statement statement = ConnectorDB.getConnection().createStatement();
) {
ResultSet resultSet = statement.executeQuery(SQL_NAME_SELECT);
while(resultSet.next()){
String name = resultSet.getString("name");
names.add(name);
}
ConnectorDB.closeConnection();
} catch (SQLException e) {
e.printStackTrace();
}
return names;
}
public boolean updateName(String oldName, String newName){
boolean flag = false;
try(
PreparedStatement ps = ConnectorDB.getConnection().prepareStatement(SQL_UPDATE_NAME);
) {
ps.setString(1, newName);
ps.setString(2, oldName);
ps.executeUpdate();
flag = true;
ConnectorDB.closeConnection();
} catch (SQLException e) {
e.printStackTrace();
}
return flag;
}
public String findById(String id){
String name = null;
try(
PreparedStatement preparedStatement = ConnectorDB.getConnection().prepareStatement(SQL_NAME_SELECT_BY_ID);
) {
preparedStatement.setString(1, id);
ResultSet resultSet = preparedStatement.executeQuery();
if(resultSet.next()){
name = resultSet.getString("name");
}
ConnectorDB.closeConnection();
} catch (SQLException e) {
e.printStackTrace();
}
return name;
}
public String findByName(String name){
String id = null;
try(
PreparedStatement preparedStatement = ConnectorDB.getConnection().prepareStatement(SQL_ID_SELECT_BY_NAME);
) {
preparedStatement.setString(1, name);
ResultSet resultSet = preparedStatement.executeQuery();
if(resultSet.next()){
id = resultSet.getString("id");
}
ConnectorDB.closeConnection();
} catch (SQLException e) {
e.printStackTrace();
}
return id;
}
}
| [
"[email protected]"
] | |
25a6fb42401ed31bad9a6605b71db3b2af442d1b | bc18b57409111dada3a48f72ac095628936f827a | /src/org/apache/lucene/search/ArticleNamespaceScaling.java | efdc3e786ba9c66d13e0407cd75699bbcac7890e | [] | no_license | sridhar-newsdistill/operations-debs-lucene-search-2 | f895a48ade280a7f62b3bf0ea85594a79543c928 | 5c1d8e45e081f78a0640925629cb6b988850e69b | refs/heads/master | 2021-01-13T07:59:53.773586 | 2014-02-12T10:54:09 | 2014-02-13T23:13:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,195 | java | package org.apache.lucene.search;
import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
public class ArticleNamespaceScaling implements Serializable {
protected float[] nsBoost = null;
public static float talkPageScale = 0.25f;
/** Initialize from ns -> boost map */
public ArticleNamespaceScaling(Map<Integer,Float> map){
int max = map.size()==0? 0 : Collections.max(map.keySet());
nsBoost = new float[max+2];
// default values
for(int i=0;i<nsBoost.length;i++)
nsBoost[i] = defaultValue(i);
// custom
for(Entry<Integer,Float> e : map.entrySet()){
int ns = e.getKey();
nsBoost[ns] = e.getValue();
if(ns % 2 == 0 && !map.containsKey(ns+1)){
// rescale default for talk page
nsBoost[ns+1] = e.getValue() * talkPageScale;
}
}
}
/** Get boost for namespace */
public float scaleNamespace(int ns){
if(ns >= nsBoost.length || ns < 0)
return defaultValue(ns);
else
return nsBoost[ns];
}
/** Produce default boost for namespace */
protected float defaultValue(int ns){
if(ns % 2 == 0) // content ns
return 1f;
else // corresponding talk ns
return talkPageScale;
}
}
| [
"[email protected]"
] | |
78fb39c4100745d014cb62fc49e0630f5c563c2c | 0144eb8f55aacb99d954ba89f6189dfd68aac581 | /src/main/java/com/algaworks/algafood/domain/repository/UserRepository.java | 55e41cf8a25c993231ed98e9ca3ae899b3cd09eb | [] | no_license | flavioso16/espec-spring-algaworks | 9b7bc891dde4f08c955bf0be6356654a3c83f436 | 2b385236f467343d01b9d255c0e6faac07dd1f42 | refs/heads/master | 2023-05-05T13:18:15.545143 | 2021-05-30T23:52:04 | 2021-05-30T23:52:04 | 302,503,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package com.algaworks.algafood.domain.repository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.algaworks.algafood.domain.model.User;
@Repository
public interface UserRepository extends CustomJpaRepository<User, Long> {
@Query("SELECT COUNT(u) > 0 FROM User u WHERE u.email = :email and (:id is null or u.id <> :id)")
boolean existsByEmailAndIdNot(final String email, final Long id);
}
| [
"[email protected]"
] | |
7452ebf2ccde642add2eea9852b2f513571bfd6e | ec2cf9897b29e1c86f0d2b6ba6cb4f657d853cef | /1.1.0/CryptoMax/app/src/main/java/com/maxtechnologies/cryptomax/wallets/misc/EncryptionUtils.java | 9255475d8fc30eaf5399d9ef07a189a96ea65b6e | [] | no_license | Colman/CryptoMaxAndroid | 1f70dc8881fad1e7ecb8a7a1308c0cc8dd257eea | eb8bd630d981acbbeed94ee768f88d6da6d0dffd | refs/heads/master | 2020-03-30T02:57:13.876674 | 2018-11-27T07:21:36 | 2018-11-27T07:21:36 | 150,660,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,661 | java | package com.maxtechnologies.cryptomax.wallets.misc;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
import java.util.ArrayList;
import java.util.Arrays;
import android.util.Base64;
import java.security.SecureRandom;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKeyFactory;
import javax.crypto.SecretKey;
import javax.crypto.ShortBufferException;
import javax.crypto.spec.SecretKeySpec;
import java.security.spec.KeySpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.IvParameterSpec;
/**
* Created by Colman on 03/05/2018.
*/
public class EncryptionUtils {
public static String[] encrypt(String input, String password) {
//Generate salt and init vector
SecureRandom secureRandom = new SecureRandom();
byte[] salt = secureRandom.generateSeed(16);
byte[] initBytes = secureRandom.generateSeed(16);
IvParameterSpec initVector = new IvParameterSpec(initBytes);
byte[] encrypted;
try {
//Generate secret key from password
KeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 65536, 128);
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
byte[] secret = factory.generateSecret(spec).getEncoded();
//Encrypt input using secret key
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(secret, "AES"), initVector);
encrypted = cipher.doFinal(input.getBytes());
}
catch(NoSuchAlgorithmException e) {
return null;
}
catch(InvalidKeySpecException e) {
return null;
}
catch(NoSuchPaddingException e) {
return null;
}
catch(InvalidAlgorithmParameterException e) {
return null;
}
catch(InvalidKeyException e) {
return null;
}
catch(IllegalBlockSizeException e) {
return null;
}
catch(BadPaddingException e) {
return null;
}
return new String[] {
Base64.encodeToString(encrypted, Base64.DEFAULT),
Base64.encodeToString(salt, Base64.DEFAULT),
Base64.encodeToString(initBytes, Base64.DEFAULT)
};
}
public static String decrypt(String password, String[] encrypted) {
if(encrypted == null || encrypted.length != 3) {
return null;
}
//Convert salt and init vector
byte[] saltBytes = Base64.decode(encrypted[1], Base64.DEFAULT);
byte[] initBytes = Base64.decode(encrypted[2], Base64.DEFAULT);
IvParameterSpec initVec = new IvParameterSpec(initBytes);
byte[] decrypted;
try {
//Generate secret key from password
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
KeySpec spec = new PBEKeySpec(password.toCharArray(), saltBytes, 65536, 128);
byte[] secret = factory.generateSecret(spec).getEncoded();
//Decrypt input using secret key
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(secret, "AES"), initVec);
decrypted = cipher.doFinal(Base64.decode(encrypted[0], Base64.DEFAULT));
}
catch(NoSuchAlgorithmException e) {
return null;
}
catch(InvalidKeySpecException e) {
return null;
}
catch(NoSuchPaddingException e) {
return null;
}
catch(InvalidAlgorithmParameterException e) {
return null;
}
catch(InvalidKeyException e) {
return null;
}
catch(IllegalBlockSizeException e) {
return null;
}
catch(BadPaddingException e) {
return null;
}
return new String(decrypted).trim();
}
}
| [
"[email protected]"
] | |
3a7ebf6d69b6b7edda49796c946710eaaa90c3f6 | e7312ae44ac3ab322c211a85fb655a99e31e7285 | /src/testSiteGetNet/TestConsultarDado.java | 04b9e90693c36e51f8aa733605c2a40a3c5b0b81 | [] | no_license | Betila/getnet | e20e9ad1794fc5c67dede5fabf57c4b1fec007c7 | 3cd06a0cae3c2f6917a823b116dbc9b3a2aeef09 | refs/heads/master | 2022-12-07T08:23:04.125311 | 2020-09-03T15:06:41 | 2020-09-03T15:06:41 | 292,603,506 | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 2,884 | java | package testSiteGetNet;
import static org.junit.Assert.assertEquals;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class TestConsultarDado {
WebDriver driver;
private String URL = "https://site.getnet.com.br/";
private final String CAMPOPROCURADO = "superget";
@Before
public void inicio() throws Throwable {
System.setProperty("webdriver.chrome.driver", "/Users/beti_/bin/chromedriver.exe");
this.driver = new ChromeDriver();
this.driver.get(URL);
this.driver.manage().window().maximize();
Thread.sleep(4000);
}
@SuppressWarnings("unused")
@Test
public void testPesquisar() throws Throwable {
try {
String TituloTela;
String TituloValidacao1 = "Como fašo a portabilidade da minha maquininha?";
String TituloValidacao2 = "Como acesso a minha conta SuperGet?";
this.driver.findElement(By.id("search-trigger")).click();
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("global-search-input")));
this.driver.findElement(By.id("global-search-input")).sendKeys(CAMPOPROCURADO);
this.driver.findElement(By.xpath("/html/body/section/div/div/div/form/button")).click();
List<WebElement> elements = this.driver.findElements(By.xpath("//h3[contains(.,'como fašo a portabilidade da minha maquininha')]"));
if(!elements.isEmpty()){
this.driver.findElement(By.xpath("//h3[contains(.,'como fašo a portabilidade da minha maquininha')]")).click();
WebDriverWait wait1 = new WebDriverWait(driver, 10);
WebElement element1 = wait1.until(ExpectedConditions.presenceOfElementLocated(By.className("is-modal-open")));
TituloTela = this.driver.findElement(By.className("is-modal-open")).findElement(By.className("o-modal__title")).getText();
Thread.sleep(4000);
assertEquals(TituloValidacao1, TituloTela);
}else {
this.driver.findElement(By.xpath("//h3[contains(.,'Como acesso a minha conta SuperGet?')]")).click();
WebDriverWait wait1 = new WebDriverWait(driver, 10);
WebElement element1 = wait1.until(ExpectedConditions.presenceOfElementLocated(By.className("is-modal-open")));
TituloTela = this.driver.findElement(By.className("is-modal-open")).findElement(By.className("o-modal__title")).getText();
Thread.sleep(4000);
assertEquals(TituloValidacao2, TituloTela);
}
}catch(Exception e) {
System.out.println(e.toString());
}
}
@After
public void fim() {
this.driver.quit();
}
}
| [
"[email protected]"
] | |
026f64c3507baec6668ecb38562c547ec953e63c | d4b77d3b6d0743d11c6c7dcd2d8dc39a6a7c7de1 | /WebSwarm/public/Behavior.java | afca2cc934cf43f63e7f6be137064cba305a743f | [] | no_license | rubencodes/GeneticSwarm | 96d00782f6481c15c564ef1a8cf534959b91fef2 | db3a09040216caf1233a5c099ea19f6467dbec90 | refs/heads/master | 2020-05-20T12:52:27.255925 | 2019-02-26T03:14:59 | 2019-02-26T03:14:59 | 21,450,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,726 | java | import java.io.StringReader;
import java.io.IOException;
import java.util.Random;
import java.util.Vector;
import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonObject;
import javax.json.JsonReader;
public class Behavior {
private int comparatorId; //ID of comparator; chooses between >, <, or ==
private int propertyA; //ID of variable used in if()
private int propertyB; //ID of variable/constant compared to
private boolean randomPropertyB; //decides if comparison will be to random prop or constant
public int depthLevel; //current depthLevel
private Vector < Integer > ifPropertyIDs; //IDs of variables to be acted upon, if true
private Vector < Integer > ifActionIDs; //IDs of actions to be taken on variables, if true
private Vector < Integer > elsePropertyIDs; //IDs of variables to be acted upon, if false
private Vector < Integer > elseActionIDs; //IDs of actions to be taken on variables, if false
private Vector < Float > numberBank; //Floats used for setting/incrementing/decrementing actions
private Vector < Float > nullNumberBank; //Floats used for setting/incrementing/decrementing actions
private Vector < Behavior > subBehaviors; //storing any sub-behaviors generated
private Boid boid; //storing our boid for variable value retrieval
private int score; //stores evaluation score
private static final int ALL_VARS_COUNT = 12; //number of variables from boid
private static final int ALL_ACTIONS_COUNT = 3; //number of possible actions
private static final int MAX_BEHAVIOR_DEPTH = 4; //max depth of behavior
private Random r = new Random();
//stores randoms chosen for behavior
private float velocityScale;
private float maxSpeed;
private float normalSpeed;
private float neighborhoodRadius;
private float separationWeight;
private float alignmentWeight;
private float cohesionWeight;
private float pacekeepingWeight;
private float motionProbability;
private float numNeighborsOwnFlock;
private float numNeighborsAllFlocks;
//Auto-Generate Behavior object
public Behavior(String jsonBehavior) {
JsonArray behavior_array = null;
JsonObject behavior = null;
try {
JsonReader rdr = Json.createReader(new StringReader(jsonBehavior));
behavior_array = rdr.readArray();
behavior = behavior_array.getValuesAs(JsonObject.class).get(0);
}
catch (Exception e) {
e.printStackTrace();
}
comparatorId = behavior.getInt("comparator_id");
propertyA = behavior.getInt("property_a_id");
randomPropertyB = behavior.getBoolean("random_property_b");
propertyB = behavior.getInt("property_b_id");
depthLevel = behavior.getInt("depth_level");
//create new vectors for behavior
ifActionIDs = new Vector < Integer > ();
ifPropertyIDs = new Vector < Integer > ();
elseActionIDs = new Vector < Integer > ();
elsePropertyIDs = new Vector < Integer > ();
subBehaviors = new Vector < Behavior > ();
//split array by delimiter, convert to array of integers, and convert array to vector
for (String actionVarID : behavior.getString("if_property_ids", "").split(","))
if (!actionVarID.equals(""))
ifPropertyIDs.add(Integer.parseInt(actionVarID));
for (String actionID : behavior.getString("if_action_ids", "").split(","))
if (!actionID.equals(""))
ifActionIDs.add(Integer.parseInt(actionID));
for (String nullActionVarID : behavior.getString("else_property_ids", "").split(","))
if (!nullActionVarID.equals(""))
elsePropertyIDs.add(Integer.parseInt(nullActionVarID));
for (String nullActionID : behavior.getString("else_action_ids", "").split(","))
if (!nullActionID.equals(""))
elseActionIDs.add(Integer.parseInt(nullActionID));
velocityScale = Float.parseFloat(behavior.getString("velocity_scale", "0"));
maxSpeed = Float.parseFloat(behavior.getString("max_speed", "0"));
normalSpeed = Float.parseFloat(behavior.getString("normal_speed", "0"));
neighborhoodRadius = Float.parseFloat(behavior.getString("neighborhood_radius", "0"));
separationWeight = Float.parseFloat(behavior.getString("separation_weight", "0"));
alignmentWeight = Float.parseFloat(behavior.getString("alignment_weight", "0"));
cohesionWeight = Float.parseFloat(behavior.getString("cohesion_weight", "0"));
pacekeepingWeight = Float.parseFloat(behavior.getString("pacekeeping_weight", "0"));
motionProbability = Float.parseFloat(behavior.getString("rand_motion_probability", "0"));
for (int i = 1; i < behavior_array.getValuesAs(JsonObject.class).size(); i++) {
JsonObject subBehavior = behavior_array.getValuesAs(JsonObject.class).get(i);
subBehaviors.add(new Behavior(subBehavior));
}
}
public Behavior(JsonObject behavior) {
comparatorId = behavior.getInt("comparator_id");
propertyA = behavior.getInt("property_a_id");
randomPropertyB = behavior.getBoolean("random_property_b");
propertyB = behavior.getInt("property_b_id");
depthLevel = behavior.getInt("depth_level");
//create new vectors for behavior
ifActionIDs = new Vector < Integer > ();
ifPropertyIDs = new Vector < Integer > ();
elseActionIDs = new Vector < Integer > ();
elsePropertyIDs = new Vector < Integer > ();
subBehaviors = new Vector < Behavior > ();
//split array by delimiter, convert to array of integers, and convert array to vector
for (String actionVarID : behavior.getString("if_property_ids").split(","))
if (!actionVarID.equals(""))
ifPropertyIDs.add(Integer.parseInt(actionVarID));
for (String actionID : behavior.getString("if_action_ids").split(","))
if (!actionID.equals(""))
ifActionIDs.add(Integer.parseInt(actionID));
for (String nullActionVarID : behavior.getString("else_property_ids").split(","))
if (!nullActionVarID.equals(""))
elsePropertyIDs.add(Integer.parseInt(nullActionVarID));
for (String nullActionID : behavior.getString("else_action_ids").split(","))
if (!nullActionID.equals(""))
elseActionIDs.add(Integer.parseInt(nullActionID));
velocityScale = Float.parseFloat(behavior.getString("velocity_scale"));
maxSpeed = Float.parseFloat(behavior.getString("max_speed"));
normalSpeed = Float.parseFloat(behavior.getString("normal_speed"));
neighborhoodRadius = Float.parseFloat(behavior.getString("neighborhood_radius"));
separationWeight = Float.parseFloat(behavior.getString("separation_weight"));
alignmentWeight = Float.parseFloat(behavior.getString("alignment_weight"));
cohesionWeight = Float.parseFloat(behavior.getString("cohesion_weight"));
pacekeepingWeight = Float.parseFloat(behavior.getString("pacekeeping_weight"));
motionProbability = Float.parseFloat(behavior.getString("rand_motion_probability"));
}
//executes Behavior on a boid
public void execute(Boid boid) {
this.boid = boid; //sets boid to act upon
if (compare()) //make a comparison
for (int i = 0; i < ifActionIDs.size(); i++)
actionBank(ifActionIDs.get(i), ifPropertyIDs.get(i), 1);
else //if comparison is false
for (int i = 0; i < elseActionIDs.size(); i++)
actionBank(elseActionIDs.get(i), elsePropertyIDs.get(i), 1);
//execute any sub-behaviors
for (int i = 0; i < subBehaviors.size(); i++)
subBehaviors.get(i).execute(boid);
}
//makes a comparison between two variables
public boolean compare() {
switch (comparatorId) {
case 0:
if (varBank(propertyA, false) > varBank(propertyB, randomPropertyB)) //if var1 > var2
return true;
else return false;
case 1:
if (varBank(propertyA, false) < varBank(propertyB, randomPropertyB)) //if var1 < var2
return true;
else return false;
case 2:
if (varBank(propertyA, false) == varBank(propertyB, randomPropertyB)) //if var1 == var2
return true;
else return false;
}
return false;
}
//bank containing variables, integers, and randoms
public float varBank(int ID, boolean rand) {
switch (ID) {
case 0:
if (rand) return velocityScale;
return boid.getVelocityScale();
case 1:
if (rand) return maxSpeed;
return boid.getMaxSpeed();
case 2:
if (rand) return normalSpeed;
return boid.getNormalSpeed();
case 3:
if (rand) return neighborhoodRadius;
return boid.getNeighborRadius();
case 4:
if (rand) return separationWeight;
return boid.getSeparationWeight();
case 5:
if (rand) return alignmentWeight;
return boid.getAlignmentWeight();
case 6:
if (rand) return cohesionWeight;
return boid.getCohesionWeight();
case 7:
if (rand) return pacekeepingWeight;
return boid.getPacekeepingWeight();
case 8:
if (rand) return motionProbability;
return boid.getRandomMotionProbability();
case 9:
if (rand) return numNeighborsOwnFlock;
return boid.getNumNeighborsOwnFlock();
case 10:
if (rand) return numNeighborsAllFlocks;
return 1;
default:
return ID;
}
}
//bank containing actions for variables
//int ID: chooses between incrementing a variable by x, decrementing by x, or setting to x
//int propertyA: decides which variable is going to be acted on in any of the 3 cases
//float x: what is added, subtracted, or set to a variable
public void actionBank(int ID, int propertyA, float x) {
boolean rand = false; //allows for randomness when grabbing from var bank; not desired in action bank
switch (ID) {
//add to variable
case 0:
float i = varBank(propertyA, rand) + x;
boid.set(propertyA, i);
break;
//subtract from variable
case 1:
float j = varBank(propertyA, rand) - x;
boid.set(propertyA, j);
break;
//set to value
case 2:
boid.set(propertyA, x);
break;
}
}
//print out behavior pseudocode
public void printBehavior() {
System.out.print("if (");
switch(propertyA) {
case 0:
System.out.print("Velocity Scale ");
break;
case 1:
System.out.print("Max Speed ");
break;
case 2:
System.out.print("Normal Speed ");
break;
case 3:
System.out.print("Neighborhood Radius ");
break;
case 4:
System.out.print("Separation Weight ");
break;
case 5:
System.out.print("Alignment Weight ");
break;
case 6:
System.out.print("Cohesion Weight ");
break;
case 7:
System.out.print("Pacekeeping Weight ");
break;
case 8:
System.out.print("Random Motion Probability ");
break;
case 9:
System.out.print("Num Neighbors Own Flock ");
break;
case 10:
System.out.print("Num Neighbors All Flocks ");
break;
}
switch(comparatorId) {
case 0:
System.out.print("> ");
break;
case 1:
System.out.print("< ");
break;
case 2:
System.out.print("== ");
break;
}
if (randomPropertyB) {
switch(propertyB) {
case 0:
System.out.print(velocityScale+") {");
break;
case 1:
System.out.print(maxSpeed+") {");
break;
case 2:
System.out.print(normalSpeed+") {");
break;
case 3:
System.out.print(neighborhoodRadius+") {");
break;
case 4:
System.out.print(separationWeight+") {");
break;
case 5:
System.out.print(alignmentWeight+") {");
break;
case 6:
System.out.print(cohesionWeight+") {");
break;
case 7:
System.out.print(pacekeepingWeight+") {");
break;
case 8:
System.out.print(motionProbability+") {");
break;
case 9:
System.out.print(numNeighborsOwnFlock+") {");
break;
case 10:
System.out.print(numNeighborsAllFlocks+") {");
break;
}
}
else {
switch(propertyA) {
case 0:
System.out.print("Velocity Scale) {");
break;
case 1:
System.out.print("Max Speed) {");
break;
case 2:
System.out.print("Normal Speed) {");
break;
case 3:
System.out.print("Neighborhood Radius) {");
break;
case 4:
System.out.print("Separation Weight) {");
break;
case 5:
System.out.print("Alignment Weight) {");
break;
case 6:
System.out.print("Cohesion Weight) {");
break;
case 7:
System.out.print("Pacekeeping Weight) {");
break;
case 8:
System.out.print("Random Motion Probability) {");
break;
case 9:
System.out.print("Num Neighbors Own Flock) {");
break;
case 10:
System.out.print("Num Neighbors All Flocks) {");
break;
}
}
for (int i = 0; i < ifActionIDs.size(); i++) {
switch(ifPropertyIDs.get(i)) {
case 0:
System.out.print("\n Velocity Scale ");
break;
case 1:
System.out.print("\n Max Speed ");
break;
case 2:
System.out.print("\n Normal Speed ");
break;
case 3:
System.out.print("\n Neighborhood Radius ");
break;
case 4:
System.out.print("\n Separation Weight ");
break;
case 5:
System.out.print("\n Alignment Weight ");
break;
case 6:
System.out.print("\n Cohesion Weight ");
break;
case 7:
System.out.print("\n Pacekeeping Weight ");
break;
case 8:
System.out.print("\n Random Motion Probability ");
break;
case 9:
System.out.print("\n Num Neighbors Own Flock ");
break;
case 10:
System.out.print("\n Num Neighbors All Flocks ");
break;
}
switch(ifActionIDs.get(i)) {
case 0:
System.out.print("+1 ");
break;
case 1:
System.out.print("-1 ");
break;
case 2:
System.out.print("=1 ");
break;
}
}
System.out.println("}");
System.out.println("else {");
for (int i = 0; i < elseActionIDs.size(); i++) {
switch(elsePropertyIDs.get(i)) {
case 0:
System.out.print("\n Velocity Scale ");
break;
case 1:
System.out.print("\n Max Speed ");
break;
case 2:
System.out.print("\n Normal Speed ");
break;
case 3:
System.out.print("\n Neighborhood Radius ");
break;
case 4:
System.out.print("\n Separation Weight ");
break;
case 5:
System.out.print("\n Alignment Weight ");
break;
case 6:
System.out.print("\n Cohesion Weight ");
break;
case 7:
System.out.print("\n Pacekeeping Weight ");
break;
case 8:
System.out.print("\n Random Motion Probability ");
break;
case 9:
System.out.print("\n Num Neighbors Own Flock ");
break;
case 10:
System.out.print("\n Num Neighbors All Flocks ");
break;
}
switch(elseActionIDs.get(i)) {
case 0:
System.out.print("+1 ");
break;
case 1:
System.out.print("-1 ");
break;
case 2:
System.out.print("=1 ");
break;
}
}
System.out.println("}");
}
//getters and setters
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public int getVariableID() {
return propertyA;
}
public void setVariableID(int propertyA) {
this.propertyA = propertyA;
}
public int getComparatorID() {
return comparatorId;
}
public void setComparatorID(int comparatorId) {
this.comparatorId = comparatorId;
}
public int getNextNumID() {
return propertyB;
}
public void setNextNumID(int propertyB) {
this.propertyB = propertyB;
}
public Vector < Integer > getActionIDs() {
return ifActionIDs;
}
public void setActionIDs(Vector < Integer > ifActionIDs) {
this.ifActionIDs = ifActionIDs;
}
public Vector < Integer > getActionVariableIDs() {
return ifPropertyIDs;
}
public void setActionVariableIDs(Vector < Integer > ifPropertyIDs) {
this.ifPropertyIDs = ifPropertyIDs;
}
public Vector < Integer > getNullActionIDs() {
return elseActionIDs;
}
public void setNullActionIDs(Vector < Integer > elseActionIDs) {
this.elseActionIDs = elseActionIDs;
}
public Vector < Integer > getNullActionVariableIDs() {
return elsePropertyIDs;
}
public void setNullActionVariableIDs(Vector < Integer > elsePropertyIDs) {
this.elsePropertyIDs = elsePropertyIDs;
}
public Vector < Float > getNumberBank() {
return numberBank;
}
public void setNumberBank(Vector < Float > numberBank) {
this.numberBank = numberBank;
}
public Vector < Float > getNullNumberBank() {
return nullNumberBank;
}
public void setNullNumberBank(Vector < Float > nullNumberBank) {
this.nullNumberBank = nullNumberBank;
}
public Vector < Behavior > getSubBehaviors() {
return subBehaviors;
}
public void setSubBehaviors(Vector < Behavior > subBehaviors) {
this.subBehaviors = subBehaviors;
}
}
| [
"[email protected]"
] | |
d95c526ecb0a015885f104182d92bbbd670890ae | 1a87782f4f85436c4ff242eae2566b318fc9dff4 | /LookupMethod_DI/src/beans/CarImpl.java | aa565f4d3f6ef26cdef48ea088b9e97aeb85fa95 | [] | no_license | kishanpanchal91/spring | 5df1b4fbde9361bd1a3adb417031c4da33b38843 | 964e11ef01f430e209b568bea7480d8714de43e8 | refs/heads/master | 2020-03-08T05:14:15.605137 | 2018-04-19T07:02:26 | 2018-04-19T07:02:26 | 127,943,227 | 0 | 0 | null | 2018-04-19T07:02:27 | 2018-04-03T17:21:27 | Java | UTF-8 | Java | false | false | 47 | java | package beans;
public class CarImpl {
}
| [
"[email protected]"
] | |
92aa51a185c253e8c77415ef7908e3ca41270a60 | d620ab67aa540c7d8466325a39f962fcf074bd06 | /modules/petals-messaging/src/main/java/org/ow2/petals/messaging/framework/message/mime/writer/TextPlainWriter.java | 9f0ba925a53d2e860526e741ef94d7880aaebe40 | [] | no_license | chamerling/petals-dsb | fa8439f28bb4077a9324371d7eb691b484a12d24 | 58b355b79f4a4d753a3c762f619ec2b32833549a | refs/heads/master | 2016-09-05T20:44:59.125937 | 2012-03-27T10:28:37 | 2012-03-27T10:28:37 | 3,722,608 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,811 | java | /**
* PETALS: PETALS Services Platform Copyright (C) 2009 EBM WebSourcing
*
* This library 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 any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*
* Initial developer(s): EBM WebSourcing
*/
package org.ow2.petals.messaging.framework.message.mime.writer;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.ow2.petals.messaging.framework.message.Constants;
import org.ow2.petals.messaging.framework.message.Message;
import org.ow2.petals.messaging.framework.message.mime.Writer;
/**
* @author chamerling - eBM WebSourcing
*
*/
public class TextPlainWriter implements Writer {
/**
* {@inheritDoc}
*/
public byte[] getBytes(Message message, String encoding) throws WriterException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
// content is is a property...
Object o = message.get(Constants.RAW);
if ((o != null) && (o instanceof String)) {
try {
out.write(((String) o).getBytes());
} catch (IOException e) {
throw new WriterException(e);
}
}
return out.toByteArray();
}
}
| [
"[email protected]"
] | |
488d62cde11424498313590c7cca9e29669d4326 | 34b713d69bae7d83bb431b8d9152ae7708109e74 | /admin/broadleaf-contentmanagement-module/src/main/java/org/broadleafcommerce/cms/page/domain/PageTemplateFieldGroupXref.java | 22945d63ace6029463be91545bb48c9457aa3cf6 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | sinotopia/BroadleafCommerce | d367a22af589b51cc16e2ad094f98ec612df1577 | 502ff293d2a8d58ba50a640ed03c2847cb6369f6 | refs/heads/BroadleafCommerce-4.0.x | 2021-01-23T14:14:45.029362 | 2019-07-26T14:18:05 | 2019-07-26T14:18:05 | 93,246,635 | 0 | 0 | null | 2017-06-03T12:27:13 | 2017-06-03T12:27:13 | null | UTF-8 | Java | false | false | 1,466 | java | /*
* #%L
* BroadleafCommerce CMS Module
* %%
* Copyright (C) 2009 - 2014 Broadleaf Commerce
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package org.broadleafcommerce.cms.page.domain;
import org.broadleafcommerce.cms.field.domain.FieldGroup;
import org.broadleafcommerce.common.copy.MultiTenantCloneable;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
* @author Kelly Tisdell
*
*/
public interface PageTemplateFieldGroupXref extends Serializable, MultiTenantCloneable<PageTemplateFieldGroupXref> {
public void setId(Long id);
public Long getId();
public void setPageTemplate(PageTemplate pageTemplate);
public PageTemplate getPageTemplate();
public void setFieldGroup(FieldGroup fieldGroup);
public FieldGroup getFieldGroup();
public void setGroupOrder(BigDecimal groupOrder);
public BigDecimal getGroupOrder();
}
| [
"[email protected]"
] | |
2d38815672cd25ecda76a93ea9a4e20949c7b4e5 | 0f7d80765671d72f7271a568daa13bacb3c4eff4 | /app/src/main/java/com/example/project/Tab2Fragment.java | df39738f5701b7e6c3a53557eb9ccb9fe98dea4c | [] | no_license | NayanaBannur/OCR-App | 5792cf260cde25c2fd84311925ccb7623af23bb8 | 957734007dd33881b0b761badecb5951ee4015ad | refs/heads/master | 2021-05-18T12:07:00.278541 | 2020-03-30T08:14:33 | 2020-03-30T08:14:33 | 251,237,958 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,418 | java | package com.example.project;
import android.content.Context;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class Tab2Fragment extends Fragment {
private String str_textpath;
private int mode;
private Context context;
private View view;
public Tab2Fragment(String str_textpath, int mode, Context context)
{
this.str_textpath = str_textpath;
this.mode = mode;
this.context = context;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
view = inflater.inflate(R.layout.fragment2, container, false);
TextView text = view.findViewById(R.id.display_text);
String t;
if(mode==Constants.LOCAL_MODE)
{
t = readFileLocal(str_textpath);
if(t.equals(""))
text.setText(getText(R.string.file_open_fail));
else
text.setText(t);
}
else
readFileCloud(str_textpath);
return view;
}
private String readFileLocal(String textpath)
{
File root = new File(Environment.getExternalStorageDirectory(), "OCRFiles");
if (!root.exists()) {
return "";
}
File file = new File(root, textpath);
StringBuilder text = new StringBuilder();
try
{
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
text.append(line);
text.append(' ');
}
br.close();
return text.toString();
}
catch (IOException e) {
Log.d("FILE DEBUG", e.getMessage());
return "";
}
}
private void readFileCloud(String textpath)
{
FirebaseStorage storage = FirebaseStorage.getInstance();
StorageReference storageRef = storage.getReferenceFromUrl(str_textpath);
final long ONE_MEGABYTE = 1024 * 1024;
storageRef.getBytes(ONE_MEGABYTE).addOnSuccessListener(new OnSuccessListener<byte[]>()
{
@Override
public void onSuccess(byte[] bytes)
{
TextView text = view.findViewById(R.id.display_text);
try
{
String ftext = new String(bytes, "UTF-8");
text.setText(ftext);
} catch (IOException e)
{
text.setText(getText(R.string.file_open_fail));
Log.d("FILE READ", "Error: " + e.getMessage());
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
}
});
}
}
| [
"[email protected]"
] | |
067154f9322fd70c6cc3e7d4af0fc036f3e2410c | 5f0f49daae1ad972c9fd0cb0b10594f9ab329d78 | /SRM 671 DIV 2/test/BearPaintsTest.java | 641cbde0f684e30363057e9c5fbb657b03156b72 | [] | no_license | lyveng/topcoder | 68a6c16a0e52efd4047ec7b78b5c7f1a51dd8f24 | a3faed5bf898d6ab7a4cebcca7f567ecea6207e8 | refs/heads/master | 2021-06-12T17:06:56.595248 | 2017-01-15T17:37:54 | 2017-01-15T17:37:54 | 22,494,337 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | import org.junit.Test;
import static org.junit.Assert.*;
public class BearPaintsTest {
@Test(timeout=2000)
public void test0() {
int W = 3;
int H = 5;
long M = 14L;
assertEquals(12L, new BearPaints().maxArea(W, H, M));
}
@Test(timeout=2000)
public void test1() {
int W = 4;
int H = 4;
long M = 10L;
assertEquals(9L, new BearPaints().maxArea(W, H, M));
}
@Test(timeout=2000)
public void test2() {
int W = 1000000;
int H = 12345;
long M = 1000000000000L;
assertEquals(12345000000L, new BearPaints().maxArea(W, H, M));
}
@Test(timeout=2000)
public void test3() {
int W = 1000000;
int H = 1000000;
long M = 720000000007L;
assertEquals(720000000000L, new BearPaints().maxArea(W, H, M));
}
@Test(timeout=2000)
public void test4() {
int W = 1000000;
int H = 1000000;
long M = 999999999999L;
assertEquals(999999000000L, new BearPaints().maxArea(W, H, M));
}
}
| [
"[email protected]"
] | |
1ee06d43273f40ce608cfc349bbefe69c00a1888 | 9e5e9c6c91ddfcff96c822fb5e395cc66eebda7a | /src/main/java/multithread/byThread/ThreadStopDemo.java | 584854aeb63efa539557747d620eb2a8cd2c869e | [] | no_license | seventheluck/JavaDemo | 845415693dd198ef79fc70106f90cb7511aa5c8e | 341c96ddb48669e14c2c51cb424c4ce4dae28d54 | refs/heads/master | 2020-04-18T10:20:04.464594 | 2019-01-25T02:40:22 | 2019-01-25T02:40:22 | 167,464,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package multithread.byThread;
public class ThreadStopDemo {
public static void main(String[] args) {
ThreadStop ts1 = new ThreadStop();
ts1.start();
try {
Thread.sleep(3000);
System.out.println(Thread.currentThread().getName());
ts1.interrupt();
} catch (InterruptedException e) {
}
}
}
| [
"[email protected]"
] | |
f026678423261842765eaf01ab23a2cae2669857 | 2c7b377aa88a740c45c92d58c608ecf0af897b91 | /src/main/java/br/com/zup/forum/repository/CursoRepository.java | c91c0e8cc84eb04e41b2a6a5d03d88f8316565cb | [] | no_license | jocimar-dev/api-rest-zup | 1e6dc2841dfe11f9af40d5ce16614379f8274004 | 92b00b908d6b2bd995ef62d72ff8b4e10469bf0c | refs/heads/master | 2023-02-17T20:16:04.223200 | 2021-01-19T13:29:10 | 2021-01-19T13:29:10 | 329,911,561 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package br.com.zup.forum.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import br.com.zup.forum.modelo.Curso;
public interface CursoRepository extends JpaRepository<Curso, Long> {
Curso findByNome(String nome);
}
| [
"[email protected]"
] | |
10b0f0801bd7d46c1cf33c9f82570a8e3c6066e0 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_13ade46b5320f3c1982e8e9bc39508bb7fc647db/AccountSyncSettings/9_13ade46b5320f3c1982e8e9bc39508bb7fc647db_AccountSyncSettings_t.java | 515e648d9c50536ad89d8f294cdb30e4e7f45407 | [] | 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 | 22,593 | java | /*
* Copyright (C) 2008 The Android Open Source Project
*
* 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.android.settings.accounts;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SyncAdapterType;
import android.content.SyncInfo;
import android.content.SyncStatusInfo;
import android.content.pm.ProviderInfo;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.settings.R;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
public class AccountSyncSettings extends AccountPreferenceBase {
public static final String ACCOUNT_KEY = "account";
protected static final int MENU_REMOVE_ACCOUNT_ID = Menu.FIRST;
private static final int MENU_SYNC_NOW_ID = Menu.FIRST + 1;
private static final int MENU_SYNC_CANCEL_ID = Menu.FIRST + 2;
private static final int REALLY_REMOVE_DIALOG = 100;
private static final int FAILED_REMOVAL_DIALOG = 101;
private static final int CANT_DO_ONETIME_SYNC_DIALOG = 102;
private TextView mUserId;
private TextView mProviderId;
private ImageView mProviderIcon;
private TextView mErrorInfoView;
private java.text.DateFormat mDateFormat;
private java.text.DateFormat mTimeFormat;
private Account mAccount;
// List of all accounts, updated when accounts are added/removed
// We need to re-scan the accounts on sync events, in case sync state changes.
private Account[] mAccounts;
private ArrayList<SyncStateCheckBoxPreference> mCheckBoxes =
new ArrayList<SyncStateCheckBoxPreference>();
private ArrayList<String> mInvisibleAdapters = Lists.newArrayList();
@Override
public Dialog onCreateDialog(final int id) {
Dialog dialog = null;
if (id == REALLY_REMOVE_DIALOG) {
dialog = new AlertDialog.Builder(getActivity())
.setTitle(R.string.really_remove_account_title)
.setMessage(R.string.really_remove_account_message)
.setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(R.string.remove_account_label,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
AccountManager.get(AccountSyncSettings.this.getActivity())
.removeAccount(mAccount,
new AccountManagerCallback<Boolean>() {
public void run(AccountManagerFuture<Boolean> future) {
boolean failed = true;
try {
if (future.getResult() == true) {
failed = false;
}
} catch (OperationCanceledException e) {
// handled below
} catch (IOException e) {
// handled below
} catch (AuthenticatorException e) {
// handled below
}
if (failed) {
showDialog(FAILED_REMOVAL_DIALOG);
} else {
finish();
}
}
}, null);
}
})
.create();
} else if (id == FAILED_REMOVAL_DIALOG) {
dialog = new AlertDialog.Builder(getActivity())
.setTitle(R.string.really_remove_account_title)
.setPositiveButton(android.R.string.ok, null)
.setMessage(R.string.remove_account_failed)
.create();
} else if (id == CANT_DO_ONETIME_SYNC_DIALOG) {
dialog = new AlertDialog.Builder(getActivity())
.setTitle(R.string.cant_sync_dialog_title)
.setMessage(R.string.cant_sync_dialog_message)
.setPositiveButton(android.R.string.ok, null)
.create();
}
return dialog;
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.account_sync_screen, container, false);
initializeUi(view);
return view;
}
protected void initializeUi(final View rootView) {
addPreferencesFromResource(R.xml.account_sync_settings);
mErrorInfoView = (TextView) rootView.findViewById(R.id.sync_settings_error_info);
mErrorInfoView.setVisibility(View.GONE);
mUserId = (TextView) rootView.findViewById(R.id.user_id);
mProviderId = (TextView) rootView.findViewById(R.id.provider_id);
mProviderIcon = (ImageView) rootView.findViewById(R.id.provider_icon);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final Activity activity = getActivity();
mDateFormat = DateFormat.getDateFormat(activity);
mTimeFormat = DateFormat.getTimeFormat(activity);
Bundle arguments = getArguments();
if (arguments == null) {
Log.e(TAG, "No arguments provided when starting intent. ACCOUNT_KEY needed.");
return;
}
mAccount = (Account) arguments.getParcelable(ACCOUNT_KEY);
if (mAccount != null) {
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "Got account: " + mAccount);
mUserId.setText(mAccount.name);
mProviderId.setText(mAccount.type);
}
}
@Override
public void onResume() {
final Activity activity = getActivity();
AccountManager.get(activity).addOnAccountsUpdatedListener(this, null, false);
updateAuthDescriptions();
onAccountsUpdated(AccountManager.get(activity).getAccounts());
super.onResume();
}
@Override
public void onPause() {
super.onPause();
AccountManager.get(getActivity()).removeOnAccountsUpdatedListener(this);
}
private void addSyncStateCheckBox(Account account, String authority) {
SyncStateCheckBoxPreference item =
new SyncStateCheckBoxPreference(getActivity(), account, authority);
item.setPersistent(false);
final ProviderInfo providerInfo = getPackageManager().resolveContentProvider(authority, 0);
if (providerInfo == null) {
return;
}
CharSequence providerLabel = providerInfo.loadLabel(getPackageManager());
if (TextUtils.isEmpty(providerLabel)) {
Log.e(TAG, "Provider needs a label for authority '" + authority + "'");
return;
}
String title = getString(R.string.sync_item_title, providerLabel);
item.setTitle(title);
item.setKey(authority);
mCheckBoxes.add(item);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
MenuItem removeAccount = menu.add(0, MENU_REMOVE_ACCOUNT_ID, 0,
getString(R.string.remove_account_label))
.setIcon(R.drawable.ic_menu_delete_holo_dark);
MenuItem syncNow = menu.add(0, MENU_SYNC_NOW_ID, 0,
getString(R.string.sync_menu_sync_now))
.setIcon(R.drawable.ic_menu_refresh_holo_dark);
MenuItem syncCancel = menu.add(0, MENU_SYNC_CANCEL_ID, 0,
getString(R.string.sync_menu_sync_cancel))
.setIcon(com.android.internal.R.drawable.ic_menu_close_clear_cancel);
removeAccount.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER |
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
syncNow.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER |
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
syncCancel.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER |
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
boolean syncActive = ContentResolver.getCurrentSync() != null;
menu.findItem(MENU_SYNC_NOW_ID).setVisible(!syncActive);
menu.findItem(MENU_SYNC_CANCEL_ID).setVisible(syncActive);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_SYNC_NOW_ID:
startSyncForEnabledProviders();
return true;
case MENU_SYNC_CANCEL_ID:
cancelSyncForEnabledProviders();
return true;
case MENU_REMOVE_ACCOUNT_ID:
showDialog(REALLY_REMOVE_DIALOG);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferences, Preference preference) {
if (preference instanceof SyncStateCheckBoxPreference) {
SyncStateCheckBoxPreference syncPref = (SyncStateCheckBoxPreference) preference;
String authority = syncPref.getAuthority();
Account account = syncPref.getAccount();
boolean syncAutomatically = ContentResolver.getSyncAutomatically(account, authority);
if (syncPref.isOneTimeSyncMode()) {
requestOrCancelSync(account, authority, true);
} else {
boolean syncOn = syncPref.isChecked();
boolean oldSyncState = syncAutomatically;
if (syncOn != oldSyncState) {
// if we're enabling sync, this will request a sync as well
ContentResolver.setSyncAutomatically(account, authority, syncOn);
// if the master sync switch is off, the request above will
// get dropped. when the user clicks on this toggle,
// we want to force the sync, however.
if (!ContentResolver.getMasterSyncAutomatically() || !syncOn) {
requestOrCancelSync(account, authority, syncOn);
}
}
}
return true;
} else {
return super.onPreferenceTreeClick(preferences, preference);
}
}
private void startSyncForEnabledProviders() {
requestOrCancelSyncForEnabledProviders(true /* start them */);
getActivity().invalidateOptionsMenu();
}
private void cancelSyncForEnabledProviders() {
requestOrCancelSyncForEnabledProviders(false /* cancel them */);
getActivity().invalidateOptionsMenu();
}
private void requestOrCancelSyncForEnabledProviders(boolean startSync) {
// sync everything that the user has enabled
int count = getPreferenceScreen().getPreferenceCount();
for (int i = 0; i < count; i++) {
Preference pref = getPreferenceScreen().getPreference(i);
if (! (pref instanceof SyncStateCheckBoxPreference)) {
continue;
}
SyncStateCheckBoxPreference syncPref = (SyncStateCheckBoxPreference) pref;
if (!syncPref.isChecked()) {
continue;
}
requestOrCancelSync(syncPref.getAccount(), syncPref.getAuthority(), startSync);
}
// plus whatever the system needs to sync, e.g., invisible sync adapters
if (mAccount != null) {
for (String authority : mInvisibleAdapters) {
requestOrCancelSync(mAccount, authority, startSync);
}
}
}
private void requestOrCancelSync(Account account, String authority, boolean flag) {
if (flag) {
Bundle extras = new Bundle();
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
ContentResolver.requestSync(account, authority, extras);
} else {
ContentResolver.cancelSync(account, authority);
}
}
private boolean isSyncing(List<SyncInfo> currentSyncs, Account account, String authority) {
for (SyncInfo syncInfo : currentSyncs) {
if (syncInfo.account.equals(account) && syncInfo.authority.equals(authority)) {
return true;
}
}
return false;
}
@Override
protected void onSyncStateUpdated() {
if (!isResumed()) return;
setFeedsState();
}
private void setFeedsState() {
// iterate over all the preferences, setting the state properly for each
Date date = new Date();
List<SyncInfo> currentSyncs = ContentResolver.getCurrentSyncs();
boolean syncIsFailing = false;
// Refresh the sync status checkboxes - some syncs may have become active.
updateAccountCheckboxes(mAccounts);
for (int i = 0, count = getPreferenceScreen().getPreferenceCount(); i < count; i++) {
Preference pref = getPreferenceScreen().getPreference(i);
if (! (pref instanceof SyncStateCheckBoxPreference)) {
continue;
}
SyncStateCheckBoxPreference syncPref = (SyncStateCheckBoxPreference) pref;
String authority = syncPref.getAuthority();
Account account = syncPref.getAccount();
SyncStatusInfo status = ContentResolver.getSyncStatus(account, authority);
boolean syncEnabled = ContentResolver.getSyncAutomatically(account, authority);
boolean authorityIsPending = status == null ? false : status.pending;
boolean initialSync = status == null ? false : status.initialize;
boolean activelySyncing = isSyncing(currentSyncs, account, authority);
boolean lastSyncFailed = status != null
&& status.lastFailureTime != 0
&& status.getLastFailureMesgAsInt(0)
!= ContentResolver.SYNC_ERROR_SYNC_ALREADY_IN_PROGRESS;
if (!syncEnabled) lastSyncFailed = false;
if (lastSyncFailed && !activelySyncing && !authorityIsPending) {
syncIsFailing = true;
}
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.d(TAG, "Update sync status: " + account + " " + authority +
" active = " + activelySyncing + " pend =" + authorityIsPending);
}
final long successEndTime = (status == null) ? 0 : status.lastSuccessTime;
if (successEndTime != 0) {
date.setTime(successEndTime);
final String timeString = mDateFormat.format(date) + " "
+ mTimeFormat.format(date);
syncPref.setSummary(timeString);
} else {
syncPref.setSummary("");
}
int syncState = ContentResolver.getIsSyncable(account, authority);
syncPref.setActive(activelySyncing && (syncState >= 0) &&
!initialSync);
syncPref.setPending(authorityIsPending && (syncState >= 0) &&
!initialSync);
syncPref.setFailed(lastSyncFailed);
ConnectivityManager connManager =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
final boolean masterSyncAutomatically = ContentResolver.getMasterSyncAutomatically();
final boolean backgroundDataEnabled = connManager.getBackgroundDataSetting();
final boolean oneTimeSyncMode = !masterSyncAutomatically || !backgroundDataEnabled;
syncPref.setOneTimeSyncMode(oneTimeSyncMode);
syncPref.setChecked(oneTimeSyncMode || syncEnabled);
}
mErrorInfoView.setVisibility(syncIsFailing ? View.VISIBLE : View.GONE);
getActivity().invalidateOptionsMenu();
}
@Override
public void onAccountsUpdated(Account[] accounts) {
super.onAccountsUpdated(accounts);
mAccounts = accounts;
updateAccountCheckboxes(accounts);
onSyncStateUpdated();
}
private void updateAccountCheckboxes(Account[] accounts) {
mInvisibleAdapters.clear();
SyncAdapterType[] syncAdapters = ContentResolver.getSyncAdapterTypes();
HashMap<String, ArrayList<String>> accountTypeToAuthorities =
Maps.newHashMap();
for (int i = 0, n = syncAdapters.length; i < n; i++) {
final SyncAdapterType sa = syncAdapters[i];
if (sa.isUserVisible()) {
ArrayList<String> authorities = accountTypeToAuthorities.get(sa.accountType);
if (authorities == null) {
authorities = new ArrayList<String>();
accountTypeToAuthorities.put(sa.accountType, authorities);
}
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.d(TAG, "onAccountUpdated: added authority " + sa.authority
+ " to accountType " + sa.accountType);
}
authorities.add(sa.authority);
} else {
// keep track of invisible sync adapters, so sync now forces
// them to sync as well.
mInvisibleAdapters.add(sa.authority);
}
}
for (int i = 0, n = mCheckBoxes.size(); i < n; i++) {
getPreferenceScreen().removePreference(mCheckBoxes.get(i));
}
mCheckBoxes.clear();
for (int i = 0, n = accounts.length; i < n; i++) {
final Account account = accounts[i];
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.d(TAG, "looking for sync adapters that match account " + account);
}
final ArrayList<String> authorities = accountTypeToAuthorities.get(account.type);
if (authorities != null && (mAccount == null || mAccount.equals(account))) {
for (int j = 0, m = authorities.size(); j < m; j++) {
final String authority = authorities.get(j);
// We could check services here....
int syncState = ContentResolver.getIsSyncable(account, authority);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.d(TAG, " found authority " + authority + " " + syncState);
}
if (syncState > 0) {
addSyncStateCheckBox(account, authority);
}
}
}
}
Collections.sort(mCheckBoxes);
for (int i = 0, n = mCheckBoxes.size(); i < n; i++) {
getPreferenceScreen().addPreference(mCheckBoxes.get(i));
}
}
/**
* Updates the titlebar with an icon for the provider type.
*/
@Override
protected void onAuthDescriptionsUpdated() {
super.onAuthDescriptionsUpdated();
getPreferenceScreen().removeAll();
if (mAccount != null) {
mProviderIcon.setImageDrawable(getDrawableForType(mAccount.type));
mProviderId.setText(getLabelForType(mAccount.type));
PreferenceScreen prefs = addPreferencesForType(mAccount.type);
if (prefs != null) {
updatePreferenceIntents(prefs);
}
}
addPreferencesFromResource(R.xml.account_sync_settings);
}
private void updatePreferenceIntents(PreferenceScreen prefs) {
for (int i = 0; i < prefs.getPreferenceCount(); i++) {
Intent intent = prefs.getPreference(i).getIntent();
if (intent != null) {
intent.putExtra(ACCOUNT_KEY, mAccount);
// This is somewhat of a hack. Since the preference screen we're accessing comes
// from another package, we need to modify the intent to launch it with
// FLAG_ACTIVITY_NEW_TASK.
// TODO: Do something smarter if we ever have PreferenceScreens of our own.
intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
}
}
}
}
| [
"[email protected]"
] | |
acb02241e90341935e398866c4f200dcd90aebbc | 90683462cd830dec12ee1c4c89e5e119ca7d9718 | /testContract/src/main/java/crawlerAddress_ropsten.java | 7079bc3739304e0b05cc95850f2d896a45e02f1a | [] | no_license | L-PLUM/ExperimentData | d02094fc4c9a5a49c4ef57725ad5847d4409e265 | 0f92389adbceefd77f537885b0e54b66530d375b | refs/heads/master | 2022-09-07T11:07:31.289716 | 2019-09-07T08:43:34 | 2019-09-07T08:43:34 | 206,934,941 | 1 | 1 | null | 2022-09-01T23:12:25 | 2019-09-07T07:52:16 | Java | UTF-8 | Java | false | false | 6,011 | java | import net.sf.json.JSONArray;
import org.apache.poi.hssf.usermodel.*;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
public class crawlerAddress_ropsten {
@SuppressWarnings("deprecation")
public static void main(String[] args) throws Exception {
// 采集的网址
String url = "https://ropsten.etherscan.io/contractsVerified/";
// int total_page =20;
Document document = Jsoup.connect(url).userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36").get();
// 获取审查页面的页数信息
Elements pages = document.select("nav").select("ul.pagination.pagination-sm.mb-0").select("li.page-item.disabled").select("span").select("strong:nth-child(2)");
// System.out.println(pages);
int total_page = Integer.parseInt(pages.text());
System.out.println(total_page);
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("sheet1");
HSSFRow row = sheet.createRow(0);
HSSFCellStyle style = wb.createCellStyle();
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFCell cell1 = row.createCell(0);
cell1.setCellValue("Address");
cell1.setCellStyle(style);
HSSFCell cell2 = row.createCell(1);
cell2.setCellValue("Name");
cell2.setCellStyle(style);
HSSFCell cell3 = row.createCell(2);
cell3.setCellValue("Compiler");
cell3.setCellStyle(style);
HSSFCell cell4 = row.createCell(3);
cell4.setCellValue("Version");
cell4.setCellStyle(style);
HSSFCell cell5 = row.createCell(4);
cell5.setCellValue("Balance");
cell5.setCellStyle(style);
HSSFCell cell6 = row.createCell(5);
cell6.setCellValue("TxCount");
cell6.setCellStyle(style);
HSSFCell cell7 = row.createCell(6);
cell7.setCellValue("Settings");
cell7.setCellStyle(style);
HSSFCell cell8 = row.createCell(7);
cell8.setCellValue("DateTime");
cell8.setCellStyle(style);
for (int current_page = 1; current_page <= total_page; current_page++) {
if (current_page == 1) {
List<Contract> list = getData(url + current_page);
JSONArray array = new JSONArray();
array.add(list);
for (int i = 0; i < list.size(); i++) {
row = sheet.createRow(i + 1);
row.createCell(0).setCellValue(list.get(i).getAddress());
row.createCell(1).setCellValue(list.get(i).getName());
row.createCell(2).setCellValue(list.get(i).getCompiler());
row.createCell(3).setCellValue(list.get(i).getVersion());
row.createCell(4).setCellValue(list.get(i).getBalance());
row.createCell(5).setCellValue(list.get(i).getTxCount());
row.createCell(6).setCellValue(list.get(i).getSettings());
row.createCell(7).setCellValue(list.get(i).getDateTime());
}
System.out.println("**************************************");
} else {
List<Contract> list = getData(url + current_page);
JSONArray array = new JSONArray();
array.add(list);
for (int i = 0; i < list.size(); i++) {
row = sheet.createRow((short) (sheet.getLastRowNum() + 1)); //现有的行号后面追加
//row = sheet.createRow(i + 1);
row.createCell(0).setCellValue(list.get(i).getAddress());
row.createCell(1).setCellValue(list.get(i).getName());
row.createCell(2).setCellValue(list.get(i).getCompiler());
row.createCell(3).setCellValue(list.get(i).getVersion());
row.createCell(4).setCellValue(list.get(i).getBalance());
row.createCell(5).setCellValue(list.get(i).getTxCount());
row.createCell(6).setCellValue(list.get(i).getSettings());
row.createCell(7).setCellValue(list.get(i).getDateTime());
}
}
try {
FileOutputStream fos = new FileOutputStream("./address/ropsten/ropstencontract2.xls");
wb.write(fos);
fos.flush();
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println("done");
}
public static List<Contract> getData(String url) throws Exception {
List<Contract> contractList = new ArrayList<Contract>();
Document doc = Jsoup.connect(url)
.header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0").timeout(30000).get();
Elements elements2 = doc.select("div.table-responsive").select("table").select("tbody").select("tr");
for (int i = 0; i < elements2.size(); i++) {
String contract = elements2.get(i).select("td").get(0).text();
System.out.println(contract);
String name = elements2.get(i).select("td").get(1).text();
String compiler = elements2.get(i).select("td").get(2).text();
String version = elements2.get(i).select("td").get(3).text();
String balance = elements2.get(i).select("td").get(4).text();
String txCount = elements2.get(i).select("td").get(5).text();
String settings = elements2.get(i).select("td").get(6).text();
String dateTime = elements2.get(i).select("td").get(7).text();
contractList.add(new Contract(contract, name, compiler, version, balance, txCount, settings, dateTime));
}
return contractList;
}
} | [
"[email protected]"
] | |
7d1b73e9d3e65841ecc49c3b4d810b3e058ed949 | 49b75f183a3c947a46fe61986816e5bc4faa2fcc | /src/main/java/com/example/priority/dto/responce/ResAllPriority.java | 207aeec7c35f7b3a0dba816607c76d28f9703c0b | [] | no_license | komal2831/priority_tatsam | 0a1cd107ffe5090651352ee5f2ae0dad38c4c365 | 0761d7a07835d133095d5232a29cd9cb9e3a4dd9 | refs/heads/main | 2023-06-16T17:32:09.251755 | 2021-07-02T12:34:46 | 2021-07-02T12:34:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package com.example.priority.dto.responce;
import lombok.Data;
import java.util.List;
@Data
public class ResAllPriority extends GenericResponse{
List<Priority> priorityList;
@Data
public static class Priority{
private Long priorityId;
private String Name;
}
}
| [
"[email protected]"
] | |
98de85ad3981beb3f94a65f4419e5a337db415b3 | d89577506ae8ae3dcf1069c0a2e95fe89e841a99 | /omd-dao/src/test/java/me/glux/omd/dao/test/package-info.java | 9f638e67fce0b3f663b10de7700e94155b47623c | [] | no_license | gluxhappy/bms-fs | 8d03fa006d1bccd066000917f70af126362294b9 | 54e3a458e6774e7763836517de14508c370555d1 | refs/heads/master | 2016-09-12T14:26:33.640921 | 2016-05-19T01:46:52 | 2016-05-19T01:46:52 | 56,482,477 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 61 | java | /**
* @author gluxhappy
*
*/
package me.glux.omd.dao.test; | [
"[email protected]"
] | |
0f9b50d20d754fce5b3dae5a0b8ee17cf908669b | 559ea64c50ae629202d0a9a55e9a3d87e9ef2072 | /com/cnmobi/im/util/DateUtils.java | 06f05f6ee6b32f7d947c5985a450ce0c8108d8f6 | [] | no_license | CrazyWolf2014/VehicleBus | 07872bf3ab60756e956c75a2b9d8f71cd84e2bc9 | 450150fc3f4c7d5d7230e8012786e426f3ff1149 | refs/heads/master | 2021-01-03T07:59:26.796624 | 2016-06-10T22:04:02 | 2016-06-10T22:04:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,719 | java | package com.cnmobi.im.util;
import com.google.protobuf.DescriptorProtos.FieldOptions;
import com.google.protobuf.DescriptorProtos.MessageOptions;
import com.google.protobuf.DescriptorProtos.UninterpretedOption;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.xbill.DNS.KEYRecord;
public class DateUtils {
public static Date parse(String dateStr, String format) {
Date result = null;
try {
result = new SimpleDateFormat(format).parse(dateStr);
} catch (ParseException e) {
e.printStackTrace();
}
return result;
}
public static String format(Date date, String format) {
return new SimpleDateFormat(format).format(date);
}
public static String getWeekDay(Date date) {
switch (date.getDay()) {
case KEYRecord.OWNER_USER /*0*/:
return "\u661f\u671f\u5929";
case MessageOptions.MESSAGE_SET_WIRE_FORMAT_FIELD_NUMBER /*1*/:
return "\u661f\u671f\u4e00";
case MessageOptions.NO_STANDARD_DESCRIPTOR_ACCESSOR_FIELD_NUMBER /*2*/:
return "\u661f\u671f\u4e8c";
case FieldOptions.DEPRECATED_FIELD_NUMBER /*3*/:
return "\u661f\u671f\u4e09";
case UninterpretedOption.POSITIVE_INT_VALUE_FIELD_NUMBER /*4*/:
return "\u661f\u671f\u56db";
case UninterpretedOption.NEGATIVE_INT_VALUE_FIELD_NUMBER /*5*/:
return "\u661f\u671f\u4e94";
case UninterpretedOption.DOUBLE_VALUE_FIELD_NUMBER /*6*/:
return "\u661f\u671f\u516d";
default:
return null;
}
}
}
| [
"[email protected]"
] | |
6ceced30208d4fa8cb7730e942ac1e1fc88292ef | 40df2cb0cf4cdc8261a88fc507ffb7cd113282c3 | /micro-film-cloud/nacos-gateway/src/main/java/com/zjservice/gateway/pojo/OperationLog.java | ca20996fadc118fa8c96e0819e960b47dab8f429 | [] | no_license | zj19950922/micro-film-cloud | d51794c2b217618fcad40569f590e8950eb35808 | 3f726f99826c4a3fc6011f950cd7a2d2dea7d350 | refs/heads/master | 2023-07-20T05:02:03.584333 | 2020-03-30T01:02:37 | 2020-03-30T01:02:37 | 241,000,356 | 3 | 0 | null | 2023-07-11T02:31:33 | 2020-02-17T02:04:10 | TSQL | UTF-8 | Java | false | false | 521 | java | package com.zjservice.gateway.pojo;
import lombok.Data;
import java.io.Serializable;
/**
* @author zj
* @date 2020/1/6 9:36
* @Description
*/
@Data
public class OperationLog implements Serializable {
private String id;
/** 用户名*/
private String userName;
/** 请求服务*/
private String visitorService;
/** 请求API资源*/
private String visitorUrl;
/** 请求方式*/
private String visitorMethod;
/** 访问者远程地址*/
private String remoteAddress;
}
| [
"[email protected]"
] | |
2906c17c91d8ac8e675ae9a4698e0fbfd4e8030a | 9f3ff403648c120b03c2ae101d42ac276a9908b1 | /SpringCloud-Customer-Service/src/main/java/in/ibm/demo/service/CustomerService.java | 2023507014387eafbd8dab81dec3edbe0d8fb461 | [] | no_license | shivamkumar116/IBM_LPU | b6410ab8a6d1ae58114dc66e4ce320d7eac60afc | e501fbee1ac5ed87bb3be5350421e7bc2d1b2e0e | refs/heads/master | 2022-12-28T12:08:25.673027 | 2020-05-14T12:07:12 | 2020-05-14T12:07:12 | 254,459,045 | 0 | 0 | null | 2022-12-16T15:37:07 | 2020-04-09T19:20:26 | Java | UTF-8 | Java | false | false | 170 | java | package in.ibm.demo.service;
import java.util.List;
import in.ibm.demo.entity.Customer;
public interface CustomerService {
public List<Customer> getCustomers();
}
| [
"[email protected]"
] | |
bfe4fc5787c4138c5362c99cf2468640f0de4652 | a33aac97878b2cb15677be26e308cbc46e2862d2 | /data/libgdx/LwjglGL20_glUniform3f.java | 32c54a8efaf4aea44ae149b1e0cd46479db76b11 | [] | no_license | GabeOchieng/ggnn.tensorflow | f5d7d0bca52258336fc12c9de6ae38223f28f786 | 7c62c0e8427bea6c8bec2cebf157b6f1ea70a213 | refs/heads/master | 2022-05-30T11:17:42.278048 | 2020-05-02T11:33:31 | 2020-05-02T11:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java | public void glUniform3f(int location, float x, float y, float z) {
GL20.glUniform3f(location, x, y, z);
}
| [
"[email protected]"
] | |
3922c6b610b5f8430cf7fc675421712ea34e656c | 3544d676049e38eac8610c13d2e8b629bd89b938 | /Factory Pattern Sample/src/com/company/Main.java | 1b87ecdc3970b2d82cd423bdbb55686de2c18895 | [
"MIT"
] | permissive | Ahmedsafwat101/DesignPatterns | cb51c274e86d77eaa0ce46f801a69691a7b2a225 | 2f52c470b21cd93c28fce1e2ffef26bffa8809db | refs/heads/main | 2023-04-18T17:05:18.220587 | 2021-04-20T22:42:14 | 2021-04-20T22:42:14 | 359,957,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.company;
import com.Factory.DialogFactory;
public class Main {
public static void main(String[] args) {
/**Calling the factory**/
DialogFactory factory = new DialogFactory();
/**Create HTML Button from DialogFactory that will return Button class **/
factory.createButton("HTML").render();
/**Create HTML Button from DialogFactory that will return Button class **/
factory.createButton("Windows").render();
}
}
| [
"[email protected]"
] | |
3ace2d12ec730068c33557c86c28ba7492c8e85c | 099028e82771d0939d2a65e81ab188ea5b9084c3 | /src/main/java/com/carndos/modules/res/pojo/ResRoleBO.java | e80e0f1e563f39969fa257f87f6a2de61b4851fa | [] | no_license | yanghj7425/carndos | 65f8e37e466dd58336435cd5f9cb1d52ed88a755 | 1cbefe125303729a8f547ee4dbac24a9f48c4cef | refs/heads/master | 2022-06-22T10:17:10.434917 | 2019-06-20T10:10:19 | 2019-06-20T10:10:19 | 140,275,326 | 0 | 0 | null | 2022-06-17T02:00:58 | 2018-07-09T11:22:16 | Java | UTF-8 | Java | false | false | 837 | java | package com.carndos.modules.res.pojo;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* @description 角色资源映射
*/
@Data
@Builder
public class ResRoleBO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 映射id
*/
private Long id;
/**
* 角色
*/
private String roleName;
/**
* 资源 URL
*/
private String resUrl;
/**
* 资源名称
*/
private String resName;
/**
* 资源描述
*/
private String resDesc;
public ResRoleBO(Long id, String roleName, String resUrl, String resName, String resDesc) {
this.id = id;
this.roleName = roleName;
this.resUrl = resUrl;
this.resName = resName;
this.resDesc = resDesc;
}
} | [
"[email protected]"
] | |
3f461858c29e6d2e17443f88ff11fe7af23d14a1 | bd1de34bb9cef9c7c382a82dc849f35b18ed28c7 | /src/main/java/com/cursomc/services/validation/ClienteUpdate.java | fc3286c30d83b570c9d02b0ec05bf74182e426b9 | [] | no_license | emersonabreu/Crud-Spring-Ionic | b9ccd14e5a37a03e27142f8be64fb10b443288ec | e8298b0bd3eef42b6026e969f240b67ac4734ef4 | refs/heads/master | 2020-03-08T05:10:02.242154 | 2018-06-16T12:09:53 | 2018-06-16T12:09:53 | 127,941,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package com.cursomc.services.validation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
@Constraint(validatedBy = ClienteUpdateValidator.class)
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface ClienteUpdate {
String message() default "Erro de validação";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
| [
"[email protected]"
] | |
01bd345a323aec46df0c8e283d27758bacaf3ffe | d34a8445db6c0ddf7bf424a96068cb6c78571803 | /WEB-INF/src/com/astrider/sfc/test/lib/helper/MapperTest.java | 4e8dff06f5ec44796c2dd55203ae4dabcadf0dfb | [] | no_license | 1tsuki/SimpleFrontController | e78cf84be16d9054e6797efaa0fcc2ec3bc22bc4 | 441b60f4ad2a45897e86062937d12beafd7d78dc | refs/heads/master | 2020-12-24T13:35:38.835399 | 2013-06-17T00:46:50 | 2013-06-17T00:46:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,914 | java | package com.astrider.sfc.test.lib.helper;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import com.astrider.sfc.lib.helper.Mapper;
import com.astrider.sfc.test.app.model.vo.TestVo;
public class MapperTest {
@Test
public void fromRequestParameter正常リクエスト() {
HttpServletRequest request = mock(HttpServletRequest.class);
TestVo expected = new TestVo();
expected.setA(""); // not null
expected.setB("abc"); // maxLength=5, minLength=3
expected.setC(true); // not null
expected.setD(false); // not null
expected.setE(0); // max=5, min=-1
expected.setF(122); // length=3
expected.setG("asdf"); // notBlank
when(request.getParameter("a")).thenReturn(expected.getA());
when(request.getParameter("B")).thenReturn(expected.getB());
when(request.getParameter("c_boolean")).thenReturn(String.valueOf(expected.isC()));
when(request.getParameter("d-Boolean")).thenReturn(String.valueOf(expected.getD()));
when(request.getParameter("e!")).thenReturn(String.valueOf(expected.getE()));
when(request.getParameter("f123")).thenReturn(String.valueOf(expected.getF()));
when(request.getParameter("5")).thenReturn(expected.getG());
Mapper<TestVo> mapper = new Mapper<TestVo>();
TestVo actual = mapper.fromHttpRequest(request);
valueMatchSuccess(actual, expected);
}
@Test
public void fromRequestParameter不正リクエスト() {
HttpServletRequest request = mock(HttpServletRequest.class);
TestVo expected = new TestVo();
expected.setA(""); // not null
expected.setB("abc"); // maxLength=5, minLength=3
expected.setC(true); // not null
expected.setD(false); // not null
expected.setE(0); // max=5, min=-1
expected.setF(122); // length=3
expected.setG("asdf"); // notBlank
when(request.getParameter("a")).thenReturn(expected.getA());
when(request.getParameter("B")).thenReturn(expected.getB());
when(request.getParameter("c_boolean")).thenReturn(null);
when(request.getParameter("d-Boolean")).thenReturn(String.valueOf(expected.getD()));
when(request.getParameter("e!")).thenReturn(String.valueOf(expected.getE()));
when(request.getParameter("f123")).thenReturn(String.valueOf(expected.getF()));
when(request.getParameter("5")).thenReturn(expected.getG());
Mapper<TestVo> mapper = new Mapper<TestVo>();
TestVo actual = mapper.fromHttpRequest(request);
valueMatchFail(actual, expected);
}
@Test
public void fromResultSet正常リクエスト() throws SQLException {
TestVo expected = new TestVo();
expected.setA(""); // not null
expected.setB("abc"); // maxLength=5, minLength=3
expected.setC(true); // not null
expected.setD(false); // not null
expected.setE(0); // max=5, min=-1
expected.setF(122); // length=3
expected.setG("asdf"); // notBlank
ResultSet rs = mock(ResultSet.class);
when(rs.getString("a")).thenReturn(expected.getA());
when(rs.getString("B")).thenReturn(expected.getB());
when(rs.getBoolean("c_boolean")).thenReturn(expected.isC());
when(rs.getBoolean("d-Boolean")).thenReturn(expected.getD());
when(rs.getInt("e!")).thenReturn(expected.getE());
when(rs.getInt("f123")).thenReturn(expected.getF());
when(rs.getString("5")).thenReturn(expected.getG());
Mapper<TestVo> mapper = new Mapper<TestVo>();
TestVo actual = mapper.fromResultSet(rs);
valueMatchSuccess(actual, expected);
}
private void valueMatchSuccess(TestVo actual, TestVo expected) {
assertTrue(actual.getA().equals(expected.getA()));
assertTrue(actual.getB().equals(expected.getB()));
assertTrue(actual.isC() == expected.isC());
assertTrue(actual.getD().equals(expected.getD()));
assertTrue(actual.getE() == expected.getE());
assertTrue(actual.getF().equals(expected.getF()));
assertTrue(actual.getG().equals(expected.getG()));
}
private void valueMatchFail(TestVo actual, TestVo expected) {
boolean result = true;
result = actual.getA().equals(expected.getA()) && result;
result = actual.getB().equals(expected.getB()) && result;
result = actual.isC() == expected.isC() && result;
result = actual.getD().equals(expected.getD()) && result;
result = actual.getE() == expected.getE() && result;
result = actual.getF().equals(expected.getF()) && result;
result = actual.getG().equals(expected.getG()) && result;
assertFalse(result);
}
}
| [
"[email protected]"
] | |
588866df2d0e7acd35b8e45b34b229b0be40a9fb | 235a84eaa8a310a6dfc98ceddb10e45a65346210 | /ExampleNotify/app/src/main/java/com/example/examplenotify/MainActivity.java | 7f281517821a9414a0d98ffe270c6f298ed9f0c4 | [] | no_license | varaprasad767/Varaprasad-Android | f4986b1eeb7ae0440a78573ac6c009e53992e37b | d450548a925e88f441b31f2ebc86388bbbd0c79f | refs/heads/main | 2023-03-18T14:22:03.296757 | 2021-03-10T06:36:16 | 2021-03-10T06:36:16 | 338,043,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,845 | java | package com.example.examplenotify;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
NotificationManager manager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
manager= (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
}
public void notify(View view) {
createNotification();
sendNotification();
}
private void sendNotification() {
NotificationCompat.Builder builder=new NotificationCompat.Builder(this,
"Demo");
Intent i= new Intent(this,MainActivity.class);
PendingIntent pi= PendingIntent.getActivity(this,0,i,PendingIntent
.FLAG_UPDATE_CURRENT);
builder.setContentTitle("Notification");
builder.setContentText("this is my notification");
builder.setSmallIcon(R.drawable.ic_launcher_background);
builder.setContentIntent(pi);
manager.notify(0,builder.build());
}
private void createNotification() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationChannel channel=new NotificationChannel("Demo","vara"
,NotificationManager.IMPORTANCE_HIGH);
channel.enableVibration(true);
channel.enableLights(true);
channel.setLightColor(Color.RED);
manager.createNotificationChannel(channel);
}
}
} | [
"[email protected]"
] | |
7f699509cf530a926aea5738e981be00ba7ef3a8 | 6d1fe7fe75bc210fc5f8662c5b4d348387f03fdf | /salesapp-microservices/salesapp/src/main/java/com/att/salesexpress/webapp/service/igloo/IglooConsumerServiceImpl.java | 94052007ea4391668238f1b485df83e07d5ed376 | [] | no_license | wsachoo/mypoc | a6a8916c7186d2a2cd9848d9b172d4898db077cf | 18e92e0a4be500fcd724ef45b5830b9b02bc8d58 | refs/heads/master | 2021-05-03T07:47:55.860926 | 2018-03-22T21:30:35 | 2018-03-22T21:30:35 | 79,166,745 | 0 | 2 | null | 2018-03-28T22:12:29 | 2017-01-16T22:49:43 | Java | UTF-8 | Java | false | false | 7,484 | java | package com.att.salesexpress.webapp.service.igloo;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.stream.StreamResult;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ws.soap.SoapFault;
import org.springframework.ws.soap.SoapFaultDetail;
import org.springframework.ws.soap.SoapFaultDetailElement;
import org.springframework.ws.soap.client.SoapFaultClientException;
import com.att.cio.commonheader.v3.WSContext;
import com.att.cio.commonheader.v3.WSContext.WSNameValue;
import com.att.cio.commonheader.v3.WSException;
import com.att.cio.commonheader.v3.WSHeader;
import com.att.cio.commonheader.v3.WSMessageData;
import com.att.edb.accessquote.AccessQuoteRequest;
import com.att.edb.accessquote.AccessQuoteRequest.AccessQuoteBody;
import com.att.edb.accessquote.GetAccessQuote;
import com.att.edb.accessquote.GetAccessQuoteResponse;
import com.att.salesexpress.igloo.consumer.service.IglooWSConsumerService;
import com.att.salesexpress.webapp.entity.SalesSite;
import com.att.salesexpress.webapp.pojos.UserDesignSelectionDO;
import com.att.salesexpress.webapp.pojos.UserSiteDesignDO;
import com.att.salesexpress.webapp.util.Constants;
/**
*
* @author sw088d Sachin Wadhankar
*
*/
@Service
public class IglooConsumerServiceImpl implements IglooConsumerService {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private IglooWSConsumerService iglooWSConsumerService;
@Override
public List<Object> call(UserDesignSelectionDO objUserDesignSelectionDO, List<SalesSite> objSalesSite) {
List<Object> iglooResponseList = new ArrayList<>();
Map<String, UserSiteDesignDO> mapSiteDesign = objUserDesignSelectionDO.getSiteDesignList();
Collection<UserSiteDesignDO> objUserSiteDesignDOList = mapSiteDesign.values();
for (UserSiteDesignDO userSiteDesignDO : objUserSiteDesignDOList) {
GetAccessQuote quote = createAccessQuoteRequestObject(userSiteDesignDO, objSalesSite);
try {
GetAccessQuoteResponse resp = iglooWSConsumerService.getAccessQuote(quote);
iglooResponseList.add(resp);
} catch (SoapFaultClientException e) {
try {
List<WSException> faultDetailMsgs = extractSOAPFaultMessageXML(e);
for (WSException faultDetailMsg : faultDetailMsgs) {
logger.info("The fault detail message is: {}", faultDetailMsg.getMessage());
}
iglooResponseList.add(faultDetailMsgs);
} catch (TransformerException | TransformerFactoryConfigurationError | JAXBException e1) {
logger.info("Error while extracting fault detail: {}", ExceptionUtils.getStackTrace(e1));
iglooResponseList.add("EXCEPTION: IGLOO call resulted in SOAP Fault for site id: "
+ userSiteDesignDO.getSiteId());
}
}
}
return iglooResponseList;
}
private List<WSException> extractSOAPFaultMessageXML(SoapFaultClientException e)
throws TransformerFactoryConfigurationError, TransformerException, JAXBException {
List<WSException> faultMsgList = new ArrayList<>();
final SoapFault soapFault = e.getSoapFault();
final SoapFaultDetail faultDetail = soapFault.getFaultDetail();
for (final Iterator<SoapFaultDetailElement> detailEntryItr = faultDetail.getDetailEntries(); detailEntryItr
.hasNext();) {
final SoapFaultDetailElement detailEntry = detailEntryItr.next();
final Source source = detailEntry.getSource();
/* StringWriter writer = new StringWriter();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
transformer.transform(source, new StreamResult(writer));
String xml = writer.toString();*/
JAXBContext jaxbContext = JAXBContext.newInstance(WSException.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
WSException objWSException = (WSException)jaxbUnmarshaller.unmarshal(source);
faultMsgList.add(objWSException);
}
return faultMsgList;
}
private GetAccessQuote createAccessQuoteRequestObject(UserSiteDesignDO userSiteDesignDO,
List<SalesSite> objSalesSiteList) {
SalesSite objSalesSite = null;
for (SalesSite salesSite : objSalesSiteList) {
if (salesSite.getSiteId() == userSiteDesignDO.getSiteId()) {
objSalesSite = salesSite;
break;
}
}
AccessQuoteBody bd = new AccessQuoteBody();
bd.setCountry(Constants.IGLOO_WEBSERVICE_DEFAULT_COUNTRY);
bd.setService(Constants.IGLOO_WEBSERVICE_DEFAULT_SERVICE_ID);
bd.setAccessType(Constants.IGLOO_WEBSERVICE_DEFAULT_ACCESS_TYPE);
bd.setAccessTransport(Constants.IGLOO_WEBSERVICE_DEFAULT_ACCESS_TRANSPORT);
bd.setEGRFlag(Constants.IGLOO_WEBSERVICE_DEFAULT_ERG_FLAG);
bd.setHouseNo(Constants.IGLOO_WEBSERVICE_DEFAULT_HOUSE_NO);
bd.setQuoteRequestType(Constants.IGLOO_WEBSERVICE_DEFAULT_QUOTE_REQUEST_TYPE);
bd.setAccesArrangement(Constants.IGLOO_WEBSERVICE_DEFAULT_ACCESS_ARRANGEMENT);
bd.setContractTerm(Constants.IGLOO_WEBSERVICE_DEFAULT_CONTRACT_TERM);
bd.setDiscountPercentage(Constants.IGLOO_WEBSERVICE_DEFAULT_DISCOUNT_PERCENTAGE);
bd.setOnNetCheck(Constants.IGLOO_WEBSERVICE_DEFAULT_ON_NET_CHECK);
bd.setMisPNT(Constants.IGLOO_WEBSERVICE_DEFAULT_MISPNT);
bd.setCustAddr1(objSalesSite.getAddressName());
bd.setCity(objSalesSite.getCity());
bd.setState(objSalesSite.getState());
bd.setPostalCode(objSalesSite.getZip());
bd.setTelephoneCode(objSalesSite.getNpanxx().toString());
bd.setTailTechnology(userSiteDesignDO.getAccessConfigDesign().getAccessTailTechnology());
bd.setAccessInterconnect(userSiteDesignDO.getAccessConfigDesign().getAccessInterconnectTechnology());
bd.setAccessArch(userSiteDesignDO.getAccessConfigDesign().getAccessArchitecture());
bd.setPhysicalInterface(userSiteDesignDO.getAccessConfigDesign().getPhysicalInterferenceOptions());
bd.setAccessBandwidth(userSiteDesignDO.getAccessConfigDesign().getSliderSpeedValue());
WSNameValue wsNV = new WSNameValue();
wsNV.setName(Constants.IGLOO_WEBSERVICE_DEFAULT_DEFAULT_WS_NAME);
wsNV.setValue(Constants.IGLOO_WEBSERVICE_DEFAULT_WS_VALUE);
WSContext wsCtx = new WSContext();
wsCtx.getWSNameValue().add(wsNV);
WSMessageData wsMsgData = new WSMessageData();
wsMsgData.setMessageId(Constants.IGLOO_WEBSERVICE_DEFAULT_MESSAGE_ID_PREFIX + System.currentTimeMillis());
WSHeader wsHeader = new WSHeader();
wsHeader.setWSContext(wsCtx);
wsHeader.setWSMessageData(wsMsgData);
AccessQuoteRequest req = new AccessQuoteRequest();
req.setAccessQuoteBody(bd);
req.setWSHeader(wsHeader);
GetAccessQuote quote = new GetAccessQuote();
quote.setAccessQuoteRequest(req);
return quote;
}
}
| [
"[email protected]"
] | |
daf0d492a50f7123e8db5af668d70d1043ec68c0 | 9370cc5bc214ad377200ca41ed6f556140cbb06a | /src/com/mysteel/banksteel/view/adapters/SourceSearchAdapter.java | 0add1e425e101fe927160b44107fce951de3c3f4 | [] | no_license | caocf/2.1.0 | db5286d5e9317e1ae70e1186b222e736b1e7a2ce | f2ba501e317eb1f5e9f77cf94ef9c52cc606b252 | refs/heads/master | 2021-01-16T20:50:52.899829 | 2015-11-06T17:29:05 | 2015-11-06T17:29:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,753 | java | package com.mysteel.banksteel.view.adapters;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;
import com.mysteel.banksteel.ao.IOrderTrade;
import com.mysteel.banksteel.ao.impl.OrderTradeImpl;
import com.mysteel.banksteel.entity.BaseData;
import com.mysteel.banksteel.entity.SearchResourceData.Data.Datas;
import com.mysteel.banksteel.util.Constants;
import com.mysteel.banksteel.util.RequestUrl;
import com.mysteel.banksteel.util.Tools;
import com.mysteel.banksteel.view.activity.ChatActivity;
import com.mysteel.banksteel.view.activity.LoginActivity;
import com.mysteel.banksteel.view.interfaceview.IOrderTradeView;
import com.mysteel.banksteeltwo.R;
import java.util.ArrayList;
import java.util.List;
public class SourceSearchAdapter extends BaseAdapter implements IOrderTradeView
{
@Override
public void updateView(BaseData data)
{
if (Tools.isLogin(mContext))
{
Intent i = new Intent(mContext, ChatActivity.class);
i.putExtra("userId", datas.get(listNum).getPhone());
i.putExtra("userName", datas.get(listNum).getUserName());
mContext.startActivity(i);
} else
{
Intent i = new Intent(mContext, LoginActivity.class);
mContext.startActivity(i);
}
}
private int mRightWidth = 0;
@Override
public void isShowDialog(boolean flag)
{
}
public interface ClickToggleItem
{
void selOpenItem(int position);
}
private Context mContext;
private ClickToggleItem clickToggleItem;
private IOrderTrade orderTrade;
private int listNum;
private List<Datas> datas = new ArrayList<Datas>();
public SourceSearchAdapter(Context mContext, int rightWidth)
{
this.mContext = mContext;
orderTrade = new OrderTradeImpl(mContext, this);
this.mRightWidth = rightWidth;
}
public void reSetListView(ArrayList<Datas> datas)
{
this.datas = datas;
notifyDataSetChanged();
}
public void setClickToggleItem(ClickToggleItem clickToggleItem)
{
this.clickToggleItem = clickToggleItem;
}
// @Override
// public int getSwipeLayoutResourceId(int position) {
// return R.id.swipe;
// }
// @Override
// public View generateView(int position, ViewGroup parent) {
// View v =
// LayoutInflater.from(mContext).inflate(R.layout.listview_search_item,
// null);
// SwipeLayout swipeLayout = (SwipeLayout) v
// .findViewById(getSwipeLayoutResourceId(position));
// swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown);
// swipeLayout.setShowMode(SwipeLayout.ShowMode.PullOut);
//
// // Datas datasTemp = datas.get(position);
// // if(datasTemp.isToogleItemFlag()){
// // swipeLayout.open();
// // }else{
// // swipeLayout.close();
// // }
// swipeLayout.addSwipeListener(new SwipeLayout.SwipeListener() {
// @Override
// public void onClose(SwipeLayout layout) {
//
// }
//
// @Override
// public void onUpdate(SwipeLayout layout, int leftOffset,
// int topOffset) {
//
// }
//
// @Override
// public void onOpen(SwipeLayout layout) {
// //LogUtils.e("打开啦啦啦");
// //YoYo.with(Techniques.Tada).duration(500).delay(100).playOn(layout.findViewById(R.id.trash));
// }
//
// @Override
// public void onHandRelease(SwipeLayout layout, float xvel, float yvel) {
//
// }
// });
// return v;
// }
// @Override
// public void fillValues(int position, View convertView) {
// TextView tv_name = (TextView) convertView.findViewById(R.id.tv_name);
// TextView tv_type = (TextView) convertView.findViewById(R.id.tv_type);
// TextView tv_num = (TextView) convertView.findViewById(R.id.tv_num);
// TextView tv_price = (TextView) convertView.findViewById(R.id.tv_price);
// TextView tv_unit = (TextView) convertView.findViewById(R.id.tv_unit);
// TextView tv_company = (TextView)
// convertView.findViewById(R.id.tv_company);
// TextView tv_sell = (TextView) convertView.findViewById(R.id.tv_sell);
// tv_sell.setVisibility(View.GONE);
// LinearLayout ll_item_phone = (LinearLayout)
// convertView.findViewById(R.id.ll_item_phone);
// LinearLayout ll_item_msg = (LinearLayout)
// convertView.findViewById(R.id.ll_item_msg);
//
//
// final Datas datasTemp = datas.get(position);
//
// tv_name.setText(datasTemp.getBreedName());
// tv_type.setText(datasTemp.getMaterial());
// tv_num.setText(datasTemp.getSpec());
//
// if(Float.parseFloat(datasTemp.getPrice())<1000){
// tv_price.setText("面议价");
// tv_unit.setVisibility(View.INVISIBLE);
// }else{
// tv_price.setText(datasTemp.getPrice());
// tv_unit.setVisibility(View.VISIBLE);
// }
// tv_company.setText(datasTemp.getMemberName());
//
// ll_item_phone.setOnClickListener(new OnClickListener() {
// @Override
// public void onClick(View v) {
// if(!TextUtils.isEmpty(datasTemp.getPhone())){
// Tools.makeCall(mContext, datasTemp.getPhone());
// }else{
// Tools.showToast(mContext, "货主尚未上传他的手机号!");
// }
// }
// });
//
// listNum = position;
// ll_item_msg.setOnClickListener(new OnClickListener()
// {
// @Override
// public void onClick(View v)
// {
// if (!TextUtils.isEmpty(datasTemp.getPhone()))
// {
// String url = RequestUrl.getInstance(mContext).getUrl_Register(mContext,
// datasTemp.getPhone(), "");
// orderTrade.getHuanXinRegister(url, Constants.INTERFACE_hxuserregister);
// } else
// {
// Toast.makeText(mContext, "暂时获取不到卖家电话!", Toast.LENGTH_SHORT).show();
// }
// }
// });
//
// }
@Override
public int getCount()
{
if (datas.size() > 0)
{
return datas.size();
}
return 0;
}
@Override
public Object getItem(int position)
{
return null;
}
@Override
public long getItemId(int position)
{
return position;
}
public IOrderTrade getOrderTrade()
{
return orderTrade;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
ViewHolder holder;
if (convertView == null)
{
convertView = LayoutInflater.from(mContext).inflate(
R.layout.listview_search_item, parent, false);
holder = new ViewHolder();
holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
holder.tv_type = (TextView) convertView.findViewById(R.id.tv_type);
holder.tv_price = (TextView) convertView
.findViewById(R.id.tv_price);
holder.tv_num = (TextView) convertView.findViewById(R.id.tv_num);
holder.tv_unit = (TextView) convertView.findViewById(R.id.tv_unit);
holder.tv_company = (TextView) convertView
.findViewById(R.id.tv_company);
holder.tv_sell = (TextView) convertView.findViewById(R.id.tv_sell);
holder.ll_item_phone = (LinearLayout) convertView
.findViewById(R.id.ll_item_phone);
holder.ll_item_msg = (LinearLayout) convertView
.findViewById(R.id.ll_item_msg);
holder.item_left = (LinearLayout) convertView
.findViewById(R.id.item_left);
holder.item_right = (LinearLayout) convertView
.findViewById(R.id.item_right);
convertView.setTag(holder);
} else
{// 有直接获得ViewHolder
holder = (ViewHolder) convertView.getTag();
}
holder.tv_sell.setVisibility(View.GONE);
LinearLayout.LayoutParams lp1 = new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
holder.item_left.setLayoutParams(lp1);
LinearLayout.LayoutParams lp2 = new LayoutParams(mRightWidth,
LayoutParams.MATCH_PARENT);
holder.item_right.setLayoutParams(lp2);
final Datas datasTemp = datas.get(position);
holder.tv_name.setText(datasTemp.getBreedName());
holder.tv_type.setText(datasTemp.getMaterial());
holder.tv_num.setText(datasTemp.getSpec());
if (Float.parseFloat(datasTemp.getPrice()) < 1000)
{
holder.tv_price.setText("面议价");
holder.tv_unit.setVisibility(View.INVISIBLE);
} else
{
holder.tv_price.setText(datasTemp.getPrice());
holder.tv_unit.setVisibility(View.VISIBLE);
}
if(!TextUtils.isEmpty(datasTemp.getWarehouse())){
holder.tv_company.setText(datasTemp.getWarehouse());
}else{
holder.tv_company.setText("厂提");
}
holder.ll_item_phone.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
if (!TextUtils.isEmpty(datasTemp.getPhone()))
{
Tools.makeCall(mContext, datasTemp.getPhone());
} else
{
Tools.showToast(mContext, "货主尚未上传他的手机号!");
}
}
});
listNum = position;
holder.ll_item_msg.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
if (!TextUtils.isEmpty(datasTemp.getPhone()))
{
String url = RequestUrl
.getInstance(mContext)
.getUrl_Register(mContext, datasTemp.getPhone(), "");
orderTrade.getHuanXinRegister(url,
Constants.INTERFACE_hxuserregister);
} else
{
Toast.makeText(mContext, "暂时获取不到卖家电话!", Toast.LENGTH_SHORT)
.show();
}
}
});
return convertView;
}
public class ViewHolder
{
TextView tv_name;
TextView tv_type;
TextView tv_num;
TextView tv_price;
TextView tv_unit;
TextView tv_company;
TextView tv_sell;
LinearLayout ll_item_phone;
LinearLayout ll_item_msg;
LinearLayout item_left;
LinearLayout item_right;
}
}
| [
"[email protected]"
] | |
1c9573f0e0ff26d9d4c7524c4612623e5fdffeb4 | 3eab3fb0f444a7d6e19205dba17a5bea6ee59221 | /Message/gen/com/example/message/R.java | 1fd6b22326b9a37f5ab93fac4a120a530a32830a | [] | no_license | fang1994042128/Android-- | 9c13018247c685d2cee6baa9e50eae123058499b | 6ed06137fb78b9a8a2571886b9d491785b61d247 | refs/heads/master | 2016-09-03T07:26:39.637180 | 2015-05-03T09:16:45 | 2015-05-03T09:16:45 | 31,646,002 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,300 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.message;
public final class R {
public static final class attr {
}
public static final class dimen {
public static final int padding_large=0x7f040002;
public static final int padding_medium=0x7f040001;
public static final int padding_small=0x7f040000;
}
public static final class drawable {
public static final int ic_action_search=0x7f020000;
public static final int ic_launcher=0x7f020001;
public static final int messager=0x7f020002;
public static final int people=0x7f020003;
}
public static final class id {
public static final int contact=0x7f080007;
public static final int edbody=0x7f080009;
public static final int ednum=0x7f080008;
public static final int imag=0x7f080000;
public static final int listmsg=0x7f080002;
public static final int listnum=0x7f080001;
public static final int listtime=0x7f080003;
public static final int menu_settings=0x7f08000b;
public static final int msg_list=0x7f080006;
public static final int newsms=0x7f080005;
public static final int send=0x7f08000a;
public static final int type=0x7f080004;
}
public static final class layout {
public static final int listview=0x7f030000;
public static final int main=0x7f030001;
public static final int write=0x7f030002;
}
public static final class menu {
public static final int activity_main=0x7f070000;
}
public static final class string {
public static final int app_name=0x7f050000;
public static final int body=0x7f050007;
public static final int hello_world=0x7f050001;
public static final int menu_settings=0x7f050002;
public static final int newsms=0x7f050004;
public static final int reply=0x7f050005;
public static final int sendnum=0x7f050006;
public static final int title_activity_main=0x7f050003;
}
public static final class style {
public static final int AppTheme=0x7f060000;
}
}
| [
"[email protected]"
] | |
04a29c75594a088db4ddad365d428310d9fbff67 | ae613b879e02a8130fd6aceaa5af40176e6f3b73 | /secondLab/src/Main.java | bb0fe7ee2a22abf805088729a068c70c2e1a1df7 | [] | no_license | Koska-java/Java-Labs | c33691f0f7b66e338c2dd95b3bbb98a859a52657 | 9f7b910d3474189b8dc5ac30df27daabf26baca9 | refs/heads/master | 2022-09-12T21:36:51.855244 | 2020-05-30T09:08:19 | 2020-05-30T09:08:19 | 261,855,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,361 | java | import java.util.InputMismatchException;
import java.util.Scanner;
public class Main {
public static final String ANSI_RESET = "\u001B[0m";
public static final String ANSI_BLACK = "\u001B[30m";
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_GREEN = "\u001B[32m";
public static final String ANSI_YELLOW = "\u001B[33m";
public static final String ANSI_BLUE = "\u001B[34m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_CYAN = "\u001B[36m";
public static final String ANSI_WHITE = "\u001B[37m";
public static void main(String[] args) {
int choice = 100;
Scanner scanner = new Scanner(System.in);
do {
try {
System.out.println(ANSI_RESET +
"-------------------------" + "\n" +
"| Menu |" + "\n" +
"-------------------------" + "\n" +
"| 0 - Exit |" + "\n" +
"-------------------------" + "\n" +
"| 1 - Derivative |" + "\n" +
"-------------------------" + "\n");
choice = scanner.nextInt();
switch (choice) {
case 0: {
System.out.println("U selected to exit");
System.exit(0);
break;
}
case 1: {
/*Производная берется от t, так, как х отсутствует в уравнении */
System.out.println(ANSI_RESET+"Choose number of function 1 - st or 2 - nd ");
int choose = scanner.nextInt();
System.out.println(ANSI_RESET+"Enter some value of function");
double par1 = scanner.nextInt();
/*System.out.println("Enter the (const) coefficient ");
double par2 = scanner.nextInt();*/
switch (choose) {
case 1: {
final Function expression = new FirstFunction(new InitFirstFunction(1, par1), new InitConst(1.7));
System.out.println(ANSI_BLUE+"f("+par1+") = " + expression.calculate(par1));
System.out.println(ANSI_BLUE+"f'("+par1+") = " + expression.derivative().calculate(par1));
break;
}
case 2: {
final Function expression = new SecondFunction(new InitSecondFunction(1, par1), new InitConst(1.7));
System.out.println(ANSI_BLUE+"f("+par1+") = " + expression.calculate(par1));
System.out.println(ANSI_BLUE+"f'("+par1+") = " + expression.derivative().calculate(par1));
break;
}
}
}
}
} catch (InputMismatchException e) {
System.out.println("Incorrect value");
scanner.nextLine();
}
} while (choice != 0);
}
}
| [
"[email protected]"
] | |
774cf554a6c634b39c0cf46ea6128d73e2beaf5f | a6b5e84baad67354a7c215828c16a186f354faa3 | /bootcampmanagement/src/main/java/com/bm/bootcampmanagement/repository/el/ProvinceRepository.java | f429424d6c901f0e7a59c8d08f7254057e8e62c7 | [] | no_license | bootcamp23-mii/SpringBoot-BootcampManagement | c310339787d0d780d3adc41efc2648786025fd4e | c84dc598f7ff84cdcce5147535eaa85f57fef92b | refs/heads/master | 2020-05-01T02:58:45.188924 | 2019-05-09T14:43:53 | 2019-05-09T14:43:53 | 177,234,302 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 790 | 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.bm.bootcampmanagement.repository.el;
import com.bm.bootcampmanagement.entities.Province;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
/**
*
* @author Firsta
*/
@Repository
public interface ProvinceRepository extends CrudRepository<Province, String>{
@Modifying
@Query (value = "DELETE FROM tb_m_province where id = ?1", nativeQuery = true)
public void deleteById(String id);
}
| [
"[email protected]"
] | |
e8888c8cd701fa12e592157c0f9811c765efdd04 | 228d30af9aeb9d97873b56d72e65f6c42eedd34d | /src/main/java/week2/Day1/IrctcSignUp.java | e453c10aebecce57160bb7835d7e2df7e7855150 | [] | no_license | tnkarthick14/Selenium-Codes | b00b7edc9afe6047b3d199b15b6057bf37e9453f | be36461f1fe4a1bd1ca6dfdf12159dc375b88877 | refs/heads/master | 2020-04-29T08:08:31.320929 | 2019-04-13T12:56:15 | 2019-04-13T12:56:15 | 175,975,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,869 | java | package week2.Day1;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class IrctcSignUp {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","./drivers/chromedriver.exe");
//Invoking Built in ChromeDriver Class using object driver to launch Chrome driver
ChromeDriver driver = new ChromeDriver();
//Launches the IRCTC Website
driver.get("https://www.irctc.co.in/eticketing/userSignUp.jsf");
//To Maximize the opened chrome window
driver.manage().window().maximize();
//To Click the register button
//driver.findElementByLinkText("REGISTER").click();
//To select the username field
driver.findElementByXPath("//input[@id='userRegistrationForm:userName']").sendKeys("sampletestleaf123");
//To Check availability :
driver.findElementByXPath("//a[text()='Check Availability']").click();
//To Enter Password
driver.findElementByXPath("//input[@id='userRegistrationForm:password']").sendKeys("Testleaf123");
//To confirm the entered Password
driver.findElementByXPath("//input[@id='userRegistrationForm:confpasword']").sendKeys("Testleaf123");
//Invoking method to select dropdown webelement and storing in a local variable securityqn
//@SuppressWarnings("unused")
//IrctcSignUPSelect select1 = new IrctcSignUPSelect("//select[@id='userRegistrationForm:securityQ']","Who was your Childhood hero?");
WebElement secqn = driver.findElementByXPath("//select[@id='userRegistrationForm:securityQ']");
secqn.click();
Select dropdown = new Select(secqn);
dropdown.selectByVisibleText("Who was your Childhood hero?");
/*
//Invoking Select Class using Object Dropdown and passing the variable securityqn
Select dropdown = new Select(secqn);
dropdown.selectByVisibleText("Who was your Childhood hero?");
*/
//To Select Security Answer field and enter text
driver.findElementByXPath("//input[@id='userRegistrationForm:securityAnswer']").sendKeys("MyDad");
//Invoking method to select dropdown webelement and storing in a local variable preflang
//@SuppressWarnings("unused")
//IrctcSignUPSelect select2 = new IrctcSignUPSelect("//select[@id='userRegistrationForm:prelan']","English");
WebElement preflang = driver.findElementByXPath("//select[@id='userRegistrationForm:prelan']");
preflang.click();
Select dropdown1 = new Select(preflang);
dropdown1.selectByVisibleText("English");
//To Select First Name field
driver.findElementByXPath("//input[@id='userRegistrationForm:firstName']").sendKeys("Babu");
//To Select Second Name field
driver.findElementByXPath("//input[@id='userRegistrationForm:lastName']").sendKeys("Manickam");
//To Select Gender
driver.findElementByXPath("(//input[@value='M'])[1]").click();
//To Select Marital Status
driver.findElementByXPath("(//input[@value='M'])[2]").click();
// To Select DOB
WebElement dobd = driver.findElementByXPath("//select[@id='userRegistrationForm:dobDay']");
dobd.click();
Select dropdown2 = new Select(dobd);
dropdown2.selectByValue("14");
dobd.click();
WebElement dobm = driver.findElementByXPath("//select[@id='userRegistrationForm:dobMonth']");
dobm.click();
Select dropdown3 = new Select(dobm);
dropdown3.selectByVisibleText("NOV");
dobm.click();
WebElement doby = driver.findElementByXPath("//select[@id='userRegistrationForm:dateOfBirth']");
doby.click();
Select dropdown4 = new Select(doby);
dropdown4.selectByVisibleText("1994");
doby.click();
//To Select occupation :
WebElement occup = driver.findElementByXPath("//select[@id='userRegistrationForm:occupation']");
occup.click();
Select dropdown5 = new Select(occup);
dropdown5.selectByVisibleText("Private");
//To Select country :
WebElement country = driver.findElementByXPath("//select[@id='userRegistrationForm:countries']");
country.click();
Select dropdown6 = new Select(country);
dropdown6.selectByVisibleText("India");
//to enter email id :
driver.findElementByXPath("//input[@id='userRegistrationForm:email']").sendKeys("[email protected]");
//to enter mobile :
driver.findElementByXPath("//input[@id='userRegistrationForm:mobile']").sendKeys("9191919191");
//To Select Nationality :
WebElement nationality = driver.findElementByXPath("//select[@id='userRegistrationForm:nationalityId']");
nationality.click();
Select dropdown7 = new Select(nationality);
dropdown7.selectByVisibleText("India");
nationality.click();
//To Enter Address
driver.findElementByXPath("//input[@id='userRegistrationForm:address']").sendKeys("India");
//To Enter Pincode and press Tab
driver.findElementByXPath("//input[@id='userRegistrationForm:pincode']").sendKeys("600042",Keys.TAB);
Thread.sleep(3000);
//To Enter City name :
WebElement city = driver.findElementByXPath("//select[@id='userRegistrationForm:cityName']");
city.click();
Select dropdown8 = new Select(city);
dropdown8.selectByVisibleText("Chennai");
Thread.sleep(3000);
//To Select PO :
WebElement post = driver.findElementByXPath("//select[@id='userRegistrationForm:postofficeName']");
post.click();
Select dropdown9 = new Select(post);
dropdown9.selectByVisibleText("Velacheri S.O");
Thread.sleep(3000);
driver.findElementByXPath("//input[@value='Y']").click();
Thread.sleep(1000);
driver.findElementByXPath("//input[@id='userRegistrationForm:landline']").sendKeys("9191919191");
System.out.println("Hurray!!! It worked ");
driver.close();
}
}
| [
"tnkar@SARKAR"
] | tnkar@SARKAR |
0ccd03d7de9cfce8c9dc302954445653bd4f259c | 2658a0e8fa37ddcca0fac8f7e4a279348f39a67b | /StoreHeader.java | 6ec91bab150c16299a59b79d62fa871381b8ce05 | [] | no_license | mtleonardjr/Receipt-Decorator | ba5c81e681ed6d3a373c7718249bfbf23cb2b49e | a2ff93b9caf952ac4ac0aa35f7d531ab4aa26793 | refs/heads/master | 2020-12-23T03:55:32.520796 | 2020-02-29T16:36:37 | 2020-02-29T16:36:37 | 237,025,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package cosc436assignment_5;
import java.io.*;
//Author: Michael Leonard
public class StoreHeader {
private String street_addr, zip_code, phone_num, store_num, state_code;
public StoreHeader(String street_addr, String zip_code, String state_code, String phone_num,
String store_num){
this.street_addr = street_addr;
this.zip_code = zip_code;
this.state_code = state_code;
this.phone_num = phone_num;
this.store_num = store_num;
}
public String getStateCode(){
return state_code;
}
public void prtHeader(){
System.out.printf("\n%-25s %25s", "BEST BUY", "Store #"+store_num);
System.out.printf("\n%-39s %11s\n", street_addr+", "+state_code+" "+zip_code, phone_num);
}
} | [
"[email protected]"
] | |
1ccb20781bcea5c344e3406dfae58c58445778f6 | 2431af653419370f5b5fd955b8c5408f1ef94dae | /src/com/javaintroduction/TaskOnVariables.java | f8527df472289a037b4639b332a11c225be4b19d | [] | no_license | prathapSEDT/TMSEL-DailyCODE | d38acd8d3e8194f94b4e8973574cc426d773b3b5 | 4031154f323606d3c41fee4ecc15c59d90dccbd7 | refs/heads/master | 2023-03-14T20:08:22.837083 | 2021-02-23T05:11:46 | 2021-02-23T05:11:46 | 341,436,163 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.javaintroduction;
public class TaskOnVariables {
public static void main(String[] args) {
int a,b;
a=30;
b=40;
// swap two numbers, a==> 40 b==>30
a=a+b;// 70
b=a-b;//70-40=30
a=a-b;//70-30=40
System.out.println(a+" "+b);
}
}
| [
"[email protected]"
] | |
5bed405c4aa96baa2305212e4336ce918cc7bfa0 | bb8f8e51044c22cbe26711ec9228669a449cb920 | /app/src/main/java/com/example/judongseok/itcontest/MainScene.java | c081a5f35e5a2a0fc73acd03467909b51e5f756f | [] | no_license | MojitoBar/SKHU-NoticeApplication | f06e32f97250df604abdfe4e69a48632076df265 | 3c29b59e286dbf8163ea0390a6567846cae89ea0 | refs/heads/master | 2022-11-04T20:26:17.599893 | 2021-01-28T10:07:55 | 2021-01-28T10:07:55 | 148,444,092 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,208 | java | package com.example.judongseok.itcontest;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
/**
* Created by judongseok on 2018-09-16.
*/
public class MainScene extends BaseActivity{
public Switch sw;
@Override
protected void onStart() {
super.onStart();
SharedPreferences pref = getSharedPreferences("pref", MODE_PRIVATE);
check = pref.getBoolean("checked", false);
System.out.println("onStart");
System.out.println(check);
if (check){
sw.setChecked(true);
System.out.println("체크됨");
}
else
sw.setChecked(false);
}
boolean check;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final SharedPreferences pref = getSharedPreferences("pref", MODE_PRIVATE);
final SharedPreferences.Editor editor = pref.edit();
setContentView(R.layout.mainscene_activity);
sw = (Switch)findViewById(R.id.switch1);
sw.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked && !pref.getBoolean("checked", false)){
editor.putBoolean("checked", true);
editor.commit();
Toast.makeText(getApplicationContext(),"Service 시작",Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MainScene.this, MyService.class);
startService(intent);
}
else{
editor.putBoolean("checked", false);
editor.commit();
Intent intent = new Intent(MainScene.this, MyService.class);
stopService(intent);
}
}
});
}
}
| [
"[email protected]"
] | |
508988f896dbd1127339652fdf65a2a15939eddc | bbe5c642dcd8637c211c654a1b520dd45c0a38f9 | /src/com/leo/algorithm/ValidateBinarySearchTree.java | b32a82ddc9eded551f88583a18f83eff73b9b767 | [] | no_license | firelion0725/Algorithm | b6916d887854ea9beb428f149e69e172004d0ed1 | cebc870d1a41abe2539ba6d463502f3ae0dc1451 | refs/heads/master | 2022-12-23T13:23:47.953315 | 2020-09-17T07:36:37 | 2020-09-17T07:36:37 | 258,155,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,239 | java | package com.leo.algorithm;
import com.leo.algorithm.model.TreeNode;
import com.leo.algorithm.model.Utils;
/**
* https://leetcode-cn.com/problems/validate-binary-search-tree/
*/
public class ValidateBinarySearchTree {
public static void main(String[] args) {
TreeNode root = initTree2();
boolean aaa = isValidBST3(root);
// System.out.println(aaa);
}
private static TreeNode initTree() {
TreeNode root = new TreeNode(2);
TreeNode tree2 = new TreeNode(1);
TreeNode tree3 = new TreeNode(3);
root.left = tree2;
root.right = tree3;
return root;
}
private static TreeNode initTree2() {
// Integer[] nums = {2, 1, 3};
Integer[] nums = {10, 5, 15, null, 7, 6, 20};
TreeNode treeNode = Utils.intToTree(nums);
return treeNode;
}
// public static boolean isValidBST(TreeNode root) {
//
// if (root == null) {
// return true;
// }
//
// return validRoot(root, root, root);
// }
// public static boolean validRoot(TreeNode up, TreeNode low, TreeNode root) {
//
// }
// public static boolean isValidBST(TreeNode root) {
//
// if (root.left == null && root.right == null) {
// return true;
// }
//
// boolean result = true;
// if (root.left != null) {
// if (root.left.val >= root.val) {
// return false;
// } else {
// result = isValidBST(root.left);
// }
// }
//
// if (!result) {
// return false;
// }
//
// if (root.right != null) {
// if (root.right.val <= root.val) {
// return false;
// } else {
// result = isValidBST(root.right);
// }
// }
//
// return result;
// }
//==============================标答=====================================
public boolean helper(TreeNode node, Integer lower, Integer upper) {
if (node == null) {
return true;
}
int val = node.val;
if (lower != null && val <= lower) {
return false;
}
if (upper != null && val >= upper) {
return false;
}
if (!helper(node.right, val, upper)) {
return false;
}
if (!helper(node.left, lower, val)) {
return false;
}
return true;
}
public boolean isValidBST2(TreeNode root) {
return helper(root, null, null);
}
//==================中序递归==============================
private static double pre = -Double.MAX_VALUE;
public static boolean isValidBST3(TreeNode root) {
if (root == null) {
return true;
}
return Inorder(root);
}
private static boolean Inorder(TreeNode root) {
if (root == null) {
return true;
}
if (!Inorder(root.left)) {
return false;
}
if (root.val <= pre) {
return false;
} else {
pre = root.val;
}
if (!Inorder(root.right)) {
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
4354c8518a394c0baa9d6471a2bcc0117579a429 | 3482685392a16465aba102874c701707343e8d95 | /app/src/main/java/com/epita/mti/tinytube/request/OkHttpStack.java | 1d3d2b1f9df0daf2c00db0f74c9da414c89dfbdc | [] | no_license | matthieu-rollin/TinyTube | d26d8f736fef9195e2e020e37a07287eda239337 | cb5df5895f5bd39578e884e6e2ec9a76ebd366ed | refs/heads/master | 2021-01-23T15:41:45.371727 | 2014-12-20T00:24:21 | 2014-12-20T00:24:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,029 | java | package com.epita.mti.tinytube.request;
import com.android.volley.toolbox.HurlStack;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.OkUrlFactory;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by _Gary_ on 28/11/2014.
* Simple stack to use OkHttp with Volley
*/
public class OkHttpStack extends HurlStack {
/**
* The TAG for logs
*/
private static final String TAG = OkHttpStack.class.getSimpleName();
/**
* The url factory
*/
private final OkUrlFactory okUrlFactory;
public OkHttpStack() {
this(new OkUrlFactory(new OkHttpClient()));
}
public OkHttpStack(OkUrlFactory okUrlFactory) {
if (okUrlFactory == null) {
throw new NullPointerException("Client must not be null.");
}
this.okUrlFactory = okUrlFactory;
}
@Override
protected HttpURLConnection createConnection(URL url) throws IOException {
return okUrlFactory.open(url);
}
}
| [
"[email protected]"
] | |
6b5c6dfbe82c11dcfc8aa7d23661141cd3c2ac83 | 75d27f2806924f891e6c6a68a839a8744cb975f3 | /girls/src/main/java/net/lele/domain/User.java | 4532fff025944e537f9ee45a586bc2143506ba4a | [] | no_license | leleluv1122/HuiHeeGirls | 454894c5171c03c63fbf9b2abc8a78cab448a122 | 2e3bd73de4e7e19058f74599ecc4afc415e8df5f | refs/heads/master | 2023-04-11T00:16:39.956398 | 2021-01-05T04:53:50 | 2021-01-05T04:53:50 | 242,047,626 | 7 | 1 | null | 2021-04-26T20:26:13 | 2020-02-21T03:42:14 | Java | UTF-8 | Java | false | false | 480 | java | package net.lele.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import lombok.Data;
@Data
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
int id;
int enable;
String userId;
String password;
String userType;
String name;
String email;
String phone;
String address;
String address_detail;
int postcode;
String addrplus;
}
| [
"[email protected]"
] | |
70cd2034f6c36b6e9692f679f1c95c904da8dcd9 | f2e41adb54b8bd00fd8bca4990af9ee1e1006a5e | /spring_step06_jdbc/src/test02/JdbcExample6.java | e701a98d90ca67aed75877156369b5cde931b59f | [] | no_license | bsgpark/Springworkspace | 3eaac88b5fae0b55604d280f1c376bee25d2e4f0 | 0127f82bee54463f5a4e783d1554ce95fb7de370 | refs/heads/master | 2022-12-24T10:24:54.540943 | 2020-09-22T07:15:51 | 2020-09-22T07:15:51 | 295,885,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package test02;
/* 수정
[문제] p0001을 jQuery, 35000, 인포믹스로 변경하시오
[결과] 상품 1개를 수정하였습니다
*/
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class JdbcExample6 {
public static void main(String[] args) {
ApplicationContext factory = new ClassPathXmlApplicationContext("test02/application.xml");
GoodsEntity entity=new GoodsEntity();
entity.setCode("p0001");
entity.setName("jQuery");
entity.setPrice(35000);
entity.setMaker("인포믹스");
FirstJdbcDao dao=factory.getBean("test", FirstJdbcDao.class);
int n=dao.update(entity);
if(n>0) {
System.out.println("상품 " + n + "개를 수정하였습니다");
}
((ClassPathXmlApplicationContext)factory).close();
}
}
| [
"[email protected]"
] | |
1f865d55f2e2ff992892b77e11190f0314ccd311 | 580d37ac030ee333cf47ffa5ad5aca0ccb608459 | /src/test/java/com/springboot/DemoApplicationTest.java | 1199ea2a66e24e73d584b126982e932435beb5cd | [] | no_license | zhuyupeiwmq/springboot | 906994fc408f220c72dfc7b44382ae7f01bb1b8e | e47d2671aa16680418665d123f4c95def32c10f9 | refs/heads/master | 2023-03-12T20:32:28.563272 | 2020-12-21T09:57:38 | 2020-12-21T09:57:38 | 323,290,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | package com.springboot;
import static org.junit.jupiter.api.Assertions.*;
class DemoApplicationTest {
} | [
"103zypZ#"
] | 103zypZ# |
ca2a71dea01ef97318d7f5ed47f504c2c6e1b13f | 5604ba8b171cc374ca78e7a165a7e26498d12e34 | /it.polimi.mdir.crawler.graphmlmodel/code/gen/it/polimi/mdir/crawler/graphmlmodel/messages/ObjectFactory.java | cd2c4135e3ebcf6b98c253c04ea5c79c71573783 | [] | no_license | zefang/model-driven-information-retrieval | 9019c4c1ca0b0a5f544866c80e7c2207841717ea | 446027dd10e809d07e5280b164347792169c7282 | refs/heads/master | 2020-04-06T03:34:33.489980 | 2011-10-08T14:44:39 | 2011-10-08T14:44:39 | 37,524,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,316 | java |
// CHECKSTYLE:OFF
package it.polimi.mdir.crawler.graphmlmodel.messages;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the it.polimi.mdir.crawler.graphmlmodel.messages package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: it.polimi.mdir.crawler.graphmlmodel.messages
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link Process }
*
*/
public Process createProcess() {
return new Process();
}
/**
* Create an instance of {@link Process.Filter }
*
*/
public Process.Filter createProcessFilter() {
return new Process.Filter();
}
/**
* Create an instance of {@link Attribute }
*
*/
public Attribute createAttribute() {
return new Attribute();
}
/**
* Create an instance of {@link OriginalAttribute }
*
*/
public OriginalAttribute createOriginalAttribute() {
return new OriginalAttribute();
}
/**
* Create an instance of {@link OriginalProcess }
*
*/
public OriginalProcess createOriginalProcess() {
return new OriginalProcess();
}
/**
* Create an instance of {@link Process.Filter.Include }
*
*/
public Process.Filter.Include createProcessFilterInclude() {
return new Process.Filter.Include();
}
/**
* Create an instance of {@link Process.Filter.Exclude }
*
*/
public Process.Filter.Exclude createProcessFilterExclude() {
return new Process.Filter.Exclude();
}
}
// CHECKSTYLE:ON
| [
"[email protected]"
] | |
89fe8e3ae8e907a75851c58c57c2249e99d57c1a | c83d9a429fa8754619eb2de55a4b36a27afb198a | /src/util/ChartUtils.java | abe8a1f490ad5bb754934794edd25cc3114082f7 | [] | no_license | yongchengmin/jfreecharts_demo_01 | 0675e724c7ba49b3be469bf75454f883559fa9ae | 975650f18cd8989438697254430c32ebeaf206cc | refs/heads/master | 2020-03-10T11:57:49.650581 | 2018-04-13T07:37:35 | 2018-04-13T07:37:35 | 129,366,706 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 16,138 | java | package util;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Paint;
import java.awt.Rectangle;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.StandardChartTheme;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.DateTickUnit;
import org.jfree.chart.axis.DateTickUnitType;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.block.BlockBorder;
import org.jfree.chart.labels.ItemLabelAnchor;
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.labels.StandardPieSectionLabelGenerator;
import org.jfree.chart.labels.StandardXYItemLabelGenerator;
import org.jfree.chart.labels.StandardXYToolTipGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.DefaultDrawingSupplier;
import org.jfree.chart.plot.PieLabelLinkStyle;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.jfree.chart.renderer.category.StackedBarRenderer;
import org.jfree.chart.renderer.category.StandardBarPainter;
import org.jfree.chart.renderer.xy.StandardXYBarPainter;
import org.jfree.chart.renderer.xy.XYBarRenderer;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.time.Day;
import org.jfree.data.time.TimeSeries;
import org.jfree.ui.RectangleInsets;
import org.jfree.ui.TextAnchor;
/**
* Jfreechart工具类
* <p>
* 解决中午乱码问题<br>
* 用来创建类别图表数据集、创建饼图数据集、时间序列图数据集<br>
* 用来对柱状图、折线图、饼图、堆积柱状图、时间序列图的样式进行渲染<br>
* 设置X-Y坐标轴样式
* <p>
*
*
* @author chenchangwen
* @since:2014-2-18
*
*/
public class ChartUtils {
private static String NO_DATA_MSG = "数据加载失败";
private static Font FONT = new Font("宋体", Font.PLAIN, 12);
public static Color[] CHART_COLORS = {
new Color(31,129,188), new Color(92,92,97), new Color(144,237,125), new Color(255,188,117),
new Color(153,158,255), new Color(255,117,153), new Color(253,236,109), new Color(128,133,232),
new Color(158,90,102),new Color(255, 204, 102) };// 颜色
static {
setChartTheme();
}
public ChartUtils() {
}
/**
* 中文主题样式 解决乱码
*/
public static void setChartTheme() {
// 设置中文主题样式 解决乱码
StandardChartTheme chartTheme = new StandardChartTheme("CN");
// 设置标题字体
chartTheme.setExtraLargeFont(FONT);
// 设置图例的字体
chartTheme.setRegularFont(FONT);
// 设置轴向的字体
chartTheme.setLargeFont(FONT);
chartTheme.setSmallFont(FONT);
chartTheme.setTitlePaint(new Color(51, 51, 51));
chartTheme.setSubtitlePaint(new Color(85, 85, 85));
chartTheme.setLegendBackgroundPaint(Color.WHITE);// 设置标注
chartTheme.setLegendItemPaint(Color.BLACK);//
chartTheme.setChartBackgroundPaint(Color.WHITE);
// 绘制颜色绘制颜色.轮廓供应商
// paintSequence,outlinePaintSequence,strokeSequence,outlineStrokeSequence,shapeSequence
Paint[] OUTLINE_PAINT_SEQUENCE = new Paint[] { Color.WHITE };
// 绘制器颜色源
DefaultDrawingSupplier drawingSupplier = new DefaultDrawingSupplier(CHART_COLORS, CHART_COLORS, OUTLINE_PAINT_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
chartTheme.setDrawingSupplier(drawingSupplier);
chartTheme.setPlotBackgroundPaint(Color.WHITE);// 绘制区域
chartTheme.setPlotOutlinePaint(Color.WHITE);// 绘制区域外边框
chartTheme.setLabelLinkPaint(new Color(8, 55, 114));// 链接标签颜色
chartTheme.setLabelLinkStyle(PieLabelLinkStyle.CUBIC_CURVE);
chartTheme.setAxisOffset(new RectangleInsets(5, 12, 5, 12));
chartTheme.setDomainGridlinePaint(new Color(192, 208, 224));// X坐标轴垂直网格颜色
chartTheme.setRangeGridlinePaint(new Color(192, 192, 192));// Y坐标轴水平网格颜色
chartTheme.setBaselinePaint(Color.WHITE);
chartTheme.setCrosshairPaint(Color.BLUE);// 不确定含义
chartTheme.setAxisLabelPaint(new Color(51, 51, 51));// 坐标轴标题文字颜色
chartTheme.setTickLabelPaint(new Color(67, 67, 72));// 刻度数字
chartTheme.setBarPainter(new StandardBarPainter());// 设置柱状图渲染
chartTheme.setXYBarPainter(new StandardXYBarPainter());// XYBar 渲染
chartTheme.setItemLabelPaint(Color.black);
chartTheme.setThermometerPaint(Color.white);// 温度计
ChartFactory.setChartTheme(chartTheme);
}
/**
* 必须设置文本抗锯齿
*/
public static void setAntiAlias(JFreeChart chart) {
chart.setTextAntiAlias(false);
}
/**
* 设置图例无边框,默认黑色边框
*/
public static void setLegendEmptyBorder(JFreeChart chart) {
chart.getLegend().setFrame(new BlockBorder(Color.WHITE));
}
/**
* 创建类别数据集合
*/
public static DefaultCategoryDataset createDefaultCategoryDataset(Vector<Serie> series, String[] categories) {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (Serie serie : series) {
String name = serie.getName();
Vector<Object> data = serie.getData();
if (data != null && categories != null && data.size() == categories.length) {
for (int index = 0; index < data.size(); index++) {
String value = data.get(index) == null ? "" : data.get(index).toString();
if (isPercent(value)) {
value = value.substring(0, value.length() - 1);
}
if (isNumber(value)) {
dataset.setValue(Double.parseDouble(value), name, categories[index]);
}
}
}
}
return dataset;
}
/**
* 创建饼图数据集合
*/
public static DefaultPieDataset createDefaultPieDataset(String[] categories, Object[] datas) {
DefaultPieDataset dataset = new DefaultPieDataset();
for (int i = 0; i < categories.length && categories != null; i++) {
String value = datas[i].toString();
if (isPercent(value)) {
value = value.substring(0, value.length() - 1);
}
if (isNumber(value)) {
dataset.setValue(categories[i], Double.valueOf(value));
}
}
return dataset;
}
/**
* 创建时间序列数据
*
* @param category
* 类别
* @param dateValues
* 日期-值 数组
* @param xAxisTitle
* X坐标轴标题
* @return
*/
public static TimeSeries createTimeseries(String category, Vector<Object[]> dateValues) {
TimeSeries timeseries = new TimeSeries(category);
if (dateValues != null) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
for (Object[] objects : dateValues) {
Date date = null;
try {
date = dateFormat.parse(objects[0].toString());
} catch (ParseException e) {
}
String sValue = objects[1].toString();
double dValue = 0;
if (date != null && isNumber(sValue)) {
dValue = Double.parseDouble(sValue);
timeseries.add(new Day(date), dValue);
}
}
}
return timeseries;
}
/**
* 设置 折线图样式
*
* @param plot
* @param isShowDataLabels
* 是否显示数据标签 默认不显示节点形状
*/
public static void setLineRender(CategoryPlot plot, boolean isShowDataLabels) {
setLineRender(plot, isShowDataLabels, false);
}
/**
* 设置折线图样式
*
* @param plot
* @param isShowDataLabels
* 是否显示数据标签
*/
public static void setLineRender(CategoryPlot plot, boolean isShowDataLabels, boolean isShapesVisible) {
plot.setNoDataMessage(NO_DATA_MSG);
plot.setInsets(new RectangleInsets(10, 10, 0, 10), false);
LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setStroke(new BasicStroke(1.5F));
if (isShowDataLabels) {
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING,
NumberFormat.getInstance()));
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));// weizhi
}
renderer.setBaseShapesVisible(isShapesVisible);// 数据点绘制形状
setXAixs(plot);
setYAixs(plot);
}
/**
* 设置时间序列图样式
*
* @param plot
* @param isShowData
* 是否显示数据
* @param isShapesVisible
* 是否显示数据节点形状
*/
public static void setTimeSeriesRender(Plot plot, boolean isShowData, boolean isShapesVisible) {
XYPlot xyplot = (XYPlot) plot;
xyplot.setNoDataMessage(NO_DATA_MSG);
xyplot.setInsets(new RectangleInsets(10, 10, 5, 10));
XYLineAndShapeRenderer xyRenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
xyRenderer.setBaseShapesVisible(false);
if (isShowData) {
xyRenderer.setBaseItemLabelsVisible(true);
xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
xyRenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));// weizhi
}
xyRenderer.setBaseShapesVisible(isShapesVisible);// 数据点绘制形状
DateAxis domainAxis = (DateAxis) xyplot.getDomainAxis();
domainAxis.setAutoTickUnitSelection(false);
DateTickUnit dateTickUnit = new DateTickUnit(DateTickUnitType.YEAR, 1, new SimpleDateFormat("yyyy-MM")); // 第二个参数是时间轴间距
domainAxis.setTickUnit(dateTickUnit);
StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0"));
xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator);
setXY_XAixs(xyplot);
setXY_YAixs(xyplot);
}
/**
* 设置时间序列图样式 -默认不显示数据节点形状
*
* @param plot
* @param isShowData
* 是否显示数据
*/
public static void setTimeSeriesRender(Plot plot, boolean isShowData) {
setTimeSeriesRender(plot, isShowData, false);
}
/**
* 设置时间序列图渲染:但是存在一个问题:如果timeseries里面的日期是按照天组织, 那么柱子的宽度会非常小,和直线一样粗细
*
* @param plot
* @param isShowDataLabels
*/
public static void setTimeSeriesBarRender(Plot plot, boolean isShowDataLabels) {
XYPlot xyplot = (XYPlot) plot;
xyplot.setNoDataMessage(NO_DATA_MSG);
XYBarRenderer xyRenderer = new XYBarRenderer(0.1D);
xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
if (isShowDataLabels) {
xyRenderer.setBaseItemLabelsVisible(true);
xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
}
StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0"));
xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator);
setXY_XAixs(xyplot);
setXY_YAixs(xyplot);
}
/**
* 设置柱状图渲染
*
* @param plot
* @param isShowDataLabels
*/
public static void setBarRenderer(CategoryPlot plot, boolean isShowDataLabels) {
plot.setNoDataMessage(NO_DATA_MSG);
plot.setInsets(new RectangleInsets(10, 10, 5, 10));
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
renderer.setMaximumBarWidth(0.075);// 设置柱子最大宽度
if (isShowDataLabels) {
renderer.setBaseItemLabelsVisible(true);
}
setXAixs(plot);
setYAixs(plot);
}
/**
* 设置堆积柱状图渲染
*
* @param plot
*/
public static void setStackBarRender(CategoryPlot plot) {
plot.setNoDataMessage(NO_DATA_MSG);
plot.setInsets(new RectangleInsets(10, 10, 5, 10));
StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
plot.setRenderer(renderer);
setXAixs(plot);
setYAixs(plot);
}
/**
* 设置类别图表(CategoryPlot) X坐标轴线条颜色和样式
*
* @param axis
*/
public static void setXAixs(CategoryPlot plot) {
Color lineColor = new Color(31, 121, 170);
plot.getDomainAxis().setAxisLinePaint(lineColor);// X坐标轴颜色
plot.getDomainAxis().setTickMarkPaint(lineColor);// X坐标轴标记|竖线颜色
}
/**
* 设置类别图表(CategoryPlot) Y坐标轴线条颜色和样式 同时防止数据无法显示
*
* @param axis
*/
public static void setYAixs(CategoryPlot plot) {
Color lineColor = new Color(192, 208, 224);
ValueAxis axis = plot.getRangeAxis();
axis.setAxisLinePaint(lineColor);// Y坐标轴颜色
axis.setTickMarkPaint(lineColor);// Y坐标轴标记|竖线颜色
// 隐藏Y刻度
axis.setAxisLineVisible(false);
axis.setTickMarksVisible(false);
// Y轴网格线条
plot.setRangeGridlinePaint(new Color(192, 192, 192));
plot.setRangeGridlineStroke(new BasicStroke(1));
plot.getRangeAxis().setUpperMargin(0.1);// 设置顶部Y坐标轴间距,防止数据无法显示
plot.getRangeAxis().setLowerMargin(0.1);// 设置底部Y坐标轴间距
}
/**
* 设置XY图表(XYPlot) X坐标轴线条颜色和样式
*
* @param axis
*/
public static void setXY_XAixs(XYPlot plot) {
Color lineColor = new Color(31, 121, 170);
plot.getDomainAxis().setAxisLinePaint(lineColor);// X坐标轴颜色
plot.getDomainAxis().setTickMarkPaint(lineColor);// X坐标轴标记|竖线颜色
}
/**
* 设置XY图表(XYPlot) Y坐标轴线条颜色和样式 同时防止数据无法显示
*
* @param axis
*/
public static void setXY_YAixs(XYPlot plot) {
Color lineColor = new Color(192, 208, 224);
ValueAxis axis = plot.getRangeAxis();
axis.setAxisLinePaint(lineColor);// X坐标轴颜色
axis.setTickMarkPaint(lineColor);// X坐标轴标记|竖线颜色
// 隐藏Y刻度
axis.setAxisLineVisible(false);
axis.setTickMarksVisible(false);
// Y轴网格线条
plot.setRangeGridlinePaint(new Color(192, 192, 192));
plot.setRangeGridlineStroke(new BasicStroke(1));
plot.setDomainGridlinesVisible(false);
plot.getRangeAxis().setUpperMargin(0.12);// 设置顶部Y坐标轴间距,防止数据无法显示
plot.getRangeAxis().setLowerMargin(0.12);// 设置底部Y坐标轴间距
}
/**
* 设置饼状图渲染
*/
public static void setPieRender(Plot plot) {
plot.setNoDataMessage(NO_DATA_MSG);
plot.setInsets(new RectangleInsets(10, 10, 5, 10));
PiePlot piePlot = (PiePlot) plot;
piePlot.setInsets(new RectangleInsets(0, 0, 0, 0));
piePlot.setCircular(true);// 圆形
// piePlot.setSimpleLabels(true);// 简单标签
piePlot.setLabelGap(0.01);
piePlot.setInteriorGap(0.05D);
piePlot.setLegendItemShape(new Rectangle(10, 10));// 图例形状
piePlot.setIgnoreNullValues(true);
piePlot.setLabelBackgroundPaint(null);// 去掉背景色
piePlot.setLabelShadowPaint(null);// 去掉阴影
piePlot.setLabelOutlinePaint(null);// 去掉边框
piePlot.setShadowPaint(null);
// 0:category 1:value:2 :percentage
piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}:{2}"));// 显示标签数据
}
/**
* 是不是一个%形式的百分比
*
* @param str
* @return
*/
public static boolean isPercent(String str) {
return str != null ? str.endsWith("%") && isNumber(str.substring(0, str.length() - 1)) : false;
}
/**
* 是不是一个数字
*
* @param str
* @return
*/
public static boolean isNumber(String str) {
return str != null ? str.matches("^[-+]?(([0-9]+)((([.]{0})([0-9]*))|(([.]{1})([0-9]+))))$") : false;
}
}
| [
"[email protected]"
] | |
8089e8b6315d865c165e72b6e9b40948d94caf72 | 6cb64364c931af163127635693a89116f7b00428 | /src/com/khoahuy/exception/UnauthorizedException.java | d72fbe86de117e859d05663aa8ae13bba2f59145 | [] | no_license | khdb/phototag | ac2a5ea7ac1f5eeda5701f899427d468ad695a09 | 62f8774fbec8a2dad83c10b3f9049fd48515c04d | refs/heads/master | 2016-09-05T20:15:47.319696 | 2013-11-27T17:54:11 | 2013-11-27T17:54:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.khoahuy.exception;
public class UnauthorizedException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public UnauthorizedException(String message) {
super(message);
}
}
| [
"[email protected]"
] | |
e7616b8311d11a5802945a90f1a05bb79ddc9b7f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/29/29_15fa01a72f25d2828339cd116a2a7d7972b980a9/TwitterManagerImpl/29_15fa01a72f25d2828339cd116a2a7d7972b980a9_TwitterManagerImpl_s.java | 151b5b8d8c3d59ebcfe7269626e1a6918ae9ea7a | [] | 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,636 | java | /**
*
*/
package org.soluvas.web.login;
import twitter4j.Twitter;
import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken;
/**
* @author haidar
*
*/
public class TwitterManagerImpl implements TwitterManager {
private final String consumerKey;
private final String consumerSecret;
private final Twitter twitter;
public TwitterManagerImpl(String consumerKey, String consumerSecret) {
super();
this.consumerKey = consumerKey;
this.consumerSecret = consumerSecret;
twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(consumerKey, consumerSecret);
}
@Override
public Twitter getTwitter() {
return twitter;
}
@Override
public Twitter createTwitter(String accessToken, String accessTokenSecret) {
final Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(consumerKey, consumerSecret);
twitter.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret));
return twitter;
}
/* (non-Javadoc)
* @see org.soluvas.web.login.FacebookManager#getAppId()
*/
@Override
public String getConsumerKey() {
return consumerKey;
}
/* (non-Javadoc)
* @see org.soluvas.web.login.FacebookManager#getAppSecret()
*/
@Override
public String getConsumerSecret() {
return consumerSecret;
}
// String appId = "260800077384280";
// String appSecret = "21f77dcd8501b12354b889ff32f96fad";
// String redirectUri = "http://www.berbatik5.haidar.dev/fb_recipient/";
// UUID state = UUID.randomUUID();
// String facebookRedirectUri = "https://www.facebook.com/dialog/oauth";
}
| [
"[email protected]"
] | |
961e9afe3ba7ccbd7a4d1d8f9f23ea518c2b3a72 | bc0ecf8cc3ac3cb3bb95f09312ba75e0062c6969 | /src/main/java/efuture/persistence/CommonDAO.java | d1c9230a24bede2550e0ea1e75e08e32b76f5958 | [] | no_license | juyoungyoo/TimeReport | c83043876d1c59af48a39389e39185a3f400f2c9 | f92b8b30d8a65a83c2fc07c3c4ad5491b71b6d2d | refs/heads/master | 2022-12-25T20:16:37.707742 | 2018-03-19T01:04:56 | 2018-03-19T01:04:56 | 125,488,608 | 0 | 0 | null | 2022-12-16T06:02:02 | 2018-03-16T08:44:03 | JavaScript | UTF-8 | Java | false | false | 286 | java | package efuture.persistence;
import java.util.ArrayList;
import java.util.HashMap;
/**
* 프로젝트 관리
* Created by user on 2017-03-29.
*/
public interface CommonDAO {
/* 공통코드 출력 */
ArrayList<HashMap<String,Object>> list(HashMap<String,Object> hmap);
}
| [
"[email protected]"
] | |
b7b175e93432ffdf786199b5feff6b5ee89310d2 | eb2690583fc03c0d9096389e1c07ebfb80e7f8d5 | /src/main/java/org/owasp/benchmark/testcode/BenchmarkTest01733.java | e16fc956f1c9f8dc5de34f0eeb80c1e8221121b3 | [] | no_license | leroy-habberstad/java-benchmark | 126671f074f81bd7ab339654ed1b2d5d85be85dd | bce2a30bbed61a7f717a9251ca2cbb38b9e6a732 | refs/heads/main | 2023-03-15T03:02:42.714614 | 2021-03-23T00:03:36 | 2021-03-23T00:03:36 | 350,495,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,498 | java | /**
* OWASP Benchmark Project v1.2
*
* This file is part of the Open Web Application Security Project (OWASP)
* Benchmark Project. For details, please see
* <a href="https://www.owasp.org/index.php/Benchmark">https://www.owasp.org/index.php/Benchmark</a>.
*
* The OWASP Benchmark is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation, version 2.
*
* The OWASP Benchmark is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* @author Dave Wichers <a href="https://www.aspectsecurity.com">Aspect Security</a>
* @created 2015
*/
package org.owasp.benchmark.testcode;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(value="/sqli-03/BenchmarkTest01733")
public class BenchmarkTest01733 extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String queryString = request.getQueryString();
String paramval = "BenchmarkTest01733"+"=";
int paramLoc = -1;
if (queryString != null) paramLoc = queryString.indexOf(paramval);
if (paramLoc == -1) {
response.getWriter().println("getQueryString() couldn't find expected parameter '" + "BenchmarkTest01733" + "' in query string.");
return;
}
String param = queryString.substring(paramLoc + paramval.length()); // 1st assume "BenchmarkTest01733" param is last parameter in query string.
// And then check to see if its in the middle of the query string and if so, trim off what comes after.
int ampersandLoc = queryString.indexOf("&", paramLoc);
if (ampersandLoc != -1) {
param = queryString.substring(paramLoc + paramval.length(), ampersandLoc);
}
param = java.net.URLDecoder.decode(param, "UTF-8");
String bar = new Test().doSomething(request, param);
String sql = "INSERT INTO users (username, password) VALUES ('foo','"+ bar + "')";
try {
java.sql.Statement statement = org.owasp.benchmark.helpers.DatabaseHelper.getSqlStatement();
int count = statement.executeUpdate( sql, new String[] {"USERNAME","PASSWORD"} );
org.owasp.benchmark.helpers.DatabaseHelper.outputUpdateComplete(sql, response);
} catch (java.sql.SQLException e) {
if (org.owasp.benchmark.helpers.DatabaseHelper.hideSQLErrors) {
response.getWriter().println(
"Error processing request."
);
return;
}
else throw new ServletException(e);
}
} // end doPost
private class Test {
public String doSomething(HttpServletRequest request, String param) throws ServletException, IOException {
org.owasp.benchmark.helpers.ThingInterface thing = org.owasp.benchmark.helpers.ThingFactory.createThing();
String bar = thing.doSomething(param);
return bar;
}
} // end innerclass Test
} // end DataflowThruInnerClass
| [
"[email protected]"
] | |
0a4a74916f624ddf63305770184cfec1b0d9c955 | 59e5d71dd5eb187fcbd544e92000525961f3541d | /integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTest.java | e9fb37522c561ae85dc9d821e4ef87ffcf1a7b7c | [
"Apache-2.0"
] | permissive | alansaid/stanbol | 532ca3eaf752b240920762e174387f243eecbdad | ad9fb1c880d17c29f9dad0e23e7c8899fff37512 | refs/heads/trunk | 2021-01-14T12:21:46.554231 | 2015-12-07T09:40:48 | 2015-12-07T09:40:48 | 46,792,648 | 0 | 1 | null | 2015-11-24T13:15:28 | 2015-11-24T13:15:27 | null | UTF-8 | Java | false | false | 1,430 | 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.stanbol.enhancer.it;
import org.junit.Test;
/**
* Default MultiThreadedTest tool. Supports the use of System properties to
* configure the test. See the <a href="http://stanbol.apache.org/docs/trunk/utils/enhancerstresstest">
* Stanbol Enhancer Stress Test Utility</a> documentation for details
* @author Rupert Westenthaler
*
*/
public final class MultiThreadedTest extends MultiThreadedTestBase {
public MultiThreadedTest(){
super();
}
@Test
public void testMultipleParallelRequests() throws Exception {
performTest(TestSettings.fromSystemProperties());
}
}
| [
"[email protected]"
] | |
6f84688104647ac3995bc160111fd806bad91a72 | ef8abb69f0381d0f5ff109a6715d8ab34c6be341 | /src/MyApplication/app/src/main/java/com/example/tuan/myapplication/Server/SendJSON.java | d576f9839da820e2a8f7efb68d814afd2d0b3ab3 | [] | no_license | tuanpham91/Android-SettlerOfCatan | 335555fa3c15e992425b15b3e97e76cfef6d690c | 244007ca09f5dcf496077dd98ea87a014685d8f3 | refs/heads/master | 2021-08-16T10:33:12.858665 | 2017-11-19T16:06:29 | 2017-11-19T16:06:29 | 110,433,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,764 | java | package com.example.tuan.myapplication.Server;
import java.util.ArrayList;
import java.util.Arrays;
import com.example.tuan.myapplication.model.Card;
import com.example.tuan.myapplication.model.Cost;
import com.example.tuan.myapplication.model.Game;
import com.example.tuan.myapplication.model.Player;
import com.example.tuan.myapplication.model.TradeOffer;
import org.json.JSONException;
import org.json.JSONObject;
public class SendJSON
{
public static Integer id = 0;
public static Integer handelsID=0;
public static String targetUrl= "blablabla";
public static String phase = "Start";
public static ArrayList<Integer> currentIds;
public static void sendErfindungServer(int playerID, int lumber, int brick, int wool, int ore, int grain) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
obj1.put("Spieler", playerID);
Cost res = new Cost();
res.brick=brick;
res.grain=grain;
res.lumber=lumber;
res.ore=ore;
res.wool=wool;
objOut.put("Erfindung", obj1);
obj1.put("Rohstoffe", res);
CatanServlet.broadcast(objOut);
}
public static void sendErfindungClient(int playerID, Cost res) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Erfindung", obj1);
obj1.put("Rohstoffe", res);
Client.executePost("", objOut);
}
public static void sendMonopolServer(int playerID, String resource) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Monopol", obj1);
obj1.put("Spieler", playerID);
obj1.put("Rohstoff", resource);
CatanServlet.broadcast(objOut);
}
public static void sendMonopolClient(int playerID, String resource) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Monopol", obj1);
obj1.put("Rohstoff", resource);
Client.executePost(targetUrl, objOut);
}
public static void sendStrassenbaukarteAusspielenServer(int playerID, int x1, int y1, int x2, int y2) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
JSONObject[] destinationArray = new JSONObject[2];
JSONObject tile1 = new JSONObject();
JSONObject tile2 = new JSONObject();
destinationArray[0] = tile1;
destinationArray[1] = tile2;
tile1.put("x", x1);
tile1.put("y", y1);
tile2.put("x", x2);
tile2.put("x", y2);
objOut.put("Straßenbaukarte ausspielen", obj1);
obj1.put("Spieler", playerID);
obj1.put("Straße", destinationArray);
CatanServlet.broadcast(objOut);
}
public static void sendNextPlayerInTurn(){
if (Game.phase.equals("Start")) {
}
}
// send by Client
public static void sendStrassenbaukarteAusspielenClient(int playerID)
{
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
}
public static void sendRitterAusspielenServer(int playerID, int x, int y, int target) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
JSONObject destinationObject = new JSONObject();
destinationObject.put("x", x);
destinationObject.put("y", y);
objOut.put("Ritter ausspielen", obj1);
obj1.put("Spieler", playerID);
obj1.put("Ort", destinationObject);
obj1.put("Ziel", target);
CatanServlet.broadcast(objOut);
}
// send by Client
public static void sendRitterAusspielenClient(int playerID, int x, int y, int target) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
JSONObject destinationObject = new JSONObject();
destinationObject.put("x", x);
destinationObject.put("y", y);
objOut.put("Ritter ausspielen", obj1);
obj1.put("Ort", destinationObject);
obj1.put("Ziel", target);
Client.executePost("", objOut);
}
public static void sendHandelsangebotAbgebrochen(int playerID, int tradeID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Handelsangebot abgebrochen", obj1);
obj1.put("Spieler", playerID);
obj1.put("Handel id", tradeID);
CatanServlet.broadcast(objOut);
}
// send by Client
public static void sendHandelAbbrechen(int playerID, int tradeID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Handelsangebot angenommen", obj1);
obj1.put("Spieler", playerID);
obj1.put("Handel id", tradeID);
Client.executePost("", objOut);
}
public static void sendHandelAusgefuehrt(int playerID, int otherPlayerID, int tradeID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
obj1.put("Mitspieler", otherPlayerID);
obj1.put("Spieler", playerID);
obj1.put("Handel id",tradeID);
objOut.put("Handelsangebot angenommen", obj1);
CatanServlet.broadcast(objOut);
}
// send by Client, when he/she accepted the offer from someone
public static void sendHandelAbschliessen(int otherPlayerID, int tradeID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Handel abschließen", obj1);
obj1.put("Mitspieler", otherPlayerID);
obj1.put("Handel id", tradeID);
Client.executePost(targetUrl, objOut);
}
public static void sendHandelsangebotAngenommen(int otherPlayerID, int tradeID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Handelsangebot angenommen", obj1);
obj1.put("Mitspieler", otherPlayerID);
obj1.put("Handel id", tradeID);
obj1.put("Annehmen", true);
TradeOffer tOffer = Game.getTradeOfferById(tradeID);
CatanServlet.send(objOut,tOffer.offerId);
}
// send by Client
public static void sendHandelAnnehmen(int playerID, int tradeID, boolean decision) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Handel annehmen", obj1);
obj1.put("Handel id", tradeID);
obj1.put("Annehmen", decision);
Client.executePost(targetUrl, objOut);
}
public static void sendHandelsangebot(int playerID, int handelsID, JSONObject angebot, JSONObject nachfrage) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Handelsangebot", obj1);
obj1.put("Spieler", playerID);
obj1.put("Handels id", handelsID);
obj1.put("Angebot", angebot);
obj1.put("Nachfrage", nachfrage);
CatanServlet.broadcast(objOut);
}
// send by Client
public static void sendHandelAnbieten(int playerID, Cost angebot, Cost nachfrage) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Handel anbieten", obj1);
JSONObject angebotObject = angebot.toJSONObject();
JSONObject nachfrageObject = nachfrage.toJSONObject();
//TODO wenn das nicht funktioniert, einzeln die Ints rausziehen. -_- laut protokoll
obj1.put("Angebot", angebotObject);
obj1.put("Nachfrage", nachfrageObject);
Client.executePost(targetUrl, objOut);
}
// send by Client
public static void sendZugBeenden(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
objOut.put("Zug beenden", null);
Client.executePost("", objOut);
}
// send by Client
public static void sendSeehandel(int playerID, Cost angebot, Cost nachfrage) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Seehandel", obj1);
// RESOURCEOBJECT?!?
JSONObject angebotObject = angebot.toJSONObject();
JSONObject nachfrageObject = nachfrage.toJSONObject();
obj1.put("Angebot", angebotObject);
obj1.put("Nachfrage", nachfrageObject);
Client.executePost(targetUrl, objOut);
}
// send by Client
public static void sendEntwicklungskarteKaufen(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
objOut.put("Entwicklungskarte kaufen", null);
Client.executePost("", objOut);
}
// send by Client
/**
* always call with all position parameter, if it's a Road set them to null!
*/
public static void sendBauen(int playerID, String type, Integer x1, Integer y1, Integer x2, Integer y2, Integer x3, Integer y3) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Bauen", obj1);
JSONObject tile1 = new JSONObject();
tile1.put("x", x1);
tile1.put("y", y1);
JSONObject tile2 = new JSONObject();
tile2.put("x", x2);
tile2.put("y", y2);
JSONObject tile3 = new JSONObject();
tile3.put("x", x3);
tile3.put("y", y3);
JSONObject[] destinationArray = new JSONObject[3];
destinationArray[0] = tile1;
destinationArray[1] = tile2;
destinationArray[2] = tile3;
obj1.put("Typ", type);
obj1.put("Ort", destinationArray);
Client.executePost("", objOut);
}
// send by Client
public static void sendRaeuberVersetzen(int playerID, Integer destinationX, Integer destinationY, Integer target) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Räuber versetzen", obj1);
JSONObject destinationObject = new JSONObject();
obj1.put("Ort", destinationObject);
destinationObject.put("x", destinationX);
destinationObject.put("y", destinationY);
obj1.put("Ziel", target);
Client.executePost("", objOut);
}
// send by Client
public static void sendKartenAbgeben(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Karten abgeben", obj1);
obj1.put("Rohstoffe", null);
Client.executePost("", objOut);
}
// send by Client
public static void sendWuerfeln(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
objOut.put("Würfeln", null);
Client.executePost(targetUrl, objOut);
}
public static void sendGroessteRittermacht(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Gr��te Rittermacht", obj1);
obj1.put("Spieler", playerID);
CatanServlet.broadcast(objOut);
}
public static void sendLaengsteHandelsstrasse(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("L�ngste Handelsstra�e", obj1);
obj1.put("Spieler", playerID);
CatanServlet.broadcast(objOut);
}
public static void sendEntwicklungskarteGekauft(int playerID, String karte) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Entwicklungskarte gekauft", obj1);
obj1.put("Spieler", playerID);
obj1.put("Entwicklungskarte", karte);
CatanServlet.broadcast(objOut);
}
public static void sendBauvorgang(Integer playerID, String type, Integer x1, Integer y1, Integer x2, Integer y2, Integer x3, Integer y3) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Bauvorgang", obj1);
JSONObject buildingObject = new JSONObject();
obj1.put("Gebäude", buildingObject);
buildingObject.put("Eigentümer", playerID);
buildingObject.put("Typ", type);
JSONObject [] destinationArray = new JSONObject[3];
JSONObject coords1 = new JSONObject();
coords1.put("x", x1);
coords1.put("y", y1);
JSONObject coords2 = new JSONObject();
coords2.put("x", x2);
coords2.put("y", y2);
JSONObject coords3 = new JSONObject();
coords2.put("x", x3);
coords2.put("y", y3);
destinationArray[0] = coords1;
destinationArray[1] = coords2;
destinationArray[2] = coords3;
buildingObject.put("Ort", destinationArray);
CatanServlet.broadcast(objOut);
}
public static void sendRaeuberVersetzt(int playerID, Integer destinationX, Integer destinationY) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("R�uber versetzt", obj1);
obj1.put("Spieler", playerID);
JSONObject destinationObject = new JSONObject();
obj1.put("Ort", destinationObject);
destinationObject.put("x", destinationX);
destinationObject.put("y", destinationY);
CatanServlet.broadcast(objOut);
}
public static void sendKosten(int playerID, Cost cost) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
obj1.put("Spieler", playerID);
//TODO add RoshtoffObject
obj1.put("Rohstoffe", cost.toJSONObject());
objOut.put("Kosten", obj1);
CatanServlet.send(objOut, playerID);
}
public static void sendErtrag(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Ertrag", obj1);
obj1.put("Spieler", playerID);
//TODO add RohstoffObject
obj1.put("Rohstoffe", null);
CatanServlet.send(objOut, playerID);
}
public static void sendWuerfelwurf(int playerID) throws JSONException {
//TODO wuerfeln richtig machen
Integer wuerfel1 = (int) ((Math.random()*5)+1);
Integer wuerfel2 = (int) ((Math.random()*5)+1);
int [] wuerfel = {wuerfel1,wuerfel2};
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Würfelwurf", obj1);
obj1.put("Spieler", playerID);
obj1.put("Wurf", wuerfel);
if (wuerfel1 + wuerfel2 == 7) {
Game.setStatus(playerID,"Räuber versetzen");
}
//TODO : Update Resouces von Player for all Players
CatanServlet.broadcast(objOut);
}
public static void sendStatusupdate(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
JSONObject playerObject = new JSONObject();
Player p = Game.getPlayerById(playerID);
playerObject.put("id", playerID);
playerObject.put("Farbe", Game.getPlayerById(playerID).getColor()); //kann NULL sein!
playerObject.put("Name", Game.getPlayerById(playerID).getName()); //kann NULL sein!
//TODO where is the Status from? Server dictates the rotation?
playerObject.put("Status", Game.getPlayerById(playerID).getStatus());
playerObject.put("Siegpunkte", Game.getPlayerById(playerID).getVicPoint());
playerObject.put("Rohstoffe", Game.getPlayerResource(playerID).toJSONObject());
//Rittermacht tells only how many Ritterkarten have been played
playerObject.put("Rittermacht",Game.getPlayerById(playerID).getArmyNumber() );
// TODO :
JSONObject cardObject = new JSONObject();
int knights = 0;
int streetBuild = 0;
int monopol = 0;
int invention = 0;
int vicPoint = 0;
for(Card card : p.getDevCards()) {
switch (card.type) {
case KNIGHT:
knights ++;
break;
case STREET_BUILD:
streetBuild++;
break;
case MONOPOLY:
monopol++;
break;
case INVENTION:
invention++;
break;
case VICTORY_POINT:
vicPoint++;
break;
}
}
cardObject.put("Ritter", knights);
cardObject.put("Straßenbau", streetBuild);
cardObject.put("Monopol", monopol);
cardObject.put("Erfindung",invention);
cardObject.put("Siegpunkt", vicPoint);
playerObject.put("Entwicklungskarten", cardObject);
//entweder false oder PlayerID?
playerObject.put("Größte Rittermacht", Game.getPlayerById(playerID).getBiggestArmy());
playerObject.put("Längste Handelsstraße",Game.getPlayerById(playerID).hasLongestRoad());
obj1.put("Spieler", playerObject);
objOut.put("Statusupdate", obj1);
CatanServlet.broadcast(objOut);
}
public static void sendSimpleStatusupdate(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
JSONObject playerObject = new JSONObject();
playerObject.put("id", playerID);
playerObject.put("Status", Game.getPlayerById(playerID).getStatus());
obj1.put("Spieler", playerObject);
objOut.put("Statusupdate", obj1);
CatanServlet.broadcast(objOut);
}
public static void sendSpielBeendet(int playerID, String message) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
obj1.put("Spieler", playerID);
obj1.put("Nachricht", message);
objOut.put("Spiel beendet", obj1);
CatanServlet.broadcast(objOut);
}
public static void sendSpielGestartet() throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
obj1.put("Karte", Game.getMapObject());
objOut.put("Spiel gestartet", obj1);
CatanServlet.broadcast(objOut);
}
public static void sendFehler( Integer playerID, String fehler) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Fehler", obj1);
obj1.put("Meldung", fehler);
CatanServlet.send(objOut, playerID);
}
// send by Client
public static void sendSpielStarten(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
objOut.put("Spiel starten", null);
Client.executePost(targetUrl, objOut);
}
// send by Client
public static void sendSpieler(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
obj1.put("Name", Game.getPlayer().getName());
obj1.put("Farbe", Game.getPlayer().getColor());
objOut.put("Spieler", obj1);
Client.executePost(targetUrl, objOut);
}
public static void sendChatnachricht(String message, int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Chatnachricht", obj1);
obj1.put("Absender", playerID);
obj1.put("Nachricht", message);
CatanServlet.broadcast(objOut);
}
// send by Client
public static void sendChatnachrichtSenden(String message, int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Chatnachricht senden", obj1);
obj1.put("Nachricht", message);
Client.executePost("targetURL"+"?playerID=" + playerID, objOut);
}
public static void sendServerantwortElse (int playerID, String message) throws JSONException {
JSONObject objOut = new JSONObject();
objOut.put("Serverantwort", message);
CatanServlet.send(objOut, playerID);
}
public static void sendServerantwortOK(int playerID) throws JSONException {
JSONObject objOut = new JSONObject();
objOut.put("Serverantwort", "OK");
CatanServlet.send(objOut, playerID);
}
public static JSONObject sendWillkommen() throws JSONException {
if (currentIds.size()>=4)
{
//TODO return JSONObject(Fehlermeldung);
}
id++;
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
Game.addPlayer(new Player(id));
obj1.put("id", id);
objOut.put("Willkommen", obj1);
currentIds.add(id);
CatanServlet.addMessageBuffer(id);
SendJSON.sendSimpleStatusupdate(id);
return objOut;
}
public static JSONObject sendHalloServer() throws JSONException {
// (Hallo : (Version:...,Protokoll:0.3))
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
objOut.put("Hallo", obj1);
obj1.put("Version", "AndroidServer 0.3 (sepgroup01)");
obj1.put("Protokoll", "0.3");
//MUSS DIREKT IN DEN RESPONSE BEI GET
//CatanServlet.send(objOut, (Integer) null);
return objOut;
}
// send by Client
public static void sendHalloClient() throws JSONException {
// (Hallo : (Version:...,Protokoll:0.3))
JSONObject objOut = new JSONObject();
JSONObject obj1 = new JSONObject();
obj1.put("Version", "AndroidClient 0.3 (sepgroup01)");
objOut.put("Hallo", obj1);
Client.executePost("TODO", objOut);
}
public static void sendBuildConnection() {
Client.executeGet(targetUrl, new JSONObject());
}
}
| [
"[email protected]"
] | |
3e0d93be066eba00506b2c1a836d4f7876221825 | d5b5d292f7c1ea7b11ce41dbd2e01d1f658d03eb | /src/main/java/thedarkcolour/futuremc/block/BlockNewSlab.java | fa1c6aac6fbaf8ba74fbdbadb45b3cd14bf2eeef | [] | no_license | JairoQuispe/Future-MC | eed942b166af0f3277022f14d9ca6777061e8644 | 98c0addbc0d22d62494fbc25eac44f203512a84a | refs/heads/master | 2020-08-27T13:09:35.888314 | 2019-10-19T06:43:27 | 2019-10-19T06:43:27 | 217,382,309 | 0 | 0 | null | 2019-10-24T19:43:22 | 2019-10-24T19:43:22 | null | UTF-8 | Java | false | false | 3,463 | java | package thedarkcolour.futuremc.block;
import net.minecraft.block.BlockPurpurSlab;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import thedarkcolour.futuremc.FutureMC;
import java.util.Random;
import static net.minecraft.block.BlockPurpurSlab.VARIANT;
public abstract class BlockNewSlab extends BlockSlab {
public BlockNewSlab() {
super(Material.ROCK);
setHardness(2.0F);
}
protected abstract Item getSlab();
@Override
public String getTranslationKey(int meta) {
return super.getTranslationKey();
}
@Override
public IProperty<?> getVariantProperty() {
return VARIANT;
}
@Override
public Comparable<?> getTypeForItem(ItemStack stack) {
return BlockPurpurSlab.Variant.DEFAULT;
}
@Override
protected BlockStateContainer createBlockState() {
return isDouble() ? new BlockStateContainer(this, VARIANT) : new BlockStateContainer(this, HALF, VARIANT);
}
@Override
public IBlockState getStateFromMeta(int meta) {
return isDouble() ? this.getDefaultState() : getBlockState().getBaseState().withProperty(HALF, meta == 1 ? EnumBlockHalf.TOP : EnumBlockHalf.BOTTOM);
}
@Override
public int getMetaFromState(IBlockState state) {
return isDouble() ? 0 : (state.getValue(HALF) == EnumBlockHalf.TOP ? 1 : 0);
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return new ItemStack(getSlab());
}
public static class Half extends BlockNewSlab {
public Half(String variant) {
setTranslationKey(FutureMC.ID + "." + variant + "_slab");
setRegistryName(variant + "_slab");
setLightOpacity(0);
}
@Override
public boolean isDouble() {
return false;
}
@Override
protected Item getSlab() {
return Item.getItemFromBlock(this);
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
}
public static class Double extends BlockNewSlab {
public Double(String variant) {
setTranslationKey(FutureMC.ID + "." + variant + "_double_slab");
setRegistryName(variant + "_double_slab");
this.variant = variant;
}
@Override
public boolean isDouble() {
return true;
}
String variant;
@Override
protected Item getSlab() {
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(FutureMC.ID + ":" + variant + "_slab"));
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return getSlab();
}
@Override
public int quantityDropped(Random random) {
return 2;
}
}
} | [
"[email protected]"
] | |
15a85510ea4e46895c9a4b15cb71ba5e8428a9ba | 56e8ac2da6d50cf2662945d971890b58e6e7372d | /facebass/src/main/java/dataAccess/entities/Pass_.java | e70fd253694a84a3f44a20edd36efa8d7b3c02bb | [] | no_license | UTCNCSSoftwareDesignTudor2018/sd-project-2018-radupetrisel | 60266472200def7b2f52000239874f3b4a5a0743 | bdf583f97117fdcb61cd8df66b54f416942d7efa | refs/heads/master | 2021-04-06T10:44:52.198051 | 2018-05-31T10:05:06 | 2018-05-31T10:05:06 | 125,383,672 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 949 | java | package dataAccess.entities;
import javax.persistence.*;
import java.time.LocalDate;
@Entity
@Table(name = "passes")
public class Pass_ {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@OneToOne
@JoinColumn
private Person_ owner;
@OneToOne
@JoinColumn
private Bus_ bus;
@Column(name = "expiry_date")
private LocalDate expiryDate;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public LocalDate getExpiryDate() {
return expiryDate;
}
public void setExpiryDate(LocalDate expiryDate) {
this.expiryDate = expiryDate;
}
public Person_ getOwner() {
return owner;
}
public void setOwner(Person_ owner) {
this.owner = owner;
}
public Bus_ getBus() {
return bus;
}
public void setBus(Bus_ bus) {
this.bus = bus;
}
}
| [
"[email protected]"
] | |
ec6d7a01aa2b03adc03d44a2a36b2bb03ac3159a | c5382dbd6472782f12119648c98eb344d2ff7952 | /8-SpringApplication/src/main/java/edu/uta/sis/calendars/web/locations/LocationsController.java | bae11b0fb1cde5018d4bd8677362abd98871ee3b | [] | no_license | wwwprogramming/java-webapps-edu | 7c30264bf811e3e029ab67d6b610e34870bdd60a | 75bc6884ae7285523468de1a2b905efe76330641 | refs/heads/master | 2021-01-21T12:59:28.417704 | 2016-06-01T17:37:46 | 2016-06-01T17:37:46 | 54,831,303 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package edu.uta.sis.calendars.web.locations;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Created by Hannu Lohtander on 23.5.2016.
*/
@Controller
@RequestMapping("/location")
public class LocationsController {
@RequestMapping("/demo")
public String mapdemo() {
return "/jsp/location/gmap";
}
}
| [
"T5grwd?p1"
] | T5grwd?p1 |
58cc46ca508dc90f0b05eb4c9cc790bec3359610 | ec07073b1fc084b86ff99caa0b7b5c23b172529e | /src/br/com/caelum/struts/action/MudaIdiomaAction.java | 29ad0d815db6e87c21091580782d86801f8dc2f5 | [] | no_license | clebsons/struts | 50cefbfb08941cf9a728d025434b8b19dea074be | 4f764a7c7804bdc340e07f93a0ee2256bae2e81b | refs/heads/master | 2020-06-02T17:04:02.790804 | 2014-07-10T21:53:14 | 2014-07-10T21:53:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package br.com.caelum.struts.action;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class MudaIdiomaAction extends Action {
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String idioma = request.getParameter("idioma");
Locale locale = new Locale(idioma);
System.out.println("mudando o locale para " + locale);
setLocale(request, locale);
return mapping.findForward("ok");
}
}
| [
"[email protected]"
] | |
d87e8d3c8c08a1b2051ba2d820d3fb66bd442d1b | 23ba003d18a2580c40b47f2c2648655631265ec0 | /src/main/java/io/agileintelligence/config/SecurityConfig.java | c16ea9da925248c58f3681eabac85d77431e66cf | [] | no_license | carlosag0712/AgileIntelligenceBookstoreFrontEnd | f2c1a503d4f97a894df858f19d7a7eb1e5ab1c2e | 585800f1a354f1854cb2e315363ba9b44f5fb047 | refs/heads/master | 2021-01-21T14:40:43.283562 | 2017-06-28T19:28:26 | 2017-06-28T19:28:26 | 95,325,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,631 | java | package io.agileintelligence.config;
import io.agileintelligence.service.Impl.UserSecurityService;
import io.agileintelligence.utility.SecurityUtility;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.util.matcher.AndRequestMatcher;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
/**
* Created by carlosarosemena on 2017-06-10.
*/
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private Environment env;
@Autowired
private UserSecurityService userSecurityService;
private BCryptPasswordEncoder passwordEncoder(){
return SecurityUtility.passwordEncoder();
}
private static final String[] PUBLIC_MATCHERS = {
"/css/**",
"/js/**",
"/image/**",
"/",
"/newUser",
"/forgetPassword",
"/login",
"/bookshelf",
"/bookDetail"
};
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers(PUBLIC_MATCHERS)
.permitAll().anyRequest().authenticated();
http
.csrf().disable().cors().disable()
.formLogin().failureUrl("/login?error").defaultSuccessUrl("/")
.loginPage("/login").permitAll()
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/?logout").deleteCookies("remember-me").permitAll()
.and()
.rememberMe();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userSecurityService).passwordEncoder(passwordEncoder());
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.