blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 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 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3d21471258a346d48124384cd8c9f3e8252cf307 | 1cf5e199a68fd7f69107ab547225fe64e28909a2 | /common/src/main/java/com/gamerole/common/rxbus2/SubscriberMethod.java | ac0ad724423d8f0086667a7c94b91a540b118f6e | [] | no_license | lvzhihao100/DDRoleBase | 94d807baa7f682561ca6d43e1ef9e4ff5650e68f | 789921d9545747d44d89ec7f7c28fd5d9f221652 | refs/heads/master | 2020-03-13T13:31:23.764200 | 2018-04-26T10:37:58 | 2018-04-26T10:37:58 | 129,202,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,182 | java | package com.gamerole.common.rxbus2;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Created by lvzhihao on 17-7-25.
*/
public class SubscriberMethod {
public Method method;
public ThreadMode threadMode;
public Class<?> eventType;
public Object subscriber;
public int code;
public SubscriberMethod(Object subscriber, Method method, Class<?> eventType, int code, ThreadMode threadMode) {
this.method = method;
this.threadMode = threadMode;
this.eventType = eventType;
this.subscriber = subscriber;
this.code = code;
}
public void invoke(Object o) {
try {
Class[] e = this.method.getParameterTypes();
if (e != null && e.length == 1) {
this.method.invoke(this.subscriber, new Object[]{o});
} else if (e == null || e.length == 0) {
this.method.invoke(this.subscriber, new Object[0]);
}
} catch (IllegalAccessException var3) {
var3.printStackTrace();
} catch (InvocationTargetException var4) {
var4.printStackTrace();
}
}
}
| [
"1030753080@qq.com"
] | 1030753080@qq.com |
25810df7aeb0de481edd7e4734411bbf6fdac987 | 6cfb69c19b2be30c3fdcd62ba70de617cfeedff8 | /backend/psp-db/src/main/java/com/yf/psp/db/util/plugin/SqlInjectCheck.java | eb9b5ce5d7457c644fca38bcaeda04bb1fab8647 | [] | no_license | yuxin6052/psp | f7367e265d8d6d6fedd80acf378b6ee44eaabf28 | c9dceada2d9ed7603efdb7aa2eb6dd412b996c94 | refs/heads/master | 2020-04-17T10:34:06.580556 | 2019-02-20T08:01:03 | 2019-02-20T08:01:03 | 166,505,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,397 | java | package com.yf.psp.db.util.plugin;
import java.util.Collection;
import java.util.Map;
public class SqlInjectCheck {
/***
* @完成参数校验
*/
public static void check(Object param) {
if(param==null) {
return ;
}
if(param instanceof Map.Entry) {
Map.Entry en = (Map.Entry)param;
check(en.getKey());
check(en.getValue());
}else if(param instanceof Map) {
Map<String,Object> map = (Map<String,Object>)param;
for(Map.Entry<String,Object> it : map.entrySet()) {
check(it);
}
}else if (param instanceof String) {
checkString((String) param);
}else if (param instanceof Page) {
checkPage((Page) param);
}else if(param instanceof Collection) {
Collection cl = (Collection)param;
for(Object it : cl) {
check(it);
}
}
//...
}
private static void checkString(String param) {
//TODO:根据业务一步步来完善 检查 逻辑
if(param.contains("'")) {
throw new IllegalArgumentException(param + " has sql inject risk");
}
}
private static void checkPage(Page param) {
check(param.getParams());
if (param instanceof PageByPageNo) {
}else if(param instanceof PageByInstId) {
PageByInstId page = (PageByInstId)param;
if(page.getPrimaryKey()!=null && page.getPrimaryKey().trim().contains(" ")) {
throw new IllegalArgumentException(page.getPrimaryKey() + " has sql inject risk");
}
}
}
}
| [
"hui.chen3@honeywell.com"
] | hui.chen3@honeywell.com |
bc3ab3c53e454ef15b537b75af7bff872dad636f | f843788f75b1ff8d5ff6d24fd7137be1b05d1aa6 | /src/ac/biu/nlp/nlp/instruments/parse/tree/dependency/basic/xmldom/TreeAndSentence.java | 31083137ad31048e56487bdfde7e9da9b5549658 | [] | no_license | oferbr/biu-infrastructure | fe830d02defc7931f9be239402931cfbf223c05e | 051096636b705ffe7756f144f58c384a56a7fcc3 | refs/heads/master | 2021-01-19T08:12:33.484302 | 2013-02-05T16:08:58 | 2013-02-05T16:08:58 | 6,156,024 | 2 | 0 | null | 2012-11-18T09:42:20 | 2012-10-10T11:02:33 | Java | UTF-8 | Java | false | false | 772 | java | package ac.biu.nlp.nlp.instruments.parse.tree.dependency.basic.xmldom;
import java.io.Serializable;
import ac.biu.nlp.nlp.instruments.parse.tree.dependency.basic.BasicNode;
/**
* Holds a tree and a sentence (from which that tree was created).
*
* @author Asher Stern
* @since October 2, 2012
*
*/
public class TreeAndSentence implements Serializable
{
private static final long serialVersionUID = -6342877867677633913L;
public TreeAndSentence(String sentence, BasicNode tree)
{
super();
this.sentence = sentence;
this.tree = tree;
}
public String getSentence()
{
return sentence;
}
public BasicNode getTree()
{
return tree;
}
private final String sentence;
private final BasicNode tree;
}
| [
"oferbr@gmail.com"
] | oferbr@gmail.com |
f5d2197d3192a9a5ec2d76867049637bd47f2670 | c5113811cb94f4639177a4420ec968f62cc440c1 | /app/src/main/java/com/wiryawan/retrofittutorial/adapter/ShowtimeListAdapter.java | d0665d6bd5310d3eea7f998097487609551cb258 | [] | no_license | wiryawan46/RetrofitTutorial | a86f754e50f7a2939e91371cfc2df9cc32ed25ad | 2ce2bdf0c2b15fd782de74605dd3d11c12595a42 | refs/heads/master | 2021-01-22T07:39:20.401991 | 2017-02-13T15:30:15 | 2017-02-13T15:30:15 | 81,839,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,925 | java | package com.wiryawan.retrofittutorial.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.wiryawan.retrofittutorial.R;
import com.wiryawan.retrofittutorial.model.ShowTime;
import com.wiryawan.retrofittutorial.util.FlowLayout;
import java.util.ArrayList;
import java.util.List;
/**
* Created by wiryawan on 1/13/17.
*/
public class ShowtimeListAdapter extends RecyclerView.Adapter<ShowtimeListAdapter.ShowtimeViewHolder> {
private List<ShowTime> showTimeList;
private Context context;
public ShowtimeListAdapter(Context context) {
this.context = context;
showTimeList = new ArrayList<>();
}
public void add(ShowTime item) {
showTimeList.add(item);
notifyItemInserted(showTimeList.size() - 1);
}
public void addAll(List<ShowTime> showTimeList) {
for (ShowTime showTime : showTimeList) {
add(showTime);
}
}
public void remove(ShowTime item) {
int position = showTimeList.indexOf(item);
if (position > -1) {
showTimeList.remove(position);
notifyItemRemoved(position);
}
}
public void clear() {
while (getItemCount() > 0) {
remove(getItem(0));
}
}
public ShowTime getItem(int position) {
return showTimeList.get(position);
}
@Override
public ShowtimeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_showtime, parent, false);
return new ShowtimeViewHolder(view);
}
@Override
public void onBindViewHolder(ShowtimeViewHolder holder, int position) {
final ShowTime showTime = showTimeList.get(position);
holder.theater.setText(showTime.getBioskop());
for (int i = 0; i < showTime.getJam().size(); i++) {
View view = LayoutInflater.from(context).inflate(R.layout.list_item_time, holder.lytime, false);
TextView time = (TextView) view.findViewById(R.id.time);
time.setText(showTime.getJam().get(i));
holder.lytime.addView(view);
}
holder.price.setText(showTime.getHarga());
}
@Override
public int getItemCount() {
return showTimeList.size();
}
static class ShowtimeViewHolder extends RecyclerView.ViewHolder {
TextView theater;
FlowLayout lytime;
TextView price;
public ShowtimeViewHolder(View itemView) {
super(itemView);
theater = (TextView) itemView.findViewById(R.id.theater);
lytime = (FlowLayout) itemView.findViewById(R.id.lyTime);
price = (TextView) itemView.findViewById(R.id.price);
}
}
}
| [
"manggala.wiryawan@gmail.com"
] | manggala.wiryawan@gmail.com |
4cf89a224f176d4d9b17d7c0ccfb6f6cb4406b6c | deb80cb2f0f70fbcd6e8c8b4d44266c43e529bd9 | /looper/src/androidTest/java/ru/mirea/evteev/looper/ExampleInstrumentedTest.java | e5056a5784cab12a2388076adaf78bef851794cb | [] | no_license | Rabotayvmake/practice4 | 8e004cc4f32f91162bcd8804c2c1f1ae89664afc | 6d7a490dc95d1dec09e06505a6fabd106807a140 | refs/heads/master | 2023-05-08T06:05:35.999876 | 2021-06-01T15:02:46 | 2021-06-01T15:02:46 | 372,852,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package ru.mirea.evteev.looper;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("ru.mirea.evteev.looper", appContext.getPackageName());
}
} | [
"ev-daniil@mail.ru"
] | ev-daniil@mail.ru |
51445a02af8817cf000a3e4425289642c008f1ce | a36486c878ed15ba156a9f8500bdcf60e60dcf9c | /spring-cloud-core/src/main/java/com/springcloud/base/core/config/exception/WebExceptionConfiguration.java | 69a4bd9b9ab99c08c1218850d1047942ca260e13 | [
"Apache-2.0"
] | permissive | debugsw/springcloud | 6cc6129c3dc2ba769453b29a8f9bd40978c75480 | 9cec564a6f00711f98f0d73c0516e64626a160f9 | refs/heads/master | 2023-08-02T15:30:44.451788 | 2023-07-24T01:13:24 | 2023-07-24T01:13:24 | 134,233,051 | 5 | 3 | Apache-2.0 | 2023-06-21T03:10:22 | 2018-05-21T07:18:40 | Java | UTF-8 | Java | false | false | 415 | java | package com.springcloud.base.core.config.exception;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* @Author: ls
* @Date: 2019/8/9
* @Description: web相关配置
**/
@Slf4j
@Configuration
@Import({WebExceptionProperties.class, WebApiExceptionHandler.class})
public class WebExceptionConfiguration {
}
| [
"shuai012192@126.com"
] | shuai012192@126.com |
d9ea3507566e9194eb12f4a25555c9c86ebd4746 | 3dd35c0681b374ce31dbb255b87df077387405ff | /generated/com/guidewire/_generated/entity/GL7SublnSchedCondItemCostInternalAccess.java | 9e236c861326bfaf65de366ece5b93ae39093979 | [] | no_license | walisashwini/SBTBackup | 58b635a358e8992339db8f2cc06978326fed1b99 | 4d4de43576ec483bc031f3213389f02a92ad7528 | refs/heads/master | 2023-01-11T09:09:10.205139 | 2020-11-18T12:11:45 | 2020-11-18T12:11:45 | 311,884,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | package com.guidewire._generated.entity;
@javax.annotation.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "GL7SublnSchedCondItemCost.eti;GL7SublnSchedCondItemCost.eix;GL7SublnSchedCondItemCost.etx")
@java.lang.SuppressWarnings(value = {"deprecation", "unchecked"})
public class GL7SublnSchedCondItemCostInternalAccess {
public static final com.guidewire.pl.system.internal.FriendAccessor<com.guidewire.pl.persistence.code.InstantiableEntityFriendAccess<entity.GL7SublnSchedCondItemCost, com.guidewire._generated.entity.GL7SublnSchedCondItemCostInternal>> FRIEND_ACCESSOR = new com.guidewire.pl.system.internal.FriendAccessor<com.guidewire.pl.persistence.code.InstantiableEntityFriendAccess<entity.GL7SublnSchedCondItemCost, com.guidewire._generated.entity.GL7SublnSchedCondItemCostInternal>>(entity.GL7SublnSchedCondItemCost.class);
private GL7SublnSchedCondItemCostInternalAccess() {
}
} | [
"ashwini@cruxxtechnologies.com"
] | ashwini@cruxxtechnologies.com |
59af1547b41ee424a66dc406b109af6d4e9568ac | 56c1e410f5c977fedce3242e92a1c6496e205af8 | /lib/sources/dolphin-mybatis-generator/main/java/com/freetmp/mbg/plugin/page/OraclePaginationPlugin.java | ab37c4eb208f4eb4e15dcdd40a4732fee16acf3b | [
"Apache-2.0"
] | permissive | jacksonpradolima/NewMuJava | 8d759879ecff0a43b607d7ab949d6a3f9512944f | 625229d042ab593f96f7780b8cbab2a3dbca7daf | refs/heads/master | 2016-09-12T16:23:29.310385 | 2016-04-27T18:45:51 | 2016-04-27T18:45:51 | 57,235,697 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | java | package com.freetmp.mbg.plugin.page;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.dom.xml.Attribute;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
import java.util.List;
/**
* Created by LiuPin on 2015/2/3.
*/
public class OraclePaginationPlugin extends AbstractPaginationPlugin {
public OraclePaginationPlugin() {
super();
}
@Override
public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(XmlElement element, IntrospectedTable introspectedTable) {
// 使用select语句包裹住原始的sql语句
XmlElement checkIfPageable = new XmlElement("if");
checkIfPageable.addAttribute(new Attribute("test", "limit != null and limit>=0 and offset != null"));
TextElement prefix = new TextElement("select * from ( select tmp_page.*, rownum row_id from ( ");
checkIfPageable.addElement(prefix);
element.addElement(0, checkIfPageable);
checkIfPageable = new XmlElement("if");
checkIfPageable.addAttribute(new Attribute("test", "limit != null and limit>=0 and offset != null"));
TextElement suffix = new TextElement("<![CDATA[ ) tmp_page where rownum <= #{limit} + #{offset} ) where row_id > #{offset} ]]>");
checkIfPageable.addElement(suffix);
element.addElement(checkIfPageable);
return true;
}
@Override
public boolean validate(List<String> warnings) {
return true;
}
}
| [
"pradolima@live.com"
] | pradolima@live.com |
2126a2c757b277db41041bf03c19ee89eddbd897 | 6c6402133b0a98ee08b9f069128563bf915597f8 | /forum/src/main/java/br/com/alura/forum/controller/dto/DetalhesDoTopicoDto.java | a9fc777e4fb0ce09425fee43f82be9ef43fa969f | [] | no_license | MonielleB/spring-boot-alura | 3cfc9c61828000510b8c422a563ca997b186eeae | 420ba62a7dd1a650247fa65633f589d03bdc4804 | refs/heads/master | 2023-05-28T07:22:00.539806 | 2021-06-11T15:19:48 | 2021-06-11T15:19:48 | 376,066,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,511 | java | package br.com.alura.forum.controller.dto;
import br.com.alura.forum.modelo.Resposta;
import br.com.alura.forum.modelo.StatusTopico;
import br.com.alura.forum.modelo.Topico;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class DetalhesDoTopicoDto {
private Long id;
private String titulo;
private String mensagem;
private LocalDateTime dataCriacao;
private String nomeAutor;
private StatusTopico status;
private List<RespostaDto> respostas;
public DetalhesDoTopicoDto(Topico topico) {
this.id = topico.getId();
this.titulo = topico.getTitulo();
this.mensagem = topico.getMensagem();
this.dataCriacao = topico.getDataCriacao();
this.nomeAutor = topico.getAutor().getNome();
this.status = topico.getStatus();
this.respostas = new ArrayList<>();
this.respostas.addAll(topico.getRespostas().stream().map(RespostaDto::new).collect(Collectors.toList()));
}
public Long getId() {
return id;
}
public String getTitulo() {
return titulo;
}
public String getMensagem() {
return mensagem;
}
public LocalDateTime getDataCriacao() {
return dataCriacao;
}
public String getNomeAutor() {
return nomeAutor;
}
public StatusTopico getStatus() {
return status;
}
public List<RespostaDto> getRespostas() {
return respostas;
}
}
| [
"monielleberger@gmail.com"
] | monielleberger@gmail.com |
23c0de0c4cd5b335db8e5ab694e411fb463c5c11 | ec1fb584bd49a625c2f899fedd6392bd71bb0d7b | /src/main/java/RandomizedCollection.java | ea0f90014b7cb3c1374f714114db56b90806c326 | [] | no_license | uniquews/CodePractice | a0ef1929a6263bbc9e6224194e565d563b330fa6 | 06bd5bc5f1e403b6410c645215ead3cd0194382e | refs/heads/master | 2021-08-29T18:22:28.099694 | 2017-12-14T15:45:11 | 2017-12-14T15:45:11 | 63,659,531 | 4 | 0 | null | 2017-12-14T15:45:13 | 2016-07-19T04:08:23 | Java | UTF-8 | Java | false | false | 1,805 | java | import java.util.*;
public class RandomizedCollection {
Map<Integer, Set<Integer>> map;
List<Integer> list;
Random rand;
public RandomizedCollection() {
list = new ArrayList<>();
map = new HashMap<>();
rand = new Random();
}
/** Inserts a value to the collection. Returns true if the collection did not already contain the specified element. */
public boolean insert(int val) {
boolean result = false;
if (!map.containsKey(val)) {
result = true;
}
int size = list.size();
Set<Integer> indices = map.getOrDefault(val, new HashSet<>());
indices.add(size);
map.put(val, indices);
list.add(val);
return result;
}
/** Removes a value from the collection. Returns true if the collection contained the specified element. */
public boolean remove(int val) {
if (!map.containsKey(val)) {
return false;
}
int index1 = map.get(val).iterator().next();
int index2 = list.size() - 1;
int num1 = val;
int num2 = list.get(list.size() - 1);
swap(index1, index2);
map.get(num1).remove(index1);
map.get(num2).remove(index2);
map.get(num1).add(index2);
map.get(num2).add(index1);
map.get(num1).remove(index2);
if (map.get(num1).size() == 0) {
map.remove(num1);
}
list.remove(list.size() - 1);
return true;
}
private void swap(int i, int j) {
int tmp = list.get(i);
list.set(i, list.get(j));
list.set(j, tmp);
}
/** Get a random element from the collection. */
public int getRandom() {
int pos = rand.nextInt(list.size());
return list.get(pos);
}
}
| [
"wstjpu@gmail.com"
] | wstjpu@gmail.com |
ae66bcea5ed3690d6d29f67c4b93970fb03100ab | bb9140f335d6dc44be5b7b848c4fe808b9189ba4 | /Extra-DS/Corpus/norm-class/aspectj/2641.java | 1003c5691b53adaba4f26c34bdbe2e226ee7184a | [] | no_license | masud-technope/EMSE-2019-Replication-Package | 4fc04b7cf1068093f1ccf064f9547634e6357893 | 202188873a350be51c4cdf3f43511caaeb778b1e | refs/heads/master | 2023-01-12T21:32:46.279915 | 2022-12-30T03:22:15 | 2022-12-30T03:22:15 | 186,221,579 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,178 | java | mode jde tab width indent tabs mode nil basic offset file debugger core tools aspect j aspectj programming language http aspectj org contents file subject mozilla license version license file compliance license copy license http mozilla org mpl http aspectj org mpl software distributed license distributed basis warranty kind express implied license specific language governing rights limitations license original code aspect j aspectj initial developer original code xerox corporation portions created xerox corporation copyright xerox corporation rights reserved org aspectj tools doclets standard sun javadoc class doc classdoc sun javadoc program element doc programelementdoc abstract sub writer aj abstractsubwriteraj print crosscuts printcrosscuts class doc classdoc program element doc programelementdoc member print summary crosscuts printsummarycrosscuts class doc classdoc program element doc programelementdoc member has crosscuts hascrosscuts class doc classdoc program element doc programelementdoc member print introduced summary anchor printintroducedsummaryanchor class doc classdoc print introduced summary label printintroducedsummarylabel class doc classdoc | [
"masudcseku@gmail.com"
] | masudcseku@gmail.com |
9cefe5811b6f49cbc75ba6cfefe5092ed10e5057 | 129f58086770fc74c171e9c1edfd63b4257210f3 | /src/testcases/CWE190_Integer_Overflow/CWE190_Integer_Overflow__long_max_square_01.java | 60926a977945dd233bb51a93b998f7978e451c97 | [] | no_license | glopezGitHub/Android23 | 1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba | 6215d0684c4fbdc7217ccfbedfccfca69824cc5e | refs/heads/master | 2023-03-07T15:14:59.447795 | 2023-02-06T13:59:49 | 2023-02-06T13:59:49 | 6,856,387 | 0 | 3 | null | 2023-02-06T18:38:17 | 2012-11-25T22:04:23 | Java | UTF-8 | Java | false | false | 2,866 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__long_max_square_01.java
Label Definition File: CWE190_Integer_Overflow.label.xml
Template File: sources-sinks-01.tmpl.java
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: max Set data to the max value for long
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: square
* GoodSink: Ensure there will not be an overflow before squaring data
* BadSink : Square data, which can lead to overflow
* Flow Variant: 01 Baseline
*
* */
package testcases.CWE190_Integer_Overflow;
import testcasesupport.*;
import java.sql.*;
import javax.servlet.http.*;
import java.lang.Math;
public class CWE190_Integer_Overflow__long_max_square_01 extends AbstractTestCase
{
public void bad() throws Throwable
{
long data;
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = Long.MAX_VALUE;
/* POTENTIAL FLAW: if (data*data) > Long.MAX_VALUE, this will overflow */
long result = (long)(data * data);
IO.writeLine("result: " + result);
}
public void good() throws Throwable
{
goodG2B();
goodB2G();
}
/* goodG2B() - use goodsource and badsink */
private void goodG2B() throws Throwable
{
long data;
/* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */
data = 2;
/* POTENTIAL FLAW: if (data*data) > Long.MAX_VALUE, this will overflow */
long result = (long)(data * data);
IO.writeLine("result: " + result);
}
/* goodB2G() - use badsource and goodsink */
private void goodB2G() throws Throwable
{
long data;
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = Long.MAX_VALUE;
/* FIX: Add a check to prevent an overflow from occurring */
/* NOTE: Math.abs of the minimum int or long will return that same value, so we must check for it */
if ((data != Integer.MIN_VALUE) && (data != Long.MIN_VALUE) && (Math.abs(data) <= (long)Math.sqrt(Long.MAX_VALUE)))
{
long result = (long)(data * data);
IO.writeLine("result: " + result);
}
else {
IO.writeLine("data value is too large to perform squaring.");
}
}
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"guillermo.pando@gmail.com"
] | guillermo.pando@gmail.com |
db9b219f29d78f182a33587516f8a97cc5430fe6 | e5107dc23b7fdede75f72d2df8da9e4684086cd9 | /Iteracion3/Implementación/Diaketas/src/Visual/AniadirSolicitante.java | 0c032e78eee9f995090cf49f07dc1189ea45aa22 | [] | no_license | olmo/ISIII | 083e85187534581b02cc67bd4251849e0f312d57 | 271a61a2d40517ce791fb9f40187fde8e86d2bfa | refs/heads/master | 2021-01-22T05:21:04.519705 | 2012-06-10T20:47:12 | 2012-06-10T20:47:12 | 3,629,810 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,267 | java | package Visual;
import java.awt.Choice;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JCheckBox;
import GestionOfertas.ControladorOfertas;
import GestionPersona.Persona;
import GestionPersona.PersonaDB;
import GestionSolicitante.Solicitante.tipo_permiso;
import GestionSolicitante.Solicitante.tipo_disp;
public class AniadirSolicitante extends JPanel {
private static final long serialVersionUID = 1L;
private VentanaPrincipal padre;
private PanelInicio ini;
private JTextField txtDNI;
private JTextField txtnombre;
private JTextField txtfechanac;
private JTextField txtcodpostal;
private JTextField txtemail;
private JTextField txtapellidos;
private JTextField txtlugarnac;
private JTextField txtdireccion;
private JTextField txttelefono;
private JTextField txtestudios;
private JTextField txtexperiencia;
private JTextField txttiempoincor;
private JTextArea txtcurriculum;
private JTextField txtapellidos2;
private Choice textpermisoconduc;
private JCheckBox checkVehiculo;
private Choice txtDisponibilidad;
private ControladorOfertas controladorOfertas = new ControladorOfertas();
private Persona unaPersonaSolicitante;
public AniadirSolicitante(VentanaPrincipal p, PanelInicio pIni) {
this.ini = pIni;
padre = p;
setSize(PanelInicio.tamanoPaneles);
setLayout(null);
txtDNI = new JTextField();
txtDNI.setBounds(296, 82, 180, 20);
add(txtDNI);
txtDNI.setColumns(10);
FocusListener listenerDNI = new FocusListener() {
public void focusGained(FocusEvent e) {
}
public void focusLost(FocusEvent e) {
unaPersonaSolicitante = new Persona();
unaPersonaSolicitante = PersonaDB.getDatos(txtDNI.getText());
if (unaPersonaSolicitante != null)
cargarInfoPersona();
else
cargarInfo(false); // no carga el dni
}
};
txtDNI.addFocusListener(listenerDNI);
txtnombre = new JTextField();
txtnombre.setBounds(296, 113, 180, 20);
add(txtnombre);
txtnombre.setColumns(10);
textpermisoconduc = new Choice();
textpermisoconduc.setBounds(296, 370, 180, 20);
for (int i = 0; i < tipo_permiso.values().length; i++)
textpermisoconduc.add(tipo_permiso.values()[i].toString());
add(textpermisoconduc);
txtfechanac = new JTextField();
txtfechanac.setBounds(296, 144, 180, 20);
add(txtfechanac);
txtfechanac.setColumns(10);
txtcodpostal = new JTextField();
txtcodpostal.setBounds(296, 216, 180, 20);
add(txtcodpostal);
txtcodpostal.setColumns(10);
txtemail = new JTextField();
txtemail.setBounds(690, 216, 180, 20);
add(txtemail);
txtemail.setColumns(10);
txtapellidos = new JTextField();
txtapellidos.setColumns(10);
txtapellidos.setBounds(690, 82, 180, 20);
add(txtapellidos);
txtlugarnac = new JTextField();
txtlugarnac.setColumns(10);
txtlugarnac.setBounds(690, 148, 180, 20);
add(txtlugarnac);
txtdireccion = new JTextField();
txtdireccion.setColumns(10);
txtdireccion.setBounds(690, 185, 180, 20);
add(txtdireccion);
txtcurriculum = new JTextArea();
txtcurriculum.setBounds(690, 278, 372, 162);
add(txtcurriculum);
JLabel lblDNI = new JLabel("DNI");
lblDNI.setBounds(181, 85, 46, 14);
add(lblDNI);
JLabel lblNombre = new JLabel("Nombre");
lblNombre.setBounds(181, 116, 46, 14);
add(lblNombre);
JLabel lblFecha = new JLabel("Fecha nacimiento");
lblFecha.setBounds(181, 140, 89, 28);
add(lblFecha);
JLabel lblTelefono = new JLabel("Telefono");
lblTelefono.setBounds(181, 179, 46, 14);
add(lblTelefono);
JLabel lblcodpostal = new JLabel("C\u00F3digo postal");
lblcodpostal.setBounds(181, 219, 75, 14);
add(lblcodpostal);
JLabel lblemail = new JLabel("Email");
lblemail.setBounds(577, 219, 46, 14);
add(lblemail);
JLabel lblapellidos = new JLabel("Apellido 1");
lblapellidos.setBounds(577, 85, 46, 14);
add(lblapellidos);
JLabel lbllugarnac = new JLabel("Lugar nacimiento");
lbllugarnac.setBounds(577, 151, 89, 14);
add(lbllugarnac);
JLabel lbldir = new JLabel("Direcci\u00F3n");
lbldir.setBounds(577, 188, 46, 14);
add(lbldir);
JLabel lbltiempoincor = new JLabel("Tiempo Incorporaci\u00F3n");
lbltiempoincor.setBounds(577, 248, 103, 14);
add(lbltiempoincor);
JLabel lblcurriculum = new JLabel("Curriculum");
lblcurriculum.setBounds(577, 283, 61, 14);
add(lblcurriculum);
JButton btnVolver = new JButton("Volver");
btnVolver.setBounds(427, 482, 89, 23);
add(btnVolver);
JButton btnGuardar = new JButton("Guardar");
btnGuardar.setBounds(562, 482, 89, 23);
add(btnGuardar);
txttelefono = new JTextField();
txttelefono.setColumns(10);
txttelefono.setBounds(296, 175, 180, 20);
add(txttelefono);
JLabel lblpermisocond = new JLabel("Permiso Conducir");
lblpermisocond.setBounds(181, 373, 89, 14);
add(lblpermisocond);
JLabel lblestudios = new JLabel("Estudios");
lblestudios.setBounds(181, 293, 60, 14);
add(lblestudios);
JLabel lblexperiencia = new JLabel("Experiencia");
lblexperiencia.setBounds(181, 324, 73, 14);
add(lblexperiencia);
txtestudios = new JTextField();
txtestudios.setColumns(10);
txtestudios.setBounds(296, 290, 180, 20);
add(txtestudios);
txtexperiencia = new JTextField();
txtexperiencia.setColumns(10);
txtexperiencia.setBounds(296, 321, 180, 20);
add(txtexperiencia);
JLabel lbldisponibilidad = new JLabel("Disponibilidad");
lbldisponibilidad.setBounds(181, 254, 89, 14);
add(lbldisponibilidad);
txttiempoincor = new JTextField();
txttiempoincor.setColumns(10);
txttiempoincor.setBounds(691, 247, 180, 20);
add(txttiempoincor);
JLabel lblapellidos2 = new JLabel("Apellido 2");
lblapellidos2.setBounds(577, 116, 46, 14);
add(lblapellidos2);
txtapellidos2 = new JTextField();
txtapellidos2.setColumns(10);
txtapellidos2.setBounds(690, 113, 180, 20);
add(txtapellidos2);
txtDisponibilidad = new Choice();
txtDisponibilidad.setBounds(296, 248, 180, 20);
for (int i = 0; i < tipo_disp.values().length; i++)
txtDisponibilidad.add(tipo_disp.values()[i].toString());
add(txtDisponibilidad);
checkVehiculo = new JCheckBox("Veh\u00EDculo propio");
checkVehiculo.setBounds(181, 417, 103, 23);
add(checkVehiculo);
btnVolver.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ini.setPanelOnTab(ini.gestion_solicitante, PanelInicio.DEMANDAS);
}
});
btnGuardar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!txtDNI.getText().isEmpty()
&& !txtnombre.getText().isEmpty()
&& !txtapellidos.getText().isEmpty()
&& !txtapellidos2.getText().isEmpty()
&& !txtfechanac.getText().isEmpty()
&& !txttelefono.getText().isEmpty()
&& !txtlugarnac.getText().isEmpty()
&& !txtdireccion.getText().isEmpty()
&& !txtcodpostal.getText().isEmpty()
&& !txtemail.getText().isEmpty()
&& !txtestudios.getText().isEmpty()
&& !txtexperiencia.getText().isEmpty()
&& !txtcurriculum.getText().isEmpty()
&& !txttiempoincor.getText().isEmpty()) {
controladorOfertas.registrarSolicitante(txtDNI.getText(),
txtnombre.getText(), txtapellidos.getText(),
txtapellidos2.getText(), txtfechanac.getText(),
Integer.parseInt(txttelefono.getText()),
txtlugarnac.getText(), txtdireccion.getText(),
Integer.parseInt(txtcodpostal.getText()), true,
txtemail.getText(), txtestudios.getText(),
txtexperiencia.getText(), txtcurriculum.getText(),
tipo_permiso.values()[textpermisoconduc
.getSelectedIndex()], checkVehiculo
.isSelected(),
tipo_disp.values()[txtDisponibilidad
.getSelectedIndex()], Integer
.parseInt(txttiempoincor.getText()));
ini.gestion_solicitante.refrescar();
ini.setPanelOnTab(ini.gestion_solicitante,
PanelInicio.DEMANDAS);
}
}
});
}
public void cargarInfo(boolean dni) {
if (dni)
txtDNI.setText("");
txtnombre.setText("");
// textpermisoconduc.select();
txtfechanac.setText("");
txtcodpostal.setText("");
txtemail.setText("");
txtapellidos.setText("");
txtlugarnac.setText("");
txtdireccion.setText("");
txtcurriculum.setText("");
txttelefono.setText("");
txtestudios.setText("");
txtexperiencia.setText("");
txttiempoincor.setText("");
txtapellidos2.setText("");
// txtDisponibilidad.select();
checkVehiculo.setSelected(false);
}
public void cargarInfoPersona() {
txtnombre.setText(unaPersonaSolicitante.getNombre());
txtfechanac.setText(unaPersonaSolicitante.getfNacimiento());
txtcodpostal.setText(unaPersonaSolicitante.getCp().toString());
txtemail.setText(unaPersonaSolicitante.getemail());
txtapellidos.setText(unaPersonaSolicitante.getApellido1());
txtlugarnac.setText(unaPersonaSolicitante.getLugarNacimiento());
txtdireccion.setText(unaPersonaSolicitante.getDomicilio());
txttelefono.setText(unaPersonaSolicitante.getTelefono().toString());
txtapellidos2.setText(unaPersonaSolicitante.getApellido2());
}
}
| [
"jesuslinares90@gmail.com"
] | jesuslinares90@gmail.com |
2b734ab856d168d01a88fe9e207d2d9ea10a9cc7 | dd7317323464414956b2b29624684d9ba07c8f6e | /core/gramar/src/main/java/org/gramar/base/function/UppercaseFunction.java | 510ca4c30897cc6ff5846bd576033836a8c1919b | [
"Apache-2.0"
] | permissive | chrisGerken/gramar | 82706760646748640bd77fee6df8f012b0a80f2c | 70e5be69594003c678e1690143620ba611f2b3de | refs/heads/master | 2020-12-29T02:21:49.372793 | 2017-12-15T02:22:36 | 2017-12-15T02:22:36 | 31,465,230 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package org.gramar.base.function;
import java.util.List;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFunction;
import javax.xml.xpath.XPathFunctionException;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class UppercaseFunction implements XPathFunction {
public UppercaseFunction() {
}
@Override
public Object evaluate(List args) throws XPathFunctionException {
String original = null;
Object val = args.get(0);
if (val instanceof String) {
original = (String) val;
} else if (val instanceof NodeList) {
NodeList nl = (NodeList) val;
Node item = nl.item(0);
if (item == null) {
throw new XPathFunctionException("argument for upper-case() is null");
}
original = item.getNodeValue();
}
return original.toUpperCase();
}
}
| [
"chris.gerken@gerkenip.com"
] | chris.gerken@gerkenip.com |
16e325432631b94148f4afc65ffdd8b3828be87b | eb5f5353f49ee558e497e5caded1f60f32f536b5 | /org/omg/DynamicAny/NameDynAnyPairHelper.java | 196b5e51ccbdd84c36c587a1114c1a48c950b57e | [] | no_license | mohitrajvardhan17/java1.8.0_151 | 6fc53e15354d88b53bd248c260c954807d612118 | 6eeab0c0fd20be34db653f4778f8828068c50c92 | refs/heads/master | 2020-03-18T09:44:14.769133 | 2018-05-23T14:28:24 | 2018-05-23T14:28:24 | 134,578,186 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,563 | java | package org.omg.DynamicAny;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.StructMember;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
public abstract class NameDynAnyPairHelper
{
private static String _id = "IDL:omg.org/DynamicAny/NameDynAnyPair:1.0";
private static TypeCode __typeCode = null;
private static boolean __active = false;
public NameDynAnyPairHelper() {}
public static void insert(Any paramAny, NameDynAnyPair paramNameDynAnyPair)
{
OutputStream localOutputStream = paramAny.create_output_stream();
paramAny.type(type());
write(localOutputStream, paramNameDynAnyPair);
paramAny.read_value(localOutputStream.create_input_stream(), type());
}
public static NameDynAnyPair extract(Any paramAny)
{
return read(paramAny.create_input_stream());
}
public static synchronized TypeCode type()
{
if (__typeCode == null) {
synchronized (TypeCode.class)
{
if (__typeCode == null)
{
if (__active) {
return ORB.init().create_recursive_tc(_id);
}
__active = true;
StructMember[] arrayOfStructMember = new StructMember[2];
TypeCode localTypeCode = null;
localTypeCode = ORB.init().create_string_tc(0);
localTypeCode = ORB.init().create_alias_tc(FieldNameHelper.id(), "FieldName", localTypeCode);
arrayOfStructMember[0] = new StructMember("id", localTypeCode, null);
localTypeCode = DynAnyHelper.type();
arrayOfStructMember[1] = new StructMember("value", localTypeCode, null);
__typeCode = ORB.init().create_struct_tc(id(), "NameDynAnyPair", arrayOfStructMember);
__active = false;
}
}
}
return __typeCode;
}
public static String id()
{
return _id;
}
public static NameDynAnyPair read(InputStream paramInputStream)
{
NameDynAnyPair localNameDynAnyPair = new NameDynAnyPair();
id = paramInputStream.read_string();
value = DynAnyHelper.read(paramInputStream);
return localNameDynAnyPair;
}
public static void write(OutputStream paramOutputStream, NameDynAnyPair paramNameDynAnyPair)
{
paramOutputStream.write_string(id);
DynAnyHelper.write(paramOutputStream, value);
}
}
/* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\org\omg\DynamicAny\NameDynAnyPairHelper.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"mohit.rajvardhan@ericsson.com"
] | mohit.rajvardhan@ericsson.com |
7b6be2cb330d7ab08739ac2bf8ce08af455e90b6 | 57074e4aef4971b3c48a3ce81f42b6affb51d7a9 | /src/bs/util/web/tool/eclipse/ProjectPropertiesDeal.java | d3211e121ab37d2675d13c3b578bf605c9736c1c | [
"Apache-2.0"
] | permissive | iqiancheng/common_gui_tools | 355e0177729ddc03c537b12cf2058bcc27f49f9b | a4defdb11c1aacfda36a667c113beac18074461f | refs/heads/master | 2021-01-15T08:31:40.982284 | 2014-10-17T01:37:06 | 2014-10-17T01:37:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,957 | java | package bs.util.web.tool.eclipse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import javax.swing.JTextArea;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
/**
* Eclipse Project Properties Deal.
*
* @author baishui2004
* @version 1.1
* @date 2013-4-5
*/
public class ProjectPropertiesDeal implements ProjectPropertiesDealInterface {
/**
* Eclipse的Java Project、Dynamic Web Project或者MyEclipse的Web Project绝对路径地址.
*/
private String projectPath;
/**
* 解析文件'.project'以获取Project Name, 此种方法要求'.project'文件根节点的第一个name子节点即是Project Name.
*/
private String projectNameFile = "/.project";
/**
* 解析文件'.settings/org.eclipse.jdt.core.prefs'以获取compileSource以及compileTarget.
*/
private String compilePropsFile = "/.settings/org.eclipse.jdt.core.prefs";
/**
* 如果没有'.settings/org.eclipse.jdt.core.prefs'文件,则解析文件'.settings/org.eclipse.wst.common.project.facet.core.xml'以"installed java facet version".
*/
private String projectFacetCoreFile = "/.settings/org.eclipse.wst.common.project.facet.core.xml";
/**
* 解析文件'.classpath'以获取javaSourcesPath以及outputPath.
*/
private String classpathFile = "/.classpath";
/**
* 解析文件'.settings/.jsdtscope'以获取webappPath.
*/
private String webappPropsFile = "/.settings/.jsdtscope";
/**
* Project Name.
*/
private String projectName;
/**
* Java Compile Source.
*/
private String compileSource;
/**
* Java Compile Target.
*/
private String compileTarget;
/**
* Java Sources path.
*/
private String[] javaSourcesPath;
/**
* Output classes path.
*/
private String outputPath;
/**
* 是否是Java Web Project.
*/
private boolean javaWebProject;
/**
* Project Webapp path.
*/
private String webappPath;
/**
* Main入口.
*
* <pre>
* 只接受传入一个参数, 即Eclipse的Java Project、Dynamic Web Project或者MyEclipse的Web Project绝对路径地址.
* </pre>
*/
public static void main(String[] args) throws IOException {
if (args.length != 1) {
throw new IllegalArgumentException("Parameters error.");
}
ProjectPropertiesDealInterface propertiesDeal = new ProjectPropertiesDeal();
propertiesDeal.deal(args[0]);
}
/**
* 解析属性文件获得Project相关属性.
*/
public void deal(String projectPath) throws IOException {
setProjectPath(projectPath);
if (!isJavaOrJavaWebEclipseProject(projectPath)) {
throw new IllegalArgumentException("The Path: \'" + projectPath
+ "\' not has a Eclipse Java Project, Dynamic Web Project or MyEclipse Web Project.");
}
dealProjectName();
dealCompileSourceAndTarget();
dealSourceAndOutput();
if (isJavaWebProject()) {
dealWebappPath();
}
print("************ Project properties Start ************");
print("Project Path: " + projectPath);
print("Project Name: " + getProjectName());
print("Java Compile Source: " + getCompileSource());
print("Java Compile Target: " + getCompileTarget());
String[] javaSourcesPath = getJavaSourcesPath();
if (javaSourcesPath != null) {
for (int i = 0; i < javaSourcesPath.length; i++) {
print("Sources Path: " + javaSourcesPath[i]);
}
}
print("Output Path: " + getOutputPath());
print("Is Java Web Project: " + isJavaWebProject());
if (isJavaWebProject()) {
print("Webapp Path: " + getWebappPath());
}
print("************ Project properties End ************\n");
}
/**
* 运行日志输出文本域.
*/
private JTextArea runLogTextArea;
public void setRunLogTextArea(JTextArea runLogTextArea) {
this.runLogTextArea = runLogTextArea;
}
/**
* 输出.
*/
private void print(String log) {
if (runLogTextArea != null) {
runLogTextArea.append(log + "\n");
} else {
System.out.print(log + "\n");
}
}
/**
* 是否是Eclipse 的Java Project、Dynamic Web Project或者MyEclipse的Web Project.
*/
public boolean isJavaOrJavaWebEclipseProject(String projectPath) {
if (!new File(projectPath + this.projectNameFile).exists()) {
return false;
} else if (!new File(projectPath + this.compilePropsFile).exists()
&& !new File(projectPath + this.projectFacetCoreFile).exists()) {
return false;
} else if (!new File(projectPath + this.classpathFile).exists()) {
return false;
}
if (!new File(this.projectPath + this.webappPropsFile).exists()) {
javaWebProject = false;
} else {
javaWebProject = true;
}
return true;
}
public boolean isJavaWebProject() {
return this.javaWebProject;
}
public String getProjectPath() {
return this.projectPath;
}
public void setProjectPath(String projectPath) {
this.projectPath = projectPath;
}
public String getProjectName() {
return this.projectName;
}
public String getCompileSource() {
return this.compileSource;
}
public String getCompileTarget() {
return this.compileTarget;
}
public String[] getJavaSourcesPath() {
return this.javaSourcesPath;
}
public String getOutputPath() {
return this.outputPath;
}
public String getWebappPath() {
return this.webappPath;
}
/**
* 解析文件'.project'以获取Project Name, 此种方法要求'.project'文件根节点的第一个name子节点即是Project Name.
*/
private void dealProjectName() throws FileNotFoundException {
String xmlPath = this.projectPath + this.projectNameFile;
parseXmlProperties(xmlPath, new XmlParse() {
@Override
public void parse(XMLStreamReader reader) throws XMLStreamException {
boolean pdFlag = false;
boolean pnFlag = false;
while (reader.hasNext()) {
int i = reader.next();
if (i == XMLStreamConstants.START_ELEMENT) {
String elementName = reader.getLocalName();
if ("projectDescription".equals(elementName)) {
pdFlag = true;
}
if (pdFlag && "name".equals(elementName)) {
pnFlag = true;
}
}
if (pnFlag && reader.hasText()) {
projectName = reader.getText().trim();
break;
}
}
}
});
}
/**
* 解析文件'.settings/org.eclipse.jdt.core.prefs'以获取compileSource以及compileTarget.
* 如果没有'.settings/org.eclipse.jdt.core.prefs'文件,则解析文件'.settings/org.eclipse.wst.common.project.facet.core.xml'以获取"installed java facet version".
*/
private void dealCompileSourceAndTarget() throws IOException {
String filePath = this.projectPath + this.compilePropsFile;
if (new File(filePath).exists()) {
Properties properties = new Properties();
InputStream in = null;
try {
in = new FileInputStream(new File(filePath));
properties.load(in);
} finally {
if (in != null) {
in.close();
}
}
compileSource = properties.getProperty("org.eclipse.jdt.core.compiler.source");
compileTarget = properties.getProperty("org.eclipse.jdt.core.compiler.compliance");
} else {
String xmlPath = this.projectPath + this.projectFacetCoreFile;
parseXmlProperties(xmlPath, new XmlParse() {
@Override
public void parse(XMLStreamReader reader) throws XMLStreamException {
while (reader.hasNext()) {
int i = reader.next();
if (i == XMLStreamConstants.START_ELEMENT) {
String elementName = reader.getLocalName();
if ("installed".equals(elementName)) {
String kind = reader.getAttributeValue(null, "facet");
if ("java".equals(kind)) {
compileSource = reader.getAttributeValue(null, "version");
compileTarget = compileSource;
}
}
}
}
}
});
}
}
/**
* 解析文件'.classpath'以获取javaSourcesPath以及outputPath.
*/
private void dealSourceAndOutput() throws FileNotFoundException {
String xmlPath = this.projectPath + this.classpathFile;
parseXmlProperties(xmlPath, new XmlParse() {
@Override
public void parse(XMLStreamReader reader) throws XMLStreamException {
List<String> javaSourcesPaths = new ArrayList<String>();
while (reader.hasNext()) {
int i = reader.next();
if (i == XMLStreamConstants.START_ELEMENT) {
String elementName = reader.getLocalName();
if ("classpathentry".equals(elementName)) {
String kind = reader.getAttributeValue(null, "kind");
String path = reader.getAttributeValue(null, "path");
if ("src".equals(kind)) {
javaSourcesPaths.add(path);
} else if ("output".equals(kind)) {
outputPath = path;
}
}
}
}
javaSourcesPath = new String[javaSourcesPaths.size()];
for (int i = 0; i < javaSourcesPath.length; i++) {
javaSourcesPath[i] = javaSourcesPaths.get(i);
}
}
});
}
/**
* 解析文件'.settings/.jsdtscope'以获取webappPath.
*/
private void dealWebappPath() throws FileNotFoundException {
String xmlPath = this.projectPath + this.webappPropsFile;
parseXmlProperties(xmlPath, new XmlParse() {
@Override
public void parse(XMLStreamReader reader) throws XMLStreamException {
while (reader.hasNext()) {
int i = reader.next();
if (i == XMLStreamConstants.START_ELEMENT) {
String elementName = reader.getLocalName();
if ("classpathentry".equals(elementName)) {
String kind = reader.getAttributeValue(null, "kind");
if ("src".equals(kind)) {
webappPath = reader.getAttributeValue(null, "path");
}
}
}
}
}
});
}
/**
* 解析XML接口.
*/
private interface XmlParse {
void parse(XMLStreamReader reader) throws XMLStreamException;
}
/**
* 解析XML.
*/
private static void parseXmlProperties(String xmlPath, XmlParse xmlParse) throws FileNotFoundException {
XMLInputFactory factory = XMLInputFactory.newInstance();
InputStream stream = null;
XMLStreamReader reader = null;
try {
stream = new FileInputStream(new File(xmlPath));
reader = factory.createXMLStreamReader(stream);
xmlParse.parse(reader);
} catch (XMLStreamException e) {
e.printStackTrace();
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (XMLStreamException e) {
e.printStackTrace();
}
}
}
}
}
}
}
| [
"bs2004@163.com"
] | bs2004@163.com |
a4f62d82ccfdde2b0648fcb85fc4dbcfe2747172 | 161abfbf639ca57742cd54f351b760ecccdfc78a | /src/main/java/com/example/demo/cmm/domain/Pagination.java | 3ccfd0b6c2004340aa9f9c2e382046825ced52a5 | [] | no_license | ElinWonyoungPARK/finalProject-be | ca962c30fcf67b030a1b6338b5891d6af12ee235 | a82a3489b9fce7c9f2545bebb769b54683ca247a | refs/heads/master | 2023-03-28T15:00:44.503012 | 2021-03-26T00:49:51 | 2021-03-26T00:49:51 | 351,618,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,398 | java | package com.example.demo.cmm.domain;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import lombok.Data;
@Component("page") @Data @Lazy
public class Pagination {
private int totalCount, startRow, endRow,
pageCount, pageSize, startPage, endPage, pageNum,
blockCount, prevBlock, nextBlock, blockNum;
public final int BLOCK_SIZE = 5;
private String tname;
private boolean existPrev, existNext;
public Pagination(){}
// SQL 방식
public Pagination(String tname, int pageSize, int pageNum, int count) {
this.tname = tname;
this.pageSize = pageSize;
this.pageNum = pageNum;
this.totalCount = count;
this.pageCount = (totalCount % pageSize != 0) ? totalCount / pageSize + 1: totalCount / pageSize;
this.blockCount = (pageCount % BLOCK_SIZE != 0) ? pageCount / BLOCK_SIZE + 1: pageCount / BLOCK_SIZE;
this.startRow = (pageNum - 1) * pageSize;
this.endRow = (pageCount != pageNum) ? startRow + pageSize - 1 : totalCount - 1;
this.blockNum = (pageNum - 1) / BLOCK_SIZE;
this.startPage = blockNum * BLOCK_SIZE + 1;
this.endPage = ((blockNum + 1) != blockCount) ? startPage + (BLOCK_SIZE - 1) : pageCount;
this.existPrev = blockNum != 0;
this.existNext = (blockNum + 1) != blockCount;
this.nextBlock = startPage + BLOCK_SIZE;
this.prevBlock = startPage - BLOCK_SIZE;
}
// POJO 방식을 위한 생성자 오버로드
public Pagination(int pageSize, int pageNum, int count) {
this.pageSize = pageSize;
this.pageNum = pageNum;
this.totalCount = count;
this.pageCount = (totalCount % pageSize != 0) ? totalCount / pageSize + 1: totalCount / pageSize;
this.blockCount = (pageCount % BLOCK_SIZE != 0) ? pageCount / BLOCK_SIZE + 1: pageCount / BLOCK_SIZE;
this.startRow = (pageNum - 1) * pageSize;
this.endRow = (pageCount != pageNum) ? startRow + pageSize - 1 : totalCount - 1;
this.blockNum = (pageNum - 1) / BLOCK_SIZE;
this.startPage = blockNum * BLOCK_SIZE + 1;
this.endPage = ((blockNum + 1) != blockCount) ? startPage + (BLOCK_SIZE - 1) : pageCount;
this.existPrev = blockNum != 0;
this.existNext = (blockNum + 1) != blockCount;
this.nextBlock = startPage + BLOCK_SIZE;
this.prevBlock = startPage - BLOCK_SIZE;
}
} | [
"elinpark.102@gmail.com"
] | elinpark.102@gmail.com |
072cc1971e6fec2e0153447eaeff663317c178ce | 1b0c79bcd4ea7d2f3d4ff5d8c87d2bdbe4b1d3d0 | /src/main/java/com/urantia/teams/service/OrdersService.java | f307ef53b1124ca62f4366819630e176fd195410 | [] | no_license | BulkSecurityGeneratorProject/UrantiApp | d9e825461561a8a27ef7b388eb0f3acd5750c295 | 6f933ac474025fdd6ca9e1993fb2c2eacc911aae | refs/heads/master | 2022-12-22T00:47:36.970588 | 2018-03-09T22:33:44 | 2018-03-09T22:33:44 | 296,586,059 | 0 | 0 | null | 2020-09-18T10:13:32 | 2020-09-18T10:13:31 | null | UTF-8 | Java | false | false | 886 | java | package com.urantia.teams.service;
import com.urantia.teams.service.dto.OrdersDTO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
/**
* Service Interface for managing Orders.
*/
public interface OrdersService {
/**
* Save a orders.
*
* @param ordersDTO the entity to save
* @return the persisted entity
*/
OrdersDTO save(OrdersDTO ordersDTO);
/**
* Get all the orders.
*
* @param pageable the pagination information
* @return the list of entities
*/
Page<OrdersDTO> findAll(Pageable pageable);
/**
* Get the "id" orders.
*
* @param id the id of the entity
* @return the entity
*/
OrdersDTO findOne(String id);
/**
* Delete the "id" orders.
*
* @param id the id of the entity
*/
void delete(String id);
}
| [
"mlopez@tiempodevelopment.com"
] | mlopez@tiempodevelopment.com |
eac89032614db5d345cf02a02ab9f671b03033d8 | 91d280521dfc59d58832d160487b125ee833f351 | /src/com/scf/news/bean/News.java | fcb830a3d5a17be0850bdcf65b06e0bbda5de7c2 | [] | no_license | schumali/SCF | 346192925ce34de2c133b54684b8a84acbaa55f8 | 5b8e86b80c9dafadb924a4444c3cf8ef0386ecde | refs/heads/master | 2020-05-25T19:36:48.757826 | 2019-05-22T04:00:03 | 2019-05-22T04:00:03 | 187,955,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package com.scf.news.bean;
public class News {
private String id;
private String ntitle;
private String ndate;
private String ncontent;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNtitle() {
return ntitle;
}
public void setNtitle(String ntitle) {
this.ntitle = ntitle;
}
public String getNdate() {
return ndate;
}
public void setNdate(String ndate) {
this.ndate = ndate;
}
public String getNcontent() {
return ncontent;
}
public void setNcontent(String ncontent) {
this.ncontent = ncontent;
}
}
| [
"39515468+schumali@users.noreply.github.com"
] | 39515468+schumali@users.noreply.github.com |
5c9466a3c07409a60861e4b6afc2df74fc172a11 | 30eec04eea70527b9803e5147437db9e7f9062a2 | /app/src/main/java/main/inventoryapp/st1nger13/me/inventoryapp/CustomListAdapter.java | 18a8a9835bb008c277cc881d2fd783dc26e97e4a | [] | no_license | St1nger13/udacity-android-beginners-inventoryapp | f8b46e8fd3d5ac9d2287acc5f2122ae51007d44d | 3c320bd7a41a6328a55ba06f3800810bef5c8eba | refs/heads/master | 2021-01-17T20:27:42.458214 | 2016-07-12T16:23:48 | 2016-07-12T16:23:48 | 62,442,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,365 | java | package main.inventoryapp.st1nger13.me.inventoryapp;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;
import java.util.List;
/**
* Created by St1nger13 on 29.06.2016.
*/
public class CustomListAdapter extends ArrayAdapter<Product>
{
private List<Product> items ;
private int layoutResourceId ;
private Context context ;
public CustomListAdapter(Context context, int layoutResourceId, List<Product> items)
{
super(context, layoutResourceId, items) ;
this.layoutResourceId = layoutResourceId ;
this.context = context ;
this.items = items ;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View row = convertView ;
InventoryElementHolder holder = null ;
LayoutInflater inflater = ((Activity) context).getLayoutInflater() ;
row = inflater.inflate(layoutResourceId, parent, false) ;
holder = new InventoryElementHolder() ;
holder.element = items.get(position) ;
holder.saleButton = (Button) row.findViewById(R.id.listItemSale) ;
holder.saleButton.setTag(holder.element) ;
holder.detailsButton = (Button) row.findViewById(R.id.listItemTitle) ;
holder.detailsButton.setTag(holder.element) ;
holder.title = (Button) row.findViewById(R.id.listItemTitle) ;
holder.quantity = (TextView) row.findViewById(R.id.listItemQuantityView) ;
holder.price = (TextView) row.findViewById(R.id.listItemPriceView) ;
row.setTag(holder) ;
setupItem(holder) ;
return row ;
}
private void setupItem(InventoryElementHolder holder)
{
holder.title.setText(holder.element.getTitle().trim()) ;
holder.quantity.setText(context.getString(R.string.quantity) + " " + holder.element.getQuantity()) ;
holder.price.setText(context.getString(R.string.price) + " " + holder.element.getPrice());
}
public static class InventoryElementHolder
{
Product element ;
Button title ;
TextView quantity ;
TextView price ;
Button saleButton ;
Button detailsButton ;
}
}
| [
"the.stinivan@gmail.com"
] | the.stinivan@gmail.com |
aa4e2838e6b3a11447bd360f932a6c060bd389af | 396b41de70768f638f969c5651786f3b7164ac76 | /app/src/main/java/istia/ei4/pm/ia/IEndCondition.java | eafe383ffbae571063db4aca2d7a437394a40255 | [] | no_license | imefGames/ProjetEi4_Android | bf4f34461d07250bf0eebff9d3a9d5b0d3c158bf | 882bc4416f6dd8142feccb176f5f51259c755350 | refs/heads/master | 2021-05-02T10:32:41.252980 | 2015-04-17T10:26:51 | 2015-04-17T10:26:51 | 32,866,419 | 1 | 1 | null | 2016-02-01T21:18:06 | 2015-03-25T13:31:29 | Java | UTF-8 | Java | false | false | 156 | java | package istia.ei4.pm.ia;
/**
*
* @author Pierre Michel
*/
public interface IEndCondition {
public boolean checkEnd(AWorld world, AGameState state);
}
| [
"michel.pierre.35@gmail.com"
] | michel.pierre.35@gmail.com |
97e9223bec99af4804d41aa67906c631a2bf8f18 | ecc1e3fcc6562518f6b1062ad978c633f3024947 | /app/src/test/java/com/example/biodatakel10/ExampleUnitTest.java | 02ecabdf9a834a6c9faa56b5b59abfb3bc697f16 | [] | no_license | rwarrrrr/BiodataKel10 | ffde3c26649fa5975aec45eb27b4c835c56e15fa | b9e0b2d00df74d6f3e0899ab437ddbfc0e372989 | refs/heads/master | 2023-08-31T07:47:02.911045 | 2019-08-30T15:56:32 | 2019-08-30T15:56:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.example.biodatakel10;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"riksaparadila202@gmail.com"
] | riksaparadila202@gmail.com |
1e3c7dfff148a2373569ad1df8986566449c0d5b | 729c851198dc513eabbb91f6fd805eb6f1b5cd28 | /src/com/metamolecular/mx/test/ReducerTest.java | d2f37b5135d1569dd604b5fba4ba6ff3d616a2f5 | [
"MIT"
] | permissive | rapodaca/mx | 12a361742d96bdf95850b142cc43e1b3fc20d8ca | 2aa0e27ae9b1012eb3b6fca55d36dc33794c654c | refs/heads/master | 2021-01-17T22:51:18.463350 | 2009-07-20T20:28:24 | 2009-07-20T20:28:24 | 79,979 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,427 | java | /*
* MX - Essential Cheminformatics
*
* Copyright (c) 2007-2009 Metamolecular, LLC
*
* http://metamolecular.com/mx
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.metamolecular.mx.test;
import com.metamolecular.mx.io.Molecules;
import com.metamolecular.mx.model.Atom;
import com.metamolecular.mx.model.Bond;
import com.metamolecular.mx.model.Reducer;
import com.metamolecular.mx.model.Molecule;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase;
/**
* @author Richard L. Apodaca <rapodaca at metamolecular.com>
*/
public class ReducerTest extends TestCase
{
private Reducer reducer;
private Map<Atom, Integer> reductions;
@Override
protected void setUp() throws Exception
{
reducer = new Reducer();
reductions = new HashMap();
}
public void testItCanReduceNonstereoHydrogen()
{
Molecule propane = createBlockedPropane();
assertTrue(reducer.canReduce(propane.getAtom(3)));
}
public void testItCanNotReduceStereoHydrogen()
{
Molecule propane = createChiralBlockedPropane();
assertFalse(reducer.canReduce(propane.getAtom(3)));
}
public void testItCanNotReduceIsotopicHydrogen()
{
Molecule propane = createIsotopeBlockedPropane();
assertFalse(reducer.canReduce(propane.getAtom(3)));
}
public void testItReducesBlockedPropaneToThreeAtoms()
{
Molecule propane = createBlockedPropane();
reducer.reduce(propane, reductions);
assertEquals(3, propane.countAtoms());
}
public void testItRemovesVirtualizableHydrogensFromBlockedPropane()
{
Molecule propane = createBlockedPropane();
reducer.reduce(propane, reductions);
boolean found = false;
for (int i = 0; i < propane.countAtoms(); i++)
{
if (reducer.canReduce(propane.getAtom(i)))
{
found = true;
break;
}
}
assertFalse(found);
}
public void testItReportsReductionForBlockedPropane()
{
Molecule propane = createBlockedPropane();
reducer.reduce(propane, reductions);
assertEquals(1, reductions.get(propane.getAtom(1)).intValue());
}
public void testItReportsDoubleReductionForDoubleBlockedPropane()
{
Molecule propane = createDoubleBlockedPropane();
reducer.reduce(propane, reductions);
assertEquals(2, reductions.get(propane.getAtom(1)).intValue());
}
public void testDoesntThrowWithNullMap()
{
Molecule propane = createBlockedPropane();
boolean pass = false;
try
{
reducer.reduce(propane, null);
pass = true;
}
catch (NullPointerException e)
{
}
assertTrue(pass);
}
private Molecule createBlockedPropane()
{
Molecule result = Molecules.createPropane();
result.connect(result.getAtom(1), result.addAtom("H"), 1);
return result;
}
private Molecule createDoubleBlockedPropane()
{
Molecule result = createBlockedPropane();
result.connect(result.getAtom(1), result.addAtom("H"), 1);
return result;
}
private Molecule createChiralBlockedPropane()
{
Molecule result = createBlockedPropane();
Bond bond = result.getBond(result.getAtom(1), result.getAtom(3));
bond.setStereo(1);
return result;
}
private Molecule createIsotopeBlockedPropane()
{
Molecule result = createBlockedPropane();
Atom h = result.getAtom(3);
h.setIsotope(1);
return result;
}
}
| [
"rapodaca@metamolecular.com"
] | rapodaca@metamolecular.com |
1a1664ed506c3917e35c3ce1416d7d02edc9a2f5 | 49ad4ee85a6c17d7973b57c9b5195fc01500b433 | /app/src/test/java/com/android/byc/servicebestpractice/ExampleUnitTest.java | 8da0f917e8fb974b3e59bf6cf879b413923d4c28 | [] | no_license | YuMENGQI/ServiceBestPractice | 90ca81fe66070959b70bc041e71469433d82114c | f1983c3e24e5eb00248039f819250355185bcc80 | refs/heads/master | 2020-04-17T20:56:43.387696 | 2019-01-22T04:30:46 | 2019-01-22T04:30:46 | 166,927,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.android.byc.servicebestpractice;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"yumengqi@example.com"
] | yumengqi@example.com |
1c067dbf9fadb777adc4ff4e3c78ec0581e348fe | 110db981699883f838f1ac81c2fa440ffaa90dbe | /src/main/java/blackjack/Hand.java | a245d9d05302e2564b7cde917763ee2c989ec97f | [] | no_license | kguy090597/COMP3004BlackJack | 8baad2ce0f3339c9604a054d116013f5d2545089 | ff8730dd88f2fec71dd497081bd9c2fde8716640 | refs/heads/master | 2020-03-28T15:09:32.522294 | 2018-09-19T18:10:28 | 2018-09-19T18:10:28 | 148,561,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,324 | java | package blackjack;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
/**
* Hand class that contains the cards in the hand
*
* @author Kevin Guy
* Date: September 15th, 2018
*/
public class Hand {
//The list containing the cards in the hand
private ArrayList<Card> hand;
/**
* The constructor class for the Hand class
*/
Hand(){
hand = new ArrayList<Card>();
}
/**
* Adds a card to the hand
*
* @param card The card to be added to the hand
*/
public void add(Card card) {
hand.add(card);
}
/**
* Sorts the cards in the hand by value from lowest to highest to help with summation
*
* @param hand The hand that is to be sorted
*/
private void sort(ArrayList<Card> hand) {
Comparator<Card> compare = (Card a, Card b) -> {
return a.getValue() - (b.getValue());
};
Collections.sort(hand, compare);
}
/**
* Returns whether or not the hand has a blackjack
*
* @return true if hand == 21 or false otherwise
*/
public boolean isBlackJack() {
return sumHand() == 21;
}
/**
* Returns whether or not the hand is over 21
*
* @return true if hand > 21 or false otherwise
*/
public boolean isOver() {
return sumHand() > 21;
}
/**
* Adds up all the cards in the hand and returns the value
*
* @return The value of all the cards in the hand
*/
public int sumHand() {
//The temporary hand so the real hand order does not change
ArrayList<Card> tmpHand = hand;
//Sorts the temporary hand
sort(tmpHand);
//Keeps track of the total sum
int sum = 0;
//Boolean indicating if an ace was previously added
boolean prevAce = false;
//loops through the hand and adds the value to the sum
for(int i = 0; i < tmpHand.size(); i++) {
//if the last card in the hand is an ace
if(tmpHand.get(i).getRank().equals("A") && i == tmpHand.size() - 1) {
//checks to see if an ace was played previously and a blackjack can be achieved by the ace value being 1
if (sum + 1 == 21 && prevAce) {
sum += 1;
}
//checks to see if an ace has been played previously and if the sum would be greater than 21 if the ace value was 11
else if(sum + 11 > 21 && prevAce) {
//subtracts 10 from the sum so the previous ace is considered a value of 1
sum -= 10;
sum += 1;
}
//checks to see if the sum would be greater than 21 if the ace value was 11
else if (sum + 11 > 21) {
sum += 1;
}
else {
sum += tmpHand.get(i).getValue();
}
}
//if the ace is not the last card in the hand
else if (tmpHand.get(i).getRank().equals("A")) {
//checks to see if the sum would be greater than 21 if the ace value was 11
if (sum + 11 > 21) {
sum += 1;
}
else {
sum += tmpHand.get(i).getValue();
}
prevAce = true;
}
else {
sum += tmpHand.get(i).getValue();
}
}
return sum;
}
/**
* Returns whether or not the hand is a soft 17 (Ace is 11 and other cards sum to 6)
*
* @return whether or not the hand is a soft 17
*/
public boolean isSoft17() {
//The temporary hand so the real hand order does not change
ArrayList<Card> tmpHand = hand;
//The temporary sum that adds up the cards that aren't Aces
int tmpSum = 0;
//Sorts the temporary hand by value (from least to greatest)
sort(tmpHand);
//Checks if the sum is 17
if (sumHand()==17) {
//Goes through the cards in the hand
for (int i = 0; i < tmpHand.size(); i++) {
//Checks to see if the card is an Ace
if(tmpHand.get(i).getRank().equals("A")) {
//If the sum of the cards before the Ace are 6 then it is a soft 17
if(tmpSum==6) {
return true;
}
//Sum of cards that aren't Aces is not 6
else {
return false;
}
}
else {
tmpSum+=tmpHand.get(i).getValue();
}
}
}
//Sum of hand is not 17
else {
return false;
}
return false;
}
/**
* Returns the cards in the hand as a list
*
* @return the cards in the hand
*/
public ArrayList<Card> getHand(){
return hand;
}
/**
* Returns the hand as a string with cards separated by spaces (" ")
*/
public String toString() {
String cards = "";
for (int i = 0; i < hand.size(); i++) {
cards += hand.get(i).toString() + " ";
}
return cards.trim();
}
}
| [
"kguy090597@gmail.com"
] | kguy090597@gmail.com |
c03b0b6644bf8e9faa991e5fc5d37724e65a72f3 | 27a5642c8e0ddf3c89c12d0734dd2e2fdb68999f | /multisource/src/main/java/com/fm/multisource/web/ParameterBasedRouter.java | a2b59f8ee06bfb3938ec0d5150c162ca127bbbec | [] | no_license | beku8/multisource | 8dd8f11d85c9089c85dee61cc9e0da7962f53cbf | fbdab4b5f18c9d47a812fffd4fe86197f12c3320 | refs/heads/master | 2016-09-05T13:17:14.075523 | 2012-12-15T16:15:53 | 2012-12-15T16:15:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,120 | java | package com.fm.multisource.web;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.fm.multisource.dao.hibernate.ItemDao;
import com.fm.multisource.datasource.CustomerContextHolder;
@Controller
@RequestMapping("/param")
public class ParameterBasedRouter {
@Autowired private ItemDao itemDao;
@Autowired private UserDetailsService userDetailsService;
private Logger logger = LoggerFactory.getLogger(getClass());
@RequestMapping
public String get(@RequestParam(value="source", defaultValue="1") Integer source, Model model){
CustomerContextHolder.setCustomerType(source);
logger.debug("setting source to {}", source);
model.addAttribute("items", itemDao.findAll());
model.addAttribute("source", source);
return "param";
}
@RequestMapping("/switch")
public String get(){
String username = SecurityContextHolder.getContext().getAuthentication().getName();
logger.debug("switching for user {}", username);
UserDetails userDetails;
if(username.equalsIgnoreCase("koala")){
userDetails = userDetailsService.loadUserByUsername("admin");
}
else{
userDetails = userDetailsService.loadUserByUsername("koala");
}
Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails.getUsername(),
userDetails.getPassword(), userDetails.getAuthorities());
logger.debug("re-authenticating...");
SecurityContextHolder.getContext().setAuthentication(authentication);
return "redirect:/user";
}
}
| [
"beku2009@gmail.com"
] | beku2009@gmail.com |
4bc21af1ca387ce2d99e4edfb240edac4f25b7a3 | cf24f669d1113cc967d246f35586c9a6e0f125f2 | /Treevie/src/com/treevie/TreevieServlet.java | f099ef3c39ae11ad8fbd0d331f8a8355bf3cbd23 | [] | no_license | ishener/treevy | f282167fc3531dff44aa7a5865aa6dbe32a6edac | 6cdc162ac5492cf948a59d07537cfb2471282bc5 | refs/heads/master | 2020-04-22T08:22:06.478119 | 2012-10-29T11:18:19 | 2012-10-29T11:18:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 905 | java | package com.treevie;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
public class TreevieServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
// resp.setContentType("text/plain");
// Date nowdate = new Date();
// resp.getWriter().println(nowdate);
Question newq = new Question ();
// newq.addWrongAnswer("answer 1624");
// newq.addWrongAnswer("answer 1925");
// newq.persist(true);
req.setAttribute("question", newq);
try {
getServletContext().getRequestDispatcher("/show-main-question.jsp").forward(req, resp);
} catch (ServletException e) {
System.out.println (e.getMessage());
}
}
}
| [
"moshe@MININT-TGCNQDK"
] | moshe@MININT-TGCNQDK |
63590c244e5db61cfd525b73922ab35db43fc817 | b1acadb7c1a77667c37931b28374c26dc97dbcdc | /service/src/main/java/com/ifish/ms/core/biz/service/EncryptService.java | 0c837395b2c3765cc211a71d3cd83d9c57f055e8 | [] | no_license | ifishlam/ifish-ms | 3847c566c98e4cb88a89ce701074d7333138a6a2 | e6eeec4788c5321de4ea70e9dd6cf9b485613452 | refs/heads/master | 2021-05-15T20:20:41.243102 | 2018-01-31T10:50:42 | 2018-01-31T10:50:42 | 105,801,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | /*
* Copyright (c) 2017. iFish Studio.
*
* Licensed under the Apache License, Version 2.0 (the "License");
*
* @author Angus Lam
* @date 2017/11/24
*
*
*/
package com.ifish.ms.core.biz.service;
import com.ifish.ms.core.exception.ApplicationException;
public interface EncryptService {
/**
* Encrypt the string by MD5
*
* @param str
* @return
* @throws ApplicationException
*/
String encryptByMd5(String str) throws ApplicationException;
}
| [
"angus_yuen@126.com"
] | angus_yuen@126.com |
42d498782f2eb1d0e711718ded78f609cc4d95ff | b9d27e62be1377c519d9f328f8b26c6e4b1ebd02 | /app/src/main/java/abaco_digital/freedom360/Video.java | 07df345f76b2e1427ebc294271c63020eee4f8d8 | [] | no_license | SMalpica/Freedom360 | 21e5643ff0cdb4570bddd5a4a8f349296da59c43 | a95bd370a0f70f383615d2bcfb272ddb719abbaa | refs/heads/master | 2016-09-11T09:04:54.335627 | 2015-09-01T10:57:07 | 2015-09-01T10:57:07 | 37,458,572 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,606 | java | package abaco_digital.freedom360;
import android.content.Context;
import android.util.Log;
import java.io.FileDescriptor;
/**
* Autor: Sandra Malpica Mallo
*
* Fecha: 23/06/2015
*
* Clase: Video.java
*
* Comments: abstraction of a video. Used in the listview adapter to take
* the information needed in the row views
*/
public class Video {
private String imagen;
private String path;
private FileDescriptor fileDescriptor;
private Context context;
private int id;
private String url;
public Video(String img, Context context){
this.imagen = img;
this.context=context;
}
public void setPath(String p){
this.path=p;
}
public String getPath(){
return this.path;
}
public void crearFrameSample(){
//make sure that the image exists. If not, create one with the first video image
int imgId = auxiliar.existeImagen(this.imagen);
Log.e("FRAMSE_SAMPLE", "img id " + imgId);
if(imgId == 0){ //img was not found
auxiliar.crearImagen(this,context);//create image sample
}
}
public String getImagen(){
return this.imagen;
}
public void setImagen(String nuevaImg){
this.imagen= nuevaImg;
}
public void setFD(FileDescriptor fd){ this.fileDescriptor = fd; }
public FileDescriptor getFD(){ return this.fileDescriptor;}
public void setID(int id){this.id = id;}
public int getID(){return this.id;}
public void setURL (String url){
this.url = url;
}
public String getURL (){ return this.url;}
}
| [
"sandra_malpica@hotmail.com"
] | sandra_malpica@hotmail.com |
6afcf7ce3340e5ed89222a31a1c5ff2c0d8db7d7 | ff73ce588c954e3fed033e462d37a37ef76fbc92 | /YoutubeAPI/app/src/main/java/com/wannaone/elice/youtubeapi/module/TAcademyGlideModule.java | 105885251844cc4eb87ec02f92a17f0254e1bd5f | [] | no_license | Elice-kim/YoutubeAPI | 0077dd9e2eb71f90b4ae83829114d4be6905c81c | 226392aeec27fe1bf0e843379be76c6d6fa72c10 | refs/heads/master | 2020-12-02T18:13:31.481629 | 2017-07-10T04:33:11 | 2017-07-10T04:33:11 | 96,491,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,940 | java | package com.wannaone.elice.youtubeapi.module;
import android.content.Context;
import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool;
import com.bumptech.glide.load.engine.cache.LruResourceCache;
import com.bumptech.glide.load.engine.cache.MemorySizeCalculator;
import com.bumptech.glide.module.GlideModule;
/**
* Created by elice.kim on 2017. 7. 7..
*/
public class TAcademyGlideModule implements GlideModule {
@Override
public void applyOptions(Context context, GlideBuilder builder) {
//전체 메모리사이즈
MemorySizeCalculator calculator = new MemorySizeCalculator(context);
int defaultMemoryCacheSize = calculator.getMemoryCacheSize();
int defaultBitmapPoolSize = calculator.getBitmapPoolSize();
/**
현재 Glide이 관리하는 캐쉬사이즈에 10%를 증가한다.
사진을 많이 다루는 것들은 20% 증가해도됨
*/
int customMemoryCacheSize = (int) (1.1 * defaultMemoryCacheSize);
int customBitmapPoolSize = (int) (1.1 * defaultBitmapPoolSize);
builder.setMemoryCache(new LruResourceCache(customMemoryCacheSize));
builder.setBitmapPool(new LruBitmapPool(customBitmapPoolSize));
/**더 선명하게 보여줄 팀은 DecodeFormat.PREFER_ARGB_8888로 설정(메모리소모많음)*/
builder.setDecodeFormat(DecodeFormat.PREFER_RGB_565);
// 디스크캐쉬 설정방법
/* String downloadDirectoryPath =
Environment.getDownloadCacheDirectory().getPath();
int diskCacheSize = 1024 * 1024 * 100; //100 메가
builder.setDiskCache(
new DiskLruCacheFactory(downloadDirectoryPath, diskCacheSize)
);*/
}
@Override
public void registerComponents(Context context, Glide glide) {
}
}
| [
"grit_julia@naver.com"
] | grit_julia@naver.com |
062ced9f85bad4ca5a3c90968c78c71ada7ef8a3 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/20/20_b0889c5057172ba0ffbe7a57ba27803cc07bf7d9/SharedPoolDataSource/20_b0889c5057172ba0ffbe7a57ba27803cc07bf7d9_SharedPoolDataSource_t.java | 53d75e270428e9078abf2464787bc2fc28d4720c | [] | 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 | 9,724 | 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.commons.dbcp.datasources;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.naming.StringRefAddr;
import javax.sql.ConnectionPoolDataSource;
import org.apache.commons.pool.KeyedObjectPool;
import org.apache.commons.pool.impl.GenericKeyedObjectPool;
import org.apache.commons.pool.impl.GenericObjectPool;
import org.apache.commons.dbcp.SQLNestedException;
/**
* A pooling <code>DataSource</code> appropriate for deployment within
* J2EE environment. There are many configuration options, most of which are
* defined in the parent class. All users (based on username) share a single
* maximum number of Connections in this datasource.
*
* @author John D. McNally
* @version $Revision$ $Date$
*/
public class SharedPoolDataSource
extends InstanceKeyDataSource {
private final Map userKeys = new LRUMap(10);
private int maxActive = GenericObjectPool.DEFAULT_MAX_ACTIVE;
private int maxIdle = GenericObjectPool.DEFAULT_MAX_IDLE;
private int maxWait = (int)Math.min((long)Integer.MAX_VALUE,
GenericObjectPool.DEFAULT_MAX_WAIT);
private KeyedObjectPool pool = null;
/**
* Default no-arg constructor for Serialization
*/
public SharedPoolDataSource() {
}
/**
* Close pool being maintained by this datasource.
*/
public void close() throws Exception {
if (pool != null) {
pool.close();
}
InstanceKeyObjectFactory.removeInstance(instanceKey);
}
// -------------------------------------------------------------------
// Properties
/**
* The maximum number of active connections that can be allocated from
* this pool at the same time, or non-positive for no limit.
*/
public int getMaxActive() {
return (this.maxActive);
}
/**
* The maximum number of active connections that can be allocated from
* this pool at the same time, or non-positive for no limit.
* The default is 8.
*/
public void setMaxActive(int maxActive) {
assertInitializationAllowed();
this.maxActive = maxActive;
}
/**
* The maximum number of active connections that can remain idle in the
* pool, without extra ones being released, or negative for no limit.
*/
public int getMaxIdle() {
return (this.maxIdle);
}
/**
* The maximum number of active connections that can remain idle in the
* pool, without extra ones being released, or negative for no limit.
* The default is 8.
*/
public void setMaxIdle(int maxIdle) {
assertInitializationAllowed();
this.maxIdle = maxIdle;
}
/**
* The maximum number of milliseconds that the pool will wait (when there
* are no available connections) for a connection to be returned before
* throwing an exception, or -1 to wait indefinitely. Will fail
* immediately if value is 0.
* The default is -1.
*/
public int getMaxWait() {
return (this.maxWait);
}
/**
* The maximum number of milliseconds that the pool will wait (when there
* are no available connections) for a connection to be returned before
* throwing an exception, or -1 to wait indefinitely. Will fail
* immediately if value is 0.
* The default is -1.
*/
public void setMaxWait(int maxWait) {
assertInitializationAllowed();
this.maxWait = maxWait;
}
// ----------------------------------------------------------------------
// Instrumentation Methods
/**
* Get the number of active connections in the pool.
*/
public int getNumActive() {
return (pool == null) ? 0 : pool.getNumActive();
}
/**
* Get the number of idle connections in the pool.
*/
public int getNumIdle() {
return (pool == null) ? 0 : pool.getNumIdle();
}
// ----------------------------------------------------------------------
// Inherited abstract methods
protected synchronized PooledConnectionAndInfo
getPooledConnectionAndInfo(String username, String password)
throws SQLException {
if (pool == null) {
try {
registerPool(username, password);
} catch (NamingException e) {
throw new SQLNestedException("RegisterPool failed", e);
}
}
PooledConnectionAndInfo info = null;
try {
info = (PooledConnectionAndInfo) pool
.borrowObject(getUserPassKey(username, password));
}
catch (SQLException ex) { // Remove bad UserPassKey
if ((userKeys != null) && (userKeys.containsKey(username))) {
userKeys.remove(username);
}
throw new SQLNestedException(
"Could not retrieve connection info from pool", ex);
}
catch (Exception e) {
throw new SQLNestedException(
"Could not retrieve connection info from pool", e);
}
return info;
}
/**
* Returns a <code>SharedPoolDataSource</code> {@link Reference}.
*
* @since 1.2.2
*/
public Reference getReference() throws NamingException {
Reference ref = new Reference(getClass().getName(),
SharedPoolDataSourceFactory.class.getName(), null);
ref.add(new StringRefAddr("instanceKey", instanceKey));
return ref;
}
private UserPassKey getUserPassKey(String username, String password) {
UserPassKey key = (UserPassKey) userKeys.get(username);
if (key == null) {
key = new UserPassKey(username, password);
userKeys.put(username, key);
}
return key;
}
private void registerPool(
String username, String password)
throws javax.naming.NamingException, SQLException {
ConnectionPoolDataSource cpds = testCPDS(username, password);
// Create an object pool to contain our PooledConnections
GenericKeyedObjectPool tmpPool = new GenericKeyedObjectPool(null);
tmpPool.setMaxActive(getMaxActive());
tmpPool.setMaxIdle(getMaxIdle());
tmpPool.setMaxWait(getMaxWait());
tmpPool.setWhenExhaustedAction(whenExhaustedAction(maxActive, maxWait));
tmpPool.setTestOnBorrow(getTestOnBorrow());
tmpPool.setTestOnReturn(getTestOnReturn());
tmpPool.setTimeBetweenEvictionRunsMillis(
getTimeBetweenEvictionRunsMillis());
tmpPool.setNumTestsPerEvictionRun(getNumTestsPerEvictionRun());
tmpPool.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis());
tmpPool.setTestWhileIdle(getTestWhileIdle());
pool = tmpPool;
// Set up the factory we will use (passing the pool associates
// the factory with the pool, so we do not have to do so
// explicitly)
new KeyedCPDSConnectionFactory(cpds, pool, getValidationQuery(),
isRollbackAfterValidation());
}
protected void setupDefaults(Connection con, String username) throws SQLException {
boolean defaultAutoCommit = isDefaultAutoCommit();
if (con.getAutoCommit() != defaultAutoCommit) {
con.setAutoCommit(defaultAutoCommit);
}
int defaultTransactionIsolation = getDefaultTransactionIsolation();
if (defaultTransactionIsolation != UNKNOWN_TRANSACTIONISOLATION) {
con.setTransactionIsolation(defaultTransactionIsolation);
}
boolean defaultReadOnly = isDefaultReadOnly();
if (con.isReadOnly() != defaultReadOnly) {
con.setReadOnly(defaultReadOnly);
}
}
/**
* Supports Serialization interface.
*
* @param in a <code>java.io.ObjectInputStream</code> value
* @exception IOException if an error occurs
* @exception ClassNotFoundException if an error occurs
*/
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
try
{
in.defaultReadObject();
SharedPoolDataSource oldDS = (SharedPoolDataSource)
new SharedPoolDataSourceFactory()
.getObjectInstance(getReference(), null, null, null);
this.pool = oldDS.pool;
}
catch (NamingException e)
{
throw new IOException("NamingException: " + e);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
927c2bab1b7ce9fc0908f26fb4d010c9ddd21a0a | 592deac6ff18254cac6fd7726629f5b26ae772d0 | /src/main/java/com/ntels/avocado/exception/ExceptionController.java | 71103623f0312cb5f62690dca3f62d54c42504cc | [] | no_license | Ntels-sup/SRC_ATOM_FE | 9d0d93a1c900e72fe459a8aa9fd885df11aa2efc | 8d68dc8e9089420e17c145c8386d6591282fe71d | refs/heads/master | 2021-01-20T17:20:04.635060 | 2016-05-28T08:57:52 | 2016-05-28T08:57:52 | 59,884,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,424 | java | package com.ntels.avocado.exception;
import javax.servlet.http.HttpServletRequest;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;
@ControllerAdvice
@RequestMapping(value = "/exception")
public class ExceptionController {
/**
* JSTL Exception 처리
* @return
*/
@RequestMapping(value = "jstlexception")
public String jstlexception() throws Exception {
return "exception/jstlexception";
}
/**
* JSTL Exception 처리
* @return
*/
@RequestMapping(value = "notfound")
public String notfound(HttpServletRequest request) throws Exception {
return "exception/notfound";
}
/**
* 자바 모든 Exception 처리
* @param e
* @return
*/
@ResponseStatus(value = HttpStatus.NOT_FOUND)
@ExceptionHandler(value = {Exception.class, RuntimeException.class})
public ModelAndView defaultErrorHandler(Exception e) {
e.printStackTrace();
ModelAndView mv = new ModelAndView("exception.controller"); //tiles name 선언
mv.addObject("errorMsg", e);
return mv;
}
}
| [
"kslee@ntels.com"
] | kslee@ntels.com |
2b71399df22d3ba21280d01cf7e9f9c86d0d31f8 | 9099d8901dbfd8bbc8f2f06c86ead72ae51e584e | /src/main/java/net/wesjd/towny/ngin/command/framework/argument/provider/ArgumentProvider.java | 99b52986a691f2afcf717244d24f48628fd21906 | [] | no_license | CyberFlameGO/towny-ngin | 07da5d3deeb75951454d5c464417a202991b8745 | 12922f12c0814440e8a10b62cd63c3d9f5176d63 | refs/heads/master | 2023-08-17T05:25:58.773944 | 2017-10-28T02:22:15 | 2017-10-28T02:22:15 | 487,011,295 | 0 | 0 | null | 2023-08-11T21:14:43 | 2022-04-29T14:55:24 | null | UTF-8 | Java | false | false | 535 | java | package net.wesjd.towny.ngin.command.framework.argument.provider;
import net.wesjd.towny.ngin.command.framework.argument.Arguments;
import java.lang.reflect.Parameter;
/**
* Provides a value for a command argument
*/
public interface ArgumentProvider<T> {
/**
* Called to get the parameter value for the argument
*
* @param parameter The parameter of the method
* @param arguments The command's arguments
* @return The generated object
*/
T get(Parameter parameter, Arguments arguments);
}
| [
"wesjavadev@gmail.com"
] | wesjavadev@gmail.com |
9fb2ea468b3dccee8dc8fc225dd94505dbddae1c | a46306fc7beb404754407ed3df63ba6519bcbd3e | /java-advanced/src/main/java/com/bucur/oop/ex1/GradedCourse.java | da2f59f38962bfc174e99b2cd5aeba95b86ca882 | [] | no_license | cosminbucur/sda-course-gradle | a17a7a91b9177425fae62dea3437e46a57912c61 | 4c3648d11be5205e91a397ac9fa07bbb6b3694f0 | refs/heads/master | 2022-11-27T03:33:14.960068 | 2020-08-07T12:01:26 | 2020-08-07T12:01:26 | 285,763,951 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package com.bucur.oop.ex1;
public class GradedCourse extends Course {
private int grade;
public GradedCourse(String name, int grade) {
super(name);
this.grade = grade;
}
@Override
public boolean passed() {
return grade >= 5;
}
}
| [
"cosmin.bucur@kambi.com"
] | cosmin.bucur@kambi.com |
5f09b388201ab921954790805aa3f31b2d06d09f | e56c0c78a24d37e80d507fb915e66d889c58258d | /seeds-io/src/main/java/net/tribe7/common/io/BaseEncoding.java | a4ac0e7dd50b5f1f91dac7f865855081bb5f6ce3 | [] | no_license | jjzazuet/seeds-libraries | d4db7f61ff3700085a36eec77eec0f5f9a921bb5 | 87f74a006632ca7a11bff62c89b8ec4514dc65ab | refs/heads/master | 2021-01-23T20:13:04.801382 | 2014-03-23T21:51:46 | 2014-03-23T21:51:46 | 8,710,960 | 30 | 2 | null | null | null | null | UTF-8 | Java | false | false | 29,695 | java | /*
* Copyright (C) 2012 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package net.tribe7.common.io;
import static java.math.RoundingMode.CEILING;
import static java.math.RoundingMode.FLOOR;
import static java.math.RoundingMode.UNNECESSARY;
import static net.tribe7.common.base.Preconditions.checkArgument;
import static net.tribe7.common.base.Preconditions.checkNotNull;
import static net.tribe7.common.base.Preconditions.checkPositionIndexes;
import static net.tribe7.common.base.Preconditions.checkState;
import static net.tribe7.common.io.GwtWorkarounds.asCharInput;
import static net.tribe7.common.io.GwtWorkarounds.asCharOutput;
import static net.tribe7.common.io.GwtWorkarounds.asInputStream;
import static net.tribe7.common.io.GwtWorkarounds.asOutputStream;
import static net.tribe7.common.io.GwtWorkarounds.stringBuilderOutput;
import static net.tribe7.common.math.IntMath.divide;
import static net.tribe7.common.math.IntMath.log2;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.util.Arrays;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import net.tribe7.common.annotations.Beta;
import net.tribe7.common.annotations.GwtCompatible;
import net.tribe7.common.annotations.GwtIncompatible;
import net.tribe7.common.base.Ascii;
import net.tribe7.common.base.CharMatcher;
import net.tribe7.common.io.GwtWorkarounds.ByteInput;
import net.tribe7.common.io.GwtWorkarounds.ByteOutput;
import net.tribe7.common.io.GwtWorkarounds.CharInput;
import net.tribe7.common.io.GwtWorkarounds.CharOutput;
/**
* A binary encoding scheme for reversibly translating between byte sequences and printable ASCII
* strings. This class includes several constants for encoding schemes specified by <a
* href="http://tools.ietf.org/html/rfc4648">RFC 4648</a>. For example, the expression:
*
* <pre> {@code
* BaseEncoding.base32().encode("foo".getBytes(Charsets.US_ASCII))}</pre>
*
* <p>returns the string {@code "MZXW6==="}, and <pre> {@code
* byte[] decoded = BaseEncoding.base32().decode("MZXW6===");}</pre>
*
* <p>...returns the ASCII bytes of the string {@code "foo"}.
*
* <p>By default, {@code BaseEncoding}'s behavior is relatively strict and in accordance with
* RFC 4648. Decoding rejects characters in the wrong case, though padding is optional.
* To modify encoding and decoding behavior, use configuration methods to obtain a new encoding
* with modified behavior:
*
* <pre> {@code
* BaseEncoding.base16().lowerCase().decode("deadbeef");}</pre>
*
* <p>Warning: BaseEncoding instances are immutable. Invoking a configuration method has no effect
* on the receiving instance; you must store and use the new encoding instance it returns, instead.
*
* <pre> {@code
* // Do NOT do this
* BaseEncoding hex = BaseEncoding.base16();
* hex.lowerCase(); // does nothing!
* return hex.decode("deadbeef"); // throws an IllegalArgumentException}</pre>
*
* <p>It is guaranteed that {@code encoding.decode(encoding.encode(x))} is always equal to
* {@code x}, but the reverse does not necessarily hold.
*
* <p>
* <table>
* <tr>
* <th>Encoding
* <th>Alphabet
* <th>{@code char:byte} ratio
* <th>Default padding
* <th>Comments
* <tr>
* <td>{@link #base16()}
* <td>0-9 A-F
* <td>2.00
* <td>N/A
* <td>Traditional hexadecimal. Defaults to upper case.
* <tr>
* <td>{@link #base32()}
* <td>A-Z 2-7
* <td>1.60
* <td>=
* <td>Human-readable; no possibility of mixing up 0/O or 1/I. Defaults to upper case.
* <tr>
* <td>{@link #base32Hex()}
* <td>0-9 A-V
* <td>1.60
* <td>=
* <td>"Numerical" base 32; extended from the traditional hex alphabet. Defaults to upper case.
* <tr>
* <td>{@link #base64()}
* <td>A-Z a-z 0-9 + /
* <td>1.33
* <td>=
* <td>
* <tr>
* <td>{@link #base64Url()}
* <td>A-Z a-z 0-9 - _
* <td>1.33
* <td>=
* <td>Safe to use as filenames, or to pass in URLs without escaping
* </table>
*
* <p>
* All instances of this class are immutable, so they may be stored safely as static constants.
*
* @author Louis Wasserman
* @since 14.0
*/
@Beta
@GwtCompatible(emulated = true)
public abstract class BaseEncoding {
// TODO(user): consider adding encodeTo(Appendable, byte[], [int, int])
BaseEncoding() {}
/**
* Exception indicating invalid base-encoded input encountered while decoding.
*
* @author Louis Wasserman
* @since 15.0
*/
public static final class DecodingException extends IOException {
DecodingException(String message) {
super(message);
}
DecodingException(Throwable cause) {
super(cause);
}
}
/**
* Encodes the specified byte array, and returns the encoded {@code String}.
*/
public String encode(byte[] bytes) {
return encode(checkNotNull(bytes), 0, bytes.length);
}
/**
* Encodes the specified range of the specified byte array, and returns the encoded
* {@code String}.
*/
public final String encode(byte[] bytes, int off, int len) {
checkNotNull(bytes);
checkPositionIndexes(off, off + len, bytes.length);
CharOutput result = stringBuilderOutput(maxEncodedSize(len));
ByteOutput byteOutput = encodingStream(result);
try {
for (int i = 0; i < len; i++) {
byteOutput.write(bytes[off + i]);
}
byteOutput.close();
} catch (IOException impossible) {
throw new AssertionError("impossible");
}
return result.toString();
}
/**
* Returns an {@code OutputStream} that encodes bytes using this encoding into the specified
* {@code Writer}. When the returned {@code OutputStream} is closed, so is the backing
* {@code Writer}.
*/
@GwtIncompatible("Writer,OutputStream")
public final OutputStream encodingStream(Writer writer) {
return asOutputStream(encodingStream(asCharOutput(writer)));
}
/**
* Returns a {@code ByteSink} that writes base-encoded bytes to the specified {@code CharSink}.
*/
@GwtIncompatible("ByteSink,CharSink")
public final ByteSink encodingSink(final CharSink encodedSink) {
checkNotNull(encodedSink);
return new ByteSink() {
@Override
public OutputStream openStream() throws IOException {
return encodingStream(encodedSink.openStream());
}
};
}
// TODO(user): document the extent of leniency, probably after adding ignore(CharMatcher)
private static byte[] extract(byte[] result, int length) {
if (length == result.length) {
return result;
} else {
byte[] trunc = new byte[length];
System.arraycopy(result, 0, trunc, 0, length);
return trunc;
}
}
/**
* Decodes the specified character sequence, and returns the resulting {@code byte[]}.
* This is the inverse operation to {@link #encode(byte[])}.
*
* @throws IllegalArgumentException if the input is not a valid encoded string according to this
* encoding.
*/
public final byte[] decode(CharSequence chars) {
try {
return decodeChecked(chars);
} catch (DecodingException badInput) {
throw new IllegalArgumentException(badInput);
}
}
/**
* Decodes the specified character sequence, and returns the resulting {@code byte[]}.
* This is the inverse operation to {@link #encode(byte[])}.
*
* @throws DecodingException if the input is not a valid encoded string according to this
* encoding.
*/
final byte[] decodeChecked(CharSequence chars) throws DecodingException {
chars = padding().trimTrailingFrom(chars);
ByteInput decodedInput = decodingStream(asCharInput(chars));
byte[] tmp = new byte[maxDecodedSize(chars.length())];
int index = 0;
try {
for (int i = decodedInput.read(); i != -1; i = decodedInput.read()) {
tmp[index++] = (byte) i;
}
} catch (DecodingException badInput) {
throw badInput;
} catch (IOException impossible) {
throw new AssertionError(impossible);
}
return extract(tmp, index);
}
/**
* Returns an {@code InputStream} that decodes base-encoded input from the specified
* {@code Reader}. The returned stream throws a {@link DecodingException} upon decoding-specific
* errors.
*/
@GwtIncompatible("Reader,InputStream")
public final InputStream decodingStream(Reader reader) {
return asInputStream(decodingStream(asCharInput(reader)));
}
/**
* Returns a {@code ByteSource} that reads base-encoded bytes from the specified
* {@code CharSource}.
*/
@GwtIncompatible("ByteSource,CharSource")
public final ByteSource decodingSource(final CharSource encodedSource) {
checkNotNull(encodedSource);
return new ByteSource() {
@Override
public InputStream openStream() throws IOException {
return decodingStream(encodedSource.openStream());
}
};
}
// Implementations for encoding/decoding
abstract int maxEncodedSize(int bytes);
abstract ByteOutput encodingStream(CharOutput charOutput);
abstract int maxDecodedSize(int chars);
abstract ByteInput decodingStream(CharInput charInput);
abstract CharMatcher padding();
// Modified encoding generators
/**
* Returns an encoding that behaves equivalently to this encoding, but omits any padding
* characters as specified by <a href="http://tools.ietf.org/html/rfc4648#section-3.2">RFC 4648
* section 3.2</a>, Padding of Encoded Data.
*/
@CheckReturnValue
public abstract BaseEncoding omitPadding();
/**
* Returns an encoding that behaves equivalently to this encoding, but uses an alternate character
* for padding.
*
* @throws IllegalArgumentException if this padding character is already used in the alphabet or a
* separator
*/
@CheckReturnValue
public abstract BaseEncoding withPadChar(char padChar);
/**
* Returns an encoding that behaves equivalently to this encoding, but adds a separator string
* after every {@code n} characters. Any occurrences of any characters that occur in the separator
* are skipped over in decoding.
*
* @throws IllegalArgumentException if any alphabet or padding characters appear in the separator
* string, or if {@code n <= 0}
* @throws UnsupportedOperationException if this encoding already uses a separator
*/
@CheckReturnValue
public abstract BaseEncoding withSeparator(String separator, int n);
/**
* Returns an encoding that behaves equivalently to this encoding, but encodes and decodes with
* uppercase letters. Padding and separator characters remain in their original case.
*
* @throws IllegalStateException if the alphabet used by this encoding contains mixed upper- and
* lower-case characters
*/
@CheckReturnValue
public abstract BaseEncoding upperCase();
/**
* Returns an encoding that behaves equivalently to this encoding, but encodes and decodes with
* lowercase letters. Padding and separator characters remain in their original case.
*
* @throws IllegalStateException if the alphabet used by this encoding contains mixed upper- and
* lower-case characters
*/
@CheckReturnValue
public abstract BaseEncoding lowerCase();
private static final BaseEncoding BASE64 = new StandardBaseEncoding(
"base64()", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", '=');
/**
* The "base64" base encoding specified by <a
* href="http://tools.ietf.org/html/rfc4648#section-4">RFC 4648 section 4</a>, Base 64 Encoding.
* (This is the same as the base 64 encoding from <a
* href="http://tools.ietf.org/html/rfc3548#section-3">RFC 3548</a>.)
*
* <p>The character {@code '='} is used for padding, but can be {@linkplain #omitPadding()
* omitted} or {@linkplain #withPadChar(char) replaced}.
*
* <p>No line feeds are added by default, as per <a
* href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in
* Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}.
*/
public static BaseEncoding base64() {
return BASE64;
}
private static final BaseEncoding BASE64_URL = new StandardBaseEncoding(
"base64Url()", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", '=');
/**
* The "base64url" encoding specified by <a
* href="http://tools.ietf.org/html/rfc4648#section-5">RFC 4648 section 5</a>, Base 64 Encoding
* with URL and Filename Safe Alphabet, also sometimes referred to as the "web safe Base64."
* (This is the same as the base 64 encoding with URL and filename safe alphabet from <a
* href="http://tools.ietf.org/html/rfc3548#section-4">RFC 3548</a>.)
*
* <p>The character {@code '='} is used for padding, but can be {@linkplain #omitPadding()
* omitted} or {@linkplain #withPadChar(char) replaced}.
*
* <p>No line feeds are added by default, as per <a
* href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in
* Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}.
*/
public static BaseEncoding base64Url() {
return BASE64_URL;
}
private static final BaseEncoding BASE32 =
new StandardBaseEncoding("base32()", "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", '=');
/**
* The "base32" encoding specified by <a
* href="http://tools.ietf.org/html/rfc4648#section-6">RFC 4648 section 6</a>, Base 32 Encoding.
* (This is the same as the base 32 encoding from <a
* href="http://tools.ietf.org/html/rfc3548#section-5">RFC 3548</a>.)
*
* <p>The character {@code '='} is used for padding, but can be {@linkplain #omitPadding()
* omitted} or {@linkplain #withPadChar(char) replaced}.
*
* <p>No line feeds are added by default, as per <a
* href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in
* Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}.
*/
public static BaseEncoding base32() {
return BASE32;
}
private static final BaseEncoding BASE32_HEX =
new StandardBaseEncoding("base32Hex()", "0123456789ABCDEFGHIJKLMNOPQRSTUV", '=');
/**
* The "base32hex" encoding specified by <a
* href="http://tools.ietf.org/html/rfc4648#section-7">RFC 4648 section 7</a>, Base 32 Encoding
* with Extended Hex Alphabet. There is no corresponding encoding in RFC 3548.
*
* <p>The character {@code '='} is used for padding, but can be {@linkplain #omitPadding()
* omitted} or {@linkplain #withPadChar(char) replaced}.
*
* <p>No line feeds are added by default, as per <a
* href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in
* Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}.
*/
public static BaseEncoding base32Hex() {
return BASE32_HEX;
}
private static final BaseEncoding BASE16 =
new StandardBaseEncoding("base16()", "0123456789ABCDEF", null);
/**
* The "base16" encoding specified by <a
* href="http://tools.ietf.org/html/rfc4648#section-8">RFC 4648 section 8</a>, Base 16 Encoding.
* (This is the same as the base 16 encoding from <a
* href="http://tools.ietf.org/html/rfc3548#section-6">RFC 3548</a>.) This is commonly known as
* "hexadecimal" format.
*
* <p>No padding is necessary in base 16, so {@link #withPadChar(char)} and
* {@link #omitPadding()} have no effect.
*
* <p>No line feeds are added by default, as per <a
* href="http://tools.ietf.org/html/rfc4648#section-3.1"> RFC 4648 section 3.1</a>, Line Feeds in
* Encoded Data. Line feeds may be added using {@link #withSeparator(String, int)}.
*/
public static BaseEncoding base16() {
return BASE16;
}
private static final class Alphabet extends CharMatcher {
private final String name;
// this is meant to be immutable -- don't modify it!
private final char[] chars;
final int mask;
final int bitsPerChar;
final int charsPerChunk;
final int bytesPerChunk;
private final byte[] decodabet;
private final boolean[] validPadding;
Alphabet(String name, char[] chars) {
this.name = checkNotNull(name);
this.chars = checkNotNull(chars);
try {
this.bitsPerChar = log2(chars.length, UNNECESSARY);
} catch (ArithmeticException e) {
throw new IllegalArgumentException("Illegal alphabet length " + chars.length, e);
}
/*
* e.g. for base64, bitsPerChar == 6, charsPerChunk == 4, and bytesPerChunk == 3. This makes
* for the smallest chunk size that still has charsPerChunk * bitsPerChar be a multiple of 8.
*/
int gcd = Math.min(8, Integer.lowestOneBit(bitsPerChar));
this.charsPerChunk = 8 / gcd;
this.bytesPerChunk = bitsPerChar / gcd;
this.mask = chars.length - 1;
byte[] decodabet = new byte[Ascii.MAX + 1];
Arrays.fill(decodabet, (byte) -1);
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
checkArgument(CharMatcher.ASCII.matches(c), "Non-ASCII character: %s", c);
checkArgument(decodabet[c] == -1, "Duplicate character: %s", c);
decodabet[c] = (byte) i;
}
this.decodabet = decodabet;
boolean[] validPadding = new boolean[charsPerChunk];
for (int i = 0; i < bytesPerChunk; i++) {
validPadding[divide(i * 8, bitsPerChar, CEILING)] = true;
}
this.validPadding = validPadding;
}
char encode(int bits) {
return chars[bits];
}
boolean isValidPaddingStartPosition(int index) {
return validPadding[index % charsPerChunk];
}
int decode(char ch) throws IOException {
if (ch > Ascii.MAX || decodabet[ch] == -1) {
throw new DecodingException("Unrecognized character: " + ch);
}
return decodabet[ch];
}
private boolean hasLowerCase() {
for (char c : chars) {
if (Ascii.isLowerCase(c)) {
return true;
}
}
return false;
}
private boolean hasUpperCase() {
for (char c : chars) {
if (Ascii.isUpperCase(c)) {
return true;
}
}
return false;
}
Alphabet upperCase() {
if (!hasLowerCase()) {
return this;
} else {
checkState(!hasUpperCase(), "Cannot call upperCase() on a mixed-case alphabet");
char[] upperCased = new char[chars.length];
for (int i = 0; i < chars.length; i++) {
upperCased[i] = Ascii.toUpperCase(chars[i]);
}
return new Alphabet(name + ".upperCase()", upperCased);
}
}
Alphabet lowerCase() {
if (!hasUpperCase()) {
return this;
} else {
checkState(!hasLowerCase(), "Cannot call lowerCase() on a mixed-case alphabet");
char[] lowerCased = new char[chars.length];
for (int i = 0; i < chars.length; i++) {
lowerCased[i] = Ascii.toLowerCase(chars[i]);
}
return new Alphabet(name + ".lowerCase()", lowerCased);
}
}
@Override
public boolean matches(char c) {
return CharMatcher.ASCII.matches(c) && decodabet[c] != -1;
}
@Override
public String toString() {
return name;
}
}
static final class StandardBaseEncoding extends BaseEncoding {
// TODO(user): provide a useful toString
private final Alphabet alphabet;
@Nullable
private final Character paddingChar;
StandardBaseEncoding(String name, String alphabetChars, @Nullable Character paddingChar) {
this(new Alphabet(name, alphabetChars.toCharArray()), paddingChar);
}
StandardBaseEncoding(Alphabet alphabet, @Nullable Character paddingChar) {
this.alphabet = checkNotNull(alphabet);
checkArgument(paddingChar == null || !alphabet.matches(paddingChar),
"Padding character %s was already in alphabet", paddingChar);
this.paddingChar = paddingChar;
}
@Override
CharMatcher padding() {
return (paddingChar == null) ? CharMatcher.NONE : CharMatcher.is(paddingChar.charValue());
}
@Override
int maxEncodedSize(int bytes) {
return alphabet.charsPerChunk * divide(bytes, alphabet.bytesPerChunk, CEILING);
}
@Override
ByteOutput encodingStream(final CharOutput out) {
checkNotNull(out);
return new ByteOutput() {
int bitBuffer = 0;
int bitBufferLength = 0;
int writtenChars = 0;
@Override
public void write(byte b) throws IOException {
bitBuffer <<= 8;
bitBuffer |= b & 0xFF;
bitBufferLength += 8;
while (bitBufferLength >= alphabet.bitsPerChar) {
int charIndex = (bitBuffer >> (bitBufferLength - alphabet.bitsPerChar))
& alphabet.mask;
out.write(alphabet.encode(charIndex));
writtenChars++;
bitBufferLength -= alphabet.bitsPerChar;
}
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
if (bitBufferLength > 0) {
int charIndex = (bitBuffer << (alphabet.bitsPerChar - bitBufferLength))
& alphabet.mask;
out.write(alphabet.encode(charIndex));
writtenChars++;
if (paddingChar != null) {
while (writtenChars % alphabet.charsPerChunk != 0) {
out.write(paddingChar.charValue());
writtenChars++;
}
}
}
out.close();
}
};
}
@Override
int maxDecodedSize(int chars) {
return (int) ((alphabet.bitsPerChar * (long) chars + 7L) / 8L);
}
@Override
ByteInput decodingStream(final CharInput reader) {
checkNotNull(reader);
return new ByteInput() {
int bitBuffer = 0;
int bitBufferLength = 0;
int readChars = 0;
boolean hitPadding = false;
final CharMatcher paddingMatcher = padding();
@Override
public int read() throws IOException {
while (true) {
int readChar = reader.read();
if (readChar == -1) {
if (!hitPadding && !alphabet.isValidPaddingStartPosition(readChars)) {
throw new DecodingException("Invalid input length " + readChars);
}
return -1;
}
readChars++;
char ch = (char) readChar;
if (paddingMatcher.matches(ch)) {
if (!hitPadding
&& (readChars == 1 || !alphabet.isValidPaddingStartPosition(readChars - 1))) {
throw new DecodingException("Padding cannot start at index " + readChars);
}
hitPadding = true;
} else if (hitPadding) {
throw new DecodingException(
"Expected padding character but found '" + ch + "' at index " + readChars);
} else {
bitBuffer <<= alphabet.bitsPerChar;
bitBuffer |= alphabet.decode(ch);
bitBufferLength += alphabet.bitsPerChar;
if (bitBufferLength >= 8) {
bitBufferLength -= 8;
return (bitBuffer >> bitBufferLength) & 0xFF;
}
}
}
}
@Override
public void close() throws IOException {
reader.close();
}
};
}
@Override
public BaseEncoding omitPadding() {
return (paddingChar == null) ? this : new StandardBaseEncoding(alphabet, null);
}
@Override
public BaseEncoding withPadChar(char padChar) {
if (8 % alphabet.bitsPerChar == 0 ||
(paddingChar != null && paddingChar.charValue() == padChar)) {
return this;
} else {
return new StandardBaseEncoding(alphabet, padChar);
}
}
@Override
public BaseEncoding withSeparator(String separator, int afterEveryChars) {
checkNotNull(separator);
checkArgument(padding().or(alphabet).matchesNoneOf(separator),
"Separator cannot contain alphabet or padding characters");
return new SeparatedBaseEncoding(this, separator, afterEveryChars);
}
private transient BaseEncoding upperCase;
private transient BaseEncoding lowerCase;
@Override
public BaseEncoding upperCase() {
BaseEncoding result = upperCase;
if (result == null) {
Alphabet upper = alphabet.upperCase();
result = upperCase =
(upper == alphabet) ? this : new StandardBaseEncoding(upper, paddingChar);
}
return result;
}
@Override
public BaseEncoding lowerCase() {
BaseEncoding result = lowerCase;
if (result == null) {
Alphabet lower = alphabet.lowerCase();
result = lowerCase =
(lower == alphabet) ? this : new StandardBaseEncoding(lower, paddingChar);
}
return result;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("BaseEncoding.");
builder.append(alphabet.toString());
if (8 % alphabet.bitsPerChar != 0) {
if (paddingChar == null) {
builder.append(".omitPadding()");
} else {
builder.append(".withPadChar(").append(paddingChar).append(')');
}
}
return builder.toString();
}
}
static CharInput ignoringInput(final CharInput delegate, final CharMatcher toIgnore) {
checkNotNull(delegate);
checkNotNull(toIgnore);
return new CharInput() {
@Override
public int read() throws IOException {
int readChar;
do {
readChar = delegate.read();
} while (readChar != -1 && toIgnore.matches((char) readChar));
return readChar;
}
@Override
public void close() throws IOException {
delegate.close();
}
};
}
static CharOutput separatingOutput(
final CharOutput delegate, final String separator, final int afterEveryChars) {
checkNotNull(delegate);
checkNotNull(separator);
checkArgument(afterEveryChars > 0);
return new CharOutput() {
int charsUntilSeparator = afterEveryChars;
@Override
public void write(char c) throws IOException {
if (charsUntilSeparator == 0) {
for (int i = 0; i < separator.length(); i++) {
delegate.write(separator.charAt(i));
}
charsUntilSeparator = afterEveryChars;
}
delegate.write(c);
charsUntilSeparator--;
}
@Override
public void flush() throws IOException {
delegate.flush();
}
@Override
public void close() throws IOException {
delegate.close();
}
};
}
static final class SeparatedBaseEncoding extends BaseEncoding {
private final BaseEncoding delegate;
private final String separator;
private final int afterEveryChars;
private final CharMatcher separatorChars;
SeparatedBaseEncoding(BaseEncoding delegate, String separator, int afterEveryChars) {
this.delegate = checkNotNull(delegate);
this.separator = checkNotNull(separator);
this.afterEveryChars = afterEveryChars;
checkArgument(
afterEveryChars > 0, "Cannot add a separator after every %s chars", afterEveryChars);
this.separatorChars = CharMatcher.anyOf(separator).precomputed();
}
@Override
CharMatcher padding() {
return delegate.padding();
}
@Override
int maxEncodedSize(int bytes) {
int unseparatedSize = delegate.maxEncodedSize(bytes);
return unseparatedSize + separator.length()
* divide(Math.max(0, unseparatedSize - 1), afterEveryChars, FLOOR);
}
@Override
ByteOutput encodingStream(final CharOutput output) {
return delegate.encodingStream(separatingOutput(output, separator, afterEveryChars));
}
@Override
int maxDecodedSize(int chars) {
return delegate.maxDecodedSize(chars);
}
@Override
ByteInput decodingStream(final CharInput input) {
return delegate.decodingStream(ignoringInput(input, separatorChars));
}
@Override
public BaseEncoding omitPadding() {
return delegate.omitPadding().withSeparator(separator, afterEveryChars);
}
@Override
public BaseEncoding withPadChar(char padChar) {
return delegate.withPadChar(padChar).withSeparator(separator, afterEveryChars);
}
@Override
public BaseEncoding withSeparator(String separator, int afterEveryChars) {
throw new UnsupportedOperationException("Already have a separator");
}
@Override
public BaseEncoding upperCase() {
return delegate.upperCase().withSeparator(separator, afterEveryChars);
}
@Override
public BaseEncoding lowerCase() {
return delegate.lowerCase().withSeparator(separator, afterEveryChars);
}
@Override
public String toString() {
return delegate.toString() +
".withSeparator(\"" + separator + "\", " + afterEveryChars + ")";
}
}
}
| [
"jjzazuet@gmail.com"
] | jjzazuet@gmail.com |
eb1008f49a2565d616aefb2a3b60e91ed5d272da | daa4b23209554c156439e1060e6e776f0fac3b9c | /src/main/java/com/siifi/infos/service/maney/ManeyImagesService.java | 5822a09a60bc4a1c2dd288ac376f721c3ef618d6 | [] | no_license | dutianyuzz/infos | 7f5a6a5c8523c743dff7a394344724cf5a4f68dc | b2e6b04c9eb872e7d339ab7a4339e58995a35faf | refs/heads/master | 2020-05-04T08:13:59.729787 | 2019-04-28T08:33:23 | 2019-04-28T08:33:23 | 144,229,473 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package com.siifi.infos.service.maney;
import com.siifi.infos.entity.ManeysImage;
import java.util.List;
public interface ManeyImagesService {
public List<ManeysImage> getManey();
public ManeysImage getManeyById(int maneyId);
public void saveManey(ManeysImage maneysImage);
public void editManey(ManeysImage maneysImage);
public void deleteManey(int maneyId);
}
| [
"15231255573@163.com"
] | 15231255573@163.com |
5abfd2c093ca25aee3004c946af5ef745a4bbf31 | 1b59a5dde466ed3f59b67f55adfe7d80f999e778 | /SemesterprøveJuni2018/src/application/model/PraktikOpgave.java | 62fb5ac19b989c55fb27035c49d9911246a6f593 | [] | no_license | TutteG/EAAA-PRO1 | a2038539f34ccd1fbbb8bfd9b0e6e17edeab06a0 | 654cf59de53768368ebb1b1bc3eeb40b04e4f4e1 | refs/heads/master | 2020-03-09T10:15:59.927274 | 2018-09-10T06:58:32 | 2018-09-10T06:58:32 | 128,733,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package application.model;
public abstract class PraktikOpgave {
private String navn;
private int semester;
public PraktikOpgave(String navn, int semester) {
this.navn = navn;
this.semester = semester;
}
public String getNavn() {
return navn;
}
public int getSemester() {
return semester;
}
public void setNavn(String navn) {
this.navn = navn;
}
public void setSemester(int semester) {
this.semester = semester;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return navn + " " + semester;
}
}
| [
"torben_grove@live.dk"
] | torben_grove@live.dk |
234b77a98a6d08db1d39e2cefed5c956bf9c36b1 | 220671ecc3661c5ca6a76aa61514bd5b0789812b | /target/classes/com/coretree/defaultconfig/main/controller/OrganizationController.java | eae22f1f8bc3081f0ca290d58e178a40a889d023 | [] | no_license | coretree011/webcrmEIT | 30b075434cc7bc45b2a3bf30913aa1d7769cbe4a | c36f4db5958eed0a179a87f5ce6cb5af7c6e8505 | refs/heads/master | 2020-04-21T18:41:32.467369 | 2016-09-01T09:47:01 | 2016-09-01T09:47:01 | 66,639,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,732 | java | package com.coretree.defaultconfig.main.controller;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import com.coretree.defaultconfig.main.mapper.OrganizationMapper;
import com.coretree.defaultconfig.main.model.Organization;
/**
* Test를 위한 컨트롤러 클래스
*
* @author hsw
*
*/
@RestController
public class OrganizationController {
@Autowired
OrganizationMapper organizationMapper;
/**
* customer counter 정보를 조회한다.
*
* @param condition
* @return
*/
/* @RequestMapping(path = "/login/actionLogin", method = RequestMethod.POST)
public @ResponseBody long checkLogin(@RequestBody Users paramUsers) {
long result = 0;
Users users = usersMapper.checkLogin(paramUsers);
if(users != null){
long nCount = users.getExistCount();
String realPassword = users.getPassword();
if(nCount == 0){
result = 0;
}else if(nCount == 1 && realPassword.equals(paramUsers.getPassword())){
result = 1;
}else if(nCount == 1 && !realPassword.equals(paramUsers.getPassword())){
result = 2;
}
}
return result;
}*/
@RequestMapping(path = "/login/actionLogin", method = RequestMethod.GET)
public ModelAndView checkLogin(@RequestParam("userName") String test, HttpSession session) {
long result = 0;
Organization paramUsers = new Organization();
paramUsers.setEmpNo(test);
Organization users = organizationMapper.checkLogin(paramUsers);
if(users != null){
long nCount = users.getExistCount();
String realPassword = users.getPassword();
if(nCount == 0){
result = 0;
}else if(nCount == 1){
session.setAttribute("empNo", users.getEmpNo());
session.setAttribute("empNm", users.getEmpNm());
session.setAttribute("extensionNo", users.getExtensionNo());
result = 1;
}else if(nCount == 1 && !realPassword.equals(paramUsers.getPassword())){
result = 2;
}
}
ModelAndView view = new ModelAndView();
view.setViewName("/index");
return view;
}
@RequestMapping(path = "/login/updatePwd", method = RequestMethod.POST)
public String updatePwd(@RequestBody Organization paramUsers, HttpSession session) {
session.setAttribute("test123", paramUsers);
return "redirect:/login/updatePwd2";
}
@RequestMapping(path = "/login/updatePwd2", method = RequestMethod.POST)
public long updatePwd2(HttpSession session) {
long result = 0;
Organization paramUsers = (Organization) session.getAttribute("test123");
Organization users = organizationMapper.checkLogin(paramUsers);
if(users != null){
if(paramUsers.getPassword().equals(users.getPassword())){
organizationMapper.updatePwd(paramUsers);
result = 1;
}else{
result = 0;
}
}
return result;
}
@RequestMapping(path = "/empList", method = RequestMethod.POST)
public List<Organization> empList() throws Exception {
List<Organization> emp = organizationMapper.empList();
return emp;
}
@RequestMapping(path = "/main/usersState", method = RequestMethod.POST)
public List<Organization> usersState() throws Exception {
List<Organization> emp = organizationMapper.usersState();
return emp;
}
}
| [
"Admin@hnlee-PC"
] | Admin@hnlee-PC |
1f178c0dc9b67529e726ed79ff23416e9d1ab327 | 0d6ac13791a001e749ff3137a41ddfd99219eeeb | /reverseFlat-ejb/src/java/com/reverseFlat/ejb/commons/valueobjects/CreditCardServer.java | a30b2bb895bc6b19574f133a4aecfb48d151ff54 | [] | no_license | lfgiraldo/reverseflat | 688b52c3e6b1fe77cf5dc0f0801cb14ff7f293fa | 7ae50185c86d13fc9f360773acf9e47e66595700 | refs/heads/master | 2020-03-30T05:50:50.768644 | 2009-07-30T22:10:36 | 2009-07-30T22:10:36 | 32,351,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | package com.reverseFlat.ejb.commons.valueobjects;
import java.io.Serializable;
public class CreditCardServer implements Serializable {
private String creditCardType;
private String creditCardNumber;
private String expdateMonth;
private String expdateYear;
private String cvv2Number;
private String idCombo;
private String currency;
public String getCreditCardType() {
return creditCardType;
}
public void setCreditCardType(String creditCardType) {
this.creditCardType = creditCardType;
}
public String getCreditCardNumber() {
return creditCardNumber;
}
public void setCreditCardNumber(String creditCardNumber) {
this.creditCardNumber = creditCardNumber;
}
public String getExpdateMonth() {
return expdateMonth;
}
public void setExpdateMonth(String expdateMonth) {
this.expdateMonth = expdateMonth;
}
public String getExpdateYear() {
return expdateYear;
}
public void setExpdateYear(String expdateYear) {
this.expdateYear = expdateYear;
}
public String getCvv2Number() {
return cvv2Number;
}
public void setCvv2Number(String cvv2Number) {
this.cvv2Number = cvv2Number;
}
public String getIdCombo() {
return idCombo;
}
public void setIdCombo(String idCombo) {
this.idCombo = idCombo;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
}
| [
"lfgiraldo@5366fab2-50f4-11de-b90f-197667375a34"
] | lfgiraldo@5366fab2-50f4-11de-b90f-197667375a34 |
72925538bbe964876faa79862e0f480dfd4e40a5 | 3a94c222f3b9a8b9755e57f9a1a8b2ac20580833 | /src/main/java/biuro/podrozy/projekt/ProjektApplication.java | 8da1f281085a48264d0c8cb39b06fc165d58fba5 | [] | no_license | MountLee98/BiuroPodrozy | 1fc05f66360a64d08e079e499e5800f6aef3210f | 0e285e7e40804f0703eaf14ee2813c61b45623ed | refs/heads/master | 2023-06-08T08:58:55.289848 | 2021-06-14T18:38:13 | 2021-06-14T18:38:13 | 376,365,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java | package biuro.podrozy.projekt;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import biuro.podrozy.projekt.storage.StorageService;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
public class ProjektApplication {
public static void main(String[] args) {
SpringApplication.run(ProjektApplication.class, args);
}
@Bean
CommandLineRunner init(StorageService storageService) {
return (args) -> {
storageService.deleteAll();
storageService.init();
};
}
}
| [
"michalpa98@gmail.com"
] | michalpa98@gmail.com |
05db1eb68e59c0b2b421620c0c0b743767afaa8f | 035c5b0fee4313d3583d3e05ecb77f5976e54053 | /app/src/test/java/com/example/administrator/shopcardemo/ExampleUnitTest.java | cdb3427a0e8a864f4feb1a71d1db235ed8b323ca | [] | no_license | androidjiasheng/ShopCarDemo | a36a542f183af0e1264aeac47353ba9695ac6fda | 883efbc1c756e6c975aacfd5e9c16c4ad466c90e | refs/heads/master | 2021-01-19T04:43:30.125555 | 2017-04-06T05:13:03 | 2017-04-06T05:13:03 | 87,388,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.example.administrator.shopcardemo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"898478073@qq.com"
] | 898478073@qq.com |
aeaabde93086ee7d55f710342b71de033ccec22a | 4eb43b54006ccbddbdbe5f88d77c656b251cc18b | /GUIeventHandling/src/EventHandlingClass.java | 77b1ed86e3b7e194967aff7e76b6a2e7d729bffe | [] | no_license | sauravprakashgupta/java-Problems-Solved | c196b1217b2351c22ea15b1d2ddcf2280b4f02e0 | 96857328ebb1ff9b1bcd54cf83c159a42acfb390 | refs/heads/master | 2020-03-21T21:01:57.821123 | 2018-07-22T17:58:45 | 2018-07-22T17:58:45 | 139,042,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,843 | java | import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JOptionPane;
public class EventHandlingClass extends JFrame{
private JTextField item1;
private JTextField item2;
private JTextField item3;
private JPasswordField passwordField;
public EventHandlingClass(){
super("The title");
setLayout(new FlowLayout());
item1 = new JTextField(10);
item2 = new JTextField("Enter text Here");
item3 = new JTextField("UnEditable",20);
item3.setEditable(false);
add(item1);
add(item2);
add(item3);
passwordField = new JPasswordField("myPassword");
add(passwordField);
MyHandlerClass handlerObj = new MyHandlerClass();
item1.addActionListener(handlerObj);
item2.addActionListener(handlerObj);
item3.addActionListener(handlerObj);
passwordField.addActionListener(handlerObj);
}
private class MyHandlerClass implements ActionListener{
public void actionPerformed(ActionEvent event){
String myString = "";
if(event.getSource()==item1){
myString=String.format("field 1 is %s", event.getActionCommand());
}
else if(event.getSource()==item2){
myString=String.format("field 2 is %s", event.getActionCommand());
}
else if(event.getSource()==item3){
myString=String.format("field 3 is %s", event.getActionCommand());
}
else if(event.getSource() == passwordField){
myString = String.format("password field is : %s",event.getActionCommand());
}
}
}
}
| [
"iamsaurav.pr.gupta@hotmail.com"
] | iamsaurav.pr.gupta@hotmail.com |
7284a5392b17fdce63c56b74073f194ea7eee45b | 3a3815e5db671d7cd69fa4e8349f94c348ef63f7 | /app/src/main/java/sg/edu/rp/c346/contactslist/Contacts.java | 18404e89c3876d40d66303065bfdef3d4e179f0b | [] | no_license | Dhurgesh/ContactList | f5314c9cdd57f7ee17390d429cf3a120a4e760de | 2e28f212fa3db1bddff115189ffb1805e254326f | refs/heads/master | 2020-03-23T19:00:42.775979 | 2018-07-23T01:55:39 | 2018-07-23T01:55:39 | 141,948,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 808 | java | package sg.edu.rp.c346.contactslist;
/**
* Created by 16033265 on 7/23/2018.
*/
public class Contacts {
private String name;
private int countryCode;
private int phoneNum;
public Contacts(String name, int countryCode, int phoneNum) {
this.name = name;
this.countryCode = countryCode;
this.phoneNum = phoneNum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCountryCode() {
return countryCode;
}
public void setCountryCode(int countryCode) {
this.countryCode = countryCode;
}
public int getPhoneNum() {
return phoneNum;
}
public void setPhoneNum(int phoneNum) {
this.phoneNum = phoneNum;
}
}
| [
"16033265@myrp.edu.sg"
] | 16033265@myrp.edu.sg |
2b4f00e9d60b49ef165578279f370309958f387e | 9b0ce2a6ee915fc276406f8a0e7b4dd7b11c5d48 | /worker/src/main/java/com/bot/worker/config/ConfigLoader.java | b24f3d510198759e1843049575e8191be67e0029 | [
"Apache-2.0"
] | permissive | oleshkoa/Bot | a374a17b507b1bf96b7fc97bba331a0b8d17199f | 8b23f43a0d3ff6f48fb3d5ec902a412e744bd929 | refs/heads/master | 2021-01-21T22:09:42.308999 | 2017-01-30T20:42:24 | 2017-01-30T20:42:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,751 | java | package com.bot.worker.config;
import com.bot.worker.EventBusComponent;
import com.bot.worker.common.Annotations.TaskConfigFile;
import com.bot.worker.common.Constants;
import com.bot.worker.common.events.AppInitEvent;
import com.bot.worker.common.events.GetStatusRequest;
import com.bot.worker.common.events.TaskConfigLoadedResponse;
import com.bot.worker.common.events.TaskConfigReloadRequest;
import com.bot.worker.common.events.TaskHoldRequest;
import com.bot.worker.config.XmlConfig.XmlTaskConfig;
import com.google.common.eventbus.Subscribe;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.xml.bind.JAXB;
import javax.xml.bind.JAXBException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Loads task configs from configuration file
* Initial config loading happens on receiving {@link AppInitEvent}
*
* <p>
* Config example
* {@code
*
* <config>
* <group id="GitHub.com">
* <task id="gitHubPing" executor="PING">
* <run>10</run>
* <deadline>3</deadline>
* </task>
* <task id="gitHubTrace" executor="TRACE">
* <run>30</run>
* <deadline>10</deadline>
* </task>
* </group>
* <task id="Java.com" executor="CUSTOM_EX">
* <run>2</run>
* <deadline>1</deadline>
* <executorConfig>
* <property key="key">value</property>
* </executorConfig>
* </task>
* <task id="runOnce" executor="CUSTOM_ONE_RUN">
* <run>-1</run>
* </task>
* </config>
* }
*
* <p>
* All communication with other app components goes though event bus,
* look {@link EventBusComponent} for more info
*
* @author Aleks
*/
@Singleton
public class ConfigLoader extends EventBusComponent {
private static final Logger logger = LoggerFactory.getLogger(ConfigLoader.class);
private final String pathToConfigFile;
@Inject
ConfigLoader(@TaskConfigFile String pathToConfigFile) {
this.pathToConfigFile = pathToConfigFile;
}
private static boolean isValidTaskConfig(String taskName, XmlTaskConfig
config) {
return Constants.ALL.equals(taskName) || taskName.equals(config
.getTaskName());
}
/**
* Initial config loading on app init event
* @param event app init event
* @throws JAXBException in case of config parse exception
* @throws IOException in case of config file IO exception
*/
@Subscribe
void onInit(AppInitEvent event) throws JAXBException, IOException {
loadTaskConfigs(Constants.ALL);
}
/**
* Handler for task config reload requests
*
* @see TaskConfigReloadRequest
* @param reloadEvent events with task name to reload
* @throws JAXBException in case of config parse exception
* @throws IOException in case of config file IO exception
*/
@Subscribe
void onConfigReload(TaskConfigReloadRequest reloadEvent) throws JAXBException, IOException {
String taskName = reloadEvent.getTaskName();
post(TaskHoldRequest.create(taskName));
loadTaskConfigs(taskName);
post(GetStatusRequest.create(taskName));
}
private void loadTaskConfigs(String taskName) throws JAXBException, IOException {
XmlConfig config = parseConfig();
logger.info("Total group confings: {}", config.getGroups());
logger.info("Total non-grouped configs : {}", config.getTasks());
config.getGroups()
.forEach(group -> group.getTasks()
.stream()
.filter((c) -> isValidTaskConfig(taskName, c))
.forEach((task) -> {
processTaskConfig(group.getGroupName(), task);
}
)
);
//process un-grouped configs
config.getTasks()
.stream()
.filter(c -> isValidTaskConfig(taskName, c))
.forEach(task -> processTaskConfig(Constants.NO_GROUP, task));
logger.info("All configs loaded");
}
private void processTaskConfig(String groupName, XmlTaskConfig task) {
logger.info("Loading config {}", task);
post(TaskConfigLoadedResponse.create(groupName, task));
}
private XmlConfig parseConfig() throws JAXBException, IOException {
try (BufferedInputStream configStream =
new BufferedInputStream(new FileInputStream(pathToConfigFile))) {
return JAXB.unmarshal(configStream, XmlConfig.class);
}
}
}
| [
"aleks.n.fedorov@gmail.com"
] | aleks.n.fedorov@gmail.com |
9510f4e7cf3f4b0a379f58972a03c1ccdfd5e88c | f070bc719e870678f39cf4daaa87edac9e58de20 | /docroot/WEB-INF/src/mylocalization/JavaText.java | 1efce627047f9fd584d1923c1b15383f4dff8388 | [] | no_license | YueRongLee/Questionnaire | 6ccb7e597562aef548185c8a28920298cced1405 | 4184fb6d35912487b86c3d0304cb1bd23f87e7af | refs/heads/master | 2020-03-09T10:52:32.459242 | 2018-04-19T06:21:43 | 2018-04-19T06:21:43 | 128,747,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,199 | java | package mylocalization;
import myutil.TextUtil;;
/**
* Java端訊息本地化.
* @author Jason
*/
public enum JavaText {
/**
* 非常满意.
*/
VERY_SATISFIED("very-satisfied"),
/**
* 满意.
*/
SATISFIED("satisfied"),
/**
* 比较满意.
*/
SO_SO("so-so"),
/**
* 不满意.
*/
NOT_SATISFIED("not-satisfied"),
/**
* 很差.
*/
SO_BAD("so-bad"),
/**
* 1.产品的打印质量,是否满意?.
*/
QUESTION_1("question1"),
/**
* 2.系统资料处理(如:模板修改或临时需求),是否满意?.
*/
QUESTION_2("question2"),
/**
* 3.生产时效,是否满意?.
*/
QUESTION_3("question3"),
/**
* 4.生产异常状况的处理结果,是否满意?.
*/
QUESTION_4("question4"),
/**
* 5.抱怨或投诉后处理的品质,是否满意?.
*/
QUESTION_5("question5"),
/**
* 6.产品外包装的完整性,是否满意?.
*/
QUESTION_6("question6"),
/**
* 7.物流配送时效,是否满意?.
*/
QUESTION_7("question7"),
/**
* 8.现场工作人员的服务态度和协调能力,是否满意?.
*/
QUESTION_8("question8"),
/**
* 9.打印设备的稳定姓(故障叫修率),是否满意?.
*/
QUESTION_9("question9"),
/**
* 10.设备维修人员的服务态度和维修水平,是否满意?.
*/
QUESTION_10("question10"),
/**
* 11.您的意见和建议(不满意事项可简述):.
*/
QUESTION_11("question11"),
/**
* 公司名称:.
*/
COMPANY_NAME("company-name"),
/**
* 联系人:.
*/
CONTACT_PERSON("contact-person"),
/**
* 联系方式:.
*/
CONTACT_METHOD("contact-method"),
/**
* 填表日期:.
*/
FILL_DATE("fill-date"),
/**
* 提交答卷.
*/
SUBMIT_BUTTON("submit-button");
//-------------properties key and return function-----------------//
/**
* properties key.
*/
private String propKey;
/**
* constructor.
* @param str key name
*/
JavaText(String str) {
this.propKey = str;
}
/**
* get message in properties.
* @return message
*/
public String value() {
return TextUtil.getText(propKey);
}
}
| [
"jasoa125@gmail.com"
] | jasoa125@gmail.com |
36159dc4ceb00231719810649aebd74e9793097f | e3c9f7397802a76557c6783f3d8d839f2ccda27e | /src/Presentacion/Licencias/pnlDiasLic.java | d4dcfb7ee9c88e30e10c2efc9faed46fd5a78ef0 | [] | no_license | patricioattun/SistemaDeSueldos | 04fec6a8e7b4cf2457fdfbe8a283b05f85ad2a02 | 704669ab59ae0961c6eefcafbb6529a74df114c3 | refs/heads/master | 2021-05-12T01:54:17.406601 | 2018-01-15T17:30:33 | 2018-01-15T17:30:33 | 117,570,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,055 | java |
package Presentacion.Licencias;
import Dominio.Licencia;
import Logica.LogFuncionario;
import Presentacion.frmPrin;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
public class pnlDiasLic extends javax.swing.JPanel {
private LogFuncionario log;
private frmPrin frm;
public pnlDiasLic(frmPrin fr) throws ClassNotFoundException, SQLException {
initComponents();
this.frm=fr;
this.log=new LogFuncionario();
Date d=new Date();
this.fecha.setDate(d);
//this.jScrollPane1.setVisible(false);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
tablaLic = new javax.swing.JTable();
jLabel1 = new javax.swing.JLabel();
txtCod = new org.edisoncor.gui.textField.TextFieldRound();
btnListar = new org.edisoncor.gui.button.ButtonIcon();
fecha = new com.toedter.calendar.JDateChooser();
jLabel2 = new javax.swing.JLabel();
lblMsg = new javax.swing.JLabel();
setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Calcular Licencia Individual", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Ebrima", 1, 18))); // NOI18N
setPreferredSize(new java.awt.Dimension(1000, 700));
tablaLic.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"CodFunc", "Fecha de Ingreso", "Dias Generados", "Año", "Fecha Generado", "Nombre1", "Nombre2", "Apellido1", "Apellido2"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane1.setViewportView(tablaLic);
jLabel1.setFont(new java.awt.Font("Ebrima", 1, 12)); // NOI18N
jLabel1.setText("Número de Funcionario");
txtCod.setBackground(new java.awt.Color(102, 153, 255));
txtCod.setForeground(new java.awt.Color(255, 255, 255));
txtCod.setCaretColor(new java.awt.Color(255, 255, 255));
txtCod.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
txtCod.setSelectionColor(new java.awt.Color(255, 255, 255));
txtCod.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtCodKeyTyped(evt);
}
});
btnListar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/tabla.png"))); // NOI18N
btnListar.setText("buttonIcon1");
btnListar.setToolTipText("Listar");
btnListar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnListarActionPerformed(evt);
}
});
fecha.setDateFormatString("dd/MM/yyyy");
jLabel2.setFont(new java.awt.Font("Ebrima", 1, 12)); // NOI18N
jLabel2.setText("Fecha de cálculo");
lblMsg.setFont(new java.awt.Font("Ebrima", 1, 14)); // NOI18N
lblMsg.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtCod, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(fecha, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE))
.addGap(44, 44, 44)
.addComponent(btnListar, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 857, Short.MAX_VALUE)
.addComponent(lblMsg, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(txtCod, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(fecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)))
.addGroup(layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(btnListar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addComponent(lblMsg, javax.swing.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 457, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void txtCodKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodKeyTyped
this.LimpiarTabla();
this.lblMsg.setText("");
//this.jScrollPane1.setVisible(false);
char c=evt.getKeyChar();
if(!Character.isDigit(c)) {
evt.consume();
}
if(evt.getKeyChar()==10){
this.btnListar.doClick();
}
}//GEN-LAST:event_txtCodKeyTyped
private void btnListarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnListarActionPerformed
this.LimpiarTabla();
String cod=this.txtCod.getText();
Date fecha=this.fecha.getDate();
if(cod!=""){
Integer codigo=Integer.valueOf(cod);
try {
Licencia lic=this.log.calculaLicenciaIndividual(codigo, fecha);
if(lic!=null){
this.cargarTabla(lic,fecha);
this.lblMsg.setText(lic.getFuncionario().getNomCompleto());
}
else{
this.lblMsg.setText("Este funcionario no existe");
}
} catch (ParseException ex) {
Logger.getLogger(pnlDiasLic.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger(pnlDiasLic.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
Logger.getLogger(pnlDiasLic.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_btnListarActionPerformed
private void LimpiarTabla() {
DefaultTableModel modelo=(DefaultTableModel) tablaLic.getModel();
//primero limpio todas las filas
for (int i = 0; i < tablaLic.getRowCount(); i++) {
modelo.removeRow(i);
i-=1;
}
}
private String convierteFecha(Date fecha){
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String reportDate = df.format(fecha);
// Print what date is today!
return reportDate;
}
private void cargarTabla(Licencia f, Date fecha) throws ClassNotFoundException, SQLException{
DefaultTableModel modelo = (DefaultTableModel)tablaLic.getModel();
String fech=this.convierteFecha(fecha);
this.jScrollPane1.setVisible(true);
Object[] filas=new Object[modelo.getColumnCount()];
filas[0]=f.getFuncionario().getCodFunc();
filas[1]=f.getFuncionario().getFechaIngreso();
filas[2]=f.getDiasGenerados();
filas[3]=f.getAño();
filas[4]=fech;
filas[5]=f.getFuncionario().getNombre1();
filas[6]=f.getFuncionario().getNombre2();
filas[7]=f.getFuncionario().getApellido1();
filas[8]=f.getFuncionario().getApellido2();
modelo.addRow(filas);
this.resizeColumnWidth(tablaLic);
JTableHeader th;
th = tablaLic.getTableHeader();
Font fuente = new Font("Ebrima", Font.BOLD, 14);
th.setBackground(Color.LIGHT_GRAY);
th.setFont(fuente);
}
//MANEJO TAMAÑO COLUMNAS
public void resizeColumnWidth(JTable table) {
final TableColumnModel columnModel = table.getColumnModel();
for (int column = 0; column < table.getColumnCount(); column++) {
int width = 150; // Min width
for (int row = 0; row < table.getRowCount(); row++) {
TableCellRenderer renderer = table.getCellRenderer(row, column);
Component comp = table.prepareRenderer(renderer, row, column);
width = Math.max(comp.getPreferredSize().width +1 , width);
}
if(width > 300)
width=300;
columnModel.getColumn(column).setPreferredWidth(width);
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private org.edisoncor.gui.button.ButtonIcon btnListar;
private com.toedter.calendar.JDateChooser fecha;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel lblMsg;
private javax.swing.JTable tablaLic;
private org.edisoncor.gui.textField.TextFieldRound txtCod;
// End of variables declaration//GEN-END:variables
}
| [
"pattun@DESARROLLO-03.PROYECTO.ACE"
] | pattun@DESARROLLO-03.PROYECTO.ACE |
e7acbce969287f6d633a1416f97bc4aacc8fd466 | 7fce9d9992cb57c8f0761ac0bee1005e141be021 | /lib_src/src/com/sap/spe/condmgnt/finding/ITracerAccessAttributes.java | ffdb53ca0350ca8a7a50423711f770cabbb651e6 | [] | no_license | mjj55409/cintas-pricing | 3e10cb68101858f56a1c1b2f40577a0ee5b3e0e0 | 037513a983f86cfd98a0abbe04fb448a2d1c7bea | refs/heads/master | 2020-04-02T03:28:54.953342 | 2016-06-27T19:18:34 | 2016-06-27T19:18:34 | 60,651,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | /*
Copyright (c) 2005 by SAP AG
All rights to both implementation and design are reserved.
Use and copying of this software and preparation of derivative works based
upon this software are not permitted.
Distribution of this software is restricted. SAP does not make any warranty
about the software, its performance or its conformity to any specification.
*/
package com.sap.spe.condmgnt.finding;
import java.util.Iterator;
/**
* @author d036612
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public interface ITracerAccessAttributes {
public Iterator getTraceAccessIterator();
public String getConditonRecordId();
public String getUsageSpecificData();
public Iterator getAccessAttributesIterator();
public boolean wasSuccessful();
public String getText();
}
| [
"michael@mertisconsulting.com"
] | michael@mertisconsulting.com |
84d34b8ee844803dc9e4b41749ec2ae4889a9772 | 7f9e44a5f3137f2830fb8b0c3c0dd5ea5ca39aa2 | /src/main/java/std/wlj/dan/SearchForPlaceReps.java | 09f6c4bfaccc311ee49709bfa39f342c6b9af3c7 | [] | no_license | wjohnson000/wlj-place-test | 042398f3b6f3472638e2c6d263419eb4670a5dde | d23ece28efe4f79b9f5343a75b1a85e8567d3021 | refs/heads/master | 2021-08-03T22:42:30.127330 | 2021-04-29T21:19:27 | 2021-04-29T21:19:27 | 18,767,871 | 0 | 0 | null | 2021-08-03T12:18:26 | 2014-04-14T16:30:20 | Java | UTF-8 | Java | false | false | 1,325 | java | package std.wlj.dan;
import org.familysearch.standards.place.data.PlaceRepBridge;
import org.familysearch.standards.place.data.PlaceSearchResults;
import org.familysearch.standards.place.data.SearchParameter;
import org.familysearch.standards.place.data.SearchParameters;
import org.familysearch.standards.place.data.solr.SolrService;
import org.familysearch.standards.place.exceptions.PlaceDataException;
import std.wlj.util.SolrManager;
public class SearchForPlaceReps {
public static void main(String... args) throws PlaceDataException {
SolrService solrService = SolrManager.awsProdService(false);
SearchParameters params = new SearchParameters();
params.addParam( SearchParameter.PlaceParam.createParam( 1941217 ) );
params.addParam( SearchParameter.FilterDeleteParam.createParam( true ) );
PlaceSearchResults results = solrService.search(params);
System.out.println("PlaceReps: " + results.getReturnedCount());
for (PlaceRepBridge repB : results.getResults()) {
System.out.println("PR: " + repB.getRepId() + " . " + repB.getDefaultLocale() + " . " + repB.getAllDisplayNames().get(repB.getDefaultLocale()));
System.out.println(" D: " + repB.isDeleted() + " --> " + repB.getRevision());
}
System.exit(0);
}
}
| [
"wjohnson@familysearch.org"
] | wjohnson@familysearch.org |
87b3016b97dd1a1032a0bfcefe23e6d979b4ff51 | d57d8067d2a17c6b67674ebfebd361dcab717d60 | /Design-and-Analysis-of-Algorithms/MultiGraph.java | 19ad50eebb658e24abd65692ee9a23e5f37c5cf7 | [] | no_license | aksharp95/Design-and-Analysis-of-Algorithms | 1b9d72f1578ed8262bbc2f8b5b04f62ab7c84cf6 | 1f8fdba4fa0f0bcceaa0021ffcc7862ac3a8cdd5 | refs/heads/master | 2022-04-14T19:26:34.565938 | 2020-04-09T01:03:49 | 2020-04-09T01:03:49 | 224,361,726 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,730 | java | // Question 6
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
public class MultiGraph {
private int V;
private LinkedList<Integer> [] adjacency;
private HashSet<Integer> [] answer;
MultiGraph(int V){
this.V = V;
adjacency = new LinkedList[V];
for(int i=0;i<V;i++)
adjacency[i] = new LinkedList<Integer>();
answer = new HashSet[V];
for(int i=0;i<V;i++)
answer[i] = new HashSet<>();
}
public void addEdge(int start, int end){
adjacency[start].add(end);
}
public void BFS(int s){
boolean [] visited = new boolean[V];
Queue<Integer> queue = new LinkedList<>();
visited[s] = true;
queue.add(s);
while(!queue.isEmpty()){
int element = queue.poll();
//System.out.print(element+" ");
LinkedList<Integer> childrens = adjacency[element];
for(Integer i: childrens){
if(element!=i)
answer[element].add(i);
if(!visited[i]){
queue.add(i);
visited[i]= true;
}
}
}
}
public void printAdjacencyList(){
for(int i=0;i<V;i++){
LinkedList<Integer> child = adjacency[i];
System.out.print("\nFor Node "+i+" : ");
for(Integer n: child){
System.out.print(n+" ");
}
}
}
public void printNewAdjacencyList(){
for(int i=0;i<V;i++){
HashSet<Integer> child = answer[i];
System.out.print("\nFor Node "+i+" : ");
for(Integer n: child){
System.out.print(n+" ");
}
}
}
public static void main(String[]args){
MultiGraph g = new MultiGraph(8);
g.addEdge(0,2);
g.addEdge(0,2);
g.addEdge(0,3);
g.addEdge(0,3);
g.addEdge(1,2);
g.addEdge(1,5);
g.addEdge(1,5);
g.addEdge(1,6);
g.addEdge(2,0);
g.addEdge(2,0);
g.addEdge(2,1);
g.addEdge(2,4);
g.addEdge(3,0);
g.addEdge(3,0);
g.addEdge(3,7);
g.addEdge(4,2);
g.addEdge(4,6);
g.addEdge(4,6);
g.addEdge(5,1);
g.addEdge(5,6);
g.addEdge(5,6);
g.addEdge(6,1);
g.addEdge(6,4);
g.addEdge(6,4);
g.addEdge(6,5);
g.addEdge(7,3);
g.addEdge(7,3);
System.out.println("Adjacency list before sorting");
g.printAdjacencyList();
g.BFS(0);
System.out.println("\n\nAdjacency list after sorting");
g.printNewAdjacencyList();
}
} | [
"58247141+aksharp95@users.noreply.github.com"
] | 58247141+aksharp95@users.noreply.github.com |
eed0022aa7c18132b504f9683c8c2408b0e19a59 | 23ff493b8800c3c43bb37303c7c7886bef34ba82 | /src/hpu/zyf/service/impl/ProductServiceImpl.java | 61cf11bddd3155cd1e50b861ef6cc6c4124145d9 | [] | no_license | hpulzl/snackShop | 223c381fd368ba207c4e7ea7f9cf56e2476974ff | 74566253173b4abba569bfb44c5492a9254a473f | refs/heads/master | 2021-01-01T05:29:03.445658 | 2017-04-13T06:53:34 | 2017-04-13T06:53:34 | 59,088,502 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,290 | java | package hpu.zyf.service.impl;
import hpu.zyf.entity.Discountproduct;
import hpu.zyf.entity.ProductType;
import hpu.zyf.entity.Productdetail;
import hpu.zyf.entity.ProductdetailExample;
import hpu.zyf.entity.ProductdetailExample.Criteria;
import hpu.zyf.exception.CustomException;
import hpu.zyf.mapper.DiscountproductMapper;
import hpu.zyf.mapper.ProductTypeMapper;
import hpu.zyf.mapper.ProductdetailMapper;
import hpu.zyf.service.ProductService;
import hpu.zyf.util.MyRowBounds;
import hpu.zyf.util.UUIDUtil;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 商品接口的实现类
* @author admin
*
*/
public class ProductServiceImpl implements ProductService{
//设置每页显示10条数据
public final int pageCount = 10;
//设置数据库中总记录数
public int totalCount = 0;
@Autowired
private ProductdetailMapper pdm;
@Autowired
private DiscountproductMapper dpm;
@Autowired
private ProductTypeMapper ptm;
/**
* 添加商品
*/
@Override
public boolean inserProduct(Productdetail pd) throws Exception {
if(pd==null){
throw new CustomException("插入-->商品信息不能为空");
}
pd.setPdid(UUIDUtil.getUUId());
pd.setCreatetime(new Date());
if(pdm.insert(pd)>0){
return true;
}
return false;
}
@Override
public boolean updateProduct(Productdetail pd) throws Exception {
if(pd==null){
throw new CustomException("更新--->商品信息不能为空");
}
//如果某个属性为空,你们就不用更新
if(pdm.updateByPrimaryKeySelective(pd)>0){
return true;
}
return false;
}
@Override
public boolean deleteProduct(String pdid) throws Exception {
if(pdm.deleteByPrimaryKey(pdid)>0){
dpm.deleteByPdid(pdid);
return true;
}
return false;
}
@Override
public Productdetail selectByPdid(String pdid) throws Exception {
Productdetail pd = pdm.selectByPrimaryKey(pdid);
if(pd == null){
throw new CustomException("查询的商品为空");
}
return pd;
}
@Override
public List<Productdetail> selectByPdExample(String example, int pageNo)
throws Exception {
ProductdetailExample pdExample = new ProductdetailExample();
//设置分页限制
pdExample.setRowBounds(new MyRowBounds(pageNo, pageCount));
if(example !=null){
//接下来是类别查询
Criteria critetia = pdExample.createCriteria();
critetia.andPdtypeLike("%"+example+"%");
totalCount = pdm.countByExample(pdExample);
}
//如果查询条件为空,设置为查询全部
return pdm.selectByExample(pdExample);
}
@Override
public int pageTotal(String example) throws Exception {
ProductdetailExample pdExample = new ProductdetailExample();
int total = 0;
if(example ==null || "".equals(example)){ //如果查询条件为空,设置为查询全部
total = pdm.countByExample(pdExample);
}else{
//接下来是类别查询
Criteria critetia = pdExample.createCriteria();
critetia.andPdtypeLike("%"+example+"%");
total = pdm.countByExample(pdExample);
}
return MyRowBounds.pageTotal(total, pageCount);
}
@Override
public List<ProductType> selectAllType() throws Exception {
return ptm.selectAllPtType();
}
}
| [
"824337531@qq.com"
] | 824337531@qq.com |
f623a6c3b8c23f2c79a286142e31800fe1c70d95 | 1770a422e9d78009777608357b892d8c01e9d990 | /app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/v7/cardview/R.java | 1116c892ac31ca5e481fc31fb5ffa4cc02802f7c | [] | no_license | jar00t/Inharmonia | d27fd7b69952c016ad8246b6d264bd15ec5810bb | 40210f996dfac3a136f4d1a41ae75d27092d68e5 | refs/heads/master | 2021-10-10T17:47:49.667974 | 2019-01-14T11:04:32 | 2019-01-14T11:04:32 | 158,631,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,195 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.v7.cardview;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int cardBackgroundColor = 0x7f030065;
public static final int cardCornerRadius = 0x7f030066;
public static final int cardElevation = 0x7f030067;
public static final int cardMaxElevation = 0x7f030068;
public static final int cardPreventCornerOverlap = 0x7f030069;
public static final int cardUseCompatPadding = 0x7f03006a;
public static final int cardViewStyle = 0x7f03006b;
public static final int contentPadding = 0x7f0300ab;
public static final int contentPaddingBottom = 0x7f0300ac;
public static final int contentPaddingLeft = 0x7f0300ad;
public static final int contentPaddingRight = 0x7f0300ae;
public static final int contentPaddingTop = 0x7f0300af;
}
public static final class color {
private color() {}
public static final int cardview_dark_background = 0x7f050027;
public static final int cardview_light_background = 0x7f050028;
public static final int cardview_shadow_end_color = 0x7f050029;
public static final int cardview_shadow_start_color = 0x7f05002a;
}
public static final class dimen {
private dimen() {}
public static final int cardview_compat_inset_shadow = 0x7f06004d;
public static final int cardview_default_elevation = 0x7f06004e;
public static final int cardview_default_radius = 0x7f06004f;
}
public static final class style {
private style() {}
public static final int Base_CardView = 0x7f10000e;
public static final int CardView = 0x7f1000c5;
public static final int CardView_Dark = 0x7f1000c6;
public static final int CardView_Light = 0x7f1000c7;
}
public static final class styleable {
private styleable() {}
public static final int[] CardView = { 0x101013f, 0x1010140, 0x7f030065, 0x7f030066, 0x7f030067, 0x7f030068, 0x7f030069, 0x7f03006a, 0x7f0300ab, 0x7f0300ac, 0x7f0300ad, 0x7f0300ae, 0x7f0300af };
public static final int CardView_android_minWidth = 0;
public static final int CardView_android_minHeight = 1;
public static final int CardView_cardBackgroundColor = 2;
public static final int CardView_cardCornerRadius = 3;
public static final int CardView_cardElevation = 4;
public static final int CardView_cardMaxElevation = 5;
public static final int CardView_cardPreventCornerOverlap = 6;
public static final int CardView_cardUseCompatPadding = 7;
public static final int CardView_contentPadding = 8;
public static final int CardView_contentPaddingBottom = 9;
public static final int CardView_contentPaddingLeft = 10;
public static final int CardView_contentPaddingRight = 11;
public static final int CardView_contentPaddingTop = 12;
}
}
| [
"myn.fajar@gmail.com"
] | myn.fajar@gmail.com |
cae39f1318faf45af296714a4958c6cb3cb844b0 | 2d3073bb785ea1fa630c22993f282263b5236c27 | /src/main/java/com/univ/action/FileDownload.java | 963de1ea7335219580a516b83583fb5c25394c8d | [] | no_license | jssgsy/struts2 | 4366e2c90b746e3f4b466b081823bad4598ebb44 | f57922f02f712be976743adeddba57c420cd2609 | refs/heads/master | 2021-01-10T17:45:48.614009 | 2018-11-07T06:52:54 | 2018-11-07T06:52:54 | 39,761,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 997 | java | package com.univ.action;
import java.io.InputStream;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
/**
* @author: liuml
* @date: 2015年8月28日 上午10:38:06
* @version: 1.0
* @description:
*/
public class FileDownload extends ActionSupport {
//获取下载的文件名,便于在文件下载框中显示,有且只需要有get方法
private String fileName;
public String getFileName() {
return fileName;
}
public InputStream getDownloadFile() throws Exception
{
//含有中文的文件名需要转码
this.fileName = new String("上大小伙伴.jpg".getBytes(), "ISO8859-1");
//获取资源路径
return ServletActionContext.getServletContext().getResourceAsStream("upload/上大小伙伴.jpg") ;
}
@Override
public String execute() throws Exception {
System.out.println("success");
return SUCCESS;
}
}
| [
"fcsnwu@163.com"
] | fcsnwu@163.com |
fdf0255e33b223692b5e2ff1d053c127ff74dd00 | 4365604e3579b526d473c250853548aed38ecb2a | /modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v202011/CreativeTemplateOperationErrorReason.java | b2539091a3bbddb9ddbf90cf21db8413f8cf3349 | [
"Apache-2.0"
] | permissive | lmaeda/googleads-java-lib | 6e73572b94b6dcc46926f72dd4e1a33a895dae61 | cc5b2fc8ef76082b72f021c11ff9b7e4d9326aca | refs/heads/master | 2023-08-12T19:03:46.808180 | 2021-09-28T16:48:04 | 2021-09-28T16:48:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,835 | java | // Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* CreativeTemplateOperationErrorReason.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.admanager.axis.v202011;
public class CreativeTemplateOperationErrorReason implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected CreativeTemplateOperationErrorReason(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _NOT_ALLOWED = "NOT_ALLOWED";
public static final java.lang.String _NOT_APPLICABLE = "NOT_APPLICABLE";
public static final java.lang.String _UNKNOWN = "UNKNOWN";
public static final CreativeTemplateOperationErrorReason NOT_ALLOWED = new CreativeTemplateOperationErrorReason(_NOT_ALLOWED);
public static final CreativeTemplateOperationErrorReason NOT_APPLICABLE = new CreativeTemplateOperationErrorReason(_NOT_APPLICABLE);
public static final CreativeTemplateOperationErrorReason UNKNOWN = new CreativeTemplateOperationErrorReason(_UNKNOWN);
public java.lang.String getValue() { return _value_;}
public static CreativeTemplateOperationErrorReason fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
CreativeTemplateOperationErrorReason enumeration = (CreativeTemplateOperationErrorReason)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static CreativeTemplateOperationErrorReason fromString(java.lang.String value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(CreativeTemplateOperationErrorReason.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202011", "CreativeTemplateOperationError.Reason"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}
| [
"christopherseeley@users.noreply.github.com"
] | christopherseeley@users.noreply.github.com |
1c6827329734bd6ca20db2fafe624d3c84ee946d | 8d5b60eda732ff2333c45b682c37cb54cf2bf31f | /src/main/java/mx/com/gseguros/portal/general/dao/MenuDAO.java | d7b76833fd307d3015cbe444d5c3f7adad620fed | [] | no_license | dbrandtb/gsc | aaa1bf78a149d89c51f943006eb103147a4eb5ae | cd11940a89b2a61fd017f366d7505e1495809e35 | refs/heads/master | 2021-07-05T21:37:37.232642 | 2017-09-28T15:47:41 | 2017-09-28T15:47:41 | 105,169,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 865 | java | package mx.com.gseguros.portal.general.dao;
import java.util.List;
import java.util.Map;
public interface MenuDAO {
public List<Map<String, String>> obtieneOpcionesLiga(Map params) throws Exception;
public List<Map<String, String>> obtieneMenusPorRol(Map params) throws Exception;
public List<Map<String, String>> obtieneOpcionesMenu(Map params) throws Exception;
public List<Map<String, String>> obtieneOpcionesSubMenu(Map params) throws Exception;
public String guardaOpcionLiga(Map params) throws Exception;
public String guardaMenu(Map params) throws Exception;
public String guardaOpcionMenu(Map params) throws Exception;
public String eliminaOpcionLiga(Map params) throws Exception;
public String eliminaMenu(Map params) throws Exception;
public String eliminaOpcionMenu(Map params) throws Exception;
} | [
"31972858+dbrandtb@users.noreply.github.com"
] | 31972858+dbrandtb@users.noreply.github.com |
89f7cd9ba2f24019da68beb25cf0f63b3d78fcf4 | 326b2d92e2369145df079fb9c528e2a857d2c11a | /src/java/com/felix/interview/leetcode/medium/dfs/PacificAtlanticWaterFlow.java | fe22b6b14a5022cdba8c3850890da2813e8c3b0b | [] | no_license | felixgao/interview | 1df414f21344e02219f16b1ca7966e61fe6cba77 | 0593fa2a3dff759f93a379cee34a29ab80711cc2 | refs/heads/master | 2021-01-18T16:50:11.641731 | 2019-02-05T16:59:43 | 2019-02-05T16:59:43 | 86,773,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,486 | java | package com.felix.interview.leetcode.medium.dfs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by felix on 3/18/17.
* 417
* https://leetcode.com/problems/pacific-atlantic-water-flow/#/description
* Given the following 5x5 matrix:
* <p>
* Pacific ~ ~ ~ ~ ~
* ~ 1 2 2 3 (5) *
* ~ 3 2 3 (4) (4) *
* ~ 2 4 (5) 3 1 *
* ~ (6) (7) 1 4 5 *
* ~ (5) 1 1 2 4 *
* * * * * Atlantic
* <p>
* Return:
* [[0, 4], [1, 3], [1, 4], [2, 2], [3, 0], [3, 1], [4, 0]] (positions with parentheses in above matrix).
*/
public class PacificAtlanticWaterFlow {
public List<int[]> pacificAtlantic(int[][] matrix) {
List<int[]> result = new ArrayList<>();
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix.length; j++) {
if (pacificFlow(matrix, i, j, matrix[i][j]) &&
atlanticFlow(matrix, i, j, matrix[i][j])
) {
result.add(new int[]{i, j});
}
}
}
return result;
}
private boolean pacificFlow(int[][] matrix, int row, int col, int from) {
if ((row <= 0 && col <= matrix[0].length) ||
(col <= 0 && row <= matrix.length)) {
return true;
}
if (matrix[row][col] <= from) {
return pacificFlow(matrix, row - 1, col, matrix[row][col]) ||
pacificFlow(matrix, row, col - 1, matrix[row][col]);
} else {
return false;
}
}
private boolean atlanticFlow(int[][] matrix, int row, int col, int from) {
if ((row >= matrix.length && col <= matrix[0].length) ||
(col >= matrix[0].length && row <= matrix.length)) {
return true;
}
if (matrix[row][col] <= from) {
return atlanticFlow(matrix, row + 1, col, matrix[row][col]) ||
atlanticFlow(matrix, row, col + 1, matrix[row][col]);
} else {
return false;
}
}
/*******
public List<int[]> pacificAtlantic(int[][] matrix) {
List<int[]> res = new LinkedList<>();
if (matrix == null || matrix.length == 0 || matrix[0].length == 0) {
return res;
}
int n = matrix.length, m = matrix[0].length;
boolean[][] pacific = new boolean[n][m];
boolean[][] atlantic = new boolean[n][m];
for (int i = 0; i < n; i++) {
dfs(matrix, pacific, Integer.MIN_VALUE, i, 0);
dfs(matrix, atlantic, Integer.MIN_VALUE, i, m - 1);
}
for (int i = 0; i < m; i++) {
dfs(matrix, pacific, Integer.MIN_VALUE, 0, i);
dfs(matrix, atlantic, Integer.MIN_VALUE, n - 1, i);
}
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
if (pacific[i][j] && atlantic[i][j])
res.add(new int[]{i, j});
return res;
}
int[][] dir = new int[][]{{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
public void dfs(int[][] matrix, boolean[][] visited, int height, int x, int y) {
int n = matrix.length, m = matrix[0].length;
if (x < 0 || x >= n || y < 0 || y >= m || visited[x][y] || matrix[x][y] < height)
return;
visited[x][y] = true;
for (int[] d : dir) {
dfs(matrix, visited, matrix[x][y], x + d[0], y + d[1]);
}
}
*/
}
| [
"felix@Felix-MBP.local"
] | felix@Felix-MBP.local |
6a2f13a384bbb3320d56d3ffbb142e312522fc90 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project287/src/test/java/org/gradle/test/performance/largejavamultiproject/project287/p1436/Test28721.java | a07b621dc3ba2c080bea77a007dc1a6ddea008f8 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | package org.gradle.test.performance.largejavamultiproject.project287.p1436;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test28721 {
Production28721 objectUnderTest = new Production28721();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
4fe8220c986c1aa24bde54f169821b505acd5426 | b2137dd5421e19449237b733cfe2000d1158a833 | /src/main/java/cn/sys/entity/UserExample.java | b8e19efea7d8dac6254acec75e4c421e463d1d85 | [] | no_license | zerasi/manager_sys | 959201369dc438fc50d92089857a970b37926f3b | d7d8a85149406a9697a5b7eac094ebdef09a3107 | refs/heads/master | 2022-12-24T22:51:56.854244 | 2020-04-19T10:51:50 | 2020-04-19T10:51:50 | 248,885,394 | 0 | 0 | null | 2022-12-16T07:17:11 | 2020-03-21T01:30:29 | JavaScript | UTF-8 | Java | false | false | 21,251 | java | package cn.sys.entity;
import java.util.ArrayList;
import java.util.List;
public class UserExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UserExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
*
*
* @author wcyong
*
* @date 2020-03-20
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUsernameIsNull() {
addCriterion("username is null");
return (Criteria) this;
}
public Criteria andUsernameIsNotNull() {
addCriterion("username is not null");
return (Criteria) this;
}
public Criteria andUsernameEqualTo(String value) {
addCriterion("username =", value, "username");
return (Criteria) this;
}
public Criteria andUsernameNotEqualTo(String value) {
addCriterion("username <>", value, "username");
return (Criteria) this;
}
public Criteria andUsernameGreaterThan(String value) {
addCriterion("username >", value, "username");
return (Criteria) this;
}
public Criteria andUsernameGreaterThanOrEqualTo(String value) {
addCriterion("username >=", value, "username");
return (Criteria) this;
}
public Criteria andUsernameLessThan(String value) {
addCriterion("username <", value, "username");
return (Criteria) this;
}
public Criteria andUsernameLessThanOrEqualTo(String value) {
addCriterion("username <=", value, "username");
return (Criteria) this;
}
public Criteria andUsernameLike(String value) {
addCriterion("username like", value, "username");
return (Criteria) this;
}
public Criteria andUsernameNotLike(String value) {
addCriterion("username not like", value, "username");
return (Criteria) this;
}
public Criteria andUsernameIn(List<String> values) {
addCriterion("username in", values, "username");
return (Criteria) this;
}
public Criteria andUsernameNotIn(List<String> values) {
addCriterion("username not in", values, "username");
return (Criteria) this;
}
public Criteria andUsernameBetween(String value1, String value2) {
addCriterion("username between", value1, value2, "username");
return (Criteria) this;
}
public Criteria andUsernameNotBetween(String value1, String value2) {
addCriterion("username not between", value1, value2, "username");
return (Criteria) this;
}
public Criteria andAdresIsNull() {
addCriterion("adres is null");
return (Criteria) this;
}
public Criteria andAdresIsNotNull() {
addCriterion("adres is not null");
return (Criteria) this;
}
public Criteria andAdresEqualTo(String value) {
addCriterion("adres =", value, "adres");
return (Criteria) this;
}
public Criteria andAdresNotEqualTo(String value) {
addCriterion("adres <>", value, "adres");
return (Criteria) this;
}
public Criteria andAdresGreaterThan(String value) {
addCriterion("adres >", value, "adres");
return (Criteria) this;
}
public Criteria andAdresGreaterThanOrEqualTo(String value) {
addCriterion("adres >=", value, "adres");
return (Criteria) this;
}
public Criteria andAdresLessThan(String value) {
addCriterion("adres <", value, "adres");
return (Criteria) this;
}
public Criteria andAdresLessThanOrEqualTo(String value) {
addCriterion("adres <=", value, "adres");
return (Criteria) this;
}
public Criteria andAdresLike(String value) {
addCriterion("adres like", value, "adres");
return (Criteria) this;
}
public Criteria andAdresNotLike(String value) {
addCriterion("adres not like", value, "adres");
return (Criteria) this;
}
public Criteria andAdresIn(List<String> values) {
addCriterion("adres in", values, "adres");
return (Criteria) this;
}
public Criteria andAdresNotIn(List<String> values) {
addCriterion("adres not in", values, "adres");
return (Criteria) this;
}
public Criteria andAdresBetween(String value1, String value2) {
addCriterion("adres between", value1, value2, "adres");
return (Criteria) this;
}
public Criteria andAdresNotBetween(String value1, String value2) {
addCriterion("adres not between", value1, value2, "adres");
return (Criteria) this;
}
public Criteria andLink_personIsNull() {
addCriterion("link_person is null");
return (Criteria) this;
}
public Criteria andLink_personIsNotNull() {
addCriterion("link_person is not null");
return (Criteria) this;
}
public Criteria andLink_personEqualTo(String value) {
addCriterion("link_person =", value, "link_person");
return (Criteria) this;
}
public Criteria andLink_personNotEqualTo(String value) {
addCriterion("link_person <>", value, "link_person");
return (Criteria) this;
}
public Criteria andLink_personGreaterThan(String value) {
addCriterion("link_person >", value, "link_person");
return (Criteria) this;
}
public Criteria andLink_personGreaterThanOrEqualTo(String value) {
addCriterion("link_person >=", value, "link_person");
return (Criteria) this;
}
public Criteria andLink_personLessThan(String value) {
addCriterion("link_person <", value, "link_person");
return (Criteria) this;
}
public Criteria andLink_personLessThanOrEqualTo(String value) {
addCriterion("link_person <=", value, "link_person");
return (Criteria) this;
}
public Criteria andLink_personLike(String value) {
addCriterion("link_person like", value, "link_person");
return (Criteria) this;
}
public Criteria andLink_personNotLike(String value) {
addCriterion("link_person not like", value, "link_person");
return (Criteria) this;
}
public Criteria andLink_personIn(List<String> values) {
addCriterion("link_person in", values, "link_person");
return (Criteria) this;
}
public Criteria andLink_personNotIn(List<String> values) {
addCriterion("link_person not in", values, "link_person");
return (Criteria) this;
}
public Criteria andLink_personBetween(String value1, String value2) {
addCriterion("link_person between", value1, value2, "link_person");
return (Criteria) this;
}
public Criteria andLink_personNotBetween(String value1, String value2) {
addCriterion("link_person not between", value1, value2, "link_person");
return (Criteria) this;
}
public Criteria andRealnameIsNull() {
addCriterion("realname is null");
return (Criteria) this;
}
public Criteria andRealnameIsNotNull() {
addCriterion("realname is not null");
return (Criteria) this;
}
public Criteria andRealnameEqualTo(String value) {
addCriterion("realname =", value, "realname");
return (Criteria) this;
}
public Criteria andRealnameNotEqualTo(String value) {
addCriterion("realname <>", value, "realname");
return (Criteria) this;
}
public Criteria andRealnameGreaterThan(String value) {
addCriterion("realname >", value, "realname");
return (Criteria) this;
}
public Criteria andRealnameGreaterThanOrEqualTo(String value) {
addCriterion("realname >=", value, "realname");
return (Criteria) this;
}
public Criteria andRealnameLessThan(String value) {
addCriterion("realname <", value, "realname");
return (Criteria) this;
}
public Criteria andRealnameLessThanOrEqualTo(String value) {
addCriterion("realname <=", value, "realname");
return (Criteria) this;
}
public Criteria andRealnameLike(String value) {
addCriterion("realname like", value, "realname");
return (Criteria) this;
}
public Criteria andRealnameNotLike(String value) {
addCriterion("realname not like", value, "realname");
return (Criteria) this;
}
public Criteria andRealnameIn(List<String> values) {
addCriterion("realname in", values, "realname");
return (Criteria) this;
}
public Criteria andRealnameNotIn(List<String> values) {
addCriterion("realname not in", values, "realname");
return (Criteria) this;
}
public Criteria andRealnameBetween(String value1, String value2) {
addCriterion("realname between", value1, value2, "realname");
return (Criteria) this;
}
public Criteria andRealnameNotBetween(String value1, String value2) {
addCriterion("realname not between", value1, value2, "realname");
return (Criteria) this;
}
public Criteria andAccNbrIsNull() {
addCriterion("accNbr is null");
return (Criteria) this;
}
public Criteria andAccNbrIsNotNull() {
addCriterion("accNbr is not null");
return (Criteria) this;
}
public Criteria andAccNbrEqualTo(String value) {
addCriterion("accNbr =", value, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrNotEqualTo(String value) {
addCriterion("accNbr <>", value, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrGreaterThan(String value) {
addCriterion("accNbr >", value, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrGreaterThanOrEqualTo(String value) {
addCriterion("accNbr >=", value, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrLessThan(String value) {
addCriterion("accNbr <", value, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrLessThanOrEqualTo(String value) {
addCriterion("accNbr <=", value, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrLike(String value) {
addCriterion("accNbr like", value, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrNotLike(String value) {
addCriterion("accNbr not like", value, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrIn(List<String> values) {
addCriterion("accNbr in", values, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrNotIn(List<String> values) {
addCriterion("accNbr not in", values, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrBetween(String value1, String value2) {
addCriterion("accNbr between", value1, value2, "accNbr");
return (Criteria) this;
}
public Criteria andAccNbrNotBetween(String value1, String value2) {
addCriterion("accNbr not between", value1, value2, "accNbr");
return (Criteria) this;
}
public Criteria andEmailIsNull() {
addCriterion("email is null");
return (Criteria) this;
}
public Criteria andEmailIsNotNull() {
addCriterion("email is not null");
return (Criteria) this;
}
public Criteria andEmailEqualTo(String value) {
addCriterion("email =", value, "email");
return (Criteria) this;
}
public Criteria andEmailNotEqualTo(String value) {
addCriterion("email <>", value, "email");
return (Criteria) this;
}
public Criteria andEmailGreaterThan(String value) {
addCriterion("email >", value, "email");
return (Criteria) this;
}
public Criteria andEmailGreaterThanOrEqualTo(String value) {
addCriterion("email >=", value, "email");
return (Criteria) this;
}
public Criteria andEmailLessThan(String value) {
addCriterion("email <", value, "email");
return (Criteria) this;
}
public Criteria andEmailLessThanOrEqualTo(String value) {
addCriterion("email <=", value, "email");
return (Criteria) this;
}
public Criteria andEmailLike(String value) {
addCriterion("email like", value, "email");
return (Criteria) this;
}
public Criteria andEmailNotLike(String value) {
addCriterion("email not like", value, "email");
return (Criteria) this;
}
public Criteria andEmailIn(List<String> values) {
addCriterion("email in", values, "email");
return (Criteria) this;
}
public Criteria andEmailNotIn(List<String> values) {
addCriterion("email not in", values, "email");
return (Criteria) this;
}
public Criteria andEmailBetween(String value1, String value2) {
addCriterion("email between", value1, value2, "email");
return (Criteria) this;
}
public Criteria andEmailNotBetween(String value1, String value2) {
addCriterion("email not between", value1, value2, "email");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
*
*
* @author wcyong
*
* @date 2020-03-20
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"zerasi@163.com"
] | zerasi@163.com |
6b400717674907d607e5cd5fe0edbaa671de549c | 7d1df492699a1d2e5e1ab0fdb91e92ef1c3b41b8 | /distr_manage/src/com/xwtech/uomp/base/dao/business/BusinessExattrDzMapper.java | 873efdd7a57f3ff3816acfb3a373f736662a949e | [] | no_license | 5391667/xwtec | ab492d6eeb4c00a2fac74ba0adc965932a4e4c5f | ca6c4f0011d5b1dbbfaa19468e5b5989c308496d | refs/heads/master | 2020-05-31T16:06:18.102976 | 2014-04-30T08:39:05 | 2014-04-30T08:39:05 | 190,374,043 | 0 | 0 | null | 2019-06-05T10:21:40 | 2019-06-05T10:21:40 | null | UTF-8 | Java | false | false | 523 | java | package com.xwtech.uomp.base.dao.business;
import java.util.List;
import com.xwtech.uomp.base.pojo.business.BusinessExattrDzBean;
/**
*
* This class is used for ...
* @author zhangel
* @version
* 1.0, 2013-11-6 下午02:53:06
*/
public interface BusinessExattrDzMapper {
List<BusinessExattrDzBean> queryBusiExtraDzByAttrKey(String attrKey);
void deleteBusiExtraDzByAttrKey(String attrKey);
void insert(BusinessExattrDzBean businessExattrDzBean);
void deleteByBusiNum(String busiNum);
} | [
"redtroyzhang@gmail.com"
] | redtroyzhang@gmail.com |
23776939c71159c5639be502cdffb64dfb8722f2 | 6fa09a2331910a8fb54a8c654da641638bf3d1c0 | /bbstats-backend/src/test/java/at/basketballsalzburg/bbstats/services/impl/AgeGroupServiceTest.java | 11a6f5fea3d51ba6c0649c56418962434877710a | [] | no_license | martinschneider/bbstats | 0f08ec4ba58c84b54134772a3c6f2c6629636bf2 | 61aa1d669af1e26e0daad91a15f56c5426f33e33 | refs/heads/master | 2021-01-20T04:58:36.946427 | 2017-03-03T22:43:14 | 2017-03-03T22:43:14 | 83,848,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,497 | java | package at.basketballsalzburg.bbstats.services.impl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;
import org.testng.annotations.Test;
import at.basketballsalzburg.bbstats.dto.AgeGroupDTO;
import at.basketballsalzburg.bbstats.services.AgeGroupService;
@ContextConfiguration("classpath:META-INF/db-test.xml")
@Transactional
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
public class AgeGroupServiceTest extends
AbstractTransactionalTestNGSpringContextTests
{
private static final String AGEGROUP_NAME = "test";
@Autowired
private AgeGroupService ageGroupService;
@Test
public void addAgeGroup()
{
int size = ageGroupService.findAll().size();
AgeGroupDTO ageGroup = new AgeGroupDTO();
ageGroup.setName(AGEGROUP_NAME);
ageGroupService.save(ageGroup);
assertEquals(size + 1, ageGroupService.findAll().size());
ageGroup = ageGroupService.findByName(AGEGROUP_NAME);
assertNotNull(ageGroup);
assertEquals(ageGroup.getName(), AGEGROUP_NAME);
}
}
| [
"mart.schneider@gmail.com"
] | mart.schneider@gmail.com |
57bee2a8a0de6a427e08940607bce9097aa9b76f | 73f1645de3ab5472ea2a22d13e5f3e66a7737bc4 | /src/com/hung/controller/giaovien/ExportThiLaiController.java | 4a32becdf5eb14e7a129eae5adc26f8853722ece | [] | no_license | HaTrongHoang/QuanLyDiem | 6451e5faef9a3996eebc5a539c1cef4e3a536141 | e48e56200cce28b5e0545d0d60f974729b68a426 | refs/heads/master | 2023-06-06T16:54:19.571388 | 2021-06-21T02:47:27 | 2021-06-21T02:47:27 | 323,518,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,833 | java | package com.hung.controller.giaovien;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import com.hung.Dao.DiemDao;
import com.hung.Dao.MonDao;
import com.hung.Dao.Impl.DiemDaoImpl;
import com.hung.Dao.Impl.MonDaoImpl;
import com.hung.model.Diem;
import com.hung.model.Mon;
@WebServlet(urlPatterns = "/giaovien/exportThiLai")
public class ExportThiLaiController extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
int id_mon = Integer.parseInt(req.getParameter("id_mon"));
DiemDao diemDao = new DiemDaoImpl();
List<Diem> listDiem = diemDao.getThiLai(id_mon);
MonDao mondao=new MonDaoImpl();
Mon mon=mondao.getMonId(id_mon);
String url = "E:\\Java\\QuanLyDiem\\WebContent\\upload\\file\\";
// ghi file
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("Diem");
Font font = sheet.getWorkbook().createFont();
font.setFontName("Times New Roman");
font.setBold(true);
font.setFontHeightInPoints((short) 14);
CellStyle cellStyle = sheet.getWorkbook().createCellStyle();
cellStyle.setFont(font);
int rownum = 3;
Cell cell;
Row row;
row = sheet.createRow(0);
cell = row.createCell(0, CellType.STRING);
cell.setCellStyle(cellStyle);
cell.setCellValue("Danh sách thi lại");
row = sheet.createRow(1);
cell = row.createCell(0, CellType.STRING);
cell.setCellStyle(cellStyle);
cell.setCellValue("Môn:"+mon.getTenmon());
//
row = sheet.createRow(2);
// msc
cell = row.createCell(0, CellType.STRING);
cell.setCellValue("MSV");
// hoten
cell = row.createCell(1, CellType.STRING);
cell.setCellValue("Họ tên");
// lop
cell = row.createCell(2, CellType.STRING);
cell.setCellValue("Lớp");
// chuyencan
cell = row.createCell(3, CellType.STRING);
cell.setCellValue("Chuyên cần");
// kta gk
cell = row.createCell(4, CellType.STRING);
cell.setCellValue("Kiểm tra GK");
// ket thuc 1
cell = row.createCell(5, CellType.STRING);
cell.setCellValue("Kết thúc lần 1");
// ket thuc 2
cell = row.createCell(6, CellType.STRING);
cell.setCellValue("Kết thúc lần 2");
// tong ket
cell = row.createCell(7, CellType.STRING);
cell.setCellValue("Tổng kết");
// danh gia
cell = row.createCell(8, CellType.STRING);
cell.setCellValue("Đánh giá");
// điểm chữ
cell = row.createCell(9, CellType.STRING);
cell.setCellValue("Điểm chữ");
for (Diem diem : listDiem) {
rownum++;
row = sheet.createRow(rownum);
cell = row.createCell(0, CellType.STRING);
cell.setCellValue(diem.getSinhvien().getMsv());
cell = row.createCell(1, CellType.STRING);
cell.setCellValue(diem.getSinhvien().getHoten());
cell = row.createCell(2, CellType.STRING);
cell.setCellValue(diem.getSinhvien().getLop().getTenlop());
cell = row.createCell(3, CellType.NUMERIC);
cell.setCellValue(diem.getChuyencan());
cell = row.createCell(4, CellType.NUMERIC);
cell.setCellValue(diem.getKiemtragk());
cell = row.createCell(5, CellType.NUMERIC);
cell.setCellValue(diem.getKetthuc1());
cell = row.createCell(6, CellType.NUMERIC);
cell.setCellValue(diem.getKetthuc2());
cell = row.createCell(7, CellType.NUMERIC);
cell.setCellValue(diem.getTongket());
cell = row.createCell(8, CellType.STRING);
cell.setCellValue(diem.getDanhgia());
cell = row.createCell(9, CellType.STRING);
cell.setCellValue(diem.getDiemchu());
}
File file = new File(url);
if (!file.exists()) {
file.mkdir();
}
File f = File.createTempFile("thilai", ".xlsx", file);
FileOutputStream outFile = new FileOutputStream(f);
workbook.write(outFile);
File input = f.getAbsoluteFile();
FileInputStream is = new FileInputStream(input);
resp.setContentType("application/vnd.ms-excel");
byte[] bytes = new byte[1024];
int bytesRead;
while ((bytesRead = is.read(bytes)) != -1) {
resp.getOutputStream().write(bytes, 0, bytesRead);
}
is.close();
File[] fileList = file.listFiles();
for (File fileD : fileList) {
fileD.delete();
System.out.println(fileD.getName());
}
}
}
| [
"tronghoang98lt@gmail.com"
] | tronghoang98lt@gmail.com |
0ffc1b8be179eeecff53cf37b8adf6705f26f6e3 | 56e87f1d1ea499318c5fcdb4594f0efd9cfceebb | /repository/src/main/java/oasis/names/tc/emergency/EDXL/TEP/_1/SpecialClassificationDefaultValues.java | 8ebb1290b8e5dedab6e832954fb3aae8c081a415 | [] | no_license | vergetid/impress | 7da9353b65bc324bb58c6694747925ab92bac104 | dd207cabeff4af8449245d96d276ceb7a71ba14d | refs/heads/master | 2020-05-21T12:34:54.412796 | 2017-06-20T13:28:14 | 2017-06-20T13:28:14 | 55,222,896 | 0 | 0 | null | 2017-03-31T13:00:22 | 2016-04-01T10:06:44 | Java | UTF-8 | Java | false | false | 1,842 | 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: 2016.04.01 at 06:03:54 PM EEST
//
package oasis.names.tc.emergency.EDXL.TEP._1;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for SpecialClassificationDefaultValues.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="SpecialClassificationDefaultValues">
* <restriction base="{urn:oasis:names:tc:emergency:edxl:ct:1.0}EDXLStringType">
* <enumeration value="SecuritySupervisionNeeds"/>
* <enumeration value="NDMSPatient"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "SpecialClassificationDefaultValues", namespace = "urn:oasis:names:tc:emergency:EDXL:TEP:1.0")
@XmlEnum
public enum SpecialClassificationDefaultValues {
@XmlEnumValue("SecuritySupervisionNeeds")
SECURITY_SUPERVISION_NEEDS("SecuritySupervisionNeeds"),
@XmlEnumValue("NDMSPatient")
NDMS_PATIENT("NDMSPatient");
private final String value;
SpecialClassificationDefaultValues(String v) {
value = v;
}
public String value() {
return value;
}
public static SpecialClassificationDefaultValues fromValue(String v) {
for (SpecialClassificationDefaultValues c: SpecialClassificationDefaultValues.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"vergetid@ubitech.eu"
] | vergetid@ubitech.eu |
2c8dd74e90336eedaffc722b0b55fd8f8447809b | 859fd744f586b6ee2c5631c028478840fd49fdb4 | /src/main/java/com/awb/controller/ShareConttroller.java | 098434f776beaf8ef301911a9b3515b605bd12ec | [] | no_license | itachihq/awb | 0d02ec5742400bde5a13f53263bf26a635f47253 | e7e2176364439faa5fd016249f91ed77b060c422 | refs/heads/master | 2022-07-12T20:10:51.989289 | 2019-11-26T02:51:26 | 2019-11-26T02:51:26 | 210,282,242 | 0 | 0 | null | 2022-06-29T17:48:16 | 2019-09-23T06:39:44 | Java | UTF-8 | Java | false | false | 3,351 | java | package com.awb.controller;
import com.awb.entity.param.ShoporderParam;
import com.awb.entity.vo.Result;
import com.awb.service.LoginService;
import com.awb.service.OtherService;
import com.awb.service.UserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by Administrator on 2019/10/21.
*/
@RestController
@RequestMapping("/other")
public class ShareConttroller {
@Autowired
private LoginService loginService ;
@Autowired
private UserService userService;
@Autowired
private OtherService otherService;
@ApiOperation(value = "分享注册", httpMethod = "POST", response = Result.class,notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "phone", value = "用户名", required = true, paramType = "form"),
@ApiImplicitParam(name = "tgm", value = "推广码", required = true, paramType = "form"),
// @ApiImplicitParam(name = "name", value = "姓名", required = false, paramType = "form")
})
// @ApiImplicitParam(name = "code", value = "验证码", required = true, paramType = "form"),
@PostMapping("/sharegist")
public Result regist(String phone ,String name,String code,String tgm){
if (StringUtils.isEmpty(phone)){
throw new RuntimeException("用户名为空");
}
if (StringUtils.isEmpty(tgm)){
throw new RuntimeException("推广码为空");
}
if (StringUtils.isEmpty(code)){
throw new RuntimeException("验证码为空");
}
loginService.shareRegist(phone,name,tgm,code);
return new Result("注册成功");
}
@RequestMapping("/selectuser")
public Result selectByPhone(String phone){
Result result=new Result();
if (StringUtils.isEmpty(phone)){
throw new RuntimeException("手机号为空");
}
result.setData(userService.selectOneUser(phone));
return result;
}
@RequestMapping("/updateuser")
public Result updateUser(String id){
if (StringUtils.isEmpty(id)){
throw new RuntimeException("参数错误");
}
userService.update(id);
return new Result("更新成功");
}
@RequestMapping("/insertorder")
public Result insertorder(String phone, Integer num, String address, String handPhone, String shopid,String name){
if (StringUtils.isEmpty(phone)||StringUtils.isEmpty(address)||StringUtils.isEmpty(handPhone)||StringUtils.isEmpty(shopid)){
throw new RuntimeException("参数错误");
}
if(null==num||num<=0){
throw new RuntimeException("参数错误");
}
otherService.insertShoporderHand(phone,num,address,handPhone,shopid,name);
return new Result("下单成功");
}
// @RequestMapping("/registtest")
// public Result list(String id){
//
// loginService.registTest();
// return new Result("更新成功");
// }
}
| [
"425095103@qq.com"
] | 425095103@qq.com |
f607d89bba2f4b86927fc65d7df0111d535028a7 | 725c08af771bbbb431ade39f2e0af98415befe0e | /android/app/src/main/java/com/nda/MainActivity.java | 4657a25884ea0a2aa605128fa1ac2f99e3bd3b2d | [] | no_license | FlyingPollo12/NDAapp | b3df37430125e203a6b1c8903efac45a00ee2b85 | 49b457c0f8694b3fad7df39554d50c9e0f7ab6c0 | refs/heads/master | 2023-03-26T00:20:02.483951 | 2021-03-20T16:30:19 | 2021-03-20T16:30:19 | 309,541,750 | 0 | 0 | null | 2020-12-23T19:07:17 | 2020-11-03T01:42:13 | Java | UTF-8 | Java | false | false | 333 | java | package com.nda;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "NDA";
}
}
| [
"tylersobacki12@gmail.com"
] | tylersobacki12@gmail.com |
d4c5a0fea51fa3d9199c0a0ce83e59197671ad1c | d819e5c4a020fc2c7027d2cf1d527e3e7d1b164b | /src/main/java/com/nsf/traqtion/business/config/ClientConfigManagerImpl.java | 9c0ab9d2317a323775a875da7cec9c1ca317e771 | [] | no_license | btirumalesh/traqtest | 66970a4e84536ce712712b961f61c736d22edf03 | 22693b1226e29a056ae81ddd57796481e3635e7c | refs/heads/master | 2020-06-28T13:37:19.825426 | 2016-09-06T16:58:47 | 2016-09-06T16:58:47 | 67,522,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,884 | java | package com.nsf.traqtion.business.config;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nsf.traqtion.data.dao.ClientConfigurationDao;
import com.nsf.traqtion.data.entity.ClientBusiness;
import com.nsf.traqtion.data.entity.ClientCategory;
import com.nsf.traqtion.data.entity.ClientSite;
import com.nsf.traqtion.data.entity.CompanyType;
import com.nsf.traqtion.data.entity.JobTitle;
import com.nsf.traqtion.data.entity.Language;
import com.nsf.traqtion.data.entity.Role;
import com.nsf.traqtion.data.entity.SecurityQuestion;
import com.nsf.traqtion.data.entity.ServiceProvider;
import com.nsf.traqtion.data.entity.ServiceProviderType;
import com.nsf.traqtion.data.entity.Supplier;
import com.nsf.traqtion.data.entity.SupplierSite;
import com.nsf.traqtion.model.common.LookupDTO;
import com.nsf.traqtion.model.usermgmt.SecurityQuestionsDTO;
import com.nsf.traqtion.util.NSFCommon;
@Service("clientConfigBusiness")
public class ClientConfigManagerImpl implements ClientConfigManager {
private static final Logger log = LogManager.getLogger(ClientConfigManagerImpl.class);
@Autowired
private ClientConfigurationDao clientConfigDao;
/**
* getServiceTypesByServiceProviderId method fetches list of service
* provider type detail records and maps DTO objects from entity objects.
*
* @param servProviderId
* @return List<LookUpDTO>
*/
public List<LookupDTO> getServiceTypesByServiceProviderId(BigInteger servProviderId) {
log.info(":: getServiceTypesByServiceProviderId");
List<LookupDTO> lookUpDtoList = new ArrayList<LookupDTO>();
List<ServiceProviderType> srvPrvdrTypeList = clientConfigDao.getServiceTypesByServiceProviderId(servProviderId);
for (ServiceProviderType srvPrdType : srvPrvdrTypeList) {
LookupDTO lookUpDTO = new LookupDTO();
lookUpDTO.setId(srvPrdType.getServiceProviderTypeId().longValue());
lookUpDTO.setCode(srvPrdType.getCode());
lookUpDTO.setDescription(srvPrdType.getDescription());
lookUpDtoList.add(lookUpDTO);
}
// List<Ser> lookUpDtoList=
// clientConfigDao.getServiceTypesByServiceProviderId(servProviderId);
return lookUpDtoList;
}
/**
* getServiceTypesByServiceProviderId method fetches list of service
* provider names and maps DTO objects from entity objects.
*
* @param clientId
* @return List<LookUpDTO>
*/
public List<LookupDTO> getServiceProviderNamesByClientId(BigInteger clientId) {
log.info(":: getServiceProviderNamesByClientId");
List<LookupDTO> lookUpDtoList = new ArrayList<LookupDTO>();
List<ServiceProvider> srvPrvdrTypeList = clientConfigDao.getServiceProviderNamesByClientId(clientId);
for (ServiceProvider srvPrvdr : srvPrvdrTypeList) {
LookupDTO lookUpDTO = new LookupDTO();
lookUpDTO.setId(srvPrvdr.getServiceProvidersId());
lookUpDTO.setCode(srvPrvdr.getServiceProviderCode());
lookUpDTO.setName(srvPrvdr.getCompanyName());
// lookUpDTO.setDescription(srvPrvdr.getDescription());
lookUpDtoList.add(lookUpDTO);
}
return lookUpDtoList;
}
/**
* getSupplierNamesByClientId method fetches list of suppliers and maps DTO
* objects from entity objects.
*
* @param clientId
* @return List<LookUpDTO>
*/
public List<LookupDTO> getSupplierNamesByClientId(BigInteger clientId) {
log.info(":: getSupplierNamesByClientId");
List<LookupDTO> lookUpDtoList = new ArrayList<LookupDTO>();
List<Supplier> suplyrList = clientConfigDao.getSupplierNamesByClientId(clientId);
for (Supplier suplyr : suplyrList) {
LookupDTO lookUpDTO = new LookupDTO();
lookUpDTO.setId(suplyr.getSupplierId());
lookUpDTO.setCode(suplyr.getNsfSupplierCode());
lookUpDTO.setName(suplyr.getSupplierName());
// lookUpDTO.setDescription(suplyr.getDescription());
lookUpDtoList.add(lookUpDTO);
}
return lookUpDtoList;
}
@Override
public List<LookupDTO> geCompanyType() {
log.info(" :: getCompanyTypes");
List<CompanyType> userEntityList = (List<CompanyType>) clientConfigDao.geCompanyType();
List<LookupDTO> lookupDTOList = new ArrayList<LookupDTO>();
if (userEntityList != null) {
LookupDTO dto = null;
for (CompanyType cmpType : userEntityList) {
dto = new LookupDTO();
dto.setCode(cmpType.getCode());
dto.setDescription(cmpType.getDescription());
dto.setId(cmpType.getCompanyTypeId());
lookupDTOList.add(dto);
}
}
return lookupDTOList;
}
@Override
public List<LookupDTO> geRoleList(Integer clientId) {
log.info(" :: geRoleList");
List<Role> userEntityList = (List<Role>) clientConfigDao.geRoleList(clientId);
List<LookupDTO> lookupDTOList = new ArrayList<LookupDTO>();
if (userEntityList != null) {
LookupDTO dto = null;
for (Role cmpType : userEntityList) {
dto = new LookupDTO();
dto.setDescription(cmpType.getRoleDesctiption());
dto.setName(cmpType.getRoleName());
dto.setId(cmpType.getRoleId());
/*
* dto.setId(cmpType.getRoleId());
* dto.setName(cmpType.getRoleName());
*/
lookupDTOList.add(dto);
}
}
return lookupDTOList;
}
@Override
public List<LookupDTO> getCategoryList(Integer clientId) {
log.info(" :: getCategoryList");
List<ClientCategory> userEntityList = (List<ClientCategory>) clientConfigDao.getCategoryList(clientId);
List<LookupDTO> lookupDTOList = new ArrayList<LookupDTO>();
if (userEntityList != null) {
LookupDTO dto = null;
for (ClientCategory cmpType : userEntityList) {
dto = new LookupDTO();
// dto.setId(cmpType.getCategory_Id());
dto.setId(cmpType.getClientCategoryId());
dto.setName(cmpType.getCategoryName());
dto.setDescription(cmpType.getDescription());
lookupDTOList.add(dto);
}
}
return lookupDTOList;
}
/**
* getFacilitiesBySupplierTypeId method fetches list of service provider
* type detail records and maps DTO objects from entity objects.
*
* @param servProviderId
* @return List<LookUpDTO>
*/
@Override
public List<LookupDTO> getFacilitiesBySupplierTypeId(BigInteger suplirTypeId) {
log.info(" :: getFacilitiesBySupplierTypeId");
List<SupplierSite> splirEntityList = clientConfigDao.getFacilitiesBySupplierTypeId(suplirTypeId);
List<LookupDTO> lookupDTOList = new ArrayList<LookupDTO>();
LookupDTO dto = null;
for (SupplierSite supirSite : splirEntityList) {
dto = new LookupDTO();
// dto.setId(cmpType.getCategory_Id());
dto.setId(supirSite.getSupplierSitesId());
dto.setName(supirSite.getSiteName());
// dto.setDescription(supirSite.getDescription());
dto.setCode(supirSite.getSiteCode());
lookupDTOList.add(dto);
}
return lookupDTOList;
}
/**
* getJobTitleOptionsByClientId method fetches list of job title records and
* maps DTO objects from entity objects.
*
* @param servProviderId
* @return List<LookUpDTO>
*/
@Override
public List<LookupDTO> getJobTitleOptionsByClientId(BigInteger clientId) {
log.info(" :: getJobTitleOptionsByClientId");
List<JobTitle> jobTitleList = (List<JobTitle>) clientConfigDao.getJobTitleOptionsByClientId(clientId);
List<LookupDTO> lookupDTOList = new ArrayList<LookupDTO>();
LookupDTO dto = null;
for (JobTitle jobTitle : jobTitleList) {
dto = new LookupDTO();
dto.setId(jobTitle.getJobTitleId());
dto.setName(jobTitle.getJobName());
dto.setDescription(jobTitle.getDescription());
lookupDTOList.add(dto);
}
return lookupDTOList;
}
/**
* getLanguageOptionsByClientId method fetches list of language records and
* maps DTO objects from entity objects.
*
* @param clientId
* @return List<LookUpDTO>
*/
@Override
public List<LookupDTO> getLanguageOptionsByClientId(BigInteger clientId) {
log.info(" :: getLanguageOptionsByClientId");
List<Language> jobTitleList = (List<Language>) clientConfigDao.getLanguageOptionsByClientId(clientId);
List<LookupDTO> trqLangLookupList = new ArrayList<LookupDTO>();
LookupDTO dto = null;
for (Language jobTitle : jobTitleList) {
dto = new LookupDTO();
// dto.setId(cmpType.getCategory_Id());
dto.setId(jobTitle.getLanguagesId());
dto.setName(jobTitle.getLanguageName());
// dto.setDescription(jobTitle.getDescription());
dto.setCode(jobTitle.getLanguageCode());
trqLangLookupList.add(dto);
}
return trqLangLookupList;
}
/**
* getSecurityQuestions method returns All security Questions list .
*
* @param
* @return List<SecurityQuestionsDTO>
*/
public List<SecurityQuestionsDTO> getSecurityQuestions() {
List<SecurityQuestion> questionList = clientConfigDao.getSecurityQuestions();
List<SecurityQuestionsDTO> securityQuestionsDtoList = null;
// mapping from Entiry to DTO
if (questionList != null) {
securityQuestionsDtoList = new ArrayList<SecurityQuestionsDTO>();
for (SecurityQuestion sq : questionList) {
SecurityQuestionsDTO securityQuestionsDto = new SecurityQuestionsDTO();
securityQuestionsDto.setSecurityQuestionId(sq.getSecurityQuestionId());
securityQuestionsDto.setQuestionCode(sq.getQuestionCode());
securityQuestionsDto.setQuestion(sq.getQuestionName());
securityQuestionsDtoList.add(securityQuestionsDto);
}
}
return securityQuestionsDtoList;
}
@Override
public List<LookupDTO> getSitesByClientId(BigInteger clientId) {
log.info(" :: getSitesByClientId");
List<ClientSite> jobTitleList = (List<ClientSite>) clientConfigDao.getSitesByClientId(clientId);
List<LookupDTO> trqSiteLookupList = new ArrayList<LookupDTO>();
LookupDTO dto = null;
for (ClientSite jobTitle : jobTitleList) {
dto = new LookupDTO();
dto.setId(jobTitle.getClientSitesId());
dto.setCode(jobTitle.getSiteCode());
dto.setName(jobTitle.getSiteName());
trqSiteLookupList.add(dto);
}
return trqSiteLookupList;
}
@Override
public List<LookupDTO> getSupplierBySupplierId(BigInteger supplierId) {
log.info(" :: getSitesByClientId");
List<SupplierSite> jobTitleList = (List<SupplierSite>) clientConfigDao.getSupplierBySupplierId(supplierId);
List<LookupDTO> trqSiteLookupList = new ArrayList<LookupDTO>();
LookupDTO dto = null;
for (SupplierSite jobTitle : jobTitleList) {
dto = new LookupDTO();
dto.setId(jobTitle.getSupplierSitesId());
dto.setCode(jobTitle.getSiteCode());
dto.setName(jobTitle.getSiteName());
trqSiteLookupList.add(dto);
}
return trqSiteLookupList;
}
/**
* getCategoryOptionsByBusinessId method fetches list of categories records
* and maps DTO objects from entity objects.
*
* @param clientId,
* businessId
* @return List<Business>
*/
@Override
public List<LookupDTO> getCategoryOptionsByBusinessId(BigInteger clientId, BigInteger businessId) {
log.info(" :: getCategoryList");
List<ClientCategory> catgryList = (List<ClientCategory>) clientConfigDao
.getCategoryOptionsByBusinessId(clientId, businessId);
List<LookupDTO> lookupDTOList = new ArrayList<LookupDTO>();
LookupDTO dto = null;
for (ClientCategory cmpType : catgryList) {
dto = new LookupDTO();
// dto.setId(cmpType.getCategory_Id());
// dto.setId(NSFCommon.string2Long(cmpType.getClient().getClientId()));
// dto.setName(cmpType.getCategoryName());
dto.setId(cmpType.getClientCategoryId());
dto.setName(cmpType.getCategoryName());
dto.setDescription(cmpType.getDescription());
lookupDTOList.add(dto);
}
return lookupDTOList;
}
@Override
public List<LookupDTO> getSitesBySupplierId(BigInteger supplierId) {
log.info(" :: getSitesByClientId");
List<SupplierSite> jobTitleList = (List<SupplierSite>) clientConfigDao.getSitesBySupplierId(supplierId);
List<LookupDTO> trqSiteLookupList = new ArrayList<LookupDTO>();
LookupDTO dto = null;
for (SupplierSite jobTitle : jobTitleList) {
dto = new LookupDTO();
// dto.setId(cmpType.getCategory_Id());
dto.setCode(jobTitle.getSiteCode());
dto.setName(jobTitle.getSiteName());
trqSiteLookupList.add(dto);
}
return trqSiteLookupList;
}
@Override
public List<LookupDTO> getbusinessByClientId(BigInteger clientId) {
log.info(" :: getSitesByClientId");
List<ClientBusiness> jobTitleList = (List<ClientBusiness>) clientConfigDao.getbusinessByClientId(clientId);
List<LookupDTO> trqSiteLookupList = new ArrayList<LookupDTO>();
LookupDTO dto = null;
for (ClientBusiness jobTitle : jobTitleList) {
dto = new LookupDTO();
// dto.setId(cmpType.getCategory_Id());
dto.setCode(jobTitle.getBusinessCode());
dto.setName(jobTitle.getBusinessCode());
trqSiteLookupList.add(dto);
}
return trqSiteLookupList;
}
/**
* getClientPrivilege method making calls to Data access classes.
*
* @param clientId
* @return String
*/
@Override
public String getClientPrivilegeByClientId(Integer clientId) {
return clientConfigDao.getClientPrivilegeByClientId(clientId);
}
}
| [
"tirumaleshb@htcindia.com"
] | tirumaleshb@htcindia.com |
fb6b97b16e8fc05fbe7740a2c1dc27bed485e9cf | d6707a11f0c8e0c9f3430045f78e5a17e932eec8 | /Droid/obj/Debug/android/src/android/support/mediacompat/R.java | e378642e8875370aa110ef566161a2b745074561 | [] | no_license | JeisonSalda/PlatziTrips | edf9cad5a3b205240ad991c8a4da02100c8c76bb | dca1e60a26e8546e5142684a281f54b8c5fe1cda | refs/heads/master | 2020-03-23T02:34:16.840654 | 2018-07-14T22:00:33 | 2018-07-14T22:00:33 | 140,980,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,197 | 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 android.support.mediacompat;
public final class R {
public static final class attr {
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int font=0x7f010007;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int fontProviderAuthority=0x7f010000;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int fontProviderCerts=0x7f010003;
/** <p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>blocking</code></td><td>0</td><td></td></tr>
<tr><td><code>async</code></td><td>1</td><td></td></tr>
</table>
*/
public static int fontProviderFetchStrategy=0x7f010004;
/** <p>May be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
<p>May be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>forever</code></td><td>-1</td><td></td></tr>
</table>
*/
public static int fontProviderFetchTimeout=0x7f010005;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int fontProviderPackage=0x7f010001;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int fontProviderQuery=0x7f010002;
/** <p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>normal</code></td><td>0</td><td></td></tr>
<tr><td><code>italic</code></td><td>1</td><td></td></tr>
</table>
*/
public static int fontStyle=0x7f010006;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int fontWeight=0x7f010008;
}
public static final class bool {
public static int abc_action_bar_embed_tabs=0x7f090000;
}
public static final class color {
public static int notification_action_color_filter=0x7f060003;
public static int notification_icon_bg_color=0x7f060004;
public static int notification_material_background_media_default_color=0x7f060000;
public static int primary_text_default_material_dark=0x7f060001;
public static int ripple_material_light=0x7f060005;
public static int secondary_text_default_material_dark=0x7f060002;
public static int secondary_text_default_material_light=0x7f060006;
}
public static final class dimen {
public static int compat_button_inset_horizontal_material=0x7f0a0004;
public static int compat_button_inset_vertical_material=0x7f0a0005;
public static int compat_button_padding_horizontal_material=0x7f0a0006;
public static int compat_button_padding_vertical_material=0x7f0a0007;
public static int compat_control_corner_material=0x7f0a0008;
public static int notification_action_icon_size=0x7f0a0009;
public static int notification_action_text_size=0x7f0a000a;
public static int notification_big_circle_margin=0x7f0a000b;
public static int notification_content_margin_start=0x7f0a0001;
public static int notification_large_icon_height=0x7f0a000c;
public static int notification_large_icon_width=0x7f0a000d;
public static int notification_main_column_padding_top=0x7f0a0002;
public static int notification_media_narrow_margin=0x7f0a0003;
public static int notification_right_icon_size=0x7f0a000e;
public static int notification_right_side_padding_top=0x7f0a0000;
public static int notification_small_icon_background_padding=0x7f0a000f;
public static int notification_small_icon_size_as_large=0x7f0a0010;
public static int notification_subtext_size=0x7f0a0011;
public static int notification_top_pad=0x7f0a0012;
public static int notification_top_pad_large_text=0x7f0a0013;
}
public static final class drawable {
public static int notification_action_background=0x7f020000;
public static int notification_bg=0x7f020001;
public static int notification_bg_low=0x7f020002;
public static int notification_bg_low_normal=0x7f020003;
public static int notification_bg_low_pressed=0x7f020004;
public static int notification_bg_normal=0x7f020005;
public static int notification_bg_normal_pressed=0x7f020006;
public static int notification_icon_background=0x7f020007;
public static int notification_template_icon_bg=0x7f02000a;
public static int notification_template_icon_low_bg=0x7f02000b;
public static int notification_tile_bg=0x7f020008;
public static int notify_panel_notification_icon_bg=0x7f020009;
}
public static final class id {
public static int action0=0x7f0b0018;
public static int action_container=0x7f0b0015;
public static int action_divider=0x7f0b001c;
public static int action_image=0x7f0b0016;
public static int action_text=0x7f0b0017;
public static int actions=0x7f0b0026;
public static int async=0x7f0b0006;
public static int blocking=0x7f0b0007;
public static int cancel_action=0x7f0b0019;
public static int categoriasSpinner=0x7f0b002b;
public static int chronometer=0x7f0b0021;
public static int ciudadTextView=0x7f0b000d;
public static int detalleToolbar=0x7f0b000b;
public static int detallesListView=0x7f0b000e;
public static int end_padder=0x7f0b0028;
public static int fechaTextView=0x7f0b000c;
public static int filtroEditText=0x7f0b002a;
public static int forever=0x7f0b0008;
public static int guardarButton=0x7f0b0030;
public static int icon=0x7f0b0023;
public static int icon_group=0x7f0b0027;
public static int idaDatePicker=0x7f0b002e;
public static int info=0x7f0b0022;
public static int italic=0x7f0b0009;
public static int line1=0x7f0b0000;
public static int line3=0x7f0b0001;
public static int loginButton=0x7f0b0013;
public static int lugarEditText=0x7f0b002d;
public static int mapa=0x7f0b0014;
public static int media_actions=0x7f0b001b;
public static int menu_agregar=0x7f0b0031;
public static int menu_guardar=0x7f0b0032;
public static int normal=0x7f0b000a;
public static int notification_background=0x7f0b0025;
public static int notification_main_column=0x7f0b001e;
public static int notification_main_column_container=0x7f0b001d;
public static int nuevoLugarToolbar=0x7f0b0029;
public static int passwordEditText=0x7f0b0012;
public static int regresoDatePicker=0x7f0b002f;
public static int right_icon=0x7f0b0024;
public static int right_side=0x7f0b001f;
public static int status_bar_latest_event_content=0x7f0b001a;
public static int tag_transition_group=0x7f0b0002;
public static int text=0x7f0b0003;
public static int text2=0x7f0b0004;
public static int time=0x7f0b0020;
public static int title=0x7f0b0005;
public static int usuarioEditText=0x7f0b0011;
public static int venuesListView=0x7f0b002c;
public static int viajesListView=0x7f0b0010;
public static int viajesToolbar=0x7f0b000f;
}
public static final class integer {
public static int cancel_button_image_alpha=0x7f070000;
public static int status_bar_notification_info_maxnum=0x7f070001;
}
public static final class layout {
public static int detallesviaje=0x7f040000;
public static int listaviajes=0x7f040001;
public static int main=0x7f040002;
public static int mapa=0x7f040003;
public static int notification_action=0x7f040004;
public static int notification_action_tombstone=0x7f040005;
public static int notification_media_action=0x7f040006;
public static int notification_media_cancel_action=0x7f040007;
public static int notification_template_big_media=0x7f040008;
public static int notification_template_big_media_custom=0x7f040009;
public static int notification_template_big_media_narrow=0x7f04000a;
public static int notification_template_big_media_narrow_custom=0x7f04000b;
public static int notification_template_custom_big=0x7f04000c;
public static int notification_template_icon_group=0x7f04000d;
public static int notification_template_lines_media=0x7f04000e;
public static int notification_template_media=0x7f04000f;
public static int notification_template_media_custom=0x7f040010;
public static int notification_template_part_chronometer=0x7f040011;
public static int notification_template_part_time=0x7f040012;
public static int nuevolugar=0x7f040013;
public static int nuevoviaje=0x7f040014;
}
public static final class menu {
public static int agregar=0x7f0c0000;
public static int guardar=0x7f0c0001;
}
public static final class mipmap {
public static int ic_add=0x7f030000;
public static int ic_save=0x7f030001;
public static int icon=0x7f030002;
}
public static final class string {
public static int GoogleMapsAPI=0x7f080003;
public static int app_name=0x7f080002;
public static int hello=0x7f080001;
public static int status_bar_notification_info_overflow=0x7f080000;
}
public static final class style {
public static int AppTheme=0x7f05000c;
public static int TextAppearance_Compat_Notification=0x7f050005;
public static int TextAppearance_Compat_Notification_Info=0x7f050006;
public static int TextAppearance_Compat_Notification_Info_Media=0x7f050000;
public static int TextAppearance_Compat_Notification_Line2=0x7f05000b;
public static int TextAppearance_Compat_Notification_Line2_Media=0x7f050004;
public static int TextAppearance_Compat_Notification_Media=0x7f050001;
public static int TextAppearance_Compat_Notification_Time=0x7f050007;
public static int TextAppearance_Compat_Notification_Time_Media=0x7f050002;
public static int TextAppearance_Compat_Notification_Title=0x7f050008;
public static int TextAppearance_Compat_Notification_Title_Media=0x7f050003;
public static int Widget_Compat_NotificationActionContainer=0x7f050009;
public static int Widget_Compat_NotificationActionText=0x7f05000a;
}
public static final class styleable {
/** Attributes that can be used with a FontFamily.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #FontFamily_fontProviderAuthority android.support.mediacompat:fontProviderAuthority}</code></td><td></td></tr>
<tr><td><code>{@link #FontFamily_fontProviderCerts android.support.mediacompat:fontProviderCerts}</code></td><td></td></tr>
<tr><td><code>{@link #FontFamily_fontProviderFetchStrategy android.support.mediacompat:fontProviderFetchStrategy}</code></td><td></td></tr>
<tr><td><code>{@link #FontFamily_fontProviderFetchTimeout android.support.mediacompat:fontProviderFetchTimeout}</code></td><td></td></tr>
<tr><td><code>{@link #FontFamily_fontProviderPackage android.support.mediacompat:fontProviderPackage}</code></td><td></td></tr>
<tr><td><code>{@link #FontFamily_fontProviderQuery android.support.mediacompat:fontProviderQuery}</code></td><td></td></tr>
</table>
@see #FontFamily_fontProviderAuthority
@see #FontFamily_fontProviderCerts
@see #FontFamily_fontProviderFetchStrategy
@see #FontFamily_fontProviderFetchTimeout
@see #FontFamily_fontProviderPackage
@see #FontFamily_fontProviderQuery
*/
public static final int[] FontFamily = {
0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
0x7f010004, 0x7f010005
};
/**
<p>This symbol is the offset where the {@link android.support.mediacompat.R.attr#fontProviderAuthority}
attribute's value can be found in the {@link #FontFamily} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name android.support.mediacompat:fontProviderAuthority
*/
public static int FontFamily_fontProviderAuthority = 0;
/**
<p>This symbol is the offset where the {@link android.support.mediacompat.R.attr#fontProviderCerts}
attribute's value can be found in the {@link #FontFamily} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name android.support.mediacompat:fontProviderCerts
*/
public static int FontFamily_fontProviderCerts = 3;
/**
<p>This symbol is the offset where the {@link android.support.mediacompat.R.attr#fontProviderFetchStrategy}
attribute's value can be found in the {@link #FontFamily} array.
<p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>blocking</code></td><td>0</td><td></td></tr>
<tr><td><code>async</code></td><td>1</td><td></td></tr>
</table>
@attr name android.support.mediacompat:fontProviderFetchStrategy
*/
public static int FontFamily_fontProviderFetchStrategy = 4;
/**
<p>This symbol is the offset where the {@link android.support.mediacompat.R.attr#fontProviderFetchTimeout}
attribute's value can be found in the {@link #FontFamily} array.
<p>May be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
<p>May be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>forever</code></td><td>-1</td><td></td></tr>
</table>
@attr name android.support.mediacompat:fontProviderFetchTimeout
*/
public static int FontFamily_fontProviderFetchTimeout = 5;
/**
<p>This symbol is the offset where the {@link android.support.mediacompat.R.attr#fontProviderPackage}
attribute's value can be found in the {@link #FontFamily} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name android.support.mediacompat:fontProviderPackage
*/
public static int FontFamily_fontProviderPackage = 1;
/**
<p>This symbol is the offset where the {@link android.support.mediacompat.R.attr#fontProviderQuery}
attribute's value can be found in the {@link #FontFamily} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name android.support.mediacompat:fontProviderQuery
*/
public static int FontFamily_fontProviderQuery = 2;
/** Attributes that can be used with a FontFamilyFont.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #FontFamilyFont_android_font android:font}</code></td><td></td></tr>
<tr><td><code>{@link #FontFamilyFont_android_fontStyle android:fontStyle}</code></td><td></td></tr>
<tr><td><code>{@link #FontFamilyFont_android_fontWeight android:fontWeight}</code></td><td></td></tr>
<tr><td><code>{@link #FontFamilyFont_font android.support.mediacompat:font}</code></td><td></td></tr>
</table>
@see #FontFamilyFont_android_font
@see #FontFamilyFont_android_fontStyle
@see #FontFamilyFont_android_fontWeight
@see #FontFamilyFont_font
*/
public static final int[] FontFamilyFont = {
0x00000000, 0x7f010006, 0x7f010007, 0x7f010008
};
/**
<p>This symbol is the offset where the {@link android.R.attr#font}
attribute's value can be found in the {@link #FontFamilyFont} array.
@attr name android:font
*/
public static int FontFamilyFont_android_font = 0;
/**
<p>This symbol is the offset where the {@link android.R.attr#fontStyle}
attribute's value can be found in the {@link #FontFamilyFont} array.
@attr name android:fontStyle
*/
public static int FontFamilyFont_android_fontStyle = 0;
/**
<p>This symbol is the offset where the {@link android.R.attr#fontWeight}
attribute's value can be found in the {@link #FontFamilyFont} array.
@attr name android:fontWeight
*/
public static int FontFamilyFont_android_fontWeight = 0;
/**
<p>This symbol is the offset where the {@link android.support.mediacompat.R.attr#font}
attribute's value can be found in the {@link #FontFamilyFont} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name android.support.mediacompat:font
*/
public static int FontFamilyFont_font = 2;
};
| [
"jeisonsaldarriaga_11@hotmail.com"
] | jeisonsaldarriaga_11@hotmail.com |
2f27f7ababc4429034175d715ad5cb615a61e4a5 | 37d1d73ec78f69e395dbb921002fa439d90e7450 | /HeadFirstJava/src/main/java/patterns/factory/factory_method/NYVeggiePizza.java | 4c0118c3e122a33b872d2549ef5f6160b04a3e52 | [] | no_license | SChepinog/CodeExamples | ad891d84329be75f571e5b280380e26e85323f26 | 3997dd73d6953c029879b8916ba45e1ee41555b6 | refs/heads/master | 2023-03-08T12:36:14.181317 | 2023-02-25T11:40:29 | 2023-02-25T11:40:29 | 241,859,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 87 | java | package patterns.factory.factory_method;
public class NYVeggiePizza extends Pizza {
}
| [
"s.chepinoga@dreamkas.ru"
] | s.chepinoga@dreamkas.ru |
b6351542bfa6f80ffe23d0b476d00aabc138dd2c | a840ad11c5313a362827e2f50788ef0a14561fed | /9.Polymorphism/src/Wind.java | f1c7caa2505471f04d94a21b20d89ab1ebe9cc58 | [] | no_license | denglitong/thingking_in_java | 4f3d5cc4341877978b21b3123b57b45f0f157c0c | 76addcb8758e6d5f720760ab58b9db6cf5c1ef46 | refs/heads/master | 2023-05-04T13:43:07.119064 | 2021-05-27T09:59:45 | 2021-05-27T09:59:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | /**
* @autor denglitong
* @date 2019/7/27
*/
public class Wind extends Instrument {
@Override
public void play(Note note) {
System.out.println("Wind.play() " + note);
}
@Override
String what() {
return "Wind";
}
@Override
void adjust() {
System.out.println("Adjusting Wind");
}
}
| [
"denglitong@xiaomi.com"
] | denglitong@xiaomi.com |
bc1df20e55a9e7c6b97787aee2ffe2e9e98d1486 | e569fc1404ebe258c3296115cddfad9dd255c921 | /src/main/java/com/digitalinovationone/gft/util/BundleUtil.java | dd7b6599be5f9fcefe56b03341467d972c77543c | [] | no_license | mbgarcia/dio-gft | 50f423dd0d5707e3960110fb86634193ab67d352 | 8019338c0afd197e68aada6c02bb915a3a72dc65 | refs/heads/master | 2023-08-29T05:56:55.260028 | 2021-10-13T22:04:27 | 2021-10-13T22:04:27 | 413,930,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | package com.digitalinovationone.gft.util;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
public class BundleUtil {
public static String getText(String key, Object... args) {
ResourceBundle bundle = ResourceBundle.getBundle("bundle",new Locale("pt","BR"));
try {
return MessageFormat.format(bundle.getString(key), args);
} catch( Exception e) {
return key;
}
}
public static String ISOtoUF8(String str) {
Charset utf8charset = Charset.forName("UTF-8");
Charset iso88591charset = Charset.forName("ISO-8859-1");
ByteBuffer inputBuffer = ByteBuffer.wrap(str.getBytes());
// decode UTF-8
CharBuffer data = iso88591charset.decode(inputBuffer);
// encode ISO-8559-1
ByteBuffer outputBuffer = utf8charset.encode(data);
byte[] outputData = outputBuffer.array();
return new String(outputData);
}
}
| [
"mbgarcia_pa@yahoo.com.br"
] | mbgarcia_pa@yahoo.com.br |
f7692d0de891b80a86883976142cee98136482c0 | 2e796fed07b32120adb91354d9763be7979d98ba | /src/main/java/ExcelDemo/Nongkeyuan.java | 5203d5c80a502b6e278c6d39adee45d3c8a9e07b | [] | no_license | shenqiangbin/javademo | b52fb72763daf11981bd1db24257c720dd1d7d00 | 3d23716160ce497699b4185116415a425c99eb46 | refs/heads/master | 2023-05-24T04:41:15.809555 | 2023-04-14T07:31:23 | 2023-04-14T07:31:23 | 162,777,741 | 3 | 0 | null | 2023-01-08T06:10:34 | 2018-12-22T03:15:40 | Java | UTF-8 | Java | false | false | 15,596 | java | package ExcelDemo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zaxxer.hikari.HikariDataSource;
import dbmgr.mySqlAccess.MySqlHelper;
import fileDemo.FileHelper;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.*;
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.chrome.ChromeOptions;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import static fileDemo.FileHelper.findFile;
public class Nongkeyuan {
static WebDriver driver;
public static void main(String[] args) throws Exception {
//sonbin();
//sonbin2();
//handleTwo();
handleTwosonbin2();
System.out.println("over");
}
/**
* 在处理的基础上进行二次处理
* 获取【作者】是【英文】的文献集合
*/
private static void handleTwo() throws Exception {
String filePath = "E:\\指标标引\\2022年维护总结\\问题数据项-700多条.xlsx";
InputStream stream = new FileInputStream(filePath);
Workbook wb = WorkbookFactory.create(stream);
Sheet sheet = wb.getSheetAt(0);
Row row = null;
int totalRow = sheet.getLastRowNum();
List<String> cells = new ArrayList<>();
String[] titles = null;
short minColIx = 0;
short maxColIx = 0;
List<Model> list = new ArrayList<>();
int needPdfCount = 0;
int notNeedPdfCount = 0;
System.out.println("全英文的作者有:");
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
cells = new ArrayList<>();
row = sheet.getRow(r);
minColIx = row.getFirstCellNum();
maxColIx = row.getLastCellNum();
String title = getCellVal(row.getCell(1));
String author = getCellVal(row.getCell(4));
String teacher = getCellVal(row.getCell(5));
String abs = getCellVal(row.getCell(2));
String pdf = getCellVal(row.getCell(21));
if (!StrHelper.isContainChinese(author)) {
JSONObject object = new JSONObject();
object.put("title", title);
object.put("author", author);
object.put("teacher", teacher);
System.out.println(object.toString());
}
}
}
public static void handleTwosonbin2() throws Exception {
//driver = initChrome();
List<String> nameList = new ArrayList<>();
// 基于上一次处理结果,继续处理
String filePath = "E:\\指标标引\\2022年维护总结\\问题数据项-700多条-new.xlsx";
String newfilePath = "E:\\指标标引\\2022年维护总结\\问题数据项-700多条-new2.xlsx";
String resultfilePath = "E:\\指标标引\\2022年维护总结\\sta2023_01_16_10_50_12_english.txt";
String fileContent = FileHelper.readTxtFile(resultfilePath);
InputStream stream = new FileInputStream(filePath);
Workbook wb = WorkbookFactory.create(stream);
Sheet sheet = wb.getSheetAt(0);
Row row = null;
int totalRow = sheet.getLastRowNum();
List<String> cells = new ArrayList<>();
String[] titles = null;
short minColIx = 0;
short maxColIx = 0;
List<Model> list = new ArrayList<>();
int needPdfCount = 0;
int notNeedPdfCount = 0;
System.out.println("excel标题和匹配到的标题人工对比一下:");
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
cells = new ArrayList<>();
row = sheet.getRow(r);
minColIx = row.getFirstCellNum();
maxColIx = row.getLastCellNum();
String title = getCellVal(row.getCell(1));
String author = getCellVal(row.getCell(4));
String teacher = getCellVal(row.getCell(5));
String abs = getCellVal(row.getCell(2));
String pdf = getCellVal(row.getCell(21));
JSONObject jsonObject = getBy(fileContent, title);
if (jsonObject == null) {
continue;
}
if (jsonObject.get("文献名字匹配").equals("1")) {
Cell cell = row.createCell(26);
cell.setCellValue("有数据_导师匹配");
boolean allSame = jsonObject.get("title").equals(jsonObject.get("title_db"));
//System.out.println(jsonObject.get("title") + ":" + jsonObject.get("title_db") + ":完成相同" + allSame);
CellStyle cellHeadStyle = createCellHeadStyle(wb);
if (StringUtils.isBlank(abs)) {
row.getCell(2).setCellStyle(cellHeadStyle);
row.getCell(2).setCellValue(jsonObject.getString("zval"));
}
if (StringUtils.isBlank(pdf)) {
needPdfCount++;
cell = row.createCell(21);
cell.setCellStyle(cellHeadStyle);
//cell.setCellValue(jsonObject.getString("zfile"));
String name = findFileMostLike("E:\\指标标引\\2022年维护总结\\topdf-english", title, author);
cell.setCellValue(name);
if(nameList.contains(name)){
System.out.println("包含了name:" + name);
}else{
nameList.add(name);
}
//
//下载文献
// System.out.println(title + ":" + author);
//downloadFile(title);
} else {
notNeedPdfCount++;
}
}
//System.out.println(r);
//System.out.println(Arrays.deepToString(cells.toArray()));
}
OutputStream ops = new FileOutputStream(newfilePath);
wb.write(ops);
ops.flush();
ops.close();
wb.close();
System.out.println("需要处理的pdf:" + needPdfCount + " 已经有的pdf:" + notNeedPdfCount);
}
public static void sonbin2() throws Exception {
//driver = initChrome();
List<String> nameList = new ArrayList<>();
String filePath = "E:\\指标标引\\2022年维护总结\\问题数据项-700多条.xlsx";
String newfilePath = "E:\\指标标引\\2022年维护总结\\问题数据项-700多条-new.xlsx";
//String resultfilePath = "E:\\指标标引\\2022年维护总结\\sta2023_01_13_10_12_07.txt";
String resultfilePath = "E:\\指标标引\\2022年维护总结\\sta2023_01_13_16_32_22.txt";
String fileContent = FileHelper.readTxtFile(resultfilePath);
InputStream stream = new FileInputStream(filePath);
Workbook wb = WorkbookFactory.create(stream);
Sheet sheet = wb.getSheetAt(0);
Row row = null;
int totalRow = sheet.getLastRowNum();
List<String> cells = new ArrayList<>();
String[] titles = null;
short minColIx = 0;
short maxColIx = 0;
List<Model> list = new ArrayList<>();
int needPdfCount = 0;
int notNeedPdfCount = 0;
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
cells = new ArrayList<>();
row = sheet.getRow(r);
minColIx = row.getFirstCellNum();
maxColIx = row.getLastCellNum();
String title = getCellVal(row.getCell(1));
String author = getCellVal(row.getCell(4));
String teacher = getCellVal(row.getCell(5));
String abs = getCellVal(row.getCell(2));
String pdf = getCellVal(row.getCell(21));
JSONObject jsonObject = getBy(fileContent, title);
if (jsonObject.get("文献名字匹配").equals("1")) {
Cell cell = row.createCell(26);
cell.setCellValue("有数据");
CellStyle cellHeadStyle = createCellHeadStyle(wb);
if (StringUtils.isBlank(abs)) {
row.getCell(2).setCellStyle(cellHeadStyle);
row.getCell(2).setCellValue(jsonObject.getString("zval"));
}
if (StringUtils.isBlank(pdf)) {
needPdfCount++;
cell = row.createCell(21);
cell.setCellStyle(cellHeadStyle);
//cell.setCellValue(jsonObject.getString("zfile"));
String name = findFileMostLike("E:\\指标标引\\2022年维护总结\\Downloads", title, author);
cell.setCellValue(name);
if (nameList.contains(name)) {
System.out.println("包含了name:" + name);
} else {
nameList.add(name);
}
System.out.println(title + ":" + author + ":" + name);
//downloadFile(title);
} else {
notNeedPdfCount++;
}
}
//System.out.println(r);
//System.out.println(Arrays.deepToString(cells.toArray()));
}
OutputStream ops = new FileOutputStream(newfilePath);
wb.write(ops);
ops.flush();
ops.close();
wb.close();
System.out.println("需要处理的pdf:" + needPdfCount + " 已经有的pdf:" + notNeedPdfCount);
}
public static String findFileMostLike(String dir, String name, String author) throws IOException {
File file = new File(dir);
if (!file.exists()) {
throw new FileNotFoundException("目录不存在");
}
File[] files = file.listFiles();
float topLike = 0;
File topLikeFile = null;
for (int i = 0; i < files.length; i++) {
String filename = files[i].getName();
float socre = StrHelper.getSimilarityRatio(filename, name + "_" + author);
if (socre > topLike) {
topLike = socre;
topLikeFile = files[i];
}
}
// if (!topLikeFile.getName().contains(author)) {
// throw new RuntimeException("不包含作者信息");
// }
String newPath = "E:\\指标标引\\2022年维护总结\\toPdf\\" + topLikeFile.getName();
FileHelper.copyFile(topLikeFile, new File(newPath));
return topLikeFile.getName().replace(".caj", ".pdf");
}
public static JSONObject getBy(String content, String title) {
for (String line : content.split("\r\n")) {
JSONObject obj = JSON.parseObject(line);
if (obj.get("title").equals(title)) {
return obj;
}
}
return null;
}
static boolean okStart = false;
static void downloadFile(String title) throws InterruptedException {
// if (!okStart) {
//
// if (title.equals("城乡一体化下空间农业关键技术研究与应用探索")) {
// okStart = true;
// }
//
// return;
// }
String path = "https://kns.cnki.net/kns8/DefaultResult/Index?dbcode=CFLS&kw=123&korder=SU";
path = path.replace("123", title);
driver.get(path);
Thread.sleep(60000);
List<WebElement> imgs = driver.findElements(By.className("downloadlink"));
for (WebElement img : imgs) {
String s = img.toString();
img.click();
}
//$(".result-table-list tr td.operat a.downloadlink").attr('href')
}
static WebDriver initChrome() {
/*
https://chromedriver.storage.googleapis.com/index.html?path=73.0.3683.68/
* */
System.setProperty("webdriver.chrome.driver", "c:/chromedriver_win32/chromedriver.exe");
ChromeOptions chromeOptions = new ChromeOptions();
//chromeOptions.addArguments("--headless");
//chromeOptions.addArguments("--window-size=1280,768");
WebDriver driver = new ChromeDriver(chromeOptions);
driver.get("http://www.sqber.com");
//driver.get("http://10.170.2.161:8161/models");
//driver.get("http://www.baidu.com");
driver.manage().window().maximize();
return driver;
}
private static CellStyle createCellHeadStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
// 设置边框样式
// style.setBorderBottom(BorderStyle.THIN);
// style.setBorderLeft(BorderStyle.THIN);
// style.setBorderRight(BorderStyle.THIN);
// style.setBorderTop(BorderStyle.THIN);
//设置对齐样式
// style.setAlignment(HorizontalAlignment.CENTER);
// style.setVerticalAlignment(VerticalAlignment.CENTER);
// 生成字体
// Font font = workbook.createFont();
// 表头样式
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
// font.setFontHeightInPoints((short) 12);
// font.setBold(true);
// 把字体应用到当前的样式
//style.setFont(font);
return style;
}
public static void sonbin() throws Exception {
String filePath = "E:\\指标标引\\2022 年维护总结\\问题数据项-700多条.xlsx";
InputStream stream = new FileInputStream(filePath);
Workbook wb = WorkbookFactory.create(stream);
Sheet sheet = wb.getSheetAt(0);
Row row = null;
int totalRow = sheet.getLastRowNum();
List<String> cells = new ArrayList<>();
String[] titles = null;
short minColIx = 0;
short maxColIx = 0;
List<Model> list = new ArrayList<>();
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
cells = new ArrayList<>();
row = sheet.getRow(r);
minColIx = row.getFirstCellNum();
maxColIx = row.getLastCellNum();
String title = getCellVal(row.getCell(1));
String author = getCellVal(row.getCell(4));
String teacher = getCellVal(row.getCell(5));
JSONObject object = new JSONObject();
object.put("title", title);
object.put("author", author);
object.put("teacher", teacher);
System.out.println(object.toString());
//System.out.println(r);
//System.out.println(Arrays.deepToString(cells.toArray()));
}
}
private static String getCellVal(Cell cell) {
String cellVal = "";
if (cell == null) {
return cellVal;
}
if (cell.getCellTypeEnum() == CellType.NUMERIC) {
java.text.DecimalFormat formatter = new java.text.DecimalFormat("########.####");
cellVal = formatter.format(cell.getNumericCellValue());
} else if (cell.getCellTypeEnum() == CellType.BOOLEAN) {
cellVal = String.valueOf(cell.getBooleanCellValue());
} else if (cell.getCellTypeEnum() == CellType.FORMULA) {
try {
cellVal = cell.getStringCellValue();
} catch (IllegalStateException e) {
cellVal = String.valueOf(cell.getNumericCellValue());
}
System.out.println(cellVal);
} else {
cellVal = cell.getStringCellValue();
}
return cellVal;
}
}
| [
"1348907384@qq.com"
] | 1348907384@qq.com |
18287405dffacc55f4436696f308eb91cbf8f502 | 717b154999c74a505ad4a2bf11221856230158ba | /src/main/java/com/spring/demo/filter/RestFilter.java | b10a8eba1f41f711f31aade30af5cbcbb36bdf82 | [] | no_license | HerrAgner/movie_night | 3ee4cbc4e7f8ef6f4ad0b7d93f4612f8e5a17177 | 16a1df2e9381fbc31176edeee84c18021525a277 | refs/heads/master | 2023-01-13T14:50:39.816243 | 2019-12-19T10:10:08 | 2019-12-19T10:10:08 | 225,610,891 | 1 | 0 | null | 2023-01-05T02:14:37 | 2019-12-03T12:09:31 | Java | UTF-8 | Java | false | false | 1,723 | java | package com.spring.demo.filter;
import com.spring.demo.db.RestInfoRepository;
import com.spring.demo.entities.RestInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.Instant;
@Configuration
@Order(Ordered.HIGHEST_PRECEDENCE)
public class RestFilter implements Filter {
private static final Logger LOGGER = LoggerFactory.getLogger(RestFilter.class);
@Autowired
RestInfoRepository restInfoRepository;
@Override
public void init(FilterConfig filterConfig) {
LOGGER.info("Initiating REST filter");
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
filterChain.doFilter(request, response);
RestInfo restInfo = new RestInfo(
request.getRequestURI(),
request.getQueryString(),
request.getRemoteAddr(),
Instant.now().toString(),
request.getMethod(),
response.getContentType(),
response.getStatus());
restInfoRepository.insert(restInfo);
}
@Override
public void destroy() {
}
} | [
"ted.agner@hotmail.com"
] | ted.agner@hotmail.com |
da5f6e2b41016235e9ff6cfb9473475e8af706d1 | bfba3b96cd5d8706ff3238c6ce9bf10967af89cf | /src/main/java/com/robertx22/age_of_exile/saveclasses/unit/Unit.java | 5921a9310e2a07b71e381ec967c29bc6c9f33ae1 | [] | no_license | panbanann/Age-of-Exile | e6077d89a5ab8f2389e9926e279aa8360960c65a | cc54a9aa573dec42660b0684fffbf653015406cf | refs/heads/master | 2023-04-12T14:16:56.379334 | 2021-05-04T21:13:19 | 2021-05-04T21:13:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,729 | java | package com.robertx22.age_of_exile.saveclasses.unit;
import com.robertx22.age_of_exile.capability.entity.EntityCap.UnitData;
import com.robertx22.age_of_exile.config.forge.ModConfig;
import com.robertx22.age_of_exile.damage_hooks.util.AttackInformation;
import com.robertx22.age_of_exile.database.data.game_balance_config.GameBalanceConfig;
import com.robertx22.age_of_exile.database.data.rarities.MobRarity;
import com.robertx22.age_of_exile.database.data.set.GearSet;
import com.robertx22.age_of_exile.database.data.skill_gem.SkillGemData;
import com.robertx22.age_of_exile.database.data.stats.Stat;
import com.robertx22.age_of_exile.database.data.stats.datapacks.stats.AttributeStat;
import com.robertx22.age_of_exile.database.data.stats.types.core_stats.base.ICoreStat;
import com.robertx22.age_of_exile.database.data.stats.types.core_stats.base.ITransferToOtherStats;
import com.robertx22.age_of_exile.database.data.stats.types.resources.blood.Blood;
import com.robertx22.age_of_exile.database.data.stats.types.resources.blood.BloodUser;
import com.robertx22.age_of_exile.database.data.stats.types.resources.health.Health;
import com.robertx22.age_of_exile.database.data.stats.types.resources.mana.Mana;
import com.robertx22.age_of_exile.database.data.unique_items.UniqueGear;
import com.robertx22.age_of_exile.database.registry.Database;
import com.robertx22.age_of_exile.event_hooks.my_events.CollectGearEvent;
import com.robertx22.age_of_exile.saveclasses.ExactStatData;
import com.robertx22.age_of_exile.saveclasses.unit.stat_ctx.GearStatCtx;
import com.robertx22.age_of_exile.saveclasses.unit.stat_ctx.StatContext;
import com.robertx22.age_of_exile.uncommon.datasaving.Load;
import com.robertx22.age_of_exile.uncommon.interfaces.IAffectsStats;
import com.robertx22.age_of_exile.uncommon.interfaces.data_items.IRarity;
import com.robertx22.age_of_exile.uncommon.stat_calculation.CommonStatUtils;
import com.robertx22.age_of_exile.uncommon.stat_calculation.ExtraMobRarityAttributes;
import com.robertx22.age_of_exile.uncommon.stat_calculation.MobStatUtils;
import com.robertx22.age_of_exile.uncommon.stat_calculation.PlayerStatUtils;
import com.robertx22.age_of_exile.uncommon.utilityclasses.RandomUtils;
import com.robertx22.age_of_exile.vanilla_mc.packets.EfficientMobUnitPacket;
import com.robertx22.age_of_exile.vanilla_mc.packets.EntityUnitPacket;
import com.robertx22.library_of_exile.main.MyPacket;
import com.robertx22.library_of_exile.main.Packets;
import info.loenwind.autosave.annotations.Storable;
import info.loenwind.autosave.annotations.Store;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.registry.Registry;
import java.util.*;
import java.util.stream.Collectors;
// this stores data that can be lost without issue, stats that are recalculated all the time
// and mob status effects.
@Storable
public class Unit {
@Store
private HashMap<StatContainerType, StatContainer> stats = new HashMap<>();
@Store
public String GUID = UUID.randomUUID()
.toString();
public InCalcStatData getStatInCalculation(Stat stat) {
return getStats().getStatInCalculation(stat);
}
public InCalcStatData getStatInCalculation(String stat) {
return getStats().getStatInCalculation(stat);
}
public enum StatContainerType {
NORMAL(-1),
SPELL1(0),
SPELL2(1),
SPELL3(2),
SPELL4(3);
StatContainerType(int place) {
this.place = place;
}
public int place;
}
public boolean isBloodMage() {
return getCalculatedStat(BloodUser.getInstance())
.getAverageValue() > 0;
}
public StatContainer getStats() {
return getStats(StatContainerType.NORMAL);
}
public StatContainer getStats(StatContainerType type) {
if (!stats.containsKey(type)) {
stats.put(type, new StatContainer());
}
return stats.get(type);
}
public StatData getCalculatedStat(Stat stat) {
return getCalculatedStat(stat.GUID());
}
public StatData getCalculatedStat(String guid) {
if (getStats().stats == null) {
this.initStats();
}
return getStats().stats.getOrDefault(guid, StatData.empty());
}
public Unit() {
}
public void initStats() {
getStats().stats = new HashMap<String, StatData>();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj instanceof Unit) {
return ((Unit) obj).GUID.equals(this.GUID); // todo this bugfix sounds big, might mess with things!!!
}
return false;
}
@Override
public int hashCode() {
return GUID.hashCode();
}
// Stat shortcuts
public Health health() {
return Health.getInstance();
}
public Mana mana() {
return Mana.getInstance();
}
public StatData healthData() {
try {
return getCalculatedStat(Health.GUID);
} catch (Exception e) {
}
return StatData.empty();
}
public StatData bloodData() {
try {
return getCalculatedStat(Blood.GUID);
} catch (Exception e) {
}
return StatData.empty();
}
public StatData manaData() {
try {
return getCalculatedStat(Mana.GUID);
} catch (Exception e) {
}
return StatData.empty();
}
public String randomRarity(LivingEntity entity, UnitData data) {
List<MobRarity> rarities = Database.MobRarities()
.getList()
.stream()
.filter(x -> data.getLevel() >= x.minMobLevelForRandomSpawns() || data.getLevel() >= GameBalanceConfig.get().MAX_LEVEL)
.collect(Collectors.toList());
if (rarities.isEmpty()) {
rarities.add(Database.MobRarities()
.get(IRarity.COMMON_ID));
}
MobRarity finalRarity = RandomUtils.weightedRandom(rarities);
return finalRarity.GUID();
}
private static class DirtyCheck {
public int hp;
public boolean isDirty(DirtyCheck newcheck) {
if (newcheck.hp != hp) {
return true;
}
return false;
}
}
/**
* @return checks if it should be synced to clients. Clients currently only see
* health and status effects
*/
private DirtyCheck getDirtyCheck() {
if (getStats().stats == null || getStats().stats.isEmpty()) {
this.initStats();
}
DirtyCheck check = new DirtyCheck();
check.hp = (int) getCalculatedStat(Health.GUID).getAverageValue();
return check;
}
@Store
public HashMap<String, Integer> sets = new HashMap<>();
private void calcSets(List<GearData> gears) {
sets.clear();
// todo possibly cache it?
gears.forEach(x -> {
if (x.gear != null) {
if (x.gear.uniqueStats != null) {
UniqueGear uniq = x.gear.uniqueStats.getUnique(x.gear);
if (uniq != null) {
if (uniq.hasSet()) {
GearSet set = uniq.getSet();
String key = set
.GUID();
int current = sets.getOrDefault(key, 0);
sets.put(key, current + 1);
}
}
}
}
});
}
public void recalculateStats(LivingEntity entity, UnitData data, AttackInformation dmgData) {
try {
if (entity.world.isClient) {
return;
}
//data.setEquipsChanged(false);
if (data.getUnit() == null) {
data.setUnit(this);
}
List<GearData> gears = new ArrayList<>();
new CollectGearEvent.CollectedGearStacks(entity, gears, dmgData);
calcSets(gears);
stats.values()
.forEach(x -> x.stats.clear());
stats.values()
.forEach(x -> x.statsInCalc.clear());
DirtyCheck old = getDirtyCheck();
List<StatContext> statContexts = new ArrayList<>();
statContexts.addAll(CommonStatUtils.addPotionStats(entity));
statContexts.addAll(CommonStatUtils.addExactCustomStats(entity));
if (entity instanceof PlayerEntity) {
if (data.hasRace()) {
data.getRace()
.addStats((PlayerEntity) entity);
}
sets.entrySet()
.forEach(x -> {
GearSet set = Database.Sets()
.get(x.getKey());
statContexts.add(set.getStats(data));
});
Load.statPoints((PlayerEntity) entity).data.addStats(data);
statContexts.addAll(PlayerStatUtils.AddPlayerBaseStats(entity));
statContexts.addAll(Load.characters((PlayerEntity) entity)
.getStats());
statContexts.addAll(Load.perks(entity)
.getStatAndContext(entity));
statContexts.addAll(Load.playerSkills((PlayerEntity) entity)
.getStatAndContext(entity));
statContexts.addAll(Load.spells(entity)
.getStatAndContext(entity));
statContexts.add(data.getStatusEffectsData()
.getStats(entity));
} else {
statContexts.addAll(MobStatUtils.getMobBaseStats(data, entity));
statContexts.addAll(MobStatUtils.getAffixStats(entity));
statContexts.addAll(MobStatUtils.getWorldMultiplierStats(entity));
MobStatUtils.addMapStats(entity, data, this);
statContexts.addAll(MobStatUtils.getMobConfigStats(entity, data));
ExtraMobRarityAttributes.add(entity, data);
}
statContexts.addAll(addGearStats(gears, entity, data));
HashMap<StatContext.StatCtxType, List<StatContext>> map = new HashMap<>();
for (StatContext.StatCtxType type : StatContext.StatCtxType.values()) {
map.put(type, new ArrayList<>());
}
statContexts.forEach(x -> {
map.get(x.type)
.add(x);
});
map.forEach((key, value) -> value
.forEach(v -> {
v.stats.forEach(s -> {
if (s.getStat().statContextModifier != null) {
map.get(s.getStat().statContextModifier.getCtxTypeNeeded())
.forEach(c -> s.getStat().statContextModifier.modify(s, c));
}
});
}));
statContexts.forEach(x -> x.stats.forEach(s -> s.applyStats(data)));
addVanillaHpToStats(entity, data);
new HashMap<>(getStats().statsInCalc).entrySet()
.forEach(x -> {
InCalcStatData statdata = x.getValue();
Stat stat = x.getValue()
.GetStat();
if (stat instanceof IAffectsStats) {
IAffectsStats add = (IAffectsStats) stat;
add.affectStats(data, statdata);
}
});
new HashMap<>(getStats().statsInCalc).entrySet()
.forEach(x -> {
InCalcStatData statdata = x.getValue();
Stat stat = x.getValue()
.GetStat();
if (stat instanceof ITransferToOtherStats) {
ITransferToOtherStats add = (ITransferToOtherStats) stat;
add.transferStats(data, statdata);
}
});
new HashMap<>(getStats().statsInCalc).entrySet()
.forEach(x -> {
InCalcStatData statdata = x.getValue();
Stat stat = x.getValue()
.GetStat();
if (stat instanceof ICoreStat) {
ICoreStat add = (ICoreStat) stat;
add.addToOtherStats(data, statdata);
}
});
if (entity instanceof PlayerEntity) {
for (StatContainerType type : StatContainerType.values()) {
// different stat containers for each spell with support gems.
if (type == StatContainerType.NORMAL) {
this.stats.put(type, getStats());
} else {
StatContainer copy = getStats().cloneForSpellStats();
stats.put(type, copy);
List<SkillGemData> supportGems = Load.spells(entity)
.getSkillGemData()
.getSupportGemsOf(type.place);
List<SkillGemData> noGemDuplicateList = new ArrayList<>();
Set<String> gemIdSet = new HashSet<>();
supportGems.forEach(x -> {
if (!gemIdSet.contains(x.id)) {// dont allow duplicate gems
noGemDuplicateList.add(x);
gemIdSet.add(x.id);
}
});
for (SkillGemData sd : noGemDuplicateList) {
if (true || sd.canPlayerUse((PlayerEntity) entity)) {
sd.getSkillGem()
.getConstantStats(sd)
.forEach(s -> {
copy.getStatInCalculation(s.getStat())
.add(s, data);
});
sd.getSkillGem()
.getRandomStats(sd)
.forEach(s -> {
copy.getStatInCalculation(s.getStat())
.add(s, data);
});
}
}
}
}
stats.values()
.forEach(x -> x.calculate());
} else {
stats.get(StatContainerType.NORMAL)
.calculate();
}
DirtyCheck aftercalc = getDirtyCheck();
this.getStats().stats.values()
.forEach(x -> {
if (x.GetStat() instanceof AttributeStat) {
AttributeStat stat = (AttributeStat) x.GetStat();
stat.addToEntity(entity, x);
}
});
if (old.isDirty(aftercalc)) {
if (!Unit.shouldSendUpdatePackets((LivingEntity) entity)) {
return;
}
Packets.sendToTracking(getUpdatePacketFor(entity, data), entity);
}
if (entity instanceof PlayerEntity) {
Packets.sendToClient((PlayerEntity) entity, new EntityUnitPacket(entity));
}
} catch (Exception e) {
e.printStackTrace();
}
}
private void addVanillaHpToStats(LivingEntity entity, UnitData data) {
if (entity instanceof PlayerEntity) {
float maxhp = MathHelper.clamp(entity.getMaxHealth(), 0, 500);
// all increases after this would just reduce enviro damage
getStats().getStatInCalculation(Health.getInstance())
.addAlreadyScaledFlat(maxhp);
// add vanila hp to extra hp
}
}
private List<StatContext> addGearStats(List<GearData> gears, LivingEntity entity, UnitData data) {
List<StatContext> ctxs = new ArrayList<>();
gears.forEach(x -> {
List<ExactStatData> stats = x.gear.GetAllStats();
if (x.percentStatUtilization != 100) {
// multi stats like for offfhand weapons
float multi = x.percentStatUtilization / 100F;
stats.forEach(s -> s.multiplyBy(multi));
}
ctxs.add(new GearStatCtx(x.gear, stats));
});
return ctxs;
}
private static HashMap<EntityType, Boolean> IGNORED_ENTITIES = null;
public static HashMap<EntityType, Boolean> getIgnoredEntities() {
if (IGNORED_ENTITIES == null) {
IGNORED_ENTITIES = new HashMap<>();
ModConfig.get().Server.IGNORED_ENTITIES
.stream()
.filter(x -> Registry.ENTITY_TYPE.getOrEmpty(new Identifier(x))
.isPresent())
.map(x -> Registry.ENTITY_TYPE.get(new Identifier(x)))
.forEach(x -> IGNORED_ENTITIES.put(x, true));
}
return IGNORED_ENTITIES;
}
public static boolean shouldSendUpdatePackets(LivingEntity en) {
return !getIgnoredEntities().containsKey(en.getType());
}
public static MyPacket getUpdatePacketFor(LivingEntity en, UnitData data) {
return new EfficientMobUnitPacket(en, data);
}
}
| [
"treborx555@gmail.com"
] | treborx555@gmail.com |
e626f4243b63aecd5f288e7f5be375a208bc57ab | eae5e01cfcfadcd52954e52d96f5bbbba929be4e | /src/com/tust/tools/db/JZData.java | c6287cc93c1e630a2e5128132c690de0575c09e0 | [] | no_license | yanghuiyang/LiCai | ab351d82716b777cde55c5152353dc3106c0a56c | cb02420db9e7050168b5bd98e3d01f17e298cc6e | refs/heads/master | 2021-01-21T12:59:10.506239 | 2016-05-29T05:01:11 | 2016-05-29T05:01:11 | 55,654,631 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,723 | java | package com.tust.tools.db;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.tust.tools.bean.JZshouru;
import com.tust.tools.bean.JZzhichu;
import com.tust.tools.service.GetTime;
//记账数据库操作
public class JZData {
private SQLiteDatabase db;
private DBOpenHelper dbHelper;// 创建DBOpenHelper对象
private Context context;
public JZData(Context context){
this.context = context;
dbHelper = new DBOpenHelper(context);// 初始化DBOpenHelper对象
db= dbHelper.getWritableDatabase();
}
public void close(){
db.close();
dbHelper.close();
}
/*
* 获取某月某类型支出总额
* */
public int getTypeMonthSpend(String userName,String typeName,Integer year,Integer month){
int total=0;
Cursor cursor = db.rawQuery("select ZC_COUNT from zhichu where ZC_USER=? and ZC_ITEM=? And ZC_YEAR = ? and ZC_MONTH=?",
new String[]{String.valueOf(userName),String.valueOf(typeName), String.valueOf(year), String.valueOf(month) } );
while (cursor.moveToNext()) {
total +=Integer.parseInt(cursor.getString(cursor.getColumnIndex("ZC_COUNT")));
}
return total;
}
/*
* 获取某月支出总额
* */
public int getMonthSpend(String userName,Integer year,Integer month){
int total=0;
// Cursor cursor = db.rawQuery("select SUM(ZC_COUNT) from zhichu where ZC_USER=? And ZC_YEAR = ? and ZC_MONTH=?",
Cursor cursor = db.rawQuery("select ZC_COUNT from zhichu where ZC_USER=? And ZC_YEAR = ? AND ZC_MONTH=?",
new String[]{String.valueOf(userName), String.valueOf(year), String.valueOf(month) } );
while (cursor.moveToNext()) {
// total = cursor.getInt(0);
total +=Integer.parseInt(cursor.getString(cursor.getColumnIndex("ZC_COUNT")));
}
return total;
}
/*
* 获取支出表中的所有数据
* */
public ArrayList<JZzhichu> GetZhiChuList(String selection){
ArrayList<JZzhichu> zhichulist=new ArrayList<JZzhichu>();
Cursor cursor=db.query("zhichu", null, selection, null, null, null, "ID DESC");
cursor.moveToFirst();
while(!cursor.isAfterLast()&&(cursor.getString(1)!=null)){
JZzhichu zhichu=new JZzhichu();
zhichu.setZc_Id(cursor.getInt(0));
zhichu.setZc_Item(cursor.getString(1));
zhichu.setZc_SubItem(cursor.getString(2));
zhichu.setZc_Year(cursor.getInt(3));
zhichu.setZc_Month(cursor.getInt(4));
zhichu.setZc_Week(cursor.getInt(5));
zhichu.setZc_Day(cursor.getInt(6));
zhichu.setZc_Time(cursor.getString(7));
zhichu.setZc_Pic(cursor.getString(8));
zhichu.setZc_Count(cursor.getDouble(9));
zhichu.setZc_Beizhu(cursor.getString(10));
zhichu.setZc_User(cursor.getString(11));//add
zhichulist.add(zhichu);
cursor.moveToNext();
}
cursor.close();
return zhichulist;
}
/*
* 获取收入表中的所有数据
* */
public ArrayList<JZshouru> GetShouRuList(String selection){
ArrayList<JZshouru>shourulist=new ArrayList<JZshouru>();
Cursor cursor=db.query("shouru", null, selection, null, null, null, "ID DESC");
cursor.moveToFirst();
while(!cursor.isAfterLast()&&(cursor.getString(1)!=null)){
JZshouru shouru=new JZshouru();
shouru.setSr_Id(cursor.getInt(0));
shouru.setSr_Item(cursor.getString(1));
shouru.setSr_Year(cursor.getInt(2));
shouru.setSr_Month(cursor.getInt(3));
shouru.setSr_Week(cursor.getInt(4));
shouru.setSr_Day(cursor.getInt(5));
shouru.setSr_Time(cursor.getString(6));
shouru.setSr_Count(cursor.getDouble(7));
shouru.setSr_Beizhu(cursor.getString(8));
shouru.setSr_User(cursor.getString(9)); //add
shourulist.add(shouru);
cursor.moveToNext();
}
cursor.close();
return shourulist;
}
/*
* 更新支出表的记录
* */
public int UpdateZhiChuInfo(JZzhichu zhichu,int id){
ContentValues values = new ContentValues();
values.put(JZzhichu.ZC_ITEM, zhichu.getZc_Item());
values.put(JZzhichu.ZC_SUBITEM, zhichu.getZc_SubItem());
values.put(JZzhichu.ZC_YEAR, zhichu.getZc_Year());
values.put(JZzhichu.ZC_MONTH, zhichu.getZc_Month());
values.put(JZzhichu.ZC_WEEK, zhichu.getZc_Week());
values.put(JZzhichu.ZC_DAY, zhichu.getZc_Day());
values.put(JZzhichu.ZC_TIME, zhichu.getZc_Time());
values.put(JZzhichu.ZC_PIC, zhichu.getZc_Pic());
values.put(JZzhichu.ZC_COUNT, zhichu.getZc_Count());
values.put(JZzhichu.ZC_BEIZHU, zhichu.getZc_Beizhu());
values.put(JZzhichu.ZC_USER, zhichu.getZc_User());//add
int idupdate= db.update("zhichu", values, "ID ='"+id+"'", null);
this.close();
return idupdate;
}
/*
* 更新收入表的记录
* */
public int UpdateShouRuInfo(JZshouru shouru,int id){
ContentValues values = new ContentValues();
values.put(JZshouru.SR_ITEM, shouru.getSr_Item());
values.put(JZshouru.SR_YEAR, shouru.getSr_Year());
values.put(JZshouru.SR_MONTH, shouru.getSr_Month());
values.put(JZshouru.SR_WEEK, shouru.getSr_Week());
values.put(JZshouru.SR_DAY, shouru.getSr_Day());
values.put(JZshouru.SR_TIME, shouru.getSr_Time());
values.put(JZshouru.SR_COUNT, shouru.getSr_Count());
values.put(JZshouru.SR_BEIZHU, shouru.getSr_Beizhu());
values.put(JZshouru.SR_USER, shouru.getSr_User());//add
int idupdate= db.update("shouru", values, "ID ='"+id+"'", null);
this.close();
return idupdate;
}
/*
* 添加支出记录
* */
public Long SaveZhiChuInfo(JZzhichu zhichu){
ContentValues values = new ContentValues();
values.put(JZzhichu.ZC_ITEM, zhichu.getZc_Item());
values.put(JZzhichu.ZC_SUBITEM, zhichu.getZc_SubItem());
values.put(JZzhichu.ZC_YEAR, zhichu.getZc_Year());
values.put(JZzhichu.ZC_MONTH, zhichu.getZc_Month());
values.put(JZzhichu.ZC_WEEK, zhichu.getZc_Week());
values.put(JZzhichu.ZC_DAY, zhichu.getZc_Day());
values.put(JZzhichu.ZC_TIME, zhichu.getZc_Time());
values.put(JZzhichu.ZC_PIC, zhichu.getZc_Pic());
values.put(JZzhichu.ZC_COUNT, zhichu.getZc_Count());
values.put(JZzhichu.ZC_BEIZHU, zhichu.getZc_Beizhu());
values.put(JZzhichu.ZC_USER, zhichu.getZc_User());//add
Long uid = db.insert("zhichu", JZzhichu.ZC_YEAR, values);
this.close();
return uid;
}
/*
* 添加收入记录
* */
public Long SaveShouRuInfo(JZshouru shouru){
ContentValues values = new ContentValues();
values.put(JZshouru.SR_ITEM, shouru.getSr_Item());
values.put(JZshouru.SR_YEAR, shouru.getSr_Year());
values.put(JZshouru.SR_MONTH, shouru.getSr_Month());
values.put(JZshouru.SR_WEEK, shouru.getSr_Week());
values.put(JZshouru.SR_DAY, shouru.getSr_Day());
values.put(JZshouru.SR_TIME, shouru.getSr_Time());
values.put(JZshouru.SR_COUNT, shouru.getSr_Count());
values.put(JZshouru.SR_BEIZHU, shouru.getSr_Beizhu());
values.put(JZshouru.SR_USER, shouru.getSr_User());
Long uid = db.insert("shouru", JZshouru.SR_YEAR, values);
this.close();
return uid;
}
/*
* 删除支出表的记录
* */
public int DelZhiChuInfo(int id){
int iddel= db.delete("zhichu", "ID ="+id, null);
this.close();
return iddel;
}
/*
* 删除所有记录
* */
public void delAll(String userName){
db.delete("zhichu","ZC_USER ="+"'"+userName+"'", null);
db.delete("shouru", "SR_USER ="+"'"+userName+"'", null);
}
/*
* 删除收入表的记录
* */
public int DelShouRuInfo(int id){
int iddel= db.delete("shouru", "ID ="+id, null);
this.close();
return iddel;
}
/*
* 用于判断当月记账是否连续3天超出平均值
* */
public boolean isBeyond(JZzhichu zhichu, int budget) {
// boolean flag = false;
int flag = 0;
int average=0;//平均值
if(GetTime.getMonth()!= zhichu.getZc_Month()||zhichu.getZc_Day()<3){ //不在当前月份的记账不考虑 当月前记账两天不考虑
return false;
}
average=(int)Math.floor(budget/30);//假设一个月30天吧
int dayCount =0;
for(int i=2;i>=0;i--) {
String selectionMonth = JZzhichu.ZC_USER + "='" + zhichu.getZc_User() + "'" + " and " + JZzhichu.ZC_YEAR + "=" + GetTime.getYear() + " and " + JZzhichu.ZC_MONTH + "=" + GetTime.getMonth() + " and " + JZzhichu.ZC_DAY + "=" + (zhichu.getZc_Day() - i);
List<JZzhichu> zhichuMonthList = GetZhiChuList(selectionMonth);
if (zhichuMonthList != null) {
for (JZzhichu zhichu2 : zhichuMonthList) {
dayCount += zhichu2.getZc_Count();
}
if (i == 0) {
dayCount += zhichu.getZc_Count();//加上今天这次记账
}
if (dayCount > average) {
// flag = flag & true;
flag ++;
}
dayCount = 0;
}
}
if (flag==3){
return true;
}
return false;
}
}
| [
"362046076@qq.com"
] | 362046076@qq.com |
70dfe870b9996b3f7a8b2702244c7350834b6791 | 87e3d71ad952f6b495592a0dd7bb696ed999bb3d | /web/src/main/java/crd/student/api/controller/WxApiController.java | 933b3304906174e61171ccb83e7208f7a3b310f6 | [] | no_license | chenrongda/student_api | 8b4bdeb0f95cb8169aa4a20e5806ff9fb2b58a29 | c0203d98842bde34f1b5ed58b269aa59da624085 | refs/heads/master | 2020-04-22T08:21:31.907465 | 2019-02-12T03:14:42 | 2019-02-12T03:14:42 | 170,240,577 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,392 | java | package crd.student.api.controller;
import crd.student.api.common.DefaultValue;
import crd.student.api.model.Score;
import crd.student.api.model.Student;
import crd.student.api.reponse.Result;
import crd.student.api.reponse.StudentExam;
import crd.student.api.service.IScoreService;
import crd.student.api.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Controller
@RequestMapping(value = "wxApi")
public class WxApiController {
@Autowired
private IStudentService iStudentService;
@Autowired
private IScoreService iScoreService;
@RequestMapping(value = "/wxLogin")
@ResponseBody
public Result wxLogin(String studentName,String phone) {
if (studentName != "" && phone != "") {
Student requestStudent = new Student();
requestStudent.setName(studentName);
requestStudent.setPhone(phone);
Student student = iStudentService.findStudent(requestStudent);
if (student != null) {
return new Result(DefaultValue.REPONSE_SUCCESS_CODE, "验证通过", student);
} else {
return new Result(DefaultValue.REPONSE_FAIL_CODE, "信息不正确");
}
} else {
return new Result(DefaultValue.REPONSE_FAIL_CODE, "学生姓名及电话不能为空");
}
}
@RequestMapping(value = "/getExamList")
@ResponseBody
public Result getExamList(@RequestBody Student student) {
if (student.getId() != null) {
List<StudentExam> studentExamList = iStudentService.getExamList(student);
return new Result(DefaultValue.REPONSE_SUCCESS_CODE,"成功",studentExamList);
} else {
return new Result(DefaultValue.REPONSE_FAIL_CODE, "参数错误");
}
}
@RequestMapping(value = "/getStudentScore")
@ResponseBody
public Result getStudentScore(Integer examId,Integer studentId){
if(examId != null & studentId != null){
Score score = iScoreService.getStudentScore(examId,studentId);
return new Result(DefaultValue.REPONSE_SUCCESS_CODE,"成功",score);
}else{
return new Result(DefaultValue.REPONSE_FAIL_CODE,"参数错误");
}
}
}
| [
"510104023@qq.com"
] | 510104023@qq.com |
929bed305354f4b9da01b439c327aad497982ca0 | 61f4bce6d63d39c03247c35cfc67e03c56e0b496 | /src/dyno/swing/designer/properties/editors/accessibles/AccessibleListModelEditor.java | ca87b51764e8a2e138a6a1d1d4afd87b3b035b06 | [] | no_license | phalex/swing_designer | 570cff4a29304d52707c4fa373c9483bbdaa33b9 | 3e184408bcd0aab6dd5b4ba8ae2aaa3f846963ff | refs/heads/master | 2021-01-01T20:38:49.845289 | 2012-12-17T06:50:11 | 2012-12-17T06:50:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,465 | java | /*
* AccessibleComboBoxModelEditor.java
*
* Created on 2007-8-28, 0:45:25
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package dyno.swing.designer.properties.editors.accessibles;
import dyno.swing.designer.properties.editors.*;
import dyno.swing.designer.properties.wrappers.ListModelWrapper;
import java.awt.Frame;
import java.awt.Window;
import javax.swing.ListModel;
import javax.swing.SwingUtilities;
/**
*
* @author William Chen
*/
public class AccessibleListModelEditor extends UneditableAccessibleEditor {
private ListModelDialog dialog;
/** Creates a new instance of AccessibleColorEditor */
public AccessibleListModelEditor() {
super(new ListModelWrapper());
}
protected void popupDialog() {
if (dialog == null) {
Frame frame;
Window win = SwingUtilities.getWindowAncestor(this);
if (win instanceof Frame) {
frame = (Frame) win;
} else {
frame = new Frame();
}
dialog = new ListModelDialog(frame, true);
dialog.setElementWrapper(((ListModelWrapper) encoder).getElementWrapper());
dialog.setLocationRelativeTo(this);
}
dialog.setModel((ListModel) getValue());
dialog.setVisible(true);
if(dialog.isOK()){
setValue(dialog.getModel());
fireStateChanged();
}
}
} | [
"584874132@qq.com"
] | 584874132@qq.com |
1a47ef157be50c24014db075212ef2ff8bbb23eb | 0f1f7332b8b06d3c9f61870eb2caed00aa529aaa | /ebean/tags/v2.6.0/src/main/java/com/avaje/ebeaninternal/server/type/ScalarTypeBase.java | 9f7467969b5cbc90df7203d800d242e5fa44c28b | [] | no_license | rbygrave/sourceforge-ebean | 7e52e3ef439ed64eaf5ce48e0311e2625f7ee5ed | 694274581a188be664614135baa3e4697d52d6fb | refs/heads/master | 2020-06-19T10:29:37.011676 | 2019-12-17T22:09:29 | 2019-12-17T22:09:29 | 196,677,514 | 1 | 0 | null | 2019-12-17T22:07:13 | 2019-07-13T04:21:16 | Java | UTF-8 | Java | false | false | 2,793 | java | /**
* Copyright (C) 2006 Robin Bygrave
*
* This file is part of Ebean.
*
* Ebean is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* Ebean 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 Ebean; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.avaje.ebeaninternal.server.type;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import com.avaje.ebean.text.json.JsonValueAdapter;
/**
* Base ScalarType object.
*/
public abstract class ScalarTypeBase<T> implements ScalarType<T> {
protected final Class<T> type;
protected final boolean jdbcNative;
protected final int jdbcType;
public ScalarTypeBase(Class<T> type, boolean jdbcNative, int jdbcType) {
this.type = type;
this.jdbcNative = jdbcNative;
this.jdbcType = jdbcType;
}
public Object readData(DataInput dataInput) throws IOException {
String s = dataInput.readUTF();
return parse(s);
}
public void writeData(DataOutput dataOutput, Object v) throws IOException {
String s = format(v);
dataOutput.writeUTF(s);
}
/**
* Just return 0.
*/
public int getLength() {
return 0;
}
public boolean isJdbcNative() {
return jdbcNative;
}
public int getJdbcType() {
return jdbcType;
}
public Class<T> getType() {
return type;
}
@SuppressWarnings("unchecked")
public String format(Object v) {
return formatValue((T)v);
}
/**
* Return true if the value is null.
*/
public boolean isDbNull(Object value) {
return value == null;
}
/**
* Returns the value that was passed in.
*/
public Object getDbNullValue(Object value) {
return value;
}
public void loadIgnore(DataReader dataReader) {
dataReader.incrementPos(1);
}
public void accumulateScalarTypes(String propName, CtCompoundTypeScalarList list) {
list.addScalarType(propName, this);
}
public String jsonToString(T value, JsonValueAdapter ctx) {
return formatValue(value);
}
public T jsonFromString(String value, JsonValueAdapter ctx) {
return parse(value);
}
}
| [
"208973+rbygrave@users.noreply.github.com"
] | 208973+rbygrave@users.noreply.github.com |
51d26acddb085266de3abe01d0a29c6c2dc72df4 | 00e5475b5093288e65b2c1090745d2a1ae7e5579 | /app/src/main/java/com/example/mantraapp/ui/share/ShareFragment.java | c20100c6450bb84fdcbd55edc1dcfaf9b8047ecc | [] | no_license | Brejesh1234/E-commerce_app | 0664894b4157fb813c9c4b648546b49ecf5ac194 | a8f82295db7a0822e4323f85e6e9b018f85ce166 | refs/heads/master | 2023-07-02T07:28:05.997872 | 2021-08-09T08:18:30 | 2021-08-09T08:18:30 | 348,821,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,142 | java | package com.example.mantraapp.ui.share;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.example.mantraapp.R;
public class ShareFragment extends Fragment {
private ShareViewModel shareViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
shareViewModel =
ViewModelProviders.of(this).get(ShareViewModel.class);
View root = inflater.inflate(R.layout.fragment_share, container, false);
final TextView textView = root.findViewById(R.id.text_share);
shareViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"brejeshjeet@gmail.com"
] | brejeshjeet@gmail.com |
eb097a7eb26a9e6077f10beaf829bff2cf1721de | fb4287b54a3e771f5703d8c717b465f43c4f8970 | /YBW3.0/src/com/scsy150/volley/net/UpLoadAvatar.java | fe6660b216ca34065d522e802c1d285e47525316 | [] | no_license | chengchangmu/150 | 3a83a644a4aae43607aff86821234a49415d7ef0 | ddd87080bc4a1c361a9899b86f98b0a041549da1 | refs/heads/master | 2016-08-11T17:24:07.836575 | 2015-10-24T03:04:12 | 2015-10-24T03:14:00 | 44,849,706 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,915 | java | package com.scsy150.volley.net;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Date;
import android.content.Context;
import android.content.SharedPreferences;
import com.scsy150.consts.MzApi;
import com.scsy150.consts.SystemConsts;
import com.scsy150.util.MD5Util;
import com.scsy150.util.TimeUtil;
public class UpLoadAvatar {
static Context context;
public UpLoadAvatar() {
}
public UpLoadAvatar(Context context) {
UpLoadAvatar.context = context;
}
/**
* 上传头像,使用此方法时,需放在异步操作或者非主线程中
*
* @param 需要上传的图像文件
* @return
*/
public String uploadImg(File file) {
String url = uploadFile(MzApi.UPLOADAVATAR, file);
return url;
}
/**
* 上传相册照片,使用此方法时,需放在异步操作或者非主线程中
*
* @param 需要上传的图像文件
* @return
*/
public String uploadPhoto(File file) {
String url = uploadFile(MzApi.UPLOADPHOTOS, file);
return url;
}
/**
* 通过URI下载文件,保存到file文件里
*
* @param URI
* @param file
* @return
*/
private static String uploadFile(String URI, File file) {
try {
return uploadFile(URI, new FileInputStream(file), file.getName());
} catch (FileNotFoundException e) {
e.printStackTrace();
return "";
}
}
/**
* 通过URI下载文件,保存到InputStream is里去
*
* @param URI
* @param is
* @param fname
* @return
*/
private static String uploadFile(String URI, InputStream is, String fname) {
try {
// LogUtils.d("TAG", "开始具体上传代码");
String cookies = LoadCookies();
// 以下3个字符串有必要在做urlconnection时做复杂的拼接吗?感觉好鸡肋
// String boundary = "*****" + System.currentTimeMillis();
// String twoHyphens = "--";
// String end = "\r\n";
URL url = new URL(URI);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Cookie", cookies);
connection.setRequestProperty("Connection", "Keep-Alive");
connection.setRequestProperty("Charset", "UTF-8");
byte[] buf = new byte[1024];
OutputStream osw = connection.getOutputStream();
while (is.read(buf) != -1) {
osw.write(buf);
}
osw.flush();
osw.close();
is.close();
// Log.i("life!", connection.getResponseCode() + "");
String jsonObject = getResponseStr(connection);
return jsonObject;
} catch (Exception e) {
// Log.i("result", "catch -------------" + e.getMessage());
e.printStackTrace();
return "";
}
}
private static String getResponseStr(HttpURLConnection connection) {
try {
int length;
InputStream ins = connection.getInputStream();
byte[] result = new byte[1024];
StringBuffer sb = new StringBuffer();
while ((length = ins.read(result)) > 0) {
String str = new String(result, 0, length);
// Log.i("result",length+"test----"+str);
sb.append(str);
str = null;
}
String jsonObject = sb.toString().trim();
// LogUtils.d("TAG", "返回的json"+jsonObject);
return jsonObject;
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/** 从SharedPreferences读取cookies **/
public static String LoadCookies() {
SharedPreferences spf = context.getSharedPreferences(
SystemConsts.COOKIES, 0);
String cookies = spf.getString("cookies", "");
if (!"".equals(cookies)) {
return cookies;
}
return "";
}
}
| [
"ZCAPP3@zengxin"
] | ZCAPP3@zengxin |
3b1559d4ba694220a91e7382a3437828dd97460a | c1e4dd152ada287a824dbf0b1aa8d5384e585dcf | /src/maximumareahistrogram/MaximumHistrogramAreaTest.java | 12f13306f027f2abf737c5da8384cb578322de0f | [] | no_license | ajanac/HistrogramProblem | 12b58218dd790bcb4f222705e6a3f1d443bb70f3 | 1c369487b52820455eec79e989f9f1bf8e68958c | refs/heads/master | 2021-01-19T03:51:08.473182 | 2017-04-05T17:22:46 | 2017-04-05T17:22:46 | 87,334,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package maximumareahistrogram;
import static org.junit.Assert.*;
import org.junit.Test;
public class MaximumHistrogramAreaTest {
@Test
public void test() {
MaximumHistrogramArea obj=new MaximumHistrogramArea();
int input[]={1,2,4};
int maxArea=obj.maximumHistaArea(input);
assertEquals(4,maxArea);
}
}
| [
"ajanacs@gmail.com"
] | ajanacs@gmail.com |
72cfb492ab39f59ca89333b619e3aa6490772a9f | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /P40_HarmonyOS_2.0.0_Developer_Beta1/src/main/java/android/hardware/radio/V1_2/VoiceRegStateResult.java | f53faabf90994ad0ef8077d83bd7d98a2f611e36 | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,484 | java | package android.hardware.radio.V1_2;
import android.hardware.radio.V1_0.RegState;
import android.os.HidlSupport;
import android.os.HwBlob;
import android.os.HwParcel;
import java.util.ArrayList;
import java.util.Objects;
public final class VoiceRegStateResult {
public CellIdentity cellIdentity = new CellIdentity();
public boolean cssSupported;
public int defaultRoamingIndicator;
public int rat;
public int reasonForDenial;
public int regState;
public int roamingIndicator;
public int systemIsInPrl;
public final boolean equals(Object otherObject) {
if (this == otherObject) {
return true;
}
if (otherObject == null || otherObject.getClass() != VoiceRegStateResult.class) {
return false;
}
VoiceRegStateResult other = (VoiceRegStateResult) otherObject;
if (this.regState == other.regState && this.rat == other.rat && this.cssSupported == other.cssSupported && this.roamingIndicator == other.roamingIndicator && this.systemIsInPrl == other.systemIsInPrl && this.defaultRoamingIndicator == other.defaultRoamingIndicator && this.reasonForDenial == other.reasonForDenial && HidlSupport.deepEquals(this.cellIdentity, other.cellIdentity)) {
return true;
}
return false;
}
public final int hashCode() {
return Objects.hash(Integer.valueOf(HidlSupport.deepHashCode(Integer.valueOf(this.regState))), Integer.valueOf(HidlSupport.deepHashCode(Integer.valueOf(this.rat))), Integer.valueOf(HidlSupport.deepHashCode(Boolean.valueOf(this.cssSupported))), Integer.valueOf(HidlSupport.deepHashCode(Integer.valueOf(this.roamingIndicator))), Integer.valueOf(HidlSupport.deepHashCode(Integer.valueOf(this.systemIsInPrl))), Integer.valueOf(HidlSupport.deepHashCode(Integer.valueOf(this.defaultRoamingIndicator))), Integer.valueOf(HidlSupport.deepHashCode(Integer.valueOf(this.reasonForDenial))), Integer.valueOf(HidlSupport.deepHashCode(this.cellIdentity)));
}
public final String toString() {
return "{.regState = " + RegState.toString(this.regState) + ", .rat = " + this.rat + ", .cssSupported = " + this.cssSupported + ", .roamingIndicator = " + this.roamingIndicator + ", .systemIsInPrl = " + this.systemIsInPrl + ", .defaultRoamingIndicator = " + this.defaultRoamingIndicator + ", .reasonForDenial = " + this.reasonForDenial + ", .cellIdentity = " + this.cellIdentity + "}";
}
public final void readFromParcel(HwParcel parcel) {
readEmbeddedFromParcel(parcel, parcel.readBuffer(120), 0);
}
public static final ArrayList<VoiceRegStateResult> readVectorFromParcel(HwParcel parcel) {
ArrayList<VoiceRegStateResult> _hidl_vec = new ArrayList<>();
HwBlob _hidl_blob = parcel.readBuffer(16);
int _hidl_vec_size = _hidl_blob.getInt32(8);
HwBlob childBlob = parcel.readEmbeddedBuffer((long) (_hidl_vec_size * 120), _hidl_blob.handle(), 0, true);
_hidl_vec.clear();
for (int _hidl_index_0 = 0; _hidl_index_0 < _hidl_vec_size; _hidl_index_0++) {
VoiceRegStateResult _hidl_vec_element = new VoiceRegStateResult();
_hidl_vec_element.readEmbeddedFromParcel(parcel, childBlob, (long) (_hidl_index_0 * 120));
_hidl_vec.add(_hidl_vec_element);
}
return _hidl_vec;
}
public final void readEmbeddedFromParcel(HwParcel parcel, HwBlob _hidl_blob, long _hidl_offset) {
this.regState = _hidl_blob.getInt32(0 + _hidl_offset);
this.rat = _hidl_blob.getInt32(4 + _hidl_offset);
this.cssSupported = _hidl_blob.getBool(8 + _hidl_offset);
this.roamingIndicator = _hidl_blob.getInt32(12 + _hidl_offset);
this.systemIsInPrl = _hidl_blob.getInt32(16 + _hidl_offset);
this.defaultRoamingIndicator = _hidl_blob.getInt32(20 + _hidl_offset);
this.reasonForDenial = _hidl_blob.getInt32(24 + _hidl_offset);
this.cellIdentity.readEmbeddedFromParcel(parcel, _hidl_blob, 32 + _hidl_offset);
}
public final void writeToParcel(HwParcel parcel) {
HwBlob _hidl_blob = new HwBlob(120);
writeEmbeddedToBlob(_hidl_blob, 0);
parcel.writeBuffer(_hidl_blob);
}
public static final void writeVectorToParcel(HwParcel parcel, ArrayList<VoiceRegStateResult> _hidl_vec) {
HwBlob _hidl_blob = new HwBlob(16);
int _hidl_vec_size = _hidl_vec.size();
_hidl_blob.putInt32(8, _hidl_vec_size);
_hidl_blob.putBool(12, false);
HwBlob childBlob = new HwBlob(_hidl_vec_size * 120);
for (int _hidl_index_0 = 0; _hidl_index_0 < _hidl_vec_size; _hidl_index_0++) {
_hidl_vec.get(_hidl_index_0).writeEmbeddedToBlob(childBlob, (long) (_hidl_index_0 * 120));
}
_hidl_blob.putBlob(0, childBlob);
parcel.writeBuffer(_hidl_blob);
}
public final void writeEmbeddedToBlob(HwBlob _hidl_blob, long _hidl_offset) {
_hidl_blob.putInt32(0 + _hidl_offset, this.regState);
_hidl_blob.putInt32(4 + _hidl_offset, this.rat);
_hidl_blob.putBool(8 + _hidl_offset, this.cssSupported);
_hidl_blob.putInt32(12 + _hidl_offset, this.roamingIndicator);
_hidl_blob.putInt32(16 + _hidl_offset, this.systemIsInPrl);
_hidl_blob.putInt32(20 + _hidl_offset, this.defaultRoamingIndicator);
_hidl_blob.putInt32(24 + _hidl_offset, this.reasonForDenial);
this.cellIdentity.writeEmbeddedToBlob(_hidl_blob, 32 + _hidl_offset);
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
72082cfcf637c310aecbc3b6357e54609d016447 | 72d02201a0cfe57885ef3ce31f6c5df176c537b3 | /src/chapter13/FileStreamDemo.java | 9b47d066dab48620c4612d4ecb107ec83e75e185 | [] | no_license | yuniler/beautifulDay | 21ec1e50a070d77798ba9d9312fd0af2a86809c6 | 33b171e7025c3612f89f5ae428a5d78c54dca627 | refs/heads/master | 2020-12-11T11:13:42.728823 | 2020-02-12T15:22:08 | 2020-02-12T15:22:08 | 233,832,587 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,663 | java | package chapter13;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
/**
* 演示文件输入。输出流的基本用法
* 注意,目前的读写方式比较元素,在这里熟悉InputStrean/OutputStream的一些方法
* 会有高级方法在后面
* @author sunguangyu
*
*/
public class FileStreamDemo {
private static final String FilePath = "src/chapter13/FileDemo.java";
public static void main(String[] args) throws IOException {
ReadFile();
}
public static void writeFile() throws IOException{
final String FilePath1 = "src/chapter13/FileDemo1.java";
OutputStream outStream = new FileOutputStream(FilePath1);
String content = "public static void main(String[] args){\n";
content += "System.out.println(\"Hello World!\");\n}";
outStream.write(content.getBytes());//核心语句,将字符串转换成字节数组,写入到文件中
//写完一定要记得关闭打开的资源
outStream.close();
}
public static void ReadFile() throws IOException{
File file = new File(FilePath);
InputStream inputStream = new FileInputStream(file);
//inputStream.available()获取输入流可以读取的文件大小
//读取文件的基本操作
byte[] bytes = new byte[20000];
int count = 0;
inputStream.read(bytes);
// while((bytes[count] = (byte)inputStream.read()) != -1){
// count++;
// }
String content = new String(bytes);//将读取出的字节数组转换成字符串,以便打印
System.out.println(content);
inputStream.close();
}
}
| [
"sunguangyuniler@163.com"
] | sunguangyuniler@163.com |
fb17435a260a1566e6a3d2479f601022f629cf62 | 7346901d3bd4beb3e19600671ea7a251aa219037 | /PrejudgeGame/PrejudgeGameModule/src/multi/premier/demoo/version01/MultibuffException.java | 07e1f6bb92985c64347f5782f5ef78a8ef7e14ec | [] | no_license | YiFan-Evan/strategic-game | 7ace1d16dda6317e998d8566c1acfe59cf77dc53 | 45ba5904becca17ef2f2e22eae5b480c0cfc6ed4 | refs/heads/main | 2023-08-25T06:09:36.130521 | 2021-10-24T04:19:25 | 2021-10-24T04:19:25 | 344,667,480 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 94 | java | package multi.premier.demoo.version01;
public class MultibuffException extends Exception {
}
| [
"61977364+YiFan-Evan@users.noreply.github.com"
] | 61977364+YiFan-Evan@users.noreply.github.com |
af3c605a7b5d7764c5643f021757a1958deb9a99 | 16a292ceef1df62ab31f0e6746a72b26c79c1d32 | /src/main/java/mabaya/assignment/AssignmentApplication.java | b4db8d882922f435c64c5e7341ad101cc7ef91c2 | [] | no_license | DavidRadchenko/mabayaExam | a2f42b2a24fa286062b3322928a18aeb675528e6 | a4bb826b99d63f13dd07dc5bc7c5172e2d274611 | refs/heads/master | 2022-10-14T22:34:38.818708 | 2020-06-14T18:39:06 | 2020-06-14T18:39:06 | 272,256,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package mabaya.assignment;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AssignmentApplication {
public static void main(String[] args) {
SpringApplication.run(AssignmentApplication.class, args);
System.out.println("Server Started!");
}
}
| [
"val10293@gmail.com"
] | val10293@gmail.com |
7b74ead188aa9d1b38bd6d0043c5388652d082df | a66a4d91639836e97637790b28b0632ba8d0a4f9 | /src/generators/sorting/StoogeSortHL.java | 897c7411eb9cf7aff8f4be1e9e7b5b14176bb1f3 | [] | no_license | roessling/animal-av | 7d0ba53dda899b052a6ed19992fbdfbbc62cf1c9 | 043110cadf91757b984747750aa61924a869819f | refs/heads/master | 2021-07-13T05:31:42.223775 | 2020-02-26T14:47:31 | 2020-02-26T14:47:31 | 206,062,707 | 0 | 2 | null | 2020-10-13T15:46:14 | 2019-09-03T11:37:11 | Java | UTF-8 | Java | false | false | 13,505 | java | package generators.sorting;
import generators.framework.Generator;
import generators.framework.GeneratorType;
import generators.framework.properties.AnimationPropertiesContainer;
import java.awt.Color;
import java.awt.Font;
import java.util.Hashtable;
import java.util.Locale;
import algoanim.animalscript.AnimalScript;
import algoanim.primitives.ArrayMarker;
import algoanim.primitives.IntArray;
import algoanim.primitives.SourceCode;
import algoanim.primitives.Text;
import algoanim.primitives.generators.Language;
import algoanim.properties.AnimationPropertiesKeys;
import algoanim.properties.ArrayMarkerProperties;
import algoanim.properties.ArrayProperties;
import algoanim.properties.RectProperties;
import algoanim.properties.SourceCodeProperties;
import algoanim.properties.TextProperties;
import algoanim.util.Coordinates;
import algoanim.util.MsTiming;
import algoanim.util.Offset;
public class StoogeSortHL implements Generator {
private Language lang;
private int[] arrayData;
private IntArray arr;
private ArrayProperties arrayProperties;
private ArrayMarkerProperties leftProperties, rightProperties;
private ArrayMarker leftMarker, rightMarker;
private SourceCodeProperties codeProperties;
private SourceCode code;
public StoogeSortHL() {
// Parameterloser Konstruktor
}
@Override
public String generate(AnimationPropertiesContainer props,
Hashtable<String, Object> primitives) {
arrayData = (int[]) primitives.get("array");
init();
// ArrayProperties uebernehmen
arrayProperties = new ArrayProperties();
arrayProperties.set(AnimationPropertiesKeys.COLOR_PROPERTY,
props.get("array", AnimationPropertiesKeys.COLOR_PROPERTY));
arrayProperties.set(AnimationPropertiesKeys.FILL_PROPERTY,
props.get("array", AnimationPropertiesKeys.FILL_PROPERTY));
arrayProperties.set(AnimationPropertiesKeys.FILLED_PROPERTY,
props.get("array", AnimationPropertiesKeys.FILLED_PROPERTY));
arrayProperties.set(AnimationPropertiesKeys.ELEMENTCOLOR_PROPERTY,
props.get("array", AnimationPropertiesKeys.ELEMENTCOLOR_PROPERTY));
arrayProperties.set(AnimationPropertiesKeys.ELEMHIGHLIGHT_PROPERTY,
props.get("array", AnimationPropertiesKeys.ELEMHIGHLIGHT_PROPERTY));
arrayProperties.set(AnimationPropertiesKeys.CELLHIGHLIGHT_PROPERTY,
props.get("array", AnimationPropertiesKeys.CELLHIGHLIGHT_PROPERTY));
arr = lang.newIntArray(new Coordinates(20, 140), arrayData, "arr", null,
arrayProperties);
lang.nextStep();
// leftMarkerProperties uebernehmen
leftProperties = new ArrayMarkerProperties();
leftProperties.set(AnimationPropertiesKeys.COLOR_PROPERTY,
props.get("left", AnimationPropertiesKeys.COLOR_PROPERTY));
leftProperties.set(AnimationPropertiesKeys.LABEL_PROPERTY,
props.get("left", AnimationPropertiesKeys.LABEL_PROPERTY));
leftProperties.set(AnimationPropertiesKeys.HIDDEN_PROPERTY, true);
leftMarker = lang.newArrayMarker(arr, 0, "left", null, leftProperties);
leftMarker.hide();
// rightMarkerProperties uebernehmen
rightProperties = new ArrayMarkerProperties();
rightProperties.set(AnimationPropertiesKeys.COLOR_PROPERTY,
props.get("right", AnimationPropertiesKeys.COLOR_PROPERTY));
rightProperties.set(AnimationPropertiesKeys.LABEL_PROPERTY,
props.get("right", AnimationPropertiesKeys.LABEL_PROPERTY));
rightProperties.set(AnimationPropertiesKeys.HIDDEN_PROPERTY, true); // diese
// Eigentschaft
// ist
// fest
// kodiert
rightMarker = lang.newArrayMarker(arr, 0, "right", null, rightProperties);
rightMarker.hide();
// codeProperties uebernehmen
codeProperties = new SourceCodeProperties();
codeProperties.set(AnimationPropertiesKeys.BOLD_PROPERTY,
props.get("sourceCode", AnimationPropertiesKeys.BOLD_PROPERTY));
codeProperties.set(AnimationPropertiesKeys.COLOR_PROPERTY,
props.get("sourceCode", AnimationPropertiesKeys.COLOR_PROPERTY));
codeProperties.set(AnimationPropertiesKeys.HIGHLIGHTCOLOR_PROPERTY, props
.get("sourceCode", AnimationPropertiesKeys.HIGHLIGHTCOLOR_PROPERTY));
codeProperties.set(AnimationPropertiesKeys.FONT_PROPERTY,
props.get("sourceCode", AnimationPropertiesKeys.FONT_PROPERTY));
codeProperties.set(AnimationPropertiesKeys.CONTEXTCOLOR_PROPERTY,
props.get("sourceCode", AnimationPropertiesKeys.CONTEXTCOLOR_PROPERTY));
codeProperties.set(AnimationPropertiesKeys.ITALIC_PROPERTY,
props.get("sourceCode", AnimationPropertiesKeys.ITALIC_PROPERTY));
codeProperties.set(AnimationPropertiesKeys.SIZE_PROPERTY,
props.get("sourceCode", AnimationPropertiesKeys.SIZE_PROPERTY));
code = lang.newSourceCode(new Coordinates(20, 190), "sourceCode", null,
codeProperties);
makeCode();
lang.nextStep();
arr.highlightCell(0, arrayData.length - 1, null, null);
lang.nextStep();
stoogeSort(arr, 0, arr.getLength());
return lang.toString();
}
@Override
public void init() {
lang = new AnimalScript(getName(), getAnimationAuthor(), 640, 480);
lang.setStepMode(true);
// Header
RectProperties rectProperties = new RectProperties();
rectProperties.set(AnimationPropertiesKeys.FILLED_PROPERTY, true);
rectProperties.set(AnimationPropertiesKeys.FILL_PROPERTY, Color.ORANGE);
rectProperties.set(AnimationPropertiesKeys.DEPTH_PROPERTY, 2);
TextProperties headerProperties = new TextProperties();
headerProperties.set(AnimationPropertiesKeys.FONT_PROPERTY, new Font(
"SansSerif", Font.BOLD, 24));
Text header = lang.newText(new Coordinates(20, 30), "StoogeSort", "header",
null, headerProperties);
lang.newRect(new Offset(-5, -5, header, AnimalScript.DIRECTION_NW),
new Offset(5, 5, header, AnimalScript.DIRECTION_SE), "hRect", null,
rectProperties);
lang.nextStep();
TextProperties textProperties = new TextProperties();
textProperties.set(AnimationPropertiesKeys.FONT_PROPERTY, new Font(
"SansSerif", Font.BOLD, 14));
Text text1 = lang
.newText(
new Coordinates(20, 90),
"1. Sind das erste und das letzte Element nicht in der richtigen Reihenfolge, so werden sie vertauscht.",
"descr", null, textProperties);
Text text2 = lang
.newText(
new Coordinates(20, 130),
"2. Sind mehr als zwei Elemente in der Liste - fortsetzen, sonst abbrechen.",
"descr1", null, textProperties);
Text text3 = lang.newText(new Coordinates(20, 160),
"3. Sortiere die ersten zwei Drittel der Liste.", "descr3", null,
textProperties);
Text text4 = lang.newText(new Coordinates(20, 190),
"4. Sortiere die letzten zwei Drittel der Liste.", "descr4", null,
textProperties);
Text text5 = lang.newText(new Coordinates(20, 220),
"5. Sortiere die ersten zwei Drittel der Liste.", "descr5", null,
textProperties);
Text text6 = lang
.newText(
new Coordinates(20, 280),
"Komplexitaet: O(n^2.71) [Bemerkung: StoogeSort zaehlt eher zu unpraktischen Algorithmen]",
"descr6", null, textProperties);
lang.nextStep();
text1.hide();
text2.hide();
text3.hide();
text4.hide();
text5.hide();
text6.hide();
}
public void makeCode() {
code.addCodeLine("public static void sort(int[] a, int left, int right) {",
null, 0, null);
code.addCodeLine("if (a[right-1] < a[left]){", null, 1, null);
code.addCodeLine("int temp = a[left];", null, 2, null);
code.addCodeLine("a[left] = a[right-1];", null, 2, null);
code.addCodeLine("a[right-1] = temp;", null, 2, null);
code.addCodeLine("}", null, 1, null);
code.addCodeLine("int len = right-left;", null, 1, null);
code.addCodeLine("if (len > 2) {", null, 1, null);
code.addCodeLine("int third=len/3;", null, 2, null);
code.addCodeLine(
"stoogeSort(a, left, right-third); // sortiere die ersten 2/3", null,
2, null);
code.addCodeLine(
"stoogeSort(a, left+third, right); // sortiere die letzten 2/3", null,
2, null);
code.addCodeLine(
"stoogeSort(a, left, right-third); // sortiere die ersten 2/3", null,
2, null);
code.addCodeLine("}", null, 1, null);
code.addCodeLine("}", null, 0, null);
}
public void goToFunk() {
code.highlight(0, 0, true);
code.highlight(13, 0, true);
}
public void goFromFunk() {
code.unhighlight(0);
code.unhighlight(13);
}
public void goToIf1() {
code.highlight(1, 0, true);
code.highlight(5, 0, true);
}
public void goFromIf1() {
code.unhighlight(1);
code.unhighlight(5);
}
public void goToIf2() {
code.highlight(7, 0, true);
code.highlight(12, 0, true);
}
public void goFromIf2() {
code.unhighlight(7);
code.unhighlight(12);
}
public void unhightLightAll() {
for (int i = 0; i < 14; i++)
code.unhighlight(i);
}
public void stoogeSort(IntArray a, int left, int right) {
unhightLightAll();
code.highlight(0);
lang.nextStep();
code.unhighlight(0);
code.highlight(1);
lang.nextStep();
leftMarker.move(left, null, null);
leftMarker.show();
rightMarker.move(right - 1, null, null);
rightMarker.show();
lang.nextStep();
a.highlightElem(left, null, null);
a.highlightElem(right - 1, null, null);
lang.nextStep();
if (a.getData(right - 1) < a.getData(left)) {
code.unhighlight(1);
goToIf1();
code.highlight(2);
code.highlight(3);
code.highlight(4);
lang.nextStep();
arr.swap(left, right - 1, null, new MsTiming(1000));
lang.nextStep();
code.unhighlight(2);
code.unhighlight(3);
code.unhighlight(4);
}
goFromIf1();
a.unhighlightElem(left, null, null);
a.unhighlightElem(right - 1, null, null);
leftMarker.hide();
rightMarker.hide();
int len = right - left;
code.highlight(6);
lang.nextStep();
code.unhighlight(6);
code.highlight(7);
lang.nextStep();
if (len > 2) {
goToIf2();
code.highlight(8);
int third = len / 3; // abgerundene Integer-Division
lang.nextStep();
// erster rekursiver Aufrunf
code.unhighlight(8);
code.highlight(9);
lang.nextStep();
arr.unhighlightCell(0, a.getLength() - 1, null, null);
arr.highlightCell(left, right - third - 1, null, null);
lang.nextStep();
stoogeSort(a, left, right - third); // sortiere die ersten 2/3
// zweiter rekursiver Aufrunf
unhightLightAll();
code.highlight(10);
lang.nextStep();
arr.unhighlightCell(0, a.getLength() - 1, null, null);
arr.highlightCell(left + third, right - 1, null, null);
lang.nextStep();
stoogeSort(a, left + third, right); // sortiere die letzten 2/3
// dritter rekursiver Aufrunf
unhightLightAll();
code.highlight(11);
lang.nextStep();
arr.unhighlightCell(0, a.getLength() - 1, null, null);
arr.highlightCell(left, right - third - 1, null, null);
lang.nextStep();
stoogeSort(a, left, right - third); // sortiere die ersten 2/3
}
goFromIf2();
arr.unhighlightCell(0, arr.getLength() - 1, null, null);
}
@Override
public String getAlgorithmName() {
return "Stooge Sort";
}
@Override
public String getAnimationAuthor() {
return "Hlib Levitin";
}
@Override
public String getCodeExample() {
String code = "public void stoogeSort(int[] a, int left, int right) {\n"
+ " if (a[right-1] < a[left]) {\n" + " int temp = a[left];\n"
+ " a[left] = a[right-1];\n" + " a[right-1] = temp;\n" + " }\n"
+ " int len = right-left;\n" + " if (len > 2) {\n"
+ " int third = len/3;\n"
+ " stoogeSort(a, left, right-third);\n"
+ " stoogeSort(a, left+third, right);\n"
+ " stoogeSort(a, left, right-third);\n" + " }\n" + "}\n";
return code;
}
@Override
public Locale getContentLocale() {
return Locale.GERMANY;
}
@Override
public String getDescription() {
return "Stooge sort (auch Trippelsort) ist ein rekursiver Sortieralgorithmus nach dem Prinzip Teile und herrsche (divide and conquer).";
}
@Override
public String getFileExtension() {
return Generator.ANIMALSCRIPT_FORMAT_EXTENSION;
}
@Override
public GeneratorType getGeneratorType() {
return new GeneratorType(GeneratorType.GENERATOR_TYPE_SORT);
}
@Override
public String getName() {
return "StoogeSort (DE)";
}
@Override
public String getOutputLanguage() {
return Generator.JAVA_OUTPUT;
}
} | [
"guido@tk.informatik.tu-darmstadt.de"
] | guido@tk.informatik.tu-darmstadt.de |
27c7d143f8b785fde35a1edada62e5f98e011179 | 7f261a1e2bafd1cdd98d58f00a2937303c0dc942 | /src/ANXCamera/sources/com/bumptech/glide/load/engine/bitmap_recycle/g.java | f6ed2f5b8213149c2ab9dff9f7a2d525fcd57354 | [] | no_license | xyzuan/ANXCamera | 7614ddcb4bcacdf972d67c2ba17702a8e9795c95 | b9805e5197258e7b980e76a97f7f16de3a4f951a | refs/heads/master | 2022-04-23T16:58:09.592633 | 2019-05-31T17:18:34 | 2019-05-31T17:26:48 | 259,555,505 | 3 | 0 | null | 2020-04-28T06:49:57 | 2020-04-28T06:49:57 | null | UTF-8 | Java | false | false | 3,251 | java | package com.bumptech.glide.load.engine.bitmap_recycle;
import android.support.annotation.Nullable;
import com.bumptech.glide.load.engine.bitmap_recycle.l;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* compiled from: GroupedLinkedMap */
class g<K extends l, V> {
private final a<K, V> hi = new a<>();
private final Map<K, a<K, V>> hj = new HashMap();
/* compiled from: GroupedLinkedMap */
private static class a<K, V> {
a<K, V> hk;
a<K, V> hl;
final K key;
private List<V> values;
a() {
this(null);
}
a(K k) {
this.hl = this;
this.hk = this;
this.key = k;
}
public void add(V v) {
if (this.values == null) {
this.values = new ArrayList();
}
this.values.add(v);
}
@Nullable
public V removeLast() {
int size = size();
if (size > 0) {
return this.values.remove(size - 1);
}
return null;
}
public int size() {
if (this.values != null) {
return this.values.size();
}
return 0;
}
}
g() {
}
private void a(a<K, V> aVar) {
d(aVar);
aVar.hl = this.hi;
aVar.hk = this.hi.hk;
c(aVar);
}
private void b(a<K, V> aVar) {
d(aVar);
aVar.hl = this.hi.hl;
aVar.hk = this.hi;
c(aVar);
}
private static <K, V> void c(a<K, V> aVar) {
aVar.hk.hl = aVar;
aVar.hl.hk = aVar;
}
private static <K, V> void d(a<K, V> aVar) {
aVar.hl.hk = aVar.hk;
aVar.hk.hl = aVar.hl;
}
public void a(K k, V v) {
a aVar = (a) this.hj.get(k);
if (aVar == null) {
aVar = new a(k);
b(aVar);
this.hj.put(k, aVar);
} else {
k.bm();
}
aVar.add(v);
}
@Nullable
public V b(K k) {
a aVar = (a) this.hj.get(k);
if (aVar == null) {
aVar = new a(k);
this.hj.put(k, aVar);
} else {
k.bm();
}
a(aVar);
return aVar.removeLast();
}
@Nullable
public V removeLast() {
for (a<K, V> aVar = this.hi.hl; !aVar.equals(this.hi); aVar = aVar.hl) {
V removeLast = aVar.removeLast();
if (removeLast != null) {
return removeLast;
}
d(aVar);
this.hj.remove(aVar.key);
((l) aVar.key).bm();
}
return null;
}
public String toString() {
StringBuilder sb = new StringBuilder("GroupedLinkedMap( ");
boolean z = false;
for (a<K, V> aVar = this.hi.hk; !aVar.equals(this.hi); aVar = aVar.hk) {
z = true;
sb.append('{');
sb.append(aVar.key);
sb.append(':');
sb.append(aVar.size());
sb.append("}, ");
}
if (z) {
sb.delete(sb.length() - 2, sb.length());
}
sb.append(" )");
return sb.toString();
}
}
| [
"sv.xeon@gmail.com"
] | sv.xeon@gmail.com |
10df45ef89f665f037a139dbe7c3e15bfb03ccb5 | 48d379a69fb6a2021b8e6bce41f56c13477a95c6 | /GeoPosUy/EJB/com/clases/Observacion.java | abb47e2ffa750f27ab429aa22314207cec131846 | [] | no_license | juanipicart/UtecGrupoEAE | 8793855745a1ddde5290947df159ae6b59c3ac7b | 456b31dc292f60b91245284f22d0f6a98d0158c1 | refs/heads/master | 2022-11-06T19:29:24.221000 | 2020-04-29T03:45:29 | 2020-04-29T03:45:29 | 213,785,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,590 | java | package com.clases;
import java.util.Date;
import com.clases.relaciones.RelUbicacion;
public class Observacion {
long id_observacion;
String descripcion; //max 100 not null
String geolocalizacion; //max 150 not null
Date fecha_hora; //not null
private RelUbicacion ubicacion; //not null
private Usuario usuario; //not null
public long getId_observacion() {
return id_observacion;
}
public void setId_observacion(long id_observacion) {
this.id_observacion = id_observacion;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public String getGeolocalizacion() {
return geolocalizacion;
}
public void setGeolocalizacion(String geolocalizacion) {
this.geolocalizacion = geolocalizacion;
}
public Date getFecha_hora() {
return fecha_hora;
}
public void setFecha_hora(Date fecha_hora) {
this.fecha_hora = fecha_hora;
}
public RelUbicacion getUbicacion() {
return ubicacion;
}
public void setUbicacion(RelUbicacion ubicacion) {
this.ubicacion = ubicacion;
}
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
public Observacion(long id_observacion, String descripcion, String geolocalizacion, Date fecha_hora,
RelUbicacion ubicacion, Usuario usuario) {
super();
this.id_observacion = id_observacion;
this.descripcion = descripcion;
this.geolocalizacion = geolocalizacion;
this.fecha_hora = fecha_hora;
this.ubicacion = ubicacion;
this.usuario = usuario;
}
}
| [
"41879116+ignaciorosales@users.noreply.github.com"
] | 41879116+ignaciorosales@users.noreply.github.com |
f04869d78a79eec403f1a82781eedbefdce5dd2a | 4465f015bdd33b7da92d273af1f7037d5fb758f0 | /app/src/main/java/com/rbn/mynote/database/DatabaseHelper.java | de58e2732a46f74d30b1bbb6e92b9c155bf3f583 | [] | no_license | RaihanBagasNugraha/MyNote | 85075a5c8eaa4b66e093b1891a78eb89967995ba | 8a44795b8d7339a0f22e5abe3938292b488ecd69 | refs/heads/master | 2020-04-30T21:45:35.787451 | 2019-03-22T08:32:37 | 2019-03-22T08:32:37 | 177,099,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,415 | java | package com.rbn.mynote.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
import java.util.List;
import com.rbn.mynote.database.model.Note;
public class DatabaseHelper extends SQLiteOpenHelper {
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "notes_db";
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
// create notes table
db.execSQL(Note.CREATE_TABLE);
}
// Upgrading database
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Drop older table if existed
db.execSQL("DROP TABLE IF EXISTS " + Note.TABLE_NAME);
// Create tables again
onCreate(db);
}
public long insertNote(String note) {
// get writable database as we want to write data
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
// `id` and `timestamp` will be inserted automatically.
// no need to add them
values.put(Note.COLUMN_NOTE, note);
// insert row
long id = db.insert(Note.TABLE_NAME, null, values);
// close db connection
db.close();
// return newly inserted row id
return id;
}
public Note getNote(long id) {
// get readable database as we are not inserting anything
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(Note.TABLE_NAME,
new String[]{Note.COLUMN_ID, Note.COLUMN_NOTE, Note.COLUMN_TIMESTAMP},
Note.COLUMN_ID + "=?",
new String[]{String.valueOf(id)}, null, null, null, null);
if (cursor != null)
cursor.moveToFirst();
// prepare note object
Note note = new Note(
cursor.getInt(cursor.getColumnIndex(Note.COLUMN_ID)),
cursor.getString(cursor.getColumnIndex(Note.COLUMN_NOTE)),
cursor.getString(cursor.getColumnIndex(Note.COLUMN_TIMESTAMP)));
// close the db connection
cursor.close();
return note;
}
public List<Note> getAllNotes() {
List<Note> notes = new ArrayList<>();
// Select All Query
String selectQuery = "SELECT * FROM " + Note.TABLE_NAME + " ORDER BY " +
Note.COLUMN_TIMESTAMP + " DESC";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
Note note = new Note();
note.setId(cursor.getInt(cursor.getColumnIndex(Note.COLUMN_ID)));
note.setNote(cursor.getString(cursor.getColumnIndex(Note.COLUMN_NOTE)));
note.setTimestamp(cursor.getString(cursor.getColumnIndex(Note.COLUMN_TIMESTAMP)));
notes.add(note);
} while (cursor.moveToNext());
}
// close db connection
db.close();
// return notes list
return notes;
}
public int getNotesCount() {
String countQuery = "SELECT * FROM " + Note.TABLE_NAME;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(countQuery, null);
int count = cursor.getCount();
cursor.close();
// return count
return count;
}
public int updateNote(Note note) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(Note.COLUMN_NOTE, note.getNote());
// updating row
return db.update(Note.TABLE_NAME, values, Note.COLUMN_ID + " = ?",
new String[]{String.valueOf(note.getId())});
}
public void deleteNote(Note note) {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(Note.TABLE_NAME, Note.COLUMN_ID + " = ?",
new String[]{String.valueOf(note.getId())});
db.close();
}
} | [
"raihan.bagas1088@students.unila.ac.id"
] | raihan.bagas1088@students.unila.ac.id |
65b6ca02e24c3b6264848c25aac1671ef2f74516 | d817267149acf53fafe3ec4553485e2169c9c6e9 | /api/src/main/java/org/openmrs/module/shr/cdahandler/order/ObservationOrder.java | f3c848aed56df73c0c42875ca7b416913b9324ba | [] | no_license | jembi/openmrs-module-shr-cdahandler | 5f21b326b449047142c6044e72809da43df03086 | 47610b625fd50214af66b2ed7caa4918194cb36f | refs/heads/master | 2020-06-02T19:56:29.221932 | 2017-02-24T08:57:11 | 2017-02-24T08:57:11 | 15,729,824 | 0 | 3 | null | 2017-02-24T08:57:12 | 2014-01-08T08:30:11 | Java | UTF-8 | Java | false | false | 2,311 | java | package org.openmrs.module.shr.cdahandler.order;
import org.openmrs.Concept;
import org.openmrs.Order;
import org.openmrs.module.shr.cdahandler.processor.util.OpenmrsMetadataUtil;
/**
* Represents a request to perform an observation
*/
public class ObservationOrder extends Order {
/**
*
*/
private static final long serialVersionUID = 1L;
// Openmrs meta-data util
private final OpenmrsMetadataUtil s_metaDataUtil = OpenmrsMetadataUtil.getInstance();
// Goal values
private String goalText;
private Double goalNumeric;
private Concept goalCoded;
// Method and target
private Concept method;
private Concept targetSite;
/**
* Observation order
*/
public ObservationOrder()
{
this.setOrderType(s_metaDataUtil.getOrCreateObservationOrderType());
}
/**
* Gets the textual description of the goal of this order
*/
public String getGoalText() {
return goalText;
}
/**
* Sets a value indicating the goal as a form of text
*/
public void setGoalText(String goalText) {
this.goalText = goalText;
}
/**
* Gets a numeric value representing the goal of this order
*/
public Double getGoalNumeric() {
return goalNumeric;
}
/**
* Sets the numeric value representing the goal of the order
*/
public void setGoalNumeric(Double goalNumeric) {
this.goalNumeric = goalNumeric;
}
/**
* Gets the codified value of the goal
*/
public Concept getGoalCoded() {
return goalCoded;
}
/**
* Sets the codified value of the goal
*/
public void setGoalCoded(Concept goalCoded) {
this.goalCoded = goalCoded;
}
/**
* Gets a concept identifying the method of observation
*/
public Concept getMethod() {
return method;
}
/**
* Sets a concept identifying the method of observation
*/
public void setMethod(Concept method) {
this.method = method;
}
/**
* Gets a concept identifying the target site of the observation. Eg. Face, Neck, etc
*/
public Concept getTargetSite() {
return targetSite;
}
/**
* Sets a concept identifying the target site of the observation
*/
public void setTargetSite(Concept targetSite) {
this.targetSite = targetSite;
}
}
| [
"justin.fyfe@ecgroupinc.com"
] | justin.fyfe@ecgroupinc.com |
b2a3449466ddf10cd2e7871aed2d3afce74df81e | 854e0a7dce78849b1d83ad9b1bbbc2235492f220 | /src/main/java/guru/springframework/didemo/services/PrimaryItalianGreetingService.java | 915613b73c5d4c3a595b577976f406f68c66a999 | [] | no_license | annivajo/di-demo | 9b1cc98d39d334a8078dfec3118f62fd2f3ab01b | a31ec766af255eae00f6cb24026d665fecf9b639 | refs/heads/master | 2020-03-26T22:05:59.523976 | 2018-08-20T14:55:10 | 2018-08-20T14:55:10 | 145,431,806 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package guru.springframework.didemo.services;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
@Service
@Profile("it")
@Primary
public class PrimaryItalianGreetingService implements GreetingService{
@Override
public String sayGreetings() {
return "ciao";
}
}
| [
"annivajo@gmail.com"
] | annivajo@gmail.com |
75f36648d8c914e86d579ee958f3941fc964fb27 | 222c56bda708da134203560d979fb90ba1a9da8d | /uapunit测试框架/engine/src/public/uap/workflow/engine/mail/MailScanCmd.java | c6d69d9716c58a3080e500f1976ed3e6b17c7476 | [] | no_license | langpf1/uapunit | 7575b8a1da2ebed098d67a013c7342599ef10ced | c7f616bede32bdc1c667ea0744825e5b8b6a69da | refs/heads/master | 2020-04-15T00:51:38.937211 | 2013-09-13T04:58:27 | 2013-09-13T04:58:27 | 12,448,060 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,477 | java | /* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package uap.workflow.engine.mail;
import java.util.List;
import java.util.Properties;
import java.util.logging.Logger;
import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Store;
import uap.workflow.engine.core.ITask;
import uap.workflow.engine.db.DbSqlSession;
import uap.workflow.engine.entity.AttachmentEntity;
import uap.workflow.engine.entity.ByteArrayEntity;
import uap.workflow.engine.entity.TaskEntity;
import uap.workflow.engine.exception.WorkflowException;
import uap.workflow.engine.identity.User;
import uap.workflow.engine.interceptor.Command;
import uap.workflow.engine.interceptor.CommandContext;
import uap.workflow.engine.query.UserQueryImpl;
/**
* @author Tom Baeyens
*/
public class MailScanCmd implements Command<Object> {
private static Logger log = Logger.getLogger(MailScanCmd.class.getName());
protected String userId;
protected String imapUsername;
protected String imapPassword;
protected String imapHost;
protected String imapProtocol;
protected String toDoFolderName;
protected String toDoInActivitiFolderName;
public Object execute(CommandContext commandContext) {
log.fine("scanning mail for user " + userId);
Store store = null;
Folder toDoFolder = null;
Folder toDoInActivitiFolder = null;
try {
Session session = Session.getDefaultInstance(new Properties());
store = session.getStore(imapProtocol);
log.fine("connecting to " + imapHost + " over " + imapProtocol + " for user " + imapUsername);
store.connect(imapHost, imapUsername, imapPassword);
toDoFolder = store.getFolder(toDoFolderName);
toDoFolder.open(Folder.READ_WRITE);
toDoInActivitiFolder = store.getFolder(toDoInActivitiFolderName);
toDoInActivitiFolder.open(Folder.READ_WRITE);
Message[] messages = toDoFolder.getMessages();
log.fine("getting messages from myToDoFolder");
DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
for (Message message : messages) {
log.fine("transforming mail into activiti task: " + message.getSubject());
MailTransformer mailTransformer = new MailTransformer(message);
createTask(commandContext, dbSqlSession, mailTransformer);
Message[] messagesToCopy = new Message[] { message };
toDoFolder.copyMessages(messagesToCopy, toDoInActivitiFolder);
message.setFlag(Flags.Flag.DELETED, true);
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new WorkflowException("couldn't scan mail for user " + userId + ": " + e.getMessage(), e);
} finally {
if (toDoInActivitiFolder != null && toDoInActivitiFolder.isOpen()) {
try {
toDoInActivitiFolder.close(false);
} catch (MessagingException e) {
e.printStackTrace();
}
}
if (toDoFolder != null && toDoFolder.isOpen()) {
try {
toDoFolder.close(true); // true means that all messages that
// are flagged for deletion are
// permanently removed
} catch (Exception e) {
e.printStackTrace();
}
}
if (store != null) {
try {
store.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
return null;
}
public void createTask(CommandContext commandContext, DbSqlSession dbSqlSession, MailTransformer mailTransformer) throws MessagingException {
// distill the task description from the mail body content (without the
// html tags)
String taskDescription = mailTransformer.getHtml();
taskDescription = taskDescription.replaceAll("\\<.*?\\>", "");
taskDescription = taskDescription.replaceAll("\\s", " ");
taskDescription = taskDescription.trim();
if (taskDescription.length() > 120) {
taskDescription = taskDescription.substring(0, 117) + "...";
}
// create and insert the task
ITask task = new TaskEntity();
// task.setAssignee(userId);
task.setName(mailTransformer.getMessage().getSubject());
task.setDescription(taskDescription);
// dbSqlSession.insert((TaskEntity)task);
String taskId = task.getTaskPk();
// add identity links for all the recipients
for (String recipientEmailAddress : mailTransformer.getRecipients()) {
User recipient = new UserQueryImpl(commandContext).userEmail(recipientEmailAddress).singleResult();
if (recipient != null) {
// /task.addUserIdentityLink(recipient.getId(), "Recipient");
}
}
// attach the mail and other attachments to the task
List<AttachmentEntity> attachments = mailTransformer.getAttachments();
for (AttachmentEntity attachment : attachments) {
// insert the bytes as content
ByteArrayEntity content = attachment.getContent();
dbSqlSession.insert(content);
// insert the attachment
attachment.setContentId(content.getId());
attachment.setTaskId(taskId);
dbSqlSession.insert(attachment);
}
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getImapUsername() {
return imapUsername;
}
public void setImapUsername(String imapUsername) {
this.imapUsername = imapUsername;
}
public String getImapPassword() {
return imapPassword;
}
public void setImapPassword(String imapPassword) {
this.imapPassword = imapPassword;
}
public String getImapHost() {
return imapHost;
}
public void setImapHost(String imapHost) {
this.imapHost = imapHost;
}
public String getImapProtocol() {
return imapProtocol;
}
public void setImapProtocol(String imapProtocol) {
this.imapProtocol = imapProtocol;
}
public String getToDoFolderName() {
return toDoFolderName;
}
public void setToDoFolderName(String toDoFolderName) {
this.toDoFolderName = toDoFolderName;
}
public String getToDoInActivitiFolderName() {
return toDoInActivitiFolderName;
}
public void setToDoInActivitiFolderName(String toDoInActivitiFolderName) {
this.toDoInActivitiFolderName = toDoInActivitiFolderName;
}
}
| [
"langpf1@yonyou.com"
] | langpf1@yonyou.com |
1636c04c025c8a202454df14a84282f7ff2cd82e | 149109a11ea36670a8b4146bf08611de34f7e4a9 | /src/main/java/com/epam/alex/trainbooking/dao/jdbc/JdbcTrainTypeDao.java | 129612d8b4927e7b5a1a85b336f9e5ce0d4b526e | [] | no_license | AlexandrSerebryakov/TrainBooking | d204834ec16e11e820d68e57b5d3deb5b6422f0d | 32589ee917592ecf2d42c40c7440dff14682e6a9 | refs/heads/master | 2020-06-10T12:30:47.754523 | 2017-01-18T13:56:07 | 2017-01-18T13:56:07 | 75,961,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 143 | java | package com.epam.alex.trainbooking.dao.jdbc;
/**
* Created by ${AlexandrSerebryakov} on ${09.10.2016}.
*/
public class JdbcTrainTypeDao {
}
| [
"common190516@mail.ru"
] | common190516@mail.ru |
e85f80cd8f92eea6b11f1784e618d8206550fdeb | 852c382f0dcb93f5118a9265e84892fcdf56de73 | /prototypes/ethosnet/trunk/dspace-jspui/src/main/java/org/dspace/app/webui/servlet/ItemsBySubjectServlet.java | 10593c859e84ee7741163340ae9abf38a7f74639 | [] | no_license | DSpace-Labs/dspace-sandbox | 101a0cf0c371a52fb78bf02d394deae1e8157d25 | a17fe69a08fb629f7da574cfc95632dc0e9118a8 | refs/heads/master | 2020-05-17T21:33:34.009260 | 2009-04-17T13:43:32 | 2009-04-17T13:43:32 | 32,347,896 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 4,863 | java | /*
* ItemsBySubjectServlet.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.webui.servlet;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.UIUtil;
import org.dspace.authorize.AuthorizeException;
import org.dspace.browse.Browse;
import org.dspace.browse.BrowseInfo;
import org.dspace.browse.BrowseScope;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
/**
* Displays the items with a particular subject.
*
* @version $Revision$
*/
public class ItemsBySubjectServlet extends DSpaceServlet
{
/** log4j logger */
private static Logger log = Logger.getLogger(ItemsBySubjectServlet.class);
protected void doDSGet(Context context, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException,
SQLException, AuthorizeException
{
// We will resolve the HTTP request parameters into a scope
BrowseScope scope = new BrowseScope(context);
// Get log information
String logInfo = "";
// Get the HTTP parameters
String subject = request.getParameter("subject");
String order = request.getParameter("order");
// How should we order the items?
boolean orderByTitle;
if ((order != null) && order.equalsIgnoreCase("title"))
{
orderByTitle = true;
logInfo = "order=title";
}
else
{
orderByTitle = false;
logInfo = "order=date";
}
// Get the community or collection scope
Community community = UIUtil.getCommunityLocation(request);
Collection collection = UIUtil.getCollectionLocation(request);
if (collection != null)
{
logInfo = logInfo + ",collection_id=" + collection.getID();
scope.setScope(collection);
}
else if (community != null)
{
logInfo = logInfo + ",community_id=" + community.getID();
scope.setScope(community);
}
// Ensure subject is non-null
if (subject == null)
{
subject = "";
}
// Do the browse
scope.setFocus(subject);
BrowseInfo browseInfo = Browse.getItemsBySubject(scope, orderByTitle);
log.info(LogManager.getHeader(context, "items_by_subject", logInfo
+ ",result_count=" + browseInfo.getResultCount()));
// Display the JSP
request.setAttribute("community", community);
request.setAttribute("collection", collection);
request.setAttribute("subject", subject);
request.setAttribute("order.by.title", new Boolean(orderByTitle));
request.setAttribute("browse.info", browseInfo);
JSPManager.showJSP(request, response, "/browse/items-by-subject.jsp");
}
}
| [
"richard-jones@users.noreply.github.com"
] | richard-jones@users.noreply.github.com |
9b132bc0a31dae0ee3bdb2fa6dae850a39721a5e | bdef4522e54283152e5fad0490878ad07d4e4273 | /app/src/main/java/com/horizon/android/activity/WebViewActivity.java | 47a6606472b5a9557d088fcadcbf615dd7eaaef9 | [] | no_license | Horizonxy/horizon_android | 1b15a2f02539e9d15e0de351b3a2df330bbf81fe | 688a537c53b043eca2b3f97cc2b341d843591bb9 | refs/heads/master | 2021-01-17T10:24:04.054447 | 2016-06-13T03:06:48 | 2016-06-13T03:06:48 | 57,014,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,830 | java | package com.horizon.android.activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ProgressBar;
import com.horizon.android.Constants;
import com.horizon.android.R;
import com.horizon.android.util.LogUtils;
import com.horizon.android.web.WebChromeClient;
import com.horizon.android.web.WebView;
import com.horizon.android.web.WebViewClient;
import com.horizon.android.web.WebViewView;
import butterknife.Bind;
public class WebViewActivity extends BaseLoadActivity implements WebViewView {
@Bind(R.id.web_view)
WebView mWevView;
@Bind(R.id.progress)
ProgressBar mProgress;
boolean firstLoadAfter;
String url;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view);
firstLoadAfter = true;
mWevView.setWebChromeClient(new WebChromeClient(this));
mWevView.setWebViewClient(new WebViewClient(this));
url = getIntent().getStringExtra(Constants.BUNDLE_WEBVIEW_URL);
if(url != null) {
if(!url.startsWith("http")){
url = "http://".concat(url);
}
firstLoad();
}
}
private void firstLoad(){
if(isNetworkAvailable()) {
mWevView.loadUrl(url);
} else {
noNet();
}
}
@Override
void clickRetry() {
initBody();
firstLoad();
}
@Override
public void firstLoadAfter(){
if(firstLoadAfter){
initAfter();
firstLoadAfter = false;
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
back();
return true;
default:
break;
}
}
return super.onKeyDown(keyCode, event);
}
public void back(){
if (url != null) {
if(url.equals(mWevView.getUrl())){
finish();
} else if (null != mWevView.getUrl() && mWevView.getUrl().startsWith("data:")) {//页面请求失败,报错
if (mWevView.canGoBackOrForward(-2)) {
mWevView.goBackOrForward(-2);
finish();
} else if (mWevView.canGoBack()) {
mWevView.goBack();
}else {
finish();
}
} else if (mWevView.canGoBack()) {
mWevView.goBack();
} else {
finish();
}
} else if(mWevView.canGoBack()){
mWevView.goBack();
} else {
finish();
}
}
@Override
public void onReceivedTitle(String title) {
setTitle(title);
}
@Override
public void onProgressChanged(int newProgress) {
LogUtils.e("newProgress: "+newProgress);
if(newProgress == 100){
mProgress.setVisibility(View.GONE);
} else {
if(mProgress.getVisibility() == View.GONE){
mProgress.setVisibility(View.VISIBLE);
}
mProgress.setProgress(newProgress);
}
}
private boolean isNetworkAvailable() {
// 得到网络连接信息
ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
// 去进行判断网络是否连接
if (manager.getActiveNetworkInfo() != null) {
return manager.getActiveNetworkInfo().isAvailable();
}
return false;
}
}
| [
"horizon.xy@foxmail.com"
] | horizon.xy@foxmail.com |
8562343a17b21c1e8e78a5955fa688da13fab173 | d049893e680f6f7736748459a2bcd0d2f52be645 | /Lp-common/src/main/java/com/lp/rpc/LpClass.java | e821cd6faf6a19dfe82a6b9c99b7f876acd26f86 | [
"MIT"
] | permissive | steakliu/Lp-Rpc | c3337c9d5ee3166df6523833769cf574637d5b22 | 6616190763c2e3006d486bbf8bec1f1d81162ff0 | refs/heads/master | 2023-07-16T10:20:28.297058 | 2021-08-31T09:26:40 | 2021-08-31T09:26:40 | 399,060,021 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48 | java | package com.lp.rpc;
public class LpClass {
}
| [
"2319492349@qq.com"
] | 2319492349@qq.com |
eb1d24b5b314341cbf86ce07f0a4fe9a8d94f439 | 8650ce09a3d571f2b64ba93f6083eb031c22db05 | /BistuTalk/app/src/main/java/com/example/bistutalk/MainActivity.java | 64e3d996275f284332cf00c8741b6b305b521cbb | [] | no_license | chenwwwwww/bistumlson | 885c7924aaea59622f519e027b76582ec36e1ff3 | 5e990ec4e54295017551be1bd2bb7eb2a82dcb4d | refs/heads/master | 2020-05-24T13:48:08.588461 | 2020-04-16T10:22:10 | 2020-04-16T10:22:10 | 187,297,475 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,324 | java | package com.example.bistutalk;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import android.os.Handler;
import android.os.Message;
public class MainActivity extends AppCompatActivity {
public static LinearLayout li1, li2, li3, li4;
public static Button button, button2, button3, button4, button5;
public ImageView imageView, imageView2, imageView3, imageView4,imageView5,imageView6,imageView7,imageView8;
public static Map<String, View> map = new HashMap<>();
String url1 = "";
String url2 = "";
String url3 = "";
HttpURLConnection httpURLConnection;
LinearLayout linearLayout,linearLayout2;
String string = "http://webcal123.top/shen1.jpg";
String string2 = "http://webcal123.top/shen2.jpg";
String string3 = "http://webcal123.top/shen3.jpg";
String string4 = "http://webcal123.top/shen4.jpg";
String string5 = "http://webcal123.top/xue1.jpg";
String string6 = "http://webcal123.top/xue2.jpg";
String string7 = "http://webcal123.top/xue3.jpg";
String string8 = "http://webcal123.top/shen.jpg";
TextView textView2 ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
StrictMode.setThreadPolicy(//必须要的线程对象管理策略
new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build()
);
li4 = (LinearLayout) findViewById(R.id.Li4);
li3 = (LinearLayout) findViewById(R.id.Li);
li2 = (LinearLayout) findViewById(R.id.Li2);
li1 = (LinearLayout) findViewById(R.id.Li3);
textView2=(TextView)findViewById(R.id.text2);
linearLayout=(LinearLayout)findViewById(R.id.Lin);
linearLayout.setVisibility(View.GONE);
linearLayout2=(LinearLayout)findViewById(R.id.Lin2);
linearLayout2.setVisibility(View.GONE);
button = (Button) findViewById(R.id.button);
button2 = (Button) findViewById(R.id.button2);
button3 = (Button) findViewById(R.id.button3);
button4 = (Button) findViewById(R.id.button4);
button5=(Button)findViewById(R.id.button5);
Button lbutton = (Button)findViewById(R.id.load);
imageView = (ImageView) findViewById(R.id.images);
imageView2 = (ImageView) findViewById(R.id.images2);
imageView3 = (ImageView) findViewById(R.id.images3);
imageView4=(ImageView)findViewById(R.id.images4);
imageView5=(ImageView)findViewById(R.id.images5);
imageView6=(ImageView)findViewById(R.id.images6);
imageView7=(ImageView)findViewById(R.id.images7);
imageView8=(ImageView)findViewById(R.id.images8);
button.setOnClickListener(new ClickView());
button2.setOnClickListener(new ClickView());
button3.setOnClickListener(new ClickView());
button4.setOnClickListener(new ClickView());
lbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView2.setVisibility(View.GONE);
loadView(string,0);
loadView(string2,1);
// loadView(string3,2);
// loadView(string4,3);
loadView(string5,4);
loadView(string6,5);
// loadView(string7,6);
linearLayout.setVisibility(View.VISIBLE);
linearLayout2.setVisibility(View.VISIBLE);
}
});
button5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this,Login.class);
startActivity(intent);
}
});
li1.setOnTouchListener(new MyTouch());
li2.setOnTouchListener(new MyTouch());
li3.setOnTouchListener(new MyTouch());
li4.setOnTouchListener(new MyTouch());
map.put("1", li1);
map.put("2", li2);
map.put("3", li3);
map.put("4", li4);
}
public void loadView(String string, int i){
try {
URL url = new URL(string);
httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("GET");
if (httpURLConnection.getResponseCode() == 200) {
InputStream inputStream = httpURLConnection.getInputStream();
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
MyHandler myHandler = new MyHandler();
myHandler.obtainMessage(i, bitmap).sendToTarget();
int result = inputStream.read();
while (result != -1) {
result = inputStream.read();
}
//inputStream.close();
}
} catch (Exception e) {
}
}
class MyHandler extends Handler {
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(msg.what==0)
imageView.setImageBitmap((Bitmap) msg.obj);
if(msg.what==1)
imageView2.setImageBitmap((Bitmap) msg.obj);
if(msg.what==2)
imageView3.setImageBitmap((Bitmap) msg.obj);
if(msg.what==3)
imageView4.setImageBitmap((Bitmap) msg.obj);
if(msg.what==4)
imageView5.setImageBitmap((Bitmap) msg.obj);
if(msg.what==5)
imageView6.setImageBitmap((Bitmap) msg.obj);
if(msg.what==6)
imageView7.setImageBitmap((Bitmap) msg.obj);
}
}
}
| [
"2726514272@qq.com"
] | 2726514272@qq.com |
b0c6cb495a586b58603227f18a67e1c31d1731b7 | d99b9eb522758208f9d0b8d860a9c6c186555c8d | /src/pastYear2018_1/Q5.java | 358cc55ee6e5d7d61319f3b868550409db097d51 | [] | no_license | TINGWEIJING/FOP-LAB-GROUP2-2020 | a4f0b071b192633c2edd098f55fc55656e813969 | 8d6a60e07d3a546a78392498d19701353b2940fd | refs/heads/main | 2023-02-19T00:35:25.377427 | 2021-01-21T05:21:54 | 2021-01-21T05:21:54 | 318,084,808 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 714 | java | package pastYear2018_1;
/**
*
* @author TING WEI JING
*/
public class Q5 {
public static void main(String[] args) {
Fruit[] fruits = new Fruit[4];
fruits[0] = new Apple("Red", 8);
fruits[1] = new Apple("Green", 11);
fruits[2] = new Watermelon("Local", 7.6);
fruits[3] = new Watermelon("Imported", 4);
Fruit cheapFruit = fruits[0];
for(Fruit fruit : fruits) {
System.out.println(fruit);
if(cheapFruit.totalPrice() > fruit.totalPrice()) {
cheapFruit = fruit;
}
}
System.out.println("The cheapest item is");
System.out.println(cheapFruit);
}
}
| [
"tingweijingting2000@gmail.com"
] | tingweijingting2000@gmail.com |
2e25caad4ecba02407de370330a69c1fea7baa98 | 0613bb6cf1c71b575419651fc20330edb9f916d2 | /CheatBreaker/src/main/java/net/minecraft/network/play/server/S08PacketPlayerPosLook.java | abe7787829694d6aa2fa58524a2dc60c43bb6f1c | [] | no_license | Decencies/CheatBreaker | 544fdae14e61c6e0b1f5c28d8c865e2bbd5169c2 | 0cf7154272c8884eee1e4b4c7c262590d9712d68 | refs/heads/master | 2023-09-04T04:45:16.790965 | 2023-03-17T09:51:10 | 2023-03-17T09:51:10 | 343,514,192 | 98 | 38 | null | 2023-08-21T03:54:20 | 2021-03-01T18:18:19 | Java | UTF-8 | Java | false | false | 2,713 | java | package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.network.INetHandler;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
public class S08PacketPlayerPosLook extends Packet
{
private double field_148940_a;
private double field_148938_b;
private double field_148939_c;
private float field_148936_d;
private float field_148937_e;
private boolean field_148935_f;
public S08PacketPlayerPosLook() {}
public S08PacketPlayerPosLook(double p_i45164_1_, double p_i45164_3_, double p_i45164_5_, float p_i45164_7_, float p_i45164_8_, boolean p_i45164_9_)
{
this.field_148940_a = p_i45164_1_;
this.field_148938_b = p_i45164_3_;
this.field_148939_c = p_i45164_5_;
this.field_148936_d = p_i45164_7_;
this.field_148937_e = p_i45164_8_;
this.field_148935_f = p_i45164_9_;
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer p_148837_1_) throws IOException
{
this.field_148940_a = p_148837_1_.readDouble();
this.field_148938_b = p_148837_1_.readDouble();
this.field_148939_c = p_148837_1_.readDouble();
this.field_148936_d = p_148837_1_.readFloat();
this.field_148937_e = p_148837_1_.readFloat();
this.field_148935_f = p_148837_1_.readBoolean();
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer p_148840_1_) throws IOException
{
p_148840_1_.writeDouble(this.field_148940_a);
p_148840_1_.writeDouble(this.field_148938_b);
p_148840_1_.writeDouble(this.field_148939_c);
p_148840_1_.writeFloat(this.field_148936_d);
p_148840_1_.writeFloat(this.field_148937_e);
p_148840_1_.writeBoolean(this.field_148935_f);
}
public void processPacket(INetHandlerPlayClient p_148833_1_)
{
p_148833_1_.handlePlayerPosLook(this);
}
public double func_148932_c()
{
return this.field_148940_a;
}
public double func_148928_d()
{
return this.field_148938_b;
}
public double func_148933_e()
{
return this.field_148939_c;
}
public float func_148931_f()
{
return this.field_148936_d;
}
public float func_148930_g()
{
return this.field_148937_e;
}
public boolean func_148929_h()
{
return this.field_148935_f;
}
public void processPacket(INetHandler p_148833_1_)
{
this.processPacket((INetHandlerPlayClient)p_148833_1_);
}
}
| [
"66835910+Decencies@users.noreply.github.com"
] | 66835910+Decencies@users.noreply.github.com |
e04a96d3334a0f9af522f3752bb14967e522a8b7 | 7123114243c9124a8aff87d1941a6c20e2cf07cb | /src/main/java/com/shivamrajput/finance/hw/shivamrajputhw/module/management/Core/NextDayMaxTrialPolicy.java | bf16ce5802bba81fa7edee7b3f4785cfee99ff02 | [
"MIT"
] | permissive | Cyraz/4FIT_shivam_HW | 3f023f4ae68e5fb52c59de4ecd572689d2ae7cc5 | e5e561ffe78d8d30b4f127bc812b8c9fe9fcdb07 | refs/heads/master | 2021-05-05T15:17:28.156896 | 2018-01-14T05:39:11 | 2018-01-14T05:39:11 | 117,301,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | package com.shivamrajput.finance.hw.shivamrajputhw.module.management.Core;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* This policy prevents users to take full amount of loan at 00:00
* this is extra step to block users who are blocked by MaxLoanApllicationPolicy
*/
public class NextDayMaxTrialPolicy implements Policy {
@Override
public void execute(PolicyDTO policyDTO) {
if (process(policyDTO)) {
policyDTO.setAllowed(false);
policyDTO.addMessage("Max amount requested at 00:**");
}else {
policyDTO.setAllowed(true);
policyDTO.addMessage("NextDayMaxTrialPolicy:Passed");
}
}
boolean process(PolicyDTO policyDTO) {
LocalDateTime time = LocalDateTime.now();
int h = time.getHour();
if (h == 0 && policyDTO.getOldAmount().compareTo(MaxLoanAmountPolicy.maxAllowed) >= 0) {
return true;
} else {
return false;
}
}
}
| [
"srecho97@gmail.com"
] | srecho97@gmail.com |
5c008655dcda93ab5d67ed16ff60b61903f216ae | 74a91f99f35408d99e4dcbd13f762cd00ef7510a | /PSGTreimanento/src/main/T1019.java | 371ceb369806a37752926d20d2cd237a4a4caa3e | [] | no_license | silas00/PSGTraining | 8f68a4b282b61d3fea02434231f59817611f6ddc | c386dfcdf6816cce6cf855f30b530331465c34c1 | refs/heads/master | 2022-12-03T05:44:44.499694 | 2020-08-25T15:30:48 | 2020-08-25T15:30:48 | 286,883,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 490 | java | package main;
import java.util.Scanner;
public class T1019 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int valor = entrada.nextInt();
int horas = valor / 3600;
int restoHoras = valor % 3600;
int minutos = restoHoras / 60;
int restoMinutos = restoHoras % 60;
int segundos = restoMinutos;
System.out.printf("%d:%d:%d\n", horas, minutos, segundos);
}
} | [
"soliveira@DESKTOP-378D65R.PSG.LOCAL"
] | soliveira@DESKTOP-378D65R.PSG.LOCAL |
a60fed07c8dfa62a62ed564e0648fcefc3c18e7e | 2e22ebfe6cee0e3b511b7a2026a31a15a59e758b | /src/main/java/com/Application.java | 5eebf24a3139ca19fd0aa6b40b53da616a42c3a0 | [] | no_license | kumaraakash25/StockViewer | b91a8bd0d8aa6c6601f2884d49518c7819abf973 | 3adef59e24351c1856b6c645e90be47089861ab4 | refs/heads/master | 2021-06-27T22:38:10.873566 | 2020-11-27T22:16:36 | 2020-11-27T22:16:36 | 176,833,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@EnableJpaRepositories
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"aakashthesid@gmail.com"
] | aakashthesid@gmail.com |
1d56493ef8ff2dcc4a1567305c848bc26608686c | a2c651af55d69301d5d4aadcbb7eb445f87c4167 | /nuls-switch-manage/src/main/java/io/nuls/nulsswitch/common/dao/LogDao.java | 93141e158bf3f84b1a04c80d47f4b69ef761ae75 | [
"MIT",
"Apache-2.0"
] | permissive | CCC-NULS/nuls_switch | 085700160b353640cfeb6c7908e3dfdd91f89ea7 | a5a19841044de7f28b4498e06a9eca2262f3be10 | refs/heads/master | 2022-12-22T05:53:09.319091 | 2020-02-05T03:16:07 | 2020-02-05T03:16:07 | 195,358,468 | 2 | 3 | MIT | 2022-12-11T23:20:23 | 2019-07-05T07:15:23 | JavaScript | UTF-8 | Java | false | false | 287 | java | package io.nuls.nulsswitch.common.dao;
import io.nuls.nulsswitch.common.base.BaseDao;
import io.nuls.nulsswitch.common.domain.LogDO;
/**
* 系统日志
*
* @author chglee
* @email 1992lcg@163.com
* @date 2017-10-03 15:45:42
*/
public interface LogDao extends BaseDao<LogDO> {
}
| [
"chenxue1@cmhk.com"
] | chenxue1@cmhk.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.