blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0dec664044ba28c8b3f65669bd038c14ef81f9fb | 70c968df577bc62647ca5ae5d78f85113a30d572 | /java/core/week-b-demos/src/main/java/com/revature/compare/models/Box.java | 0df782beac873238948d2cdd91a72e6eb45ce2f3 | [] | no_license | 200727-java-ng-usf/demos | b65323584a24d437722ce13bba80f7aaad03ae1b | 86e190137e15a104b4cd148a9cd82e73929d131e | refs/heads/master | 2023-06-03T17:13:49.061610 | 2021-06-04T22:26:55 | 2021-06-04T22:26:55 | 282,066,419 | 0 | 0 | null | 2020-09-17T21:02:32 | 2020-07-23T22:10:53 | Java | UTF-8 | Java | false | false | 1,780 | java | package com.revature.compare.models;
import java.util.Objects;
// How to create a POJO:
// declare variables
// declare constructors
// declare getters and setters
// override hashCode, equals, and toString
public class Box implements Comparable<Box> {
private double volume;
private String color;
public Box(double volume, String color) {
this.volume = volume;
this.color = color;
}
public double getVolume() {
return volume;
}
public void setVolume(double volume) {
this.volume = volume;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Box box = (Box) o;
return Double.compare(box.volume, volume) == 0 &&
Objects.equals(color, box.color);
}
@Override
public int hashCode() {
return Objects.hash(volume, color);
}
@Override
public String toString() {
return "Box{" +
"volume=" + volume +
", color='" + color + '\'' +
'}';
}
@Override
public int compareTo(Box otherBox) {
if (this.volume > otherBox.volume) {
return 1;
} else if (this.volume < otherBox.volume) {
return -1;
} else {
return this.color.compareTo(otherBox.color); // if both boxes have equal volume, compare by color
}
// one-liner version of the above code (because Double implements Comparable)
// return Double.compare(this.volume, otherBox.volume);
}
}
| [
"[email protected]"
] | |
b5811818a178cac87d575278982ce6fa4a2236d5 | 3a7742b372c0597037d9bd569e37ff330b6d7a4f | /ph-jdmc-example/src/main/java/com/helger/aufnahme/smallbo/IHabitatbaumgruppe.java | d9e4643d5e28d03c6454dd83a418c3d1a5d1824a | [
"Apache-2.0"
] | permissive | jdrew1303/ph-jdmc | eecc5c1eec6f9d5d29030b4ce0b41a6c28648a0b | 75efd96646883aab3eecf261df7cba37ef60c9a9 | refs/heads/master | 2023-08-27T14:28:40.256248 | 2021-10-30T19:34:08 | 2021-10-30T19:34:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,751 | java | /*
* Copyright (C) 2018-2019 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.aufnahme.smallbo;
import java.io.File;
import java.time.LocalDate;
import com.helger.commons.annotation.Nonempty;
import com.helger.commons.annotation.ReturnsMutableObject;
import com.helger.commons.collection.impl.ICommonsList;
import com.helger.commons.string.StringHelper;
import com.helger.tenancy.IBusinessObject;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* <p>Interface for class {@link Habitatbaumgruppe}</p>
* <p>This class was initially automatically created</p>
*
*
* @author JDMCodeGenerator
*/
public interface IHabitatbaumgruppe
extends IBusinessObject
{
/**
* Schlüsselfeld
*
* @return
* The requested value.
*/
int getHBGNr();
/**
* Fotos
*
* @return
* The requested value. May neither be <code>null</code> nor empty.
*/
@Nonnull
@Nonempty
@ReturnsMutableObject
ICommonsList<File> pics();
/**
* zugehörige Biotopbäume
*
* @return
* The requested value. May not be <code>null</code>.
*/
@Nonnull
@ReturnsMutableObject
ICommonsList<IBiotopbaum> HBGzBB();
/**
* Get the value of date.
*
* @return
* The requested value. May not be <code>null</code>.
*/
@Nonnull
LocalDate getDate();
/**
* allg. Beschreibung Freitext
*
* @return
* The requested value. May not be <code>null</code>.
*/
@Nonnull
String getStandort();
/**
* Wald, einschichtig (1 Baumschicht, kaum Unterwuchs) oder mehrschichtiger Bestand (Unterwuchs, Strauchsch., evtl. 2. Baumschicht)
*
* @return
* The requested value.
*/
boolean isOneLevel();
/**
* lichter Bestand (Besonnung)
*
* @return
* The requested value.
*/
boolean isLight();
/**
* geschlossene Kronendach
*
* @return
* The requested value.
*/
boolean isClosedCrown();
/**
* explitzit keine Besonnung
*
* @return
* The requested value.
*/
boolean isNoSun();
/**
* eingebettet in homogenene oder heterogene Umgebung
*
* @return
* The requested value.
*/
boolean isHomogen();
/**
* Exposition
*
* @return
* The requested value. May not be <code>null</code>.
*/
@Nonnull
EExposition getExposition();
@Nonnull
default String getExpositionID() {
return getExposition().getID();
}
/**
* Angabe von Neigungen: keine, Angabe von Neigungen, Freitext
*
* @return
* The requested value. May be <code>null</code>.
*/
@Nullable
String getHanglage();
default boolean hasHanglage() {
return StringHelper.hasText(getHanglage());
}
/**
* Größe (in m²)
*
* @return
* The requested value.
*/
int getAreaSize();
/**
* Habitatbaumgruppe NUR aus schon kartierten Biotopbäumen oder auch aus anderen Bäumen bestehend
*
* @return
* The requested value.
*/
boolean isOnlyBB();
/**
* Freitext
*
* @return
* The requested value. May not be <code>null</code>.
*/
@Nonnull
String getBeschreibung();
}
| [
"[email protected]"
] | |
de4b596aa3e66a2e73f39b69d5dba7092eddb832 | 9d14ce3d30466ab89bccbef51d2cdf6a5dcc1d8e | /estoquews-web/src/br/com/caelum/estoque/ws/EstoqueWSImpl.java | 839ee919513f2bb7f34f298b580d145b58c120e3 | [] | no_license | andrevnl/estoquews | 398033e98150e5372c845874ae37115b5fae5f68 | 0256bd2e0969f9b0dd12189a858c9e755ab712dd | refs/heads/master | 2023-03-06T05:18:16.569894 | 2021-02-21T02:23:57 | 2021-02-21T02:23:57 | 337,896,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,142 | java | package br.com.caelum.estoque.ws;
import javax.jws.WebService;
import java.util.Arrays;
@WebService(endpointInterface = "br.com.caelum.estoque.ws.EstoqueWS", name = "EstoqueWS", serviceName = "EstoqueWS", portName = "EstoqueWSPort")
public class EstoqueWSImpl implements EstoqueWS {
@Override
public ListaItens todosOsItens(Filtros filtros) {
System.out.println("Chamando todos os Itens");
ListaItens listaItens = new ListaItens();
listaItens.item = Arrays.asList(geraItem());
return listaItens;
}
@Override
public CadastrarItemResponse cadastrarItem(CadastrarItem parameters, TokenUsuario tokenUsuario) throws AutorizacaoFault {
System.out.println("Chamando cadastarItem");
CadastrarItemResponse resposta = new CadastrarItemResponse();
resposta.setItem(geraItem());
return resposta;
}
//método auxiliar
private Item geraItem() {
Item item = new Item();
item.codigo = "MEA";
item.nome = "MEAN";
item.quantidade = 5;
item.tipo = "Livro";
return item;
}
}
| [
"[email protected]"
] | |
6b1d8bacde112f4227fad1f183b8e8d9a0d64301 | 3036646b19edca13232186f31178c27ad4ad7f73 | /Test32/src/main32/Main32.java | 32fe2bfbf7923608f278c26e40a37a02b1e4bd56 | [] | no_license | Oleh131313/Test32 | 6fc4e4c5feb6aee25e498e675ae4af542f2789d1 | a50b6e06c7ec378d456454fc0a5e5ed2fae63a4e | refs/heads/master | 2021-01-01T17:12:59.730645 | 2017-07-22T11:04:03 | 2017-07-22T11:04:03 | 98,025,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | package main32;
public class Main32 {
public static void main(String[] args) {
System.out.println("Hello");
System.out.println("I hero");
}
}
| [
"[email protected]"
] | |
8ede146c5fc6c606d88814856d05e89d5f782ad8 | 5113b31832ab9ec48e9e68b1dc3766a354d87d78 | /njxct_lib_indicator/src/com/haoqee/chatsdk/SharedStorage.java | 39ebe0ec569188dd012f47349e766ce555e6036c | [] | no_license | ycc0545/android_item | 4a4058b79d8a2cdaf35209c5ae5f47d23aeaa6fd | 3244d8c40112ef0324dd2385f2ad7ca5ccf55068 | refs/heads/master | 2021-01-12T13:06:31.318110 | 2016-03-02T03:17:22 | 2016-03-02T03:17:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | package com.haoqee.chatsdk;
import android.content.Context;
import android.content.SharedPreferences;
/**
* 共享存储信息
* 功能:<br />
* 日期:2013-5-5<br />
* 地点:好奇科技<br />
* @since
*/
public final class SharedStorage {
/** 当读取Shared文件中的内容失败后,将发送该广播 */
public static final String ACTION_SHARED_READ_ERR = "com.shared.storage.READERROR";
/** 应用信息存储位置 */
public static final String SHARED_APP_NAME = "shared_core";
/** 应用配置信息存储位置 */
public static final String SHARED_CONFIG_NAME = "shared_config";
/** 应用缓存信息存储位置 */
public static final String SHARED_CACHE_NAME = "shared_cache";
public static SharedPreferences getSharedPreferences(Context context, String sharedName){
return context.getSharedPreferences(sharedName, Context.MODE_PRIVATE);
}
/**
* 缓存共享区
* @param context
* @return
public static SharedPreferences getCacheSharedPreferences(Context context){
return context.getSharedPreferences(SHARED_CACHE_NAME, Context.MODE_PRIVATE);
}
/**
* 配置共享区
* @param context
* @return
*/
public static SharedPreferences getConfigSharedPreferences(Context context){
return context.getSharedPreferences(SHARED_CONFIG_NAME, Context.MODE_PRIVATE);
}
/**
* 应用共享区
* @param context
* @return
*/
public static SharedPreferences getCoreSharedPreferences(Context context){
return context.getSharedPreferences(SHARED_APP_NAME, Context.MODE_PRIVATE);
}
}
| [
"[email protected]"
] | |
b149c8ef2c4876f8dad147c5c4b39e16487b3228 | 07ac433d94ef68715b5f18b834ac4dc8bb5b8261 | /benchmarks/caldat/julday/Eq/newV.java | 0354386c4f0dc37460e736597d0d95b988f42a5d | [
"MIT"
] | permissive | shrBadihi/ARDiff_Equiv_Checking | a54fb2908303b14a5a1f2a32b69841b213b2c999 | e8396ae4af2b1eda483cb316c51cd76949cd0ffc | refs/heads/master | 2023-04-03T08:40:07.919031 | 2021-02-05T04:44:34 | 2021-02-05T04:44:34 | 266,228,060 | 4 | 4 | MIT | 2020-11-26T01:34:08 | 2020-05-22T23:39:32 | Java | UTF-8 | Java | false | false | 727 | java | package demo.benchmarks.caldat.julday.Eq;
public class newV {
public static double snippet(double mmj, double idj, double iyyyj) {
double IGREG=15.0+31.0*(10.0+12.0*1582.0);
double ja =1.0;
double jul=0.0;
double jy=iyyyj;
double jm=0.0;
if (iyyyj == 0.0) //change
return 0.0;
if (jy < 0.0)
++jy;
if (mmj > 2.0) {
jm=mmj+1.0;
}
else {
--jy;
jm=mmj+13.0;
}
jul = Math.abs(365.0*jy)+Math.sqrt(30.0*jm)+idj+1720995.0;
if (idj+31.0*(mmj+12.0*iyyyj) <= IGREG ) {
ja=(0.01*jy);
jul += 2.0-ja+(0.25*ja);
}
return jul;
}
} | [
"[email protected]"
] | |
6d1768ca8b971182e7aa57944b3e03fc032d4724 | ecb7e109a62f6a2a130e3320ed1fb580ba4fc2de | /aio-service/src/main/java/com/viettel/aio/dto/CntConstrWorkItemTaskDTO.java | 5978fb373aafc2fa6141350000f51828da294d81 | [] | no_license | nisheeth84/prjs_sample | df732bc1eb58bc4fd4da6e76e6d59a2e81f53204 | 3fb10823ca4c0eb3cd92bcd2d5d4abc8d59436d9 | refs/heads/master | 2022-12-25T22:44:14.767803 | 2020-10-07T14:55:52 | 2020-10-07T14:55:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,086 | java | package com.viettel.aio.dto;
import com.viettel.aio.bo.CntConstrWorkItemTaskBO;
import com.viettel.utils.CustomJsonDateDeserializer;
import com.viettel.utils.CustomJsonDateSerializer;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;
import java.util.List;
/**
*
* @author hailh10
*/
@SuppressWarnings("serial")
@XmlRootElement(name = "CNT_CONSTR_WORK_ITEM_TASKBO")
@JsonIgnoreProperties(ignoreUnknown = true)
public class CntConstrWorkItemTaskDTO extends ComsBaseFWDTO<CntConstrWorkItemTaskBO> {
private Long constructionId;
private String constructionName;
private Long updatedGroupId;
private String updatedGroupName;
private Long updatedUserId;
private String updatedUserName;
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
@JsonSerialize(using = CustomJsonDateSerializer.class)
private Date updatedDate;
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
@JsonSerialize(using = CustomJsonDateSerializer.class)
private Date updatedDateFrom;
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
@JsonSerialize(using = CustomJsonDateSerializer.class)
private Date updatedDateTo;
private Long createdGroupId;
private String createdGroupName;
private Long createdUserId;
private String createdUserName;
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
@JsonSerialize(using = CustomJsonDateSerializer.class)
private Date createdDate;
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
@JsonSerialize(using = CustomJsonDateSerializer.class)
private Date createdDateFrom;
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
@JsonSerialize(using = CustomJsonDateSerializer.class)
private Date createdDateTo;
private Long status;
private String description;
private Double price;
private Double unitPrice;
private Long quantity;
private Long catUnitId;
private String catUnitName;
private Long catTaskId;
private String catTaskName;
private String catTaskCode;
private Long workItemId;
private String workItemName;
private String workItemCode;
private Long cntContractId;
private String cntContractName;
private String cntContractCode;
private Long cntConstrWorkItemTaskId;
private String constructionCode;
private String catStationCode;
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
@JsonSerialize(using = CustomJsonDateSerializer.class)
private Date startingDate;
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
@JsonSerialize(using = CustomJsonDateSerializer.class)
private Date completeDate;
private Double completeValue;
private Double completeValueWorkItem;
private String taskCode;
// hoanm1_20180312_start
private String complateState;
private String email;
private String fullName;
// hoanm1_20180312_end
private String sysGroupName;
// hnx_20180418_start
private Long isInternal;
private Long constructorId;
private String listContractIn;
// hnx_20180418_end
private Long type;
/**hoangnh start 02012018**/
private String synStatus;
/**hoangnh start 02012018**/
//hienvd: START 7/9/2019
private String stationHTCT;
public String getStationHTCT() {
return stationHTCT;
}
public void setStationHTCT(String stationHTCT) {
this.stationHTCT = stationHTCT;
}
//hienvd: END 7/9/2019
@Override
public CntConstrWorkItemTaskBO toModel() {
CntConstrWorkItemTaskBO cntConstrWorkItemTaskBO = new CntConstrWorkItemTaskBO();
cntConstrWorkItemTaskBO.setConstructionId(this.constructionId);
cntConstrWorkItemTaskBO.setUpdatedGroupId(this.updatedGroupId);
cntConstrWorkItemTaskBO.setUpdatedUserId(this.updatedUserId);
cntConstrWorkItemTaskBO.setUpdatedDate(this.updatedDate);
cntConstrWorkItemTaskBO.setCreatedGroupId(this.createdGroupId);
cntConstrWorkItemTaskBO.setCreatedUserId(this.createdUserId);
cntConstrWorkItemTaskBO.setCreatedDate(this.createdDate);
cntConstrWorkItemTaskBO.setStatus(this.status);
cntConstrWorkItemTaskBO.setDescription(this.description);
cntConstrWorkItemTaskBO.setPrice(this.price);
cntConstrWorkItemTaskBO.setUnitPrice(this.unitPrice);
cntConstrWorkItemTaskBO.setQuantity(this.quantity);
cntConstrWorkItemTaskBO.setCatUnitId(this.catUnitId);
cntConstrWorkItemTaskBO.setCatTaskId(this.catTaskId);
cntConstrWorkItemTaskBO.setWorkItemId(this.workItemId);
cntConstrWorkItemTaskBO.setCntContractId(this.cntContractId);
cntConstrWorkItemTaskBO.setCntConstrWorkItemTaskId(this.cntConstrWorkItemTaskId);
cntConstrWorkItemTaskBO.setSynStatus(this.synStatus);
//hienvd: START 7/9/2019
cntConstrWorkItemTaskBO.setStationHTCT(this.stationHTCT);
//hienvd: END 7/9/2019
return cntConstrWorkItemTaskBO;
}
@JsonProperty("catTaskCode")
public String getCatTaskCode() {
return catTaskCode;
}
public void setCatTaskCode(String catTaskCode) {
this.catTaskCode = catTaskCode;
}
@JsonProperty("type")
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
@JsonProperty("constructionId")
public Long getConstructionId(){
return constructionId;
}
public void setConstructionId(Long constructionId){
this.constructionId = constructionId;
}
@JsonProperty("constructionName")
public String getConstructionName(){
return constructionName;
}
public void setConstructionName(String constructionName){
this.constructionName = constructionName;
}
@JsonProperty("updatedGroupId")
public Long getUpdatedGroupId(){
return updatedGroupId;
}
public void setUpdatedGroupId(Long updatedGroupId){
this.updatedGroupId = updatedGroupId;
}
@JsonProperty("updatedGroupName")
public String getUpdatedGroupName(){
return updatedGroupName;
}
public void setUpdatedGroupName(String updatedGroupName){
this.updatedGroupName = updatedGroupName;
}
@JsonProperty("updatedUserId")
public Long getUpdatedUserId(){
return updatedUserId;
}
public void setUpdatedUserId(Long updatedUserId){
this.updatedUserId = updatedUserId;
}
@JsonProperty("updatedUserName")
public String getUpdatedUserName(){
return updatedUserName;
}
public void setUpdatedUserName(String updatedUserName){
this.updatedUserName = updatedUserName;
}
@JsonProperty("updatedDate")
public Date getUpdatedDate(){
return updatedDate;
}
public void setUpdatedDate(Date updatedDate){
this.updatedDate = updatedDate;
}
public Date getUpdatedDateFrom() {
return updatedDateFrom;
}
public void setUpdatedDateFrom(Date updatedDateFrom) {
this.updatedDateFrom = updatedDateFrom;
}
public Date getUpdatedDateTo() {
return updatedDateTo;
}
public void setUpdatedDateTo(Date updatedDateTo) {
this.updatedDateTo = updatedDateTo;
}
@JsonProperty("createdGroupId")
public Long getCreatedGroupId(){
return createdGroupId;
}
public void setCreatedGroupId(Long createdGroupId){
this.createdGroupId = createdGroupId;
}
@JsonProperty("createdGroupName")
public String getCreatedGroupName(){
return createdGroupName;
}
public void setCreatedGroupName(String createdGroupName){
this.createdGroupName = createdGroupName;
}
@JsonProperty("createdUserId")
public Long getCreatedUserId(){
return createdUserId;
}
public void setCreatedUserId(Long createdUserId){
this.createdUserId = createdUserId;
}
@JsonProperty("createdUserName")
public String getCreatedUserName(){
return createdUserName;
}
public void setCreatedUserName(String createdUserName){
this.createdUserName = createdUserName;
}
@JsonProperty("createdDate")
public Date getCreatedDate(){
return createdDate;
}
public void setCreatedDate(Date createdDate){
this.createdDate = createdDate;
}
public Date getCreatedDateFrom() {
return createdDateFrom;
}
public void setCreatedDateFrom(Date createdDateFrom) {
this.createdDateFrom = createdDateFrom;
}
public Date getCreatedDateTo() {
return createdDateTo;
}
public void setCreatedDateTo(Date createdDateTo) {
this.createdDateTo = createdDateTo;
}
@JsonProperty("status")
public Long getStatus(){
return status;
}
public void setStatus(Long status){
this.status = status;
}
@JsonProperty("description")
public String getDescription(){
return description;
}
public void setDescription(String description){
this.description = description;
}
@JsonProperty("price")
public Double getPrice(){
return price;
}
public void setPrice(Double price){
this.price = price;
}
@JsonProperty("unitPrice")
public Double getUnitPrice(){
return unitPrice;
}
public void setUnitPrice(Double unitPrice){
this.unitPrice = unitPrice;
}
@JsonProperty("quantity")
public Long getQuantity(){
return quantity;
}
public void setQuantity(Long quantity){
this.quantity = quantity;
}
@JsonProperty("catUnitId")
public Long getCatUnitId(){
return catUnitId;
}
public void setCatUnitId(Long catUnitId){
this.catUnitId = catUnitId;
}
@JsonProperty("catUnitName")
public String getCatUnitName(){
return catUnitName;
}
public void setCatUnitName(String catUnitName){
this.catUnitName = catUnitName;
}
@JsonProperty("catTaskId")
public Long getCatTaskId(){
return catTaskId;
}
public void setCatTaskId(Long catTaskId){
this.catTaskId = catTaskId;
}
@JsonProperty("catTaskName")
public String getCatTaskName(){
return catTaskName;
}
public void setCatTaskName(String catTaskName){
this.catTaskName = catTaskName;
}
@JsonProperty("workItemId")
public Long getWorkItemId(){
return workItemId;
}
public void setWorkItemId(Long workItemId){
this.workItemId = workItemId;
}
@JsonProperty("workItemName")
public String getWorkItemName(){
return workItemName;
}
public void setWorkItemName(String workItemName){
this.workItemName = workItemName;
}
@JsonProperty("cntContractId")
public Long getCntContractId(){
return cntContractId;
}
public void setCntContractId(Long cntContractId){
this.cntContractId = cntContractId;
}
@JsonProperty("cntContractName")
public String getCntContractName(){
return cntContractName;
}
public void setCntContractName(String cntContractName){
this.cntContractName = cntContractName;
}
@Override
public Long getFWModelId() {
return cntConstrWorkItemTaskId;
}
@Override
public String catchName() {
return getCntConstrWorkItemTaskId().toString();
}
@JsonProperty("cntConstrWorkItemTaskId")
public Long getCntConstrWorkItemTaskId(){
return cntConstrWorkItemTaskId;
}
public void setCntConstrWorkItemTaskId(Long cntConstrWorkItemTaskId){
this.cntConstrWorkItemTaskId = cntConstrWorkItemTaskId;
}
@JsonProperty("constructionCode")
public String getConstructionCode() {
return constructionCode;
}
public void setConstructionCode(String constructionCode) {
this.constructionCode = constructionCode;
}
@JsonProperty("catStationCode")
public String getCatStationCode() {
return catStationCode;
}
public void setCatStationCode(String catStationCode) {
this.catStationCode = catStationCode;
}
@JsonProperty("startingDate")
public Date getStartingDate() {
return this.startingDate;
}
public void setStartingDate(Date startingDate) {
this.startingDate = startingDate;
}
@JsonProperty("completeDate")
public Date getCompleteDate() {
return this.completeDate;
}
public void setCompleteDate(Date completeDate) {
this.completeDate = completeDate;
}
@JsonProperty("completeValue")
public Double getCompleteValue() {
return this.completeValue;
}
public void setCompleteValue(Double completeValue) {
this.completeValue = completeValue;
}
@JsonProperty("workItemCode")
public String getWorkItemCode() {
return workItemCode;
}
public void setWorkItemCode(String workItemCode) {
this.workItemCode = workItemCode;
}
@JsonProperty("taskCode")
public String getTaskCode() {
return taskCode;
}
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
// hoanm1_20180312_start
@JsonProperty("complateState")
public String getComplateState() {
return complateState;
}
public void setComplateState(String complateState) {
this.complateState = complateState;
}
@JsonProperty("email")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@JsonProperty("fullName")
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
@JsonProperty("sysGroupName")
public String getSysGroupName() {
return sysGroupName;
}
public void setSysGroupName(String sysGroupName) {
this.sysGroupName = sysGroupName;
}
// hoanm1_20180312_end
@JsonProperty("cntContractCode")
public String getCntContractCode() {
return cntContractCode;
}
public void setCntContractCode(String cntContractCode) {
this.cntContractCode = cntContractCode;
}
@JsonProperty("completeValueWorkItem")
public Double getCompleteValueWorkItem() {
return completeValueWorkItem;
}
public void setCompleteValueWorkItem(Double completeValueWorkItem) {
this.completeValueWorkItem = completeValueWorkItem;
}
public Long getIsInternal() {
return isInternal;
}
public void setIsInternal(Long isInternal) {
this.isInternal = isInternal;
}
public Long getConstructorId() {
return constructorId;
}
public void setConstructorId(Long constructorId) {
this.constructorId = constructorId;
}
public String getListContractIn() {
return listContractIn;
}
public void setListContractIn(String listContractIn) {
this.listContractIn = listContractIn;
}
public String getSynStatus() {
return synStatus;
}
public void setSynStatus(String synStatus) {
this.synStatus = synStatus;
}
//Huypq-20190919-start
private String catStationCodeCtct;
private String catStationCodeViettel;
private String address;
private String catProvinceName;
private String catProvinceCode;
private String longitude;
private String latitude;
private String location;
private String highHtct;
private String capexHtct;
private String partnerName;
private String stationHtct;
private String contractHlDate;
private String paymentFrom;
private String paymentTo;
private String paymentPrice;
private String paymentContinue;
public String getCatStationCodeCtct() {
return catStationCodeCtct;
}
public void setCatStationCodeCtct(String catStationCodeCtct) {
this.catStationCodeCtct = catStationCodeCtct;
}
public String getCatStationCodeViettel() {
return catStationCodeViettel;
}
public void setCatStationCodeViettel(String catStationCodeViettel) {
this.catStationCodeViettel = catStationCodeViettel;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCatProvinceName() {
return catProvinceName;
}
public void setCatProvinceName(String catProvinceName) {
this.catProvinceName = catProvinceName;
}
public String getCatProvinceCode() {
return catProvinceCode;
}
public void setCatProvinceCode(String catProvinceCode) {
this.catProvinceCode = catProvinceCode;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getHighHtct() {
return highHtct;
}
public void setHighHtct(String highHtct) {
this.highHtct = highHtct;
}
public String getCapexHtct() {
return capexHtct;
}
public void setCapexHtct(String capexHtct) {
this.capexHtct = capexHtct;
}
public String getPartnerName() {
return partnerName;
}
public void setPartnerName(String partnerName) {
this.partnerName = partnerName;
}
public String getStationHtct() {
return stationHtct;
}
public void setStationHtct(String stationHtct) {
this.stationHtct = stationHtct;
}
public String getContractHlDate() {
return contractHlDate;
}
public void setContractHlDate(String contractHlDate) {
this.contractHlDate = contractHlDate;
}
public String getPaymentFrom() {
return paymentFrom;
}
public void setPaymentFrom(String paymentFrom) {
this.paymentFrom = paymentFrom;
}
public String getPaymentTo() {
return paymentTo;
}
public void setPaymentTo(String paymentTo) {
this.paymentTo = paymentTo;
}
public String getPaymentPrice() {
return paymentPrice;
}
public void setPaymentPrice(String paymentPrice) {
this.paymentPrice = paymentPrice;
}
public String getPaymentContinue() {
return paymentContinue;
}
public void setPaymentContinue(String paymentContinue) {
this.paymentContinue = paymentContinue;
}
private String contractType;
private String projectType;
public String getContractType() {
return contractType;
}
public void setContractType(String contractType) {
this.contractType = contractType;
}
public String getProjectType() {
return projectType;
}
public void setProjectType(String projectType) {
this.projectType = projectType;
}
private List<String> contractTypeLst;
public List<String> getContractTypeLst() {
return contractTypeLst;
}
public void setContractTypeLst(List<String> contractTypeLst) {
this.contractTypeLst = contractTypeLst;
}
//Huy-end
}
| [
"[email protected]"
] | |
681a455c236dcbeea41983e58e9f1957ee9b11aa | 20aa7f03d5e46eed15529f0ed4de9d5544dae835 | /src/game_logic/Board.java | 71153b3234e37a53ec67d1b187c0fef2fbe45e6d | [] | no_license | JasonXsy/FortressDefense | cbb358379201ec8598c821d68b6759a99252bef9 | 964fbfc5763b0662fa1155acaeb41402e2cb1d1d | refs/heads/master | 2020-12-24T20:10:46.858884 | 2016-05-22T00:35:57 | 2016-05-22T00:35:57 | 59,387,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,925 | java | package game_logic;
import java.util.ArrayList;
import java.util.Random;
import java.util.List;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/*board class generates required game objects.
* handles game objects' interaction.
* ex. passing fortress to tank in order to let tanks attack reduce
* the fortress' strength
*
*/
public class Board {
private static List<ChangeListener> listeners = new ArrayList<ChangeListener>();
private Cell[][] cells;
private Tank[] tanks;
private Fortress fortress;
private int number_row;
private int number_column;
private int number_tanks;
private int number_tank_cells;
private int fortress_hp;
public Board(int row, int col, int fortress_strength,
int num_tanks, int tank_cells){
number_row = row;
number_column = col;
fortress_hp = fortress_strength;
number_tanks = num_tanks;
number_tank_cells = tank_cells;
/*get game objects*/
setCells(new Cell[number_row][number_column]);
for (int i = 0; i<number_row;i++){
for(int j = 0; j<number_column;j++){
cells[i][j] = new Cell(i,j);
}
}
tanks = new Tank[number_tanks];
for (int i = 0; i<number_tanks; i++){
tanks[i] = new Tank(number_tank_cells);
}
setFortress(new Fortress(fortress_hp));
generateTanks();
}
public Cell getCell ( int i, int j){
return cells[i][j];
}
private void generateTanks(){
for(Tank tanks: tanks){
getNextTankCell(tanks);
}
}
private void getNextTankCell(Tank tank) {
Random rand_num = new Random();
int start_point_row = 0;
int start_point_col = 0;
boolean isAllTankCellsDone = false;
while(!isAllTankCellsDone){
//first cell starts here, if all other cells fail to generate, start over from here
start_point_row = rand_num.nextInt(number_row);
start_point_col = rand_num.nextInt(number_column);
if (cells[start_point_row][start_point_col].getIsTank() == false){
tank.addCells(cells[start_point_row][start_point_col]);
cells[start_point_row][start_point_col].setIsTank(true);
isAllTankCellsDone = getRestTankCells(tank, rand_num);
}
}
}
private boolean getRestTankCells(Tank t, Random rand_num) {
while(t.getCells().size() != 4){
int next_row = t.getCells().getLast().getCurrent_row();
int next_col = t.getCells().getLast().getCurrent_column();
/*chose direction, 0 = north, 1 = east, 2 south, 3 =west */
int next_cell = rand_num.nextInt(4);
if (next_cell == 0){//north
/*check if the next cell is occupied by another tank or out of boundary*/
int north = next_row-1;
if( (north >= 0 && north < number_row) &&! (cells[north][next_col].getIsTank())){
t.addCells(cells[north][next_col]);
cells[north][next_col].setIsTank(true);
}
}
else if (next_cell == 1){
int east = next_col+1;
if((east >= 0&&east < number_column)
&&! cells[next_row][east].getIsTank()){
t.addCells(cells[next_row][east]);
cells[next_row][east].setIsTank(true);
}
}
else if (next_cell == 2){
int south = next_row+1;
if((south >=0 && south<number_row)
&&! cells[south][next_col].getIsTank()){
t.addCells(cells[south][next_col]);
cells[south][next_col].setIsTank(true);
}
}
else if (next_cell == 3){
int west = next_col-1;
if((west >= 0 &&west < number_column)
&&! cells[next_row][west].getIsTank()){
t.addCells(cells[next_row][west]);
cells[next_row][west].setIsTank(true);
}
}
}
if(t.getCells().size() == 4){
return true;
}
else{
return false;
}
}
public int isFortressHit(int row, int col){
notifyListeners();
return fortress.fireCannons(cells[row][col], tanks);
}
public ArrayList<Integer> getTankDamage_notFire(){
ArrayList<Integer> damages = new ArrayList<Integer>();
for (Tank t : tanks){
damages.add(t.current_damge());
}
return damages;
}
public ArrayList<Integer> getEachTankDamage(){
ArrayList<Integer> damages = new ArrayList<Integer>();
for(Tank t : tanks){
damages.add(t.fire(getFortress()));
}
notifyListeners();
return damages;
}
public String inGameCells(int row, int col){
String symbol = new String();
if (cells[row][col].getHasBeenAttacked()){
if(cells[row][col].getIsTank()){
symbol = "X";
}else{
symbol = ".";
}
}else{
symbol = "~";
}
return symbol;
}
public String afterGameCells(int row, int col){
String symbol = new String();
if (cells[row][col].getIsTank() && cells[row][col].getHasBeenAttacked()){
symbol = "X";
} else if(cells[row][col].getIsTank() && !cells[row][col].getHasBeenAttacked()) {
symbol = "T";
}
else{
if(cells[row][col].getHasBeenAttacked() && !cells[row][col].getIsTank()){
symbol = ".";
}else{
symbol = " ";
}
}
return symbol;
}
public int isWon(){
/*1 == lose, -1 == win*/
int game_continue =0;
if(fortress.getHp() <= 0){
return 1;
}
else{
for(Tank t : tanks){
if(t.getNumber_undamaged_cell() != 0){
return game_continue;
}
}
return -1; //win
// for(int i =0; i<number_tanks;i++){
// if (tanks[i].getNumber_undamaged_cell()!=0){
// isAllTankDown = false;
// }
// if (isAllTankDown){
// return -1;
// }
// }
}
}
public int getRow(){
return number_row;
}
public int getCol(){
return number_column;
}
public Fortress getFortress() {
return fortress;
}
public void setFortress(Fortress fortress) {
this.fortress = fortress;
}
public Cell[][] getCells() {
return cells;
}
public void setCells(Cell[][] cells) {
this.cells = cells;
}
public static void addChangeListener (ChangeListener listener){
listeners.add(listener);
}
public void notifyListeners() {
if (listeners == null) {
return;
}
ChangeEvent event = new ChangeEvent(this);
for (ChangeListener listener : listeners){
listener.stateChanged(event);
}
}
}
| [
"[email protected]"
] | |
00fa245b72777b3c12ec366ca76c86a8f761edd6 | 559bc6952a3e353d0d0c640016cba687a23327cf | /src/main/java/me/olliem5/past/impl/modules/combat/KillAura.java | 4523b7b53acca196390affa736243ef65865961e | [
"MIT"
] | permissive | XeonLyfe/past | c9f0cff1f24d119a80676773770bdc4e8b8df947 | 652723e2ddefbbc6756eb916aa33bea7cae6629b | refs/heads/master | 2023-03-17T15:23:37.272668 | 2021-03-07T07:15:54 | 2021-03-07T07:15:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,073 | java | package me.olliem5.past.impl.modules.combat;
import com.mojang.realmsclient.gui.ChatFormatting;
import me.olliem5.past.Past;
import me.olliem5.past.api.module.Category;
import me.olliem5.past.api.module.Module;
import me.olliem5.past.api.module.ModuleInfo;
import me.olliem5.past.api.setting.Setting;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumHand;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@ModuleInfo(name = "KillAura", description = "Automatically attacks entities in range", category = Category.COMBAT)
public class KillAura extends Module {
Setting range;
Setting players;
Setting mobs;
Setting animals;
@Override
public void setup() {
Past.settingsManager.registerSetting(range = new Setting("Range", "KillAuraRange", 0.0, 5.0, 10.0, this));
Past.settingsManager.registerSetting(players = new Setting("Players", "KillAuraPlayers", true, this));
Past.settingsManager.registerSetting(mobs = new Setting("Mobs", "KillAuraMobs", false, this));
Past.settingsManager.registerSetting(animals = new Setting("Animals", "KillAuraAnimals", false, this));
}
private Entity target = null;
public void onUpdate() {
if (nullCheck()) return;
List<Entity> targets = mc.world.loadedEntityList.stream()
.filter(entity -> entity != mc.player)
.filter(entity -> mc.player.getDistance(entity) <= range.getValueDouble())
.filter(entity -> !entity.isDead)
.filter(entity -> attackCheck(entity))
.sorted(Comparator.comparing(e -> mc.player.getDistance(e)))
.collect(Collectors.toList());
targets.forEach(target -> {
attack(target);
});
}
public void attack(Entity entity) {
if (mc.player.getCooledAttackStrength(0) >= 1) {
mc.playerController.attackEntity(mc.player, entity);
mc.player.swingArm(EnumHand.MAIN_HAND);
}
target = entity;
}
public boolean attackCheck(Entity entity) {
if (players.getValBoolean() && entity instanceof EntityPlayer && !Past.friendsManager.isFriend(entity.getName())) {
if (((EntityPlayer) entity).getHealth() > 0) {
return true;
}
} else if (mobs.getValBoolean() && entity instanceof EntityMob) {
if (((EntityMob) entity).getHealth() > 0) {
return true;
}
} else if (animals.getValBoolean() && entity instanceof EntityAnimal) {
if (((EntityAnimal) entity).getHealth() > 0) {
return true;
}
}
return false;
}
public String getArraylistInfo() {
if (target != null) {
return ChatFormatting.GRAY + " " + target.getName();
} else {
return "";
}
}
}
| [
"[email protected]"
] | |
9e72dd63da2da8dd18fd8186d24c94b7a756d431 | 153c293d6df417727f591c363b0ee275d2c7488a | /Pawn.java | 8f8e9a34e7bdb4c4bcd048352841d21ec42f430b | [] | no_license | PascalBedrossian/ChessGame | c6994399fffea39d4ec35eb4053e6d083a1c2098 | f8bf713e345632b7ab9dfb7fe5584ef9cfffcf3c | refs/heads/main | 2023-04-16T21:43:20.813834 | 2021-04-22T02:16:26 | 2021-04-22T02:16:26 | 360,363,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,205 | java | import java.util.ArrayList;
public class Pawn extends Piece
{
/**
* Construct a new Pawn Object
*
* @param color the color of the piece
* @param x the x coordinate of the piece
* @param y the y coordinate of the piece
*/
public Pawn(boolean color, int x, int y){
// this calls the constructor of Piece
super(color, x, y);
}
/**
* Collect all the moves the pawn can do and store
* them in an array of type ListOfMoves
*
* @return an array of type ListOfMoves
*/
protected ListOfMoves[] getMoves(){
boolean isWhite = this.color;
ListOfMoves[] moves = {};
if (isWhite) {//white pawn, so moving from coordinates 0 to 7, so up
ArrayList<ListOfMoves> whiteMoves = new ArrayList<ListOfMoves>();
// move forward
whiteMoves.add(ListOfMoves.UP);
// to capture diagonally
whiteMoves.add(ListOfMoves.UP_RIGHT);
whiteMoves.add(ListOfMoves.UP_LEFT);
if (!hasMoved) {// if it didn't move, allow double forward move
whiteMoves.add(ListOfMoves.DOUBLE_UP);
}
moves = whiteMoves.toArray(moves);
} else {//black pawn, so moving from coordinates 7 to 0, so down
ArrayList<ListOfMoves> blackMoves = new ArrayList<ListOfMoves>();
// move forward
blackMoves.add(ListOfMoves.DOWN);
// to capture diagonally
blackMoves.add(ListOfMoves.DOWN_RIGHT);
blackMoves.add(ListOfMoves.DOWN_LEFT);
if (!hasMoved) {// if it didn't move, allow double forward move
blackMoves.add(ListOfMoves.DOUBLE_DOWN);
}
moves = blackMoves.toArray(moves);
}
return moves;
}
/**
* Determine if this piece has single moves or multiple
*
* @return a boolean true if it has single moves and false otherwise
*/
protected boolean hasSingleMove(){
return true;
}
/**
* Gives the Sring representation of this piece
*
* @return a String
*/
protected String getName(){
return "pawn";
}
} | [
"[email protected]"
] | |
c27d3445536d642a61d819c61a87b5b38d675636 | 2d5148ce300815bb9225636778e94fe64e8e5e4d | /Minglr-BackEnd/src/main/java/com/dao/VoteRepoImpl.java | bd9fd81db1c11e295c571a1f6a39cead73a6348f | [] | no_license | Minngilbert/MinglrSN | 410592d9a3e93aa815768d562044f38a3fcba364 | dd36d87f7b94e2bec854e7be17a79ff40f77c37d | refs/heads/main | 2022-12-30T07:49:36.407831 | 2020-10-13T07:28:05 | 2020-10-13T07:28:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,049 | java | package com.dao;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.models.Posts;
import com.models.Vote;
@Transactional
@Repository("VoteRepoImpl")
public class VoteRepoImpl implements VoteRepo {
@Autowired
private SessionFactory sesFact;
@Override
public void createVotebyUser(Vote vote) {
sesFact.getCurrentSession().save(vote);
}
@Override
public void deleteVoteByPostId(int postid) {
Posts post = (Posts) sesFact.getCurrentSession().get(Posts.class, postid);
System.out.println(post);
sesFact.getCurrentSession().delete(post);
sesFact.getCurrentSession().flush();
}
@Override
public List<Vote> selectAllVote(int voteId) {
System.out.println("getting all posts..");
List<Vote> votes = sesFact.getCurrentSession().createQuery("from Vote where user_id ='"+ voteId +"'", Vote.class).list();
return votes;
}
}
| [
"[email protected]"
] | |
eab285de93967a77a9bae27ce2e44a30c9d71370 | 49b9758a4e959f5974c9192b9f0e7834e93c6c7a | /Original Files/source/src/android/support/v4/view/accessibility/G.java | 140911c07b79f34b36e742e4b46e2629928e5c19 | [
"Apache-2.0"
] | permissive | renanalves/MiBandDecompiled | 88855d3182d3a66c4c59c6202c8ccc9f5d38c5cf | 2c12ea0a68e55d776551ad70ed4ef26b0ed87a70 | refs/heads/master | 2021-05-02T18:26:40.875129 | 2015-05-04T12:49:22 | 2015-05-04T12:49:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package android.support.v4.view.accessibility;
import android.view.accessibility.AccessibilityRecord;
class G
{
G()
{
}
public static int a(Object obj)
{
return ((AccessibilityRecord)obj).getMaxScrollX();
}
public static void a(Object obj, int i)
{
((AccessibilityRecord)obj).setMaxScrollX(i);
}
public static int b(Object obj)
{
return ((AccessibilityRecord)obj).getMaxScrollY();
}
public static void b(Object obj, int i)
{
((AccessibilityRecord)obj).setMaxScrollY(i);
}
}
| [
"[email protected]"
] | |
bf0284580eb94ae5fec2a697890a8846af4415f8 | 7821ec7034f5511cbe0a58307d15e69e25c2ffe5 | /roses-biz-support/modular-dict/biz-support-dict/src/main/java/cn/stylefeng/roses/biz/dict/modular/mapper/DictTypeMapper.java | f6084db5086f9e4538076cdd64bea8f6ee1feb8f | [
"Apache-2.0"
] | permissive | diewucanghai/roses | e0205efaf52665a247d092f7b49b854040f545bb | fd78459c451ed8be38339ce6fa2e348ed78bd4db | refs/heads/master | 2020-04-01T13:10:07.508984 | 2018-10-18T07:31:42 | 2018-10-18T07:31:42 | 153,239,642 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package cn.stylefeng.roses.biz.dict.modular.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import cn.stylefeng.roses.biz.dict.api.entity.DictType;
import cn.stylefeng.roses.biz.dict.api.model.DictTypeInfo;
import java.util.List;
/**
* <p>
* 字典类型表 Mapper 接口
* </p>
*
* @author fengshuonan
* @since 2018-07-24
*/
public interface DictTypeMapper extends BaseMapper<DictType> {
/**
* 获取字典类型列表
*
* @author fengshuonan
* @Date 2018/7/25 上午11:24
*/
List<DictTypeInfo> getDictTypeList(Page page, DictTypeInfo dictTypeInfo);
}
| [
"[email protected]"
] | |
ea2f5bb9109d57627cd8e175cff44376c0af1330 | e6c12d69ae5efa4938a0e99464a48fd7fe749285 | /src/com/cos/blog/domain/board/Board.java | e71fb46c951a471f92659f49a262e3aba6cd9e58 | [] | no_license | chmh0805/Jsp-Blog | 17f0efb3b41c02d6cdd0832db01bcdda261f3597 | ed10175e95f974f31959e7eaeaf01b14b98055df | refs/heads/master | 2023-02-10T07:52:43.873257 | 2021-01-11T09:49:25 | 2021-01-11T09:49:25 | 325,679,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.cos.blog.domain.board;
import java.sql.Timestamp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Board {
private int id;
private int userId;
private String title;
private String content;
private int readCount; // 조회수 default=0
private Timestamp createDate;
} | [
"[email protected]"
] | |
1f64e3d68bb1e9c09b619648af7986020ffa4077 | 80ce4624948c61a62fb7c180cdabf184186b6cee | /src/main/java/vn/com/nct/service/objectservice/RoleServiceIplm.java | c4ce1607916edd9ea479a1a7b0b12321884e921c | [] | no_license | tienvn3012/GHServer | c8be9091e886971e4f008b057947a0a6681ce82f | 08d53a9e8ee17960f155c3a05bb2306842baff8c | refs/heads/master | 2018-09-19T22:02:17.536577 | 2018-06-06T09:48:42 | 2018-06-06T09:48:42 | 110,795,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,803 | java | package vn.com.nct.service.objectservice;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import vn.com.nct.dao.ObjectDaoSupport;
import vn.com.nct.model.Roles;
import vn.com.nct.model.response.Page;
import vn.com.nct.model.response.RoleResponse;
@Service("roleService")
@Transactional(readOnly = false)
public class RoleServiceIplm implements ObjectService<Roles,RoleResponse>{
@Autowired
private ObjectDaoSupport<Roles> roleDao;
@Override
public List<Roles> getAll() {
// TODO Auto-generated method stub
return roleDao.getAll();
}
@Override
public List<Roles> getAllBy(String... condition) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Roles> getLimit(int index, int offset) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Roles> getLimitBy(int index, int offset, String... condition) {
// TODO Auto-generated method stub
return null;
}
@Override
public Roles getOneById(int id) {
// TODO Auto-generated method stub
return roleDao.getOneById(id);
}
@Override
public Roles getOneByCondition(String... condition) {
// TODO Auto-generated method stub
return null;
}
@Override
public void deleteE(int id) {
// TODO Auto-generated method stub
}
@Override
public void deleteManyE(List<Roles> lis) {
// TODO Auto-generated method stub
}
@Override
public Roles saveE(Roles e) {
// TODO Auto-generated method stub
return roleDao.saveE(e);
}
@Override
public int countAll() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int countBy(String... condition) {
// TODO Auto-generated method stub
return 0;
}
@Override
public Page<RoleResponse> getPage(int page_number, int row) {
// TODO Auto-generated method stub
return null;
}
@Override
public Roles updateE(Roles e) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<RoleResponse> parseAll(List<Roles> lis) {
List<RoleResponse> lisResponse = new ArrayList<>();
for (int i = 0; i < lis.size(); i++) {
lisResponse.add(this.parseResponse(lis.get(i)));
}
return lisResponse;
}
@Override
public RoleResponse parseResponse(Roles role) {
RoleResponse response = new RoleResponse();
response.setId(role.getId());
response.setRole(role.getRole());
return response;
}
@Override
public Page<RoleResponse> getPageBy(int page_number, int row, String... condition) {
// TODO Auto-generated method stub
return null;
}
@Override
public Roles parseToStandar(RoleResponse t) {
// TODO Auto-generated method stub
return null;
}
}
| [
"[email protected]"
] | |
08632347636efe3bea5786c0f05769ecf6a531d2 | 94802fb43239b8355ea33b6421448ec6d86f775d | /agenda/src/main/java/stone/agenda/models/IDayItem.java | 619bf4d3d10eadf553493a0dad00fe69a6560ea6 | [
"MIT"
] | permissive | jgabrielfreitas/Agenda | 0c6beeba1ab9c9814ca4c9be965dd960de333c7f | 3f00b8d9ff8d3836297992e63acf147f5521edfe | refs/heads/master | 2021-01-12T10:15:18.341533 | 2017-01-30T20:56:14 | 2017-01-30T20:56:14 | 76,400,072 | 1 | 1 | null | 2017-01-30T16:37:57 | 2016-12-13T21:31:17 | Java | UTF-8 | Java | false | false | 717 | java | package stone.agenda.models;
import java.util.Calendar;
import java.util.Date;
public interface IDayItem {
// region Getters/Setters
Date getDate();
void setDate(Date date);
int getValue();
void setValue(int value);
boolean isToday();
void setToday(boolean today);
boolean isSelected();
void setSelected(boolean selected);
boolean isFirstDayOfTheMonth();
void setFirstDayOfTheMonth(boolean firstDayOfTheMonth);
String getMonth();
void setMonth(String month);
int getDayOftheWeek();
void setDayOftheWeek(int mDayOftheWeek);
// endregion
void buildDayItemFromCal(Calendar calendar);
String toString();
IDayItem copy();
}
| [
"[email protected]"
] | |
b9c80d3efab8ef9019b200c9ca3973a4701bbfda | 3c1ef9311ee3c2f2d0394ed4b296ba1e6c96b338 | /FacebookExample/app/src/androidTest/java/com/example/fixit/facebookexample/ExampleInstrumentedTest.java | 7bd66f88b747274762c91ec94fa3e570794b644a | [] | no_license | ajm13c/NotQuiteThereYet | 3b42c0f700b12870462ae354603ff96f9552d338 | 367569dc9768b674538ebcf9a9640728c766a163 | refs/heads/master | 2020-12-24T11:06:18.035264 | 2016-12-01T12:36:52 | 2016-12-01T12:36:52 | 73,201,031 | 0 | 0 | null | 2016-11-14T00:11:06 | 2016-11-08T15:43:15 | Java | UTF-8 | Java | false | false | 770 | java | package com.example.fixit.facebookexample;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.fixit.facebookexample", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
d3af1df8fbf5dd686b53d25e79ffcf26c4377c96 | 2d0a82f047c7d3e59ca7a33109e0fe6b8bed2de6 | /Week_01/2020-08-10/移动零/Solution.java | 760db8633bda6e4de5b93f68c688f33a9dcd806d | [] | no_license | AugustYou/algorithm014-algorithm014 | 8c8c9235675c897ae533f5b722012e302ed726d2 | ca70819925646f484229e1f35f5b62342d1e044c | refs/heads/master | 2023-01-02T16:05:22.003645 | 2020-10-29T12:37:06 | 2020-10-29T12:37:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | class Solution {
public void moveZeroes(int[] nums) {
int l = 0, f = 0;
// 思路很简单,快慢指针 l : slow, f : fast 。
while (nums.length != 1 && f <= nums.length - 1) {
// 如果f位置为0,则让 f 先走,找到一个非零的位置
if (nums[f] == 0) {
f++;
continue;
}
// 如果l位置为0,则跟f位置的值互换
if (nums[l] == 0) {
nums[l] = nums[f];
nums[f] = 0;
l++;
continue;
}
// 都不为0则一起往前移动
f++;
l++;
}
}
} | [
"[email protected]"
] | |
4b2afb8ee3aea298927f63e755e57bba8c8aee68 | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-forecast/src/main/java/com/amazonaws/services/forecast/model/transform/IntegerParameterRangeJsonUnmarshaller.java | e067ab9cf70a009564d0b4709f5a8552494490a0 | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 3,542 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.forecast.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.forecast.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* IntegerParameterRange JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class IntegerParameterRangeJsonUnmarshaller implements Unmarshaller<IntegerParameterRange, JsonUnmarshallerContext> {
public IntegerParameterRange unmarshall(JsonUnmarshallerContext context) throws Exception {
IntegerParameterRange integerParameterRange = new IntegerParameterRange();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("Name", targetDepth)) {
context.nextToken();
integerParameterRange.setName(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("MaxValue", targetDepth)) {
context.nextToken();
integerParameterRange.setMaxValue(context.getUnmarshaller(Integer.class).unmarshall(context));
}
if (context.testExpression("MinValue", targetDepth)) {
context.nextToken();
integerParameterRange.setMinValue(context.getUnmarshaller(Integer.class).unmarshall(context));
}
if (context.testExpression("ScalingType", targetDepth)) {
context.nextToken();
integerParameterRange.setScalingType(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return integerParameterRange;
}
private static IntegerParameterRangeJsonUnmarshaller instance;
public static IntegerParameterRangeJsonUnmarshaller getInstance() {
if (instance == null)
instance = new IntegerParameterRangeJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
034ade426b42aa0789707d3e89bd5719698504d8 | 5b299e7dde6a5ff458d383af5b3fc26e4bff2137 | /src/com/zjicm/api/admin/CustomKeyAdminApi.java | 1c47cc56ae41808513ef7e397b7599b1af63d0ce | [] | no_license | fish-mirror/practice | e531fecd7768fbda895c9a51c44e0a101b070812 | e49ff084711885c5ed9af9b6968b96a916734f1b | refs/heads/master | 2021-01-20T18:36:29.459057 | 2017-05-24T05:31:26 | 2017-05-24T05:31:26 | 60,191,606 | 0 | 0 | null | 2017-04-15T06:17:03 | 2016-06-01T16:03:09 | Java | UTF-8 | Java | false | false | 5,417 | java | package com.zjicm.api.admin;
import com.zjicm.common.beans.UserSession;
import com.zjicm.common.lang.json.JsonDataHolder;
import com.zjicm.common.lang.json.MsgType;
import com.zjicm.common.lang.page.PageResult;
import com.zjicm.customkeyvalue.beans.CustomKeyParams;
import com.zjicm.customkeyvalue.dao.CustomKeyValueDao;
import com.zjicm.customkeyvalue.domain.CustomKeyValue;
import com.zjicm.web.admin.AdminBaseController;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Date;
/**
* 自定义键值对后台管理接口
* <p>
* Created by yujing on 2017/5/13.
*/
@Controller
@RequestMapping(value = "/admin/i/customkey")
public class CustomKeyAdminApi extends AdminBaseController {
@Autowired
private CustomKeyValueDao customKeyValueDao;
/**
* 列表
*
* @param page
* @param size
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public JsonDataHolder list(@RequestParam(value = "page_index", defaultValue = "1", required = false) int page,
@RequestParam(value = "items_per_page", defaultValue = "5", required = false) int size
) {
JsonDataHolder jsonDataHolder = new JsonDataHolder();
PageResult pr = customKeyValueDao.page(page, size);
if (pr == null || CollectionUtils.isEmpty(pr.getResult())) return jsonDataHolder.error101();
jsonDataHolder.putAttrToJsonDataHolder(pr);
jsonDataHolder.addListToItems(pr.getResult());
return jsonDataHolder;
}
/**
* 创建
*
* @param request
* @param params
* @param results
* @return
*/
@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseBody
public JsonDataHolder save(HttpServletRequest request,
@Valid @ModelAttribute CustomKeyParams params,
BindingResult results
) {
JsonDataHolder jsonDataHolder = new JsonDataHolder();
if (jsonDataHolder.checkError(results)) return jsonDataHolder;
UserSession session = getUserSession(request);
if (StringUtils.isBlank(params.getKey())) return jsonDataHolder.putToError(400, "key 不为空");
if (customKeyValueDao.ifExistByKey(params.getKey())) return jsonDataHolder.putToError(400, "key 已存在");
CustomKeyValue customKeyValue = new CustomKeyValue();
customKeyValue.setName(params.getName());
customKeyValue.setKeyStr(params.getKey());
customKeyValue.setValue(params.getValue());
customKeyValue.setRemarks(params.getRemarks());
customKeyValue.setModifier(session.getUserId());
customKeyValue.setCreator(session.getUserId());
customKeyValue.setCreateTime(new Date());
customKeyValueDao.save(customKeyValue);
return jsonDataHolder.simpleMsg(customKeyValue.getId(), MsgType.add);
}
/**
* 单字段修改
*
* @param request
* @param id
* @param params
* @param results
* @return
*/
@RequestMapping(value = "", method = RequestMethod.PATCH)
@ResponseBody
public JsonDataHolder edit(HttpServletRequest request,
@RequestParam(value = "id", defaultValue = "") int id,
@Valid @ModelAttribute CustomKeyParams params,
BindingResult results
) {
JsonDataHolder jsonDataHolder = new JsonDataHolder();
if (jsonDataHolder.checkError(results)) return jsonDataHolder;
UserSession session = getUserSession(request);
if (customKeyValueDao.ifExistByKey(params.getKey())) return jsonDataHolder.putToError(400, "key 已存在");
CustomKeyValue customKeyValue = customKeyValueDao.getById(id);
if (customKeyValue == null) return jsonDataHolder.error101();
if (StringUtils.isNotBlank(params.getKey())) customKeyValue.setKeyStr(params.getKey());
if (StringUtils.isNotBlank(params.getName())) customKeyValue.setName(params.getName());
if (StringUtils.isNotEmpty(params.getValue())) customKeyValue.setValue(params.getValue());
if (StringUtils.isNotEmpty(params.getRemarks())) customKeyValue.setRemarks(params.getRemarks());
customKeyValue.setModifier(session.getUserId());
customKeyValueDao.save(customKeyValue);
return jsonDataHolder.simpleMsg(customKeyValue.getId(), MsgType.update);
}
/**
* 删除
*
* @param id
* @return
*/
@RequestMapping(value = "", method = RequestMethod.DELETE)
@ResponseBody
public JsonDataHolder delete(@RequestParam(value = "id", defaultValue = "") int id
) {
JsonDataHolder jsonDataHolder = new JsonDataHolder();
CustomKeyValue customKeyValue = customKeyValueDao.getById(id);
if (customKeyValue == null) return jsonDataHolder.error404();
customKeyValueDao.delete(customKeyValue);
return jsonDataHolder.simpleMsg(customKeyValue.getId(), MsgType.delete);
}
}
| [
"[email protected]"
] | |
a4b2cdc9f3872f3fc4019da68d8be839dcd073e6 | c9edd21bdf3e643fe182c5b0f480d7deb218737c | /dy-agent-log4j/dy-agent-log4j-core/src/main/java/com/hust/foolwc/dy/agent/log4j/core/config/plugins/PluginVisitorStrategy.java | 7f11fabdc3ad95fc85c89a64819fc669a8ad88e4 | [] | no_license | foolwc/dy-agent | f302d2966cf3ab9fe8ce6872963828a66ca8a34e | d7eca9df2fd8c4c4595a7cdc770d6330e7ab241c | refs/heads/master | 2022-11-22T00:13:52.434723 | 2022-02-18T09:39:15 | 2022-02-18T09:39:15 | 201,186,332 | 10 | 4 | null | 2022-11-16T02:45:38 | 2019-08-08T05:44:02 | Java | UTF-8 | Java | false | false | 1,816 | 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 com.hust.foolwc.dy.agent.log4j.core.config.plugins;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.visitors.PluginVisitor;
import com.hust.foolwc.dy.agent.log4j.core.config.plugins.visitors.PluginVisitor;
/**
* Meta-annotation to denote the class name to use that implements
* {@link PluginVisitor} for the annotated annotation.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface PluginVisitorStrategy {
/**
* The class to use that implements {@link PluginVisitor}
* for the given annotation. The generic type in {@code PluginVisitor} should match the annotation this annotation
* is applied to.
*/
Class<? extends PluginVisitor<? extends Annotation>> value();
}
| [
"[email protected]"
] | |
e26faa5430a16e55252ab25ee92964d1f0af1f80 | 67d2eb3dff75aa5dcab5ddc732b6cea1e68f045a | /gulimall-pms/src/main/java/com/atguigu/gulimall/pms/entity/SpuInfoEntity.java | ac78dc9e8cd56d3aba05002b18bbad0a32aa0aef | [
"Apache-2.0"
] | permissive | tww0351/gulimall1215 | cc2d7c7e1f5efcb23be17cc105e52bc35cf4da24 | e45f90ae3a9f635637ae26b0634cd8100084f4ed | refs/heads/master | 2022-07-18T18:24:37.666663 | 2019-12-16T14:32:00 | 2019-12-16T14:32:00 | 228,149,843 | 0 | 1 | Apache-2.0 | 2022-07-06T20:43:54 | 2019-12-15T08:03:41 | JavaScript | UTF-8 | Java | false | false | 1,473 | java | package com.atguigu.gulimall.pms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* spu信息
*
* @author ljt
* @email [email protected]
* @date 2019-12-16 11:13:20
*/
@ApiModel
@Data
@TableName("pms_spu_info")
public class SpuInfoEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 商品id
*/
@TableId
@ApiModelProperty(name = "id",value = "商品id")
private Long id;
/**
* 商品名称
*/
@ApiModelProperty(name = "spuName",value = "商品名称")
private String spuName;
/**
* 商品描述
*/
@ApiModelProperty(name = "spuDescription",value = "商品描述")
private String spuDescription;
/**
* 所属分类id
*/
@ApiModelProperty(name = "catalogId",value = "所属分类id")
private Long catalogId;
/**
* 品牌id
*/
@ApiModelProperty(name = "brandId",value = "品牌id")
private Long brandId;
/**
* 上架状态[0 - 下架,1 - 上架]
*/
@ApiModelProperty(name = "publishStatus",value = "上架状态[0 - 下架,1 - 上架]")
private Integer publishStatus;
/**
*
*/
@ApiModelProperty(name = "createTime",value = "")
private Date createTime;
/**
*
*/
@ApiModelProperty(name = "uodateTime",value = "")
private Date uodateTime;
}
| [
"your email"
] | your email |
56c4888ed642460460255ffc8ad10e85512d8cc3 | bfa4af4d96cb65540bc68796ac677fb5d8d4749b | /Sager/ons-sager-write/src/main/java/br/org/ons/sager/write/config/mq/MQProperties.java | efe241f0d0b4e0e60ed896e3a2c180ff09783378 | [] | no_license | MbqIIB/Project-Java-Microservices | 4e538d3ac808a4da2bd4c6358da5efd22cce916b | 77ada2cda0d16d5d737630f22c1b522ea72c0a40 | refs/heads/master | 2021-01-22T15:16:11.100497 | 2017-02-09T21:05:01 | 2017-02-09T21:05:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,679 | java | package br.org.ons.sager.write.config.mq;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "mq")
public class MQProperties {
private String queueManager;
private String host;
private int port;
private String channel;
private String incomingQueue;
private String outgoingQueue;
private String username;
private String password;
public String getQueueManager() {
return queueManager;
}
public void setQueueManager(String queueManager) {
this.queueManager = queueManager;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getIncomingQueue() {
return incomingQueue;
}
public void setIncomingQueue(String incomingQueue) {
this.incomingQueue = incomingQueue;
}
public String getOutgoingQueue() {
return outgoingQueue;
}
public void setOutgoingQueue(String outgoingQueue) {
this.outgoingQueue = outgoingQueue;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
} | [
"[email protected]"
] | |
f6b636e6c6d3e86a51b7f87872c8b7c090c4acf1 | 80b940ee697895db5efe9e35e63cce3456848ee5 | /src/main/java/com/pudge/service/weixin/BaseSupportService.java | d25cc7c2ed313a339a64dae0456065e9426b5210 | [] | no_license | madull/pudge | c9b15e7bd4b5bcfc961f64a7e86883478f11e992 | 1211823761a33416550b7adcb3e4fd1db32f2a2a | refs/heads/master | 2016-08-06T20:12:10.627013 | 2015-04-29T03:00:45 | 2015-04-29T03:00:45 | 34,767,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,885 | java | /**
* @author [email protected], https://github.com/caijianqing/weixinmp4java/, 2014-2-19 下午2:15:32
*/
package com.pudge.service.weixin;
import java.util.Arrays;
import java.util.Date;
import com.pudge.controller.weixin.AbstractWeixinmpController;
import com.pudge.entity.weixin.base.AccessToken;
import com.pudge.entity.weixin.base.SignatureInfo;
import com.pudge.exception.weixin.WeixinException;
import com.pudge.util.CommonUtils;
/**
* 基础支持接口
* @author [email protected], https://github.com/caijianqing/weixinmp4java/, 2014-2-19 下午2:15:32
*/
public class BaseSupportService {
/** 微信公众平台API控制器实例 */
private final AbstractWeixinmpController controller;
public BaseSupportService(AbstractWeixinmpController controller) {
this.controller = controller;
}
/**
* 微信服务器接入事件(微信主动访问)
* @author [email protected], https://github.com/caijianqing/weixinmp4java/, 2014-2-25 下午3:58:39
* @param sign
* @param timestampLimit
* @return
* @throws WeixinException
*/
public String onAccess(SignatureInfo sign, int timestampLimit) throws WeixinException {
controller.logInfo("微信服务器请求接入:" + sign);
checkSignature(sign, timestampLimit);
return sign.echostr;
}
/**
* 获取AccessToken
* @author [email protected], https://github.com/caijianqing/weixinmp4java/, 2014-2-25 下午4:02:46
* @param appid
* @param secert
* @return
* @throws WeixinException
*/
public AccessToken getAccessToken(String appid, String secert) throws WeixinException {
controller.logInfo("请求AccessToken:appid=" + appid + ",secert=" + secert);
if (appid == null || secert == null) {
throw new WeixinException(CommonUtils.getNextId() + "_NoAppIDOrAppSecert", "调用高级服务需要提供appid和secert", null);
}
String url = controller.getProperty("accessToken_url", null, false);
url = url.replaceFirst("APPID", appid).replaceFirst("APPSECRET", secert);
try {
AccessToken token = controller.post(url, null, AccessToken.class, "getAccessToken");
return token;
} catch (WeixinException e) {
controller.logError(e.getMessage());
if (e.isNeedLog()) {
controller.saveToFile(e.getLogFilename(), e.getLogContent());
}
throw new WeixinException(CommonUtils.getNextId() + "_ErrorAccessToken", "获取AccessToken失败", e);
}
}
/**
* 检查签名
* @author [email protected], https://github.com/caijianqing/weixinmp4java/, 2014-2-25 下午4:02:59
* @param sign
* @param timestampLimit
* @throws WeixinException
*/
public void checkSignature(SignatureInfo sign, int timestampLimit) throws WeixinException {
// 预期签名
String expectSignature = null;
long expectTimestamp = new Date().getTime() / 1000;
String err = null;
// 验证数字签名
if (sign.signature != null && sign.timestamp != null && sign.nonce != null) {
// 0. 鉴定时间差
try {
long timestamp = Long.valueOf(sign.timestamp);
if (Math.abs(expectTimestamp - timestamp) <= timestampLimit) {
// 1. sort
String[] tmpArr = new String[] { sign.token, sign.timestamp, sign.nonce };
Arrays.sort(tmpArr);
// 2. implode
StringBuffer sb = new StringBuffer();
for (String s : tmpArr) {
sb.append(s);
}
// 3. sha1
expectSignature = CommonUtils.sha1(sb.toString());
// 4. equals
if (expectSignature != null && expectSignature.equals(sign.signature)) {
return; // 验证通过
}
}
} catch (NumberFormatException e) {
err = "时间格式不正确:" + e.getMessage();
}
}
// 验证出错,抛出异常
StringBuffer sb = new StringBuffer();
sb.append("signature=").append(sign.signature).append("\r\n");
sb.append("timestamp=").append(sign.timestamp).append("\r\n");
sb.append("nonce=").append(sign.nonce).append("\r\n");
sb.append("echostr=").append(sign.echostr).append("\r\n");
sb.append("expectSignature=").append(expectSignature).append("\r\n");
sb.append("expectTimestamp=").append(expectTimestamp).append("\r\n");
sb.append("err=").append(err).append("\r\n");
throw new WeixinException(CommonUtils.getNextId() + "_checkFail.dat", sb.toString(), null);
}
}
| [
"[email protected]"
] | |
bbdbf5eca8e140e03fd88534d6c1648c24d3fb75 | 8a1d5d6dd67fa57878e978fb926fd3b29211126f | /src/main/java/coffeepot/br/sped/fiscal/arquivo/blocoH/BlocoH.java | 5f3e90949b461dc40c7354a6347dc2214b86254e | [] | no_license | cesarbruno16/coffeepot-br-sped-fiscal | 710f8f3e529024acd5055dfa446927425c1b98b3 | 141a978fbe0719fe8f2b7ce76204981a02a64ffd | refs/heads/master | 2020-06-10T22:02:13.699654 | 2015-03-12T17:41:00 | 2015-03-12T17:41:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,743 | java | /*
* Copyright 2013 - Jeandeson O. Merelis
*/
package coffeepot.br.sped.fiscal.arquivo.blocoH;
/*
* #%L
* coffeepot-br-sped-fiscal
* %%
* Copyright (C) 2013 Jeandeson O. Merelis
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import coffeepot.bean.wr.annotation.Field;
import coffeepot.bean.wr.annotation.Record;
import java.util.List;
/**
* Bloco H - Inventário Físico.
*
* @author Jeandeson O. Merelis
*/
@Record(fields = {
@Field(name = "regH001"),
@Field(name = "regH005List"),
@Field(name = "regH990")
})
public class BlocoH {
private RegH001 regH001;
private List<RegH005> regH005List;
private RegH990 regH990;
public RegH001 getRegH001() {
return regH001;
}
public void setRegH001(RegH001 regH001) {
this.regH001 = regH001;
}
public List<RegH005> getRegH005List() {
return regH005List;
}
public void setRegH005List(List<RegH005> regH005List) {
this.regH005List = regH005List;
}
public RegH990 getRegH990() {
return regH990;
}
public void setRegH990(RegH990 regH990) {
this.regH990 = regH990;
}
}
| [
"[email protected]"
] | |
241c45f012e7abd12842d050dcbf35e996b3530d | 583681d1890728e21eac7708f0709f2b0bc44a58 | /app/src/main/java/com/beijing/tenfingers/activity/WebViewActivity.java | 873d1e1dbe5145d973e17364a5bfe79483a9e1d9 | [] | no_license | L-Torres/TenFingers | d7700173dd93fe2cbff629ba38d821eb7c4c06e1 | eb7069bb416b7bb687250ea467adb0d33e7b1144 | refs/heads/master | 2022-12-16T00:53:28.529143 | 2020-09-24T08:45:10 | 2020-09-24T08:45:10 | 297,903,235 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,865 | java | package com.beijing.tenfingers.activity;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.beijing.tenfingers.Base.BaseActivity;
import com.beijing.tenfingers.Base.MyConfig;
import com.beijing.tenfingers.R;
import com.beijing.tenfingers.eventbus.EventBusModel;
import com.beijing.tenfingers.eventbus.MyEventBusConfig;
import com.hemaapp.hm_FrameWork.HemaNetTask;
import com.hemaapp.hm_FrameWork.result.HemaBaseResult;
import de.greenrobot.event.EventBus;
/**
* 网页通用页面
* Created by Torres on 2016/12/1.
*/
public class WebViewActivity extends BaseActivity {
private String Baidu = "https://www.baidu.com/";
private WebView webview;
private ImageView imageQuitActivity;
private TextView txtTitle;
private TextView tvRight;
private String Title;
private String URL;
private ProgressBar pg1;
private LinearLayout ll_back;
public ValueCallback<Uri[]> mUploadMessageForAndroid5;
public ValueCallback<Uri> mUploadMessage;
public final static int FILE_CHOOSER_RESULT_CODE_FOR_ANDROID_5 = 2;
private final static int FILE_CHOOSER_RESULT_CODE = 1;// 表单的结果回调
private String type_id;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_webview_h);
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
if ((Build.VERSION.SDK_INT > 27)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
}
initWebView();
webview.setWebChromeClient(new WebChromeClient() {
//Android < 5.0
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
openFileChooserImpl(uploadMsg);
}
//Android => 5.0
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> uploadMsg, FileChooserParams fileChooserParams) {
onenFileChooseImpleForAndroid(uploadMsg);
return true;
}
@Override
public void onProgressChanged(WebView view, int newProgress) {
// TODO 自动生成的方法存根
if (newProgress == 100) {
pg1.setVisibility(View.GONE);//加载完网页进度条消失
} else {
pg1.setVisibility(View.VISIBLE);//开始加载网页时显示进度条
pg1.setProgress(newProgress);//设置进度值
}
}
});
if (isNull(URL))
webview.loadUrl(Baidu);
else
webview.loadUrl(URL);
}
@Override
protected void callBeforeDataBack(HemaNetTask netTask) {
// TODO Auto-generated method stub
}
@Override
protected void callAfterDataBack(HemaNetTask netTask) {
// TODO Auto-generated method stub
}
@Override
protected void callBackForServerSuccess(HemaNetTask netTask,
HemaBaseResult baseResult) {
// TODO Auto-generated method stub
}
@Override
protected void callBackForServerFailed(HemaNetTask netTask,
HemaBaseResult baseResult) {
// TODO Auto-generated method stub
}
@Override
protected void callBackForGetDataFailed(HemaNetTask netTask, int failedType) {
// TODO Auto-generated method stub
}
@Override
protected void findView() {
pg1 = findViewById(R.id.progressBar1);
webview = (WebView) findViewById(R.id.webview);
imageQuitActivity = (ImageView) findViewById(R.id.iv_back);
txtTitle = (TextView) findViewById(R.id.tv_title);
txtTitle.setText(Title);
tvRight = (TextView) findViewById(R.id.tv_right);
ll_back = findViewById(R.id.ll_back);
if (isCanGoNext()) {
tvRight.setVisibility(View.VISIBLE);
tvRight.setText("去购买");
} else {
tvRight.setVisibility(View.INVISIBLE);
}
}
@Override
protected void getExras() {
Title = mIntent.getStringExtra("Title");
URL = mIntent.getStringExtra("URL");
type_id = mIntent.getStringExtra("type_id");
}
private boolean isCanGoNext() {
if (isNull(type_id)) {
return false;
} else if ("绿茶".equals(Title) || "红茶".equals(Title)
|| "青茶".equals(Title) || "白茶".equals(Title)
|| "黄茶".equals(Title) || "黑茶".equals(Title)
|| "花茶".equals(Title) || "再加工茶".equals(Title)) {
return false;
}else{
return true;
}
}
@Override
protected void setListener() {
imageQuitActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish(R.anim.none, R.anim.right_out);
}
});
ll_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish(R.anim.none, R.anim.right_out);
}
});
}
@Override
protected void onDestroy() {
EventBus.getDefault().unregister(this);
super.onDestroy();
}
@Override
protected boolean onKeyBack() {
finish(R.anim.none, R.anim.right_out);
return super.onKeyBack();
}
@Override
public void onEventMainThread(EventBusModel event) {
if (!event.getState()) {
return;
}
switch (event.getType()) {
}
}
@Override
protected void onResume() {
webview.onResume();
super.onResume();
}
@Override
protected void onPause() {
webview.onPause();
super.onPause();
}
/**
* 初始化webview
*/
private void initWebView() {
// 支持javascript
webview.getSettings().setJavaScriptEnabled(true);
// webview.addJavascriptInterface(new JavaScriptinterface(this),
// "closeWeb");
// 设置可以支持缩放
webview.getSettings().setSupportZoom(true);
// 设置出现缩放工具
webview.getSettings().setBuiltInZoomControls(false);
// 扩大比例的缩放
webview.getSettings().setUseWideViewPort(true);
// 自适应屏幕
webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webview.getSettings().setLoadWithOverviewMode(true);
// 取消显示滚动条
webview.setVerticalScrollBarEnabled(false);
webview.setHorizontalScrollBarEnabled(false);
webview.getSettings().setAllowFileAccess(true);//设置在WebView内部是否允许访问文件
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
webview.loadUrl(url);
return true;
}
});
webview.getSettings().setSavePassword(true);
webview.getSettings().setSaveFormData(true);
webview.getSettings().setGeolocationEnabled(true);
webview.getSettings().setGeolocationDatabasePath("/data/data/org.itri.html5webview/databases/"); // enable Web Storage: localStorage, sessionStorage
webview.getSettings().setDomStorageEnabled(true);
webview.requestFocus();
}
/**
* android 5.0 以下开启图片选择(原生)
* 可以自己改图片选择框架。
*/
private void openFileChooserImpl(ValueCallback<Uri> uploadMsg) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "File Chooser"),
FILE_CHOOSER_RESULT_CODE);
}
/**
* android 5.0(含) 以上开启图片选择(原生)
* 可以自己改图片选择框架。
*/
private void onenFileChooseImpleForAndroid(ValueCallback<Uri[]> filePathCallback) {
mUploadMessageForAndroid5 = filePathCallback;
Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
contentSelectionIntent.setType("image/*");
Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
startActivityForResult(chooserIntent, FILE_CHOOSER_RESULT_CODE_FOR_ANDROID_5);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
Uri result = (intent == null || resultCode != Activity.RESULT_OK) ? null : intent.getData();
switch (requestCode) {
case FILE_CHOOSER_RESULT_CODE: //android 5.0以下 选择图片回调
if (null == mUploadMessage)
return;
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
break;
case FILE_CHOOSER_RESULT_CODE_FOR_ANDROID_5: //android 5.0(含) 以上 选择图片回调
if (null == mUploadMessageForAndroid5)
return;
if (result != null) {
mUploadMessageForAndroid5.onReceiveValue(new Uri[]{result});
} else {
mUploadMessageForAndroid5.onReceiveValue(new Uri[]{});
}
mUploadMessageForAndroid5 = null;
break;
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Check if the key event was the Back button and if there's history
if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
webview.goBack();
return true;
}
// If it wasn't the Back key or there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
return super.onKeyDown(keyCode, event);
}
}
| [
"[email protected]"
] | |
857ca1228534f041a1154af7f1a95928d6577933 | b635fce2e94ab3b32931e84f615dc8c3a55258d9 | /src/main/java/com/dreamer/domain/account/AdvanceRecord.java | 86615b88235219e58a75c46eafdfe6815483dbab | [] | no_license | BaiJunJie123/kam2 | 0b93e4ce3a447619eb9000fe278ccf59fc137c95 | b39b2900eb785340a907c5d545ce7731f22c4d24 | refs/heads/master | 2020-04-11T10:28:31.286751 | 2018-12-14T01:37:40 | 2018-12-14T01:37:40 | 161,715,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,887 | java | package com.dreamer.domain.account;
import com.dreamer.domain.user.Agent;
import javax.persistence.Entity;
import java.io.Serializable;
import java.util.Date;
/**
* Created by huangfei on 16/4/11.
*/
@Entity
public class AdvanceRecord implements Serializable{
private Integer id;
private Integer type;// 0代表扣除 1代表增加
private Double advance;//流动数量
private Double advance_now;//变更后的量
private String more;//详情
private Agent agent;//所属人
private Date updateTime;//产生时间
public AdvanceRecord(Integer type,Agent agent,Double advance,String more,Double advance_now,Date updateTime){
this.type=type;
this.agent=agent;
this.advance=advance;
this.more=more;
this.advance_now=advance_now;
this.updateTime=updateTime;
}
public AdvanceRecord(){}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Double getAdvance() {
return advance;
}
public void setAdvance(Double advance) {
this.advance = advance;
}
public Double getAdvance_now() {
return advance_now;
}
public void setAdvance_now(Double advance_now) {
this.advance_now = advance_now;
}
public String getMore() {
return more;
}
public void setMore(String more) {
this.more = more;
}
public Agent getAgent() {
return agent;
}
public void setAgent(Agent agent) {
this.agent = agent;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
| [
"[email protected]"
] | |
7bd3c4961a2881a0517874333b1d742901132c7d | ace62913e84ce27f94821e8b165b02a8347165eb | /SpringBootJwtAuthentication/src/main/java/menondemand/jwtauthentication/SpringBootJwtAuthenticationApplication.java | 9af1cc37b6a0b88bbe90d65c9c218f0b9c08a6c5 | [] | no_license | samisofttech/MentorOnDemandBackend | 3e2d1e25dc3dcb073c8ff40846fa89de306530a9 | df73a2e61cdab6b8bca6dd4f306407217abe59ab | refs/heads/master | 2020-06-03T12:31:39.487569 | 2019-06-25T12:29:24 | 2019-06-25T12:29:24 | 191,568,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | package menondemand.jwtauthentication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableDiscoveryClient
@EnableFeignClients
@EntityScan( basePackages = {"ibm.mentor","menondemand"} )
@SpringBootApplication(scanBasePackages = {"menondemand"})
public class SpringBootJwtAuthenticationApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootJwtAuthenticationApplication.class, args);
}
}
| [
"[email protected]"
] | |
37ed48044c86b465f1d705595ccdef556723da35 | ad9acef87b3b6b8e27f4c171436ecdea6cd8eebc | /MyAlarmClock/ClockActivity.java | 811a00987aabd29dc27c814be351648bad60689e | [] | no_license | wuchiaaa/Android | 1d64fb8e8989c5d609870d41870a21ab0cc7f4bd | 6e7bf9e4dcd1ba61ce82cac0bd45acd38b2e8cd6 | refs/heads/main | 2023-07-11T19:29:43.417356 | 2021-08-25T03:57:40 | 2021-08-25T03:57:40 | 315,983,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,050 | java | /*
* 暫時取消使用此activity
* 因:取消利用activity顯示鬧鐘響鈴的dialog,改用notification顯示鬧鐘響鈴
* */
package com.example.myalarmclock;
import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
public class ClockActivity extends AppCompatActivity {
private MediaPlayer mediaPlayer;
private Vibrator vibrator;
private String vibrator_value, clockName, ringUri;
private AlarmReceiver alarmReceiver;
private String TAG = "ClockActivity";
private int repeat;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_clock);
Log.d("ClockActivity", "鬧鐘註冊成功");
//[方法二]
alarmReceiver = new AlarmReceiver();
// mediaPlayer = MediaPlayer.create(this, R.raw.music);//鈴聲不可被使用者選取
Intent intent = this.getIntent();
//鬧鐘dialog內容:標籤名稱、震動、鈴聲
ringUri = intent.getStringExtra("ringUri");
clockName = intent.getStringExtra("clockName");
vibrator_value = intent.getStringExtra("vibrator_value");
//12.29 鬧鈴設定重複
String strRepeat = intent.getStringExtra("repeat");
repeat = Integer.parseInt(strRepeat);
//12.24 篩選clockId,使鬧鐘響鈴過後顯示停用
String str_clockId = intent.getStringExtra("clockId");
assert str_clockId != null; //斷言??
int clockId = Integer.parseInt(str_clockId);
if(repeat == 0) {
AlarmDB.updateEnableClose(ClockActivity.this, clockId);
System.out.println("ClockActivity======鬧鐘已響鈴完畢,設為停用");
}else if(repeat == 1){
ArrayList<Integer> listWeek= intent.getIntegerArrayListExtra("listWeek");//如果repeat==1,查找響鈴後需要設定的下一個鬧鐘時間週期為何?
System.out.println("ClockActivity======鬧鐘已響鈴完畢,因為重複鬧鈴故保持啟用,接收到的 listWeek="+listWeek);
System.out.println("ClockActivity======鬧鐘已響鈴完畢,因為重複鬧鈴故保持啟用");
intent = new Intent(ClockActivity.this, AlarmReceiver.class);//創建intent設置要啟動的組件
intent.putExtra("vibrator_value", vibrator_value);//傳值給broadcast
intent.putExtra("clockName", clockName);
intent.putExtra("ringUri", ringUri);
//12.24 篩選clockId,使鬧鐘響鈴過後>>>仍顯示啟用
intent.putExtra("clockId", String.valueOf(clockId));//intent只能傳一種型別,故轉成str
//12.29 鬧鐘設定重複
intent.putExtra("repeat", strRepeat);
//取得響鈴當下的時間
Calendar today = Calendar.getInstance();//calendar實例化,取得預設時間、預設時區
today.setTimeInMillis(System.currentTimeMillis());//系統目前時間
long triggerAtMillis = today.getTimeInMillis();//獲得設定時間;
@SuppressLint("SimpleDateFormat") DateFormat dateFo = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Log.d(TAG, "響鈴當下的時間(毫秒):"+ dateFo.format(today.getTime()));
//==============================
int nowDayOfWeek = today.get(Calendar.DAY_OF_WEEK);
int index = -1;
int selectDayOfWeek = nowDayOfWeek;
while (index < 0) {
selectDayOfWeek += 1;//查找星期是否有在list裡面,有則代表設定該星期響鈴
index = listWeek.indexOf(selectDayOfWeek); //nowDayOfWeek=4
if (selectDayOfWeek == 8) {
selectDayOfWeek = 0;
}
}
System.out.println("ClockActivity, 尋找下一個需啟用的鬧鐘週期:" + selectDayOfWeek + ",index:" + index);
int diffDayOfWeek = selectDayOfWeek - nowDayOfWeek;
if (diffDayOfWeek <= 0) diffDayOfWeek += 7;//恆正數
triggerAtMillis = triggerAtMillis + diffDayOfWeek * 24 * 60 * 60 * 1000;//註冊下周同一時間的鬧鐘
today.setTimeInMillis(triggerAtMillis);
Log.d(TAG, "下次響鈴當下的時間:" + dateFo.format(today.getTime()));
//==============================
//註冊下一個broadcast
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);//獲取AlarmManager
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, clockId, intent, PendingIntent.FLAG_UPDATE_CURRENT);//設定pendingIntent接受自訂鬧鈴廣播 //FLAG_UPDATE_CURRENT: 不存在時就建立,建立好了以後就一直用它,每次使用時都會更新pi的資料
if (Build.VERSION.SDK_INT < 19) {
alarmManager.set(AlarmManager.RTC_WAKEUP, triggerAtMillis, pendingIntent);
} else {
alarmManager.setExact(AlarmManager.RTC_WAKEUP, triggerAtMillis, pendingIntent);//設置單次鬧鐘的類型,啟動時間,PendingIntent對象
}
}
//震動效果
if(vibrator_value.equals("ON")){
vibrator = (Vibrator) getSystemService(Service.VIBRATOR_SERVICE);
vibrator.vibrate(new long[]{100, 1000, 1000, 1000}, 0);//停0.1秒 震1秒 停1秒 震1秒。第二組參數:帶入-1是不重複
}
//播放選取的鈴聲,靜音為null
mediaPlayer = new MediaPlayer();
Uri soundUri = Uri.parse(ringUri);
if(soundUri != null) {
try{
mediaPlayer = MediaPlayer.create(this, soundUri);
mediaPlayer.setLooping(true);//循環播放鈴聲
mediaPlayer.start();
}catch(NullPointerException n){
Log.e(TAG, "RuntimeException");
}
}
//創建一個鬧鐘提醒的對話框,點擊確定關閉鈴聲與頁面
new AlertDialog.Builder(ClockActivity.this).setTitle("鬧鐘").setMessage(clockName)
.setPositiveButton("關閉鬧鈴", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {//按鈕點選的監聽程式
if(vibrator_value.equals("ON")) vibrator.cancel();
try{
mediaPlayer.stop();
}catch(NullPointerException n){
Log.e(TAG, "RuntimeException");
}
ClockActivity.this.finish();
}
}).show();
//------------notification寫的地方>不適用----------------------------------------------------
/*
mediaPlayer = MediaPlayer.create(this, R.raw.music);//鈴聲不可被使用者選取
mediaPlayer.start();
clockName = "小豬起床囉~";
//由於每一個Notification都必須對使用者的點擊做出回應,為了達到此要求,所以需要建立PendingIntent
//建立關閉通知的動作 Create an Intent for the BroadcastReceiver
Intent closeIntent = new Intent(this, NotificationReceiver.class);
// closeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
// PendingIntent dismissIntent = PendingIntent.getBroadcast(this, 0, closeIntent, PendingIntent.FLAG_CANCEL_CURRENT);
PendingIntent dismissIntent = NotificationActivity.getDismissIntent(1, this);
//建立Dismiss
// NotificationCompat.Action dismissAction = new NotificationCompat.Action.Builder(R.drawable.ic_alarm_black, "關閉鬧鐘", dismissIntent).build();
//建立Notification.Builder
//uri尚未建立!!!
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, "clockId");
mBuilder.setSmallIcon(R.drawable.ic_alarm_black); //設置小圖標
mBuilder.setContentTitle("鬧鐘"); //標題
mBuilder.setContentText(clockName); //內容
mBuilder.setPriority(NotificationCompat.PRIORITY_HIGH);
// mBuilder.setContentIntent(dismissIntent);//每個通知都應該對點按操作做出回應,通常是在應用中打開對應於該通知的Activity(PendingIntent的第三個參數改成new Intent(),即不開啟任何Activiy)
// mBuilder.setAutoCancel(true);//用戶點按通知後,自動移除通知
mBuilder.addAction(R.drawable.ic_alarm_black, "關閉鬧鐘", dismissIntent);//添加按鈕操作>關閉通知
// mBuilder.addAction(dismissAction);//添加按鈕操作>關閉通知
// mBuilder.setCategory(NotificationCompat.CATEGORY_ALARM);
NotificationManager mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//建立通知頻道
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { //NotificationChannel 只存在於8.0以上的系統,為了顯示通知,必須要註冊通道
NotificationChannel mChannel = new NotificationChannel("clockId", "Channel Clock", NotificationManager.IMPORTANCE_HIGH);
if(mManager != null) {
mManager.createNotificationChannel(mChannel);
mBuilder.setChannelId("clockId");
// mChannel.enableLights(true);//是否在桌面ICON右上角展示小紅點
// mChannel.enableVibration(true);
// AudioAttributes audioAttributes = new AudioAttributes.Builder()
// .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
// .setUsage(AudioAttributes.USAGE_ALARM)
// .build();
// Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);//預設的鈴聲
System.out.println("AlarmReceiver, mChannel被呼叫了...");
}
}
if(mManager != null) {
mManager.notify(1, mBuilder.build());
}
*/
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onDestroy() { //比如停止訪問數據庫
super.onDestroy();
}
}
| [
"[email protected]"
] | |
3bf182d3a83208abbdb205dcd3a01c2349c68e60 | 8101886dd821ae4addba7a8604dff6713b37cedc | /src/main/java/com/wangting/cms/entity/Special.java | ca355afeb9855c831bbf0b7b8c6d709e7ea6df26 | [] | no_license | wangtinglonglive/1706E-cms | 9ae913f84f7c969a4ca9fdf53361e895ee4e59b7 | 0f54e8ca7d672d75c2eb47a91ab0fb2f81eb8c0a | refs/heads/master | 2022-12-22T06:36:04.155413 | 2019-10-29T05:32:42 | 2019-10-29T05:32:42 | 216,505,495 | 0 | 0 | null | 2022-12-16T04:53:31 | 2019-10-21T07:35:10 | JavaScript | UTF-8 | Java | false | false | 1,459 | java | package com.wangting.cms.entity;
import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 专题
* @author wangting
*
*/
public class Special {
private Integer id;
private String title;
private String digest;//abstract;
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date created;
private Integer articleNum;
public Integer getArticleNum() {
return articleNum;
}
public void setArticleNum(Integer articleNum) {
this.articleNum = articleNum;
}
List<Article> artilceList;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDigest() {
return digest;
}
public void setDigest(String digest) {
this.digest = digest;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public List<Article> getArtilceList() {
return artilceList;
}
public void setArtilceList(List<Article> artilceList) {
this.artilceList = artilceList;
}
@Override
public String toString() {
return "Special [id=" + id + ", title=" + title + ", digest=" + digest + ", created=" + created
+ ", articleNum=" + articleNum + ", artilceList=" + artilceList + "]";
}
}
| [
"[email protected]"
] | |
90603c157e9b94f2b5d29bf82e51877e43b5015a | 9dd413f36e0d6406d662a9d181bf28808e0f377a | /app/src/main/java/com/ljq/sushi/HttpUtil/NativeHttpUtil.java | 8417184bda990770188e402cd99662feda9f5650 | [] | no_license | jun-quan-Lai/SuShi | 94959fc11957875fbc6ec07a780a14c7f151f5f2 | c926e6492b573d34ae3f174b3ed49d0b187fc68e | refs/heads/master | 2021-01-21T04:47:22.820093 | 2016-07-12T10:34:47 | 2016-07-12T10:34:47 | 45,769,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,300 | java | package com.ljq.sushi.HttpUtil;
import android.util.Log;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
public class NativeHttpUtil {
//设置URLConnection的连接超时时间
private final static int CONNET_TIMEOUT = 5 * 1000;
//设置URLConnection的读取超时时间
private final static int READ_TIMEOUT = 5 * 1000;
//设置请求参数的字符编码格式
private final static String QUERY_ENCODING = "UTF-8";
//设置返回请求结果的字符编码格式
private final static String ENCODING = "GBK";
/**
*
* @param url
* 请求链接
* @return
* HTTP GET请求结果
*/
public static String get(String url) {
return get(url, null);
}
/**
*
* @param url
* 请求链接
* @param params
* HTTP GET请求的QueryString封装map集合
* @return
* HTTP GET请求结果
*/
public static String get(String url, Map<String, String> params) {
InputStream is = null;
try {
StringBuffer queryString = null;
if (params != null && params.size() > 0) {
queryString = new StringBuffer("?");
queryString = joinParam(params, queryString);
}
if (queryString != null) {
url = url + URLEncoder.encode(queryString.toString(), QUERY_ENCODING);
}
URL u = new URL(url);
HttpURLConnection conn = (HttpURLConnection) u.openConnection();
conn.setUseCaches(false);
conn.setConnectTimeout(CONNET_TIMEOUT);
conn.setReadTimeout(READ_TIMEOUT);
conn.setRequestMethod("GET");
if (conn.getResponseCode() == 200) {
is = conn.getInputStream();
return StreamUtil.readStreamToString(is, ENCODING);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
/**
*
* @param url
* 请求链接
* @param params
* HTTP POST请求body的封装map集合
* @return
*
*/
public static String post(String url, Map<String, String> params) {
if (params == null || params.size() == 0) {
Log.d("参数为空了??????","参数空!!!!!!!!!!!!!");
return null;
}
OutputStream os = null;
InputStream is = null;
StringBuffer body = new StringBuffer();
body = joinParam(params, body);
byte[] data = body.toString().getBytes();
try {
URL u = new URL(url);
HttpURLConnection conn = (HttpURLConnection) u.openConnection();
conn.setConnectTimeout(CONNET_TIMEOUT);
conn.setReadTimeout(READ_TIMEOUT);
conn.setRequestMethod("POST");
// 请求头, 必须设置
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(data.length));
// post请求必须允许输出
conn.setDoOutput(true);
// 向服务器写出数据
os = conn.getOutputStream();
os.write(data);
if (conn.getResponseCode() == 200) {
is = conn.getInputStream();
return StreamUtil.readStreamToString(is, ENCODING);
}
else{
Log.d("服务器出问题??????","服务器错误!!!!!!!!");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
/**
*
* @param url
* 请求链接
* @param params
* HTTP POST请求文本参数map集合
* @param files
* HTTP POST请求文件参数map集合
* @return
* HTTP POST请求结果
* @throws IOException
*/
public static String post(String url, Map<String, String> params, Map<String, File> files) throws IOException {
String BOUNDARY = UUID.randomUUID().toString();
String PREFIX = "--", LINEND = "\r\n";
String MULTIPART_FROM_DATA = "multipart/form-data";
URL uri = new URL(url);
HttpURLConnection conn = (HttpURLConnection) uri.openConnection();
// 缓存的最长时间
conn.setReadTimeout(READ_TIMEOUT);
// 允许输入
conn.setDoInput(true);
// 允许输出
conn.setDoOutput(true);
// 不允许使用缓存
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("connection", "keep-alive");
conn.setRequestProperty("Charsert", "UTF-8");
conn.setRequestProperty("Content-Type", MULTIPART_FROM_DATA + ";boundary=" + BOUNDARY);
// 首先组拼文本类型的参数
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : params.entrySet()) {
sb.append(PREFIX);
sb.append(BOUNDARY);
sb.append(LINEND);
sb.append("Content-Disposition: form-data; name=\"" + entry.getKey() + "\"" + LINEND);
sb.append("Content-Type: text/plain; charset=" + ENCODING + LINEND);
sb.append("Content-Transfer-Encoding: 8bit" + LINEND);
sb.append(LINEND);
sb.append(entry.getValue());
sb.append(LINEND);
}
DataOutputStream outStream = new DataOutputStream(conn.getOutputStream());
outStream.write(sb.toString().getBytes());
// 发送文件数据
if (files != null)
for (Map.Entry<String, File> file : files.entrySet()) {
StringBuilder sb1 = new StringBuilder();
sb1.append(PREFIX);
sb1.append(BOUNDARY);
sb1.append(LINEND);
sb1.append("Content-Disposition: form-data; name=\"uploadfile\"; filename=\""
+ file.getValue().getName() + "\"" + LINEND);
sb1.append("Content-Type: application/octet-stream; charset=" + ENCODING + LINEND);
sb1.append(LINEND);
outStream.write(sb1.toString().getBytes());
InputStream is = new FileInputStream(file.getValue());
byte[] buffer = new byte[1024];
int len = 0;
while ((len = is.read(buffer)) != -1) {
outStream.write(buffer, 0, len);
}
is.close();
outStream.write(LINEND.getBytes());
}
// 请求结束标志
byte[] end_data = (PREFIX + BOUNDARY + PREFIX + LINEND).getBytes();
outStream.write(end_data);
outStream.flush();
StringBuilder sb2 = new StringBuilder();
if (conn.getResponseCode() == 200) {
InputStream in = conn.getInputStream();
int ch;
while ((ch = in.read()) != -1) {
sb2.append((char) ch);
}
}
outStream.close();
conn.disconnect();
return sb2.toString();
}
/**
*
* @param params
* @param queryString
* @return
* 返回拼接后的StringBuffer
*/
private static StringBuffer joinParam(Map<String, String> params, StringBuffer queryString) {
Iterator<Entry<String, String>> iterator = params.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, String> param = iterator.next();
String key = param.getKey();
String value = param.getValue();
queryString.append(key).append('=').append(value);
if (iterator.hasNext()) {
queryString.append('&');
}
}
return queryString;
}
} | [
"[email protected]"
] | |
91c2bf25df8883b7397417404a60fd50a880dab3 | fcd682557509bf32ae29fd34106886af80c0dd8b | /Assignment 2/src/ir/assignments/three/TLDList.java | e06046bcde4368473ad697ad4545f24901a80a8f | [] | no_license | LindaFe/inf141Crawler | b821b3ca4076bf4fd2957d2637c94dc4247f6a03 | ab7a88b0e28675e3fa9e7518b31ef1e8d95b65b0 | refs/heads/master | 2020-12-24T14:35:32.874802 | 2016-02-05T05:13:20 | 2016-02-05T05:13:20 | 50,479,827 | 0 | 0 | null | 2016-01-27T03:47:03 | 2016-01-27T03:47:03 | null | UTF-8 | Java | false | false | 3,470 | java | package src.ir.assignments.three;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
/**
* This class is a singleton which obtains a list of TLDs (from online or a local file) in order to compare against
* those TLDs
*/
public class TLDList {
private static final String TLD_NAMES_ONLINE_URL = "https://publicsuffix.org/list/effective_tld_names.dat";
private static final String TLD_NAMES_TXT_FILENAME = "tld-names.txt";
//private static final Logger logger = LoggerFactory.getLogger(TLDList.class);
private static boolean onlineUpdate = false;
private final Set<String> tldSet = new HashSet<>(10000);
private static final TLDList instance = new TLDList(); // Singleton
private TLDList() {
if (onlineUpdate) {
URL url;
try {
url = new URL(TLD_NAMES_ONLINE_URL);
} catch (MalformedURLException e) {
// This cannot happen... No need to treat it
System.out.println("Invalid URL: {}" + TLD_NAMES_ONLINE_URL);
throw new RuntimeException(e);
}
try (InputStream stream = url.openStream()) {
//logger.debug("Fetching the most updated TLD list online");
int n = readStream(stream);
//logger.info("Obtained {} TLD from URL {}", n, TLD_NAMES_ONLINE_URL);
return;
} catch (Exception e) {
System.out.println("Couldn't fetch the online list of TLDs from: {}" + TLD_NAMES_ONLINE_URL + e);
}
}
File f = new File(TLD_NAMES_TXT_FILENAME);
if (f.exists()) {
//logger.debug("Fetching the list from a local file {}", TLD_NAMES_TXT_FILENAME);
try (InputStream tldFile = new FileInputStream(f)) {
int n = readStream(tldFile);
//logger.info("Obtained {} TLD from local file {}", n, TLD_NAMES_TXT_FILENAME);
return;
} catch (IOException e) {
//logger.error("Couldn't read the TLD list from local file", e);
}
}
try (InputStream tldFile = getClass().getClassLoader().getResourceAsStream(TLD_NAMES_TXT_FILENAME)) {
int n = readStream(tldFile);
//logger.info("Obtained {} TLD from packaged file {}", n, TLD_NAMES_TXT_FILENAME);
} catch (IOException e) {
//logger.error("Couldn't read the TLD list from file");
throw new RuntimeException(e);
}
}
private int readStream(InputStream stream) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
if (line.isEmpty() || line.startsWith("//")) {
continue;
}
tldSet.add(line);
}
} catch (IOException e) {
//logger.warn("Error while reading TLD-list: {}", e.getMessage());
}
return tldSet.size();
}
public static TLDList getInstance() {
return instance;
}
/**
* If {@code online} is set to true, the list of TLD files will be downloaded and refreshed, otherwise the one
* cached in src/main/resources/tld-names.txt will be used.
*/
public static void setUseOnline(boolean online) {
onlineUpdate = online;
}
public boolean contains(String str) {
return tldSet.contains(str);
}
}
| [
"[email protected]"
] | |
abc03a32c804b9f8ba8ddbc1b70802f550e1a613 | 73bb5bbbdae67cf079c1f826fb2716559edd9388 | /src/main/java/com/br/itau/demo/DemoApplication.java | 2583a1b040c1afc9d2ac73c160bb910a63b16b9d | [] | no_license | zefor2/testeHashSet | 023c175d05deae01e4f1decc43f998a814fbf56a | 4ed9813e4f687ac380c1a0f47257ed358673c96f | refs/heads/master | 2020-04-29T01:57:46.141649 | 2019-03-21T02:52:11 | 2019-03-21T02:52:11 | 175,747,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.br.itau.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan("com.br.itau.demo")
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"[email protected]"
] | |
224c9397ac684f80d58189ff50cdabad8583a974 | 37bf2e18143ac3f2f21d3045fc6ffef9befbee45 | /app/src/test/java/com/eijun/slidingtabs/ExampleUnitTest.java | 65c597d864a20391f047587cec26171c0965e250 | [] | no_license | narumiya1/SlidingTabLayout | f091c17aa84bb44ad8766eea45d1f92bbf7c2135 | fe0c55a11f04083738a24d4ced3605db21914a7f | refs/heads/master | 2022-11-19T06:45:25.799031 | 2020-07-21T16:48:21 | 2020-07-21T16:48:21 | 279,274,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.eijun.slidingtabs;
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);
}
} | [
"Manunited22"
] | Manunited22 |
84ed9c5e9c250be986c745239ae23691feeec5d6 | d9a3161c141d3d41c4b8923f2952896d6fea82e0 | /kodilla-stream/src/main/java/com/kodilla/stream/lambda/MathExpression.java | 3e0f92d2ffc508e49850108d70966f897ae52e18 | [] | no_license | RFLewandowski/radek-lewandowski-kodilla-java | 1094722a24f628ec7574317293252bd8338622c9 | c528ba7ebb0c2de9fab8c28643da1a9ac4b2a6f9 | refs/heads/master | 2021-01-23T08:24:26.744067 | 2018-02-11T22:33:39 | 2018-02-11T22:33:39 | 102,518,515 | 1 | 0 | null | 2017-11-12T20:28:35 | 2017-09-05T18:54:27 | Java | UTF-8 | Java | false | false | 123 | java | package com.kodilla.stream.lambda;
public interface MathExpression {
double calculateExpression(double a, double b);
} | [
"[email protected]"
] | |
9fb8da2cac1d9e27c54fb357dc5c8190e52db0ad | 858efa68f987a171ced00c8ebde2a2eb0dbf5b76 | /Ejercicios Java/Arreglos/Ejercicios.java | 0a61a6e638650bdafd77cbf9e41d05aabeaf8e6f | [] | no_license | arcanite24/projecto-poo-juego | a8573c5c7cc6909a6aeba6ca494f3258c697547c | 2dd9ed05f2f68c8e6e546cf5e16e94ac0c61d628 | refs/heads/master | 2020-05-17T13:46:18.595904 | 2015-06-15T04:35:39 | 2015-06-15T04:35:39 | 35,833,107 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,136 | java | import javax.swing.*;
public class Ejercicios {
public void promedio() {
int limite = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingresa cuantos numeros quieres promediar:"));
float n[] = new float[limite];
float r = 0;
for (int i=0; i<limite; i++) {
n[i] = Float.parseFloat(JOptionPane.showInputDialog(null, "Ingresa numero " + (i+1)));
r += n[i];
}
JOptionPane.showMessageDialog(null, "El proemdio de " + limite + " numeros es: " + (r/limite));
}
public void promedioPar() {
int limite = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingresa cuantos numeros quieres promediar:"));
float n[] = new float[limite];
float r = 0;
for (int i=0; i<limite; i++) {
n[i] = Float.parseFloat(JOptionPane.showInputDialog(null, "Ingresa numero " + (i+1)));
if(n[i] % 2 == 0) r += n[i];
}
JOptionPane.showMessageDialog(null, "El proemdio de " + limite + " numeros pares es: " + (r/limite));
}
public void calificaciones() {
int n[] = new int[10];
float r = 0;
String rstr = "";
for (int i=0; i<10; i++) {
n[i] = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingresa calificacion " + (i+1)));
r += n[i];
rstr += n[i] + ",";
}
JOptionPane.showMessageDialog(null, "Calificaciones: " + rstr);
JOptionPane.showMessageDialog(null, "Promedio: " + (r / 10));
int imayor = n[0];
int imenor = n[0];
for (int j=0; j<10; j++) {
if (n[j] > imayor) {
imayor = n[j];
}
}
for (int k=0; k<10; k++) {
if (n[k] < imenor) {
imenor = n[k];
}
}
JOptionPane.showMessageDialog(null, "El numero menor es: " + imenor + ", el numero mayor es: " + imayor);
String mayorPromedio = "";
for (int l=0; l<10; l++) {
if (n[l] > (r/10)) {
mayorPromedio += n[l] + ",";
}
}
JOptionPane.showMessageDialog(null, "Los numeros mayores al promedio son: " + mayorPromedio);
int reprobados = 0;
int aprobados = 0;
for (int l=0; l<10; l++) {
if (n[l] > 6) {
aprobados++;
} else {
reprobados++;
}
}
JOptionPane.showMessageDialog(null, "Aprobados: " + aprobados + ", Reprobados: " + reprobados);
}
} | [
"[email protected]"
] | |
0d1ad51315b192ce364127533c73d0d2c9bbe54a | eaade9203dc56fed4f57f22dbefeb09590d1c22d | /Main2.java | 9f1b5af0c33b7e11c9a8d5324d9565d3062dce39 | [] | no_license | Aso2001222/2021java | 967115573fd82d208ff4e7ff6f377dd8aeca355a | 3d5f98ebc10bacef84daffa38703f6547d588593 | refs/heads/main | 2023-06-27T13:34:53.905148 | 2021-07-30T02:57:13 | 2021-07-30T02:57:13 | 390,909,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,138 | java | import java.util.Scanner;
import java.util.Random;
public class Main{
public static void main(String[] args){
//入力値の取得
Scanner scanner = new Scanner(System.in);
//必要な変数を作成
int count = 0;
int bre = 1;
//タイトル
System.out.println("*******************");
System.out.println(" 戦艦ゲーム ");
System.out.println("*******************");
//5:5の配列を作成
int[][] a = new int[7][7];
//ターン数
for(int p = 1; p < 100; p++){
if(bre == 4){
Ship ship = new Ship();
ship.lastdisp();
break;
}
//配列内を0で初期化
for(int i=1; i<6; i++){
for(int j = 1; j<6; j++){
a[i][j] = 0;
}
}
//ランダムで戦艦の配置 戦艦は1
if(bre == 1){
for(int x =0; x<3; x++){
Random rnd = new Random();
int b = rnd.nextInt(5) + 1;
int c = rnd.nextInt(5) + 1;
a[b][c] = 1;
}
}else if(bre == 2){
for(int x =0; x<2; x++){
Random rnd = new Random();
int b = rnd.nextInt(5) + 1;
int c = rnd.nextInt(5) + 1;
a[b][c] = 1;
}
}else if(bre == 3){
for(int x =0; x<1; x++){
Random rnd = new Random();
int b = rnd.nextInt(5) + 1;
int c = rnd.nextInt(5) + 1;
a[b][c] = 1;
}
}
//位置を把握するため
for(int i=1; i<6; i++){
for(int j = 1; j<6; j++){
if(j !=5){
System.out.print(a[i][j]);
}else{
System.out.print(a[i][j]);
System.out.println("");
}
}
}
for(int g = 0; g <= 100 ; g++ ){
//ターン数の表示
System.out.println("---ターン" + p + "---");
//X座標とY座標を指定
System.out.println("X座標を1~5で選んでください")
String d = scanner.next();
System.out.println("Y座標を1~5で選んでください")
String e = scanner.next();
//String型をint型に変換
int num1 = Integer.parseInt(d);
int num2 = Integer.parseInt(e);
//System.out.println("ここは" + a[num1][num2]);
//波高しの記述
if(1 == a[num1][num2] && count == 2){
System.out.println("戦艦を" + bre +"艦撃退した。残り" + (3 - bre) + "艦いるぞ");
count = 0;
bre++;
break;
}else if(1 == a[num1][num2]){
Ship ship = new Ship();
ship.seconddisp();
count++;
break;
}else if(1 == a[num1][num2+1]){
System.out.println(a[num1][num2 + 1]);
System.out.println("波高し 戦艦はこの列の前にいます");
p++;
}else if(1 == a[num1][num2 - 1]){
System.out.println(a[num1][num2 - 1]);
System.out.println("波高し 戦艦はこの列の後ろにいます");
p++;
}else if(1 == a[num1 + 1][num2]){
System.out.println(a[num1 + 1][num2]);
System.out.println("波高し 戦艦はこの行の前にいます");
p++;
}else{
System.out.println("敵が周りにいない");
p++;
}
}
}
}
} | [
"[email protected]"
] | |
af0948b1c1444fb47565618135f6980f3d0be4cd | dafd80abd3ca5f77a5760a033fa35d7f053aebe6 | /Summarizer/src/TextSumm.java | 323d6e9c605b7d31159114ef2a38b3e260288a44 | [] | no_license | abtpst/Text-Summarization | d1eb6b2b45ddb0923bf3bafb8ccc42dd0076eafd | c7ca95ad373f8c95c3144f733a9bce0e4712527f | refs/heads/master | 2021-01-10T20:17:30.084759 | 2014-01-02T19:41:07 | 2014-01-02T19:41:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,628 | java | import java.io.File;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import static gate.Utils.inDocumentOrder;
import gate.*;
import static gate.util.persistence.PersistenceManager.loadObjectFromFile;
public class TextSumm {
public static String HOME_PATH = "";
public TextSumm() throws Exception{
Gate.init();
File gateHome = Gate.getGateHome();
HOME_PATH = gateHome.getCanonicalPath() + "/";
//System.out.println("Home path: "+ HOME_PATH);
if (Gate.getGateHome() == null)
Gate.setGateHome(gateHome);
File pluginsHome = new File(gateHome, "plugins");
//Register all the plugins that your program will need
Gate.getCreoleRegister().registerDirectories(
new File(pluginsHome, "ANNIE")
.toURI().toURL());
}
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
new TextSumm();
//Point it to where your gapp file resides on your hard drive
gate.CorpusController c = ((gate.CorpusController)loadObjectFromFile(new java.io.File("C:/Program Files (x86)/GATE_Developer_7.1/A/2/tsum.gapp")));
Corpus corpus = (Corpus) Factory.createResource("gate.corpora.CorpusImpl");
//Point it to whichever folder contains your documents
URL dir = new File("C:/Program Files (x86)/GATE_Developer_7.1/A/2/Text").toURI().toURL();
corpus.populate(dir, null, "UTF-8", false); //set the encoding to whatever is the encoding of your files
c.setCorpus(corpus);
c.execute();
gate.Document tempDoc = null;
int paracount=0; // We shall keep a count of how many NVN annotations we receive. The we shall use this value to extract the top nouns
HashMap<String, Integer> nouncounter = new HashMap<String, Integer>();
HashMap<String, Integer> firstnouns = new HashMap<String, Integer>();
HashMap<String, Integer> noundf = new HashMap<String, Integer>();
String fv = null;
//This is how you can access the annotations created by your gate application
for (int i = 0; i < corpus.size(); i++)
{
tempDoc = (gate.Document)corpus.get(i);
for(gate.Annotation a: tempDoc.getAnnotations().get("Sent")) // Get all the email ids of the thread, annotated as EmailID
{
paracount++;
HashMap<String, Integer> nounkey = new HashMap<String, Integer>();
try
{
nounkey=(HashMap<String, Integer>) a.getFeatures().get("Nouns");// Get all the nouns associated with this NVN annotation
for (Map.Entry <String, Integer> entry : nounkey.entrySet())// Iterate over all the nouns in this NVN annotation
{
String nk = entry.getKey();
int tf = entry.getValue();
if(!nk.isEmpty())// If the noun obtained is not a blank string and it is not an email ID then proceed
{
if(nouncounter.containsKey(nk))// If this noun already appears in our nouncounter HashMap, then increase its count by 1
nouncounter.put(nk, nouncounter.get(nk)+tf);
else// If this noun does not appear in our nouncounter HashMap, meaning this is the first time we see it, set its count to 1
nouncounter.put(nk, tf);
if(noundf.containsKey(nk))// If this noun already appears in our nouncounter HashMap, then increase its count by 1
noundf.put(nk, noundf.get(nk)+1);
else// If this noun does not appear in our nouncounter HashMap, meaning this is the first time we see it, set its count to 1
noundf.put(nk, 1);
}
}
}
catch(NullPointerException e)
{}
}
for(gate.Annotation a: tempDoc.getAnnotations().get("First")) // Get all the email ids of the thread, annotated as EmailID
{
HashMap<String, Integer> nounkey = new HashMap<String, Integer>();
try
{
fv = a.getFeatures().get("Value").toString();
nounkey=(HashMap<String, Integer>) a.getFeatures().get("Nouns");// Get all the nouns associated with this NVN annotation
for ( Map.Entry<String, Integer> entry : nounkey.entrySet())
{
String nk = entry.getKey();
if(noundf.containsKey(nk))// If this noun already appears in our nouncounter HashMap, then increase its count by 1
noundf.put(nk, noundf.get(nk)+1);
else// If this noun does not appear in our nouncounter HashMap, meaning this is the first time we see it, set its count to 1
noundf.put(nk, 1);
}
}
catch(NullPointerException e)
{}
}
}
String nou;
for ( Map.Entry<String, Integer> entry : firstnouns.entrySet())
{
nou = entry.getKey();
if(nouncounter.containsKey(nou))
{
nouncounter.put(nou, nouncounter.get(nou)+firstnouns.get(nou));
}
}
ArrayList<String> nn = new ArrayList<String>();// This list represents the high scoring nouns that we will select
nn = TextSumm.Scores(nouncounter, firstnouns, noundf, paracount+1);
ArrayList<String> nvn = new ArrayList<String>();
List<Annotation> lis = null; // This list would be used to extract all the NVN annotations in the sequence that they appear in the original email
lis = inDocumentOrder(tempDoc.getAnnotations().get("First"));
for(gate.Annotation a: lis) //Now iterate over the NVN annotations again, this time collecting the string values of the top nouns that we got above
{
HashMap<String, Integer> finalnounkey = (HashMap<String, Integer>) a.getFeatures().get("Nouns");
for(Map.Entry<String, Integer> entry : finalnounkey.entrySet())
{
String n = entry.getKey();
if(nn.contains(n))
if(!nvn.contains(a.getFeatures().get("Value").toString())) // Add this string to the final summary only if it has not been seen before
nvn.add(a.getFeatures().get("Value").toString());
}
}
lis = inDocumentOrder(tempDoc.getAnnotations().get("Sent"));
for(gate.Annotation a: lis) //Now iterate over the NVN annotations again, this time collecting the string values of the top nouns that we got above
{
HashMap<String, Integer> finalnounkey = (HashMap<String, Integer>) a.getFeatures().get("Nouns");
try
{
for(Map.Entry<String, Integer> entry : finalnounkey.entrySet())
{
String n = entry.getKey();
if(nn.contains(n))
if(!nvn.contains(a.getFeatures().get("Value").toString())) // Add this string to the final summary only if it has not been seen before
nvn.add(a.getFeatures().get("Value").toString());
}
}
catch (Exception e)
{}
}
for(String jb : nvn)
{
System.out.println(jb); // Print out the summary
}
}
private static ArrayList<String> Scores(HashMap<String, Integer> nouncounter, HashMap<String, Integer> firstnouns, HashMap<String, Integer> noundf, int paracount) {
double globalcount = 0;
globalcount = ((double)paracount/10.0); // This count represents the number of the nouns which will be our candidates from the sorted HashMap
HashMap<String, Double> nounscore = new HashMap<String, Double>();// HashMap for storing the tfidf scores of the nouns in the nouncounter
for(Map.Entry <String, Integer> entry : nouncounter.entrySet())//Iterate over all the nouns in the nouncounter
try
{
String term = entry.getKey();//Get the noun
if(term.matches("[\\p{Alnum}]+"))//Eliminate non alphanumeric nouns
{
int df=1;//df is set to one by default
int tf=entry.getValue();// Get the count associated with this noun. This will be the tf
double tfidf;
if(noundf.containsKey(term))
df=noundf.get(term);
tfidf=tf*Math.log10(paracount/df);//Calculate the tfidf score for this noun
if(firstnouns.containsKey(term))// If this noun also appears in firstnouns then assign it a higher score.
//Store the final tfidf score in nounscores
nounscore.put(term, tfidf+1);
else//If not then, store the tfidf score in nounscores
nounscore.put(term, tfidf);
}
}
catch (Exception e)
{
e.printStackTrace();
}
ArrayList<String> its = new ArrayList<String>();// This is the list which is returned to the main function. It will hold all the high scoring nouns
ValueComparator bvc = new ValueComparator(nounscore);
TreeMap<String,Double> sorted_map = new TreeMap<String,Double>(bvc);
sorted_map.putAll(nounscore);// sorted_map now has the nounscore HashMap sorted by value in descending order
int count = 0;// count represents what portion of the sorted_map entries we wish to take
System.out.println(globalcount);
for ( Map.Entry<String, Double> entry : sorted_map.entrySet())
{
if(entry.getValue()>1)
System.out.println(entry.getKey()+" "+entry.getValue());
}
for ( Map.Entry<String, Double> entry : sorted_map.entrySet())
{
if(entry.getValue()>globalcount)//Here we will extract the top values and store them in the ArrayList which would be returned
{
its.add(entry.getKey());// Add the entry to the list its
count++;
}
}
return its;
}
}
//Sort in descending order
class ValueComparator implements Comparator<String> {
Map<String, Double> base;
public ValueComparator(Map<String, Double> base) {
this.base = base;
}
// Note: this comparator imposes orderings that are inconsistent with equals.
public int compare(String a, String b) {
if (base.get(a) >= base.get(b)) {
return -1;
} else {
return 1;
} // returning 0 would merge keys
}
}
//Sort in ascending order
class ValueComparatorAsc implements Comparator<String> {
Map<String, Integer> base;
public ValueComparatorAsc(Map<String, Integer> base) {
this.base = base;
}
// Note: this comparator imposes orderings that are inconsistent with equals.
public int compare(String a, String b) {
if (base.get(a) <= base.get(b)) {
return -1;
} else {
return 1;
} // returning 0 would merge keys
}
}
| [
"[email protected]"
] | |
190b1fbf74afe17cd8b26ca1abf8c3776b95dab7 | 789588ffa08153ee8af3701b3473d6ad6898e6ed | /lib/src/main/java/com/tan/lib/algorithm/StringAnagram.java | ddf2a56a3dd439908239d1217ebe0554c37c397b | [] | no_license | tranminhtan/new-experiment | 3b56870934d3f7dd0073d51ffed0faac017c346a | 4d7e3883c74ef86168b2130822386c81bed60145 | refs/heads/master | 2023-06-27T05:59:37.628529 | 2021-07-27T16:04:15 | 2021-07-27T16:04:15 | 354,869,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,717 | java | package com.tan.lib.algorithm;
import com.tan.lib.PrintUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
class StringAnagram {
public static void main(String[] args) {
PrintUtils.print(isAnagram("abcd", "dcba"));
PrintUtils.print(isAnagramCount("abcd", "dcba"));
String[] input = {"eat", "tea", "tan", "ate", "nat", "bat"};
PrintUtils.print(groupAnagram(input));
}
/**
* NOTE: CHECK THE INPUT CONSTRAINTS: upper case, lower case, range
* 1st
* Fail fast by checking their length
* Sort both -> nlog(n)
* Compare -> n
* <p>
* 2nd
* Fail fast by checking their length
* <p>
* Compare 2 sets
* <p>
* eg: "abcd", "aabb"
*/
private static boolean isAnagram(String str1, String str2) {
if (str1.length() != str2.length()) {
return false;
}
char[] chars1 = str1.toCharArray();
char[] chars2 = str2.toCharArray();
Arrays.sort(chars1);
Arrays.sort(chars2);
for (int i = 0; i < chars1.length; i++) {
if (chars1[i] != chars2[i]) {
return false;
}
}
return true;
}
/**
* CONSTRAINT: string contains lower-case english alphabet -> 26 chars
* <p>
* fail fast -> compare length
* init a count array size 26
* walk thru both arrays
* increase the appearance of the chars in 1srt
* decrease the appearance of the chars in 2nd
* walk thru count array
* if any element != 0
* return false
* return true
*/
private static boolean isAnagramCount(String str1, String str2) {
int n1 = str1.length();
int n2 = str2.length();
if (n1 != n2) {
return false;
}
int[] count = new int[26];
for (int i = 0; i < n1; i++) {
count[str1.charAt(i) - 'a']++;
count[str2.charAt(i) - 'a']--;
}
for (int v : count) {
if (v != 0) {
return false;
}
}
return true;
}
// {1, 1, 2, 1, 2,3 }
// {{1, 1, 1}, {2,2}, {3}}
/**
* walk thru the array i: 0 -> n-2
* if(visited)
* continues
* create a new list, put curr into the list
* walk thru the array i+1 -> n-1
* if they're anagram & not visited
* put curr into list
* mart it as visited
*/
// {"eat", "tea", "tan", "ate", "nat", "bat"};
// [[eat, tea, ate], [tan, nat], [bat]]
private static List<List<String>> groupAnagram(String[] input) {
if (input == null || input.length == 0) {
return Collections.emptyList();
}
List<List<String>> result = new ArrayList<>();
Set<String> grouped = new HashSet<>();
for (int i = 0; i < input.length; i++) {
if (!grouped.contains(input[i])) {
grouped.add(input[i]);
List<String> list = new ArrayList<>();
list.add(input[i]);
for (int j = i + 1; j < input.length; j++) {
if (!grouped.contains(input[j]) && isAnagram(input[i], input[j])) {
grouped.add(input[j]);
list.add(input[j]);
}
}
result.add(list);
}
}
return result;
}
String test() {
String s = "fdfd";
char[] c = s.toCharArray();
for (int i = 1; i < c.length - 1; i += 2) {
c[i] = '$';
}
return String.valueOf(c);
}
}
| [
"[email protected]"
] | |
2f920f5887f9607170b1acafb6b92d0ab71bfca7 | 517148ec9aa215774264f3cf6b1792088ffe1e21 | /src/main/java/com/learning/ds/creational/prototype/Movie.java | 0b4255858508e6b38927e6e5b16624c327479d17 | [] | no_license | alok27may/design-pattern | 7ce1c9b1809a0c1c5d07a29050f6150446325cde | b2b52736eabfda25e1e27aaa6fd973f0d675e6c5 | refs/heads/master | 2020-12-27T15:41:23.415283 | 2020-04-27T16:29:29 | 2020-04-27T16:29:29 | 237,955,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package com.learning.ds.creational.prototype;
public class Movie implements PrototypeCapable {
private String name;
public Movie() {
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public Movie clone() throws CloneNotSupportedException {
System.out.println("cloning movie object ...");
return (Movie) super.clone();
}
@Override
public String toString() {
return "Movie";
}
}
| [
"[email protected]"
] | |
31989892f7f940213ea10df23c297bdacd59d380 | f001bbe14ad7c050cde7ed17e3135e7d779b0e47 | /webFramework_HW/src/main/java/kr/ac/hansung/model/Course.java | 3fb1e714e76e2d7260721185e21288b6e8aa68a9 | [] | no_license | lsis91/HelloSpringHOMEWORK2 | cd603e2be32b4282764c2c770be5551d9954ef49 | cda0b886251874c933a2f798af6b0c3a145744f0 | refs/heads/master | 2020-06-13T05:48:44.364022 | 2016-12-03T16:11:25 | 2016-12-03T16:11:25 | 75,483,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,196 | java | package kr.ac.hansung.model;
public class Course {
private int year;
private String name;
private String semester;
private String code;
private String value;
private int grades;
public Course() {
}
public Course(int year, String name, String semester, String code, String value, int grades) {
super();
this.year = year;
this.name = name;
this.semester = semester;
this.code = code;
this.value = value;
this.grades = grades;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSemester() {
return semester;
}
public void setSemester(String semester) {
this.semester = semester;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public int getGrades() {
return grades;
}
public void setGrades(int grades) {
this.grades = grades;
}
}
| [
"[email protected]"
] | |
7f9902de20da47a16da1e29358d281ee1722ad85 | 357c9a8e074752f66117b3045126167227b773e9 | /CoinDashboard/src/main/java/com/trade/impl/PercentageTrader.java | 4a30165d6e3962864a08941f9e4f1674436fa613 | [] | no_license | gopalkec24/Coin_Dashboard | 6cb033508a7131a268d943179e9c39be740aefad | 7c5c00184abfad7c7dd360cdc94084f74fe864d7 | refs/heads/master | 2022-06-23T12:46:21.312740 | 2021-11-28T20:24:07 | 2021-11-28T20:24:07 | 130,269,756 | 0 | 0 | null | 2022-05-20T20:54:10 | 2018-04-19T20:35:02 | Java | UTF-8 | Java | false | false | 24,171 | java | package com.trade.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import com.trade.ExchangeFactory;
import com.trade.ITrade;
import com.trade.constants.TraderConstants;
import com.trade.dao.ATMarketStaticsVO;
import com.trade.dao.ATOrderDetailsVO;
import com.trade.dao.TradeDataVO;
import com.trade.exception.AutoTradeException;
import com.trade.inf.IAutoTrader;
import com.trade.utils.AutoTradeConfigReader;
import com.trade.utils.AutoTradeUtilities;
import com.trade.utils.TradeClient;
import com.trade.utils.TradeLogger;
public class PercentageTrader extends Trader implements IAutoTrader {
private static final String CLASS_NAME = PercentageTrader.class.getName();
BigDecimal mIN_PERMISSIBLE_PERCENT= new BigDecimal("1.2");
BigDecimal mAX_PERMISSIBLE_PERCENT = new BigDecimal("1000");
public static void main(String[] args) {
}
public void processTradeList(List<TradeDataVO> listData) {
}
public void processData(TradeDataVO data) {
if(data.getTriggerEvent() == TraderConstants.COUNTER_NOINIT)
{
initializeLastPrice(data);
}
else if(data.getTriggerEvent() == TraderConstants.INTITAL_TRIGGER)
{
TradeLogger.LOGGER.info(data.toString());
checkConditionTriggerTransaction(data);
}
else if(data.getTriggerEvent() == TraderConstants.PLACE_ORDER_TRIGGER)
{
orderToExchange(data);
}
else if(data.getTriggerEvent() == TraderConstants.ORDER_TRIGGERED) {
checkOrderExecution(data);
}
else if(data.getTriggerEvent() == TraderConstants.MARK_FOR_DELETE_CREATE_NEW) {
cancelOrderReTriggerForNewTradeCondition(data);
}
else if(data.getTriggerEvent() == TraderConstants.DELETE_FOR_NEWTRADE) {
createNewTradeForDelete(data);
}
else if(data.getTriggerEvent() == TraderConstants.NEWTRADE_CREATED_FOR_DELETE) {
data.setRemarks("Order was deleted and new order was created for same");
}
else if(data.getTriggerEvent() == TraderConstants.COMPLETED) {
data.setRemarks("Order Got completed ");
}
}
public void initializeLastPrice(TradeDataVO data)
{
ITrade trade = ExchangeFactory.getInstance(data.getExchange());
boolean buyTrigger=false;
boolean sellTrigger = false;
BigDecimal lastPrice = TraderConstants.BIGDECIMAL_ZERO;
try
{
TradeLogger.LOGGER.finest("Start to get the price from Exchange ");
//Get the price from Exchange
ATMarketStaticsVO marketStaticsVO = trade.getExchangePriceStatics(data.getCoin(), data.getCurrency());
TradeLogger.LOGGER.finest("End to get the price from Exchange ");
BigDecimal pricePercentChange = TraderConstants.BIGDECIMAL_ZERO;
if (marketStaticsVO.isSuccess())
{
pricePercentChange = marketStaticsVO.getPricePercentFor24H();
TradeLogger.LOGGER.finest("Get the value from Exchange was successful");
lastPrice = marketStaticsVO.getLastPrice();
}
else
{
//check the current price from CoinMarketCap site
throw new AutoTradeException(marketStaticsVO.getErrorMsg());
}
//get the Percentage change
int compareResult = pricePercentChange.compareTo(TraderConstants.BIGDECIMAL_ZERO);
TradeLogger.LOGGER.info("PricePercent change value is "+pricePercentChange);
StringBuffer remarks=new StringBuffer();
if(compareResult== TraderConstants.COMPARE_GREATER)
{
//value is greater than zero
if(data.getTransactionType() == TraderConstants.BUY_CALL)
{
// Transaction is buy call
//compare the current pricePercent change is less than buy permissible limit
//if yes then trigger buy order trigger here.
//else wait for some time.
TradeLogger.LOGGER.info("Greater condition :: Maximum Buy Permission Limit :: " +AutoTradeConfigReader.getMaxBuyPermissibleLimit());
int buyLimit = pricePercentChange.compareTo(AutoTradeConfigReader.getMaxBuyPermissibleLimit());
if(buyLimit == TraderConstants.COMPARE_LOWER)
{
//Initializing the buy order trigger here
if(AutoTradeUtilities.isValidMarketData(data.getBasePrice()) )
{
int compareBasePrice = lastPrice.compareTo(data.getBasePrice());
if(compareBasePrice == TraderConstants.COMPARE_LOWER)
{
BigDecimal percent = AutoTradeUtilities.getDifferInPercentage(lastPrice, data.getBasePrice());
buyTrigger= AutoTradeUtilities.percentagePermissible(percent,(data.getMinPercentage().compareTo(TraderConstants.NEGATIVE_ONE))== TraderConstants.COMPARE_EQUAL?mIN_PERMISSIBLE_PERCENT:data.getMinPercentage(), (data.getMaxPercentage().compareTo(TraderConstants.NEGATIVE_ONE))== TraderConstants.COMPARE_EQUAL?mAX_PERMISSIBLE_PERCENT:data.getMaxPercentage());
TradeLogger.LOGGER.fine("Under PP is Greater .last price is lower than Base price. and Price differ Percentage " + percent +" Buy trigger value is "+buyTrigger);
remarks.append("last price is lower than Base price. and Price differ Percentage " + percent +" Buy trigger value is "+buyTrigger);
}
else
{
TradeLogger.LOGGER.fine("Under PP is Greater .last price is Greater than Base price,So not Triggering Buy trigger");
remarks.append("last Price is lower than Base Price");
}
}
else
{
buyTrigger= true;
TradeLogger.LOGGER.fine(" Under PP is Greater .last price is not valid price");
}
}
else
{
TradeLogger.LOGGER.info(" Under PP is Greater . Price Percent Change value is greater than MaximumBuyPermissible Limit");
//wait for some time.
}
}
else if(data.getTransactionType() == TraderConstants.SELL_CALL)
{
TradeLogger.LOGGER.info("Maximum Sell Permission Limit :: " +AutoTradeConfigReader.getMaxSellPermissibleLimit());
//Transaction is sell call
int sellLimit = pricePercentChange.compareTo(AutoTradeConfigReader.getMaxSellPermissibleLimit());
if(sellLimit == TraderConstants.COMPARE_GREATER) {
//Initializing the sell order trigger here
if(AutoTradeUtilities.isValidMarketData(data.getBasePrice()) )
{
int compareBasePrice = lastPrice.compareTo(data.getBasePrice());
if(compareBasePrice == TraderConstants.COMPARE_GREATER)
{
BigDecimal percent = AutoTradeUtilities.getDifferInPercentage(lastPrice, data.getBasePrice());
sellTrigger=AutoTradeUtilities.percentagePermissible(percent.abs(),(data.getMinPercentage().compareTo(TraderConstants.NEGATIVE_ONE))== TraderConstants.COMPARE_EQUAL?mIN_PERMISSIBLE_PERCENT:data.getMinPercentage(), (data.getMaxPercentage().compareTo(TraderConstants.NEGATIVE_ONE))== TraderConstants.COMPARE_EQUAL?mAX_PERMISSIBLE_PERCENT:data.getMaxPercentage());
TradeLogger.LOGGER.fine("Under PP is Greater .last price is Greater than Base price and Price differ Percentage " + percent +" sell trigger value is "+sellTrigger);
//TradeLogger.LOGGER.finest("Under PP is Greater .last price is Greater than Base price. so Triggering sell trigger");
remarks.append("Last price is Greater than Base price and Price differ Percentage " + percent +" sell trigger value is "+sellTrigger);
}
else
{
TradeLogger.LOGGER.fine("Under PP is Greater .last price is lesser than Base price");
remarks.append("Last price is Greater than Base price ");
}
}
else
{
sellTrigger =true;
TradeLogger.LOGGER.fine("Under PP is Greater .last price is not valid price");
}
}
else
{
// wait for some time.
TradeLogger.LOGGER.info("Under PP is Greater .Price Percent Change value is greater than MaximumSellPermissible Limit");
}
}
}
else if(compareResult == TraderConstants.COMPARE_LOWER || compareResult == TraderConstants.COMPARE_EQUAL)
{
// value is lesser or equal to zero
if(data.getTransactionType() == TraderConstants.BUY_CALL)
{
TradeLogger.LOGGER.info("Maximum Buy Permission Limit :: " +AutoTradeConfigReader.getMaxBuyPermissibleLimit());
// Transaction is buy call
int buyLimit = pricePercentChange.abs().compareTo(AutoTradeConfigReader.getMaxBuyPermissibleLimit());
if(buyLimit == TraderConstants.COMPARE_GREATER)
{
if(AutoTradeUtilities.isValidMarketData(data.getBasePrice()) )
{
int compareBasePrice = lastPrice.compareTo(data.getBasePrice());
if(compareBasePrice == TraderConstants.COMPARE_LOWER)
{
BigDecimal percent = AutoTradeUtilities.getDifferInPercentage(lastPrice, data.getBasePrice());
buyTrigger= AutoTradeUtilities.percentagePermissible(percent,(data.getMinPercentage().compareTo(TraderConstants.NEGATIVE_ONE))== TraderConstants.COMPARE_EQUAL?mIN_PERMISSIBLE_PERCENT:data.getMinPercentage(), (data.getMaxPercentage().compareTo(TraderConstants.NEGATIVE_ONE))== TraderConstants.COMPARE_EQUAL?mAX_PERMISSIBLE_PERCENT:data.getMaxPercentage());
TradeLogger.LOGGER.fine("Under PP is Greater .last price is Greater than Base price and Price differ Percentage " + percent +" Buy trigger value is "+buyTrigger);
remarks.append("last price is Greater than Base price. and Price differ Percentage " + percent +" Buy trigger value is "+buyTrigger);
}
else
{
TradeLogger.LOGGER.fine("Under PP is lower or Equal .last price is Greater than Base price,So not Triggering Buy trigger");
remarks.append("last Price is Greater than Base Price");
}
}
else
{
buyTrigger= true;
TradeLogger.LOGGER.fine("Under PP is lower or Equal .last price is not valid price. Triggering buy trigger");
}
}
else {
// wait for few minutes
TradeLogger.LOGGER.info("Under PP is lower or Equal .Price Percent Change value is less than MaximumBuyPermissible Limit");
}
}
else if(data.getTransactionType() == TraderConstants.SELL_CALL)
{
//Transaction is sell call
TradeLogger.LOGGER.info("Maximum Sell Permission Limit :: " +AutoTradeConfigReader.getMaxSellPermissibleLimit());
//percentage change is negative value
//Since change is negative value,we sell the immediately may be price will be getting down soon
int sellLimit = pricePercentChange.abs().compareTo(AutoTradeConfigReader.getMaxSellPermissibleLimit());
if(sellLimit == TraderConstants.COMPARE_GREATER)
{
//Initializing the sell order trigger here
if(AutoTradeUtilities.isValidMarketData(data.getBasePrice()) )
{
int compareBasePrice = lastPrice.compareTo(data.getBasePrice());
if(compareBasePrice == TraderConstants.COMPARE_GREATER)
{
//sellTrigger= true;
BigDecimal percent = AutoTradeUtilities.getDifferInPercentage(lastPrice, data.getBasePrice());
sellTrigger= AutoTradeUtilities.percentagePermissible(percent.abs(),(data.getMinPercentage().compareTo(TraderConstants.NEGATIVE_ONE))== TraderConstants.COMPARE_EQUAL?mIN_PERMISSIBLE_PERCENT:data.getMinPercentage(), (data.getMaxPercentage().compareTo(TraderConstants.NEGATIVE_ONE))== TraderConstants.COMPARE_EQUAL?mAX_PERMISSIBLE_PERCENT:data.getMaxPercentage());
TradeLogger.LOGGER.fine("Under PP is lower or Equal .last price is Greater than Base price and Price differ Percentage " + percent +" sell trigger value is "+sellTrigger);
//TradeLogger.LOGGER.finest("Under PP is lower or Equal .last price is Greater than Base price. so Triggering sell trigger");
remarks.append("Last price is Greater than Base price and Price differ Percentage " + percent +" sell trigger value is "+sellTrigger);
}
else
{
TradeLogger.LOGGER.fine("Under PP is lower or Equal .last price is lesser than Base price");
}
}
else
{
sellTrigger =true;
TradeLogger.LOGGER.fine("Under PP is lower or Equal .last price is not valid price");
}
}
else
{
//wait
TradeLogger.LOGGER.info("Under PP is lower or Equal .Price Percent Change value is less than MaximumSellPermissible Limit");
}
}
}
data.setLastPrice(lastPrice);
data.setLowPrice(marketStaticsVO.getLowPrice());
data.setHighPrice(marketStaticsVO.getHighPrice());
if(buyTrigger || sellTrigger)
{
data.setLastBuyCall(buyTrigger);
data.setLastSellCall(sellTrigger);
data.setTriggeredPrice(lastPrice);
data.setTriggerTime(System.currentTimeMillis());
data.setAtOrderId(System.currentTimeMillis()+"");
data.setTriggerEventForHistory(TraderConstants.INTITAL_TRIGGER);
data.setWaitCount(TraderConstants.ZERO_COUNT);
data.setLowCount(TraderConstants.ZERO_COUNT);
data.setHighCount(TraderConstants.ZERO_COUNT);
data.setReTriggerCount(TraderConstants.ZERO_COUNT);
data.addPriceHistory(getMarketStaticsVO(marketStaticsVO, data.getPriceHistory().size(), remarks.toString()+"Triggered Scenario"));
TradeLogger.LOGGER.warning("TRIGGERED SCENARIO");
data.setRemarks(" Scenario TRIGGERED");
}
else
{
TradeLogger.LOGGER.warning("NO Scenario TRIGGERED ");
data.setRemarks(remarks.toString()+" No Scenario TRIGGERED Since PricePercent change value is "+pricePercentChange);
}
} catch (AutoTradeException e) {
TradeLogger.LOGGER.logp(Level.SEVERE, CLASS_NAME,"initializeLastPrice" , "Failed to get the Exchange price from server",e);
}
}
public void checkConditionTriggerTransaction(TradeDataVO data)
{
ITrade trade = ExchangeFactory.getInstance(data.getExchange());
//get the price from exchange
ATOrderDetailsVO placeOrder = null;
try
{
ATMarketStaticsVO marketStaticsVO = trade.getExchangePriceStatics(data.getCoin(), data.getCurrency());
if(marketStaticsVO.isSuccess())
{
if(data.getWaitCount() > AutoTradeConfigReader.getWaitCount())
{
if(data.getTransactionType() == TraderConstants.BUY_CALL && data.getLowCount() > data.getHighCount()) {
data.setWaitCount(0);
data.setLowCount(0);
data.setHighCount(0);
}
else if(data.getTransactionType() == TraderConstants.SELL_CALL && data.getHighCount() > data.getLowCount()) {
data.setWaitCount(0);
data.setLowCount(0);
data.setHighCount(0);
}
else
{
// place order with triggered price
TradeLogger.LOGGER.info("Condition Met to transact changeing the state alone");
checkAndChangeTriggerPrice(data, marketStaticsVO);
placeOrder=generateOrderDetails(TraderConstants.LIMIT_ORDER,data.getTriggeredPrice(),null,data);
data.setRemarks("Triggered order with Triggered Price as "+data.getTriggeredPrice());
data.addPriceHistory(getMarketStaticsVO(marketStaticsVO,data.getPriceHistory().size(),"Triggered order with Triggered Price as "+data.getTriggeredPrice()));
}
}
else
{
checkAndChangeTriggerPrice(data, marketStaticsVO);
}
if(data.getTriggerEvent() == TraderConstants.PLACE_ORDER_TRIGGER && placeOrder!= null)
{
placeOrderToExchange(placeOrder);
updateTradeData(data, placeOrder);
}
data.setPreviousLastPrice(data.getLastPrice());
data.setLowPrice(marketStaticsVO.getLowPrice());
data.setHighPrice(marketStaticsVO.getHighPrice());
data.setLastPrice(marketStaticsVO.getLastPrice());
}
}
catch (AutoTradeException e)
{
TradeLogger.LOGGER.logp(Level.SEVERE, CLASS_NAME,"checkConditionTriggerTransaction" , "Failed to get the Exchange price from server",e);
}
}
private boolean checkAndChangeTriggerPrice(TradeDataVO data, ATMarketStaticsVO marketStaticsVO)
{
boolean placeOrder = false;
int compareLastCurrent =marketStaticsVO.getLastPrice().compareTo(data.getTriggeredPrice());
if(data.getTransactionType() == TraderConstants.BUY_CALL)
{
if(compareLastCurrent == TraderConstants.COMPARE_LOWER)
{
TradeLogger.LOGGER.finest("Updating the triggered Price as "+ marketStaticsVO.getLastPrice());
//change the trigger price to current last price
data.addTriggerPriceHistory(data.getTriggeredPrice());
data.setTriggeredPrice(marketStaticsVO.getLastPrice());
//increase the lower count and overall count here
data.addPriceHistory(getMarketStaticsVO(marketStaticsVO,data.getPriceHistory().size(),"Updating the triggered Price as "+ marketStaticsVO.getLastPrice() + " .Decrease in Price so increasing Low count"));
/*data.increaseLowCount();
data.increaseWaitCount();*/
data.setWaitCount(0);
data.setLowCount(0);
data.setHighCount(0);
}
else if(compareLastCurrent == TraderConstants.COMPARE_GREATER || compareLastCurrent ==TraderConstants.COMPARE_EQUAL)
{
//increase the High count and overall count here
TradeLogger.LOGGER.finest("Increasing the wait count with higher Count , adding history as well");
data.addPriceHistory(getMarketStaticsVO(marketStaticsVO,data.getPriceHistory().size(),"Increase in Price so increasing High count"));
data.increaseHigherCount();
data.increaseWaitCount();
}
}
else if(data.getTransactionType() == TraderConstants.SELL_CALL)
{
if(compareLastCurrent == TraderConstants.COMPARE_LOWER)
{
//increase the lower count and overall count here
data.addPriceHistory(getMarketStaticsVO(marketStaticsVO,data.getPriceHistory().size(),"Decrease in Price so increasing Low count"));
data.increaseLowCount();
data.increaseWaitCount();
}
else if(compareLastCurrent == TraderConstants.COMPARE_GREATER || compareLastCurrent ==TraderConstants.COMPARE_EQUAL)
{
TradeLogger.LOGGER.finest("Updating the triggered Price also here");
//change the trigger price to current last price
data.addTriggerPriceHistory(data.getTriggeredPrice());
data.setTriggeredPrice(marketStaticsVO.getLastPrice());
//increase the High count and overall count here
TradeLogger.LOGGER.finest("Updating the triggered Price as "+ marketStaticsVO.getLastPrice()+"Increase in Price so increasing High count");
data.addPriceHistory(getMarketStaticsVO(marketStaticsVO,data.getPriceHistory().size(), "Updating the triggered Price as "+ marketStaticsVO.getLastPrice()+"Increase in Price so increasing High count"));
/*data.increaseHigherCount();
data.increaseWaitCount();*/
data.setWaitCount(0);
data.setLowCount(0);
data.setHighCount(0);
}
}
return placeOrder;
}
public void orderToExchange(TradeDataVO data) {
ITrade trade = ExchangeFactory.getInstance(data.getExchange());
ATMarketStaticsVO marketStaticsVO;
try {
marketStaticsVO = trade.getExchangePriceStatics(data.getCoin(), data.getCurrency());
checkAndChangeTriggerPrice(data, marketStaticsVO);
ATOrderDetailsVO orderDetailsVO = generateATOrderForBSTransaction(TraderConstants.LIMIT_ORDER, data.getOrderTriggeredPrice(), null,data);
placeOrderToExchange(orderDetailsVO);
updateTradeData(data, orderDetailsVO);
} catch (AutoTradeException e) {
TradeLogger.LOGGER.logp(Level.SEVERE, CLASS_NAME,"orderToExchange" ,"FAILED to fetch the values from Exchange : " + data.getExchange(),e);
}
}
public void checkOrderExecution(TradeDataVO data)
{
try{
//check whether exchange order id is available
if(!TradeClient.isNullorEmpty(data.getExchangeOrderId()))
{
ITrade trade = ExchangeFactory.getInstance(data.getExchange());
if(trade!= null)
{
ATOrderDetailsVO getDetailVO= generateOrderDetailsForGet(data);
trade.getOrderStatus(getDetailVO);
//incase order is new or partially executed
if(getDetailVO.getStatus() == TraderConstants.NEW || getDetailVO.getStatus() == TraderConstants.PARTIALLY_EXECUTED)
{
TradeLogger.LOGGER.info("Order placed time "+new Date(getDetailVO.getTransactionTime())+" "+ getDetailVO.getTransactionTime());
TradeLogger.LOGGER.info("Client Status " + getDetailVO.getClientStatus());
//Map<String,Object> values= AutoTradeUtilities.getExchangePrice(data.getExchange(),data.getCoin(),data.getCurrency());
ATMarketStaticsVO marketStaticsVO = trade.getExchangePriceStatics(data.getCoin(), data.getCurrency());
//updatedCacheTime + defaultCacheTimeoutInMS < System.currentTimeMillis()
if((getDetailVO.getTransactionTime() + AutoTradeConfigReader.getTransactionTimeOut()) < System.currentTimeMillis())
{
TradeLogger.LOGGER.info("Making order to delete Since "+ (getDetailVO.getTransactionTime() + AutoTradeConfigReader.getTransactionTimeOut() )+ " milliseconds . Current Time"+System.currentTimeMillis());
data.setTriggerEventForHistory(TraderConstants.MARK_FOR_DELETE_CREATE_NEW);
data.setRemarks("Marking order to delete ");
cancelOrderReTriggerForNewTradeCondition(data);
}
else
{
TradeLogger.LOGGER.info("Waiting for order to execute for "+ (getDetailVO.getTransactionTime() + AutoTradeConfigReader.getTransactionTimeOut() )+ " milliseconds . Current Time"+System.currentTimeMillis());
}
data.addPriceHistory(getMarketStaticsVO(marketStaticsVO,data.getPriceHistory().size(),"Checking the order to be executed"));
}
//Cancelled / Expired
else if(getDetailVO.getStatus() == TraderConstants.DELETED || getDetailVO.getStatus() == TraderConstants.EXPIRED)
{
data.setTriggerEventForHistory(TraderConstants.DELETED);
data.setRemarks("Order got Deleted");
}
else if(getDetailVO.getStatus() == TraderConstants.EXECUTED)
{
BigDecimal quantity = TraderConstants.BIGDECIMAL_ZERO;
BigDecimal tradeCurrency = TraderConstants.BIGDECIMAL_ZERO;
//5 coin sold/bought , 5 coin is bought/sold
if(data.getProfitType() == TraderConstants.TAKE_AMOUNT)
{
quantity = getDetailVO.getExecutedQuantity();
}
else if(data.getProfitType() == TraderConstants.KEEP_VOLUME)
{
//Calculate the total transaction volume , we could buy/sold the coin based on
//total transactin volume
tradeCurrency = getDetailVO.getExecutedQuantity().multiply(getDetailVO.getOrderPrice());
}
TradeDataVO newTradeData = new TradeDataVO(data.getExchange(), data.getCoin(), data.getCurrency(), quantity, tradeCurrency,AutoTradeUtilities.reverseTransaction(data.getTransactionType()));
newTradeData.setBasePrice(getDetailVO.getOrderPrice());
newTradeData.setProfitType(data.getProfitType());
TradeLogger.LOGGER.info("New Trade Data" + newTradeData);
newOrderList.add(newTradeData);
data.setTriggerEventForHistory(TraderConstants.COMPLETED);
data.setRemarks("Order Got completed. Counter Order created");
}
}
}
}
catch (Exception e) {
TradeLogger.LOGGER.log(Level.SEVERE,"FAILED to fetch the values from Exchange : " + data.getExchange(),e);
}
}
public void cancelOrderReTriggerForNewTradeCondition(TradeDataVO data) {
try {
createNewTradeForDelete(data,getNewTradePriceForDeletedOrder2(data));
} catch (Exception e) {
TradeLogger.LOGGER.log(Level.SEVERE, "Error in calculating amount order please contact the Administrator ", e);
}
}
public void createNewTradeForDelete(TradeDataVO data) {
try {
createNewTradeForDelete(data,getNewTradePriceForDeletedOrder(data));
} catch (Exception e) {
TradeLogger.LOGGER.log(Level.SEVERE, "Error in calculating amount order please contact the Administrator ", e);
}
}
public List<TradeDataVO> getNewTradeOrderList() {
return newOrderList;
}
}
| [
"[email protected]"
] | |
a4fbe16627c4c2420025904a386d83b4e05791d7 | 99cb54420b8d78ffa8103c173939ba3b15dddf9f | /app/src/main/java/com/photon/templatemvp/view/navigation/Navigator.java | 5d2582a9b43c8816cd538e9876bb8b8cfa3827b0 | [
"Apache-2.0"
] | permissive | pointphoton/AndroidMVPTemplate | 32fd05079fbc708ab4fd1f2b7fbbf2253a5f8882 | 1f731aa4aaa8054319dfb1d9198955411ae44934 | refs/heads/master | 2020-12-30T11:27:34.990011 | 2017-06-08T09:31:23 | 2017-06-08T09:31:23 | 91,548,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,044 | java | package com.photon.templatemvp.view.navigation;
/**
* Created by jumbada on 03/05/2017.
*/
import android.content.Intent;
import com.photon.templatemvp.R;
import com.photon.templatemvp.view.base.activity.BaseActivity;
import com.photon.templatemvp.view.section.gallery.GalleryActivity;
import javax.inject.Inject;
import javax.inject.Singleton;
/**
* Class used to navigate through the application.
*/
@Singleton
public class Navigator {
@Inject
public Navigator() {
//empty
}
/**
* Goes to the {@link GalleryActivity} screen.
*
* @param activity A Activity needed to open with animation the destiny activity.
*/
public void navigateToGalleryScreen(BaseActivity activity) {
if (activity != null) {
Intent intentToLaunch = GalleryActivity.getCallingIntent(activity);
activity.startActivity(intentToLaunch);
activity.overridePendingTransition(R.anim.anim_slide_in_right,
R.anim.anim_slide_out_right);
}
}
}
| [
"[email protected]"
] | |
f02f07358ec82cdb81814d6f81e60967ee546a11 | 87a1bac52603bc028c5bf8ca5f2387cc442618d0 | /DVDLibrary1/src/dvdlibrary/dao/DVDLibraryDaoPersistenceException.java | 1e3c76ae69f61529bd8c7818a894f11f8e1526bb | [] | no_license | rsvll/DVDLibrary | c3d53b33059328d9c7314d153b39c72d5e8b42ac | b401237ff0ea150e4a664176ad21f48830636a31 | refs/heads/master | 2021-10-25T11:45:49.596205 | 2019-04-04T00:47:40 | 2019-04-04T00:47:40 | 116,081,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dvdlibrary.dao;
/**
*
* @author svlln
*/
public class DVDLibraryDaoPersistenceException extends Exception {
public DVDLibraryDaoPersistenceException(String message){
super(message);
}
public DVDLibraryDaoPersistenceException(String message, Throwable cause){
super(message, cause);
}
//
}
| [
"[email protected]"
] | |
be6ba53d22fc5ee74b63eab2a585787f4e7c11cd | 38be824395eb16f93cf1b61b84dd48d60e3b24ff | /src/main/java/com/luulsolutions/luulpos/repository/search/package-info.java | c3d698a4e593645b919608461f2f0622ab3e347c | [
"Apache-2.0"
] | permissive | gustavocaraciolo/luulpos_backend | 1443bdfef0791568ebc17b132d3f4ba579525076 | 1626620d1355b9feab7beac3aaf4e5c1003ac26d | refs/heads/master | 2020-05-16T06:48:46.833288 | 2019-04-23T07:37:18 | 2019-04-23T07:37:18 | 182,859,518 | 0 | 0 | Apache-2.0 | 2019-04-22T20:05:15 | 2019-04-22T20:05:14 | null | UTF-8 | Java | false | false | 104 | java | /**
* Spring Data Elasticsearch repositories.
*/
package com.luulsolutions.luulpos.repository.search;
| [
"[email protected]"
] | |
708861464f600ad8eb03bc6c93467d28aa0fdaee | 030c9d1aee96e3e6c8df8c2d337941b421607bf0 | /user-center/src/main/java/com/learning/usercenter/service/impl/PositionServiceImpl.java | 0d3ef90696c7d09cebc0dd415626a5eed5f97b44 | [] | no_license | 804959783/learning | b5a8425988f89a55482de30a2e8666d5053bf993 | 278f1b624a927521c90c946d1cdd6bfc548df990 | refs/heads/main | 2023-07-12T09:15:46.411117 | 2021-08-13T08:59:44 | 2021-08-13T08:59:44 | 395,168,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,460 | java | package com.learning.usercenter.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.learning.usercenter.dao.PositionMapper;
import com.learning.usercenter.entity.param.PositionQueryParam;
import com.learning.usercenter.entity.po.Position;
import com.learning.usercenter.service.IPositionService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Zzz
* @date 2021年8月11日10:46:34
*/
@Service
@Slf4j
public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> implements IPositionService {
@Override
public boolean add(Position position) {
return this.save(position);
}
@Override
public boolean delete(Long id) {
return this.removeById(id);
}
@Override
public boolean update(Position position) {
return this.updateById(position);
}
@Override
public Position get(Long id) {
return this.getById(id);
}
@Override
public List<Position> query(PositionQueryParam positionQueryParam) {
QueryWrapper<Position> queryWrapper = positionQueryParam.build();
queryWrapper.eq(StringUtils.isNotBlank(positionQueryParam.getName()), "name", positionQueryParam.getName());
return this.list(queryWrapper);
}
}
| [
"[email protected]"
] | |
954d1c405a2174cab54ac9b2a6f347921c95f392 | aefd216bdb4a15bdb031f9c78e0c99a908ac6669 | /src/main/java/com/hospital/model/Room.java | 41212f13f5a1678b049708f024087738104efdd3 | [] | no_license | JieeiroSst/hospital | 19e9aa651896a89a98ef234ceac2a74521fff0bd | 8df72fa9960d731a8d35146ca7889675714188e9 | refs/heads/master | 2022-12-12T02:42:55.025198 | 2020-09-04T02:11:22 | 2020-09-04T02:11:22 | 292,501,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,195 | java | package com.hospital.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Room {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int RoomNumber;
private String RoomType;
private int BlockFloor;
private int BlockCode;
private int Unavailable;
public Room(){}
public int getUnavailable() {
return Unavailable;
}
public int getBlockCode() {
return BlockCode;
}
public int getBlockFloor() {
return BlockFloor;
}
public int getRoomNumber() {
return RoomNumber;
}
public String getRoomType() {
return RoomType;
}
public void setBlockCode(int blockCode) {
BlockCode = blockCode;
}
public void setBlockFloor(int blockFloor) {
BlockFloor = blockFloor;
}
public void setRoomNumber(int roomNumber) {
RoomNumber = roomNumber;
}
public void setUnavailable(int unavailable) {
Unavailable = unavailable;
}
public void setRoomType(String roomType) {
RoomType = roomType;
}
}
| [
"[email protected]"
] | |
45da7465d5733503365dc06a2fe0ec7cb0c7ce2f | 47fd9eaccf058687de1311f3b8c65e70e4d9949f | /app/src/test/java/com/example/octavio/calculadora_imc/ExampleUnitTest.java | 92ee368fb47d8925a0c9152b17d27820994200e0 | [] | no_license | donowanoctavio/Imc | 913bfaf696ba8f0a747b82cd28632f5a49ef8eff | d92698fcd4f7cd7aabd17e6f658c0e46efdf8171 | refs/heads/master | 2020-05-31T09:02:51.891547 | 2019-06-04T13:25:23 | 2019-06-04T13:25:23 | 190,202,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package com.example.octavio.calculadora_imc;
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);
}
} | [
"[email protected]"
] | |
6e83debd700e3c41ab7f21bdd58c471a0771d3a2 | 0ed0793dfbe80580b733925d1197726052dad16b | /src/com/sun/org/apache/xerces/internal/xni/grammars/XMLGrammarPool.java | affc21281469be87dce373e73f17c75331a582e0 | [] | no_license | td1617/jdk1.8-source-analysis | 73b653f014f90eee1a6c6f8dd9b132b2333666f9 | e260d95608527ca360892bdd21c9b75ea072fbaa | refs/heads/master | 2023-03-12T03:22:09.529624 | 2021-02-25T01:00:11 | 2021-02-25T01:01:44 | 341,839,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,489 | java | /*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* Copyright 2000-2002,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.org.apache.xerces.internal.xni.grammars;
/**
* <p> This interface specifies how the parser and the application
* interact with respect to Grammar objects that the application
* possesses--either by having precompiled them or by having stored them
* from a previous validation of an instance document. It makes no
* assumptions about the kind of Grammar involved, or about how the
* application's storage mechanism works.</p>
*
* <p>The interaction works as follows:
* <ul>
* <li>When a validator considers a document, it is expected to request
* grammars of the type it can handle from this object using the
* <code>retrieveInitialGrammarSet</code> method. </li>
* <li>If it requires a grammar
* not in this set, it will request it from this Object using the
* <code>retrieveGrammar</code> method. </li>
* <li> After successfully validating an
* instance, the validator should make any new grammars it has compiled
* available to this object using the <code>cacheGrammars</code>
* method; for ease of implementation it may make other Grammars it holds references to as well (i.e.,
* it may return some grammars that were retrieved from the GrammarPool in earlier operations). </li> </ul> </p>
*
* @author Neil Graham, IBM
*/
public interface XMLGrammarPool {
// <p>we are trying to make this XMLGrammarPool work for all kinds of
// grammars, so we have a parameter "grammarType" for each of the
// methods. </p>
/**
* <p> retrieve the initial known set of grammars. this method is
* called by a validator before the validation starts. the application
* can provide an initial set of grammars available to the current
* validation attempt. </p>
*
* @param grammarType the type of the grammar, from the
* <code>com.sun.org.apache.xerces.internal.xni.grammars.Grammar</code> interface.
* @return the set of grammars the validator may put in its "bucket"
*/
public Grammar[] retrieveInitialGrammarSet(String grammarType);
/**
* <p>return the final set of grammars that the validator ended up
* with.
* This method is called after the
* validation finishes. The application may then choose to cache some
* of the returned grammars. </p>
*
* @param grammarType the type of the grammars being returned;
* @param grammars an array containing the set of grammars being
* returned; order is not significant.
*/
public void cacheGrammars(String grammarType, Grammar[] grammars);
/**
* <p> This method requests that the application retrieve a grammar
* corresponding to the given GrammarIdentifier from its cache.
* If it cannot do so it must return null; the parser will then
* call the EntityResolver. <strong>An application must not call its
* EntityResolver itself from this method; this may result in infinite
* recursions.</strong>
*
* @param desc The description of the Grammar being requested.
* @return the Grammar corresponding to this description or null if
* no such Grammar is known.
*/
public Grammar retrieveGrammar(XMLGrammarDescription desc);
/**
* Causes the XMLGrammarPool not to store any grammars when
* the cacheGrammars(String, Grammar[[]) method is called.
*/
public void lockPool();
/**
* Allows the XMLGrammarPool to store grammars when its cacheGrammars(String, Grammar[])
* method is called. This is the default state of the object.
*/
public void unlockPool();
/**
* Removes all grammars from the pool.
*/
public void clear();
} // XMLGrammarPool
| [
"[email protected]"
] | |
905e5265d858c33f3d5ccf4851d2e21a31ec3a31 | 34ed66a1ad6c9b310bb1f78ae6aea239a27fa5f4 | /corejava12/variable/BB.java | e0e82a12c1d2c76293ba6afdc5b745a7be3872e7 | [] | no_license | ravipathak105/JavaProjects | e04f240455c65d5e151dbbd7c37213843822f6bc | 6f1a9c4ac3784bcf29f3ae3797c155abf927e2c0 | refs/heads/master | 2020-06-08T18:14:00.915089 | 2019-06-22T21:20:35 | 2019-06-22T21:20:35 | 193,280,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | class BB
{
public static void main(String [] args)
{
int x=10;
int y=4;
float z=(float)x/y;
System.out.println(z);
}
}
| [
"[email protected]"
] | |
0b52c7ce517f9d2b33e006b654038f508ed91c09 | eaf56b4aaf14650532ee4d5e045dd031a61135c3 | /Tornado/src/edu/purdue/cs/tornado/index/local/fast/KeywordTrieCellMinimalExperiment.java | 7f933d344512a85f061eb00afe9cea8aa8b41d47 | [] | no_license | purduedb/tornadostreaming | 00d4cea01ad24761d065c74a804bd0d10eee4a56 | a1457a0422ac6d2369214c4900b6254b1fe7c521 | refs/heads/master | 2020-04-10T20:36:33.384625 | 2019-02-03T22:14:58 | 2019-02-03T22:14:58 | 161,273,123 | 1 | 3 | null | 2021-11-23T21:55:49 | 2018-12-11T03:41:44 | Java | UTF-8 | Java | false | false | 4,800 | java | package edu.purdue.cs.tornado.index.local.fast;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import edu.purdue.cs.tornado.helper.Point;
import edu.purdue.cs.tornado.helper.SpatialHelper;
import edu.purdue.cs.tornado.helper.TextHelpers;
import edu.purdue.cs.tornado.messages.Query;
public class KeywordTrieCellMinimalExperiment {
public HashMap<String, Object> trieCells;
public ArrayList<Query> queries;
public ArrayList<Query> finalQueries;
//public boolean extended ;
public KeywordTrieCellMinimalExperiment() {
queries = null;//
finalQueries = null;
trieCells = null;
// extended = false;
}
public void find(ArrayList<String> keywords, int start, List<Query> result, int level, Point location) {
if (finalQueries != null)
for (Query q : finalQueries) {
if (SpatialHelper.overlapsSpatially(location, q.getSpatialRange())) {
result.add(q);
}
}
if (queries != null)
for (Query q : queries) {
if (SpatialHelper.overlapsSpatially(location, q.getSpatialRange())) {
result.add(q);
}
}
int i = start;
HashMap<String, Object> currentCells = trieCells;
if (currentCells != null)
for (; i < keywords.size(); i++) {
String keyword = keywords.get(i);
Object cell = currentCells.get(keyword);
if (cell == null)
continue;
if (cell instanceof Query) {
if (SpatialHelper.overlapsSpatially(location, ((Query) cell).getSpatialRange()) && TextHelpers.containsTextually(keywords, ((Query) cell).getQueryText()))
result.add(((Query) cell));
} else if (cell instanceof ArrayList) {
for (Query q : ((ArrayList<Query>) cell)) {
if (SpatialHelper.overlapsSpatially(location, q.getSpatialRange()) && TextHelpers.containsTextually(keywords, q.getQueryText()))
result.add(q);
}
} else if (cell instanceof KeywordTrieCellMinimalExperiment) {
((KeywordTrieCellMinimalExperiment) cell).find(keywords, i + 1, result, level + 1, location);
}
}
}
public void findTextualOnly(ArrayList<String> keywords, int start, List<Query> result, int level) {
if (queries != null)
result.addAll(queries);
int i = start;
HashMap<String, Object> currentCells = trieCells;
if (currentCells != null)
for (; i < keywords.size(); i++) {
String keyword = keywords.get(i);
Object cell = currentCells.get(keyword);
if (cell == null)
continue;
if (cell instanceof Query) {
if (TextHelpers.containsTextually(keywords, ((Query) cell).getQueryText(), i, level))
result.add(((Query) cell));
} else if (cell instanceof ArrayList) {
for (Query q : ((ArrayList<Query>) cell)) {
if (TextHelpers.containsTextually(keywords, q.getQueryText(), i, level))
result.add(q);
}
} else if (cell instanceof KeywordTrieCellMinimalExperiment) {
((KeywordTrieCellMinimalExperiment) cell).findTextualOnly(keywords, i + 1, result, level + 1);
}
}
}
public int clean(ArrayList<Query> combinedQueries) {
int operations = 0;
if (queries != null) {
Iterator<Query> queriesItr = queries.iterator();
while (queriesItr.hasNext()) {
Query query = queriesItr.next();
if (query.getRemoveTime() < FAST.queryTimeStampCounter)
queriesItr.remove();
else {
combinedQueries.add(query);
}
operations++;
}
if (queries.size() == 0)
queries = null;
}
if (trieCells != null) {
Iterator<Entry<String, Object>> trieCellsItr = trieCells.entrySet().iterator();
while (trieCellsItr.hasNext()) {
Entry<String, Object> trieCellEntry = trieCellsItr.next();
Object cell = trieCellEntry.getValue();
if (cell instanceof Query) {
if (((Query) cell).getRemoveTime() < FAST.queryTimeStampCounter)
trieCellsItr.remove();
else {
combinedQueries.add((Query) cell);
}
operations++;
} else if (cell instanceof ArrayList) {
Iterator<Query> queriesInternalItr = ((ArrayList<Query>) cell).iterator();
while (queriesInternalItr.hasNext()) {
Query query = queriesInternalItr.next();
if (query.getRemoveTime() < FAST.queryTimeStampCounter)
queriesInternalItr.remove();
else {
combinedQueries.add(query);
}
operations++;
}
if (((ArrayList<Query>) cell).size() == 0)
trieCellsItr.remove();
} else if (cell instanceof KeywordTrieCellMinimalExperiment) {
operations += ((KeywordTrieCellMinimalExperiment) cell).clean(combinedQueries);
if (((KeywordTrieCellMinimalExperiment) cell).queries == null && ((KeywordTrieCellMinimalExperiment) cell).trieCells == null)
trieCellsItr.remove();
}
}
if (trieCells.size() == 0)
trieCells = null;
}
return operations;
}
}
| [
"[email protected]"
] | |
f8d0249418a5fe1784a1f3cc76d9fa181d8aec93 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/readerapp/Plugin$1.java | 134befe7a8afaca90d6f84cca56812a45fc83512 | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,041 | java | package com.tencent.mm.plugin.readerapp;
import android.content.Context;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.pluginsdk.b.a;
import com.tencent.mm.sdk.platformtools.ab;
final class Plugin$1
implements com.tencent.mm.pluginsdk.b.b
{
Plugin$1(Plugin paramPlugin)
{
}
public final a ac(Context paramContext, String paramString)
{
AppMethodBeat.i(76736);
ab.i("MicroMsg.ReaderApp.Plugin", "create contact widget type[%s]", new Object[] { paramString });
if ("widget_type_news".equals(paramString))
{
paramContext = new com.tencent.mm.plugin.readerapp.ui.b(paramContext);
AppMethodBeat.o(76736);
}
while (true)
{
return paramContext;
paramContext = null;
AppMethodBeat.o(76736);
}
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes7-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.readerapp.Plugin.1
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
] | |
85596b4c2f19d298c302b0c7b65b7234175322bb | df6bcaa0b76d73e1b93a9da8a9ff69ae58339599 | /src/java8inAction/chapter3/WorkingWithConsumer.java | da19d8f9af9c70c5d51b818e03b4df9ed01a8230 | [] | no_license | miuteo/JavaPractice | 2f86ab7d755fde5418110497ad4615698efea863 | 77ac9d7c77c2895d26c33897146c4869c884d5bd | refs/heads/master | 2020-04-06T04:53:00.684098 | 2017-06-01T18:54:20 | 2017-06-01T18:54:20 | 73,620,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,174 | java | package java8inAction.chapter3;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static java8inAction.chapter3.CONSTANTS.arrayListInteger;
/**
* Created by Asus x556 on 11-Mar-17.
*/
public class WorkingWithConsumer {
public static <T>void forEach(List<T> list,Consumer c){
for(T i:list){
c.accept(i);
}
}
public static void main(String[]args){
forEach(arrayListInteger, new Consumer<Integer>() {
@Override
public void accept(Integer t) {
if(t%2==0){
System.out.println(t);
}
}
}
);
///or
forEach(arrayListInteger, x ->{
if(x instanceof Integer){
int xInt = (int) x;
if(xInt %2 ==0){
System.out.println(x);
}
}
});
forEach(arrayListInteger, x ->{
if((int)x % 2 ==0){
System.out.println(x);
}
}
);
}
}
| [
"[email protected]"
] | |
52f099f743af02c53ab8770a48cd6c108ed9d667 | e201b7f2ddee8c62a5f27e1fcdaa9347bb99ef3f | /JPAProject/src/entities/Payment.java | 7d6927e354af92442d8b7e44a7ead72fb8b80034 | [] | no_license | abp1400/FuelTracker | 2bf03bb98514d68733107fc0a0907257024a6dba | f50dd1d7ce14b53b96a9d9c5b7427d9f7de07dbf | refs/heads/master | 2021-09-03T09:56:27.472561 | 2018-01-08T06:48:25 | 2018-01-08T06:48:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,884 | java | package entities;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="payment")
public class Payment {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
@Column(name="store_name")
private String storeName;
private String address;
private String grade;
private double gallon;
@Column(name="price_per_gallon")
private double pricePerGallon;
@Column(name="total_price")
private double totalPrice;
private Date date;
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getGrade() {
return grade;
}
public void setGrade(String grade) {
this.grade = grade;
}
public double getGallon() {
return gallon;
}
public void setGallon(double gallon) {
this.gallon = gallon;
}
public double getPricePerGallon() {
return pricePerGallon;
}
public void setPricePerGallon(double pricePerGallon) {
this.pricePerGallon = pricePerGallon;
}
public double getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(double totalPrice) {
this.totalPrice = totalPrice;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public int getId() {
return id;
}
@Override
public String toString() {
return "Payment [id=" + id + ", storeName=" + storeName + ", address=" + address + ", grade=" + grade
+ ", gallon=" + gallon + ", pricePerGallon=" + pricePerGallon + ", totalPrice=" + totalPrice + ", date="
+ date + "]";
}
}
| [
"[email protected]"
] | |
90328209c978de20a7e4c5292a0c6e88e022b60d | 519e177c79891112e9c06626edbda0b0163c0603 | /gefp/src/main/java/gefp/web/validator/UserValidator.java | c61ae05d3555ac5f5c0efcf73d695df49f52beaa | [] | no_license | gauravsisodiya/Golden-Eagle-Flight-Plan | f144fff7d50ec38cc045242e82988b99f01a4f52 | 991ac96ed1f3922a83cccf8fa0c498a5738e248b | refs/heads/master | 2021-01-10T11:12:46.113590 | 2015-10-16T04:14:30 | 2015-10-16T15:30:47 | 44,394,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,105 | java | package gefp.web.validator;
import gefp.model.User;
import gefp.model.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@Component
public class UserValidator implements Validator{
@Autowired
private UserDao userDao;
@Override
public boolean supports(Class<?> clazz) {
// TODO Auto-generated method stub
return User.class.isAssignableFrom(clazz);
}
@Override
public void validate(Object target, Errors errors) {
// TODO Auto-generated method stub
User user = (User) target;
//System.out.println("user"+user.getUsername());
if(!StringUtils.hasText(user.getUsername()))
{
System.out.println("uname");
errors.rejectValue("username", "error.username.empty");
}
if(!StringUtils.hasText(user.getPassword()))
{
System.out.println("pwd");
errors.rejectValue("password", "error.password.empty");}
}
}
| [
"[email protected]"
] | |
5422b3668e7b704ba5a6f580b33161a7560e915b | bf641e8319de14cf090d4da56ea3e6ba96efd41f | /guorj/MovedGridWithDb4o/app/src/main/java/com/wesoft/movedgridwithdb4o/CategoryManager.java | 3aedf789dd7c406c4b24754932a6c315172f012f | [] | no_license | guoruiliang/Demo | f83e163fa73a6e49279cbd089fa4f2d13163967e | c46d8c5c823e5c8b46c18b869954bf89a7b8b71d | refs/heads/master | 2021-03-12T22:33:43.020105 | 2015-10-17T09:40:21 | 2015-10-17T09:40:21 | 38,966,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,317 | java | package com.wesoft.movedgridwithdb4o;
import android.content.Context;
import android.database.SQLException;
import com.wesoft.movedgridwithdb4o.view.CategoryItem;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class CategoryManager {
private static final String LOG_TAG = CategoryManager.class.getSimpleName();
Context mContext;
public static CategoryManager categoryManage;
/**
* 默认的用户选择分类列表
* */
public static List<CategoryItem> defaultUserCategorys;
/**
* 默认的其他分类列表
* */
public static List<CategoryItem> defaultOtherCategorys;
/**
* 这里写上默认的数据,比如开始没有网络的情况下,给的一些默认分类
*
*/
static {
defaultUserCategorys = new ArrayList<CategoryItem>();
defaultOtherCategorys = new ArrayList<CategoryItem>();
defaultUserCategorys.add(new CategoryItem(1, "推荐", 1, 1));
defaultUserCategorys.add(new CategoryItem(2, "热点", 2, 1));
defaultUserCategorys.add(new CategoryItem(3, "娱乐", 3, 1));
defaultUserCategorys.add(new CategoryItem(4, "时尚", 4, 1));
defaultUserCategorys.add(new CategoryItem(5, "科技", 5, 1));
defaultUserCategorys.add(new CategoryItem(6, "体育", 6, 1));
defaultUserCategorys.add(new CategoryItem(7, "军事", 7, 1));
defaultOtherCategorys.add(new CategoryItem(8, "财经", 1, 0));
defaultOtherCategorys.add(new CategoryItem(9, "汽车", 2, 0));
defaultOtherCategorys.add(new CategoryItem(10, "房产", 3, 0));
defaultOtherCategorys.add(new CategoryItem(11, "社会", 4, 0));
defaultOtherCategorys.add(new CategoryItem(12, "情感", 5, 0));
defaultOtherCategorys.add(new CategoryItem(13, "女人", 6, 0));
defaultOtherCategorys.add(new CategoryItem(14, "旅游", 7, 0));
defaultOtherCategorys.add(new CategoryItem(15, "健康", 8, 0));
defaultOtherCategorys.add(new CategoryItem(16, "美女", 9, 0));
defaultOtherCategorys.add(new CategoryItem(17, "游戏", 10, 0));
defaultOtherCategorys.add(new CategoryItem(18, "数码", 11, 0));
}
/**
* 重新初始化数据库的数据
* <P>
* 这个后面在加,从网络获取到分类后,初始化,需要更新数据库中的内容,保存用户已经选择的,删除没有的分类。
*
* @param userCates
* @param otherCates
*/
public static void initData(List<CategoryItem> userCates,
List<CategoryItem> otherCates) {
}
private CategoryManager(Context context) throws SQLException {
this.mContext = context;
// 判断是否有数据,如果没有数据则初始化,如果已经有数据了,就不初始化
if (AppApplication.mDb4oHelper.count(CategoryItem.class) <= 0) {
initDefaultChannel();
}
return;
}
/**
* 初始化分类管理类
*
* @param paramDBHelper
* @throws SQLException
*/
public static CategoryManager getManage(Context context) throws SQLException {
if (categoryManage == null)
categoryManage = new CategoryManager(context);
return categoryManage;
}
/**
* 清除所有的分类
*/
public void deleteAllChannel() {
try {
AppApplication.mDb4oHelper.delAll(CategoryItem.class);
} catch (Exception e) {
} finally {
// AppApplication.mDb4oHelper.close();
}
}
/**
* 获取用户选择的的分类
*
* @return 数据库存在用户配置 ? 数据库内的用户选择分类 : 默认用户选择分类 ;
*/
public List<CategoryItem> getUserChannel() {
List<CategoryItem> result = new ArrayList<CategoryItem>();
try {
HashMap map = new HashMap();
map.put("selected", 1);
result = AppApplication.mDb4oHelper.getDatasByParam(CategoryItem.class, map);
} catch (Exception e) {
} finally {
// AppApplication.mDb4oHelper.close();
}
return result;
}
/**
* 获取其他的分类
*
* @return 数据库存在用户配置 ? 数据库内的其它分类 : 默认其它分类 ;
*/
public List<CategoryItem> getOtherChannel() {
List<CategoryItem> result = new ArrayList<CategoryItem>();
try {
HashMap map = new HashMap();
map.put("selected", 0);
result = AppApplication.mDb4oHelper.getDatasByParam(CategoryItem.class, map);
} catch (Exception e) {
} finally {
// AppApplication.mDb4oHelper.close();
}
return result;
}
/**
* 保存用户分类到数据库
*
* @param userList
*/
public void saveUserChannel(List<CategoryItem> userList) {
try {
// 需要修改slected值
if (userList != null && !userList.isEmpty()) {
for (CategoryItem item : userList) {
item.selected = 1;
}
AppApplication.mDb4oHelper.save(userList);
}
} catch (Exception e) {
} finally {
// AppApplication.mDb4oHelper.close();
}
}
/**
* 保存其他分类到数据库
*
* @param otherList
*/
public void saveOtherChannel(List<CategoryItem> otherList) {
try {
// 需要修改slected值
if (otherList != null && !otherList.isEmpty()) {
for (CategoryItem item : otherList) {
item.selected = 0;
}
AppApplication.mDb4oHelper.save(otherList);
}
} catch (Exception e) {
} finally {
// AppApplication.mDb4oHelper.close();
}
}
/**
* 初始化数据库内的分类数据
*/
private void initDefaultChannel() {
deleteAllChannel();
saveUserChannel(defaultUserCategorys);
saveOtherChannel(defaultOtherCategorys);
}
}
| [
"[email protected]"
] | |
0a50697e300c3b68db021ca87290873834cad271 | 6a5ccc3fdcff5e5424904517d9c217b679566ce2 | /src/com/hexin/apicloud/ble/printer/qr380/TemplateItemFactory.java | b71b76b04340ea1ea379c39605136be8fb403303 | [] | no_license | Unknown2016/HxBle | ce874bd3b383a0ead3de6110bc69749743aabf6b | 26e9374e82a9ab9e81d13cfd29861eaba0492838 | refs/heads/master | 2020-03-13T19:13:36.112258 | 2019-01-17T09:04:11 | 2019-01-17T09:04:11 | 131,249,380 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,123 | java | package com.hexin.apicloud.ble.printer.qr380;
import android.annotation.SuppressLint;
import java.util.HashMap;
import java.util.Map;
import com.hexin.apicloud.ble.enums.PrintItemEnum;
/**
* 打印项目模板工厂
* @author 军刀
*/
@SuppressLint("UseSparseArrays")
public class TemplateItemFactory {
public TemplateItemFactory() {
super();
}
private static class TemplateItemFactoryHolder {
private final static TemplateItemFactory INSTANCE = new TemplateItemFactory();
}
/**
* 工厂实例
* @return
*/
public static TemplateItemFactory getInstance() {
return TemplateItemFactoryHolder.INSTANCE;
}
/**
* 电子面单模板实现类Map
* key:快递模板类型
* value:电子面单模板实现类
*/
private static Map<Integer,IPrintTemplateItem> templateItemMap = new HashMap<Integer,IPrintTemplateItem>();
/**
* TEXT(0, "文本"),IMAGE(1, "图片"),LINE(2,"线条"),QRCODE(3,"二维码"),RECTANGLE(4,"矩形"),BARCODE(5,"条码"),
* GRID(10,"表格"),SEQNUMBER(11,"序号"),BLANK(12,"空白"),WATERMARK(13,"水印");
*/
static{
templateItemMap.put(PrintItemEnum.TEXT.ordinal(), new PrintTextItem());
templateItemMap.put(PrintItemEnum.IMAGE.ordinal(), new PrintImageItem());
templateItemMap.put(PrintItemEnum.LINE.ordinal(), new PrintLineItem());
templateItemMap.put(PrintItemEnum.QRCODE.ordinal(), new PrintQRCodeItem());
templateItemMap.put(PrintItemEnum.RECTANGLE.ordinal(), new PrintRectangleItem());
templateItemMap.put(PrintItemEnum.BARCODE.ordinal(), new PrintBarcodeItem());
templateItemMap.put(PrintItemEnum.GRID.getIndex(), new PrintGridItem());
templateItemMap.put(PrintItemEnum.SEQNUMBER.getIndex(), new PrintSeqNumberItem());
templateItemMap.put(PrintItemEnum.BLANK.getIndex(), new PrintBlankItem());
templateItemMap.put(PrintItemEnum.WATERMARK.getIndex(), new PrintWaterMarkItem());
}
/**
* 生成快递电子面单模板
* @param type 快递模板类型
* @return
*/
public IPrintTemplateItem createTemplateItem(Integer type){
return templateItemMap.get(type);
}
}
| [
"[email protected]"
] | |
ef4d9b88bb116ef4e905a11b47ed74700d634afd | a7c86df1aadcf97b4b4780199a3de0e2d75860f2 | /src/main/java/com/domain/models/repos/BookRepo.java | 96de642c612fb1ef71c53f82c1af22bbe42e969b | [] | no_license | ibnuwm/demo-api | 36f36dfc04398eda3192cc4b5c77491d4810d583 | 8b8fabfb862010c8465d509be1bfe6d13c933772 | refs/heads/master | 2023-06-10T04:10:17.562614 | 2021-07-05T04:29:31 | 2021-07-05T04:29:31 | 380,736,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package com.domain.models.repos;
import com.domain.models.entities.Book;
import org.springframework.data.jpa.repository.JpaRepository;
public interface BookRepo extends JpaRepository<Book, Long> {
}
| [
"[email protected]"
] | |
029789b3856a0fce5bf90b5ca084ca36c5d43af0 | 462dc68ed1d4ed0fc9eeb5021fbe0f62cd1e3e16 | /src/main/java/pl/hornunge/structural/bridge/example2/shape/Shape.java | a6d8849e348920a41f141497fb798b4ddad80e7c | [] | no_license | emil-hornung/design-patterns | 75fc4e99f7a409054a71db248476b7f079cd6811 | 5c547c8774bd8f7b7c07da0ec294cb7d8bcc8ed6 | refs/heads/master | 2021-01-09T05:43:25.986547 | 2017-02-03T10:49:09 | 2017-02-03T10:49:11 | 80,819,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package pl.hornunge.structural.bridge.example2.shape;
import pl.hornunge.structural.bridge.example2.graphic_interface.GraphicInterface;
public abstract class Shape {
public abstract void draw(GraphicInterface graphicInterface);
}
| [
"[email protected]"
] | |
fe51bb955935c48e2bda5b0743f1916d3998c6d8 | 4d078bbbfea95e2879a49ddffb18f26f8235d78b | /TianTianCircle/app/src/main/java/com/tt/circle/app/adapter/FragmentAdapter.java | fe55f86dd7740d56087c8bcdfa50497d7ccda6f0 | [] | no_license | oybo/TianTianCircle | be4343ac6bf72e498d3f12783ec66faf9197e6b5 | a93316006dadd02e60f0a56ef39c8abe7beac2a1 | refs/heads/master | 2023-01-10T13:14:40.630621 | 2022-12-30T08:46:23 | 2022-12-30T08:46:23 | 96,094,194 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,405 | java | package com.tt.circle.app.adapter;
/**
* Created by O on 2017/7/3.
*/
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;
import com.tt.circle.app.entity.CategoryEntity;
import com.tt.circle.app.ui.fragment.MediaFragment;
import java.util.ArrayList;
import java.util.List;
public class FragmentAdapter extends FragmentStatePagerAdapter {
private List<Fragment> mFragments = new ArrayList<>();
private List<CategoryEntity> mCategoryLists = new ArrayList<>();
public FragmentAdapter(FragmentManager fm) {
super(fm);
}
public void addItem(CategoryEntity entity) {
mCategoryLists.add(entity);
mFragments.add(MediaFragment.newInstance(entity.getId()));
}
@Override
public Fragment getItem(int position) {
return mFragments.get(position);
}
@Override
public int getCount() {
return mFragments.size();
}
@Override
public CharSequence getPageTitle(int position) {
return mCategoryLists.get(position).getName().replace("#", "");
}
/**
* Override this method to save Fragment state
* @param container
* @param position
* @param object
*/
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
}
} | [
"[email protected]"
] | |
9c58df2a9ce95fe433a8f54c846201a95b2b1b37 | 2e49f5b8bd64209e8266ad58e867a468073854a1 | /nrt-core/src/main/java/com/jd/rec/nl/core/guice/interceptor/InterceptorConfig.java | 9c9fe7eacc6a3ed25e5455cec1a85cf152094fe8 | [] | no_license | ttggaa/Import_test | edf9eb9e5d7d473966d54c931171601298df9f3e | 15e7fa9afd7c9791bc9c273909c2552d61e2e213 | refs/heads/master | 2020-04-22T12:01:03.965830 | 2019-01-13T08:00:03 | 2019-01-13T08:00:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 966 | java | package com.jd.rec.nl.core.guice.interceptor;
import org.aopalliance.intercept.MethodInterceptor;
import java.lang.annotation.Annotation;
/**
* 用于定义切面的配置类
*
* @author linmx
* @date 2018/5/28
*/
public class InterceptorConfig<M extends MethodInterceptor> {
private Class<? extends Annotation> annotation;
private M methodInterceptor;
public InterceptorConfig(Class<? extends Annotation> annotation, M methodInvocation) {
this.annotation = annotation;
this.methodInterceptor = methodInvocation;
}
public Class<? extends Annotation> getAnnotation() {
return annotation;
}
public void setAnnotation(Class<? extends Annotation> annotation) {
this.annotation = annotation;
}
public M getMethodInterceptor() {
return methodInterceptor;
}
public void setMethodInterceptor(M methodInterceptor) {
this.methodInterceptor = methodInterceptor;
}
}
| [
"[email protected]"
] | |
2566b9c92e4dacd67871adb3f5e301a878294412 | a5b5d052eacfe5e2d47b2b257cfbf45af9e385e7 | /src/main/java/com/dmalch/priority/AbstractPriorityQueue.java | fd79ad888b212a2100079b9cb243835e9ddd487b | [] | no_license | dmalch/sorting-sample | f6f3807b247c1ff58a2b0e97d7b41bdb43282bcc | 2df05fbf97332c5d7268503f0774e40c50a50124 | refs/heads/master | 2016-09-05T11:27:37.407939 | 2013-02-14T10:24:18 | 2013-02-14T10:24:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package com.dmalch.priority;
public abstract class AbstractPriorityQueue<E extends Comparable<E>> implements PriorityQueue<E> {
@Override
public E[] addAllAndDeleteMax(final E[] unsortedEvenArray, final Class<? extends E[]> aClass) {
for (final E element : unsortedEvenArray) {
insert(element);
if (noMoreSpace()) {
deleteMax();
}
}
return toArray(aClass);
}
protected abstract E[] toArray(final Class<? extends E[]> aClass);
protected abstract boolean noMoreSpace();
}
| [
"[email protected]"
] | |
77093dd23d54d828c11847ab05de21913570865f | 5e0e30b04743c83157394133438bd42f729cd45c | /core/src/main/java/au/com/biztechaem/core/package-info.java | 589ee58aeb657c55aaa29db15f595289ae14994f | [] | no_license | dfparker2002/cq-aem-spellchecker | 0f7a2436c42025d33ceffd24d0b51bdd859e4e1d | 8acd76baa8b5882d054107ab724aeb1b9408472d | refs/heads/master | 2020-03-28T20:21:27.675859 | 2015-11-23T23:29:18 | 2015-11-23T23:29:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 777 | java | /*
* Copyright 2014 Adobe Systems Incorporated
*
* 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.
*/
@Version("1.0")
@Export(optional = "provide:=true")
package au.com.biztechaem.core;
import aQute.bnd.annotation.Export;
import aQute.bnd.annotation.Version; | [
"[email protected]"
] | |
062319b95961df634999b71f74d40c3c18bdda2e | 973238bc7fa2f929204fbd75ee54a5aa1a34781e | /StackAndQueue/src/course/algo/exos/compression/Test.java | 3e17836f61b3b579a8d0b5ec6b205d8bf831ec9f | [] | no_license | nguyenvanson9x/JAVA | 00aa60e1611a37f61be7a393f2254899367fb106 | 9b41608015cc23668f57b9cc450ad86cbcffd2b9 | refs/heads/master | 2021-01-20T00:20:26.286203 | 2017-05-31T14:23:52 | 2017-05-31T14:23:52 | 89,112,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,139 | java | package course.algo.exos.compression;
public class Test {
public static void main(String[] args) {
// testRle1();
// testRle2();
// testRle3();
// testRle4();
// testLz1();
// testLz2();
// testLz3();
// testLz4();
// testLz5();
}
public static void testRle1() {
System.out.printf("testRle1 ");
for (int[] line : Data.testsRle) {
System.out.printf("%d ", RLE.length(line));
}
System.out.printf("done\n");
}
public static void testRle2() {
System.out.printf("testRle2 ");
for (int[] line : Data.testsRle) {
int[] rle = RLE.compress(line);
for (int i : rle)
System.out.printf("%d ", i);
System.out.printf("| ");
}
System.out.printf("done\n");
}
public static void testRle3() {
System.out.printf("testRle3 ");
for (int[] line : Data.testsRleInverse) {
System.out.printf("%d ", RLE.lengthInverse(line));
}
System.out.printf("done\n");
}
public static void testRle4() {
System.out.printf("testRle4 ");
for (int[] line : Data.testsRleInverse) {
int[] rle = RLE.decompress(line);
for (int i : rle)
System.out.printf("%d ", i);
System.out.printf("| ");
}
System.out.printf("done\n");
}
public static void testLz1() {
System.out.printf("testLz1 ");
Occurrence o;
o = LZ77.longestOccurrence(Data.testsLzOccurrence[0], 0,
Data.windowSize);
System.out.printf("%d %d | ", o.size, o.retour);
o = LZ77.longestOccurrence(Data.testsLzOccurrence[1], 0,
Data.windowSize);
System.out.printf("%d %d | ", o.size, o.retour);
o = LZ77.longestOccurrence(Data.testsLzOccurrence[2], 0,
Data.windowSize);
System.out.printf("%d %d | ", o.size, o.retour);
o = LZ77.longestOccurrence(Data.testsLzOccurrence[2], 1,
Data.windowSize);
System.out.printf("%d %d | ", o.size, o.retour);
o = LZ77.longestOccurrence(Data.testsLzOccurrence[3], 0,
Data.windowSize);
System.out.printf("%d %d | ", o.size, o.retour);
o = LZ77.longestOccurrence(Data.testsLzOccurrence[3], 2,
Data.windowSize);
System.out.printf("%d %d | ", o.size, o.retour);
o = LZ77.longestOccurrence(Data.testsLzOccurrence[4], 143,
Data.windowSize);
System.out.printf("%d %d | ", o.size, o.retour);
o = LZ77.longestOccurrence(Data.testsLzOccurrence[4], 298,
Data.windowSize);
System.out.printf("%d %d | ", o.size, o.retour);
System.out.printf("done\n");
}
public static void testLz2() {
System.out.printf("testLz2 ");
for (int[] line : Data.testsLz)
System.out.printf("%d ", LZ77.length(line, Data.windowSize));
System.out.printf("done\n");
}
public static void testLz3() {
System.out.printf("testLz3 ");
for (int[] line : Data.testsLz)
LZ77.printCompression(LZ77.compress(line, Data.windowSize));
System.out.printf("done\n");
}
public static void testLz4() {
System.out.printf("testLz4 ");
for (Element[] line : Data.testsLzInverse)
System.out.printf("%d ", LZ77.lengthInverse(line));
System.out.printf("done\n");
}
public static void testLz5() {
System.out.printf("testLz5 ");
for (Element[] line : Data.testsLzInverse)
LZ77.printDecompression(LZ77.decompress(line));
System.out.printf("done\n");
}
}
| [
"[email protected]"
] | |
74cb8ec06e6c35c4dcf8556ff85ac85d2e1e27fb | 66f5b9d0a6ef4c21ebdb2f0bcd82f21594129a60 | /Pokecube Core/src/main/java/pokecube/core/moves/animations/MoveAnimationHelper.java | 0b340a7637e9a5b1e1306b3cba17cefc9f6c331e | [] | no_license | MartijnTielemans/Pokecube | 4fee4dd4512fd821c52a91a4ec314b11a8dd1acd | 3618d37ca56d9c3df2e3022782fba42bb8e6f751 | refs/heads/master | 2021-05-31T03:22:47.590067 | 2016-02-28T13:41:14 | 2016-02-28T13:41:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,310 | java | package pokecube.core.moves.animations;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import org.lwjgl.opengl.GL11;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.EntityViewRenderEvent.RenderFogEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent.Unload;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pokecube.core.interfaces.IMoveAnimation.MovePacketInfo;
import pokecube.core.interfaces.Move_Base;
import thut.api.maths.Vector3;
public class MoveAnimationHelper
{
private static MoveAnimationHelper instance;
public static MoveAnimationHelper Instance()
{
if (instance == null)
{
instance = new MoveAnimationHelper();
MinecraftForge.EVENT_BUS.register(instance);
}
return instance;
}
HashMap<Entity, HashSet<MoveAnimation>> moves = new HashMap<Entity, HashSet<MoveAnimation>>();
public void addMove(Entity attacker, MoveAnimation move)
{
HashSet<MoveAnimation> moves = this.moves.get(attacker);
if (moves == null)
{
moves = new HashSet<MoveAnimation>();
this.moves.put(attacker, moves);
}
moves.add(move);
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderWorldPost(RenderFogEvent event)
{
try
{
GL11.glPushMatrix();
ArrayList<Entity> entities = Lists.newArrayList(moves.keySet());
for (Entity e : entities)
{
if (!moves.containsKey(e)) continue;
HashSet<MoveAnimation> moves = Sets.newHashSet(this.moves.get(e));
for (MoveAnimation move : moves)
{
Vector3 target = Vector3.getNewVector().set(move.targetLoc);
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
Vector3 source = Vector3.getNewVector().set(player);
GL11.glPushMatrix();
source.set(target.subtract(source));
GL11.glTranslated(source.x, source.y, source.z);
// Clear out the jitteryness from rendering
source.x = player.prevPosX - player.posX;
source.y = player.prevPosY - player.posY;
source.z = player.prevPosZ - player.posZ;
source.scalarMultBy(event.renderPartialTicks);
GL11.glTranslated(source.x, source.y, source.z);
// TODO see about fixing the slight movement that occurs
// when the player stops or starts moving
move.render(event.renderPartialTicks);
GL11.glPopMatrix();
}
}
GL11.glPopMatrix();
for (Object e : moves.keySet())
{
HashSet<MoveAnimation> moves = this.moves.get(e);
for (MoveAnimation move : moves)
{
if (move.lastDrop != event.entity.worldObj.getTotalWorldTime())
{
move.duration--;
move.lastDrop = event.entity.worldObj.getTotalWorldTime();
}
}
}
HashSet<Object> toRemove = new HashSet<Object>();
for (Object e : moves.keySet())
{
HashSet<MoveAnimation> moves = this.moves.get(e);
HashSet<MoveAnimation> remove = new HashSet<MoveAnimation>();
for (MoveAnimation move : moves)
{
if (move.duration < 0)
{
remove.add(move);
}
}
moves.removeAll(remove);
if (moves.size() == 0) toRemove.add(e);
}
for (Object o : toRemove)
{
moves.remove(o);
}
}
catch (Throwable e)
{
e.printStackTrace();
}
}
@SubscribeEvent
public void WorldUnloadEvent(Unload evt)
{
if (evt.world.provider.getDimensionId() == 0 && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
{
clear();
}
}
public void clear()
{
moves.clear();
}
public static class MoveAnimation
{
public final Entity attacker;
public final Entity targetEnt;
public final Vector3 targetLoc;
public final Vector3 sourceStart;
public final Move_Base move;
public int duration;
public long lastDrop;
final MovePacketInfo info;
public MoveAnimation(Entity attacker, Entity targetEnt, Vector3 targetLoc, Move_Base move, int time)
{
this.attacker = attacker;
this.targetEnt = targetEnt;
this.targetLoc = targetLoc;
this.sourceStart = Vector3.getNewVector().set(attacker).addTo(0, attacker.getEyeHeight(), 0);
this.move = move;
info = new MovePacketInfo(move, attacker, targetEnt, sourceStart, targetLoc);
duration = time;
}
public void render(double partialTick)
{
if (move.animation != null)
{
info.currentTick = move.animation.getDuration() - duration;
move.animation.clientAnimation(info, Minecraft.getMinecraft().renderGlobal, (float) partialTick);
}
else
{
throw (new NullPointerException("Who Registered null animation for " + move.name));
}
}
}
}
| [
"[email protected]"
] | |
9f5f0580100b443627f3e4fbcb90b84d737764a9 | ee76808a48056a613692aa196bfb96ba73a1282d | /src/com/main/loop/swaptwonumbers.java | 8b380b87a2331f9549a3113dce8c5923b564cbba | [] | no_license | Ramyasarav/Programs | 66de75816510a86135d11cfd101919547bb6fc74 | 6913d53df82b232343c3107d2b774543a27f1cb1 | refs/heads/master | 2021-01-10T16:09:39.891042 | 2016-02-29T15:07:30 | 2016-02-29T15:07:30 | 52,642,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | package com.main.loop;
import java.util.Scanner;
public class swaptwonumbers {
public static void main(String[] args) {
int x,y;
System.out.println("Enter the numbers x and y: ");
Scanner A = new Scanner(System.in);
x = A.nextInt();
y = A.nextInt();
System.out.println("you entered x="+x);
System.out.println("you entered y="+y);
x=x+y;
y=x-y;
x=x-y;
System.out.println("swapped number x="+x);
System.out.println("swapped number y="+y);
}
}
| [
"[email protected]"
] | |
5e388a4a415c5349df5d329e5dbf2d1d19f8e630 | 3fcd509867dcc91e652d7c64c8c547984829fd36 | /src/main/java/forestry/apiculture/genetics/BeekeepingMode.java | 83dc37d65ae567d3a9df1c2844a1041ec1c4b257 | [] | no_license | Mgazul/ForestryMC-mc-1.12 | 57ecee970ea461a4ab91334c647eb3ccf2d44d05 | 27a81dcc10fb8b7ba51a82724481819f4f8af040 | refs/heads/master | 2020-04-02T17:44:30.565079 | 2018-10-25T12:59:40 | 2018-10-25T12:59:40 | 154,669,968 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,860 | java | /*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.apiculture.genetics;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.DefaultBeeModifier;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.apiculture.IBeekeepingMode;
public class BeekeepingMode implements IBeekeepingMode {
public static final IBeekeepingMode easy = new BeekeepingMode("EASY", 2.0f, 1.0f, 1.0f, false, false);
public static final IBeekeepingMode normal = new BeekeepingMode("NORMAL", 1.0f, 1.0f, 1.0f, false, true);
public static final IBeekeepingMode hard = new BeekeepingMode("HARD", 0.75f, 1.5f, 1.0f, false, true);
public static final IBeekeepingMode hardcore = new BeekeepingMode("HARDCORE", 0.5f, 5.0f, 0.8f, true, true);
public static final IBeekeepingMode insane = new BeekeepingMode("INSANE", 0.2f, 10.0f, 0.6f, true, true);
private final Random rand;
private final String name;
private final boolean reducesFertility;
private final boolean canFatigue;
private final IBeeModifier beeModifier;
public BeekeepingMode(String name, float mutationModifier, float lifespanModifier, float speedModifier, boolean reducesFertility, boolean canFatigue) {
this.rand = new Random();
this.name = name;
this.reducesFertility = reducesFertility;
this.canFatigue = canFatigue;
this.beeModifier = new BeekeepingModeBeeModifier(mutationModifier, lifespanModifier, speedModifier);
}
@Override
public String getName() {
return this.name;
}
@Override
public List<String> getDescription() {
List<String> ret = new ArrayList<>();
ret.add("beemode." + name.toLowerCase(Locale.ENGLISH) + ".desc");
return ret;
}
@Override
public float getWearModifier() {
return 1.0f;
}
@Override
public int getFinalFertility(IBee queen, World world, BlockPos pos) {
int toCreate = queen.getGenome().getFertility();
if (reducesFertility) {
toCreate = new Random().nextInt(toCreate);
}
return toCreate;
}
@Override
public boolean isFatigued(IBee queen, IBeeHousing housing) {
if (!canFatigue) {
return false;
}
if (queen.isNatural()) {
return false;
}
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
return queen.getGeneration() > 96 + rand.nextInt(6) + rand.nextInt(6) &&
rand.nextFloat() < 0.02f * beeModifier.getGeneticDecay(queen.getGenome(), 1f);
}
@Override
public boolean isDegenerating(IBee queen, IBee offspring, IBeeHousing housing) {
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
float mutationModifier = beeModifier.getMutationModifier(queen.getGenome(), queen.getMate(), 1.0f);
if (mutationModifier > 10) {
return housing.getWorldObj().rand.nextFloat() * 100 < 0.4 * (mutationModifier * mutationModifier - 100);
}
return false;
}
@Override
public boolean isNaturalOffspring(IBee queen) {
return queen.isNatural();
}
@Override
public boolean mayMultiplyPrincess(IBee queen) {
return true;
}
@Override
public IBeeModifier getBeeModifier() {
return beeModifier;
}
private static class BeekeepingModeBeeModifier extends DefaultBeeModifier {
private final float mutationModifier;
private final float lifespanModifier;
private final float speedModifier;
public BeekeepingModeBeeModifier(float mutationModifier, float lifespanModifier, float speedModifier) {
this.mutationModifier = mutationModifier;
this.lifespanModifier = lifespanModifier;
this.speedModifier = speedModifier;
}
@Override
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
return this.mutationModifier;
}
@Override
public float getLifespanModifier(IBeeGenome genome, @Nullable IBeeGenome mate, float currentModifier) {
return this.lifespanModifier;
}
@Override
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
if(this.speedModifier>16.0f)
{
return 16.0f;
}
return this.speedModifier;
}
}
}
| [
"[email protected]"
] | |
c1771985838abecfdd1fac8da953194d2f333ebf | ac7f1905cefa2716f0562fe396275e6fa725f0b5 | /Semi/src/Controller/NewMember.java | 65dbab63cca77d68ac740ae8e0b86e74ff4fa49d | [
"MIT"
] | permissive | raylia-w/workspace | 41db8e69e06d8adc3da4c9c8d1d5129115178a7e | b8e26d609c7c891a728e98df6ceefb0ecadf6d6c | refs/heads/master | 2020-03-17T16:34:58.510296 | 2018-05-17T03:26:01 | 2018-05-17T03:26:01 | 133,754,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package Controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/member/memberjoin.do")
public class NewMember extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher("/mypage/memberJoin.jsp").forward(request, response);;
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| [
"[email protected]"
] | |
687ce1d93f4a0024d0d37a100364f9a3fa5f82b2 | 16c51c59a206af21d33fe6f2d1ad9ab17fec6e52 | /src/main/java/testcases/testSftSignIn.java | e2f957f1c76e5b2285ff939a8eda96633c487474 | [] | no_license | sotoncit06/SFTAutomationProject | 52e4b6a244d63f64399b27b189ec021523d5b69b | 583a04c2be455b684b024ea9826a688c70e65f6f | refs/heads/master | 2020-03-26T08:54:31.178631 | 2018-08-14T13:38:32 | 2018-08-14T13:38:32 | 144,725,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,537 | java | package testcases;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import pages.signIn.sftSignIn;
import pages.signOut.sftSignOut;
import testdata.getExcelData;
import static testcases.configuration.driver;
/**
* Created by sarja on 7/23/2017.
*/
public class testSftSignIn {
//Declaration of SFT sign in page and getExcelData objects.
sftSignIn objLogin;
sftSignOut objSignout;
getExcelData getExlObj;
//Test will be initiated from here by TestNG framework. This method will open facebook signIn page and sign in to facebook using
//the specified email address and password in credential.xls
@Test(dataProvider="sftLogin")
public void testSftSignIn(String userName, String password) throws InterruptedException {
//Navogate to sft signIn page
driver.get("http://rupshav13/bds");
//Create SFT SignIn Page object
objLogin = new sftSignIn(driver);
//signIn to SFT
objLogin.signinSFT(userName, password);
objSignout = new sftSignOut(driver);
objSignout.clickSignOut();
}
//Test will be initiated from here by TestNG framework. This method will read the credential.xls file and extrace email, password
// and pass it to "test_Login" through @Dataprovider
@DataProvider(name="sftLogin")
public Object[][] loginData() {
getExlObj= new getExcelData();
Object[][] arrayObject = getExlObj.getExcelData("credential.xls","Sheet1");
return arrayObject;
}
}
| [
"[email protected]"
] | |
6ca95abdf2761f4a56c2352cdada2622914964e4 | 94b077e0e35507a51b977dccf5d70e29f0cf4041 | /gen-java/tserver/gen/TimeServer.java | 6cdbb32e8cf62fbfacef0145b1bab662822f7b98 | [] | no_license | paco-shum/PUBLIC_DEMO_WebApp_20_21_Assignment | a5d5237649e956e358731e46dc39b809798eb93e | a52fb0e736e37ab0c5ddf6d49231594be2b2b28c | refs/heads/main | 2023-06-23T16:04:01.764244 | 2021-04-30T14:56:55 | 2021-04-30T14:56:55 | 387,054,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 29,151 | java | /**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package tserver.gen;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2021-4-30")
public class TimeServer {
public interface Iface {
public long time() throws org.apache.thrift.TException;
}
public interface AsyncIface {
public void time(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
}
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
public Factory() {}
public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
return new Client(prot);
}
public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
return new Client(iprot, oprot);
}
}
public Client(org.apache.thrift.protocol.TProtocol prot)
{
super(prot, prot);
}
public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
super(iprot, oprot);
}
public long time() throws org.apache.thrift.TException
{
send_time();
return recv_time();
}
public void send_time() throws org.apache.thrift.TException
{
time_args args = new time_args();
sendBase("time", args);
}
public long recv_time() throws org.apache.thrift.TException
{
time_result result = new time_result();
receiveBase(result, "time");
if (result.isSetSuccess()) {
return result.success;
}
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "time failed: unknown result");
}
}
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
private org.apache.thrift.async.TAsyncClientManager clientManager;
private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
this.clientManager = clientManager;
this.protocolFactory = protocolFactory;
}
public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
return new AsyncClient(protocolFactory, clientManager, transport);
}
}
public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
super(protocolFactory, clientManager, transport);
}
public void time(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
time_call method_call = new time_call(resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class time_call extends org.apache.thrift.async.TAsyncMethodCall {
public time_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("time", org.apache.thrift.protocol.TMessageType.CALL, 0));
time_args args = new time_args();
args.write(prot);
prot.writeMessageEnd();
}
public long getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
return (new Client(prot)).recv_time();
}
}
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
}
protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
super(iface, getProcessMap(processMap));
}
private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
processMap.put("time", new time());
return processMap;
}
public static class time<I extends Iface> extends org.apache.thrift.ProcessFunction<I, time_args> {
public time() {
super("time");
}
public time_args getEmptyArgsInstance() {
return new time_args();
}
protected boolean isOneway() {
return false;
}
public time_result getResult(I iface, time_args args) throws org.apache.thrift.TException {
time_result result = new time_result();
result.success = iface.time();
result.setSuccessIsSet(true);
return result;
}
}
}
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
public AsyncProcessor(I iface) {
super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
}
protected AsyncProcessor(I iface, Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
super(iface, getProcessMap(processMap));
}
private static <I extends AsyncIface> Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
processMap.put("time", new time());
return processMap;
}
public static class time<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, time_args, Long> {
public time() {
super("time");
}
public time_args getEmptyArgsInstance() {
return new time_args();
}
public AsyncMethodCallback<Long> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new AsyncMethodCallback<Long>() {
public void onComplete(Long o) {
time_result result = new time_result();
result.success = o;
result.setSuccessIsSet(true);
try {
fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
return;
} catch (Exception e) {
LOGGER.error("Exception writing to internal frame buffer", e);
}
fb.close();
}
public void onError(Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
time_result result = new time_result();
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
return;
} catch (Exception ex) {
LOGGER.error("Exception writing to internal frame buffer", ex);
}
fb.close();
}
};
}
protected boolean isOneway() {
return false;
}
public void start(I iface, time_args args, org.apache.thrift.async.AsyncMethodCallback<Long> resultHandler) throws TException {
iface.time(resultHandler);
}
}
}
public static class time_args implements org.apache.thrift.TBase<time_args, time_args._Fields>, java.io.Serializable, Cloneable, Comparable<time_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("time_args");
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new time_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new time_argsTupleSchemeFactory());
}
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(time_args.class, metaDataMap);
}
public time_args() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public time_args(time_args other) {
}
public time_args deepCopy() {
return new time_args(this);
}
@Override
public void clear() {
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof time_args)
return this.equals((time_args)that);
return false;
}
public boolean equals(time_args that) {
if (that == null)
return false;
return true;
}
@Override
public int hashCode() {
List<Object> list = new ArrayList<Object>();
return list.hashCode();
}
@Override
public int compareTo(time_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("time_args(");
boolean first = true;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class time_argsStandardSchemeFactory implements SchemeFactory {
public time_argsStandardScheme getScheme() {
return new time_argsStandardScheme();
}
}
private static class time_argsStandardScheme extends StandardScheme<time_args> {
public void read(org.apache.thrift.protocol.TProtocol iprot, time_args struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, time_args struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class time_argsTupleSchemeFactory implements SchemeFactory {
public time_argsTupleScheme getScheme() {
return new time_argsTupleScheme();
}
}
private static class time_argsTupleScheme extends TupleScheme<time_args> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, time_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, time_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
}
}
}
public static class time_result implements org.apache.thrift.TBase<time_result, time_result._Fields>, java.io.Serializable, Cloneable, Comparable<time_result> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("time_result");
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I64, (short)0);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new time_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new time_resultTupleSchemeFactory());
}
public long success; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 0: // SUCCESS
return SUCCESS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __SUCCESS_ISSET_ID = 0;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "Timestamp")));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(time_result.class, metaDataMap);
}
public time_result() {
}
public time_result(
long success)
{
this();
this.success = success;
setSuccessIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public time_result(time_result other) {
__isset_bitfield = other.__isset_bitfield;
this.success = other.success;
}
public time_result deepCopy() {
return new time_result(this);
}
@Override
public void clear() {
setSuccessIsSet(false);
this.success = 0;
}
public long getSuccess() {
return this.success;
}
public time_result setSuccess(long success) {
this.success = success;
setSuccessIsSet(true);
return this;
}
public void unsetSuccess() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
}
/** Returns true if field success is set (has been assigned a value) and false otherwise */
public boolean isSetSuccess() {
return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
}
public void setSuccessIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
if (value == null) {
unsetSuccess();
} else {
setSuccess((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
return Long.valueOf(getSuccess());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case SUCCESS:
return isSetSuccess();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof time_result)
return this.equals((time_result)that);
return false;
}
public boolean equals(time_result that) {
if (that == null)
return false;
boolean this_present_success = true;
boolean that_present_success = true;
if (this_present_success || that_present_success) {
if (!(this_present_success && that_present_success))
return false;
if (this.success != that.success)
return false;
}
return true;
}
@Override
public int hashCode() {
List<Object> list = new ArrayList<Object>();
boolean present_success = true;
list.add(present_success);
if (present_success)
list.add(success);
return list.hashCode();
}
@Override
public int compareTo(time_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("time_result(");
boolean first = true;
sb.append("success:");
sb.append(this.success);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class time_resultStandardSchemeFactory implements SchemeFactory {
public time_resultStandardScheme getScheme() {
return new time_resultStandardScheme();
}
}
private static class time_resultStandardScheme extends StandardScheme<time_result> {
public void read(org.apache.thrift.protocol.TProtocol iprot, time_result struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 0: // SUCCESS
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.success = iprot.readI64();
struct.setSuccessIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, time_result struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.isSetSuccess()) {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
oprot.writeI64(struct.success);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class time_resultTupleSchemeFactory implements SchemeFactory {
public time_resultTupleScheme getScheme() {
return new time_resultTupleScheme();
}
}
private static class time_resultTupleScheme extends TupleScheme<time_result> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, time_result struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetSuccess()) {
oprot.writeI64(struct.success);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, time_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.success = iprot.readI64();
struct.setSuccessIsSet(true);
}
}
}
}
}
| [
"[email protected]"
] | |
b3a95b7e1a05259e035f858ca8c7a09b0cc52258 | 55b68777ae077e0243f4f4d650fa4f5059285866 | /hrms/src/main/java/JavaKampProje/hrms/api/CvPhotosController.java | 4c984f73622538a74d965f8287ca77865ea08764 | [] | no_license | ugurcivgin34/HRMS | 3257b52b1d85f20c16ecea47538b67e70eef262d | 0d0a56c23c8efd0d75dac0f5d355d7920d53936f | refs/heads/master | 2023-06-04T00:12:07.058572 | 2021-06-26T07:43:02 | 2021-06-26T07:43:02 | 371,510,248 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,514 | java | package JavaKampProje.hrms.api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import JavaKampProje.hrms.business.abstracts.CandidateService;
import JavaKampProje.hrms.business.abstracts.CvPhotoService;
import JavaKampProje.hrms.core.utilities.Result;
import JavaKampProje.hrms.core.utilities.SuccessResult;
import JavaKampProje.hrms.entities.concretes.Candidate;
import JavaKampProje.hrms.entities.concretes.CvPhoto;
@RestController
@RequestMapping("/api/cvPhotoController")
public class CvPhotosController {
private CvPhotoService cvPhotoService;
private CandidateService candidateService;
@Autowired
public CvPhotosController(CvPhotoService cvPhotoService,CandidateService candidateService) {
super();
this.cvPhotoService = cvPhotoService;
this.candidateService=candidateService;
}
@PostMapping("/add")
public Result add(@RequestParam(value="id")int id,@RequestParam(value="imageFile")MultipartFile imageFile) {
Candidate candidate=this.candidateService.getById(id).getData();
CvPhoto cvPhoto =new CvPhoto();
cvPhoto.setCandidate(candidate);
return this.cvPhotoService.add(cvPhoto, imageFile);
}
}
| [
"[email protected]"
] | |
59e98eee0acf9daae31a4ec66a74982b52bc961e | 6e050c23603cbd8fc267544b9361ebbd9ce64b7f | /server/src/main/java/com/clientservertest/server/workers/RequestWorker.java | 0cef844b4cf2b8c9cf2c694a95ff4a1afb4a1ea0 | [
"MIT"
] | permissive | andrey-v-sokolov/simple-rpc-client-server | f5f515145fd915c71d8992d4971391db6e4da2e0 | 878ba2d3298f6939700ef57a8dc018f9447693bf | refs/heads/master | 2021-01-25T06:49:21.756700 | 2017-06-26T18:19:45 | 2017-06-26T18:19:45 | 93,615,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,638 | java | package com.clientservertest.server.workers;
import com.clientservertest.common.CommandRequest;
import com.clientservertest.common.CommandResponse;
import com.clientservertest.server.Services;
import org.apache.log4j.Logger;
/**
* Request worker class. Handles client command execution.
*/
public class RequestWorker implements Runnable {
private static final Logger LOG = Logger.getLogger(RequestWorker.class);
private CommandRequest commandRequest;
private Services services;
private ClientWorker clientWorker;
public RequestWorker(ClientWorker clientWorker, CommandRequest commandRequest, Services services) {
this.commandRequest = commandRequest;
this.services = services;
this.clientWorker = clientWorker;
}
@Override
public void run() {
CommandResponse commandResponse = new CommandResponse();
commandResponse.setId(commandRequest.getId());
LOG.info(String.format("Processing: %s", commandRequest.toString()));
Object call = null;
try {
call = services.call(commandRequest.getServiceName(), commandRequest.getMethodName(), commandRequest.getParams());
} catch (Exception e) {
LOG.info(String.format("CommandRequest %d caused exception: %s.", commandRequest.getId(), e.getMessage()));
commandResponse.setException(e);
}
commandResponse.setResult(call);
LOG.info(String.format("CommandRequest %d processed. ", commandRequest.getId()));
clientWorker.write(commandResponse);
LOG.info(commandResponse.toString() + " sent to client.");
}
}
| [
"[email protected]"
] | |
e44a23f7f6c8736b9f7bff54dd059b3c46f949bd | 37db8f6b2e7907b71f748808ea9ff8e8d033d564 | /JavaSource/org/unitime/timetable/api/ApiServlet.java | ef9157caccfeb4dff63fcbd36b5db60fe40972bf | [
"Apache-2.0",
"EPL-2.0",
"CDDL-1.0",
"MIT",
"CC-BY-3.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-freemarker",
"LGPL-2.1-only",
"EPL-1.0",
"BSD-3-Clause",
"LGPL-2.1-or-later",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | UniTime/unitime | 48eaa44ae85db344d015577d21dcc1a41cecd862 | bc69f2e18f82bdb6c995c4e6490cb650fa4fa98e | refs/heads/master | 2023-08-18T00:52:29.614387 | 2023-08-16T16:08:17 | 2023-08-16T16:08:17 | 29,594,752 | 253 | 185 | Apache-2.0 | 2023-05-17T14:16:13 | 2015-01-21T14:58:53 | Java | UTF-8 | Java | false | false | 5,274 | java | /*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* The Apereo Foundation 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.unitime.timetable.api;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.unitime.timetable.gwt.shared.PageAccessException;
import org.unitime.timetable.security.SessionContext;
import org.unitime.timetable.security.context.AnonymousUserContext;
import org.unitime.timetable.security.context.HttpSessionContext;
/**
* @author Tomas Muller
*/
public class ApiServlet extends HttpServlet {
private static Log sLog = LogFactory.getLog(ApiServlet.class);
private static final long serialVersionUID = 1L;
protected SessionContext getSessionContext() {
return HttpSessionContext.getSessionContext(getServletContext());
}
protected String getReference(HttpServletRequest request) {
return request.getServletPath() + request.getPathInfo();
}
protected ApiConnector getConnector(HttpServletRequest request) {
WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
return (ApiConnector) applicationContext.getBean(getReference(request));
}
protected void checkError(HttpServletRequest request, HttpServletResponse response, Throwable t) throws IOException {
if (t instanceof NoSuchBeanDefinitionException) {
sLog.info("Service " + getReference(request) + " not known.");
sendError(request, response, HttpServletResponse.SC_BAD_REQUEST, t);
} else if (t instanceof IllegalArgumentException) {
sLog.info(t.getMessage());
sendError(request, response, HttpServletResponse.SC_BAD_REQUEST, t);
} else if (t instanceof PageAccessException || t instanceof AccessDeniedException) {
sLog.info(t.getMessage());
if (!getSessionContext().isAuthenticated() || getSessionContext().getUser() instanceof AnonymousUserContext) {
response.setHeader("WWW-Authenticate", "Basic");
sendError(request, response, HttpServletResponse.SC_UNAUTHORIZED, t);
} else {
sendError(request, response, HttpServletResponse.SC_FORBIDDEN, t);
}
} else {
sLog.warn(t.getMessage(), t);
sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, t);
}
}
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
getConnector(request).doGet(request, response);
} catch (Throwable t) {
checkError(request, response, t);
}
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
getConnector(request).doPost(request, response);
} catch (Throwable t) {
checkError(request, response, t);
}
}
@Override
public void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
getConnector(request).doPut(request, response);
} catch (Throwable t) {
checkError(request, response, t);
}
}
@Override
public void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
getConnector(request).doDelete(request, response);
} catch (Throwable t) {
checkError(request, response, t);
}
}
protected void sendError(HttpServletRequest request, HttpServletResponse response, int code, String message) throws IOException {
try {
getConnector(request).createHelper(request, response).sendError(code, message);
} catch (Throwable t) {
response.sendError(code, message);
}
}
protected void sendError(HttpServletRequest request, HttpServletResponse response, int code, Throwable error) throws IOException {
try {
if (error instanceof NoSuchBeanDefinitionException)
new JsonApiHelper(request, response, getSessionContext(), null).sendError(code, "Service " + getReference(request) + " not known, please check the request path.");
else
getConnector(request).createHelper(request, response).sendError(code, error);
} catch (Throwable t) {
response.sendError(code, error.getMessage());
}
}
}
| [
"[email protected]"
] | |
250a536d40b3da4f15eaa0a7e5bbee144a9f0527 | 1fd7ee0cf4c2d259fa1422757cf92a29b5de8694 | /仓库条码新平台/ppbs/src/cc/jiuyi/dao/impl/RoleDaoImpl.java | f1ade35562d51925b0892bcb2c0742e13bf807a5 | [] | no_license | 1059027178/com.zxec.www | 8e044433181816e9bab84ecd4e67d3f61ffc5b6c | de5ca55287c402354320f95da74d3c40ced81ea0 | refs/heads/master | 2020-03-22T18:02:47.080595 | 2018-07-09T15:47:22 | 2018-07-09T15:47:22 | 140,433,065 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,327 | java | package cc.jiuyi.dao.impl;
import java.util.List;
import cc.jiuyi.dao.RoleDao;
import cc.jiuyi.entity.Role;
import org.springframework.stereotype.Repository;
/**
* Dao实现类 - 角色
*/
@Repository
public class RoleDaoImpl extends BaseDaoImpl<Role, String> implements RoleDao {
// 忽略isSystem=true的对象
@Override
public void delete(Role role) {
if (role.getIsSystem()) {
return;
}
super.delete(role);
}
// 忽略isSystem=true的对象
@Override
public void delete(String id) {
Role role = load(id);
this.delete(role);
}
// 忽略isSystem=true的对象
@Override
public void delete(String[] ids) {
if (ids != null && ids.length > 0) {
for (String id : ids) {
this.delete(id);
}
}
}
// 设置isSystem=false
@Override
public String save(Role role) {
role.setIsSystem(false);
return super.save(role);
}
// 忽略isSystem=true的对象
@Override
public void update(Role role) {
if (role.getIsSystem()) {
return;
}
super.update(role);
}
@SuppressWarnings("unchecked")
@Override
public List<Role> getList(String resourceid) {
String hql="select a from Role a join a.resourcesSet b where b.id = ?";
return getSession().createQuery(hql).setParameter(0, resourceid).list();
}
} | [
"QianYang@244d0f91-ff8a-4924-8869-ed5808972776"
] | QianYang@244d0f91-ff8a-4924-8869-ed5808972776 |
5941204348f5f6cdfc215cf0c5505889c7860d1e | e81a0f8388a3aa3d9b35d172f2b900ab790011a5 | /algorithm/src/leetcode/common/Node.java | 952ab547356a66af3f6a306ba9ae530f31e00739 | [] | no_license | xbb2yy/tutorials | e65d93d02217846813dbd99eb6f8b076521278bb | b53966a37f8e2d2a731b4395b089e8778f8eb889 | refs/heads/master | 2022-06-24T22:03:27.082758 | 2020-09-08T03:34:29 | 2020-09-08T03:34:29 | 166,727,859 | 1 | 0 | null | 2022-06-21T00:57:11 | 2019-01-21T01:09:09 | Java | UTF-8 | Java | false | false | 252 | java | package leetcode.common;
import java.util.List;
public class Node {
public int val;
public List<Node> children;
public Node() {}
public Node(int _val, List<Node> _children) {
val = _val;
children = _children;
}
} | [
"[email protected]"
] | |
45816277c87ad768da5741b8d600e77411509d03 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/29/29_659164ea6eaa193065904b7e74dd9babf37e628a/AppAdmin/29_659164ea6eaa193065904b7e74dd9babf37e628a_AppAdmin_t.java | 57b4a8e258e637a28eb18cff9a4b23b7e94ab4a0 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 1,330 | java | package edu.gatech.oad.rocket.findmythings.server.model;
import java.util.Set;
import com.googlecode.objectify.annotation.EntitySubclass;
/**
* CS 2340 - FindMyStuff Android App
* This class creates a new AppAdmin object
*
* @author TeamRocket
* */
@EntitySubclass
public class AppAdmin extends AppMember {
/**
*
*/
private static final long serialVersionUID = 1381561058937653330L;
/** Constructors **/
public AppAdmin(String email, Set<String> roles, Set<String> permissions) {
super(email, roles, permissions);
}
public AppAdmin(String email, String password, Set<String> roles,
Set<String> permissions, boolean isRegistered) {
super(email, password, roles, permissions, isRegistered);
}
public AppAdmin(String email, String password, Set<String> roles,
Set<String> permissions) {
super(email, password, roles, permissions);
}
public AppAdmin(String email, String password) {
super(email, password);
}
public AppAdmin(String email) {
super(email);
}
protected AppAdmin() {
super();
}
/** Accessors **/
@Override
public final boolean isLocked() {
return false;
}
/**
* checks if a certain member is an AppAdmin
* @return True
*/
@Override
public final boolean isAdmin() {
return true;
}
}
| [
"[email protected]"
] | |
d308d2347df6e01bca6d5959bb73571c95a92ab6 | a7829bf066a362440bf91bdc99aa2fb02a86aed0 | /src/main/java/prototype/e2_celulares/IRegistroDispositivo.java | 7d9f6320f039c25cd4c9f4b33a88276ef7b0daa7 | [] | no_license | AleS900/Design_Patterns | 8ead6e8e6e6248d6570994868e4ec0bc5feecf73 | 5b20895b6f1fea4e78bb0acfe52cb8870e5dca1b | refs/heads/main | 2023-06-11T23:26:10.925609 | 2021-06-28T12:50:52 | 2021-06-28T12:50:52 | 368,742,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 113 | java | package prototype.e2_celulares;
public interface IRegistroDispositivo extends Cloneable {
Object clone();
}
| [
"[email protected]"
] | |
411814a7e7ee2c36217d67e9c8a1e6181e5b4c40 | 250922211af2820c7e7b3402b282f4f307266b27 | /src/main/java/org/wwald/util/CourseWikiParser.java | ab76e092e3ae9f41e17cce3e708f78685e511528 | [] | no_license | openlearning/wwald | 4437ac1ccc63f670081e9fa836e5d2733a6e116d | 16ab5637340d8aec6ec7176b29b018240c01694f | refs/heads/master | 2020-05-18T20:29:44.361544 | 2011-01-21T14:06:03 | 2011-01-21T14:06:03 | 826,786 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,418 | java | package org.wwald.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
public class CourseWikiParser {
private static final Logger cLogger = Logger.getLogger(CourseWikiParser.class);
public static class CourseTitlePair {
public final String courseId;
public final String courseTitle;
public final String updatedCourseTitle;
public CourseTitlePair(String courseId,
String courseTitle) {
this(courseId, courseTitle, null);
}
public CourseTitlePair(String courseId,
String courseTitle,
String updatedCourseTitle) {
this.courseId = courseId;
this.courseTitle = courseTitle;
this.updatedCourseTitle = updatedCourseTitle;
}
}
public static class UpdateHint {
public final List<CourseTitlePair> updatedCourseTitlePairs;
public final String updatedWikiContents;
public UpdateHint(List<CourseTitlePair> courseTitlePairs,
String updatedWikiContents) {
this.updatedCourseTitlePairs = courseTitlePairs;
this.updatedWikiContents = updatedWikiContents;
}
}
public List<CourseTitlePair> parse(String wikiContent) throws ParseException {
List<CourseTitlePair> tokens = new ArrayList<CourseTitlePair>();
BufferedReader bufferedReader = new BufferedReader(new StringReader(wikiContent));
String line = null;
try {
while ((line = bufferedReader.readLine()) != null) {
if(line.trim().equals("")) {
//ignore empty lines
continue;
}
if(line.trim().startsWith("#")) {
//# denotes a comment
continue;
}
String lineTokens[] = line.split("\\|");
String courseId = lineTokens[0];
String courseTitle = lineTokens[1];
// It does not matter if the courseTitle is null, but as a rule we
// want the wikiContent
// to contain both for each course
if (courseId != null && courseTitle != null) {
CourseTitlePair ctp = null;
if(courseTitle.contains("->")) {
String titleTokens[] = courseTitle.split("->");
if(titleTokens != null && titleTokens.length == 2 && titleTokens[0] != null && titleTokens[1] != null) {
String origTitle = titleTokens[0].trim();
String updatedTitle = titleTokens[1].trim();
ctp = new CourseTitlePair(courseId.trim(), origTitle, updatedTitle);
}
}
else {
ctp = new CourseTitlePair(courseId.trim(),
courseTitle.trim());
}
tokens.add(ctp);
}
else {
String msg = "The following line is not in the expected format\n" +
"Line: '" + line + "'\n" +
"Expected format: 'courseId | course title'";
throw new ParseException(msg);
}
}
} catch(IOException ioe) {
String msg = "Could not parse the wiki contents due to an internal error";
throw new ParseException(msg);
}
return tokens;
}
public UpdateHint parseForUpdate(String wikiContent) throws ParseException {
StringBuffer updatedWikiContentBuff = new StringBuffer();
List<CourseTitlePair> tokens = new ArrayList<CourseTitlePair>();
BufferedReader bufferedReader = new BufferedReader(new StringReader(wikiContent));
String line = null;
try {
while ((line = bufferedReader.readLine()) != null) {
if(line.trim().equals("")) {
//ignore empty lines
updatedWikiContentBuff.append(line + "\n");
continue;
}
if(line.trim().startsWith("#")) {
//# denotes a comment
updatedWikiContentBuff.append(line + "\n");
continue;
}
String lineTokens[] = line.split("\\|");
String courseId = lineTokens[0];
String courseTitle = lineTokens[1];
// It does not matter if the courseTitle is null, but as a rule we
// want the wikiContent
// to contain both for each course
if (courseId != null && courseTitle != null) {
CourseTitlePair ctp = null;
if(courseTitle.contains("->")) {
String titleTokens[] = courseTitle.split("->");
if(titleTokens != null && titleTokens.length == 2 && titleTokens[0] != null && titleTokens[1] != null) {
String origTitle = titleTokens[0].trim();
String updatedTitle = titleTokens[1].trim();
ctp = new CourseTitlePair(courseId.trim(), origTitle, updatedTitle);
}
else {
String msg = "Wiki line has an incorrect syntax '" + line + "'";
cLogger.error(msg);
throw new ParseException(msg);
}
}
else {
ctp = new CourseTitlePair(courseId.trim(),
courseTitle.trim());
}
//only add those tokens which signify an update
if(ctp.updatedCourseTitle != null) {
tokens.add(ctp);
}
String newWikiLine = ctp.courseId + " | " +
(ctp.updatedCourseTitle != null ? ctp.updatedCourseTitle : ctp.courseTitle);
updatedWikiContentBuff.append(newWikiLine+"\n");
}
else {
String msg = "The following line is not in the expected format\n" +
"Line: '" + line + "'\n" +
"Expected format: 'courseId | course title'";
throw new ParseException(msg);
}
}
} catch(IOException ioe) {
String msg = "Could not parse the wiki contents due to an internal error";
throw new ParseException(msg);
}
UpdateHint updateHint = new UpdateHint(tokens,
updatedWikiContentBuff.toString());
return updateHint;
}
}
| [
"[email protected]"
] | |
a173130d08fc4d3c1804df6a11b4cafef827bf29 | 5ac764957d2787e4016c1f7564d0f4d11184b47f | /src/main/java/edu/uta/mav/beans/PhoneBean.java | 6ae475f75575c6afb75ee5665a694b3f2e27d6b9 | [] | no_license | vaibhavnaikprojects/mavericks-web-app | 760fc04790b997e28ecea55e376d408306b95c32 | d4162794305ddb0fb090244b1e0fba609eefa37e | refs/heads/master | 2021-05-07T20:31:09.727916 | 2017-10-31T01:12:11 | 2017-10-31T01:12:11 | 108,927,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,491 | java | package edu.uta.mav.beans;
public class PhoneBean {
private int phoneId;
private String phoneType;
private String telephone;
private String ext;
private String country;
private boolean preferred;
public PhoneBean(){
}
public PhoneBean(int phoneId, String phoneType, String telephone,
String ext, String country, boolean preferred) {
super();
this.phoneId = phoneId;
this.phoneType = phoneType;
this.telephone = telephone;
this.ext = ext;
this.country = country;
this.preferred = preferred;
}
public int getPhoneId() {
return phoneId;
}
public void setPhoneId(int phoneId) {
this.phoneId = phoneId;
}
public String getPhoneType() {
return phoneType;
}
public void setPhoneType(String phoneType) {
this.phoneType = phoneType;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getExt() {
return ext;
}
public void setExt(String ext) {
this.ext = ext;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public boolean getPreferred() {
return preferred;
}
public void setPreferred(boolean preferred) {
this.preferred = preferred;
}
@Override
public String toString() {
return "PhoneBean [phoneId=" + phoneId + ", phoneType=" + phoneType
+ ", telephone=" + telephone + ", ext=" + ext + ", country="
+ country + ", preferred=" + preferred + "]";
}
}
| [
"[email protected]"
] | |
236afbdbcfc23fddd2eecd8dcc3624a12241a4f4 | 4d8acc281ca1691cd4f0b5af6d58823d3a3c9d2f | /App1/src/main/java/MiProyecto/App1/InstitutoRepository.java | d84082d0a042512db49551fdc4e50fc257115523 | [] | no_license | leandrogiova/Tallerr4 | 78f2ea3f44af0e30a4cc3e18fb53589bd9af8ab6 | ac6b36127164dee8d01a4592e553b272799ade75 | refs/heads/master | 2023-06-29T21:30:50.018988 | 2021-08-11T15:13:57 | 2021-08-11T15:13:57 | 362,508,667 | 0 | 0 | null | 2021-08-11T15:13:59 | 2021-04-28T14:58:02 | Java | UTF-8 | Java | false | false | 239 | java | package MiProyecto.App1;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface InstitutoRepository extends JpaRepository<Instituto, Long>{
}
| [
"[email protected]"
] | |
5145d7832d2a883ee3b6c951c7a64ef758ccb6f3 | 2de2d3a266d6b7238a0e53ecfd45ac023da8d36b | /android/app/src/main/java/com/seller/MainApplication.java | c9a779ff183fb5df016377e96a5f3b6ac657a207 | [] | no_license | Zafarustad/Seller-RN | d6203a2938d34c8a0f555715069c61891c4c4000 | ef08f4418ea1b462f6def38371e214ed5a5f9879 | refs/heads/master | 2023-05-22T05:41:19.866195 | 2021-06-15T02:16:35 | 2021-06-15T02:16:35 | 327,621,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,781 | java | package com.seller;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import com.airbnb.android.react.lottie.LottiePackage;
import com.oblador.vectoricons.VectorIconsPackage;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new LottiePackage());
new VectorIconsPackage();
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.seller.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
8c5d688fcd8fdd8d1c97fa79ecc7e2d26d695463 | f12f8fb19ba56fc9c11f215266cd25517f79b4a6 | /src/main/java/br/com/socialmeli/dtos/user/seller/SellerFollowersDTO.java | 6622a955c3f7c30bc0cc3060a04a0a669cb5561e | [] | no_license | mlluiferreira/desafio-spring | 8a28c5c7b14f3099fe9888a0c4138e2ad1cac8f0 | 011394ca567dd9aef54f02a434c993c9d12238f0 | refs/heads/main | 2023-05-13T00:55:36.864770 | 2021-06-07T18:38:08 | 2021-06-07T18:38:08 | 372,601,716 | 0 | 0 | null | 2021-06-01T18:49:46 | 2021-05-31T18:52:07 | Java | UTF-8 | Java | false | false | 431 | java | package br.com.socialmeli.dtos.user.seller;
import br.com.socialmeli.dtos.user.UserDTO;
import br.com.socialmeli.dtos.user.client.ClientDTO;
import java.util.Set;
public class SellerFollowersDTO extends UserDTO {
public Set<ClientDTO> followers;
public Set<ClientDTO> getFollowers() {
return followers;
}
public void setFollowers(Set<ClientDTO> followers) {
this.followers = followers;
}
}
| [
"[email protected]"
] | |
69630d08c4fafe73e04ebb3e027b362b7eaeaee8 | fe6cab5a40ece97b8424fefba0e412405f5fe2ba | /src/ch/anakin/hotel_projekt/service/GaesteService.java | b9eec05174fbfa7727a0e8cfcb25d0f2a060a837 | [] | no_license | Gollum8123/Hotel_Projekt | f27c39bbdfcbc7e12c44af652a2d28490884bc51 | 1f142e2717db6bc80956473f7bb8be52fca6d405 | refs/heads/master | 2022-12-05T18:13:50.527609 | 2020-04-26T16:27:01 | 2020-04-26T16:27:01 | 292,070,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,580 | java | package ch.anakin.hotel_projekt.service;
import ch.anakin.hotel_projekt.data.DataHandler;
import ch.anakin.hotel_projekt.model.Gast;
import ch.anakin.hotel_projekt.model.Hotel;
import javax.validation.Valid;
import javax.validation.constraints.Pattern;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.NewCookie;
import javax.ws.rs.core.Response;
import java.util.Map;
import java.util.UUID;
import java.util.Vector;
/**
* short description
* <p>
* service for gast
* <p>
* Hotel_Projekt
*
* @author Anakin Kirschler
* @version 1.0
* @since 12.03.20
*/
@Path("gast")
public class GaesteService {
/**
* List gaeste response.
*
* @param userRole the user role
* @return the response
*/
@GET
@Path("list")
@Produces(MediaType.APPLICATION_JSON)
public Response listBooks(
@CookieParam("userRole") String userRole
) {
Map<String, Gast> gastMap = null;
int httpStatus;
if (userRole == null || userRole.equals("guest")) {
httpStatus = 403;
} else {
httpStatus = 200;
gastMap = DataHandler.getGastMap();
}
NewCookie cookie = new NewCookie(
"userRole",
userRole,
"/",
"",
"Login-Cookie",
600,
false
);
Response response = Response
.status(httpStatus)
.entity(gastMap)
.cookie(cookie)
.build();
return response;
}
/**
* Search gast response.
*
* @param gastUUID the gastUUID
* @param userRole the user role
* @return the response
*/
@GET
@Path("search")
@Produces(MediaType.APPLICATION_JSON)
public Response readBook(
@Pattern(regexp = "[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}")
@QueryParam("uuid") String gastUUID,
@CookieParam("userRole") String userRole
) {
Gast gast = null;
int httpStatus;
if (userRole == null || userRole.equals("guest")) {
httpStatus = 403;
} else {
gast = DataHandler.getGastMap().get(gastUUID);
if (gast != null) {
httpStatus = 200;
} else {
httpStatus = 404;
}
}
NewCookie cookie = new NewCookie(
"userRole",
userRole,
"/",
"",
"Login-Cookie",
600,
false
);
Response response = Response
.status(httpStatus)
.entity(gast)
.cookie(cookie)
.build();
return response;
}
/**
* Create gast response.
*
* @param gast the gast
* @param userRole the user role
* @return the response
*/
@POST
@Path("create")
@Produces(MediaType.TEXT_PLAIN)
public Response createBook(
@Valid @BeanParam Gast gast,
@CookieParam("userRole") String userRole
) {
int httpStatus;
if (userRole != null && userRole.equals("admin")) {
httpStatus = 200;
gast.setGastUUID(UUID.randomUUID().toString());
Map<String, Gast> gastMap = DataHandler.getGastMap();
gastMap.put(gast.getGastUUID(), gast);
DataHandler.writeGaeste(gastMap);
} else {
httpStatus = 403;
}
NewCookie cookie = new NewCookie(
"userRole",
userRole,
"/",
"",
"Login-Cookie",
600,
false
);
Response response = Response
.status(httpStatus)
.entity("")
.cookie(cookie)
.build();
return response;
}
/**
* Delete book response.
*
* @param gastUUID the gastUUID
* @param userRole the user role
* @return the response
*/
@DELETE
@Path("delete")
@Produces(MediaType.TEXT_PLAIN)
public Response deleteBook(
@Pattern(regexp = "[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}")
@QueryParam("uuid") String gastUUID,
@CookieParam("userRole") String userRole
) {
int httpStatus;
if (userRole != null && userRole.equals("admin")) {
Map<String, Gast> gastMap = DataHandler.getGastMap();
Gast gast = gastMap.get(gastUUID);
if (gast != null) {
httpStatus = 200;
gastMap.remove(gastUUID);
DataHandler.writeGaeste(gastMap);
} else {
httpStatus = 404;
}
} else {
httpStatus = 403;
}
NewCookie cookie = new NewCookie(
"userRole",
userRole,
"/",
"",
"Login-Cookie",
600,
false
);
Response response = Response
.status(httpStatus)
.entity("")
.cookie(cookie)
.build();
return response;
}
/**
* Update book response.
*
* @param gast the gast
* @param userRole the user role
* @return the response
*/
@PUT
@Path("update")
@Produces(MediaType.TEXT_PLAIN)
public Response updateBook(
@Valid @BeanParam Gast gast,
@CookieParam("userRole") String userRole
) {
int httpStatus;
if (userRole != null && userRole.equals("admin")) {
Map<String, Gast> gastMap = DataHandler.getGastMap();
if (gastMap.containsKey(gast.getGastUUID())) {
gastMap.put(gast.getGastUUID(), gast);
DataHandler.writeGaeste(gastMap);
httpStatus = 200;
} else {
httpStatus = 404;
}
} else {
httpStatus = 403;
}
NewCookie cookie = new NewCookie(
"userRole",
userRole,
"/",
"",
"Login-Cookie",
600,
false
);
Response response = Response
.status(httpStatus)
.entity("")
.cookie(cookie)
.build();
return response;
}
}
| [
"[email protected]"
] | |
53a2889fb27c531dfdbd482f68e087fccfe20450 | c5176581b8f944e88af897d401b99696e9e3d84e | /seleniumWebDriver/src/test/java/bringItOn/pages/NewPastePage.java | 31dc107a42332634ffef923c992209685fabf02c | [] | no_license | StasTitorenko/Second_Stage_Tasks | 4c9fa5f8d7d961735d95255b4ba27942173c5ee1 | 04e3c6b45b57c1002193944b4b68d1672869d3dd | refs/heads/main | 2023-08-27T19:44:07.042701 | 2021-11-10T08:39:29 | 2021-11-10T08:39:29 | 413,741,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | package bringItOn.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class NewPastePage extends AbstractPage{
@FindBy(xpath = "//div[@class='info-top']/*")
private WebElement pasteName;
@FindBy(xpath = "//div[@class='left']/*")
private WebElement pasteSyntax;
@FindBy(xpath = "//textarea")
private WebElement resultData;
public NewPastePage(WebDriver driver, WebDriverWait wait, Actions actions) {
super(driver, wait, actions);
}
public String getNewPasteName() {
wait.until(ExpectedConditions.visibilityOf(pasteName));
return pasteName.getText();
}
public String getNewPasteSyntax() {
return pasteSyntax.getText();
}
public String getNewPasteCode() {
return resultData.getText();
}
}
| [
"[email protected]"
] | |
5f5c22885fea9991c0c3b166b1235bf2f34eab4c | 1dab227f0ca0ec224521ab0cd531c8c8a4221e73 | /core/src/com/mygames/flappybird/FlappyBird.java | 75d357a6c51eb80bf120a4b543ad4639f66306f3 | [
"MIT"
] | permissive | Tup0lev/Flappy-Bird-Game-Android | 1165d0cb5d2bf2cdd2fd2f4cd053aadc1b9be4df | e7df85c06ab350d208973f030eda442c03032676 | refs/heads/master | 2023-05-09T19:39:40.041455 | 2021-06-06T20:12:09 | 2021-06-06T20:12:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | package com.mygames.flappybird;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.mygames.flappybird.config.Assets;
import com.mygames.flappybird.config.Settings;
import com.mygames.flappybird.screens.MainMenuScreen;
public class FlappyBird extends Game {
private SpriteBatch batch;
@Override
public void create () {
batch = new SpriteBatch();
Assets.load();
setScreen(new MainMenuScreen(this));
}
@Override
public void render () {
super.render();
}
@Override
public void dispose () {
batch.dispose();
}
public SpriteBatch getGameBatch() {
return batch;
}
}
| [
"[email protected]"
] | |
121d193914ba87bed30554a6a31c8e6f646ece39 | fb4f08e1f9d41d8f9cfd40072b6c5e1f59303885 | /src/creational/factorymethod/figura/QuadradoFactory.java | bf852cafb4a1feb8693fc2f5a45a23c81eed29dc | [] | no_license | ReinanS/Design-Patterns | 0188e4007d6f91de7e08e6ac628b447eeff90bfb | 47414ba0d0cf99a8ac4e6f719838741661c62b5a | refs/heads/master | 2023-08-06T08:39:09.904171 | 2021-10-09T18:16:27 | 2021-10-09T18:16:27 | 412,876,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package creational.factorymethod.figura;
public class QuadradoFactory extends FiguraFactory {
@Override
FiguraIF criarFigura() {
// TODO Auto-generated method stub
return new Quadrado();
}
}
| [
"[email protected]"
] | |
c3a482c2778e494873f4b68e2a3c2daa0fa3d364 | 530f2ceaf933ca4f8e9dc57b69f8fb1260646906 | /src/main/java/com/snal/dataloader/MetaDataLoader.java | a3ab44f00e34002c3eb63fa39cdc5ff3aab48a85 | [] | no_license | taonlyt/ModelHelper | 5d6cf8c7a6fbf8b45c41b2855800ae73da1886be | e1ac49b709d4280304c265b41a934a470ca527e2 | refs/heads/master | 2021-01-19T18:20:54.647536 | 2017-08-23T09:38:57 | 2017-08-23T09:38:57 | 101,125,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,271 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.snal.dataloader;
import com.snal.util.excel.BigExcelUtil;
import com.snal.beans.Table;
import com.snal.beans.TenantAttribute;
import com.snal.beans.TableCol;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author luotao
*/
public class MetaDataLoader {
/**
* 加载元数据 key:表名 value:表信息
*
* @param metaDataFile
* @param tenantMap
* @param startsheet
* @param endsheet
* @param mincolumns
* @return
* @throws java.lang.Exception
*/
public Map<String, Table> loadMetaData(String metaDataFile, Map<String, TenantAttribute> tenantMap,
int startsheet, int endsheet, int[] mincolumns) throws Exception {
BigExcelUtil bigExlUtil = new BigExcelUtil();
Map<String, List<List<String>>> metadata = bigExlUtil.readExcelData(metaDataFile, startsheet, endsheet, mincolumns);
List<List<String>> tableIndxList = metadata.get("0");//第一个工作表格,模型索引
List<List<String>> tableStructList = metadata.get("1");//第二个工作表格,模型结构
Map<String, Table> metaDataMap = new HashMap();
for (int i = 1; i < tableIndxList.size(); i++) {
List<String> row = tableIndxList.get(i);
Table table = createTable(row, tenantMap);
table.setLineId(i);
table.setMainTable(true);
metaDataMap.put(table.getTableName(), table);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
String currentMonth = sdf.format(new Date());
for (int j = 1; j < tableStructList.size(); j++) {
List<String> row = tableStructList.get(j);
TableCol tableCol = createTableCol(row, currentMonth);
tableCol.setLineId(j);
Table mainTable = metaDataMap.get(tableCol.getTableName());
if (mainTable != null) {
mainTable.addTableCol(tableCol);
tableCol.setTableId(mainTable.getTableId());
} else {
System.out.println("【模型索引】中缺少[模型名:" + tableCol.getTableName() + "][行号:" + tableCol.getLineId() + "]");
}
}
/**
* 将模型分区字段添加到模型字段列表中。
*/
for (String tablename : metaDataMap.keySet()) {
Table table = metaDataMap.get(tablename);
if (table.getTablecols() == null) {
System.out.println("[警告] " + tablename + " 模型未定义字段.");
continue;
}
TableCol tablecol0 = table.getTablecols().get(0);
int colcount = table.getTablecols().size();
String[] partitioncosl = table.getPartitionCols();
int partitionseq = 0;
for (String colname : partitioncosl) {
if (colname == null || colname.isEmpty()) {
continue;
}
TableCol tablecol = tablecol0.clone();
tablecol.setColumnName(colname);
tablecol.setColumnNameZh(transPartitionName(colname));
tablecol.setColumnSeq(String.valueOf(++colcount));
if (colname.equalsIgnoreCase("branch") && table.isMainTable()) {
tablecol.setDataType("STRING");
} else if (colname.equalsIgnoreCase("month") || colname.equalsIgnoreCase("day")
|| colname.equalsIgnoreCase("year") || colname.equalsIgnoreCase("week")
|| colname.equalsIgnoreCase("ds") || colname.equals("hour")) {
tablecol.setDataType("INT");
}
tablecol.setColumnId(tablecol.getTableName() + "_201610" + tablecol.getColumnSeq());
tablecol.setPartitionSeq(String.valueOf(++partitionseq));
tablecol.setIsPrimaryKey("");
tablecol.setIsNullable("N");
tablecol.setSecurityType3("");
tablecol.setSensitivityLevel("");
tablecol.setOutSensitivityId("");
tablecol.setRemark("");
tablecol.setOpenState("");
table.addTableCol(tablecol);
}
}
return metaDataMap;
}
private String transPartitionName(String colname) {
String name = colname;
if (colname.equalsIgnoreCase("branch")) {
name = "地市";
} else if (colname.equalsIgnoreCase("month")) {
name = "月份";
} else if (colname.equalsIgnoreCase("day")) {
name = "日期";
} else if (colname.equalsIgnoreCase("year")) {
name = "年份";
} else if (colname.equalsIgnoreCase("week")) {
name = "周";
} else if (colname.equalsIgnoreCase("ds")) {
name = "数据源";
} else if (colname.equalsIgnoreCase("hour")) {
name = "小时";
}
return name;
}
private TableCol createTableCol(List<String> tablecolumn, String currentMonth) {
TableCol tablecol = new TableCol();
int i = 0;
tablecol.setDbType(tablecolumn.get(i++));
tablecol.setTableName(tablecolumn.get(i++));
tablecol.setTableId(tablecol.getTableName());//模型标识
tablecol.setColumnSeq(tablecolumn.get(i++));
tablecol.setColumnId(tablecol.getTableName() + "_" + currentMonth + tablecol.getColumnSeq());//字段标识
tablecol.setColumnName(tablecolumn.get(i++));
tablecol.setColumnNameZh(tablecolumn.get(i++));
tablecol.setDataType(tablecolumn.get(i++));
tablecol.setLength(tablecolumn.get(i++));
tablecol.setPrecision(tablecolumn.get(i++));
tablecol.setPartitionSeq(tablecolumn.get(i++));
tablecol.setIsPrimaryKey(tablecolumn.get(i++));
tablecol.setPartKeyForPrimaryKey(tablecolumn.get(i++));
tablecol.setIsNullable(tablecolumn.get(i++));
tablecol.setRemark(tablecolumn.get(i++));
if (tablecol.getRemark() != null && tablecol.getRemark().length() > 4000) {
tablecol.setRemark(tablecol.getRemark().substring(0, 4000));
}
tablecol.setOpenState(tablecolumn.get(i++));
tablecol.setSecurityType3(tablecolumn.get(i++));
tablecol.setSensitivityLevel(tablecolumn.get(i++));
if (tablecol.getSensitivityLevel() == null || tablecol.getSensitivityLevel().trim().length() == 0) {
switch (tablecol.getSecurityType3()) {
case "C1-1":
case "C1-5":
case "D1-7":
case "D2-3":
case "D2-4":
case "D3-5": {
tablecol.setSensitivityLevel("1");
break;
}
case "C1-3":
case "C2-1":
case "C2-2":
case "D1-3":
case "D1-6":
case "D2-2":
case "D3-4":
case "D3-6": {
tablecol.setSensitivityLevel("2");
break;
}
case "A1-1":
case "A1-2":
case "A1-3":
case "B1-1":
case "B1-2":
case "C1-2":
case "C1-4":
case "D1-2":
case "D1-5":
case "D1-8":
case "D2-1":
case "D3-3":
case "D4-1":
case "D4-2": {
tablecol.setSensitivityLevel("3");
break;
}
case "A1-4":
case "A1-5":
case "A2-1":
case "D1-1":
case "D1-4":
case "D3-1":
case "D3-2": {
tablecol.setSensitivityLevel("4");
break;
}
default: {
break;
}
}
}
tablecol.setOutSensitivityId(tablecolumn.get(i++));
return tablecol;
}
public boolean checkTableColumn(Table table, List<String> hiveKeywords) {
boolean isValid = true;
Pattern pattern = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9_]*$");
List<TableCol> tablecolumns = table.getTablecols();
if (tablecolumns != null) {
List<String> colunnames = new ArrayList(tablecolumns.size());
for (TableCol column : tablecolumns) {
Matcher matcher = pattern.matcher(column.getColumnName());
if (!matcher.find()) {
System.out.println("[错误]" + column.getTableName() + "." + column.getColumnName() + " 字段名不正确!");
isValid = false;
}
// if (!isValidColumnName(column.getColumnName())) {
// System.out.println("[错误]" + column.getTableName() + "." + column.getColumnName() + " 字段名不正确!");
// isValid = false;
// }
if (!colunnames.contains(column.getColumnName())) {
colunnames.add(column.getColumnName());
} else {
System.out.println("[错误]" + table.getTableName() + "." + column.getColumnName() + " 字段重复!");
isValid = false;
}
if (hiveKeywords.contains(column.getColumnName())) {
System.out.println("[错误]" + table.getTableName() + "." + column.getColumnName() + " 属于语法关键字!");
isValid = false;
}
}
}
return isValid;
}
/**
* 检查字段是否为有效字段名
*
* @param columName
* @return
*/
private boolean isValidColumnName(String columName) {
if (columName.contains(" ")) {
return false;
}
for (int i = 0; i < columName.length(); i++) {
if (isContainChineseChar(columName.charAt(i))) {
return false;
}
}
return true;
}
/**
* 判断字符串是否包含中文
*
* @param c
* @return
*/
private boolean isContainChineseChar(char c) {
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
return ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS;
}
private Table createTable(List<String> tableindx, Map<String, TenantAttribute> tenantMap) throws Exception {
Table table = new Table();
int i = 0;
table.setMainTable(true);
table.setDataDomain(tableindx.get(i++));
table.setDbType(tableindx.get(i++));
table.setDbName(tableindx.get(i++));
table.setTableName(tableindx.get(i++));
/**
* 模型 XMLID 不直接从EXCEL中读取,代码固话,减少excel填写工作。
*/
table.setTableId(table.getTableName());
table.setTableNameZh(tableindx.get(i++));
table.setTableModel(tableindx.get(i++));
if (table.getTableModel() == null || table.getTableModel().trim().length() == 0) {
throw new Exception(table.getTableName() + " 表模式不能为空");
}
if (!table.getTableNameZh().startsWith(table.getTableModel() + "_")) {
table.setTableNameZh(table.getTableModel() + "_" + table.getTableNameZh());
}
table.setState(tableindx.get(i++));
table.setCycleType(tableindx.get(i++));
table.setTopicName(tableindx.get(i++));
table.setTopicCode(tableindx.get(i++));
table.setTenantUser(tableindx.get(i++));
table.setColDelimiter(tableindx.get(i++));
String partcols = tableindx.get(i++);
if (partcols.equalsIgnoreCase("NA")) {
partcols = "";
}
table.setPartitionCols(partcols);
table.setStoredFormat(tableindx.get(i++));
if (table.getStoredFormat().equalsIgnoreCase("TEXTFILE")) {
if (table.getColDelimiter().equals("\\001")
|| table.getColDelimiter().equals("\t")
|| table.getColDelimiter().length() == 1
|| table.getColDelimiter().startsWith("0x")) {
table.setSerdeClass("org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe");
} else {
table.setSerdeClass("org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe");
}
} else if (table.getStoredFormat().equalsIgnoreCase("ORC")) {
table.setSerdeClass("org.apache.hadoop.hive.ql.io.orc.OrcSerde");
} else if (table.getStoredFormat().equals("PARQUET")) {
table.setSerdeClass("org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe");
} else {
table.setSerdeClass("org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe");
}
table.setCharacterSet(tableindx.get(i++));
// table.setSerdeClass(tableindx.get(i++));//取消从excel读取,因为excel经常有人填错。
table.setRightlevel(tableindx.get(i++));
table.setCreater(tableindx.get(i++));
table.setCurdutyer(tableindx.get(i++));
table.setEffDate(tableindx.get(i++));
table.setStateDate(tableindx.get(i++));
table.setOpenState(tableindx.get(i++));
table.setRemark(tableindx.get(i++));
if ("HIVE".equals(table.getDbType())) {
//table.setIsVIP218(tableindx.get(i++));已经无用处
table.setShared(tableindx.get(i++));
table.setConstantParam(tableindx.get(i++));
//table.setHasJobConf(tableindx.get(i++));已经无用处
//table.setInterfaceTable(tableindx.get(i++));已经无用处
table.setShareAllDataToCity(tableindx.get(i++));
/**
* 设置模型其他属性
*/
TenantAttribute tenantAttr = tenantMap.get(table.getTenantUser());
table.setLocation(tenantAttr.getLocation() + "/" + table.getTableModel()+ "/" + table.getTableName());
table.setDbServName(tenantAttr.getDbserver());
table.setTeamCode(tenantAttr.getTeamcode());
/**
* {"EXTERNAL":"y","LOCATION":"/tenant/BIGDATA/JCFW/JRCL/BD_B/STAGE/TS_BASS_NBRGRP","FILEFORMAT":"TEXTFILE","DELIMITER":"@#$"}
* {"EXTERNAL":"y",,"LOCATION":"/tenant/BIGDATA/JCFW/JRCL/BD_B/STAGE/TS_O_HSH_ECCOUPON_ALLOT_D","FILEFORMAT":"TEXTFILE","DELIMITER":"|"}
*/
StringBuilder sbdbuff = new StringBuilder();
sbdbuff.append("{\"EXTERNAL\":\"y\",")
.append("\"LOCATION\":\"")
.append(table.getLocation()).append("\",")
.append("\"FILEFORMAT\":\"")
.append(table.getStoredFormat()).append("\",")
.append("\"DELIMITER\":\"")
.append(table.getColDelimiter()).append("\"}");
table.setExtendcfg(sbdbuff.toString());
}
table.setState("NEW");
table.setOpenState("");
return table;
}
}
| [
""
] | |
7510304bf730ff7c5b0794d130b1959a9dae723d | 497c15af5abf8e3493c4238a07d07bbc3685e86a | /src/no/systema/tvinn/sad/nctsexport/model/jsonjackson/topic/items/JsonSadNctsExportSpecificTopicItemSecurityRecord.java | 9709554e50805a1ae19e2b7ef112f46734e51a3e | [] | no_license | SystemaAS/espedsgtvinnsad | 0d37b6a282793f88c2c08c3db0980b6bab5cdfd7 | 77812a19cb7319444b16a2033a9432c592f01abb | refs/heads/master | 2023-08-22T16:58:54.994691 | 2023-08-22T11:44:32 | 2023-08-22T11:44:32 | 128,168,457 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,905 | java | /**
*
*/
package no.systema.tvinn.sad.nctsexport.model.jsonjackson.topic.items;
import java.lang.reflect.Field;
import java.util.*;
import no.systema.main.model.jsonjackson.general.JsonAbstractGrandFatherRecord;
/**
* @author oscardelatorre
* @date Mar 13, 2016
*
*/
public class JsonSadNctsExportSpecificTopicItemSecurityRecord extends JsonAbstractGrandFatherRecord {
//---------
//Sikkerhet
//---------
private String tvavd = null;
public void setTvavd(String value) { this.tvavd = value; }
public String getTvavd() { return this.tvavd;}
private String tvtdn = null;
public void setTvtdn(String value) { this.tvtdn = value; }
public String getTvtdn() { return this.tvtdn;}
private String tvli = null;
public void setTvli(String value) { this.tvli = value; }
public String getTvli() { return this.tvli;}
private String tvtkbm = null;
public void setTvtkbm(String value) { this.tvtkbm = value; }
public String getTvtkbm() { return this.tvtkbm;}
private String tvkref = null;
public void setTvkref(String value) { this.tvkref = value; }
public String getTvkref() { return this.tvkref;}
private String tvfgkd = null;
public void setTvfgkd(String value) { this.tvfgkd = value; }
public String getTvfgkd() { return this.tvfgkd;}
private String tvknss = null;
public void setTvknss(String value) { this.tvknss = value; }
public String getTvknss() { return this.tvknss;}
private String tvnass = null;
public void setTvnass(String value) { this.tvnass = value; }
public String getTvnass() { return this.tvnass;}
private String tvadss1 = null;
public void setTvadss1(String value) { this.tvadss1 = value; }
public String getTvadss1() { return this.tvadss1;}
private String tvpnss = null;
public void setTvpnss(String value) { this.tvpnss = value; }
public String getTvpnss() { return this.tvpnss;}
private String tvpsss = null;
public void setTvpsss(String value) { this.tvpsss = value; }
public String getTvpsss() { return this.tvpsss;}
private String tvlkss = null;
public void setTvlkss(String value) { this.tvlkss = value; }
public String getTvlkss() { return this.tvlkss;}
private String tvskss = null;
public void setTvskss(String value) { this.tvskss = value; }
public String getTvskss() { return this.tvskss;}
private String tvtinss = null;
public void setTvtinss(String value) { this.tvtinss = value; }
public String getTvtinss() { return this.tvtinss;}
private String tvknks = null;
public void setTvknks(String value) { this.tvknks = value; }
public String getTvknks() { return this.tvknks;}
private String tvnaks = null;
public void setTvnaks(String value) { this.tvnaks = value; }
public String getTvnaks() { return this.tvnaks;}
private String tvadks1 = null;
public void setTvadks1(String value) { this.tvadks1 = value; }
public String getTvadks1() { return this.tvadks1;}
private String tvpnks = null;
public void setTvpnks(String value) { this.tvpnks = value; }
public String getTvpnks() { return this.tvpnks;}
private String tvpsks = null;
public void setTvpsks(String value) { this.tvpsks = value; }
public String getTvpsks() { return this.tvpsks;}
private String tvlkks = null;
public void setTvlkks(String value) { this.tvlkks = value; }
public String getTvlkks() { return this.tvlkks;}
private String tvskks = null;
public void setTvskks(String value) { this.tvskks = value; }
public String getTvskks() { return this.tvskks;}
private String tvtinks = null;
public void setTvtinks(String value) { this.tvtinks = value; }
public String getTvtinks() { return this.tvtinks;}
/**
*
* @return
* @throws Exception
*/
public List<Field> getFields() throws Exception{
Class cl = Class.forName(this.getClass().getCanonicalName());
Field[] fields = cl.getDeclaredFields();
List<Field> list = Arrays.asList(fields);
return list;
}
}
| [
"[email protected]"
] | |
fe4911be13d219ea3124bde24aab50cdf04cc946 | dbb9a275810e26b9ed93e983f9f0e845eb0f9315 | /plato-model/src/main/java/eu/scape_project/planning/model/interfaces/actions/IEmulationAction.java | bbe3e47b0c67a5bce115511b95cc39af7e3532ef | [
"Apache-2.0"
] | permissive | openpreserve/plato | 524519487e525a8af3ccdb73f7db337de37786db | 10d9fc276c23c773a6a346af8312e48c50ac8755 | refs/heads/master | 2022-07-21T04:36:35.362929 | 2015-05-22T18:30:14 | 2015-05-22T18:30:14 | 4,406,463 | 2 | 2 | Apache-2.0 | 2022-07-07T22:53:28 | 2012-05-22T12:35:23 | Java | UTF-8 | Java | false | false | 1,428 | java | /*******************************************************************************
* Copyright 2006 - 2012 Vienna University of Technology,
* Department of Software Technology and Interactive Systems, IFS
*
* 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.
*
* This work originates from the Planets project, co-funded by the European Union under the Sixth Framework Programme.
******************************************************************************/
package eu.scape_project.planning.model.interfaces.actions;
import eu.scape_project.planning.model.PlatoException;
import eu.scape_project.planning.model.PreservationActionDefinition;
import eu.scape_project.planning.model.SampleObject;
public interface IEmulationAction extends IPreservationAction {
String startSession(PreservationActionDefinition action,
SampleObject sampleObject) throws PlatoException;
}
| [
"[email protected]"
] | |
2529ac3265b598aa7aabd94fe76b2bb744cdbce6 | 5b9d231e32b5da0ae0fdd930ab70cd5904ce65b0 | /src/java/com/dailydibba/model/getAllCity.java | 6149d79e0a834fe7c82a6d2ab1b66ce6818fd19d | [] | no_license | mehulkaklotar/DailyDabba | 7a2fbd00b0acd7652effe9eec13e7536c18a991d | 28f99f03390f3f65060cbe1e61c03e7677e31bfc | refs/heads/master | 2020-05-17T07:58:42.333769 | 2013-12-04T15:09:31 | 2013-12-04T15:09:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.dailydibba.model;
import com.dailydibba.action.Action;
import com.dailydibba.bean.Administrator;
import com.dailydibba.bean.City;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author kaklo
*/
public class getAllCity implements Action{
@Override
public String execute(HttpServletRequest req, HttpServletResponse res) {
Administrator objAdministrator = new Administrator();
List<City> cities=objAdministrator.getAllCity();
req.setAttribute("cities", cities);
return "city.jsp";
}
}
| [
"[email protected]"
] | |
933e75c9c36f2b239124965d33937aa2a353f485 | 2973def1f5a133eba6cd5b65b1732ea35541db83 | /src/unicom/web/UserInfoPrepareImportServlet.java | ff5d84d6fad5c62ffca23c098649216e36bda617 | [] | no_license | shawnye/xdsl | 1528a72ac6d1bc512b2bb80e3875e9c471ec4953 | b4747523c4a9a6d16382b8144d1dfa377699acec | refs/heads/master | 2020-04-22T09:11:50.609192 | 2014-03-06T02:48:41 | 2014-03-06T02:48:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | package unicom.web;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class UserInfoPrepareImportServlet
*/
public class UserInfoPrepareImportServlet extends BaseServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public UserInfoPrepareImportServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
boolean b = super.checkPrivilege(request, response, "用户信息导入功能需要写权限.", 2);
if(b){
return;
}
request.getRequestDispatcher("/WEB-INF/userInfoImport.jsp").forward(request, response);
}
}
| [
"[email protected]"
] | |
053fe4fa6032697594b0eeb23984afb2e0fdfff1 | a0c60a13fbb006332126c666090bae11cdffbc43 | /src/main/java/br/com/totvs/testeSelecao/domain/Item.java | 0840dcfd7184a315eae05319b131f417fad7405f | [] | no_license | marzari/listenerFlatFilesTotvs | e7e3f662fd25d79f463dbc7c967a78a8241ffb1e | 0e6b89b6f137793c63a3443b8857b2e56f8201b7 | refs/heads/master | 2020-03-27T14:54:08.003558 | 2018-08-30T15:33:43 | 2018-08-30T15:33:43 | 146,685,624 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,758 | java | package br.com.totvs.testeSelecao.domain;
import java.math.BigDecimal;
/**
* @author tiago marzari
* @since 29/08/2018
*/
public class Item {
private Long idItem;
private Integer quantity;
private BigDecimal cost;
/**
* @param idItem
* @param quantity
* @param cost
*/
public Item(String idItem, String quantity, String cost) {
super();
this.idItem = Long.parseLong(idItem);
this.quantity = Integer.parseInt(quantity);
this.cost = new BigDecimal(cost);
}
/**
* @return the idItem
*/
public final Long getIdItem() {
return idItem;
}
/**
* @param idItem the idItem to set
*/
public final void setIdItem(Long idItem) {
this.idItem = idItem;
}
/**
* @return the quantity
*/
public final Integer getQuantity() {
return quantity;
}
/**
* @param quantity the quantity to set
*/
public final void setQuantity(Integer quantity) {
this.quantity = quantity;
}
/**
* @return the cost
*/
public final BigDecimal getCost() {
return cost;
}
/**
* @param cost the cost to set
*/
public final void setCost(BigDecimal cost) {
this.cost = cost;
}
@Override
public String toString() {
return "Item [idItem=" + idItem + ", quantity=" + quantity + ", cost=" + cost + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((cost == null) ? 0 : cost.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Item other = (Item) obj;
if (cost == null) {
if (other.cost != null)
return false;
} else if (!cost.equals(other.cost))
return false;
return true;
}
}
| [
"[email protected]"
] | |
25edc4cd79bc640e229d4a3b61752b0bfec6577e | 8ad68b6853c81e862db1c31f17fd3bc881676e7a | /src/main/java/com/pritesh/target/model/ConfigConstants.java | 92ea17d4939266c1e8c52897c94b046812ce64b6 | [] | no_license | pritesh15/callcenter | 9f37015bd8c7c12cda835f21017f8f16dc8bf4bf | d8b4f0e159076962b140c395ce9e72684c4ab2ce | refs/heads/master | 2021-07-24T21:01:37.641782 | 2017-11-06T20:10:08 | 2017-11-06T20:10:08 | 109,593,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.pritesh.target.model;
/**
* Created by pripatha on 11/5/2017.
*/
public class ConfigConstants {
public final static int JUNIOR_EXECUTIVES = 5;
public final static int SENIOR_EXECUTIVES = 3;
public final static int DURATION_LIMIT_JE = 7;
public final static int DURATION_LIMIT_SE= 10;
public final static int DURATION_LIMIT_MGR = 15;
}
| [
"[email protected]"
] | |
6abb9ff49f18794d58c7113656b664c2f639aa84 | d427d4810c63b39da08c5290484f9b58c0d52410 | /servlet01/src/com/javalec/ex1/Ex_ServletInitParam_2.java | a41210fb82cd8b637f369d95a34208d26afa700a | [] | no_license | JaySurplusYoon/JSP_Servlet | b4e73f80f6380eb612d953ef7e3b2cde01a8f1b5 | a6fca2facd637348c37af31555e2b35a5b5079e0 | refs/heads/master | 2021-01-15T23:30:36.738776 | 2017-08-15T06:34:10 | 2017-08-15T06:34:10 | 99,472,336 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 3,375 | java | package com.javalec.ex1;
import java.io.IOException;
import java.io.PrintWriter;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/* web.xml에 입력하여 불러오는 방법
* Servlet클래스 제작 > web.xml에 기술 > ServletConfig클래스 이용하여 데이터불러옴
* (해당 클래스가 ServletConfig클래스를 이미 상속받고있으므로 바로 getInitParameter 활용)
* 서블릿 초기화 파라미터 : 특정 Servlet생성시 초기 필요한 데이터(ex 아이디, 특정경로) =>ServletConfig클래스
*
* 1)web.xml기술
<servlet>
<servlet-name>ServletInitParam</servlet-name>
<servlet-class>com.javalec.ex1.ServletInitParam</servlet-class>
<init-param>
<param-name>id</param-name>
<param-value>abc123</param-value>
</init-param>
<init-param>
<param-name>password</param-name>
<param-value>1234</param-value>
</init-param>
<init-param>
<param-name>path</param-name>
<param-value>C:\\javalec\\workspace</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ServletInitParam</servlet-name>
<url-pattern>/InitParam</url-pattern>
</servlet-mapping>
* 초기화 파라미터를 web.xml이 아닌 Servlet파일에 직접기술도 가능
*
*/
/**
* Servlet implementation class Config_Context_Listener
*/
//@WebServlet("/ccl")
public class Ex_ServletInitParam_2 extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Ex_ServletInitParam_2() {
super();
// TODO Auto-generated constructor stub
}
@PostConstruct
private void post_construct() {
System.out.println("PostConstruct 선처리");
}
@Override
public void init(ServletConfig config) throws ServletException {
// TODO Auto-generated method stub
super.init(config);
System.out.println("init()호출");
}
@Override
public void destroy() {
// TODO Auto-generated method stub
super.destroy();
System.out.println("destroy()호출");
}
@PreDestroy
public void pre_destroy() {
System.out.println("PreDestroy 후처리");
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
//ServletConfig필요없이 바로 getInitOParameter메서드 활용(이미 상속받고있으므로 ServerConfig치고 cntl+t로 확인가능)
String id = getInitParameter("id");
String pw = getInitParameter("pw");
String path = getInitParameter("path");
resp.setContentType("text/html; charset=UTF-8");
PrintWriter writer = resp.getWriter();
writer.println("<html><head></head><body>");
writer.println("아이디 :"+ id +"<br>");
writer.println("비밀번호 :"+ pw +"<br>");
writer.println("경로 :"+ path +"<br>");
writer.println("</body></html>");
writer.close();
}
}
| [
"[email protected]"
] | |
5f33501282ad0bb635c5a08ecffe439243105f44 | b8f392f5d714be026be1e6efba95d6600a6abd2b | /200319JAVA/src/sample3.java | 8299d3f53ad431a2d6a272a426caff8b78be166b | [] | no_license | koalakid1/java-study | ac5ef04cb06f895fe73581d6433cc0824cb0d9eb | 73c181abb5b485bd46812b32da617b57e8b1f72c | refs/heads/master | 2021-03-28T16:55:35.390422 | 2020-05-27T08:58:26 | 2020-05-27T08:58:26 | 247,879,262 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 393 | java | import java.util.Scanner;
public class sample3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("정수를 5개 입력하세요.");
int sum = 0;
for (int i = 0; i < 5; i++) {
int n = sc.nextInt();
if (n<=0) {
continue;
}
sum += n;
}
System.out.println("양수의 합은" + sum);
sc.close();
}
} | [
"[email protected]"
] | |
d0f4951b741a58d952d607f509acaf84a0ce3024 | 0cdebd5fa8e49b07aa7a06deb45b4957c188606e | /zdata-ias Maven Webapp/src/main/java/com/zdata/controller/SysRoleInfoController.java | 72f8cc8cf26bbc7201f13a12ccd54f68265b72a2 | [] | no_license | dfvips/Big-data | 720ea5366b251ce5557bded74f0259afed40d5fd | 67691e5001ac4f8672b1875ee24f1a2e97632b55 | refs/heads/main | 2023-03-26T09:29:44.298271 | 2021-03-25T11:09:29 | 2021-03-25T11:09:29 | 351,406,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,713 | java | package com.zdata.controller;
import java.util.Map;
import com.zdata.service.SysRoleInfoService;
import com.zdata.util.ResponseUtil;
@Controller
@RequestMapping("/sysRoleInfo")
public class SysRoleInfoController {
@Resource
private SysRoleInfoService sysRoleInfoService;
@RequestMapping("/findByRoleId")
public void findByRoleId(
@RequestParam(value = "roleId", required = false) Integer roleId,
@RequestParam(value = "rows", required = false) Integer rows,
@RequestParam(value = "page", required = false) Integer page,
HttpServletResponse response) throws Exception {
Map<String, Object> map = sysRoleInfoService.findByRoleId(roleId,page,rows);
JSONObject result = JSONObject.parseObject(JSON.toJSONString(map));
ResponseUtil.write(result, response);
}
@RequestMapping("/delete")
public void delete(
@RequestParam(value = "ids[]", required = false) Integer[] ids,
@RequestParam(value = "userIds[]", required = false) String[] userIds,
@RequestParam(value = "roleId", required = false) Integer roleId,
HttpServletResponse response) throws Exception {
Map<String, Object> map = sysRoleInfoService.delete(ids,userIds,roleId);
JSONObject result = JSONObject.parseObject(JSON.toJSONString(map));
ResponseUtil.write(result, response);
}
@RequestMapping("/saveUsers")
public void saveUsers(@RequestParam(value = "users[]", required = false)String[] users,
@RequestParam(value = "roleId", required = false)Integer roleId,
HttpServletResponse response) throws Exception{
Map<String, Object> map = sysRoleInfoService.saveUsers(users, roleId);
JSONObject result = JSONObject.parseObject(JSON.toJSONString(map));
ResponseUtil.write(result, response);
}
}
| [
"[email protected]"
] | |
d8927a10a433cf316afbb0899cfb68ca53661fd1 | 42ba67a82cf980f70c3c9649f74d502e0458fe86 | /src/main/java/tradeManagementSystem/model/QuantityUnit.java | 6d7553fd269030b4f8b237122d02254b5af1cb91 | [] | no_license | kerwinxu/TradeManagementSystem | 46e9b9adb648a203b7746388f943dd9e3674d58a | 4a68aa4f0fd369fe317d0a70954d4086020c0156 | refs/heads/master | 2023-08-06T08:38:22.815485 | 2021-10-10T03:30:33 | 2021-10-10T03:30:33 | 408,105,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | package tradeManagementSystem.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Getter;
import lombok.Setter;
// 数量单位表
@Entity
@Setter
@Getter
@Table(name = "quantity_unit")
public class QuantityUnit {
@Id
@GeneratedValue
private Integer id; // id
@Column(length = 20)
private String name;
}
| [
"[email protected]"
] | |
72342abfd2fd6d1c49722738b8c290a3060fb562 | b9ed2aa03a5f6aff9278c5db7c4ca097be6e15a2 | /app/src/androidTest/java/com/boostbrain/brainbooster/ExampleInstrumentedTest.java | b119cba58c29e178bf6e30f58cac4f609a705e30 | [] | no_license | supremo4031/BrainBooster | ec69a9a147a5f9af686fa173b2616f3329ef2401 | eb66853d5c24ffb599e69286a79f0f8d15b955aa | refs/heads/master | 2023-02-01T14:31:18.366638 | 2020-12-18T15:22:25 | 2020-12-18T15:22:25 | 275,383,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.boostbrain.brainbooster;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.boostbrain.brainbooster", appContext.getPackageName());
}
} | [
"[email protected]"
] | |
d0b261eaa73f80303fa3197c427b62120f8b3e98 | 358588de52a2ad83dc30418b0b022ba121d060db | /src/test/java/com/victormeng/leetcode/ji_qi_ren_de_yun_dong_fan_wei_lcof/Tester.java | d5a8b134472816d19c891a70d553135cd8725c48 | [
"MIT"
] | permissive | victormeng24/LeetCode-Java | c53e852ea47049328397e4896319edd0ce0cf48a | 16bc2802e89d5c9d6450d598f0f41a7f6261d7b6 | refs/heads/master | 2023-08-05T02:33:18.990663 | 2021-02-04T13:31:48 | 2021-02-04T13:31:48 | 327,479,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,140 | java | /**
* Leetcode - ji_qi_ren_de_yun_dong_fan_wei_lcof
*/
package com.victormeng.leetcode.ji_qi_ren_de_yun_dong_fan_wei_lcof;
import java.util.*;
import com.ciaoshen.leetcode.util.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(Parameterized.class)
public class Tester {
/**=========================== static for every test cases ============================== */
// Solution instance to test
private static Solution solution;
// use this Object to print the log (call from slf4j facade)
private static final Logger LOGGER = LoggerFactory.getLogger(TesterRunner.class);
/** Execute once before any of the test methods in this class. */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
/* uncomment to switch solutions */
solution = new Solution1();
// solution = new Solution2();
}
/** Execute once after all of the test methods are executed in this class. */
@AfterClass
public static void tearDownAfterClass() throws Exception {}
/** Initialize test cases */
@Parameters
public static Collection<Object[]> testcases() {
return Arrays.asList(new Object[][]{
// {}, // test case 1 (init parameters below: {para1, para2, expected})
// {}, // test case 2 (init parameters below: {para1, para2, expected})
// {} // test case 3 (init parameters below: {para1, para2, expected})
});
}
/**=========================== for each test case ============================== */
/**
* Parameters for each test (initialized in testcases() method)
* You can change the type of parameters
*/
// private Object para1; // parameter 1
// private Object para2; // parameter 2
// private Object expected; // parameter 3 (expected answer)
/** This constructor must be provided to run parameterized test. */
public Tester(Object para1, Object para2, Object expected) {
// initialize test parameters
// this.para1 = para1;
// this.para2 = para2;
// this.expected = expected;
}
/** Execute before each test method in this class is executed. */
@Before
public void setUp() throws Exception {}
/** Executed as a test case. */
@Test
public void test() {
//
// Object actual = solution.your-method(para1, para2);
//
// assertThat(actual, is(equalTo(expected)));
//
// if (LOGGER.isDebugEnabled()) {
// LOGGER.debug("your-method() pass unit test!");
// }
}
/** Execute after each test method in this class is executed. */
@After
public void tearDown() throws Exception {}
}
| [
"[email protected]"
] | |
dc79877d8c89524ce7968d647d5aa77c612653eb | fcdec0b49c1b0200c9d981d2e94b576250e065db | /Optalinew/app/src/main/java/com/app/optali/ListeActivity.java | 41d5330b045922f613eacdbfff96c3207086edaa | [] | no_license | FrancoisLefevre12/Optali | 6c67f96ce6dd7510253c4bb129ac2ec5ed3344c5 | 8dbe918ba78e03b6af696931f7c05714cc5d257a | refs/heads/master | 2021-01-11T17:40:22.675101 | 2017-05-15T16:40:04 | 2017-05-15T16:40:04 | 79,818,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,249 | java | package com.app.optali;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ListeActivity extends AppCompatActivity implements View.OnClickListener {
public static final String TAG = "ListeActivity.java";
public static final String REGISTER_DELETE_URL = "http://89.80.34.165/optali/delete.php";
public static final String REGISTER_CONSUME_URL = "http://89.80.34.165/optali/consume.php";
public static final String KEY_PRODUCT = "Product";
public static final String KEY_DATE = "Date";
public static final int REFRESH_TIME = 300;
public int nbre;
private List<Produit> arrayList;
private Button bSuppr;
private Button bConsume;
private EditText eFindProduct;
private RadioGroup radioGroup;
private RadioButton radioName;
private RadioButton radioDate;
private RadioButton radioStock;
private RadioButton radioHisto;
private RadioButton radioSuppr;
private String rech;
private int intRadio;
private TableLayout tableLayout;
private CheckBox[] checkBox;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.liste_alim);
nbre=0;
// Initialisation buttons
bSuppr = (Button) findViewById(R.id.suppr);
bSuppr.setOnClickListener(this);
bConsume = (Button) findViewById(R.id.consume);
bConsume.setOnClickListener(this);
// Initialisation EditText
eFindProduct = (EditText) findViewById(R.id.recherche_produit);
// Initialisation RadioButton
radioGroup = (RadioGroup) findViewById(R.id.rdGroup);
radioName = (RadioButton) findViewById(R.id.triNom);
radioName.setOnClickListener(this);
radioDate = (RadioButton) findViewById(R.id.triDate);
radioDate.setOnClickListener(this);
radioStock = (RadioButton) findViewById(R.id.triStock);
radioStock.setOnClickListener(this);
radioHisto = (RadioButton) findViewById(R.id.trihisto);
radioHisto.setOnClickListener(this);
radioSuppr = (RadioButton) findViewById(R.id.triSuppr);
radioSuppr.setOnClickListener(this);
tableLayout = (TableLayout) findViewById(R.id.table);
checkBox = new CheckBox[100];
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
doAndRefresh();
// A chaque changement de text, actualiser la liste
eFindProduct.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//Rien a faire
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
//Rien a faire
}
@Override
public void afterTextChanged(Editable s) {
rech=eFindProduct.getText().toString();
refreshList();
}
});
// A chaque changement de radiobouton, actualiser la liste.
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if(checkedId==R.id.triNom){
intRadio=0;
}
if(checkedId==R.id.triDate){
intRadio=1;
}
if(checkedId==R.id.triStock){
intRadio=2;
}
if(checkedId==R.id.trihisto){
intRadio=3;
}
// On indique la condition de tri
for (Produit prod : arrayList){
prod.setOrder(intRadio);
}
refreshList();
if(checkedId==R.id.triSuppr){
checkall();
}
}
});
}
// méthodes
public void doAndRefresh(){
// Récupération du tableau de produit
Etat.getInstance(ListeActivity.this).sendData();
this.arrayList=Etat.getInstance(ListeActivity.this).getList();
final Handler handler = new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run(){
// Après REFRESH_TIME millisecondes, on refresh la liste.
refreshList();
}
},REFRESH_TIME);
}
public void checkall(){
int i;
for(i=0;i<nbre;i++){
checkBox[i].setChecked(true);
}
}
public void onClick(View v) {
if (v.getId() == R.id.suppr) {
for(int i=0;i<nbre;i++){
if(checkBox[i].isChecked()) {
delete(arrayList.get(i).getNom(),arrayList.get(i).getDate(),REGISTER_DELETE_URL);
}
}
}
if (v.getId() == R.id.consume) {
for(int i=0;i<nbre;i++) {
if (checkBox[i].isChecked()) {
if (arrayList.get(i).getStock().compareTo("0") > 0) {
delete(arrayList.get(i).getNom(), arrayList.get(i).getDate(), REGISTER_CONSUME_URL);
}
}
}
}
}
public void refreshList(){
// On remplace les produits utilisés par des symboles de vide au niveau des dates
for(Produit produit : arrayList){
if(Integer.parseInt(produit.getStock())<=0){
produit.setDate("Pas de Date");
}
}
// On trie la liste
Collections.sort(arrayList);
tableLayout.removeAllViews();
nbre=0;
for(Produit produit : arrayList){
if(rech!=null){
if(produit.getNom().startsWith(rech)) {
createRow(produit.getNom(),produit.getDate(),produit.getStock(),produit.getHistorique(),nbre);
nbre++;
}
}
else{
createRow(produit.getNom(),produit.getDate(),produit.getStock(),produit.getHistorique(),nbre);
nbre++;
}
}
}
// Methode d'envoi de la date et du produit au server.
private void delete(String dnom, String ddate, String REGISTER) {
final String product = dnom;
final String date = ddate;
StringRequest stringRequest = new StringRequest(Request.Method.POST, REGISTER,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(ListeActivity.this,response,Toast.LENGTH_LONG).show();
doAndRefresh();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(ListeActivity.this,error.toString(),Toast.LENGTH_LONG).show();
}
}){
@Override
protected Map<String,String> getParams(){
Map<String,String> params = new HashMap<String, String>();
params.put(KEY_PRODUCT,product);
params.put(KEY_DATE,date);
return params;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(ListeActivity.this);
requestQueue.add(stringRequest);
}
public void createRow(String s1, String s2, String s3, String s4, int nbre){
// On crée une ligne avec les paramètres match_parent
final TableRow tableRow = new TableRow (this);
tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT));
// Création d'un textView du nom
final TextView tProduct = new TextView(this);
tProduct.setText(s1);
tProduct.setLayoutParams(new TableRow.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT));
// Création d'un textView de la date
final TextView tDate = new TextView(this);
tDate.setText(s2);
tDate.setLayoutParams(new TableRow.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT));
// Création d'un textView du Stock
final TextView tStock= new TextView(this);
tStock.setText(s3);
tStock.setLayoutParams(new TableRow.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT));
// Création d'un textView de l'historique
final TextView tHisto= new TextView(this);
tHisto.setText(s4);
tHisto.setLayoutParams(new TableRow.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT));
// Création d'un Checkbox
checkBox[nbre]= new CheckBox(this);
tHisto.setLayoutParams(new TableRow.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT));
tableRow.addView(tProduct);
tableRow.addView(tDate);
tableRow.addView(tStock);
tableRow.addView(tHisto);
tableRow.addView(checkBox[nbre]);
tableLayout.addView(tableRow);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.