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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
33d50cc251247410250133682e35018a7ab52bc2 | 8534ea766585cfbd6986fd845e59a68877ecb15b | /com/google/android/gms/maps/internal/zzs.java | a8b859a93e17b5e4cc6fe49111a307345c68a9f2 | [] | no_license | Shanzid01/NanoTouch | d7af94f2de686f76c2934b9777a92b9949b48e10 | 6d51a44ff8f719f36b880dd8d1112b31ba75bfb4 | refs/heads/master | 2020-04-26T17:39:53.196133 | 2019-03-04T10:23:51 | 2019-03-04T10:23:51 | 173,720,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,972 | java | package com.google.android.gms.maps.internal;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import com.google.android.gms.maps.model.StreetViewPanoramaLocation;
public interface zzs extends IInterface {
public abstract class zza extends Binder implements zzs {
class zza implements zzs {
private IBinder zzle;
zza(IBinder iBinder) {
this.zzle = iBinder;
}
public IBinder asBinder() {
return this.zzle;
}
public void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation) {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.maps.internal.IOnStreetViewPanoramaChangeListener");
if (streetViewPanoramaLocation != null) {
obtain.writeInt(1);
streetViewPanoramaLocation.writeToParcel(obtain, 0);
} else {
obtain.writeInt(0);
}
this.zzle.transact(1, obtain, obtain2, 0);
obtain2.readException();
} finally {
obtain2.recycle();
obtain.recycle();
}
}
}
public zza() {
attachInterface(this, "com.google.android.gms.maps.internal.IOnStreetViewPanoramaChangeListener");
}
public static zzs zzbN(IBinder iBinder) {
if (iBinder == null) {
return null;
}
IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.maps.internal.IOnStreetViewPanoramaChangeListener");
return (queryLocalInterface == null || !(queryLocalInterface instanceof zzs)) ? new zza(iBinder) : (zzs) queryLocalInterface;
}
public IBinder asBinder() {
return this;
}
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) {
switch (i) {
case 1:
parcel.enforceInterface("com.google.android.gms.maps.internal.IOnStreetViewPanoramaChangeListener");
onStreetViewPanoramaChange(parcel.readInt() != 0 ? StreetViewPanoramaLocation.CREATOR.zzec(parcel) : null);
parcel2.writeNoException();
return true;
case 1598968902:
parcel2.writeString("com.google.android.gms.maps.internal.IOnStreetViewPanoramaChangeListener");
return true;
default:
return super.onTransact(i, parcel, parcel2, i2);
}
}
}
void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation);
}
| [
"shanzid.shaiham@gmail.com"
] | shanzid.shaiham@gmail.com |
363fc8809a322eaa8eb6088ace004424a97afe00 | 2d743972d47a780ff297c188dfef2c33e90b11f9 | /src/main/java/com/spring/hotel/service/AdminServiceImpl.java | 05088c1b392762100c28fd1823cffd3e43602e51 | [] | no_license | won-yeon/h-P.P | b7f81f0ed8ba596c186944de8904f498dbcaa7b6 | 09f4eb6e478ac98e43a8491e381b51ca9aef2f17 | refs/heads/master | 2022-12-23T20:22:43.998794 | 2021-03-03T12:41:07 | 2021-03-03T12:41:07 | 245,570,876 | 0 | 0 | null | 2022-12-16T15:26:17 | 2020-03-07T04:55:29 | Java | UTF-8 | Java | false | false | 4,676 | java | package com.spring.hotel.service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.inject.Inject;
import org.springframework.stereotype.Service;
import com.spring.hotel.dao.AdminDAO;
import com.spring.hotel.dto.AadminReservDTO;
import com.spring.hotel.dto.AdminMemberDTO;
import com.spring.hotel.dto.AdminParseDTO;
import com.spring.hotel.dto.ReservParseDTO;
import com.spring.hotel.vo.MemberVO;
import com.spring.hotel.vo.NonPayment;
import com.spring.hotel.vo.NonReservationVO;
import com.spring.hotel.vo.PaymentVO;
import com.spring.hotel.vo.QuestionVO;
import com.spring.hotel.vo.ReservationVO;
import com.spring.hotel.vo.RoomVO;
@Service
public class AdminServiceImpl implements AdminService {
@Inject
AdminDAO dao;
@Override
public List<MemberVO> memberList() {
List<MemberVO> list =dao.memberList();
return list;
}
@Override
public MemberVO memberOne(String userId) {
return dao.memberOne(userId);
}
@Override
public List<ReservationVO> reservList() {
return dao.reservList();
}
@Override
public List<ReservationVO> reservList(String userId) {
return dao.reservList(userId);
}
@Override
public ReservationVO reservDetail(int reservNo) {
return dao.reservDetail(reservNo);
}
@Override
public RoomVO findGT(int roomNo) {
return dao.findGT(roomNo);
}
@Override
public List<MemberVO> MemberSearch(AdminMemberDTO dto) {
return dao.MemberSearch(dto);
}
@Override
public AdminMemberDTO parse(AdminParseDTO dto2, AdminMemberDTO dto) throws Exception {
SimpleDateFormat Format = new SimpleDateFormat("yyyy-MM-dd");
if(dto2.getTphone2()!="") {
int phone2 = Integer.parseInt(dto2.getTphone2());
dto.setPhone2(phone2);
}
if(dto2.getTphone3()!="") {
int phone3 = Integer.parseInt(dto2.getTphone3());
dto.setPhone3(phone3);
}
if(dto2.getTregDateL()!="") {
Date regDateL = Format.parse(dto2.getTregDateL());
dto.setRegDateL(regDateL);
}
if(dto2.getTregDateS()!="") {
Date regDateS = Format.parse(dto2.getTregDateS());
dto.setRegDateS(regDateS);
}
return dto;
}
@Override
public List<ReservationVO> reservSearch(AadminReservDTO vo) {
return dao.reservSearch(vo);
}
@Override
public AadminReservDTO rparse(AadminReservDTO Rdto, ReservParseDTO dto) throws Exception {
SimpleDateFormat Format = new SimpleDateFormat("yyyy-MM-dd");
if(dto.getPreservNo()!="") {
int reservNo = Integer.parseInt(dto.getPreservNo());
Rdto.setReservNo(reservNo);
}
if(dto.getProomNo()!="") {
int proomNo = Integer.parseInt(dto.getProomNo());
Rdto.setRoomNo(proomNo);
}
if(dto.getPreservRegDate()!="") {
Date preservRegDate = Format.parse(dto.getPreservRegDate());
Rdto.setReservRegDate(preservRegDate);
}
if(dto.getPcheckInDate()!="") {
Date pcheckInDate = Format.parse(dto.getPcheckInDate());
Rdto.setCheckInDate(pcheckInDate);
}
if(dto.getPcheckOutDate()!="") {
Date pcheckOutDate = Format.parse(dto.getPcheckOutDate());
Rdto.setCheckOutDate(pcheckOutDate);
}
if(dto.getPisCancled()!="") {
int isCancled = Integer.parseInt(dto.getPisCancled());
Rdto.setIsCancled(isCancled);
}
return Rdto;
}
@Override
public List<QuestionVO> questionList() {
return dao.questionList();
}
@Override
public QuestionVO questionContent(String no) {
int questionNo = Integer.parseInt(no);
return dao.questionContent(questionNo);
}
@Override
public void replyInsert(QuestionVO vo) {
dao.replayInsert(vo);
dao.replayUpdate(vo);
}
@Override
public List<RoomVO> roomList() {
return dao.roomList();
}
@Override
public RoomVO roomDetail(int roomNO) {
return dao.roomDetail(roomNO);
}
@Override
public boolean updateState(RoomVO vo) {
if(dao.updateState(vo)==0) {
return false;
}else {
return true;
}
}
@Override
public void autoRoomState() {
dao.autoUpdateRev();
}
@Override
public ReservationVO roomReservDetail(int roomNO) {
return dao.selectRoomDetail(roomNO);
}
@Override
public void insertNonPay(NonPayment vo1) {
String cardNo="";
for(PaymentVO list : vo1.getPayList()) {
cardNo += list.getCardNo();
}
vo1.setCardNo(cardNo);
dao.insertNonPay(vo1);
}
@Override
public void insertNonRev(NonReservationVO vo2) {
dao.insertNonRev(vo2);
}
@Override
public NonReservationVO roomNonReserv(int roomNO) {
return dao.selectNonRserv(roomNO);
}
@Override
public void nonRevCheckOut(int no) {
dao.nonRevCheckOut(no);
}
@Override
public void reservCancle(int reservNo) {
dao.updateReservCancle(reservNo);
}
}
| [
"opkisq@gmail.com"
] | opkisq@gmail.com |
138fbbeb91d2b8151bb0cf2d74ddac0572422ff1 | 7eb71082bd72cf4c31fec8129d6d77ba60b884f0 | /Server/MovieSystem/src/main/java/com/example/demo/mapper/ScreeningroomMapper.java | a116a45e94f4ad20ffdd44baf5eeeae83ac59051 | [] | no_license | BobbyBBY/MovieSystem | 8b2a95fc2a59e15ea9541564fe0b5c244e730049 | 54a2a4a6ef4532034f443ab7848ead751ce8e1cb | refs/heads/master | 2022-07-24T22:34:06.643085 | 2020-06-14T08:48:23 | 2020-06-14T08:48:23 | 202,650,156 | 1 | 0 | null | 2020-06-15T21:56:21 | 2019-08-16T03:14:31 | Java | UTF-8 | Java | false | false | 205 | java | package com.example.demo.mapper;
import com.example.demo.pojo.Screeningroom;
public interface ScreeningroomMapper {
int insert(Screeningroom record);
int insertSelective(Screeningroom record);
} | [
"35885991+BobbyBBY@users.noreply.github.com"
] | 35885991+BobbyBBY@users.noreply.github.com |
cee1511ba363be3c3fdb2027e311d7a6a6a88a2d | 746c092eb7cf542afd2baf5e702e9631653a7337 | /src/main/java/de/inren/data/repositories/security/RightRepository.java | 34a3f1d3f5f344402f31eb9ced9c1d7e32118a1e | [] | no_license | inren/inren-elevation | 0818a39dda38c6513b87a351aa87966bb3f2465f | e03f1eb1ecc95550accb78db3b7af93bbaedbab6 | refs/heads/master | 2021-09-02T06:20:24.479587 | 2017-12-31T00:49:36 | 2017-12-31T00:49:36 | 115,550,028 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 947 | java | /**
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.inren.data.repositories.security;
import org.springframework.data.repository.PagingAndSortingRepository;
import de.inren.data.domain.security.Right;
/**
*
* @author Ingo Renner
*
*/
public interface RightRepository extends PagingAndSortingRepository<Right, Long> {
Right findRightByName(String name);
}
| [
"ingo.renner@bricket.org"
] | ingo.renner@bricket.org |
085e68b48d3669bf4addfef984ea5775d0ba0639 | f2bf3d19f727c50f685b6cb02eb5d459d5f564e4 | /src/com/udemy/balazsholczer/solid/liskov_substitution_principle/Vehicle.java | d956c715962e467010742b06b5e02abcd9da6bd1 | [] | no_license | nvankhoiws/DesignPatterns | 6b8c639bd3238fde9e12e8c16489911a6a9aedfa | 7e717e0113a21b5dc195a5dfd9a6b0d2073a9355 | refs/heads/master | 2021-08-28T06:14:19.261026 | 2017-12-11T11:02:18 | 2017-12-11T11:02:18 | 112,955,969 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package com.udemy.balazsholczer.solid.liskov_substitution_principle;
public interface Vehicle {
public void speed();
}
| [
"nvankhoiws@gmai.com"
] | nvankhoiws@gmai.com |
bc75373ca9e68bbd948f0d17cae9e06de9fa0932 | 3429a69e03c8f2b391d1fb9ac67bcdb46bab349e | /src/FECpacket.java | e814d3d635d72dd83b5ccc47b450bfbca08bcc6b | [] | no_license | sergei-gaponik/it2 | aa8fbbdfb0873b2634c67f1f950037c6d61f220a | cac99970f0d52318de2347f9341117f2bd0fc37d | refs/heads/main | 2023-02-13T09:08:34.913066 | 2021-01-17T15:31:05 | 2021-01-17T15:31:05 | 326,785,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,983 | java | /*
Information according to RFC 5109
Implementation: http://apidocs.jitsi.org/libjitsi/
FEC Packet Structure
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RTP Header (12 octets or more) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FEC Header (10 octets) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FEC Level 0 Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FEC Level 0 Payload |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FEC Level 1 Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| FEC Level 1 Payload |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cont. |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
FEC Header
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|E|L|P|X| CC |M| PT recovery | SN base |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TS recovery |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| length recovery |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
ULP Level Header
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Protection Length | mask |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| mask cont. (present only when L = 1) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
/**
* @author Jörg Vogt
* @version 1.0
*/
import java.util.ArrayList;
public class FECpacket extends RTPpacket {
private static final int FEC_HEADER_SIZE = 10;
private static final int ULP_HEADER_SIZE0 = 4;
private static final int ULP_HEADER_SIZE1 = 8;
int headerAll;
int payloadFec_size;
// *** FEC-Header *************************
byte[] fecHeader = new byte[FEC_HEADER_SIZE];
int E = 0;
int L;
// XOR fields set to initial zero
int P = 0;
int X = 0;
int CC = 0;
int M = 0;
int ptRecovery = 0;
int snBase;
int tsRecovery = 0;
int lengthRecovery = 0;
// *** ULP Level Header ********************
byte[] ulpLevelHeader;
int protectionLength;
long mask;
// *** FEC Parameters **********************
int fecGroupSize; // FEC-Gruppengröße
// ##############################################################################################
/**
* Construct FEC packet from parameters
* @param PType Payload Type
* @param Framenb Sequence Nr
* @param Time Time Stamp
* @param maxGroupSize maximum supported group size
* @param snBase base for sequence nr.
*/
public FECpacket(int PType, int Framenb, int Time, int maxGroupSize, int snBase) {
super(PType, Framenb, Time, new byte[0], 0);
setFecHeader(maxGroupSize, snBase);
setUlpLevelHeader(0,0,maxGroupSize);
}
// ##############################################################################################
/**
* Constructor for Receiver
*
* @param packet bitstream
* @param packet_size size
*/
public FECpacket(byte[] packet, int packet_size) {
// packet includes FEC header
// builds the RTP header
super(packet, packet_size);
extractFecHeader(); // sets the header arrays and the variables
// removes the fec-header from the payload
byte[] buf = new byte[payload.length- FEC_HEADER_SIZE - ulpLevelHeader.length];
System.arraycopy(payload,FEC_HEADER_SIZE+ulpLevelHeader.length,
buf, 0, payload.length-FEC_HEADER_SIZE-ulpLevelHeader.length);
payload = buf;
}
// ##############################################################################################
/**
* Sets the FEC-Header-variables and generates the Header-Array
*
* @param maxGroupSize to generate al short or long mask for ULP
* @param ptRec PayloadType
* @param snBase SN
* @param tsRec Timestamp
* @param lengthRec Length
*/
public void setFecHeader(int maxGroupSize, int ptRec, int snBase, int tsRec, int lengthRec) {
ptRecovery = ptRec;
tsRecovery = tsRec;
lengthRecovery = lengthRec;
setFecHeader(maxGroupSize, snBase);
}
private void setFecHeader(int maxGroupSize, int snBase) {
this.snBase = snBase;
L = maxGroupSize > 16 ? 1 : 0;
setFecHeader();
}
private void setFecHeader() {
// FEC-Header
// P,X,CC,M,PT, TS is XORed
fecHeader[0] = (byte) (E << 7 | L << 6);
fecHeader[1] = (byte) (M<< 7 | ptRecovery);
fecHeader[2] = (byte) (snBase >> 8);
fecHeader[3] = (byte) (0xFF & snBase);
fecHeader[4] = (byte) (tsRecovery >> 24);
fecHeader[5] = (byte) (tsRecovery >> 16);
fecHeader[6] = (byte) (tsRecovery >> 8);
fecHeader[7] = (byte) (tsRecovery);
fecHeader[8] = (byte) (lengthRecovery >> 8);
fecHeader[9] = (byte) (0xFF & lengthRecovery);
}
/**
* Sets the ULP-Variables and generates the Header
*
* @param level always 0
* @param protectionLength set to max Length
* @param fecGroupSize corresponding packets
*/
public void setUlpLevelHeader(int level, int protectionLength, int fecGroupSize) {
// Level is always 0
this.protectionLength = protectionLength;
this.fecGroupSize = fecGroupSize;
// generate mask, MSB corresponds to i=0
mask = 0x8000000000000000L;
for (int i = 1; i < fecGroupSize; i++) {
mask = 0x8000000000000000L | (mask >> 1);
}
if (L == 0) {
ulpLevelHeader = new byte[ULP_HEADER_SIZE0];
} else {
ulpLevelHeader = new byte[ULP_HEADER_SIZE1];
}
// FEC-Level-Header
ulpLevelHeader[0] = (byte) (protectionLength >> 8);
ulpLevelHeader[1] = (byte) (0xFF & protectionLength);
ulpLevelHeader[2] = (byte) (mask >> 56);
ulpLevelHeader[3] = (byte) (mask >> 48);
if (L == 1) {
ulpLevelHeader[4] = (byte) (mask >> 40);
ulpLevelHeader[5] = (byte) (mask >> 32);
ulpLevelHeader[6] = (byte) (mask >> 24);
ulpLevelHeader[7] = (byte) (mask >> 16);
}
headerAll = HEADER_SIZE + FEC_HEADER_SIZE + ulpLevelHeader.length;
payloadFec_size = payload_size - FEC_HEADER_SIZE - ulpLevelHeader.length;
}
/**
* Generates a list of involved RTP packets, starting with snBase
* @return list of sequence numbers
*/
public ArrayList<Integer> getRtpList() {
// determine the involved media packets (base address + mask)
System.out.println("snBase: ");
System.out.println(snBase);
ArrayList<Integer> list = new ArrayList<>();
//System.out.println("FEC: base + mask " + snBase + " " + Long.toHexString(mask) );
// generates involved packet numbers from mask
System.out.println("mask " + mask);
for (int i = 0; i < 48; i++) {
if ( (mask & 0x8000000000000000L) != 0 ) {
list.add(snBase + i);
System.out.println("test");
}
mask = mask << 1;
}
return list;
}
/**
* Gets the whole FEC packet including RTP header as array
*
* @return the bitstream
*/
@Override
public byte[] getpacket() {
System.out.println("FEC packet: " + payload_size + " " + payload.length);
byte[] packet = new byte[payload_size + headerAll];
setRtpHeader(); // set RTP Header again because of changing time stamp
// RTP Header from array
System.arraycopy(header, 0, packet, 0, HEADER_SIZE);
// FEC Header from array
System.arraycopy(fecHeader, 0, packet, HEADER_SIZE, FEC_HEADER_SIZE);
// ULP Header from array
System.arraycopy(
ulpLevelHeader, 0, packet, HEADER_SIZE + FEC_HEADER_SIZE, ulpLevelHeader.length);
// Payload starts from 0
System.arraycopy(
payload, 0, packet, headerAll, payload_size);
return packet;
}
// ##############################################################################################
// Java Unsigned Bytes
// https://sites.google.com/site/gencoreoperative/index/java-development/java-unsigned-bytes
/** retrieves the FEC-header from the RTP payload
* data is received from RTP packet payload
*
*/
private void extractFecHeader() {
// byte[] payload = fec.getpayload();
// copy the FEC Header als part of the RTP payload
System.arraycopy(payload, 0, fecHeader, 0, FEC_HEADER_SIZE);
L = (fecHeader[0] & 0b01000000) >> 6;
// ignore P,X,CC,M yet
ptRecovery = 0x7F & fecHeader[1];
snBase = (0xFF & fecHeader[2]) * 256 + (0xFF & fecHeader[3]);
// TODO check if correct
tsRecovery =
(0xFFFFFF & fecHeader[4]) * 0xFFFF
+ (0xFF & fecHeader[5])
+ (0xFF & fecHeader[6]) * 256
+ (0xFF & fecHeader[7]);
lengthRecovery = (0xFF & fecHeader[8]) * 256 + (0xFF & fecHeader[9]);
// ULP Level Header
if (L == 0) ulpLevelHeader = new byte[ULP_HEADER_SIZE0];
else ulpLevelHeader = new byte[ULP_HEADER_SIZE1];
// copy the ULP header
System.arraycopy(payload, FEC_HEADER_SIZE, ulpLevelHeader, 0, ulpLevelHeader.length);
protectionLength = (0xFF & ulpLevelHeader[0]) * 256 + (0xFF & ulpLevelHeader[1]);
// Small mask
mask = ((0xFFL & ulpLevelHeader[2]) << 56) + ((0xFFL & ulpLevelHeader[3]) << 48);
// System.out.println("FEC mask: " + ulpLevelHeader[2] + " " + ulpLevelHeader[3] + " " +
// Long.toHexString(mask));
// Large mask
if (L == 1) {
mask |=
((0xFFL & ulpLevelHeader[4]) << 40)
+ ((0xFFL & ulpLevelHeader[5]) << 32)
+ ((0xFFL & ulpLevelHeader[6]) << 24)
+ ((0xFFL & ulpLevelHeader[7]) << 16);
}
}
// ###############################################################################################
/**
* Adds a RTP packet to the header and payload
* Length adjusts to the longest packet
* For sender and receiver
*
* @param rtp RTP packet
*/
public void addRtp(RTPpacket rtp) {
// sets the payload
byte[] data = rtp.getpayload();
// XOR actual data size
lengthRecovery ^= data.length;
// init of buffer and length recovery
if (payload.length == 0) {
payload = data;
} else {
// switch array so that payload is longest of all packets
if (data.length > payload.length) {
byte[] buf = data;
data = payload;
payload = buf;
}
for (int i = 0; i < data.length; i++) {
payload[i] ^= data[i];
}
}
payload_size = payload.length;
// Header XOR -> P, X, CC, M, PT, TS
P ^= rtp.Padding;
X ^= rtp.Extension;
CC ^= rtp.CC;
M ^= rtp.Marker;
ptRecovery ^= rtp.getpayloadtype();
tsRecovery ^= rtp.gettimestamp();
int newProtectionLength = Math.max(protectionLength, data.length);
setUlpLevelHeader(0, newProtectionLength ,fecGroupSize);
setFecHeader(); // update Header with changed variables
}
/**
* Generates the lost RTP packet from the XORed values
* @return rtp
*/
public RTPpacket getLostRtp(int snr) {
// TODO get the correct SNr
System.out.println("getLostRtp");
System.out.println("snr " + snr + " base " + snBase);
return new RTPpacket(ptRecovery, snr - snBase, tsRecovery, payload, lengthRecovery);
}
// *************** Debugging *******************************************************************
private String bytesToHex(byte[] bytes) {
char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = HEX_ARRAY[v >>> 4];
hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
}
return new String(hexChars);
}
/**
* Prints the FEC- and ULP-Header fields
*/
public void printHeaders() {
System.out.println("FEC-Header");
printheader(FEC_HEADER_SIZE, fecHeader);
System.out.println("FEC-Level-Header");
printheader(ulpLevelHeader.length, ulpLevelHeader);
System.out.println("FEC-Payload");
String hexString = bytesToHex(payload);
System.out.println("..." + hexString.substring(hexString.length() - 32));
}
} | [
"sergei.gaponik@gmail.com"
] | sergei.gaponik@gmail.com |
b28d9c7dd377178cc4150d86a50fa3eea9ddd692 | 7abeaef0fc888e357c0a6d322513ae65f3fa5a00 | /src/if1/pkg10119015/latihan33/userlogin/IF110119015Latihan33UserLogin.java | d4a41a3cbed169f072accee075e7cc7b4aa25502 | [] | no_license | AgiSutrisna/IF1-10119015-Latihan33-UserLogin | f44c4d2973a7486e7d118c6d8e1660d04087d939 | 17d144f332fa3f19a1c19ac4260981544073f7a6 | refs/heads/master | 2023-01-04T01:38:36.569029 | 2020-11-07T13:47:19 | 2020-11-07T13:47:19 | 310,854,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | 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 if1.pkg10119015.latihan33.userlogin;
import java.util.Scanner;
/**
*
* @author Agy
* NAMA : Agi Sutrisna
* KELAS : IF-1
* NIM : 10119015
*/
public class IF110119015Latihan33UserLogin {
/**
* @param args the command line arguments
*/
public static String usName, passWord;
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Masukkan Username = ");
usName = input.next();
System.out.print("Masukkan Password = ");
passWord = input.next();
User user = new User();
user.pengecekkanLogin(usName, passWord);
}
}
| [
"Agy@LAPTOP-9KM93J6F"
] | Agy@LAPTOP-9KM93J6F |
646a3f85c2998ce8b4c6badf4fb6dd7c00224e2a | 91c1ef261414bf38a488a9fc5bc84fb9d4376bfa | /PlayersApp/src/java/controller/SearchServelet.java | c2714e0b0563df398ec584fc2971d726f08b9d39 | [] | no_license | athierjung/HW7 | 59b12ad7392bfb0f6929e6a123848f7a0325e3b0 | 78ccb3a2d53afc4b0377441322fad3d07cc90505 | refs/heads/master | 2016-08-12T02:42:14.231226 | 2015-11-17T00:07:27 | 2015-11-17T00:07:27 | 45,558,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,030 | 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 controller;
import dbHelpers.SearchQuery;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author athierjung
*/
@WebServlet(name = "SearchServelet", urlPatterns = {"/search"})
public class SearchServelet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet SearchServelet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet SearchServelet at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//get the text to search
String playerName = request.getParameter("searchVal");
//create a SearchQuery helper object
SearchQuery sq = new SearchQuery();
try {
//Get the HTML table from the SearchQuery Object
sq.doSearch(playerName);
} catch (SQLException ex) {
Logger.getLogger(SearchServelet.class.getName()).log(Level.SEVERE, null, ex);
}
String table = sq.getHTMLTable();
//pass execution control to read.jsp along with the table
request.setAttribute("table", table);
String url = "/read.jsp";
RequestDispatcher dispatcher = request.getRequestDispatcher(url);
dispatcher.forward(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"axthierjung@gmail.com"
] | axthierjung@gmail.com |
40fa6757e29b364e28833b22dafe488354dbf5e5 | e941aff9aa1501a8b75df214bcfc1e237c9b45c2 | /app/src/main/java/com/cs465/team_award/accessiblesidewalks/CustomInfoWindow.java | d864d0c1300cc18e64bdb1de3eebc04ab1450d35 | [] | no_license | rshah98626/Accesible-Sidewalks | f7c5e820282693e8aa462ded8479a037fb8bcf12 | 5e28deec414f62e38a2c583d0617edf77d20e248 | refs/heads/master | 2020-04-02T15:28:36.559425 | 2018-12-08T00:07:11 | 2018-12-08T00:07:11 | 154,568,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,737 | java | package com.cs465.team_award.accessiblesidewalks;
/**
* Created by bella on 11/27/2018.
*/
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Marker;
public class CustomInfoWindow implements GoogleMap.InfoWindowAdapter {
private Context context;
public CustomInfoWindow(Context ctx){
context = ctx;
}
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
View view = ((Activity)context).getLayoutInflater()
.inflate(R.layout.fragment_obstacle_info, null);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
TextView description = view.findViewById(R.id.description);
TextView type = view.findViewById(R.id.type);
final Button myButton = view.findViewById(R.id.reportButton);
type.setText(marker.getTitle());
description.setText(marker.getSnippet());
CharSequence text = "Report Received!";
int duration = Toast.LENGTH_SHORT;
final Toast toast = Toast.makeText(context, text, duration);
myButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
myButton.setText("Thank you");
// Code here executes on main thread after user presses button
}
});
return view;
}
} | [
"hinohoshi04@gmail.com"
] | hinohoshi04@gmail.com |
1c2d202428c7ef2747095b9d51643d1d41762fd9 | 3580b4d5c33501f7b87471576f238e80368a3eeb | /Client/src/main/java/com/boot/pp25/controller/AdminController.java | c4bde046b4602752df65fb5394359123e6b8a66d | [] | no_license | ScriptingGuyRU/PP_3.1.4 | 186972190ed36b63a2cb70dbe4a259f049ebcdd7 | 98c7a0f56b9c5d6bd073d1d2e626a7fe0d7f8e15 | refs/heads/master | 2022-12-02T13:02:06.257984 | 2020-05-19T13:09:57 | 2020-05-19T13:09:57 | 264,716,109 | 0 | 0 | null | 2022-11-16T01:26:31 | 2020-05-17T17:03:17 | Java | UTF-8 | Java | false | false | 1,350 | java | package com.boot.pp25.controller;
import com.boot.pp25.model.Role;
import com.boot.pp25.model.User;
import com.boot.pp25.service.abstractServ.RoleServices;
import com.boot.pp25.service.abstractServ.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@Controller
@RequestMapping("/admin")
public class AdminController {
@GetMapping
public ModelAndView mainAdminControllerGet(Authentication auth) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("authUser", auth.getPrincipal());
modelAndView.addObject("userEmail", ((User) auth.getPrincipal()).getEmail());
modelAndView.addObject("rolesAuth", ((User) auth.getPrincipal()).getRoles()
.stream().map(Objects::toString).collect(Collectors.joining(" ")));
modelAndView.setViewName("adminsPages/admin");
return modelAndView;
}
}
| [
"59977339+ScriptingGuy1@users.noreply.github.com"
] | 59977339+ScriptingGuy1@users.noreply.github.com |
ec490b0a510d0409578eef78f6d705b6df4778ad | 2cf8124f688688e9ada9b502b50bd4b598e2e39a | /thread-chapter02/src/main/java/com/xingleng/thread/chapter02/model/Father.java | 3265a95b784b980e94c9104b7a1616d25f9aedb1 | [] | no_license | MichaelDiane/Thread-Demo | fffe618e251401813ecbbb31a7e22f7688a70368 | 8e4f6c3781936be2457aba4dd32d8c189b6f7fa7 | refs/heads/master | 2020-05-17T23:20:08.778113 | 2019-04-29T08:22:04 | 2019-04-29T08:22:04 | 184,028,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.xingleng.thread.chapter02.model;
/**@author Michael.Zhang
* @Date Apr 25, 2019
* @Desc 演示线程的 重入锁 例子
**/
public class Father {
public int i= 10;
synchronized public void operateFatherMethod() {
try {
i--;
System.out.println(" father print i="+i);
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
| [
"394101728@qq.com"
] | 394101728@qq.com |
2c00d7fea42a847ed16b1864603b1ceebf4c9a0d | e47a0eb0028c6135dae0d08386652ba4884d1922 | /Android Apps/Gps_trck_child/src/com/project/gps_trck_child/GPS_coordinate_send.java | 521e7deff844f3ea4b2419719bb69f53e6e52b4c | [] | no_license | cyberintruder/GPS-for-personal-security-and-tracking_2012-13 | 93b36937911d0c591d33f311a556e1555eb34742 | 64ac92277bddc3818402d644cd7b8798b35b820e | refs/heads/master | 2021-01-21T03:08:46.623073 | 2015-01-20T13:02:52 | 2015-01-20T13:02:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,274 | java | package com.project.gps_trck_child;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;
public class GPS_coordinate_send extends Activity {
public double latitude ;
public double longitude ;
public String latitude1;
public String longitude1;
// Creating HTTP client
HttpClient httpClient = new DefaultHttpClient();
// Creating HTTP Post
HttpPost httpPost = new HttpPost("http://192.168.1.5/test2.php");
//private final static int DELAYED_ACTION_TIMEOUT = 10000;
//private Handler mRepetitiveTimeoutHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gps_coordinate_send);
Intent call_GPS_CoFetch=new Intent(this,GPS_tracking_activity.class);
startActivityForResult(call_GPS_CoFetch,0);
//////////////////////////////////////////////
/*
mRepetitiveTimeoutHandler = new Handler();
mRepetitiveTimeoutHandler.postDelayed(processWatchTimer, DELAYED_ACTION_TIMEOUT);
}
private Runnable processWatchTimer = new Runnable()
{
public void run()
{
mRepetitiveTimeoutHandler.removeCallbacks(processWatchTimer);
//Put your action here.
}
};
*/
/*startActivityForResult(call_GPS_CoFetch,0);
* TimerTask tasknew = new TimerScheduleFixedRateDelay();
Timer timer = new Timer();
// scheduling the task at fixed rate delay
timer.scheduleAtFixedRate(tasknew,500,1000);
}
// this method performs the task
public void run() {
System.out.println("working at fixed rate delay");
}
* */
////////////////////////////////////////////////
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.gps_coordinate_send, menu);
return true;
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch(requestCode){
case 0:
{
if (resultCode == RESULT_OK) {
latitude=intent.getDoubleExtra("latitude",latitude);
longitude=intent.getDoubleExtra("longitude",longitude);
// Toast.makeText(getApplicationContext(), " Your Location is - \nLat: " + latitude + "\nLong: " + longitude+"\nQR code--"+QR, Toast.LENGTH_SHORT).show();
// playAlertTone(getApplicationContext());
//////////////////////////////////////////////////////
latitude1=String.valueOf(latitude);
longitude1=String.valueOf(longitude);
///////////////////////////////////////////////////////////////
// Create a new HttpClient and Post Header
TelephonyManager tManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
String device_id = tManager.getDeviceId();
// Building post parameters
// key and value pair
List<NameValuePair> nameValuePair = new ArrayList<NameValuePair>(3);
nameValuePair.add(new BasicNameValuePair("latitude",latitude1));
nameValuePair.add(new BasicNameValuePair("longitude", longitude1));
nameValuePair.add(new BasicNameValuePair("device_id",device_id));
nameValuePair.add(new BasicNameValuePair("QR", ""));
// Url Encoding the POST parameters
try {
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair));
} catch (UnsupportedEncodingException e) {
// writing error to Log
e.printStackTrace();
}
// Making HTTP Request
try {
HttpResponse response = httpClient.execute(httpPost);
// writing response to log
Log.d("Http Response:", response.toString());
} catch (ClientProtocolException e) {
// writing exception to log
// e.printStackTrace();
} catch (IOException e) {
// writing exception to log
// e.printStackTrace();
}
}
Toast.makeText(getApplicationContext(), "ChildACt send", Toast.LENGTH_SHORT).show();
break;
}
}
}
}
| [
"ssj8127@g.rit.edu"
] | ssj8127@g.rit.edu |
ba293a7ed7223150f7a486c8e7f56ee68188e7d8 | 23d61f8027f41d800452a1d394d663d839580f7e | /src/main/java/com/huayun/user/dao/FavorDao.java | f0f80b0c86c70dcdfcdeda066c0306d1bc99b10d | [] | no_license | liuhaoyi/content-service | c98844757b9b01c44ab9893d0adb2a516987965e | 5100051232ef912f44fe493f064c63fea38df3b5 | refs/heads/master | 2020-04-06T10:52:58.099822 | 2018-11-27T12:36:46 | 2018-11-27T12:36:46 | 157,395,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package com.huayun.user.dao;
import com.huayun.user.domain.Article_;
import com.huayun.user.domain.Favor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
public interface FavorDao extends JpaRepository<Favor,String> {
@Transactional
void deleteFavorByUserIdAndArticleId(String userId,String articleId);
//查询该用户是否收藏该文章;
Favor queryFirstByUserIdAndArticleId(String userId,String articleId);
@Query("select new com.huayun.user.domain.Article_(art.id,art.title,art.img,favor.modifyDatetime) from Article art,Favor favor where art.id= favor.articleId and favor.userId=:userId order by favor.modifyDatetime desc")
List<Article_> queryFavorList(@Param("userId") String userId);
}
| [
"25436136@qq.com"
] | 25436136@qq.com |
957b7f2e36eb6f36488bc86b44596dfff037b1b6 | 18cfc693d57b2401d3b82e818c70099dbd5dfaa7 | /src/com/dsl/storage/categorize/constants/Category.java | 9b4639507f5a7371c31999a4f2237802f7ceca17 | [] | no_license | dslsyeoh/storage-categorize-concept | b92464c481e7798ad3d2269036e4961512d91ae3 | cff9169a2c3f87767e852826b5aef1dbdcb80baf | refs/heads/master | 2020-08-07T12:48:43.134102 | 2019-10-08T14:50:57 | 2019-10-08T14:50:57 | 213,457,052 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | /*
* Author Steven Yeoh
* Copyright (c) 2019. All rights reserved.
*/
package com.dsl.storage.categorize.constants;
public enum Category
{
CATEGORY_1,
CATEGORY_2,
CATEGORY_3
}
| [
"syeoh91x@gmail.com"
] | syeoh91x@gmail.com |
1d406f6710486c76a010343f346fe12d9aa29667 | 9d3eaffc0ae4a9dc7a6379611b2268b1af636265 | /app/src/main/java/edu/cftic/fichapp/dao/EmpresaDao.java | a9c74f3a24ffe0b1f67f89a3ec07b2372a975123 | [] | no_license | JuanLPerea/FICHApp | ae5f25a8e6b3741d84bd42ebd3d583c51335829f | 66d615d2a78aa941f88bff74934d507f79bf225f | refs/heads/master | 2020-05-31T08:10:46.791635 | 2019-06-14T07:57:20 | 2019-06-14T07:57:20 | 190,181,674 | 0 | 0 | null | 2019-06-04T10:41:03 | 2019-06-04T10:41:03 | null | UTF-8 | Java | false | false | 5,416 | java | package edu.cftic.fichapp.dao;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteConstraintException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import com.example.appk.i_esquema.IEmpresaEsquema;
import java.util.ArrayList;
import java.util.List;
import edu.cftic.fichapp.beans.Empresa;
import edu.cftic.fichapp.i_dao.IEmpresaDao;
public class EmpresaDao extends CRUD implements IEmpresaEsquema, IEmpresaDao {
private Cursor cursor;
private ContentValues valoresIniciales;
public EmpresaDao(SQLiteDatabase bd) {
super(bd);
}
@Override
public Empresa getEmpresaId(int id_empresa) {
final String argumentos[] = { String.valueOf(id_empresa)};
final String seleccion = C_COL_ID_EMPRESA + " = ?";
Empresa e = new Empresa();
cursor = super.query(C_TABLA, C_COLUMNAS, seleccion, argumentos);
if(cursor != null){
cursor.moveToFirst();
while (!cursor.isAfterLast()){
e = cursorATabla(cursor);
cursor.moveToNext();
}
cursor.close();
}
return e;
}
@Override
public List<Empresa> getEmpresas() {
List<Empresa> empresaLista = new ArrayList<Empresa>();
cursor = super.query(C_TABLA, C_COLUMNAS, null, null);
if(cursor != null){
cursor.moveToFirst();
while (!cursor.isAfterLast()){
Empresa e = cursorATabla(cursor);
empresaLista.add(e);
cursor.moveToNext();
}
}
cursor.close();
return empresaLista;
}
@Override
public Empresa primero() {
Empresa e = null;
String LIMITE = "1";
cursor = super.query(C_TABLA, C_COLUMNAS, null, null, C_COL_ID_EMPRESA, LIMITE);
if(cursor != null){
cursor.moveToFirst();
e = cursorATabla(cursor);
}
cursor.close();
return e;
}
@Override
public Empresa ultimo() {
Empresa e = null;
String LIMITE = "1";
cursor = super.query(C_TABLA, C_COLUMNAS, null, null, C_COL_ID_EMPRESA + " DESC ", LIMITE);
if(cursor != null){
cursor.moveToFirst();
e = cursorATabla(cursor);
}
cursor.close();
return e;
}
@Override
public boolean nuevo(Empresa e) {
setRegistro(e);
try {
return super.insert(C_TABLA, getRegistro()) > 0;
} catch ( SQLiteConstraintException ex) {
Log.i("APPK", "Empresa nuevo DAO: "+ ex.getMessage());
return false;
}
}
@Override
public boolean eliminar(int id_empresa) {
final String argumentos[] = { String.valueOf(id_empresa) };
final String seleccion = C_COL_ID_EMPRESA + " = ?";
try {
return super.delete(C_TABLA, seleccion, argumentos) > 0;
} catch (SQLiteConstraintException ex) {
Log.i("APPK", "Empresa eliminar DAO: "+ ex.getMessage());
return false;
}
}
@Override
public boolean actualizar(Empresa e) {
setRegistro(e);
final String argumentos[] = { String.valueOf(e.getId_empresa()) };
final String seleccion = C_COL_ID_EMPRESA + " = ?";
try {
return super.update(C_TABLA, getRegistro(), seleccion, argumentos) > 0;
} catch ( SQLiteConstraintException ex) {
Log.i("APPK", "Empresa actualizar DAO: "+ ex.getMessage());
return false;
}
}
@Override
protected Empresa cursorATabla(Cursor cursor) {
Empresa e = new Empresa();
int id_empresaIndex;
int cifIndex;
int nombreIndex;
int responsableIndex;
int emailIndex;
if(cursor.getColumnIndex(C_COL_ID_EMPRESA) != -1){
id_empresaIndex = cursor.getColumnIndexOrThrow(C_COL_ID_EMPRESA);
e.setId_empresa( cursor.getInt(id_empresaIndex));
}
if(cursor.getColumnIndex(C_COL_CIF) != -1){
cifIndex = cursor.getColumnIndexOrThrow(C_COL_CIF);
e.setCif( cursor.getString(cifIndex));
}
if(cursor.getColumnIndex(C_COL_NOMBRE) != -1){
nombreIndex = cursor.getColumnIndexOrThrow(C_COL_NOMBRE);
e.setNombre_empresa( cursor.getString(nombreIndex));
}
if(cursor.getColumnIndex(C_COL_RESPONSABLE) != -1){
responsableIndex = cursor.getColumnIndexOrThrow(C_COL_RESPONSABLE);
e.setResponsable( cursor.getString(responsableIndex));
}
if(cursor.getColumnIndex(C_COL_EMAIL) != -1){
emailIndex = cursor.getColumnIndexOrThrow(C_COL_EMAIL);
e.setEmail( cursor.getString(emailIndex));
}
return e;
}
private void setRegistro(Empresa e){
valoresIniciales = new ContentValues();
// valoresIniciales.put(C_COL_ID_EMPRESA, e.getId_empresa()); // Activar si el campo No es Autoincremental
valoresIniciales.put(C_COL_CIF, e.getCif());
valoresIniciales.put(C_COL_NOMBRE, e.getNombre_empresa());
valoresIniciales.put(C_COL_RESPONSABLE, e.getResponsable());
valoresIniciales.put(C_COL_EMAIL, e.getEmail());
}
private ContentValues getRegistro(){
return valoresIniciales;
}
}
| [
"juanluperea@hotmail.com"
] | juanluperea@hotmail.com |
2b5908321fb8f17725d10dc566fe777d001bb99a | 3addd799bbbc0c612b1975484f7a2ee2ea3f1efb | /src/main/java/com/ferret/bean/SubImageInfo.java | 2e60cb0a9a592bb6950ffef9031e6bd7ba8919cf | [] | no_license | yinshuaibin/weby2 | 5d27e08b6da85fcbac1a3f70210cb31584cd3378 | dfe674433a177fa89b3ea76225fd13dd45b9bf89 | refs/heads/master | 2020-04-22T10:01:24.153769 | 2019-02-13T01:31:50 | 2019-02-13T01:31:50 | 170,291,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package com.ferret.bean;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@Data
public class SubImageInfo {
@JsonProperty("SubImageInfoObject")
private List<SubImageInfoObject> subImageInfoObject;
}
| [
"805346635@qq.com"
] | 805346635@qq.com |
44d0c4cb39eeaf16ccb73cc2cadd820156154f5b | 04ab15ce619fd2238e100716d1b550945b31c997 | /Practice/src/Practice/Q4.java | ebf7815653983112527cc0b23f2259bab3434940 | [] | no_license | Minerva-Shrivastava/My-java-Practice | 9d7c58c482d7459246325dc218f63eef8a5d4cfa | 4d5466c1727cc226d4a243475c67a9e41ea54d4d | refs/heads/master | 2021-05-06T11:48:22.078973 | 2018-04-26T08:49:39 | 2018-04-26T08:49:39 | 114,281,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package Practice;
import java.util.Scanner;
public class Q4 {
public static void main(String[] args) {
System.out.println("\nEnter a no:");
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int count = 0;
for(int i=1;i<=n;i++)
{
for(int j=1; j<=i ; j++)
{
count++;
if(count%2==0)
{
System.out.print("1\t");
}
else
{
System.out.print("0\t");
}
}
System.out.println();
}
}
}
| [
"minerva.shrivastava@gmail.com"
] | minerva.shrivastava@gmail.com |
1495e3ea9a616fdb2e3ef51889b07180d9a0cff3 | 900ff6c3247e13f864d959de43f67c030923f47a | /spring_project_fn/src/main/java/com/example/demo/controller/LoginController.java | 186f41a6ec7845be5b7492d86fe0a59713bf43ef | [] | no_license | vanshika-croods/spring-security-project | 73ac39a17806a2df39709fa69f399cc3c532fa39 | ec6a6980768a89c531623ffd6e69f935185605d2 | refs/heads/master | 2023-05-13T02:51:53.091431 | 2021-06-06T17:25:26 | 2021-06-06T17:25:26 | 373,818,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,696 | java | package com.example.demo.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.LockedException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
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.servlet.ModelAndView;
@Controller
public class LoginController {
@GetMapping("/login")
public ModelAndView login(@RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout, HttpServletRequest request) {
ModelAndView model = new ModelAndView();
if (error != null) {
model.addObject("error", getErrorMessage(request, "SPRING_SECURITY_LAST_EXCEPTION"));
}
return new ModelAndView("login");
}
private Object getErrorMessage(HttpServletRequest request, String key) {
Exception exception = (Exception) request.getSession().getAttribute(key);
String error = "";
if (exception instanceof BadCredentialsException) {
error = "Invalid username and password!";
} else if (exception instanceof LockedException) {
error = exception.getMessage();
} else {
error = "Invalid username and password!";
}
return error;
}
@PostMapping("registration")
public ModelAndView registration() {
return new ModelAndView("redirect:/login");
}
@RequestMapping("/fail_login")
public ModelAndView failLogin() {
return new ModelAndView("403");
}
}
| [
"vanshikashah850@gmail.com"
] | vanshikashah850@gmail.com |
feef1ae04512a839f1d312c13f4ef4f46f2975f9 | c2a5151d9c216f789b515e0ea18160789f12c93e | /zskg-xianhezi-api/src/main/java/com/zsgroup/xianhezi/api/interceptor/FormLoginSecurityConfig.java | 84f43104ab41f3a7983dd0f31cac9d80db5f50bb | [] | no_license | esileme/springcloud_mongodb | 191af62eb844b146e5918280863f2d277a087f49 | 25d88692bee874c4c401df3cf4417a9fa69ea3e4 | refs/heads/master | 2020-04-01T16:32:30.094452 | 2018-10-17T02:52:14 | 2018-10-17T02:52:14 | 153,385,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.zsgroup.xianhezi.api.interceptor;
/**
* =================================
* <p>
* Created by yl on 2018-9-17.
* <p>
* 描述:
*/
/*@Configuration
@EnableWebSecurity
public class FormLoginSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
}
}*/
| [
"yangliang123"
] | yangliang123 |
f7799de117a65c414adaad480de76caada9c695f | 55ea6bab2fa9e381944586208a79f279da127842 | /app/src/test/java/com/example/chenjutsu/newapplication/ExampleUnitTest.java | dff12756eaa01bf6a55f22656368c46541fea197 | [] | no_license | akslsi/NewApplication | afeac4e4ed132f1130f36caab7d510da8a6fa4d8 | 42ae1272c57ca3694b8a8a26170bf81df609b644 | refs/heads/master | 2016-08-12T06:53:17.157369 | 2016-02-05T21:25:24 | 2016-02-05T21:25:24 | 51,174,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package com.example.chenjutsu.newapplication;
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);
}
} | [
"chenjutsu@chenmatoMacBook-Pro-5.local"
] | chenjutsu@chenmatoMacBook-Pro-5.local |
2e449f82fce3a98a5219c8617dc94c75b94866d9 | 47fcbc136781ef4f194229a50e9f7233d1f108fd | /src/main/java/b/TheEconomy.java | 0330c18f7f3a80137395f2d14f7e9900f7bdd55b | [] | no_license | noopurjoshi/202-SequenceDiagram | 225075b04011a926bef0b8fc7784ade4a5b2a42c | c07f3b9fc28dd313be6d96e4de70d2e2d584d779 | refs/heads/master | 2020-12-30T13:28:52.101493 | 2017-05-14T06:27:34 | 2017-05-14T06:27:34 | 91,224,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package b;
public class TheEconomy extends ConcreteSubject {
public TheEconomy()
{
super.setState("The Price of gas is at $5.00/gal");
}
}
/*
The Price of gas is at $5.00/gal
The New iPad is out today
*/
| [
"noopur2393@gmail.com"
] | noopur2393@gmail.com |
20c06d2f1ea1d5f1f1ed86d79350e43928274cc3 | 613f91a1a771b91e0228a681c614968eea325907 | /my/app/src/main/java/com/example/dusicong/my/sharedpreference.java | e8d58e02e07b38758cbf279ddad6ea36de136ad6 | [] | no_license | wcsngonion/project | c2d4faa72f1dcef7178cfa6941f49bcccd819095 | 4928e9d5239efbbfaa1cbc8c02ae4b63a2dc1f3d | refs/heads/master | 2021-01-23T05:29:27.211983 | 2017-05-31T05:59:26 | 2017-05-31T05:59:26 | 86,310,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,780 | java | package com.example.dusicong.my;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.util.Map;
import static com.example.dusicong.my.R.id.editdetail;
/**
* Created by Du Sicong on 3/30/2017.
*/
public class sharedpreference extends AppCompatActivity{
private EditText editname;
private EditText editpasswd;
private Button btnlogin;
private String strname;
private String strpasswd;
private Context mContext;
private SharedHelper sh;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sharedpreference);
mContext = getApplicationContext();
sh = new SharedHelper(mContext);
bindViews();
}
private void bindViews(){
editname = (EditText)findViewById(R.id.editname);
editpasswd = (EditText)findViewById(R.id.editpasswd);
btnlogin = (Button)findViewById(R.id.btnlogin);
btnlogin.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
strname = editname.getText().toString();
strpasswd = editpasswd.getText().toString();
sh.save(strname, strpasswd);
}
});
}
@Override
protected void onStart() {
super.onStart();
Map<String, String> data = sh.read();
editname.setText(data.get("username"));
editpasswd.setText(data.get("passwd"));
}
}
| [
"1010136561@qq.com"
] | 1010136561@qq.com |
be2d59bc24e10541e826e1e0a1aecbf4792e3f49 | 18805fe7f8fd2eb3be4805e30ed65ddec583d409 | /src/main/java/com/mellemhere/mysql/MySQLCurrentController.java | a443cca6cab5fecb9b09e2e1a4a43a498ddb1a6c | [] | no_license | mellemhere/gavsystem2.0 | 14bbd039053e507da351b3d97ab9bc651cb74d1d | 6c712f0390708121418c6d9e505c3674a9892ffa | refs/heads/master | 2020-04-16T20:03:34.312924 | 2017-05-07T23:23:29 | 2017-05-07T23:23:29 | 165,885,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,967 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mellemhere.mysql;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
/**
*
* @author MellemHere
*/
public class MySQLCurrentController {
private final String DB_NAME = "gav_current";
private final MySQLController con;
public MySQLCurrentController(MySQLController con) {
this.con = con;
}
public JSONArray getItems() {
JSONArray data = new JSONArray();
ResultSet rs = null;
try {
//SELECT * FROM pet WHERE name LIKE '%w%';
rs = con.query("SELECT * FROM `" + DB_NAME + "` WHERE 1 ORDER BY time DESC");
while (rs.next()) {
JSONObject dataHolder = new JSONObject();
dataHolder.put("x", rs.getTimestamp("time"));
dataHolder.put("y", rs.getFloat("current"));
data.put(dataHolder);
}
} catch (SQLException ex) {
con.getController().log(DB_NAME, "Erro com getItems", ex);
return null;
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException ex) {
con.getController().log(DB_NAME, "Erro com getItems", ex);
Logger.getLogger(MySQLUserController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
return data;
}
public JSONObject getItemsBad() {
JSONObject data = new JSONObject();
JSONArray x = new JSONArray();
JSONArray y = new JSONArray();
ResultSet rs = null;
try {
//SELECT * FROM pet WHERE name LIKE '%w%';
rs = con.query("SELECT * FROM `" + DB_NAME + "` WHERE 1 ORDER BY time DESC");
while (rs.next()) {
x.put(rs.getTimestamp("time"));
y.put(rs.getFloat("current"));
}
} catch (SQLException ex) {
con.getController().log(DB_NAME, "Erro com getItems", ex);
return null;
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException ex) {
con.getController().log(DB_NAME, "Erro com getItems", ex);
Logger.getLogger(MySQLUserController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
data.put("x", x);
data.put("y", y);
return data;
}
public void put(String floats) {
float data = Float.parseFloat(floats);
con.update("INSERT INTO `gav_current`(`current`) VALUES ('" + data + "')");
}
}
| [
"gabriel@mellemhere.com"
] | gabriel@mellemhere.com |
2d59570abc7a0e89f9f51c091edbc475b51866bf | 832b76ac467079a22e024ab04e6ef8962b8f4d0d | /ChatServer.java | 67400245886b1e74a5f46915e078848c85838a27 | [] | no_license | dranercom/Test-projects-java | 4648ba457154244f181911f9d6cc23879d6ed849 | 8ec7361d0b3f20de3084c45ee6dc1b395ea56330 | refs/heads/master | 2021-01-02T23:10:41.655582 | 2017-08-06T11:53:13 | 2017-08-06T11:53:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,897 | java | //client program for the chat app
import java.awt.*;
import java.awt.event.*;
import java.io.InputStreamReader;
import javax.swing.*;
import java.io.*;
import java.net.*;
class ChatServer{
static int y=580;
static JLabel label=null;
public static void main(String args[]) throws Exception{
String defaultMessage = "Enter your message..";
final int portno=3030;
JFrame frame = new JFrame("FireFly");
JTextField text = new JTextField(defaultMessage);
//manipulate the default message in the text field
text.addFocusListener(new FocusListener(){
public void focusGained(FocusEvent ae){
if(text.getText().equals(defaultMessage)){
text.setText("");
}
}
public void focusLost(FocusEvent ae){
if(text.getText().isEmpty()){
text.setText(defaultMessage);
}
}
});
text.setBounds(10,620,295,40);
frame.add(text);
JButton button = new JButton("SEND");
button.setBounds(310,620,80,40);
button.setForeground(Color.WHITE);
button.setBackground(Color.decode("#11A458"));
button.setFocusPainted(false);
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
if(!text.getText().equals(defaultMessage))
{
if(!text.getText().isEmpty()){
try{
ServerSocket ss = new ServerSocket(portno);
Socket socket = ss.accept();
BufferedReader bin1 = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter out = new PrintWriter(socket.getOutputStream());
String send,receive;
while(true){
if((receive = bin1.readLine())!=null){
label = new JLabel(receive);
label.setBounds(10,y,380,20);
y = y-20;
label.setHorizontalAlignment(SwingConstants.RIGHT);
frame.add(label);
frame.revalidate();
frame.repaint();
}
send = text.getText();
label = new JLabel(send);
text.setText(defaultMessage);
label.setBounds(10,y,380,20);
y = y-20;
frame.add(label);
frame.revalidate();
frame.repaint();
out.println(send);
out.flush();
}
}catch(UnknownHostException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
label=new JLabel(text.getText());
text.setText(defaultMessage);
label.setBounds(10,y,380,20);
y=y-40;
frame.add(label);
frame.revalidate();
frame.repaint();
}
}
}
});
frame.add(button);
frame.setSize(400,700);
frame.setLayout(null);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
| [
"ronythankachan324@gmail.com"
] | ronythankachan324@gmail.com |
13a410d478fb1f8028d736c637137522747c8f76 | 6d5f6bcf71a25f54d9f009ba1cd7f7bd17cc45ec | /app/src/main/java/com/johnmagdalinos/android/shopandcook/ui/MealItemTouchHelper.java | cf3f3a1b017823169539fedd13a44f0e6c3d0727 | [
"Apache-2.0"
] | permissive | jmagdalinos1981/ShopAndCook | f00f0c51411a8c8c6a8dfd1357dac91c607aae91 | c3df2bc5e106f532b91bcabc2d4b883932a3cf8f | refs/heads/master | 2021-09-16T21:12:06.911160 | 2018-06-25T07:17:49 | 2018-06-25T07:17:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,111 | java | /*
* Copyright (C) 2017 John Magdalinos
*
* 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.johnmagdalinos.android.shopandcook.ui;
import android.graphics.Canvas;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.view.View;
import com.johnmagdalinos.android.shopandcook.ui.adapters.MealListAdapter;
/**
* ItemTouchHelper used to enable swipe deletion of meals
*/
public class MealItemTouchHelper extends ItemTouchHelper.SimpleCallback {
/** Member variables */
private RecyclerItemTouchHelperListener mListener;
/** Creates a Callback for the given drag and swipe allowance. */
public MealItemTouchHelper(int dragDirs, int swipeDirs, RecyclerItemTouchHelperListener listener) {
super(dragDirs, swipeDirs);
mListener = listener;
}
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
mListener.onSwiped(viewHolder, direction, viewHolder.getAdapterPosition());
}
/** Detects whenever there is a UI change on the view and keeps the background in a static
* position*/
@Override
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
if (viewHolder != null) {
final View foregroundView = ((MealListAdapter.ViewHolder) viewHolder)
.mForegroundView;
getDefaultUIUtil().onSelected(foregroundView);
}
}
@Override
public void onChildDrawOver(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
final View foregroundView = ((MealListAdapter.ViewHolder) viewHolder).mForegroundView;
getDefaultUIUtil().onDrawOver(c, recyclerView, foregroundView, dX, dY, actionState, isCurrentlyActive);
}
@Override
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
final View foregroundView = ((MealListAdapter.ViewHolder) viewHolder).mForegroundView;
getDefaultUIUtil().clearView(foregroundView);
}
@Override
public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
final View foregroundView = ((MealListAdapter.ViewHolder) viewHolder).mForegroundView;
getDefaultUIUtil().onDraw(c, recyclerView, foregroundView, dX, dY, actionState, isCurrentlyActive);
// Get the direction of the swipe and hide/show appropriate background
View backgroundLeft = ((MealListAdapter.ViewHolder) viewHolder).mBackgroundViewLeft;
View backgroundRight = ((MealListAdapter.ViewHolder) viewHolder).mBackgroundViewRight;
if (dX > 0) {
// Right Swipe
backgroundLeft.setVisibility(View.VISIBLE);
backgroundRight.setVisibility(View.GONE);
} else {
// Left Swipe
backgroundLeft.setVisibility(View.GONE);
backgroundRight.setVisibility(View.VISIBLE);
}
}
@Override
public int convertToAbsoluteDirection(int flags, int layoutDirection) {
return super.convertToAbsoluteDirection(flags, layoutDirection);
}
public interface RecyclerItemTouchHelperListener {
void onSwiped(RecyclerView.ViewHolder viewHolder, int direction, int position);
}
}
| [
"jmagdalinos@gmail.com"
] | jmagdalinos@gmail.com |
a2a4cacfe1b46241c3a365f018adba7ff0ebb304 | 1b4b9c1c6c02833b1eae9e3123c951975df8b36a | /app/src/main/java/com/android/currencyconverter/MainActivity.java | f6dbf73fd2aae4ed7797d015af1011c50eddfa19 | [] | no_license | MahmoudMohammed07/CurrencyConverter | 4aeba2069d5b3a963d91580bc125188846d63af8 | d5b1673c264ad2e57121e11c43f9a21369a8e8fc | refs/heads/master | 2020-06-30T12:44:17.536219 | 2019-08-06T10:25:22 | 2019-08-06T10:25:22 | 200,829,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | package com.android.currencyconverter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void convert(View view) {
EditText dollarAmount = (EditText) findViewById(R.id.et_currency);
double dollarAmountDouble = Double.parseDouble(dollarAmount.getText().toString());
double egpAmount = dollarAmountDouble * 16.74;
Toast.makeText(MainActivity.this, "EGP: " + String.format("%.2f", egpAmount), Toast.LENGTH_SHORT).show();
Log.i("amount", dollarAmount.getText().toString());
}
}
| [
"mahmoudmohammed07@gmail.com"
] | mahmoudmohammed07@gmail.com |
444623bfde25572ade891bfa3df1e1201e0e7fde | a0c90512a0b12f0c8563e576d69284202d0f81a0 | /app/src/main/java/fernando/example/relativelayoutpropiedades/MainActivity.java | a636f5adea5115f39958cc4be1ee688750038216 | [] | no_license | fernan3ox/RelativeLayoutPropiedades2 | 3b1ec2d8ef15af3e70f0167bebb3197eb5c657cc | 552d40c8beb998642b7163ccd020ba6438432ce3 | refs/heads/main | 2023-07-17T11:35:21.479261 | 2021-09-04T04:50:39 | 2021-09-04T04:50:39 | 402,966,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package fernando.example.relativelayoutpropiedades;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"fernandoramiro21@gmail.com"
] | fernandoramiro21@gmail.com |
9c7ad533cd3e99f28e732ceda4396595114971e4 | c51502da4a28fbfc25a259ac8c478f39283caf27 | /src/net/eduard/curso/projeto/rankup/RankSQL.java | faafa2a2eb90c6d7797f8516be70a8a5d3d18e7a | [
"MIT"
] | permissive | Neonzio/Curso-de-Plugins | 6b6341997d9e8159e66a157ae221ee836d2ca91e | f9eef282ba49ae3c172f1cd2327d5a6cdb2a8483 | refs/heads/master | 2022-11-25T17:35:20.432637 | 2020-07-31T19:41:06 | 2020-07-31T19:41:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,276 | java | package net.eduard.curso.projeto.rankup;
import net.eduard.api.lib.database.DBManager;
public class RankSQL extends DBManager {
public RankSQL(String user, String pass, String host, String database) {
super(user, pass, host, database);
}
public void createRanksTable() {
createTable("ranks", "name varchar(30) , prefix varchar(16),suffix varchar(16), price double , position int ");
}
public void createPlayersRankTable() {
createTable("players_rank", "player_name varchar(16), player_rank varchar(30)");
}
public void createRank(String name, String prefix, String suffix, double price, int position) {
insert("ranks", name.toLowerCase(), prefix, suffix, price, position);
}
public void deleteRank(String name) {
deleteData("ranks", "name = ?", name.toLowerCase());
}
public boolean hasRank(String name) {
return contains("ranks", "name = ?", name.toLowerCase());
}
public boolean hasPlayerRank(String playerName) {
return contains("players_rank", "player_name = ?", playerName);
}
public void setRank(String playerName, String rankName) {
if (hasPlayerRank(playerName)) {
change("players_rank", "player_rank = ?", "player_name = ?", rankName, playerName);
} else {
insert("players_rank", playerName, rankName);
}
}
}
| [
"eduardkiller@hotmail.com"
] | eduardkiller@hotmail.com |
84e946b8e566410428513d5bc01bd5e35f328d8f | 069c360eaaf5c70fda0115549fdcb678e5a80a96 | /app/src/main/java/com/example/imazjav0017/instaclone/StarterApplication.java | d3926c69572945b42e356c70b58e5ad28fef87c4 | [] | no_license | imazjav0017/instagramClone | 8f41ede62781dd1861dcd2c79c36b4c2bbbb3b4b | 7649e3cb3a871e968506a0c45d0240e7f6e5bacb | refs/heads/master | 2020-04-02T00:18:23.857175 | 2018-10-19T14:46:03 | 2018-10-19T14:46:03 | 153,796,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package com.example.imazjav0017.instaclone;
import android.app.Application;
import android.util.Log;
import com.parse.Parse;
import com.parse.ParseACL;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseUser;
import com.parse.SaveCallback;
public class StarterApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("55ae035c549fb229da81e140d0a41df8cc26c5ac")
.clientKey("9558daedc385c6fb25ab307a8f778c3a366b8138")
.server("http://18.216.253.77:80/parse/")
.build()
);
// ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
defaultACL.setPublicWriteAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
}
| [
"imazjaveed@gmail.com"
] | imazjaveed@gmail.com |
0e1802cacd8ffcf865be958cf461ab8ef290928a | 472152638c1b0fab475ea8fa30d2b793f5d2e1b9 | /Olivia/1008/palindrome numbers.java | 57c9ac62baada156495869d813db1cdfecbeba1c | [] | no_license | mingming733/LCGroup | 0e9c0101aeced0c66cd7e3a573866f252aaf85d0 | d26c6a18749aa176eba0ef000b8276335979fedb | refs/heads/master | 2021-01-13T01:40:51.745175 | 2015-11-25T04:33:32 | 2015-11-25T04:33:32 | 42,124,191 | 0 | 5 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | public class Solution {
public boolean isPalindrome(int x) {
if(x<0){
return false;
}
return x==reverse(x);
}
public int reverse(int x)
{
int rst=0;
while(x!=0){
rst=rst*10+x%10;
x=x/10;
}
return rst;
}
}
| [
"wangjueolivia@users.noreply.github.com"
] | wangjueolivia@users.noreply.github.com |
85acc957da16cd7b95f7d1ca3fb7421503b07828 | 067fd4d94e88ee10bc017bc9406340680d34ea95 | /Jelp/app/src/main/java/com/android/jelp/jelp/HomeActivity.java | 9cf3039a3b856165f13357e60d8e52f54269ca13 | [] | no_license | aryan24/Jelp | df410ffced5ffe22b7e2ac4f24bcbfbc8cc6e26e | a535c1906971c188c9c274c784376de51e725856 | refs/heads/master | 2021-01-01T17:19:36.212919 | 2017-08-02T17:07:03 | 2017-08-02T17:07:03 | 98,049,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,398 | java | package com.android.jelp.jelp;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
public class HomeActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).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);
/////////////////////////////////////////////
// Locate the button in activity_main.xml
//View headerLayout = navigationView.inflateHeaderView(R.layout.nav_header_home);
NavigationView nav = (NavigationView) findViewById(R.id.nav_view);
View header = navigationView.getHeaderView(0);
//View myLayout = findViewById( R.id.nav_view );
button = (Button) header.findViewById(R.id.MyButton);
// Capture button clicks
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// Start NewActivity.class
Intent myIntent = new Intent(HomeActivity.this,
LoginActivity.class);
startActivity(myIntent);
}
});
}
@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
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_camera) {
// Handle the camera action
} else if (id == R.id.nav_gallery) {
} else if (id == R.id.nav_slideshow) {
} else if (id == R.id.nav_manage) {
} else if (id == R.id.nav_share) {
} else if (id == R.id.nav_send) {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
| [
"aryan.r.t@gmail.com"
] | aryan.r.t@gmail.com |
79e3da688b71c7ff3dc90a91152ebdafc811fd63 | c953ffe02e79f9093e82eef206fbaf456115a3f2 | /자바기초/ch10/DateFormatterEx.java | 949b062cb4c3f277f8315951acfdb119627cb49f | [] | no_license | VIXXPARK/javaAlgorithm | 12718741c0d83d1aad9cf9ccf1b5493cedd806d7 | 34ccf5c136e1573e7e76b4238a97ce6b170e9aad | refs/heads/main | 2023-08-03T16:21:55.401817 | 2021-09-09T00:14:24 | 2021-09-09T00:14:24 | 378,756,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
class DayAfterTomorrow{
public static void main(String[] args){
LocalDate newYear = LocalDate.parse("2021-06-24",DateTimeFormatter.ISO_LOCAL_DATE);
LocalDate date = LocalDate.parse("2000-01-01");
LocalTime time = LocalTime.parse("23:59:59");
LocalDateTime dateTime = LocalDateTime.parse("2000-01-01T23:59:59");
DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime endOfYear = LocalDateTime.parse("2015-12-31 23:59:59",pattern);
System.out.println(newYear);
System.out.println(date);
System.out.println(time);
System.out.println(dateTime);
System.out.println(endOfYear);
}
} | [
"vixx170627@gmail.com"
] | vixx170627@gmail.com |
dff6c3f188fa4d4210b2cafcb33d89e9e3728038 | e4753d581730392938c99ce08e83900549d16776 | /app/src/main/java/com/example/test_gait/LoginActivity.java | 190b57ef7d7179796cd14add9f8b4822763cdaeb | [] | no_license | shyam2828/Gait_Analysis | 15eb21ea232dae627a1a7221c639842acf5b2396 | e5db44c14f042937688798f28b2cbc1d3a67e162 | refs/heads/master | 2023-03-13T18:19:16.886241 | 2021-03-08T21:20:37 | 2021-03-08T21:20:37 | 345,798,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,670 | java | package com.example.test_gait;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class LoginActivity extends AppCompatActivity {
EditText email;
String u_email;
FirebaseUser firebaseUser;
@Override
protected void onStart() {
super.onStart();
firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
//check if user is null
if (firebaseUser != null){
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
startActivity(intent);
finish();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
email=(EditText)findViewById(R.id.username_email);
}
public void con(View view) {
String next = email.getText().toString();
if (TextUtils.isEmpty(next))
{
Toast.makeText(LoginActivity.this, "Enter your email to login", Toast.LENGTH_SHORT).show();
}
else {
Intent i = new Intent(LoginActivity.this, LoginActivity1.class);
u_email=email.getText().toString();
i.putExtra("email",u_email);
startActivity(i);
}
}
public void register(View view) {
startActivity(new Intent(LoginActivity.this,RegisterActivity.class));
}
} | [
"baddogs81@gmail.com"
] | baddogs81@gmail.com |
d7081dbbc6c42d703011b3f2eb03c4373c95624a | 9ab7abce5525e101482c64726d1a9717e640242c | /src/main/java/fr/ibformation/scenarryo_back/enums/AgeEnum.java | dd2b5b5aa4cf6c3cce9c793c1970c1c40dbcd07b | [] | no_license | niamoR-dev/scenarryo_back_final | 4281e189cee2f6255d0bb53cbec688e79c8f195f | 2e99dd96058238e6a63fa72d4c5152dc7f960b77 | refs/heads/master | 2023-05-24T19:10:12.045367 | 2021-06-06T09:12:14 | 2021-06-06T09:12:14 | 370,742,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 116 | java | package fr.ibformation.scenarryo_back.enums;
public enum AgeEnum {
TOUS_PUBLIC, AVERTISSEMENT, M_18, M_16, M_12
}
| [
"alexandre.segelle@hotmail.fr"
] | alexandre.segelle@hotmail.fr |
f87a42bbb16de1535487d9038db311834f32e391 | 17218a40ba17ae6d85e09d6be03ebff179c9549f | /src/main/java/com/hns/oop/csv/CsvReader.java | d9651993e4ffe4725e5bcf6e63527fd18fcfa31b | [] | no_license | harunuyar/Student-Assistant | c0975c571afe9f5791913a85c1f2f669c606be6a | 0849eeda1f794f443a2b3c656fd2004a224a3591 | refs/heads/master | 2021-04-29T02:01:50.936590 | 2017-03-04T12:13:07 | 2017-03-04T12:13:07 | 78,063,574 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,623 | java | package com.hns.oop.csv;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class CsvReader {
private final BufferedReader br;
public CsvReader(String csvFile) throws FileNotFoundException, IOException {
br = new BufferedReader(new FileReader(csvFile));
readNext(); // İlk satırda column isimleri var. Onları es geç.
}
public String[] readNext() throws IOException{
String line = br.readLine(); // Sonraki satırı okur.
if (line == null)
return null;
return parse(line); // Virgüllere göre bölüp döndürür.
}
private String[] parse(String str){
ArrayList<String> al = new ArrayList();
char[] c = str.toCharArray();
int i = 0;
while(true){
StringBuilder sb = new StringBuilder();
if(c[i] == '\"'){
i++;
while(c[i]!='\"'){
sb.append(c[i]);
i++;
}
i++;
}
else{
while(i != c.length && c[i]!=','){
sb.append(c[i]);
i++;
}
}
al.add(sb.toString());
if(i==c.length)
break;
i++;
}
return al.toArray(new String[0]);
} // Satırı virgüllere göre Stringlere böler. Eğer yazı çift tırnak ile başlıyorsa çift tırnakları görmezden gelir.
}
| [
"harunuyar1996@gmail.com"
] | harunuyar1996@gmail.com |
c0752256d9722bacb6b7a29e87e437f35db51167 | 516ce71685ea714ff648a21e0689628cc8f73297 | /ZB0420/src/com/mobile/meishang/model/bean/CombineListItem.java | 7101fd6e088ba1eb29f77688655bfa82a45dd085 | [] | no_license | qq466455592/HelloWord | dcbef820ebc3593bff03f27a34e61f7b5d9e9eb3 | e9b7d089011cc2d9dd31c99c91a6d40c38780730 | refs/heads/master | 2020-06-03T19:44:27.436829 | 2015-04-21T03:58:21 | 2015-04-21T03:58:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 985 | java | package com.mobile.meishang.model.bean;
import org.json.JSONException;
import org.json.JSONObject;
import com.mobile.meishang.utils.FunctionUtil;
/**
*
* @Title:
* @Description:
* @Author:Administrator
* @Since:2013-5-2
* @Version:
*/
public class CombineListItem {
private String id;
private String title;
private String imgageUrlBig;
private String imgageUrlsmall;
public CombineListItem() {
}
public CombineListItem(int i) {
}
public CombineListItem(JSONObject json) throws JSONException {
id = FunctionUtil.getJsonStrValue(json, "activeid");
title = FunctionUtil.getJsonStrValue(json, "title");
imgageUrlBig = FunctionUtil.getJsonStrValue(json, "imgageurl");
imgageUrlsmall = FunctionUtil.getJsonStrValue(json, "smallimage");
}
public String getId() {
return id;
}
public String getTitle() {
return title;
}
public String getImgageUrlBig() {
return imgageUrlBig;
}
public String getImgageUrlsmall() {
return imgageUrlsmall;
}
}
| [
"zhangbin131421@163.com"
] | zhangbin131421@163.com |
27d645f55becaf471534831201520282eeb8af99 | ab9ac90572781fc965d3557e14a4c8cb7490c43e | /src/oljek/hd/gui/custom/GUI.java | 9d918287b48d008d35ae97424e1e52cb1d027652 | [] | no_license | TestUserV/HardTest | 054742ff09a19cc8c6254c1515a65fa2890a89f1 | 24ee31d8d525651389fbaa33f6304f51ecc2c5e8 | refs/heads/master | 2020-04-20T17:55:09.306943 | 2019-02-03T23:31:53 | 2019-02-03T23:31:53 | 169,003,268 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,783 | java | package oljek.hd.gui.custom;
import com.oljek.main.util.StringUtil;
import oljek.hd.Hard;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import java.util.List;
public abstract class GUI implements Listener {
protected Inventory inv;
protected Hard hard;
protected Player p;
public GUI(Hard hard, Player p) {
this.hard = hard;
this.p = p;
inv = Bukkit.createInventory(null, getSlot(), StringUtil.inColor(getName()));
Bukkit.getPluginManager().registerEvents(this, hard);
}
public abstract String getName();
public abstract int getSlot();
public abstract List<GUIItem> getItems();
public void open() {
inv.clear();
setItems();
p.openInventory(inv);
}
protected void setItems() {
inv.clear();
getItems().forEach((s) -> inv.setItem(s.getSlot(), s.getStack()));
}
public void close() {
if (p != null && p.isOnline())
p.closeInventory();
}
@EventHandler
public void onClick(InventoryClickEvent e) {
if (e.getWhoClicked() instanceof Player) {
Player p = (Player) e.getWhoClicked();
Inventory inv = e.getClickedInventory();
if (!this.p.equals(p))
return;
if (inv == null)
return;
if (!inv.equals(this.inv))
return;
if (e.getClick().isShiftClick() || e.getClick() == ClickType.DOUBLE_CLICK) {
e.setCancelled(true);
e.setResult(Event.Result.DENY);
return;
}
ItemStack curr = e.getCurrentItem();
ItemStack cursor = e.getCursor();
if (curr == null)
curr = new ItemStack(Material.AIR);
if (cursor == null)
cursor = new ItemStack(Material.AIR);
List<GUIItem> items = getItems();
ItemStack finalCurr = curr;
items.forEach((s) -> {
if (finalCurr.getType() == Material.AIR) {
if (s.isAir() && s.getSlot() == e.getSlot()) {
s.getFunction().done(e);
return;
}
} else {
if (s.getStack().equals(finalCurr) || s.getSlot() == e.getSlot()) {
s.getFunction().done(e);
return;
}
}
});
if (curr.getType() == Material.AIR && cursor.getType() != Material.AIR) {
e.setCancelled(true);
e.setResult(Event.Result.DENY);
}
}
}
@EventHandler
public void onDrag(InventoryDragEvent e) {
if (e.getWhoClicked() instanceof Player) {
Player p = (Player) e.getWhoClicked();
if (!this.p.equals(p))
return;
Inventory inv = e.getInventory();
if (inv.equals(this.inv)) {
e.setCancelled(true);
e.setResult(Event.Result.DENY);
}
}
}
@EventHandler
public void onClose(InventoryCloseEvent e) {
if (e.getInventory().equals(this.inv) && e.getPlayer().equals(this.p))
HandlerList.unregisterAll(this);
}
}
| [
"idi.nahuy.discord@yandex.ru"
] | idi.nahuy.discord@yandex.ru |
bb0463fa9471697db35a375ed4ca0c3289a4f5a2 | b28fd79cf40e709b17fae9922c4f81e8c081adb4 | /app/src/main/java/com/sara/project/Activities/Login.java | 1e61befddf75db8ba2fc55f2f12cbdbf82161701 | [] | no_license | sara-adel/StoreShop | 85b3280a2d489b4fa2b904b792dc65c687e5ffff | 14768864ee5cc6645da8283eca872435302a9e49 | refs/heads/master | 2021-05-10T18:05:06.163975 | 2018-02-04T18:04:22 | 2018-02-04T18:04:22 | 118,620,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,618 | java | package com.sara.project.Activities;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FacebookAuthProvider;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.sara.project.Database.DBController;
import com.sara.project.R;
public class Login extends AppCompatActivity {
DBController mydb;
String id;
private EditText email , pass;
private ImageView showPass;
private Button login, forgetPass, signup, skip ;
private LoginButton facebookLogin;
private CheckBox rememberMe;
private ProgressBar progressBarLogin;
private String emailText , passText;
private CallbackManager mCallbackManager;
private boolean isCilcked = false;
private FirebaseAuth mAuth;
private SharedPreferences loginPrefs;
private SharedPreferences.Editor loginPrefEditor;
private boolean saveLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
Init();
}
private void Init(){
mAuth = FirebaseAuth.getInstance();
mydb = new DBController(this);
if (mAuth.getCurrentUser() != null){
startActivity(new Intent(Login.this , Home.class));
finish();
}
facebookLogin = findViewById(R.id.faceLogin);
email = findViewById(R.id.email);
pass = findViewById(R.id.password);
showPass = findViewById(R.id.show_pass);
login = findViewById(R.id.login);
forgetPass = findViewById(R.id.forgetPassword);
rememberMe = findViewById(R.id.rememberMe);
signup = findViewById(R.id.signup_login);
skip = findViewById(R.id.skip);
progressBarLogin = findViewById(R.id.progressBarLogin);
loginPrefs = getSharedPreferences("loginPrefrence" , MODE_PRIVATE);
loginPrefEditor = loginPrefs.edit();
//remember me
saveLogin = loginPrefs.getBoolean("saveLogin", false);
if (saveLogin == true) {
email.setText(loginPrefs.getString("userPref", ""));
pass.setText(loginPrefs.getString("passPref", ""));
rememberMe.setChecked(true);
}
LoginFacebook();
ShowPasswordAction();
LoginAction();
ForgetPasswordAction();
SignupAction();
SkipAction();
}
private void LoginFacebook() {
mCallbackManager = CallbackManager.Factory.create();
facebookLogin.setReadPermissions("email", "public_profile");
facebookLogin.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Log.d("msg", "facebook:onSuccess:" + loginResult);
handleFacebookAccessToken(loginResult.getAccessToken());
}
@Override
public void onCancel() {
Log.d("msg", "facebook:onCancel");
}
@Override
public void onError(FacebookException error) {
Log.d("msg", "facebook:onError", error);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Pass the activity result back to the Facebook SDK
mCallbackManager.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void onStart() {
super.onStart();
// Check if user is signed in (non-null) and update UI accordingly.
FirebaseUser currentUser = mAuth.getCurrentUser();
if (currentUser != null) {
updateUI();
}
}
private void updateUI(){
Toast.makeText(Login.this ,"You are logged in." , Toast.LENGTH_LONG).show();
Intent intent = new Intent(Login.this, Home.class);
startActivity(intent);
finish();
}
private void handleFacebookAccessToken(AccessToken token) {
Log.d("msg", "handleFacebookAccessToken:" + token);
AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d("msg", "signInWithCredential:success");
FirebaseUser user = mAuth.getCurrentUser();
//facebookLogin.setEnabled(true);
updateUI();
} else {
// If sign in fails, display a message to the user.
Log.w("msg", "signInWithCredential:failure", task.getException());
Toast.makeText(Login.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
//facebookLogin.setEnabled(true);
updateUI();
}
// ...
}
});
}
private void ShowPasswordAction(){
showPass.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isCilcked){
//pass.setTransformationMethod(PasswordTransformationMethod.getInstance());
pass.setInputType(InputType.TYPE_CLASS_TEXT);
} else {
//pass.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}
}
});
}
private void LoginAction(){
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
emailText = email.getText().toString().trim();
passText = pass.getText().toString().trim();
if(TextUtils.isEmpty(emailText)){
email.setError("Field cannot be left blank.");
return;
}
if( TextUtils.isEmpty(passText)){
pass.setError("Field cannot be left blank.");
return;
}
//remember me
if (rememberMe.isChecked()) {
loginPrefEditor.putBoolean("saveLogin", true);
loginPrefEditor.putString("userPref", emailText);
loginPrefEditor.putString("passPref", passText);
loginPrefEditor.commit();
} else {
loginPrefEditor.clear();
loginPrefEditor.commit();
}
progressBarLogin.setVisibility(View.VISIBLE);
mAuth.signInWithEmailAndPassword(emailText , passText)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
progressBarLogin.setVisibility(View.GONE);
if (!task.isSuccessful()) {
// there was an error
Toast.makeText(Login.this, "check your email and password or sign up",
Toast.LENGTH_LONG).show();
} else {
//if user already exist in database
String email_value = mydb.getEmailOfUser(emailText);
if (emailText.equals(email_value)) {
id = mydb.getIdOfUser(emailText);
Intent intent = new Intent(Login.this, Home.class);
Bundle bundle = new Bundle();
bundle.putString("idOfUser", id);
intent.putExtras(bundle);
startActivity(intent);
finish();
} else {
//insert data into table of users
long insert = mydb.insert_intoUsers(emailText);
if (insert == -1) {
Toast.makeText(Login.this, "Data not Inserted", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(Login.this, "Data Inserted", Toast.LENGTH_LONG).show();
//get id
id = mydb.getIdOfUser(emailText);
}
}
Intent intent = new Intent(Login.this, Home.class);
Bundle bundle = new Bundle();
bundle.putString("idOfUser", id);
intent.putExtras(bundle);
startActivity(intent);
finish();
}
}
});
}
});
}
private void ForgetPasswordAction(){
forgetPass.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent forget = new Intent(Login.this , ForgetPassword.class);
startActivity(forget);
}
});
}
private void SignupAction(){
signup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent signup = new Intent(Login.this , Signup.class);
startActivity(signup);
}
});
}
private void SkipAction(){
skip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent skip = new Intent(Login.this , Home.class);
startActivity(skip);
}
});
}
} | [
"saraadel895@gmail.com"
] | saraadel895@gmail.com |
32892912bf7a214c6ce9faf1b9171eaf2c354f31 | 4dd9e17d35745519e294aa6b31297909c5f81e60 | /src/main/java/me/soler/designPattern/proxy/dynamic/Context.java | d980fe33b514cfedd63fb90d6b32588428cacca9 | [] | no_license | solerwell/learn | 5f1412f2d49a7a26a34439134f28897b0a1f941a | 124d11ea2df93799d3722d1b87fb38b5f0b593e5 | refs/heads/master | 2021-01-20T18:52:36.710891 | 2017-05-23T10:11:26 | 2017-05-23T10:11:39 | 64,528,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package me.soler.designPattern.proxy.dynamic;/**
* Created by soler on 2017/5/23.
*/
import me.soler.designPattern.proxy.GamePlayer;
import me.soler.designPattern.proxy.IGamePlayer;
/**
* <p>动态代理上下文 </p>
*
* @author weizengjie
* @since 2017/5/23
*/
public class Context {
public static void main(String[] args) {
String user = "soler";
String name = "自来卷儿";
String pwd = "123456";
IGamePlayer player = new GamePlayer(user, name);
IGamePlayer proxy = DynamicProxyFactory.getGameProxy(player, () -> System.out.println("game is proxyed"));
proxy.login(name, pwd);
proxy.killBoss();
proxy.upgrade();
}
}
| [
"solerwell@msn.com"
] | solerwell@msn.com |
ef8ef380fccc098f34c798e56e16ca84c6f16302 | 4b533c1db53cb485f1981da02f57c0da0912d753 | /com.syhan.rcp.geftut4/src/com/syhan/rcp/geftut4/editor/part/EnterprisePart.java | 6aa9231c89afe24db8d36fb959a9c4b5dcf987d0 | [] | no_license | Lareinahe/Exercise.gef | cd1705625f1c743db3864435d1bdedf31c98a7db | c699b9a4f1a71e03a47c8c18fe0bff75088c6da8 | refs/heads/master | 2021-12-09T16:23:49.737212 | 2016-06-02T08:50:46 | 2016-06-02T08:50:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,452 | java | package com.syhan.rcp.geftut4.editor.part;
import java.beans.PropertyChangeEvent;
import java.util.List;
import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPolicy;
import com.syhan.rcp.geftut4.editor.editpolicies.AppEditLayoutPolicy;
import com.syhan.rcp.geftut4.editor.figure.EnterpriseFigure;
import com.syhan.rcp.geftut4.editor.model.Enterprise;
import com.syhan.rcp.geftut4.editor.model.Node;
public class EnterprisePart extends AppAbstractEditPart {
@Override
protected IFigure createFigure() {
//
IFigure figure = new EnterpriseFigure();
return figure;
}
@Override
protected void createEditPolicies() {
//
installEditPolicy(EditPolicy.LAYOUT_ROLE, new AppEditLayoutPolicy());
}
@Override
protected void refreshVisuals() {
//
EnterpriseFigure figure = (EnterpriseFigure) getFigure();
Enterprise model = (Enterprise) getModel();
figure.setName(model.getName());
figure.setAddress(model.getAddress());
figure.setCapital(model.getCapital());
}
@Override
protected List<Node> getModelChildren() {
//
return ((Enterprise)getModel()).getChildren();
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
//
if (evt.getPropertyName().equals(Node.PROPERTY_LAYOUT)) {
refreshVisuals();
}
if (evt.getPropertyName().equals(Node.PROPERTY_ADD)) {
refreshChildren();
}
if (evt.getPropertyName().equals(Node.PROPERTY_REMOVE)) {
refreshChildren();
}
}
}
| [
"syhan@nextree.co.kr"
] | syhan@nextree.co.kr |
d4a82a017f9cdcdc0acf2506d4a395f1fd62a9cd | d80caba529723dcfa947c30ee77f0503da2fba80 | /src/com/bint/vo/PageVo.java | c39293fa35482c78bda483985e80846e80a75bf4 | [] | no_license | LintBin/bint_blog_manager_system | ff12096c18c95860422356f3ec17f5ca94600eed | d6654673ea0ba4b464b6c4b8c35990ca32a8e1fb | refs/heads/master | 2016-09-05T22:31:52.886972 | 2015-01-22T21:37:17 | 2015-01-22T21:37:17 | 28,593,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,009 | java | package com.bint.vo;
import java.util.List;
public class PageVo {
private List<?> list;
private long startIndex =1;
private int size = 20;
private long amount ;
private int currentPage =1;
public long getAmount() {
return amount;
}
public void setAmount(long amount) {
this.amount = amount;
}
public List<?> getList() {
return list;
}
public void setList(List<?> list) {
this.list = list;
}
public long getStartIndex() {
return (currentPage-1)*size;
}
public void setStartIndex(long startIndex) {
this.startIndex = startIndex;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
@Override
public String toString() {
return "PageVo [list=" + list + ", startIndex=" + startIndex
+ ", numPerPage=" + size + ", amount=" + amount
+ ", currentPage=" + currentPage + "]";
}
}
| [
"312763889@qq.com"
] | 312763889@qq.com |
4f7be67a86297c8d160fc14ccd1f462b3872a776 | 06c8958c75ab7b30ad7cc7512b700b1fa3b0c36b | /MyAnnotation/src/Version.java | 718fd291eaf7b809aecbeddef06571d32745f2fa | [] | no_license | EvgeniiNovikov/BelHard_lessons | d5d97b280f53bf46eafdf0190417d0af0e0660b0 | 8e95a6c52f2d429c5adfac85ca23f66e464eeb88 | refs/heads/master | 2020-07-15T03:16:00.839887 | 2019-10-07T23:16:28 | 2019-10-07T23:16:28 | 205,467,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Version
{
double version();
String nameVersion();
}
| [
"Rul92@mail.ru"
] | Rul92@mail.ru |
4f4d2d4b0cad1780744e59e45355718a5540850c | 5dbf415c02e6ff71ed820438b79169bb12f4af1f | /app/src/main/java/com/example/camera/ICallback.java | 34955fbfe8a3ad6a8d56301fc195841aa971c795 | [] | no_license | rnandyala/camera_click_view | 90df0491d4267c8745cedc332d9b300a90a9f7f1 | 5b476485cd0d22910a76456741e1d6d81d877e63 | refs/heads/master | 2021-05-22T16:02:14.273714 | 2020-05-14T11:53:22 | 2020-05-14T11:53:22 | 252,994,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 88 | java | package com.example.camera;
public interface ICallback {
void done(Exception e);
}
| [
"rajapnandyala@gmail.com"
] | rajapnandyala@gmail.com |
dfa2aa92dd66c61726f84c20540fec664ba66b57 | 808b985690efbca4cd4db5b135bb377fe9c65b88 | /tbs_core_45016_20191122114850_nolog_fs_obfs/assets/webkit/unZipCode/video_impl_dex.src/com/tencent/smtt/webkit/c.java | 021c0ed19a9c4eda9cbb2ac6c5da519ad7a27c12 | [] | no_license | polarrwl/WebviewCoreAnalysis | 183e12b76df3920c5afc65255fd30128bb96246b | e21a294bf640578e973b3fac604b56e017a94060 | refs/heads/master | 2022-03-16T17:34:15.625623 | 2019-12-17T03:16:51 | 2019-12-17T03:16:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,426 | java | package com.tencent.smtt.webkit;
import com.tencent.smtt.util.MttLog;
import java.io.File;
import java.io.IOException;
import org.chromium.android_webview.AwDebug;
import org.chromium.base.PathUtils;
public class c
{
public static boolean a(String paramString)
{
if (paramString.startsWith("http://debug.core/dump-thread"))
{
paramString = new File(PathUtils.getExternalStorageDirectory(), "dump.dmp");
if (!paramString.exists()) {
try
{
paramString.createNewFile();
}
catch (IOException localIOException)
{
localIOException.printStackTrace();
}
}
AwDebug.dumpWithoutCrashing(paramString);
return true;
}
return false;
}
public static boolean b(String paramString)
{
String str = MttLog.getLocalDumpDirTbs();
if (str == null) {
return false;
}
paramString = new File(str, paramString);
if (!paramString.exists()) {
try
{
paramString.createNewFile();
}
catch (IOException localIOException)
{
localIOException.printStackTrace();
}
}
AwDebug.dumpWithoutCrashing(paramString);
return true;
}
}
/* Location: C:\Users\Administrator\Desktop\学习资料\dex2jar\dex2jar-2.0\classes-dex2jar.jar!\com\tencent\smtt\webkit\c.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"1542951820@qq.com"
] | 1542951820@qq.com |
609badd0c5ec2d1e511963e1177cf319a6e6fd15 | 809a078fc0c9560f6657406cf52b3ae93e1d3e9e | /myapp/core/src/main/java/com/org/core/filters/package-info.java | 7c83a56eddc378dfe7538111fc3d7d69050fe9d4 | [
"Apache-2.0"
] | permissive | behlgaurav/roman_numeral | 88d5912abc12131242ed90ca87a31c7965e06ba4 | 503bce71ca2cf876cf0495104c1f2808a5c776c9 | refs/heads/main | 2023-04-10T21:48:39.866856 | 2021-04-22T19:32:22 | 2021-04-22T19:32:22 | 360,633,002 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | /*
* Copyright 2015 Adobe Systems Incorporated
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Version("1.0")
package com.org.core.filters;
import org.osgi.annotation.versioning.Version; | [
"gbehl@expediagroup.com"
] | gbehl@expediagroup.com |
98ff8da986b1bcbd32c05aab8b5d4326bea2140e | f9819768ac21da0796ff8221dc7b35769f5271a3 | /app/src/main/java/com/bfg/game/scene/SceneMainMenu.java | 4a5305d507dcf72096b2682974fbda95ba036b60 | [] | no_license | CFoce/SimplePlatformer | 04c29840b504535e53b522483c57fcadfce434dd | 78ca4e883cb2940d6111f2fe62e397db14446f2f | refs/heads/master | 2021-05-04T07:49:34.321938 | 2016-10-13T11:46:53 | 2016-10-13T11:46:53 | 70,704,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,887 | java | package com.bfg.game.scene;
import android.graphics.*;
import java.util.concurrent.*;
import com.bfg.game.button.*;
import com.bfg.game.text.*;
import com.bfg.game.*;
import com.bfg.game.block.*;
import com.bfg.game.common.*;
public class SceneMainMenu implements Scene
{
private volatile static ButtonStandard button = new ButtonStandard("Select Level",480,90);
private volatile static ButtonStandard button1 = new ButtonStandard("Options",480,210);
private volatile static ButtonStandard button2 = new ButtonStandard("Extra Levels",480,330);
private volatile static TextTitle title = new TextTitle("Simple",225,150);
private volatile static TextTitle title1 = new TextTitle("Platformer",225,225);
private volatile static TextCredits alpha = new TextCredits("Beta Build 0.1.0",225,275);
private volatile static Block[] blocks = new Block[7];
private volatile static Block exit = new Flag(305,318);
private volatile Player player = new Player(129,334);
private volatile int nextScene = 0;
private volatile static Semaphore sem = new Semaphore(10,true);
private volatile int tick = 0;
public void onCreate() {
for(int i = 0; i < blocks.length; i++) {
blocks[i] = new BlockBlack(113+i*32,350);
}
}
public void onChange() {
MainThread.setLoading(true);
if(tick == 0){
tick = UpdateThread.getTicks();
}
if(UpdateThread.getTicks() >= tick+30) {
switch(getNextScene()) {
case 1:
MainThread.scene = new SceneLevelMenu();
break;
case 2:
MainThread.scene = new SceneOptionsMenu();
break;
case 3:
MainThread.scene = new SceneExtraLevels();
break;
}
MainThread.scene.onCreate();
MainThread.setLoading(false);
}
}
public void onRender(Canvas canvas) {
player.drawDisplay(canvas);
exit.draw(canvas);
for(int i = 0; i < blocks.length; i++) {
blocks[i].draw(canvas);
}
title.draw(canvas);
title1.draw(canvas);
alpha.draw(canvas);
button.draw(canvas);
button1.draw(canvas);
button2.draw(canvas);
}
public void onUpdate() {
if(getNextScene() != 0) {
onChange();
}
if(player.getPosX() >= 313) {
float[] loc = {129,334};
player.setLocation(loc);
}
player.setPosX(player.getPosX()+1);
}
public void onListener(boolean touch,int x,int y) {
if(touch) {
if(button.checkTouch(x,y)) {
setNextScene(1);
}
if(button1.checkTouch(x,y)) {
setNextScene(2);
}
if(button2.checkTouch(x,y)) {
setNextScene(3);
}
}
}
public void setNextScene(int next) {
try {
sem.acquire(10);
this.nextScene = next;
} catch(InterruptedException e) {
System.err.println (e.getMessage());
} finally {
sem.release(10);
}
}
public int getNextScene() {
try {
sem.acquire();
return nextScene;
} catch(InterruptedException e) {
System.err.println (e.getMessage());
} finally {
sem.release();
}
return 0;
}
}
| [
"cfoce.dev@gmail.com"
] | cfoce.dev@gmail.com |
90118ab6fb8502c0a07822ac9cf42f0e5da32263 | c919f9c961fedbcf8ec5d77c433b78a2f9bf7308 | /src/main/java/org/mythtv/services/api/v027/status/beans/Miscellaneous.java | f57a233632d1c30db68038811f26543e1ef55c5c | [] | no_license | wsuetholz/MythTV-Service-API | 63639da2b5156b46f850c26b128732881271cb7d | 2c1a4e6ccd908b2d6a585c71c78e3212bac62f02 | refs/heads/master | 2020-04-06T06:51:13.573465 | 2014-02-24T15:28:22 | 2014-02-24T15:28:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | /**
*
*/
package org.mythtv.services.api.v027.status.beans;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;
import java.util.List;
/**
* @author Daniel Frey
*
*/
@Root( name = "Miscellaneous" )
public class Miscellaneous {
@ElementList( inline = true, required = false )
private List<Information> informations;
public Miscellaneous() { }
/**
* @return the informations
*/
public List<Information> getInformations() {
return informations;
}
/**
* @param informations the informations to set
*/
public void setInformations( List<Information> informations ) {
this.informations = informations;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append( "Miscellaneous [" );
if( informations != null ) {
builder.append( "informations=" );
builder.append( informations );
}
builder.append( "]" );
return builder.toString();
}
}
| [
"sebastien.astie@gmail.com"
] | sebastien.astie@gmail.com |
a290b904ca901b5a88418d4d4629aced356b4891 | 3a99acc67c7409484bc869c22afba857a0571cdb | /src/day19_sync2/Master.java | c0585ad3acd9648b10461b40ae27c106c374eca8 | [] | no_license | vincenttuan/JavaCourse0805 | 04bffcc50f0c6dc98b07b0e4be0b454f06481455 | 670e7a71717230bf4c45ee008ace94c0a8750f65 | refs/heads/master | 2020-09-12T11:49:01.252789 | 2019-11-18T13:37:06 | 2019-11-18T13:37:06 | 222,414,871 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | package day19_sync2;
public class Master extends Thread {
private Cookies cookies;
public Master(Cookies cookies) {
this.cookies = cookies;
}
@Override
public void run() {
for(int i=1;i<=10;i++) {
cookies.put(i);
}
}
}
| [
"teacher@192.168.2.14"
] | teacher@192.168.2.14 |
f5f313f083ab1c5cbed265d7297fbd8e108e264c | d67425c6f06e602df2041287e7fcd56b1c54bb07 | /LostBrainZZ/src/proy/interfaces/Showable.java | f9702eac04202885f62fe644e6bd0fe3c9ff1bab | [] | no_license | DanelArias-Dreyton257/Java-ProgII | 86bbdd13cc7ef55da43d65fa1f5a821c1705397f | b403567ef6264967d3d6a0ab30ee389b8d9ac715 | refs/heads/master | 2023-01-29T19:00:58.387743 | 2020-12-11T10:29:43 | 2020-12-11T10:29:43 | 320,538,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package proy.interfaces;
import proy.visuals.VentanaGrafica;
/**
*
* @author Danel
*
*/
public interface Showable {
/**
* Método que dibuja en el objeto VentanaGrafica el objeto
* @param v objeto VentanaGrafica
*/
public void show(VentanaGrafica v);
}
| [
"danel@DESKTOP-3DCJVBQ"
] | danel@DESKTOP-3DCJVBQ |
5d90f8db7dcad7e878a7ea701b727c378c40c6ac | 5a15d10a44ba030f3fb8ed1d631c5a81d8b9ed66 | /original/171/gen/com/example156/R.java | 2184bf1fd7466d5876b1820cfd04b60b9f417a03 | [] | no_license | kongxiangyue/sample_android | c0ae7ba0d5b2b7d0bae8168fd8aad72918f4d882 | ba63d80516754881212f2fd52b0e6d3a3a4091dc | refs/heads/master | 2020-03-26T13:06:46.378051 | 2018-08-30T08:57:22 | 2018-08-30T08:57:22 | 144,923,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example156;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int duke=0x7f020000;
public static final int icon=0x7f020001;
public static final int jpg1=0x7f020002;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;
}
}
| [
"513001363@qq.com"
] | 513001363@qq.com |
b2f867d0638c91fb0ed10add1bfba56aa74e6245 | cfb6372783ae07b9daeab23ab42c058ca764f060 | /src/main/java/net/alaarc/ast/nodes/stmts/AstAssertRcStmt.java | 7b13c8ab274dfbf4cb55170cb2bb1aa741be12cb | [
"Apache-2.0"
] | permissive | abreslav/alaarc | 272d1851f85533306c5a57475a8d6f18baa0d49f | 54d4f7b9b8a522b94bfb5e3c7fadbfdbc4495330 | refs/heads/master | 2020-12-11T05:55:14.193974 | 2015-05-04T20:28:13 | 2015-05-04T20:30:20 | 35,057,588 | 1 | 0 | null | 2015-05-04T20:25:58 | 2015-05-04T20:25:58 | null | UTF-8 | Java | false | false | 1,001 | java | package net.alaarc.ast.nodes.stmts;
import net.alaarc.ast.nodes.operators.AstComparisonOperator;
import net.alaarc.ast.IAstNodeVisitor;
import net.alaarc.ast.nodes.AstExpr;
import net.alaarc.ast.nodes.AstStmt;
/**
* @author dnpetrov
*/
public class AstAssertRcStmt extends AstStmt {
private final AstComparisonOperator operator;
private final long number;
private final AstExpr operand;
public AstAssertRcStmt(String sourceFileName, int lineNumber, AstExpr operand, AstComparisonOperator operator, long number) {
super(sourceFileName, lineNumber);
this.operand = operand;
this.operator = operator;
this.number = number;
}
public AstComparisonOperator getOperator() {
return operator;
}
public long getNumber() {
return number;
}
public AstExpr getOperand() {
return operand;
}
@Override
public void accept(IAstNodeVisitor visitor) {
visitor.visitAssertRcStmt(this);
}
}
| [
"dmitry.n.petrov@intel.com"
] | dmitry.n.petrov@intel.com |
793593e57f549732ec6ca61be26bf5d6ebf09325 | 4b477529849ed98580ae28aa1f73c52fd51da9c4 | /src/test/java/org/yota/automation/listeners/TestListener.java | b2ed35b7e60c3d310099a70d524cf6169998c8c5 | [] | no_license | denipotapov/slider-tests | 3bd47f2372585137f6aa863fa37950b162bc6761 | 60884b36635667015c1f7379be5758bfbc76b077 | refs/heads/master | 2021-06-01T05:08:01.628165 | 2016-06-06T13:18:00 | 2016-06-06T13:18:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package org.yota.automation.listeners;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
/**
* Created by Denis on 5/8/2016.
*/
public class TestListener implements ITestListener{
public void onTestStart(ITestResult var1) {}
public void onTestSuccess(ITestResult var1) {}
public void onTestFailure(ITestResult var1) {
log("Test " + var1.getName().toString() + " FAILED");
}
public void onTestSkipped(ITestResult var1) {}
public void onTestFailedButWithinSuccessPercentage(ITestResult var1) {}
public void onStart(ITestContext var1) {}
public void onFinish(ITestContext var1) {}
private void log (String par) {
System.out.println(par);
}
}
| [
"denipotapov@gmail.com"
] | denipotapov@gmail.com |
023c3262c62cb6dc6982daff47b5a33b7887a2f9 | 60d1d8c3fe15c70b086f40c7838167b090fda301 | /src/main/java/com/lr/response/BillingnameView.java | a06924c06fa50a27537cdf97355e5b020d873701 | [] | no_license | pmanonita/LRService | ec66284b0368012f8985a6e0292e94ed68d5b679 | 61baa1a361c911231c77e6d675754ea82aae3d28 | refs/heads/master | 2021-01-23T06:35:28.885354 | 2015-08-18T20:59:10 | 2015-08-18T20:59:10 | 38,620,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package com.lr.response;
public class BillingnameView {
private long id;
private String name;
private String address;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
| [
"pattanaik.manonita@gmail.com"
] | pattanaik.manonita@gmail.com |
8869d1766e7e1d28551c97572635053f021f704a | c6f8a9ae7ffc4e24c133fe8a695f0b9347922a80 | /src/com/ashok/codejam/cj20/qualification/ESAbATAd.java | 253833c8240a11ab1c9da1b79da756550e64a542 | [] | no_license | AshokRajpurohit/karani | 6c7d42946a56bf6cd18dc83635d130d34d814e89 | 9c80302d7857f7ecc369f358b85e072650beb088 | refs/heads/master | 2021-08-22T05:36:28.909089 | 2021-06-28T12:39:49 | 2021-06-28T12:39:49 | 61,425,311 | 4 | 7 | null | null | null | null | UTF-8 | Java | false | false | 9,779 | java | /*
* Copyright (c) 2015, 2099, Ashok and/or its affiliates. All rights reserved.
* ASHOK PROPRIETARY/CONFIDENTIAL. Use is subject to license terms, But you are free to use it :).
*
*/
package com.ashok.codejam.cj20.qualification;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
/**
* Problem Name:
* Link:
*
* @author Ashok Rajpurohit (ashok1113@gmail.com)
*/
public class ESAbATAd {
private static final PrintWriter out = new PrintWriter(System.out);
private static final InputReader in = new InputReader();
private static final String CASE = "Case #";
private static InterativeSystem interactiveSystem;
public static void main(String[] args) throws IOException {
interactiveSystem = new MockInteractiveSystem(in.readIntArray(in.readInt()));
solve();
in.close();
out.close();
}
private static void solve() throws IOException {
int t = in.readInt(), b = in.readInt();
for (int i = 1; i <= t; i++) {
if (!interactiveSystem.checkAnswer(process(b))) return;
}
}
private static String process(int bits) throws IOException {
int[] bitArray = new int[bits];
Arrays.fill(bitArray, -1);
if (bits <= 10) {
for (int i = 0; i < bits; i++) bitArray[i] = interactiveSystem.submitQuery(i + 1);
} else {
interact(bitArray);
}
StringBuilder sb = new StringBuilder();
for (int e : bitArray) sb.append(e);
return sb.toString();
}
private static void interact(int[] ar) throws IOException {
/**
* Lists containing indices, where values are same for all indices.
*/
List<Integer> zeroValueIndices = new ArrayList<>(); // same value even when the array is reversed, 0
List<Integer> oneValueIndices = new ArrayList<>(); // same value even when the array is reversed, 1
List<Integer> differentValueIndices = new ArrayList<>(); // different value when the array is reversed, 0<->1
int n = ar.length;
int queries = 1, index = 1, counterPart = n;
while (index <= counterPart) {
int iv = interactiveSystem.submitQuery(index);
queries++;
int cpv = interactiveSystem.submitQuery(counterPart);
queries++;
if (iv == cpv) {
if (iv == 0) {
zeroValueIndices.add(index);
} else {
oneValueIndices.add(index);
}
} else {
differentValueIndices.add(iv == 0 ? index : counterPart);
}
index++;
counterPart--;
if (queries % 10 == 1) { // time to reset list of indices.
int zv = 0, ov = 1, df = 0;
if (!zeroValueIndices.isEmpty()) {
zv = interactiveSystem.submitQuery(zeroValueIndices.get(0));
queries++;
}
if (zeroValueIndices.isEmpty() && !oneValueIndices.isEmpty()) {
ov = interactiveSystem.submitQuery(oneValueIndices.get(0));
queries++;
}
if (zv == 1 || ov == 0) {
List<Integer> temp = zeroValueIndices;
zeroValueIndices = oneValueIndices;
oneValueIndices = temp;
}
if (!differentValueIndices.isEmpty()) {
df = interactiveSystem.submitQuery(differentValueIndices.get(0));
queries++;
}
if (df == 1) {
List<Integer> temp = differentValueIndices.stream().map(v -> n + 1 - v).collect(Collectors.toList());
differentValueIndices = temp;
}
}
}
zeroValueIndices.stream().forEach(v -> ar[v - 1] = 0);
zeroValueIndices.stream().forEach(v -> ar[n - v] = 0);
oneValueIndices.stream().forEach(v -> ar[v - 1] = 1);
oneValueIndices.stream().forEach(v -> ar[n - v] = 1);
differentValueIndices.stream().forEach(v -> ar[v - 1] = 0);
differentValueIndices.stream().forEach(v -> ar[n - v] = 1);
}
interface InterativeSystem {
boolean checkAnswer(String answer) throws IOException;
int submitQuery(int n) throws IOException;
}
final static class DefaultInteractiveSystem implements InterativeSystem {
@Override
public boolean checkAnswer(String answer) throws IOException {
out.println(answer);
out.flush();
String result = in.read();
return result.equals("Y");
}
@Override
public int submitQuery(int n) throws IOException {
out.println(n);
out.flush();
return in.readInt();
}
}
final static class MockInteractiveSystem implements InterativeSystem {
private static final int flip = 0, reverse = 1, combo = 2, nothing = 3;
private final int[] bits;
private final Random random = new Random();
private int queryCount = 0;
MockInteractiveSystem(int[] bits) {
this.bits = bits.clone();
}
@Override
public boolean checkAnswer(String answer) throws IOException {
out.println("validating " + answer);
out.flush();
if (answer.length() != bits.length) return false;
char[] chars = answer.toCharArray();
for (int i = 0; i < chars.length; i++) {
int bit = chars[i] - '0';
if (bit != bits[i]) return false;
}
out.println("validation succeeded");
out.flush();
return true;
}
@Override
public int submitQuery(int n) throws IOException {
if (queryCount % 10 == 0) refresh();
queryCount++;
return bits[n - 1];
}
private void refresh() {
int op = random.nextInt(4);
switch (op) {
case flip:
toggle();
break;
case reverse:
reverse();
break;
case combo:
toggle();
reverse();
break;
}
}
private void toggle() {
for (int i = 0; i < bits.length; i++) {
bits[i] = 1 ^ bits[i];
}
}
private void reverse() {
for (int i = 0, j = bits.length - 1; i < j; i++, j--) {
int temp = bits[i];
bits[i] = bits[j];
bits[j] = temp;
}
}
}
private static class InputReader {
protected byte[] buffer = new byte[8192];
protected int offset = 0;
protected int bufferSize = 0;
InputStream in;
public InputReader() {
in = System.in;
}
public void close() throws IOException {
in.close();
}
public int readInt() throws IOException {
int number = 0;
int s = 1;
if (offset == bufferSize) {
offset = 0;
bufferSize = in.read(buffer);
}
if (bufferSize == -1)
throw new IOException("No new bytes");
for (; buffer[offset] < 0x30 || buffer[offset] == '-'; ++offset) {
if (buffer[offset] == '-')
s = -1;
if (offset == bufferSize - 1) {
offset = -1;
bufferSize = in.read(buffer);
}
}
for (; offset < bufferSize && buffer[offset] > 0x2f; ++offset) {
number = (number << 3) + (number << 1) + buffer[offset] - 0x30;
if (offset == bufferSize - 1) {
offset = -1;
bufferSize = in.read(buffer);
}
}
++offset;
return number * s;
}
public String read() throws IOException {
StringBuilder sb = new StringBuilder();
if (offset == bufferSize) {
offset = 0;
bufferSize = in.read(buffer);
}
if (bufferSize == -1 || bufferSize == 0)
throw new IOException("No new bytes");
for (;
buffer[offset] == ' ' || buffer[offset] == '\t' || buffer[offset] ==
'\n' || buffer[offset] == '\r'; ++offset) {
if (offset == bufferSize - 1) {
offset = -1;
bufferSize = in.read(buffer);
}
}
for (; offset < bufferSize; ++offset) {
if (buffer[offset] == ' ' || buffer[offset] == '\t' ||
buffer[offset] == '\n' || buffer[offset] == '\r')
break;
if (Character.isValidCodePoint(buffer[offset])) {
sb.appendCodePoint(buffer[offset]);
}
if (offset == bufferSize - 1) {
offset = -1;
bufferSize = in.read(buffer);
}
}
return sb.toString();
}
public int[] readIntArray(int n) throws IOException {
int[] ar = new int[n];
for (int i = 0; i < n; i++)
ar[i] = readInt();
return ar;
}
}
}
| [
"ashok1113@hotmail.com"
] | ashok1113@hotmail.com |
b284d8fa677d4897aaa10909f790274ff8df4b1c | 6491a8e3526760ebfc38c77594ea31e6936aa075 | /src/java/apollo/editor/AnnotationChangeEvent.java | 11d95643881353c1af2b01d30a433ac4322b31b1 | [
"BSD-3-Clause"
] | permissive | youngorchuang/apollo | 05b56d2f7113c4538e529c385770d2afdd08426a | a290c9297f113ce4cdc096aa55d504c7253342a5 | refs/heads/master | 2021-01-15T12:37:53.371735 | 2012-03-27T15:57:53 | 2012-03-27T15:57:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,405 | java | package apollo.editor;
import java.util.EventObject;
import java.util.Vector;
import apollo.datamodel.*;
import apollo.util.SeqFeatureUtil;
/**
* A controller managed event class which signals when a change is made to
* a set of annotations and what type of change occurred. Objects interested
* in listening for these event should implement the FeatureChangeListener
* interface and register with the controller.
Eventually I would like this to just be a carrier/wrapper for a transaction,
so it could/should just query transaction for everything. All of its fields are
really redundant of transactions.
*/
public class AnnotationChangeEvent extends FeatureChangeEvent {
private AnnotatedFeatureI annotFeature; // ????
private AnnotatedFeatureI deletedAnnot;
/** For subparts that are lists, like comments and synoyms we need to know which
item in the list is being operated on. FeatCngEv? */
private int subpartRank;
private String oldString;
private Comment deletedComment;
private String oldId;
private Transaction transaction;
private boolean isUndo;
/** Solely for edit session done event */
protected AnnotationChangeEvent(Object source) {
super(source);
}
void setUndo(boolean isUndo)
{
this.isUndo = isUndo;
}
public boolean isUndo()
{
return isUndo;
}
AnnotationChangeEvent(Transaction trans) {
super(trans.getSource(),trans.getAnnotatedFeature());
setTransaction(trans);
if (trans.hasSubpart())
setSubpart(trans.getSubpart());
}
/** No subpart */
protected AnnotationChangeEvent(Object source, AnnotatedFeatureI feature) {
super(source,feature);
}
/** With subpart */
protected AnnotationChangeEvent(Object source, AnnotatedFeatureI changedFeat,
TransactionSubpart subpart) {
super(source,changedFeat,subpart);
}
void setSource(Object source) {
super.source = source; // source is protected var in EventObject
}
void setTransaction(Transaction trans) {
this.transaction = trans;
}
boolean hasTransaction() {
return transaction != null;
}
Transaction getTransaction() {
return transaction;
}
public SeqFeatureI getParentFeature() {
if (super.parentFeature != null)
return parentFeature;
// get from delete transaction
if (hasTransaction() && getTransaction().getParentFeature() != null) {
return getTransaction().getParentFeature();
} else {
SeqFeatureI cf = getChangedFeature();
return (cf == null) ? null : cf.getRefFeature();
}
}
/** If compound event return # of child events, default 0 */
public int getNumberOfChildren() { return 0; }
/** Default is null. If compound event return ith chil event */
public AnnotationChangeEvent getChildChangeEvent(int i) { return null; }
/** If compound change event, add trans to compound transaction
AnnotationCompoundEvent overrides no-op */
public void addTransaction(Transaction trans) {}
public AnnotatedFeatureI getChangedAnnot() {
if (getChangedFeature() == null)// end of edit - is that right?
return null;
return getChangedFeature().getAnnotatedFeature();
}
public AnnotatedFeatureI getDeletedFeature() {
return deletedAnnot;
//return getTransaction().getDeletedFeature();
}
public void setDeletedFeature(AnnotatedFeatureI delFeat) {
this.deletedAnnot = delFeat;
}
/** rename get change top? annot top? should this return an AnnotatedFeatureI?
rename getAnnotRoot? */
public AnnotatedFeatureI getAnnotTop() {
// if change top explicitly set return it
if (super.getChangeTop() != null) // do we need this - delete?
return super.getChangeTop().getAnnotatedFeature();
if (getChangedAnnot() == null) //this is true of end of edit, or should there be
return null;
AnnotatedFeatureI annotTop = SeqFeatureUtil.getAnnotRoot(getChangedAnnot());
setChangeTop(annotTop);
return annotTop;
}
public SeqFeatureI getChangeTop() {
return getAnnotTop();
}
/** For subparts that are lists, like comments and synoyms we need to know which
item in the list is being operated on */
public void setSubpartRank(int rank) { this.subpartRank = rank; }
public int getSubpartRank() { return subpartRank; }
/** for updates(name...) and deletes(syn) to strings */
public void setOldString(String oldString) {
this.oldString = oldString;
}
public boolean isStringChange() {
return getOldString() != null;
}
public String getOldString() {
if (hasTransaction() && transaction.getSubpart().isString())
return (String)transaction.getOldSubpartValue();
return oldString;
}
/** For comment deletes */
public void setOldComment(Comment comment) {
deletedComment = comment;
}
public Comment getOldComment() {
return deletedComment;
}
public boolean isCommentChange() {
return getSubpart() == TransactionSubpart.COMMENT;
}
/** Set original id before update of parent changed it. */
public void setOldId(String oldId) {
this.oldId = oldId;
}
/** A parent update for transcripts will change the transcript id and make it
impossible to update the db. getOldId returns the original ID of the transcript
before changes. */
public String getOldId() {
if (hasTransaction())
return transaction.getOldId();
return this.oldId;
}
public String toString() {
if (hasTransaction())
return transaction.toString();
else
return super.toString(); // pase
}
}
// AnnotationUpdateEvent getUpdateEvent() ???
// static String asString(int changeSubType) {
// // NOTE: No breaks
// switch (changeSubType) {
// case COMMENT:
// return new String("COMMENT");
// //case EVIDENCE: return new String("EVIDENCE");
// case EXON:
// return new String("EXON");
// case TRANSLATION:
// return new String("TRANSLATION");
// case TRANSCRIPT:
// return new String("TRANSCRIPT");
// case ANNOTATION:
// return new String("ANNOTATION");
// case TYPE:
// return TransactionClass.TYPE.toString();
// default:
// return new String("UNKNOWN OBJECT CLASS (" + changeSubType + ")");
// }
// }
// public static int toNum(String changeSubType) {
// if (changeSubType.equals("COMMENT"))
// return COMMENT;
// //if (changeSubType.equals("EVIDENCE")) return EVIDENCE;
// if (changeSubType.equals("EXON"))
// return EXON;
// if (changeSubType.equals("TRANSLATION"))
// return TRANSLATION;
// if (changeSubType.equals("TRANSCRIPT"))
// return TRANSCRIPT;
// if (changeSubType.equals("ANNOTATION"))
// return ANNOTATION;
// else
// return -1; // unknown
// }
// /**
// * I think feature1 and feature2 are used differently for each type.
// * For deletions feature2 is the deleted feature and feature1 is the parent
// * of the deleted feature(feature2)
// For ADD feat1 is the feature being added to, feat2 is the feature being added.
// ADD EVIDENCE gene is top, transcript feat1, evidence feat2
// ADD TRANSCRIPT: top gene, feat1 gene, feat2 transcript
// ADD EXON: top gene, feat1 transcript, feat2 exon
// ADD GENE: top gene, feat1 geneHolder, feat2 gene
// phase this out
// */
// public AnnotationChangeEvent(Object source,
// SeqFeatureI changeTop,
// int operation,
// int objectClass,
// SeqFeatureI feature1,
// SeqFeatureI feature2) {
// super(source, changeTop, operation, /*objectClass,*/ feature1, feature2);
// //if (isTransactionOperation(operation))
// //transaction = new Transaction(this);
// }
// Replace these constants with TransactionClass
// public static final int COMMENT = 10; // subpart
// // i commented out evidence events - evidence is irrelevant
// //public static final int EVIDENCE = 11;
// // I dont think translation is a class
// public static final int TRANSLATION = 12; // subpartish
// public static final int EXON = 13;
// public static final int TRANSCRIPT = 14;
// ANNOTATION still used by AE - fix this
// public static final int ANNOTATION = 15;
/** This is controversial ground. Type is a part of one of the above objects.
Should there be another SubObjectClass? ObjectPart? i think so - for now
just shove here */
// public static final int TYPE = 16; // subpart
// public static AnnotationChangeEvent getSessionDoneEvent(Object source) {
// return new AnnotationChangeEvent(source);
// }
// private AnnotationChangeEvent(Object source, TransactionOperation op,
// AnnotatedFeatureI feat) {
// super(source,op,feat);
// }
// /** Constructor with no feature2(null) - phase out*/
// public AnnotationChangeEvent(Object source,SeqFeatureI changeTop,int operation,
// int objectClass,SeqFeatureI feature1) {
// this(source,changeTop,operation,objectClass,feature1,null);
// }
/** should be abstract? */
//void fireEvent(AnnotationChangeListener acl) {}
| [
"ssmith@genome.wustl.edu"
] | ssmith@genome.wustl.edu |
cfcd538f4d5f8c9373bf1b2c7c7d25b9587cca8c | 74b966cf026a0b9e2e1fc57dfb1be0f3a681c4c6 | /ContractManage/src/main/java/cn/com/kxcomm/contractmanage/dao/PurchaseOrderContractBillDAO.java | ceffbb0b4b13610ec7af03d607daaae708b38945 | [] | no_license | liveqmock/Projects | 6f75cdb7e59015aed3ad851619676c392ea7fdec | 0b416e76f38dd7f21062199f0dcf6f893e111eca | refs/heads/master | 2021-01-14T12:31:44.197040 | 2015-04-12T08:38:19 | 2015-04-12T08:38:19 | 33,808,969 | 0 | 0 | null | 2015-04-12T08:21:07 | 2015-04-12T08:21:07 | null | UTF-8 | Java | false | false | 2,215 | java | package cn.com.kxcomm.contractmanage.dao;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.Hibernate;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;
import cn.com.kxcomm.common.util.PageInfo;
import cn.com.kxcomm.contractmanage.entity.TbPurchaseOrderContractBill;
import cn.com.kxcomm.contractmanage.vo.PurchaseOrderContractBillVo;
@Repository
public class PurchaseOrderContractBillDAO extends CommonDAO<TbPurchaseOrderContractBill>{
private static final Logger log = Logger.getLogger(PurchaseOrderContractBillDAO.class);
/**
*
* 执行hql
* @author luj 新增日期:2013-3-14
* @param criteria 带查询条件的DetachedCriteria
* @param hql 执行的
* @return
*/
public List findByPage(String hql,PageInfo<PurchaseOrderContractBillVo> pageInfo ,Object ...objects){
Session sessionUse = this.getSession();
SQLQuery sq=sessionUse.createSQLQuery(hql);
int j=0;
for (int i = 0; i < objects.length; i++) {
log.debug("objects["+i+"]"+objects[i]);
if(null!=objects[i] && !"".equals(objects[i]) && -1!=Integer.parseInt(objects[i].toString())){
sq.setParameter(j, objects[i]);
j++;
}
}
if ((pageInfo.getCurrentPage() !=0 && pageInfo.getPageSize() !=0) ) {
sq.setFirstResult((pageInfo.getCurrentPage()-1)*pageInfo.getPageSize()).setMaxResults(pageInfo.getPageSize());
}
List lista = sq.list();
return lista;
}
/**
*
* 获取总记录数
* @author luj 新增日期:2013-3-14
* @param criteria 带查询条件的DetachedCriteria
* @param hql 执行的
* @return
*/
public int findCount(String countHql ,Object ...objects){
Session sessionUse = this.getSession();
SQLQuery sq = sessionUse.createSQLQuery(countHql);
int j=0;
for (int i = 0; i < objects.length; i++) {
log.debug("objects1["+i+"]"+objects[i]);
if(null!=objects[i] && !"".equals(objects[i]) && -1!=Integer.parseInt(objects[i].toString())){
sq.setParameter(j, objects[i]);
j++;
}
}
int count = (Integer) sq.addScalar("count", Hibernate.INTEGER).uniqueResult();
return count;
}
}
| [
"chenliang@kxcomm.com.cn"
] | chenliang@kxcomm.com.cn |
e0a4a42be3e5ca0f7bbf7abda49bfa82dabd3a24 | f0d8114ce6036e91c53296597773e7d10d31316b | /src/application/Controller.java | b65c8e15f5063ed6dd960effd800c1d7e16c060c | [] | no_license | RubenEscribanoMartin/appIntro | 511b94b990da34b3ebc00f188d86f301a79d6826 | fc3a0ea4ac5cecf57bf03fb7d772e088b96c390c | refs/heads/master | 2021-08-23T04:50:12.297102 | 2017-12-03T12:04:49 | 2017-12-03T12:04:49 | 112,380,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,900 | java | package application;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.animation.TranslateTransition;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.effect.GaussianBlur;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.util.Duration;
public class Controller implements Initializable {
@FXML
private AnchorPane pane1;
@FXML
private ImageView image1;
@FXML
private AnchorPane pane2;
@FXML
private ImageView image2;
@FXML
private AnchorPane pane3;
@FXML
private ImageView image3;
@FXML
private AnchorPane pane4;
@FXML
private ImageView image4;
@FXML
private Label countLabel;
public void translateAnimation(double duration, Node node, double byY) {
TranslateTransition translateTransition = new TranslateTransition(Duration.seconds(duration), node);
translateTransition.setByY(byY);
translateTransition.play();
}
@Override
public void initialize(URL location, ResourceBundle resources) {
translateAnimation(0.5, pane2, 615);
translateAnimation(0.5, pane3,615);
translateAnimation(0.5, pane4, 615);
}
int showSlide = 0;
@FXML
void nextAction(ActionEvent event) {
if (showSlide == 0) {
translateAnimation(0.7, pane2, -615);
showSlide++; // showSlide=1
countLabel.setText(" STEP 2/4");
} else if (showSlide == 1) {
translateAnimation(0.7, pane3, -615);
showSlide++; // showSlide=2
countLabel.setText("STEP 3/4");
} else if (showSlide == 2) {
translateAnimation(0.7, pane4, -615);
showSlide++; // showSlide=3
countLabel.setText("STEP 4/4");
} else {
System.out.println("No more slides");
}
}
@FXML
void backAction(ActionEvent event) {
if (showSlide == 0) {
System.out.println("No more slide");
} else if (showSlide == 1) {
translateAnimation(0.5, pane2, 615);
showSlide--; // showSlide=1
countLabel.setText("1/4");
} else if (showSlide == 2) {
translateAnimation(0.5, pane3, 615);
showSlide--; // showSlide=1
countLabel.setText("2/4");
} else if (showSlide == 3) {
translateAnimation(0.5, pane4, 615);
showSlide--; // showSlide=2
countLabel.setText("3/4");
}
}
@FXML
public void imageBlurON (){
image1.setEffect(new GaussianBlur(7));
image2.setEffect(new GaussianBlur(7));
image3.setEffect(new GaussianBlur(7));
image4.setEffect(new GaussianBlur(7));
}
@FXML
public void BlurOFF (){
image1.setEffect(new GaussianBlur(0));
image2.setEffect(new GaussianBlur(0));
image3.setEffect(new GaussianBlur(0));
image4.setEffect(new GaussianBlur(0));
}
@FXML
void buttonClose(ActionEvent event) {
System.exit(0);
}
}
| [
"escribanomartinruben@gmail.com"
] | escribanomartinruben@gmail.com |
6d6fae3919e012a3b6f0b1d618476a609b825f5d | 3ef55e152decb43bdd90e3de821ffea1a2ec8f75 | /large/module1501_public/tests/more/src/java/module1501_public_tests_more/a/Foo3.java | f95dce1e891354026870074e86b6a47895d762b1 | [
"BSD-3-Clause"
] | permissive | salesforce/bazel-ls-demo-project | 5cc6ef749d65d6626080f3a94239b6a509ef145a | 948ed278f87338edd7e40af68b8690ae4f73ebf0 | refs/heads/master | 2023-06-24T08:06:06.084651 | 2023-03-14T11:54:29 | 2023-03-14T11:54:29 | 241,489,944 | 0 | 5 | BSD-3-Clause | 2023-03-27T11:28:14 | 2020-02-18T23:30:47 | Java | UTF-8 | Java | false | false | 1,596 | java | package module1501_public_tests_more.a;
import java.beans.beancontext.*;
import java.io.*;
import java.rmi.*;
/**
* Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
* labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
* Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
*
* @see java.io.File
* @see java.rmi.Remote
* @see java.nio.file.FileStore
*/
@SuppressWarnings("all")
public abstract class Foo3<P> extends module1501_public_tests_more.a.Foo2<P> implements module1501_public_tests_more.a.IFoo3<P> {
java.sql.Array f0 = null;
java.util.logging.Filter f1 = null;
java.util.zip.Deflater f2 = null;
public P element;
public static Foo3 instance;
public static Foo3 getInstance() {
return instance;
}
public static <T> T create(java.util.List<T> input) {
return module1501_public_tests_more.a.Foo2.create(input);
}
public String getName() {
return module1501_public_tests_more.a.Foo2.getInstance().getName();
}
public void setName(String string) {
module1501_public_tests_more.a.Foo2.getInstance().setName(getName());
return;
}
public P get() {
return (P)module1501_public_tests_more.a.Foo2.getInstance().get();
}
public void set(Object element) {
this.element = (P)element;
module1501_public_tests_more.a.Foo2.getInstance().set(this.element);
}
public P call() throws Exception {
return (P)module1501_public_tests_more.a.Foo2.getInstance().call();
}
}
| [
"gwagenknecht@salesforce.com"
] | gwagenknecht@salesforce.com |
1149d8503158f8f29661eec6a580af85d690d7b9 | 3986a6251fee5b8d9f71031a790ca0972e5d74f9 | /app/src/main/java/com/codepath/apps/restclienttemplate/TweetsAdapter.java | e6da258b99e53e9a269e8731e4f44e1ec3ea4f0e | [
"Apache-2.0",
"MIT"
] | permissive | keerthanap24/SimpleTweet2 | fff6cc05ff488b47e60c86958ffacb12bd684112 | 33c7904fdda8943846bf28d0c3619dfa66ad431d | refs/heads/master | 2022-12-31T20:13:19.849851 | 2020-10-19T23:08:09 | 2020-10-19T23:08:09 | 305,533,081 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,103 | java | package com.codepath.apps.restclienttemplate;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.codepath.apps.restclienttemplate.models.Tweet;
import java.util.List;
public class TweetsAdapter extends RecyclerView.Adapter<TweetsAdapter.ViewHolder>{
Context context;
List<Tweet> tweets;
public TweetsAdapter(Context context, List<Tweet> tweets) {
this.context = context;
this.tweets = tweets;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.item_tweet, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
Tweet tweet = tweets.get(position);
holder.bind(tweet);
}
@Override
public int getItemCount() {
return tweets.size();
}
public void clear() {
tweets.clear();
notifyDataSetChanged();
}
public void addAll(List<Tweet> tweetList) {
tweets.addAll(tweetList);
notifyDataSetChanged();
}
public class ViewHolder extends RecyclerView.ViewHolder {
ImageView ivProfileImage;
TextView tvBody;
TextView tvScreenName;
public ViewHolder(@NonNull View itemView) {
super(itemView);
ivProfileImage = itemView.findViewById(R.id.ivProfileImage);
tvBody = itemView.findViewById(R.id.tvBody);
tvScreenName = itemView.findViewById(R.id.tvScreenName);
}
public void bind(Tweet tweet) {
tvBody.setText(tweet.body);
tvScreenName.setText(tweet.user.screenName);
Glide.with(context).load(tweet.user.profileImageUrl).into(ivProfileImage);
}
}
} | [
"kpullela24@gmail.com"
] | kpullela24@gmail.com |
c90beb0f053a61b36aca94b519a672102b4ca3b5 | c8473be1019a5142466dccc59b18cb94fc153e7f | /atomic-messages-kafka/src/main/java/org/atomsg/common/internal/AbstractSimpleConsumer.java | bcdeed6f8d7c47437455dc3987f298e7e348409b | [
"Apache-2.0"
] | permissive | chrisGerken/splittingAtomically | 1923e72a8efba36854a9d7b24b5b28211ed3a8e9 | 2c37d3a73eedae2dc76b065ce1001305048089c8 | refs/heads/master | 2021-01-19T14:34:13.183083 | 2015-07-22T14:23:16 | 2015-07-22T14:23:16 | 39,215,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,619 | java | package org.atomsg.common.internal;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import kafka.api.PartitionFetchInfo;
import kafka.api.PartitionOffsetRequestInfo;
import kafka.cluster.Broker;
import kafka.common.ErrorMapping;
import kafka.common.OffsetMetadataAndError;
import kafka.common.OffsetOutOfRangeException;
import kafka.common.TopicAndPartition;
import kafka.javaapi.FetchRequest;
import kafka.javaapi.FetchResponse;
import kafka.javaapi.OffsetCommitRequest;
import kafka.javaapi.OffsetFetchRequest;
import kafka.javaapi.OffsetFetchResponse;
import kafka.javaapi.OffsetRequest;
import kafka.javaapi.OffsetResponse;
import kafka.javaapi.PartitionMetadata;
import kafka.javaapi.TopicMetadata;
import kafka.javaapi.TopicMetadataRequest;
import kafka.javaapi.TopicMetadataResponse;
import kafka.javaapi.consumer.SimpleConsumer;
import kafka.javaapi.message.ByteBufferMessageSet;
import kafka.message.MessageAndOffset;
import kafka.network.RequestChannel.RequestLogger;
import org.atomsg.common.exception.*;
public class AbstractSimpleConsumer {
// List of brokers managing the topic's partitions
private List<String> replicaBrokers = new ArrayList<String>();
// List of (at least some of the) brokers (host:port) in the Kafka cluster
private List<String> seedBrokers = new ArrayList<String>();
// The topic from which to read
protected String topic;
// The partition of the topic from which to read
protected int partition;
// The name of the client group
private String groupName;
// How long to wait
private int timeout = 10000;
// Number of bytes to fetch
private int fetchSize = 100000;
// How many times to retry a fetch before failing
private int fetchRetries = 5;
private String clientName;
// An arbitrary string of data to be stored with partition offset
private String consumerMetadata = "";
private SimpleConsumer simpleConsumer = null;
private Broker leadBroker = null;
private MessageAndOffset nextMessageAndOffset = null;
// Offset of the first unread message (the next message to be read)
// This value advances as messages are read in preparation for fast return to a client
private Long firstUnread = null;
// Offset of the last returned message
// This value will only advance when a message is returned to a client and is used on close()
private Long nextOffsetToReturn = null;
// Iterator over messages retrieved by most recent fetch
private Iterator<MessageAndOffset> messageSetIterator;
// How long (milliseconds) to sleep if there are no messages in the partition
private long emptyWait = 1000;
// Force the consumer to start reading at the beginning of the partition
private boolean startAtBeginning = false;
// Force the consumer to start reading at the end of the partition
private boolean startAtEnd = false;
public AbstractSimpleConsumer(String csBrokerList, String topic, int partition, String groupName) {
this.seedBrokers = parse(csBrokerList);
this.topic = topic;
this.partition = partition;
this.groupName = groupName;
clientName = "Client_" + topic + "_" + partition;
// determineFirstUnread();
}
private List<String> parse(String csBrokerList) {
List<String> list = new ArrayList<String>();
StringTokenizer st = new StringTokenizer(csBrokerList, ", \t\n");
while (st.hasMoreTokens()) {
list.add(st.nextToken());
}
return list;
}
public boolean hasNext() {
if (nextMessageAndOffset == null) {
nextMessageAndOffset = nextMessage();
}
return nextMessageAndOffset != null;
}
protected MessageAndOffset nextMessage() {
for (int attempt = 0; attempt < fetchRetries; attempt++) {
try {
MessageAndOffset mao = nextMessage0();
return mao;
} catch (PartitionConsumerException e) {
}
}
return null;
}
private MessageAndOffset nextMessage0() throws PartitionConsumerException {
MessageAndOffset result = null;
if (nextMessageAndOffset != null) {
result = nextMessageAndOffset;
nextMessageAndOffset = null;
nextOffsetToReturn = result.nextOffset();
return result;
}
if ((messageSetIterator == null) || (!messageSetIterator.hasNext())) {
messageSetIterator = fetch();
if (!messageSetIterator.hasNext()) {
messageSetIterator = null;
try { Thread.sleep(emptyWait); } catch (Throwable t) { }
return null;
}
}
MessageAndOffset messageAndOffset = messageSetIterator.next();
long currentOffset = messageAndOffset.offset();
if (currentOffset < firstUnread) {
throw new OldMessageException("Found an old offset: " + currentOffset + " Expecting: " + firstUnread);
}
firstUnread = messageAndOffset.nextOffset();
nextOffsetToReturn = messageAndOffset.nextOffset();
return messageAndOffset;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private Iterator<MessageAndOffset> fetch() throws PartitionConsumerException {
if (firstUnread == null) {
determineFirstUnread();
}
Map<TopicAndPartition,PartitionFetchInfo> requestInfo = new HashMap<TopicAndPartition,PartitionFetchInfo>();
TopicAndPartition tap = new TopicAndPartition(topic,partition);
PartitionFetchInfo pfi = new PartitionFetchInfo(firstUnread, fetchSize);
requestInfo.put(tap,pfi);
FetchRequest fetchRequest = new FetchRequest(0, clientName, timeout, 1, requestInfo);
FetchResponse fetchResponse;
try {
fetchResponse = getSimpleConsumer().fetch(fetchRequest);
} catch (Exception e) {
return new ByteBufferMessageSet(new ArrayList()).iterator();
}
if (fetchResponse.hasError()) {
short code = fetchResponse.errorCode(topic, partition);
if (code == ErrorMapping.OffsetOutOfRangeCode()) {
// We asked for an invalid offset. For simple case ask for the last element to reset
firstUnread = retrieveOffset();
cleanConsumer();
throw new OffsetOutOfRangeException();
}
cleanConsumer();
throw new PartitionConsumerException("Error fetching data from the Broker:" + getLeadBroker() + " Reason: " + code);
}
ByteBufferMessageSet bbms = fetchResponse.messageSet(topic, partition);
return bbms.iterator();
}
private SimpleConsumer getSimpleConsumer() throws PartitionConsumerException {
if (simpleConsumer==null) {
simpleConsumer = new SimpleConsumer(getLeadBroker().host(), getLeadBroker().port(), timeout, 64 * 1024, clientName);
}
return simpleConsumer;
}
private void cleanConsumer() {
if (simpleConsumer!=null) {
simpleConsumer.close();
}
simpleConsumer = null;
// Force a search for a new lead broker
leadBroker = null;
}
public void close() throws PartitionConsumerException {
cleanConsumer();
if (nextOffsetToReturn!=null) {
commitOffset(nextOffsetToReturn);
}
}
private Broker getLeadBroker() throws PartitionConsumerException {
if (leadBroker==null) {
leadBroker = findNewLeadBroker();
}
return leadBroker;
}
private void determineFirstUnread() {
try {
long earliest = requestEarliestAvailableOffset();
long latest = requestLatestAvailableOffset();
if (startAtBeginning) {
// Flag was set forcing us back to the beginning of the partition
firstUnread = earliest;
} else if (startAtEnd) {
// Flag was set forcing us forward to the end (most recent message) of the partition
firstUnread = latest + 1;
} else {
// Look to see if we previously committed an offset for this partition
firstUnread = retrieveOffset();
if (firstUnread < earliest) {
firstUnread = earliest;
}
if (firstUnread > latest+1) {
firstUnread = latest+1;
}
}
} catch (PartitionConsumerException e) {
// gotta start somewhere
firstUnread = 0L;
}
}
/*
* Commits the given offset as being the offset of the next message to be read.
*/
private void commitOffset(long offset) throws PartitionConsumerException {
Map<TopicAndPartition, OffsetMetadataAndError> requestInfo = new HashMap<TopicAndPartition, OffsetMetadataAndError>();
TopicAndPartition topicAndPartition = new TopicAndPartition(topic, partition);
OffsetMetadataAndError omae = new OffsetMetadataAndError(offset, consumerMetadata, ErrorMapping.NoError());
requestInfo.put(topicAndPartition, omae);
OffsetCommitRequest request = new OffsetCommitRequest(groupName, requestInfo, (short) 0, 0, clientName);
getSimpleConsumer().commitOffsets(request);
}
/*
* Retrieves the previously committed offset. If no offset has been committed, yet, a -1 is returned.
*/
public long retrieveOffset() throws PartitionConsumerException {
List<TopicAndPartition> requestInfo = new ArrayList<TopicAndPartition>();
TopicAndPartition topicAndPartition = new TopicAndPartition(topic, partition);
requestInfo.add(topicAndPartition);
OffsetFetchRequest request = new OffsetFetchRequest(groupName, requestInfo, (short) 0, 0, clientName);
OffsetFetchResponse response = getSimpleConsumer().fetchOffsets(request);
Map<TopicAndPartition, OffsetMetadataAndError> offsets = response.offsets();
OffsetMetadataAndError omae = offsets.get(new TopicAndPartition(topic, partition));
return omae.offset();
}
public long requestEarliestAvailableOffset() throws PartitionConsumerException {
return requestOffset(-2);
}
public long requestLatestAvailableOffset() throws PartitionConsumerException {
return requestOffset(-1);
}
/*
* Request the offset for the current partition:
* time = -1 returns the latest offset
* time = -2 returns the earliest available offset
*/
private long requestOffset(long time) throws PartitionConsumerException {
TopicAndPartition topicAndPartition = new TopicAndPartition(topic, partition);
Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo = new HashMap<TopicAndPartition, PartitionOffsetRequestInfo>();
requestInfo.put(topicAndPartition, new PartitionOffsetRequestInfo(time, 1));
OffsetRequest request = new OffsetRequest(requestInfo, (short)0, clientName);
OffsetResponse response = getSimpleConsumer().getOffsetsBefore(request);
if (response.hasError()) {
throw new PartitionConsumerException("Error fetching data Offset Data the Broker. Reason: " + response.errorCode(topic, partition));
}
long[] offsets = response.offsets(topic, partition);
return offsets[0];
}
public TopicMetadata getMetaData() throws PartitionConsumerException {
for (String seed : seedBrokers) {
SimpleConsumer consumer = null;
try {
consumer = new SimpleConsumer(hostFrom(seed), portFrom(seed), timeout, 64 * 1024, "leaderLookup");
List<String> topics = Collections.singletonList(topic);
TopicMetadataRequest req = new TopicMetadataRequest(topics);
TopicMetadataResponse resp = consumer.send(req);
List<TopicMetadata> metaData = resp.topicsMetadata();
return metaData.get(0);
} catch (Exception e) {
throw new PartitionConsumerException("Error communicating with Broker ('" + seed + "') to find meta data for topic ('"+topic+"')",e);
} finally {
if (consumer != null) consumer.close();
}
}
throw new PartitionConsumerException("Can't find metadata for topic ('"+topic+"') and partition ("+partition+")");
}
private int portFrom(String seed) {
int index = seed.indexOf(":");
if (index == -1) { return 9092; }
try {
return Integer.parseInt(seed.substring(index+1));
} catch (NumberFormatException e) {
}
return 9092;
}
private String hostFrom(String seed) {
int index = seed.indexOf(":");
if (index == -1) { return seed; }
return seed.substring(0,index);
}
private Broker findNewLeadBroker() throws PartitionConsumerException {
for (String seed : seedBrokers) {
SimpleConsumer consumer = null;
try {
consumer = new SimpleConsumer(hostFrom(seed), portFrom(seed), timeout, 64 * 1024, "leaderLookup");
List<String> topics = Collections.singletonList(topic);
TopicMetadataRequest req = new TopicMetadataRequest(topics);
TopicMetadataResponse resp = consumer.send(req);
List<TopicMetadata> metaData = resp.topicsMetadata();
for (TopicMetadata item : metaData) {
for (PartitionMetadata part : item.partitionsMetadata()) {
if (part.partitionId() == partition) {
replicaBrokers.clear();
for (kafka.cluster.Broker replica : part.replicas()) {
replicaBrokers.add(replica.host());
}
if (part.leader() == null) {
throw new PartitionConsumerException("Can't find leader for topic ('"+topic+"') and partition ("+partition+")");
}
return part.leader();
}
}
}
} catch (Exception e) {
throw new PartitionConsumerException("Error communicating with Broker ('" + seed + "') to find Leader for topic ('"+topic+"') and partition ("+partition+")",e);
} finally {
if (consumer != null) consumer.close();
}
}
throw new PartitionConsumerException("Can't find metadata for topic ('"+topic+"') and partition ("+partition+")");
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public void setTimeout(String timeout) {
if (timeout==null) { return; }
this.timeout = Integer.parseInt(timeout);
}
public void setFetchSize(int fetchSize) {
this.fetchSize = fetchSize;
}
public void setFetchSize(String fetchSize) {
if (fetchSize==null) { return; }
this.fetchSize = Integer.parseInt(fetchSize);
}
public void setFetchRetries(int fetchRetries) {
this.fetchRetries = fetchRetries;
}
public void setFetchRetries(String fetchRetries) {
if (fetchRetries==null) { return; }
this.fetchRetries = Integer.parseInt(fetchRetries);
}
public void setEmptyWait(long emptyWait) {
this.emptyWait = emptyWait;
}
public void setEmptyWait(String emptyWait) {
if (emptyWait==null) { return; }
this.emptyWait = Long.parseLong(emptyWait);
}
public void setStartAtBeginning(boolean startAtBeginning) {
this.startAtBeginning = startAtBeginning;
}
public void setStartAtBeginning(String startAtBeginning) {
if (startAtBeginning==null) { return; }
this.startAtBeginning = Boolean.parseBoolean(startAtBeginning);
}
public void setStartAtEnd(boolean startAtEnd) {
this.startAtEnd = startAtEnd;
}
public void setStartAtEnd(String startAtEnd) {
if (startAtEnd==null) { return; }
this.startAtEnd = Boolean.parseBoolean(startAtEnd);
}
}
| [
"chris.gerken@gerkenip.com"
] | chris.gerken@gerkenip.com |
f7af152156bd7d330118113cd541eaa7648bd0a0 | 4e678f6967745c3da2a3e8899204e34d99fc3be0 | /flipping-the-matrix/Solution.java | 78c0800e0b2cdc5222a048baecbdec92fb8e6821 | [] | no_license | pratikshah1701/hackerrank | bf689a583b462c0fde697abd536ae0638d14ced9 | 73fde2a0d9dc063e1c06d42f0572ce01f5dd04b9 | refs/heads/master | 2021-01-19T18:47:15.278811 | 2017-04-13T09:16:27 | 2017-04-13T09:16:27 | 88,381,516 | 1 | 1 | null | 2017-04-16T00:20:00 | 2017-04-16T00:20:00 | null | UTF-8 | Java | false | false | 811 | java | import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int q = sc.nextInt();
for (int tc = 0; tc < q; tc++) {
int n = sc.nextInt();
int[][] matrix = new int[n * 2][n * 2];
for (int r = 0; r < matrix.length; r++) {
for (int c = 0; c < matrix[0].length; c++) {
matrix[r][c] = sc.nextInt();
}
}
System.out.println(solve(matrix));
}
sc.close();
}
static int solve(int[][] matrix) {
int size = matrix.length;
int n = size / 2;
int result = 0;
for (int r = 0; r < n; r++) {
for (int c = 0; c < n; c++) {
result += Math.max(Math.max(matrix[r][c], matrix[size - 1 - r][c]),
Math.max(matrix[r][size - 1 - c], matrix[size - 1 - r][size - 1 - c]));
}
}
return result;
}
}
| [
"charles.wangkai@gmail.com"
] | charles.wangkai@gmail.com |
ae77a6b0dc8d7f1303e40a9e88168c05d7e86c47 | a4a9a1de350b16fafc83740df5a8d449cbd185c3 | /StandOutExample/src/com/summerlab/chords/main/Artist.java | b0502712e4fc20abfe13beca06a5aada66e7aa3e | [] | no_license | daotronghieu251192/mobile-projects | 9488132705c0d18e58bf64d7090d692aca154292 | cb3a85340eb205ef348b4c22c50944414e97b840 | refs/heads/master | 2021-01-19T23:33:59.897802 | 2017-04-24T08:50:23 | 2017-04-24T08:50:23 | 88,998,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package com.summerlab.chords.main;
public class Artist {
private int artistID;
private String _name;
private String _asciiName;
public Artist(int id, String name, String asciiName)
{
this.artistID = id;
this._name = name;
this._asciiName = asciiName;
}
public int getID()
{
return this.artistID;
}
public String getName()
{
return this._name;
}
public String getAsciiName()
{
return this._asciiName;
}
}
| [
"daotronghieu251192@gmail.com"
] | daotronghieu251192@gmail.com |
964169cb25420d1a0cb58c3f3e846efd343bf915 | a077485c93f02429e7ad4207235170da21d879e9 | /src/test/java/com/lingshou/supply/contract/package-info.java | 0d19c0ea63ca3fc6ef68e8b208fdf64bba2bbed4 | [] | no_license | Cathy-yunli/supply-core | ab2dd9ef721b082d3d4750cdb22534cb1c57041a | 1c987eb73681267ba7a695fe549c29084c06bf71 | refs/heads/master | 2020-03-27T01:02:06.889432 | 2018-08-22T08:09:40 | 2018-08-22T08:09:40 | 145,675,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 37 | java | package com.lingshou.supply.contract; | [
"wenyunli2028@163.com"
] | wenyunli2028@163.com |
36978dda7a36a5e195fb811150ce6adfce83827f | bc4b753277ea4b87be28cca153e0f9c5c1389080 | /src/main/java/eu/javaspecialists/tjsn/gui/lambda/samples/facade/componentpallet/ComponentPallet.java | fa8c5a78a16142cb5b3f4fdd3a0ea836a7feeb1f | [
"Apache-2.0"
] | permissive | kabutz/javaspecialists-awt-event-mixins | b4e783ec4c509cbb01312aa0aa081809ed0efe97 | 3de48ed88c93c33480f50ea3b446d5bfcd85bc76 | refs/heads/master | 2022-02-26T03:00:29.524004 | 2022-01-26T13:42:21 | 2022-01-26T13:42:21 | 17,369,406 | 7 | 4 | null | null | null | null | UTF-8 | Java | false | false | 4,769 | java | /*
* Copyright (C) 2000-2014 Heinz Max Kabutz
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership. Heinz Max Kabutz 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 eu.javaspecialists.tjsn.gui.lambda.samples.facade.componentpallet;
import eu.javaspecialists.tjsn.gui.lambda.facade.*;
import javax.swing.*;
import java.awt.*;
public class ComponentPallet extends JFrame {
public ComponentPallet() {
super("ComponentPallet");
setLayout(new GridLayout(0, 3));
JLabel label = new JLabel("New Improved Label");
addListeners(label);
add(label);
JTree tree = new JTree();
addListeners(tree);
addTreeListeners(tree);
add(tree);
JButton button = new JButton("Cool Button");
addListeners(button);
addButtonListeners(button);
JPanel buttonPanel = new JPanel();
buttonPanel.add(button);
add(buttonPanel);
JTextField textField = new JTextField("some text");
addListeners(textField);
JPanel textFieldPanel = new JPanel();
textFieldPanel.add(textField);
add(textFieldPanel);
JCheckBox checkBox = new JCheckBox("Are you Happy?");
addListeners(checkBox);
addButtonListeners(checkBox);
add(checkBox);
JComboBox<String> comboBox = new JComboBox<>(
new String[]{"option1", "option2", "option3"});
addListeners(comboBox);
add(comboBox);
JTable table = new JTable(
new Object[][]{{"1", "2", "3"}, {"apples", "oranges", "pears"}},
new Object[]{"col1", "col2", "col3"});
addListeners(table);
add(new JScrollPane(table));
JTextArea textArea = new JTextArea("Hey\nthere\nsport", 3, 4);
addListeners(textArea);
add(textArea);
}
private void addButtonListeners(AbstractButton c) {
c.addActionListener(e -> show(c, "action happened", e));
c.addChangeListener(e -> show(c, "change happened", e));
c.addItemListener(e -> show(c, "item happened", e));
}
private void addTreeListeners(JTree c) {
c.addTreeSelectionListener(e -> show(c, "item selected", e));
c.addTreeWillExpandListener(TreeWillExpandListeners.forTreeWillExpand(e -> show(c, "tree /will/ expand", e)));
c.addTreeWillExpandListener(TreeWillExpandListeners.forTreeWillCollapse(e -> show(c, "tree /will/ collapse", e)));
c.addTreeExpansionListener(TreeExpansionListeners.forTreeExpanded(e -> show(c, "tree expanded", e)));
c.addTreeExpansionListener(TreeExpansionListeners.forTreeCollapsed(e -> show(c, "tree collapsed", e)));
}
private void addListeners(JComponent c) {
c.addFocusListener(FocusListeners.forFocusGainedListener(e -> show(c, "gained focus", e)));
c.addFocusListener(FocusListeners.forFocusLostListener(e -> show(c, "lost focus", e)));
c.addMouseListener(MouseListeners.forMouseClicked(e -> show(c, "mouse clicked", e)));
c.addMouseListener(MouseListeners.forMouseEntered(e -> show(c, "mouse entered", e)));
c.addMouseListener(MouseListeners.forMouseExited(e -> show(c, "mouse exited", e)));
c.addMouseListener(MouseListeners.forMousePressed(e -> show(c, "mouse pressed", e)));
c.addMouseListener(MouseListeners.forMouseReleased(e -> show(c, "mouse released", e)));
c.addKeyListener(KeyListeners.forKeyPressedListener(e -> show(c, "key pressed", e)));
c.addKeyListener(KeyListeners.forKeyReleasedListener(e -> show(c, "key released", e)));
c.addKeyListener(KeyListeners.forKeyTypedListener(e -> show(c, "key typed", e)));
}
private void show(Object component, String what, Object event) {
System.out.printf("%s %s : %s%n", component.getClass().getSimpleName(),
what, event);
}
public static void main(String... args) {
SwingUtilities.invokeLater(() -> {
ComponentPallet calc =
new ComponentPallet();
calc.setSize(400, 300);
calc.setVisible(true);
calc.setDefaultCloseOperation(EXIT_ON_CLOSE);
});
}
} | [
"heinz@javaspecialists.eu"
] | heinz@javaspecialists.eu |
6649f9e24559b9a0562cffec3c98fe2b8dd5a26a | e667164db5558f7793e7ffb66e9bb3428a373cfd | /webService_Quick/src/example/HelloWorld.java | 61613e5ce8e4fd8aeacf47f21b288d494400c374 | [] | no_license | LUSHULIN/webservice | bfc0eca865ac9089133d52b9dae33433bc91b067 | bfdd8c507db70ea0962276c0832a46b6a5131835 | refs/heads/master | 2022-09-22T21:52:44.273192 | 2020-05-28T03:29:13 | 2020-05-28T03:29:13 | 267,483,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package example;
public class HelloWorld {
public double add(double a, double b) {
return a + b;
}
public double minus(double a, double b) {
return a - b;
}
public double multiply(double a, double b) {
return a * b;
}
public double divide(double a, double b) {
return a / b;
}
public double power(double a) {
return a*a;
}
public double sqrt(double a) {
if (a < 0) {
System.out.println("开方数要大于0");
return 0;
} else {
return Math.sqrt(a);
}
}
}
| [
"java_lin@163.com"
] | java_lin@163.com |
588f063b673a0386755dec518dd6301fa9ce0678 | dbf9c17bcd62379e736cc652ae96b4c318eb14b0 | /MyAuthServer/src/main/java/com/prokarma/auth/controller/RegistrationController.java | a8f4f710cf24bca0c3a1e4e67af270ad9edf688b | [] | no_license | sweinhart-pk/my-oauth-demo | 07785b7c65dde9a732eb072e727ef25846d51a2a | 2ebdad41b690f893baa0aa309011f32a623b4d7f | refs/heads/master | 2021-06-23T15:55:28.296212 | 2019-11-06T18:45:00 | 2019-11-06T18:45:00 | 220,059,252 | 0 | 0 | null | 2021-06-04T02:18:04 | 2019-11-06T18:05:34 | Java | UTF-8 | Java | false | false | 10,961 | java | package com.prokarma.auth.controller;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import java.util.stream.Collectors;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.MessageSource;
import org.springframework.core.env.Environment;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.prokarma.auth.persistence.model.Privilege;
import com.prokarma.auth.persistence.model.User;
import com.prokarma.auth.persistence.model.VerificationToken;
import com.prokarma.auth.registration.OnRegistrationCompleteEvent;
import com.prokarma.auth.security.ISecurityUserService;
import com.prokarma.auth.service.IUserService;
import com.prokarma.auth.web.dto.PasswordDto;
import com.prokarma.auth.web.dto.UserDto;
import com.prokarma.auth.web.error.InvalidOldPasswordException;
import com.prokarma.auth.web.util.GenericResponse;
@Controller
public class RegistrationController {
private final Logger LOGGER = LoggerFactory.getLogger(getClass());
@Autowired
private IUserService userService;
@Autowired
private ISecurityUserService securityUserService;
@Autowired
private MessageSource messages;
@Autowired
private JavaMailSender mailSender;
@Autowired
private ApplicationEventPublisher eventPublisher;
@Autowired
private Environment env;
@Autowired
private AuthenticationManager authenticationManager;
public RegistrationController() {
super();
}
// Registration
@RequestMapping(value = "/user/registration", method = RequestMethod.POST)
@ResponseBody
public GenericResponse registerUserAccount(@Valid final UserDto accountDto, final HttpServletRequest request) {
LOGGER.debug("Registering user account with information: {}", accountDto);
final User registered = userService.registerNewUserAccount(accountDto);
eventPublisher.publishEvent(new OnRegistrationCompleteEvent(registered, request.getLocale(), getAppUrl(request)));
return new GenericResponse("success");
}
@RequestMapping(value = "/registrationConfirm", method = RequestMethod.GET)
public String confirmRegistration(final HttpServletRequest request, final Model model, @RequestParam("token") final String token) throws UnsupportedEncodingException {
Locale locale = request.getLocale();
final String result = userService.validateVerificationToken(token);
if (result.equals("valid")) {
final User user = userService.getUser(token);
if (user.isUsing2FA()) {
model.addAttribute("qr", userService.generateQRUrl(user));
return "redirect:/qrcode.html?lang=" + locale.getLanguage();
}
authWithoutPassword(user);
model.addAttribute("message", messages.getMessage("message.accountVerified", null, locale));
return "redirect:/console.html?lang=" + locale.getLanguage();
}
model.addAttribute("message", messages.getMessage("auth.message." + result, null, locale));
model.addAttribute("expired", "expired".equals(result));
model.addAttribute("token", token);
return "redirect:/badUser.html?lang=" + locale.getLanguage();
}
// user activation - verification
@RequestMapping(value = "/user/resendRegistrationToken", method = RequestMethod.GET)
@ResponseBody
public GenericResponse resendRegistrationToken(final HttpServletRequest request, @RequestParam("token") final String existingToken) {
final VerificationToken newToken = userService.generateNewVerificationToken(existingToken);
final User user = userService.getUser(newToken.getToken());
mailSender.send(constructResendVerificationTokenEmail(getAppUrl(request), request.getLocale(), newToken, user));
return new GenericResponse(messages.getMessage("message.resendToken", null, request.getLocale()));
}
// Reset password
@RequestMapping(value = "/user/resetPassword", method = RequestMethod.POST)
@ResponseBody
public GenericResponse resetPassword(final HttpServletRequest request, @RequestParam("email") final String userEmail) {
final User user = userService.findUserByEmail(userEmail);
if (user != null) {
final String token = UUID.randomUUID().toString();
userService.createPasswordResetTokenForUser(user, token);
mailSender.send(constructResetTokenEmail(getAppUrl(request), request.getLocale(), token, user));
}
return new GenericResponse(messages.getMessage("message.resetPasswordEmail", null, request.getLocale()));
}
@RequestMapping(value = "/user/changePassword", method = RequestMethod.GET)
public String showChangePasswordPage(final Locale locale, final Model model, @RequestParam("id") final long id, @RequestParam("token") final String token) {
final String result = securityUserService.validatePasswordResetToken(id, token);
if (result != null) {
model.addAttribute("message", messages.getMessage("auth.message." + result, null, locale));
return "redirect:/login?lang=" + locale.getLanguage();
}
return "redirect:/updatePassword.html?lang=" + locale.getLanguage();
}
@RequestMapping(value = "/user/savePassword", method = RequestMethod.POST)
@ResponseBody
public GenericResponse savePassword(final Locale locale, @Valid PasswordDto passwordDto) {
final User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
userService.changeUserPassword(user, passwordDto.getNewPassword());
return new GenericResponse(messages.getMessage("message.resetPasswordSuc", null, locale));
}
// change user password
@RequestMapping(value = "/user/updatePassword", method = RequestMethod.POST)
@ResponseBody
public GenericResponse changeUserPassword(final Locale locale, @Valid PasswordDto passwordDto) {
final User user = userService.findUserByEmail(((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getEmail());
if (!userService.checkIfValidOldPassword(user, passwordDto.getOldPassword())) {
throw new InvalidOldPasswordException();
}
userService.changeUserPassword(user, passwordDto.getNewPassword());
return new GenericResponse(messages.getMessage("message.updatePasswordSuc", null, locale));
}
@RequestMapping(value = "/user/update/2fa", method = RequestMethod.POST)
@ResponseBody
public GenericResponse modifyUser2FA(@RequestParam("use2FA") final boolean use2FA) throws UnsupportedEncodingException {
final User user = userService.updateUser2FA(use2FA);
if (use2FA) {
return new GenericResponse(userService.generateQRUrl(user));
}
return null;
}
// ============== NON-API ============
private SimpleMailMessage constructResendVerificationTokenEmail(final String contextPath, final Locale locale, final VerificationToken newToken, final User user) {
final String confirmationUrl = contextPath + "/registrationConfirm.html?token=" + newToken.getToken();
final String message = messages.getMessage("message.resendToken", null, locale);
return constructEmail("Resend Registration Token", message + " \r\n" + confirmationUrl, user);
}
private SimpleMailMessage constructResetTokenEmail(final String contextPath, final Locale locale, final String token, final User user) {
final String url = contextPath + "/user/changePassword?id=" + user.getId() + "&token=" + token;
final String message = messages.getMessage("message.resetPassword", null, locale);
return constructEmail("Reset Password", message + " \r\n" + url, user);
}
private SimpleMailMessage constructEmail(String subject, String body, User user) {
final SimpleMailMessage email = new SimpleMailMessage();
email.setSubject(subject);
email.setText(body);
email.setTo(user.getEmail());
email.setFrom(env.getProperty("support.email"));
return email;
}
private String getAppUrl(HttpServletRequest request) {
return "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
}
public void authWithHttpServletRequest(HttpServletRequest request, String username, String password) {
try {
request.login(username, password);
} catch (ServletException e) {
LOGGER.error("Error while login ", e);
}
}
public void authWithAuthManager(HttpServletRequest request, String username, String password) {
UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(username, password);
authToken.setDetails(new WebAuthenticationDetails(request));
Authentication authentication = authenticationManager.authenticate(authToken);
SecurityContextHolder.getContext().setAuthentication(authentication);
// request.getSession().setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, SecurityContextHolder.getContext());
}
public void authWithoutPassword(User user) {
List<Privilege> privileges = user.getRoles().stream().map(role -> role.getPrivileges()).flatMap(list -> list.stream()).distinct().collect(Collectors.toList());
List<GrantedAuthority> authorities = privileges.stream().map(p -> new SimpleGrantedAuthority(p.getName())).collect(Collectors.toList());
Authentication authentication = new UsernamePasswordAuthenticationToken(user, null, authorities);
SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
| [
"sweinhart@sweinhart-pk"
] | sweinhart@sweinhart-pk |
2a9564a80c79d9fb9071c16b7d02363c75ae05f9 | 98a7149a1a0cb95fcd53613d97b261c594e70bb7 | /apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/springsecurity/ApolloPasswordEncoderFactory.java | e4948bfe4750cbc0fcad7f4b78ee525ce235f6d6 | [
"Apache-2.0"
] | permissive | totalo/apollo | b978f3927461c76ba893d055b4e6439ae43de2c0 | e1636d425c010b75d85174fec0f1369e7c3a912b | refs/heads/master | 2023-03-15T23:37:18.988392 | 2022-09-18T09:10:02 | 2022-09-18T09:10:02 | 178,846,627 | 2 | 0 | Apache-2.0 | 2019-04-01T11:14:16 | 2019-04-01T11:14:15 | null | UTF-8 | Java | false | false | 3,586 | java | /*
* Copyright 2022 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.spi.springsecurity;
import com.ctrip.framework.apollo.portal.spi.oidc.PlaceholderPasswordEncoder;
import java.util.HashMap;
import java.util.Map;
import org.springframework.security.crypto.argon2.Argon2PasswordEncoder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.DelegatingPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder;
import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder;
/**
* @author vdisk <vdisk@foxmail.com>
*/
public final class ApolloPasswordEncoderFactory {
private ApolloPasswordEncoderFactory() {
}
/**
* Creates a {@link DelegatingPasswordEncoder} with default mappings {@link
* PasswordEncoderFactories#createDelegatingPasswordEncoder()}, and add a placeholder encoder for
* oidc {@link PlaceholderPasswordEncoder}
*
* @return the {@link PasswordEncoder} to use
*/
@SuppressWarnings("deprecation")
public static PasswordEncoder createDelegatingPasswordEncoder() {
// copy from PasswordEncoderFactories, and it's should follow the upgrade of the PasswordEncoderFactories
String encodingId = "bcrypt";
Map<String, PasswordEncoder> encoders = new HashMap<>();
encoders.put(encodingId, new BCryptPasswordEncoder());
encoders.put("ldap", new org.springframework.security.crypto.password.LdapShaPasswordEncoder());
encoders.put("MD4", new org.springframework.security.crypto.password.Md4PasswordEncoder());
encoders.put("MD5",
new org.springframework.security.crypto.password.MessageDigestPasswordEncoder("MD5"));
encoders.put("noop",
org.springframework.security.crypto.password.NoOpPasswordEncoder.getInstance());
encoders.put("pbkdf2", new Pbkdf2PasswordEncoder());
encoders.put("scrypt", new SCryptPasswordEncoder());
encoders.put("SHA-1",
new org.springframework.security.crypto.password.MessageDigestPasswordEncoder("SHA-1"));
encoders.put("SHA-256",
new org.springframework.security.crypto.password.MessageDigestPasswordEncoder("SHA-256"));
encoders
.put("sha256", new org.springframework.security.crypto.password.StandardPasswordEncoder());
encoders.put("argon2", new Argon2PasswordEncoder());
// placeholder encoder for oidc
encoders.put(PlaceholderPasswordEncoder.ENCODING_ID, new PlaceholderPasswordEncoder());
DelegatingPasswordEncoder delegatingPasswordEncoder = new DelegatingPasswordEncoder(encodingId,
encoders);
// todo: adapt the old password, and it should be removed in the next feature version of the 1.9.x
delegatingPasswordEncoder.setDefaultPasswordEncoderForMatches(new PasswordEncoderAdapter(encoders.get(encodingId)));
return delegatingPasswordEncoder;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
90a2a91d81c321da9d46d43a7e6f90b63bdf8102 | a03d5380e5650cc193b859047f0f9090515d6492 | /David_Diaz_Examen_1/src/david_diaz_examen_1/Proyecto.java | a1ae907cd3a81ae2322acad08702137d6e754aa7 | [] | no_license | guillendiazd/Lab_5 | ff2ab71c3b61417795a9b2bfd4487996338c2460 | 76d581cbff1bbd07b2b7d6bdd2000f92d2a8902c | refs/heads/master | 2021-01-21T15:18:40.166803 | 2017-05-20T00:18:46 | 2017-05-20T00:18:46 | 91,838,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,142 | java | package david_diaz_examen_1;
import java.util.ArrayList;
public class Proyecto {
private String nombre;
private ArrayList<Archivo> archivos = new ArrayList();
private ArrayList<Usuario> usuarios = new ArrayList();
private int commit;
public Proyecto() {
}
public Proyecto(String nombre) {
this.nombre = nombre;
}
public Proyecto(int commit) {
this.commit = commit;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public ArrayList<Archivo> getArchivos() {
return archivos;
}
public void setArchivos(ArrayList<Archivo> archivos) {
this.archivos = archivos;
}
public ArrayList<Usuario> getUsuarios() {
return usuarios;
}
public void setUsuarios(ArrayList<Usuario> usuarios) {
this.usuarios = usuarios;
}
public int getCommit() {
return commit;
}
public void setCommit(int commit) {
this.commit = commit;
}
@Override
public String toString() {
return nombre;
}
}
| [
"guillendiazd@hotmail.com"
] | guillendiazd@hotmail.com |
cf7d9b326225843d6ad59d0e29266d5fc5c58dd4 | 3539b64d713a40ee33be681099df2fd1b1d97906 | /M3U8Component/src/main/java/com/arialyy/aria/m3u8/M3U8InfoThread.java | d4e637be9836c20ad59b8b6ff43bc6e2c5b8ba26 | [
"Apache-2.0"
] | permissive | tjarl/Aria | b034f04921131053d3a0ee04d228e838d24a2329 | e8c5a9f08b4f772d30d280053aa0afb6b7bd6f43 | refs/heads/master | 2020-09-01T10:16:18.195639 | 2019-11-01T02:13:42 | 2019-11-01T02:13:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,276 | java | /*
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
*
* 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.arialyy.aria.m3u8;
import android.net.TrafficStats;
import android.net.Uri;
import android.os.Process;
import android.text.TextUtils;
import com.arialyy.aria.core.AriaConfig;
import com.arialyy.aria.core.common.CompleteInfo;
import com.arialyy.aria.core.download.DTaskWrapper;
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.download.M3U8Entity;
import com.arialyy.aria.core.processor.IBandWidthUrlConverter;
import com.arialyy.aria.core.inf.OnFileInfoCallback;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.exception.M3U8Exception;
import com.arialyy.aria.exception.TaskException;
import com.arialyy.aria.http.ConnectionHelp;
import com.arialyy.aria.http.HttpTaskOption;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.CheckUtil;
import com.arialyy.aria.util.CommonUtil;
import com.arialyy.aria.util.FileUtil;
import com.arialyy.aria.util.Regular;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 解析url中获取到到m3u8文件信息
* https://www.cnblogs.com/renhui/p/10351870.html
* https://blog.csdn.net/Guofengpu/article/details/54922865
*/
final public class M3U8InfoThread implements Runnable {
public static final String M3U8_INDEX_FORMAT = "%s.index";
private final String TAG = "M3U8InfoThread";
private DownloadEntity mEntity;
private DTaskWrapper mTaskWrapper;
private int mConnectTimeOut;
private OnFileInfoCallback onFileInfoCallback;
private OnGetLivePeerCallback onGetPeerCallback;
private HttpTaskOption mHttpOption;
private M3U8TaskOption mM3U8Option;
/**
* 是否停止获取切片信息,{@code true}停止获取切片信息
*/
private boolean isStop = false;
/**
* m3u8文件信息
*/
private List<String> mInfos = new ArrayList<>();
public interface OnGetLivePeerCallback {
void onGetPeer(String url);
}
public M3U8InfoThread(DTaskWrapper taskWrapper, OnFileInfoCallback callback) {
this.mTaskWrapper = taskWrapper;
mEntity = taskWrapper.getEntity();
mConnectTimeOut = AriaConfig.getInstance().getDConfig().getConnectTimeOut();
onFileInfoCallback = callback;
mHttpOption = (HttpTaskOption) taskWrapper.getTaskOption();
mM3U8Option = (M3U8TaskOption) taskWrapper.getM3u8Option();
mEntity.getM3U8Entity().setLive(mTaskWrapper.getRequestType() == AbsTaskWrapper.M3U8_LIVE);
}
@Override public void run() {
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
TrafficStats.setThreadStatsTag(UUID.randomUUID().toString().hashCode());
HttpURLConnection conn = null;
try {
URL url = ConnectionHelp.handleUrl(mEntity.getUrl(), mHttpOption);
conn = ConnectionHelp.handleConnection(url, mHttpOption);
ConnectionHelp.setConnectParam(mHttpOption, conn);
conn.setConnectTimeout(mConnectTimeOut);
conn.connect();
handleConnect(conn);
} catch (IOException e) {
failDownload(e.getMessage(), false);
} finally {
if (conn != null) {
conn.disconnect();
}
}
}
private void handleConnect(HttpURLConnection conn) throws IOException {
int code = conn.getResponseCode();
if (code == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = reader.readLine();
if (TextUtils.isEmpty(line) || !line.equalsIgnoreCase("#EXTM3U")) {
failDownload("读取M3U8信息失败,读取不到#EXTM3U标签", false);
return;
}
List<String> extInf = new ArrayList<>();
boolean isLive = mTaskWrapper.getRequestType() == ITaskWrapper.M3U8_LIVE;
boolean isGenerateIndexFile = mTaskWrapper.getEntity().getM3U8Entity().isGenerateIndexFile();
if (isGenerateIndexFile) {
mInfos.add(line);
}
while ((line = reader.readLine()) != null) {
if (isStop) {
break;
}
if (isGenerateIndexFile) {
mInfos.add(line);
}
if (line.startsWith("#EXT-X-ENDLIST")) {
break;
}
ALog.d(TAG, line);
if (line.startsWith("#EXTINF")) {
String info = reader.readLine();
mInfos.add(info);
if (isLive) {
if (onGetPeerCallback != null) {
onGetPeerCallback.onGetPeer(info);
}
} else {
extInf.add(info);
}
} else if (line.startsWith("#EXT-X-STREAM-INF")) {
int setBand = mM3U8Option.getBandWidth();
int bandWidth = getBandWidth(line);
// 多码率的m3u8配置文件,清空信息
if (isGenerateIndexFile && mInfos != null) {
mInfos.clear();
}
if (setBand == 0) {
handleBandWidth(conn, reader.readLine());
} else if (bandWidth == setBand) {
handleBandWidth(conn, reader.readLine());
} else {
failDownload(String.format("【%s】码率不存在", bandWidth), false);
}
return;
} else if (line.startsWith("EXT-X-KEY")) {
getKeyInfo(line);
}
}
if (!isLive && extInf.isEmpty()) {
failDownload(String.format("获取M3U8下载地址列表失败,url: %s", mEntity.getUrl()), false);
return;
}
if (!isLive && mEntity.getM3U8Entity().getPeerNum() == 0) {
mEntity.getM3U8Entity().setPeerNum(extInf.size());
mEntity.getM3U8Entity().update();
}
CompleteInfo info = new CompleteInfo();
info.obj = extInf;
generateIndexFile();
onFileInfoCallback.onComplete(mEntity.getKey(), info);
} else if (code == HttpURLConnection.HTTP_MOVED_TEMP
|| code == HttpURLConnection.HTTP_MOVED_PERM
|| code == HttpURLConnection.HTTP_SEE_OTHER
|| code == HttpURLConnection.HTTP_CREATED // 201 跳转
|| code == 307) {
handleUrlReTurn(conn, conn.getHeaderField("Location"));
} else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
failDownload("404错误", false);
} else {
failDownload(String.format("不支持的响应,code: %s", code), true);
}
}
/**
* 创建索引文件
*/
private void generateIndexFile() {
if (mTaskWrapper.getEntity().getM3U8Entity().isGenerateIndexFile()) {
String indexPath = String.format(M3U8_INDEX_FORMAT, mEntity.getFilePath());
File indexFile = new File(indexPath);
if (indexFile.exists()) {
FileUtil.deleteFile(indexPath);
}
FileUtil.createFile(indexPath);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(indexFile);
for (String str : mInfos) {
byte[] by = str.concat("\r\n").getBytes(Charset.forName("UTF-8"));
fos.write(by, 0, by.length);
}
fos.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
/**
* 是否停止获取切片信息,{@code true}停止获取切片信息
*/
public void setStop(boolean isStop) {
this.isStop = isStop;
}
/**
* 直播切片信息获取回调
*/
public void setOnGetPeerCallback(OnGetLivePeerCallback peerCallback) {
onGetPeerCallback = peerCallback;
}
/**
* 获取加密的密钥信息
*/
private void getKeyInfo(String line) {
String temp = line.substring(line.indexOf(":") + 1);
String[] params = temp.split(",");
M3U8Entity m3U8Entity = mEntity.getM3U8Entity();
for (String param : params) {
if (param.startsWith("METHOD")) {
m3U8Entity.method = param.split("=")[1];
} else if (param.startsWith("URI")) {
m3U8Entity.keyUrl = param.split("=")[1].replaceAll("\"", "");
m3U8Entity.keyPath =
new File(mEntity.getFilePath()).getParent() + "/" + CommonUtil.getStrMd5(
m3U8Entity.keyUrl) + ".key";
} else if (param.startsWith("IV")) {
m3U8Entity.iv = param.split("=")[1];
}
}
downloadKey(m3U8Entity);
}
/**
* 读取bandwidth
*/
private int getBandWidth(String line) {
Pattern p = Pattern.compile(Regular.BANDWIDTH);
Matcher m = p.matcher(line);
if (m.find()) {
return Integer.parseInt(m.group());
}
return 0;
}
/**
* 处理30x跳转
*/
private void handleUrlReTurn(HttpURLConnection conn, String newUrl) throws IOException {
ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】");
if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) {
if (onFileInfoCallback != null) {
onFileInfoCallback.onFail(mEntity, new TaskException(TAG, "获取重定向链接失败"), false);
}
return;
}
if (newUrl.startsWith("/")) {
Uri uri = Uri.parse(mEntity.getUrl());
newUrl = uri.getHost() + newUrl;
}
if (!CheckUtil.checkUrl(newUrl)) {
failDownload("下载失败,重定向url错误", false);
return;
}
mHttpOption.setRedirectUrl(newUrl);
mEntity.setRedirect(true);
mEntity.setRedirectUrl(newUrl);
String cookies = conn.getHeaderField("Set-Cookie");
conn.disconnect(); // 关闭上一个连接
URL url = ConnectionHelp.handleUrl(newUrl, mHttpOption);
conn = ConnectionHelp.handleConnection(url, mHttpOption);
ConnectionHelp.setConnectParam(mHttpOption, conn);
conn.setRequestProperty("Cookie", cookies);
conn.setConnectTimeout(mConnectTimeOut);
conn.connect();
handleConnect(conn);
conn.disconnect();
}
/**
* 处理码率
*/
private void handleBandWidth(HttpURLConnection conn, String bandWidthM3u8Url) throws IOException {
IBandWidthUrlConverter converter = mM3U8Option.getBandWidthUrlConverter();
if (converter != null) {
bandWidthM3u8Url = converter.convert(bandWidthM3u8Url);
if (!bandWidthM3u8Url.startsWith("http")) {
failDownload(String.format("码率转换器转换后的url地址无效,转换后的url:%s", bandWidthM3u8Url), false);
return;
}
} else {
ALog.d(TAG, "没有设置码率转换器");
}
mM3U8Option.setBandWidthUrl(bandWidthM3u8Url);
ALog.d(TAG, String.format("新码率url:%s", bandWidthM3u8Url));
String cookies = conn.getHeaderField("Set-Cookie");
conn.disconnect(); // 关闭上一个连接
URL url = ConnectionHelp.handleUrl(bandWidthM3u8Url, mHttpOption);
conn = ConnectionHelp.handleConnection(url, mHttpOption);
ConnectionHelp.setConnectParam(mHttpOption, conn);
conn.setRequestProperty("Cookie", cookies);
conn.setConnectTimeout(mConnectTimeOut);
conn.connect();
handleConnect(conn);
conn.disconnect();
}
private void failDownload(String errorInfo, boolean needRetry) {
onFileInfoCallback.onFail(mEntity, new M3U8Exception(TAG, errorInfo), needRetry);
}
/**
* 密钥不存在,下载密钥
*/
private void downloadKey(M3U8Entity info) {
HttpURLConnection conn = null;
FileOutputStream fos = null;
try {
File keyF = new File(info.keyPath);
if (!keyF.exists()) {
ALog.d(TAG, "密钥不存在,下载密钥");
FileUtil.createFile(keyF.getPath());
} else {
return;
}
URL url = ConnectionHelp.handleUrl(info.keyUrl, mHttpOption);
conn = ConnectionHelp.handleConnection(url, mHttpOption);
ConnectionHelp.setConnectParam(mHttpOption, conn);
conn.setConnectTimeout(mConnectTimeOut);
conn.connect();
InputStream is = conn.getInputStream();
fos = new FileOutputStream(keyF);
byte[] buffer = new byte[1024];
int len;
while ((len = is.read(buffer)) != -1) {
fos.write(buffer, 0, len);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (fos != null) {
fos.close();
}
if (conn != null) {
conn.disconnect();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
| [
"511455842@qq.com"
] | 511455842@qq.com |
bf1bd19601ef21c006e5cebd4776d80b6f0b6b63 | 9caa2da9df6cdfef9e7fc2ecc0f00e0b2f03551b | /app/src/main/java/project/graduate/lele/accountbook/activity/FundActivity.java | 8b81e7bef6546a436fc5ebd89e330f6e25d66857 | [] | no_license | zhpanvip/AccountBook | dac1579f906df5b58aa522f663e541dd2a81dae7 | 96c8dfe10485bd3f8a17633fc4724558541fa088 | refs/heads/master | 2022-11-15T02:40:16.411052 | 2017-07-18T12:20:27 | 2017-07-18T12:20:27 | 276,527,515 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,121 | java | package project.graduate.lele.accountbook.activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import org.litepal.crud.DataSupport;
import java.util.List;
import project.graduate.lele.accountbook.R;
import project.graduate.lele.accountbook.adapter.PayDetailAdapter;
import project.graduate.lele.accountbook.bean.AccountBean;
import project.graduate.lele.accountbook.bean.PayBean;
import project.graduate.lele.accountbook.utils.UserTools;
/**
* 支付方式详情页面
*/
public class FundActivity extends BaseActivity {
private TextView mTvPay;
private LinearLayout mLlPay;
private TextView mTvIncome;
private LinearLayout mLlIncome;
private LinearLayout mLlFund;
private ListView mLvFund;
private PayDetailAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fund);
initView();
setData();
}
private void setData() {
// 获取资金页面传递来的数据
Intent intent = getIntent();
PayBean payBean = (PayBean) intent.getSerializableExtra("payBean");
tvTitle.setText(payBean.getWay());
tvTitle.setTextColor(Color.parseColor("#FFFFFF"));
int color = Color.parseColor(payBean.getBackground());
// 设置背景色
mRlTitleBar.setBackgroundColor(color);
mLlFund.setBackgroundColor(color);
mLlIncome.setBackgroundColor(color);
mLlPay.setBackgroundColor(color);
// 给状态栏设置背景色
setStatusBarColor(this,color);
// List<AccountGainClassBean> accountGainClassBeen = DataSupport.findAll(AccountGainClassBean.class);
// 从数据查询用户某个支付方式的收入数据
List<AccountBean> accountIncomeBeen = DataSupport
.where("accountClass=2 and payWay=? and username=?",payBean.getWay(), UserTools.getUsername(this))
.find(AccountBean.class);
// 从数据查询用户某个收入方式的收入数据
List<AccountBean> accountPayBeen = DataSupport
.where("accountClass=1 and payWay=? and username=?",payBean.getWay(),UserTools.getUsername(this))
.find(AccountBean.class);
double income=0; // 累计支出
double pay=0; // 累计收入
// 遍历支出集合计算出累计支出
for(int i=0; i<accountIncomeBeen.size();i++){
income+=accountIncomeBeen.get(i).getAccount();
}
// 遍历收入集合计算出累计收入
for(int i=0;i<accountPayBeen.size();i++){
pay+=accountPayBeen.get(i).getAccount();
}
mTvIncome.setText("¥"+income);
mTvPay.setText("¥"+pay);
// 1.实例化ListView的适配器
mAdapter=new PayDetailAdapter(this);
// 2.查询数据库获取用户该支付方式的所有数据得到List集合
List<AccountBean> accountBeen = DataSupport
.where("payWay=? and username=?", payBean.getWay(),UserTools.getUsername(this))
.find(AccountBean.class);
// 3.将集合数据设置到Adapter
mAdapter.setmList(accountBeen);
// 4.给ListView适配Adapter
mLvFund.setAdapter(mAdapter);
}
public static void start(Context context, PayBean payBean) {
Intent intent = new Intent(context, FundActivity.class);
intent.putExtra("payBean", payBean);
context.startActivity(intent);
}
private void initView() {
mTvPay = (TextView) findViewById(R.id.tv_pay);
mLlPay = (LinearLayout) findViewById(R.id.ll_pay);
mTvIncome = (TextView) findViewById(R.id.tv_income);
mLlIncome = (LinearLayout) findViewById(R.id.ll_income);
mLlFund = (LinearLayout) findViewById(R.id.ll_fund);
mLvFund = (ListView) findViewById(R.id.lv_fund);
}
}
| [
"zhpanvip@outlook.com"
] | zhpanvip@outlook.com |
97e178e7d2146f7e4395182b5dbb954bdaead0d4 | ee19da9556d7e1b97adc09c9a0638d164b0f5fef | /java 8 예외처리/src/exceptionex8.java | 985061b612ff62652af80d0eb38395434263aa42 | [] | no_license | lovemin1003/lovemin34 | bc6384e6abb071b2b5689411d1898982b9abf141 | 3af29667645fff631dc79137cd9beeca2f0981f8 | refs/heads/master | 2020-07-17T04:38:57.202293 | 2020-02-09T09:33:12 | 2020-02-09T09:33:12 | 205,943,964 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 585 | java |
public class exceptionex8 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(1);
System.out.println(2);
try
{
System.out.println(3);
System.out.println(0/0);//예외를 발생시킨다.
System.out.println(5);//실행이 안 됨.
}
catch(ArithmeticException ae)
{
ae.printStackTrace();//참조변수 ae를 통해, ArithmeticException생성된 인스턴스에 접근 가능.
System.out.println("예외메시지:"+ae.getMessage());
}
System.out.println(8);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c1ece0cf9d743e006d0d7009f6294784f5005492 | a601a83dd25edd7cf250d50a77be520734988b84 | /备份设置帮助/shezhiActivity.java | 2ff1f79037282167a08dae15a611da462824c05e | [] | no_license | liuxinyao0722/SUIYUEAPP | 251756e1d59c8b003c854ee777218f0482520ee0 | 9adac001734504f7829420bf035d83c1fbc66bae | refs/heads/master | 2020-09-06T15:58:32.882762 | 2019-11-10T08:40:27 | 2019-11-10T08:40:27 | 220,472,599 | 0 | 0 | null | 2019-11-08T13:29:16 | 2019-11-08T13:29:15 | null | UTF-8 | Java | false | false | 350 | java | package com.example.suiyue;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class shezhiActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shezhi);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
122dc55c8a87ac7fe08fb7dc2d32e50dfb9e09c2 | b7321d03be978cd3fc09489d22b93f9dac365b00 | /src/main/java/com/example/mp/config/MpConfig.java | f1fc7ef06041ff7b90ef634abb684f24334d9f6b | [] | no_license | xuxiaolong1994/pm | c444f4e4e274a32324a47e0b572318c821763508 | ba13649079839a90f8ab1465f056f04cdbe13687 | refs/heads/master | 2023-05-08T14:56:38.270917 | 2021-06-06T09:21:27 | 2021-06-06T09:21:27 | 374,296,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 557 | java | package com.example.mp.config;
import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@MapperScan("com.example.mp.mapper")
public class MpConfig {
@Bean
public OptimisticLockerInterceptor optimisticLockerInterceptor() {
return new OptimisticLockerInterceptor();
}
}
| [
"879612339@qq.com"
] | 879612339@qq.com |
66f1d6c05062764a52c6d53a6b2486fb9b78bce5 | 2d3ab742d830ea30b702c186d61d34cf8c324183 | /algo/algoexpert/src/main/java/todo/java/algo/algoexpert/bst/MinHeightBST.java | 60ce473a9f4548a398b78780c2327371e40ce814 | [
"MIT"
] | permissive | jianchengwang/todo-java | 39893627fc9e1250b50c41f34a2b13c90d98de2c | 0b697590fd7f08027844c00abb352c2fddc18175 | refs/heads/main | 2023-08-28T03:30:20.723137 | 2023-08-01T07:16:50 | 2023-08-01T07:16:50 | 175,554,847 | 1 | 0 | MIT | 2023-06-14T22:34:00 | 2019-03-14T05:34:19 | Java | UTF-8 | Java | false | false | 1,533 | java | package todo.java.algo.algoexpert.bst;
import java.util.List;
/**
* 生成最小高度的二分查找树
* medium
* link: https://www.algoexpert.io/questions/Min%20Height%20BST
*
*/
public class MinHeightBST {
public static void main(String[] args) {
}
// O(n) time | O(n) space
public static BST solution(List<Integer> array) {
return constructMinHeightBST(array, 0, array.size() - 1);
}
public static BST constructMinHeightBST(List<Integer> array, int startIndex, int endIndex) {
if(endIndex < startIndex) return null;
int midIndex = (startIndex + endIndex) / 2;
BST bst = new BST(array.get(midIndex));
bst.left = constructMinHeightBST(array, startIndex, midIndex - 1);
bst.right = constructMinHeightBST(array, midIndex + 1, endIndex);
return bst;
}
static class BST {
public int value;
public BST left;
public BST right;
public BST(int value) {
this.value = value;
left = null;
right = null;
}
public void insert(int value) {
if (value < this.value) {
if (left == null) {
left = new BST(value);
} else {
left.insert(value);
}
} else {
if (right == null) {
right = new BST(value);
} else {
right.insert(value);
}
}
}
}
}
| [
"jiancheng_wang@yahoo.com"
] | jiancheng_wang@yahoo.com |
87ac7b6f8df817c57c7279edb21b52c7c65800a8 | 66b79e277f18af9beb122e65f74af1bd8a346672 | /src/Beans/ProductBean.java | 3dadec7632792f48d032dd5f0f73141fd462c9c7 | [] | no_license | sbojja1/ProductServices | 91b95e1f5d5e5289474377823ade43a04b97b3a2 | 891eea27c1be11578b376e16b91b458c018c1ce0 | refs/heads/master | 2021-01-10T04:02:49.333856 | 2016-02-04T00:54:11 | 2016-02-04T00:54:11 | 51,041,994 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package Beans;
//import sun.util.calendar.LocalGregorianCalendar.Date;
public class ProductBean {
int productId;
String productName;
int productQuantity;
int productPricePerUnit;
String last_update;
int catId;
public int getCatId() {
return catId;
}
public void setCatId(int catId) {
this.catId = catId;
}
public int getProductId() {
return productId;
}
public void setProductId(int productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public int getProductQuantity() {
return productQuantity;
}
public void setProductQuantity(int productQuantity) {
this.productQuantity = productQuantity;
}
public int getProductPricePerUnit() {
return productPricePerUnit;
}
public void setProductPricePerUnit(int productPricePerUnit) {
this.productPricePerUnit = productPricePerUnit;
}
public String getLast_update() {
return last_update;
}
public void setLast_update(String last_update) {
this.last_update = last_update;
}
public ProductBean() {
super();
// TODO Auto-generated constructor stub
}
}
| [
"Sai Nishank"
] | Sai Nishank |
d3304415dde58ccbcd7bf94d77070af5937d0075 | a1621e690167e6adf461cbfceb8e1c9b2f269e02 | /src/main/java/org/una/tramites/loaders/Permisos.java | e09ae123d338393419a87d7960034fbb0709ad90 | [] | no_license | RoberthFallas/tramitesWS | 91c0ca2b5dbbdbc0bcab07b7dddf78636212f78b | 2dd653decb793d23d52aa6be87953d0d77b6c2d8 | refs/heads/master | 2022-12-26T12:28:03.375737 | 2020-10-09T22:43:12 | 2020-10-09T22:43:12 | 291,831,066 | 0 | 0 | null | 2020-09-14T05:42:08 | 2020-08-31T21:43:43 | Java | UTF-8 | Java | false | false | 3,958 | 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 org.una.tramites.loaders;
/**
*
* @author LordLalo
*/
public enum Permisos {
USUARIO_CREAR("USU1"),
USUARIO_MODIFICAR("USU2"),
USUARIO_INACTIVAR("USU3"),
USUARIO_CONSULTAR("USU4"),
USUARIO_CONSULTAR_CEDULA("USU5"),
USUARIO_CONSULTAR_NOMBRE("US6"),
USUARIO_CONSULTAR_TODO("USU7"),
USUARIO_ELIMINAR("USU8"),
USUARIO_ELIMINAR_TODO("USU9"),
DEPARTAMENTO_CREAR("DEP1"),
DEPARTAMENTO_MODIFICAR("DEP2"),
DEPARTAMENTO_INACTIVAR("DEP3"),
DEPARTAMENTO_CONSULTAR("DEP4"),
DEPARTAMENTO_CONSULTAR_ESTADO("DEP5"),
DEPARTAMENTO_CONSULTAR_DESCRIPCION("DEP6"),
DEPARTAMENTO_CONSULTAR_TODO("DEP7"),
DEPARTAMENTO_ELIMINAR("DEP8"),
DEPARTAMENTO_ELIMINAR_TODO("DEP9"),
TRAMITE_REGISTRAR("TRA1"),
TRAMITE_MODIFICAR("TRA2"),
TRAMITE_INACTIVAR("TRA3"),
TRAMITE_FINALIZAR("TRA4"),
TRAMITE_CONSULTAR("TRA5"),
TRAMITE_CONSULTAR_TODO("TRA6"),
TRAMITE_REGISTRAR_("TRA7"),
TRAMITE_ELIMINAR("TRA8"),
TRAMITE_ELIMINAR_TODO("TRA9"),
TRAMITE_DISEÑAR("TRD1"),
TRAMITE_TIPO_CREAR("TRT1"),
TRAMITE_TIPO_MODIFICAR("TRT2"),
TRAMITE_TIPO_CONSULTAR("TRT3"),
TRAMITE_TIPO_CONSULTAR_ESTADO("TRT4"),
TRAMITE_TIPO_CONSULTAR_DESCRIPCION("TRT5"),
TRAMITE_TIPO_CONSULTAR_TODO("TRT6"),
TRAMITE_ESTADO_CONSULTAR_TODO("TRE1"),
TRAMITE_ESTADO_CONSULTAR("TRE2"),
TRAMITE_ESTADO_CREAR("TRE2"),
TRAMITE_ESTADO_MODIFICAR("TRE3"),
TRAMITE_ESTADO_ELIMINAR("TRE4"),
TRAMITE_ESTADO_ELIMINAR_TODO("TRE5"),
TRAMITE_CAMBIO_ESTADO_CONSULTAR_TODO("TCA1"),
TRAMITE_CAMBIO_ESTADO_CONSULTAR("TCA2"),
TRAMITE_CAMBIO_ESTADO_CREAR("TCA2"),
TRAMITE_CAMBIO_ESTADO_MODIFICAR("TCA3"),
TRAMITE_CAMBIO_ESTADO_ELIMINAR("TCA4"),
TRAMITE_CAMBIO_ESTADO_ELIMINAR_TODO("TCA5"),
TRAMITE_ESTADO_MODIFICAR_ESTADO("TCA5"),
TRANSACCION_CONSULTAR("TRU1"),
TRANSACCION_CREAR("TRU2"),
NOTA_CONSULTAR_TODO("NOT1"),
NOTA_CONSULTAR("NOT2"),
NOTA_CREAR("NOT2"),
NOTA_MODIFICAR("NOT3"),
NOTA_ELIMINAR("NOT4"),
NOTA_ELIMINAR_TODO("NOT5"),
ARCHIVO_RELACIONADO_CREAR("ARC1"),
ARCHIVO_RELACIONADO_MODIFICAR("ARC2"),
ARCHIVO_RELACIONADO_CONSULTAR("ARC3"),
ARCHIVO_RELACIONADO_CONSULTAR_TODO("ARC4"),
ARCHIVO_RELACIONADO_ELIMINAR("ARC5"),
ARCHIVO_RELACIONADO_ELIMINAR_TODO("ARC6"),
CLIENTE_CREAR("CLI1"),
CLIENTE_MODIFICAR("CLI2"),
CLIENTE_INACTIVAR("CLI3"),
CLIENTE_CONSULTAR("CLI4"),
CLIENTE_CONSULTAR_NOMBRE_APROXIMADO("CLI5"),
CLIENTE_CONSULTAR_CEDULA_APROXIMADA("CLI6"),
CLIENTE_CONSULTAR_TODO("CLI7"),
CLIENTE_ELIMINAR("CLI8"),
CLIENTE_ELIMINAR_TODO("CLI9"),
PARAMETRO_GENERAL_CREAR("PAR1"),
PARAMETRO_GENERAL_CONSULTAR("PAR2"),
PARAMETRO_GENERAL_CONSULTAR_TODO("PAR53"),
PARAMETRO_GENERAL_ELIMINAR("PAR4"),
PARAMETRO_GENERAL_ELIMINAR_TODO("PAR5"),
REQUISITO_CREAR("REQ1"),
REQUISITO_CONSULTAR("REQ2"),
REQUISITO_CONSULTAR_TODO("REQ3"),
REQUISITO_ELIMINAR("REQ4"),
REQUISITO_ELIMINAR_TODO("REQ5"),
REQUISITO_PRESENTADO_CONSULTAR("REP1"),
REQUISITO_PRESENTADO_CONSULTAR_TODO("REP2"),
REQUISITO_PRESENTADO_ELIMINAR("REP3"),
REQUISITO_PRESENTADO_ELIMINAR_TODO("REP4"),
VARIACION_CREAR("VAR1"),
VARIACION_MODIFICAR("VAR2"),
VARIACION_CONSULTAR("VAR3"),
USUARIO_CONSULTAR_GRUPO("VAR4"),
USUARIO_CONSULTAR_DESCRIPCION("VAR5"),
VARIACION_CONSULTAR_TODO("VAR6"),
VARIACION_ELIMINAR("VAR7"),
VARIACION_ELIMINAR_TODO("VAR8");
private String codigo;
Permisos(String codigo) {
this.codigo = codigo;
}
public String getCodigo() {
return codigo;
}
}
| [
"gera.araya3@gmail.com"
] | gera.araya3@gmail.com |
80652482727d286ee2706b3c077d283d654cf9fc | e308bbf78e22dfda108bc2b8d20ee7cc0f22d856 | /app/src/main/java/me/carc/intervaltimer/model/CarcAppsMenu.java | 3d3e2fefca58e65e9d29266cd08bfeee13d99f91 | [] | no_license | carcme/CarcIntervalTimer | 97b28714e24128dc1cb2115e97a7e9299a0a42be | 951dbab7c4fdebd8c663e668c97526111b3e4a39 | refs/heads/master | 2021-05-04T21:35:41.428345 | 2018-03-08T07:04:15 | 2018-03-08T07:04:15 | 119,953,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,366 | java | package me.carc.intervaltimer.model;
import me.carc.intervaltimer.R;
/**
* Set up the front page menu items
*
* Created by bamptonm on 18/12/2017.
*/
public enum CarcAppsMenu {
THISAPP(R.mipmap.ic_launcher, R.string.app_name, R.string.app_name_desc, ""),
BTOWN(R.drawable.app_image_btown, R.string.appTitleBtown, R.string.appDescBtown, "btown"),
AGD(R.drawable.app_image_agd, R.string.appTitleAGD, R.string.appDescAGB, "anygivendate"),
BBOOKS(R.drawable.app_image_blackbooks, R.string.appTitleBlackBooks, R.string.appDescBlackBooks, "blackbooks"),
FAKER(R.drawable.app_image_fakecall, R.string.appTitleFakeCall, R.string.appDescFakeCall, "fakecallandsms_mvp");
final int iconDrawable;
final int titleResourceId;
final int subTitleResourceId;
final String urlExt;
CarcAppsMenu(int drawable, int titleResourceId, int subTitleResourceId, String urlExt) {
this.iconDrawable = drawable;
this.titleResourceId = titleResourceId;
this.subTitleResourceId = subTitleResourceId;
this.urlExt = urlExt;
}
public int getTitleResourceId() {
return titleResourceId;
}
public int getSubTitleResourceId() {
return subTitleResourceId;
}
public String getUrlExtension() { return urlExt; }
public int getIconDrawable() {
return iconDrawable;
}
} | [
"carcmedev@gmail.com"
] | carcmedev@gmail.com |
abf2491bee01396438e3de20b4575533a8cf4734 | 71ae68731ea257dd8a06dfb1094071c98f270e6e | /app/src/main/java/cn/edu/sdwu/android/classroom/sn170507180117/Ch8Activity1.java | 1d38f5c7023d899a8ac2e065d135d607014f91a8 | [] | no_license | youyanling/MyApplicationClass3 | 2667dc9804c781a99afa2a6dd9143db24e23d2bc | bf3cff0268f8222fdb03cd36ddf18ac05ccdb3a7 | refs/heads/master | 2021-05-20T01:51:37.103956 | 2020-04-22T04:15:49 | 2020-04-22T04:15:49 | 252,135,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,492 | java | package cn.edu.sdwu.android.classroom.sn170507180117;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.MultiAutoCompleteTextView;
import android.widget.TextView;
public class Ch8Activity1 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//使用编码方式实现布局
FrameLayout frameLayout=new FrameLayout(this);
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
ImageView imageView=new ImageView(this);
imageView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
imageView.setImageResource(R.drawable.img);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
frameLayout.addView(imageView);
TextView textView=new TextView(this);
textView.setText("test");
textView.setTextColor(Color.RED);
textView.setTextSize(70);
textView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));
frameLayout.addView(textView);
setContentView(frameLayout);
}
}
| [
"3219402965@qq.com"
] | 3219402965@qq.com |
3983d73a6d724b7f77360fbb9e8ac1c16351d38f | a0854d453cb54a7b9c498a3a847afbc16c88743d | /service-consumer-ribbon-rest/src/main/java/com/spring/could/serviceconsumerribbonrest/ServiceConsumerRibbonRestApplication.java | 1c9a679e560de7e3c0de37d5c41baec9dbc00e22 | [] | no_license | DreamOvO/SpringCould | b620b2e8a782d35077a93f7361bfc4e325b29678 | 64e56f1a4235e7bf5063e112f61072d3dc7f6260 | refs/heads/master | 2020-03-14T02:24:50.134120 | 2018-04-28T10:09:37 | 2018-04-28T10:09:37 | 131,398,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,086 | java | package com.spring.could.serviceconsumerribbonrest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication //标注spring boo服务启动入口t
@EnableDiscoveryClient //spring could 向服务器注册
@EnableHystrix //注解开启Hystrix
@EnableHystrixDashboard //开启hystrixDashboard:
public class ServiceConsumerRibbonRestApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceConsumerRibbonRestApplication.class, args);
}
@Bean
@LoadBalanced
RestTemplate restTemplate() {
return new RestTemplate();
}
}
| [
"1184885512@qq.com"
] | 1184885512@qq.com |
206e1ff7cd8c5a54e5a977cc59ccac9d19682357 | ee9aa986a053e32c38d443d475d364858db86edc | /src/main/java/com/ebay/soap/eBLBaseComponents/PickupMethodCodeType.java | e4c8eaa01abe0319280b9101e80117c6b703043e | [
"Apache-2.0"
] | permissive | modelccc/springarin_erp | 304db18614f69ccfd182ab90514fc1c3a678aaa8 | 42eeb70ee6989b4b985cfe20472240652ec49ab8 | refs/heads/master | 2020-05-15T13:10:21.874684 | 2018-05-24T15:39:20 | 2018-05-24T15:39:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,662 | java |
package com.ebay.soap.eBLBaseComponents;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for PickupMethodCodeType.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="PickupMethodCodeType">
* <restriction base="{http://www.w3.org/2001/XMLSchema}token">
* <enumeration value="InStorePickup"/>
* <enumeration value="PickUpDropOff"/>
* <enumeration value="CustomCode"/>
* </restriction>
* </simpleType>
* </pre>
*
* Note: Per JAXB standards, underscores are added to separate words in enumerations (e.g., PayPal becomes PAY_PAL).
*/
@XmlType(name = "PickupMethodCodeType")
@XmlEnum
public enum PickupMethodCodeType {
/**
*
* This value indicates that the buyer will pick up the In-Store Pickup item at the merchant's physical store.
* <br/><br/>
* <span class="tablenote">
* <strong>Note:</strong> A merchant must be eligible for the In-Store Pickup feature to list an item that is eligible for In-Store Pickup. At this time, the In-Store Pickup feature is generally only available to large retail merchants, and can only be applied to multi-quantity, fixed-price listings.
* </span>
*
*
*/
@XmlEnumValue("InStorePickup")
IN_STORE_PICKUP("InStorePickup"),
/**
*
* This value indicates that the buyer will pick up the "Click and Collect" item at the merchant's physical store.
* <br/><br/>
* <span class="tablenote">
* <strong>Note:</strong> A merchant must be eligible for the "Click and Collect" feature to list an item that is eligible for "Click and Collect". At this time, the "Click and Collect" feature is only available to large merchants on the eBay UK site (site ID=3).
*
*
*/
@XmlEnumValue("PickUpDropOff")
PICK_UP_DROP_OFF("PickUpDropOff"),
/**
*
* Reserved for internal or future use.
*
*
*/
@XmlEnumValue("CustomCode")
CUSTOM_CODE("CustomCode");
private final String value;
PickupMethodCodeType(String v) {
value = v;
}
public String value() {
return value;
}
public static PickupMethodCodeType fromValue(String v) {
for (PickupMethodCodeType c: PickupMethodCodeType.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"601906911@qq.com"
] | 601906911@qq.com |
32fadf6a8ba0b7b91c96340ea11458e4e8713ded | 101a966196d8c250e9ab974c267303ff53350b64 | /src/test/duxiaomanTest.java | e4b56b4cc882274428366e6f681a495186cb512c | [] | no_license | meiszl/LeetCodetest | d59b424f3dc5468ecd8326fe50d61181401b29bc | 07b73544b1bdd371f5a327b9c386dab0c856a910 | refs/heads/master | 2023-04-13T03:46:53.009232 | 2023-04-10T15:22:23 | 2023-04-10T15:22:23 | 248,486,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,072 | java | package test;
import java.util.Scanner;
public class duxiaomanTest {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int[] contr = new int[n];
int i;
for (i=0;i<n;i++){
contr[i] = sc.nextInt();
}
if (n == 0 || contr.length == 0 || contr == null){
System.out.println(0);
return;
}
int[] sum = new int[n];
for (i=1;i<n;i++){
sum[i] = 10001;
}
sum[0] = 0;
int count = 0;
for (i=0;i<n;i++){
if (contr[i] > 1){
sum[contr[i] - 2] = Math.min(sum[contr[i] - 2],sum[i] + b + a);
}
if (contr[i] < n){
sum[contr[i]] = Math.min(sum[contr[i]],sum[i] + c + a);
}
sum[contr[i]-1] = Math.min(sum[contr[i]-1],sum[i] + a);
}
System.out.println(sum[sum.length - 1]);
}
}
| [
"tiaode@qq.com"
] | tiaode@qq.com |
837a4bba3ac3989e65eb5ef90da678a362e335b6 | 777960d3948e93ae70d3b3535eb4a03de9e7c720 | /src/net/packet/server/MapleServerMessagePacket.java | e36318d8fd306775b44334609ea8719b67fa2309 | [
"MIT"
] | permissive | DaphyMorph/MapleProxy | 6d04a2f754602bd064736bbf0d673e37fd6be05b | 653dcd383ef036dba8c47ea1b0c08d23a28352e4 | refs/heads/master | 2023-03-16T18:42:33.266669 | 2016-08-09T22:40:43 | 2016-08-09T22:40:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package net.packet.server;
import java.nio.ByteOrder;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import maplestory.MessageType;
import net.ServerOpCode;
import net.packet.MaplePacket;
public class MapleServerMessagePacket extends MaplePacket {
public MapleServerMessagePacket(MessageType type, String msg){
super(ServerOpCode.SERVERMESSAGE.getCode());
ByteBuf buf = Unpooled.buffer().order(ByteOrder.LITTLE_ENDIAN);
buf.writeByte(type.getId());
if(type == MessageType.SCROLLING_TEXT){
buf.writeByte(1);
}
MaplePacket.writeString(buf, msg);
if(type == MessageType.SUPER_MEGAPHONE){
throw new RuntimeException("Not implemented");
}else if(type == MessageType.LIGHT_BLUE_TEXT){
buf.writeInt(0);
}
setPayload(buf);
}
}
| [
"tylerhasman10@hotmail.com"
] | tylerhasman10@hotmail.com |
beff3614127acf6f55275c55de91a2ef64824afd | fe91391d4715181c4ee0fca0336cbf6326ebf7e6 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Uhaul/Autonomous/AutoPositions/BlueAlliance/MiddlePark_Foundation_Blue.java | 95085b2508b5544ec9e1f81884cfe4eb7072d7d1 | [] | no_license | rawbaconrobotics/RawBacon-Skystone-2019-2020 | 81067609d4920b9cf8d4f9b639a0980166190970 | 5ba4ebc629770dcf0e8d8b3bea872ba5a98467a8 | refs/heads/master | 2022-04-08T12:29:33.271680 | 2020-02-15T22:28:04 | 2020-02-15T22:28:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package org.firstinspires.ftc.teamcode.Uhaul.Autonomous.AutoPositions.BlueAlliance;
import com.acmerobotics.dashboard.config.Config;
/**
* @author Raw Bacon Coders
* FTC Dashboard Values for this specific autonomous to be referenced in class:BDAutonomous
*/
@Config
public class MiddlePark_Foundation_Blue {
public static double one = 0;
public static double two = 0;
public static double three = 0;
public static double four = 0;
public static double five = 0;
public static double six = 0;
public static double seven = 0;
public static double eight = 0;
static double nine = 0;
static double ten = 0;
static double eleven = 0;
static double twelve = 0;
static double thirteen = 0;
static double fourteen = 0;
static double fifteen = 0;
static double sixteen = 0;
static double seventeen = 0;
static double eighteen = 0;
static double nineteen = 0;
static double twenty = 0;
}
| [
"30738778+lukehasawii@users.noreply.github.com"
] | 30738778+lukehasawii@users.noreply.github.com |
62e3912ecfe7171e59183d8c250cbbcc2aa88d4b | c0e32a2ed3318a4d831ca7962e9addb16bc8602c | /A2.java | b3b55698428cde1e67fb1a6abb97f2a62efa1640 | [] | no_license | Zoujay/test-for-ipipe | 4239af70640caf23478b941e94a7a24f0cef5a82 | d22e8d44f661fb92b388840583b5acb3775b7bb1 | refs/heads/main | 2023-07-15T20:09:18.822068 | 2021-08-27T13:51:44 | 2021-08-27T13:51:44 | 386,235,856 | 0 | 0 | null | 2021-07-15T09:33:04 | 2021-07-15T09:33:03 | null | UTF-8 | Java | false | false | 187 | java | public class A2 {
public void badCase2() {
try {
} catch (ArrayIndexOutOfBoundsException e) {
throw new IndexOutOfBoundsException();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
93cdea05a5b1b9c341fc969d8b80c59be4c0049e | 94678f9fa4fec8116c209fbf33829d0aa5984c79 | /test/src/test/java/com/danikula/videocache/support/ProxyCacheTestUtils.java | 8acbee53b5dc3d0bb09ff1ecd38a7243b231326e | [
"Apache-2.0"
] | permissive | iceelor/AndroidVideoCache | 6dce89ee7bf8bf6e11b8e1e78e3408817a33f374 | 88da0aa5c026e8167c9dc308125b707d140ac360 | refs/heads/master | 2021-01-19T20:05:47.353989 | 2015-09-21T20:50:06 | 2015-09-21T20:50:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,067 | java | package com.danikula.videocache.support;
import com.danikula.android.garden.io.IoUtils;
import com.danikula.videocache.HttpProxyCacheServer;
import com.google.common.io.Files;
import org.robolectric.RuntimeEnvironment;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Random;
import java.util.UUID;
/**
* @author Alexey Danilov (danikula@gmail.com).
*/
public class ProxyCacheTestUtils {
public static final String HTTP_DATA_URL = "https://dl.dropboxusercontent.com/u/15506779/persistent/proxycache/android.jpg";
public static final String HTTP_DATA_URL_ONE_REDIRECT = "http://bit.ly/1V5PeY5";
public static final String HTTP_DATA_URL_3_REDIRECTS = "http://bit.ly/1KvVmgZ";
public static final String HTTP_DATA_URL_6_REDIRECTS = "http://ow.ly/SugRH";
public static final String HTTP_DATA_BIG_URL = "https://dl.dropboxusercontent.com/u/15506779/persistent/proxycache/phones.jpg";
public static final String HTTP_DATA_BIG_URL_ONE_REDIRECT = "http://bit.ly/1iJ69yA";
public static final String ASSETS_DATA_NAME = "android.jpg";
public static final String ASSETS_DATA_BIG_NAME = "phones.jpg";
public static final int HTTP_DATA_SIZE = 4768;
public static final int HTTP_DATA_BIG_SIZE = 94363;
public static byte[] getFileContent(File file) throws IOException {
return Files.asByteSource(file).read();
}
public static Response readProxyResponse(HttpProxyCacheServer proxy, String url) throws IOException {
return readProxyResponse(proxy, url, -1);
}
public static Response readProxyResponse(HttpProxyCacheServer proxy, String url, int offset) throws IOException {
URL proxiedUrl = new URL(proxy.getProxyUrl(url));
HttpURLConnection connection = (HttpURLConnection) proxiedUrl.openConnection();
try {
if (offset >= 0) {
connection.setRequestProperty("Range", "bytes=" + offset + "-");
}
return new Response(connection);
} finally {
connection.disconnect();
}
}
public static byte[] loadAssetFile(String name) throws IOException {
InputStream in = RuntimeEnvironment.application.getResources().getAssets().open(name);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IoUtils.copy(in, out);
IoUtils.closeSilently(in);
IoUtils.closeSilently(out);
return out.toByteArray();
}
public static File getTempFile(File file) {
return new File(file.getParentFile(), file.getName() + ".download");
}
public static File newCacheFile() {
return new File(RuntimeEnvironment.application.getCacheDir(), UUID.randomUUID().toString());
}
public static byte[] generate(int capacity) {
Random random = new Random(System.currentTimeMillis());
byte[] result = new byte[capacity];
random.nextBytes(result);
return result;
}
}
| [
"danikula@gmail.com"
] | danikula@gmail.com |
041006229674605c02d668316eb608841dc72405 | d98cb549cf521c00dcdb71aa089ab0fcd7d6cc02 | /src/main/java/com/smile/aspect/HttpAspect.java | aef4b1bfec49a08048d52e16d8a897b8e4cfd925 | [] | no_license | Smile52/SpringBootDemo | 8464392eb72dbcceff5fc388b4665dba49f24a68 | dbc3ac0c2ceed932309d7cd221b5d6c5d4ca56db | refs/heads/master | 2020-03-06T22:30:34.651725 | 2018-04-03T06:32:28 | 2018-04-03T06:32:28 | 127,104,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,745 | java | package com.smile.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Objects;
/**
* Created by yaojiulong on 2017/7/25.
*/
@Aspect
@Component
public class HttpAspect {
private final static Logger logger = LoggerFactory.getLogger(HttpAspect.class);
/**
* 拦截GirlController全部请求
*/
@Pointcut("execution(public * com.smile.controller.GirlController.*(..))")
public void log(){
}
@Before("log()")
public void doBefore(JoinPoint joinPoint){
logger.info("111111111");
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
//url
logger.info("url={}", request.getRequestURL());
//method
logger.info("method={}", request.getMethod());
//ip
logger.info("id={}", request.getRemoteAddr());
//类名
logger.info("class-name={}", joinPoint.getSignature().getDeclaringTypeName()+"."+joinPoint.getSignature().getName());
//参数
logger.info("args={}", joinPoint.getArgs());
}
@After("log()")
public void doAfter(){
logger.info("22222222");
}
@AfterReturning(returning = "object", pointcut = "log()")
public void doAfterReturning(Object object){
logger.info("response={}", object.toString());
}
}
| [
"Dandy503@163.com"
] | Dandy503@163.com |
718cb0473762137615fe8e4d56a7554396c7b124 | f7958f7c668a9b2ffdf8285ad7451309871f07e3 | /ContractManagement/src/com/dao/impl/ContractDaoImpl.java | dd9da52b669ccfbb1e71ee18fd95b6ce3b012285 | [] | no_license | afrahao/Contract-Management-System | c54ef59f9277eeac303d7a0836d27571d1bc0b03 | bc6869858273fba8c690afd949b74b463e81c902 | refs/heads/master | 2021-01-21T20:46:26.857242 | 2017-06-21T10:40:52 | 2017-06-21T10:40:52 | 92,274,857 | 2 | 1 | null | 2017-06-20T14:43:07 | 2017-05-24T09:30:25 | Java | UTF-8 | Java | false | false | 11,345 | java | package com.dao.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.dao.ContractDao;
import com.model.Contract;
import com.utils.AppException;
import com.utils.DBUtil;
/**
* Contract data access layer implementation class
*/
public class ContractDaoImpl implements ContractDao {
/**
* Add contract information
*
* @param contract
* @return boolean Return true if successful , otherwise false
* @throws AppException
*/
public boolean add(Contract contract) throws AppException{
boolean flag = false;// Operation flag
// Declare database connection object, pre-compiled object and results set object
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
try {
// Create database connection
conn = DBUtil.getConnection();
//Declare operation statement,save contract information, "?" is a placeholder
String sql = "insert into t_contract"
+"(user_id,customer,num,name,beginTime,endTime,content) "
+"values(?,?,?,?,?,?,?)";
// Pre-compiled sql, and return primary key
psmt = conn.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS);
// Set values for the placeholder
psmt.setInt(1, contract.getUserId());
psmt.setString(2, contract.getCustomer());
psmt.setString(3, contract.getNum());
psmt.setString(4, contract.getName());
// Turn java.util.Dat to java.sql.Date
java.sql.Date beginTime = new java.sql.Date(contract.getBeginTime().getTime());
java.sql.Date endTime = new java.sql.Date(contract.getEndTime().getTime());
psmt.setDate(5, beginTime);
psmt.setDate(6, endTime);
psmt.setString(7, contract.getContent());
psmt.executeUpdate();// Execute update
rs = psmt.getGeneratedKeys(); //Get primary key in insert row,only one record in result set
if (rs.next()) {
contract.setId(rs.getInt(1));// Get primary key's value,and set it into contract object
flag = true; // If affected lines greater than 0, so operation success
}
} catch (SQLException e) {
e.printStackTrace();
throw new AppException(
"com.ruanko.dao.impl.ContractDaoImpl.add");
} finally {
// Close database object operation, release resources
DBUtil.closeResultSet(rs);
DBUtil.closeStatement(psmt);
DBUtil.closeConnection(conn);
}
return flag;
}
/**
* Query contract object according to contract id
*
* @param id Contract id
* @return Contract object
* @throws AppException
*/
public Contract getById(int id) throws AppException {
// Declare contract
Contract contract = null;
// Declare database connection object, pre-compiled object and result set object
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
try {
// Create database connection
conn = DBUtil.getConnection();
//Define SQL statement: query contract information according to the contract id
String sql = "select id,name,user_id,customer,num,beginTime,endTime,content "
+"from t_contract "
+"where id = ? and del = 0";
// Pre-compiled sql, and set the parameter values
psmt = conn.prepareStatement(sql);
psmt.setInt(1, id); //Set contract id
// Query result set
rs = psmt.executeQuery();
//Get information in result set by loop,and encapsulated into contract object
if(rs.next()) {
contract = new Contract();
contract.setId(rs.getInt("id"));
contract.setName(rs.getString("name"));
contract.setUserId(rs.getInt("user_id"));
contract.setCustomer(rs.getString("customer"));
contract.setNum(rs.getString("num"));
contract.setBeginTime(rs.getDate("beginTime"));
contract.setEndTime(rs.getDate("endTime"));
contract.setContent(rs.getString("content"));
}
} catch (SQLException e) {
e.printStackTrace();
throw new AppException(
"com.ruanko.dao.impl.ContractDaoImpl.getById");
} finally {
// Close the database operation object
DBUtil.closeResultSet(rs);
DBUtil.closeStatement(psmt);
DBUtil.closeConnection(conn);
}
return contract;
}
/**
* Query contract id set according to user id
*
* @param id Contract id
* @return Contract id set
* @throws AppException
*/
public List<Integer> getIdsByUserId(int userId) throws AppException {
// Initialize id set
List<Integer> ids = new ArrayList<Integer>();
// Declare database connection object, pre-compiled object and result set object
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
try {
// Create database connection
conn = DBUtil.getConnection();
// Declare operation statement,query contract id according to user id, "?" is a Placeholder
String sql = "select id "
+"from t_contract "
+"where user_id = ? and del = 0";
// Pre-compiled sql
psmt = conn.prepareStatement(sql);
// Set values for the placeholder '?'
psmt.setInt(1, userId);
// Query result set
rs = psmt.executeQuery();
// Get information in result set by loop,and save it to conIds
while (rs.next()) {
ids.add(rs.getInt("id"));
}
} catch (SQLException e) {
e.printStackTrace();
throw new AppException("com.ruanko.dao.impl.ContractDaoImpl.getIdsByUserId");
} finally {
// Close database object operation, release resources
DBUtil.closeResultSet(rs);
DBUtil.closeStatement(psmt);
DBUtil.closeConnection(conn);
}
return ids;
}
/**
* Update contract's content according to contract id,passing parameters through entity object
*
* @param conId Contract id
* @return boolean Return true if successful , otherwise false
* @throws AppException
*/
public boolean updateById(Contract contract) throws AppException {
boolean flag = false;// Operation flag
// Declare database connection object, pre-compiled object
Connection conn = null;
PreparedStatement psmt = null;
try {
// Create database connection
conn = DBUtil.getConnection();
// Declare sql:update contract information according to contract id
String sql = "update t_contract set name = ?, customer = ?, beginTime = ?, endTime = ?, content = ? "
+"where id = ? and del = 0";
// Pre-compiled sql, and set the parameter values
psmt = conn.prepareStatement(sql);
psmt.setString(1, contract.getName());
psmt.setString(2, contract.getCustomer());
// Turn java.util.Dat to java.sql.Date
java.sql.Date beginTime = new java.sql.Date(contract.getBeginTime().getTime());
java.sql.Date endTime = new java.sql.Date(contract.getEndTime().getTime());
psmt.setDate(3, beginTime);
psmt.setDate(4, endTime);
psmt.setString(5, contract.getContent());
psmt.setInt(6, contract.getId());
// Execute update,return affected rows
int count = psmt.executeUpdate();
if (count > 0) {// If affected lines greater than 0, so update success
flag = true;
}
}catch (SQLException e) {
e.printStackTrace();
throw new AppException("com.ruanko.dao.impl.ContractDaoImpl.updateById");
} finally {
// Close database operation object
DBUtil.closeStatement(psmt);
DBUtil.closeConnection(conn);
}
return flag;
}
public List<Contract> getAll() throws AppException {
// Initialiaze roleList
List<Contract> contractList = new ArrayList<Contract>();
//Declare Connection object,PreparedStatement object and ResultSet object
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
try {
// Create database connection
conn = DBUtil.getConnection();
// Declare operation statement:query all role object set,"?" is a placeholder
String sql = "select id,user_id,customer,num,name,beginTime,endTime,content,del from t_contract ";
psmt = conn.prepareStatement(sql);
rs = psmt.executeQuery();// Return result set
// Loop to get information in result set,and save in ids
while (rs.next()) {
Contract contract = new Contract(); // Instantiate role object
// Set value to role
contract.setId(rs.getInt("id"));
contract.setUserId(rs.getInt("user_id"));
contract.setContent(rs.getString("content"));
contract.setCustomer(rs.getString("customer"));
contract.setBeginTime(rs.getDate("beginTime"));
contract.setEndTime(rs.getDate("endTime"));
contract.setNum(rs.getString("num"));
contract.setName(rs.getString("name"));
contract.setDel(rs.getInt("del"));
contractList.add(contract);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
// Close the database operation object, release resources
DBUtil.closeResultSet(rs);
DBUtil.closeStatement(psmt);
DBUtil.closeConnection(conn);
}
return contractList;
}
public List<Contract> getFinalized() throws AppException {
// Initialiaze roleList
List<Contract> contractList = new ArrayList<Contract>();
//Declare Connection object,PreparedStatement object and ResultSet object
Connection conn = null;
PreparedStatement psmt = null;
ResultSet rs = null;
try {
// Create database connection
conn = DBUtil.getConnection();
// Declare operation statement:query all role object set,"?" is a placeholder
String sql = "select t_contract.id,user_id,customer,num,name,beginTime,endTime,content,t_contract.del from t_contract,t_contract_state where t_contract.id=t_contract_state.con_id and t_contract_state.type=5 ";
psmt = conn.prepareStatement(sql);
rs = psmt.executeQuery();// Return result set
// Loop to get information in result set,and save in ids
while (rs.next()) {
Contract contract = new Contract(); // Instantiate role object
// Set value to role
contract.setId(rs.getInt("id"));
contract.setUserId(rs.getInt("user_id"));
contract.setContent(rs.getString("content"));
contract.setCustomer(rs.getString("customer"));
contract.setBeginTime(rs.getDate("beginTime"));
contract.setEndTime(rs.getDate("endTime"));
contract.setNum(rs.getString("num"));
contract.setName(rs.getString("name"));
contract.setDel(rs.getInt("del"));
contractList.add(contract);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
// Close the database operation object, release resources
DBUtil.closeResultSet(rs);
DBUtil.closeStatement(psmt);
DBUtil.closeConnection(conn);
}
return contractList;
}
public void deleteContract(int id){
//Declare Connection object,PreparedStatement object and ResultSet object
Connection conn = null;
PreparedStatement psmt = null;
int rs;
try {
// Create database connection
conn = DBUtil.getConnection();
// Declare operation statement,query role's information based on role id, "?" is a placeholder
String sql = "delete from t_contract where id =? " ;
// Pre-compiled sql
psmt =(PreparedStatement) conn.prepareStatement(sql);
// Set values for the placeholder '?'
psmt.setInt(1, id);
rs = psmt.executeUpdate();
// Save user's information by using Pole entity object when queried the results set
} catch (SQLException e) {
e.printStackTrace();
} finally {
// Close the database operation object, release resources
DBUtil.closeStatement(psmt);
DBUtil.closeConnection(conn);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
a2413457788c999f7622c2b3ed3b6108208d339e | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-marketplaceentitlement/src/main/java/com/amazonaws/services/marketplaceentitlement/AWSMarketplaceEntitlementClient.java | 007b16e3142d61c5df0248f9ccfbf4ae290111a3 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 13,884 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.marketplaceentitlement;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.marketplaceentitlement.AWSMarketplaceEntitlementClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.marketplaceentitlement.model.*;
import com.amazonaws.services.marketplaceentitlement.model.transform.*;
/**
* Client for accessing AWS Marketplace Entitlement Service. All service calls made using this client are blocking, and
* will not return until the service call completes.
* <p>
* <fullname>AWS Marketplace Entitlement Service</fullname>
* <p>
* This reference provides descriptions of the AWS Marketplace Entitlement Service API.
* </p>
* <p>
* AWS Marketplace Entitlement Service is used to determine the entitlement of a customer to a given product. An
* entitlement represents capacity in a product owned by the customer. For example, a customer might own some number of
* users or seats in an SaaS application or some amount of data capacity in a multi-tenant database.
* </p>
* <p>
* <b>Getting Entitlement Records</b>
* </p>
* <ul>
* <li>
* <p>
* <i>GetEntitlements</i>- Gets the entitlements for a Marketplace product.
* </p>
* </li>
* </ul>
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSMarketplaceEntitlementClient extends AmazonWebServiceClient implements AWSMarketplaceEntitlement {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AWSMarketplaceEntitlement.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "aws-marketplace";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.withSupportsIon(false)
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidParameterException").withExceptionUnmarshaller(
com.amazonaws.services.marketplaceentitlement.model.transform.InvalidParameterExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InternalServiceErrorException").withExceptionUnmarshaller(
com.amazonaws.services.marketplaceentitlement.model.transform.InternalServiceErrorExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ThrottlingException").withExceptionUnmarshaller(
com.amazonaws.services.marketplaceentitlement.model.transform.ThrottlingExceptionUnmarshaller.getInstance()))
.withBaseServiceExceptionClass(com.amazonaws.services.marketplaceentitlement.model.AWSMarketplaceEntitlementException.class));
public static AWSMarketplaceEntitlementClientBuilder builder() {
return AWSMarketplaceEntitlementClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on AWS Marketplace Entitlement Service using the specified
* parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSMarketplaceEntitlementClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on AWS Marketplace Entitlement Service using the specified
* parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSMarketplaceEntitlementClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("entitlement.marketplace.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/marketplaceentitlement/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/marketplaceentitlement/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
* <p>
* GetEntitlements retrieves entitlement values for a given product. The results can be filtered based on customer
* identifier or product dimensions.
* </p>
*
* @param getEntitlementsRequest
* The GetEntitlementsRequest contains parameters for the GetEntitlements operation.
* @return Result of the GetEntitlements operation returned by the service.
* @throws InvalidParameterException
* One or more parameters in your request was invalid.
* @throws ThrottlingException
* The calls to the GetEntitlements API are throttled.
* @throws InternalServiceErrorException
* An internal error has occurred. Retry your request. If the problem persists, post a message with details
* on the AWS forums.
* @sample AWSMarketplaceEntitlement.GetEntitlements
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/entitlement.marketplace-2017-01-11/GetEntitlements"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetEntitlementsResult getEntitlements(GetEntitlementsRequest request) {
request = beforeClientExecution(request);
return executeGetEntitlements(request);
}
@SdkInternalApi
final GetEntitlementsResult executeGetEntitlements(GetEntitlementsRequest getEntitlementsRequest) {
ExecutionContext executionContext = createExecutionContext(getEntitlementsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetEntitlementsRequest> request = null;
Response<GetEntitlementsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetEntitlementsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getEntitlementsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Marketplace Entitlement Service");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetEntitlements");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetEntitlementsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetEntitlementsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful, request, typically used for debugging issues
* where a service isn't acting as expected. This data isn't considered part of the result data returned by an
* operation, so it's available through this separate, diagnostic interface.
* <p>
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> anonymousInvoke(Request<Y> request,
HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> doInvoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
HttpResponseHandler<AmazonServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@com.amazonaws.annotation.SdkInternalApi
static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
return protocolFactory;
}
@Override
public void shutdown() {
super.shutdown();
}
}
| [
""
] | |
3dc763116202ca13b32e66019e8187940b4742a7 | 8728ea0aeedd6df212c226ac8a3c12cba047f5e4 | /app/src/test/java/il/co/idocare/requests/retrievers/RequestsRetrieverTest.java | d238a11087fae9debfda3c71ee5f472029255131 | [] | no_license | Rikenm/idocare-android | e13a39ca1e704bed2fca5323594f9a02713042d1 | af9dbe752e987cb096ad2d7be22824f0f3e5bb22 | refs/heads/master | 2020-03-31T06:09:56.942757 | 2018-09-04T13:09:09 | 2018-09-04T13:09:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,832 | java | package il.co.idocare.requests.retrievers;
import android.support.annotation.NonNull;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import il.co.idocare.requests.RequestEntity;
import il.co.idocare.testdoubles.entities.RequestEntityProvider;
import il.co.idocare.useractions.UserActionEntityFactory;
import il.co.idocare.useractions.UserActionsToRequestsApplier;
import il.co.idocare.useractions.entities.CloseRequestUserActionEntity;
import il.co.idocare.useractions.entities.PickUpRequestUserActionEntity;
import il.co.idocare.useractions.entities.UserActionEntity;
import il.co.idocare.useractions.entities.VoteForRequestUserActionEntity;
import il.co.idocare.useractions.retrievers.UserActionsRetriever;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class RequestsRetrieverTest {
private static final String TEST_USER_ID = "test_user_id";
@Mock RawRequestRetriever mRawRequestRetrieverMock;
@Mock UserActionsRetriever mUserActionsRetrieverMock;
UserActionsToRequestsApplier mUserActionsToRequestsApplier = new UserActionsToRequestsApplier();
UserActionEntityFactory mUserActionEntityFactory = new UserActionEntityFactory();
RequestsRetriever SUT;
@Before
public void setup() throws Exception {
SUT = new RequestsRetriever(mRawRequestRetrieverMock, mUserActionsRetrieverMock,
mUserActionsToRequestsApplier);
}
@Test
public void getRequestsAssignedToUser_allUserActionEffectsPresent() {
// Arrange
RequestEntity initiallyClosedRequest = RequestEntityProvider.getClosedRequestEntity();
RequestEntity initiallyNewRequest = RequestEntityProvider.getNewRequestEntity();
RequestEntity initiallyPickedUpRequest = RequestEntity
.getBuilder(RequestEntityProvider.getPickedUpRequestEntity())
.setPickedUpBy(TEST_USER_ID)
.build();
List<RequestEntity> rawRequests = new ArrayList<>(3);
rawRequests.add(initiallyClosedRequest);
rawRequests.add(initiallyNewRequest);
rawRequests.add(initiallyPickedUpRequest);
CloseRequestUserActionEntity closePickedUp = mUserActionEntityFactory.newCloseRequest(
initiallyPickedUpRequest.getId(), TEST_USER_ID, "closed_comment", Arrays.asList("one", "two"));
PickUpRequestUserActionEntity pickUpNew =
mUserActionEntityFactory.newPickUpRequest(initiallyNewRequest.getId(), TEST_USER_ID);
VoteForRequestUserActionEntity voteForClosed =
mUserActionEntityFactory.newVoteUpForRequestClosed(initiallyClosedRequest.getId());
List<UserActionEntity> userActions = new ArrayList<>(3);
userActions.add(voteForClosed);
userActions.add(pickUpNew);
userActions.add(closePickedUp);
when(mRawRequestRetrieverMock.getRequestsAssignedToUser(TEST_USER_ID)).thenReturn(rawRequests);
when(mUserActionsRetrieverMock.getAllUserActions()).thenReturn(userActions);
// Act
List<RequestEntity> resultRequests = SUT.getRequestsAssignedToUser(TEST_USER_ID);
// Assert
assertNotNull(resultRequests);
assertThat(resultRequests.size(), is(3));
RequestEntity updatedInitiallyNewRequest = getRequestById(resultRequests, initiallyNewRequest.getId());
assertNotNull(updatedInitiallyNewRequest);
assertRequestsEqual(updatedInitiallyNewRequest, RequestEntity.getBuilder(initiallyNewRequest)
.setPickedUpBy(pickUpNew.getPickedUpByUserId())
.setPickedUpAt(pickUpNew.getPickedUpAt())
.build());
RequestEntity updatedInitiallyPickedUpRequest = getRequestById(resultRequests, initiallyPickedUpRequest.getId());
assertNotNull(updatedInitiallyPickedUpRequest);
assertRequestsEqual(updatedInitiallyPickedUpRequest, RequestEntity.getBuilder(initiallyPickedUpRequest)
.setClosedBy(closePickedUp.getClosedByUserId())
.setClosedAt(closePickedUp.getClosedAt())
.setClosedComment(closePickedUp.getClosedComment())
.setClosedPictures(closePickedUp.getClosedPictures())
.setClosedVotes(0)
.build());
RequestEntity updatedInitiallyClosedRequest = getRequestById(resultRequests, initiallyClosedRequest.getId());
assertNotNull(updatedInitiallyClosedRequest);
assertRequestsEqual(updatedInitiallyClosedRequest, RequestEntity.getBuilder(initiallyClosedRequest)
.setClosedVotes(initiallyClosedRequest.getClosedVotes() + 1)
.build());
}
private void assertRequestsEqual(RequestEntity request1, RequestEntity request2) {
assertThat(request1.getId(), is(request2.getId()));
assertThat(request1.getCreatedBy(), is(request2.getCreatedBy()));
assertThat(request1.getCreatedAt(), is(request2.getCreatedAt()));
assertThat(request1.getCreatedComment(), is(request2.getCreatedComment()));
assertThat(request1.getCreatedVotes(), is(request2.getCreatedVotes()));
assertEquals(request1.getCreatedPictures(), request2.getCreatedPictures());
assertThat(request1.getLatitude(), is(request2.getLatitude()));
assertThat(request1.getLongitude(), is(request2.getLongitude()));
assertThat(request1.getLocation(), is(request2.getLocation()));
assertThat(request1.getPickedUpBy(), is(request2.getPickedUpBy()));
assertThat(request1.getPickedUpAt(), is(request2.getPickedUpAt()));
assertThat(request1.getClosedBy(), is(request2.getClosedBy()));
assertThat(request1.getClosedAt(), is(request2.getClosedAt()));
assertThat(request1.getClosedComment(), is(request2.getClosedComment()));
assertThat(request1.getClosedVotes(), is(request2.getClosedVotes()));
assertEquals(request1.getClosedPictures(), request2.getClosedPictures());
assertThat(request1.getId(), is(request2.getId()));
assertThat(request1.getId(), is(request2.getId()));
}
private RequestEntity getRequestById(@NonNull List<RequestEntity> requests, String id) {
for (RequestEntity requestEntity : requests) {
if (requestEntity.getId().equals(id)) {
return requestEntity;
}
}
return null;
}
} | [
"vasiliy.zukanov@gmail.com"
] | vasiliy.zukanov@gmail.com |
c438495a7497123edd60884584b59b0c044d7f8a | 13997c099034a496006b5bd62dd9e85343680481 | /app/src/main/java/com/jc/pda/MainActivity.java | adf43f6d94fa6e510d8d4c86fddc23091ccdc80e | [] | no_license | iamzzj/PDA | e12b9804f7a7df9f3861ce42a858609965216057 | be96765862f8f2968f16d7d7369c07a7ecb7035c | refs/heads/master | 2020-03-19T21:21:43.556453 | 2018-06-11T14:27:00 | 2018-06-11T14:27:00 | 136,937,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.jc.pda;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"iamzzj@qq.com"
] | iamzzj@qq.com |
3d241f879e34db20f822eb9f790653905ff6d861 | 6dea412c74f0a1196b8b447d093f94260b96ace5 | /src/main/java/com/huofu/module/i5wei/base/SysConfig.java | 8d2f0382dc8d4dd2a3912d9c0882579240a12c2c | [] | no_license | zhangsuliang/java8 | 7104bbe167fc2cccb21feb55a3a6865881fbbcef | d900457e070b18597c8eab73a588c366928ff5d7 | refs/heads/master | 2021-09-08T02:59:15.536504 | 2018-03-06T09:40:34 | 2018-03-06T09:40:34 | 119,370,644 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,316 | java | package com.huofu.module.i5wei.base;
import java.util.ResourceBundle;
/**
* Created by akwei on 9/30/14.
*/
public class SysConfig {
public static final ResourceBundle BUNDLE = ResourceBundle.getBundle("sysconfig");
private static final ResourceBundle rb = ResourceBundle.getBundle
("i5weiconfig");
public static String getCahceKeyPrefix() {
return BUNDLE.getString("cache_key_prefix");
}
public static boolean isEnableCache() {
return Boolean.parseBoolean(BUNDLE.getString("memcached.enableCache"));
}
public static String getWechatNotifyServer() {
return BUNDLE.getString("wechat.notify.server");
}
public static String getWechatNotifyServerBaseUrl() {
return BUNDLE.getString("wechat.notify.server");
}
public static int getOfficalUserGzId() {
return Integer.parseInt(rb.getString("user.gzId"));
}
public static int getOfficalMerchantGzId() {
return Integer.parseInt(rb.getString("merchant.gzId"));
}
/**
* 获取营业时段事件主题
*/
public static String getStoreTimeBucketTopicArn() {
return BUNDLE.getString("sns.storeTimeBucket");
}
/**
* 获取餐牌号事件主题
*/
public static String getSiteNumberTopicArn() {
return BUNDLE.getString("sns.siteNumber");
}
/**
* 获取桌台模式设置事件主题
*/
public static String getStoreTableSettingTopicArn() {
return BUNDLE.getString("sns.storeTableSetting");
}
/**
* 获取产品成本变动的事件主题
*/
public static String getProductEventTopicArn() {
return BUNDLE.getString("sns.store_product");
}
/**
* 获取店铺设置事件主题
*/
public static String getStoreSettingTopicArn() {
return BUNDLE.getString("sns.store_setting");
}
public static String getImageServerPath() {
return rb.getString("img.server.path");
}
/**
* 删除收费项目事件主题
*/
public static String getDeleteChargeItemTopicArn() {
return BUNDLE.getString("sns.delete_chargeItem");
}
/**
* 获取出餐口主题
*/
public static String getStoreMealPortTopicArn() {
return BUNDLE.getString("sns.store_meal_port");
}
}
| [
"zhangsuliang_job@163.com"
] | zhangsuliang_job@163.com |
04b8ef652b31df39d2c8ebb8f4495d78b2923faa | 356c95539599458d844faa653e1e426c3a2d49f4 | /app/src/inpe/java/minsa/formulario/Util/AgeCalculator.java | 8562ba7c395833f5fdf9683a16a3fdeb3afd7031 | [] | no_license | jose-g/espirometro | a02ae5d1a3bebed6b7ff6bdd816b36cfd56a2c9e | 2e8259eb47bd8d7d05cd157efece7ed0fba49a6f | refs/heads/master | 2022-12-06T07:44:42.432788 | 2020-08-22T02:29:48 | 2020-08-22T02:29:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,078 | java | package minsa.formulario.Util;
import java.util.Calendar;
import java.util.Date;
public class AgeCalculator {
public static Age calculateAge(Date birthDate) {
int years = 0;
int months = 0;
int days = 0;
//create calendar object for birth day
Calendar birthDay = Calendar.getInstance();
birthDay.setTimeInMillis(birthDate.getTime());
//create calendar object for current day
long currentTime = System.currentTimeMillis();
Calendar now = Calendar.getInstance();
now.setTimeInMillis(currentTime);
//Get difference between years
years = now.get(Calendar.YEAR) - birthDay.get(Calendar.YEAR);
int currMonth = now.get(Calendar.MONTH) + 1;
int birthMonth = birthDay.get(Calendar.MONTH) + 1;
//Get difference between months
months = currMonth - birthMonth;
//if month difference is in negative then reduce years by one
//and calculate the number of months.
if (months < 0)
{
years--;
months = 12 - birthMonth + currMonth;
if (now.get(Calendar.DATE) < birthDay.get(Calendar.DATE))
months--;
} else if (months == 0 && now.get(Calendar.DATE) < birthDay.get(Calendar.DATE))
{
years--;
months = 11;
}
//Calculate the days
if (now.get(Calendar.DATE) > birthDay.get(Calendar.DATE))
days = now.get(Calendar.DATE) - birthDay.get(Calendar.DATE);
else if (now.get(Calendar.DATE) < birthDay.get(Calendar.DATE))
{
int today = now.get(Calendar.DAY_OF_MONTH);
now.add(Calendar.MONTH, -1);
days = now.getActualMaximum(Calendar.DAY_OF_MONTH) - birthDay.get(Calendar.DAY_OF_MONTH) + today;
}
else
{
days = 0;
if (months == 12)
{
years++;
months = 0;
}
}
//Create new Age object
return new Age(days, months, years);
}
} | [
"jose.guerreror@inpe.gob.pe"
] | jose.guerreror@inpe.gob.pe |
8f0df8e3ded648f953285153744a0546c9338170 | 582ec99114dcbdf3469886cd872df02f2d7dc5e0 | /src/main/java/Main.java | 24775633a1779a7f2fb5ff25fead24eca451b53d | [] | no_license | vsevols/pnet | bc614fc608f72210f0f7b695ab53871c5ce4abd0 | fdd6c85f19b8fdd3f8e942715ce24a354132ec05 | refs/heads/master | 2023-01-06T23:15:51.439750 | 2020-10-10T11:02:53 | 2020-10-10T11:02:53 | 289,026,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 277 | java | import com.pnet.Router;
import it.tdlight.tdlight.utils.CantLoadLibrary;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws Exception {
Router router = new Router();
router.Init();
router.run();
}
}
| [
"vsevols@gmail.com"
] | vsevols@gmail.com |
7dee09132294a42d6c6725fa5f5fd49a305a6370 | 57555cf121de4958c2008b0b835521aae9659c49 | /app/src/main/java/winservices/com/listapro/models/dao/AssocShopDCategoryDao.java | 892e458bf402436d8e54f5ffadc52043866a0a30 | [] | no_license | omarhaji080286/ListaPro | c2e25ff04793d8e6a626ce56f84ed23adbf472a0 | fe56549851481ddbe13349ad41ce5404aa15ed6f | refs/heads/master | 2021-07-24T18:17:05.829014 | 2020-04-17T08:48:59 | 2020-04-17T08:48:59 | 154,531,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | package winservices.com.listapro.models.dao;
import java.util.List;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import winservices.com.listapro.models.entities.AssocShopDCategory;
@Dao
public interface AssocShopDCategoryDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(AssocShopDCategory assoc);
@Update
void update(AssocShopDCategory assoc);
@Delete
void delete(AssocShopDCategory assoc);
@Query("SELECT * FROM shops_has_default_categories")
LiveData<List<AssocShopDCategory>> getAllAssocShopDCategory();
}
| [
"omar.haji@gmail.com"
] | omar.haji@gmail.com |
3fc9d5502fc3d925009222ae582e71c8efc94668 | ea3024547bb286ccedc11c0d1c71ef4d4788bff6 | /src/java/ru/ifmo/genetics/tools/ApproximateKmerCounter.java | 17b527a6f7b7c5c6b0d505e5ddcb221415ebc5e0 | [
"MIT"
] | permissive | ctlab/itmo-assembler | befd44df5e30c6b11cf531e5c89d68e98f936293 | 163177494fa08c50f056ab219bd626a0130ab338 | refs/heads/master | 2022-04-30T06:08:15.660730 | 2022-03-22T08:08:55 | 2022-03-22T08:08:55 | 136,324,827 | 3 | 1 | MIT | 2019-09-09T07:22:42 | 2018-06-06T12:21:50 | Java | UTF-8 | Java | false | false | 8,003 | java | package ru.ifmo.genetics.tools;
import com.clearspring.analytics.stream.cardinality.CardinalityMergeException;
import com.clearspring.analytics.stream.cardinality.HyperLogLog;
import com.clearspring.analytics.stream.cardinality.ICardinality;
import org.apache.commons.lang.mutable.MutableLong;
import org.jetbrains.annotations.Nullable;
import ru.ifmo.genetics.dna.DnaQ;
import ru.ifmo.genetics.dna.DnaTools;
import ru.ifmo.genetics.dna.DnaView;
import ru.ifmo.genetics.io.readers.BinqReader;
import ru.ifmo.genetics.executors.TaskWithSharedContext;
import ru.ifmo.genetics.executors.ThreadExecutorWithSharedContext;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
public class ApproximateKmerCounter {
public final static int minK = 21;
public final static int maxK = 31;
public final static int kd = 10;
public static void main(String[] args) throws InterruptedException, IOException {
CountingContext result = new CountingContext();
ThreadExecutorWithSharedContext<CountingContext> executor = new ThreadExecutorWithSharedContext<CountingContext>(6);
final int TASK_SIZE = 1 << 10;
ArrayList<DnaQ> task = new ArrayList<DnaQ>(TASK_SIZE);
long dnaQsNumber = 0;
long sumLength = 0;
ArrayList<MutableLong> lengthsStat = new ArrayList<MutableLong>();
for (String file: args) {
// FastqReader reader = new FastqReader(new File(file), Sanger.instance);
BinqReader reader = new BinqReader(new File(file));
for (DnaQ dnaq: reader) {
task.add(dnaq);
dnaQsNumber++;
sumLength += dnaq.length();
if (dnaq.length() >= lengthsStat.size()) {
for (int i = lengthsStat.size(); i <= dnaq.length(); ++i) {
lengthsStat.add(new MutableLong());
}
}
lengthsStat.get(dnaq.length()).increment();
if (task.size() == TASK_SIZE) {
// executor.blockingExecute(new CountingTask(task, result));
executor.blockingExecute(new CountingTask(task));
task = new ArrayList<DnaQ>(TASK_SIZE);
}
/*
String sRc = DnaTools.toString(DnaView.rcView(dnaq));
for (int k = minK; k <= maxK; k += kd) {
for (int i = 0; i + k < s.length(); ++i) {
counters[k].offer(sRc.substring(i, i + k));
}
}
*/
}
}
if (!task.isEmpty()) {
executor.blockingExecute(new CountingTask(task));
}
System.out.println("reads number: " + dnaQsNumber);
System.out.println("total length: " + sumLength);
executor.shutdownAndAwaitTermination();
// System.out.println(x);
System.out.println("number of k-mers:");
for (CountingContext resultPart: executor.getContexts()) {
try {
result = result.merge(resultPart);
} catch (CardinalityMergeException e) {
throw new RuntimeException(e);
}
}
long genomeSize = 0;
for (int k = minK; k<= maxK; k += kd) {
long cardinality = result.counters[k].cardinality();
ICardinality counterWithRc;
counterWithRc = result.counters[k].merge(result.rcCounters[k]);
long cardinalityWithRc = counterWithRc.cardinality();
long currentGenomeEstimation = (2 * cardinality - cardinalityWithRc) / 2;
if (currentGenomeEstimation > genomeSize) {
genomeSize = currentGenomeEstimation;
}
System.out.println(k + ":\t" + cardinality + "\t" + cardinalityWithRc + "\t" + currentGenomeEstimation);
}
System.out.println("Estimated genome size: " + genomeSize);
System.out.println("Read length distribution:");
for (int i = 0; i < lengthsStat.size(); ++i) {
System.out.println(i + "\t" + lengthsStat.get(i));
}
double averageStartDistance = genomeSize / (double) dnaQsNumber;
System.out.println("Average distance between starts: " + averageStartDistance);
int maxLength = lengthsStat.size() - 1;
System.err.println("Probability of having overlap of length k:");
for (int k = 15; k < 91; ++k) {
double prob = 0;
double dprob = Math.exp(-averageStartDistance);
for (int d = 0; d <= maxLength; ++d) {
if (d > 0) {
dprob *= averageStartDistance / d;
}
long t = 0;
for (int l1 = d + k; l1 <= maxLength; ++l1) {
for (int l2 = k; l2 <= maxLength; ++l2) {
t += lengthsStat.get(l1).longValue() * lengthsStat.get(l2).longValue();
}
}
prob += dprob * t / dnaQsNumber /dnaQsNumber;
}
System.out.println(k + "\t" + prob + "\t" + k * prob);
}
}
public static class CountingContext {
public final HyperLogLog[] counters;
public final HyperLogLog[] rcCounters;
public CountingContext(HyperLogLog[] counters, HyperLogLog[] rcCounters) {
this.counters = counters;
this.rcCounters = rcCounters;
}
public CountingContext() {
this(new HyperLogLog[maxK + 1], new HyperLogLog[maxK + 1]);
for (int i = minK; i <= maxK; i += kd) {
counters[i] = new HyperLogLog(20);
}
for (int i = minK; i <= maxK; i += kd) {
rcCounters[i] = new HyperLogLog(20);
}
}
public CountingContext merge(CountingContext other) throws CardinalityMergeException {
HyperLogLog[] newCounters = new HyperLogLog[maxK + 1];
HyperLogLog[] newRcCounters = new HyperLogLog[maxK + 1];
for (int i = minK; i <= maxK; i += kd) {
newCounters[i] = (HyperLogLog) counters[i].merge(other.counters[i]);
}
for (int i = minK; i <= maxK; i += kd) {
newRcCounters[i] = (HyperLogLog) rcCounters[i].merge(other.rcCounters[i]);
}
return new CountingContext(newCounters, newRcCounters);
}
}
public static class CountingTask implements TaskWithSharedContext<CountingContext> {
private Iterable<? extends DnaQ> task;
private @Nullable CountingContext context;
public CountingTask(Iterable<? extends DnaQ> task) {
this.task = task;
}
public CountingTask(Iterable<DnaQ> task, CountingContext context) {
this.task = task;
this.context = context;
}
@Override
public void run() {
if (context == null) {
context = new CountingContext();
}
for (DnaQ dnaq: task) {
String s = DnaTools.toString(dnaq);
for (int k = minK; k <= maxK; k += kd) {
for (int i = 0; i + k < s.length(); ++i) {
context.counters[k].offer(s.substring(i, i + k));
}
}
String sRc = DnaTools.toString(DnaView.rcView(dnaq));
for (int k = minK; k <= maxK; k += kd) {
for (int i = 0; i + k < s.length(); ++i) {
context.rcCounters[k].offer(sRc.substring(i, i + k));
}
}
}
}
@Nullable
public CountingContext getContext() {
return context;
}
public void setContext(@Nullable CountingContext context) {
if (context == null) {
return;
}
this.context = context;
}
}
}
| [
"svkazakov@rain.ifmo.ru"
] | svkazakov@rain.ifmo.ru |
29c6ef7c4acb6c79137d8ee285f730b7d3365f4a | f42cffb655b25cfd9ce106a8fcb6a8b9510519c1 | /src/main/java/com/feri/rs/exlistener/ExpireEventListener.java | f449060eff64e2336b495deccf39c05bcfbb05b7 | [] | no_license | xingpenghui/RedisStudy | 258068316f3b693a13298763b0048b7299dcc694 | 1b32304af77607a79bf2708e46fbe17527500e69 | refs/heads/master | 2021-04-16T06:12:44.769341 | 2020-03-23T09:12:12 | 2020-03-23T09:12:12 | 249,333,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package com.feri.rs.exlistener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.JedisPubSub;
/**
* @program: RedisStudy
* @description:
* @author: Feri
* @create: 2020-03-23 15:10
*/
public class ExpireEventListener extends JedisPubSub {
private Logger logger= LoggerFactory.getLogger(ExpireEventListener.class);
@Override
public void onMessage(String channel, String message) {
System.out.println("获取消息:"+message);
}
@Override
public void onPMessage(String pattern, String channel, String message) {
logger.info("Redis订阅超时key失效监听:"+message);
}
}
| [
"xingfei_work@163.com"
] | xingfei_work@163.com |
176bb809ea424b4aa0bc9fe17ccbc3f26bfc0e61 | 0afa99db82518dca677753bfd0016acaf06763ea | /src/br/com/markConsult/classesMetodos/OrdemTableModel.java | fdd9b970635390e7b0f81f98f5cd8fcfb0efb740 | [] | no_license | jefersoncj/Projeto-NEUROCENTER-Desktop | 663849c96538950e846f6f48dfc4d69ef8d9b5be | 7fd11590c12bfc893a9b9dcc68063ca72cc37647 | refs/heads/master | 2021-01-25T13:17:30.116642 | 2018-03-10T04:12:06 | 2018-03-10T04:12:06 | 123,546,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,810 | java | package br.com.markConsult.classesMetodos;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import br.com.markConsult.entidades.OrdemExames;
import java.util.ArrayList;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.List;
import javax.swing.table.AbstractTableModel;
/**
*
* @author jeferson
*/
public class OrdemTableModel extends AbstractTableModel{
//constantes que vão representar as colunas
SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
private final int COL_CODIGO = 0;
private final int COL_DATA_ORDEM = 1;
private final int COL_EMPRESA = 2;
private final int COL_PERIODICIDADE = 3;
//lista dos produtos que serão exibidos
private List<OrdemExames> ordemExamess;
public OrdemTableModel() {
ordemExamess = new ArrayList();
}
public OrdemTableModel(List<OrdemExames> lista) {
this();
ordemExamess.addAll(lista);
}
@Override
public int getRowCount() {
//cada produto na lista será uma linha
return ordemExamess.size();
}
@Override
public int getColumnCount() {
//Quantidade de colunas
return 4;
}
@Override
public String getColumnName(int column) {
//qual o nome da coluna
if (column == COL_CODIGO) {
return "Código";
}else if (column == COL_DATA_ORDEM) {
return "Data";
}else if (column == COL_EMPRESA) {
return "Empresa";
}else if (column == COL_PERIODICIDADE) {
return "Periodicidade";
}
return "";
}
@Override
public Class getColumnClass(int columnIndex) {
// retorna a classe que representa a coluna
if (columnIndex == COL_DATA_ORDEM) {
return int.class;
} else if (columnIndex == COL_DATA_ORDEM) {
return Date.class;
}else if (columnIndex == COL_EMPRESA) {
return String.class;
}else if (columnIndex == COL_PERIODICIDADE) {
return String.class;
}
return String.class;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
//pega o produto da linha
OrdemExames c = ordemExamess.get(rowIndex);
//verifica qual valor deve ser retornado
if (columnIndex == COL_CODIGO) {
return c.getId();
}
else if (columnIndex == COL_DATA_ORDEM) {
return formato.format(c.getData());
}
else if (columnIndex == COL_EMPRESA) {
return c.getEmpresa();
}
else if (columnIndex == COL_PERIODICIDADE) {
return c.getPeriodicidade();
}
return "";
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
fireTableDataChanged();
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
//no nosso caso todas não vão ser editáveis, entao retorna false pra todas
return false;
}
public void limpaLista() {
ordemExamess.clear();
fireTableDataChanged();
}
public void listar(List<OrdemExames> c) {
ordemExamess.clear();
ordemExamess = c;
fireTableDataChanged();
}
public List<OrdemExames> getListar() {
return ordemExamess;
}
public OrdemExames getItem(int pos) {
if (pos < 0 || pos >= ordemExamess.size()) {
return null;
}
return ordemExamess.get(pos);
}
}
| [
"jefersoncj@outlook.com"
] | jefersoncj@outlook.com |
c6a92c9c19cb5163e82f30556752ce09f178df50 | a3c0dbeb6df10f162c0a440e1baf88cacfa2c33c | /src/test/com/reversevending/TestUserRoles.java | bf9fbaf6cd0efe9224fb57d0069e3dd444473f79 | [] | no_license | ThaboMoopa/ReverseVending | 5f7867324ad719ff80e609e4a705f316489f3a5d | 83b1622073360229ed30570f3358952b7f7daa7a | refs/heads/master | 2022-09-22T11:07:13.763114 | 2019-07-29T06:53:41 | 2019-07-29T06:53:41 | 197,124,090 | 0 | 0 | null | 2022-09-08T01:01:37 | 2019-07-16T05:07:41 | CSS | UTF-8 | Java | false | false | 2,101 | java | package com.reversevending;
import com.reversevending.beans.UserRolesBean;
import com.reversevending.databaseOperationsDAO.UserRolesDAO;
import com.reversevending.domain.Customer;
import com.reversevending.domain.Roles;
import com.reversevending.domain.Transactions;
import com.reversevending.domain.UserRoles;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.junit.Test;
import java.time.LocalDate;
public class TestUserRoles {
@Test
public void add()
{
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
create(session);
}
public void create(Session session)
{
System.out.println("Creating car records...");
Customer customer = new Customer();
customer.setName("Thembi");
customer.setSurname("Thembi");
customer.setContact("0849262266");
customer.setEmail("thembi.moopa@gmail.com");
customer.setPassword("mysql");
Transactions transaction = new Transactions();
transaction.setCustomer(customer);// .setStreet("M");
transaction.setTransactionDate(LocalDate.now());
Roles roles = new Roles();
roles.setRoleName("Admin");
UserRoles userRoles = new UserRoles();
userRoles.setCustomer(customer);
userRoles.setRole(roles);
session.beginTransaction();
session.save(customer);
session.save(transaction);
session.save(roles);
//session.save(userRoles);
session.getTransaction().commit();
long customerId = customer.getId();
long roleId = roles.getId();
System.out.println(customerId);
System.out.println(roleId);
//session.beginTransaction();
UserRolesDAO userRolesDAO = new UserRolesDAO();
userRolesDAO.add(userRoles, customerId, roleId);
//session.getTransaction().commit();
//UserRolesBean bean = new UserRolesBean();
//bean.add();
}
}
| [
"thabo.moopa@gmail.com"
] | thabo.moopa@gmail.com |
566460c36860576b9ceb2b1ff6a2999d8fc1dabd | bde3252feb647af62651965c820b31cbde8be408 | /src/main/java/org/fastquery/httpsign/Algorithm.java | b3ce7e81e2f1032485878ddbbc3e4b0c1f447aee | [
"Apache-2.0"
] | permissive | xixifeng/httpsign | 80cd03b66c554aaa2e4438f80eaeb2e108d3d401 | 9ccf5590e3a6bcd4fde3dc3191fe5a3c07ab4df1 | refs/heads/master | 2022-07-03T23:22:35.811542 | 2019-11-08T08:22:41 | 2019-11-08T08:22:41 | 129,718,278 | 6 | 0 | Apache-2.0 | 2022-06-17T01:48:40 | 2018-04-16T09:27:00 | Java | UTF-8 | Java | false | false | 1,146 | java | /*
* Copyright (c) 2016-2100, fastquery.org and/or its affiliates. All rights reserved.
*
* 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.
*
* For more information, please see http://www.fastquery.org/.
*
*/
package org.fastquery.httpsign;
/**
* 可选算法
*
* @author mei.sir@aliyun.cn
*/
enum Algorithm {
/**
* HmacSHA1
*/
HMACSHA1,
/**
* HmacSHA256
*/
HMACSHA256;
}
| [
"fastquery@126.com"
] | fastquery@126.com |
b2442e63fdea58a01eeaf8c1ff0f6f3990c1c698 | b10a88255f4fe787b005aebf71fca13f6269c3ae | /JPL/ch01/ex01_15/LookupImpl.java | 9e8c5d57d7792838f0e4ba8420f230ec77f7d90f | [] | no_license | KeisukeMori/JAVA_TRAINING | 3e91602003c21264c31b6edf0c67bf6df1795d26 | 417248deb417df061c50834bdda9e3111207ed06 | refs/heads/master | 2016-09-11T03:19:01.522820 | 2013-01-10T19:28:36 | 2013-01-10T19:28:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 138 | java | package ch01.ex01_15;
public interface LookupImpl extends Lookup {
void add(Object value);
Object remove(String name);
}
| [
"keisuke.mori@nts.ricoh.co.jp"
] | keisuke.mori@nts.ricoh.co.jp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.