blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f6e63fb0c4e8fa95fbdddb3bf4ec2a266a37bc32 | 74d680f2693b433c3d9e5abaf80b774f51d37bef | /src/com/tuzki/dao/BaseDAO.java | 29ef344357715e481e0c3598bad35e2549885e51 | [] | no_license | zhiquan181/chbbs | cb519074ecd5ec656b335746cf98d327c36468c4 | 661f2242747ce1c39dbc49a577e1a3c54ffd5941 | refs/heads/master | 2020-05-03T09:15:08.546736 | 2019-04-29T07:38:17 | 2019-04-29T07:38:17 | 178,549,200 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.tuzki.dao;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
public class BaseDAO {
private SessionFactory sessionFactory;
public SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public Session getSession(){
Session session=sessionFactory.openSession();
return session;
}
} | [
"zhiquan181@163.com"
] | zhiquan181@163.com |
3388e797496ecbaccb77c3e502f043a414403377 | a357731515df72776edfc9ee61a59b10d1b657fd | /src/main/java/ertyu.java | b8fc73a92bcc46d2643e267b4aa1648bd339863b | [] | no_license | Hohol01/test | ff44035eec4ce78ef074d9bd57f5ce700aba4c7c | ebe92d2d2d03d8eea404d5ec16eb9ad8a69f44a3 | refs/heads/master | 2023-06-25T00:02:26.083587 | 2021-07-23T08:52:56 | 2021-07-23T08:52:56 | 373,305,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | import db.DBManager;
import java.sql.Connection;
import java.sql.SQLException;
public class ertyu {
public static void main(String[] args) {
}
}
| [
"380559a@gmail.com"
] | 380559a@gmail.com |
30e42dac1b815a0630ba1f7e85ecde5d87064603 | 7b84b0ef1bace0e213ec1ddadb263f83622afba5 | /BookStoreManagementApp-1/src/main/java/com/cg/bookstore/exceptions/CategoryException.java | 985de7502283b953a31b820477bdb8c0962b63dc | [] | no_license | sahil0205/BookStoreManagement | 41d6173de7d6180e78bc9e03ac8394d9a225e36d | 1745ac91a02c2d2ba25da4c5cab9bad314739339 | refs/heads/main | 2023-04-11T15:35:47.189093 | 2021-04-29T06:52:29 | 2021-04-29T06:52:29 | 362,164,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 213 | java | package com.cg.bookstore.exceptions;
public class CategoryException extends RuntimeException {
public CategoryException(String message) {
// TODO Auto-generated constructor stub
super(message);
}
}
| [
"SAPALASK@LIN51011983.corp.capgemini.com"
] | SAPALASK@LIN51011983.corp.capgemini.com |
cfd4e02a65043f133f11bd2bf70cf8a2989e8834 | 54ac224ef19764257dd737ca83e370af690ab2d4 | /entity/src/main/java/com/lky/dto/BannerDto.java | d099feec5c034d3f6a4166e1d5b2cf57d99d45e7 | [] | no_license | kanchairen/king-test | 626ed87b026681efefac2a4eac2189fa51fb1391 | 42621cc93a84e0b338e2b79083a84591f854c1a6 | refs/heads/master | 2023-02-17T06:18:58.637723 | 2019-11-10T13:07:00 | 2019-11-10T13:07:00 | 171,207,418 | 0 | 0 | null | 2023-02-09T20:11:14 | 2019-02-18T03:20:38 | JavaScript | UTF-8 | Java | false | false | 771 | java | package com.lky.dto;
import com.lky.entity.Banner;
import io.swagger.annotations.ApiModelProperty;
/**
* bannerDto 增加是否为积分商城
*
* @author huangjingang
* @version 1.0
* @since 2018/1/12
*/
public class BannerDto extends Banner {
@ApiModelProperty(notes = "目标开通小米商城")
private Boolean openRPoint;
@ApiModelProperty(notes = "目标开通G米商城")
private Boolean openWPoint;
public Boolean getOpenRPoint() {
return openRPoint;
}
public void setOpenRPoint(Boolean openRPoint) {
this.openRPoint = openRPoint;
}
public Boolean getOpenWPoint() {
return openWPoint;
}
public void setOpenWPoint(Boolean openWPoint) {
this.openWPoint = openWPoint;
}
}
| [
"544363956@qq.com"
] | 544363956@qq.com |
c38c44d9dfc3ec7aab8a89a90ddbfce800b335c7 | d6f7652cd47c6759544ed78bfbcf4e548e0ecb64 | /src/uts/if2/pkg10119077/ridhwananwarfauzan/no3/DeathCoreKepiting.java | 31b94418f1d43915c60a2a4edada92db21238131 | [] | no_license | RidhwanAF/UTS-IF2-10119077-RIDHWANANWARFAUZAN-no3 | 01dedac6cc404b343a62a3b79c6a0e77e687f137 | 3ea8cbbf6d4b4705b96792a91dc41d77b4f2ba0d | refs/heads/master | 2023-01-22T21:11:31.854848 | 2020-12-04T14:53:55 | 2020-12-04T14:53:55 | 318,547,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | 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 uts.if2.pkg10119077.ridhwananwarfauzan.no3;
/**
*
* @author RAF
*/
public class DeathCoreKepiting {
public void genreDeathCoreKepiting(String artistName){
}
}
| [
"RAF@DESKTOP-K6RM0SH"
] | RAF@DESKTOP-K6RM0SH |
c8db5902b3abdb892589bab4bb9aace3cbd07061 | 739355457fd3d8a5d1d03b12429dd480760ff148 | /src/cn/ucai/chatuidemo/utils/ImageCache.java | ee8a033d4b9e479f7d8ea89f73a7d67f44df0f39 | [
"Apache-2.0"
] | permissive | lijie233/superwechat201607 | 0f39c3fba1b299852892b2cdcdaf52215787c7be | 76042add602cdea607f1b8d6a5039962366128c7 | refs/heads/master | 2020-12-25T15:18:16.025895 | 2016-07-29T02:39:42 | 2016-07-29T02:39:42 | 63,669,925 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,648 | java | /**
* Copyright (C) 2013-2014 EaseMob Technologies. 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.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ucai.chatuidemo.utils;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
public class ImageCache {
private ImageCache() {
// use 1/8 of available heap size
cache = new LruCache<String, Bitmap>((int) (Runtime.getRuntime().maxMemory() / 8)) {
@Override
protected int sizeOf(String key, Bitmap value) {
return value.getRowBytes() * value.getHeight();
}
};
}
private static ImageCache imageCache = null;
public static synchronized ImageCache getInstance() {
if (imageCache == null) {
imageCache = new ImageCache();
}
return imageCache;
}
private LruCache<String, Bitmap> cache = null;
/**
* put bitmap to image cache
* @param key
* @param value
* @return the puts bitmap
*/
public Bitmap put(String key, Bitmap value){
return cache.put(key, value);
}
/**
* return the bitmap
* @param key
* @return
*/
public Bitmap get(String key){
return cache.get(key);
}
}
| [
"771706409@qq.com"
] | 771706409@qq.com |
fefb77d1fa9c4840193bacb0bd267a299f53b0d9 | 7be2183a61b922a279ebb09ffe7365d60c786048 | /src/Currency.java | e90631a447bd945da16b840372d2a895a00c1eda | [] | no_license | fjiang-ecm/Adventure | c460e3a6a55b4a34924131c627633e69053d5a65 | c26ebb6c314f49180220688167a512fe166b5bc7 | refs/heads/master | 2023-05-23T19:54:35.272634 | 2021-06-06T19:16:50 | 2021-06-06T19:16:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,434 | java | /*
A currency is a portable object that a player can create with less
valuable ones.
*/
public class Currency extends PortableObject {
private final String type;
public Currency(String type) {
super();
this.type = type;
}
public Currency(String type, int quantity) {
super(quantity);
this.type = type;
}
@Override
public String getType() {
return type;
}
/*
Buy portable object with coins
*/
public PortableObject buy(String transformed) {
if (type.equals("coin")) {
switch (transformed) {
case "key":
remove(2);
return new Key();
case "gold":
remove(5);
return new Currency("gold");
case "diamond":
remove(15);
return new Currency("diamond");
default:
throw new IllegalArgumentException(("You can only buy keys, gold or diamond!\n"));
}
} else {
throw new IllegalArgumentException(("You can only use coin to buy something!\n"));
}
}
/*
Print the commends involving currencies.
*/
public static void help() {
System.out.println("Buy (key | gold | diamond) with coin : Buy 1 key, gold or diamond with 2, 5 or 15 coins\n");
}
}
| [
"francois.jiang@centrale-marseille.fr"
] | francois.jiang@centrale-marseille.fr |
0287fec7f07983f0f9fa3c4031cc4cc878559489 | b4fda041a64fe5aa0741f7429ea4284a7a819098 | /src/equippingcharacters/items/FootWear.java | 2d19e1371a61cf2bbab0a8956d0a0fb8492397e7 | [] | no_license | nikhilfeb95/RPGEquipFunctionality | 76849090f10c77734ad51a6601646a17026b1da4 | 6bab624d02489dd4ade7beeae77a1ae6fd3e4e91 | refs/heads/master | 2023-06-16T17:41:26.480461 | 2021-07-14T19:36:37 | 2021-07-14T19:36:37 | 386,056,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,228 | java | package equippingcharacters.items;
import java.util.Objects;
/**
* A class which represents the footwear of the character.
*/
public final class FootWear extends AbstractItem implements OffensiveItem {
private final int offensiveStat;
/**
* The constructor for the footWear --> footwears only have an offensive stat.
*
* @param name The name of the item.
* @param isCursed Whether the item is cursed.
* @param health The number of usages of the item.
* @param offensiveStat The offensive stat of the item.
*/
public FootWear(String name, boolean isCursed, int health, int offensiveStat) {
super(name, isCursed, health);
this.offensiveStat = offensiveStat;
}
@Override
public int getOffensiveStat() {
return this.isCursed() && this.offensiveStat > 0 ? -this.offensiveStat : offensiveStat;
}
@Override
protected boolean equalsFootWear(FootWear footWear) {
return this.getName() == footWear.getName()
&& this.getOffensiveStat() == footWear.getOffensiveStat();
}
@Override
public boolean equals(Object obj) {
if (obj instanceof AbstractItem) {
AbstractItem abstractItem = (AbstractItem) obj;
return abstractItem.equalsFootWear(this);
}
return false;
}
@Override
public int compareTo(Items o) {
if (o instanceof FootWear) {
FootWear footWear = (FootWear) o;
if (this.offensiveStat > footWear.offensiveStat) {
return 1;
}
if (this.offensiveStat == footWear.offensiveStat) {
return 0;
}
return -1;
}
return 1;
}
@Override
protected boolean checkTypeFootWear(Items item) {
return true;
}
@Override
public boolean checkType(Items item) {
if (item instanceof AbstractItem) {
AbstractItem abstractItem = (AbstractItem) item;
return abstractItem.checkTypeFootWear(abstractItem);
}
return false;
}
@Override
public String toString() {
return String.format("FootWear Item; Name : %s; Health %d; Cursed : %s; Attack %d",
this.getName(), this.getItemHealth(), this.isCursed(), this.getOffensiveStat());
}
@Override
public int hashCode() {
return Objects.hashCode(this);
}
}
| [
"nikhil.mollay@gmail.com"
] | nikhil.mollay@gmail.com |
7b8704181a32e2eb2daa38e38eeb484afcdbc74d | c87bb3b51ce2cdee80f1ed2c0ff7c611ad036a9c | /taskmanager/src/main/java/it/uniroma3/siw/taskmanager/repository/CredentialsRepository.java | f366efc6855776c82ce75914ee4c78c09bcca14b | [] | no_license | paolomastroo/progetto | 6284791f92f040869af9c351549a9bf52a394e13 | 510c94529768a5ca362c966a0eac991aa8a28b5c | refs/heads/master | 2022-10-31T07:32:39.913721 | 2020-06-18T16:47:51 | 2020-06-18T16:47:51 | 273,275,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package it.uniroma3.siw.taskmanager.repository;
import java.util.Optional;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import it.uniroma3.siw.taskmanager.model.Credentials;
@Repository
public interface CredentialsRepository extends CrudRepository<Credentials, Long>{
public Optional<Credentials> findByUsername(String username);
}
| [
"noreply@github.com"
] | noreply@github.com |
8bf1f2536efd7c9de52532f2cce9f8eeaf52b64b | 15710c5ac7cb8ad4358f55f3eea88fcc6796d8f1 | /ODE_Tooladapter/ThriftContract/ODEThriftContract/gen_Thrift_ODE/java/thriftContract/TDDIAbstractFailureAnalysisArtifact.java | fbe2dc130cb2965ef1de54efb318c9304d6fd5ca | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | permissive | DEIS-Project-EU/DDI-Scripting-Tools | 88da26baca23924f625d16c0a66a91afc8cee1e0 | a234b7f25500080a421685d4692e8a5b20033b2e | refs/heads/master | 2021-07-01T08:51:05.675539 | 2021-06-18T06:46:50 | 2021-06-18T06:46:50 | 169,675,373 | 7 | 1 | MIT | 2021-06-18T06:46:50 | 2019-02-08T02:34:12 | C# | UTF-8 | Java | false | true | 19,723 | java | /**
* Autogenerated by Thrift Compiler (0.11.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package thriftContract;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2018-08-13")
public class TDDIAbstractFailureAnalysisArtifact implements org.apache.thrift.TBase<TDDIAbstractFailureAnalysisArtifact, TDDIAbstractFailureAnalysisArtifact._Fields>, java.io.Serializable, Cloneable, Comparable<TDDIAbstractFailureAnalysisArtifact> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDDIAbstractFailureAnalysisArtifact");
private static final org.apache.thrift.protocol.TField USED_FAILURE_ANALYSIS_ARTIFACT_FIELD_DESC = new org.apache.thrift.protocol.TField("UsedFailureAnalysisArtifact", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField USED_FAILURE_ANALYSIS_ARTIFACT_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("UsedFailureAnalysisArtifactType", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TDDIAbstractFailureAnalysisArtifactStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TDDIAbstractFailureAnalysisArtifactTupleSchemeFactory();
public TDDIFailureAnalysisArtifactUnion UsedFailureAnalysisArtifact; // required
/**
*
* @see TDDIFailureAnalysisArtifactUnionType
*/
public TDDIFailureAnalysisArtifactUnionType UsedFailureAnalysisArtifactType; // 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 {
USED_FAILURE_ANALYSIS_ARTIFACT((short)1, "UsedFailureAnalysisArtifact"),
/**
*
* @see TDDIFailureAnalysisArtifactUnionType
*/
USED_FAILURE_ANALYSIS_ARTIFACT_TYPE((short)2, "UsedFailureAnalysisArtifactType");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
static {
for (_Fields field : java.util.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 1: // USED_FAILURE_ANALYSIS_ARTIFACT
return USED_FAILURE_ANALYSIS_ARTIFACT;
case 2: // USED_FAILURE_ANALYSIS_ARTIFACT_TYPE
return USED_FAILURE_ANALYSIS_ARTIFACT_TYPE;
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 java.lang.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(java.lang.String name) {
return byName.get(name);
}
private final short _thriftId;
private final java.lang.String _fieldName;
_Fields(short thriftId, java.lang.String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public java.lang.String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.USED_FAILURE_ANALYSIS_ARTIFACT, new org.apache.thrift.meta_data.FieldMetaData("UsedFailureAnalysisArtifact", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TDDIFailureAnalysisArtifactUnion.class)));
tmpMap.put(_Fields.USED_FAILURE_ANALYSIS_ARTIFACT_TYPE, new org.apache.thrift.meta_data.FieldMetaData("UsedFailureAnalysisArtifactType", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TDDIFailureAnalysisArtifactUnionType.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDDIAbstractFailureAnalysisArtifact.class, metaDataMap);
}
public TDDIAbstractFailureAnalysisArtifact() {
}
public TDDIAbstractFailureAnalysisArtifact(
TDDIFailureAnalysisArtifactUnion UsedFailureAnalysisArtifact,
TDDIFailureAnalysisArtifactUnionType UsedFailureAnalysisArtifactType)
{
this();
this.UsedFailureAnalysisArtifact = UsedFailureAnalysisArtifact;
this.UsedFailureAnalysisArtifactType = UsedFailureAnalysisArtifactType;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public TDDIAbstractFailureAnalysisArtifact(TDDIAbstractFailureAnalysisArtifact other) {
if (other.isSetUsedFailureAnalysisArtifact()) {
this.UsedFailureAnalysisArtifact = new TDDIFailureAnalysisArtifactUnion(other.UsedFailureAnalysisArtifact);
}
if (other.isSetUsedFailureAnalysisArtifactType()) {
this.UsedFailureAnalysisArtifactType = other.UsedFailureAnalysisArtifactType;
}
}
public TDDIAbstractFailureAnalysisArtifact deepCopy() {
return new TDDIAbstractFailureAnalysisArtifact(this);
}
@Override
public void clear() {
this.UsedFailureAnalysisArtifact = null;
this.UsedFailureAnalysisArtifactType = null;
}
public TDDIFailureAnalysisArtifactUnion getUsedFailureAnalysisArtifact() {
return this.UsedFailureAnalysisArtifact;
}
public TDDIAbstractFailureAnalysisArtifact setUsedFailureAnalysisArtifact(TDDIFailureAnalysisArtifactUnion UsedFailureAnalysisArtifact) {
this.UsedFailureAnalysisArtifact = UsedFailureAnalysisArtifact;
return this;
}
public void unsetUsedFailureAnalysisArtifact() {
this.UsedFailureAnalysisArtifact = null;
}
/** Returns true if field UsedFailureAnalysisArtifact is set (has been assigned a value) and false otherwise */
public boolean isSetUsedFailureAnalysisArtifact() {
return this.UsedFailureAnalysisArtifact != null;
}
public void setUsedFailureAnalysisArtifactIsSet(boolean value) {
if (!value) {
this.UsedFailureAnalysisArtifact = null;
}
}
/**
*
* @see TDDIFailureAnalysisArtifactUnionType
*/
public TDDIFailureAnalysisArtifactUnionType getUsedFailureAnalysisArtifactType() {
return this.UsedFailureAnalysisArtifactType;
}
/**
*
* @see TDDIFailureAnalysisArtifactUnionType
*/
public TDDIAbstractFailureAnalysisArtifact setUsedFailureAnalysisArtifactType(TDDIFailureAnalysisArtifactUnionType UsedFailureAnalysisArtifactType) {
this.UsedFailureAnalysisArtifactType = UsedFailureAnalysisArtifactType;
return this;
}
public void unsetUsedFailureAnalysisArtifactType() {
this.UsedFailureAnalysisArtifactType = null;
}
/** Returns true if field UsedFailureAnalysisArtifactType is set (has been assigned a value) and false otherwise */
public boolean isSetUsedFailureAnalysisArtifactType() {
return this.UsedFailureAnalysisArtifactType != null;
}
public void setUsedFailureAnalysisArtifactTypeIsSet(boolean value) {
if (!value) {
this.UsedFailureAnalysisArtifactType = null;
}
}
public void setFieldValue(_Fields field, java.lang.Object value) {
switch (field) {
case USED_FAILURE_ANALYSIS_ARTIFACT:
if (value == null) {
unsetUsedFailureAnalysisArtifact();
} else {
setUsedFailureAnalysisArtifact((TDDIFailureAnalysisArtifactUnion)value);
}
break;
case USED_FAILURE_ANALYSIS_ARTIFACT_TYPE:
if (value == null) {
unsetUsedFailureAnalysisArtifactType();
} else {
setUsedFailureAnalysisArtifactType((TDDIFailureAnalysisArtifactUnionType)value);
}
break;
}
}
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case USED_FAILURE_ANALYSIS_ARTIFACT:
return getUsedFailureAnalysisArtifact();
case USED_FAILURE_ANALYSIS_ARTIFACT_TYPE:
return getUsedFailureAnalysisArtifactType();
}
throw new java.lang.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 java.lang.IllegalArgumentException();
}
switch (field) {
case USED_FAILURE_ANALYSIS_ARTIFACT:
return isSetUsedFailureAnalysisArtifact();
case USED_FAILURE_ANALYSIS_ARTIFACT_TYPE:
return isSetUsedFailureAnalysisArtifactType();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that == null)
return false;
if (that instanceof TDDIAbstractFailureAnalysisArtifact)
return this.equals((TDDIAbstractFailureAnalysisArtifact)that);
return false;
}
public boolean equals(TDDIAbstractFailureAnalysisArtifact that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_UsedFailureAnalysisArtifact = true && this.isSetUsedFailureAnalysisArtifact();
boolean that_present_UsedFailureAnalysisArtifact = true && that.isSetUsedFailureAnalysisArtifact();
if (this_present_UsedFailureAnalysisArtifact || that_present_UsedFailureAnalysisArtifact) {
if (!(this_present_UsedFailureAnalysisArtifact && that_present_UsedFailureAnalysisArtifact))
return false;
if (!this.UsedFailureAnalysisArtifact.equals(that.UsedFailureAnalysisArtifact))
return false;
}
boolean this_present_UsedFailureAnalysisArtifactType = true && this.isSetUsedFailureAnalysisArtifactType();
boolean that_present_UsedFailureAnalysisArtifactType = true && that.isSetUsedFailureAnalysisArtifactType();
if (this_present_UsedFailureAnalysisArtifactType || that_present_UsedFailureAnalysisArtifactType) {
if (!(this_present_UsedFailureAnalysisArtifactType && that_present_UsedFailureAnalysisArtifactType))
return false;
if (!this.UsedFailureAnalysisArtifactType.equals(that.UsedFailureAnalysisArtifactType))
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((isSetUsedFailureAnalysisArtifact()) ? 131071 : 524287);
if (isSetUsedFailureAnalysisArtifact())
hashCode = hashCode * 8191 + UsedFailureAnalysisArtifact.hashCode();
hashCode = hashCode * 8191 + ((isSetUsedFailureAnalysisArtifactType()) ? 131071 : 524287);
if (isSetUsedFailureAnalysisArtifactType())
hashCode = hashCode * 8191 + UsedFailureAnalysisArtifactType.getValue();
return hashCode;
}
@Override
public int compareTo(TDDIAbstractFailureAnalysisArtifact other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.valueOf(isSetUsedFailureAnalysisArtifact()).compareTo(other.isSetUsedFailureAnalysisArtifact());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUsedFailureAnalysisArtifact()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.UsedFailureAnalysisArtifact, other.UsedFailureAnalysisArtifact);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.valueOf(isSetUsedFailureAnalysisArtifactType()).compareTo(other.isSetUsedFailureAnalysisArtifactType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUsedFailureAnalysisArtifactType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.UsedFailureAnalysisArtifactType, other.UsedFailureAnalysisArtifactType);
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 {
scheme(iprot).read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
scheme(oprot).write(oprot, this);
}
@Override
public java.lang.String toString() {
java.lang.StringBuilder sb = new java.lang.StringBuilder("TDDIAbstractFailureAnalysisArtifact(");
boolean first = true;
sb.append("UsedFailureAnalysisArtifact:");
if (this.UsedFailureAnalysisArtifact == null) {
sb.append("null");
} else {
sb.append(this.UsedFailureAnalysisArtifact);
}
first = false;
if (!first) sb.append(", ");
sb.append("UsedFailureAnalysisArtifactType:");
if (this.UsedFailureAnalysisArtifactType == null) {
sb.append("null");
} else {
sb.append(this.UsedFailureAnalysisArtifactType);
}
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, java.lang.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 TDDIAbstractFailureAnalysisArtifactStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TDDIAbstractFailureAnalysisArtifactStandardScheme getScheme() {
return new TDDIAbstractFailureAnalysisArtifactStandardScheme();
}
}
private static class TDDIAbstractFailureAnalysisArtifactStandardScheme extends org.apache.thrift.scheme.StandardScheme<TDDIAbstractFailureAnalysisArtifact> {
public void read(org.apache.thrift.protocol.TProtocol iprot, TDDIAbstractFailureAnalysisArtifact 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 1: // USED_FAILURE_ANALYSIS_ARTIFACT
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.UsedFailureAnalysisArtifact = new TDDIFailureAnalysisArtifactUnion();
struct.UsedFailureAnalysisArtifact.read(iprot);
struct.setUsedFailureAnalysisArtifactIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // USED_FAILURE_ANALYSIS_ARTIFACT_TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.UsedFailureAnalysisArtifactType = thriftContract.TDDIFailureAnalysisArtifactUnionType.findByValue(iprot.readI32());
struct.setUsedFailureAnalysisArtifactTypeIsSet(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, TDDIAbstractFailureAnalysisArtifact struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.UsedFailureAnalysisArtifact != null) {
oprot.writeFieldBegin(USED_FAILURE_ANALYSIS_ARTIFACT_FIELD_DESC);
struct.UsedFailureAnalysisArtifact.write(oprot);
oprot.writeFieldEnd();
}
if (struct.UsedFailureAnalysisArtifactType != null) {
oprot.writeFieldBegin(USED_FAILURE_ANALYSIS_ARTIFACT_TYPE_FIELD_DESC);
oprot.writeI32(struct.UsedFailureAnalysisArtifactType.getValue());
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class TDDIAbstractFailureAnalysisArtifactTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public TDDIAbstractFailureAnalysisArtifactTupleScheme getScheme() {
return new TDDIAbstractFailureAnalysisArtifactTupleScheme();
}
}
private static class TDDIAbstractFailureAnalysisArtifactTupleScheme extends org.apache.thrift.scheme.TupleScheme<TDDIAbstractFailureAnalysisArtifact> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, TDDIAbstractFailureAnalysisArtifact struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet optionals = new java.util.BitSet();
if (struct.isSetUsedFailureAnalysisArtifact()) {
optionals.set(0);
}
if (struct.isSetUsedFailureAnalysisArtifactType()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetUsedFailureAnalysisArtifact()) {
struct.UsedFailureAnalysisArtifact.write(oprot);
}
if (struct.isSetUsedFailureAnalysisArtifactType()) {
oprot.writeI32(struct.UsedFailureAnalysisArtifactType.getValue());
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TDDIAbstractFailureAnalysisArtifact struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.UsedFailureAnalysisArtifact = new TDDIFailureAnalysisArtifactUnion();
struct.UsedFailureAnalysisArtifact.read(iprot);
struct.setUsedFailureAnalysisArtifactIsSet(true);
}
if (incoming.get(1)) {
struct.UsedFailureAnalysisArtifactType = thriftContract.TDDIFailureAnalysisArtifactUnionType.findByValue(iprot.readI32());
struct.setUsedFailureAnalysisArtifactTypeIsSet(true);
}
}
}
private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
}
}
| [
"joshua.frey@iese.fraunhofer.de"
] | joshua.frey@iese.fraunhofer.de |
5f15d9cafe4d2197b7825339adbb822345d7d620 | 575b274d163978d61b69e4482dfdbe56de85adc0 | /app/src/main/java/com/example/zfc/dropball/stone/Stone.java | c20d273e800d2d5c6b24dcd2fea3d874f73afb35 | [] | no_license | zfcjava/DropBallGame | dc086724f3f0434c8566b3ef954f7adaaf72bae9 | ba2e827192380c5f5802492a985e2c7d950c85fa | refs/heads/master | 2020-03-15T12:26:04.512194 | 2018-05-23T06:43:58 | 2018-05-23T06:43:58 | 132,143,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,478 | java | package com.example.zfc.dropball.stone;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import com.example.zfc.dropball.Point;
import com.example.zfc.dropball.utils.LogUtil;
/**
* Created by zfc on 2018/5/6.
*/
public abstract class Stone {
protected int attackNums = 5; //允许撞击的次数
protected Paint paint;
protected Point center;
public void doAtackedAnim(){ //撞击之后的特效
}
public Stone(Point center) {
this.center = center;
initPaint();
}
public Stone() {
initPaint();
}
private void initPaint() {
paint = new Paint();
paint.setColor(Color.RED);
paint.setStyle(Paint.Style.FILL_AND_STROKE);
}
public void doDraw(Canvas c){
// paint.setColor(Color.BLUE);
// paint.setTextSize(15);
// LogUtil.e(getClass().getSimpleName(), "draw");
// c.drawText(attackNums + "", center.x, center.y, paint);
}
/**
* 是否可以上移动一排
* @return
*/
public boolean doGoUpARow() {
center.y -= StoneConfig.SPACE_ROWS;
if (center.y <= StoneConfig.topY) {
return false;
}
return true;
}
@Override
public String toString() {
return "Stone{" +
"attackNums=" + attackNums +
", paint=" + paint +
", center=" + center +
'}';
}
}
| [
"2681226018@qq.com"
] | 2681226018@qq.com |
9bee3c298480acb341b48976462933cada3b4c52 | 83f7fa524dec2cf772e5d3f29d097d8b2546043a | /app/src/test/java/app/com/dev/andreilucian/meteopoject/ExampleUnitTest.java | fb71e614b72c2031ca4d13ec0ae05c499903a025 | [] | no_license | AndreiLucianDev/MeteoProject | 869c6caf8c7282bc2a172dd74a81c60c1f92f36a | 9dec006d8380379ea489652be32af195d6c088ac | refs/heads/master | 2016-09-13T16:46:57.246897 | 2016-04-27T12:53:36 | 2016-04-27T12:53:36 | 57,209,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package app.com.dev.andreilucian.meteopoject;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"andreilucian.fartonea@gmail.com"
] | andreilucian.fartonea@gmail.com |
6d868a1d1a5e8c92252213dc6ddcb0a4d3e9d0b5 | 15e341054b63bff5aef54b202c33f7fb8b8aeb44 | /app/src/main/java/com/example/chen/myapplication/mvp/view/adapter/GoodsExpandableListAdapter.java | 3f6d11035358378948abbc517b85b8a91516e93e | [] | no_license | IamChenyujie/MyDeam | cbf9d40da955bffe61787ed404d0a0064193c1fe | 3ff9e41520fb4aec2fa13dfc46c4d7aa52e87757 | refs/heads/master | 2021-08-12T03:48:47.639334 | 2017-11-14T11:33:56 | 2017-11-14T11:33:56 | 110,682,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,231 | java | package com.example.chen.myapplication.mvp.view.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.TextView;
import com.example.chen.myapplication.R;
import com.example.chen.myapplication.mvp.modle.bean.Data;
import com.example.chen.myapplication.mvp.modle.bean.Gouwu;
import java.util.List;
/**
* 时间: 2017/9/8 15:09
* 作者: 陈宇杰
* 作用:
*/
public class GoodsExpandableListAdapter extends BaseExpandableListAdapter {
private Context context;
private List<Data> list;
private List<List<Gouwu>> lists;
private LayoutInflater inflater;
public GoodsExpandableListAdapter(Context context, List<List<Gouwu>> lists, List<Data> list) {
this.context = context;
inflater = LayoutInflater.from(context);
this.list = list;
this.lists = lists;
notifyDataSetChanged();
}
@Override
public int getGroupCount() {
return null != list ? list.size() : 0;
}
@Override
public int getChildrenCount(int groupPosition) {
return 1;
}
@Override
public Object getGroup(int groupPosition) {
return lists.get(groupPosition);
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return lists.get(groupPosition).get(childPosition);
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
convertView = convertView.inflate(context, R.layout.item_gwex, null);
holder = new ViewHolder();
holder.tv = (TextView) convertView.findViewById(R.id.gwex_tv);
holder.ck = (CheckBox) convertView.findViewById(R.id.gw_cb);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
Data data = list.get(0);
holder.tv.setText(data.getName());
holder.ck.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<Gouwu> gouwus = lists.get(groupPosition);
if (holder.ck.isChecked()) {
//选中
holder.ck.setChecked(true);
for (int i = 0; i < gouwus.size(); i++) {
gouwus.get(i).setChecked(true);
}
} else {
//未选中
holder.ck.setChecked(false);
for (int i = 0; i < gouwus.size(); i++) {
gouwus.get(i).setChecked(false);
}
}
notifyDataSetChanged();
}
});
return convertView;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
convertView = convertView.inflate(context, R.layout.item_gwlv, null);
holder = new ViewHolder();
holder.lv = (ListView) convertView.findViewById(R.id.gw_ls);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
List<Gouwu> gouwus = lists.get(groupPosition);
MyListAdapter adapter = new MyListAdapter(context, gouwus);
holder.lv.setAdapter(adapter);
return convertView;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
class ViewHolder {
TextView tv;
ListView lv;
CheckBox ck;
}
}
| [
"770885399@qq.com"
] | 770885399@qq.com |
bd1b1e2d1ccd124cdbde78a0d5a43576145778b1 | 74acea1b7f2a3a509b9ead48f186c9349bf55cc8 | /framework/src/main/java/com/enjoyf/platform/service/joymeapp/anime/AnimeTagField.java | 1756499b50dbcc0004a43b6d2f449de2c8714bc1 | [] | no_license | liu67224657/besl-platform | 6cd2bfcc7320a4039e61b114173d5f350345f799 | 68c126bea36c289526e0cc62b9d5ce6284353d11 | refs/heads/master | 2022-04-16T02:23:40.178907 | 2020-04-17T09:00:01 | 2020-04-17T09:00:01 | 109,520,110 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,311 | java | package com.enjoyf.platform.service.joymeapp.anime;
import com.enjoyf.platform.util.sql.AbstractObjectField;
import com.enjoyf.platform.util.sql.ObjectFieldDBType;
/**
* Created with IntelliJ IDEA.
* User: zhimingli
* Date: 14-10-26
* Time: 下午3:23
* To change this template use File | Settings | File Templates.
*/
public class AnimeTagField extends AbstractObjectField {
public static final AnimeTagField TAG_ID = new AnimeTagField("tag_id", ObjectFieldDBType.LONG, true, false);
public static final AnimeTagField TAG_NAME = new AnimeTagField("tag_name", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField PARENT_TAG_ID = new AnimeTagField("parent_tag_id", ObjectFieldDBType.LONG, true, false);
public static final AnimeTagField TAG_DESC = new AnimeTagField("tag_desc", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField PICJSON = new AnimeTagField("picjson", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField CH_NAME = new AnimeTagField("ch_name", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField EN_NAME = new AnimeTagField("en_name", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField RESERVED = new AnimeTagField("reserved", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField CH_DESC = new AnimeTagField("ch_desc", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField EN_DESC = new AnimeTagField("en_desc", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField TYPE = new AnimeTagField("type", ObjectFieldDBType.INT, true, false);
public static final AnimeTagField MODEL = new AnimeTagField("model", ObjectFieldDBType.INT, true, false);
public static final AnimeTagField VOLUME = new AnimeTagField("volume", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField PLAY_NUM = new AnimeTagField("play_num", ObjectFieldDBType.LONG, true, false);
public static final AnimeTagField FAVORITE_NUM = new AnimeTagField("favorite_num", ObjectFieldDBType.LONG, true, false);
public static final AnimeTagField REMOVE_STATUS = new AnimeTagField("remove_status", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField UPDATE_DATE = new AnimeTagField("update_date", ObjectFieldDBType.TIMESTAMP, true, false);
public static final AnimeTagField CREATE_DATE = new AnimeTagField("create_date", ObjectFieldDBType.TIMESTAMP, true, false);
public static final AnimeTagField CREATE_USER = new AnimeTagField("create_user", ObjectFieldDBType.STRING, true, false);
public static final AnimeTagField DISPLAY_ORDER = new AnimeTagField("display_order", ObjectFieldDBType.INT, true, false);
public static final AnimeTagField SEARCH_TYPE = new AnimeTagField("search_type", ObjectFieldDBType.INT, true, false);
public static final AnimeTagField APP_TYPE = new AnimeTagField("app_type", ObjectFieldDBType.INT, true, false);
public static final AnimeTagField TOTAL_SUM = new AnimeTagField("total_sum", ObjectFieldDBType.INT, true, false);
public AnimeTagField(String column, ObjectFieldDBType type, boolean modify, boolean uniquene) {
super(column, type, modify, uniquene);
}
public AnimeTagField(String column, ObjectFieldDBType type) {
super(column, type);
}
}
| [
"ericliu@staff.joyme.com"
] | ericliu@staff.joyme.com |
381e48767b3c108525ff54b0876c398ee85c5b68 | a1665faa43aebd9f07833208975bb08479e77eaa | /src/DataAnalyse/TimeAnalyser.java | 53261e13a32f34b1d1e106264c21f71f52c224a7 | [] | no_license | PangYanbo/Y-Project | 77f76d38022cff4b1e07d7d8e952c63b157ffd58 | 69f3ef9e439e4391a4eec047d1ef2dd031f50561 | refs/heads/master | 2020-01-23T21:53:21.113402 | 2016-04-25T09:06:49 | 2016-04-25T09:06:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,042 | java | package DataAnalyse;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
public class TimeAnalyser {
public static void main(String args[]) throws IOException{
// CountbyDay(args[0]);
// GetTimes(args[0],args[1]);
ID_Daycount(args[0],args[1]);
}
public static void CountbyDay(String in) throws IOException{
HashMap<String,Integer> res = new HashMap<String,Integer>();
BufferedReader br = new BufferedReader(new FileReader(new File(in)));
String line = null;
while((line = br.readLine())!= null){
String[] tokens = line.split("\t");
String date = tokens[3];
String day = date.substring(8,10);
if(res.containsKey(day)){
int count = res.get(day)+1;
res.put(day, count);
}
else{
res.put(day, 1);
}
}
br.close();
for(String d : res.keySet()){
System.out.println(d + "," + res.get(d));
}
}
public static void GetTimes(String in,String out) throws IOException{
HashMap<Integer,Integer> res = new HashMap<Integer,Integer>();
BufferedReader br = new BufferedReader(new FileReader(new File(in)));
BufferedWriter bw = new BufferedWriter(new FileWriter(new File(out)));
String line = null;
while((line = br.readLine())!= null){
String[] tokens = line.split("\t");
String date = tokens[3];
Integer hour = Integer.parseInt(date.substring(11,13));
Integer mindig1 = Integer.parseInt(date.substring(14,15));
// Integer sec = Integer.parseInt(date.substring(17,19));
Integer time = hour*60+mindig1*10;
if(res.containsKey(time)){
int count = res.get(time)+1;
res.put(time, count);
}
else{
res.put(time, 1);
}
}
br.close();
for(Integer i : res.keySet()){
bw.write(String.valueOf(i)+","+String.valueOf(res.get(i)));
bw.newLine();
}
bw.close();
}
public static void ID_Daycount(String in, String out) throws IOException{
HashMap<String,HashSet<String>> res = new HashMap<String,HashSet<String>>();
HashMap<String,Integer> resres = new HashMap<String,Integer>();
BufferedReader br = new BufferedReader(new FileReader(new File(in)));
BufferedWriter bw = new BufferedWriter(new FileWriter(new File(out)));
String line = null;
while((line = br.readLine())!= null){
String[] tokens = line.split("\t");
String id = tokens[0];
String date = tokens[3];
String ymd = date.substring(8,10);
if(res.containsKey(id)){
res.get(id).add(ymd);
}
else{
HashSet<String> set = new HashSet<String>();
set.add(ymd);
res.put(id, set);
}
}
br.close();
for (String id : res.keySet()){
int days = res.get(id).size();
String d = String.valueOf(days);
if(resres.containsKey(d)){
int count = resres.get(d)+1;
resres.put(d, count);
}
else{
resres.put(d, 1);
}
}
for(String i : resres.keySet()){
bw.write(i+","+String.valueOf(resres.get(i)));
bw.newLine();
}
bw.close();
}
} | [
"yabe0505@iis.u-tokyo.ac.jp"
] | yabe0505@iis.u-tokyo.ac.jp |
1630180c6e22efe708d956092d3ac45592712688 | 09e6690147eedf58189c09546a8b4d50300c725b | /weizu-parent/weizu-web-modules/weizu-channel/src/main/java/com/weizu/flowsys/util/MyX509TrustManager.java | 3189d5e87519583ae0404ac5f1844a127116f34b | [] | no_license | showlofans/weizu_channel | 3c846e8df738b28db539324c28500d2b82172e83 | 39de1347be4a988acd2aa929d0d52e95dc8dbba9 | refs/heads/master | 2022-01-27T09:35:10.396785 | 2022-01-23T12:25:32 | 2022-01-23T12:25:32 | 95,176,460 | 0 | 1 | null | 2018-04-14T10:01:38 | 2017-06-23T02:42:08 | Java | UTF-8 | Java | false | false | 876 | java | package com.weizu.flowsys.util;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.X509TrustManager;
/**
* @description: ssl信任管理器
* @projectName:weizu-channel
* @className:MyX509TrustManager.java
* @author:微族通道代码设计人 宁强
* @createTime:2018年2月7日 上午10:24:55
* @version 1.0
*/
public class MyX509TrustManager implements X509TrustManager {
@Override
public void checkClientTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException {
// TODO Auto-generated method stub
}
@Override
public void checkServerTrusted(X509Certificate[] arg0, String arg1)
throws CertificateException {
// TODO Auto-generated method stub
}
@Override
public X509Certificate[] getAcceptedIssuers() {
// TODO Auto-generated method stub
return null;
}
}
| [
"1727661035@qq.com"
] | 1727661035@qq.com |
29b4436fffa7db64c2be64696e6bdc9bf3cf9af1 | 148d5e770a8e199236f5868af486b5620ad205c1 | /ssm_Test/ssm_Test_service/src/main/java/cn/itheima/service/impl/RoleServiceImp.java | c254932d0a86c01d4fc4b7cd655673b6aa278a75 | [] | no_license | pengzichen/Mytest | ac0b3e1738b361bcdad2d9821e1ad1b766672b79 | 2cd1f4e2a6431f1bfaf1cf902de52361f2cd2c64 | refs/heads/master | 2020-04-01T06:29:37.065334 | 2018-10-15T00:42:05 | 2018-10-15T00:42:05 | 152,950,294 | 0 | 0 | null | 2018-10-14T08:05:21 | 2018-10-14T07:35:32 | JavaScript | UTF-8 | Java | false | false | 1,425 | java | package cn.itheima.service.impl;
import cn.itheima.dao.RoleDao;
import cn.itheima.domain.Permission;
import cn.itheima.domain.Role;
import cn.itheima.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class RoleServiceImp implements RoleService {
@Autowired
private RoleDao roleDao;
/**
* 查询所有角色
* @return
*/
@Override
public List<Role> findAll() {
List<Role> roleList = roleDao.findAll();
return roleList;
}
/**
* 添加角色
* @param role
*/
@Override
public void save(Role role) {
roleDao.save(role);
}
/**
* 根据id查询角色
* @param id
* @return
*/
@Override
public Role findById(String id) {
Role role = roleDao.findById(id);
return role;
}
/**
* 查询角色没有的权限
* @return
*/
@Override
public List<Permission> findRoleByIdAndAllPermission(String id) {
List<Permission> list = roleDao.findRoleByIdAndAllPermission(id);
return list;
}
@Override
public void addPermissionToRole(String roleId, String permissionId) {
roleDao.addPermissionToRole(roleId,permissionId);
}
}
| [
"17332582866@qq.com"
] | 17332582866@qq.com |
4be845d3d5a1f5c8f34405118c644eea6a30a4fe | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/io/protostuff/runtime/DefaultIdStrategyTest.java | a292351b3318ed2713b4ecc3e7a1f43d1236f779 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 973 | java | package io.protostuff.runtime;
import io.protostuff.Message;
import io.protostuff.Schema;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
public class DefaultIdStrategyTest {
private final IdStrategy strategy = new DefaultIdStrategy();
@Test
public void privateConstructors() {
HasSchema<DefaultIdStrategyTest.TestMessage> schema = strategy.getSchemaWrapper(DefaultIdStrategyTest.TestMessage.class, true);
Assert.assertEquals(DefaultIdStrategyTest.TestMessage.SCHEMA, schema.getSchema());
}
public static class TestMessage implements Message<DefaultIdStrategyTest.TestMessage> {
private static final Schema<DefaultIdStrategyTest.TestMessage> SCHEMA = Mockito.mock(Schema.class);
private TestMessage() {
}
@Override
public Schema<DefaultIdStrategyTest.TestMessage> cachedSchema() {
return DefaultIdStrategyTest.TestMessage.SCHEMA;
}
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
e5890fc93635ac89174488f9b3ca96e33c853d84 | 6135ff5ce0b473c1ab22fa32e870b113c9234c51 | /src/main/java/com/ezandro/myapi/services/UserService.java | 2ea4d9802059a99d3244ece634d393e78371d3d6 | [] | no_license | ezbueno/myapi | e35e4f424d2240f9c5e6541aafe8c3d34fb189c9 | 285c28cfbe630ad3c333b391783fa293d440dc15 | refs/heads/main | 2023-03-13T04:25:42.842986 | 2021-03-07T01:46:52 | 2021-03-07T01:46:52 | 344,890,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,192 | java | package com.ezandro.myapi.services;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ezandro.myapi.entities.User;
import com.ezandro.myapi.repositories.UserRepository;
import com.ezandro.myapi.services.exceptions.UserNotFoundException;
@Service
public class UserService {
@Autowired
private UserRepository userRepository;
public User findById(Integer id) {
Optional<User> user = userRepository.findById(id);
return user.orElseThrow(() -> new UserNotFoundException("Usuário não encontrado! Id: " + id + ", Tipo: " + User.class.getName()));
}
public List<User> findAll() {
List<User> users = userRepository.findAll();
return users;
}
public User update(Integer id, User user) {
User newUser = findById(id);
newUser.setNome(user.getNome());
newUser.setLogin(user.getLogin());
newUser.setSenha(user.getSenha());
return userRepository.save(newUser);
}
public User create(User user) {
user.setId(null);
return userRepository.save(user);
}
public void delete(Integer id) {
findById(id);
userRepository.deleteById(id);
}
}
| [
"ezandrobueno@yahoo.com.br"
] | ezandrobueno@yahoo.com.br |
0d17cdd500a42af2ea4b7d15be95ed9615934069 | 4a9f0cf184f530383d435bfeb440cf58f7bdf636 | /OneKit/app/src/main/java/com/cn21/onekit/android/MyApplication.java | cf5a056ff75a5282626356b30c8e890129b8078e | [] | no_license | zmyxingyu/test | 277e41defc9488bde8e8a4b1dc651f8ad340a295 | 630b25dce3581d834fe21f16b56b7fde146621e9 | refs/heads/master | 2021-01-10T01:48:06.292781 | 2018-02-13T04:10:29 | 2018-02-13T04:10:29 | 53,903,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,000 | java | package com.cn21.onekit.android;
import android.app.Application;
import android.content.Context;
import android.util.Log;
import com.cn21.onekit.android.util.AndroidUtils;
import com.cn21.onekit.core.OneKitConfig;
import com.cn21.onekit.core.OneKitInitListener;
import com.cn21.onekit.core.OneKitManager;
import com.cn21.onekit.core.OneKitRuntime;
import com.cn21.onekit.lib.update.CommonApiManager;
import com.cn21.onekit.lib.update.ResoucePackageManager;
import com.cn21.onekit.lib.update.ResourceDownloadListener;
import com.cn21.ued.apm.util.UEDAgent;
import com.tencent.bugly.crashreport.CrashReport;
/**
* Created by lecykx on 2017/7/17.
*/
public class MyApplication extends Application {
String TAG = MyApplication.class.getSimpleName();
@Override
public void onCreate() {
super.onCreate();
OneKitManager.createInstance(oneKitRuntimeImpl, new OneKitConfig.Builder().build());
OneKitManager.getInstance().setInitListener(mListener);
OneKitManager.getInstance().init(this);
CommonApiManager.getInstance().setmSwitchListener(swichListener);
ResoucePackageManager.getInstance().setmResourceDowloadLister(mResourceDownloadLister);
ResoucePackageManager.getInstance().init(this);
//初始化bugly
CrashReport.initCrashReport(this, "b7764184c0", BuildConfig.DEBUG);
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
UEDAgent.startTrafficInfoAndNetSpeed(this);
}
private OneKitInitListener mListener = new OneKitInitListener() {
@Override
public void onInitOneKitResult(boolean success) {
UEDAgent.trackCustomKVEvent(getApplicationContext(),
success ? UxContants.INIT_ONEKIT_SUCCESS : UxContants.INIT_ONEKIT_FAILED,
null, null);
AndroidUtils.showShortToast(MyApplication.this, success ? "init onekit success !" : "init onekit fail !");
}
@Override
public void onDownloadOneKitResult(boolean success) {
UEDAgent.trackCustomKVEvent(getApplicationContext(),
success ? UxContants.DOWNLOAD_ONEKIT_SUCCESS : UxContants.DOWNLOAD_ONEKIT_FAILED,
null, null);
AndroidUtils.showShortToast(MyApplication.this, success ? "XWalk download success !" : "XWalk download fail !");
}
@Override
public void onXWalkUpdateStarted() {
AndroidUtils.showShortToast(MyApplication.this, "XWalk update start !");
}
};
private OneKitRuntime oneKitRuntimeImpl = new OneKitRuntime() {
@Override
public String getAccount() {
return "18819364866";
}
@Override
public String getAppSecret() {
return "aeiou";
}
@Override
public String getAppId() {
return "test";
}
@Override
public String getPackageSecret() {
return null;
}
};
private ResourceDownloadListener mResourceDownloadLister = new ResourceDownloadListener() {
@Override
public void onResourceDownloadStart() {
Log.d(TAG, "onResourceDownloadStart");
UEDAgent.trackCustomKVEvent(getApplicationContext(),
UxContants.resoure_download_start,
null, null);
AndroidUtils.showShortToast(MyApplication.this, "start download resource !");
}
@Override
public void onResourceDownload(boolean success) {
Log.d(TAG, "onResourceDownload" + success);
UEDAgent.trackCustomKVEvent(getApplicationContext(),
success ? UxContants.resoure_download_success : UxContants.resoure_download_Failed,
null, null);
AndroidUtils.showShortToast(MyApplication.this, "download resource " + (success ? " success !" : "fail !"));
}
@Override
public void onResourceCheckMd5(boolean success) {
Log.d(TAG, "onResourceCheckMd5" + success);
UEDAgent.trackCustomKVEvent(getApplicationContext(),
success ? UxContants.resoure_checkMd5_success : UxContants.resource_checkMd5_failed,
null, null);
AndroidUtils.showShortToast(MyApplication.this, "check resource zip md5" + (success ? " success !" : "fail !"));
}
@Override
public void onResourceUnzip(boolean success) {
Log.d(TAG, "onResourceUnzip" + success);
UEDAgent.trackCustomKVEvent(getApplicationContext(),
success ? UxContants.resource_unzip_success : UxContants.resource_unzip_failed,
null, null);
AndroidUtils.showShortToast(MyApplication.this, "unzip resource " + (success ? " success !" : "fail !"));
}
@Override
public void onResourceCheckFiles(boolean success) {
Log.d(TAG, "onResourceCheckFiles" + success);
AndroidUtils.showShortToast(MyApplication.this, "check every file " + (success ? " success !" : "fail !"));
}
@Override
public void onResourceUpdateSuccess() {
Log.d(TAG, "onResourceUpdateSuccess");
UEDAgent.trackCustomKVEvent(getApplicationContext(),
UxContants.resource_update_success,
null, null);
AndroidUtils.showShortToast(MyApplication.this, "update resource success !");
}
};
private CommonApiManager.SwitchListener swichListener = new CommonApiManager.SwitchListener() {
@Override
public void onSwitchErr() {
AndroidUtils.showShortToast(MyApplication.this, "get xwalk switch status err !");
}
@Override
public void onSwitchSuccess(boolean status) {
AndroidUtils.showShortToast(MyApplication.this, "switch status :" + (status ? "on" : "off"));
}
};
}
| [
"zhangmy@corp.21cn.com"
] | zhangmy@corp.21cn.com |
62b6677d06b11f27849c3cc375de8371eb61da74 | 15fc33232acd56ea99d156486076782837f7d81c | /EncenderAspersor.java | 97252d4bbc9cd301973fb8fe06de1488d2ede722 | [] | no_license | emiruffini/TRABAJO-PRACRICO-PARADIGMAS | b49378ff759a1b649a648a712f769bc46edfa669 | b08a3b6cf67f31a6377047c3f2f6f589a9b9bd37 | refs/heads/master | 2023-01-06T17:28:44.558500 | 2020-11-03T15:51:27 | 2020-11-03T15:51:27 | 309,732,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 304 | java |
public class EncenderAspersor implements Comando {
Aspersor aspersor;
public EncenderAspersor(Aspersor aspersor) {
super();
this.aspersor = aspersor;
}
public void ejecutar() {
System.out.println("Encendiendo aspersor...");
aspersor.encender();
}
}
| [
"emilianoruffini@outlook.com"
] | emilianoruffini@outlook.com |
89310c2b1ae3fcda92a4e7e947b8cfca80c05800 | d6cfd7db35b70bbf73dea89318c50d6a8f6c266e | /src/main/java/com/cute/community/aspect/ServiceLog.java | 643d5e98a8c571d292ad359c856c7cac1bc32a5b | [] | no_license | baobao-sudo/uchain-community | bdd8affa001c5b3f496b3bf5a9cb69e27afa37cf | 4ab87d3059877babd049ee669a52e7be72297400 | refs/heads/master | 2022-07-02T05:57:36.884499 | 2020-02-19T14:00:12 | 2020-02-19T14:00:12 | 239,415,747 | 0 | 0 | null | 2022-06-21T02:46:14 | 2020-02-10T03:02:31 | Java | UTF-8 | Java | false | false | 1,384 | java | package com.cute.community.aspect;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
/**
* @ClassName ServiceLog
* @Description service的执行的日志生成
* @Author Lenovo
* @Date 2020/2/15
* @Version 1.0
**/
@Aspect
@Slf4j
@Component
public class ServiceLog {
@Pointcut("execution(public * com.cute.community.service.*.*(..))")
public void service() {
}
@Before("service()")
public void before(JoinPoint joinPoint) {
Signature signature = joinPoint.getSignature();
String method = signature.getDeclaringTypeName() + "." + signature.getName();
log.info("-----------------------------------------------------");
log.info("当前执行的service方法:" + method);
Object[] args = joinPoint.getArgs();
for (Object arg : args) {
log.info("参数:" + arg);
}
}
@AfterReturning(pointcut = "service()", returning = "ret")
public void after(Object ret) {
log.info("service返回参数:" + ret);
log.info("-----------------------------------------------------");
}
}
| [
"2581901873@qq.com"
] | 2581901873@qq.com |
21e1990ea9dd6416f9ddcec7cba9c60038357253 | dc25a7595140e510dec968327d1756eec168008f | /produce/src/main/java/com/manage/produce/data/CodeStyle.java | 466fc95a1fdd61665957758c77a214a3ca8f6fe3 | [] | no_license | jasonboore/produce | af1c985f9365739e5b2dc30518167fd59427589b | 8b7f8b556e38affa4fec95f3e608014328413337 | refs/heads/master | 2023-04-01T21:05:58.044127 | 2021-04-02T03:12:56 | 2021-04-02T03:12:56 | 353,888,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package com.manage.produce.data;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import javax.persistence.*;
@Data
@Entity
@JsonIgnoreProperties({"hibernateLazyInitializer","handler"})
@Table(name = "code_style")
public class CodeStyle {
@Id
@GeneratedValue
private Long pid;
@Column
private String columnField;
@Column
private String columnTitle;
@Column
private Integer columnWidth;
@Column
private String alignment;
@Column
private String dataType;
@Column
private String isSeen;
@Column
private String isLock;
@Column
private String isEdit;
@Column
private String checkBox;
@Column
private String selectCondition;
@Column
private Integer conditionWidth;
@Column
private String listSetences;
@Column
private String codeName;
}
| [
"2286842225@qq.com"
] | 2286842225@qq.com |
6bfe1a054f1e8914ca45374c0c8e5df76faa76ca | d190e148e5a5c5f9ebe54cc838939faa52638c70 | /src/main/java/Calculator.java | 6a08c94a81a586781b9be1609a80aa1158170044 | [] | no_license | Nadezhda48/CalculatorJUnit | 5353826045eb779d301f4d5f55c5b477de7cedc3 | e9849778e7672aab0a1baa84567a8727ad73f3b4 | refs/heads/master | 2020-05-04T18:49:46.400568 | 2019-04-03T20:50:32 | 2019-04-03T20:50:32 | 179,367,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,732 | java | public class Calculator implements ICalculator {
private double[] numbers;
private char[] signs;
private String labelText, temp;
private int labelLength, idInSignsArr, numPos;
private double result;
double getResult(){
return result;
}
Calculator(String labelText){
this.labelText = labelText;
labelLength = labelText.length();
numbers = new double[20];
signs = new char[20];
idInSignsArr = 1;
numPos = 0;
result = calculateResult();
}
public double calculateResult(){
int pos = 0;
int idInNumbersArr = 0;
while(pos< labelLength){
if(labelText.charAt(pos)=='+'){
signs[idInSignsArr] = '+';
idInSignsArr +=2;
temp = labelText.substring(idInNumbersArr,pos);
numbers[numPos]= Double.parseDouble(temp);
numPos +=2;
idInNumbersArr = pos+1;
} else if(labelText.charAt(pos)=='-'){
signs[idInSignsArr] = '-';
idInSignsArr +=2;
temp = labelText.substring(idInNumbersArr,pos);
numbers[numPos]= Double.parseDouble(temp);
numPos +=2; idInNumbersArr = pos+1;
}else if(labelText.charAt(pos)=='*'){
signs[idInSignsArr] = '*';
idInSignsArr +=2;
temp = labelText.substring(idInNumbersArr,pos);
numbers[numPos]= Double.parseDouble(temp);
numPos +=2;
idInNumbersArr = pos+1;
}else if(labelText.charAt(pos)=='/'){
signs[idInSignsArr] = '/';
idInSignsArr +=2;
temp = labelText.substring(idInNumbersArr,pos);
numbers[numPos]= Double.parseDouble(temp);
numPos +=2;
idInNumbersArr = pos+1;
}else{}
pos++;
}
temp = labelText.substring(idInNumbersArr);
numbers[numPos] = Double.parseDouble(temp);
calculate();
return numbers[0];
}
public void calculate(){
for(int i = 1; i<= idInSignsArr; i+=2){
if(signs[i]=='*'){
numbers[i-1] = metodMultiplication(numbers[i-1], numbers[i+1]);
changeNumPos(i+1);
changeOpPos(i);
}
}
for(int i = 1; i<= idInSignsArr; i+=2){
if(signs[i]=='/'){
numbers[i-1] = metodDivision(numbers[i-1], numbers[i+1]);
changeNumPos(i+1);
changeOpPos(i);
}
}
for(int i = 1; i<= idInSignsArr; i+=2){
if(signs[i]=='-'){
numbers[i-1] = metodMinus(numbers[i-1], numbers[i+1]);
changeNumPos(i+1);
changeOpPos(i);
}
}
for(int i = 1; i<= idInSignsArr; i+=2){
if(signs[i]=='+'){
numbers[i-1] = metodPlus(numbers[i-1], numbers[i+1]);
changeNumPos(i+1);
changeOpPos(i);
}
}
for(int i = 1; i<= idInSignsArr; i+=2){
if(signs[i]=='√'){
numbers[i-1] = metodSqrt(numbers[i-1]);
changeNumPos(i+1);
changeOpPos(i);
}
}
}
public void changeNumPos(int pos1){
for(int i = pos1; i< numPos; i+=2)
numbers[i] = numbers[i+2];
}
public void changeOpPos(int pos1)
{
for(int i = pos1; i< idInSignsArr; i+=2)
signs[i] = signs[i+2];
}
public double metodPlus(double firstNum, double secondNum) {
double res = firstNum + secondNum;
return res;
}
public double metodMinus (double firstNum, double secondNum){
double res = firstNum - secondNum;
return res;
}
public double metodDivision (double firstNum, double secondNum){
double res = firstNum / secondNum;
return res;
}
public double metodMultiplication (double firstNum, double secondNum){
double res = firstNum * secondNum;
return res;
}
public double metodSqrt (double firstNum){
/* double number = sc.nextDouble();
double t;
double squareRoot = number/2;
do {
t = squareRoot;
squareRoot = (t+(number/t))/ 2;
}while ((t - squareRoot) != 0);
sc.close();
*/
double temp;
double squareRoot = firstNum / 2;
do {
temp = squareRoot;
squareRoot = (temp + (firstNum / temp)) / 2;
} while ((temp - squareRoot) != 0);
return squareRoot;
}
}
| [
"nadezhda.bilega@gmail.com"
] | nadezhda.bilega@gmail.com |
0bfdc02591a60b1726cadfd2cc5d4cd415eb4227 | 4a7799bcc8b78faa170e1fb739a7b8b7d2e393ea | /src/WordList.java | 5ea1296db90a660a2cd79d9269e9a5a82f09e4f6 | [] | no_license | elisenharper/textAnalyzerFinal | 6bb76184c533d68b17b902d566a4ba8e3a0015f2 | f5f09a92eac4f0173f3ea6c7c1e44a07a69c2296 | refs/heads/master | 2022-04-17T07:02:40.738833 | 2020-04-16T01:06:02 | 2020-04-16T01:06:02 | 256,054,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,553 | java |
public class WordList {
/**
* Word class used for adding to the list of words to the ObservableList
*/
private int order;
private String word;
private int frequency;
/**
* Word class constructor method to store the characteristics of each word.
*
* @param order of frequency of the word
* @param word that is being analyzed for frequency
* @param frequency of the word
*/
public WordList(int order, String word, int frequency) {
this.order = order;
this.word = word;
this.frequency = frequency;
}
/*
* Getter method for the order variable
*
* @return order of frequency of the word
*/
public int getOrder() {
return order;
}
/**
* Setter method for the order variable
*
* @param order of frequency of the word
*/
public void setOrder(int order) {
this.order = order;
}
/*
* Getter method for the word variable
*
* @return that is being analyzed for frequency
*/
public String getWord() {
return word;
}
/**
* Setter method for the word variable
*
* @param word that is being analyzed for frequency
*/
public void setWord(String word) {
this.word = word;
}
/**
* Getter method for the frequency variable
*
* @return frequency of the word
*/
public int getFrequency() {
return frequency;
}
/**
* Setter method for the frequency variable
*
* @param frequency of the word
*/
public void setFrequency(int frequency) {
this.frequency = frequency;
}
} | [
"noreply@github.com"
] | noreply@github.com |
7cd1f6be092162ab30d92623b3a7e6a57eddefd1 | 9c38cf326af863594caeee93f26abe130d5680fe | /app/build/generated/ap_generated_sources/debug/out/hilt_aggregated_deps/com_example_pokemon_di_DataBaseModuleModuleDeps.java | 0fb90a13e2c4d60d33c25e17287ec59317aa2567 | [] | no_license | maysambabaei/MVVM-with-Hilt-Rxjava3 | 9860913cad9fe8f385a36b4b0a516ed6e602aa78 | 9f7890442656cf7d0e1f2f99312ef3b4347970e0 | refs/heads/master | 2022-12-16T06:05:31.881137 | 2020-08-23T12:39:16 | 2020-08-23T12:39:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 499 | java | package hilt_aggregated_deps;
import dagger.hilt.processor.internal.aggregateddeps.AggregatedDeps;
import javax.annotation.Generated;
/**
* Generated class to pass information through multiple javac runs.
*/
@AggregatedDeps(
components = "dagger.hilt.android.components.ApplicationComponent",
modules = "com.example.pokemon.di.DataBaseModule"
)
@Generated("dagger.hilt.processor.internal.aggregateddeps.AggregatedDepsGenerator")
class com_example_pokemon_di_DataBaseModuleModuleDeps {
}
| [
"meysam@arexgo.com"
] | meysam@arexgo.com |
d7f3b1928ba3a54ac8aff39ad6a1e13b48231c81 | 42111ed1c24872f7473b307ab6ba277d97f8c1f4 | /src/main/java/com/pb/service2/services/EmployeServiceImpl.java | 5ef851e6a406adfe8ea68320aa488f3e3ba1cdfc | [] | no_license | leelanakka/pact-service2 | 7022c64e10418d6c9a6474b0ab3f18f2bd62f42b | e673975afe0a880bac21800bd8b9688b0f90c8bf | refs/heads/master | 2020-06-19T07:11:09.672097 | 2019-07-12T16:30:50 | 2019-07-12T16:30:50 | 196,611,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,019 | java | package com.pb.service2.services;
import com.pb.service2.dto.Employee;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.List;
@Service
public class EmployeServiceImpl implements EmployeeService {
String baseUrl = "http://localhost:9001";
@Override
public List<Employee> getAll() {
RestTemplate restTemplate = new RestTemplate();
return restTemplate.exchange(baseUrl + "/employees", HttpMethod.GET, null, new ParameterizedTypeReference<List<Employee>>() {
}).getBody();
}
@Override
public Employee get(Long id) {
RestTemplate restTemplate = new RestTemplate();
return restTemplate.getForObject(baseUrl + "/employees/" + id, Employee.class);
}
@Override
public EmployeeService setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
return this;
}
}
| [
"44019459+leelanakka@users.noreply.github.com"
] | 44019459+leelanakka@users.noreply.github.com |
9fb593ef4fc17a88adc82a1cb7287899b7232925 | b42ea68ace3293fcaac088e26100279efbb47969 | /src/main/java/br/com/nao/saia/exception/StateNotFoundException.java | 3f9ea6f47e609ba6844196cee60fbfc9c4347d26 | [
"MIT"
] | permissive | b0nn13/nao-saia-backend | ce17084b406933f6e5948ea13767d5ddf57a963a | 755f89256a45b1b36773be44e8894278e2235b0f | refs/heads/master | 2021-04-19T03:34:02.010907 | 2020-03-24T00:36:44 | 2020-03-24T00:36:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package br.com.nao.saia.exception;
public class StateNotFoundException extends RuntimeException {
/**
*
*/
private static final long serialVersionUID = 9117600442700073122L;
public StateNotFoundException(Integer id) {
super(String.format("State not found with id %s", id));
}
}
| [
"isaiasengsoft@gmail.com"
] | isaiasengsoft@gmail.com |
59cf27c3cc2a40d37df4ca95ebd14a5d7af1ba57 | e07dc8c6bef0aa886ab7d14352f6f39c96ecd991 | /app/src/main/java/com/baswarajmamidgi/vnrvjiet/Faculty.java | 65cc40412fb0af65ef24dbeeca4bb885290c6997 | [] | no_license | baswarajmamidgi/vnrvjiet | 5d69f472b2e2c126c61e68e8b9cd720550be7020 | 70b86196476c2c60da4a3709ee5b63bb677f6d3a | refs/heads/master | 2022-03-01T04:21:46.074019 | 2019-11-25T04:52:38 | 2019-11-25T04:52:38 | 98,921,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,623 | java | package com.baswarajmamidgi.vnrvjiet;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.database.MatrixCursor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.CursorAdapter;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.SimpleCursorAdapter;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
public class Faculty extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
private String departmenturl;
private String hoddata; //http://www.vnrvjiet.ac.in/Department_FacultyProfileNew.aspx?nID=251&nDeptID=5
private DatabaseReference mDatabase; // faculty url sample
private CursorAdapter cursorAdapter;
private ValueEventListener valueEventListener;
private ValueEventListener hodvalue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_faculty);
Toolbar toolbar= (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("Faculty");
setSupportActionBar(toolbar);
final FirebaseDatabase database = FirebaseDatabase.getInstance();
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
Intent i=getIntent();
final String branchname=i.getStringExtra("branch");
ConnectivityManager manager = (ConnectivityManager) getApplicationContext().getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo info = manager.getActiveNetworkInfo();
final boolean isconnected = info != null && info.isConnectedOrConnecting();
final ProgressDialog progressDialog=new ProgressDialog(Faculty.this);
progressDialog.setMessage(getString(R.string.LOADING_DATA));
progressDialog.setCancelable(true);
progressDialog.show();
mDatabase=database.getReference().child("hods").child(branchname);
ListView listView= (ListView) findViewById(R.id.stafflist);
final ImageView imageView= (ImageView) findViewById(R.id.hodimage);
final TextView email= (TextView) findViewById(R.id.hodemail);
final TextView name= (TextView) findViewById(R.id.hodname);
hodvalue=mDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot postsnapshot:dataSnapshot.getChildren()) {
hoddata = postsnapshot.getValue(String.class);
final String[] data=hoddata.split(",");
departmenturl=data[0];
name.setText(data[1]);
email.setText(data[2]);
Glide.with(Faculty.this).load(data[3])
.placeholder(R.drawable.loading)
.error(R.drawable.noimage)
.into(imageView);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Dialog dialog = new Dialog(Faculty.this,R.style.Theme_Dialog);
dialog.setContentView(R.layout.imageview);
ImageView imageView = (ImageView) dialog.findViewById(R.id.imageView);
ImageView cancel = (ImageView) dialog.findViewById(R.id.cancel);
Glide.with(Faculty.this).load(data[3])
.placeholder(R.drawable.loading)
.error(R.drawable.noimage)
.into(imageView);
dialog.show();
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
});
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
final MatrixCursor matrixCursor=new MatrixCursor(new String[]{"_id","name","designation","email"});
String[] from={"name","designation","email",};
int[] to={R.id.faculty_name,R.id.designation,R.id.email};
cursorAdapter=new SimpleCursorAdapter(this,R.layout.adapterview,matrixCursor,from,to,0);
Log.i("log1",branchname);
mDatabase=database.getReference().child("branches").child(branchname);
valueEventListener=mDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot postsnapshot : dataSnapshot.getChildren()) {
int count=0;
String data = postsnapshot.getValue(String.class);
String info[] = data.split(",");
matrixCursor.addRow(new String[]{String.valueOf(count++),info[0],info[1],info[2]});
cursorAdapter.notifyDataSetChanged();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.i("log",databaseError.toString());
progressDialog.dismiss();
}
});
listView.setAdapter(cursorAdapter);
final Handler handler=new Handler();
handler.post(new Runnable() {
@Override
public void run() {
if((matrixCursor.getCount()>0)){
progressDialog.dismiss();
handler.removeCallbacks(this);
}
handler.post(this);
}
});
handler.postDelayed(new Runnable() {
@Override
public void run() {
if(cursorAdapter.getCount()==0){
if(!isconnected) {
Toast.makeText(Faculty.this, R.string.NO_INTERNET, Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
handler.removeCallbacks(this);
startActivity(new Intent(Faculty.this,MainActivity.class));
finishAffinity();
}
}
}
},3000);
listView.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Log.i("log",departmenturl);
if(departmenturl==null){
return;
}
String facultyurl=departmenturl;
Intent intent=new Intent((Intent.ACTION_VIEW));
intent.setData(Uri.parse(facultyurl));
ConnectivityManager connectivityManager= (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo networkInfo=connectivityManager.getActiveNetworkInfo();
final boolean isconnected= networkInfo!=null && networkInfo.isConnectedOrConnecting();
if(isconnected)
startActivity(intent);
else
Toast.makeText(getApplicationContext(), R.string.NO_INTERNET, Toast.LENGTH_SHORT).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.overflowmenu,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId()==R.id.help){
startActivity(new Intent(Faculty.this, Feedback.class));
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.home:{
Intent i = new Intent(Faculty.this, MainActivity.class);
startActivity(i);
break;
}
case R.id.fest: {
Intent i = new Intent(Faculty.this, Fest.class);
startActivity(i);
break;
}
case R.id.clubs: {
Intent i = new Intent(Faculty.this, Clubs.class);
startActivity(i);
break;
}
case R.id.chapter: {
Intent i = new Intent(Faculty.this, StudentChapters.class);
startActivity(i);
break;
}
case R.id.contacts: {
Intent i = new Intent(Faculty.this, MiscContacts.class);
startActivity(i);
break;
}
case R.id.syallabus: {
startActivity(new Intent(Faculty.this,Syllabus.class));
break;
}
case R.id.timetable: {
startActivity(new Intent(Faculty.this,Timetable.class));
break;
}
case R.id.profile: {
startActivity(new Intent(Faculty.this, Studentinfo.class));
break;
}
case R.id.collegemap: {
Handler handler=new Handler();
handler.post(new Runnable() {
@Override
public void run() {
startActivity(new Intent(Faculty.this, CollegeMap.class));
}
});
break;
}
case R.id.website: {
Intent i=new Intent(Faculty.this,Webpage.class);
i.putExtra("webpage",getString(R.string.VNR_WEBSITE));
startActivity(i);
break;
}
case R.id.youtube:{
Intent i=new Intent(Intent.ACTION_VIEW,Uri.parse(getString(R.string.VNR_YOUTUBE)));
startActivity(i);
break;
}
case R.id.Feedback:
{
Intent intent = new Intent (Faculty.this,Feedback.class);
startActivity(intent);
break;
}
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
mDatabase.removeEventListener(valueEventListener);
mDatabase.removeEventListener(hodvalue);
}
}
| [
"baswarajmamidgi@gmail.com"
] | baswarajmamidgi@gmail.com |
dad224a65cafdde190df217a0359a64f00bcf15a | fbb29ec6decb860a8b17bdc6f450937b5cc17395 | /app/src/main/java/com/my/appcamp/DOL.java | 245a428d2a7a7b6b4af71ff147557638b98b473a | [] | no_license | heejuShin/AppCamp | d6d8916cfd943aa00bc476ba31b7036e64b5a56d | 7702eb0c388231b440e9198916f9e233fcc9c1d2 | refs/heads/master | 2020-11-27T03:58:36.805928 | 2019-12-20T17:00:07 | 2019-12-20T17:00:07 | 229,294,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,103 | java | package com.my.appcamp;
public class DOL {
private int ImageId;
private String name;
private String ex;
//private boolean[] check = new boolean[3];
DOL(){
}
DOL(int id, String name, String ex){
this.ImageId=id;
this.name=name;
this.ex=ex;
}
DOL(int id, String name, String ex, boolean check1, boolean check2, boolean check3){
this.ImageId=id;
this.name=name;
this.ex=ex;
//this.check[0]=check1;
//this.check[1]=check2;
//this.check[2]=check3;
}
public int getImageId() {
return ImageId;
}
public void setImageId(int imageId) {
ImageId = imageId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEx() {
return ex;
}
public void setEx(String ex) {
this.ex = ex;
}
/*
public boolean getCheck(int i) {
return check[i];
}
public void setCheck(boolean[] check) {
this.check = check;
}*/
}
| [
"21800412@handong.edu"
] | 21800412@handong.edu |
7e539e5a1d6d32ca64b0f6db1332a2de28676012 | b4f03a45ecd3d33ed05c5908b264b2444c29d4c5 | /src/question25/NameScoreStudent.java | f51dd5d62ad6d63f8a77c6442636e1e315c17ee7 | [] | no_license | thapmons/Assignments | fb6c50356e104565cd231dfa5500c34a8c0e4190 | 25f3da2233187830d5c61c9db6d0f8ddf63ce288 | refs/heads/master | 2023-01-20T11:02:36.864250 | 2020-11-27T05:48:57 | 2020-11-27T05:48:57 | 316,376,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package question25;
import java.util.Scanner;
public class NameScoreStudent {
public static void main(String[] args) {
Scanner input =new Scanner(System.in);
System.out.println("Enter no.of students");
int numOfStudent=input.nextInt();
int maxScore=0;
String studentName="";
for (int i = 1; i <=numOfStudent; i++) {
System.out.println("Enter name of Student: ");
String name=input.next();
System.out.println("Enter Score: ");
int score=input.nextInt();
if(score>maxScore) {
maxScore=score;
studentName=name;
}
}
System.out.println("Student Name is :" +studentName);
System.out.println("Max Score is: "+maxScore);
input.close();
}
}
| [
"monsoonthapa123@gmail.com"
] | monsoonthapa123@gmail.com |
465da332e2e9ac2f828f27c9605a08a307c3c366 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_98d8a6a36a244e94788018f7218fa8524afdbb6d/ImportCommand/10_98d8a6a36a244e94788018f7218fa8524afdbb6d_ImportCommand_t.java | 5d09bf1c748ed5a93a048146c544c7110c61ebff | [] | 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 | 2,251 | java | package com.onarandombox.multiverseinventories.command;
import com.onarandombox.multiverseinventories.MultiverseInventories;
import com.onarandombox.multiverseinventories.locale.MultiverseMessage;
import com.onarandombox.multiverseinventories.migration.DataImporter;
import com.onarandombox.multiverseinventories.migration.MigrationException;
import com.onarandombox.multiverseinventories.permission.MVIPerms;
import com.onarandombox.multiverseinventories.util.MVILog;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import java.util.List;
/**
* The /mvi info Command.
*/
public class ImportCommand extends InventoriesCommand {
public ImportCommand(MultiverseInventories plugin) {
super(plugin);
this.setName("Import from MultiInv/WorldInventories");
this.setCommandUsage("/mvinv import " + ChatColor.GREEN + "{MultiInv|WorldInventories}");
this.setArgRange(1, 1);
this.addKey("mvinv import");
this.addKey("mvinvim");
this.addKey("mvinvimport");
this.setPermission(MVIPerms.COMMAND_IMPORT.getPerm());
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
DataImporter importer = null;
if (args.get(0).equalsIgnoreCase("MultiInv")) {
importer = this.getPlugin().getImportManager().getMultiInvImporter();
} else if (args.get(0).equalsIgnoreCase("WorldInventories")) {
importer = this.getPlugin().getImportManager().getWorldInventoriesImporter();
} else {
this.getPlugin().getMessager().bad(MultiverseMessage.ERROR_PLUGIN_NOT_ENABLED,
sender, args.get(0));
return;
}
if (importer == null) {
this.getPlugin().getMessager().bad(MultiverseMessage.ERROR_PLUGIN_NOT_ENABLED,
sender, args.get(0));
} else {
try {
importer.importData();
} catch (MigrationException e) {
MVILog.severe(e.getMessage());
MVILog.severe("Cause: " + e.getCauseException().getMessage());
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
2cbe91b6b50a081a8c006c2e1b60fb468201c2b5 | 619da019fa3e2549026cae674ea19bc8f5a995be | /exam/src/p20/Service.java | f592cd0c00c7e7ed9e6dfa85d919e1faa1269f70 | [] | no_license | kmjy/test | 9155461e8b3a52997e7cae3ebf994c42dab2f496 | b6e1f479620833ebc922ab94d407aa5a8043a3d7 | refs/heads/master | 2021-08-31T04:11:24.836531 | 2017-12-20T09:47:06 | 2017-12-20T09:47:06 | 111,525,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,627 | java | package p20;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import com.test.lot.common.DBCon;
public class Service {
DBCon dbcon;
Service() {
dbcon = new DBCon();
}
public ArrayList<HashMap<String, Object>> searchClassInfo(LinkedHashMap<String, Object> hm) {
ArrayList<HashMap<String, Object>> result = null;
String sql = "select *from class_info\r\n" + "where cino=?";
try {
result = dbcon.executeQuery(sql, hm);
} catch (SQLException e) {
e.printStackTrace();
}
return result;
}
public int insetClassInfo(LinkedHashMap<String, Object> hm) {
int result = 0;
String sql = "insert into class_info(ciname,cidesc)\r\n" + "values (?,?)\r\n";
try {
result = dbcon.executeUpdate(sql, hm);
dbcon.commit();
} catch (SQLException e) {
try {
dbcon.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
}
System.out.println("수정 이미했어");
} finally {
try {
dbcon.closeAll();
} catch (SQLException e) {
e.printStackTrace();
}
}
return result;
}
public int deleteClassInfo(LinkedHashMap<String, Object> hm) {
int result = 0;
String sql = "delete from class_info\r\n" + "where cino=?\r\n";
try {
result = dbcon.executeUpdate(sql, hm);
dbcon.commit();
} catch (SQLException e) {
try {
dbcon.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
}
System.out.println("삭제 이미했어");
} finally {
try {
dbcon.closeAll();
} catch (SQLException e) {
e.printStackTrace();
}
}
return result;
}
public int updateClassInfo(LinkedHashMap<String, Object> hm) { // 4 //5-2 괄호안에 LinkedHashMap<String,Object>hm 요거넣어주기
int result = 0; // 1
String sql = "update class_info " + "set cidesc=? " + // 1-1 //4 내용바꾸기 //5-1 물음표로 바꿔주기?는 절대 홑따옴표 붙으면 안댐
"where cino=?";
try {
result = dbcon.executeUpdate(sql, hm); // 1-2 트라이태치 //5-2,hm 써주기
dbcon.commit(); // 2
} catch (SQLException e) {
try {
dbcon.rollback(); // 3 트라이캐치
} catch (SQLException e1) {
System.out.println("업데이트 이미 했어");
}
e.printStackTrace();
} finally { // 4-1 파이널리 써주고
try {
dbcon.closeAll(); // 5 트라이캐치 여까지하고 >>익스큐트 클래스만들기
} catch (SQLException e) {
e.printStackTrace();
}
}
return result; // 1-3
}
}
| [
"jae080004@gmail.com"
] | jae080004@gmail.com |
499a6fa4e85f8d62c551df5e5f960873a8ea9271 | 52fbde69a43fb4be4a4b6d6e338afe4298a32567 | /app/src/androidTest/java/seismonet/com/notch/ExampleInstrumentedTest.java | 2414da8f13bbbf014abe97aacbc19451b2d832e8 | [] | no_license | devajyotibarman/Notch | f3795819a5a1360bc62317849279d6133b8816a7 | 9cc4157cc4dd7ed16a1940efd1460ea4abcffb1f | refs/heads/master | 2021-07-11T10:07:37.604201 | 2017-10-02T19:35:41 | 2017-10-02T19:35:41 | 105,576,536 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package seismonet.com.notch;
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("seismonet.com.notch", appContext.getPackageName());
}
}
| [
"devajyotibarman@gmail.com"
] | devajyotibarman@gmail.com |
4b0859ed78a470402e99ad5f289f7c149fbc4657 | 52aac63fda6ca9b805224b8c0db9fbc20d4cfe61 | /src/main/java/pe/edu/upc/controller/ProductoController.java | 3089059697e5b7826d44d113d6e5edd472b8cd16 | [] | no_license | MayraStefany/RepositorioPetCareTP | 10f47476c9b937851fbc439515128276d57244de | 1f906b3ee8986e5bf50e64cc828069ab4106f46f | refs/heads/master | 2022-12-28T12:51:34.804725 | 2020-10-03T02:12:50 | 2020-10-03T02:12:50 | 297,699,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,209 | java | package pe.edu.upc.controller;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import pe.edu.upc.entity.Producto;
import pe.edu.upc.service.IProductoService;
@Named
@RequestScoped
public class ProductoController implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Inject
private IProductoService pService;
private Producto producto;
List<Producto> listaProductos;
@PostConstruct
public void init() {
producto = new Producto();
listaProductos = new ArrayList<Producto>();
this.listProducto();
}
public String nuevoProducto() {
this.setProducto(producto);
return "producto.xhtml";
}
public void insertar() {
try {
pService.insertar(producto);
limpiarProducto();
} catch (Exception e) {
e.getMessage();
}
}
public void listProducto() {
try {
listaProductos = pService.listar();
} catch (Exception e) {
e.getMessage();
}
}
public void limpiarProducto() {
this.init();
}
public void eliminar(Producto producto) {
try {
pService.eliminar(producto.getIdProducto());
listProducto();
} catch (Exception e) {
e.getMessage();
}
}
public String detallesProducto(Producto _producto) {
this.setProducto(_producto);
return "detalleProducto.xhtml";
}
public void modificar() {
try {
pService.modificar(this.producto);
limpiarProducto();
this.listProducto();
} catch (Exception e) {
e.getMessage();
}
}
public String ModifProducto(Producto _pro) {
this.setProducto(_pro);
return "producto2.xhtml";
}
// get y set
public void setpService(IProductoService pService) {
this.pService = pService;
}
public IProductoService getpService() {
return pService;
}
public Producto getProducto() {
return producto;
}
public void setProducto(Producto producto) {
this.producto = producto;
}
public List<Producto> getListaProductos() {
return listaProductos;
}
public void setListaProductos(List<Producto> listaProductos) {
this.listaProductos = listaProductos;
}
}
| [
"mayrawenita3@gmail.com"
] | mayrawenita3@gmail.com |
ec2dcb38eaf51c4dddc77030051d2a71ff80795e | cf9a5ed24c5fc9b161385cc22fdfb1d3f03bb538 | /java/src/apps/yasabalisujati/form/CustomerTambah.java | a1ae287159671e537e792761a6eb63eceb027842 | [] | no_license | rahmatcmos/yasa-bali-sujati | 858a72fa1f3474ee80d81597d7415af0a541efa2 | 5a5a4fb272a6dd7cdae4ddcf0304c094ca234f70 | refs/heads/master | 2021-01-20T16:21:14.864183 | 2015-09-19T11:06:08 | 2015-09-19T11:06:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,517 | java | package apps.yasabalisujati.form;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import apps.yasabalisujati.components.Button;
import apps.yasabalisujati.components.ComboBox;
import apps.yasabalisujati.components.Label;
import apps.yasabalisujati.components.Textbox;
import apps.yasabalisujati.components.TextboxArea;
import apps.yasabalisujati.database.entity.Customer;
import apps.yasabalisujati.database.entity.Pegawai;
import apps.yasabalisujati.service.Service;
public class CustomerTambah extends JInternalFrame {
private static final long serialVersionUID = -113509224699880126L;
private JInternalFrame _frame;
private Session _session;
private Service _service;
private SimpleDateFormat _simpleDateFormat;
private Textbox namaTextbox;
private Textbox jenisCustomerTextbox;
private TextboxArea detailTextboxArea;
private ComboBox jenisCustomerComboBox;
private CustomerIndex _customerIndex;
private ShipperIndex _shipperIndex;
private Customer _customer;
private String[] jenisCustomersSet = new String[] {"Rekanan", "Exportir", "Importir" };
private JoborderTambah _joborderTambah;
public CustomerTambah(Session session, Service service,
SimpleDateFormat simpleDateFormat) {
super("a", false, true, false, true);
_frame = this;
_frame.setLayout(new FlowLayout(FlowLayout.LEADING));
_frame.setPreferredSize(new Dimension(550, 300));
_frame.setSize(_frame.getPreferredSize());
_frame.setLocation(10, 10);
_frame.setDefaultCloseOperation(
WindowConstants.HIDE_ON_CLOSE);
_frame.setFrameIcon(new ImageIcon(getClass().getClassLoader()
.getResource("icons/people.png")));
_session = session;
_service = service;
_simpleDateFormat = simpleDateFormat;
Container container = _frame.getContentPane();
Dimension labelDimension = new Dimension(100, 30);
Dimension textDimension = new Dimension(150, 30);
Label usernameLabel = new Label("Nama");
usernameLabel.setPreferredSize(labelDimension);
container.add(usernameLabel);
namaTextbox = new Textbox("");
namaTextbox.setPreferredSize(new Dimension(400, 30));
container.add(namaTextbox);
Label detailLabel = new Label("Detail");
detailLabel.setPreferredSize(new Dimension(100, 90));
detailLabel.setVerticalAlignment(SwingConstants.TOP);
container.add(detailLabel);
detailTextboxArea = new TextboxArea("");
detailTextboxArea.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB) {
if (detailTextboxArea.getText().length() > 0) {
String checkAkhiran = detailTextboxArea.getText()
.substring(
detailTextboxArea.getText().length() - 1,
detailTextboxArea.getText().length());
if ((int) checkAkhiran.charAt(0) == 9) {
detailTextboxArea
.setText(detailTextboxArea.getText()
.substring(
0,
detailTextboxArea.getText()
.length() - 1));
jenisCustomerTextbox.requestFocus();
}
}
}
}
});
JScrollPane alamatScrollPane = new JScrollPane(detailTextboxArea );
alamatScrollPane.setPreferredSize(new Dimension(400, 90));
alamatScrollPane.setBorder(new Textbox(null).getBorderCustom());
container.add(alamatScrollPane);
Label divisiLabel = new Label("Divisi");
divisiLabel.setPreferredSize(labelDimension);
container.add(divisiLabel);
jenisCustomerComboBox = new ComboBox(new String[] { "a" });
jenisCustomerComboBox.setPreferredSize(textDimension);
container.add(jenisCustomerComboBox);
Label divisilainLabel = new Label(" Selain itu");
divisilainLabel.setPreferredSize(labelDimension);
container.add(divisilainLabel);
jenisCustomerTextbox = new Textbox("");
jenisCustomerTextbox.setPreferredSize(textDimension);
container.add(jenisCustomerTextbox);
JPanel buttonSavePanel = new JPanel();
buttonSavePanel.setPreferredSize(new Dimension(Double.valueOf(
_frame.getPreferredSize().getWidth()).intValue() - 25, 40));
buttonSavePanel.setBorder(BorderFactory.createTitledBorder(""));
container.add(buttonSavePanel);
Button saveButton = new Button(new ImageIcon(
getClass().getClassLoader().getResource("icons/save.png")), "(Ctrl+S) SIMPAN");
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
save();
}
});
buttonSavePanel.add(saveButton);
KeyStroke newKeyStroke = KeyStroke.getKeyStroke((KeyEvent.VK_S), InputEvent.CTRL_MASK, false);
Action newAction = new AbstractAction() {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent e) {
save();
}
};
_frame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(newKeyStroke, "SAVED");
_frame.getRootPane().getActionMap().put("SAVED", newAction);
KeyStroke escapeKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
Action escapeAction = new AbstractAction() {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent e) {
closeEvent();
}
};
_frame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escapeKeyStroke, "ESCAPE");
_frame.getRootPane().getActionMap().put("ESCAPE", escapeAction);
JLabel blankLabel = new JLabel("");
blankLabel.setPreferredSize(new Dimension(100, 30));
buttonSavePanel.add(blankLabel);
Button closeButton = new Button(new ImageIcon(
getClass().getClassLoader().getResource("icons/cancel.png")), "TUTUP");
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
closeEvent();
}
});
buttonSavePanel.add(closeButton);
_frame.pack();
}
public void setVisible(Customer customer) {
clearForm();
_customer = customer;
refreshDivisiCustomer();
if (_customer == null) {
_frame.setFrameIcon(new ImageIcon(getClass().getClassLoader()
.getResource("icons/addpeople.png")));
_frame.setTitle("Tambah Customer");
} else {
_frame.setFrameIcon(new ImageIcon(getClass().getClassLoader()
.getResource("icons/edit.png")));
_frame.setTitle("Ubah pegawai");
namaTextbox.setText(_customer.getNama());
detailTextboxArea.setText(_customer.getDetail());
jenisCustomerComboBox.setSelectedItem(_customer.getJenisCustomer());
}
_frame.setVisible(true);
_frame.moveToFront();
}
public void clearForm() {
namaTextbox.setText("");
namaTextbox.requestFocus();
detailTextboxArea.setText("");
jenisCustomerTextbox.setText("");
}
public void refreshDivisiCustomer() {
String divisiSelected = jenisCustomerComboBox.getSelectedItem().toString();
_session = _service.getConnectionDB(_session);
_session.clear();
jenisCustomerComboBox.removeAllItems();
for (String settt : jenisCustomersSet) {
jenisCustomerComboBox.addItem(settt);
}
Criteria criteria = _session.createCriteria(Customer.class).setProjection(
Projections.groupProperty("jenisCustomer"));
criteria.add(Restrictions.not(Restrictions.in("jenisCustomer", jenisCustomersSet )));
List<String> jenisCustomers = criteria.list();
for (String jenisCustomer : jenisCustomers) {
jenisCustomerComboBox.addItem(jenisCustomer);
}
jenisCustomerComboBox.setSelectedItem(divisiSelected);
}
public void save() {
_session = _service.getConnectionDB(_session);
_session.clear();
if (namaTextbox.getText().isEmpty()) {
namaTextbox.requestFocus();
JOptionPane.showMessageDialog(null, "Isi nama pegawai", "Informasi",
JOptionPane.INFORMATION_MESSAGE);
return;
}
if (_customer == null) {
Criteria citeria = _session.createCriteria(Pegawai.class).setProjection(Projections.rowCount());
citeria.add(Restrictions.eq("nama", namaTextbox.getText()));
if ((long) citeria.uniqueResult() > 0) {
namaTextbox.requestFocus();
JOptionPane.showMessageDialog(null, "Nama pegawai "+namaTextbox.getText()+" sudah terdaftar", "Informasi",
JOptionPane.INFORMATION_MESSAGE);
return;
}
}
String jenisCustomer = jenisCustomerComboBox.getSelectedItem().toString();
if (!jenisCustomerTextbox.getText().isEmpty()) {
jenisCustomer = jenisCustomerTextbox.getText();
}
Date nowDate = new Date();
java.sql.Timestamp nowSqlDate = new java.sql.Timestamp(nowDate.getTime());
Customer customer = new Customer();
if (_customer != null) {
customer = _customer;
} else {
customer.setCreatedAt(nowSqlDate);
}
customer.setUpdatedAt(nowSqlDate);
customer.setJenisCustomer(jenisCustomer);
customer.setNama(namaTextbox.getText());
customer.setDetail(detailTextboxArea.getText());
if (_customer == null) {
customer.setDeleted(true);
_session.save(customer);
} else {
_session.update(customer);
_session.flush();
}
refreshDivisiCustomer();
_joborderTambah.refreshCustomer();
_joborderTambah.getJoborderIndex().refreshTable();
if (jenisCustomer.equalsIgnoreCase("Exportir") || jenisCustomer.equalsIgnoreCase("Importir")) {
_shipperIndex.refreshTable();
} else {
_customerIndex.refreshTable();
}
if (_customer == null) {
clearForm();
} else {
closeEvent();
}
}
public void closeEvent() {
_frame.setVisible(false);
}
public void setCustomerIndex(CustomerIndex customerIndex) {
_customerIndex = customerIndex;
}
public void setShipperIndex(ShipperIndex shipperIndex) {
_shipperIndex = shipperIndex;
}
public void setJoborderTambah(JoborderTambah joborderTambah) {
_joborderTambah = joborderTambah;
}
public JoborderTambah getJoborderTambah() {
return _joborderTambah;
}
}
| [
"ade_ari_w0@yahoo.com"
] | ade_ari_w0@yahoo.com |
016c4c1bba3bd6f8ccbc4071424614b3cda124e2 | abcf9763d7fb2df3ad52d540aa4a3c444261b116 | /src/orientacaoObjetoClassica/Gerente.java | e2657fd578bdf0dddf8d61ccf7e599e146398b38 | [] | no_license | 07fps/CursoJava | d55cd578ff065a43ac5330e595002d68c793a292 | 465068416622af7fe1b35f33c7cbf172089c385c | refs/heads/master | 2021-01-12T12:04:14.936238 | 2016-09-17T19:24:48 | 2016-09-17T19:24:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | java | package orientacaoObjetoClassica;
public class Gerente extends Funcionario implements Autenticavel {
private int senha;
private int numeroDeFuncionariosGerenciados;
private String unidadeAlocado;
@Override
public double getBonificacao() {
return this.getSalario() * 0.15;
}
public void demitirFuncionario(Funcionario f){
//Do Staff
}
@Override
public boolean autentica(int senha) {
if(this.senha == senha && checarUnidadeValida())
return true;
return false;
}
private boolean checarUnidadeValida() {
if(this.unidadeAlocado != null)
return true;
return false;
}
}
| [
"aluno@netacad.local"
] | aluno@netacad.local |
b6852c48d0d9304df2ce7917e3a2a19b4a02316d | c8d91cc6a69b13ffc812dbc7bedc8c4dc68cd7c8 | /consumer/src/main/java/com/kinesis/ConsumerApplication.java | c350994d0a3c7648b1514c809642ab383d758582 | [] | no_license | muhufuk/awsKinesisConsumer | a53d03454ec2eb3b496e9b5114479691d4dbd0de | e13f421f5f22e2cadb962ac89b949c0322a53ff2 | refs/heads/master | 2021-01-25T08:08:05.199603 | 2017-06-08T08:14:12 | 2017-06-08T08:14:12 | 93,723,109 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.kinesis;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(ConsumerApplication.class, args);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
edfcca9f7fd778e0ede315aeff8fe71ae6eeea99 | 9504e0d8352824b8b2d3e8a27dc5f40f99bd4dc4 | /tanhua-server/src/main/java/com/itheima/tanhua/server/service/SSOService.java | a9aa131c8db737f7f09d4c1214c2606c1bd6934f | [] | no_license | liu-gogo/tanhua | 6a4fd720f4e94a3b55aa3c4fec71db3ee5fd8db1 | d79e5fe6d3d7e5d75df20b5b332363c94f0c22db | refs/heads/master | 2023-04-01T02:26:46.414006 | 2021-04-09T00:26:27 | 2021-04-09T00:26:27 | 356,084,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,018 | java | package com.itheima.tanhua.server.service;
import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.tanhua.sso.api.SSOAPI;
import com.itheima.tanhua.sso.pojo.User;
import com.itheima.tanhua.sso.pojo.UserInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.List;
@Service
@Slf4j
public class SSOService {
@Reference(version = "1.0.0")
private SSOAPI ssoapi;
public User checkToken(String token) {
return ssoapi.checkToken(token);
}
public UserInfo findUserInfoByUserId(Long userId) {
return ssoapi.findUserInfo(userId);
}
public List<UserInfo> findUserInfoList(List<Long> userIdList,
Integer age,
String city,
String education,
String gender) {
return ssoapi.findUserInfoList(userIdList,age,city,education,gender);
}
public List<UserInfo> findUserInfoList(List<Long> userIdList) {
return findUserInfoList(userIdList,null,null,null,null);
}
public boolean saveContacts(Long userId, Long firendId) {
return ssoapi.contactUsers(userId, firendId);
}
public List<UserInfo> findUserInfoList(List<Long> userIdList, String keyword) {
return ssoapi.findUserInfoList(userIdList,keyword);
}
public List<UserInfo> findUserInfoListByGender(List<Long> userIdList,
String gender) {
return ssoapi.findUserInfoList(userIdList,null,null,null,gender);
}
public boolean sendMsg(Long userId, String txt, String reply) {
return ssoapi.sendMsg(userId, txt, reply);
}
public Boolean updateUserInfo(UserInfo userInfo) {
return ssoapi.updateUserInfo(userInfo);
}
}
| [
"“L970096047@.163com"
] | “L970096047@.163com |
640cb76651a50df429bd69b3a12950ae94c8f206 | a852be66ee2dcec0091e43c50002518599bf2977 | /src/com/leetcode/backtrack/LetterCombinationsOfaPhoneNumber_17.java | f2ccdab84f4ca8200198b4e16a7aa8f70ef84459 | [] | no_license | charles03/LeetCode | 01c0cabc358c850c7e583bc9db18d7c5beeeaf75 | 7fd7cd3794b5365ec199151f12db081b5fa1d105 | refs/heads/master | 2021-01-12T08:35:41.725568 | 2017-06-25T18:35:17 | 2017-06-25T18:35:17 | 76,621,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,499 | java | package com.leetcode.backtrack;
import java.util.LinkedList;
import java.util.List;
/**
* Created by charles on 1/19/17.
* Given a digit string, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below.
Input:Digit string "23"
Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
*/
public class LetterCombinationsOfaPhoneNumber_17 {
private static final String[] KEYS = {"0", "1", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
public List<String> letterCombinations(String digits) {
List<String> res = new LinkedList<>();
char[] index = digits.toCharArray();
combineHelper("", index, 0, res);
return res;
}
private void combineHelper(String str, char[] index, int pos, List<String> res) {
if (pos >= index.length) {
res.add(str);
return;
}
char[] letters = KEYS[index[pos] - '0'].toCharArray();
for (int i = 0; i < letters.length; i++) {
combineHelper(str + letters[i], index, pos + 1, res);
}
}
public static void main(String[] args) {
LetterCombinationsOfaPhoneNumber_17 l = new LetterCombinationsOfaPhoneNumber_17();
output(l.letterCombinations("23"));
}
private static void output(List<String> list) {
list.stream().forEach(t -> System.out.print(t + ','));
System.out.println();
}
}
| [
"charleszhang0629@gmail.com"
] | charleszhang0629@gmail.com |
fd44cd0ca19d36bcdfd8ac4c1becc50d13ddc8a4 | 5eb714fce333f2b40380deb7685544edb57fb7ed | /app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/vectordrawable/R.java | 77918097b5c860c85ae99c9f5263fcfb7b46c74a | [] | no_license | ilham1997/kawalcovid19 | 7de15b4527ed8afe1a4816844d52095f59447a56 | c42ca46d13c95c31ca350669e60fcac21119dc8e | refs/heads/master | 2023-06-26T01:42:59.659536 | 2023-06-18T00:13:50 | 2023-06-18T00:13:50 | 270,156,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,483 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.vectordrawable;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int font = 0x7f020093;
public static final int fontProviderAuthority = 0x7f020095;
public static final int fontProviderCerts = 0x7f020096;
public static final int fontProviderFetchStrategy = 0x7f020097;
public static final int fontProviderFetchTimeout = 0x7f020098;
public static final int fontProviderPackage = 0x7f020099;
public static final int fontProviderQuery = 0x7f02009a;
public static final int fontStyle = 0x7f02009b;
public static final int fontVariationSettings = 0x7f02009c;
public static final int fontWeight = 0x7f02009d;
public static final int ttcIndex = 0x7f020159;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f040043;
public static final int notification_icon_bg_color = 0x7f040044;
public static final int ripple_material_light = 0x7f04004e;
public static final int secondary_text_default_material_light = 0x7f040050;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f050051;
public static final int compat_button_inset_vertical_material = 0x7f050052;
public static final int compat_button_padding_horizontal_material = 0x7f050053;
public static final int compat_button_padding_vertical_material = 0x7f050054;
public static final int compat_control_corner_material = 0x7f050055;
public static final int compat_notification_large_icon_max_height = 0x7f050056;
public static final int compat_notification_large_icon_max_width = 0x7f050057;
public static final int notification_action_icon_size = 0x7f050067;
public static final int notification_action_text_size = 0x7f050068;
public static final int notification_big_circle_margin = 0x7f050069;
public static final int notification_content_margin_start = 0x7f05006a;
public static final int notification_large_icon_height = 0x7f05006b;
public static final int notification_large_icon_width = 0x7f05006c;
public static final int notification_main_column_padding_top = 0x7f05006d;
public static final int notification_media_narrow_margin = 0x7f05006e;
public static final int notification_right_icon_size = 0x7f05006f;
public static final int notification_right_side_padding_top = 0x7f050070;
public static final int notification_small_icon_background_padding = 0x7f050071;
public static final int notification_small_icon_size_as_large = 0x7f050072;
public static final int notification_subtext_size = 0x7f050073;
public static final int notification_top_pad = 0x7f050074;
public static final int notification_top_pad_large_text = 0x7f050075;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060062;
public static final int notification_bg = 0x7f060063;
public static final int notification_bg_low = 0x7f060064;
public static final int notification_bg_low_normal = 0x7f060065;
public static final int notification_bg_low_pressed = 0x7f060066;
public static final int notification_bg_normal = 0x7f060067;
public static final int notification_bg_normal_pressed = 0x7f060068;
public static final int notification_icon_background = 0x7f060069;
public static final int notification_template_icon_bg = 0x7f06006a;
public static final int notification_template_icon_low_bg = 0x7f06006b;
public static final int notification_tile_bg = 0x7f06006c;
public static final int notify_panel_notification_icon_bg = 0x7f06006d;
}
public static final class id {
private id() {}
public static final int accessibility_action_clickable_span = 0x7f080006;
public static final int accessibility_custom_action_0 = 0x7f080007;
public static final int accessibility_custom_action_1 = 0x7f080008;
public static final int accessibility_custom_action_10 = 0x7f080009;
public static final int accessibility_custom_action_11 = 0x7f08000a;
public static final int accessibility_custom_action_12 = 0x7f08000b;
public static final int accessibility_custom_action_13 = 0x7f08000c;
public static final int accessibility_custom_action_14 = 0x7f08000d;
public static final int accessibility_custom_action_15 = 0x7f08000e;
public static final int accessibility_custom_action_16 = 0x7f08000f;
public static final int accessibility_custom_action_17 = 0x7f080010;
public static final int accessibility_custom_action_18 = 0x7f080011;
public static final int accessibility_custom_action_19 = 0x7f080012;
public static final int accessibility_custom_action_2 = 0x7f080013;
public static final int accessibility_custom_action_20 = 0x7f080014;
public static final int accessibility_custom_action_21 = 0x7f080015;
public static final int accessibility_custom_action_22 = 0x7f080016;
public static final int accessibility_custom_action_23 = 0x7f080017;
public static final int accessibility_custom_action_24 = 0x7f080018;
public static final int accessibility_custom_action_25 = 0x7f080019;
public static final int accessibility_custom_action_26 = 0x7f08001a;
public static final int accessibility_custom_action_27 = 0x7f08001b;
public static final int accessibility_custom_action_28 = 0x7f08001c;
public static final int accessibility_custom_action_29 = 0x7f08001d;
public static final int accessibility_custom_action_3 = 0x7f08001e;
public static final int accessibility_custom_action_30 = 0x7f08001f;
public static final int accessibility_custom_action_31 = 0x7f080020;
public static final int accessibility_custom_action_4 = 0x7f080021;
public static final int accessibility_custom_action_5 = 0x7f080022;
public static final int accessibility_custom_action_6 = 0x7f080023;
public static final int accessibility_custom_action_7 = 0x7f080024;
public static final int accessibility_custom_action_8 = 0x7f080025;
public static final int accessibility_custom_action_9 = 0x7f080026;
public static final int action_container = 0x7f08002e;
public static final int action_divider = 0x7f080030;
public static final int action_image = 0x7f080031;
public static final int action_text = 0x7f080037;
public static final int actions = 0x7f080038;
public static final int async = 0x7f08003d;
public static final int blocking = 0x7f080040;
public static final int chronometer = 0x7f080048;
public static final int dialog_button = 0x7f080053;
public static final int forever = 0x7f08005b;
public static final int icon = 0x7f080061;
public static final int icon_group = 0x7f080062;
public static final int info = 0x7f080066;
public static final int italic = 0x7f080068;
public static final int line1 = 0x7f08006b;
public static final int line3 = 0x7f08006c;
public static final int normal = 0x7f080075;
public static final int notification_background = 0x7f080076;
public static final int notification_main_column = 0x7f080077;
public static final int notification_main_column_container = 0x7f080078;
public static final int right_icon = 0x7f080086;
public static final int right_side = 0x7f080087;
public static final int tag_accessibility_actions = 0x7f0800a9;
public static final int tag_accessibility_clickable_spans = 0x7f0800aa;
public static final int tag_accessibility_heading = 0x7f0800ab;
public static final int tag_accessibility_pane_title = 0x7f0800ac;
public static final int tag_screen_reader_focusable = 0x7f0800ad;
public static final int tag_transition_group = 0x7f0800ae;
public static final int tag_unhandled_key_event_manager = 0x7f0800af;
public static final int tag_unhandled_key_listeners = 0x7f0800b0;
public static final int text = 0x7f0800b1;
public static final int text2 = 0x7f0800b2;
public static final int time = 0x7f0800b7;
public static final int title = 0x7f0800b8;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f090004;
}
public static final class layout {
private layout() {}
public static final int custom_dialog = 0x7f0b001e;
public static final int notification_action = 0x7f0b001f;
public static final int notification_action_tombstone = 0x7f0b0020;
public static final int notification_template_custom_big = 0x7f0b0021;
public static final int notification_template_icon_group = 0x7f0b0022;
public static final int notification_template_part_chronometer = 0x7f0b0023;
public static final int notification_template_part_time = 0x7f0b0024;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0d001d;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0e00f1;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0e00f2;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e00f3;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0e00f4;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0e00f5;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0e0160;
public static final int Widget_Compat_NotificationActionText = 0x7f0e0161;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f020095, 0x7f020096, 0x7f020097, 0x7f020098, 0x7f020099, 0x7f02009a };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f020093, 0x7f02009b, 0x7f02009c, 0x7f02009d, 0x7f020159 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"muhamadilhamsutrisna1997@gmail.com"
] | muhamadilhamsutrisna1997@gmail.com |
f871382804f0c30031cf13d2f9a239f683c33bde | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/26/26_5cd9937697252fcc71110282895a8dad8c83964a/GanttChartComponentState/26_5cd9937697252fcc71110282895a8dad8c83964a_GanttChartComponentState_s.java | ad4f2a67509bad62622f44cd6d0a50e054d0ae2c | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 13,072 | java | /**
* ***************************************************************************
* Copyright (c) 2010 Qcadoo Limited
* Project: Qcadoo Framework
* Version: 1.2.0
*
* This file is part of Qcadoo.
*
* Qcadoo is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation; either version 3 of the License,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ***************************************************************************
*/
package com.qcadoo.view.internal.components.ganttChart;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.joda.time.DateTime;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.qcadoo.model.internal.api.ValueAndError;
import com.qcadoo.model.internal.types.DateType;
import com.qcadoo.view.api.components.ganttChart.GanttChartItem;
import com.qcadoo.view.api.components.ganttChart.GanttChartItemResolver;
import com.qcadoo.view.api.components.ganttChart.GanttChartItemStrip.Orientation;
import com.qcadoo.view.internal.components.ganttChart.GanttChartScaleImpl.ZoomLevel;
import com.qcadoo.view.internal.states.AbstractComponentState;
public class GanttChartComponentState extends AbstractComponentState {
public final GanttChartComponentEventPerformer eventPerformer = new GanttChartComponentEventPerformer();
private GanttChartScaleImpl scale;
private Orientation stripsOrientation;
private String dateFromErrorMessage;
private String dateToErrorMessage;
private String globalErrorMessage;
Map<String, List<GanttChartItem>> items;
Map<String, List<GanttChartItem>> collisionItems;
protected static final DateType DATETYPE = new DateType();
private final GanttChartItemResolver itemResolver;
private final int defaultStartDay;
private final int defaultEndDay;
private final ZoomLevel defaultZoomLevel;
private Long selectedEntityId;
private JSONObject context;
private final int itemsBorderWidth;
private final String itemsBorderColor;
public GanttChartComponentState(final GanttChartItemResolver itemResolver, final GanttChartComponentPattern pattern) {
super(pattern);
this.itemResolver = itemResolver;
this.defaultZoomLevel = pattern.getDefaultZoomLevel();
this.defaultStartDay = pattern.getDefaultStartDay();
this.defaultEndDay = pattern.getDefaultEndDay();
this.stripsOrientation = pattern.getStripOrientation();
this.itemsBorderWidth = pattern.getItemsBorderWidth();
this.itemsBorderColor = pattern.getItemsBorderColor();
registerEvent("refresh", eventPerformer, "refresh");
registerEvent("initialize", eventPerformer, "initialize");
registerEvent("select", eventPerformer, "selectEntity");
}
@Override
protected void initializeContext(final JSONObject json) throws JSONException {
super.initializeContext(json);
this.context = json;
}
@Override
public Object getFieldValue() {
return selectedEntityId;
}
@Override
protected void initializeContent(final JSONObject json) throws JSONException {
JSONObject headerDataObject = json.getJSONObject("headerParameters");
ZoomLevel zoomLevel = ZoomLevel.valueOf(headerDataObject.getString("scale"));
String dateFromString = headerDataObject.getString("dateFrom");
String dateToString = headerDataObject.getString("dateTo");
DateTime now = new DateTime().withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0);
Date dateFrom = now.plusDays(defaultStartDay).toDate();
Date dateTo = now.plusDays(defaultEndDay).toDate();
if (dateFromString == null || "".equals(dateFromString)) {
dateFromErrorMessage = translate("errorMessage.emptyDate");
} else {
ValueAndError dateFromVaE = DATETYPE.toObject(null, dateFromString);
if (dateFromVaE.getMessage() == null) {
dateFrom = (Date) dateFromVaE.getValue();
} else {
dateFromErrorMessage = translate("errorMessage.dateNotValid");
}
}
if (dateToString == null || "".equals(dateToString)) {
dateToErrorMessage = translate("errorMessage.emptyDate");
} else {
ValueAndError dateToVaE = DATETYPE.toObject(null, dateToString);
if (dateToVaE.getMessage() == null) {
dateTo = (Date) dateToVaE.getValue();
} else {
dateToErrorMessage = translate("errorMessage.dateNotValid");
}
}
scale = new GanttChartScaleImpl(this, zoomLevel, dateFrom, dateTo);
if (dateFromErrorMessage == null && globalErrorMessage == null) {
if (scale.isFromLargerThanTo()) {
globalErrorMessage = translate("errorMessage.fromLargerThanTo");
} else if (scale.isTooLargeRange()) {
globalErrorMessage = translate("errorMessage.tooLargeRange", String.valueOf(scale.getMaxRangeInMonths()));
}
}
if (json.has("selectedEntityId")) {
selectedEntityId = json.getLong("selectedEntityId");
}
}
@Override
protected JSONObject renderContent() throws JSONException {
JSONObject json = new JSONObject();
json.put("zoomLevel", scale.getZoomLevel().toString());
json.put("dateFromErrorMessage", dateFromErrorMessage);
json.put("dateToErrorMessage", dateToErrorMessage);
if (dateFromErrorMessage == null) {
json.put("dateFrom", DATETYPE.toString(scale.getDateFrom(), getLocale()));
}
if (dateToErrorMessage == null) {
json.put("dateTo", DATETYPE.toString(scale.getDateTo(), getLocale()));
}
json.put("globalErrorMessage", globalErrorMessage);
if (globalErrorMessage == null) {
json.put("scale", scale.getAsJson());
JSONArray rowsArray = new JSONArray();
JSONArray itemsArray = new JSONArray();
for (Map.Entry<String, List<GanttChartItem>> entry : items.entrySet()) {
rowsArray.put(entry.getKey());
for (GanttChartItem item : entry.getValue()) {
if (item != null) {
itemsArray.put(item.getAsJson());
}
}
}
json.put("stripsOrientation", getStripsOrientation().getStringValue());
json.put("itemsBorderColor", itemsBorderColor);
json.put("itemsBorderWidth", itemsBorderWidth);
json.put("rows", rowsArray);
json.put("items", itemsArray);
JSONArray collisionItemsArray = new JSONArray();
for (Map.Entry<String, List<GanttChartItem>> entry : collisionItems.entrySet()) {
for (GanttChartItem item : entry.getValue()) {
if (item != null) {
collisionItemsArray.put(item.getAsJson());
}
}
}
json.put("collisions", collisionItemsArray);
json.put("selectedEntityId", selectedEntityId);
}
return json;
}
private Orientation getStripsOrientation() {
if (stripsOrientation == null) {
return Orientation.HORIZONTAL;
} else {
return stripsOrientation;
}
}
protected String translate(final String suffix, final String... args) {
return getTranslationService().translate(getTranslationPath() + "." + suffix, "qcadooView.gantt." + suffix, getLocale(),
args);
}
protected class GanttChartComponentEventPerformer {
public void initialize(final String[] args) {
DateTime now = new DateTime().withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0);
scale = new GanttChartScaleImpl(GanttChartComponentState.this, defaultZoomLevel, now.plusDays(defaultStartDay)
.toDate(), now.plusDays(defaultEndDay).toDate());
dateFromErrorMessage = null;
dateToErrorMessage = null;
globalErrorMessage = null;
refresh(args);
}
public void refresh(final String[] args) {
requestRender();
requestUpdateState();
if (globalErrorMessage != null) {
return;
}
items = itemResolver.resolve(scale, context, getLocale());
updateCollisionItems();
}
public void selectEntity(final String[] args) {
notifyEntityIdChangeListeners(selectedEntityId);
}
private void updateCollisionItems() {
collisionItems = new HashMap<String, List<GanttChartItem>>();
for (Entry<String, List<GanttChartItem>> rowEntry : items.entrySet()) {
List<GanttChartItem> sortedItems = new ArrayList<GanttChartItem>(rowEntry.getValue());
Collections.sort(sortedItems, new Comparator<GanttChartItem>() {
@Override
public int compare(final GanttChartItem itemA, final GanttChartItem itemB) {
return Double.valueOf(itemA.getFrom()).compareTo(Double.valueOf(itemB.getFrom()));
}
});
List<GanttChartItem> collisionRow = getCollisionsList(sortedItems, rowEntry.getKey());
if (!collisionRow.isEmpty()) {
collisionItems.put(rowEntry.getKey(), collisionRow);
}
}
}
private List<GanttChartItem> getCollisionsList(final List<GanttChartItem> sortedItems, final String row) {
List<GanttChartItem> collisionRow = new ArrayList<GanttChartItem>();
GanttChartConflictItem collisionItem = null;
GanttChartItem previousItem = null;
for (GanttChartItem item : sortedItems) {
if (previousItem != null && item.getFrom() < previousItem.getTo()) {
if (collisionItem != null && item.getFrom() < collisionItem.getTo()) { // same collision
if (item.getTo() > collisionItem.getTo()) { // not entirely included in existing collision
if (item.getTo() > previousItem.getTo()) { // entirely included in previous item
collisionItem.setTo(item.getTo());
collisionItem.setDateTo(item.getDateTo());
} else {
collisionItem.setTo(previousItem.getTo());
collisionItem.setDateTo(previousItem.getDateTo());
}
}
} else { // different collision
if (collisionItem != null) {
collisionRow.add(collisionItem);
}
if (item.getTo() < previousItem.getTo()) { // entirely included in previous item
collisionItem = new GanttChartConflictItem(row, item.getDateFrom(), item.getDateTo(), item.getFrom(),
item.getTo());
} else {
collisionItem = new GanttChartConflictItem(row, item.getDateFrom(), previousItem.getDateTo(),
item.getFrom(), previousItem.getTo());
}
collisionItem.addItem(previousItem);
}
collisionItem.addItem(item);
}
if (previousItem == null || item.getTo() > previousItem.getTo()) {
previousItem = item;
}
}
if (collisionItem != null) {
collisionRow.add(collisionItem);
}
return collisionRow;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
1c7b26028f2a0c1a1cebf931f9ee124c23054022 | 2ba76e39fe7121196b3e3945f09707ca97888363 | /taotao-common/src/main/java/com/taotao/common/utils/CookieUtils.java | 0519dd3ddb9860316d397c74e898082a47a8b1c1 | [] | no_license | honglujun/taotao | 3b9f1c2645386c48ae01b03dc770ce89b9bfe2d0 | 0411c4e2214a253faad85836fb84469b5b2aba13 | refs/heads/master | 2022-12-20T22:06:43.794046 | 2019-08-02T01:53:54 | 2019-08-02T01:53:54 | 141,689,766 | 1 | 0 | null | 2022-12-16T04:54:43 | 2018-07-20T09:05:54 | JavaScript | UTF-8 | Java | false | false | 7,713 | java | package com.taotao.common.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
/**
*
* Cookie 工具类
*
*/
public final class CookieUtils {
protected static final Logger logger = LoggerFactory.getLogger(CookieUtils.class);
/**
* 得到Cookie的值, 不编码
*
* @param request
* @param cookieName
* @return
*/
public static String getCookieValue(HttpServletRequest request, String cookieName) {
return getCookieValue(request, cookieName, false);
}
/**
* 得到Cookie的值,
*
* @param request
* @param cookieName
* @return
*/
public static String getCookieValue(HttpServletRequest request, String cookieName, boolean isDecoder) {
Cookie[] cookieList = request.getCookies();
if (cookieList == null || cookieName == null) {
return null;
}
String retValue = null;
try {
for (int i = 0; i < cookieList.length; i++) {
if (cookieList[i].getName().equals(cookieName)) {
if (isDecoder) {
retValue = URLDecoder.decode(cookieList[i].getValue(), "UTF-8");
} else {
retValue = cookieList[i].getValue();
}
break;
}
}
} catch (UnsupportedEncodingException e) {
logger.error("Cookie Decode Error.", e);
}
return retValue;
}
/**
* 得到Cookie的值,
*
* @param request
* @param cookieName
* @return
*/
public static String getCookieValue(HttpServletRequest request, String cookieName, String encodeString) {
Cookie[] cookieList = request.getCookies();
if (cookieList == null || cookieName == null) {
return null;
}
String retValue = null;
try {
for (int i = 0; i < cookieList.length; i++) {
if (cookieList[i].getName().equals(cookieName)) {
retValue = URLDecoder.decode(cookieList[i].getValue(), encodeString);
break;
}
}
} catch (UnsupportedEncodingException e) {
logger.error("Cookie Decode Error.", e);
}
return retValue;
}
/**
* 设置Cookie的值 不设置生效时间默认浏览器关闭即失效,也不编码
*/
public static void setCookie(HttpServletRequest request, HttpServletResponse response, String cookieName,
String cookieValue) {
setCookie(request, response, cookieName, cookieValue, -1);
}
/**
* 设置Cookie的值 在指定时间内生效,但不编码
*/
public static void setCookie(HttpServletRequest request, HttpServletResponse response, String cookieName,
String cookieValue, int cookieMaxage) {
setCookie(request, response, cookieName, cookieValue, cookieMaxage, false);
}
/**
* 设置Cookie的值 不设置生效时间,但编码
*/
public static void setCookie(HttpServletRequest request, HttpServletResponse response, String cookieName,
String cookieValue, boolean isEncode) {
setCookie(request, response, cookieName, cookieValue, -1, isEncode);
}
/**
* 设置Cookie的值 在指定时间内生效, 编码参数
*/
public static void setCookie(HttpServletRequest request, HttpServletResponse response, String cookieName,
String cookieValue, int cookieMaxage, boolean isEncode) {
doSetCookie(request, response, cookieName, cookieValue, cookieMaxage, isEncode);
}
/**
* 设置Cookie的值 在指定时间内生效, 编码参数(指定编码)
*/
public static void setCookie(HttpServletRequest request, HttpServletResponse response, String cookieName,
String cookieValue, int cookieMaxage, String encodeString) {
doSetCookie(request, response, cookieName, cookieValue, cookieMaxage, encodeString);
}
/**
* 删除Cookie带cookie域名
*/
public static void deleteCookie(HttpServletRequest request, HttpServletResponse response,
String cookieName) {
doSetCookie(request, response, cookieName, "", -1, false);
}
/**
* 设置Cookie的值,并使其在指定时间内生效
*
* @param cookieMaxage cookie生效的最大秒数
*/
private static final void doSetCookie(HttpServletRequest request, HttpServletResponse response,
String cookieName, String cookieValue, int cookieMaxage, boolean isEncode) {
try {
if (cookieValue == null) {
cookieValue = "";
} else if (isEncode) {
cookieValue = URLEncoder.encode(cookieValue, "utf-8");
}
Cookie cookie = new Cookie(cookieName, cookieValue);
if (cookieMaxage > 0)
cookie.setMaxAge(cookieMaxage);
if (null != request)// 设置域名的cookie
cookie.setDomain(getDomainName(request));
cookie.setPath("/");
response.addCookie(cookie);
} catch (Exception e) {
logger.error("Cookie Encode Error.", e);
}
}
/**
* 设置Cookie的值,并使其在指定时间内生效
*
* @param cookieMaxage cookie生效的最大秒数
*/
private static final void doSetCookie(HttpServletRequest request, HttpServletResponse response,
String cookieName, String cookieValue, int cookieMaxage, String encodeString) {
try {
if (cookieValue == null) {
cookieValue = "";
} else {
cookieValue = URLEncoder.encode(cookieValue, encodeString);
}
Cookie cookie = new Cookie(cookieName, cookieValue);
if (cookieMaxage > 0)
cookie.setMaxAge(cookieMaxage);
if (null != request)// 设置域名的cookie
cookie.setDomain(getDomainName(request));
cookie.setPath("/");
response.addCookie(cookie);
} catch (Exception e) {
logger.error("Cookie Encode Error.", e);
}
}
/**
* 得到cookie的域名
*/
private static final String getDomainName(HttpServletRequest request) {
String domainName = null;
String serverName = request.getRequestURL().toString();
if (serverName == null || serverName.equals("")) {
domainName = "";
} else {
serverName = serverName.toLowerCase();
serverName = serverName.substring(7);
final int end = serverName.indexOf("/");
serverName = serverName.substring(0, end);
final String[] domains = serverName.split("\\.");
int len = domains.length;
if (len > 3) {
// www.xxx.com.cn
domainName = "." + domains[len - 3] + "." + domains[len - 2] + "." + domains[len - 1];
} else if (len <= 3 && len > 1) {
// xxx.com or xxx.cn
domainName = "." + domains[len - 2] + "." + domains[len - 1];
} else {
domainName = serverName;
}
}
if (domainName != null && domainName.indexOf(":") > 0) {
String[] ary = domainName.split("\\:");
domainName = ary[0];
}
return domainName;
}
}
| [
"909408954@qq.com"
] | 909408954@qq.com |
fe30ac18cb0a942dfe7e2bd077702ad62e16a6dc | 900b0bc2822aeafff5bc91903af5d241a97da511 | /gameserver/data/scripts/quests/quests0040/_046_OnceMoreInTheArmsOfTheMotherTree.java | e3e56223666da1ffe1c64f8be8a8822e3544dbb7 | [] | no_license | LacosteR/mesdev | 43ae3e63ef02b482a6e10a340f41c5bbe735a094 | e0e46269ef0440b54dd38bfb84235393b29b55ed | refs/heads/master | 2021-07-16T02:57:53.101176 | 2017-10-20T01:38:51 | 2017-10-20T01:38:51 | 107,477,817 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,517 | java | package quests.quests0040;
import l2p.gameserver.model.base.Race;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.model.quest.Quest;
import l2p.gameserver.model.quest.QuestState;
import l2p.gameserver.scripts.ScriptFile;
public class _046_OnceMoreInTheArmsOfTheMotherTree extends Quest implements ScriptFile {
private static final int GALLADUCCIS_ORDER_DOCUMENT_ID_1 = 7563;
private static final int GALLADUCCIS_ORDER_DOCUMENT_ID_2 = 7564;
private static final int GALLADUCCIS_ORDER_DOCUMENT_ID_3 = 7565;
private static final int MAGIC_SWORD_HILT_ID = 7568;
private static final int GEMSTONE_POWDER_ID = 7567;
private static final int PURIFIED_MAGIC_NECKLACE_ID = 7566;
private static final int MARK_OF_TRAVELER_ID = 7570;
private static final int SCROLL_OF_ESCAPE_ELVEN_VILLAGE = 7118;
@Override
public void onLoad() {
}
@Override
public void onReload() {
}
@Override
public void onShutdown() {
}
public _046_OnceMoreInTheArmsOfTheMotherTree() {
super(false);
addStartNpc(30097);
addTalkId(30097);
addTalkId(30097);
addTalkId(30094);
addTalkId(30090);
addTalkId(30116);
addQuestItem(new int[]{
GALLADUCCIS_ORDER_DOCUMENT_ID_1,
GALLADUCCIS_ORDER_DOCUMENT_ID_2,
GALLADUCCIS_ORDER_DOCUMENT_ID_3,
MAGIC_SWORD_HILT_ID,
GEMSTONE_POWDER_ID,
PURIFIED_MAGIC_NECKLACE_ID
});
}
@Override
public String onEvent(String event, QuestState st, NpcInstance npc) {
String htmltext = event;
if (event.equals("1")) {
st.setCond(1);
st.setState(STARTED);
st.playSound(SOUND_ACCEPT);
st.doGiveItems(GALLADUCCIS_ORDER_DOCUMENT_ID_1, 1);
htmltext = "galladuchi_q0046_0104.htm";
} else if (event.equals("2")) {
st.setCond(2);
st.doTakeItems(GALLADUCCIS_ORDER_DOCUMENT_ID_1, 1);
st.doGiveItems(MAGIC_SWORD_HILT_ID, 1);
htmltext = "gentler_q0046_0201.htm";
} else if (event.equals("3")) {
st.setCond(3);
st.doTakeItems(MAGIC_SWORD_HILT_ID, 1);
st.doGiveItems(GALLADUCCIS_ORDER_DOCUMENT_ID_2, 1);
htmltext = "galladuchi_q0046_0301.htm";
} else if (event.equals("4")) {
st.setCond(4);
st.doTakeItems(GALLADUCCIS_ORDER_DOCUMENT_ID_2, 1);
st.doGiveItems(GEMSTONE_POWDER_ID, 1);
htmltext = "sandra_q0046_0401.htm";
} else if (event.equals("5")) {
st.setCond(5);
st.doTakeItems(GEMSTONE_POWDER_ID, 1);
st.doGiveItems(GALLADUCCIS_ORDER_DOCUMENT_ID_3, 1);
htmltext = "galladuchi_q0046_0501.htm";
} else if (event.equals("6")) {
st.setCond(6);
st.doTakeItems(GALLADUCCIS_ORDER_DOCUMENT_ID_3, 1);
st.doGiveItems(PURIFIED_MAGIC_NECKLACE_ID, 1);
htmltext = "dustin_q0046_0601.htm";
} else if (event.equals("7")) {
st.doRewardItems(SCROLL_OF_ESCAPE_ELVEN_VILLAGE, 1);
st.doTakeItems(PURIFIED_MAGIC_NECKLACE_ID, 1);
htmltext = "galladuchi_q0046_0701.htm";
st.setCond(0);
st.playSound(SOUND_FINISH);
st.exitCurrentQuest(false);
}
return htmltext;
}
@Override
public String onTalk(NpcInstance npc, QuestState st) {
int npcId = npc.getNpcId();
String htmltext = "noquest";
int id = st.getState();
if (id == CREATED) {
if (st.getPlayer().getRace() != Race.elf || st.getQuestItemsCount(MARK_OF_TRAVELER_ID) == 0) {
htmltext = "galladuchi_q0046_0102.htm";
st.exitCurrentQuest(true);
} else if (st.getPlayer().getLevel() < 3) {
htmltext = "galladuchi_q0046_0103.htm";
st.exitCurrentQuest(true);
} else
htmltext = "galladuchi_q0046_0101.htm";
} else if (npcId == 30097 && st.getCond() == 1)
htmltext = "galladuchi_q0046_0105.htm";
else if (npcId == 30097 && st.getCond() == 2)
htmltext = "galladuchi_q0046_0201.htm";
else if (npcId == 30097 && st.getCond() == 3)
htmltext = "galladuchi_q0046_0303.htm";
else if (npcId == 30097 && st.getCond() == 4)
htmltext = "galladuchi_q0046_0401.htm";
else if (npcId == 30097 && st.getCond() == 5)
htmltext = "galladuchi_q0046_0503.htm";
else if (npcId == 30097 && st.getCond() == 6)
htmltext = "galladuchi_q0046_0601.htm";
else if (npcId == 30094 && st.getCond() == 1)
htmltext = "gentler_q0046_0101.htm";
else if (npcId == 30094 && st.getCond() == 2)
htmltext = "gentler_q0046_0203.htm";
else if (npcId == 30090 && st.getCond() == 3)
htmltext = "sandra_q0046_0301.htm";
else if (npcId == 30090 && st.getCond() == 4)
htmltext = "sandra_q0046_0403.htm";
else if (npcId == 30116 && st.getCond() == 5)
htmltext = "dustin_q0046_0501.htm";
else if (npcId == 30116 && st.getCond() == 6)
htmltext = "dustin_q0046_0603.htm";
return htmltext;
}
} | [
"pavel.shuckii@yandex.ru"
] | pavel.shuckii@yandex.ru |
f7addfc29ab633cd097477e41928c2ab505c6874 | d59eaecab91b190334570a2e780588351deece39 | /src/com/atguigu/bookstore/service/OrderService.java | 164e5a5d9374138281c4e4d13d97a168f30875f1 | [] | no_license | jianglei-tianma/JavaEE | 521ae08f93aea45ec5be372fe437ede80eaadbd0 | a6707212dc99e1c36c58b81c60f9d03a6472890a | refs/heads/master | 2020-06-23T07:59:46.996754 | 2019-07-24T05:34:50 | 2019-07-24T05:34:50 | 198,565,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package com.atguigu.bookstore.service;
import java.util.List;
import com.atguigu.bookstore.bean.Cart;
import com.atguigu.bookstore.bean.Order;
import com.atguigu.bookstore.bean.OrderItem;
import com.atguigu.bookstore.bean.User;
public interface OrderService {
/**
* 去结账的方法
* @param user
* @param cart
* @return
*/
public String createOrder(User user ,Cart cart);
/**
* 获取所有订单的方法
* @return
*/
public List<Order> getOrders();
/**
* 根据订单号获取订单项的方法
* @param orderId
* @return
*/
public List<OrderItem> getOrderItemsByOrderId(String orderId);
/**
* 获取用户订单的方法
* @param userId
* @return
*/
public List<Order> getMyOrders(int userId);
/**
*
*
* 发货或确认收货
*/
public void updateOrderState(String orderId , int state);
}
| [
"18761160921@163.com"
] | 18761160921@163.com |
d1a1beb511c191a36143090244941a3c8233232b | ade6a795d709c213ac44457abcd66779072191b9 | /testEJBClient/ejbModule/dto/SupplierDTO.java | d9db7143a1bf48ed3558af7030d1920a5c2def43 | [] | no_license | supadance-duplicate/Tema_ORM | 986afb2df3e61fa40a4dedfcb15f9c4a0374c046 | 37fea3a7a2157d7c1471e89edcb17d820db3c87d | refs/heads/master | 2021-04-12T09:30:39.361597 | 2018-03-21T16:50:05 | 2018-03-21T16:50:05 | 126,212,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 617 | java | package dto;
import java.io.Serializable;
import java.lang.Boolean;
import java.lang.String;
public class SupplierDTO extends UserDTO implements Serializable {
private String nameWinery;
private Boolean visibility;
private static final long serialVersionUID = 1L;
public SupplierDTO() {
super();
}
public String getNameWinery() {
return this.nameWinery;
}
public void setNameWinery(String nameWinery) {
this.nameWinery = nameWinery;
}
public Boolean getVisibility() {
return this.visibility;
}
public void setVisibility(Boolean visibility) {
this.visibility = visibility;
}
}
| [
"ungureanu.andrei28@gmail.com"
] | ungureanu.andrei28@gmail.com |
64c493899e0245cced50969456357bec5f81a8fe | 7929ce928cbf1634c6396651949a072492bc6631 | /app/src/main/java/com/openlab/amazonia_guardabosque/core/BaseView.java | 9ec2c9bdaae3d7d8e92fbfdc173be61a75d64c03 | [] | no_license | bsoto24/Amazonia-usuario | 481e37bba2d7970d31afca0bd1c38bf12ed16c84 | 9ef3e1629ecdd16d3a67763b4e7882a05b18d580 | refs/heads/master | 2021-08-10T15:12:01.370235 | 2017-11-12T18:06:13 | 2017-11-12T18:06:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 869 | java | /*
* Copyright 2016, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.openlab.amazonia_guardabosque.core;
public interface BaseView<T> {
void setPresenter(T mPresenter);
void setLoadingIndicator(boolean active);
void showMessage(String message);
void showErrorMessage(String message);
}
| [
"katherine.caillahua@gmail.com"
] | katherine.caillahua@gmail.com |
ef79fa4e9c66b4a57cc95554a89837d1e48a76be | b19be03fceabb70f77f8e36424c581d0101deada | /zuul-demo/src/main/java/cn/netbuffer/zuuldemo/controller/ZuulRouteController.java | 29e957c4bf1115f0232eec4878853e18bbe2b25d | [] | no_license | netbuffer/spring-cloud-demo | fd56f71c2a1ba96d063c9362823b74618b231b99 | 34a00b32d103f25d615185b820dbc27b77c1200e | refs/heads/master | 2022-08-30T06:28:54.365685 | 2022-08-09T07:31:26 | 2022-08-09T07:31:26 | 121,131,254 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 785 | java | package cn.netbuffer.zuuldemo.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/z")
public class ZuulRouteController {
@Resource
private ZuulProperties zuulProperties;
@GetMapping("properties")
public ZuulProperties getZuulProperties() {
return zuulProperties;
}
@GetMapping("routes")
public Map<String, ZuulProperties.ZuulRoute> getRoutes() {
return zuulProperties.getRoutes();
}
}
| [
"javawiki@163.com"
] | javawiki@163.com |
96da4cf3cef877aa924251ebf38a92e8cf6840c6 | 5598faaaaa6b3d1d8502cbdaca903f9037d99600 | /code_changes/Apache_projects/MAPREDUCE-16/c588e1f3d4eed273bedc629a1efafc48b418188d/TestTaskFail.java | 4e2c2ac5795adde7298aa9551e4b9e5e264d848d | [] | no_license | SPEAR-SE/LogInBugReportsEmpirical_Data | 94d1178346b4624ebe90cf515702fac86f8e2672 | ab9603c66899b48b0b86bdf63ae7f7a604212b29 | refs/heads/master | 2022-12-18T02:07:18.084659 | 2020-09-09T16:49:34 | 2020-09-09T16:49:34 | 286,338,252 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 9,218 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.mapred;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import junit.framework.TestCase;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.lib.IdentityReducer;
public class TestTaskFail extends TestCase {
private static String taskLog = "Task attempt log";
static String cleanupLog = "cleanup attempt log";
public static class MapperClass extends MapReduceBase
implements Mapper<LongWritable, Text, Text, IntWritable> {
String taskid;
public void configure(JobConf job) {
taskid = job.get("mapred.task.id");
}
public void map (LongWritable key, Text value,
OutputCollector<Text, IntWritable> output,
Reporter reporter) throws IOException {
System.err.println(taskLog);
assertFalse(Boolean.getBoolean(System
.getProperty("hadoop.tasklog.iscleanup")));
if (taskid.endsWith("_0")) {
throw new IOException();
} else if (taskid.endsWith("_1")) {
System.exit(-1);
} else if (taskid.endsWith("_2")) {
throw new Error();
}
}
}
static class CommitterWithLogs extends FileOutputCommitter {
public void abortTask(TaskAttemptContext context) throws IOException {
System.err.println(cleanupLog);
String attemptId = System.getProperty("hadoop.tasklog.taskid");
assertNotNull(attemptId);
if (attemptId.endsWith("_0")) {
assertFalse(Boolean.getBoolean(System
.getProperty("hadoop.tasklog.iscleanup")));
} else {
assertTrue(Boolean.getBoolean(System
.getProperty("hadoop.tasklog.iscleanup")));
}
super.abortTask(context);
}
}
static class CommitterWithFailTaskCleanup extends FileOutputCommitter {
public void abortTask(TaskAttemptContext context) throws IOException {
System.err.println(cleanupLog);
System.exit(-1);
}
}
static class CommitterWithFailTaskCleanup2 extends FileOutputCommitter {
public void abortTask(TaskAttemptContext context) throws IOException {
System.err.println(cleanupLog);
throw new IOException();
}
}
public RunningJob launchJob(JobConf conf,
Path inDir,
Path outDir,
String input)
throws IOException {
// set up the input file system and write input text.
FileSystem inFs = inDir.getFileSystem(conf);
FileSystem outFs = outDir.getFileSystem(conf);
outFs.delete(outDir, true);
if (!inFs.mkdirs(inDir)) {
throw new IOException("Mkdirs failed to create " + inDir.toString());
}
{
// write input into input file
DataOutputStream file = inFs.create(new Path(inDir, "part-0"));
file.writeBytes(input);
file.close();
}
// configure the mapred Job
conf.setMapperClass(MapperClass.class);
conf.setReducerClass(IdentityReducer.class);
conf.setNumReduceTasks(0);
FileInputFormat.setInputPaths(conf, inDir);
FileOutputFormat.setOutputPath(conf, outDir);
conf.setSpeculativeExecution(false);
String TEST_ROOT_DIR = new Path(System.getProperty("test.build.data",
"/tmp")).toString().replace(' ', '+');
conf.set("test.build.data", TEST_ROOT_DIR);
// return the RunningJob handle.
return new JobClient(conf).submitJob(conf);
}
private void validateAttempt(TaskInProgress tip, TaskAttemptID attemptId,
TaskStatus ts, boolean isCleanup, JobTracker jt)
throws IOException {
assertEquals(isCleanup, tip.isCleanupAttempt(attemptId));
assertTrue(ts != null);
assertEquals(TaskStatus.State.FAILED, ts.getRunState());
// validate tasklogs for task attempt
String log = TestMiniMRMapRedDebugScript.readTaskLog(
TaskLog.LogName.STDERR, attemptId, false);
assertTrue(log.contains(taskLog));
// access the logs from web url
TaskTrackerStatus ttStatus = jt.getTaskTracker(
tip.machineWhereTaskRan(attemptId)).getStatus();
String tasklogUrl = TaskLogServlet.getTaskLogUrl("localhost",
String.valueOf(ttStatus.getHttpPort()), attemptId.toString());
assertEquals(HttpURLConnection.HTTP_OK, TestWebUIAuthorization
.getHttpStatusCode(tasklogUrl, tip.getUser(), "GET"));
if (!isCleanup) {
// validate task logs: tasklog should contain both task logs
// and cleanup logs
assertTrue(log.contains(cleanupLog));
} else {
// validate tasklogs for cleanup attempt
log = TestMiniMRMapRedDebugScript.readTaskLog(
TaskLog.LogName.STDERR, attemptId, true);
assertTrue(log.contains(cleanupLog));
// access the cleanup attempt's logs from web url
ttStatus = jt.getTaskTracker(tip.machineWhereCleanupRan(attemptId))
.getStatus();
String cleanupTasklogUrl = TaskLogServlet.getTaskLogUrl(
"localhost", String.valueOf(ttStatus.getHttpPort()), attemptId
.toString()) + "&cleanup=true";
assertEquals(HttpURLConnection.HTTP_OK, TestWebUIAuthorization
.getHttpStatusCode(cleanupTasklogUrl, tip.getUser(), "GET"));
}
}
private void validateJob(RunningJob job, JobTracker jt)
throws IOException {
assertEquals(JobStatus.SUCCEEDED, job.getJobState());
JobID jobId = job.getID();
// construct the task id of first map task
// this should not be cleanup attempt since the first attempt
// fails with an exception
TaskAttemptID attemptId =
new TaskAttemptID(new TaskID(jobId, true, 0), 0);
TaskInProgress tip = jt.getTip(attemptId.getTaskID());
TaskStatus ts = jt.getTaskStatus(attemptId);
validateAttempt(tip, attemptId, ts, false, jt);
attemptId = new TaskAttemptID(new TaskID(jobId, true, 0), 1);
// this should be cleanup attempt since the second attempt fails
// with System.exit
ts = jt.getTaskStatus(attemptId);
validateAttempt(tip, attemptId, ts, true, jt);
attemptId = new TaskAttemptID(new TaskID(jobId, true, 0), 2);
// this should be cleanup attempt since the third attempt fails
// with Error
ts = jt.getTaskStatus(attemptId);
validateAttempt(tip, attemptId, ts, true, jt);
}
public void testWithDFS() throws IOException {
MiniDFSCluster dfs = null;
MiniMRCluster mr = null;
FileSystem fileSys = null;
try {
final int taskTrackers = 4;
Configuration conf = new Configuration();
dfs = new MiniDFSCluster(conf, 4, true, null);
fileSys = dfs.getFileSystem();
mr = new MiniMRCluster(taskTrackers, fileSys.getUri().toString(), 1);
JobTracker jt = mr.getJobTrackerRunner().getJobTracker();
final Path inDir = new Path("./input");
final Path outDir = new Path("./output");
String input = "The quick brown fox\nhas many silly\nred fox sox\n";
// launch job with fail tasks
JobConf jobConf = mr.createJobConf();
jobConf.setOutputCommitter(CommitterWithLogs.class);
RunningJob rJob = launchJob(jobConf, inDir, outDir, input);
rJob.waitForCompletion();
validateJob(rJob, jt);
// launch job with fail tasks and fail-cleanups
fileSys.delete(outDir, true);
jobConf.setOutputCommitter(CommitterWithFailTaskCleanup.class);
rJob = launchJob(jobConf, inDir, outDir, input);
rJob.waitForCompletion();
validateJob(rJob, jt);
fileSys.delete(outDir, true);
jobConf.setOutputCommitter(CommitterWithFailTaskCleanup2.class);
rJob = launchJob(jobConf, inDir, outDir, input);
rJob.waitForCompletion();
validateJob(rJob, jt);
} finally {
if (dfs != null) { dfs.shutdown(); }
if (mr != null) { mr.shutdown(); }
}
}
public static void main(String[] argv) throws Exception {
TestTaskFail td = new TestTaskFail();
td.testWithDFS();
}
}
| [
"archen94@gmail.com"
] | archen94@gmail.com |
389dd0f521a7baa228bd5633ced4f6e647db78dc | 94e5ba6a3ca8ee93ef27992763091519a9041809 | /5.SPRING CONTROLLER/loginSpringMVC/src/com/codegym/model/Login.java | 1101b3dd18fc924b73e1eb815d9f012b24666065 | [] | no_license | diembate/javaWeb | de190f72a2122e2bf9e79a291f95fd66f4a3d4ca | a18153d5b2ad0ceee48170dbe1335e0df380e133 | refs/heads/master | 2022-12-25T14:26:42.865475 | 2019-12-20T10:35:36 | 2019-12-20T10:35:36 | 229,244,229 | 0 | 0 | null | 2022-12-15T23:25:22 | 2019-12-20T10:31:06 | Java | UTF-8 | Java | false | false | 411 | java | package com.codegym.model;
public class Login {
private String account;
private String password;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"diembate@gmail.com"
] | diembate@gmail.com |
f667c5008b86eeab0c1e57ad4312348d3856f08c | 173145c077f6d0bfdf59029b7e7063db4bb77f26 | /app/src/main/java/com/mxkj/econtrol/utils/DESUtils.java | 0611ff05b511801f1e1c8c565dda6cf3e50642ab | [] | no_license | heaofei/EControl | ab09dc662c7ec8f0a8bb57800937a551d98c83b7 | 38f0470248928217a3d07c6236bfb39f6706cb9a | refs/heads/master | 2020-09-11T23:36:42.690348 | 2019-04-22T06:21:24 | 2019-04-22T06:21:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,974 | java | package com.mxkj.econtrol.utils;
import org.apache.commons.net.util.Base64;
import java.util.UUID;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class DESUtils {
//算法名称
public static final String KEY_ALGORITHM = "DES";
//算法名称/加密模式/填充方式
//DES共有四种工作模式-->>ECB:电子密码本模式、CBC:加密分组链接模式、CFB:加密反馈模式、OFB:输出反馈模式
public static final String CIPHER_ALGORITHM = "DES/CBC/PKCS5Padding";
public static String getDefault8Keys(){
String s = UUID.randomUUID().toString();
System.out.println(s);
String [] str = s.split("-");
s = "";
for(String st : str){
s = s + st;
}
return s.substring(0,8);
}
private static byte[] iv = { 1, 2, 3, 4, 5, 6, 7, 8};
public static String decryptDES(String decryptString, String decryptKey) throws Exception {
IvParameterSpec zeroIv = new IvParameterSpec(iv);
SecretKeySpec key = new SecretKeySpec(decryptKey.getBytes(), KEY_ALGORITHM);
byte[] byteMi = Base64.decodeBase64(decryptString);
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, key, zeroIv);
byte decryptedData[] = cipher.doFinal(byteMi);
return new String(decryptedData);
}
public static String encryptDES(String encryptString, String encryptKey)
throws Exception {
IvParameterSpec zeroIv = new IvParameterSpec(iv);
SecretKeySpec key = new SecretKeySpec(encryptKey.getBytes(), KEY_ALGORITHM);
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, key, zeroIv);
byte[] encryptedData = cipher.doFinal(encryptString.getBytes());
return Base64.encodeBase64String(encryptedData);
}
public static void main(String[] args) throws Exception {
String key =getDefault8Keys();
String data = "{\"device\":\"SHZJHFSJ131803\",\"serial\":\"01njSuxhhFbd\",\"action\":\"REGIST\",\"clientId\":\"Cient1000\",\"appId\":\"6953E411FCE84CFD150406C3E2A558AD0ECB3BED\",\"randomStr\":\"20171206150232\",\"sign\":\"f1f64c215c1f18f2d51b2e85eefa47de952b471d\"}";
// String result = "XfLgGoqjor3C9kXQy2Jh+0vLnAxayKD2cJFRUdIs20q4HWAUM+VU7rB9Fb5IwZUDcH1mw1UUgFtQHR+LFey9YjPkVTWWY20ODPCMoXt633oO8LkaVev1vrxkZ8NfZEGwGTZR+vzZxRzFoN4i97fZwojkPD80wQCQ2j+lib7FQDP7xW2Uh+RIX0oawoMMMhouWRn93Bi/woWGcEd/v5Md0vFA6iZCnUo9NXwX3m4kDyLf2lsV+QGFliywnxG1Nkz9nyTtyXdZdCTQuKim5YAf3F89cDQlVNkFgRsa4A5tnfI=";
System.out.println("键值("+key.length()+"):"+key);
System.out.println("数据("+data.length()+"):"+data);
String result = encryptDES(data, key);//用DES加密
System.out.println("加密结果("+result.length()+"):"+result);
System.out.println("解密结果:"+decryptDES(result,key));
}
/**
* 获取字符串的长度,如果有中文,则每个中文字符计为2位
* @param value 指定的字符串
* @return 字符串的长度
*/
public static int length(String value) {
int valueLength = 0;
String chinese = "[\u0391-\uFFE5]";
/* 获取字段值的长度,如果含中文字符,则每个中文字符长度为2,否则为1 */
for (int i = 0; i < value.length(); i++) {
/* 获取一个字符 */
String temp = value.substring(i, i + 1);
/* 判断是否为中文字符 */
if (temp.matches(chinese)) {
/* 中文字符长度为2 */
valueLength += 3;
} else {
/* 其他字符长度为1 */
valueLength += 1;
}
}
return valueLength;
}
}
| [
"joshuajan@JoshuadeMacBook-Pro.local"
] | joshuajan@JoshuadeMacBook-Pro.local |
c42891396628989fdd5f45f470ed2db74069004d | 4b2b6fe260ba39f684f496992513cb8bc07dfcbc | /com/planet_ink/coffee_mud/Abilities/Prayers/Prayer_SoulPeering.java | 6e2e3dd191734627e77310dc706160891ebcaf22 | [
"Apache-2.0"
] | permissive | vjanmey/EpicMudfia | ceb26feeac6f5b3eb48670f81ea43d8648314851 | 63c65489c673f4f8337484ea2e6ebfc11a09364c | refs/heads/master | 2021-01-18T20:12:08.160733 | 2014-06-22T04:38:14 | 2014-06-22T04:38:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,791 | java | package com.planet_ink.coffee_mud.Abilities.Prayers;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2000-2014 Bo Zimmerman
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.
*/
@SuppressWarnings("rawtypes")
public class Prayer_SoulPeering extends Prayer
{
@Override public String ID() { return "Prayer_SoulPeering"; }
private final static String localizedName = CMLib.lang()._("Soul Peering");
@Override public String name() { return localizedName; }
@Override public int abstractQuality(){ return Ability.QUALITY_INDIFFERENT;}
@Override public int classificationCode(){return Ability.ACODE_PRAYER|Ability.DOMAIN_COMMUNING;}
@Override
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null) return false;
if(target==mob) return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,target,this,somanticCastCode(mob,target,auto),auto?"":_("^S<S-NAME> @x1 while peering into <T-YOUPOSS> soul.^?",prayWord(mob)));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
final StringBuilder str=CMLib.commands().getScore(target);
if(!mob.isMonster())
mob.session().wraplessPrintln(str.toString());
}
}
else
beneficialVisualFizzle(mob,target,_("<S-NAME> attempt(s) to peer into <T-YOUPOSS> soul, but fails."));
return success;
}
}
| [
"vjanmey@gmail.com"
] | vjanmey@gmail.com |
ff01ba516b28a80cecf480d72a169944574a4197 | 0b0c8b81dad1ed8b5c0e254bd8d04d8a8d8565a9 | /BoMa/app/src/main/java/com/example/mikerah/boma/BarcodeTools/BarcodeCaptureActivity.java | 35c7778c6f1ddba1c702a8f4118489b90a562761 | [
"MIT"
] | permissive | Mikerah/BoMa | 5ea4e2e58f855caec9d30af3010c5bbb9ca891d3 | cf3bbb7314b0579c4e396323c5e0100267aa9d50 | refs/heads/master | 2021-08-30T22:09:15.903225 | 2017-12-19T16:05:06 | 2017-12-19T16:05:06 | 111,819,890 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,467 | java | package com.example.mikerah.boma.BarcodeTools;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.hardware.Camera;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.widget.Toast;
import com.example.mikerah.boma.GraphicOverlay;
import com.example.mikerah.boma.R;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.android.gms.vision.MultiProcessor;
import com.google.android.gms.vision.barcode.Barcode;
import com.google.android.gms.vision.barcode.BarcodeDetector;
import java.io.IOException;
public final class BarcodeCaptureActivity extends AppCompatActivity implements BarcodeGraphicTracker.BarcodeUpdateListener {
private static final String TAG = "Barcode-reader";
// intent request code to handle updating play services if needed.
private static final int RC_HANDLE_GMS = 9001;
// permission request codes need to be < 256
private static final int RC_HANDLE_CAMERA_PERM = 2;
// constants used to pass extra data in the intent
public static final String BarcodeObject = "Barcode";
private CameraSource mCameraSource;
private CameraSourcePreview mPreview;
private GraphicOverlay<BarcodeGraphic> mGraphicOverlay;
// helper objects for detecting taps and pinches.
private ScaleGestureDetector scaleGestureDetector;
private GestureDetector gestureDetector;
/**
* Initializes the UI and creates the detector pipeline.
*/
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.activity_barcode_capture);
mPreview = (CameraSourcePreview) findViewById(R.id.preview);
mGraphicOverlay = (GraphicOverlay<BarcodeGraphic>) findViewById(R.id.graphicOverlay);
// Check for the camera permission before accessing the camera. If the
// permission is not granted yet, request permission.
int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
if (rc == PackageManager.PERMISSION_GRANTED) {
createCameraSource(true, true);
} else {
requestCameraPermission();
}
gestureDetector = new GestureDetector(this, new CaptureGestureListener());
scaleGestureDetector = new ScaleGestureDetector(this, new ScaleListener());
Snackbar.make(mGraphicOverlay, "Tap to capture. Pinch/Stretch to zoom",
Snackbar.LENGTH_LONG)
.show();
}
/**
* Handles the requesting of the camera permission. This includes
* showing a "Snackbar" message of why the permission is needed then
* sending the request.
*/
private void requestCameraPermission() {
Log.w(TAG, "Camera permission is not granted. Requesting permission");
final String[] permissions = new String[]{Manifest.permission.CAMERA};
if (!ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.CAMERA)) {
ActivityCompat.requestPermissions(this, permissions, RC_HANDLE_CAMERA_PERM);
return;
}
final Activity thisActivity = this;
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
ActivityCompat.requestPermissions(thisActivity, permissions,
RC_HANDLE_CAMERA_PERM);
}
};
findViewById(R.id.topLayout).setOnClickListener(listener);
Snackbar.make(mGraphicOverlay, R.string.permission_camera_rationale,
Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.ok, listener)
.show();
}
@Override
public boolean onTouchEvent(MotionEvent e) {
boolean b = scaleGestureDetector.onTouchEvent(e);
boolean c = gestureDetector.onTouchEvent(e);
return b || c || super.onTouchEvent(e);
}
/**
* Creates and starts the camera. Note that this uses a higher resolution in comparison
* to other detection examples to enable the barcode detector to detect small barcodes
* at long distances.
*
* Suppressing InlinedApi since there is a check that the minimum version is met before using
* the constant.
*/
@SuppressLint("InlinedApi")
private void createCameraSource(boolean autoFocus, boolean useFlash) {
Context context = getApplicationContext();
// A barcode detector is created to track barcodes. An associated multi-processor instance
// is set to receive the barcode detection results, track the barcodes, and maintain
// graphics for each barcode on screen. The factory is used by the multi-processor to
// create a separate tracker instance for each barcode.
BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(context).build();
BarcodeTrackerFactory barcodeFactory = new BarcodeTrackerFactory(mGraphicOverlay, this);
barcodeDetector.setProcessor(
new MultiProcessor.Builder<>(barcodeFactory).build());
if (!barcodeDetector.isOperational()) {
// Note: The first time that an app using the barcode or face API is installed on a
// device, GMS will download a native libraries to the device in order to do detection.
// Usually this completes before the app is run for the first time. But if that
// download has not yet completed, then the above call will not detect any barcodes
// and/or faces.
//
// isOperational() can be used to check if the required native libraries are currently
// available. The detectors will automatically become operational once the library
// downloads complete on device.
Log.w(TAG, "Detector dependencies are not yet available.");
// Check for low storage. If there is low storage, the native library will not be
// downloaded, so detection will not become operational.
IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
boolean hasLowStorage = registerReceiver(null, lowstorageFilter) != null;
if (hasLowStorage) {
Toast.makeText(this, R.string.low_storage_error, Toast.LENGTH_LONG).show();
Log.w(TAG, getString(R.string.low_storage_error));
}
}
// Creates and starts the camera. Note that this uses a higher resolution in comparison
// to other detection examples to enable the barcode detector to detect small barcodes
// at long distances.
CameraSource.Builder builder = new CameraSource.Builder(getApplicationContext(), barcodeDetector)
.setFacing(CameraSource.CAMERA_FACING_BACK)
.setRequestedPreviewSize(1600, 1024)
.setRequestedFps(15.0f);
// make sure that auto focus is an available option
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
builder = builder.setFocusMode(
autoFocus ? Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE : null);
}
mCameraSource = builder
.setFlashMode(useFlash ? Camera.Parameters.FLASH_MODE_TORCH : null)
.build();
}
/**
* Restarts the camera.
*/
@Override
protected void onResume() {
super.onResume();
startCameraSource();
}
/**
* Stops the camera.
*/
@Override
protected void onPause() {
super.onPause();
if (mPreview != null) {
mPreview.stop();
}
}
/**
* Releases the resources associated with the camera source, the associated detectors, and the
* rest of the processing pipeline.
*/
@Override
protected void onDestroy() {
super.onDestroy();
if (mPreview != null) {
mPreview.release();
}
}
/**
* Callback for the result from requesting permissions. This method
* is invoked for every call on {@link #requestPermissions(String[], int)}.
* <p>
* <strong>Note:</strong> It is possible that the permissions request interaction
* with the user is interrupted. In this case you will receive empty permissions
* and results arrays which should be treated as a cancellation.
* </p>
*
* @param requestCode The request code passed in {@link #requestPermissions(String[], int)}.
* @param permissions The requested permissions. Never null.
* @param grantResults The grant results for the corresponding permissions
* which is either {@link PackageManager#PERMISSION_GRANTED}
* or {@link PackageManager#PERMISSION_DENIED}. Never null.
* @see #requestPermissions(String[], int)
*/
@Override
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode != RC_HANDLE_CAMERA_PERM) {
Log.d(TAG, "Got unexpected permission result: " + requestCode);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
return;
}
if (grantResults.length != 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "Camera permission granted - initialize the camera source");
// we have permission, so create the camerasource
createCameraSource(true,true);
return;
}
Log.e(TAG, "Permission not granted: results len = " + grantResults.length +
" Result code = " + (grantResults.length > 0 ? grantResults[0] : "(empty)"));
DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Multitracker sample")
.setMessage(R.string.no_camera_permission)
.setPositiveButton(R.string.ok, listener)
.show();
}
/**
* Starts or restarts the camera source, if it exists. If the camera source doesn't exist yet
* (e.g., because onResume was called before the camera source was created), this will be called
* again when the camera source is created.
*/
private void startCameraSource() throws SecurityException {
// check that the device has play services available.
int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
getApplicationContext());
if (code != ConnectionResult.SUCCESS) {
Dialog dlg =
GoogleApiAvailability.getInstance().getErrorDialog(this, code, RC_HANDLE_GMS);
dlg.show();
}
if (mCameraSource != null) {
try {
mPreview.start(mCameraSource, mGraphicOverlay);
} catch (IOException e) {
Log.e(TAG, "Unable to start camera source.", e);
mCameraSource.release();
mCameraSource = null;
}
}
}
/**
* onTap returns the tapped barcode result to the calling Activity.
*
* @param rawX - the raw position of the tap
* @param rawY - the raw position of the tap.
* @return true if the activity is ending.
*/
private boolean onTap(float rawX, float rawY) {
// Find tap point in preview frame coordinates.
int[] location = new int[2];
mGraphicOverlay.getLocationOnScreen(location);
float x = (rawX - location[0]) / mGraphicOverlay.getWidthScaleFactor();
float y = (rawY - location[1]) / mGraphicOverlay.getHeightScaleFactor();
// Find the barcode whose center is closest to the tapped point.
Barcode best = null;
float bestDistance = Float.MAX_VALUE;
for (BarcodeGraphic graphic : mGraphicOverlay.getGraphics()) {
Barcode barcode = graphic.getBarcode();
if (barcode.getBoundingBox().contains((int) x, (int) y)) {
// Exact hit, no need to keep looking.
best = barcode;
break;
}
float dx = x - barcode.getBoundingBox().centerX();
float dy = y - barcode.getBoundingBox().centerY();
float distance = (dx * dx) + (dy * dy); // actually squared distance
if (distance < bestDistance) {
best = barcode;
bestDistance = distance;
}
}
if (best != null) {
Intent data = new Intent();
data.putExtra(BarcodeObject, best);
setResult(CommonStatusCodes.SUCCESS, data);
finish();
return true;
}
return false;
}
private class CaptureGestureListener extends GestureDetector.SimpleOnGestureListener {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
return onTap(e.getRawX(), e.getRawY()) || super.onSingleTapConfirmed(e);
}
}
private class ScaleListener implements ScaleGestureDetector.OnScaleGestureListener {
/**
* Responds to scaling events for a gesture in progress.
* Reported by pointer motion.
*
* @param detector The detector reporting the event - use this to
* retrieve extended info about event state.
* @return Whether or not the detector should consider this event
* as handled. If an event was not handled, the detector
* will continue to accumulate movement until an event is
* handled. This can be useful if an application, for example,
* only wants to update scaling factors if the change is
* greater than 0.01.
*/
@Override
public boolean onScale(ScaleGestureDetector detector) {
return false;
}
/**
* Responds to the beginning of a scaling gesture. Reported by
* new pointers going down.
*
* @param detector The detector reporting the event - use this to
* retrieve extended info about event state.
* @return Whether or not the detector should continue recognizing
* this gesture. For example, if a gesture is beginning
* with a focal point outside of a region where it makes
* sense, onScaleBegin() may return false to ignore the
* rest of the gesture.
*/
@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
return true;
}
/**
* Responds to the end of a scale gesture. Reported by existing
* pointers going up.
* <p/>
* Once a scale has ended, {@link ScaleGestureDetector#getFocusX()}
* and {@link ScaleGestureDetector#getFocusY()} will return focal point
* of the pointers remaining on the screen.
*
* @param detector The detector reporting the event - use this to
* retrieve extended info about event state.
*/
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
mCameraSource.doZoom(detector.getScaleFactor());
}
}
@Override
public void onBarcodeDetected(Barcode barcode) {
//do something with barcode data returned
}
}
| [
"mikerah14@gmail.com"
] | mikerah14@gmail.com |
55bb06cd19c1f22a96948904c31b176f47e4af34 | 7872a7570269708aa3d443561b9d064ca9e2a1d7 | /web/src/test/java/hu/psprog/leaflet/web/rest/conversion/entry/EntryUpdateRequestModelToEntryVOConverterTest.java | 6cecda2b98824aafcada36ff83cec43e3703dcfa | [] | no_license | petersmith-hun/leaflet-backend | 2dee975662ee2b53e971661c773a3e322415b7f7 | f6e0072520555a0c837468fd85e4434aa037487d | refs/heads/master | 2023-07-19T08:29:44.899936 | 2023-07-09T15:19:09 | 2023-07-09T15:19:09 | 59,896,821 | 0 | 0 | null | 2023-07-09T15:19:11 | 2016-05-28T13:51:04 | Java | UTF-8 | Java | false | false | 1,199 | java | package hu.psprog.leaflet.web.rest.conversion.entry;
import hu.psprog.leaflet.service.vo.EntryVO;
import hu.psprog.leaflet.web.test.ConversionTestObjects;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Unit tests for {@link EntryUpdateRequestModelToEntryVOConverter}.
*
* @author Peter Smith
*/
@ExtendWith(MockitoExtension.class)
public class EntryUpdateRequestModelToEntryVOConverterTest extends ConversionTestObjects {
@InjectMocks
private EntryUpdateRequestModelToEntryVOConverter converter;
@Test
public void shouldConvertCreateRequest() {
// when
EntryVO result = converter.convert(ENTRY_CREATE_REQUEST_MODEL);
// then
assertThat(result, equalTo(ENTRY_VO_FOR_CREATE));
}
@Test
public void shouldConvertUpdateRequest() {
// when
EntryVO result = converter.convert(ENTRY_UPDATE_REQUEST_MODEL);
// then
assertThat(result, equalTo(ENTRY_VO_FOR_UPDATE));
}
} | [
"peter.kovacs0519@gmail.com"
] | peter.kovacs0519@gmail.com |
d0335811f611997a0cceadb9cbf24fa73d0bea06 | d64852be80460b91e2d1c32edb3ecb7510bcaa4c | /app/src/test/java/it/gilconsulting/www/portaunamico/ExampleUnitTest.java | c1f047d1bf61b66969b0b731fcef181ceb9964f7 | [] | no_license | albezzz/pua | a99398777b37d0daf349596cb2975bd4b2b2e369 | 0a8cccd98c18a6507d5e8976e7c50295cb4573a5 | refs/heads/master | 2020-02-26T13:38:25.548181 | 2016-08-04T10:26:45 | 2016-08-04T10:26:45 | 64,925,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package it.gilconsulting.www.portaunamico;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"Alberto Boschi"
] | Alberto Boschi |
cd7f60ce2e828860e409df55e934ed42eca6dbd9 | 878bdb7a1a97626d296680be7b3dcc6e9f4684f1 | /src/main/java/br/com/cast/avaliacao/paginacao/Operacao.java | c99dc1cfbe45093ef09e19b1f1843b599513c6cb | [] | no_license | djeisoncs/cast | 3442c4d218578f73ad3b368e91bfa75cdcc48e39 | f0ccec8686a5db7059b90a664af2274c53bb31af | refs/heads/master | 2023-02-15T01:33:41.714196 | 2021-01-10T12:29:14 | 2021-01-10T12:29:14 | 324,596,212 | 0 | 0 | null | 2021-01-07T23:16:18 | 2020-12-26T16:45:03 | Java | UTF-8 | Java | false | false | 11,861 | java | package br.com.cast.avaliacao.paginacao;
import org.hibernate.criterion.MatchMode;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import java.math.BigDecimal;
import java.util.Date;
/**
* Created by djeison.cassimiro on 26/12/2020
*/
public enum Operacao {
IN {
public Predicate restricao(CriteriaBuilder criteriaBuilder, Path path, Object[] valor) {
return path.in(valor);
}
@Override
public boolean necessitaDeValor() {
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
NOT_IN {
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.not(path.in(valor));
}
@Override
public boolean necessitaDeValor() {
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
EQ_SUM {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.equal(criteriaBuilder.sum(path), valor[0]);
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return true;
}
},
EQ {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.equal(path, valor[0]);
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
NOT_EQ {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.notEqual(path, valor[0]);
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
GE {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
if(valor[0] instanceof Date){
return criteriaBuilder.greaterThanOrEqualTo(path, (Date)valor[0]);
} else if(valor[0] instanceof Integer) {
return criteriaBuilder.greaterThanOrEqualTo(path, (Integer)valor[0]);
} else if(valor[0] instanceof Long) {
return criteriaBuilder.greaterThanOrEqualTo(path, (Long)valor[0]);
} else if(valor[0] instanceof Float) {
return criteriaBuilder.greaterThanOrEqualTo(path, (Float)valor[0]);
} else if(valor[0] instanceof Double) {
return criteriaBuilder.greaterThanOrEqualTo(path, (Double)valor[0]);
} else {
return criteriaBuilder.greaterThanOrEqualTo(path, (BigDecimal)valor[0]);
}
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
LE {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
if(valor[0] instanceof Date){
return criteriaBuilder.lessThanOrEqualTo(path, (Date)valor[0]);
} else if(valor[0] instanceof Integer) {
return criteriaBuilder.lessThanOrEqualTo(path, (Integer)valor[0]);
} else if(valor[0] instanceof Long) {
return criteriaBuilder.lessThanOrEqualTo(path, (Long)valor[0]);
} else if(valor[0] instanceof Float) {
return criteriaBuilder.lessThanOrEqualTo(path, (Float)valor[0]);
} else if(valor[0] instanceof Double) {
return criteriaBuilder.lessThanOrEqualTo(path, (Double)valor[0]);
} else {
return criteriaBuilder.lessThanOrEqualTo(path, (BigDecimal)valor[0]);
}
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
GT {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
if(valor[0] instanceof Date){
return criteriaBuilder.greaterThan(path, (Date)valor[0]);
} else if(valor[0] instanceof Integer) {
return criteriaBuilder.greaterThan(path, (Integer)valor[0]);
} else if(valor[0] instanceof Long) {
return criteriaBuilder.greaterThan(path, (Long)valor[0]);
} else if(valor[0] instanceof Float) {
return criteriaBuilder.greaterThan(path, (Float)valor[0]);
} else if(valor[0] instanceof Double) {
return criteriaBuilder.greaterThan(path, (Double)valor[0]);
} else {
return criteriaBuilder.greaterThan(path, (BigDecimal)valor[0]);
}
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
LT {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
if(valor[0] instanceof Date){
return criteriaBuilder.lessThan(path, (Date)valor[0]);
} else if(valor[0] instanceof Integer) {
return criteriaBuilder.lessThan(path, (Integer)valor[0]);
} else if(valor[0] instanceof Long) {
return criteriaBuilder.lessThan(path, (Long)valor[0]);
} else if(valor[0] instanceof Float) {
return criteriaBuilder.lessThan(path, (Float)valor[0]);
} else if(valor[0] instanceof Double) {
return criteriaBuilder.lessThan(path, (Double)valor[0]);
} else {
return criteriaBuilder.lessThan(path, (BigDecimal)valor[0]);
}
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
LIKE {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.like(path, "%" + valor[0].toString() + "%");
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
LIKE_START {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.like(path, MatchMode.START.toMatchString(valor[0].toString()));
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
ILIKE {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.like(criteriaBuilder.lower(path), valor[0].toString().toLowerCase());
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
ILIKE_ANYWHERE {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.like(criteriaBuilder.lower(path), MatchMode.ANYWHERE.toMatchString(valor[0].toString().toLowerCase()));
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
ILIKE_START {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.like(criteriaBuilder.lower(path), MatchMode.START.toMatchString(valor[0].toString().toLowerCase()));
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
},
IS_EMPTY {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.isEmpty(path);
}
@Override
public boolean necessitaDeValor(){
return false;
}
@Override
public boolean filtroHaving() {
return false;
}
},
IS_NOT_EMPTY {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.isNotEmpty(path);
}
@Override
public boolean necessitaDeValor(){
return false;
}
@Override
public boolean filtroHaving() {
return false;
}
},
IS_NULL {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.isNull(path);
}
@Override
public boolean necessitaDeValor(){
return false;
}
@Override
public boolean filtroHaving() {
return false;
}
},
IS_NOT_NULL {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
return criteriaBuilder.isNotNull(path);
}
@Override
public boolean necessitaDeValor(){
return false;
}
@Override
public boolean filtroHaving() {
return false;
}
},
BETWEEN {
@Override
public Predicate restricao(CriteriaBuilder criteriaBuilder,Path path, Object[] valor) {
if(valor[0] instanceof Date){
return criteriaBuilder.between(path, (Date)valor[0], (Date) valor[1]);
} else if(valor[0] instanceof Integer) {
return criteriaBuilder.between(path, (Integer)valor[0], (Integer)valor[0]);
} else if(valor[0] instanceof Long) {
return criteriaBuilder.between(path, (Long)valor[0], (Long)valor[0]);
} else if(valor[0] instanceof Float) {
return criteriaBuilder.between(path, (Float)valor[0], (Float)valor[0]);
} else if(valor[0] instanceof Double) {
return criteriaBuilder.between(path, (Double)valor[0], (Double)valor[0]);
} else {
return criteriaBuilder.between(path, (BigDecimal)valor[0], (BigDecimal)valor[0]);
}
}
@Override
public boolean necessitaDeValor(){
return true;
}
@Override
public boolean filtroHaving() {
return false;
}
};
public abstract Predicate restricao(CriteriaBuilder criteriaBuilder, Path path, Object[] valor);
public abstract boolean necessitaDeValor();
public abstract boolean filtroHaving();
}
| [
"djeison.dev@gmail.com"
] | djeison.dev@gmail.com |
d63cf062b49790392246cbc90a1c758d93350cd6 | eaa55ad0e71e92482d600e47b34cc798f0b97ff0 | /src/main/java/com/training/exception/SpringException.java | f06c6a0f34997956b2cfb450001190b5cde5eecb | [] | no_license | ndelacruzoliver/MyApp | ebd15b1b2d1754242190b721177eca42407172f1 | c3e79f66067f410983838fce051b9ae6df5edcf5 | refs/heads/master | 2021-09-10T20:00:48.641010 | 2018-04-01T05:59:18 | 2018-04-01T05:59:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.training.exception;
@SuppressWarnings("serial")
public class SpringException extends RuntimeException {
private String exceptionMsg;
public SpringException(String exceptionMsg) {
this.exceptionMsg = exceptionMsg;
}
public String getExceptionMsg() {
return exceptionMsg;
}
public void setExceptionMsg(String exceptionMsg) {
this.exceptionMsg = exceptionMsg;
}
}
| [
"oliver.delacruz@sungard.com"
] | oliver.delacruz@sungard.com |
e9174a4d1e8fe4e63345a600454489d688fd754e | 978cc3f7e19f1b6e5cbbcc7a7f19dd3d33b16af9 | /New Folder/app/src/main/java/com/google/android/gms/internal/mn.java | 1686d9068b1a01ceb426977307296482cd585e79 | [] | no_license | pshyc007/Capstoneprojectrepo | e0efae0eeafb1b55973e9607f8b2d45d73ea7a5c | f41e9a65d595a085f6624e89c37f2333945c50d7 | refs/heads/master | 2021-01-16T18:19:36.246241 | 2015-03-11T13:28:48 | 2015-03-11T13:28:48 | 32,010,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 450 | 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 com.google.android.gms.internal;
import com.google.android.gms.drive.metadata.c;
// Referenced classes of package com.google.android.gms.internal:
// mv
public class mn extends mv
implements c
{
public mn(int i)
{
super(i);
}
}
| [
"singhujjwal1011@gmail.com"
] | singhujjwal1011@gmail.com |
dfb88fe9361215fd1c09c0649f31e512535b57d7 | b388afc61225c3a2de7fa0e70aec453b69ff616b | /VFDemo/app/src/main/java/vfa/vfdemo/fragments/drawing/glObjects/WorldSpace.java | 869b35131568e71bb90ea6247efaaf1bcd0ac934 | [] | no_license | vfa-trungtt/vfademo | 50811b7c089bc46e56637ace11b497d5c44236c4 | 0931a365afa2da9e02240413af2b6de535e30d08 | refs/heads/master | 2021-01-12T15:17:41.249447 | 2017-10-23T07:56:57 | 2017-10-23T07:56:57 | 71,748,906 | 0 | 0 | null | 2017-08-29T13:32:18 | 2016-10-24T03:33:52 | Java | UTF-8 | Java | false | false | 121 | java | package vfa.vfdemo.fragments.drawing.glObjects;
/**
* Created by Vitalify on 3/22/17.
*/
public class WorldSpace {
}
| [
"trungtt@vitalify.asia"
] | trungtt@vitalify.asia |
5edbc74893380dc26c90f2de503b73b756bd6fd0 | 82f076053495623296a246e64eede835efe846c4 | /src/main/java/com/ceng/tutorial/rabbitmq/fanout/listener/GameObjectCreatePSClientListener.java | c91193ae644a072f4737d4d72654403be869d4df | [] | no_license | cengizhanozcan/rabbitmq-exchange-types | 77383c43831503ad388ab66c22a27de485aafd66 | 5fcafc9d56b3cc4375ca746511621c3f7b706891 | refs/heads/master | 2022-12-12T15:27:17.662265 | 2020-08-25T20:13:21 | 2020-08-25T20:13:21 | 290,032,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package com.ceng.tutorial.rabbitmq.fanout.listener;
import com.ceng.tutorial.rabbitmq.fanout.config.GameObjectCreatedExchangeConfig;
import com.ceng.tutorial.rabbitmq.fanout.model.GameObject;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
@Component
public class GameObjectCreatePSClientListener extends GameObjectCreateClientListener {
@RabbitListener(queues = GameObjectCreatedExchangeConfig.GAME_OBJECT_CREATE_PS_CLIENT_QUEUE)
public void consume(GameObject gameObject) {
print("PS", gameObject);
}
}
| [
"cengizhan.ozcan@trendyol.com"
] | cengizhan.ozcan@trendyol.com |
cc685f1e53348ee780bbf282379f30c6d396994a | 4872ad45d2f2c64372d9962dea25af54271601a0 | /provider-payment-hystrix8001/src/main/java/com/yangzl/springcloud/controller/PaymentController.java | 692ee02cdbdd4cf74037ce7c52c3a507e6b67fce | [] | no_license | Timesless/spring-cloud | e9142afc3e2628e331fc869757f40760ad134820 | 60847af899f0881e31c7e6a396c5325689ce373d | refs/heads/master | 2023-01-04T23:02:44.693915 | 2020-11-08T16:16:20 | 2020-11-08T16:16:20 | 291,637,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 828 | java | package com.yangzl.springcloud.controller;
import com.yangzl.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author yangzl
* @Date: 2020/8/30 21:01
* @Desc:
*/
@RestController
@RequestMapping("hystrix")
public class PaymentController {
@Resource
private PaymentService paymentService;
@Value("${server.port}")
private String port;
@GetMapping("ok")
public String ok() {
return paymentService.ok();
}
@GetMapping("timeout")
public String timeout() {
return paymentService.timeout();
}
}
| [
"yangzl@git.com"
] | yangzl@git.com |
6b9b9d0e81d5d5877d8f776a381bbff8df41978c | 957852f2339da953ee98948ab04df2ef937e38d1 | /src ref/classes-dex2jar_source_from_jdcore/com/android/volley/RequestQueue.java | 3df3ec26b572f82c50ed47b291a0653274d1bdef | [] | no_license | nvcervantes/apc_softdev_mi151_04 | c58fdc7d9e7450654fcb3ce2da48ee62cda5394f | 1d23bd19466d2528934110878fdc930c00777636 | refs/heads/master | 2020-03-22T03:00:40.022931 | 2019-05-06T04:48:09 | 2019-05-06T04:48:09 | 139,407,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,338 | java | package com.android.volley;
import android.os.Handler;
import android.os.Looper;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
public class RequestQueue
{
private static final int DEFAULT_NETWORK_THREAD_POOL_SIZE = 4;
private final Cache mCache;
private CacheDispatcher mCacheDispatcher;
private final PriorityBlockingQueue<Request<?>> mCacheQueue = new PriorityBlockingQueue();
private final Set<Request<?>> mCurrentRequests = new HashSet();
private final ResponseDelivery mDelivery;
private NetworkDispatcher[] mDispatchers;
private List<RequestFinishedListener> mFinishedListeners = new ArrayList();
private final Network mNetwork;
private final PriorityBlockingQueue<Request<?>> mNetworkQueue = new PriorityBlockingQueue();
private AtomicInteger mSequenceGenerator = new AtomicInteger();
private final Map<String, Queue<Request<?>>> mWaitingRequests = new HashMap();
public RequestQueue(Cache paramCache, Network paramNetwork)
{
this(paramCache, paramNetwork, 4);
}
public RequestQueue(Cache paramCache, Network paramNetwork, int paramInt)
{
this(paramCache, paramNetwork, paramInt, new ExecutorDelivery(new Handler(Looper.getMainLooper())));
}
public RequestQueue(Cache paramCache, Network paramNetwork, int paramInt, ResponseDelivery paramResponseDelivery)
{
mCache = paramCache;
mNetwork = paramNetwork;
mDispatchers = new NetworkDispatcher[paramInt];
mDelivery = paramResponseDelivery;
}
public <T> Request<T> add(Request<T> paramRequest)
{
paramRequest.setRequestQueue(this);
synchronized (mCurrentRequests)
{
mCurrentRequests.add(paramRequest);
paramRequest.setSequence(getSequenceNumber());
paramRequest.addMarker("add-to-queue");
if (!paramRequest.shouldCache())
{
mNetworkQueue.add(paramRequest);
return paramRequest;
}
synchronized (mWaitingRequests)
{
String str = paramRequest.getCacheKey();
if (mWaitingRequests.containsKey(str))
{
Queue localQueue = (Queue)mWaitingRequests.get(str);
??? = localQueue;
if (localQueue == null) {
??? = new LinkedList();
}
((Queue)???).add(paramRequest);
mWaitingRequests.put(str, ???);
if (VolleyLog.DEBUG) {
VolleyLog.v("Request for cacheKey=%s is in flight, putting on hold.", new Object[] { str });
}
}
else
{
mWaitingRequests.put(str, null);
mCacheQueue.add(paramRequest);
}
return paramRequest;
}
}
}
public <T> void addRequestFinishedListener(RequestFinishedListener<T> paramRequestFinishedListener)
{
synchronized (mFinishedListeners)
{
mFinishedListeners.add(paramRequestFinishedListener);
return;
}
}
public void cancelAll(RequestFilter paramRequestFilter)
{
synchronized (mCurrentRequests)
{
Iterator localIterator = mCurrentRequests.iterator();
while (localIterator.hasNext())
{
Request localRequest = (Request)localIterator.next();
if (paramRequestFilter.apply(localRequest)) {
localRequest.cancel();
}
}
return;
}
}
public void cancelAll(final Object paramObject)
{
if (paramObject == null) {
throw new IllegalArgumentException("Cannot cancelAll with a null tag");
}
cancelAll(new RequestFilter()
{
public boolean apply(Request<?> paramAnonymousRequest)
{
return paramAnonymousRequest.getTag() == paramObject;
}
});
}
<T> void finish(Request<T> paramRequest)
{
synchronized (mCurrentRequests)
{
mCurrentRequests.remove(paramRequest);
synchronized (mFinishedListeners)
{
Object localObject2 = mFinishedListeners.iterator();
while (((Iterator)localObject2).hasNext()) {
((RequestFinishedListener)((Iterator)localObject2).next()).onRequestFinished(paramRequest);
}
if (paramRequest.shouldCache()) {
synchronized (mWaitingRequests)
{
paramRequest = paramRequest.getCacheKey();
localObject2 = (Queue)mWaitingRequests.remove(paramRequest);
if (localObject2 != null)
{
if (VolleyLog.DEBUG) {
VolleyLog.v("Releasing %d waiting requests for cacheKey=%s.", new Object[] { Integer.valueOf(((Queue)localObject2).size()), paramRequest });
}
mCacheQueue.addAll((Collection)localObject2);
}
return;
}
}
return;
}
}
}
public Cache getCache()
{
return mCache;
}
public int getSequenceNumber()
{
return mSequenceGenerator.incrementAndGet();
}
public <T> void removeRequestFinishedListener(RequestFinishedListener<T> paramRequestFinishedListener)
{
synchronized (mFinishedListeners)
{
mFinishedListeners.remove(paramRequestFinishedListener);
return;
}
}
public void start()
{
stop();
mCacheDispatcher = new CacheDispatcher(mCacheQueue, mNetworkQueue, mCache, mDelivery);
mCacheDispatcher.start();
int i = 0;
while (i < mDispatchers.length)
{
NetworkDispatcher localNetworkDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
mDispatchers[i] = localNetworkDispatcher;
localNetworkDispatcher.start();
i += 1;
}
}
public void stop()
{
if (mCacheDispatcher != null) {
mCacheDispatcher.quit();
}
int i = 0;
while (i < mDispatchers.length)
{
if (mDispatchers[i] != null) {
mDispatchers[i].quit();
}
i += 1;
}
}
public static abstract interface RequestFilter
{
public abstract boolean apply(Request<?> paramRequest);
}
public static abstract interface RequestFinishedListener<T>
{
public abstract void onRequestFinished(Request<T> paramRequest);
}
}
| [
"shierenecervantes23@gmail.com"
] | shierenecervantes23@gmail.com |
745d7ec3445c01805e335276cfbf4d3fbcf4c56e | 7ff1a9acf89d16655264aa3e9ae42e49cf26a1d7 | /src/main/java/dev/group1/repos/CommentRepo.java | 2d3239dac3b7bbd6d8cb86f6df4f90fd7943ffbf | [] | no_license | jbarthelmess/RevatureConnectPlus | 668a4179c68216f4007f89146d6e2044f515ef91 | 0f467236b0180b6a29eb7208e49ed67884c8ff75 | refs/heads/master | 2023-03-29T02:04:09.571667 | 2021-03-29T15:03:56 | 2021-03-29T15:03:56 | 348,208,320 | 1 | 0 | null | 2021-03-29T15:03:57 | 2021-03-16T04:01:56 | Java | UTF-8 | Java | false | false | 266 | java | package dev.group1.repos;
import dev.group1.entities.Comment;
import org.springframework.data.repository.CrudRepository;
import java.util.Set;
public interface CommentRepo extends CrudRepository<Comment, Integer> {
Set<Comment> findAllByPostId(int postId);
}
| [
"brookekiser98@yahoo.com"
] | brookekiser98@yahoo.com |
91798b5181b3980d43824bdba6bca9e0af0f89da | 4a9787906df77ebdda101b7b79a98a8f32b117f5 | /src/main/java/ru/tsystems/tchallenge/service/kernel/domain/forum/ForumBootstrap.java | 565a6a98bf75ee83ce021ab939405c4e85ec2140 | [] | no_license | onlythenaive/tchallenge-service-kernel | 3f2b6e8f0e843704cfd73eac63e0e20a49969b39 | 3987b8fdfb6758415ff92edc1c056d794c7c0767 | refs/heads/master | 2021-01-18T04:07:37.763016 | 2017-03-27T03:18:01 | 2017-03-27T03:18:01 | 85,762,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,111 | java | package ru.tsystems.tchallenge.service.kernel.domain.forum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import ru.tsystems.tchallenge.service.kernel.domain.maturity.Maturity;
import ru.tsystems.tchallenge.service.kernel.domain.maturity.MaturityBootstrap;
import ru.tsystems.tchallenge.service.kernel.domain.maturity.MaturityRepository;
import ru.tsystems.tchallenge.service.kernel.domain.specialization.Specialization;
import ru.tsystems.tchallenge.service.kernel.domain.specialization.SpecializationBootstrap;
import ru.tsystems.tchallenge.service.kernel.domain.specialization.SpecializationRepository;
import javax.annotation.PostConstruct;
import java.time.Instant;
@Component
@Lazy(false)
public class ForumBootstrap {
@Autowired
private SpecializationBootstrap specializationBootstrap;
@Autowired
private MaturityBootstrap maturityBootstrap;
@Autowired
private ForumRepository forumRepository;
@Autowired
private SpecializationRepository specializationRepository;
@Autowired
private MaturityRepository maturityRepository;
@PostConstruct
public void init() {
forumRepository.save(joker2016());
forumRepository.save(it2017());
}
private Forum joker2016() {
Forum forum = new Forum();
forum.setTextcode("joker2016");
forum.setTitle("Joker 2016");
forum.setDescription("Для гостей и участников конференции Joker 2016");
forum.setIntroduction("Добро пожаловать на крупнейшую Java-конференцию в России!");
forum.setSince(Instant.parse("2016-10-14T09:00:00.00Z"));
forum.setUntil(Instant.parse("2016-10-14T17:30:00.00Z"));
forum.getMaturities().add(maturity("STUDENT"));
forum.getSpecializations().add(specialization("JAVADEV"));
forum.getSpecializations().add(specialization("TESTER"));
return forum;
}
private Forum it2017() {
Forum forum = new Forum();
forum.setTextcode("it2017");
forum.setTitle("Найти IT 2017");
forum.setDescription("Для гостей и участников конференции Найти IT 2017");
forum.setIntroduction("Добро пожаловать на ежегодную конференцию для молодых специалистов и выпускников в IT-области.");
forum.setSince(Instant.parse("2017-04-01T09:00:00.00Z"));
forum.setUntil(Instant.parse("2017-04-01T17:30:00.00Z"));
forum.getMaturities().add(maturity("STUDENT"));
forum.getSpecializations().add(specialization("JAVADEV"));
forum.getSpecializations().add(specialization("TESTER"));
return forum;
}
private Maturity maturity(String id) {
return maturityRepository.findOne(id);
}
private Specialization specialization(String id) {
return specializationRepository.findOne(id);
}
}
| [
"ilia.gubarev@t-systems.com"
] | ilia.gubarev@t-systems.com |
ad31af2826cd9e0a60e70c8e2facffac3be6d16b | c9f274b67af133dd83b4605e2ae2e62ee0950eba | /TrabajoWeb/src/main/java/com/gamepride/platform/controller/GamerController.java | 7474be4777a20101e021a8eb11f4369f61c87697 | [] | no_license | Natus-Vincere/TFGamePride | 1f0689da4ecc009fb08f8bd282cee41543acdf30 | a22fa3eb667cfbfe6e301774ed2a958ba6da7e6c | refs/heads/master | 2022-11-09T22:37:57.709127 | 2020-06-20T02:49:08 | 2020-06-20T02:49:08 | 269,799,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,114 | java | package com.gamepride.platform.controller;
import java.util.List;
import java.util.Optional;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.bind.support.SessionStatus;
import com.gamepride.platform.model.Gamer;
import com.gamepride.platform.service.IGamerService;
@Controller
@SessionAttributes("gamer")
@RequestMapping("/gamers")
public class GamerController {
@Autowired
private IGamerService gamerService;
@GetMapping("/register")
public String newGamer(Model model) throws Exception {
model.addAttribute("gamer", new Gamer());
return "/gamer/gamerForm";
}
@PostMapping("/save")
public String saveGamer(@Valid Gamer gamer, BindingResult result, Model model, SessionStatus status)
throws Exception {
if (result.hasErrors()) {
return "/gamer/gamerForm";
} else {
if (gamerService.create(gamer)>0) {
model.addAttribute("error", "Este usuario ya existe");
return "/gamer/gamerForm";
} else {
model.addAttribute("info", "Usuario registrado correctamente");
status.setComplete();
}
}
model.addAttribute("gamers",gamerService.getGamers());
return "redirect:/login";
}
@GetMapping("/list")
public String listGamers(Model model) {
try {
model.addAttribute("gamer", new Gamer());
model.addAttribute("gamers", gamerService.getGamers());
} catch (Exception e) {
model.addAttribute("error", e.getMessage());
}
return "/gamer/gamerList";
}
@GetMapping("/search")
public String searchGamer(@RequestParam("name") String name, Model model) {
try {
if (!name.isEmpty()) {
List<Gamer> gamers = gamerService.findByUsername(name);
if (!gamers.isEmpty()) {
model.addAttribute("gamers", gamers);
} else {
model.addAttribute("info", "Competidor no existe");
model.addAttribute("gamers", gamerService.getGamers());
}
} else {
model.addAttribute("info", "Debe ingresar un nombre");
model.addAttribute("gamers", gamerService.getGamers());
}
} catch (Exception e) {
model.addAttribute("error", e.getMessage());
}
return "/gamer/gamerList";
}
@GetMapping("/profile/{id}")
public String profile(@PathVariable(value="id") Long id, Model model) {
try {
Optional<Gamer> gamer=gamerService.findById(id);
if(!gamer.isPresent()) {
model.addAttribute("info","Competidor no existe");
return "redirect:/gamers/list";
}else {
model.addAttribute("gamer",gamer.get());
}
} catch (Exception e) {
model.addAttribute("error",e.getMessage());
}
return "/gamer/profile";
}
} | [
"u201617072@upc.edu.pe"
] | u201617072@upc.edu.pe |
b75480b17886fdd0f88c68edc824f12754974455 | 697a9e160e63877f5388016b21cb8af33740de2b | /src/com/customization/sap/SapConn.java | 8f3b10a4d47e4b6c1c279573fad087caad71fd95 | [] | no_license | LinBinWork/ecology_Yundcx | bf1b4f0f9fb88ff2c2d354f9312b4ad5c0ec2c82 | df9ae5244be51e44de26793b9f5eedb77f7b7618 | refs/heads/master | 2021-05-24T16:58:58.346712 | 2021-02-25T08:39:45 | 2021-02-25T08:39:45 | 253,666,342 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,323 | java | package com.customization.sap;
public class SapConn {
// SAP服务器
private String JCO_ASHOST;
// SAP系统编号
private String JCO_SYSNR;
// SAP集团
private String JCO_CLIENT;
// SAP用户名
private String JCO_USER;
// SAP密码
private String JCO_PASSWD;
// SAP登录语言
private String JCO_LANG;
// 最大连接数
private String JCO_POOL_CAPACITY;
// 最大连接线程
private String JCO_PEAK_LIMIT;
// SAP ROUTER
private String JCO_SAPROUTER;
public SapConn(String JCO_ASHOST, String JCO_SYSNR, String JCO_CLIENT, String JCO_USER,
String JCO_PASSWD, String JCO_LANG, String JCO_POOL_CAPACITY, String JCO_PEAK_LIMIT,
String JCO_SAPROUTER) {
this.JCO_ASHOST = JCO_ASHOST;
this.JCO_SYSNR = JCO_SYSNR;
this.JCO_CLIENT = JCO_CLIENT;
this.JCO_USER = JCO_USER;
this.JCO_PASSWD = JCO_PASSWD;
this.JCO_LANG = JCO_LANG;
this.JCO_POOL_CAPACITY = JCO_POOL_CAPACITY;
this.JCO_PEAK_LIMIT = JCO_PEAK_LIMIT;
this.JCO_SAPROUTER = JCO_SAPROUTER;
}
public SapConn() {}
public String getJCO_ASHOST() {
return JCO_ASHOST;
}
public void setJCO_ASHOST(String JCO_ASHOST) {
this.JCO_ASHOST = JCO_ASHOST;
}
public String getJCO_SYSNR() {
return JCO_SYSNR;
}
public void setJCO_SYSNR(String JCO_SYSNR) {
this.JCO_SYSNR = JCO_SYSNR;
}
public String getJCO_CLIENT() {
return JCO_CLIENT;
}
public void setJCO_CLIENT(String JCO_CLIENT) {
this.JCO_CLIENT = JCO_CLIENT;
}
public String getJCO_USER() {
return JCO_USER;
}
public void setJCO_USER(String JCO_USER) {
this.JCO_USER = JCO_USER;
}
public String getJCO_PASSWD() {
return JCO_PASSWD;
}
public void setJCO_PASSWD(String JCO_PASSWD) {
this.JCO_PASSWD = JCO_PASSWD;
}
public String getJCO_LANG() {
return JCO_LANG;
}
public void setJCO_LANG(String JCO_LANG) {
this.JCO_LANG = JCO_LANG;
}
public String getJCO_POOL_CAPACITY() {
return JCO_POOL_CAPACITY;
}
public void setJCO_POOL_CAPACITY(String JCO_POOL_CAPACITY) {
this.JCO_POOL_CAPACITY = JCO_POOL_CAPACITY;
}
public String getJCO_PEAK_LIMIT() {
return JCO_PEAK_LIMIT;
}
public void setJCO_PEAK_LIMIT(String JCO_PEAK_LIMIT) {
this.JCO_PEAK_LIMIT = JCO_PEAK_LIMIT;
}
public String getJCO_SAPROUTER() {
return JCO_SAPROUTER;
}
public void setJCO_SAPROUTER(String JCO_SAPROUTER) {
this.JCO_SAPROUTER = JCO_SAPROUTER;
}
@Override
public String toString() {
return "SapConn{" +
"JCO_ASHOST='" + JCO_ASHOST + '\'' +
", JCO_SYSNR='" + JCO_SYSNR + '\'' +
", JCO_CLIENT='" + JCO_CLIENT + '\'' +
", JCO_USER='" + JCO_USER + '\'' +
", JCO_PASSWD='" + JCO_PASSWD + '\'' +
", JCO_LANG='" + JCO_LANG + '\'' +
", JCO_POOL_CAPACITY='" + JCO_POOL_CAPACITY + '\'' +
", JCO_PEAK_LIMIT='" + JCO_PEAK_LIMIT + '\'' +
", JCO_SAPROUTER='" + JCO_SAPROUTER + '\'' +
'}';
}
}
| [
"linbin_work@foxmail.com"
] | linbin_work@foxmail.com |
0a6d0ae455c5bcb72b97dc78b23a3207af095cd4 | 47c94894a26553958a0300f4a39d1c5646526f11 | /src/main/java/run/nya/petbbs/controller/SysFriendLinkController.java | a2bebb5f716e9bd85f87b9f89c4d149eec1f99e5 | [
"MIT"
] | permissive | HAIZAKURA/petbbs | 367405cc4bcfd779034d07648da2eb7db74c87bf | b5d90190c0016c18611666e130040fa9132e4541 | refs/heads/master | 2023-06-09T14:20:47.058140 | 2021-06-22T12:44:00 | 2021-06-22T12:44:00 | 317,226,231 | 3 | 0 | null | 2021-02-19T03:56:22 | 2020-11-30T13:05:27 | Java | UTF-8 | Java | false | false | 3,400 | java | package run.nya.petbbs.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import run.nya.petbbs.common.api.ApiResult;
import run.nya.petbbs.model.dto.FriendLinkDTO;
import run.nya.petbbs.model.entity.SysFriendLink;
import run.nya.petbbs.service.ISysFriendLinkService;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 友链控制器
*
* 2021/02/26
*/
@RestController
@RequestMapping("/api")
@Api(tags = {"SysFriendLinkController"})
public class SysFriendLinkController extends BaseController {
@Resource
private ISysFriendLinkService iSysFriendLinkService;
/**
* 获取有效友链
*
* @return ApiResult
*/
@ApiOperation(value = "获取有效友链")
@RequestMapping(value = "/friends", method = RequestMethod.GET)
public ApiResult<List<SysFriendLink>> getLinks() {
LambdaQueryWrapper<SysFriendLink> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysFriendLink::getState, true);
List<SysFriendLink> list = iSysFriendLinkService.list(wrapper);
return ApiResult.success(list);
}
/**
* 获取所有友链
* 超级管理员
*
* @return ApiResult
*/
@ApiOperation(value = "获取所有友链")
@PreAuthorize("hasRole('ROLE_SUPERADMIN')")
@RequestMapping(value = "/admin/friends", method = RequestMethod.GET)
public ApiResult<List<SysFriendLink>> getLinksByAdmin() {
List<SysFriendLink> list = iSysFriendLinkService.list();
return ApiResult.success(list);
}
/**
* 添加友链
* 超级管理员
*
* @param dto
* @return ApiResult
*/
@ApiOperation(value = "添加友链")
@PreAuthorize("hasRole('ROLE_SUPERADMIN')")
@RequestMapping(value = "/admin/friends", method = RequestMethod.POST)
public ApiResult<Map<String, Object>> addLink(@Valid @RequestBody FriendLinkDTO dto) {
SysFriendLink sysFriendLink = iSysFriendLinkService.addLink(dto);
if (ObjectUtils.isEmpty(sysFriendLink)) {
return ApiResult.failed("添加失败");
}
Map<String, Object> map = new HashMap<>(16);
map.put("friends", sysFriendLink);
return ApiResult.success(map);
}
/**
* 修改友链
* 超级管理员
*
* @param sysFriendLink
* @return ApiResult
*/
@ApiOperation(value = "修改友链")
@PreAuthorize("hasRole('ROLE_SUPERADMIN')")
@RequestMapping(value = "/admin/friends", method = RequestMethod.PUT)
public ApiResult<String> updateLink(@RequestBody SysFriendLink sysFriendLink) {
try {
iSysFriendLinkService.updateById(sysFriendLink);
return ApiResult.success("修改成功");
} catch (Exception e) {
e.printStackTrace();
}
return ApiResult.failed("修改失败");
}
}
| [
"hhbilly99@gmail.com"
] | hhbilly99@gmail.com |
4ccf269948cf4d409de9a98631c48629ca455ce1 | 1e2a3f00a843423e85c28c1313edf13bb963d1e9 | /app/src/main/java/com/techastrum/attendance/activities/model/Gallery.java | 65a00c7456920da06d1b22b2780ebc1586659fea | [] | no_license | arundidauli/Android-Student-Attendance-management-system | 9208e32581d5f2768d4d237e6912446577653fbb | 3b70f9bb68f2d21c6c6a6aa57bab01e9fd0c8df1 | refs/heads/master | 2022-11-06T15:46:38.277670 | 2020-06-20T08:16:10 | 2020-06-20T08:16:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 699 | java | package com.techastrum.attendance.activities.model;
public class Gallery {
private String id;
private String image;
private String url;
public Gallery() {
}
public Gallery(String id, String image, String url) {
this.id = id;
this.image = image;
this.url = url;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
| [
"9027118560#Varun"
] | 9027118560#Varun |
ef9de8c4280dae645986f2f6475684ec8d3529d6 | 2f406695be4d1aacf7d09156dd5df2431352c7f7 | /src/com/easy/MovingAveragefromDataStream.java | 643160bc939c0cb518476e33b264e481ae66e0fd | [] | no_license | Arpitha93/LeetCode | 052a1f4d2084c53ed9b2c3c69c4c8ccef7635519 | 0524bc69a77abe848f6c0cc07881ef27bae4e1f9 | refs/heads/master | 2021-07-08T00:32:53.748184 | 2020-08-20T22:21:42 | 2020-08-20T22:21:42 | 177,222,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package com.easy;
import java.util.Deque;
import java.util.LinkedList;
public class MovingAveragefromDataStream {
private Deque<Integer> deque;
private int window;
private double sum;
public void MovingAverage(int size) {
deque = new LinkedList<>();
window = size;
sum = 0;
}
public double next(int val) {
sum -= deque.size() == window ? deque.poll() : 0;
deque.offer(val);
sum += val;
return sum / Math.min(deque.size(), window);
}
} | [
"arpitha1993@gmail.com"
] | arpitha1993@gmail.com |
cd6a9953b74ab14d912732844e19805f22846eee | 76285e6dbb62433ca11db6cc02d9142f214c27cc | /src/main/java/com/kl/jewelry/controller/ContactRest.java | 08577b92e0eabf217f45d8e8e11e68e6e6d9a2f8 | [] | no_license | tuanmanh322/kltn-jewelry-be | ac928803f72236477b7b72a45dbfa94e49ca534d | 4e8e93612a4d1406c1506571c79eba8e5cf211aa | refs/heads/master | 2023-01-30T22:29:38.876132 | 2020-12-13T15:07:49 | 2020-12-13T15:07:49 | 307,109,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,921 | java | package com.kl.jewelry.controller;
import com.kl.jewelry.dto.ContactSearchDTO;
import com.kl.jewelry.model.Contact;
import com.kl.jewelry.service.ContactService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/contact")
public class ContactRest {
private final Logger log = LoggerFactory.getLogger(ContactRest.class);
private final ContactService contactService;
public ContactRest(ContactService contactService) {
this.contactService = contactService;
}
@GetMapping("/all")
public ResponseEntity<List<Contact>> getAll(){
return new ResponseEntity<>(contactService.getAll(), HttpStatus.OK);
}
@GetMapping("/detail/{id}")
public ResponseEntity<Contact> getById(@PathVariable("id")Long id){
return new ResponseEntity<>(contactService.getById(id), HttpStatus.OK);
}
@PostMapping("/add")
public ResponseEntity<Void> addNew(@RequestBody Contact color){
contactService.add(color);
return new ResponseEntity<>(HttpStatus.OK);
}
@PutMapping("/edit")
public ResponseEntity<Void> edit(@RequestBody Contact color){
contactService.edit(color);
return ResponseEntity.ok().build();
}
@DeleteMapping("/delete/{id}")
public ResponseEntity<Void> deleteId(@PathVariable("id")Long id){
contactService.delete(id);
return ResponseEntity.ok().build();
}
@PostMapping("/search")
public ResponseEntity<ContactSearchDTO> userSearchDTOResponseEntity(@RequestBody ContactSearchDTO dto) {
log.info("Start rest to userSearchDTOResponseEntity :{}", dto);
contactService.searchContact(dto);
return new ResponseEntity<>(dto, HttpStatus.OK);
}
}
| [
"tuandm@itsol.vn"
] | tuandm@itsol.vn |
5d2f564e435a2deed382147d7a8ba72f11835647 | 8edbd4d64996a705a0bcb783d75bf47be70c6972 | /NGO/src/main/java/com/ngo/webservice/event/EventForm.java | d69bb26f3e8a050476bea70ea2f9e0ac0481d937 | [] | no_license | eBay-Opportunity-Hack-Chennai-2014/Maatram | 06f64ba77507c20d0112073134839a68adffdcf5 | 824fb250732fb254bc12fdee14c213c074a76ecd | refs/heads/master | 2021-01-02T09:26:45.968379 | 2014-10-12T11:04:29 | 2014-10-12T11:04:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,485 | java | package com.ngo.webservice.event;
public class EventForm {
private String title;
private String description;
private String category;
private String location;
private String date;
private String resourceAcquired;
private String resourceNeeded;
private int month;
private int year;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getResourceAcquired() {
return resourceAcquired;
}
public void setResourceAcquired(String resourceAcquired) {
this.resourceAcquired = resourceAcquired;
}
public String getResourceNeeded() {
return resourceNeeded;
}
public void setResourceNeeded(String resourceNeeded) {
this.resourceNeeded = resourceNeeded;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
} | [
"prakash.prax@gmail.com"
] | prakash.prax@gmail.com |
a0b7bc6a785ead76143c81b94c17ec4877d91a9d | 543a8ea79428d7840ff6ce758af91ab72da2ec80 | /src/main/java/com/wh/jvm/rtda/OpStack.java | 115b26785c78397bf5874f6eba60cfe8f3e407e4 | [] | no_license | louiewh/JVM-JAVA | b181937a1d101f28376eee2b0ec3987f26cd5ce9 | 7cab18499a5f70cfc96694d4d5058bd2ef6f9c54 | refs/heads/master | 2021-05-09T02:58:53.013779 | 2018-12-13T09:13:18 | 2018-12-13T09:13:18 | 119,227,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,391 | java | package com.wh.jvm.rtda;
import java.util.Stack;
public class OpStack extends Stack<Slot>{
public OpStack(int maxOPS) {
super.setSize(maxOPS);
}
public void pushInt(int value){
this.push(new Slot(value, null));
}
public int popInt(){
return (int) this.pop().mNumber;
}
public void pushFloat(float value){
Slot slot = new Slot(Float.floatToIntBits(value), null);
this.push(slot);
}
public float popFloat(){
Slot slot = this.pop();
return Float.intBitsToFloat((int) slot.mNumber);
}
public void pushLong(long value){
Slot slot = new Slot(value, null);
this.push(slot);
}
public long popLong(){
Slot slot = this.pop();
return slot.mNumber;
}
public void pushDouble(double value){
long longValue = Double.doubleToLongBits(value);
pushLong(longValue);
}
public Double popDouble(){
long longValue = this.pop().mNumber;
return Double.longBitsToDouble(longValue);
}
public void pushRef(Jobject jobject){
Slot slot = new Slot(-1, jobject);
this.push(slot);
}
public Jobject popRef(){
return this.pop().mJobject;
}
public void pushSlot(Slot slot){
this.push(slot);
}
public Slot popSlot(){
return this.pop();
}
}
| [
"louie.wang.g@gmail.com"
] | louie.wang.g@gmail.com |
ded9f6afa2752a6650f5729bf72a2233199d5a50 | f705705b5bebf6deb69dbb9079250c9d2329decc | /src/main/java/ch/corner/envres/web/rest/errors/ParameterizedErrorDTO.java | 18e9ece2afa68c9651d70dcc5455163a994195d4 | [] | no_license | gatling77/reservation | 6cc9ae1dceb5c4c5343e7a5d1eac1dff1d40fe75 | 0c2ff64892fc19d8b7dd48cab5bd0462e6a8e4a0 | refs/heads/master | 2021-01-10T11:12:36.469138 | 2017-03-01T16:14:38 | 2017-03-01T16:14:38 | 51,954,871 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | package ch.corner.envres.web.rest.errors;
import java.io.Serializable;
/**
* DTO for sending a parameterized error message.
*/
public class ParameterizedErrorDTO implements Serializable {
private static final long serialVersionUID = 1L;
private final String message;
private final String[] params;
public ParameterizedErrorDTO(String message, String... params) {
this.message = message;
this.params = params;
}
public String getMessage() {
return message;
}
public String[] getParams() {
return params;
}
}
| [
"stefano.dellafiore@gmail.com"
] | stefano.dellafiore@gmail.com |
34e28d07d079a8f7227917fd5b8ea843ab1b63ba | 51f2d15acc4af7fce3a440934d8e6d1f1c2885ff | /work/src/main/java/com/admin/work/main/discover/tab/JzViewOutlineProvider.java | 96c150d3970523b1dbc4435232facf1f1ae27318 | [] | no_license | LvKang-insist/ImitateQQMusic | 6e194b16b7a485caa4eaa810ed42e1c45cbcb19e | b05baa85c85915eafe7d26ab9d15f9590195eaf5 | refs/heads/master | 2020-07-14T15:00:59.373866 | 2019-08-30T08:30:54 | 2019-08-30T08:30:54 | 205,339,378 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.admin.work.main.discover.tab;
import android.graphics.Outline;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.ViewOutlineProvider;
import androidx.annotation.RequiresApi;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public class JzViewOutlineProvider extends ViewOutlineProvider {
private float mRadius;
public JzViewOutlineProvider(float radius) {
this.mRadius = radius;
}
@Override
public void getOutline(View view, Outline outline) {
Rect rect = new Rect();
view.getGlobalVisibleRect(rect);
Rect selfRect = new Rect(0, 0,
view.getWidth(),view.getHeight());
outline.setRoundRect(selfRect,mRadius);
}
}
| [
"lv345_y@163.com"
] | lv345_y@163.com |
32cb5e5cc0be0f0e666c0966238581e03aae1503 | c4993d5389a173aeb39acd20a0a19a4a49561e5a | /DAA/Dfs.java | 38053348a57378d1ccc8ac1504a60f5488ef8daa | [] | no_license | saivivek116/programs | 63bd583fcee73384bc5ae6bd0e8feda112ef98f2 | 35b81011f5b961314c7259edf021cfc1ab3f723b | refs/heads/master | 2023-08-22T06:56:08.087998 | 2023-08-06T19:07:19 | 2023-08-06T19:07:19 | 100,804,592 | 0 | 1 | null | 2018-07-17T12:54:42 | 2017-08-19T15:50:30 | C | UTF-8 | Java | false | false | 1,658 | java | import java.util.*;
class Dfs
{
int v;
LinkedList<Integer> ll[];
boolean vis[];
Dfs(int n)
{
v=n;
vis=new boolean[v];
ll=new LinkedList[v];
for(int i=0;i<v;i++)
ll[i]=new LinkedList();
}
public static void main(String ar[])
{
Scanner s=new Scanner(System.in);
System.out.print("Enter the no of vertices :");
int n=s.nextInt();
Dfs q=new Dfs(n);
for(int i=0;i<n;i++)
{
System.out.print("Enter the nodes Connected to "+i+"\nEnter -1 if there are no new nodes :");
do
{
int w=s.nextInt();
if(w==-1)
break;
if(w>=0&&w<n)
q.ll[i].add(w);
else
System.out.print("Entered node does not exist");
}while(true);
}
System.out.print("Enter the node to start search :");
q.search(s.nextInt());
s.close();
}
public void search(int j)
{
// LinkedList<Integer> que=new LinkedList();
//que.add(j);
vis[j]=true;
//while(que.size()!=0)
// {
// int h=que.poll();
System.out.println(j+" ");
Iterator<Integer> i=ll[j].listIterator();
while(i.hasNext())
{
int hl=i.next();
if(!vis[hl])
{
//vis[hl]=true;
//que.add(hl);
search(hl);
}
}
// }
}
}
| [
"saivivek116@gmail.com"
] | saivivek116@gmail.com |
98b031685f1f5490596c6aa6f10738c0856f9a7a | 3ffdea6bd398bf6da08588f7534f74cc29ffc0e1 | /Section 5/CleanArchitecture-20181031T062220Z-001/CleanArchitecture/app/build/generated/source/buildConfig/debug/com/example/abuzar/cleanarchitecture/BuildConfig.java | 02e73300c3854c02393713ed1bef344911e7c8e8 | [
"MIT"
] | permissive | PacktPublishing/Android-Application-Architecture | 008cda9242f1f03ef50eb756cb42613fb20f02ee | 4015f1f38df6665fb0d8ade71474acc0a2d0011e | refs/heads/master | 2021-06-17T18:12:15.439276 | 2021-01-15T06:34:22 | 2021-01-15T06:34:22 | 132,595,941 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.example.abuzar.cleanarchitecture;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.example.abuzar.cleanarchitecture";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"35484449+cleonb-packt@users.noreply.github.com"
] | 35484449+cleonb-packt@users.noreply.github.com |
d3adaaee1e3e4c8225d654f835c32dd71e9793d2 | f51f002c36ba89dfe36afd993855a369dba8c703 | /blog/src/main/java/com/cecilia/blog/controller/CategoryController.java | 6a37ab53a0341b72fa99258d9be83032310a6a70 | [] | no_license | Cecilia177/Blog | 227df454fc54260c3a0574e88c155d41fdee927b | a136b7342755e4cc1072f08b20011774d6ecbd5b | refs/heads/master | 2020-05-31T05:06:25.525965 | 2019-06-12T12:12:26 | 2019-06-12T12:12:26 | 190,112,384 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,650 | java | package com.cecilia.blog.controller;
import com.cecilia.blog.entity.Article;
import com.cecilia.blog.entity.Category;
import com.cecilia.blog.repository.ArticleRepository;
import com.cecilia.blog.repository.CategoryRepository;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.Iterator;
import java.util.Optional;
@RestController
@RequestMapping("/category")
@CrossOrigin("*")
public class CategoryController {
@Autowired
CategoryRepository categoryRepository;
@Autowired
ArticleRepository articleRepository;
@ApiOperation(value = "获取所有分类")
@GetMapping
public Iterable<Category> getAllCategories() {
return categoryRepository.findAll();
}
@ApiOperation(value = "获取某个分类", notes = "根据类别号获取分类")
@GetMapping("/{categoryId}")
public ResponseEntity<Category> getCategoryById(@PathVariable("categoryId") Long categoryId) {
Optional<Category> optionalCategory = categoryRepository.findById(categoryId);
if (optionalCategory.isPresent()) {
return new ResponseEntity<>(optionalCategory.get(), HttpStatus.OK);
}
return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);
}
@ApiOperation(value = "新建分类")
@PostMapping(consumes = "application/json")
@ResponseStatus(HttpStatus.CREATED)
public Category postCategory(@RequestBody Category category){
return categoryRepository.save(category);
}
@ApiOperation(value = "删除分类", notes = "根据类别号删除某个分类")
@DeleteMapping("/{categoryId}")
@ResponseStatus(code = HttpStatus.NO_CONTENT)
public void deleteCategory(@PathVariable("categoryId") Long categoryId){
try{
categoryRepository.deleteById(categoryId);
} catch (EmptyResultDataAccessException e){}
}
@ApiOperation(value = "更新分类", notes = "根据类别号更新某个类名")
@PatchMapping(path = "/{categoryId}", consumes = "application/json")
public Category patchCategory(@PathVariable("categoryId") Long categoryId, @RequestBody Category categoryToPatch){
Category category = categoryRepository.findById(categoryId).get();
if(categoryToPatch.getCategoryName() != null){
category.setCategoryName(categoryToPatch.getCategoryName());
}
String validOrNot = categoryToPatch.getIsValid();
if(validOrNot != null) {
category.setIsValid(validOrNot);
//级联修改该类下所有articles的valid字段
Collection<Article> articles = category.getArticles();
for(Article article : articles) {
article.setIsValid(validOrNot);
articleRepository.save(article);
}
}
return categoryRepository.save(category);
}
@ApiOperation(value = "获取文章列表", notes = "获取某一类别下所有文章列表")
@GetMapping(path = "/getArticles/{categoryId}")
public Iterable<Article> getArticlesByCategory(@PathVariable("categoryId") Long categoryId) {
Optional<Category> optionalCategory = categoryRepository.findById(categoryId);
if(optionalCategory.isPresent()) {
Category category = optionalCategory.get();
return category.getArticles();
}
return null;
}
}
| [
"1455849229@qq.com"
] | 1455849229@qq.com |
56926e4e96b8267887ecbc58aaca10301efe23e9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_a22dade71dbec36e1b82902e85e356fb009905f2/AbstractModelObject/11_a22dade71dbec36e1b82902e85e356fb009905f2_AbstractModelObject_t.java | 67e99745f27618c2d875a739ac9bd1912caf3bc8 | [] | 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 | 5,054 | java | /**
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright (C) 2007 Ronny Brandt (Ronny_Brandt@web.de). *
* All rights reserved. *
* *
* This work was done as a project at the Chair for Software Technology, *
* Dresden University Of Technology, Germany (http://st.inf.tu-dresden.de). *
* It is understood that any modification not identified as such is not *
* covered by the preceding statement. *
* *
* This work is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Library General Public License as published *
* by the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This work is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public *
* License for more details. *
* *
* You should have received a copy of the GNU Library General Public License *
* along with this library; if not, you can view it online at *
* http://www.fsf.org/licensing/licenses/gpl.html. *
* *
* To submit a bug report, send a comment, or get the latest news on this *
* project, please visit the website: http://dresden-ocl.sourceforge.net. *
* For more information on OCL and related projects visit the OCL Portal: *
* http://st.inf.tu-dresden.de/ocl *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
package tudresden.ocl20.pivot.modelbus.base;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import tudresden.ocl20.pivot.essentialocl.standardlibrary.OclRoot;
import tudresden.ocl20.pivot.modelbus.IModelObject;
import tudresden.ocl20.pivot.pivotmodel.Constraint;
/**
* Abstract implementation of {@link IModelObject}
*
* @author Ronny Brandt
* @version 1.0 31.08.2007
*/
public abstract class AbstractModelObject implements IModelObject {
// The name
protected String name;
// The qualified name
protected List<String> qualifiedName;
// The qualified name as string
protected String qualifiedNameString;
// The results are mapped to constraints
protected Map<Constraint, OclRoot> results = new HashMap<Constraint, OclRoot>();
// The OCL object
protected OclRoot oclObject;
/*
* (non-Javadoc)
*
* @see tudresden.ocl20.pivot.modelbus.IModelObject#getName()
*/
public String getName() {
return name;
}
/*
* (non-Javadoc)
*
* @see tudresden.ocl20.pivot.modelbus.IModelObject#getQualifiedName()
*/
public List<String> getQualifiedName() {
return qualifiedName;
}
/*
* (non-Javadoc)
*
* @see tudresden.ocl20.pivot.modelbus.IModelObject#getQualifiedNameString()
*/
public String getQualifiedNameString() {
if (qualifiedNameString == null)
if (qualifiedName != null) {
for (String part : qualifiedName) {
if (qualifiedNameString == null)
qualifiedNameString = part;
else
qualifiedNameString = qualifiedNameString + "::" + part;
}
}
return qualifiedNameString;
}
/*
* (non-Javadoc)
*
* @see tudresden.ocl20.pivot.modelbus.IModelObject#addResult(tudresden.ocl20.pivot.pivotmodel.Constraint,
* tudresden.ocl20.pivot.essentialocl.standardlibrary.OclRoot)
*/
public void addResult(Constraint cs, OclRoot result) {
results.put(cs, result);
}
/*
* (non-Javadoc)
*
* @see tudresden.ocl20.pivot.modelbus.IModelObject#getResults()
*/
public Map<Constraint, OclRoot> getResults() {
return results;
}
/*
* (non-Javadoc)
*
* @see tudresden.ocl20.pivot.modelbus.IModelObject#clearResults()
*/
public boolean clearResults() {
if (results != null) {
results.clear();
return true;
}
return false;
}
/*
* (non-Javadoc)
*
* @see tudresden.ocl20.pivot.modelbus.IModelObject#removeResult(tudresden.ocl20.pivot.pivotmodel.Constraint)
*/
public boolean removeResult(Constraint cs) {
if (results != null) {
results.remove(cs);
return true;
}
return false;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
4f61e56ca97db05bc94cb2d4c02750857bad2591 | 3a5c32113e7618a8343a44baddc46904610b6258 | /Insta/src/main/java/com/Insta/service/InstaServiceInterface.java | 83590196c7540adb4ffd63a485e8b97099c30ebf | [] | no_license | akshitahedaoo/hsbc_sep | 7d5234f4b334f423bdd05e30165232d9cda95494 | aaacc24a044e4f1fa73976b88c7e383ab715b943 | refs/heads/master | 2023-01-01T16:24:20.728038 | 2020-10-20T10:52:38 | 2020-10-20T10:52:38 | 295,692,800 | 0 | 0 | null | 2020-09-15T10:29:33 | 2020-09-15T10:29:33 | null | UTF-8 | Java | false | false | 279 | java | package com.Insta.service;
import java.util.List;
import com.Insta.entity.InstaUser;
public interface InstaServiceInterface {
int createprofileservice(InstaUser iu);
List<InstaUser> friendProfile(InstaUser iu);
boolean loginProfile(InstaUser iu);
}
| [
"noreply@github.com"
] | noreply@github.com |
7aa6ab4ea2a96cfe78090a070d57e179962aba6d | a383b8cf6b63c2075d651c8ed7cd475af149a850 | /bitcamp-java-basic/src/main/java/ch28/b/MyAnnotation.java | 259c6450f582667a8c195afc4bec9c7d4e5b9364 | [] | no_license | icewaterdrop/bitcamp-java-20190527 | 93c0f8189dc7165c924e7575029b215c4497e8f5 | fc707617332a1e211a9c16026506fc194c9b91be | refs/heads/master | 2020-06-13T20:16:32.503371 | 2019-11-07T02:49:53 | 2019-11-07T02:49:53 | 194,775,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package ch28.b;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
// 애노테이션 유지 범위 지정하기
// => 아무것도 지정하지 않으면 기본이 CLASS 이다.
// => 또는 다음과 같이 명시적으로 지정할 수 있다.
@Retention(RetentionPolicy.CLASS)
public @interface MyAnnotation {
}
// 애노테이션 유지 범위
// 1) CLASS (기본) : .class 파일에 포함. 실행할 때 로딩 안됨.
// 2) SOURCE : .class 파일에 포함 안됨
// 3) RUNTIME : .class 파일에 포함. 실행 할 때도 메모리에 로딩됨. | [
"ozzang1991@gmail.com"
] | ozzang1991@gmail.com |
2a2cb7990ce8c789260b7e25731c60e30ca57f3b | c3260ac83cf04080d03a95eea8e5f2ce2e740652 | /mp-aos-framework/estgames_framework/app/src/main/java/com/estgames/estgames_framework/common/CustomFunction.java | 42ac7aafff6082a69613725afbfd112f2b813320 | [] | no_license | HyeongJinK/temp | 6e083f0a49fde5fa7168ab47b8be274b7a9a2c01 | f2a169ec51d3d5eb6455b8ee3e015bd96a61af7d | refs/heads/master | 2022-05-14T12:08:48.236759 | 2020-04-16T06:52:47 | 2020-04-16T06:52:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 109 | java | package com.estgames.estgames_framework.common;
public interface CustomFunction<T, R> {
R apply(T t);
}
| [
"wkzkfmxk23@gmail.com"
] | wkzkfmxk23@gmail.com |
c57c880e00c03819b4c8d240e7e71143de4a49a6 | 9bedc47946e61d1de21d16a32775ced6fdb236c8 | /src/main/java/BankApplication/BankAccountApp.java | a58bb5eaa0a9cf8247856652977a03e6a1ef423a | [] | no_license | KapaleAnup/Excerises | f2d5cd97ccbd6d580c32118ca4a825135ea01f3b | 60007b19e14ab8da8d8eb8c7686de78a1271f688 | refs/heads/master | 2023-05-14T11:19:50.411504 | 2020-08-02T09:43:11 | 2020-08-02T09:43:11 | 232,782,408 | 0 | 0 | null | 2023-05-09T17:57:12 | 2020-01-09T10:25:11 | Java | UTF-8 | Java | false | false | 213 | java | package BankApplication;
public class BankAccountApp {
public static void main(String [] args){
Checking checking = new Checking("ANup Kapale");
//Read a csv file and read the data
}
}
| [
"anup.k@turtlemint.com"
] | anup.k@turtlemint.com |
ebdf8f3ee14f0bb49beff08f67659a1eeb24ce2e | 75f76f663954f7fae6ab0a596fea3cde38ac1562 | /app/src/androidTest/java/pinkbun/reword_demo/ExampleInstrumentedTest.java | bfd7463bf0068d7f2d550b09a8433f0562ede238 | [
"MIT"
] | permissive | hwchan91/reword_android | 3a700ff2e5dec248be85136f5da7c359b20317fc | aca8a20def98b766ec3c930ca158858509731762 | refs/heads/master | 2020-03-18T07:00:27.399016 | 2018-05-22T16:05:56 | 2018-05-22T16:05:56 | 134,426,822 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package pinkbun.reword_demo;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("pinkbun.reword_demo", appContext.getPackageName());
}
}
| [
"hwchan91@gmail.com"
] | hwchan91@gmail.com |
9ed988b21704bba36018d1ea2ce7b90e32981d4d | 235db80a49708a0f1bd97e24cb9940738be3f324 | /src/api/java/camus/device/DeviceType.java | 3bf34a035efbe9a6409e2af31e5371b1c8196d25 | [] | no_license | kwlee0220/camus.model | e72df02364e6fc97de4c8a2870e2b6704825f8cd | c7c80d280cb8b137b8d563c8b04571ac81d648f5 | refs/heads/master | 2022-10-01T07:46:14.480814 | 2022-08-25T08:21:06 | 2022-08-25T08:21:06 | 81,835,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | package camus.device;
/**
*
* @author Kang-Woo Lee (ETRI)
*/
public enum DeviceType {
GLOBAL_SERVICE_DIRECTORY,
LOCAL_STATION,
ROBOT
;
}
| [
"kwlee@etri.re.kr"
] | kwlee@etri.re.kr |
4af67df7d4d8272aede78c0b187464b585fb6aa4 | 217de722a86cd2a28a787c6b214c25c11c6dc4d2 | /zcloud-hospital/zcloud-hospital-feign/src/main/java/com/jfatty/zcloud/hospital/feign/ComplexPatientFeignClient.java | cceaccc16c6830e2c9e2cb00edd96776eeccd66c | [] | no_license | dizhaung/zcloud-1 | a7e2f419a3a47de8ffffdc44b3acdd7783b85901 | 38d17288d60b3a1c079a4b6a51d29356a37c4db2 | refs/heads/master | 2023-05-09T19:47:04.986295 | 2020-09-01T07:27:10 | 2020-09-01T07:27:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,850 | java | package com.jfatty.zcloud.hospital.feign;
import com.jfatty.zcloud.base.interfaces.BInterface;
import com.jfatty.zcloud.base.utils.RELResultUtils;
import com.jfatty.zcloud.base.utils.RETResultUtils;
import com.jfatty.zcloud.hospital.entity.ComplexPatient;
import com.jfatty.zcloud.hospital.req.ComplexPatientReq;
import com.jfatty.zcloud.hospital.req.NumoPatientDeatilReq;
import com.jfatty.zcloud.hospital.req.NumoPatientInfoReq;
import com.jfatty.zcloud.hospital.res.WebRegPatientRes;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* 描述
*
* @author jfatty on 2019/12/29
* @email jfatty@163.com
*/
@FeignClient(value = "zcloud-hospital-service" , path = "/api/complexPatient" )
public interface ComplexPatientFeignClient extends BInterface<ComplexPatient,ComplexPatientReq,WebRegPatientRes> {
@ApiOperation(value=" 001**** POST 参数 查询微信/支付宝 ... 用户绑定的就诊人列表信息")
@RequestMapping(value="/getComplexPatients", method=RequestMethod.POST)
RELResultUtils<WebRegPatientRes> getComplexPatients(@RequestBody ComplexPatientReq complexPatientReq);
@ApiOperation(value=" 002**** 添加/绑定 就诊人")
@RequestMapping(value="/addComplexPatient", method=RequestMethod.POST)
RETResultUtils<String> addComplexPatient(@RequestBody NumoPatientInfoReq numoPatientInfoReq);
@ApiOperation(value=" 005****删除就诊人,即将就诊人与用户解绑")
@RequestMapping(value="/delComplexPatient", method=RequestMethod.POST)
RETResultUtils<String> deleteComplexPatient(@RequestBody NumoPatientDeatilReq numoPatientDeatilReq);
}
| [
"zealsoft#yeah.net"
] | zealsoft#yeah.net |
9c7fee31a6bd9afd1e9331b0047836f3a2f3c373 | 58caaadb314acdff29c23633741895f1aee462c4 | /tipi/com.dexels.navajo.tipi.swing.jxlayer/demosrc/org/jdesktop/jxlayer/plaf/effect/AbstractBufferedImageOpEffect.java | 4a715500ca2a26d518a0d12b364729806ac57017 | [] | no_license | mvdhorst/navajo | 5c26314cc5a9a4ecb337d81604e941f9239ea9f2 | 21e1ed205d5995ae7aa3bdc645124885448bf867 | refs/heads/master | 2021-01-10T22:28:23.051655 | 2015-02-27T08:48:52 | 2015-02-27T08:48:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,223 | java | /**
* Copyright (c) 2006-2008, Alexander Potochkin
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the JXLayer project nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.jdesktop.jxlayer.plaf.effect;
import java.awt.*;
import java.awt.image.*;
import java.lang.ref.*;
/**
* The base class for {@link org.jdesktop.jxlayer.plaf.effect.BufferedImageOpEffect}
*/
public class AbstractBufferedImageOpEffect extends AbstractLayerEffect {
private transient SoftReference<BufferedImage> cachedSubImage;
private static final BufferedImageOp[] emptyOpsArray = new BufferedImageOp[0];
/**
* {@inheritDoc}
* <p/>
* Filters the passed image using {@code clip} and
* {@code BufferedImageOp}s provided by {@link #getBufferedImageOps()}
*/
public void apply(BufferedImage buffer, Shape clip) {
if (buffer == null) {
throw new IllegalArgumentException("BufferedImage is null");
}
Rectangle bufferSize = new Rectangle(buffer.getWidth(), buffer.getHeight());
if (clip == null) {
clip = bufferSize;
}
Rectangle clipBounds = clip.getBounds().intersection(bufferSize);
if (clipBounds.isEmpty() ||
buffer.getWidth() <= clipBounds.x ||
buffer.getHeight() <= clipBounds.y) {
return;
}
int x = clipBounds.x;
int y = clipBounds.y;
int width = clipBounds.width;
int height = clipBounds.height;
if (buffer.getWidth() < x + width) {
width = buffer.getWidth() - x;
}
if (buffer.getHeight() < y + height) {
height = buffer.getHeight() - y;
}
BufferedImage subImage = cachedSubImage == null ? null : cachedSubImage.get();
if (subImage == null ||
subImage.getWidth() != width ||
subImage.getHeight() != height) {
subImage = new BufferedImage(width, height, buffer.getType());
cachedSubImage = new SoftReference<BufferedImage>(subImage);
}
Graphics2D bufg = buffer.createGraphics();
bufg.setClip(clip);
Graphics2D subg = subImage.createGraphics();
for (BufferedImageOp op : getBufferedImageOps()) {
subg.drawImage(buffer, 0, 0, width, height, x, y, x + width, y + height, null);
bufg.drawImage(subImage, op, x, y);
}
subg.dispose();
bufg.dispose();
}
/**
* Returns the array of {@code BufferedImageOp}s
* specified for this {@code LayerEffect}.
*
* @return the array of {@code BufferedImageOp}s
* specified for this {@code LayerEffect}
*/
protected BufferedImageOp[] getBufferedImageOps() {
return emptyOpsArray;
}
}
| [
"frank@dexels.com"
] | frank@dexels.com |
b185b864940ac6d93739a543e93a12d2cd79c088 | f18430ed224c60d814d377552e908aec77887ef0 | /src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java | b67133c1430607666f75024f1ec1ad4e135c0546 | [] | no_license | yofayed/POI-1 | 2485d635afa9729f1a0305267615417fe5e57d86 | 84beb09b53fccc66b9bb302673b8444f3b9cdab9 | refs/heads/master | 2021-01-18T20:26:40.569221 | 2009-10-08T14:41:15 | 2009-10-08T14:41:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 51,070 | java | /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellAlignment;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellFill;
import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder.BorderSide;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
/**
*
* High level representation of the the possible formatting information for the contents of the cells on a sheet in a
* SpreadsheetML document.
*
* @see org.apache.poi.xssf.usermodel.XSSFWorkbook#createCellStyle()
* @see org.apache.poi.xssf.usermodel.XSSFWorkbook#getCellStyleAt(short)
* @see org.apache.poi.xssf.usermodel.XSSFCell#setCellStyle(org.apache.poi.ss.usermodel.CellStyle)
*/
public class XSSFCellStyle implements CellStyle {
private int _cellXfId;
private StylesTable _stylesSource;
private CTXf _cellXf;
private CTXf _cellStyleXf;
private XSSFFont _font;
private XSSFCellAlignment _cellAlignment;
/**
* Creates a Cell Style from the supplied parts
* @param cellXfId The main XF for the cell
* @param cellStyleXfId Optional, style xf
* @param stylesSource Styles Source to work off
*/
public XSSFCellStyle(int cellXfId, int cellStyleXfId, StylesTable stylesSource) {
_cellXfId = cellXfId;
_stylesSource = stylesSource;
_cellXf = stylesSource.getCellXfAt(this._cellXfId);
_cellStyleXf = stylesSource.getCellStyleXfAt(cellStyleXfId);
}
/**
* Used so that StylesSource can figure out our location
*/
public CTXf getCoreXf() {
return _cellXf;
}
/**
* Used so that StylesSource can figure out our location
*/
public CTXf getStyleXf() {
return _cellStyleXf;
}
/**
* Creates an empty Cell Style
*/
public XSSFCellStyle(StylesTable stylesSource) {
_stylesSource = stylesSource;
// We need a new CTXf for the main styles
// TODO decide on a style ctxf
_cellXf = CTXf.Factory.newInstance();
_cellStyleXf = null;
}
/**
* Verifies that this style belongs to the supplied Workbook
* Styles Source.
* Will throw an exception if it belongs to a different one.
* This is normally called when trying to assign a style to a
* cell, to ensure the cell and the style are from the same
* workbook (if they're not, it won't work)
* @throws IllegalArgumentException if there's a workbook mis-match
*/
public void verifyBelongsToStylesSource(StylesTable src) {
if(this._stylesSource != src) {
throw new IllegalArgumentException("This Style does not belong to the supplied Workbook Stlyes Source. Are you trying to assign a style from one workbook to the cell of a differnt workbook?");
}
}
/**
* Clones all the style information from another
* XSSFCellStyle, onto this one. This
* XSSFCellStyle will then have all the same
* properties as the source, but the two may
* be edited independently.
* Any stylings on this XSSFCellStyle will be lost!
*
* The source XSSFCellStyle could be from another
* XSSFWorkbook if you like. This allows you to
* copy styles from one XSSFWorkbook to another.
*/
public void cloneStyleFrom(CellStyle source) {
if(source instanceof XSSFCellStyle) {
XSSFCellStyle src = (XSSFCellStyle)source;
_cellXf.set(src.getCoreXf());
_cellStyleXf.set(src.getStyleXf());
} else {
throw new IllegalArgumentException("Can only clone from one XSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle");
}
}
/**
* Get the type of horizontal alignment for the cell
*
* @return short - the type of alignment
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_GENERAL
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_LEFT
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_RIGHT
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_FILL
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_JUSTIFY
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER_SELECTION
*/
public short getAlignment() {
return (short)(getAlignmentEnum().ordinal());
}
/**
* Get the type of horizontal alignment for the cell
*
* @return HorizontalAlignment - the type of alignment
* @see org.apache.poi.ss.usermodel.HorizontalAlignment
*/
public HorizontalAlignment getAlignmentEnum() {
CTCellAlignment align = _cellXf.getAlignment();
if(align != null && align.isSetHorizontal()) {
return HorizontalAlignment.values()[align.getHorizontal().intValue()-1];
}
return HorizontalAlignment.GENERAL;
}
/**
* Get the type of border to use for the bottom border of the cell
*
* @return short - border type
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderBottom() {
if(!_cellXf.getApplyBorder()) return BORDER_NONE;
int idx = (int)_cellXf.getBorderId();
CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
STBorderStyle.Enum ptrn = ct.isSetBottom() ? ct.getBottom().getStyle() : null;
return ptrn == null ? BORDER_NONE : (short)(ptrn.intValue() - 1);
}
/**
* Get the type of border to use for the bottom border of the cell
*
* @return border type as Java enum
* @see BorderStyle
*/
public BorderStyle getBorderBottomEnum() {
int style = getBorderBottom();
return BorderStyle.values()[style];
}
/**
* Get the type of border to use for the left border of the cell
*
* @return short - border type, default value is {@link org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE}
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderLeft() {
if(!_cellXf.getApplyBorder()) return BORDER_NONE;
int idx = (int)_cellXf.getBorderId();
CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
STBorderStyle.Enum ptrn = ct.isSetLeft() ? ct.getLeft().getStyle() : null;
return ptrn == null ? BORDER_NONE : (short)(ptrn.intValue() - 1);
}
/**
* Get the type of border to use for the left border of the cell
*
* @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
*/
public BorderStyle getBorderLeftEnum() {
int style = getBorderLeft();
return BorderStyle.values()[style];
}
/**
* Get the type of border to use for the right border of the cell
*
* @return short - border type, default value is {@link org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE}
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderRight() {
if(!_cellXf.getApplyBorder()) return BORDER_NONE;
int idx = (int)_cellXf.getBorderId();
CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
STBorderStyle.Enum ptrn = ct.isSetRight() ? ct.getRight().getStyle() : null;
return ptrn == null ? BORDER_NONE : (short)(ptrn.intValue() - 1);
}
/**
* Get the type of border to use for the right border of the cell
*
* @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
*/
public BorderStyle getBorderRightEnum() {
int style = getBorderRight();
return BorderStyle.values()[style];
}
/**
* Get the type of border to use for the top border of the cell
*
* @return short - border type, default value is {@link org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE}
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
* @see org.apache.poi.ss.usermodel.CellStyle #BORDER_THICK
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderTop() {
if(!_cellXf.getApplyBorder()) return BORDER_NONE;
int idx = (int)_cellXf.getBorderId();
CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
STBorderStyle.Enum ptrn = ct.isSetTop() ? ct.getTop().getStyle() : null;
return ptrn == null ? BORDER_NONE : (short)(ptrn.intValue() - 1);
}
/**
* Get the type of border to use for the top border of the cell
*
* @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
*/
public BorderStyle getBorderTopEnum() {
int style = getBorderTop();
return BorderStyle.values()[style];
}
/**
* Get the color to use for the bottom border
* <br/>
* Color is optional. When missing, IndexedColors.AUTOMATIC is implied.
* @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#AUTOMATIC}
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getBottomBorderColor() {
XSSFColor clr = getBottomBorderXSSFColor();
return clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndexed();
}
/**
* Get the color to use for the bottom border as a {@link XSSFColor}
*
* @return the used color or <code>null</code> if not set
*/
public XSSFColor getBottomBorderXSSFColor() {
if(!_cellXf.getApplyBorder()) return null;
int idx = (int)_cellXf.getBorderId();
XSSFCellBorder border = _stylesSource.getBorderAt(idx);
return border.getBorderColor(BorderSide.BOTTOM);
}
/**
* Get the index of the number format (numFmt) record used by this cell format.
*
* @return the index of the number format
*/
public short getDataFormat() {
return (short)_cellXf.getNumFmtId();
}
/**
* Get the contents of the format string, by looking up
* the StylesSource
*
* @return the number format string
*/
public String getDataFormatString() {
int idx = getDataFormat();
return new XSSFDataFormat(_stylesSource).getFormat((short)idx);
}
/**
* Get the background fill color.
* <p>
* Note - many cells are actually filled with a foreground
* fill, not a background fill - see {@link #getFillForegroundColor()}
* </p>
* @return fill color, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#AUTOMATIC}
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getFillBackgroundColor() {
XSSFColor clr = getFillBackgroundXSSFColor();
return clr == null ? IndexedColors.AUTOMATIC.getIndex() : clr.getIndexed();
}
/**
* Get the background fill color.
* <p>
* Note - many cells are actually filled with a foreground
* fill, not a background fill - see {@link #getFillForegroundColor()}
* </p>
* @see org.apache.poi.xssf.usermodel.XSSFColor#getRgb()
* @return XSSFColor - fill color or <code>null</code> if not set
*/
public XSSFColor getFillBackgroundXSSFColor() {
if(!_cellXf.getApplyFill()) return null;
int fillIndex = (int)_cellXf.getFillId();
XSSFCellFill fg = _stylesSource.getFillAt(fillIndex);
return fg.getFillBackgroundColor();
}
/**
* Get the foreground fill color.
* <p>
* Many cells are filled with this, instead of a
* background color ({@link #getFillBackgroundColor()})
* </p>
* @see IndexedColors
* @return fill color, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#AUTOMATIC}
*/
public short getFillForegroundColor() {
XSSFColor clr = getFillForegroundXSSFColor();
return clr == null ? IndexedColors.AUTOMATIC.getIndex() : clr.getIndexed();
}
/**
* Get the foreground fill color.
*
* @return XSSFColor - fill color or <code>null</code> if not set
*/
public XSSFColor getFillForegroundXSSFColor() {
if(!_cellXf.getApplyFill()) return null;
int fillIndex = (int)_cellXf.getFillId();
XSSFCellFill fg = _stylesSource.getFillAt(fillIndex);
return fg.getFillForegroundColor();
}
/**
* Get the fill pattern
* @return fill pattern, default value is {@link org.apache.poi.ss.usermodel.CellStyle#NO_FILL}
*
* @see org.apache.poi.ss.usermodel.CellStyle#NO_FILL
* @see org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND
* @see org.apache.poi.ss.usermodel.CellStyle#FINE_DOTS
* @see org.apache.poi.ss.usermodel.CellStyle#ALT_BARS
* @see org.apache.poi.ss.usermodel.CellStyle#SPARSE_DOTS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_HORZ_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_VERT_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_BACKWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_FORWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#BIG_SPOTS
* @see org.apache.poi.ss.usermodel.CellStyle#BRICKS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_HORZ_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_VERT_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_BACKWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_FORWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#SQUARES
* @see org.apache.poi.ss.usermodel.CellStyle#DIAMONDS
*/
public short getFillPattern() {
if(!_cellXf.getApplyFill()) return 0;
int fillIndex = (int)_cellXf.getFillId();
XSSFCellFill fill = _stylesSource.getFillAt(fillIndex);
STPatternType.Enum ptrn = fill.getPatternType();
if(ptrn == null) return CellStyle.NO_FILL;
return (short)(ptrn.intValue() - 1);
}
/**
* Get the fill pattern
*
* @return the fill pattern, default value is {@link org.apache.poi.ss.usermodel.FillPatternType#NO_FILL}
*/
public FillPatternType getFillPatternEnum() {
int style = getFillPattern();
return FillPatternType.values()[style];
}
/**
* Gets the font for this style
* @return Font - font
*/
public XSSFFont getFont() {
if (_font == null) {
_font = _stylesSource.getFontAt(getFontId());
}
return _font;
}
/**
* Gets the index of the font for this style
*
* @return short - font index
* @see org.apache.poi.xssf.usermodel.XSSFWorkbook#getFontAt(short)
*/
public short getFontIndex() {
return (short) getFontId();
}
/**
* Get whether the cell's using this style are to be hidden
*
* @return boolean - whether the cell using this style is hidden
*/
public boolean getHidden() {
return getCellProtection().getHidden();
}
/**
* Get the number of spaces to indent the text in the cell
*
* @return indent - number of spaces
*/
public short getIndention() {
CTCellAlignment align = _cellXf.getAlignment();
return (short)(align == null ? 0 : align.getIndent());
}
/**
* Get the index within the StylesTable (sequence within the collection of CTXf elements)
*
* @return unique index number of the underlying record this style represents
*/
public short getIndex() {
return (short)this._cellXfId;
}
/**
* Get the color to use for the left border
*
* @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#BLACK}
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getLeftBorderColor() {
XSSFColor clr = getLeftBorderXSSFColor();
return clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndexed();
}
/**
* Get the color to use for the left border
*
* @return the index of the color definition or <code>null</code> if not set
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public XSSFColor getLeftBorderXSSFColor() {
if(!_cellXf.getApplyBorder()) return null;
int idx = (int)_cellXf.getBorderId();
XSSFCellBorder border = _stylesSource.getBorderAt(idx);
return border.getBorderColor(BorderSide.LEFT);
}
/**
* Get whether the cell's using this style are locked
*
* @return whether the cell using this style are locked
*/
public boolean getLocked() {
return getCellProtection().getLocked();
}
/**
* Get the color to use for the right border
*
* @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#BLACK}
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getRightBorderColor() {
XSSFColor clr = getRightBorderXSSFColor();
return clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndexed();
}
/**
* Get the color to use for the right border
*
* @return the used color or <code>null</code> if not set
*/
public XSSFColor getRightBorderXSSFColor() {
if(!_cellXf.getApplyBorder()) return null;
int idx = (int)_cellXf.getBorderId();
XSSFCellBorder border = _stylesSource.getBorderAt(idx);
return border.getBorderColor(BorderSide.RIGHT);
}
/**
* Get the degree of rotation for the text in the cell
* <p>
* Expressed in degrees. Values range from 0 to 180. The first letter of
* the text is considered the center-point of the arc.
* <br/>
* For 0 - 90, the value represents degrees above horizon. For 91-180 the degrees below the
* horizon is calculated as:
* <br/>
* <code>[degrees below horizon] = 90 - textRotation.</code>
* </p>
*
* @return rotation degrees (between 0 and 180 degrees)
*/
public short getRotation() {
CTCellAlignment align = _cellXf.getAlignment();
return (short)(align == null ? 0 : align.getTextRotation());
}
/**
* Get the color to use for the top border
*
* @return the index of the color definition, default value is {@link org.apache.poi.ss.usermodel.IndexedColors#BLACK}
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public short getTopBorderColor() {
XSSFColor clr = getTopBorderXSSFColor();
return clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndexed();
}
/**
* Get the color to use for the top border
*
* @return the used color or <code>null</code> if not set
*/
public XSSFColor getTopBorderXSSFColor() {
if(!_cellXf.getApplyBorder()) return null;
int idx = (int)_cellXf.getBorderId();
XSSFCellBorder border = _stylesSource.getBorderAt(idx);
return border.getBorderColor(BorderSide.TOP);
}
/**
* Get the type of vertical alignment for the cell
*
* @return align the type of alignment, default value is {@link org.apache.poi.ss.usermodel.CellStyle#VERTICAL_BOTTOM}
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_TOP
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_CENTER
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_BOTTOM
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_JUSTIFY
*/
public short getVerticalAlignment() {
return (short) (getVerticalAlignmentEnum().ordinal());
}
/**
* Get the type of vertical alignment for the cell
*
* @return the type of alignment, default value is {@link org.apache.poi.ss.usermodel.VerticalAlignment#BOTTOM}
* @see org.apache.poi.ss.usermodel.VerticalAlignment
*/
public VerticalAlignment getVerticalAlignmentEnum() {
CTCellAlignment align = _cellXf.getAlignment();
if(align != null && align.isSetVertical()) {
return VerticalAlignment.values()[align.getVertical().intValue()-1];
}
return VerticalAlignment.BOTTOM;
}
/**
* Whether the text should be wrapped
*
* @return a boolean value indicating if the text in a cell should be line-wrapped within the cell.
*/
public boolean getWrapText() {
CTCellAlignment align = _cellXf.getAlignment();
return align != null && align.getWrapText();
}
/**
* Set the type of horizontal alignment for the cell
*
* @param align - the type of alignment
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_GENERAL
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_LEFT
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_RIGHT
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_FILL
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_JUSTIFY
* @see org.apache.poi.ss.usermodel.CellStyle#ALIGN_CENTER_SELECTION
*/
public void setAlignment(short align) {
getCellAlignment().setHorizontal(HorizontalAlignment.values()[align]);
}
/**
* Set the type of horizontal alignment for the cell
*
* @param align - the type of alignment
* @see org.apache.poi.ss.usermodel.HorizontalAlignment
*/
public void setAlignment(HorizontalAlignment align) {
setAlignment((short)align.ordinal());
}
/**
* Set the type of border to use for the bottom border of the cell
*
* @param border the type of border to use
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public void setBorderBottom(short border) {
CTBorder ct = getCTBorder();
CTBorderPr pr = ct.isSetBottom() ? ct.getBottom() : ct.addNewBottom();
if(border == BORDER_NONE) ct.unsetBottom();
else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));
int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
_cellXf.setBorderId(idx);
_cellXf.setApplyBorder(true);
}
/**
* Set the type of border to use for the bottom border of the cell
*
* @param border - type of border to use
* @see org.apache.poi.ss.usermodel.BorderStyle
*/
public void setBorderBottom(BorderStyle border) {
setBorderBottom((short)border.ordinal());
}
/**
* Set the type of border to use for the left border of the cell
* @param border the type of border to use
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public void setBorderLeft(short border) {
CTBorder ct = getCTBorder();
CTBorderPr pr = ct.isSetLeft() ? ct.getLeft() : ct.addNewLeft();
if(border == BORDER_NONE) ct.unsetLeft();
else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));
int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
_cellXf.setBorderId(idx);
_cellXf.setApplyBorder(true);
}
/**
* Set the type of border to use for the left border of the cell
*
* @param border the type of border to use
*/
public void setBorderLeft(BorderStyle border) {
setBorderLeft((short)border.ordinal());
}
/**
* Set the type of border to use for the right border of the cell
*
* @param border the type of border to use
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public void setBorderRight(short border) {
CTBorder ct = getCTBorder();
CTBorderPr pr = ct.isSetRight() ? ct.getRight() : ct.addNewRight();
if(border == BORDER_NONE) ct.unsetRight();
else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));
int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
_cellXf.setBorderId(idx);
_cellXf.setApplyBorder(true);
}
/**
* Set the type of border to use for the right border of the cell
*
* @param border the type of border to use
*/
public void setBorderRight(BorderStyle border) {
setBorderRight((short)border.ordinal());
}
/**
* Set the type of border to use for the top border of the cell
*
* @param border the type of border to use
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_NONE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THIN
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOTTED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_THICK
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DOUBLE
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_HAIR
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASHED
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public void setBorderTop(short border) {
CTBorder ct = getCTBorder();
CTBorderPr pr = ct.isSetTop() ? ct.getTop() : ct.addNewTop();
if(border == BORDER_NONE) ct.unsetTop();
else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));
int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
_cellXf.setBorderId(idx);
_cellXf.setApplyBorder(true);
}
/**
* Set the type of border to use for the top border of the cell
*
* @param border the type of border to use
*/
public void setBorderTop(BorderStyle border) {
setBorderTop((short)border.ordinal());
}
/**
* Set the color to use for the bottom border
* @param color the index of the color definition
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setBottomBorderColor(short color) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(color);
setBottomBorderColor(clr);
}
/**
* Set the color to use for the bottom border
*
* @param color the color to use, null means no color
*/
public void setBottomBorderColor(XSSFColor color) {
CTBorder ct = getCTBorder();
if(color == null && !ct.isSetBottom()) return;
CTBorderPr pr = ct.isSetBottom() ? ct.getBottom() : ct.addNewBottom();
if(color != null) pr.setColor(color.getCTColor());
else pr.unsetColor();
int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
_cellXf.setBorderId(idx);
_cellXf.setApplyBorder(true);
}
/**
* Set the index of a data format
*
* @param fmt the index of a data format
*/
public void setDataFormat(short fmt) {
_cellXf.setApplyNumberFormat(true);
_cellXf.setNumFmtId(fmt);
}
/**
* Set the background fill color represented as a {@link XSSFColor} value.
* <p>
* For example:
* <pre>
* cs.setFillPattern(XSSFCellStyle.FINE_DOTS );
* cs.setFillBackgroundXSSFColor(new XSSFColor(java.awt.Color.RED));
* </pre>
* optionally a Foreground and background fill can be applied:
* <i>Note: Ensure Foreground color is set prior to background</i>
* <pre>
* cs.setFillPattern(XSSFCellStyle.FINE_DOTS );
* cs.setFillForegroundColor(new XSSFColor(java.awt.Color.BLUE));
* cs.setFillBackgroundColor(new XSSFColor(java.awt.Color.GREEN));
* </pre>
* or, for the special case of SOLID_FILL:
* <pre>
* cs.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND );
* cs.setFillForegroundColor(new XSSFColor(java.awt.Color.GREEN));
* </pre>
* It is necessary to set the fill style in order
* for the color to be shown in the cell.
*
* @param color - the color to use
*/
public void setFillBackgroundColor(XSSFColor color) {
CTFill ct = getCTFill();
CTPatternFill ptrn = ct.getPatternFill();
if(color == null) {
if(ptrn != null) ptrn.unsetBgColor();
} else {
if(ptrn == null) ptrn = ct.addNewPatternFill();
ptrn.setBgColor(color.getCTColor());
}
int idx = _stylesSource.putFill(new XSSFCellFill(ct));
_cellXf.setFillId(idx);
_cellXf.setApplyFill(true);
}
/**
* Set the background fill color represented as a indexed color value.
* <p>
* For example:
* <pre>
* cs.setFillPattern(XSSFCellStyle.FINE_DOTS );
* cs.setFillBackgroundXSSFColor(IndexedColors.RED.getIndex());
* </pre>
* optionally a Foreground and background fill can be applied:
* <i>Note: Ensure Foreground color is set prior to background</i>
* <pre>
* cs.setFillPattern(XSSFCellStyle.FINE_DOTS );
* cs.setFillForegroundColor(IndexedColors.BLUE.getIndex());
* cs.setFillBackgroundColor(IndexedColors.RED.getIndex());
* </pre>
* or, for the special case of SOLID_FILL:
* <pre>
* cs.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND );
* cs.setFillForegroundColor(IndexedColors.RED.getIndex());
* </pre>
* It is necessary to set the fill style in order
* for the color to be shown in the cell.
*
* @param bg - the color to use
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setFillBackgroundColor(short bg) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(bg);
setFillBackgroundColor(clr);
}
/**
* Set the foreground fill color represented as a {@link XSSFColor} value.
* <br/>
* <i>Note: Ensure Foreground color is set prior to background color.</i>
* @param color the color to use
* @see #setFillBackgroundColor(org.apache.poi.xssf.usermodel.XSSFColor) )
*/
public void setFillForegroundColor(XSSFColor color) {
CTFill ct = getCTFill();
CTPatternFill ptrn = ct.getPatternFill();
if(color == null) {
if(ptrn != null) ptrn.unsetFgColor();
} else {
if(ptrn == null) ptrn = ct.addNewPatternFill();
ptrn.setFgColor(color.getCTColor());
}
int idx = _stylesSource.putFill(new XSSFCellFill(ct));
_cellXf.setFillId(idx);
_cellXf.setApplyFill(true);
}
/**
* Set the foreground fill color as a indexed color value
* <br/>
* <i>Note: Ensure Foreground color is set prior to background color.</i>
* @param fg the color to use
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setFillForegroundColor(short fg) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(fg);
setFillForegroundColor(clr);
}
/**
* Get a <b>copy</b> of the currently used CTFill, if none is used, return a new instance.
*/
private CTFill getCTFill(){
CTFill ct;
if(_cellXf.getApplyFill()) {
int fillIndex = (int)_cellXf.getFillId();
XSSFCellFill cf = _stylesSource.getFillAt(fillIndex);
ct = (CTFill)cf.getCTFill().copy();
} else {
ct = CTFill.Factory.newInstance();
}
return ct;
}
/**
* Get a <b>copy</b> of the currently used CTBorder, if none is used, return a new instance.
*/
private CTBorder getCTBorder(){
CTBorder ct;
if(_cellXf.getApplyBorder()) {
int idx = (int)_cellXf.getBorderId();
XSSFCellBorder cf = _stylesSource.getBorderAt(idx);
ct = (CTBorder)cf.getCTBorder().copy();
} else {
ct = CTBorder.Factory.newInstance();
}
return ct;
}
/**
* This element is used to specify cell fill information for pattern and solid color cell fills.
* For solid cell fills (no pattern), foregorund color is used.
* For cell fills with patterns specified, then the cell fill color is specified by the background color.
*
* @see org.apache.poi.ss.usermodel.CellStyle#NO_FILL
* @see org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND
* @see org.apache.poi.ss.usermodel.CellStyle#FINE_DOTS
* @see org.apache.poi.ss.usermodel.CellStyle#ALT_BARS
* @see org.apache.poi.ss.usermodel.CellStyle#SPARSE_DOTS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_HORZ_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_VERT_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_BACKWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#THICK_FORWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#BIG_SPOTS
* @see org.apache.poi.ss.usermodel.CellStyle#BRICKS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_HORZ_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_VERT_BANDS
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_BACKWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#THIN_FORWARD_DIAG
* @see org.apache.poi.ss.usermodel.CellStyle#SQUARES
* @see org.apache.poi.ss.usermodel.CellStyle#DIAMONDS
* @see #setFillBackgroundColor(short)
* @see #setFillForegroundColor(short)
* @param fp fill pattern (set to {@link org.apache.poi.ss.usermodel.CellStyle#SOLID_FOREGROUND} to fill w/foreground color)
*/
public void setFillPattern(short fp) {
CTFill ct = getCTFill();
CTPatternFill ptrn = ct.isSetPatternFill() ? ct.getPatternFill() : ct.addNewPatternFill();
if(fp == NO_FILL && ptrn.isSetPatternType()) ptrn.unsetPatternType();
else ptrn.setPatternType(STPatternType.Enum.forInt(fp + 1));
int idx = _stylesSource.putFill(new XSSFCellFill(ct));
_cellXf.setFillId(idx);
_cellXf.setApplyFill(true);
}
/**
* This element is used to specify cell fill information for pattern and solid color cell fills. For solid cell fills (no pattern),
* foreground color is used is used. For cell fills with patterns specified, then the cell fill color is specified by the background color element.
*
* @param ptrn the fill pattern to use
* @see #setFillBackgroundColor(short)
* @see #setFillForegroundColor(short)
* @see org.apache.poi.ss.usermodel.FillPatternType
*/
public void setFillPattern(FillPatternType ptrn) {
setFillPattern((short)ptrn.ordinal());
}
/**
* Set the font for this style
*
* @param font a font object created or retreived from the XSSFWorkbook object
* @see org.apache.poi.xssf.usermodel.XSSFWorkbook#createFont()
* @see org.apache.poi.xssf.usermodel.XSSFWorkbook#getFontAt(short)
*/
public void setFont(Font font) {
if(font != null){
long index = font.getIndex();
this._cellXf.setFontId(index);
this._cellXf.setApplyFont(true);
} else {
this._cellXf.setApplyFont(false);
}
}
/**
* Set the cell's using this style to be hidden
*
* @param hidden - whether the cell using this style should be hidden
*/
public void setHidden(boolean hidden) {
getCellProtection().setHidden(hidden);
}
/**
* Set the number of spaces to indent the text in the cell
*
* @param indent - number of spaces
*/
public void setIndention(short indent) {
getCellAlignment().setIndent(indent);
}
/**
* Set the color to use for the left border as a indexed color value
*
* @param color the index of the color definition
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setLeftBorderColor(short color) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(color);
setLeftBorderColor(clr);
}
/**
* Set the color to use for the left border as a {@link XSSFColor} value
*
* @param color the color to use
*/
public void setLeftBorderColor(XSSFColor color) {
CTBorder ct = getCTBorder();
if(color == null && !ct.isSetLeft()) return;
CTBorderPr pr = ct.isSetLeft() ? ct.getLeft() : ct.addNewLeft();
if(color != null) pr.setColor(color.getCTColor());
else pr.unsetColor();
int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
_cellXf.setBorderId(idx);
_cellXf.setApplyBorder(true);
}
/**
* Set the cell's using this style to be locked
*
* @param locked - whether the cell using this style should be locked
*/
public void setLocked(boolean locked) {
getCellProtection().setLocked(locked);
}
/**
* Set the color to use for the right border
*
* @param color the index of the color definition
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setRightBorderColor(short color) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(color);
setRightBorderColor(clr);
}
/**
* Set the color to use for the right border as a {@link XSSFColor} value
*
* @param color the color to use
*/
public void setRightBorderColor(XSSFColor color) {
CTBorder ct = getCTBorder();
if(color == null && !ct.isSetRight()) return;
CTBorderPr pr = ct.isSetRight() ? ct.getRight() : ct.addNewRight();
if(color != null) pr.setColor(color.getCTColor());
else pr.unsetColor();
int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
_cellXf.setBorderId(idx);
_cellXf.setApplyBorder(true);
}
/**
* Set the degree of rotation for the text in the cell
* <p>
* Expressed in degrees. Values range from 0 to 180. The first letter of
* the text is considered the center-point of the arc.
* <br/>
* For 0 - 90, the value represents degrees above horizon. For 91-180 the degrees below the
* horizon is calculated as:
* <br/>
* <code>[degrees below horizon] = 90 - textRotation.</code>
* </p>
*
* @param rotation - the rotation degrees (between 0 and 180 degrees)
*/
public void setRotation(short rotation) {
getCellAlignment().setTextRotation(rotation);
}
/**
* Set the color to use for the top border
*
* @param color the index of the color definition
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public void setTopBorderColor(short color) {
XSSFColor clr = new XSSFColor();
clr.setIndexed(color);
setTopBorderColor(clr);
}
/**
* Set the color to use for the top border as a {@link XSSFColor} value
*
* @param color the color to use
*/
public void setTopBorderColor(XSSFColor color) {
CTBorder ct = getCTBorder();
if(color == null && !ct.isSetTop()) return;
CTBorderPr pr = ct.isSetTop() ? ct.getTop() : ct.addNewTop();
if(color != null) pr.setColor(color.getCTColor());
else pr.unsetColor();
int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
_cellXf.setBorderId(idx);
_cellXf.setApplyBorder(true);
}
/**
* Set the type of vertical alignment for the cell
*
* @param align - align the type of alignment
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_TOP
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_CENTER
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_BOTTOM
* @see org.apache.poi.ss.usermodel.CellStyle#VERTICAL_JUSTIFY
* @see org.apache.poi.ss.usermodel.VerticalAlignment
*/
public void setVerticalAlignment(short align) {
getCellAlignment().setVertical(VerticalAlignment.values()[align]);
}
/**
* Set the type of vertical alignment for the cell
*
* @param align - the type of alignment
*/
public void setVerticalAlignment(VerticalAlignment align) {
getCellAlignment().setVertical(align);
}
/**
* Set whether the text should be wrapped.
* <p>
* Setting this flag to <code>true</code> make all content visible
* whithin a cell by displaying it on multiple lines
* </p>
*
* @param wrapped a boolean value indicating if the text in a cell should be line-wrapped within the cell.
*/
public void setWrapText(boolean wrapped) {
getCellAlignment().setWrapText(wrapped);
}
/**
* Gets border color
*
* @param side the border side
* @return the used color
*/
public XSSFColor getBorderColor(BorderSide side) {
switch(side){
case BOTTOM:
return getBottomBorderXSSFColor();
case RIGHT:
return getRightBorderXSSFColor();
case TOP:
return getTopBorderXSSFColor();
case LEFT:
return getLeftBorderXSSFColor();
default:
throw new IllegalArgumentException("Unknown border: " + side);
}
}
/**
* Set the color to use for the selected border
*
* @param side - where to apply the color definition
* @param color - the color to use
*/
public void setBorderColor(BorderSide side, XSSFColor color) {
switch(side){
case BOTTOM:
setBottomBorderColor(color);
break;
case RIGHT:
setRightBorderColor(color);
break;
case TOP:
setTopBorderColor(color);
break;
case LEFT:
setLeftBorderColor(color);
break;
}
}
private int getFontId() {
if (_cellXf.isSetFontId()) {
return (int) _cellXf.getFontId();
}
return (int) _cellStyleXf.getFontId();
}
/**
* get a cellProtection from the supplied XML definition
* @return CTCellProtection
*/
private CTCellProtection getCellProtection() {
if (_cellXf.getProtection() == null) {
_cellXf.addNewProtection();
}
return _cellXf.getProtection();
}
/**
* get the cellAlignment object to use for manage alignment
* @return XSSFCellAlignment - cell alignment
*/
protected XSSFCellAlignment getCellAlignment() {
if (this._cellAlignment == null) {
this._cellAlignment = new XSSFCellAlignment(getCTCellAlignment());
}
return this._cellAlignment;
}
/**
* Return the CTCellAlignment instance for alignment
*
* @return CTCellAlignment
*/
private CTCellAlignment getCTCellAlignment() {
if (_cellXf.getAlignment() == null) {
_cellXf.setAlignment(CTCellAlignment.Factory.newInstance());
}
return _cellXf.getAlignment();
}
/**
* Returns a hash code value for the object. The hash is derived from the underlying CTXf bean.
*
* @return the hash code value for this style
*/
public int hashCode(){
return _cellXf.toString().hashCode();
}
/**
* Checks is the supplied style is equal to this style
*
* @param o the style to check
* @return true if the supplied style is equal to this style
*/
public boolean equals(Object o){
if(o == null || !(o instanceof XSSFCellStyle)) return false;
XSSFCellStyle cf = (XSSFCellStyle)o;
return _cellXf.toString().equals(cf.getCoreXf().toString());
}
/**
* Make a copy of this style. The underlying CTXf bean is cloned,
* the references to fills and borders remain.
*
* @return a copy of this style
*/
public Object clone(){
CTXf xf = (CTXf)_cellXf.copy();
int xfSize = _stylesSource._getStyleXfsSize();
int indexXf = _stylesSource.putCellXf(xf);
return new XSSFCellStyle(indexXf-1, xfSize-1, _stylesSource);
}
}
| [
"yegor@13f79535-47bb-0310-9956-ffa450edef68"
] | yegor@13f79535-47bb-0310-9956-ffa450edef68 |
b2d5d0928861a02a930dd99e067b1aee6877b818 | cf5e45ece2a7cc411dc1f7fd12eb611c35d5c075 | /src/model/Database.java | 0d7a5c8e8eedf89e6e8e85b3c17ac419cb616897 | [] | no_license | Wilmermo/CRM-1 | e6ec080c443be16185bfd962e6b38f8113c09bcc | 717c841f607bff791bed670fe78f5bdbffc489e5 | refs/heads/master | 2021-01-18T10:59:38.852261 | 2012-08-10T22:00:57 | 2012-08-10T22:00:57 | null | 0 | 0 | null | null | null | null | ISO-8859-10 | Java | false | false | 6,116 | java | package model;
import java.util.ArrayList;
public class Database {
ArrayList<Prospecto> prospectoData = new ArrayList<Prospecto>();
ArrayList<Cliente> clienteData = new ArrayList<Cliente>();
ArrayList<Venta> ventaData = new ArrayList<Venta>();
ArrayList<Compra> compraData = new ArrayList<Compra>();
ArrayList<GrupoEstudio> grupoEstudioData = new ArrayList<GrupoEstudio>();
ArrayList<Usuario> usuarioData = new ArrayList<Usuario>();
ArrayList<Rol> rolData = new ArrayList<Rol>();
ArrayList<Currency> currencyData = new ArrayList<Currency>();
ArrayList<Modulo> moduloData = new ArrayList<Modulo>();
ArrayList<Opcion> opcionData = new ArrayList<Opcion>();
// Instanciador
public Database() {
moduloData.add(new Modulo("Prospectos" ,"Modulo de Prospectos" ,true));
moduloData.add(new Modulo("Clientes" ,"Modulo de Clientes" ,true));
moduloData.add(new Modulo("Ventas" ,"Modulo de Ventas" ,true));
moduloData.add(new Modulo("Compras" ,"Modulo de Compras" ,true));
moduloData.add(new Modulo("GruposEstudio","Modulo de Grupos de Estudio",true));
moduloData.add(new Modulo("Usuarios" ,"Modulo de Usuarios" ,true));
moduloData.add(new Modulo("Roles" ,"Modulo de Roles" ,true));
opcionData.add(new Opcion("Agregar" ,"Nuevo registro" ,true));
opcionData.add(new Opcion("Modificar" ,"Modificar registro" ,true));
opcionData.add(new Opcion("Eliminar" ,"Eliminar registro" ,true));
opcionData.add(new Opcion("Buscar" ,"Buscar registro" ,true));
opcionData.add(new Opcion("Listar" ,"Listar registro" ,true));
}
// Generar datos de prueba
public void loadTestData() {
// Prospectos de Clientes
prospectoData.add(new Prospecto("Juan","Perez","Rojas","juanperez@hotmail.com","16201123","720-1221","2012/01/01"));
prospectoData.add(new Prospecto("Maria","Ocaņa","Rios","mariaocana@hotmail.com","12345667","720-1222","2012/05/07"));
prospectoData.add(new Prospecto("Gabriel","Osorio","Iriarte","gabrielosorio@hotmail.com","87654321","720-1223","2012/06/15"));
prospectoData.add(new Prospecto("Raul","Quispe","Mendizabal","raulquispe@msn.com","87654321","720-1222","2012/04/21"));
prospectoData.add(new Prospecto("Miguel","Huaman","Flor","miguelhuaman@msn.com","12345667","720-1224","2012/01/18"));
prospectoData.add(new Prospecto("Karina","Pita","Branco","karinapita@gmail.com","16201123","720-1222","2012/07/22"));
prospectoData.add(new Prospecto("Olga","Julca","Zambrano","olgajulca@gmail.com","87654321","720-1225","2012/05/28"));
prospectoData.add(new Prospecto("Susana","Chavez","Garcia","susanachavez@yahoo.com","16201123","720-1222","2012/03/09"));
prospectoData.add(new Prospecto("Mariela","Ugarte","Velez","marielaugarte@yahoo.com","12345667","720-1226","2012/11/24"));
// Monedas
currencyData.add(new Currency("SOL", "S/.", 1.00));
currencyData.add(new Currency("DOL", "US$", 2.65));
// Permisos por Rol (Modulo, Consultar, Agregar, Modificar, Eliminar)
ArrayList<Permiso> permisoRAdmin = new ArrayList<Permiso>();
permisoRAdmin.add(new Permiso("Prospectos" , true, true, true, true, true));
permisoRAdmin.add(new Permiso("Clientes" , true, true, true, true, true));
permisoRAdmin.add(new Permiso("Compras" , true, true, true, true, true));
permisoRAdmin.add(new Permiso("Ventas" , true, true, true, true, true));
permisoRAdmin.add(new Permiso("GruposEstudio", true, true, true, true, true));
permisoRAdmin.add(new Permiso("Usuarios" , true, true, true, true, true));
permisoRAdmin.add(new Permiso("Roles" , true, true, true, true, true));
ArrayList<Permiso> permisoROperador = new ArrayList<Permiso>();
permisoROperador.add(new Permiso("Prospectos" , true, true, true, true, false));
permisoROperador.add(new Permiso("Clientes" , true, true, true, true, true));
permisoROperador.add(new Permiso("Compras" , true, true, true, true, true));
permisoROperador.add(new Permiso("Ventas" , true, true, true, true, true));
permisoROperador.add(new Permiso("GruposEstudio", true, true, true, true, true));
permisoROperador.add(new Permiso("Usuarios" , false, true, true, true, true));
permisoROperador.add(new Permiso("Roles" , false, true, true, true, true));
// Roles
rolData.add(new Rol("radmin", permisoRAdmin));
rolData.add(new Rol("roperador", permisoROperador));
// Usuarios
usuarioData.add(new Usuario("admin","Curs0d3p002012",
"06259735","Jorge","Cabezudo","Perez","jorge.cabezudo@gmail.com",
"2012/07/08","Administrador","radmin"));
usuarioData.add(new Usuario("operador","0p3r4d0r",
"06259735","Ruth","Navarro","Guevara","ruth.navarro@gmail.com",
"2012/07/18","Operador","roperador"));
}
public Usuario getUsuario(String p_atributo, String p_valor) {
Usuario usuarioFound = null;
// retornar el objeto que coincide con el valor del atributo
for (Usuario u : usuarioData) {
if (p_atributo.equals("cuenta")) {
if (u.getCuenta().equals(p_valor)) {
usuarioFound = u;
}
}
}
return usuarioFound;
}
public Currency getCurrency(String p_atributo, String p_valor) {
Currency currencyFound = null;
// retornar el objeto que coincide con el valor del atributo
for (Currency c : currencyData) {
if (p_atributo.equals("currencyName")) {
if (c.getCurrencyName().equals(p_valor)) {
currencyFound = c;
}
}
}
return currencyFound;
}
public ArrayList<Modulo> getModulos() {
return this.moduloData;
}
public ArrayList<Permiso> getPermisos(String p_userName) {
ArrayList<Permiso> permisoList = null;
for (Usuario u : usuarioData) {
if (u.getCuenta().equals(p_userName)) {
for (Rol r : rolData) {
if (u.getRol().equals(r.getNombre())) {
permisoList = r.getPermisoList();
}
}
}
}
return permisoList;
}
public ArrayList<Opcion> getOpciones() {
return this.opcionData;
}
public void addProspecto(Prospecto p) {
prospectoData.add(p);
}
public ArrayList<Prospecto> getProspectos() {
return prospectoData;
}
}
| [
"u201215490@upc.edu.pe"
] | u201215490@upc.edu.pe |
05abfb4ab243041739a297ef4f07f755699e1803 | 702a611aac878e0a64933a86c9fc44568bfecca0 | /test/src/test/java/com/jt/test/service/CheckQte.java | 6e820d88425b8cc9d627d9b63d524891d8485c40 | [
"Apache-2.0"
] | permissive | jt120/my-cabin | 404d240b9b4a6111fa5b27b0b67d9754cee68c6c | fa6655999cbf6f1878d48094f7c02af43f30924e | refs/heads/master | 2016-09-08T00:24:16.421015 | 2015-05-27T04:11:28 | 2015-05-27T04:11:28 | 31,362,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,213 | java | package com.jt.test.service;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by ze.liu on 2014/9/19.
*/
public class CheckQte {
private static final Logger logger = LoggerFactory.getLogger(CheckQte.class);
private static Pattern WITHTAX_GT0 = Pattern.compile("(\\d{2})[ \\S]*[ ]+(\\d+)([ ]|[A-Z]{2,})*INCL TAX");
private static Pattern WITHOUTTAX_EQ0 = Pattern.compile("^(\\d{2})[ \\s]{1,}[ \\S]*[ ]+(\\d+)([ ]|[A-Z]{2,})*", Pattern.MULTILINE);
private static Pattern FSQWITHFARE = Pattern.compile("[\\s\\S]*^FARE[ \\s]+[\\s\\S]*?[ \\s]+\\d+[\\s\\S]*?$[\\s\\S]*", Pattern.MULTILINE);
private static Pattern FSQWITHTAX = Pattern.compile("[\\s\\S]*^TAX[ \\s]+[\\s\\S]*?[ \\s]+[\\s\\S]*?$[\\s\\S]*", Pattern.MULTILINE);
private QtaxExchangeRateService qtaxExchangeRateService = new QtaxExchangeRateService();
/**
* 此段逻辑已经废除,原因是税费为0时要计算q*roe
*
* @param xsfsqMsg
* @param type
* @return
*/
@Deprecated
public String getQTaxMsg(String xsfsqMsg, String type) {
if (StringUtils.isBlank(xsfsqMsg)) {
return null;
}
boolean hasFare = FSQWITHFARE.matcher(xsfsqMsg).matches();
boolean hasTax = false;
if (hasFare) { //有报价
hasTax = FSQWITHTAX.matcher(xsfsqMsg).matches();
if (!hasTax) { //没有Tax开头的记录就是没有税费
return "0";
} else {
return xsfsqMsg;
}
} else {
logger.info("can't find FSQ FARE info:" + xsfsqMsg);
}
return null;
}
public String getXFSQNum(String qte_or_xsfsi_Msg, List<String> totalfareList) {
if (StringUtils.isBlank(qte_or_xsfsi_Msg) || !this.isValidQTaxCMDResp(qte_or_xsfsi_Msg)) {
return "";
}
totalfareList.clear();
Matcher taxGt0Matcher = WITHTAX_GT0.matcher(qte_or_xsfsi_Msg);
String fsqNo = "";
while (taxGt0Matcher.find()) {
fsqNo = taxGt0Matcher.group(1);
totalfareList.add(taxGt0Matcher.group(2));
}
if (StringUtils.isBlank(fsqNo)) {
Matcher taxEq0Matcher = WITHOUTTAX_EQ0.matcher(qte_or_xsfsi_Msg);
totalfareList.clear();
while (taxEq0Matcher.find()) {
fsqNo = taxEq0Matcher.group(1);
totalfareList.add(taxEq0Matcher.group(2));
}
}
return fsqNo;
}
public String getXFSQNumAdapterNofare(String qte_or_xsfsi_Msg, List<String> totalfareList) {
boolean isNofare = StringUtils.isNotBlank(qte_or_xsfsi_Msg) && noFarePattern.matcher(qte_or_xsfsi_Msg).find();
if (!isNofare && (StringUtils.isBlank(qte_or_xsfsi_Msg) || !this.isValidQTaxCMDResp(qte_or_xsfsi_Msg))) {
return "";
}
totalfareList.clear();
Matcher taxGt0Matcher = WITHTAX_GT0.matcher(qte_or_xsfsi_Msg);
String fsqNo = "";
while (taxGt0Matcher.find()) {
fsqNo = taxGt0Matcher.group(1);
totalfareList.add(taxGt0Matcher.group(2));
}
if (StringUtils.isBlank(fsqNo)) {
Matcher taxEq0Matcher = WITHOUTTAX_EQ0.matcher(qte_or_xsfsi_Msg);
totalfareList.clear();
while (taxEq0Matcher.find()) {
fsqNo = taxEq0Matcher.group(1);
totalfareList.add(taxEq0Matcher.group(2));
}
}
return fsqNo;
}
public int parseQfeeByxfsqMsg(String xfsqMsg, Map<String, String> allCityCodeMap, Set<String> allCarriers) {
double ret = 0;
if (StringUtils.equals(xfsqMsg, "0")) {
return 0;
}
if (StringUtils.equals(xfsqMsg, "-1") || StringUtils.isBlank(xfsqMsg) || !this.isValidQTaxCMDResp(xfsqMsg)) {
return -1;
}
String taxStr = "";
String other = "";
Matcher m = Pattern.compile("FARE\\s+.*?\\nTAX([\\s\\S]*?)TOTAL([\\s\\S]*)").matcher(xfsqMsg);
if (m.find()) {
taxStr = m.group(1);
other = m.group(2);
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr TAXSTR : " + taxStr);
}
}
/* xing.zhao 2013-10-22
* if(StringUtils.isBlank(taxStr)) {
return 0;
}*/
// xing.zhao 2013-10-22 修改,junhui.du需求,要求没有税值的情况,计算q值*ROE值
if (StringUtils.isBlank(taxStr)) {
other = xfsqMsg;
}
if (!this.isValidXFSQMsg(other, allCarriers)) {
return -1;
}
Matcher mTax = Pattern.compile("([\\d\\.]+)").matcher(taxStr);
while (mTax.find()) {
ret += Double.parseDouble(mTax.group(1));
}
other = other.replaceAll("b\\n", "");
for (String city : allCityCodeMap.values()) {
other = other.replaceAll(city, "");
}
if (allCityCodeMap.values().contains("PEK")) {
other = other.replaceAll("BJS", "");
}
if (allCityCodeMap.values().contains("XIY")) {
other = other.replaceAll("SIA", "");
}
for (String carrier : allCarriers) {
other = other.replaceAll(carrier, "");
}
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr QSTR : " + other);
}
// 解析Q值
double q = numberParser(xfsqMsg, other, "Q");
// 解析S值
double s = numberParser(xfsqMsg, other, "S");
q += s;
double qroe[] = {};
//浮点比较
if (q > 0.001) {
Matcher mROE = Pattern.compile("ROE([\\d\\.]+)").matcher(other);
if (mROE.find()) {
double roe = Double.parseDouble(mROE.group(1));
q *= roe;
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr roe : " + roe);
}
}
Matcher mRatio = Pattern.compile("([A-Z]{3})\\s*=([\\d\\.]+)CNY").matcher(other);
if (mRatio.find()) {
//qroe = qtaxExchangeRateService.qroeUpRoleCalc(q, "USD", mRatio.group(1), Constant.qtax_officeid);
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr calc qroe: " + qroe[0] + ";upRole :" + qroe[1]);
}
double ratio = Double.parseDouble(mRatio.group(2));
ret += qtaxExchangeRateService.qrateUpRoleCalc(qroe[0] * ratio, 10);
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr ratio : " + ratio);
}
} else {
ret += qtaxExchangeRateService.qrateUpRoleCalc(q, 10);
}
}
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr final ret: " + ret);
}
return (int) ret;
}
/**
* 解析金额
*
* @param xfsqMsg
* @param other
* @param key "Q":解析Q值, "S":解析S值
* @return
*/
private double numberParser(String xfsqMsg, String other, String key) {
double result = 0;
try {
other = "#" + other.replaceAll("([^A-Z])" + key, "$1#" + key);
Matcher mQ = Pattern.compile("[^A-Z]" + key + "\\s*(\\d+(\\.\\d{0,2})?)").matcher(other);
while (mQ.find()) {
String qvalue = mQ.group(1);
if (qvalue.indexOf(".") == -1) {//报警邮件,q值不能为整数
if (!"S".equals(key)) {
}
} else {
result += Double.parseDouble(qvalue);
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr " + key + " : " + result);
logger.info("S xsfsq is :" + xfsqMsg);
if ("S".equals(key)) {
}
}
}
}
} catch (Exception e) {
logger.error("parse xsfsq" + key + "error", e);
}
return result;
}
/**
* 验证qte指令返回报文,内容错误
*
* @param qtaxInfo
* @return
*/
private boolean isValidQTaxCMDResp(String qtaxInfo) {
if (StringUtils.isNotBlank(qtaxInfo)) {
List<String> errMsg = new ArrayList<String>();
errMsg.add("EXCEPTION: COULD NOT CONNECT TO HOST");
errMsg.add("EFEP ROUTE NAME NOT FOUND");
errMsg.add("PAGING REQUEST DATA NOT FOUND");
errMsg.add("RETRANSMIT");
errMsg.add("NO FARES/RBD/CARRIER");
errMsg.add("EXCEPTION: COULD NOT READ FROM SOCKET");
errMsg.add("SESSION CURRENTLY LOCKED");
errMsg.add("FARE OFFER NOT FOUND");
for (String err : errMsg) {
if (qtaxInfo.contains(err)) {
logger.info("qte switch status is open, but qte info is error");
return false;
}
}
}
return true;
}
/**
* 验证报文是否有窜税现象
*
* @param xfsqMsg
* @param airlineCodes
* @return
*/
private boolean isValidXFSQMsg(String xfsqMsg, Set<String> airlineCodes) {
boolean rs = true;
xfsqMsg = StringUtils.replace(xfsqMsg, "<", " ");
for (String airCode : airlineCodes) {
String rule = StringUtils.upperCase(airCode) + " ";
rs &= (xfsqMsg.contains(rule)); //与操作,只要有一个航空公司没有,验证失败
}
if (!rs) {
logger.error("可能出现指令串税" + xfsqMsg + "\n airlineCodes:" + airlineCodes.toString());
}
return rs;
}
private static Pattern noFarePattern = Pattern.compile(
"\\*NO\\s+FARES/RBD/CARRIER", Pattern.CASE_INSENSITIVE);
/**
* copy自parseQfeeByxfsqMsg,修改了部分逻辑,isNofare的时候,跳过一些检查
*
* @param xsfsqMsg
* @param allCityCodeMap
* @param allCarriers
* @return
* @author lingzhen.kong
*/
public int parseQfeeByxfsqMsgAdapterNofare(String xsfsqMsg) {
double ret = 0;
if (StringUtils.equals(xsfsqMsg, "0")) {
return 0;
}
boolean isNofare = StringUtils.isNotBlank(xsfsqMsg) && noFarePattern.matcher(xsfsqMsg).find();
if (!isNofare && (StringUtils.equals(xsfsqMsg, "-1") || StringUtils.isBlank(xsfsqMsg)
|| !this.isValidQTaxCMDResp(xsfsqMsg))) {
return -1;
}
if (isNofare && logger.isInfoEnabled()) {
logger.info("the xsfsqMsg is no fare");
} else {
logger.info("the xsfsqMsg is not no fare");
}
String taxStr = "";
String other = "";
Matcher m = Pattern.compile(
"FARE\\s+.*?\\nTAX([\\s\\S]*?)TOTAL([\\s\\S]*)").matcher(
xsfsqMsg);
if (m.find()) {
taxStr = m.group(1);
other = m.group(2);
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr TAXSTR : " + taxStr);
}
}
/*
* xing.zhao 2013-10-22 if(StringUtils.isBlank(taxStr)) { return 0; }
*/
// xing.zhao 2013-10-22 修改,junhui.du需求,要求没有税值的情况,计算q值*ROE值
if (StringUtils.isBlank(taxStr)) {
other = xsfsqMsg;
}
Matcher mTax = Pattern.compile("([\\d\\.]+)").matcher(taxStr);
while (mTax.find()) {
ret += Double.parseDouble(mTax.group(1));
}
other = other.replaceAll("b\\n", "");
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr QSTR : " + other);
}
// 解析Q值
double q = numberParser(xsfsqMsg, other, "Q");
// 解析S值
double s = numberParser(xsfsqMsg, other, "S");
q += s;
double qroe[] = {};
// 浮点比较
if (q > 0.001) {
Matcher mROE = Pattern.compile("ROE([\\d\\.]+)").matcher(other);
if (mROE.find()) {
double roe = Double.parseDouble(mROE.group(1));
q *= roe;
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr roe : " + roe);
}
}
Matcher mRatio = Pattern.compile("([A-Z]{3})\\s*=([\\d\\.]+)CNY")
.matcher(other);
if (mRatio.find()) {
//qroe = qtaxExchangeRateService.qroeUpRoleCalc(q, "USD", mRatio.group(1), Constant.qtax_officeid);
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr calc qroe: " + qroe[0]
+ ";upRole :" + qroe[1]);
}
double ratio = Double.parseDouble(mRatio.group(2));
ret += qtaxExchangeRateService.qrateUpRoleCalc(qroe[0] * ratio,
10);
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr ratio : " + ratio);
}
} else {
ret += qtaxExchangeRateService.qrateUpRoleCalc(q, 10);
}
}
if (logger.isInfoEnabled()) {
logger.info("parseQFeeStr final ret: " + ret);
}
return (int) ret;
}
@Test
public void test01() {
String s = "XSIN YIF NVB NVA29SEP 30K ESCb\n" +
" PAR YIF NVB NVA29SEP 30K ESCb\n" +
"FARE CNY 28450 ESCb\n" +
"TAX CNY 90CN CNY 15OO CNY 1719XTESCb\n" +
"TOTAL CNY 30274 ESCb\n" +
"29SEP14CAN SQ X/SIN SQ PAR10M4555.36NUC4555.36END ROE6.24450ESCb\n" +
"0 ESCb\n" +
"XT CNY 44SG CNY 1675YQ ESCb\n" +
"*AUTO BAGGAGE INFORMATION AVAILABLE - SEE FSB ESCb\n" +
"RFSONLN/1E /EFEP_11/FCC=T/ ESCb\n" +
"^^ESCb^C";
int n = parseQfeeByxfsqMsgAdapterNofare(s);
System.out.println(n);
}
@Test
public void test2() {
String taxStr = "TAX CNY 90CN CNY 15OO CNY 1719XTESCb";
Matcher mTax = Pattern.compile("([\\d\\.]+)").matcher(taxStr);
double ret = 0;
while (mTax.find()) {
System.out.println(mTax.group(1));
ret += Double.parseDouble(mTax.group(1));
}
System.out.println(ret);
}
} | [
"jt120lz@gmail.com"
] | jt120lz@gmail.com |
03cc84dde6c71465010696d4b61622fbeb68e1ac | 7bddd31834394182996a7495ad9e247d28a0d1c1 | /src/main/java/br/com/caelum/carangobom/veiculo/dtos/VeiculoDashboard.java | cdf1ce0a7bca54d5c4d26a2bb6da9339d8876f4f | [] | no_license | FranciscoPDNeto/carango-bom-api-base | c059c03aad10d3b1e5b29fe4570833dc172622ce | cf82630f3da054957b18c9835dcf48aaa100f0b0 | refs/heads/master | 2023-06-07T10:07:19.188627 | 2021-07-09T18:40:11 | 2021-07-09T18:40:11 | 377,280,741 | 1 | 1 | null | 2021-07-08T19:27:26 | 2021-06-15T20:03:58 | Java | UTF-8 | Java | false | false | 248 | java | package br.com.caelum.carangobom.veiculo.dtos;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class VeiculoDashboard {
private Long numVeiculos;
private Long somaValor;
private String marca;
}
| [
"llgalvao24@gmail.com"
] | llgalvao24@gmail.com |
3927ae4782bcda28de0548106ab6998b87bf4d17 | 297d94988a89455f9a9f113bfa107f3314d21f51 | /trade-biz/src/main/java/com/hbc/api/trade/ota/resp/OrderCancelResult.java | e0997b838bc2c5b9ea8ad3b0a50f449803794b91 | [] | no_license | whyoyyx/trade | 408e86aba9a0d09aa5397eef194d346169ff15cc | 9d3f30fafca42036385280541e31eb38d2145e03 | refs/heads/master | 2020-12-28T19:11:46.342249 | 2016-01-15T03:29:44 | 2016-01-15T03:29:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,785 | java | /*
* Copyright (c) 2015-2016, CCLX.COM. All rights reserved.
* WANDA GROUP PROPRIETARY/CONFIDENTIAL.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is private property; you can't redistribute it and/or modify it
* under the terms of the LICENSE you obtained from
*
* http://www.cclx.com/
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* Author: Jongly Ran
* Revision: 1.0
*/
package com.hbc.api.trade.ota.resp;
/**
* @author Jongly Ran
*/
public class OrderCancelResult {
private String orderNo; // HBC 订单号
private String thirdTradeNo; // 三方订单号
private Double refundable; // 可退金额
private Double cancelFee; // 退款时应扣除已消费的费用
/**
* @return the orderNo
*/
public String getOrderNo() {
return orderNo;
}
/**
* @param orderNo the orderNo to set
*/
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
/**
* @return the thirdTradeNo
*/
public String getThirdTradeNo() {
return thirdTradeNo;
}
/**
* @param thirdTradeNo the thirdTradeNo to set
*/
public void setThirdTradeNo(String thirdTradeNo) {
this.thirdTradeNo = thirdTradeNo;
}
/**
* @return the refundable
*/
public Double getRefundable() {
return refundable;
}
/**
* @param refundable the refundable to set
*/
public void setRefundable(Double refundable) {
this.refundable = refundable;
}
/**
* @return the cancelFee
*/
public Double getCancelFee() {
return cancelFee;
}
/**
* @param cancelFee the cancelFee to set
*/
public void setCancelFee(Double cancelFee) {
this.cancelFee = cancelFee;
}
}
| [
"fuyongtian@huangbaoche.com"
] | fuyongtian@huangbaoche.com |
bcb76dc38c2c62932549551a7d9f99ed0969d3ea | a787a0b9859be15e838e29215cb77543b995c826 | /Java Projects/TroJams/src/networking/UpdatePartyMessage.java | 3005fd7afc4b60030f7015ca5dea84462337c02d | [] | no_license | AdamMoffitt/portfolio | 675e46f0b308ad06a095a4b0cdb28d4694fe7782 | 198d88c13eff4f7579863cc5a0e2d02f756f2647 | refs/heads/master | 2023-01-13T12:09:01.052253 | 2020-04-29T15:31:44 | 2020-04-29T15:31:44 | 56,955,304 | 2 | 1 | null | 2023-01-09T12:17:06 | 2016-04-24T05:13:08 | HTML | UTF-8 | Java | false | false | 242 | java | package networking;
import logic.Party;
public class UpdatePartyMessage extends Message {
private Party party;
public UpdatePartyMessage(Party p) {
super("upm");
this.party = p;
}
public Party getParty(){
return party;
}
}
| [
"admoffit@usc.edu"
] | admoffit@usc.edu |
a187976e8f1ad54c7be50205439e68ed180d196c | 98cd2632e69feb687dfc24079f096499b0dc71fe | /storemanagement/src/main/java/com/capgemini/storemanagement/dao/ManufactureDAOImpl.java | 5ca39ad44ff2c50223275c44de664dfa0cd4eae6 | [] | no_license | Narasimha9963/project1 | e6e98e0cf89d6a5034a97d4a0bf1ea1e80e43023 | 566809a9f2730d67ac0910283ab018bc32a1b6a4 | refs/heads/master | 2022-06-22T03:31:57.465725 | 2020-02-11T10:30:27 | 2020-02-11T10:30:27 | 239,734,870 | 0 | 0 | null | 2022-06-21T02:46:56 | 2020-02-11T10:28:22 | JavaScript | UTF-8 | Java | false | false | 3,583 | java | package com.capgemini.storemanagement.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.capgemini.storemanagement.dto.Orders;
import com.capgemini.storemanagement.dto.Products;
import com.capgemini.storemanagement.dto.StoreUnit;
import com.capgemini.storemanagement.dto.Users;
public class ManufactureDAOImpl implements ManufactureDAO {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
Statement stmt = null;
public List<String> loginManufact(String userId, String password) {
List<String> users = new ArrayList<String>();
try {
Class.forName("com.mysql.jdbc.Driver");
String dburl = "jdbc:mysql://localhost:3306/storemanagement?user=root&password=root";
con = DriverManager.getConnection(dburl);
String qry = "select * from users_info where userId ='" + userId + "' and password='" + password + "'";
pstmt = con.prepareStatement(qry);
rs = pstmt.executeQuery();
while (rs.next()) {
users.add(rs.getString("userId"));
users.add(rs.getString("password"));
}
} catch (Exception e) {
e.getMessage();
}
return users;
}
public boolean addDealer(Users dealer) {
return false;
}
public boolean modifyDealer(Users dealer) {
return false;
}
public boolean removeDealer(String dealerId) {
return false;
}
public List<String> viewAllDealers(String role) {
List<String> manufactures = new ArrayList<>();
try {
Class.forName("com.mysql.jdbc.Driver");
String dburl = "jdbc:mysql://localhost:3306/storemanagement?user=root&password=root";
Connection con = DriverManager.getConnection(dburl);
String qry = "select * from users_info where role='" + role + "' ";
pstmt=con.prepareStatement(qry);
ResultSet rs = pstmt.executeQuery();
while(rs.next()) {
manufactures.add(rs.getString("userName"));
}
} catch (Exception e) {
e.getMessage();
}
return manufactures;
}
public boolean addProduct(Products product) {
return false;
}
public boolean modifyProduct(Products product) {
return false;
}
public boolean removeProduct(Integer productId) {
return false;
}
public List<String> viewAllProducts() {
List<String> productlist = new ArrayList<>();
try {
Class.forName("com.mysql.jdbc.Driver");
String dburl = "jdbc:mysql://localhost:3306/storemanagement?user=root&password=root";
Connection con = DriverManager.getConnection(dburl);
String qry = "select * from product_details";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(qry);
while (rs.next()) {
productlist.add(rs.getString("brand"));
}
} catch (Exception e) {
e.getMessage();
}
return productlist;
}
public List<String> viewAllOrders() {
List<String> productlist = new ArrayList<>();
try {
Class.forName("com.mysql.jdbc.Driver");
String dburl = "jdbc:mysql://localhost:3306/storemanagement?user=root&password=root";
Connection con = DriverManager.getConnection(dburl);
String qry = "select * from order_details";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(qry);
while (rs.next()) {
productlist.add(rs.getString("userId"));
productlist.add(rs.getString("email"));
productlist.add(rs.getString("location"));
}
} catch (Exception e) {
e.getMessage();
}
return productlist;
}
public List<String> viewStore() {
return null;
}
}
| [
"m.narasimhareddy25@gmail.com"
] | m.narasimhareddy25@gmail.com |
6016d7234d07d1689a7f4c88f483dde382895822 | e5edd996546c9e666b5a65698eb04380caeb95de | /src/main/java/cz/cvut/fit/zum/data/StateSpace.java | 53ff3bf73cd5dc52f874c2ade9b726b79b5b60c5 | [] | no_license | tregoreg/zum-2014 | a866a2694086c66ce96eae1ea8f0739e3b4899d9 | 59a3fa9cdc35eb14f389762da9fbc5cd2c3f8306 | refs/heads/master | 2021-01-01T18:18:29.570899 | 2014-04-05T23:35:40 | 2014-04-05T23:35:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,828 | java | <<<<<<< HEAD
package cz.cvut.fit.zum.data;
import cz.cvut.fit.zum.api.Node;
import cz.cvut.fit.zum.gui.LoaderContext;
import java.util.ArrayList;
import java.util.List;
/**
* State space class providing access to all the Nodes and Edges present in
* the map.
*
* @author Tomas Barton
*/
public class StateSpace {
private static List<Node> nodes;
private static List<Edge> edges = new ArrayList<Edge>();
/**
* Sets the list of the map's nodes.
*
* @param n The list of nodes
*/
public static void setNodes(List<NodeImpl> n) {
NodeImpl.setContext(new LoaderContext());
CollectionTransformer transformer = new CollectionTransformer<NodeImpl, Node>() {
@Override
Node transform(NodeImpl e) {
return e;
}
};
nodes = transformer.transform(n);
updateEdges();
}
/**
* Iterates over the list of nodes and explores the neighborhood relations,
* creating a list of edges.
*/
private static void updateEdges() {
for (int n = 0; n < nodes.size(); n++) {
Node node = nodes.get(n);
List<Node> neighbours = node.expand();
for (int s = 0; s < neighbours.size(); s++) {
Edge edge = new Edge();
edge.setFromId(node.getId());
edge.setToId(neighbours.get(s).getId());
if (!edges.contains(edge)) {
edges.add(edge);
}
}
}
System.out.println("edges size: " + edges.size());
}
/**
* Gets the total number of edges on the map.
* @return The number of nodes
*/
public static int nodesCount() {
if (nodes != null) {
return nodes.size();
}
return 0;
}
/**
* Gets the total number of edges (roads) on the map.
* @return The number of edges
*/
public static int edgesCount() {
return edges.size();
}
/**
* Gets a reference to the list of all nodes.
* @return The list of all nodes
*/
public static List<Node> getNodes() {
return nodes;
}
/**
* Gets a reference to a list of all edges.
* @return The list of all edges
*/
public static List<Edge> getEdges() {
return edges;
}
/**
* Gets a node at given index, counting from 0 to |Nodes|-1
* @param idx Index of the node to be retrieved
* @return The Node object at the index given
*/
public static Node getNode(int idx) {
return nodes.get(idx);
}
/**
* Gets an edge at given index, counting from 0 to |Edges|-1
* @param idx Index of the edge to be retrieved
* @return The Edge object at the index given
*/
public static Edge getEdge(int idx) {
return edges.get(idx);
}
}
=======
package cz.cvut.fit.zum.data;
import cz.cvut.fit.zum.api.Node;
import cz.cvut.fit.zum.gui.LoaderContext;
import java.util.ArrayList;
import java.util.List;
/**
* State space class providing access to all the Nodes and Edges present in
* the map.
*
* @author Tomas Barton
*/
public class StateSpace {
private static List<Node> nodes;
private static List<Edge> edges = new ArrayList<Edge>();
/**
* Sets the list of the map's nodes.
*
* @param n The list of nodes
*/
public static void setNodes(List<NodeImpl> n) {
NodeImpl.setContext(new LoaderContext());
CollectionTransformer transformer = new CollectionTransformer<NodeImpl, Node>() {
@Override
Node transform(NodeImpl e) {
return e;
}
};
nodes = transformer.transform(n);
updateEdges();
}
/**
* Iterates over the list of nodes and explores the neighborhood relations,
* creating a list of edges.
*/
private static void updateEdges() {
for (int n = 0; n < nodes.size(); n++) {
Node node = nodes.get(n);
List<Node> neighbours = node.expand();
for (int s = 0; s < neighbours.size(); s++) {
Edge edge = new Edge();
edge.setFromId(node.getId());
edge.setToId(neighbours.get(s).getId());
if (!edges.contains(edge)) {
edges.add(edge);
}
}
}
System.out.println("edges size: " + edges.size());
}
/**
* Gets the total number of edges on the map.
* @return The number of nodes
*/
public static int nodesCount() {
if (nodes != null) {
return nodes.size();
}
return 0;
}
/**
* Gets the total number of edges (roads) on the map.
* @return The number of edges
*/
public static int edgesCount() {
return edges.size();
}
/**
* Gets a reference to the list of all nodes.
* @return The list of all nodes
*/
public static List<Node> getNodes() {
return nodes;
}
/**
* Gets a reference to a list of all edges.
* @return The list of all edges
*/
public static List<Edge> getEdges() {
return edges;
}
/**
* Gets a node at given index, counting from 0 to |Nodes|-1
* @param idx Index of the node to be retrieved
* @return The Node object at the index given
*/
public static Node getNode(int idx) {
return nodes.get(idx);
}
/**
* Gets an edge at given index, counting from 0 to |Edges|-1
* @param idx Index of the edge to be retrieved
* @return The Edge object at the index given
*/
public static Edge getEdge(int idx) {
return edges.get(idx);
}
}
>>>>>>> f74fa964b97379918a7c8cc7844b342a2cedab05
| [
"tomas.rehorek@fit.cvut.cz"
] | tomas.rehorek@fit.cvut.cz |
900146933b6938c761ccbc225b00fa302cb27812 | 30642413547d5f37bdd4b22a5db8d9bd82f20b79 | /src/lambda/LambdaWithMethodReferenceInt.java | 2fb81f271e0735cc560a869f46f4671aaab5c606 | [] | no_license | erdemcicek/winterjavaErdem | 0136f5582cb6beb285b50f9553e280b5ff586e7a | 00d8583e5a6147f82129db32bc187196aa8b3f06 | refs/heads/master | 2023-08-11T08:59:15.704623 | 2021-09-22T14:57:18 | 2021-09-22T14:57:18 | 367,855,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,867 | java | package lambda;
import java.util.ArrayList;
import java.util.List;
public class LambdaWithMethodReferenceInt {
public static void main(String[] args) {
List<Integer> l = new ArrayList<>();
l.add(12);
l.add(9);
l.add(13);
l.add(4);
l.add(9);
l.add(2);
l.add(4);
l.add(12);
l.add(7);
// printEvensFunctional(l);
// printOddsFunctional(l);
System.out.println(sumOfSquaresOfEvens(l));
System.out.println(productOfCubesOfOdds(l));
}
/*
1) Functional Programming
Create a method to print the even list elements on the console in
the same line with a space between
two consecutive elements.
*/
public static void printEvensFunctional(List<Integer> l) {
l.stream().filter(Utils::checkToBeEven).forEach(System.out::println);
}
/*
2) Functional Prog
Create a method to print the square of odd list elements on the console
in the same line with a space
between two consecutive elements.
*/
public static void printOddsFunctional(List<Integer> l) {
// l.stream().filter(Utils::checkToBeOdd).map(t->t*t).forEach(t->System.out.print(t + " "));
l.stream().filter(Utils::checkToBeEven).map(t->t*t).forEach(t->System.out.print(t + " "));
}
/*
5) Functional Programming
Create a method to calculate the sum of the square of even elements
*/
public static int sumOfSquaresOfEvens(List<Integer> l) {
int sum = l.stream().filter(Utils::checkToBeEven).distinct().map(Utils::findSquare).reduce(0, Math::addExact);
return sum;
}
/*
6) Functional Programming
Create a method to calculate the product of the cubes of distinct odd elements
*/
public static int productOfCubesOfOdds(List<Integer> l) {
int prod = l.stream().distinct().filter(Utils::checkToBeOdd).map(Utils::findCube).reduce(1, Math::multiplyExact);
return prod;
}
}
| [
"erdem25123@gmail"
] | erdem25123@gmail |
311ae7558107f5defa79cb665305d0f00101b8a9 | 8305a4b18fdd4aed6c055a9693fec884b3bf1b13 | /src/297D-052114/gruber/SwapLetters.java | c6e88bacfd60c3b1a69b00e85f34e7667bd6f7f7 | [] | no_license | mr-feek/412ProjectGrader | 81a7a07f1527f3a37209238a5172353f7b6ae66f | 9dbc44a9f32100f4408370d243c247c96b210eeb | refs/heads/master | 2021-05-30T20:09:11.856948 | 2016-02-09T06:14:04 | 2016-02-09T06:14:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 624 | java | public class SwapLetters
{
public static void main(String [] args)
{
int a = Integer.parseInt(args [0]);
String str1 = a + "";
char A = str1.charAt(0);
char position1 = str1.charAt(1);
char B = str1.charAt(2);
char C = str1.charAt(3);
char D = str1.charAt(4);
char E = str1.charAt(5);
char F = str1.charAt(6);
char position2 = str1.charAt(7);
char G = str1.charAt(8);
System.out.println("Original String: " + A + position1 + B + C + D + E + F + position2 + G + " New String : " + A + position2 + B + C + D + E + F + position1 + G);
}
}
| [
"fpm5022@gmail.com"
] | fpm5022@gmail.com |
fc6333c730e2d8c4cb8bfd6a317c7c9d14cf4220 | 2e73f3181a321a0ee40ac3a42e153f07ccdfe37a | /video-recommendation/src/main/java/com/verho/videorecommendation/repository/RecommendationRepository.java | 77fed771dd8a007f5ef8ef1e8075d26ac5d8098f | [] | no_license | VerhoczkiMarton/Netflix-- | 0f87ca8947120c9e1991153fd1347aa8601d6f4e | f85f588624c53f44c3ea2184803534fbf11dff40 | refs/heads/master | 2023-03-14T03:04:16.601506 | 2020-01-05T15:01:48 | 2020-01-05T15:01:48 | 231,732,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.verho.videorecommendation.repository;
import com.verho.videorecommendation.model.Recommendation;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface RecommendationRepository extends JpaRepository<Recommendation, Long> {
List<Recommendation> findAllByVideoId(Long id);
}
| [
"verhoczki.marci@gmail.com"
] | verhoczki.marci@gmail.com |
f884e85135dc8c5fd5bcec239ff39179ce874091 | 4a25bc8c13c57a21051cadcbbb6c172f91c76758 | /src/main/java/ru/filimonov/hotelbusinessdatagenerator/domain/BookingServiceId.java | 0b2c1e2617b562427cdee3c80aa98710cfbb6f6b | [] | no_license | BigArtemka/HotelBusinessDataGenerator | 302badac61a9b9df832b2e8f0687208a892af46b | 7c3114b597016ae2d8c1da6dcf9392cabd8fc4b2 | refs/heads/master | 2023-08-14T15:13:59.313429 | 2021-09-15T01:03:00 | 2021-09-15T01:03:00 | 404,397,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package ru.filimonov.hotelbusinessdatagenerator.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@NoArgsConstructor
@AllArgsConstructor
@Data
public class BookingServiceId implements Serializable {
private Integer booking;
private Integer service;
}
| [
"dak.112008@gmail.com"
] | dak.112008@gmail.com |
1361ddae588a0990a66ce05d5e786ee2b532df1a | 5bf08e29cb68b6e98be7416df5be771080936f95 | /src/main/java/com/example/samini/dto/LoginRequests.java | 6aa91160ba383919a71b052b07e4a3606646c798 | [] | no_license | GizachewB/samini | 187ec6e83e50c735fd5faf6408ab466751914504 | d13e0782561e969946b0868c4b54954c07832c72 | refs/heads/main | 2023-08-24T07:36:26.041514 | 2021-10-08T04:31:04 | 2021-10-08T04:31:04 | 414,844,445 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package com.example.samini.dto;
import lombok.Data;
import lombok.Getter;
@Data
@Getter
public class LoginRequests {
private String username;
private String password;
}
| [
"gizachew.berane@gmail.com"
] | gizachew.berane@gmail.com |
406da85d7c281511e4df15853779bbf7e2b51189 | 465c8edeb3b47ca79eef9c9c5a82992529ce25c0 | /test/com/nunsys/cursoPOO/classes/PricingServiceImplTest.java | 16f4f605cb27d537d8dc04e293a9c216b499adb4 | [] | no_license | napak/CursoPOO_Mocks | 5f812de89f7159459df597c68c3b2f9a542c71ba | 785324a663c7372cfdd17e03c38b08be859760b4 | refs/heads/master | 2021-01-11T00:13:52.114134 | 2016-10-10T11:07:43 | 2016-10-10T11:07:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,184 | java | package com.nunsys.cursoPOO.classes;
import com.nunsys.cursoPOO.exceptions.SkuNotFoundException;
import com.nunsys.cursoPOO.interfaces.DataAccess;
import com.nunsys.cursoPOO.interfaces.PricingService;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.verification.VerificationMode;
import java.math.BigDecimal;
import static org.junit.Assert.*;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
* Created by lorenzo.martinez on 10/10/2016.
*/
public class PricingServiceImplTest {
private static final String GOOD_SKU = "3283947";
private static final String BAD_SKU = "-9999993434";
private static final BigDecimal expectedPrice = new BigDecimal(100);
private PricingService pricingService;
@Mock
private DataAccess mockDataAccess;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
pricingService = new PricingServiceImpl();
pricingService.setDataAccess(mockDataAccess);
}
@Test
public void getPrice() throws SkuNotFoundException {
// Preparación
when(mockDataAccess.getPriceBySku(GOOD_SKU)).thenReturn(expectedPrice);
// Ejecución
final BigDecimal price = pricingService.getPrice(GOOD_SKU);
// Verificación
assertNotNull(price);
assertEquals(expectedPrice, price);
verify(mockDataAccess, times(1)).getPriceBySku(GOOD_SKU);
}
@Test(expected = SkuNotFoundException.class)
public void getPriceNonExistentSkuThrowsException() throws SkuNotFoundException {
when(mockDataAccess.getPriceBySku(BAD_SKU)).thenReturn(null);
final BigDecimal price = pricingService.getPrice(BAD_SKU);
}
@Test(expected = RuntimeException.class)
public void getPriceDataAccessThrowsRuntimeException() throws SkuNotFoundException {
when(mockDataAccess.getPriceBySku(GOOD_SKU)).thenThrow(new RuntimeException("Error crítico al acceder a datos."));
final BigDecimal price = pricingService.getPrice(GOOD_SKU);
}
} | [
"lorenzo.martinez@nunsys.com"
] | lorenzo.martinez@nunsys.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.