blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
896647f1f1bc6f7ccfe488f47b1298c5e42972a1 | 14185e67f441733f835e6280976350e407b6b97a | /exercise-jdbc-api/src/main/java/com/intelisoft/api/dao/ICarDao.java | 3481867be546f351afec4f3a38a7986431d904c6 | [] | no_license | lanaflonform/intelisoft-JDBC | bb8a37ab26bacfe7298cac4d0dece1631898c566 | d2812a6fa46b4c48c15865ee453ad0b2918672c2 | refs/heads/master | 2020-12-09T04:28:02.288040 | 2017-07-23T22:31:54 | 2017-07-23T22:31:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package com.intelisoft.api.dao;
import java.sql.Connection;
import java.sql.SQLException;
import com.intelisoft.model.Car;
public interface ICarDao extends IModelDao<Car> {
public Car getByIdWithConsumer(long id, Connection connection) throws SQLException;
}
| [
"wasa-bi@mail.ru"
] | wasa-bi@mail.ru |
b123968d8ef06c999b30e68ef250a7a00d7957e6 | a88404e860f9e81f175d80c51b8e735fa499c93c | /hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/codesystems/FeedingDevice.java | 9522529673d918852a7f858651d23c47bf390dd6 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | sabri0/hapi-fhir | 4a53409d31b7f40afe088aa0ee8b946860b8372d | c7798fee4880ee8ffc9ed2e42c29c3b8f6753a1c | refs/heads/master | 2020-06-07T20:02:33.258075 | 2019-06-18T09:40:00 | 2019-06-18T09:40:00 | 193,081,738 | 2 | 0 | Apache-2.0 | 2019-06-21T10:46:17 | 2019-06-21T10:46:17 | null | UTF-8 | Java | false | false | 10,413 | java | package org.hl7.fhir.r4.model.codesystems;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
import org.hl7.fhir.exceptions.FHIRException;
public enum FeedingDevice {
/**
* Standard nipple definition:
*/
STANDARDNIPPLE,
/**
* Preemie nipple definition:
*/
PREEMIENIPPLE,
/**
* Orthodontic nipple definition:
*/
ORTHONIPPLE,
/**
* Slow flow nipple definition:
*/
SLOFLONIPPLE,
/**
* Middle flow nipple definition:
*/
MIDFLONIPPLE,
/**
* Enlarged, cross-cut nipple definition:
*/
BIGCUTNIPPLE,
/**
* Haberman bottle definition:
*/
HABERMANBOTTLE,
/**
* Sippy cup with valve definition:
*/
SIPPYVALVE,
/**
* Sippy cup without valve definition:
*/
SIPPYNOVALVE,
/**
* Provale Cup definition:
*/
PROVALECUP,
/**
* Glass with lid/sippy cup definition:
*/
GLASSLID,
/**
* Double handhold on glass/cup definition:
*/
HANDHOLDCUP,
/**
* Rubber matting under tray definition:
*/
RUBBERMAT,
/**
* Straw definition:
*/
STRAW,
/**
* Nose cup definition:
*/
NOSECUP,
/**
* Scoop plate definition:
*/
SCOOPPLATE,
/**
* Hand wrap utensil holder definition:
*/
UTENSILHOLDER,
/**
* Foam handle utensils definition:
*/
FOAMHANDLE,
/**
* Angled utensils definition:
*/
ANGLEDUTENSIL,
/**
* Spout cup definition:
*/
SPOUTCUP,
/**
* Automated feeding devices definition:
*/
AUTOFEEDINGDEVICE,
/**
* Rocker knife definition:
*/
ROCKERKNIFE,
/**
* added to help the parsers
*/
NULL;
public static FeedingDevice fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("standard-nipple".equals(codeString))
return STANDARDNIPPLE;
if ("preemie-nipple".equals(codeString))
return PREEMIENIPPLE;
if ("ortho-nipple".equals(codeString))
return ORTHONIPPLE;
if ("sloflo-nipple".equals(codeString))
return SLOFLONIPPLE;
if ("midflo-nipple".equals(codeString))
return MIDFLONIPPLE;
if ("bigcut-nipple".equals(codeString))
return BIGCUTNIPPLE;
if ("haberman-bottle".equals(codeString))
return HABERMANBOTTLE;
if ("sippy-valve".equals(codeString))
return SIPPYVALVE;
if ("sippy-no-valve".equals(codeString))
return SIPPYNOVALVE;
if ("provale-cup".equals(codeString))
return PROVALECUP;
if ("glass-lid".equals(codeString))
return GLASSLID;
if ("handhold-cup".equals(codeString))
return HANDHOLDCUP;
if ("rubber-mat".equals(codeString))
return RUBBERMAT;
if ("straw".equals(codeString))
return STRAW;
if ("nose-cup".equals(codeString))
return NOSECUP;
if ("scoop-plate".equals(codeString))
return SCOOPPLATE;
if ("utensil-holder".equals(codeString))
return UTENSILHOLDER;
if ("foam-handle".equals(codeString))
return FOAMHANDLE;
if ("angled-utensil".equals(codeString))
return ANGLEDUTENSIL;
if ("spout-cup".equals(codeString))
return SPOUTCUP;
if ("autofeeding-device".equals(codeString))
return AUTOFEEDINGDEVICE;
if ("rocker-knife".equals(codeString))
return ROCKERKNIFE;
throw new FHIRException("Unknown FeedingDevice code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case STANDARDNIPPLE: return "standard-nipple";
case PREEMIENIPPLE: return "preemie-nipple";
case ORTHONIPPLE: return "ortho-nipple";
case SLOFLONIPPLE: return "sloflo-nipple";
case MIDFLONIPPLE: return "midflo-nipple";
case BIGCUTNIPPLE: return "bigcut-nipple";
case HABERMANBOTTLE: return "haberman-bottle";
case SIPPYVALVE: return "sippy-valve";
case SIPPYNOVALVE: return "sippy-no-valve";
case PROVALECUP: return "provale-cup";
case GLASSLID: return "glass-lid";
case HANDHOLDCUP: return "handhold-cup";
case RUBBERMAT: return "rubber-mat";
case STRAW: return "straw";
case NOSECUP: return "nose-cup";
case SCOOPPLATE: return "scoop-plate";
case UTENSILHOLDER: return "utensil-holder";
case FOAMHANDLE: return "foam-handle";
case ANGLEDUTENSIL: return "angled-utensil";
case SPOUTCUP: return "spout-cup";
case AUTOFEEDINGDEVICE: return "autofeeding-device";
case ROCKERKNIFE: return "rocker-knife";
default: return "?";
}
}
public String getSystem() {
return "http://hl7.org/fhir/feeding-device";
}
public String getDefinition() {
switch (this) {
case STANDARDNIPPLE: return "Standard nipple definition:";
case PREEMIENIPPLE: return "Preemie nipple definition:";
case ORTHONIPPLE: return "Orthodontic nipple definition:";
case SLOFLONIPPLE: return "Slow flow nipple definition:";
case MIDFLONIPPLE: return "Middle flow nipple definition:";
case BIGCUTNIPPLE: return "Enlarged, cross-cut nipple definition:";
case HABERMANBOTTLE: return "Haberman bottle definition:";
case SIPPYVALVE: return "Sippy cup with valve definition:";
case SIPPYNOVALVE: return "Sippy cup without valve definition:";
case PROVALECUP: return "Provale Cup definition:";
case GLASSLID: return "Glass with lid/sippy cup definition:";
case HANDHOLDCUP: return "Double handhold on glass/cup definition:";
case RUBBERMAT: return "Rubber matting under tray definition:";
case STRAW: return "Straw definition:";
case NOSECUP: return "Nose cup definition:";
case SCOOPPLATE: return "Scoop plate definition:";
case UTENSILHOLDER: return "Hand wrap utensil holder definition:";
case FOAMHANDLE: return "Foam handle utensils definition:";
case ANGLEDUTENSIL: return "Angled utensils definition:";
case SPOUTCUP: return "Spout cup definition:";
case AUTOFEEDINGDEVICE: return "Automated feeding devices definition:";
case ROCKERKNIFE: return "Rocker knife definition:";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case STANDARDNIPPLE: return "Standard nipple";
case PREEMIENIPPLE: return "Preemie nipple";
case ORTHONIPPLE: return "Orthodontic nipple";
case SLOFLONIPPLE: return "Slow flow nipple";
case MIDFLONIPPLE: return "Middle flow nipple";
case BIGCUTNIPPLE: return "Enlarged, cross-cut nipple";
case HABERMANBOTTLE: return "Haberman bottle";
case SIPPYVALVE: return "Sippy cup with valve";
case SIPPYNOVALVE: return "Sippy cup without valve";
case PROVALECUP: return "Provale Cup";
case GLASSLID: return "Glass with lid/sippy cup";
case HANDHOLDCUP: return "Double handhold on glass/cup";
case RUBBERMAT: return "Rubber matting under tray";
case STRAW: return "Straw";
case NOSECUP: return "Nose cup";
case SCOOPPLATE: return "Scoop plate";
case UTENSILHOLDER: return "Hand wrap utensil holder";
case FOAMHANDLE: return "Foam handle utensils";
case ANGLEDUTENSIL: return "Angled utensils";
case SPOUTCUP: return "Spout cup";
case AUTOFEEDINGDEVICE: return "Automated feeding devices";
case ROCKERKNIFE: return "Rocker knife";
default: return "?";
}
}
}
| [
"jamesagnew@gmail.com"
] | jamesagnew@gmail.com |
1b57af4e5d2ae1a864e5f493c985e202abd5b466 | 7aa36431660ff1832debbb21dede14ce277be8ca | /src/main/java/lucene/index/MultiFields.java | 66d50ca0b74d85edcdc8266291ed53b4532037b4 | [] | no_license | DeanWanghewei/lucene-source-code-analysis | c329558f2f25c3517bc0277d64d4949db73afab2 | 1b50a9e8ece4ee0881d4745268ee1977b406c423 | refs/heads/master | 2020-04-28T21:26:30.584598 | 2019-03-15T10:13:42 | 2019-03-15T10:13:42 | 175,581,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,284 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lucene.index;
import lucene.util.MergedIterator;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Provides a single {@link Fields} term index view over an
* {@link IndexReader}.
* This is useful when you're interacting with an {@link
* IndexReader} implementation that consists of sequential
* sub-readers (eg {@link DirectoryReader} or {@link
* MultiReader}) and you must treat it as a {@link LeafReader}.
*
* <p><b>NOTE</b>: for composite readers, you'll get better
* performance by gathering the sub readers using
* {@link IndexReader#getContext()} to get the
* atomic leaves and then operate per-LeafReader,
* instead of using this class.
*
* @lucene.internal
*/
public final class MultiFields extends Fields {
private final Fields[] subs;
private final ReaderSlice[] subSlices;
private final Map<String,Terms> terms = new ConcurrentHashMap<>();
/**
* Sole constructor.
*/
public MultiFields(Fields[] subs, ReaderSlice[] subSlices) {
this.subs = subs;
this.subSlices = subSlices;
}
@SuppressWarnings({"unchecked","rawtypes"})
@Override
public Iterator<String> iterator() {
Iterator<String> subIterators[] = new Iterator[subs.length];
for(int i=0;i<subs.length;i++) {
subIterators[i] = subs[i].iterator();
}
return new MergedIterator<>(subIterators);
}
@Override
public Terms terms(String field) throws IOException {
Terms result = terms.get(field);
if (result != null)
return result;
// Lazy init: first time this field is requested, we
// create & add to terms:
final List<Terms> subs2 = new ArrayList<>();
final List<ReaderSlice> slices2 = new ArrayList<>();
// Gather all sub-readers that share this field
for(int i=0;i<subs.length;i++) {
final Terms terms = subs[i].terms(field);
if (terms != null) {
subs2.add(terms);
slices2.add(subSlices[i]);
}
}
if (subs2.size() == 0) {
result = null;
// don't cache this case with an unbounded cache, since the number of fields that don't exist
// is unbounded.
} else {
result = new MultiTerms(subs2.toArray(Terms.EMPTY_ARRAY),
slices2.toArray(ReaderSlice.EMPTY_ARRAY));
terms.put(field, result);
}
return result;
}
@Override
public int size() {
return -1;
}
}
| [
"deanwanghewei@163.com"
] | deanwanghewei@163.com |
ec04dc42c4ad25d6008a26918865fda7d5002c27 | 805579dcf8a39987ea3854966f968ef8cf4f95f7 | /dynamic-route/src/main/java/com/yao/sc/dynamicroute/ApiGatewayDynamicRouteApplication.java | 97ed71afcd5985208c95a623bd48a9400d403224 | [] | no_license | ghyaolong/sc-all | ed2b38239f3c21fcf13bff21a9c07a29046b881a | 4c3e2538950122fc796ea51a4468c78467872341 | refs/heads/master | 2020-05-29T15:29:06.377129 | 2019-06-26T08:28:47 | 2019-06-26T08:28:47 | 189,214,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | package com.yao.sc.dynamicroute;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
@EnableDiscoveryClient
@SpringBootApplication
@EnableZuulProxy
@RefreshScope
public class ApiGatewayDynamicRouteApplication {
public static void main(String[] args) {
SpringApplication.run(ApiGatewayDynamicRouteApplication.class, args);
}
}
| [
"289911401@qq.com"
] | 289911401@qq.com |
9bd406a5efd19c5a5e6d5648c9dfa16e73a58906 | c8655251bb853a032ab7db6a9b41c13241565ff6 | /jframe-utils/src/main/java/com/alipay/api/response/AlipayEcoCplifeNoticeDeleteResponse.java | 352eee79ab52d82639b5b669775b134f5f3e194b | [] | no_license | jacksonrick/JFrame | 3b08880d0ad45c9b12e335798fc1764c9b01756b | d9a4a9b17701eb698b957e47fa3f30c6cb8900ac | refs/heads/master | 2021-07-22T21:13:22.548188 | 2017-11-03T06:49:44 | 2017-11-03T06:49:44 | 107,761,091 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.alipay.api.response;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.eco.cplife.notice.delete response.
*
* @author auto create
* @since 1.0, 2017-03-02 18:17:35
*/
public class AlipayEcoCplifeNoticeDeleteResponse extends AlipayResponse {
private static final long serialVersionUID = 1376592964247362434L;
}
| [
"809573150@qq.com"
] | 809573150@qq.com |
bd020e49b74a4fcd20e52b561c0f651e36c6da01 | db78883a2c7791b65dcd9d41746532b9f7d65e66 | /src/main/java/cic/cs/unb/ca/jnetpcap/FlowGenerator.java | 7759e18b9eca7f4c0294ce9552cadc1d27732ec8 | [
"LicenseRef-scancode-other-permissive"
] | permissive | Siddharth1698/CICFlowMeter | 9487f3e7ac906bfca76aab006b4ceabcbdc4fe30 | e267135eb5e24d73c1a2fcecd83a100be134f73c | refs/heads/master | 2021-02-15T11:52:41.933004 | 2020-06-14T22:45:50 | 2020-06-14T22:45:50 | 244,896,288 | 0 | 0 | NOASSERTION | 2020-06-14T22:45:54 | 2020-03-04T12:36:50 | null | UTF-8 | Java | false | false | 9,383 | java | package cic.cs.unb.ca.jnetpcap;
import cic.cs.unb.ca.jnetpcap.worker.FlowGenListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import static cic.cs.unb.ca.jnetpcap.Utils.LINE_SEP;
public class FlowGenerator {
public static final Logger logger = LoggerFactory.getLogger(FlowGenerator.class);
//total 85 colums
/*public static final String timeBasedHeader = "Flow ID, Source IP, Source Port, Destination IP, Destination Port, Protocol, "
+ "Timestamp, Flow Duration, Total Fwd Packets, Total Backward Packets,"
+ "Total Length of Fwd Packets, Total Length of Bwd Packets, "
+ "Fwd Packet Length Max, Fwd Packet Length Min, Fwd Packet Length Mean, Fwd Packet Length Std,"
+ "Bwd Packet Length Max, Bwd Packet Length Min, Bwd Packet Length Mean, Bwd Packet Length Std,"
+ "Flow Bytes/s, Flow Packets/s, Flow IAT Mean, Flow IAT Std, Flow IAT Max, Flow IAT Min,"
+ "Fwd IAT Total, Fwd IAT Mean, Fwd IAT Std, Fwd IAT Max, Fwd IAT Min,"
+ "Bwd IAT Total, Bwd IAT Mean, Bwd IAT Std, Bwd IAT Max, Bwd IAT Min,"
+ "Fwd PSH Flags, Bwd PSH Flags, Fwd URG Flags, Bwd URG Flags, Fwd Header Length, Bwd Header Length,"
+ "Fwd Packets/s, Bwd Packets/s, Min Packet Length, Max Packet Length, Packet Length Mean, Packet Length Std, Packet Length Variance,"
+ "FIN Flag Count, SYN Flag Count, RST Flag Count, PSH Flag Count, ACK Flag Count, URG Flag Count, "
+ "CWE Flag Count, ECE Flag Count, Down/Up Ratio, Average Packet Size, Avg Fwd Segment Size, Avg Bwd Segment Size, Fwd Header Length,"
+ "Fwd Avg Bytes/Bulk, Fwd Avg Packets/Bulk, Fwd Avg Bulk Rate, Bwd Avg Bytes/Bulk, Bwd Avg Packets/Bulk,"
+ "Bwd Avg Bulk Rate,"
+ "Subflow Fwd Packets, Subflow Fwd Bytes, Subflow Bwd Packets, Subflow Bwd Bytes,"
+ "Init_Win_bytes_forward, Init_Win_bytes_backward, act_data_pkt_fwd, min_seg_size_forward,"
+ "Active Mean, Active Std, Active Max, Active Min,"
+ "Idle Mean, Idle Std, Idle Max, Idle Min, Label";*/
//40/86
private FlowGenListener mListener;
private HashMap<String,BasicFlow> currentFlows;
private HashMap<Integer,BasicFlow> finishedFlows;
private HashMap<String,ArrayList> IPAddresses;
private boolean bidirectional;
private long flowTimeOut;
private long flowActivityTimeOut;
private int finishedFlowCount;
public FlowGenerator(boolean bidirectional, long flowTimeout, long activityTimeout) {
super();
this.bidirectional = bidirectional;
this.flowTimeOut = flowTimeout;
this.flowActivityTimeOut = activityTimeout;
init();
}
private void init(){
currentFlows = new HashMap<>();
finishedFlows = new HashMap<>();
IPAddresses = new HashMap<>();
finishedFlowCount = 0;
}
public void addFlowListener(FlowGenListener listener) {
mListener = listener;
}
public void addPacket(BasicPacketInfo packet){
if(packet == null) {
return;
}
BasicFlow flow;
long currentTimestamp = packet.getTimeStamp();
String id;
if(this.currentFlows.containsKey(packet.fwdFlowId())||this.currentFlows.containsKey(packet.bwdFlowId())){
if(this.currentFlows.containsKey(packet.fwdFlowId()))
{id = packet.fwdFlowId();}
else {
id = packet.bwdFlowId();}
flow = currentFlows.get(id);
// Flow finished due flowtimeout:
// 1.- we move the flow to finished flow list
// 2.- we eliminate the flow from the current flow list
// 3.- we create a new flow with the packet-in-process
if((currentTimestamp -flow.getFlowStartTime())>flowTimeOut){
if(flow.packetCount()>1){
if (mListener != null) {
mListener.onFlowGenerated(flow);
}
else{
finishedFlows.put(getFlowCount(), flow);
}
//flow.endActiveIdleTime(currentTimestamp,this.flowActivityTimeOut, this.flowTimeOut, false);
}
currentFlows.remove(id);
currentFlows.put(id, new BasicFlow(bidirectional,packet,flow.getSrc(),flow.getDst(),flow.getSrcPort(),flow.getDstPort()));
int cfsize = currentFlows.size();
if(cfsize%50==0) {
logger.debug("Timeout current has {} flow",cfsize);
}
// Flow finished due FIN flag (tcp only):
// 1.- we add the packet-in-process to the flow (it is the last packet)
// 2.- we move the flow to finished flow list
// 3.- we eliminate the flow from the current flow list
}else if(packet.hasFlagFIN()){
logger.debug("FlagFIN current has {} flow",currentFlows.size());
flow.addPacket(packet);
if (mListener != null) {
mListener.onFlowGenerated(flow);
}
else {
finishedFlows.put(getFlowCount(), flow);
}
currentFlows.remove(id);
}else{
flow.updateActiveIdleTime(currentTimestamp,this.flowActivityTimeOut);
flow.addPacket(packet);
currentFlows.put(id,flow);
}
}else{
currentFlows.put(packet.fwdFlowId(), new BasicFlow(bidirectional,packet));
}
}
/*public void dumpFlowBasedFeatures(String path, String filename,String header){
BasicFlow flow;
try {
System.out.println("TOTAL Flows: "+(finishedFlows.size()+currentFlows.size()));
FileOutputStream output = new FileOutputStream(new File(path+filename));
output.write((header+"\n").getBytes());
Set<Integer> fkeys = finishedFlows.keySet();
for(Integer key:fkeys){
flow = finishedFlows.get(key);
if(flow.packetCount()>1)
output.write((flow.dumpFlowBasedFeaturesEx()+"\n").getBytes());
}
Set<String> ckeys = currentFlows.keySet();
for(String key:ckeys){
flow = currentFlows.get(key);
if(flow.packetCount()>1)
output.write((flow.dumpFlowBasedFeaturesEx()+"\n").getBytes());
}
output.flush();
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}*/
public int dumpLabeledFlowBasedFeatures(String path, String filename,String header){
BasicFlow flow;
int total = 0;
int zeroPkt = 0;
try {
//total = finishedFlows.size()+currentFlows.size(); becasue there are 0 packet BasicFlow in the currentFlows
FileOutputStream output = new FileOutputStream(new File(path+filename));
logger.debug("dumpLabeledFlow: ", path + filename);
output.write((header+"\n").getBytes());
Set<Integer> fkeys = finishedFlows.keySet();
for(Integer key:fkeys){
flow = finishedFlows.get(key);
if (flow.packetCount() > 1) {
output.write((flow.dumpFlowBasedFeaturesEx() + "\n").getBytes());
total++;
}
else {
zeroPkt++;
}
}
logger.debug("dumpLabeledFlow finishedFlows -> {},{}",zeroPkt,total);
Set<String> ckeys = currentFlows.keySet();
output.write((header + "\n").getBytes());
for(String key:ckeys){
flow = currentFlows.get(key);
if(flow.packetCount()>1) {
output.write((flow.dumpFlowBasedFeaturesEx() + "\n").getBytes());
total++;
}else{
zeroPkt++;
}
}
logger.debug("dumpLabeledFlow total(include current) -> {},{}",zeroPkt,total);
output.flush();
output.close();
} catch (IOException e) {
logger.debug(e.getMessage());
}
return total;
}
public long dumpLabeledCurrentFlow(String fileFullPath,String header) {
if (fileFullPath == null || header==null) {
String ex = String.format("fullFilePath=%s,filename=%s", fileFullPath);
throw new IllegalArgumentException(ex);
}
File file = new File(fileFullPath);
FileOutputStream output = null;
int total = 0;
try {
if (file.exists()) {
output = new FileOutputStream(file, true);
}else{
if (file.createNewFile()) {
output = new FileOutputStream(file);
output.write((header + LINE_SEP).getBytes());
}
}
for (BasicFlow flow : currentFlows.values()) {
if(flow.packetCount()>1) {
output.write((flow.dumpFlowBasedFeaturesEx() + LINE_SEP).getBytes());
total++;
}else{
}
}
} catch (IOException e) {
logger.debug(e.getMessage());
} finally {
try {
if (output != null) {
output.flush();
output.close();
}
} catch (IOException e) {
logger.debug(e.getMessage());
}
}
return total;
}
private int getFlowCount(){
this.finishedFlowCount++;
return this.finishedFlowCount;
}
}
| [
"a.habibi.l@unb.ca"
] | a.habibi.l@unb.ca |
f6afb27604590ae792a0dd9ef649d7509744b3c8 | 583472f6e1430ecfb654cfe439e88d0f5ea218cf | /src/InvalidCallNumber.java | 8291e0b620fcc65f4cf327976500605c4157ea76 | [] | no_license | G-Armstrong/Exception-Handling-and-File-IO | 8a490d343a25b8c946759a54870d783b93b51cb4 | eba029c57058d18afb7638d53f7866c528b8fd72 | refs/heads/main | 2023-02-23T08:46:37.785019 | 2021-01-14T05:03:14 | 2021-01-14T05:03:14 | 329,511,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 459 | java | import java.util.InputMismatchException;
/**
* default constructor with no parameter that calls the super class which it inherits
*/
public class InvalidCallNumber extends InputMismatchException {
public InvalidCallNumber() {
super();
}
/**
* Constructor with one parameter
* @param message of type String to be displayed to the user when the error is caught
*/
public InvalidCallNumber(String message) {
super(message);
}
}
| [
"noreply@github.com"
] | G-Armstrong.noreply@github.com |
96d8c2bd97e4e9bedf111c7fedf0b2cc4bad2142 | 0bda108dbdb3bf410364ea8eaefe5711fb54bdc0 | /easeUI/src/main/java/com/easemob/easeui/widget/EaseExpandGridView.java | 8c6decd9092b480b4967be82aea472bf5306b49a | [
"Apache-2.0"
] | permissive | nggirl/EaseChatDemo | 249f8dd9fd7b2a0a094b2c22f1b2ac9087d9a1fd | 6d64bbffad5a162e7585eb66827ce3cdab44170b | refs/heads/master | 2021-01-10T06:22:47.936589 | 2015-12-03T05:24:11 | 2015-12-03T05:24:11 | 47,309,600 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,483 | java | /**
* Copyright (C) 2013-2014 EaseMob Technologies. All rights reserved.
* <p/>
* 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.easemob.easeui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;
public class EaseExpandGridView extends GridView {
public EaseExpandGridView(Context context) {
super(context);
}
public EaseExpandGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
// @Override
// public boolean dispatchTouchEvent(MotionEvent ev) {
// if (ev.getAction() == MotionEvent.ACTION_MOVE) {
// return true;
// }
// return super.dispatchTouchEvent(ev);
// }
}
| [
"logan676395@gmail.com"
] | logan676395@gmail.com |
d262299ac8079cef90f8780d7decfada4c7c450e | a1293a865005bd55e11482b3d7ed9065f57a17ed | /src/ch09/hw/homework.java | dae16ad314e416271ae901b226fba09102f5b820 | [] | no_license | JHuang95/JavaDataStructures | 40434bb77a17c68b09d22e6c59b2138dabf1ceac | 125c092a7e7f8606b419d5bab8e4f9c77486790e | refs/heads/master | 2022-03-24T21:37:18.367197 | 2017-05-22T20:29:52 | 2017-05-22T20:29:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | package ch09.hw;
public class homework {
//Done
//Use the SortedABPriQ class to help solve the following problem.
//Create an application Random10K that generates 100 numbers between 1 and 10,000,
//stores them in a priority queue (you can wrap them in an Integer object), and then
//prints them out in columns 10 integers wide in
//1) decreasing order
//2) increasing order
//3) ordered increasingly by the sum of the digits in the number.
}
| [
"jfontain@9.55.152.154"
] | jfontain@9.55.152.154 |
b56dbb63adf3a4286fbe7c38d454cf0c3a518e01 | b014784d3ac74d9fe91f97fa34bb350dbb8833cf | /app/src/main/java/com/study91/audiobook/media/AssetMediaPlayer.java | 641f7e9fbefa2311ae8589b2b4e74b118a66594d | [] | no_license | study91/AudioBook | a94117932eb9e4dc8fdf09fb38dad9f7ab7989b5 | b13a732d4d82ec87a063fd0d4f8048ca5508c73a | refs/heads/master | 2020-07-24T17:18:00.959177 | 2019-12-09T08:01:46 | 2019-12-09T08:01:46 | 194,875,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,359 | java | package com.study91.audiobook.media;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
import android.util.Log;
import com.study91.audiobook.dict.MediaState;
import com.study91.audiobook.tools.ImageTools;
import java.io.IOException;
/**
* Asset资源媒体播放器
*/
class AssetMediaPlayer implements IMediaPlayer {
private Field m = new Field(); //私有字段
/**
* 构造器
* @param context 应用程序上下文
*/
AssetMediaPlayer(Context context) {
m.context = context;
}
@Override
public void setFilename(String filename) {
if (filename != null && !filename.trim().equals(getFilename())) {
m.seekToPosition = 0; //重置播放位置为音频开始位置
m.mediaFilename = filename.trim(); //设置文件名
//如果媒体播放器不为null,重置媒体播放器
if (m.mediaPlayer != null) {
getMediaPlayer().reset();
m.mediaState = MediaState.IDLE; //重置媒体播放器状态为空闲
}
AssetManager assetManager = getContext().getAssets(); //获取资源管理器
try {
AssetFileDescriptor assetFileDescriptor = assetManager.openFd(getFilename()); //打开文件
//设置媒体播放器数据源
getMediaPlayer().setDataSource(
assetFileDescriptor.getFileDescriptor(),
assetFileDescriptor.getStartOffset(),
assetFileDescriptor.getLength());
getMediaPlayer().prepareAsync(); //准备媒体
m.mediaState = MediaState.PREPARING; //设置状态为准备中状态
} catch (IOException e) {
Log.e(getClass().getName(), "setFilename:" + e.getMessage());
throw new RuntimeException(e);
}
}
}
@Override
public String getFilename() {
return m.mediaFilename;
}
@Override
public void setTitle(String title) {
if (title != null && !title.trim().equals(getTitle())) {
m.title = title.trim();
}
}
@Override
public String getTitle() {
return m.title;
}
@Override
public void play() {
switch (getMediaState()) {
case PREPARED: //媒体准备就绪
if (!isPlaying()) {
getMediaPlayer().start();
}
break;
case PREPARING: //媒体准备中
m.mediaState = MediaState.WAITING_TO_PLAY; //设置为等待播放状态
break;
case WAITING_TO_PLAY: //等待播放状态
//注:如果媒体处于等待播放状态,将在setOnPreparedListener.onPrepared中执行getMediaPlayer().start()进行播放
break;
case COMPLETED:
m.mediaState = MediaState.PREPARED; //重置为媒体准备就绪状态
getMediaPlayer().start();
break;
}
}
@Override
public void pause() {
switch (getMediaState()) {
case PREPARED: //媒体准备就绪
if (isPlaying()) {
getMediaPlayer().pause();
}
break;
}
}
@Override
public boolean isPlaying() {
boolean isPlaying = false;
switch (getMediaState()) {
case PREPARED: //媒体准备就绪
isPlaying = getMediaPlayer().isPlaying();
break;
}
return isPlaying;
}
@Override
public void seekTo(int position) {
switch (getMediaState()) {
case IDLE: //空闲状态
case PREPARING: //媒体准备中
m.seekToPosition = position;
break;
case PREPARED: //媒体准备就绪
getMediaPlayer().seekTo(position);
break;
}
}
@Override
public int getLength() {
int length = 0;
switch (getMediaState()) {
case PREPARED: //媒体准备就绪
case COMPLETED: //媒体播放完成
length = getMediaPlayer().getDuration();
break;
}
return length;
}
@Override
public int getPosition() {
int position = 0;
switch (getMediaState()) {
case PREPARED: //媒体准备就绪
case COMPLETED: //媒体播放完成
position = getMediaPlayer().getCurrentPosition();
break;
}
return position;
}
@Override
public void setVolume(float leftVolume, float rightVolume) {
m.leftVolume = leftVolume;
m.rightVolume = rightVolume;
getMediaPlayer().setVolume(leftVolume, rightVolume);
}
@Override
public void setIconFilename(String filename) {
if (filename != null && !filename.trim().equals(m.iconFilename)) {
m.iconFilename = filename.trim(); //图标文件名
m.iconDrawable = ImageTools.getDrawable(getContext(), filename); //图标Drawable
}
}
@Override
public String getIconFilename() {
return m.iconFilename;
}
@Override
public Drawable getIconDrawable() {
return m.iconDrawable;
}
@Override
public MediaState getMediaState() {
return m.mediaState;
}
@Override
public void setOnPreparedListener(MediaPlayer.OnPreparedListener listener) {
m.preparedListener = listener;
}
@Override
public void setOnCompletionListener(MediaPlayer.OnCompletionListener listener) {
m.completionListener = listener;
}
@Override
public void release() {
getMediaPlayer().release();
m.mediaState = MediaState.IDLE; //重置媒体播放器状态为空闲
}
/**
* 获取应用程序上下文
*/
private Context getContext() {
return m.context;
}
/**
* 获取媒体播放器
*/
private MediaPlayer getMediaPlayer() {
if (m.mediaPlayer == null) {
m.mediaPlayer = new MediaPlayer();
m.mediaState = MediaState.IDLE; //初始化媒体状态为空闲状态
//设置媒体准备就绪事件监听器
m.mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
switch (getMediaState()) {
case PREPARING: //准备媒体中
m.mediaState = MediaState.PREPARED; //设置媒体状态为准备就绪
//如果有定位信息,立即进行定位
if (m.seekToPosition > 0) {
seekTo(m.seekToPosition); //定位
m.seekToPosition = 0; //重置缓存的定位信息
}
break;
case WAITING_TO_PLAY: //等待播放媒体
m.mediaState = MediaState.PREPARED; //设置媒体状态为准备就绪
//如果有定位信息,立即进行定位
if (m.seekToPosition > 0) {
seekTo(m.seekToPosition); //定位
m.seekToPosition = 0; //重置缓存的定位信息
}
play(); //播放
break;
}
//执行自定义的媒体准备就绪事件
if (m.preparedListener != null) m.preparedListener.onPrepared(mp);
}
});
//设置媒体播放完成事件监听器
m.mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
switch (getMediaState()) {
//此处疑似系统有Bug,在切换音频文件时,处于WAITING_TO_PLAY和PREPARING状态时有时会
//莫名其秒的进入完成播放状态,因此这两种状态完成播放时不能执行自定义的媒体播放完成事件。
case WAITING_TO_PLAY: //等待播放媒体
Log.d("Test", "等待播放媒体时完成播放");
break;
case PREPARING: //准备媒体中
Log.d("Test", "准备媒体中完成播放");
break;
default:
Log.d("Test", "正常完成播放");
m.mediaState = MediaState.COMPLETED; //设置媒体状态为播放完成
//执行自定义的媒体播放完成事件
if (m.completionListener != null) m.completionListener.onCompletion(mp);
break;
}
}
});
//设置媒体播放器错误事件监听器
m.mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Log.d(getClass().getName(), "媒体播放器错误,错误代码:" + "what=" + what + "extra" + extra);
switch (what) {
case -1004:
Log.d(getClass().getName(), "MEDIA_ERROR_IO");
break;
case -1007:
Log.d(getClass().getName(), "MEDIA_ERROR_MALFORMED");
break;
case 200:
Log.d(getClass().getName(), "MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK");
break;
case 100:
Log.d(getClass().getName(), "MEDIA_ERROR_SERVER_DIED");
break;
case -110:
Log.d(getClass().getName(), "MEDIA_ERROR_TIMED_OUT");
break;
case 1:
Log.d(getClass().getName(), "MEDIA_ERROR_UNKNOWN");
break;
case -1010:
Log.d(getClass().getName(), "MEDIA_ERROR_UNSUPPORTED");
break;
}
switch (extra) {
case 800:
Log.d(getClass().getName(), "MEDIA_INFO_BAD_INTERLEAVING");
break;
case 702:
Log.d(getClass().getName(), "MEDIA_INFO_BUFFERING_END");
break;
case 701:
case 802:
Log.d(getClass().getName(), "MEDIA_INFO_METADATA_UPDATE");
break;
case 801:
Log.d(getClass().getName(), "MEDIA_INFO_NOT_SEEKABLE");
break;
case 1:
Log.d(getClass().getName(), "MEDIA_INFO_UNKNOWN");
break;
case 3:
Log.d(getClass().getName(), "MEDIA_INFO_VIDEO_RENDERING_START");
break;
case 700:
Log.d(getClass().getName(), "MEDIA_INFO_VIDEO_TRACK_LAGGING");
break;
}
return false;
}
});
}
return m.mediaPlayer;
}
/**
* 私有字段类
*/
private class Field {
/**
* 应用程序上下文
*/
Context context;
/**
* 媒体文件名
*/
String mediaFilename;
/**
* 图标文件名
*/
String iconFilename;
/**
* 图标Drawable
*/
Drawable iconDrawable;
/**
* 定位位置
*/
int seekToPosition;
/**
* 标题
*/
String title;
/**
* 左声道音量
*/
float leftVolume = 1f;
/**
* 右声道音量
*/
float rightVolume = 1f;
/**
* 媒体播放器
*/
MediaPlayer mediaPlayer;
/**
* 媒体状态(初始化默认为空闲状态)
*/
MediaState mediaState = MediaState.IDLE;
/**
* 媒体准备就绪事件监听器
*/
MediaPlayer.OnPreparedListener preparedListener;
/**
* 媒体播放完成事件监听器
*/
MediaPlayer.OnCompletionListener completionListener;
}
}
| [
"1964073@qq.com"
] | 1964073@qq.com |
f94b29b1b5519febe3d4948bc88d3c6bee20b96b | e49a3fbe0e74864ea9b429ffec384cc0bcfd3ff8 | /service/service-edu/src/main/java/com/atguigu/guli/service/edu/service/CourseDescriptionService.java | 0b54688b2b57c583a773fd4e61820b9e041725ac | [] | no_license | zhukehui/guli | 2941f0187cb6fca546c594deb985cf0e4f602019 | 38b28b15ea78fe615fa6ae2db3d695374f215d96 | refs/heads/master | 2020-09-13T23:18:19.600182 | 2019-11-29T12:19:03 | 2019-11-29T12:19:03 | 222,935,822 | 0 | 0 | null | 2019-11-20T12:52:25 | 2019-11-20T12:47:03 | Java | UTF-8 | Java | false | false | 346 | java | package com.atguigu.guli.service.edu.service;
import com.atguigu.guli.service.edu.entity.CourseDescription;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 课程简介 服务类
* </p>
*
* @author eternity
* @since 2019-11-20
*/
public interface CourseDescriptionService extends IService<CourseDescription> {
}
| [
"574059694@qq.com"
] | 574059694@qq.com |
4f075d7beedee3a2918afe9b11e952213813cd9d | df19ad99fd8a2cd4d67d64a77441db07d060d82e | /TestHealiAi/android/app/src/debug/java/com/testhealiai/ReactNativeFlipper.java | 3a4720840c07ea8b43f2370a1f00d9d8dea3b07c | [] | no_license | tarekel96/R_Native_Practice | 8019bc75fdfedbe668eb7a7fdac435a0e2bf92d8 | 95cac288f7da96a3e8d7a808f3b2dfa15e0ef3f3 | refs/heads/main | 2023-04-19T04:57:09.282995 | 2021-05-06T06:04:29 | 2021-05-06T06:04:29 | 363,772,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,266 | java | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.testhealiai;
import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
import com.facebook.flipper.android.utils.FlipperUtils;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;
public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(new ReactFlipperPlugin());
client.addPlugin(new DatabasesFlipperPlugin(context));
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
client.addPlugin(CrashReporterPlugin.getInstance());
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
NetworkingModule.setCustomClientBuilder(
new NetworkingModule.CustomClientBuilder() {
@Override
public void apply(OkHttpClient.Builder builder) {
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
}
});
client.addPlugin(networkFlipperPlugin);
client.start();
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
// Hence we run if after all native modules have been initialized
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext == null) {
reactInstanceManager.addReactInstanceEventListener(
new ReactInstanceManager.ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(ReactContext reactContext) {
reactInstanceManager.removeReactInstanceEventListener(this);
reactContext.runOnNativeModulesQueueThread(
new Runnable() {
@Override
public void run() {
client.addPlugin(new FrescoFlipperPlugin());
}
});
}
});
} else {
client.addPlugin(new FrescoFlipperPlugin());
}
}
}
}
| [
"elhaj102@mail.chapman.edu"
] | elhaj102@mail.chapman.edu |
2cc4f39634566dcadb99c231095d3fbb87373218 | edefa9883e68cf605868b083d7be7553074549d7 | /springboot-api/src/main/java/com/fandou/springboot/api/support/Result.java | e79e323e45c1769b8fbbbb17ebb71b450dcb6e33 | [] | no_license | chengshangqian/spring-boot-learning | 56b0d20571d9240a5674f7160243f1cd3bf322d1 | eeb1dd6664fc3f517d1a47b231fb0fe078578c78 | refs/heads/master | 2023-04-20T03:33:09.532098 | 2021-05-22T12:30:45 | 2021-05-22T12:30:45 | 222,270,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,828 | java | /**
* @Title: HttpResult.java
* @Package com.fandou.springboot.api.support
* @Copyright: ©2019
* @Company: Fandou Technology Co., Ltd.
* @author 成尚谦
* @email chengshangqian@foxmail.com
* @date 2019年11月5日 下午12:16:10
* @version V0.0.1
*/
package com.fandou.springboot.api.support;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Title: HttpResult
* @Description: TODO(一句话描述该类的业务或功能)
* @Copyright: ©2019
* @Company: Fandou Technology Co., Ltd.
* @author 成尚谦
* @email chengshangqian@foxmail.com
* @date 2019年11月5日 下午12:16:10
* @version V0.0.1
*/
@ApiModel(value = "请求处理结果类",description = "对发起http请求处理结果的状态、代码、描述以及返回数据等信息的包装")
public class Result {
public final static Result SUCCESS = new Result();
public final static Result FAILURE = new Result("failure", "500", "请求失败");
@ApiModelProperty(value = "请求结果状态",dataType = "string",required = true)
private String status;
@ApiModelProperty(value = "请求结果编码",dataType = "string",required = false)
private String code;
@ApiModelProperty(value = "请求结果描述",dataType = "string",required = false)
private String desc;
@ApiModelProperty(value = "请求结果数据,可能是基本数据类型,也可能是对象、集合等任意类型",dataType = "object",required = false)
private Object result;
@ApiModelProperty(hidden = true)
private Object pagintiaon;
public Result() {
this.status = "success";
this.code = "200";
this.desc = "请求成功";
}
public Result(Object result) {
this();
this.result = result;
}
public Result(String status) {
this.status = status;
}
public Result(String status, String code) {
this(status);
this.code = code;
}
public Result(String status, String code, String desc) {
this(status, code);
this.desc = desc;
}
public Result(String status, String code, String desc, Object result) {
this(status, code, desc);
this.result = result;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
public Object getPagintiaon() {
return pagintiaon;
}
public void setPagintiaon(Object pagintiaon) {
this.pagintiaon = pagintiaon;
}
}
| [
"173030513@qq.com"
] | 173030513@qq.com |
f93a434a651345aa9863625f3910479ab66c73b6 | 4bf711b7fe3ee94c3c2ede64a24f49e05070cf5a | /src/main/java/it/wilds/guice/jetty_exporter/DefaultHttpServlet.java | 3ccce9ae22b75e7d9005f219eb48712a02067ed0 | [
"Apache-2.0"
] | permissive | wilds/guice-modules | d0f330a7c5d7a937558052e2f6de56d677af735c | ff2e51369c58a1021c7850fe695ee9063bd2f1f7 | refs/heads/master | 2021-08-22T09:19:16.548381 | 2021-05-08T14:27:47 | 2021-05-08T14:27:47 | 165,836,009 | 0 | 0 | NOASSERTION | 2021-06-10T15:48:27 | 2019-01-15T11:02:53 | Java | UTF-8 | Java | false | false | 1,247 | java | /**
* Copyright (C) 2011 Brian Ferris <bdferris@onebusaway.org>
* Copyright (C) 2012 Google, Inc.
*
* 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 it.wilds.guice.jetty_exporter;
import java.net.URL;
import javax.servlet.Servlet;
import javax.servlet.http.HttpServlet;
public abstract class DefaultHttpServlet extends HttpServlet implements ServletSource {
private static final long serialVersionUID = -6208775831208489621L;
protected URL _url;
public void setUrl(URL url) {
_url = url;
}
/****
* {@link ServletSource} Interface
****/
@Override
public URL getUrl() {
return _url;
}
@Override
public Servlet getServlet() {
return this;
}
} | [
"ivoselva@gmail.com"
] | ivoselva@gmail.com |
ebf9f098c149f98a64c02c69ba7a07a978c3baae | 5362e80c23f2b9ee40e5036fb3ccb2051975c42d | /DevelopLib/src/com/lib/ext/widget/BottomView.java | c72f1fe87ee9c9451ec01c0a4eab165132fe2d04 | [] | no_license | lanjiexingfu/ListenBook | cb11fc11512841d8313ea8cf9542f88e23c8c5e6 | 09405b2c8e8269472aa4947b8a750b79137a1ee1 | refs/heads/master | 2021-01-10T08:06:45.887924 | 2016-01-29T10:26:41 | 2016-01-29T10:26:41 | 50,441,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,192 | java | package com.lib.ext.widget;
import android.app.Dialog;
import android.content.Context;
import android.view.Display;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
public class BottomView {
private View convertView;
private Context context;
private int theme;
private Dialog bv;
private int animationStyle;
private boolean isTop = false;
public BottomView(Context c, int theme, View convertView) {
this.theme = theme;
this.context = c;
this.convertView = convertView;
}
public BottomView(Context c, int theme, int resource) {
this.theme = theme;
this.context = c;
this.convertView = View.inflate(c, resource, null);
}
public void showBottomView(boolean CanceledOnTouchOutside) {
if (this.bv == null) {
if (this.theme == 0) {
this.bv = new Dialog(this.context);
} else {
this.bv = new Dialog(this.context, this.theme);
}
this.bv.setCanceledOnTouchOutside(CanceledOnTouchOutside);
this.bv.getWindow().requestFeature(1);
this.bv.setContentView(this.convertView);
Window wm = this.bv.getWindow();
WindowManager m = wm.getWindowManager();
Display d = m.getDefaultDisplay();
LayoutParams p = wm.getAttributes();
p.width = d.getWidth() * 1;
if (this.isTop) {
p.gravity = 48;
} else {
p.gravity = 80;
}
if (this.animationStyle != 0) {
wm.setWindowAnimations(this.animationStyle);
}
wm.setAttributes(p);
}
this.bv.show();
}
public void setTopIfNecessary() {
this.isTop = true;
}
public void setAnimation(int animationStyle) {
this.animationStyle = animationStyle;
}
public View getView() {
return this.convertView;
}
public void dismissBottomView() {
if (this.bv != null) {
this.bv.dismiss();
}
}
} | [
"1002961114@qq.com"
] | 1002961114@qq.com |
c6d8b28a2e36c88bbcf1628d137652b3a5ad7fed | a7b81e872292d352116f451bff3d5e19267a116b | /moo-ui-shell/moo-ui-shell-commons/src/main/java/pl/zimowski/moo/ui/shell/commons/ExecutionThrottling.java | 9a117223fa0ac9b5319654fcfde8d43857036c7c | [
"Apache-2.0"
] | permissive | mrazjava/moo | e6a5d95175dfccfb71f2a925f53bc4ab262d204b | 3f0f045fdbef0ba120df255444abe25a14baad1c | refs/heads/develop | 2022-12-21T09:45:48.286994 | 2020-12-23T06:53:06 | 2020-12-23T06:53:06 | 101,843,475 | 0 | 0 | NOASSERTION | 2022-12-16T04:48:55 | 2017-08-30T06:00:12 | Java | UTF-8 | Java | false | false | 877 | java | package pl.zimowski.moo.ui.shell.commons;
/**
* Delay of application execution.
*
* @since 1.2.0
* @author Adam Zimowski (<a href="mailto:mrazjava@yandex.com">mrazjava</a>)
*/
public interface ExecutionThrottling {
/**
* Delay execution by some pre-configured time period.
*/
void throttle();
/**
* Delay execution by desired period of time.
*
* @param delay in milliseconds
*/
void throttle(long delay);
/**
* @return number of times throttle was invoked
*/
int getCount();
/**
* Reset throttle counter to starting point as if no throttling
* was performed.
*/
void reset();
/**
* Determines if number of throttle invocations exceeded some limit.
*
* @param limit of allowed throttling executions
* @return {@code true} if throttle was executed beyond allowed limit
*/
boolean isCountExceeded(Integer limit);
}
| [
"mrazjava@yandex.com"
] | mrazjava@yandex.com |
8611964a1bc3eb2a4fe08366b1f3637c3e16aecb | 78582f2af11ee47aa8467965a05d6fbf3882794e | /src/main/java/com/qdqtrj/pay/api/trade/dto/request/ReqTransfer.java | c764b3b8ad12670338fe29bbccef6a0f552dfe50 | [] | no_license | theonewangqichao/lianlianpay-accp-sdk | 658286a45d0cbefbc86b85e7c4b8a3bcdcf55a08 | f2cb3c24e886c6be4d5f209202fd3837c76c1118 | refs/heads/main | 2023-04-16T11:17:53.406009 | 2021-04-19T02:07:55 | 2021-04-19T02:07:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,069 | java | package com.qdqtrj.pay.api.trade.dto.request;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 3.4. 代发 支持内部代发和外部代发两种场景交易。 内部代发:用户/平台商户A将账户可用余额代发至用户/平台商户B可用余额账户,业务场 景为佣金代发、红包奖励代发、供应商货款付款等。 外部代发:用户/平台商户A将账户可用余额代发至用户/平台商户B实体银行账户;业务场 景为佣金代发、红包奖励代发、供应商货款付款等。 3.4.1. 代发申请 请求地址https://accpapi.lianlianpay.com/v1/txn/transfer
*/
@Data
public class ReqTransfer implements Serializable {
/**
* timestamp,时间戳,Y,Date,交易服务器时间戳,格式:yyyyMMddHHmms,有效期30分钟(包含服务器之间的时间差)
*/
@NotNull()
@JSONField(format = "yyyyMMddHHmmss")
private Date timestamp;
/**
* oid_partner,商户号,Y,String,ACCP 系统分配给平台商户的唯一编号
*/
@NotBlank()
private String oid_partner;
/**
* notify_url,异步通知地址,N,String,交易结果异步通知接收地址,建议HTTPS协议
*/
private String notify_url;
/**
* pay_expire,订单有效期,N,Number,订单有效期,逾期将会关闭交易,单位:分钟,默认:3天,注:超时关单对内部代发暂不生效;外部代发用于代发确认有效时间,超过订单时间系统进行关单,将无法确认
*/
private Integer pay_expire;
/**
* funds_flag,垫资标识,N,String,标识该笔代发交易是否支持平台商户垫资,适用于代发付款方为用户的业务场景,默认:N,Y:支持垫资,N:不支持垫资
*/
private String funds_flag;
/**
* check_flag,审核标识,N,String,标识该笔订单是否需要审核,默认:N,Y:需要代发确认,N:无需代发确认,注:内部代发(收款方为ACCP账户)暂不支持
*/
private String check_flag;
/**
* pay_time_type,到账类型,N,String,只对收款方为非余额账户类的外部代发生效,到账类型参见‘到账类型列表’,默认:实时到账
*/
private String pay_time_type;
/**
* risk_item,风控参数,N,String,参见‘风控参数’
*/
private String risk_item;
/**
* 商户订单信息 orderInfo
*/
private OrderInfo orderInfo;
/**
* 付款方信息 payerInfo
*/
private PayerInfo payerInfo;
/**
* 收款方信息 payeeInfo
*/
private PayeeInfo payeeInfo;
/**
* 商户订单信息 orderInfo
*/
@Data
public static class OrderInfo {
/**
* txn_seqno,商户交易流水号,Y,String(64),商户系统唯一交易流水号
*/
@NotBlank()
@Length(min = 1, max = 64)
private String txn_seqno;
/**
* txn_time,商户交易时间,Y,String(14),商户系统交易时间,格式:yyyyMMddHHmmss
*/
@NotBlank()
@Length(min = 1, max = 14)
private String txn_time;
/**
* total_amount,订单总金额,Y,Number(8,2),订单总金额,单位为元,精确到小数点后两位
*/
@NotBlank()
@Digits(integer = 8, fraction = 2)
private BigDecimal total_amount;
/**
* fee_amount,手续费金额,N,Number(8,2),手续费金额,单位为元,精确到小数点后两位。会自动收取到商户的自有资金账户。不允许超过订单总金额的20%,注:收款方为“对私银行账户”或“对公银行账户”才有效
*/
@Digits(integer = 8, fraction = 2)
private BigDecimal fee_amount;
/**
* txn_purpose,代发交易用途,Y,String,服务费,信息费,修理费,佣金支付,贷款支付,其他
*/
@NotBlank()
private String txn_purpose;
/**
* order_info,订单信息,N,String,订单信息,在查询API和支付通知中原样返回,可作为自定义参数使用
*/
private String order_info;
/**
* postscript,交易附言,N,String,交易附言 代发至银行账户单笔金额大于等于5w必须提供
*/
private String postscript;
}
/**
* 付款方信息 payerInfo
*/
@Data
public static class PayerInfo {
/**
* payer_type,付款方类型,Y,String,用户:USER,平台商户:MERCHANT
*/
@NotBlank()
private String payer_type;
/**
* payer_id,付款方标识,Y,String,付款方为用户时设置user_id付款方为商户时设置平台商户号
*/
@NotBlank()
private String payer_id;
/**
* payer_accttype,付款方账户类型,N,String,付款方为平台商户时必须提供,参见‘账户类型列表’
*/
private String payer_accttype;
/**
* password,支付密码,N,String,支付密码,非委托代发,付款方为用,户时必填
*/
private String password;
/**
* random_key,密码随机因子key,N,String,密码随机因子 key,随机因子获取,接口返回
*/
private String random_key;
/**
* pap_agree_no,委托代发协议号,N,String,账户加返回的代扣协议号,委托代发时必输该字段需要RSA加密传输
*/
private String pap_agree_no;
}
/**
* 收款方信息 payeeInfo
*/
@Data
public static class PayeeInfo {
/**
* payee_type,收款方类型,Y,String,用户:USER,平台商户:MERCHANT,对私银行账户:BANKACCT_PRI,对公银行账户:BANKACCT_PUB
*/
@NotBlank()
private String payee_type;
/**
* payee_id,收款方标识,N,String,收款方标识,指定为用户或者平台商户的唯一 id,收款方类型为用户或者商户时必须
*/
private String payee_id;
/**
* payee_accttype,收款方账户类型,N,String,收款方为平台商户时必传,参见‘账户类型列表’
*/
private String payee_accttype;
/**
* bank_acctno,银行帐号,N,String,银行帐号
*/
private String bank_acctno;
/**
* bank_code,银行编码,N,String,收款方类型为对公银行账户必须
*/
private String bank_code;
/**
* bank_acctname,户名,N,String,户名
*/
private String bank_acctname;
/**
* cnaps_code,大额行号,N,String,银行大额行号,收款方类型为对公银行账户必须
*/
private String cnaps_code;
}
}
| [
"1052921694@qq.com"
] | 1052921694@qq.com |
25508b64e31251efccd09ae658aaf8f8abd2fe09 | 159fd6745e98bab58b12cce27bd1aacfb1467872 | /TravelersBlog/src/main/java/com/yusuf/travel/controller/UserController.java | 7e3f95222f5cab693b48eec82dce26b73a218a8a | [] | no_license | golmalyusuf/Travel-s-Blog | efc34bdb215849004fc17efbf4bdbb6769586e17 | dada6279d063ba0abc90e718550034d03e5dbf10 | refs/heads/main | 2022-12-23T22:42:23.365228 | 2020-10-03T23:24:05 | 2020-10-03T23:24:05 | 300,702,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 949 | java | package com.yusuf.travel.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.support.SessionStatus;
import com.yusuf.travel.entity.User;
import com.yusuf.travel.service.UserService;
@Controller
public class UserController {
@Autowired
UserService userService;
@PostMapping("/user/registration")
public String saveUser(@Valid @ModelAttribute("user") User user, BindingResult errors, SessionStatus status) {
if(errors.hasErrors()) {
return "registration";
}else {
userService.save(user);
}
status.setComplete();
return "redirect:../index";
}
}
| [
"common.dsdl@gmail.com"
] | common.dsdl@gmail.com |
56d67dd7f1fe383a19c622486cc4a6a8bfabd20e | a245aeb0d384cbc73cde27a4e06bc9e5712b4fd3 | /app/src/main/java/com/dxj/teacher/bean/ClassWayBean.java | 3d5de4cf6d6eed4aa6d4baee9db5f7ddc5553fb6 | [] | no_license | stormsign/dxj_teacher | c253f4c2937d690baf25f5314caaa6bfae67f148 | 7f6d34e672f4d4a003b3c22c924e85ad28de3681 | refs/heads/master | 2020-06-03T10:07:51.002108 | 2015-09-22T10:54:22 | 2015-09-22T10:54:22 | 41,296,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package com.dxj.teacher.bean;
import java.io.Serializable;
/**
* Created by khb on 2015/8/31.
*/
public class ClassWayBean extends BaseBean implements Serializable{
private int mode;
private int price;
public void setMode(int mode) {
this.mode = mode;
}
public void setPrice(int price) {
this.price = price;
}
public int getMode() {
return mode;
}
public int getPrice() {
return price;
}
}
| [
"ylyspengjun@163.com"
] | ylyspengjun@163.com |
1ef68a61f4e303211981f97606b5d59d8fb5e5ae | e81d634b3cd7b21eff0437d1d7a93e9621d5c555 | /src/main/java/graph/oriented/unweighted/UnweightedOrientedGraphOperations.java | bc6d0aff4859768b53a9d5ad53cebb405127a840 | [] | no_license | Cazbrik/Graph | 0e74e80808847dfa0fbbeccf0b34f4e5f4c73060 | 69931aef96c4ce43fdaebb221f89b6e9a3b3636d | refs/heads/master | 2021-08-08T14:54:03.636584 | 2020-09-26T13:29:29 | 2020-09-26T13:29:29 | 223,366,344 | 1 | 1 | null | 2020-09-26T13:29:31 | 2019-11-22T09:13:02 | Java | UTF-8 | Java | false | false | 2,424 | java | package graph.oriented.unweighted;
import java.util.Set;
import java.util.function.Function;
import graph.ConnectionPredicate;
import graph.CyclePredicate;
import graph.ReachableVerticesAccessor;
import graph.SpanningTreeFactory;
import graph.oriented.StrongConnectionPredicate;
import utils.Pair;
public class UnweightedOrientedGraphOperations<V> {
private CyclePredicate<V> hasCycle;
private ConnectionPredicate<V> isConnected;
private ReachableVerticesAccessor<V> reachable;
private SpanningTreeFactory<V> spanningTree;
private ReachableVerticesAccessor<V> reachableFrom;
private ReachableVerticesAccessor<V> reachableTo;
private StrongConnectionPredicate<V> isStronglyConnected;
private CyclePredicate<V> hasCircuit;
public UnweightedOrientedGraphOperations(Function<Object, Set<V>> vertices, Function<V, Set<V>> children, Function<V, Set<V>> parents){
Function<V, Set<V>> related = x -> { Set<V> rel = children.apply(x); rel.addAll(parents.apply(x)); return rel; };
this.hasCycle = new CyclePredicate<>(vertices, related);
this.isConnected = new ConnectionPredicate<>(vertices, related);
this.reachable = new ReachableVerticesAccessor<>(related);
this.spanningTree = new SpanningTreeFactory<>(vertices, related);
this.reachableFrom = new ReachableVerticesAccessor<>(children);
this.reachableTo = new ReachableVerticesAccessor<>(parents);
this.isStronglyConnected = new StrongConnectionPredicate<>(vertices, this.reachableFrom);
this.hasCircuit = new CyclePredicate<>(vertices, this.reachableFrom);
}
public Set<V> reachable(V vertex) {
return this.reachable.get(vertex);
}
public Set<V> reachableFrom(V vertex){
return this.reachableFrom.get(vertex);
}
public Set<V> reachableTo(V vertex){
return this.reachableTo.get(vertex);
}
public boolean isStronglyConnected(Object graph){
return isStronglyConnected.test(graph);
}
public boolean isWeaklyConnected(Object graph){
return this.isConnected.test(graph);
}
public boolean hasCycle(Object graph){
return this.hasCycle.test(graph);
}
public boolean hasCircuit(Object graph){
return this.hasCircuit.test(graph);
}
public Set<Pair<V>> spanningTree(Object graph) {
return this.spanningTree.create(graph);
}
} | [
"matthieu.vergne@meritis.fr"
] | matthieu.vergne@meritis.fr |
29ebacc937f34d24531db902b173722c3105ba01 | ef59f22001e9de67bc555c0929ad9d8adf5f98de | /src/lab/java8/PredicateTester.java | 2cf9157abb834e4532b0e39be22df666355b79df | [] | no_license | voleynik/lab-java | b846aac2bafb82d8d841c1ef0645a6767bd005ae | f055bd19f61a807d2d1dec9b01ea1787b99e18aa | refs/heads/master | 2021-01-21T17:45:58.823354 | 2018-04-06T12:53:04 | 2018-04-06T12:53:04 | 91,983,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,470 | java | package lab.java8;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
public class PredicateTester {
public static void main(String args[]) {
List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9);
// Predicate<Integer> predicate = n -> true
// n is passed as parameter to test method of Predicate interface
// test method will always return true no matter what value n has.
System.out.println("\n Print all numbers:");
//pass n as parameter
eval(list, n->true);
// Predicate<Integer> predicate1 = n -> n%2 == 0
// n is passed as parameter to test method of Predicate interface
// test method will return true if n%2 comes to be zero
System.out.println("\n Print even numbers:");
eval(list, n-> n%2 == 0 );
System.out.println("\n Print odd numbers:");
eval(list, n-> ! (n%2 == 0) );
// Predicate<Integer> predicate2 = n -> n > 3
// n is passed as parameter to test method of Predicate interface
// test method will return true if n is greater than 3.
System.out.println("\n Print numbers greater than 3:");
eval(list, n-> n > 3 );
}
public static void eval(List<Integer> list, Predicate<Integer> predicate) {
for(Integer n: list) {
if(predicate.test(n)) {
System.out.print(n + " ");
}
}
}
}
| [
"Kiev1kiev@"
] | Kiev1kiev@ |
31d398fbb6000f334c816b4415f67b0e13eb6a42 | 8b2890f00cbc9b3047b0f217421a6c57870512a5 | /src/main/java/com/qvc/cn/it/report/manager/BaseManagerImpl.java | 70ccf63d84f2bb21da78a21eb3e2566728c4583a | [] | no_license | Reyke/SSHDemo | f62f5c588680127aef25df4a630fb6d7973ff10d | e58b42fd40aa829939c4892311918be407ab7f3c | refs/heads/master | 2016-08-12T13:59:29.688307 | 2015-11-25T10:09:16 | 2015-11-25T10:09:16 | 46,850,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package com.qvc.cn.it.report.manager;
import com.qvc.cn.it.report.BaseSpringManagedBean;
public class BaseManagerImpl extends BaseSpringManagedBean implements BaseManager {
}
| [
"reyke.liu@qq.com"
] | reyke.liu@qq.com |
bc8ef755d0ce3cb773b950a9acdaff0f081c7832 | 05622540c3388a267af8bd11e21ed4520319b49f | /ProjectPJ/src/repositoriesImpl/UserRepository.java | 85f4c5bfed90536209f9bf057e962d5475b9fc67 | [] | no_license | damiandobek/PJP2 | ab2d56980abf99666ef2563277e8fba73e1e8648 | 4917b40b84841bdbaf8b725c67ff49a9ef796a16 | refs/heads/master | 2020-12-24T14:52:43.983896 | 2015-01-02T23:02:28 | 2015-01-02T23:19:03 | 28,729,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,438 | java | package repositoriesImpl;
import java.sql.*;
import java.util.List;
import repositories.IUserRepository;
import unitofwork.IUnitOfWork;
import domain.*;
public class UserRepository extends Repository<User> implements IUserRepository{
//extends Repository<User> implements IUserRepository{
public UserRepository(Connection connection, IEntityBuilder<User> builder, IUnitOfWork uow) {
super(connection, builder);
}
@Override
protected String getTableName() {
return "users";
}
@Override
protected String getUpdateQuery() {
return
"UPDATE users SET (login,password)=(?,?) WHERE id=?";
}
@Override
protected String getInsertQuery() {
return "INSERT INTO users(login,password)"
+ "VALUES(?,?)";
}
@Override
protected void setUpInsertQuery(User entity) throws SQLException {
insert.setString(1, entity.getLogin());
insert.setString(2, entity.getPassword());
}
@Override
protected void setUpUpdateQuery(User entity) throws SQLException {
update.setString(1, entity.getLogin());
update.setString(2, entity.getPassword());
update.setInt(3, entity.getId());
}
@Override
public List<User> withRole(Role role) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<User> withRole(String roleName) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<User> withRole(int roleId) {
// TODO Auto-generated method stub
return null;
}
}
| [
"s11770@pjwstk.edu.pl"
] | s11770@pjwstk.edu.pl |
180cd69632edbf155e89fcc86f9aee0468af0fbd | e2c5f2e469abf7d4aeaabce98eeb44f756d8c585 | /com.supeyou.core.iface/src/main/java/com/supeyou/core/iface/Invitation2SupporterCRUDService.java | e924c0a826f1d5b2e5e3343a72cfeea8e758426d | [] | no_license | MoritzTheile/com.supeyou | 6db76d442866072af9b552411043f57036e1d745 | 289b2675d0b9ff908b1394988c1d806424261d6e | refs/heads/master | 2021-01-23T12:06:20.243484 | 2018-10-16T07:18:07 | 2018-10-16T07:18:07 | 102,648,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package com.supeyou.core.iface;
import com.supeyou.core.iface.dto.Invitation2SupporterFetchQuery;
import com.supeyou.core.iface.dto.Invitation2SupporterIDType;
import com.supeyou.core.iface.dto.InvitationDTO;
import com.supeyou.core.iface.dto.SupporterDTO;
import com.supeyou.crudie.iface.CRUDAssoService;
import com.supeyou.crudie.iface.dto.AbstrAssoDTO;
public interface Invitation2SupporterCRUDService extends CRUDAssoService<InvitationDTO, SupporterDTO, Invitation2SupporterIDType, AbstrAssoDTO<InvitationDTO, SupporterDTO, Invitation2SupporterIDType>, Invitation2SupporterFetchQuery> {
} | [
"MoritzTheile@757eb1d2-deeb-4e35-a037-182455f4f83f"
] | MoritzTheile@757eb1d2-deeb-4e35-a037-182455f4f83f |
e10fc7ea205387e1d4f55863b372b943b1dd238f | c5c05fa8c6af96dcd47514aafa2c5bc1941dadeb | /app/src/main/java/gofereats/views/main/subviews/RatingActivity.java | 59d80d637a7d6606d959bf4d09d69a32f692bf13 | [] | no_license | ma-c-kik/java-food-deliver-app-volados-user | 4dded557870df477768aee308221215de0cbe11f | 471a514d0471d93dd2f2e3396eed29c4f426214b | refs/heads/master | 2022-05-28T22:04:11.129840 | 2020-05-02T19:39:41 | 2020-05-02T19:39:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,977 | java | package gofereats.views.main.subviews;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.RelativeLayout;
import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.obs.CustomButton;
import com.obs.CustomTextView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import javax.inject.Inject;
import butterknife.ButterKnife;
import butterknife.InjectView;
import de.hdodenhof.circleimageview.CircleImageView;
import gofereats.R;
import gofereats.adapters.main.DriverFeedBacKAdapter;
import gofereats.adapters.main.FoodItemRatingAdapter;
import gofereats.configs.AppController;
import gofereats.configs.SessionManager;
import gofereats.datamodels.main.JsonResponse;
import gofereats.datamodels.order.MenuListModel;
import gofereats.datamodels.ratings.RatingDetailsModel;
import gofereats.datamodels.ratings.RatingOrderDetailsModel;
import gofereats.datamodels.ratings.issueslist.DriverIssueListModel;
import gofereats.datamodels.ratings.issueslist.FoodIssueModelList;
import gofereats.interfaces.ApiService;
import gofereats.interfaces.ServiceListener;
import gofereats.utils.CommonMethods;
import gofereats.utils.ImageUtils;
import gofereats.utils.RequestCallback;
import gofereats.views.customize.CustomDialog;
import gofereats.views.main.MainActivity;
import static gofereats.utils.Enums.REQ_RATING;
import static gofereats.utils.Enums.REQ_RATING_UPDATE;
public class RatingActivity extends AppCompatActivity implements ServiceListener, View.OnFocusChangeListener {
public static ArrayList<DriverIssueListModel> driverIssueList = new ArrayList<>();
public static ArrayList<FoodIssueModelList> foodIssueList = new ArrayList<>();
public static ArrayList<MenuListModel> ratingMenuList = new ArrayList<>();
public @Inject
ApiService apiService;
public @Inject
CommonMethods commonMethods;
public @Inject
CustomDialog customDialog;
public @Inject
SessionManager sessionManager;
public @Inject
ImageUtils imageUtils;
public @Inject
Gson gson;
public CircleImageView thumbs_up;
public CircleImageView thumbs_down;
public CircleImageView like_status_icon;
public CircleImageView ivDriverImage;
public ImageView ivResturantImage;
public CustomTextView delivery_status;
public CustomTextView tvResturantName;
public CustomTextView tvResturantOrderId;
public RelativeLayout add_commet_layout;
public RelativeLayout feedback_comments;
public RatingBar ratingBar;
public int orderId = 0;
public String driverReason = "";
public boolean submitEnable = false;
public float resturantRating;
// JSON conversion
public String jsonString = "";
public JSONObject json = new JSONObject();
public JSONObject driverObj = new JSONObject();
public JSONObject restaurantObj = new JSONObject();
public JSONArray foodArray = new JSONArray();
public CustomButton submit;
public RecyclerView rvIssues;
public RecyclerView rvMenus;
public RatingDetailsModel ratingDetailsModel;
public RatingOrderDetailsModel ratingOrderDetailsModel;
public FoodItemRatingAdapter foodItemRatingAdapter;
public DriverFeedBacKAdapter driverFeedBacKAdapter;
public @InjectView(R.id.edtDriverComment)
EditText edtDriverComment;
public @InjectView(R.id.edtRestaurantComment)
EditText edtRestaurantComment;
public BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String foodArrays = intent.getStringExtra("foodArray");
//Toast.makeText(RatingActivity.this,"Food Array "+foodArrays ,Toast.LENGTH_SHORT).show();
try {
foodArray = new JSONArray();
foodArray = new JSONArray(foodArrays);
submitEnable = true;
enableSubmit();
} catch (JSONException e) {
e.printStackTrace();
}
}
};
private AlertDialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rating);
AppController.getAppComponent().inject(this);
ButterKnife.inject(this);
initViews();
recView();
orderId = getIntent().getIntExtra("orderId", 0);
getMenuForRating();
edtDriverComment.setOnFocusChangeListener(this);
edtRestaurantComment.setOnFocusChangeListener(this);
/*String laydir = getResources().getString(R.string.layout_direction);
if ("1".equals(laydir)) {
ratingBar.setRotation(180);
ratingBar.setScaleY(-1);
}else {
ratingBar.setRotation(0);
ratingBar.setScaleY(0);
}
*/
ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
resturantRating = rating;
System.out.println("Rating " + resturantRating);
if (resturantRating > 0) edtRestaurantComment.setVisibility(View.VISIBLE);
else edtRestaurantComment.setVisibility(View.GONE);
submitEnable = true;
enableSubmit();
}
});
/**
* Submit your Ratings
*/
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
enableSubmit();
System.out.println("message " + jsonString);
//Toast.makeText(RatingActivity.this, "Thanks for the Ratings and comments", Toast.LENGTH_SHORT).show();
updateRating(jsonString);
}
});
/**
* Like and Dislike Functionality
*/
thumbs_up.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
thumbsUp();
}
});
thumbs_down.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
thumbsDown();
}
});
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter("foodArray"));
}
/**
* Ini Views
*/
private void initViews() {
rvMenus = findViewById(R.id.rvMenus);
thumbs_up = findViewById(R.id.thumbs_up);
thumbs_down = findViewById(R.id.thumbs_down);
delivery_status = findViewById(R.id.delivery_status);
add_commet_layout = findViewById(R.id.add_commet_layout);
//issues=(LinearLayout)findViewById(R.id.issues);
feedback_comments = findViewById(R.id.feedback_comments);
like_status_icon = findViewById(R.id.like_status_icon);
submit = findViewById(R.id.submit);
rvIssues = findViewById(R.id.rvIssues);
ivDriverImage = findViewById(R.id.ivDriverImage);
tvResturantName = findViewById(R.id.tvResturantName);
ivResturantImage = findViewById(R.id.ivResturantImage);
tvResturantOrderId = findViewById(R.id.tvResturantOrderId);
ratingBar = findViewById(R.id.ratingBar);
dialog = commonMethods.getAlertDialog(this);
}
/**
* Thumbs Up Functionality
*/
private void thumbsUp() {
like_status_icon.setVisibility(View.VISIBLE);
like_status_icon.setImageResource(R.drawable.thumbs_up_selected);
thumbs_up.setActivated(true);
thumbs_down.setActivated(false);
thumbs_up.setTag(1);
thumbs_down.setTag(0);
thumbs_up.setImageResource(R.drawable.thumbs_up_selected);
thumbs_down.setImageResource(R.drawable.thumbs_down_normal);
delivery_status.setText(getResources().getString(R.string.oh_great));
add_commet_layout.setVisibility(View.VISIBLE);
feedback_comments.setVisibility(View.GONE);
submitEnable = true;
enableSubmit();
}
/**
* Thumbs Down Functionality
*/
private void thumbsDown() {
like_status_icon.setVisibility(View.VISIBLE);
like_status_icon.setImageResource(R.drawable.thumbs_down_selected);
thumbs_up.setActivated(false);
thumbs_down.setActivated(true);
thumbs_up.setTag(0);
thumbs_down.setTag(1);
thumbs_up.setImageResource(R.drawable.thumbs_up_normal);
thumbs_down.setImageResource(R.drawable.thumbs_down_selected);
delivery_status.setText(getResources().getString(R.string.what_could_better));
add_commet_layout.setVisibility(View.VISIBLE);
feedback_comments.setVisibility(View.VISIBLE);
submitEnable = true;
enableSubmit();
driverFeedBacKAdapter = new DriverFeedBacKAdapter(getApplicationContext(), driverIssueList);
driverFeedBacKAdapter.setOnItemClickListener(new DriverFeedBacKAdapter.OnItemClickListener() {
@Override
public void onItemClickListener(int id, int positionz) {
driverReason = "";
for (int i = 0; i < driverIssueList.size(); i++) {
if (!driverIssueList.get(i).isSelected()) {
driverIssueList.get(i).getId();
System.out.println("SIZE" + driverIssueList.get(i).getId());
if (TextUtils.isEmpty(driverReason)) {
driverReason = driverReason + driverIssueList.get(i).getId();
} else {
driverReason = driverReason + "," + driverIssueList.get(i).getId();
}
}
}
/*
* For Must Give the Reason For Thumbs Down
*/
/* if (TextUtils.isEmpty(driverReason)) {
//submitEnable=false;
} else {
//submitEnable=true;
}*/
System.out.println("Driver Issues " + driverReason);
enableSubmit();
}
});
rvIssues.setAdapter(driverFeedBacKAdapter);
driverFeedBacKAdapter.notifyDataSetChanged();
}
/**
* To enable submit button
*/
public void enableSubmit() {
//submit.setEnabled(true);
//submit.setBackground(getResources().getDrawable(R.drawable.ripple_effect));
if (submitEnable) {//&&resturantRating>0.0){
submit.setEnabled(true);
submit.setBackground(getResources().getDrawable(R.drawable.ripple_effect));
} else {
submit.setEnabled(false);
submit.setBackgroundColor(getResources().getColor(R.color.appbuttondisable));
}
try {
if (thumbs_down.isActivated() || thumbs_up.isActivated()) {
int thumbs = 0;
if (thumbs_up.isActivated()) thumbs = 1;
driverObj.put("id", ratingOrderDetailsModel.getDriverId());
driverObj.put("thumbs", thumbs);
driverObj.put("reason", driverReason);
driverObj.put("comment", edtDriverComment.getText().toString());
}
if (resturantRating > 0) {
restaurantObj.put("id", ratingOrderDetailsModel.getRestaurantId());
restaurantObj.put("thumbs", Float.valueOf(resturantRating));
//restaurantObj.put("reason", "");
restaurantObj.put("comment", edtRestaurantComment.getText().toString());
}
if (foodArray != null) json.put("food", foodArray);
if (driverObj != null) json.put("driver", driverObj);
if (restaurantObj != null) json.put("store", restaurantObj);
jsonString = json.toString();
} catch (JSONException e) {
e.printStackTrace();
}
}
/**
* Setting RecyclerViews
*/
private void recView() {
GridLayoutManager layoutManager = new GridLayoutManager(this, 2, GridLayoutManager.VERTICAL, false);
//gridLayoutManager.setAutoMeasureEnabled(false);
//layoutManager.setOrientation(GridLayoutManager.VERTICAL);
rvIssues.setLayoutManager(layoutManager);
rvIssues.setHasFixedSize(true);
/*RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
rvIssues.setLayoutManager(layoutManager);*/
rvMenus.setHasFixedSize(true);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false);
//LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false);
rvMenus.setLayoutManager(linearLayoutManager);
}
/**
* Call API to Get The Get Rating details for menu, driver and restaurant
*/
private void getMenuForRating() {
commonMethods.showProgressDialog(this, customDialog);
apiService.userRatings(orderId, sessionManager.getToken()).enqueue(new RequestCallback(REQ_RATING, this));
}
/**
* Call API to update rating for menu, driver and restaurant
*/
private void updateRating(String rating) {
commonMethods.showProgressDialog(this, customDialog);
System.out.println("OrderId and Rating "+orderId+ ""+rating);
apiService.updateRating(orderId, rating, sessionManager.getToken()).enqueue(new RequestCallback(REQ_RATING_UPDATE, this));
}
@Override
public void onSuccess(JsonResponse jsonResp, String data) {
commonMethods.hideProgressDialog();
if (!jsonResp.isOnline()) {
if (!TextUtils.isEmpty(data)) commonMethods.showMessage(this, dialog, data);
return;
}
switch (jsonResp.getRequestCode()) {
case REQ_RATING:
if (jsonResp.isSuccess()) {
onSuccessRatingItemList(jsonResp);
} else if (!TextUtils.isEmpty(jsonResp.getStatusMsg())) {
commonMethods.showMessage(this, dialog, jsonResp.getStatusMsg());
}
break;
case REQ_RATING_UPDATE:
if (jsonResp.isSuccess()) {
MainActivity.cancelled = true;
Intent restartMainActivity = new Intent(getApplicationContext(), MainActivity.class);
restartMainActivity.putExtra("type", "placeorder");
startActivity(restartMainActivity);
} else if (!TextUtils.isEmpty(jsonResp.getStatusMsg())) {
commonMethods.showMessage(this, dialog, jsonResp.getStatusMsg());
}
break;
default:
break;
}
}
@Override
public void onFailure(JsonResponse jsonResp, String data) {
if (!TextUtils.isEmpty(jsonResp.getStatusMsg())) {
commonMethods.showMessage(this, dialog, jsonResp.getStatusMsg());
}
}
/**
* On Success Get List For rating
*
* @param jsonResp
*/
private void onSuccessRatingItemList(JsonResponse jsonResp) {
ratingDetailsModel = gson.fromJson(jsonResp.getStrResponse(), RatingDetailsModel.class);
if (ratingDetailsModel != null) {
updateView();
}
}
private void updateView() {
ratingOrderDetailsModel = ratingDetailsModel.getRatingOrderDetailsModel();
Glide.with(this).load(ratingOrderDetailsModel.getDriverImage()).into(ivDriverImage);
//Glide.with(this).load(ratingOrderDetailsModel.getRestauranBanner()).into(ivResturantImage);
Glide.with(this).load(ratingOrderDetailsModel.getBannerImageList().getSmallImage()).into(ivResturantImage);
tvResturantName.setText(ratingOrderDetailsModel.getResturantName());
if("0".equalsIgnoreCase(getResources().getString(R.string.layout_direction)))
tvResturantOrderId.setText(ratingOrderDetailsModel.getResturantName() + "\n" +getResources().getString(R.string.orderid) + " "+ "#" + ratingOrderDetailsModel.getOrderId());
else
tvResturantOrderId.setText(ratingOrderDetailsModel.getResturantName() + "\n"+getResources().getString(R.string.orderid) + " "+ ratingOrderDetailsModel.getOrderId()+ "#" );
if (ratingOrderDetailsModel.getDriverIssues() != null && (ratingOrderDetailsModel.getDriverIssues().size() > 0)) {
driverIssueList.clear();
driverIssueList.addAll(ratingOrderDetailsModel.getDriverIssues());
}
if (ratingOrderDetailsModel.getFoodIssues() != null && ratingOrderDetailsModel.getFoodIssues().size() > 0) {
foodIssueList.clear();
foodIssueList.addAll(ratingOrderDetailsModel.getFoodIssues());
}
if (ratingOrderDetailsModel.getMenuList() != null && ratingOrderDetailsModel.getMenuList().size() > 0) {
ratingMenuList.clear();
ratingMenuList.addAll(ratingOrderDetailsModel.getMenuList());
}
foodItemRatingAdapter = new FoodItemRatingAdapter(getApplicationContext(), ratingMenuList);
rvMenus.setAdapter(foodItemRatingAdapter);
}
public ArrayList<FoodIssueModelList> getFoodIssueList() {
return foodIssueList;
}
@Override
public void onFocusChange(View v, boolean hasFocus) {
switch (v.getId()) {
case R.id.edtDriverComment:
if (hasFocus) {
edtDriverComment.setHint("");
} else {
edtDriverComment.setHint(getResources().getString(R.string.add_a_comment));
}
break;
case R.id.edtRestaurantComment:
if (hasFocus) {
edtRestaurantComment.setHint("");
} else {
edtRestaurantComment.setHint(getResources().getString(R.string.add_a_comment));
}
break;
default:
break;
}
}
}
| [
"q3construction1@gmail.com"
] | q3construction1@gmail.com |
e4ba2fcdd3689c5c92192e31e86ad6f9cb0ccebb | ed1af92d32b7676e745a80427bd19f1eb910aaf1 | /12.Composite/src/main/java/CompositePatternClient.java | 75033af330d8ac79461d1abe403af5d4ff9639df | [] | no_license | Jeremy-Yuan-Java/gof23 | 8fe9d730cd6dcb68d87a08c8d27b5c60160cdef6 | 3e916a980201182056af15b054b4a9001e23ef57 | refs/heads/master | 2023-06-28T16:42:01.409894 | 2021-07-23T03:44:43 | 2021-07-23T03:44:43 | 387,707,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,473 | java | import java.util.ArrayList;
public class CompositePatternClient {
public static void main(String[] args) {
Component c0 = new Composite();
Component c1 = new Composite();
Component leaf1 = new Leaf("1");
Component leaf2 = new Leaf("2");
Component leaf3 = new Leaf("3");
c0.add(leaf1);
c0.add(c1);
c1.add(leaf2);
c1.add(leaf3);
c0.operation();
}
}
//抽象构件
interface Component {
public void add(Component c);
public void remove(Component c);
public Component getChild(int i);
public void operation();
}
//树叶构件
class Leaf implements Component {
private String name;
public Leaf(String name) {
this.name = name;
}
public void add(Component c) {
}
public void remove(Component c) {
}
public Component getChild(int i) {
return null;
}
public void operation() {
System.out.println("树叶" + name + ":被访问!");
}
}
//树枝构件
class Composite implements Component {
private ArrayList<Component> children = new ArrayList<Component>();
public void add(Component c) {
children.add(c);
}
public void remove(Component c) {
children.remove(c);
}
public Component getChild(int i) {
return children.get(i);
}
public void operation() {
for (Object obj : children) {
((Component) obj).operation();
}
}
} | [
"jeremt_yuan@126.com"
] | jeremt_yuan@126.com |
601a7ef23275c2e03f02b6ff6a1082cfc3882a45 | 6c60703bd43a2c06c45dfeae9630af2d8445646c | /pdfact-core/src/main/java/pdfact/core/pipes/parse/stream/pdfbox/operators/graphic/CurveTo.java | 2744f396d6e2619f42758d21f302808e6210f769 | [
"Apache-2.0"
] | permissive | ad-freiburg/pdfact | 299adfa89de7c8c3b3416009b3da032a351c0a89 | 00d4db9afe852e0b53b0e4d0ca624b66d284a997 | refs/heads/master | 2022-03-30T21:50:15.953166 | 2022-01-04T17:47:45 | 2022-01-04T17:47:45 | 127,158,621 | 52 | 11 | Apache-2.0 | 2022-01-04T17:47:46 | 2018-03-28T15:11:09 | Java | UTF-8 | Java | false | false | 1,596 | java | package pdfact.core.pipes.parse.stream.pdfbox.operators.graphic;
import java.io.IOException;
import java.util.List;
import org.apache.pdfbox.contentstream.operator.Operator;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSNumber;
import pdfact.core.model.Page;
import pdfact.core.model.Document;
import pdfact.core.model.Point;
import pdfact.core.pipes.parse.stream.pdfbox.operators.OperatorProcessor;
/**
* c: Append curved segment to path.
*
* @author Claudius Korzen
*/
public class CurveTo extends OperatorProcessor {
@Override
public void process(Document pdf, Page page, Operator op,
List<COSBase> args) throws IOException {
COSNumber x1 = (COSNumber) args.get(0);
COSNumber y1 = (COSNumber) args.get(1);
COSNumber x2 = (COSNumber) args.get(2);
COSNumber y2 = (COSNumber) args.get(3);
COSNumber x3 = (COSNumber) args.get(4);
COSNumber y3 = (COSNumber) args.get(5);
Point point1 = new Point(x1.floatValue(), y1.floatValue());
Point point2 = new Point(x2.floatValue(), y2.floatValue());
Point point3 = new Point(x3.floatValue(), y3.floatValue());
this.engine.transform(point1);
this.engine.transform(point2);
this.engine.transform(point3);
if (this.engine.getLinePath().getCurrentPoint() == null) {
this.engine.getLinePath().moveTo(point3.getX(), point3.getY());
} else {
this.engine.getLinePath().curveTo(point1.getX(), point1.getY(),
point2.getX(), point2.getY(), point3.getX(), point3.getY());
}
}
@Override
public String getName() {
return "c";
}
}
| [
"ckorzen@users.noreply.github.com"
] | ckorzen@users.noreply.github.com |
d9082da2d3afc0c964566ecd83bb0b42df6cfb7b | 1b9accece1f9d0ae83aa7976a53e1b9840a4982f | /app/src/main/java/com/gigpeople/app/adapter/LeftNavAdapter.java | d64e726ed5ae6365ade10d09629a6f53a3fd0104 | [] | no_license | MobileDev0702/gigpeople_android | 024b80d4a7c10795d5c5a44d99454ea91dd4695e | 824c66d04b35b4f53674283513f5a30f85e683df | refs/heads/master | 2022-11-29T22:52:39.670870 | 2020-08-13T02:48:16 | 2020-08-13T02:48:16 | 285,154,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,046 | java | package com.gigpeople.app.adapter;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.gigpeople.app.R;
import com.gigpeople.app.model.ClassLeftDrawer;
import java.util.List;
/**
* Created by swesspos on 11/11/17.
*/
public class LeftNavAdapter extends ArrayAdapter<ClassLeftDrawer> {
Context context;
public LeftNavAdapter(Context context, int resourceId,
List<ClassLeftDrawer> items) {
super(context, resourceId, items);
this.context = context;
}
/*private view holder class*/
public class ViewHolder {
ImageView imageView;
TextView txtTitle;
View view1;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
ClassLeftDrawer rowItem = getItem(position);
LayoutInflater mInflater = (LayoutInflater) context
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = mInflater.inflate(R.layout.activity_main_left_drawer_menu, null);
holder = new ViewHolder();
holder.txtTitle = (TextView) convertView.findViewById(R.id.txv_nave);
holder.imageView = (ImageView) convertView.findViewById(R.id.img_nave);
holder.view1 = (View) convertView.findViewById(R.id.view1);
convertView.setTag(holder);
} else
holder = (ViewHolder) convertView.getTag();
holder.txtTitle.setText(rowItem.getMenu_name());
holder.imageView.setImageResource(rowItem.getMenu_img());
if(position==3 || position==5)
{
holder.view1.setVisibility(View.VISIBLE);
}
else
{
holder.view1.setVisibility(View.GONE);
}
return convertView;
}
} | [
"mobiledev0702@hotmail.com"
] | mobiledev0702@hotmail.com |
553e9108b0b779c85e3993df922d4c7740a4595b | a07c4d74ebd93b564adb1bb69c6ce1a75d9cef9c | /src/MiniMaxSum.java | b6027fb8fcd95147b23b5b44ddfcc3c5f2fe2ad2 | [] | no_license | Skanderrr/HackerRank | a8a25a5375638500fab7efa8e9f91a9d172f6a2c | 20887bbdff813788c5c48c2b0aa2e13d918e3d06 | refs/heads/master | 2021-04-28T19:19:51.433948 | 2018-02-19T10:32:16 | 2018-02-19T10:32:16 | 121,893,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | import java.util.Scanner;
public class MiniMaxSum {
static void miniMaxSum(long[] arr) {
long max = arr[0];
long min = arr[0];
long sum = 0;
// Complete this function
for ( int i = 0; i <5; i++ ) {
sum += arr[i];
if ( arr[i] > max )
max = arr[i];
if ( arr[i] < min )
min = arr[i];
}
System.out.printf ( "%d %d", sum - max, sum - min );
}
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
long[] arr = new long[5];
for(int arr_i = 0; arr_i < 5; arr_i++){
arr[arr_i] = in.nextLong ();
}
miniMaxSum(arr);
in.close();
}
}
| [
"a.chouba957@gmail.com"
] | a.chouba957@gmail.com |
03f62d9b7259ecac55f7b5fef3380a3d346dfe8b | 2ddfdc082f6fd892a483b0479d79f4c063f271e1 | /src/main/java/com/soebes/jacem2/OperationCodeNOP.java | 349a4200d86db2fc50c64b91cd8df0d7724f7616 | [] | no_license | khmarbaise/CPUEmu | fedcfd7adf0bab6b196af7bd6ac81a9da2207818 | b1d7ff41fe43fffc310423fea47694fcb46f582f | refs/heads/master | 2021-06-11T11:47:21.884760 | 2021-02-15T17:04:52 | 2021-02-15T17:04:52 | 1,595,501 | 1 | 1 | null | 2015-09-26T23:20:15 | 2011-04-10T17:07:39 | Java | UTF-8 | Java | false | false | 414 | java | package com.soebes.jacem2;
import com.soebes.jacem.memory.CMemoryByte;
public class OperationCodeNOP extends AbstractOperationCode {
public OperationCodeNOP(CMemoryByte memory, RegisterSet registerSet) {
super(memory, registerSet);
setNumberOfBytes(1);
setMnemonic("NOP");
setCycles(4);
}
@Override
public void execute() {
setOperators(null);
}
}
| [
"info@soebes.de"
] | info@soebes.de |
cae738d1cd605b1f987f2eeef71d25f1d40c6ff9 | adfd699334f4c3b22e44bf8d15d242e4ad960829 | /src/main/java/br/com/sishovet/bean/MenuBean.java | f49e503920c1d67aaba4738ff90a91891d804635 | [
"MIT"
] | permissive | deividoliver/sishovet | b67e08e0072b2d77fd2f11079aa245ba648a1f71 | 9e4ca712def2d1206636cb7ef58f6b554bf6490d | refs/heads/master | 2022-12-21T08:39:52.335537 | 2019-09-25T19:52:16 | 2019-09-25T19:52:16 | 205,570,044 | 0 | 0 | MIT | 2022-12-16T02:42:00 | 2019-08-31T16:36:11 | CSS | UTF-8 | Java | false | false | 2,537 | 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 br.com.sishovet.bean;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
/**
*
* @author BPMLAB-04
*/
@ManagedBean
@RequestScoped
public class MenuBean {
public MenuBean() {
}
/////////////USUÁRIO/////////////
public String irInicio() {
return "/usuario/inicio.xhtml";
}
public String irRelatorioFichaPet() {
return "/usuario/relatorio/ficha.xhtml";
}
public String irAlterarSenha() {
return "/sishovet/usuario/alterar-senha.xhtml";
}
/////////FIM-USUÁRIO/////////////
/////////////SECRETARIA/////////////
public String irCadastroEspecie() {
return "/secretaria/especie/cadastro.xhtml";
}
public String irListarEspecie() {
return "/secretaria/especie/listar.xhtml";
}
public String irCadastroRaca() {
return "/secretaria/raca/cadastro.xhtml";
}
public String irListarRaca() {
return "/secretaria/raca/listar.xhtml";
}
public String irCadastroUsuario() {
return "/secretaria/usuario/cadastro_usuario.xhtml";
}
public String irCadastroProprietario() {
return "/secretaria/proprietario/cadastro_proprietario.xhtml";
}
public String irAtendimento() {
return "/secretaria/atendimento.xhtml";
}
public String irCadastroAnimal() {
return "/secretaria/pet/cadastro_animal.xhtml";
}
public String irListaPet() {
return "/secretaria/pet/lista_de_pet.xhtml";
}
public String irListaAtendimento() {
return "/secretaria/lista_de_atendimento.xhtml";
}
public String irListaProprietario() {
return "/secretaria/proprietario/lista_de_proprietario.xhtml";
}
/////////////FIM-SECRETARIA/////////////
/////////////ADMINISTRADOR/////////////
public String irAlterarPerfil() {
return "/admin/alterar_perfil.xhtml";
}
public String irHabilitarDesabilitarPerfil() {
return "/admin/habilitar_desabilitar.xhtml";
}
/////////////FIM-ADMINISTRADOR/////////////
///////////////MÉDICO//////////////////
public String irTriagem() {
return "/medico/triagem.xhtml";
}
public String irProcedimentoMedico() {
return "/medico/procedimento_medico.xhtml";
}
///////////FIM-MÉDICO//////////////////
}
| [
"deividsouza18@gmail.com"
] | deividsouza18@gmail.com |
5b042483eae86c6d35763151b56cb49fe9822101 | 94b132d7b3663e9c2541e1d56e083635373efe42 | /src/MainFunction/HammingDistance.java | bc7b55b216fdb54689e935151351e9fadb7b6c3a | [] | no_license | daixing1/leetcode- | 62a3f82c25b4ec1e77959ee0dc3d745f64301061 | 270ce542855607dde6623245da63d21815237ef3 | refs/heads/master | 2020-11-27T11:47:53.884492 | 2020-08-24T01:52:43 | 2020-08-24T01:52:43 | 229,425,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,061 | java | package MainFunction;
/**
* User: 兴希
* Date: 2020/7/9
* Time: 10:33
* Description: 两个整数之间的汉明距离指的是这两个数字对应二进制位不同的位置的数目。
* 给出两个整数 x 和 y,计算它们之间的汉明距离。
*/
public class HammingDistance {
public int hammingDistance(int x, int y) {
if (x>y){
return hammingDistance(y,x);
}
int count = 0;
int tmpx = 0;
int tmpy = 0;
while (x>0){
tmpx = x&1;
tmpy = y&1;
if (tmpx!=tmpy){
count++;
}
x = x>>1;
y = y>>1;
}
while (y>0){
tmpy = y&1;
if (tmpy==1){
count++;
}
y = y>>1;
}
return count;
}
public static void main(String[] args) {
HammingDistance hammingDistance = new HammingDistance();
int i = hammingDistance.hammingDistance(1, 4);
System.out.println(i);
}
}
| [
"790976320@qq.com"
] | 790976320@qq.com |
d3d7cb1c7678672d67f9c96de44cf5e2129cf0a2 | bceedb77b9370ff19c228149d8333225ddf0d68a | /src/main/java/ar/com/kfgodel/buxfer/client/api/exceptions/BuxferApiException.java | 2c86ef1bc82ba46bd88d947b645cf0379bd9c478 | [] | no_license | kfgodel/buxfer-api-client | e429ca4bc59db38cc4b8924f8fae79e3dbff999d | 0c319cdcd29b69ac6d28e6e977a828bc88a0a078 | refs/heads/master | 2021-06-11T03:38:49.158982 | 2020-04-05T00:06:13 | 2020-04-05T00:06:13 | 128,286,376 | 0 | 0 | null | 2021-06-07T16:34:24 | 2018-04-06T02:07:44 | Java | UTF-8 | Java | false | false | 447 | java | package ar.com.kfgodel.buxfer.client.api.exceptions;
/**
* This class represents an error on buxfer api communication
* Date: 08/04/18 - 23:55
*/
public class BuxferApiException extends RuntimeException {
public BuxferApiException(String message) {
super(message);
}
public BuxferApiException(String message, Throwable cause) {
super(message, cause);
}
public BuxferApiException(Throwable cause) {
super(cause);
}
}
| [
"dario.garcia@10pines.com"
] | dario.garcia@10pines.com |
5abef34ae35ad58d59d4f4e8198418cbbe543006 | 3e114a7561b3787085c25d231d696dbbbb697f36 | /SmartCity/WisdomOfBeijing/src/view/PhotoBean.java | f4cb8b9415341788977483f8ccbe0e4081c39caf | [
"Apache-2.0"
] | permissive | chenjunivy/androidcode | 5246995f64eaa8b87a0f42b7a271b4e3ca63dda6 | b8ad94958a03c640f71df9edbfb6b34807e87667 | refs/heads/master | 2020-09-20T07:26:45.339492 | 2016-09-23T04:05:22 | 2016-09-23T04:05:22 | 67,578,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package view;
import java.util.ArrayList;
public class PhotoBean {
public PhotoData data;
public class PhotoData{
public ArrayList<PhotoNews> news;
@Override
public String toString() {
return "PhotoData [news=" + news + "]";
}
}
public class PhotoNews{
public int id;
public String listimage;
public String title;
@Override
public String toString() {
return "PhotoNews [id=" + id + ", listimage=" + listimage
+ ", title=" + title + "]";
}
}
@Override
public String toString() {
return "PhotoBean [data=" + data + ", getClass()=" + getClass()
+ ", hashCode()=" + hashCode() + ", toString()="
+ super.toString() + "]";
}
}
| [
"chenjunysqh@163.com"
] | chenjunysqh@163.com |
c1f076c58333be8b540bc6133e3746ddf131aebf | c164053b3e62c5eb4e77092f785f9934609865f0 | /src/main/java/com/sinus/JobCompletionNotificationListener.java | 254c60f2e59f5c99791ee27ca37c722908f97556 | [] | no_license | iSINUS/batch | 870336aece4ceb58635429dd42627c90da0ac7d3 | 45d226bb7b95c6767c0c659203614455ea81fceb | refs/heads/master | 2021-01-10T10:12:03.629318 | 2016-02-16T12:48:14 | 2016-02-16T12:48:14 | 51,835,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,726 | java | package com.sinus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
/**
* Created by sinus on 16.02.16.
*/
@Component
public class JobCompletionNotificationListener extends JobExecutionListenerSupport{
private static final Logger log = LoggerFactory.getLogger(JobCompletionNotificationListener.class);
private final JdbcTemplate jdbcTemplate;
@Autowired
public JobCompletionNotificationListener(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
@Override
public void afterJob(JobExecution jobExecution) {
if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
log.info("!!! JOB FINISHED! Time to verify the results");
RowMapper<Person> rowMapper = new RowMapper<Person>() {
@Override
public Person mapRow(ResultSet resultSet, int i) throws SQLException {
return new Person(resultSet.getString(1),resultSet.getString(2));
}
};
List<Person> results = jdbcTemplate.query("SELECT first_name, last_name FROM people",rowMapper);
for (Person person : results) {
log.info("Found <"+person+"> in database.");
}
}
}
}
| [
"sinus@Sergeis-MBP.lan"
] | sinus@Sergeis-MBP.lan |
a8e05578721c413ae629fa5a725b8ef996afaa78 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/roomsdk/model/a.java | 6ad674cb841f424569d0d4bbf55791ff3debeaed | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 392 | java | package com.tencent.mm.roomsdk.model;
import com.tencent.mm.am.p;
public abstract class a
extends p
{
public abstract com.tencent.mm.roomsdk.model.b.a a(com.tencent.mm.roomsdk.model.b.a parama);
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes4.jar
* Qualified Name: com.tencent.mm.roomsdk.model.a
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
9bea2d88441b2d326fc651dcb5a2bc1e47689a6c | 00e79b4a3d6cf689c955363c8cd4ca60d8073f85 | /app/src/main/java/com/xms/widget/SwitchView.java | b14cd7f42f3f6b48701cafbd856f8366fcb0d8f7 | [] | no_license | pengxiaoshuai/DBM | 0c0e5dc70af659994319567a0a04281c93112e66 | f533710a1ea6084261317cb2c4bd06bbc5846524 | refs/heads/master | 2021-07-09T16:45:27.828589 | 2017-10-11T02:28:42 | 2017-10-11T02:28:42 | 106,362,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,105 | java | package com.xms.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.RadialGradient;
import android.graphics.RectF;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
/**
* For details, please see <b>http://blog.csdn.net/bfbx5173/article/details/45191147<b>
* @author QQ 517309507
*/
public class SwitchView extends View {
private final Paint paint = new Paint();
private final Path sPath = new Path();
private final Path bPath = new Path();
private final RectF bRectF = new RectF();
private float sAnim, bAnim;
private RadialGradient shadowGradient;
/**
* state switch on
*/
public static final int STATE_SWITCH_ON = 4;
/**
* state prepare to off
*/
public static final int STATE_SWITCH_ON2 = 3;
/**
* state prepare to on
*/
public static final int STATE_SWITCH_OFF2 = 2;
/**
* state prepare to off
*/
public static final int STATE_SWITCH_OFF = 1;
/**
* current state
*/
private int state = STATE_SWITCH_OFF;
/**
* last state
*/
private int lastState = state;
private int mWidth, mHeight;
private float sWidth, sHeight;
private float sLeft, sTop, sRight, sBottom;
private float sCenterX, sCenterY;
private float sScale;
private float bOffset;
private float bRadius, bStrokeWidth;
private float bWidth;
private float bLeft, bTop, bRight, bBottom;
private float bOnLeftX, bOn2LeftX, bOff2LeftX, bOffLeftX;
private float shadowHeight;
public SwitchView(Context context) {
this(context, null);
}
public SwitchView(Context context, AttributeSet attrs) {
super(context, attrs);
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSize = (int) (widthSize * 0.65f);
setMeasuredDimension(widthSize, heightSize);
}
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mWidth = w;
mHeight = h;
sLeft = sTop = 0;
sRight = mWidth;
sBottom = mHeight * 0.91f;
sWidth = sRight - sLeft;
sHeight = sBottom - sTop;
sCenterX = (sRight + sLeft) / 2;
sCenterY = (sBottom + sTop) / 2;
shadowHeight = mHeight - sBottom;
bLeft = bTop = 0;
bRight = bBottom = sBottom;
bWidth = bRight - bLeft;
final float halfHeightOfS = (sBottom - sTop) / 2;
bRadius = halfHeightOfS * 0.95f;
bOffset = bRadius * 0.2f;
bStrokeWidth = (halfHeightOfS - bRadius) * 2;
bOnLeftX = sWidth - bWidth;
bOn2LeftX = bOnLeftX - bOffset;
bOffLeftX = 0;
bOff2LeftX = 0;
sScale = 1 - bStrokeWidth / sHeight;
RectF sRectF = new RectF(sLeft, sTop, sBottom, sBottom);
sPath.arcTo(sRectF, 90, 180);
sRectF.left = sRight - sBottom;
sRectF.right = sRight;
sPath.arcTo(sRectF, 270, 180);
sPath.close();
bRectF.left = bLeft;
bRectF.right = bRight;
bRectF.top = bTop + bStrokeWidth / 2;
bRectF.bottom = bBottom - bStrokeWidth / 2;
shadowGradient = new RadialGradient(bWidth / 2, bWidth / 2, bWidth / 2, 0xff000000, 0x00000000, Shader.TileMode.CLAMP);
}
private void calcBPath(float percent) {
bPath.reset();
bRectF.left = bLeft + bStrokeWidth / 2;
bRectF.right = bRight - bStrokeWidth / 2;
bPath.arcTo(bRectF, 90, 180);
bRectF.left = bLeft + percent * bOffset + bStrokeWidth / 2;
bRectF.right = bRight + percent * bOffset - bStrokeWidth / 2;
bPath.arcTo(bRectF, 270, 180);
bPath.close();
}
private float calcBTranslate(float percent) {
float result = 0;
int wich = state - lastState;
switch (wich) {
case 1:
// off -> off2
if (state == STATE_SWITCH_OFF2) {
result = bOff2LeftX - (bOff2LeftX - bOffLeftX) * percent;
}
// on2 -> on
else if (state == STATE_SWITCH_ON) {
result = bOnLeftX - (bOnLeftX - bOn2LeftX) * percent;
}
break;
case 2:
// off2 -> on
if (state == STATE_SWITCH_ON) {
result = bOnLeftX - (bOnLeftX - bOff2LeftX) * percent;
}
// off -> on2
else if (state == STATE_SWITCH_ON) {
result = bOn2LeftX - (bOn2LeftX - bOffLeftX) * percent;
}
break;
case 3: // off -> on
result = bOnLeftX - (bOnLeftX - bOffLeftX) * percent;
break;
case -1:
// on -> on2
if (state == STATE_SWITCH_ON2) {
result = bOn2LeftX + (bOnLeftX - bOn2LeftX) * percent;
}
// off2 -> off
else if (state == STATE_SWITCH_OFF) {
result = bOffLeftX + (bOff2LeftX - bOffLeftX) * percent;
}
break;
case -2:
// on2 -> off
if (state == STATE_SWITCH_OFF) {
result = bOffLeftX + (bOn2LeftX - bOffLeftX) * percent;
}
// on -> off2
else if (state == STATE_SWITCH_OFF2) {
result = bOff2LeftX + (bOnLeftX - bOff2LeftX) * percent;
}
break;
case -3: // on -> off
result = bOffLeftX + (bOnLeftX - bOffLeftX) * percent;
break;
}
return result - bOffLeftX;
}
@Override protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
paint.setAntiAlias(true);
final boolean isOn = (state == STATE_SWITCH_ON || state == STATE_SWITCH_ON2);
// draw background
paint.setStyle(Style.FILL);
paint.setColor(isOn ? 0xff4bd763 : 0xffe3e3e3);
canvas.drawPath(sPath, paint);
sAnim = sAnim - 0.1f > 0 ? sAnim - 0.1f : 0;
bAnim = bAnim - 0.1f > 0 ? bAnim - 0.1f : 0;
// draw background animation
final float scale = sScale * (isOn ? sAnim : 1 - sAnim);
final float scaleOffset = (bOnLeftX + bRadius - sCenterX) * (isOn ? 1 - sAnim : sAnim);
canvas.save();
canvas.scale(scale, scale, sCenterX + scaleOffset, sCenterY);
paint.setColor(0xffffffff);
canvas.drawPath(sPath, paint);
canvas.restore();
// draw center bar
canvas.save();
canvas.translate(calcBTranslate(bAnim), shadowHeight);
final boolean isState2 = (state == STATE_SWITCH_ON2 || state == STATE_SWITCH_OFF2);
final float percent = (isState2 ? 1 - bAnim : bAnim);
calcBPath(percent);
// draw shadow
paint.setStyle(Style.FILL);
paint.setColor(0xff333333);
paint.setShader(shadowGradient);
canvas.drawPath(bPath, paint);
paint.setShader(null);
canvas.translate(0, -shadowHeight);
canvas.scale(0.98f, 0.98f, bWidth / 2, bWidth / 2);
paint.setStyle(Style.FILL);
paint.setColor(0xffffffff);
canvas.drawPath(bPath, paint);
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(bStrokeWidth * 0.5f);
paint.setColor(isOn ? 0xff4ada60 : 0xffbfbfbf);
canvas.drawPath(bPath, paint);
canvas.restore();
paint.reset();
if (sAnim > 0 || bAnim > 0) invalidate();
}
@Override public boolean onTouchEvent(MotionEvent event) {
if ((state == STATE_SWITCH_ON || state == STATE_SWITCH_OFF) && (sAnim * bAnim == 0)) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
return true;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
lastState = state;
if (state == STATE_SWITCH_OFF) {
refreshState(STATE_SWITCH_OFF2);
}
else if (state == STATE_SWITCH_ON) {
refreshState(STATE_SWITCH_ON2);
}
bAnim = 1;
invalidate();
if (listener != null) {
if (state == STATE_SWITCH_OFF2) {
listener.toggleToOn();
}
else if (state == STATE_SWITCH_ON2) {
listener.toggleToOff();
}
}
break;
}
}
return super.onTouchEvent(event);
}
private void refreshState(int newState) {
lastState = state;
state = newState;
postInvalidate();
}
/**
*
* @return the state of switch view
*/
public int getState() {
return state;
}
/**
* if set true , the state change to on;
* if set false, the state change to off
* @param isOn
*/
public void setState(boolean isOn) {
final int wich = isOn ? STATE_SWITCH_ON : STATE_SWITCH_OFF;
refreshState(wich);
}
/**
* if set true , the state change to on;
* if set false, the state change to off
* <br><b>change state with animation</b>
* @param letItOn
*/
public void toggleSwitch(boolean letItOn) {
final int wich = letItOn ? STATE_SWITCH_ON : STATE_SWITCH_OFF;
postDelayed(new Runnable() {
@Override public void run() {
toggleSwitch(wich);
}
}, 300);
}
private synchronized void toggleSwitch(int wich) {
if (wich == STATE_SWITCH_ON || wich == STATE_SWITCH_OFF) {
if ((wich == STATE_SWITCH_ON && (lastState == STATE_SWITCH_OFF || lastState == STATE_SWITCH_OFF2))
|| (wich == STATE_SWITCH_OFF && (lastState == STATE_SWITCH_ON || lastState == STATE_SWITCH_ON2))) {
sAnim = 1;
}
bAnim = 1;
refreshState(wich);
}
}
public interface OnStateChangedListener {
void toggleToOn();
void toggleToOff();
}
private OnStateChangedListener listener = new OnStateChangedListener() {
@Override public void toggleToOn() {
toggleSwitch(STATE_SWITCH_ON);
}
@Override public void toggleToOff() {
toggleSwitch(STATE_SWITCH_OFF);
}
};
public void setOnStateChangedListener(OnStateChangedListener listener) {
if (listener == null) throw new IllegalArgumentException("empty listener");
this.listener = listener;
}
}
| [
"1299746690@qq.com"
] | 1299746690@qq.com |
428a36a2815dbdab1203c364381c4141c3486042 | 44cc29c5941c25faf9543b5663a0f13ccdc77f21 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/season/relicrecov18/polaris/v1/robot/Drive.java | 54620c82f5876244405610bba9ea3c6f7b59ac46 | [] | no_license | BunnyFuFuu/AstronomityTestOpenRC | 86b96e8b02bf492d03421f4ca35ab99b56e4803d | e56d36642580f221b399725f90da6fe45e5c0811 | refs/heads/master | 2021-05-08T16:07:29.062490 | 2018-02-04T00:38:26 | 2018-02-04T00:38:26 | 120,141,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,247 | java | package org.firstinspires.ftc.teamcode.season.relicrecov18.polaris.v1.robot;
import com.qualcomm.hardware.bosch.BNO055IMU;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorEx;
import com.qualcomm.robotcore.util.Range;
import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder;
import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
import org.firstinspires.ftc.teamcode.robot.Robot;
import org.firstinspires.ftc.teamcode.robot.SubSystem;
import org.firstinspires.ftc.teamcode.season.relicrecov18.polaris.v1.program.programs.AnalogSensor;
import org.firstinspires.ftc.teamcode.util.Vector;
import static java.lang.Thread.sleep;
/**
* Created by Andrew on 12/6/2017.
*/
public class Drive extends SubSystem{
private DcMotorEx motor1, motor2, motor3, motor4;
public AnalogSensor frontSensor;
public BNO055IMU imu;
public int homeAngle;
double globalAngle;
double stoneThreshold = 2.5;
double drivingoffThreshold = 2.5;
private double motor1XY;
private double motor2XY;
private double motor3XY;
private double motor4XY;
boolean dpadLeftPrevState = false;
boolean dpadRightPrevState = false;
double targetAngle;
public Drive(Robot robot) {
super(robot);
}
@Override
public void init() throws InterruptedException {
motor1 = (DcMotorEx) robot.hardwareMap.dcMotor.get("motor1");
motor2 = (DcMotorEx) robot.hardwareMap.dcMotor.get("motor2");
motor3 = (DcMotorEx) robot.hardwareMap.dcMotor.get("motor3");
motor4 = (DcMotorEx) robot.hardwareMap.dcMotor.get("motor4");
motor1.setDirection(DcMotor.Direction.REVERSE);
motor2.setDirection(DcMotor.Direction.FORWARD);
motor3.setDirection(DcMotor.Direction.REVERSE);
motor4.setDirection(DcMotor.Direction.FORWARD);
frontSensor = new AnalogSensor("frontSensor", AnalogSensor.Type.LONG_RANGE);
frontSensor.initialize(robot.hardwareMap);
initGyro();
modeEncoders();
}
public void readSensorsSetUp() {
for (int i = 0; i < AnalogSensor.NUM_OF_READINGS; i++ ) {
frontSensor.addReading();
}
}
public void initGyro(){
BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();
parameters.mode = BNO055IMU.SensorMode.IMU;
parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;
parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;
parameters.loggingEnabled = false;
imu = robot.hardwareMap.get(BNO055IMU.class, "imu");
imu.initialize(parameters);
robot.telemetry.addData("Mode", "calibrating...");
robot.telemetry.update();
}
public void notifyGyroReady(){
robot.telemetry.addData("Mode", "waiting for start");
robot.telemetry.addData("imu calib status", imu.getCalibrationStatus().toString());
robot.telemetry.addData("Angle", getYaw());
robot.telemetry.addData("Pitch", getPitch());
robot.telemetry.update();
}
@Override
public void handle() {
Vector inputVector = new Vector(robot.gamepad1.left_stick_x, -robot.gamepad1.left_stick_y); //gamepads are weird, -1 is at the top of the y axis
Vector motionVector = inputVector.rotate(-Math.PI / 4);
robot.telemetry.addData("motionVector init r", motionVector.r);
motionVector = motionVector.normalize(Math.pow(motionVector.r,2)*Math.sqrt(2));
robot.telemetry.addData("motionVector final r", motionVector.r);
robot.telemetry.addData("Aligned with Cryptobox:", isAligned());
if ((robot.gamepad1.dpad_left != dpadLeftPrevState && robot.gamepad1.dpad_left) || (robot.gamepad1.dpad_right != dpadRightPrevState && robot.gamepad1.dpad_right)){
targetAngle = getYaw();
}
if (robot.gamepad1.left_bumper && motionVector.isZeroVector()) {
motor1.setPower(-1);
motor2.setPower(1);
motor3.setPower(-1);
motor4.setPower(1);
} else if (robot.gamepad1.right_bumper && motionVector.isZeroVector()) {
motor1.setPower(1);
motor2.setPower(-1);
motor3.setPower(1);
motor4.setPower(-1);
}
else if(robot.gamepad1.dpad_left || robot.gamepad1.dpad_right) {
double error = getYaw()-targetAngle;
double p = 0.05*error;
double power = 0.3*(dpadRight()-dpadLeft());
motor1.setPower(power+p);
motor2.setPower(-power-p);
motor3.setPower(-power+p);
motor4.setPower(power-p);
}
else {
double offset = (robot.gamepad1.left_trigger-robot.gamepad1.right_trigger) / 3.5;
motor1.setPower(Range.clip(motionVector.x - offset, -1, 1));
motor2.setPower(Range.clip(motionVector.y + offset, -1, 1));
motor3.setPower(Range.clip(motionVector.y - offset, -1, 1));
motor4.setPower(Range.clip(motionVector.x + offset, -1, 1));
}
dpadLeftPrevState = robot.gamepad1.dpad_left;
dpadRightPrevState = robot.gamepad1.dpad_right;
robot.telemetry.update();
}
public int dpadRight(){
int returnVal = robot.gamepad1.dpad_right ? 1 : 0;
return returnVal;
}
public int dpadLeft(){
int returnVal = robot.gamepad1.dpad_left ? 1 : 0;
return returnVal;
}
public void modeEncoders() {
motor1.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
motor2.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
motor3.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
motor4.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
}
public void drive(double speed) {
motor1.setPower(speed);
motor2.setPower(speed);
motor3.setPower(speed);
motor4.setPower(speed);
}
public void strafeDistance(double distance, double power) throws InterruptedException {
double encoderTicks = inchesToPositions(distance);
resetEncoders();
waitforEncodersStrafe(encoderTicks, power);
stopDrive();
}
boolean isAligned() {
return (int) Math.abs(getYaw()) % 90 < 3;
}
public void driveDistance(double distance, double power) throws InterruptedException {
double encoderTicks = inchesToPositions(distance);
resetEncoders();
waitforEncoders(encoderTicks, power);
stopDrive();
}
public void turnExact(double velocity, double angle, double threshold) throws InterruptedException {//velocity out of 1
//double initialYaw = getYaw();
//double totalDelta = Math.abs(initialYaw)-angle;
while (Math.abs(getYaw() - angle) > threshold) {
//double inversePercentError = 1-Math.abs((getYaw()-initialYaw)/totalDelta);
//double pController = Range.clip(Math.cbrt(inversePercentError), 0.2, 1);
//double outputRequest = velocity*pController;
if (getYaw() < angle) {
motor1.setPower(-velocity);
motor2.setPower(velocity);
motor3.setPower(-velocity);
motor4.setPower(velocity);
} else {
motor1.setPower(velocity);
motor2.setPower(-velocity);
motor3.setPower(velocity);
motor4.setPower(-velocity);
}
robot.telemetry.addData("Heading", getYaw());
robot.telemetry.update();
sleep(1);
}
stopDrive();
}
public void strafeMaintainYawUntilDistance(double distance, double velocity, double angle) throws InterruptedException{
resetEncoders();
waitforEncoderDistance(distance, velocity, angle);
stopDrive();
}
public void waitforEncoderDistance (double distance, double velocity, double targAngle) throws InterruptedException{
double elapsedTime = 0;
double accumulatedError = 0;
double lastError = 0;
double kp = 0.075;
double ki = 0;
double kd = 0;
double toGo = 0;
while (toGo < distance) {
double currentTime = System.currentTimeMillis();
double error = getYaw() - targAngle;
double p = kp * error;
double i = ki * (error + accumulatedError) * elapsedTime;
double d = kd * (error - lastError) / elapsedTime;
double pi = p + i;
double pd = p + d;
double pid = p + i + d;
motor1.setPower(velocity + pid);
motor2.setPower(-velocity - pid);
motor3.setPower(-velocity + pid);
motor4.setPower(velocity - pid);
lastError = error;
accumulatedError += error;
robot.telemetry.addData("MotorFL", motor1.getPower());
robot.telemetry.addData("MotorFR", motor2.getPower());
robot.telemetry.addData("MotorBL", motor3.getPower());
robot.telemetry.addData("MotorBR", motor4.getPower());
robot.telemetry.addData("CMAvg", frontSensor.getCmAvg());
robot.telemetry.update();
sleep(1);
elapsedTime = System.currentTimeMillis() - currentTime;
toGo = frontSensor.getCmAvg();
frontSensor.addReading();
}
}
public void driveMaintainYaw(double distance, double velocity, double angle, double threshold) throws InterruptedException {
double encoderTicks = inchesToPositions(distance);
resetEncoders();
waitforEncoderwithYaw(encoderTicks, velocity, angle, threshold);
stopDrive();
}
public void waitforEncoderwithYaw(double encoderTicks, double velocity, double targAngle, double threshold) throws InterruptedException {
double elapsedTime = 1;
double accumulatedError = 0;
double lastError = 0;
double kp = 0.05;
double ki = 0;
double kd = 0.05;
while (getFurthestEncoder() < encoderTicks) {
double currentTime = System.currentTimeMillis();
double error = getYaw() - targAngle;
double p = kp * error; //proportional component, bases the change to output request based on the amount of error present
double i = ki * (error + accumulatedError) * elapsedTime;//integral component, bases the change to output request based on the accumulation of error present
double d = kd * (error - lastError) / elapsedTime;//derivative component, bases the change to output request based on the rate of change of error present
double pi = p + i;
double pd = p + d;
double pid = p + i + d;
motor1.setPower(velocity + pid);
motor2.setPower(velocity - pid);
motor3.setPower(velocity + pid);
motor4.setPower(velocity - pid);
lastError = error;
accumulatedError += error;
robot.telemetry.addData("MotorFL", motor1.getPower());
robot.telemetry.addData("MotorFR", motor2.getPower());
robot.telemetry.addData("MotorBL", motor3.getPower());
robot.telemetry.addData("MotorBR", motor4.getPower());
robot.telemetry.addData("Yaw", getYaw());
robot.telemetry.update();
sleep(1);
elapsedTime = System.currentTimeMillis() - currentTime;
/*if(Math.abs(getYaw())-targAngle<threshold){
motor1.setVelocity(velocity * 960, AngleUnit.DEGREES);
motor2.setVelocity(velocity*900, AngleUnit.DEGREES);
motor3.setVelocity(velocity*960, AngleUnit.DEGREES);
motor4.setVelocity(velocity*900, AngleUnit.DEGREES);
sleep(1);
}
else{
motor1.setVelocity(velocity*900, AngleUnit.DEGREES);
motor2.setVelocity(velocity*960, AngleUnit.DEGREES);
motor3.setVelocity(velocity*900, AngleUnit.DEGREES);
motor4.setVelocity(velocity*960, AngleUnit.DEGREES);
sleep(1);
}*/
}
}
public void strafeMaintainYaw(double distance, double velocity, double angle, double threshold) throws InterruptedException{
double encoderTicks = inchesToPositions(distance);
resetEncoders();
waitforEncoderStrafeWithYaw(encoderTicks, velocity, angle, threshold);
stopDrive();
}
public void waitforEncoderStrafeWithYaw(double encoderTicks, double velocity, double targAngle, double threshold) throws InterruptedException {
double elapsedTime = 0;
double accumulatedError = 0;
double lastError = 0;
double kp = 0.075;
double ki = 0;
double kd = 0;
while (getFurthestEncoder() < encoderTicks) {
double currentTime = System.currentTimeMillis();
double error = getYaw() - targAngle;
double p = kp * error;
double i = ki * (error + accumulatedError) * elapsedTime;
double d = kd * (error - lastError) / elapsedTime;
double pi = p + i;
double pd = p + d;
double pid = p + i + d;
motor1.setPower(velocity + pid);
motor2.setPower(-velocity - pid);
motor3.setPower(-velocity + pid);
motor4.setPower(velocity - pid);
lastError = error;
accumulatedError += error;
robot.telemetry.addData("MotorFL", motor1.getPower());
robot.telemetry.addData("MotorFR", motor2.getPower());
robot.telemetry.addData("MotorBL", motor3.getPower());
robot.telemetry.addData("MotorBR", motor4.getPower());
robot.telemetry.update();
sleep(1);
elapsedTime = System.currentTimeMillis() - currentTime;
}
}
public void stopDrive() {
motor1.setPower(0);
motor2.setPower(0);
motor3.setPower(0);
motor4.setPower(0);
}
public double getYaw() {
Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
return angles.firstAngle;
}
public double getPitch() {
Orientation angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
return angles.thirdAngle;
}
public void driveoffBalancingStone()throws InterruptedException{
boolean stillDrivingOff = true;
while(getPitch()<stoneThreshold){
double error = getYaw();
motor1.setPower(0.5+(0.05*error));
motor2.setPower(0.5-(0.05*error));
motor3.setPower(0.5+(0.05*error));
motor4.setPower(0.5-(0.05*error));
robot.telemetry.addData("Unbalancing stone", getPitch());
robot.telemetry.update();
sleep(10);
}
while(getPitch()>drivingoffThreshold && stillDrivingOff){
double error = getYaw();
motor1.setPower(0.5+(0.05*error));
motor2.setPower(0.5-(0.05*error));
motor3.setPower(0.5+(0.05*error));
motor4.setPower(0.5-(0.05*error));
robot.telemetry.addData("Still driving off", getPitch());
robot.telemetry.update();
sleep(10);
if (getPitch()<stoneThreshold){
stopDrive();
stillDrivingOff = false;
robot.telemetry.addData("Off the stone", getPitch());
robot.telemetry.update();
}
}
}
private int getFurthestEncoder() {
int left = Math.max(Math.abs(motor1.getCurrentPosition()), Math.abs(motor3.getCurrentPosition()));
int right = Math.max(Math.abs(motor2.getCurrentPosition()), Math.abs(motor4.getCurrentPosition()));
int both = Math.max(left, right);
return both;
}
private void waitforEncoders(double encoderTicks, double power) throws InterruptedException {
while (getFurthestEncoder() < encoderTicks) {
motor1.setPower(power);
motor2.setPower(power);
motor3.setPower(power);
motor4.setPower(power);
sleep(1);
}
}
private void waitforEncodersStrafe(double encoderTicks, double power) throws InterruptedException {
while (getFurthestEncoder() < encoderTicks) {
motor1.setPower(power);
motor2.setPower(-power);
motor3.setPower(-power);
motor4.setPower(power);
sleep(1);
}
}
public int inchesToPositions(double inches) {
return (int) Math.round(inches * 210 / Math.PI);
}
public void resetEncoders() {
motor1.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
motor2.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
motor3.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
motor4.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
motor1.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
motor2.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
motor3.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
motor4.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
}
public void paramDrive(double x, double y, double c) throws InterruptedException { //this is a function based on the cartesian coordinate system: positive x axis is right strafe, positive y axis is forward/back, positive c is counterclockwise
//reference is 70rpm for y, x component max/60sec*4.006pi*4/3GR and replace 70 with 20 for c component (420 420 120 in degrees/sec), assumes y is maxed out to determine time needed to travel
//double seconds = inchestomotorDegs(y)/420; //determines how many seconds the program is expected to run for
double yRequest = 420 * y / Math.abs(y); //assumes y maxed out, and normalizes it to make sure it's the right direction (SPEED)
double xRequest = Math.abs(x / y) * 420 * x / Math.abs(x); //bases the x request on the x to y ratio so they end at the same time, then normalizes it to make sure it's the right direction (SPEED)
double spinRequest;//14.6 wheeldist as a rough estimate to extrapolate how far wheel will turn per second assuming full speed turn of 120 deg/sec
this.motor1XY = yRequest + xRequest;
this.motor2XY = yRequest - xRequest;
this.motor3XY = yRequest - xRequest;
this.motor4XY = yRequest + xRequest;
double checkSumYX = Math.abs(yRequest) + Math.abs(xRequest);
if (checkSumYX > 840) { //if the x and y go over the hardcap we set for speed of move/strafe, normalize it so the ratio remains the same but the fastest motor will go at cap speed
motor1XY /= checkSumYX * 840;
motor2XY /= checkSumYX * 840;
motor3XY /= checkSumYX * 840;
motor4XY /= checkSumYX * 840;
}
double seconds = (Math.abs(inchestomotorDegs(y)) / checkSumYX); //determines how many seconds it will take to travel the full y distance (since x will be based off this, they end at the same time)
spinRequest = degreestomotorDegs(c) / seconds; //Gets spin speed based off of the time required
motor1.setVelocity(motor1XY - spinRequest, AngleUnit.DEGREES);
motor2.setVelocity(motor1XY - spinRequest, AngleUnit.DEGREES);
motor3.setVelocity(motor1XY + spinRequest, AngleUnit.DEGREES);
motor4.setVelocity(motor1XY + spinRequest, AngleUnit.DEGREES);
sleep((long) seconds);
motor1.setVelocity(0, AngleUnit.DEGREES);
motor2.setVelocity(0, AngleUnit.DEGREES);
motor3.setVelocity(0, AngleUnit.DEGREES);
motor4.setVelocity(0, AngleUnit.DEGREES);
//turnGyro((int) c, 0.2);
}
public double inchestomotorDegs(double inches) {
return inches / 4.006 * Math.PI * 360 * 4 / 3;
}
public double degreestomotorDegs(double degrees) {
return inchestomotorDegs(degrees / 360 * 14.6 * Math.PI);
}
@Override
public void stop() {
}
} | [
"andrewliangsd@gmail.com"
] | andrewliangsd@gmail.com |
11ef91ef535eb9cfca3008a19b8b6c1bfa9c660f | 6957911d40cb26b50fac0cffe1f83749d6f46790 | /logserviceSDK/src/main/java/com/zzg/logservice/api/ILogDataProcessingService.java | 180e7f6f6dd7998e4179fe2646f91d16300304b4 | [] | no_license | Abelzzg/AOP_LOG_CONNECTOR | 5a2badf62541b9fb4786e962133400fbe44d8b8a | b59826e2b2b15c95b872fca8712f9834c9782e12 | refs/heads/master | 2016-09-14T19:01:52.160790 | 2016-06-08T06:45:04 | 2016-06-08T06:45:04 | 59,474,655 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | package com.zzg.logservice.api;
/**
* @author Abelzzg
* @version V1.0
* @Description: ${todo}
* @date ${date} ${time}
*/
public interface ILogDataProcessingService {
void processCountEventLogData(String eventName, String viewName, int count);
String processDuringStartEventLogData(String eventName, String viewName);
void processDuringEndEventLogData(String token);
void processBehaviorEventLogData(String viewName);
void processErrorEventLogData(String viewName, String errorCode, Exception ex);
void processDuringEventLogData(String className, String method, String during);
}
| [
"abelzzg90@gmail.com"
] | abelzzg90@gmail.com |
b8634d7d6e23487ecdfe54bfe610c7b00622eafd | f8d9bb5b118338bd58ced1d743d5272ab734c9aa | /src/simple_hello/simple_hello_world.java | a76590ae102e6f23c8c8f58b1cb2b01c5052e142 | [
"MIT"
] | permissive | LeeEunhyeong/simple_java_workspace | e98d740c54e5c5cb8b99da55a0c1d573d3c6df25 | f1704cee38d6db4b2c3e11944f3a930a468e92d6 | refs/heads/master | 2021-01-17T16:52:56.055556 | 2016-06-30T02:19:23 | 2016-06-30T02:22:44 | 62,271,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package simple_hello;
public class simple_hello_world {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("hello world");
}
}
| [
"lehyong03@naver.com"
] | lehyong03@naver.com |
ac5b4a58570f35e508b12c144a230ecfc9d57d75 | e175b916b71d010960276a532abc9d2ba7ace3cc | /app/src/main/java/me/samlss/inkjet/ui/base/ItemDescription.java | 1890111eed6bb873071a50a2b8984ab473caf072 | [
"Apache-2.0"
] | permissive | wutongyuqq/Inkjet-master2 | 172c9dc5dc685c5329f46e69e8bd58cbbdcb093c | d6c17b3c162ee2bc3fca60479d537cd6d07cb761 | refs/heads/master | 2023-02-22T03:11:41.484599 | 2021-01-11T22:46:04 | 2021-01-11T22:46:04 | 328,718,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,412 | java | package me.samlss.inkjet.ui.base;
import android.graphics.drawable.Drawable;
/**
* @author SamLeung
* @e-mail samlssplus@gmail.com
* @github https://github.com/samlss
* @description 设置
*/
public class ItemDescription {
private Class<? extends BaseFragment> mKitDemoClass;
private String mKitName;
private int mIconRes;
private String mDocUrl;
private Drawable mBgDrawable;
public ItemDescription(Class<? extends BaseFragment> kitDemoClass, String kitName){
this(kitDemoClass, kitName, 0, "");
}
public ItemDescription(Class<? extends BaseFragment> mKitDemoClass, String mKitName, int mIconRes, Drawable bg) {
this.mKitDemoClass = mKitDemoClass;
this.mKitName = mKitName;
this.mIconRes = mIconRes;
this.mBgDrawable = bg;
}
public ItemDescription(Class<? extends BaseFragment> kitDemoClass, String kitName, int iconRes, String docUrl) {
mKitDemoClass = kitDemoClass;
mKitName = kitName;
mIconRes = iconRes;
mDocUrl = docUrl;
}
public Class<? extends BaseFragment> getDemoClass() {
return mKitDemoClass;
}
public Drawable getBgDrawable() {
return mBgDrawable;
}
public String getName() {
return mKitName;
}
public int getIconRes() {
return mIconRes;
}
public String getDocUrl() {
return mDocUrl;
}
}
| [
"314421674@qq.com"
] | 314421674@qq.com |
5c5cff9a71a0a27d35b13938436bc42805edba89 | c2b51c9f2787c7e1010499d5a1d257350d585c8c | /src/test/java/com/rockit/common/blackboxtester/suite/structures/TestStepBuilderTest.java | a8f9ba525a235a36b28185f35b28e00b9c286559 | [
"MIT"
] | permissive | josecatela/test.rockitizer | 792ac5237984b73a692ce91b3a7f01fa98209147 | 0f5510cc6e9549c1f61e81823f6d35eaefec2687 | refs/heads/master | 2020-12-30T07:34:48.647957 | 2020-02-04T08:27:11 | 2020-02-04T08:27:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,903 | java | package com.rockit.common.blackboxtester.suite.structures;
import static com.rockit.common.blackboxtester.suite.configuration.SettingsHolder.cacheByConnector;
import static org.junit.Assert.assertTrue;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import com.rockit.common.blackboxtester.connector.settings.MQHeader;
import com.rockit.common.blackboxtester.connector.settings.SettingsBuilder;
import com.rockit.common.blackboxtester.suite.configuration.Constants.Connectors;
public class TestStepBuilderTest {
public static final Logger LOGGER = Logger.getLogger(TestStepBuilderTest.class.getName());
TestStepBuilder testStepBuilder;
@Before
public void setUp() {
testStepBuilder = new TestStepBuilder("TestRockitzerTest", "addMQ001");
testStepBuilder.addSettings("MQPUT.TEST.TRIGGER.01", SettingsBuilder.addMQHeader().
setExpiry(1).
setMsgType(0).
setCodedCharSetId(819).
setMsgFormat("test").
setReplyToQ("test").
setReplyToQMgr("test"));
}
@Test //TODO rewrite according to current enums. No text for constants please
public void testDefaultAddSettings(){
MQHeader defaultSettings = (MQHeader) cacheByConnector(Connectors.MQPUT.toString(), null);
assertTrue(defaultSettings.getType().equals(Connectors.MQPUT.toString()));
assertTrue(defaultSettings.getValues().equals("-1, 8, 1208, , , MQSTR "));
}
@Test
public void testAddSettings(){
MQHeader settings = (MQHeader) cacheByConnector(Connectors.MQPUT.toString(), "TEST.TRIGGER.01");
assertTrue(settings.getType().equals(Connectors.MQPUT.toString()));
assertTrue(settings.getValues(), settings.getValues().equals("1, 0, 819, test, test, test"));
//testStepBuilder.execute();
// testStepBuilder.getConnectorFolders();
//testStepBuilder.relativize("");
}
}
| [
"Alexander.Mueller@wm-its.de"
] | Alexander.Mueller@wm-its.de |
e2389b02408d94e93b7d413222d9c22a47103b98 | 5765c87fd41493dff2fde2a68f9dccc04c1ad2bd | /Variant Programs/1-5/15/store/SpaceChockfulWaiver.java | 81008c5ebc6114701f28da7c64afa70d9eae098f | [
"MIT"
] | permissive | hjc851/Dataset2-HowToDetectAdvancedSourceCodePlagiarism | 42e4c2061c3f8da0dfce760e168bb9715063645f | a42ced1d5a92963207e3565860cac0946312e1b3 | refs/heads/master | 2020-08-09T08:10:08.888384 | 2019-11-25T01:14:23 | 2019-11-25T01:14:23 | 214,041,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 241 | java | package store;
public class SpaceChockfulWaiver extends java.lang.Exception {
static int restrictions = 384978138;
public SpaceChockfulWaiver() {
super();
}
public SpaceChockfulWaiver(String signal) {
super(signal);
}
}
| [
"hayden.cheers@me.com"
] | hayden.cheers@me.com |
7a1a23856a15a75ea27f0f6ec87648f0b86d0f32 | 59a71351c0e4b7082fd8225662644c99e0ccb7fb | /src/main/java/com/example/appointment/service/AppointmentService.java | f6c043661c8d41aadd1a5916f56fa36e965c8dab | [] | no_license | cipherkey/spring-boot-appointment | bf485eb43c6ab1cf4791780437d07336f0ad78d6 | 2fae53cf2563b1bca53a6391249886f7a680729b | refs/heads/master | 2023-03-18T08:29:56.527557 | 2019-01-28T23:27:43 | 2019-01-28T23:27:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 636 | java | package com.example.appointment.service;
import com.example.appointment.model.Appointment;
import java.time.LocalDate;
import java.util.List;
import java.util.Optional;
public interface AppointmentService {
Optional<Appointment> findById(Long appointmentId);
List<Appointment> findAll();
List<Appointment> findByDateRangeSortedByPrice(LocalDate startDate, LocalDate endDate);
Appointment create(Appointment appointment);
Appointment update(Long appointmentId, Appointment appointment);
Appointment updateStatus(Long appointmentId, Appointment appointment);
void deleteById(Long appointmentId);
}
| [
"canirban99@gmail.com"
] | canirban99@gmail.com |
2e635d790fdc43e5c21cae9a5b50134e68eec893 | bde99ff209e3dfd6aebd33ea2d85119a6baeb597 | /FinalProject/app/src/main/java/com/example/votungdh/learnjapanese/gdg/ninja/ui/GameActivity.java | 5f2f3079b762ee90fba7a59ffd5731f4a24d68c5 | [] | no_license | votung246/datn | f0b8d6747d278c2a1f1db6d660df1393058613bc | ae57c98b9c4b15bca16ce39852abbe50c4763eab | refs/heads/master | 2021-06-16T16:58:04.586569 | 2017-05-15T03:06:34 | 2017-05-15T03:06:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,640 | java | package com.example.votungdh.learnjapanese.gdg.ninja.ui;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import com.example.votungdh.learnjapanese.gdg.ninja.R;
import com.example.votungdh.learnjapanese.gdg.ninja.framework.BaseActivity;
import com.example.votungdh.learnjapanese.gdg.ninja.navigate.NavigationBar;
import com.example.votungdh.learnjapanese.gdg.ninja.navigate.NavigationManager;
import com.example.votungdh.learnjapanese.gdg.ninja.util.App;
import com.example.votungdh.learnjapanese.gdg.ninja.util.ShareUtils;
import java.io.File;
import java.io.FileOutputStream;
public class GameActivity extends BaseActivity {
private NavigationBar mNaviBar;
private View screenView;
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.ac_game);
initView();
showListGameFragment();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// FacebookUtil.onActivityResult(this, requestCode, resultCode, data);
}
public NavigationManager getNavigationManager() {
return mNaviManager;
}
public void takeScreenShot(ShareUtils.SHARE_TYPE shareType) {
new TakeScreenShot(shareType).execute();
}
// PrntScr your phone
public class TakeScreenShot extends AsyncTask<Void, Void, Void> {
AlertDialog replaceDialog;
ShareUtils.SHARE_TYPE shareType;
Bitmap b;
public TakeScreenShot(ShareUtils.SHARE_TYPE shareType) {
super();
this.shareType = shareType;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
replaceDialog = dialog;
dialog = new ProgressDialog(GameActivity.this);
dialog.setMessage(App.getContext().getResources()
.getString(R.string.please_wait));
dialog.setCancelable(false);
dialog.show();
b = Bitmap.createBitmap(screenView.getWidth(),
screenView.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(b);
screenView.draw(canvas);
}
@Override
protected Void doInBackground(Void... params) {
File file = new File(ShareUtils.DEFAULT_SCREENSHOT_PATH);
try {
file.createNewFile();
FileOutputStream ostream = new FileOutputStream(file);
b.compress(CompressFormat.PNG, 80, ostream);
ostream.close();
} catch (Exception e) {
e.printStackTrace();
}
if (shareType == ShareUtils.SHARE_TYPE.FACEBOOK)
ShareUtils.postPhotoToFacebook(GameActivity.this, new File(
ShareUtils.DEFAULT_SCREENSHOT_PATH));
else
ShareUtils.postPhotoToGoogle(GameActivity.this, new File(
ShareUtils.DEFAULT_SCREENSHOT_PATH));
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
// Dismiss the progress dialog
if (dialog.isShowing())
dialog.dismiss();
dialog = replaceDialog;
}
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void initView() {
mNaviManager = new NavigationManager(this);
mNaviBar = (NavigationBar) findViewById(R.id.navigation_bar);
mNaviBar.initNaviBar(mNaviManager);
screenView = findViewById(R.id.btn_choose_from_galary);
}
private void showListGameFragment() {
ListGameFragment fragment = new ListGameFragment();
mNaviManager.showPage(fragment, "");
}
} | [
"vtungcntt12t1@gmail.com"
] | vtungcntt12t1@gmail.com |
0c752c7d84bd14589320090cf9fe5915e03c190b | a23b277bd41edbf569437bdfedad22c2d7733dbe | /topcoder/SequenceOfCommands.java | e5c0a964f92f45814aa09a0c392c0a443b57d83c | [] | no_license | alexandrofernando/java | 155ed38df33ae8dae641d327be3c6c355b28082a | a783407eaba29a88123152dd5b2febe10eb7bf1d | refs/heads/master | 2021-01-17T06:49:57.241130 | 2019-07-19T11:34:44 | 2019-07-19T11:34:44 | 52,783,678 | 1 | 0 | null | 2017-07-03T21:46:00 | 2016-02-29T10:38:28 | Java | UTF-8 | Java | false | false | 719 | java | public class SequenceOfCommands {
public String whatHappens(String[] commands) {
int x = 0;
int y = 0;
int direction = 0;
int[] OFFSET_X = { -1, 0, 1, 0 };
int[] OFFSET_Y = { 0, 1, 0, -1 };
for (int i = 0; i < 4; i++) {
for (String commandElement : commands) {
for (int j = 0; j < commandElement.length(); j++) {
char command = commandElement.charAt(j);
if (command == 'S') {
x += OFFSET_X[direction];
y += OFFSET_Y[direction];
} else if (command == 'L') {
direction = (direction + 3) % 4;
} else if (command == 'R') {
direction = (direction + 1) % 4;
}
}
}
if (x == 0 && y == 0) {
return "bounded";
}
}
return "unbounded";
}
}
| [
"alexandrofernando@gmail.com"
] | alexandrofernando@gmail.com |
96c0c18a6c33345566af0e781b9edd74d2cb1368 | 914cd8b59592d49daa5fad665c44b94bc8cc45d6 | /Algo/byte/src/com/lwj/algo/leetcode/editor/cn/VvXgSW .java | 259b783f242067af244dc7b227d69831d13d0d49 | [
"Apache-2.0"
] | permissive | networkcv/Framework | 29699c94c6939bfe0132039f59bf50842a858ce2 | 350b6fb49569d0161fb9b493fc9dfb48cfc0e0db | refs/heads/master | 2023-08-18T04:01:02.252636 | 2023-07-18T05:57:36 | 2023-07-18T05:57:36 | 219,328,092 | 3 | 2 | Apache-2.0 | 2023-08-31T17:23:02 | 2019-11-03T16:11:20 | Java | UTF-8 | Java | false | false | 2,786 | java | //给定一个链表数组,每个链表都已经按升序排列。
//
// 请将所有链表合并到一个升序链表中,返回合并后的链表。
//
//
//
// 示例 1:
//
//
//输入:lists = [[1,4,5],[1,3,4],[2,6]]
//输出:[1,1,2,3,4,4,5,6]
//解释:链表数组如下:
//[
// 1->4->5,
// 1->3->4,
// 2->6
//]
//将它们合并到一个有序链表中得到。
//1->1->2->3->4->4->5->6
//
//
// 示例 2:
//
//
//输入:lists = []
//输出:[]
//
//
// 示例 3:
//
//
//输入:lists = [[]]
//输出:[]
//
//
//
//
// 提示:
//
//
// k == lists.length
// 0 <= k <= 10^4
// 0 <= lists[i].length <= 500
// -10^4 <= lists[i][j] <= 10^4
// lists[i] 按 升序 排列
// lists[i].length 的总和不超过 10^4
//
//
//
//
// 注意:本题与主站 23 题相同: https://leetcode-cn.com/problems/merge-k-sorted-lists/
// Related Topics 链表 分治 堆(优先队列) 归并排序 👍 47 👎 0
package com.lwj.algo.leetcode.editor.cn;
import com.lwj.algo.leetcode.editor.cn.utils.ListNodeUtils;
import java.util.Comparator;
import java.util.PriorityQueue;
class VvXgSW {
public static void main(String[] args) {
Solution solution = new VvXgSW().new Solution();
System.out.println(solution.mergeKLists(new ListNode[0]));
ListNode[] listNodes = new ListNode[3];
listNodes[0] = ListNodeUtils.build(145);
listNodes[1] = ListNodeUtils.build(134);
listNodes[2] = ListNodeUtils.build(26);
System.out.println(solution.mergeKLists(listNodes));
}
//leetcode submit region begin(Prohibit modification and deletion)
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
class Solution {
public ListNode mergeKLists(ListNode[] lists) {
if (lists.length == 0) {
return null;
}
ListNode dummy = new ListNode();
ListNode p = dummy;
PriorityQueue<ListNode> queue = new PriorityQueue<>(lists.length, Comparator.comparingInt(a -> a.val));
for (ListNode cur : lists) {
if (cur != null) {
queue.add(cur);
}
}
while (!queue.isEmpty()) {
ListNode cur = queue.poll();
if (cur.next != null) {
queue.add(cur.next);
}
p.next = cur;
p = p.next;
}
return dummy.next;
}
}
//leetcode submit region end(Prohibit modification and deletion)
} | [
"networkcavalry@gmail.com"
] | networkcavalry@gmail.com |
5a041df5224d005779c30bbd2e10cfa2f0e25c64 | c2da058bfeab91d8816c91013a1901e47b3dea13 | /src/test/QueueTest.java | f49f90a26f1c5d4e559ddd8d96345092968d17f7 | [] | no_license | sevencm/WorkTools | 959f330934069a870f3375511037b7cdc2293ec5 | d391569bc32a0e85aa826f27e521fd422392281b | refs/heads/master | 2021-01-13T01:46:12.220107 | 2015-07-01T03:34:30 | 2015-07-01T03:34:30 | 34,437,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package test;
import java.util.LinkedList;
import java.util.Queue;
import org.junit.Test;
public class QueueTest {
@Test
public void run(){
Queue<String> queue = new LinkedList<String>();
queue.offer("Hello");
queue.offer("World!");
queue.offer("你好!");
queue.add("132456");
System.out.println(queue.size());
String str;
while((str=queue.poll())!=null){
System.out.print(str);
}
System.out.println();
System.out.println(queue.size());
}
}
| [
"liuxiaole_87@163.com"
] | liuxiaole_87@163.com |
2c0852187c089de6c29e9f6a8c643cfac57a6389 | 9373fe952c96922d53468edbd844519b038d2c28 | /Java/Loon-Neo/src/loon/LTextureBatch.java | f29d19984b982a41bac5b8b8929035e7580f47a1 | [
"Apache-2.0"
] | permissive | dc6273632/LGame | 58f2820db7baf76099e565f75ce7edd0eb600b7c | eccae858c2f40f8f5a5da9b9a62613ccb68d66fc | refs/heads/master | 2020-04-29T18:02:40.009966 | 2019-03-18T08:59:43 | 2019-03-18T08:59:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,823 | java | /**
* Copyright 2008 - 2015 The Loon Game Engine 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.
*
* @project loon
* @author cping
* @email:javachenpeng@yahoo.com
* @version 0.5
*/
package loon;
import loon.canvas.LColor;
import loon.geom.Matrix4;
import loon.geom.Vector2f;
import loon.opengl.BlendState;
import loon.opengl.ExpandVertices;
import loon.opengl.GL20;
import loon.opengl.MeshDefault;
import loon.opengl.ShaderProgram;
import loon.opengl.TrilateralBatch;
import loon.opengl.TrilateralBatch.Source;
import loon.utils.GLUtils;
import loon.utils.IntMap;
import loon.utils.MathUtils;
import loon.utils.NumberUtils;
/**
* 这是一个针对单独纹理的批量渲染类,默认绑定在特定Texture上运行(texture.geTexturetBatch即可获得),
* 方便针对特定纹理的缓存以及渲染.
*/
public class LTextureBatch implements LRelease {
private final static String defName = "texbatch";
private String name = defName;
private final Source source;
private boolean isClosed;
public boolean isCacheLocked;
public boolean quad = true;
public static boolean isBatchCacheDitry;
private final static IntMap<LTextureBatch> batchPools = new IntMap<LTextureBatch>(10);
public final static void clearBatchCaches() {
if (batchPools == null || batchPools.size == 0) {
return;
}
if (LTextureBatch.isBatchCacheDitry) {
IntMap<LTextureBatch> batchCaches;
synchronized (batchPools) {
batchCaches = new IntMap<LTextureBatch>(batchPools);
batchPools.clear();
}
for (LTextureBatch bt : batchCaches.values()) {
if (bt != null) {
synchronized (bt) {
bt.close();
bt = null;
}
}
}
batchCaches = null;
LTextureBatch.isBatchCacheDitry = false;
}
}
public final static LTextureBatch bindBatchCache(final LTexture texture) {
return bindBatchCache(0, texture);
}
public final static LTextureBatch bindBatchCache(final int index, final LTexture texture) {
if (texture == null) {
return null;
}
int texId = texture.getID();
return bindBatchCache(index, texId, texture);
}
public final static LTextureBatch bindBatchCache(final Object o, final int texId, final LTexture texture) {
return bindBatchCache(o.hashCode(), texId, texture);
}
public final static LTextureBatch bindBatchCache(final int index, final int texId, final LTexture texture) {
if (batchPools.size > 128) {
clearBatchCaches();
}
int key = LSystem.unite(index, texId);
LTextureBatch pBatch = batchPools.get(key);
if (pBatch == null) {
synchronized (batchPools) {
pBatch = new LTextureBatch(texture);
batchPools.put(key, pBatch);
}
}
return pBatch;
}
public final static LTextureBatch disposeBatchCache(int texId) {
synchronized (batchPools) {
LTextureBatch pBatch = batchPools.remove(texId);
if (pBatch != null) {
synchronized (pBatch) {
pBatch.close();
pBatch = null;
}
}
return pBatch;
}
}
private Cache lastCache;
private LColor[] colors;
public static class Cache implements LRelease {
public float x = 0;
public float y = 0;
float[] vertices;
int vertexIdx;
int count;
public Cache(LTextureBatch batch) {
count = batch.count;
vertexIdx = batch.vertexIdx;
float[] verts = batch.expandVertices.getVertices();
vertices = new float[verts.length];
System.arraycopy(verts, 0, vertices, 0, verts.length);
}
public void close() {
if (vertices != null) {
vertices = null;
}
}
}
int count = 0;
private final ExpandVertices expandVertices;
float invTexWidth = 0, invTexHeight = 0;
boolean drawing = false;
private LTexture lastTexture = null;
private final Matrix4 combinedMatrix = new Matrix4();
private ShaderProgram shader = null;
private ShaderProgram customShader = null;
private ShaderProgram globalShader = null;
private final float whiteColor = LColor.white.toFloatBits();
float color = whiteColor;
private LColor tempColor = new LColor(1, 1, 1, 1);
public int maxSpritesInBatch = 0;
boolean isLoaded;
LTexture texture;
private Matrix4 batchMatrix;
private int vertexIdx;
private int texWidth, texHeight;
private float tx, ty;
public void setLocation(float tx, float ty) {
this.tx = tx;
this.ty = ty;
}
/**
* 使用独立的矩阵渲染纹理(这个函数是专门为Live2d增加的,因为官方API本身的矩阵限制,没法和loon已有的view做混合运算(
* 否则会产生奇怪的效果(因为是2D框架,不需要处理长宽高,所以我默认只用了一个2d矩阵,和live2d的矩阵相乘后会混乱的……)))
*
* @param val
*/
public void setBatchMatrix(float[] val) {
if (batchMatrix == null) {
batchMatrix = new Matrix4(val);
} else {
batchMatrix.set(val);
}
}
public void setBatchMatrix(Matrix4 m) {
if (batchMatrix == null) {
batchMatrix = new Matrix4(m);
} else {
batchMatrix.set(m);
}
}
public void setTexture(LTexture tex2d) {
this.texture = tex2d;
this.texWidth = (int) texture.width();
this.texHeight = (int) texture.height();
if (texture.isCopy()) {
invTexWidth = (1f / texture.width());
invTexHeight = (1f / texture.height());
} else {
invTexWidth = (1f / texture.width()) * texture.widthRatio;
invTexHeight = (1f / texture.height()) * texture.heightRatio;
}
}
public float getInvTexWidth() {
return this.invTexWidth;
}
public float getInvTexHeight() {
return this.invTexHeight;
}
public LTexture toTexture() {
return texture;
}
private MeshDefault mesh;
private BlendState lastBlendState = BlendState.NonPremultiplied;
public LTextureBatch(LTexture tex) {
this(tex, 256, TrilateralBatch.DEF_SOURCE, null);
}
public LTextureBatch(LTexture tex, final Source src) {
this(tex, src, 256);
}
public LTextureBatch(LTexture tex, final Source src, int size) {
this(tex, size, src, null);
}
public LTextureBatch(LTexture tex, final int size, final Source src, final ShaderProgram defaultShader) {
if (size > 5460) {
throw new IllegalArgumentException("Can't have more than 5460 sprites per batch: " + size);
}
this.setTexture(tex);
this.source = src;
this.shader = defaultShader;
this.expandVertices = new ExpandVertices(size);
this.mesh = new MeshDefault();
}
public void glColor4f() {
expandVertices.setVertice(vertexIdx++, color);
}
public void glColor4f(LColor color) {
expandVertices.setVertice(vertexIdx++, color.toFloatBits());
}
public void glColor4f(float r, float g, float b, float a) {
expandVertices.setVertice(vertexIdx++, LColor.toFloatBits(r, g, b, a));
}
public void glTexCoord2f(float u, float v) {
expandVertices.setVertice(vertexIdx++, u);
expandVertices.setVertice(vertexIdx++, v);
}
public void glVertex2f(Vector2f v) {
expandVertices.setVertice(vertexIdx++, v.x);
expandVertices.setVertice(vertexIdx++, v.y);
}
public void glVertex2f(float x, float y) {
expandVertices.setVertice(vertexIdx++, x);
expandVertices.setVertice(vertexIdx++, y);
}
public BlendState getBlendState() {
return lastBlendState;
}
public void setBlendState(BlendState state) {
this.lastBlendState = state;
}
private static boolean runningCache = false;
public final static boolean isRunningCache() {
return runningCache;
}
public void begin() {
if (!isLoaded) {
if (shader == null) {
shader = LSystem.createShader(source.vertexShader(), source.fragmentShader());
}
isLoaded = true;
}
if (drawing) {
throw new IllegalStateException("SpriteBatch.end must be called before begin.");
}
LSystem.mainEndDraw();
if (!isCacheLocked) {
vertexIdx = 0;
lastTexture = null;
}
LSystem.base().graphics().gl.glDepthMask(false);
if (customShader != null) {
customShader.begin();
} else {
shader.begin();
}
setupMatrices(LSystem.base().graphics().getViewMatrix());
drawing = true;
runningCache = true;
}
public void end() {
if (!isLoaded) {
return;
}
if (!drawing) {
throw new IllegalStateException("SpriteBatch.begin must be called before end.");
}
if (vertexIdx > 0) {
if (tx != 0 || ty != 0) {
Matrix4 project = LSystem.base().graphics().getViewMatrix().cpy();
project.translate(tx, ty, 0);
if (drawing) {
setupMatrices(project);
}
}
submit();
}
drawing = false;
LSystem.base().graphics().gl.glDepthMask(true);
if (customShader != null) {
customShader.end();
} else {
shader.end();
}
LSystem.mainBeginDraw();
}
public void setColor(LColor tint) {
color = tint.toFloatBits();
}
public void setColor(float r, float g, float b, float a) {
int intBits = (int) (255 * a) << 24 | (int) (255 * b) << 16 | (int) (255 * g) << 8 | (int) (255 * r);
color = NumberUtils.intToFloatColor(intBits);
}
public void setColor(float color) {
this.color = color;
}
public LColor getColor() {
int intBits = NumberUtils.floatToIntColor(color);
LColor color = tempColor;
color.r = (intBits & 0xff) / 255f;
color.g = ((intBits >>> 8) & 0xff) / 255f;
color.b = ((intBits >>> 16) & 0xff) / 255f;
color.a = ((intBits >>> 24) & 0xff) / 255f;
return color;
}
public float getFloatColor() {
return color;
}
private void checkDrawing() {
if (!drawing) {
throw new IllegalStateException("Not implemented begin !");
}
}
public boolean checkTexture(final LTexture texture) {
if (!isLoaded || isCacheLocked) {
return false;
}
if (isClosed) {
return false;
}
if (texture == null) {
return false;
}
checkDrawing();
if (!texture.isLoaded()) {
texture.loadTexture();
}
LTexture tex2d = LTexture.firstFather(texture);
if (tex2d != null) {
if (tex2d != lastTexture) {
submit();
lastTexture = tex2d;
} else if (vertexIdx == expandVertices.length()) {
submit();
}
invTexWidth = (1f / texWidth) * texture.widthRatio;
invTexHeight = (1f / texHeight) * texture.heightRatio;
} else if (texture != lastTexture) {
submit();
lastTexture = texture;
invTexWidth = (1f / texWidth) * texture.widthRatio;
invTexHeight = (1f / texHeight) * texture.heightRatio;
} else if (vertexIdx == expandVertices.length()) {
submit();
}
return true;
}
public void submit() {
submit(lastBlendState);
}
public void submit(BlendState state) {
if (vertexIdx == 0) {
return;
}
if (!isCacheLocked) {
int spritesInBatch = vertexIdx / 20;
if (spritesInBatch > maxSpritesInBatch) {
maxSpritesInBatch = spritesInBatch;
}
this.count = spritesInBatch * 6;
}
GL20 gl = LSystem.base().graphics().gl;
GLUtils.bindTexture(gl, texture.getID());
int old = GLUtils.getBlendMode();
try {
switch (lastBlendState) {
case Additive:
GLUtils.setBlendMode(gl, LSystem.MODE_ALPHA_ONE);
break;
case AlphaBlend:
GLUtils.setBlendMode(gl, LSystem.MODE_NORMAL);
break;
case Opaque:
GLUtils.setBlendMode(gl, LSystem.MODE_NONE);
break;
case NonPremultiplied:
GLUtils.setBlendMode(gl, LSystem.MODE_SPEED);
break;
case Null:
break;
}
mesh.post(name, expandVertices.getSize(), customShader != null ? customShader : shader,
expandVertices.getVertices(), vertexIdx, count);
} catch (Exception e) {
throw LSystem.runThrow(e.getMessage(), e);
} finally {
if (expandVertices.expand(this.vertexIdx)) {
mesh.reset(name, expandVertices.length());
}
GLUtils.setBlendMode(gl, old);
}
}
public void setTextureBatchName(String n) {
this.name = n;
}
public String getTextureBatchName() {
return this.name;
}
private void setupMatrices(Matrix4 view) {
if (batchMatrix != null) {
combinedMatrix.set(batchMatrix);
} else {
combinedMatrix.set(view);
}
if (customShader != null) {
customShader.setUniformMatrix("u_projTrans", combinedMatrix);
customShader.setUniformi("u_texture", 0);
} else {
shader.setUniformMatrix("u_projTrans", combinedMatrix);
shader.setUniformi("u_texture", 0);
}
}
protected void switchTexture(LTexture texture) {
submit();
lastTexture = texture;
invTexWidth = 1.0f / texWidth;
invTexHeight = 1.0f / texHeight;
}
protected void setShader(Matrix4 view, ShaderProgram shader) {
if (drawing) {
submit();
if (customShader != null) {
customShader.end();
} else {
this.shader.end();
}
}
customShader = shader;
if (drawing) {
if (customShader != null) {
customShader.begin();
} else {
this.shader.begin();
}
setupMatrices(view);
}
}
public boolean isDrawing() {
return drawing;
}
public void lock() {
this.isCacheLocked = true;
}
public void unLock() {
this.isCacheLocked = false;
}
private void commit(Matrix4 view, Cache cache, LColor color, BlendState state) {
if (!isLoaded) {
return;
}
if (drawing) {
end();
}
LSystem.mainEndDraw();
if (color == null) {
if (shader == null) {
shader = LSystem.createShader(source.vertexShader(), source.fragmentShader());
}
globalShader = shader;
} else if (globalShader == null) {
globalShader = LSystem.createShader(LSystem.getGLExVertexShader(), LSystem.getColorFragmentShader());
}
globalShader.begin();
float oldColor = getFloatColor();
if (color != null) {
globalShader.setUniformf("v_color", color.r, color.g, color.b, color.a);
}
if (batchMatrix != null) {
combinedMatrix.set(batchMatrix);
} else {
combinedMatrix.set(view);
}
if (globalShader != null) {
globalShader.setUniformMatrix("u_projTrans", combinedMatrix);
globalShader.setUniformi("u_texture", 0);
}
if (cache.vertexIdx > 0) {
GL20 gl = LSystem.base().graphics().gl;
GLUtils.bindTexture(gl, texture.getID());
int old = GLUtils.getBlendMode();
switch (lastBlendState) {
case Additive:
GLUtils.setBlendMode(gl, LSystem.MODE_ALPHA_ONE);
break;
case AlphaBlend:
GLUtils.setBlendMode(gl, LSystem.MODE_NORMAL);
break;
case Opaque:
GLUtils.setBlendMode(gl, LSystem.MODE_NONE);
break;
case NonPremultiplied:
GLUtils.setBlendMode(gl, LSystem.MODE_SPEED);
break;
case Null:
break;
}
mesh.post(name, expandVertices.getSize(), globalShader, cache.vertices, cache.vertexIdx, cache.count);
GLUtils.setBlendMode(gl, old);
} else if (color != null) {
globalShader.setUniformf("v_color", oldColor);
}
globalShader.end();
LSystem.mainBeginDraw();
runningCache = true;
}
public void setIndices(short[] indices) {
mesh.getMesh(name, expandVertices.getSize()).setIndices(indices);
}
public void resetIndices() {
mesh.resetIndices(name, expandVertices.getSize());
}
public void setGLType(int type) {
mesh.setGLType(type);
}
public void postLastCache() {
if (lastCache != null) {
commit(LSystem.base().graphics().getViewMatrix(), lastCache, null, lastBlendState);
}
}
public Cache getLastCache() {
return lastCache;
}
public boolean existCache() {
return lastCache != null;
}
public Cache newCache() {
if (isLoaded) {
return (lastCache = new Cache(this));
} else {
return null;
}
}
public void disposeLastCache() {
if (lastCache != null) {
lastCache.close();
lastCache = null;
}
}
private float xOff, yOff, widthRatio, heightRatio;
private float drawWidth, drawHeight;
private float textureSrcX, textureSrcY;
private float srcWidth, srcHeight;
private float renderWidth, renderHeight;
public void draw(float x, float y) {
draw(colors, x, y, texture.width(), texture.height(), 0, 0, texture.width(), texture.height());
}
public void draw(float x, float y, float width, float height) {
draw(colors, x, y, width, height, 0, 0, texture.width(), texture.height());
}
public void draw(float x, float y, float width, float height, float srcX, float srcY, float srcWidth,
float srcHeight) {
draw(colors, x, y, width, height, srcX, srcY, srcWidth, srcHeight);
}
public void draw(LColor[] colors, float x, float y, float width, float height) {
draw(colors, x, y, width, height, 0, 0, texture.width(), texture.height());
}
/**
* 以指定的色彩,顶点绘制出指定区域内的纹理到指定位置
*
* @param colors
* @param x
* @param y
* @param width
* @param height
* @param srcX
* @param srcY
* @param srcWidth
* @param srcHeight
*/
public void draw(LColor[] colors, float x, float y, float width, float height, float srcX, float srcY,
float srcWidth, float srcHeight) {
if (!checkTexture(texture)) {
return;
}
xOff = srcX * invTexWidth + texture.xOff;
yOff = srcY * invTexHeight + texture.yOff;
widthRatio = srcWidth * invTexWidth;
heightRatio = srcHeight * invTexHeight;
final float fx2 = x + width;
final float fy2 = y + height;
if (colors == null) {
glVertex2f(x, y);
glColor4f();
glTexCoord2f(xOff, yOff);
glVertex2f(x, fy2);
glColor4f();
glTexCoord2f(xOff, heightRatio);
glVertex2f(fx2, fy2);
glColor4f();
glTexCoord2f(widthRatio, heightRatio);
glVertex2f(fx2, y);
glColor4f();
glTexCoord2f(widthRatio, yOff);
} else {
glVertex2f(x, y);
glColor4f(colors[LTexture.TOP_LEFT]);
glTexCoord2f(xOff, yOff);
glVertex2f(x, fy2);
glColor4f(colors[LTexture.BOTTOM_LEFT]);
glTexCoord2f(xOff, heightRatio);
glVertex2f(fx2, fy2);
glColor4f(colors[LTexture.BOTTOM_RIGHT]);
glTexCoord2f(widthRatio, heightRatio);
glVertex2f(fx2, y);
glColor4f(colors[LTexture.TOP_RIGHT]);
glTexCoord2f(widthRatio, yOff);
}
}
public void drawQuad(float drawX, float drawY, float drawX2, float drawY2, float srcX, float srcY, float srcX2,
float srcY2) {
if (!checkTexture(texture)) {
return;
}
drawWidth = drawX2 - drawX;
drawHeight = drawY2 - drawY;
textureSrcX = ((srcX / texWidth) * texture.widthRatio) + texture.xOff;
textureSrcY = ((srcY / texHeight) * texture.heightRatio) + texture.yOff;
srcWidth = srcX2 - srcX;
srcHeight = srcY2 - srcY;
renderWidth = ((srcWidth / texWidth) * texture.widthRatio);
renderHeight = ((srcHeight / texHeight) * texture.heightRatio);
glVertex2f(drawX, drawY);
glColor4f();
glTexCoord2f(textureSrcX, textureSrcY);
glVertex2f(drawX, drawY + drawHeight);
glColor4f();
glTexCoord2f(textureSrcX, textureSrcY + renderHeight);
glVertex2f(drawX + drawWidth, drawY + drawHeight);
glColor4f();
glTexCoord2f(textureSrcX + renderWidth, textureSrcY + renderHeight);
glVertex2f(drawX + drawWidth, drawY);
glColor4f();
glTexCoord2f(textureSrcX + renderWidth, textureSrcY);
}
public void draw(LColor[] colors, float x, float y, float rotation) {
draw(colors, x, y, texture.width() / 2, texture.height() / 2, texture.width(), texture.height(), 1f, 1f,
rotation, 0, 0, texture.width(), texture.height(), false, false);
}
public void draw(LColor[] colors, float x, float y, float width, float height, float rotation) {
draw(colors, x, y, texture.width() / 2, texture.height() / 2, width, height, 1f, 1f, rotation, 0, 0,
texture.width(), texture.height(), false, false);
}
public void draw(LColor[] colors, float x, float y, float srcX, float srcY, float srcWidth, float srcHeight,
float rotation) {
draw(colors, x, y, texture.width() / 2, texture.height() / 2, texture.width(), texture.height(), 1f, 1f,
rotation, srcX, srcY, srcWidth, srcHeight, false, false);
}
public void draw(LColor[] colors, float x, float y, float width, float height, float srcX, float srcY,
float srcWidth, float srcHeight, float rotation) {
draw(colors, x, y, width / 2, height / 2, width, height, 1f, 1f, rotation, srcX, srcY, srcWidth, srcHeight,
false, false);
}
public void draw(float x, float y, float originX, float originY, float width, float height, float scaleX,
float scaleY, float rotation, float srcX, float srcY, float srcWidth, float srcHeight, boolean flipX,
boolean flipY) {
draw(colors, x, y, originX, originY, width, height, scaleX, scaleY, rotation, srcX, srcY, srcWidth, srcHeight,
flipX, flipY);
}
public void draw(LColor[] colors, float x, float y, float originX, float originY, float width, float height,
float scaleX, float scaleY, float rotation, float srcX, float srcY, float srcWidth, float srcHeight,
boolean flipX, boolean flipY) {
if (!checkTexture(texture)) {
return;
}
final float worldOriginX = x + originX;
final float worldOriginY = y + originY;
float fx = -originX;
float fy = -originY;
float fx2 = width - originX;
float fy2 = height - originY;
if (scaleX != 1 || scaleY != 1) {
fx *= scaleX;
fy *= scaleY;
fx2 *= scaleX;
fy2 *= scaleY;
}
final float p1x = fx;
final float p1y = fy;
final float p2x = fx;
final float p2y = fy2;
final float p3x = fx2;
final float p3y = fy2;
final float p4x = fx2;
final float p4y = fy;
float x1;
float y1;
float x2;
float y2;
float x3;
float y3;
float x4;
float y4;
if (rotation != 0) {
final float cos = MathUtils.cosDeg(rotation);
final float sin = MathUtils.sinDeg(rotation);
x1 = cos * p1x - sin * p1y;
y1 = sin * p1x + cos * p1y;
x2 = cos * p2x - sin * p2y;
y2 = sin * p2x + cos * p2y;
x3 = cos * p3x - sin * p3y;
y3 = sin * p3x + cos * p3y;
x4 = x1 + (x3 - x2);
y4 = y3 - (y2 - y1);
} else {
x1 = p1x;
y1 = p1y;
x2 = p2x;
y2 = p2y;
x3 = p3x;
y3 = p3y;
x4 = p4x;
y4 = p4y;
}
x1 += worldOriginX;
y1 += worldOriginY;
x2 += worldOriginX;
y2 += worldOriginY;
x3 += worldOriginX;
y3 += worldOriginY;
x4 += worldOriginX;
y4 += worldOriginY;
xOff = srcX * invTexWidth + texture.xOff;
yOff = srcY * invTexHeight + texture.yOff;
widthRatio = srcWidth * invTexWidth;
heightRatio = srcHeight * invTexHeight;
if (flipX) {
float tmp = xOff;
xOff = widthRatio;
widthRatio = tmp;
}
if (flipY) {
float tmp = yOff;
yOff = heightRatio;
heightRatio = tmp;
}
if (colors == null) {
glVertex2f(x1, y1);
glColor4f();
glTexCoord2f(xOff, yOff);
glVertex2f(x2, y2);
glColor4f();
glTexCoord2f(xOff, heightRatio);
glVertex2f(x3, y3);
glColor4f();
glTexCoord2f(widthRatio, heightRatio);
glVertex2f(x4, y4);
glColor4f();
glTexCoord2f(widthRatio, yOff);
} else {
glVertex2f(x1, y1);
glColor4f(colors[LTexture.TOP_LEFT]);
glTexCoord2f(xOff, yOff);
glVertex2f(x2, y2);
glColor4f(colors[LTexture.BOTTOM_LEFT]);
glTexCoord2f(xOff, heightRatio);
glVertex2f(x3, y3);
glColor4f(colors[LTexture.BOTTOM_RIGHT]);
glTexCoord2f(widthRatio, heightRatio);
glVertex2f(x4, y4);
glColor4f(colors[LTexture.TOP_RIGHT]);
glTexCoord2f(widthRatio, yOff);
}
}
public void draw(LColor[] colors, float x, float y, float width, float height, float srcX, float srcY,
float srcWidth, float srcHeight, boolean flipX, boolean flipY) {
if (!checkTexture(texture)) {
return;
}
xOff = srcX * invTexWidth + texture.xOff;
yOff = srcY * invTexHeight + texture.yOff;
widthRatio = srcWidth * invTexWidth;
heightRatio = srcHeight * invTexHeight;
final float fx2 = x + width;
final float fy2 = y + height;
if (flipX) {
float tmp = xOff;
xOff = widthRatio;
widthRatio = tmp;
}
if (flipY) {
float tmp = yOff;
yOff = heightRatio;
heightRatio = tmp;
}
if (colors == null) {
glVertex2f(x, y);
glColor4f();
glTexCoord2f(xOff, yOff);
glVertex2f(x, fy2);
glColor4f();
glTexCoord2f(xOff, heightRatio);
glVertex2f(fx2, fy2);
glColor4f();
glTexCoord2f(widthRatio, heightRatio);
glVertex2f(fx2, y);
glColor4f();
glTexCoord2f(widthRatio, yOff);
} else {
glVertex2f(x, y);
glColor4f(colors[LTexture.TOP_LEFT]);
glTexCoord2f(xOff, yOff);
glVertex2f(x, fy2);
glColor4f(colors[LTexture.BOTTOM_LEFT]);
glTexCoord2f(xOff, heightRatio);
glVertex2f(fx2, fy2);
glColor4f(colors[LTexture.BOTTOM_RIGHT]);
glTexCoord2f(widthRatio, heightRatio);
glVertex2f(fx2, y);
glColor4f(colors[LTexture.TOP_RIGHT]);
glTexCoord2f(widthRatio, yOff);
}
}
public void setImageColor(float r, float g, float b, float a) {
setColor(LTexture.TOP_LEFT, r, g, b, a);
setColor(LTexture.TOP_RIGHT, r, g, b, a);
setColor(LTexture.BOTTOM_LEFT, r, g, b, a);
setColor(LTexture.BOTTOM_RIGHT, r, g, b, a);
}
public void setImageColor(float r, float g, float b) {
setColor(LTexture.TOP_LEFT, r, g, b);
setColor(LTexture.TOP_RIGHT, r, g, b);
setColor(LTexture.BOTTOM_LEFT, r, g, b);
setColor(LTexture.BOTTOM_RIGHT, r, g, b);
}
public void setImageColor(LColor c) {
if (c == null) {
return;
}
setImageColor(c.r, c.g, c.b, c.a);
}
public void draw(short[] indexArray, float[] vertexArray, float[] uvArray, float x, float y, float sx, float sy,
LColor color) {
int length = vertexArray.length;
if (indexArray.length < 1024) {
short[] indices = new short[1024];
for (int i = 0; i < indexArray.length; i++) {
indices[i] = indexArray[i];
}
for (int i = 0; i < indexArray.length; i++) {
indices[i + indexArray.length] = indexArray[i];
}
setIndices(indices);
} else if (indexArray.length < 2048) {
short[] indices = new short[2048];
for (int i = 0; i < indexArray.length; i++) {
indices[i] = indexArray[i];
}
for (int i = 0; i < indexArray.length; i++) {
indices[i + indexArray.length] = indexArray[i];
}
setIndices(indices);
} else if (indexArray.length < 4096) {
short[] indices = new short[4096];
for (int i = 0; i < indexArray.length; i++) {
indices[i] = indexArray[i];
}
for (int i = 0; i < indexArray.length; i++) {
indices[i + indexArray.length] = indexArray[i];
}
setIndices(indices);
}
for (int q = 0; q < 4; q++) {
for (int idx = 0; idx < length; idx += 2) {
glVertex2f(vertexArray[idx] * sx + x, vertexArray[idx + 1] * sy + y);
glColor4f(color.r, color.g, color.b, color.a);
glTexCoord2f(uvArray[idx], uvArray[idx + 1]);
}
}
}
public void setColor(int corner, float r, float g, float b, float a) {
if (colors == null) {
colors = new LColor[] { new LColor(1f, 1f, 1f, 1f), new LColor(1f, 1f, 1f, 1f), new LColor(1f, 1f, 1f, 1f),
new LColor(1f, 1f, 1f, 1f) };
}
colors[corner].r = r;
colors[corner].g = g;
colors[corner].b = b;
colors[corner].a = a;
}
public void setColor(int corner, float r, float g, float b) {
if (colors == null) {
colors = new LColor[] { new LColor(1f, 1f, 1f, 1f), new LColor(1f, 1f, 1f, 1f), new LColor(1f, 1f, 1f, 1f),
new LColor(1f, 1f, 1f, 1f) };
}
colors[corner].r = r;
colors[corner].g = g;
colors[corner].b = b;
}
public void draw(float x, float y, LColor[] c) {
draw(c, x, y, texture.width(), texture.height());
}
public void draw(float x, float y, LColor c) {
final boolean update = checkUpdateColor(c);
if (update) {
setImageColor(c);
}
draw(colors, x, y, texture.width(), texture.height());
if (update) {
setImageColor(LColor.white);
}
}
public void draw(float x, float y, float width, float height, LColor c) {
final boolean update = checkUpdateColor(c);
if (update) {
setImageColor(c);
}
draw(colors, x, y, width, height);
if (update) {
setImageColor(LColor.white);
}
}
public void draw(float x, float y, float width, float height, float x1, float y1, float x2, float y2, LColor[] c) {
draw(c, x, y, width, height, x1, y1, x2, y2);
}
public void draw(float x, float y, float width, float height, float x1, float y1, float x2, float y2, LColor c) {
final boolean update = checkUpdateColor(c);
if (update) {
setImageColor(c);
}
draw(colors, x, y, width, height, x1, y1, x2, y2);
if (update) {
setImageColor(LColor.white);
}
}
public void draw(float x, float y, float w, float h, float rotation, LColor c) {
final boolean update = checkUpdateColor(c);
if (update) {
setImageColor(c);
}
draw(colors, x, y, w, h, rotation);
if (update) {
setImageColor(LColor.white);
}
}
private boolean checkUpdateColor(LColor c) {
return c != null && !LColor.white.equals(c);
}
public void commit(float x, float y, float sx, float sy, float ax, float ay, float rotaion) {
if (isClosed) {
return;
}
Matrix4 project = LSystem.base().graphics().getViewMatrix();
boolean update = (x != 0 || y != 0 || rotaion != 0 || sx != 1f || sy != 1f);
if (update) {
project = project.cpy();
}
if (x != 0 || y != 0) {
project.translate(x, y, 0);
}
if (sx != 1f || sy != 1f) {
project.scale(sx, sy, 0);
}
if (rotaion != 0) {
if (ax != 0 || ay != 0) {
project.translate(ax, ay, 0.0f);
project.rotate(0f, 0f, 1f, rotaion);
project.translate(-ax, -ay, 0.0f);
} else {
project.translate(texture.width() / 2, texture.height() / 2, 0.0f);
project.rotate(0f, 0f, 0f, rotaion);
project.translate(-texture.width() / 2, -texture.height() / 2, 0.0f);
}
}
if (drawing) {
setupMatrices(project);
}
end();
runningCache = true;
}
public void postCache(Cache cache, LColor color, float x, float y) {
if (isClosed) {
return;
}
x += cache.x;
y += cache.y;
Matrix4 project = LSystem.base().graphics().getViewMatrix();
if (x != 0 || y != 0) {
project = project.cpy();
project.translate(x, y, 0);
}
commit(project, cache, color, lastBlendState);
}
public void postCache(Cache cache, LColor color, float x, float y, float sx, float sy, float ax, float ay,
float rotaion) {
if (isClosed) {
return;
}
x += cache.x;
y += cache.y;
Matrix4 project = LSystem.base().graphics().getViewMatrix();
boolean update = (x != 0 || y != 0 || rotaion != 0 || sx != 1f || sy != 1f);
if (update) {
project = project.cpy();
}
if (x != 0 || y != 0) {
project.translate(x, y, 0);
}
if (sx != 1f || sy != 1f) {
project.scale(sx, sy, 0);
}
if (rotaion != 0) {
if (ax != 0 || ay != 0) {
project.translate(ax, ay, 0.0f);
project.rotate(0f, 0f, 1f, rotaion);
project.translate(-ax, -ay, 0.0f);
} else {
project.translate(texture.width() / 2, texture.height() / 2, 0.0f);
project.rotate(0f, 0f, 0f, rotaion);
project.translate(-texture.width() / 2, -texture.height() / 2, 0.0f);
}
}
commit(project, cache, color, lastBlendState);
}
public void postCache(Cache cache, LColor color, float rotaion) {
if (isClosed) {
return;
}
float x = cache.x;
float y = cache.y;
Matrix4 project = LSystem.base().graphics().getViewMatrix();
if (rotaion != 0) {
project = project.cpy();
project.translate((texture.width() / 2) + x, (y + texture.height() / 2) + y, 0.0f);
project.rotate(0f, 0f, 1f, rotaion);
project.translate((-texture.width() / 2) + y, (-texture.height() / 2) + y, 0.0f);
}
commit(project, cache, color, lastBlendState);
}
public void postCache(LColor color, float rotaion) {
if (lastCache != null) {
postCache(lastCache, color, rotaion);
}
}
@Override
public void close() {
isClosed = true;
isLoaded = false;
if (shader != null) {
shader.close();
}
if (globalShader != null) {
globalShader.close();
}
if (customShader != null) {
customShader.close();
}
if (lastCache != null) {
lastCache.close();
}
if (!defName.equals(name)) {
mesh.dispose(name, expandVertices.getSize());
}
runningCache = false;
}
public void destroy() {
if (texture != null) {
texture.close(true);
}
}
}
| [
"longwind2012@hotmail.com"
] | longwind2012@hotmail.com |
bdf8ff94c03ab645d7f177e170d123ca1efe91f3 | 6f3d1792803da7f3f3af5291fd4498f69d1ecae1 | /src/main/java/com/cursojunit/orderapi/entities/public_/tables/records/PaymentmethodRecord.java | 8b0776d1ae4dcbd104cebb6a2d880f490f984570 | [] | no_license | VGrechi/cursojunit-order-api | bd093e5525ae57d68be037a30857d4f6f6f4265d | 732fa9dabffc5a6c01cd59f3a66a19033a76ca25 | refs/heads/master | 2021-06-19T19:38:56.954411 | 2019-09-13T19:32:40 | 2019-09-13T19:32:40 | 206,529,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 5,371 | java | /*
* This file is generated by jOOQ.
*/
package com.cursojunit.orderapi.entities.public_.tables.records;
import com.cursojunit.orderapi.entities.public_.tables.Paymentmethod;
import java.math.BigDecimal;
import javax.annotation.Generated;
import org.jooq.Field;
import org.jooq.Record4;
import org.jooq.Row4;
import org.jooq.impl.TableRecordImpl;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.9.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class PaymentmethodRecord extends TableRecordImpl<PaymentmethodRecord> implements Record4<Integer, Integer, String, BigDecimal> {
private static final long serialVersionUID = -233614498;
/**
* Setter for <code>PUBLIC.PAYMENTMETHOD.PAYMENTMETHODID</code>.
*/
public void setPaymentmethodid(Integer value) {
set(0, value);
}
/**
* Getter for <code>PUBLIC.PAYMENTMETHOD.PAYMENTMETHODID</code>.
*/
public Integer getPaymentmethodid() {
return (Integer) get(0);
}
/**
* Setter for <code>PUBLIC.PAYMENTMETHOD.EVENTID</code>.
*/
public void setEventid(Integer value) {
set(1, value);
}
/**
* Getter for <code>PUBLIC.PAYMENTMETHOD.EVENTID</code>.
*/
public Integer getEventid() {
return (Integer) get(1);
}
/**
* Setter for <code>PUBLIC.PAYMENTMETHOD.PAYMENTMETHOD</code>.
*/
public void setPaymentmethod(String value) {
set(2, value);
}
/**
* Getter for <code>PUBLIC.PAYMENTMETHOD.PAYMENTMETHOD</code>.
*/
public String getPaymentmethod() {
return (String) get(2);
}
/**
* Setter for <code>PUBLIC.PAYMENTMETHOD.PAYMENTAMOUNT</code>.
*/
public void setPaymentamount(BigDecimal value) {
set(3, value);
}
/**
* Getter for <code>PUBLIC.PAYMENTMETHOD.PAYMENTAMOUNT</code>.
*/
public BigDecimal getPaymentamount() {
return (BigDecimal) get(3);
}
// -------------------------------------------------------------------------
// Record4 type implementation
// -------------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public Row4<Integer, Integer, String, BigDecimal> fieldsRow() {
return (Row4) super.fieldsRow();
}
/**
* {@inheritDoc}
*/
@Override
public Row4<Integer, Integer, String, BigDecimal> valuesRow() {
return (Row4) super.valuesRow();
}
/**
* {@inheritDoc}
*/
@Override
public Field<Integer> field1() {
return Paymentmethod.PAYMENTMETHOD.PAYMENTMETHODID;
}
/**
* {@inheritDoc}
*/
@Override
public Field<Integer> field2() {
return Paymentmethod.PAYMENTMETHOD.EVENTID;
}
/**
* {@inheritDoc}
*/
@Override
public Field<String> field3() {
return Paymentmethod.PAYMENTMETHOD.PAYMENTMETHOD_;
}
/**
* {@inheritDoc}
*/
@Override
public Field<BigDecimal> field4() {
return Paymentmethod.PAYMENTMETHOD.PAYMENTAMOUNT;
}
/**
* {@inheritDoc}
*/
@Override
public Integer value1() {
return getPaymentmethodid();
}
/**
* {@inheritDoc}
*/
@Override
public Integer value2() {
return getEventid();
}
/**
* {@inheritDoc}
*/
@Override
public String value3() {
return getPaymentmethod();
}
/**
* {@inheritDoc}
*/
@Override
public BigDecimal value4() {
return getPaymentamount();
}
/**
* {@inheritDoc}
*/
@Override
public PaymentmethodRecord value1(Integer value) {
setPaymentmethodid(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public PaymentmethodRecord value2(Integer value) {
setEventid(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public PaymentmethodRecord value3(String value) {
setPaymentmethod(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public PaymentmethodRecord value4(BigDecimal value) {
setPaymentamount(value);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public PaymentmethodRecord values(Integer value1, Integer value2, String value3, BigDecimal value4) {
value1(value1);
value2(value2);
value3(value3);
value4(value4);
return this;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached PaymentmethodRecord
*/
public PaymentmethodRecord() {
super(Paymentmethod.PAYMENTMETHOD);
}
/**
* Create a detached, initialised PaymentmethodRecord
*/
public PaymentmethodRecord(Integer paymentmethodid, Integer eventid, String paymentmethod, BigDecimal paymentamount) {
super(Paymentmethod.PAYMENTMETHOD);
set(0, paymentmethodid);
set(1, eventid);
set(2, paymentmethod);
set(3, paymentamount);
}
}
| [
"victor.grechi@vistajet.com"
] | victor.grechi@vistajet.com |
66bc7803bb2937673fbd25a97f3ad09e26cda961 | 3aea2255c2d777f3a91c30f8f0ddfa846b9bb47b | /src/core/lecture3_05_IO_Stream/practice/task_5_06/Group.java | 084af5008839e99316ce09b5b8abba95cddf6dfb | [] | no_license | javaquasar/JavaSE | 91b00d92d06fae52ff9420420235e6e4d1a08aa5 | 6333c6cea44d7417ad23941f515ef7c438be02fc | refs/heads/master | 2021-06-01T10:45:46.584321 | 2021-03-02T22:50:41 | 2021-03-02T22:50:41 | 91,481,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package core.lecture3_05_IO_Stream.practice.task_5_06;
import java.io.Serializable;
public class Group implements Serializable {
private static final long serialVersionUID = 4433147861334322335L;
private String name;
private Student[] students;
public Group(String name, Student... students) {
this.name = name;
this.students = students;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Student[] getStudents() {
return students;
}
public void setStudents(Student[] students) {
this.students = students;
}
}
| [
"buzov.artur@gmail.com"
] | buzov.artur@gmail.com |
081baf520edbbb5e315c0572938832f9d64e1e69 | f63d97fd3e4648f8e953acc930839d631638300f | /Chord.java | 48da07127183696e4b12678f4d1f950abc37eacf | [] | no_license | deepak15493/chord-simulation | d134c6d91a0d41e1e124ed3602dcd10dff548234 | 36f0f4e8eabd468938476e3426149b4216b30a85 | refs/heads/master | 2020-04-06T20:51:52.532649 | 2018-11-22T04:47:46 | 2018-11-22T04:47:46 | 157,785,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,578 | java | import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
public class Chord {
public static final long RING_MAX_SIZE = 4294967296L;
public static final int RING = 32;
public static int m=0;
public static ArrayList<ChordNode> chordNodes = new ArrayList<>();
public static ArrayList<Integer> nodeList = new ArrayList<>();
public static void main(String[] args) {
Scanner src = new Scanner(System.in);
//******************************* Batch ***************************
if(args.length==3)
{
String i = args[0];
if(i.charAt(0)!='-' || i.charAt(1)!='i')
{
System.out.println("Error : batch mode requires -i as argument, passed different argument... Exiting program");
System.exit(1);
}
File fileName = new File(args[1]);
Chord chord = new Chord();
Scanner sfile = null;
try {
sfile = new Scanner(fileName);
}catch (FileNotFoundException fne)
{
System.out.println("File Not Found Exception Occurred");
fne.printStackTrace();
}
try{
m = Integer.parseInt(args[2]);
if(m<=0 || m>31)
{
System.out.println("Error: invalid integer m= " + m);
System.exit(1);
}
}
catch (Exception e)
{
System.out.println("Error: invalid integer" + args[2]);
}
while (sfile.hasNextLine())
{
String line = sfile.nextLine();
String[] str = line.split(" ");
try{
if(line.equalsIgnoreCase("end")){
if(str.length>1)
{
System.out.println("SYNTAX ERROR: end expects no parameters");
continue;
}
sfile.close();
//System.exit(0);
chord.end();
} // end command
if (str.length>1){
if (Integer.parseInt(str[1]) >= Math.pow(2, m) || Integer.parseInt(str[1])<0) {
System.out.println("ERROR: node id must be in [0," + (int) (Math.pow(2, m)) + ")");
continue;
}
} // for add, show check
if (str.length > 2) {
if (Integer.parseInt(str[2]) >= Math.pow(2, m) || Integer.parseInt(str[2])<0) {
System.out.println("ERROR: node id must be in [0," + (Math.pow(2, m)) + ")");
continue;
}
} // for join check
if(str[0].equalsIgnoreCase("drop")){
if(str.length>2)
{
System.out.println("SYNTAX ERROR: drop expects 1 parameter not " + str.length);
continue;
}
int nNode = Integer.parseInt(str[1]);
chord.drop(nNode);
//chordNodes.remove(chord.getNodeFromList(nNode));
} // end drop
else if(str[0].equalsIgnoreCase("add")){
if(str.length > 2)
{
System.out.println("SYNTAX ERROR: add expects 1 parameter not " + str.length);
continue;
}
int nNode = Integer.parseInt(str[1]);
chord.add(nNode);
}//end add
else if(str[0].equalsIgnoreCase("join")){
if (str.length > 3) {
System.out.println("SYNTAX ERROR: join expects 2 parameters not " + str.length);
continue;
}
int nNode1 = Integer.parseInt(str[1]);
int nNode2 = Integer.parseInt(str[2]);
chord.join(nNode1,nNode2);
}// end join
else if(str[0].equalsIgnoreCase("stab")){
if (str.length > 2) {
System.out.println("SYNTAX ERROR: stab expects 1 parameter not " + str.length);
continue;
}
int nNode = Integer.parseInt(str[1]);
chord.stabilize(nNode);
} // end stabilize
else if(str[0].equalsIgnoreCase("fix")){
if (str.length > 2) {
System.out.println("SYNTAX ERROR: fix expects 1 parameter not " + str.length);
continue;
}
int nNode = Integer.parseInt(str[1]);
chord.fix_finger(nNode);
} // end fix
else if(str[0].equalsIgnoreCase("show")){
if (str.length > 2) {
System.out.println("SYNTAX ERROR: show expects 1 parameter not " + str.length);
continue;
}
int nNode = Integer.parseInt(str[1]);
chord.show(nNode);
} // end show
else if(str[0].equalsIgnoreCase("list")){
if (str.length > 1) {
System.out.println("SYNTAX ERROR: list expects no parameter ");
continue;
}
chord.list();
}//end list
else{
System.out.println("Invalid Input");
}
}catch (NumberFormatException nfe)
{
System.out.println("ERROR: invalid integer");//nfe.printStackTrace();
}
catch (Exception e)
{
System.out.println("Something went wrong");
e.printStackTrace();
}
}//end of while
} // batch mode ends
//*********************************** Interactive ******************************
else if(args.length ==1)
{
try{
m = Integer.parseInt(args[0]);
if(m<=0 || m>31)
{
System.out.println("Error: invalid integer " + m);
System.exit(1);
}
}
catch (Exception e)
{
System.out.println("Error: invalid integer m= " + args[1]);
}
Chord chord = new Chord();
while (true)
{
String inputLine = src.nextLine();
String[] strArray = inputLine.split(" ");
try{
if(strArray[0].equalsIgnoreCase("end")){
if(strArray.length>1)
{
System.out.println("SYNTAX ERROR: end expects no parameters");
continue;
}
//sfile.close();
//System.exit(0);
chord.end();
} // end command
if (strArray.length>1){
if (Integer.parseInt(strArray[1]) >= Math.pow(2, m) || Integer.parseInt(strArray[1])<0) {
System.out.println("ERROR: node id must be in [0," + (int) Math.pow(2, m) + ")");
continue;
}
} // for value check
if (strArray.length > 2) {
if (Integer.parseInt(strArray[2]) >= Math.pow(2, m) || Integer.parseInt(strArray[2])<0) {
System.out.println("ERROR: node id must be in [0," + (int) (Math.pow(2, m)) + ")");
continue;
}
} // for value check
if(strArray[0].equalsIgnoreCase("drop")){
if(strArray.length>2)
{
System.out.println("SYNTAX ERROR: drop expects 1 parameter not " + strArray.length);
continue;
}
int nNode = Integer.parseInt(strArray[1]);
chord.drop(nNode);
} // end drop
else if(strArray[0].equalsIgnoreCase("add")){
if(strArray.length > 2)
{
System.out.println("SYNTAX ERROR: add expects 1 parameter not " + strArray.length);
continue;
}
int nNode = Integer.parseInt(strArray[1]);
chord.add(nNode);
}//end add
else if(strArray[0].equalsIgnoreCase("join")){
if (strArray.length > 3) {
System.out.println("SYNTAX ERROR: join expects 2 parameters not " + strArray.length);
continue;
}
int nNode1 = Integer.parseInt(strArray[1]);
int nNode2 = Integer.parseInt(strArray[2]);
chord.join(nNode1,nNode2);
}// end join
else if(strArray[0].equalsIgnoreCase("stab")){
if (strArray.length > 2) {
System.out.println("SYNTAX ERROR: stab expects 1 parameter not " + strArray.length);
continue;
}
int nNode = Integer.parseInt(strArray[1]);
chord.stabilize(nNode);
} // end stabilize
else if(strArray[0].equalsIgnoreCase("fix")){
if (strArray.length > 2) {
System.out.println("SYNTAX ERROR: fix expects 1 parameter not " + strArray.length);
continue;
}
int nNode = Integer.parseInt(strArray[1]);
chord.fix_finger(nNode);
} // end fix
else if(strArray[0].equalsIgnoreCase("show")){
if (strArray.length > 2) {
System.out.println("SYNTAX ERROR: show expects 1 parameter not " + strArray.length);
continue;
}
int nNode = Integer.parseInt(strArray[1]);
chord.show(nNode);
} // end show
else if(strArray[0].equalsIgnoreCase("list")){
if (strArray.length > 1) {
System.out.println("SYNTAX ERROR: list expects no parameter ");
continue;
}
chord.list();
}//end list
else{
System.out.println("Invalid Input");
}
}catch (NumberFormatException nfe)
{
System.out.println("ERROR: invalid integer");//nfe.printStackTrace();
}
catch (Exception e)
{
System.out.println("Something went wrong");
//e.printStackTrace();
}
}//while
}
else{
System.out.println("Error : Invalid Number of arguments passed");
System.out.println("For batch mode pass : chord -i \"input_file\" m");
System.out.println("For interactive mode pass : chord m");
}
} // end of main *****************
public int find_successor(double id,int n)
{
ChordNode node = getNodeFromList(n);
if(node==null)
{
return (int) id;
}
int successor = node.getSuccessor();
if(successor<=n)
{
if((n<id && id<=Math.pow(2,m)-1)||(id>= 0 && id<=successor))
{
return successor;
}
else
{
int n_dash = closest_preceding_node(id,n);
/*if(chordNodes.contains(getNodeFromList(n_dash)))
return successor;*/
return find_successor(id,n_dash);
}
}
else{
if(n<id && id<=successor)
return successor;
else
{
int n_dash = closest_preceding_node(id,n);
/*if(chordNodes.contains(getNodeFromList(n_dash)))
return successor;*/
return find_successor(id,n_dash);
}
}
}
public int closest_preceding_node(double id, int n)
{
ChordNode node = getNodeFromList(n);
//int successor = node.getSuccessor();
for (int i = m-1; i >=0 ; i--) {
if(n<id){
if(node.finger[i]> n && node.finger[i]< id)
return node.finger[i];
}
else{
if((node.finger[i]> n && node.finger[i]<=Math.pow(2,m)-1) || (node.finger[i]>=0 && node.finger[i]<id)) //n
{
return node.finger[i];
}
}
}
return n;
}
public void fix_finger(int n)
{
try{
ChordNode node = getNodeFromList(n);
if(chordNodes.contains(node))
{
//Collections.sort(nodeList);
for (int j = 0; j <m ; j++) {
double nNode = n + Math.pow(2,j);
double value = Math.pow(2,m);
int x = (int) (nNode%value);
node.finger[j]=find_successor(x,n);
}
}
else
System.out.println("ERROR: Node " + n + " does not exist");
}catch (Exception e){
System.out.println(e.getMessage());
}
//return node.getNodeId();
}
public void end(){
System.exit(0);
}
public void stabilize(int n)
{
try{
ChordNode current = getNodeFromList(n);
ChordNode pred = getNodeFromList(current.getPredecessor());
ChordNode succ = getNodeFromList(current.getSuccessor());
if(pred!=null && !chordNodes.contains(pred)){
current.setPredecessor(-1);
}
if(succ!=null && !chordNodes.contains(succ)){
current.setSuccessor(n);
}
if(chordNodes.contains(current) && n!=-1)
{
//ChordNode current = getNodeFromList(n);
int successorVal = current.getSuccessor();
ChordNode successor = getNodeFromList(successorVal);
if(successor!=null)
{
int x = successor.getPredecessor();
if(x!=-1)
{
if(current.getSuccessor()<=n){
if((n<x && x<=Math.pow(2,m)-1) || (0<=x && x<current.getSuccessor()))
{
current.setSuccessor(x);
}
}
else
{
if(n<x && x<current.getSuccessor())
{
current.setSuccessor(x);
}
}
}
else
{
System.out.println("ERROR: Node " + n + " does not exist");
}
ChordNode newSuccessor = getNodeFromList(current.getSuccessor()); //getNodeFromList(n).getSuccessor();
notify(n,newSuccessor.getNodeId());
}
else
{
return;
}
}
}catch (Exception e)
{
System.out.println(e.getMessage());
}
}
public void notify(int n,int succ)
{
//this ==succ
//n = id
try{
ChordNode node = getNodeFromList(succ);
if(node.getPredecessor()==-1)
{
node.setPredecessor(n);
}else if(succ<=node.getPredecessor()){
if((node.getPredecessor()<n && n<=Math.pow(2,m)-1)|| (0<=n && n<succ))
{
node.setPredecessor(n);
}
}
else{
if(node.getPredecessor()<n && n< succ)
{
node.setPredecessor(n);
}
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
public void drop(int n)
{
try{
ChordNode node = getNodeFromList(n);
if(chordNodes.contains(node))
{
ChordNode successor = getNodeFromList(node.getSuccessor());
//nodeList.remove(Integer.valueOf(n));
if(node.getPredecessor()!=-1)
{
ChordNode predecessor = getNodeFromList(node.getPredecessor());
predecessor.setSuccessor(node.getSuccessor());
}
successor.setPredecessor(node.getPredecessor());
chordNodes.remove(node);
System.out.println("Dropped Node "+n);
//check predessor for other nodes
}
else
System.out.println("ERROR: Node " + n + " does not exist");
}catch (Exception e)
{
System.out.println(e.getMessage());
}
}
public void join(int n1,int n2)
{
try {
ChordNode node1 = getNodeFromList(n1);
ChordNode node2 = getNodeFromList(n2);
if(chordNodes.contains(node1) && chordNodes.contains(node2))
{
//chordNodes.remove(node);
int x = find_successor(n1,n2);
node1.setSuccessor(x);
node1.setPredecessor(-1);
//chordNodes.add(node);
}
else {
if (!chordNodes.contains(node1))
System.out.println("ERROR: Node " + n1 + " does not exist");
else
System.out.println("ERROR: Node " + n2 + " does not exist");
}
}catch (Exception e)
{
System.out.println(e.getMessage());
}
}
public void add(int n)
{
try{
ChordNode nodeNew = new ChordNode(n,m);
if(chordNodes.contains(nodeNew))
{
System.out.println("ERROR: Node " + n + " exists");
}
else {
chordNodes.add(nodeNew);
//nodeList.add(n);
System.out.println("Added Node "+n);
}
}catch (Exception e)
{
System.out.println(e.getMessage()
);
}
}
public void list()
{
try{
Collections.sort(chordNodes,(o1, o2) -> o1.nodeId -o2.nodeId);
System.out.print("Nodes: ");
for (int i = 0; i < chordNodes.size()-1; i++) {
System.out.print(chordNodes.get(i).nodeId+", ");
}
System.out.print(chordNodes.get(chordNodes.size()-1).nodeId);
System.out.println();
}catch (Exception e)
{
System.out.println(e.getMessage());
}
}
public void check_predecessor(int n)
{
ChordNode node = getNodeFromList(n);
if(!chordNodes.contains(node));
node.setPredecessor(-1);
}
public void show(int n)
{
try{
ChordNode node = getNodeFromList(n);
if(chordNodes.contains(node))
{
System.out.print("Node "+ node.getNodeId()+":");
System.out.print(" suc "+node.getSuccessor()+",");
if(node.getPredecessor()==-1)
System.out.print(" pre None:");
else
System.out.print(" pre "+node.getPredecessor()+":");
System.out.print(" finger ");
for (int i = 0; i < node.finger.length-1; i++) {
System.out.print(node.finger[i]+",");
}
System.out.print(node.finger[(m-1)]);
System.out.println();
}
else
System.out.println("ERROR: Node " + n + " does not exist");
}catch (Exception e)
{
System.out.println(e.getMessage());
}
}
public ChordNode getNodeFromList(int n)
{
ChordNode node = null;
for (int i = 0; i < chordNodes.size(); i++) {
if(chordNodes.get(i).getNodeId()==n)
{
node = chordNodes.get(i);
break;
}
}
return node;
}
}
class ChordNode{
public int nodeId;
public int successor;
public int predecessor;
//public Map<Integer,Integer> finger = new HashMap<>();
public int[] finger;
public ChordNode(int n,int m)
{
nodeId = n;
successor = n;
predecessor=-1;
finger = new int[m];
for (int i = 0; i < m; i++) {
{
//finger.put(i,n);
finger[i]=n;
}
}
}
public int getNodeId() {
return nodeId;
}
public void setNodeId(int nodeId) {
this.nodeId = nodeId;
}
public int getSuccessor() {
return successor;
}
public void setSuccessor(int successor) {
this.successor = successor;
this.finger[0] = successor;
}
public int getPredecessor() {
return predecessor;
}
public void setPredecessor(int predecessor) {
this.predecessor = predecessor;
}
public int[] getFinger() {
return finger;
}
public void setFinger(int[] finger) {
this.finger = finger;
}
}
| [
"noreply@github.com"
] | deepak15493.noreply@github.com |
c9dd396ac34b11713831ffe184a5c828f51fa822 | 8da06d3ad989d0092d7761a81f2ec184e0989f7d | /d2cmall-main/d2cmall-main-rest/src/main/java/com/d2c/flame/controller/order/OrderController.java | 1590e46e5364258eaa61cf2d6872d58149347f5e | [] | no_license | RoJinnSennSei/my_mall | e5234c631a30b17f2ffbfd4614ef9e8dc04a9869 | dbec98edac0e679906668be1d5f37ea13f46975b | refs/heads/master | 2020-04-08T15:48:40.090961 | 2018-11-14T10:04:36 | 2018-11-14T10:04:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58,185 | java | package com.d2c.flame.controller.order;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.d2c.common.api.page.PageModel;
import com.d2c.common.api.page.PageResult;
import com.d2c.common.api.response.ResponseResult;
import com.d2c.common.base.enums.ErrorCodeEnum;
import com.d2c.common.base.exception.BusinessException;
import com.d2c.common.mq.enums.MqEnum;
import com.d2c.flame.controller.base.BaseController;
import com.d2c.flame.convert.AppVersionConvert;
import com.d2c.flame.property.HttpProperties;
import com.d2c.member.enums.DeviceTypeEnum;
import com.d2c.member.model.Account;
import com.d2c.member.model.MemberCertification;
import com.d2c.member.model.MemberInfo;
import com.d2c.member.service.AccountService;
import com.d2c.member.service.MemberCertificationService;
import com.d2c.order.dto.AddressDto;
import com.d2c.order.dto.Cart;
import com.d2c.order.dto.CartItemDto;
import com.d2c.order.dto.OrderDto;
import com.d2c.order.dto.OrderItemDto;
import com.d2c.order.enums.PaymentTypeEnum;
import com.d2c.order.handle.PromotionCalculateItem;
import com.d2c.order.handle.PromotionCalculateResult;
import com.d2c.order.handle.PromotionCondition;
import com.d2c.order.model.Address;
import com.d2c.order.model.CartItem;
import com.d2c.order.model.CollageGroup;
import com.d2c.order.model.CollageGroup.GroupStatus;
import com.d2c.order.model.CollageOrder;
import com.d2c.order.model.CollageOrder.CollageOrderStatus;
import com.d2c.order.model.Coupon;
import com.d2c.order.model.Coupon.CouponStatus;
import com.d2c.order.model.CouponDef;
import com.d2c.order.model.CouponDef.Association;
import com.d2c.order.model.CouponDefRelation;
import com.d2c.order.model.CouponDefRelation.CouponRelationType;
import com.d2c.order.model.Order.OrderType;
import com.d2c.order.model.Setting;
import com.d2c.order.model.Store;
import com.d2c.order.model.Store.BusTypeEnum;
import com.d2c.order.model.base.IPromotionInterface;
import com.d2c.order.mongo.enums.BargainStatus;
import com.d2c.order.mongo.model.BargainPriceDO;
import com.d2c.order.mongo.service.BargainPriceService;
import com.d2c.order.query.CollageOrderSearcher;
import com.d2c.order.service.AddressService;
import com.d2c.order.service.CartService;
import com.d2c.order.service.CollageGroupService;
import com.d2c.order.service.CollageOrderService;
import com.d2c.order.service.CouponDefQueryService;
import com.d2c.order.service.CouponDefRelationService;
import com.d2c.order.service.CouponQueryService;
import com.d2c.order.service.OrderService;
import com.d2c.order.service.PromotionRunService;
import com.d2c.order.service.SettingService;
import com.d2c.order.service.StoreService;
import com.d2c.order.service.tx.OrderTxService;
import com.d2c.order.third.kaola.KaolaClient;
import com.d2c.order.third.kaola.model.OrderItem;
import com.d2c.order.third.kaola.model.UserInfo;
import com.d2c.product.dto.ProductCombDto;
import com.d2c.product.model.BargainPromotion;
import com.d2c.product.model.CollagePromotion;
import com.d2c.product.model.Product;
import com.d2c.product.model.Product.ProductSource;
import com.d2c.product.model.Product.ProductTradeType;
import com.d2c.product.model.ProductSku;
import com.d2c.product.service.BargainPromotionService;
import com.d2c.product.service.CollagePromotionService;
import com.d2c.product.service.ProductCombService;
import com.d2c.product.service.ProductService;
import com.d2c.product.service.ProductSkuService;
import com.d2c.util.date.DateUtil;
import com.d2c.util.string.RandomUtil;
import com.d2c.util.string.StringUtil;
/**
* 订单流程
*
* @author wwn
* @version 3.0
*
*/
@RestController
@RequestMapping(value = "/v3/api/order")
public class OrderController extends BaseController {
@Autowired
private ProductService productService;
@Autowired
private ProductSkuService productSkuService;
@Autowired
private ProductCombService productCombService;
@Autowired
private PromotionRunService promotionRunService;
@Autowired
private StoreService storeService;
@Autowired
private AddressService addressService;
@Autowired
private AccountService accountService;
@Autowired
private CouponQueryService couponQueryService;
@Autowired
private CouponDefQueryService couponDefQueryService;
@Autowired
private CouponDefRelationService couponDefRelationService;
@Autowired
private CartService cartService;
@Autowired
private OrderService orderService;
@Reference
private OrderTxService orderTxService;
@Autowired
private SettingService settingService;
@Autowired
private MemberCertificationService memberCertificationService;
@Autowired
private BargainPriceService bargainPriceService;
@Autowired
private BargainPromotionService bargainPromotionService;
@Autowired
private RedisTemplate<String, String> redisTemplate;
@Autowired
private HttpProperties httpProperties;
@Autowired
private CollagePromotionService collagePromotionService;
@Autowired
private CollageGroupService collageGroupService;
@Autowired
private CollageOrderService collageOrderService;
/**
* 立即购买
*
* @param skuId
* @param num
* @param appTerminal
* @param appVersion
* @return
*/
@RequestMapping(value = "/buynow", method = RequestMethod.POST)
public ResponseResult buyNow(@RequestParam(required = true) Long[] skuId,
@RequestParam(required = true) Integer[] num, String appTerminal, String appVersion) {
ResponseResult result = new ResponseResult();
MemberInfo memberInfo = this.getLoginMemberInfo();
// 产生订单表单
OrderDto orderDto = new OrderDto(memberInfo);
orderDto.setTempId(RandomUtil.getRandomString(32));
List<IPromotionInterface> promotionConditions = new ArrayList<>();
List<OrderItemDto> orderItems = new ArrayList<>();
boolean tick = (memberInfo.getDistributorId() == null);
boolean cross = false;
for (int i = 0; i < skuId.length; i++) {
ProductSku productSku = productSkuService.findById(skuId[i]);
if (productSku == null) {
continue;
}
Product product = productService.findById(productSku.getProductId());
if (product == null) {
continue;
}
tick = tick && (product.getStatus() != 5 && product.getStatus() != -1);
cross = cross | (product.getProductTradeType().equals(ProductTradeType.CROSS.name()));
this.checkQuantityAndStatus(productSku, product, num[i], appTerminal, appVersion, OrderType.ordinary);
// 产生购物车明细
CartItemDto cartItemDto = this.createCartItemDto(product, productSku, memberInfo, num[i]);
PromotionCondition pc = new PromotionCondition(cartItemDto, product, productSku, true);
promotionConditions.add(pc);
// 产生订单明细
OrderItemDto orderItemDto = this.createOrderItemDto(cartItemDto, product, productSku, memberInfo);
orderItems.add(orderItemDto);
}
// 初始化活动
PromotionCalculateResult calResult = promotionRunService.getPromotionsByOrder(memberInfo.getDistributorId(),
null, promotionConditions);
this.initPromotion(orderDto, orderItems, calResult);
JSONObject orderJson = this.orderJson(orderDto);
// 跨境商品不能钱包支付
if (cross) {
orderJson.put("payParams", PaymentTypeEnum.ALIPAY + "," + PaymentTypeEnum.WXAPPPAY);
}
result.put("order", orderJson);
// 收货地址,钱包账户,优惠券
result = this.getOtherInfo(orderDto, result, tick, tick, cross);
return result;
}
/**
* 拼团商品立即购买
*
* @param skuId
* @param num
* @param collageId
* @param groupId
* @param appTerminal
* @param appVersion
* @return
*/
@RequestMapping(value = "/collage/buynow", method = RequestMethod.POST)
public ResponseResult buyNowCollage(@RequestParam(required = true) Long skuId,
@RequestParam(required = true) Integer num, @RequestParam(required = true) Long collageId, Long groupId,
String appTerminal, String appVersion) {
ResponseResult result = new ResponseResult();
MemberInfo memberInfo = this.getLoginMemberInfo();
if (num == null) {
num = 1;
}
if (skuId == null) {
throw new BusinessException("没有选择购买的商品,请刷新页面后,重新购买!");
}
ProductSku productSku = productSkuService.findById(skuId);
if (productSku == null) {
throw new BusinessException("商品已下架,购买不成功!");
}
Product product = productService.findById(productSku.getProductId());
if (product == null || product.getMark() <= 0) {
throw new BusinessException("商品已下架,购买不成功!");
}
if (AppVersionConvert.convert(appTerminal, appVersion) > 0
&& AppVersionConvert.convert(appTerminal, appVersion) <= 3230) {
if (product.getProductTradeType().equals(ProductTradeType.CROSS.name())
|| product.getSource().equals(ProductSource.KAOLA.name())) {
throw new BusinessException("当前app版本暂不支持该商品购买,请在小程序购买或请将app升级到最新版本!");
}
}
this.checkQuantityAndStatus(productSku, product, num, appTerminal, appVersion, OrderType.collage);
// 拼团活动处理
if (collageId == null) {
this.checkCollage(memberInfo.getId(), groupId, collageId);
}
// 产生订单表单
OrderDto orderDto = new OrderDto(memberInfo);
orderDto.setTempId(RandomUtil.getRandomString(32));
List<IPromotionInterface> promotionConditions = new ArrayList<>();
List<OrderItemDto> orderItems = new ArrayList<>();
// 产生购物车明细
CartItemDto cartItemDto = this.createCartItemDto(product, productSku, memberInfo, num);
// 拼团价格处理
cartItemDto.setPrice(productSku.getCollagePrice());
PromotionCondition pc = new PromotionCondition();
BeanUtils.copyProperties(cartItemDto, pc, "goodPromotionId", "orderPromotionId", "flashPromotionId");
promotionConditions.add(pc);
// 产生订单明细
OrderItemDto orderItemDto = this.createOrderItemDto(cartItemDto, product, productSku, memberInfo);
orderItems.add(orderItemDto);
// 初始化活动
PromotionCalculateResult calResult = promotionRunService.getPromotionsByOrder(null, null, promotionConditions);
this.initPromotion(orderDto, orderItems, calResult);
JSONObject orderJson = this.orderJson(orderDto);
// 跨境商品不能钱包支付
if (product.getProductTradeType().equals(ProductTradeType.CROSS.name())) {
orderJson.put("payParams", PaymentTypeEnum.ALIPAY + "," + PaymentTypeEnum.WXAPPPAY);
}
result.put("order", orderJson);
boolean certificate = product.getProductTradeType().equals(ProductTradeType.CROSS.name())
|| product.getSource().equals(ProductSource.KAOLA.name());
// 收货地址,钱包账户,优惠券
result = this.getOtherInfo(orderDto, result, false, false, certificate);
return result;
}
/**
* 判断是否能开团参团<br>
* 限定条件:
* <li>同一商品同一人只能在进行中只有一个
* <li>同商品同人只能买N件
* <li>同账号一天开N次团
* <li>同账号一天只能参N次团
*
* @param memberId
* @param group
* @param promotion
*/
protected void checkCollage(Long memberId, Long groupId, Long promotionId) {
// 活动相关
CollagePromotion promotion = collagePromotionService.findById(promotionId);
// 活动相关
if (promotion == null || promotion.isOver() < 1) {
throw new BusinessException("活动已结束,看看其他的拼团活动吧!");
}
if (groupId != null) {
CollageGroup group = collageGroupService.findById(groupId);
// 满人或者关闭或者由于未支付而没关闭实际已超时的团队不能参与
if (group == null || group.getStatus() != GroupStatus.PROCESS.getCode()
|| group.getEndDate().before(new Date())) {
throw new BusinessException("该团队不在开团中,请重新选择团队!");
}
} else {
int count = collageGroupService.countGroupByPromotionId(promotion.getId());
if (count >= promotion.getProductCreatedLimit()) {
throw new BusinessException(ErrorCodeEnum.COLLAGE_1002.getMessage(),
ErrorCodeEnum.COLLAGE_1002.getCode());
}
}
// 判断对于该用户是否存在正在进行中的,存在则不能参团开团
CollageOrder order = collageOrderService.findExistProcess(promotion.getId(), memberId);
if (order != null) {
throw new BusinessException(ErrorCodeEnum.COLLAGE_1001.getMessage(), ErrorCodeEnum.COLLAGE_1001.getCode());
}
// 判断是否该活动该用户参团成功的次数超过限制
CollageOrderSearcher searcher = new CollageOrderSearcher();
searcher.setMemberId(memberId);
searcher.setPromotionId(promotion.getId());
searcher.setStatus(CollageOrderStatus.SUCESS.getCode());
int successCount = collageOrderService.countBySearch(searcher);
if (successCount >= promotion.getMemberBuyLimit()) {
throw new BusinessException("您已经成功拼团该商品" + successCount + "次了,超过上限了,看看其他拼团活动吧!",
ErrorCodeEnum.COLLAGE_1003.getCode());
}
}
/**
* 砍价商品立即购买
*
* @param skuId
* @param num
* @param bargainId
* @param appTerminal
* @param appVersion
* @return
*/
@RequestMapping(value = "/bargain/buynow", method = RequestMethod.POST)
public ResponseResult buyNowBargain(@RequestParam(required = true) Long skuId,
@RequestParam(required = true) Integer num, @RequestParam(required = true) String bargainId,
String appTerminal, String appVersion) {
ResponseResult result = new ResponseResult();
MemberInfo memberInfo = this.getLoginMemberInfo();
if (num == null) {
num = 1;
}
if (skuId == null) {
throw new BusinessException("没有选择购买的商品,请刷新页面后,重新购买!");
}
ProductSku productSku = productSkuService.findById(skuId);
if (productSku == null) {
throw new BusinessException("商品已下架,购买不成功!");
}
Product product = productService.findById(productSku.getProductId());
if (product == null || product.getMark() <= 0) {
throw new BusinessException("商品已下架,购买不成功!");
}
if (AppVersionConvert.convert(appTerminal, appVersion) > 0
&& AppVersionConvert.convert(appTerminal, appVersion) <= 3230) {
if (product.getProductTradeType().equals(ProductTradeType.CROSS.name())
|| product.getSource().equals(ProductSource.KAOLA.name())) {
throw new BusinessException("当前app版本暂不支持该商品购买,请在小程序购买或请将app升级到最新版本!");
}
}
this.checkQuantityAndStatus(productSku, product, num, appTerminal, appVersion, OrderType.bargain);
// 产生订单表单
OrderDto orderDto = new OrderDto(memberInfo);
orderDto.setTempId(RandomUtil.getRandomString(32));
List<IPromotionInterface> promotionConditions = new ArrayList<>();
List<OrderItemDto> orderItems = new ArrayList<>();
// 产生购物车明细
CartItemDto cartItemDto = this.createCartItemDto(product, productSku, memberInfo, num);
// 砍价活动处理
if (StringUtil.isNotBlank(bargainId)) {
this.initBargainPrice(bargainId, cartItemDto, memberInfo.getId());
}
PromotionCondition pc = new PromotionCondition();
BeanUtils.copyProperties(cartItemDto, pc, "goodPromotionId", "orderPromotionId", "flashPromotionId");
promotionConditions.add(pc);
// 产生订单明细
OrderItemDto orderItemDto = this.createOrderItemDto(cartItemDto, product, productSku, memberInfo);
orderItems.add(orderItemDto);
orderDto.setOrderItems(orderItems);
// 初始化活动
PromotionCalculateResult calResult = promotionRunService.getPromotionsByOrder(memberInfo.getDistributorId(),
null, promotionConditions);
this.initPromotion(orderDto, orderItems, calResult);
JSONObject orderJson = this.orderJson(orderDto);
// 跨境商品不能钱包支付
if (product.getProductTradeType().equals(ProductTradeType.CROSS.name())) {
orderJson.put("payParams", PaymentTypeEnum.ALIPAY + "," + PaymentTypeEnum.WXAPPPAY);
}
result.put("order", orderJson);
boolean certificate = product.getProductTradeType().equals(ProductTradeType.CROSS.name())
|| product.getSource().equals(ProductSource.KAOLA.name());
// 收货地址,钱包账户,优惠券
result = this.getOtherInfo(orderDto, result, false, false, certificate);
return result;
}
/**
* 砍价优惠
*
* @param bargainId
* @param cartItemDto
* @param memberId
* @return
*/
protected boolean initBargainPrice(String bargainId, CartItemDto cartItemDto, Long memberId) {
BargainPriceDO bargainPrice = bargainPriceService.getBargainPriceById(bargainId);
if (bargainPrice.getStatus().equals(BargainStatus.ORDERED.name())) {
throw new BusinessException("该砍价单已创建过订单了!");
}
BargainPromotion bargainpromotion = bargainPromotionService.findById(bargainPrice.getBargainId());
// 活动结束后的24小时还能购买
bargainpromotion.setEndDate(new Date(bargainpromotion.getEndDate().getTime() + 24 * 60 * 60 * 1000));
if (bargainpromotion == null || bargainpromotion.isOver()) {
throw new BusinessException("该砍价活动已结束!");
}
if (!memberId.equals(bargainPrice.getMemberId())) {
throw new BusinessException("创建该砍价活动会员和购买用户不匹配!");
}
cartItemDto.setPrice(new BigDecimal(bargainPrice.getPrice()));
return true;
}
/**
* 组合商品立即购买
*
* @param productCombId
* @param num
* @param skuId
* @param appTerminal
* @param appVersion
* @return
*/
@RequestMapping(value = "/comb/buynow", method = RequestMethod.POST)
public ResponseResult buyNowComb(@RequestParam(required = true) Long productCombId,
@RequestParam(required = true) Integer num, @RequestParam(required = true) Long[] skuId, String appTerminal,
String appVersion) {
ResponseResult result = new ResponseResult();
MemberInfo memberInfo = this.getLoginMemberInfo();
if (productCombId == null || productCombId <= 0) {
throw new BusinessException("组合商品不存在,下单不成功!");
}
ProductCombDto productComb = productCombService.findDtoById(productCombId);
if (productComb == null || productComb.getMark() <= 0) {
throw new BusinessException("组合商品不存在,下单不成功!");
}
// 产生订单表单
OrderDto orderDto = new OrderDto(memberInfo);
orderDto.setTempId(RandomUtil.getRandomString(32));
List<IPromotionInterface> promotionConditions = new ArrayList<>();
List<OrderItemDto> orderItems = new ArrayList<>();
if (skuId == null || skuId.length != productComb.getProducts().size()) {
throw new BusinessException("组合商品,选择不全,下单不成功!");
}
List<Long> procombs = new ArrayList<>();
productComb.getProducts().forEach(item -> procombs.add(item.getId()));
boolean tick = (memberInfo.getDistributorId() == null);
for (int i = 0; i < skuId.length; i++) {
ProductSku productSku = productSkuService.findById(skuId[i]);
if (productSku == null) {
throw new BusinessException("组合商品,选择不全,下单不成功!");
}
Product product = productService.findById(productSku.getProductId());
tick = tick && (product.getStatus() != 5 && product.getStatus() != -1);
this.checkQuantityAndStatus(productSku, product, num, appTerminal, appVersion, OrderType.ordinary);
if (!procombs.contains(product.getId())) {
throw new BusinessException("商品" + product.getName() + "不在组合商品序列中,请重新选择下单!");
}
// 产生购物车明细
CartItemDto cartItemDto = this.createCartItemDto(product, productSku, memberInfo, num);
PromotionCondition pc = new PromotionCondition();
BeanUtils.copyProperties(cartItemDto, pc);
pc.setProductCombId(productCombId);
promotionConditions.add(pc);
// 产生订单明细
OrderItemDto orderItemDto = this.createOrderItemDto(cartItemDto, product, productSku, memberInfo);
orderItemDto.setProductCombId(productCombId);
orderItems.add(orderItemDto);
}
// 初始化活动
PromotionCalculateResult calResult = promotionRunService.getProductCombPromotion(promotionConditions);
this.initPromotion(orderDto, orderItems, calResult);
result.put("order", this.orderJson(orderDto));
// 收货地址,钱包账户,优惠券
result = this.getOtherInfo(orderDto, result, tick, tick, false);
return result;
}
/**
* 确认订单
*
* @param cartItemIds
* @param appTerminal
* @param appVersion
* @return
*/
@RequestMapping(value = "/confirm", method = RequestMethod.POST)
public ResponseResult confirmOrder(@RequestParam(required = true) Long[] cartItemIds, String appTerminal,
String appVersion) {
ResponseResult result = new ResponseResult();
MemberInfo memberInfo = this.getLoginMemberInfo();
// 产生订单表单
OrderDto orderDto = new OrderDto(memberInfo);
orderDto.setTempId(RandomUtil.getRandomString(32));
List<IPromotionInterface> promotionConditions = new ArrayList<>();
List<OrderItemDto> orderItems = new ArrayList<>();
Cart cart = cartService.findCart(memberInfo.getId());
List<Long> skuIds = new ArrayList<>();
List<Long> productIds = new ArrayList<>();
for (int i = 0; i < cartItemIds.length; i++) {
CartItemDto cartItem = cart.getItemMapById().get(cartItemIds[i]);
if (cartItem == null) {
continue;
}
skuIds.add(cartItem.getProductSkuId());
productIds.add(cartItem.getProductId());
}
Map<Long, ProductSku> skuMap = productSkuService.findByIds(skuIds.toArray(new Long[] {}));
Map<Long, Product> productMap = productService.findByIds(productIds.toArray(new Long[] {}));
boolean tick = (memberInfo.getDistributorId() == null);
boolean cross = false;
for (int i = 0; i < cartItemIds.length; i++) {
// 获取购物车明细
CartItemDto cartItemDto = cart.getItemMapById().get(cartItemIds[i]);
if (cartItemDto == null) {
continue;
}
ProductSku productSku = skuMap.get(cartItemDto.getProductSkuId());
Product product = productMap.get(cartItemDto.getProductId());
if (productSku == null || product == null) {
continue;
}
tick = tick && (product.getStatus() != 5 && product.getStatus() != -1);
cross = cross | (product.getProductTradeType().equals(ProductTradeType.CROSS.name()));
this.checkQuantityAndStatus(productSku, product, cartItemDto.getQuantity(), appTerminal, appVersion,
OrderType.ordinary);
PromotionCondition pc = new PromotionCondition(cartItemDto, product, productSku, true);
promotionConditions.add(pc);
// 产生订单明细
OrderItemDto orderItemDto = this.createOrderItemDto(cartItemDto, product, productSku, memberInfo);
orderItems.add(orderItemDto);
}
// 初始化活动
PromotionCalculateResult calResult = promotionRunService.getPromotionsByOrder(memberInfo.getDistributorId(),
null, promotionConditions);
this.initPromotion(orderDto, orderItems, calResult);
JSONObject orderJson = this.orderJson(orderDto);
// 跨境商品不能钱包支付
if (cross) {
orderJson.put("payParams", PaymentTypeEnum.ALIPAY + "," + PaymentTypeEnum.WXAPPPAY);
}
result.put("order", orderJson);
// 收货地址,钱包账户,优惠券
result = this.getOtherInfo(orderDto, result, tick, tick, cross);
return result;
}
/**
* 收货地址,钱包账户,优惠券
*
* @param orderDto
* @param result
* @param coupon
* @param red
* @return
*/
protected ResponseResult getOtherInfo(OrderDto orderDto, ResponseResult result, boolean coupon, boolean red,
boolean certificate) {
// 收货地址
PageResult<AddressDto> addressPager = addressService.findByMemberInfoId(orderDto.getMemberId(),
new PageModel(1, 1), null);
AddressDto address = null;
if (addressPager.getList().size() > 0) {
address = addressPager.getList().get(0);
if (certificate) {
MemberCertification memberCertification = memberCertificationService.findByName(address.getName(),
orderDto.getMemberId());
result.put("memberCertification",
memberCertification == null ? new JSONObject() : memberCertification.toJson());
}
}
result.put("address", address == null ? null : address.toJson());
// 账户信息
Account account = accountService.findByMemberId(orderDto.getMemberId());
if (account != null) {
JSONObject accountJson = account.toJson();
if (!red) {
accountJson.put("isRed", false);
}
result.put("account", accountJson);
}
// 优惠券
PageResult<Coupon> couponPager = couponQueryService.findMyUnusedCoupons(orderDto.getMemberId(),
orderDto.getTotalAmount());
Set<Long> defineIds = new HashSet<>();
couponPager.getList().forEach(item -> defineIds.add(item.getDefineId()));
List<Long> ableIds = new ArrayList<>();
List<OrderItemDto> initItems = this.checkValidItem(orderDto);
for (Long defineId : defineIds) {
CouponDef cd = couponDefQueryService.findById(defineId);
if (orderDto.getTotalAmount().intValue() < cd.getNeedAmount()
|| cd.getEnableDate().compareTo(new Date()) > 0) {
continue;
}
List<OrderItemDto> validItems = new ArrayList<>();
if (this.checkValidCoupon(orderDto, cd, initItems, validItems)) {
ableIds.add(defineId);
}
}
List<Coupon> ableCoupons = new ArrayList<>();
List<Coupon> disableCoupons = new ArrayList<>();
for (Coupon item : couponPager.getList()) {
if (ableIds.contains(item.getDefineId())) {
ableCoupons.add(item);
} else {
disableCoupons.add(item);
}
}
if (coupon) {
result.put("coupons", this.couponJson(ableCoupons));
result.put("disableCoupons", this.couponJson(disableCoupons));
} else {
result.put("coupons", new JSONArray());
disableCoupons.addAll(ableCoupons);
result.put("disableCoupons", this.couponJson(disableCoupons));
result.put("reason", "所结算商品中含特殊商品,不支持使用优惠券!");
}
return result;
}
/**
* 跨境订单的税仓
*
* @param goodsId
* 商品款号
* @param skuId
* 商品条码
* @param buyAmount
* 商品数量
* @param channelSalePrice
* 活动后价格
* @param name
* 收货人姓名
* @param provinceName
* 省份名称
* @param cityName
* 城市名称
* @param districtName
* 地区名称
* @param address
* 街道地址
* @return
* @throws Exception
*/
@RequestMapping(value = "/kaola/confirm", method = RequestMethod.POST)
public ResponseResult confirmKaola(@RequestParam(required = true) String[] goodsId,
@RequestParam(required = true) String[] skuId, @RequestParam(required = true) Integer[] buyAmount,
@RequestParam(required = true) BigDecimal[] channelSalePrice, @RequestParam(required = true) String name,
@RequestParam(required = true) String provinceName, @RequestParam(required = true) String cityName,
@RequestParam(required = true) String districtName, @RequestParam(required = true) String address)
throws Exception {
ResponseResult result = new ResponseResult();
MemberInfo memberInfo = this.getLoginMemberInfo();
String loginCode = memberInfo.getLoginCode();
// 测试环境请使用@163.com结尾的账户,正式环境不受限
if (httpProperties.getMobileUrl().contains("test")) {
loginCode = loginCode + "@163.com";
}
UserInfo userInfo = new UserInfo(loginCode, name, memberInfo.getLoginCode(), address, provinceName, cityName,
districtName, null);
List<OrderItem> orderItemList = new ArrayList<>();
for (int i = 0; i < goodsId.length; i++) {
OrderItem oi = new OrderItem(goodsId[i], skuId[i], buyAmount[i], channelSalePrice[i], null);
orderItemList.add(oi);
}
try {
JSONObject response = KaolaClient.getInstance().orderConfirm(userInfo, orderItemList);
result.put("kaola", response);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return result;
}
/**
* 优惠券条件
*
* @param skuIds
* @param productIds
* @param designerIds
* @param coupons
* @return
*/
@RequestMapping(value = "/coupon", method = RequestMethod.POST)
public ResponseResult checkCoupon(Long[] skuIds, Long[] productIds, Long[] designerIds, String coupons) {
ResponseResult result = new ResponseResult();
MemberInfo member = this.getLoginMemberInfo();
Coupon coupon = couponQueryService.findByCode(coupons, member.getId());
if (coupon == null || !coupon.getStatus().equals(CouponStatus.CLAIMED.name())) {
throw new BusinessException("优惠券不存在!");
}
CouponDef couponDef = couponDefQueryService.findById(coupon.getDefineId());
Long[] targetIds = null;
String relationType = null;
if (couponDef.getCheckAssociation().equals(Association.ALL.name())) {
result.put("skuIds", skuIds);
return result;
} else if (couponDef.getCheckAssociation().equals(Association.PRODUCT.name())) {
relationType = CouponRelationType.PRODUCT.name();
targetIds = productIds;
} else if (couponDef.getCheckAssociation().equals(Association.DESIGNER.name())) {
relationType = CouponRelationType.DESIGNER.name();
targetIds = designerIds;
}
List<CouponDefRelation> relations = couponDefRelationService.findByCidAndTids(Arrays.asList(targetIds),
couponDef.getId(), relationType);
Map<Long, Long> relMap = new HashMap<>();
for (CouponDefRelation relation : relations) {
relMap.put(relation.getTargetId(), relation.getCouponDefId());
}
List<Long> validItem = new ArrayList<>();
for (int i = 0; i < targetIds.length; i++) {
if (!couponDef.getExclude().booleanValue()) {
if (relMap.containsKey(targetIds[i]))
validItem.add(skuIds[i]);
} else {
if (!relMap.containsKey(targetIds[i]))
validItem.add(skuIds[i]);
}
}
result.put("skuIds", validItem);
return result;
}
/**
* 创建订单
*
* @param skuId
* 条码
* @param quantity
* 数量
* @param productCombId
* 组合商品
* @param warehouseId
* 仓库号
* @param warehouseName
* 仓库名称
* @param taxAmount
* 税费
* @param freight
* 运费
* @param addressId
* 收货地址
* @param address
* 收货地址
* @param coupons
* 优惠券编码
* @param memo
* 买家备注
* @param drawee
* 收票人
* @param redPacket
* 使用红包
* @param longitude
* 经度
* @param latitude
* 维度
* @param bargainId
* 砍价活动
* @param collageId
* 拼团活动
* @param appTerminal
* 设备
* @param appVersion
* 版本号
* @return
*/
@RequestMapping(value = "/create", method = RequestMethod.POST)
public ResponseResult createOrder(Long[] skuId, Integer[] quantity, Long[] productCombId, Long[] warehouseId,
String[] warehouseName, BigDecimal[] taxAmount, BigDecimal freight, Long addressId, AddressDto address,
String coupons, String memo, String drawee, Integer redPacket, BigDecimal longitude, BigDecimal latitude,
String bargainId, Long collageId, String appTerminal, String appVersion, Long parent_id, Integer level) {
ResponseResult result = new ResponseResult();
MemberInfo memberInfo = this.getLoginMemberInfo();
// 防止重复提交的锁
final String memberKey = "create_order_member_info_" + memberInfo.getId();
try {
Boolean exist = redisTemplate.execute(new RedisCallback<Boolean>() {
@Override
public Boolean doInRedis(RedisConnection connection) throws DataAccessException {
return connection.exists(memberKey.getBytes());
}
});
if (exist != null && exist.booleanValue()) {
throw new BusinessException("不能重复提交订单!");
} else {
redisTemplate.execute(new RedisCallback<Long>() {
@Override
public Long doInRedis(RedisConnection connection) throws DataAccessException {
connection.set(memberKey.getBytes(), String.valueOf(memberInfo.getId()).getBytes());
return 1L;
}
});
}
// 收货地址
if (addressId == null || addressId <= 0) {
if (address != null) {
address.setMemberId(memberInfo.getId());
address = addressService.insert(address);
} else {
throw new BusinessException("请填写收货地址!");
}
} else {
address = addressService.findById(addressId);
}
if (address == null || !memberInfo.getId().equals(address.getMemberId())) {
throw new BusinessException("收货地址异常!");
}
if (skuId == null || skuId[0] == null) {
throw new BusinessException("购买商品已经售罄,请选购其他商品!");
}
// 产生订单
OrderDto orderDto = new OrderDto(memberInfo);
orderDto.setReciverInfo(address);
orderDto.setMemo(memo);
orderDto.setDevice(DeviceTypeEnum.divisionDevice(appTerminal));
orderDto.setAppVersion(appVersion);
orderDto.setDrawee(drawee);
orderDto.setLongitude(longitude);
orderDto.setLatitude(latitude);
List<Long> productIds = new ArrayList<>();
Map<Long, ProductSku> skuMap = productSkuService.findByIds(skuId);
Iterator<Entry<Long, ProductSku>> iterator = skuMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Long, ProductSku> entry = iterator.next();
ProductSku sku = entry.getValue();
if (sku == null) {
continue;
}
productIds.add(sku.getProductId());
}
Map<Long, Product> productMap = productService.findByIds(productIds.toArray(new Long[] {}));
boolean tick = (memberInfo.getDistributorId() == null);
boolean cross = false;
boolean kaola = false;
boolean qualified = false;
OrderType orderType = OrderType.ordinary;
BigDecimal orderTaxAmount = new BigDecimal(0);
List<IPromotionInterface> promotionConditions = new ArrayList<>();
List<OrderItemDto> orderItems = new ArrayList<>();
for (int i = 0; i < skuId.length; i++) {
ProductSku productSku = skuMap.get(skuId[i]);
if (productSku == null) {
continue;
}
Product product = productMap.get(productSku.getProductId());
if (product == null) {
continue;
}
Boolean promotion = true;
// 秒杀商品
if (product.getStatus() == 5) {
tick = tick & false;
orderType = OrderType.seckill;
orderDto.setType(orderType.name());
}
// 礼包商品
if (product.getStatus() == -1) {
tick = tick & false;
qualified = qualified | true;
}
// 跨境商品
if (product.getProductTradeType().equals(ProductTradeType.CROSS.name())) {
cross = cross | true;
orderDto.setCrossBorder(1);
}
// 考拉商品
if (product.getSource().equals(ProductSource.KAOLA.name())) {
kaola = kaola | true;
}
// 产生购物车明细
CartItemDto cartItemDto = this.createCartItemDto(product, productSku, memberInfo, quantity[i]);
// 拼团活动处理
if (collageId != null) {
orderType = OrderType.collage;
orderDto.setType(orderType.name());
orderDto.setCollageId(collageId);
promotion = false;
}
// 砍价活动处理
if (StringUtil.isNotBlank(bargainId)) {
this.initBargainPrice(bargainId, cartItemDto, memberInfo.getId());
orderType = OrderType.bargain;
orderDto.setType(orderType.name());
orderDto.setBargainId(bargainId);
promotion = false;
}
this.checkQuantityAndStatus(productSku, product, cartItemDto.getQuantity(), appTerminal, appVersion,
orderType);
PromotionCondition pc = new PromotionCondition(cartItemDto, product, productSku, promotion);
promotionConditions.add(pc);
// 产生订单明细
OrderItemDto orderItemDto = this.createOrderItemDto(cartItemDto, product, productSku, memberInfo);
if (isComb(productCombId)) {
pc.setProductCombId(productCombId[0]);
orderItemDto.setProductCombId(productCombId[0]);
}
if (isWarehouse(warehouseId, warehouseName)) {
orderItemDto.setWarehouseId(warehouseId[i]);
orderItemDto.setWarehouseName(warehouseName[i]);
}
if (isTax(taxAmount)) {
orderItemDto.setTaxAmount(taxAmount[i]);
orderTaxAmount = orderTaxAmount.add(taxAmount[i]);
}
orderItems.add(orderItemDto);
}
orderDto.setTaxAmount(orderTaxAmount);
// 初始化活动
PromotionCalculateResult calResult = null;
if (isComb(productCombId)) {
// 组合商品
calResult = promotionRunService.getProductCombPromotion(promotionConditions);
} else {
// 一般订单
calResult = promotionRunService.getPromotionsByOrder(memberInfo.getDistributorId(), null,
promotionConditions);
}
// 设置活动
this.initPromotion(orderDto, orderItems, calResult);
if (!orderDto.getType().equals(OrderType.distribution.name())) {
// 设置优惠券
this.initCoupon(coupons, orderDto, tick);
// 设置红包
this.initRedPacks(redPacket, orderDto, memberInfo, tick);
// 设置分销规则
orderDto = orderService.doInitPartner(memberInfo, orderDto, parent_id, level, qualified);
} else {
// 设置D+店信息
this.initDPlus(orderDto, memberInfo);
}
// 考拉或跨境商品实名认证
if (cross || kaola) {
MemberCertification memberCertification = memberCertificationService.findByName(orderDto.getReciver(),
memberInfo.getId());
if (memberCertification == null) {
result.setStatus(-3);
result.setMsg("您购买的商品需要实名认证!");
return result;
}
// 考拉订单推单
if (kaola) {
if (freight != null) {
orderDto.setShippingRates(freight);
}
this.push2Kaola(memberInfo.getLoginCode(), memberCertification, orderDto);
}
result.put("memberCertification",
memberCertification == null ? new JSONObject() : memberCertification.toJson());
}
// 此处创建订单
orderDto = orderTxService.doCreateOrder(orderDto, coupons, redPacket);
// 清空购物车
Cart cart = cartService.findCart(memberInfo.getId());
List<Long> delCartItemIds = structCartItemIds(cart, skuId);
if (delCartItemIds != null && delCartItemIds.size() > 0) {
cartService.deleteCartItems(delCartItemIds, memberInfo.getId());
}
// 冻结砍价单
if (!StringUtils.isEmpty(bargainId)) {
bargainPriceService.updateBargainForPay(bargainId);
}
result.put("order", orderDto);
try {
// 订单创建提醒
Setting setting = settingService.findByCode(Setting.ORDERCLOSECODE);
String value = Setting.defaultValue(setting, "86400").toString();
this.orderRemindMQ(orderDto, value);
} catch (Exception e) {
logger.error(e.getMessage());
}
return result;
} finally {
redisTemplate.execute(new RedisCallback<Long>() {
@Override
public Long doInRedis(RedisConnection connection) throws DataAccessException {
connection.del(memberKey.getBytes());
return 1L;
}
});
}
}
/**
* 根据地址返回认证信息
*
* @param addressId
* @return
*/
@RequestMapping(value = "/certification/{addressId}", method = RequestMethod.GET)
public ResponseResult getCertification(@PathVariable("addressId") Long addressId) {
MemberInfo memberInfo = this.getLoginMemberInfo();
ResponseResult result = new ResponseResult();
Address address = addressService.findById(addressId);
if (address == null || !address.getMemberId().equals(memberInfo.getId())) {
throw new BusinessException("地址非本人,请重选");
}
MemberCertification certification = memberCertificationService.findByName(address.getName(),
memberInfo.getId());
if (certification != null) {
result.put("memberCertification", certification.toJson());
}
return result;
}
private void push2Kaola(String loginCode, MemberCertification memberCertification, OrderDto orderDto) {
// 测试环境请使用@163.com结尾的账户,正式环境不受限
if (httpProperties.getMobileUrl().contains("test")) {
loginCode = loginCode + "@163.com";
}
UserInfo userInfo = new UserInfo(loginCode, memberCertification.getRealName(), orderDto.getContact(),
orderDto.getAddress(), orderDto.getProvince(), orderDto.getCity(), orderDto.getDistrict(),
memberCertification.getIdentityCard());
String domain = "https://img.d2c.cn";
if (StringUtil.isNotBlank(memberCertification.getFrontPic())) {
userInfo.setIdentityPicFront(domain + memberCertification.getFrontPic());
}
if (StringUtil.isNotBlank(memberCertification.getBehindPic())) {
userInfo.setIdentityPicBack(domain + memberCertification.getBehindPic());
}
Map<Long, List<OrderItem>> pushOrders = new HashMap<>();
for (OrderItemDto dto : orderDto.getOrderItems()) {
if (dto.getProductSource() != null && dto.getProductSource().equals(ProductSource.KAOLA.name())) {
OrderItem item = new OrderItem(dto.getProductSn(), dto.getProductSkuSn(), dto.getProductQuantity(),
dto.getTotalPrice().subtract(dto.getPromotionAmount()).subtract(dto.getOrderPromotionAmount())
.divide(new BigDecimal(dto.getProductQuantity())).setScale(2, BigDecimal.ROUND_HALF_UP),
dto.getWarehouseId().toString());
if (pushOrders.get(dto.getWarehouseId()) == null) {
pushOrders.put(dto.getWarehouseId(), new ArrayList<OrderItem>());
}
pushOrders.get(dto.getWarehouseId()).add(item);
}
}
for (Map.Entry<Long, List<OrderItem>> entry : pushOrders.entrySet()) {
try {
if (pushOrders.entrySet().size() > 0) {
KaolaClient.getInstance().bookOrder(orderDto.getOrderSn() + "-" + entry.getKey(), userInfo,
entry.getValue());
}
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
}
}
private void orderRemindMQ(OrderDto orderDto, String seconds) {
Long delayTime = DateUtil.add(new Date(), Calendar.SECOND, Integer.parseInt(seconds)).getTime()
- System.currentTimeMillis() - 30 * 60 * 1000;
if (delayTime > 60 * 1000) {
Map<String, Object> map = new HashMap<>();
map.put("orderId", orderDto.getId());
map.put("minutes", 30);
MqEnum.ORDER_REMIND.send(map, delayTime / 1000);
}
}
/**
* 检验商品的状态和明细
*
* @param productSku
* @param product
* @param quantity
*/
private void checkQuantityAndStatus(ProductSku productSku, Product product, Integer quantity, String appTerminal,
String appVersion, OrderType orderType) {
// 当前商品下架或者删除, 不能下订单
if (product == null || product.getMark() <= 0) {
throw new BusinessException("商品已下架,购买不成功!");
}
// 当前商品下架或者删除, 不能下订单
if (productSku == null || productSku.getStatus() <= 0) {
throw new BusinessException("商品已下架,购买不成功!");
}
// 当前商品数量异常
if (quantity == null || quantity <= 0) {
throw new BusinessException("商品数量异常,购买不成功!");
}
// 当前没有销售的库存了, 不能下订单
if (productSku.getAvailableStore() < quantity) {
throw new BusinessException("款号:" + productSku.getInernalSn() + ",尺码:" + productSku.getSizeValue() + "颜色:"
+ productSku.getColorValue() + ",商品库存不足" + quantity + "件,下次早点来哦!");
}
// 当前没有销售的库存了, 不能下订单
if (orderType != null && (orderType.equals(OrderType.bargain) || orderType.equals(OrderType.collage))) {
if (productSku.getAvailableFlashStore() < quantity) {
throw new BusinessException("款号:" + productSku.getInernalSn() + ",尺码:" + productSku.getSizeValue()
+ "颜色:" + productSku.getColorValue() + ",商品库存不足" + quantity + "件,下次早点来哦!");
}
}
if (AppVersionConvert.convert(appTerminal, appVersion) > 0
&& AppVersionConvert.convert(appTerminal, appVersion) <= 3230) {
if (product.getProductTradeType().equals(ProductTradeType.CROSS.name())
|| product.getSource().equals(ProductSource.KAOLA.name())) {
throw new BusinessException("当前app版本暂不支持该商品购买,请在小程序购买或请将app升级到最新版本!");
}
}
}
/**
* 创建购物车
*
* @param product
* @param productSku
* @param member
* @param quantity
* @return
*/
protected CartItemDto createCartItemDto(Product product, ProductSku productSku, MemberInfo member, int quantity) {
CartItem cartItem = new CartItem(product, productSku, member);
cartItem.setId(0L);
cartItem.setQuantity(quantity);
cartItem.setPrice(productSku.getPrice());
CartItemDto cartItemDto = new CartItemDto();
BeanUtils.copyProperties(cartItem, cartItemDto);
cartItemDto.initCondition(product.getGoodPromotionId(), product.getOrderPromotionId(),
product.getFlashPromotionId(), productSku.getaPrice(), productSku.getFlashPrice(),
productSku.getAvailableFlashStore());
return cartItemDto;
}
/**
* 创建订单明细
*
* @param cartItemDto
* @param product
* @param productSku
* @param member
* @return
*/
protected OrderItemDto createOrderItemDto(CartItemDto cartItemDto, Product product, ProductSku productSku,
MemberInfo member) {
OrderItemDto orderItemDto = new OrderItemDto(product, cartItemDto);
orderItemDto.setProductSku(productSku);
orderItemDto.setDeliveryBarCode(productSku.getSn());
orderItemDto.setBuyerMemberId(member.getId());
orderItemDto.setBuyerMemberName(member.getLoginCode());
// 全局返利系数
Setting ratio = settingService.findByCode(Setting.REBATERATIO);
BigDecimal parentRatio = product.getFirstRatio().multiply(product.getGrossRatio());
BigDecimal partnerRatio = product.getSecondRatio().multiply(product.getGrossRatio());
String ratioValue = Setting.defaultValue(ratio, new Integer(1)).toString();
parentRatio = parentRatio.multiply(new BigDecimal(ratioValue)).setScale(2, BigDecimal.ROUND_HALF_UP);
partnerRatio = partnerRatio.multiply(new BigDecimal(ratioValue)).setScale(2, BigDecimal.ROUND_HALF_UP);
orderItemDto.setPartnerRatio(partnerRatio);
orderItemDto.setParentRatio(parentRatio);
orderItemDto.setSuperRatio(new BigDecimal(0.02));
orderItemDto.setMasterRatio(new BigDecimal(0.02));
return orderItemDto;
}
/**
* 是否是组合商品
*
* @param productCombId
* @return
*/
private boolean isComb(Long[] productCombId) {
return productCombId != null && productCombId.length > 0 && productCombId[0] > 0;
}
/**
* 是否是收税商品
*
* @param taxAmount
* @return
*/
private boolean isTax(BigDecimal[] taxAmount) {
return taxAmount != null && taxAmount.length > 0;
}
/**
* 是否是仓库商品
*
* @param warehouseId
* @param warehouseName
* @return
*/
private boolean isWarehouse(Long[] warehouseId, String[] warehouseName) {
return warehouseId != null && warehouseName != null && warehouseId.length > 0 && warehouseName.length > 0;
}
/**
* 活动优惠
*
* @param orderItems
* @param calResult
*/
protected void initPromotion(OrderDto orderDto, List<OrderItemDto> orderItems, PromotionCalculateResult calResult) {
orderDto.initPromotion(calResult);
for (OrderItemDto orderItem : orderItems) {
orderItem.setType(calResult.getType());
for (PromotionCalculateItem pi : calResult.getItems()) {
Long key = orderItem.getCartItemId();
if (key == null || key <= 0) {
key = orderItem.getProductSkuId();
}
if (key.equals(pi.getKey())) {
orderItem = orderItem.initPromotion(pi);
}
}
}
orderDto.setOrderItems(orderItems);
}
/**
* 优惠券优惠
*
* @param coupons
* @param orderDto
* @param tick
*/
protected void initCoupon(String coupons, OrderDto orderDto, boolean tick) {
orderDto.setCouponId(null);
orderDto.setCouponAmount(new BigDecimal(0));
if (StringUtils.isBlank(coupons) || !tick) {
return;
}
Coupon coupon = couponQueryService.findByCode(coupons, orderDto.getMemberId());
if (coupon == null || !coupon.getStatus().equals(CouponStatus.CLAIMED.name())) {
return;
}
Date now = new Date();
if (now.after(coupon.getExpireDate()) || now.before(coupon.getEnableDate())) {
return;
}
if (orderDto.getTotalAmount().intValue() < coupon.getNeedAmount()) {
return;
}
if (orderDto.getTotalAmount().compareTo(coupon.getCalAmount(orderDto.getTotalAmount())) < 0) {
return;
}
CouponDef couponDef = couponDefQueryService.findById(coupon.getDefineId());
List<OrderItemDto> initItems = this.checkValidItem(orderDto);
List<OrderItemDto> validItems = new ArrayList<>();
if (this.checkValidCoupon(orderDto, couponDef, initItems, validItems)) {
orderDto.setCouponId(coupon.getId());
orderDto.setCouponAmount(coupon.getCalAmount(orderDto.getTotalAmount()));
this.splitCoupon(validItems, orderDto.getCouponAmount());
}
}
/**
* 排除禁用的明细
*
* @param orderDto
* @return
*/
private List<OrderItemDto> checkValidItem(OrderDto orderDto) {
List<OrderItemDto> initItems = new ArrayList<>();
orderDto.getOrderItems().forEach(item -> {
if (item.getCoupon() == 1)
initItems.add(item);
});
return initItems;
}
/**
* 检查此券是否可用
*
* @param orderDto
* @param couponDef
* @param validItems
* @return
*/
private boolean checkValidCoupon(OrderDto orderDto, CouponDef couponDef, List<OrderItemDto> initItems,
List<OrderItemDto> validItems) {
boolean valid = false;
if (initItems == null || initItems.size() <= 0) {
return valid;
}
if (couponDef.getCheckAssociation().equals(Association.ALL.name())) {
validItems.addAll(initItems);
valid = true;
} else {
validItems.addAll(this.processValid(initItems, couponDef));
valid = this.processAmount(couponDef, orderDto.getTotalAmount().intValue(), validItems);
}
return valid;
}
/**
* 获取满足条件的明细
*/
private List<OrderItemDto> processValid(List<OrderItemDto> orderItems, CouponDef couponDef) {
List<Long> targetIds = new ArrayList<>();
if (couponDef.getCheckAssociation().equals(CouponRelationType.PRODUCT.name())) {
orderItems.forEach(item -> targetIds.add(item.getCouponProductId()));
} else if (couponDef.getCheckAssociation().equals(CouponRelationType.DESIGNER.name())) {
orderItems.forEach(item -> targetIds.add(item.getCouponShopId()));
}
List<CouponDefRelation> relations = couponDefRelationService.findByCidAndTids(targetIds, couponDef.getId(),
couponDef.getCheckAssociation());
Map<Long, Long> relMap = new HashMap<>();
for (CouponDefRelation relation : relations) {
relMap.put(relation.getTargetId(), relation.getCouponDefId());
}
List<OrderItemDto> validItems = new ArrayList<>();
for (int i = 0; i < orderItems.size(); i++) {
Long key = targetIds.get(i);
if (!couponDef.getExclude().booleanValue()) {
if (relMap.containsKey(key))
validItems.add(orderItems.get(i));
} else {
if (!relMap.containsKey(key))
validItems.add(orderItems.get(i));
}
}
return validItems;
}
/**
* 计算是否满足可用金额
*/
private boolean processAmount(CouponDef couponDef, int orderAmout, List<OrderItemDto> validItems) {
BigDecimal amout = new BigDecimal(0);
for (OrderItemDto oi : validItems) {
amout = amout.add(oi.getProductPrice().multiply(new BigDecimal(oi.getQuantity()))
.subtract(oi.getPromotionAmount()).subtract(oi.getOrderPromotionAmount()));
}
if (!amout.equals(new BigDecimal(0)) && amout.intValue() >= couponDef.getNeedAmount()
&& orderAmout >= couponDef.getNeedAmount()) {
return true;
}
return false;
}
/**
* 拆分优惠券
*
* @param validOrderItems
* @param couponAmount
*/
private void splitCoupon(List<OrderItemDto> validOrderItems, BigDecimal couponAmount) {
if (couponAmount.compareTo(new BigDecimal(0)) > 0) {
if (validOrderItems.size() == 1) {
OrderItemDto orderItem = validOrderItems.get(0);
// 只有一条,直接取,否则会出现小数点
orderItem.setCouponAmount(couponAmount);
} else {
// 计算所有可用商品的总金额
BigDecimal totalAmount = new BigDecimal(0);
for (int i = 0; i < validOrderItems.size(); i++) {
OrderItemDto orderItem = validOrderItems.get(i);
totalAmount = totalAmount.add(orderItem.getTotalPrice()
.subtract(orderItem.getOrderPromotionAmount()).subtract(orderItem.getPromotionAmount()));
}
// 计算所有可用商品的拆分金额
BigDecimal splitCouponPromotionAmount = new BigDecimal(0);
for (int i = 0; i < validOrderItems.size(); i++) {
OrderItemDto orderItem = validOrderItems.get(i);
if (i == validOrderItems.size() - 1) {
BigDecimal couponPromotionAmount = couponAmount.subtract(splitCouponPromotionAmount);
orderItem.setCouponAmount(couponPromotionAmount);
} else {
BigDecimal itemAmount = orderItem.getTotalPrice().subtract(orderItem.getPromotionAmount())
.subtract(orderItem.getOrderPromotionAmount());
BigDecimal ratePromotion = itemAmount.divide(totalAmount, 4, BigDecimal.ROUND_HALF_UP);
BigDecimal couponPromotionAmount = couponAmount.multiply(ratePromotion).setScale(0,
BigDecimal.ROUND_HALF_UP);
orderItem.setCouponAmount(couponPromotionAmount);
splitCouponPromotionAmount = splitCouponPromotionAmount.add(couponPromotionAmount);
}
}
}
}
}
/**
* 红包优惠
*
* @param redPacket
* @param orderDto
* @param memberInfo
* @param tick
*/
protected void initRedPacks(Integer redPacket, OrderDto orderDto, MemberInfo memberInfo, boolean tick) {
orderDto.setRedAmount(new BigDecimal(0));
Account account = accountService.findByMemberId(orderDto.getMemberId());
if (redPacket == null || redPacket == 0 || !tick) {
return;
}
if (account.getRedDate() != null && account.getRedDate().before(new Date())) {
return;
}
BigDecimal tempAmount = orderDto.getTotalAmount().subtract(orderDto.getCouponAmount());
if (tempAmount.compareTo(account.getRedAmount()) <= 0) {
orderDto.setRedAmount(orderDto.getTotalAmount().subtract(orderDto.getCouponAmount()));
} else {
orderDto.setRedAmount(account.getRedAmount());
}
this.splitRedPackets(orderDto.getOrderItems(), orderDto.getRedAmount());
}
/**
* 拆分红包金额
*
* @param orderItems
* @param redAmount
*/
private void splitRedPackets(List<OrderItemDto> orderItems, BigDecimal redAmount) {
if (redAmount.compareTo(new BigDecimal(0)) > 0) {
if (orderItems.size() == 1) {
OrderItemDto orderItem = orderItems.get(0);
// 只有一条,直接取,否则会出现小数点
orderItem.setRedAmount(redAmount);
} else {
// 计算所有可用商品的总金额
BigDecimal totalAmount = new BigDecimal(0);
for (int i = 0; i < orderItems.size(); i++) {
OrderItemDto orderItem = orderItems.get(i);
totalAmount = totalAmount.add(orderItem.getTotalPrice().subtract(orderItem.getPromotionAmount())
.subtract(orderItem.getOrderPromotionAmount()));
}
// 计算所有可用商品的拆分金额
BigDecimal splitRedAmount = new BigDecimal(0);
for (int i = 0; i < orderItems.size(); i++) {
OrderItemDto orderItem = orderItems.get(i);
if (i == orderItems.size() - 1) {
BigDecimal redPromotionAmount = redAmount.subtract(splitRedAmount);
orderItem.setRedAmount(redPromotionAmount);
} else {
BigDecimal itemAmount = orderItem.getTotalPrice().subtract(orderItem.getPromotionAmount())
.subtract(orderItem.getOrderPromotionAmount());
BigDecimal ratePromotion = itemAmount.divide(totalAmount, 4, BigDecimal.ROUND_HALF_UP);
BigDecimal redPromotionAmount = redAmount.multiply(ratePromotion).setScale(0,
BigDecimal.ROUND_HALF_UP);
orderItem.setRedAmount(redPromotionAmount);
splitRedAmount = splitRedAmount.add(redPromotionAmount);
}
}
}
}
}
/**
* 设置D+店信息
*
* @param orderDto
* @param memberInfo
*/
protected void initDPlus(OrderDto orderDto, MemberInfo memberInfo) {
Store store = storeService.findById(memberInfo.getStoreId());
if (store != null && store.getBusType().equals(BusTypeEnum.DPLUS.name())) {
for (OrderItemDto item : orderDto.getOrderItems()) {
item.setDplusId(store.getId());
item.setDplusCode(store.getCode());
item.setDplusName(store.getName());
}
}
}
/**
* 购物车删除
*
* @param cart
* @param skuId
* @return
*/
private List<Long> structCartItemIds(Cart cart, Long[] skuId) {
List<Long> cartItemIds = new ArrayList<>();
if (cart != null && cart.getItemMapBySku() != null) {
for (int i = 0; i < skuId.length; i++) {
CartItemDto oldCartItem = cart.getItemMapBySku().get(skuId[i]);
if (oldCartItem != null) {
cartItemIds.add(oldCartItem.getId());
}
}
}
return cartItemIds;
}
/**
* 优惠券处理
*
* @param coupons
* @return
*/
private JSONArray couponJson(List<Coupon> coupons) {
JSONArray array = new JSONArray();
if (coupons != null && coupons.size() > 0) {
coupons.forEach(item -> array.add(item.toJson()));
}
return array;
}
/**
* 订单处理
*
* @param order
* @return
*/
private JSONObject orderJson(OrderDto order) {
JSONObject obj = order.toJson();
JSONArray items = new JSONArray();
order.getOrderItems().forEach(item -> items.add(item.toJson()));
obj.put("items", items);
return obj;
}
}
| [
"vicleo566@163.com"
] | vicleo566@163.com |
88f39adbeacea0389476d1eb63afdc9c83077025 | 8b955dad9e6e2b26a4a8e069369340a66545b512 | /src/main/java/com/hike/kafkaconsumer/config/Services.java | b1f31e53d5058651aaa07f1fd11c517b56c0370d | [] | no_license | sisingh/DropwizardKakfaConsumer | 3b74eafeffcb3fb4856cca55f31f1bd3663367d9 | 59f39fcdd24f060ff74f678087c9b060b0bf5da2 | refs/heads/master | 2021-01-15T18:40:54.782491 | 2017-08-10T13:14:58 | 2017-08-10T13:14:58 | 99,797,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package com.hike.kafkaconsumer.config;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* @author siddharthasingh
*/
public class Services {
@JsonProperty("database")
private Boolean database;
@JsonProperty("kafkaConsumer")
private Boolean kafkaConsumer;
public Boolean getDatabase() {
return database;
}
public void setDatabase(Boolean database) {
this.database = database;
}
public Boolean getKafkaConsumer() {
return kafkaConsumer;
}
public void setKafkaConsumer(Boolean kafkaConsumer) {
this.kafkaConsumer = kafkaConsumer;
}
}
| [
"siddhartha@hike.in"
] | siddhartha@hike.in |
4672ecbe481063a39e7fab05ffdd5e95f25342fd | 6eb04a4bf3d88459a0e77b17c830b7a41ed9c624 | /Week4/day2/AssignDrop.java | f12250bdaf0aa128601fd88af05ce3191f1c5baa | [] | no_license | Haritestleaf/Week4 | a464feb57738cc7bbb7dfc4aa9493ab5c28668a6 | f0e1704137fc5e2c0dbe4cb427df68d83af66b72 | refs/heads/main | 2023-07-18T09:45:32.839390 | 2021-09-03T09:06:49 | 2021-09-03T09:06:49 | 402,707,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package Week4.day2;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import io.github.bonigarcia.wdm.WebDriverManager;
public class AssignDrop {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
ChromeDriver driver = new ChromeDriver();
driver.get("http://www.leafground.com/pages/drop.html");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
WebElement drag = driver.findElement(By.xpath("//div[@id='draggable']"));
WebElement drop = driver.findElement(By.xpath("//div[@id='droppable']"));
Actions builder = new Actions(driver);
builder.dragAndDrop(drag, drop).perform();
}
}
| [
"noreply@github.com"
] | Haritestleaf.noreply@github.com |
f0afd7aa586e4de4f9a527fc6c1c102b6fb7cc54 | ca9f992d188e84dab080919916d0614c4b87f4a6 | /src/java/com/kiteapp/model/shoppingCart.java | da73ab41da7118543cbdae43ae3a04f60dcbcad9 | [] | no_license | Aarondavin3/Web-Development | 891a1089254e9792a64c994dcc0c117c887432b9 | 3b282bcea0dd12a33147ffebceaf46b726ee7a6c | refs/heads/master | 2020-09-13T10:45:06.147107 | 2020-01-15T19:45:09 | 2020-01-15T19:45:09 | 222,746,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,428 | 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.kiteapp.model;
import java.io.Serializable;
import java.util.ArrayList;
/**
*
* @author adavi
*/
public class shoppingCart implements Serializable {
private ArrayList<cartItem> items;
public shoppingCart(){
items = new ArrayList<cartItem>();
}
public ArrayList<cartItem> getItems() {
return items;
}
public int getCount() {
return items.size();
}
public void addItem(cartItem item){
int kiteID = item.getKite().getKiteID();
int quantity = item.getQuantity();
for(cartItem cartItem : items){
if(cartItem.getKite().getKiteID() == kiteID){
cartItem.setQuantity(quantity);
return;
}
items.add(item);
}
}
public void removeItem(cartItem item) {
int kiteID = item.getKite().getKiteID();
for (int i = 0; i < items.size(); i++){
cartItem cartItem = items.get(i);
if(cartItem.getKite().getKiteID() == kiteID){
items.remove(i);
return;
}
}
}
}
| [
"adavi@192.168.1.21"
] | adavi@192.168.1.21 |
89a5b5a9efc48d84a9467e21502b771a8edead6b | fe1ee556fb8fff262336eaaecc5c6cb30c805e67 | /src/main/java/com/eva/ui/profile/staff/view/LeaveInfoDisplay.java | 7e1ca0adc2bed36efe7d250c3e3226f90b03324a | [
"MIT"
] | permissive | AY2021S1-CS2103T-W13-1/tp | 9cec3340988934345edad74053ef2e10164a7b1d | 75c53893a54b059b9f271f39146b02617354f7c5 | refs/heads/master | 2023-01-18T23:29:19.203796 | 2020-11-13T15:09:31 | 2020-11-13T15:09:31 | 293,289,659 | 2 | 5 | NOASSERTION | 2020-11-13T02:23:05 | 2020-09-06T14:07:54 | Java | UTF-8 | Java | false | false | 1,685 | java | package com.eva.ui.profile.staff.view;
import com.eva.model.person.staff.leave.Leave;
import com.eva.model.person.staff.leave.LeaveTaken;
import com.eva.ui.UiPart;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.layout.Region;
/**
* A UI component that displays the list of leaves.
*/
public class LeaveInfoDisplay extends UiPart<Region> {
private static final String FXML = "LeaveInfoDisplay.fxml";
private static final String DISPLAY_NAME = "Leaves";
@FXML
private ListView<Leave> leaveListView;
@FXML
private Label leavesTaken;
@FXML
private Label display;
/**
* Creates a {@code LeaveInfoDisplay} with the given {@code ObservableList}.
*/
LeaveInfoDisplay(ObservableList<Leave> leaves, LeaveTaken leaveTaken) {
super(FXML);
leaveListView.setItems(leaves);
leaveListView.setCellFactory(listView -> new LeaveListViewCell());
leavesTaken.setText(leaveTaken.toString());
display.setText(DISPLAY_NAME);
}
/**
* Custom {@code ListCell} that displays the graphics of a {@code Leave} using a {@code LeaveInfoCard}.
*/
class LeaveListViewCell extends ListCell<Leave> {
@Override
protected void updateItem(Leave leave, boolean empty) {
super.updateItem(leave, empty);
if (empty || leave == null) {
setGraphic(null);
setText(null);
} else {
setGraphic(new LeaveInfoCard(leave).getRoot());
}
}
}
}
| [
"56751879+Ben-Hanan@users.noreply.github.com"
] | 56751879+Ben-Hanan@users.noreply.github.com |
de9caa2cfa1e9f28da65f01352de8fd7c357c406 | 3e0bbfa3f4837b38ab91d0575c340830bf7a3d19 | /CriminalIntent/src/com/bignerdranch/android/criminalintent/CrimePagerActivity.java | b9a9bc7adc34feb2299d85aa60f6946a376a9e3c | [] | no_license | grpp/CriminalIntent | 6eeb2323163fda6f137a0865af9c3bdfe5c2cb9f | 7e4ec959a11a20bfb316bd3d6e92d944973ef983 | refs/heads/master | 2020-05-31T18:41:31.827004 | 2014-09-02T21:44:39 | 2014-09-02T21:44:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,094 | java | package com.bignerdranch.android.criminalintent;
import java.util.ArrayList;
import java.util.UUID;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
public class CrimePagerActivity extends FragmentActivity
implements CrimeFragment.Callbacks {
private ViewPager mViewPager;
private ArrayList<Crime> mCrimes;
public void onCrimeUpdated(Crime crime){
}
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
mViewPager = new ViewPager(this);
mViewPager.setId(R.id.viewPager);
setContentView(mViewPager);
mCrimes = CrimeLab.get(this).getCrimes();
FragmentManager fm = getSupportFragmentManager();
mViewPager.setAdapter(new FragmentStatePagerAdapter(fm){
@Override
public int getCount(){
return mCrimes.size();
}
@Override
public Fragment getItem(int pos){
Crime crime = mCrimes.get(pos);
return CrimeFragment.newInstance(crime.getId());
}
});
UUID crimeId = (UUID)getIntent().getSerializableExtra(CrimeFragment.EXTRA_CRIME_ID);
for(int i = 0; i< mCrimes.size(); i++){
if(mCrimes.get(i).getId().equals(crimeId)){
mViewPager.setCurrentItem(i);
setTitle(mCrimes.get(i).getTitle());
break;
}
}
mViewPager.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageSelected(int pos) {
Crime crime = mCrimes.get(pos);
if(crime.getTitle() != null){
setTitle(crime.getTitle());
}
}
@Override
public void onPageScrolled(int pos, float posOffset, int posOffsetPixels) {
// TODO Auto-generated method stub
}
@Override
public void onPageScrollStateChanged(int state) {
// TODO Auto-generated method stub
}
});
}
}
| [
"nat_hanlaw@hotmail.com"
] | nat_hanlaw@hotmail.com |
d4eb7d8318eab06b36fb422525e35dd582f80820 | 45a7e138de4f6bb9b15f68fc428058eaca42deb9 | /isell-order-web/src/main/java/com/le/isell/web/OrderController.java | aec37ce7692800ced1c26b097c025f36cfc2ea45 | [] | no_license | wallxu/Sell | 95f36637a6aa719b213cb34c356723222dd92857 | 3cff2758cc9d4bf0ad19fbb7ac8687dc86fde238 | refs/heads/master | 2020-03-14T22:10:05.024256 | 2018-05-11T04:00:35 | 2018-05-11T04:00:35 | 131,815,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,466 | java | package com.le.isell.web;
import com.le.isell.entity.OrderModel;
import com.le.isell.entity.OrderQueryModel;
import com.le.isell.service.OrderService;
import com.le.isell.util.json.JsonHelper;
import com.le.isell.util.pageutil.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping(value="/order")
public class OrderController {
@Autowired
private OrderService iservice = null;
@RequestMapping(value="toAdd",method=RequestMethod.GET)
public String toAdd(){
return "order/add";
}
@RequestMapping(value="add",method=RequestMethod.POST)
public String add(@ModelAttribute("m") OrderModel m){
iservice.create(m);
return "order/success";
}
@RequestMapping(value="toUpdate/{uuid}",method=RequestMethod.GET)
public String toUpdate(Model model,@PathVariable("uuid") int uuid){
OrderModel m = iservice.getByUuid(uuid);
model.addAttribute("m", m);
return "order/update";
}
@RequestMapping(value="update",method=RequestMethod.POST)
public String post(@ModelAttribute("m") OrderModel m){
iservice.update(m);
return "order/success";
}
@RequestMapping(value="toDelete/{uuid}",method=RequestMethod.GET)
public String toDelete(Model model,@PathVariable("uuid") int uuid){
OrderModel m = iservice.getByUuid(uuid);
model.addAttribute("m", m);
return "order/delete";
}
@RequestMapping(value="delete",method=RequestMethod.POST)
public String post(@RequestParam("uuid") int uuid){
iservice.delete(uuid);
return "order/success";
}
@RequestMapping(value="toList",method=RequestMethod.GET)
public String toList(@ModelAttribute("wm")OrderWebModel wm,Model model){
OrderQueryModel qm = null;
if(wm.getQueryJsonStr()==null || wm.getQueryJsonStr().trim().length()==0){
qm = new OrderQueryModel();
}else{
String s = wm.getQueryJsonStr();
s = s.replace("-", "%");
qm = (OrderQueryModel)JsonHelper.str2Object(s, OrderQueryModel.class);
}
qm.getPage().setNowPage(wm.getNowPage());
if(wm.getPageShow() > 0){
qm.getPage().setPageShow(wm.getPageShow());
}
Page dbPage = iservice.getByConditionPage(qm);
//
model.addAttribute("wm", wm);
model.addAttribute("page", dbPage);
return "order/list";
}
@RequestMapping(value="toQuery",method=RequestMethod.GET)
public String toQuery(){
return "order/query";
}
}
| [
"532357520@qq.com"
] | 532357520@qq.com |
4780aeee08f553016fb64d7e7ae3c37ffd8ab2e1 | ae78ba042a525d963157d12aff18860e11ee8b76 | /Course.java | 0e345271346fc69f525559254a7f85813a37221e | [] | no_license | fatih-demirci/hrms | 45efc2e381c20c4d42fa29755a447c6eaa663374 | fd97dd830a52320c2ae180fe49f76d4ba6238ec9 | refs/heads/main | 2023-07-03T10:25:07.469985 | 2021-04-29T17:40:14 | 2021-04-29T17:40:14 | 361,775,468 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,617 | java | package kodlamaioop;
public class Course {
private int id;
private String image;
private String title;
private String description;
private Educator educator;
private double price;
private int complated;
public Course(int id, String image, String title, String description, Educator educator, double price) {
this.id = id;
this.image = image;
this.title = title;
this.description = description;
this.educator = educator;
this.price = price;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Educator getEducator() {
return educator;
}
public void setEducator(Educator educator) {
this.educator = educator;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getComplated() {
return complated;
}
public void setComplated(int complated) {
this.complated = complated;
}
}
| [
"noreply@github.com"
] | fatih-demirci.noreply@github.com |
5b9dd88da135371493fa04d6c495baf18b058b41 | 41f79b1c6ef0c793914d99a55b3805f39e3ea8e3 | /src/org/broad/igv/ui/TrackFilterElement.java | f48a0c53f4f31172abd8d1450131300b8fd0cc5e | [
"MIT",
"LGPL-2.1-or-later",
"LGPL-2.1-only"
] | permissive | nrgene/NRGene-IGV | 35bf50a07341ff0bf26eabbea55d10e8fa9fcdd0 | 4ac9ffcd6f9fcbe318e9e85d9820783afbabf5fc | refs/heads/master | 2023-09-02T12:48:20.171109 | 2021-02-03T10:26:44 | 2021-02-03T10:26:44 | 162,590,091 | 2 | 1 | MIT | 2023-08-16T11:47:31 | 2018-12-20T14:26:46 | Java | UTF-8 | Java | false | false | 2,533 | java | /*
* Copyright (c) 2007-2011 by The Broad Institute of MIT and Harvard. All Rights Reserved.
*
* This software is licensed under the terms of the GNU Lesser General Public License (LGPL),
* Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php.
*
* THE SOFTWARE IS PROVIDED "AS IS." THE BROAD AND MIT MAKE NO REPRESENTATIONS OR
* WARRANTES OF ANY KIND CONCERNING THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER
* OR NOT DISCOVERABLE. IN NO EVENT SHALL THE BROAD OR MIT, OR THEIR RESPECTIVE
* TRUSTEES, DIRECTORS, OFFICERS, EMPLOYEES, AND AFFILIATES BE LIABLE FOR ANY DAMAGES
* OF ANY KIND, INCLUDING, WITHOUT LIMITATION, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
* ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER
* THE BROAD OR MIT SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT
* SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.broad.igv.ui;
import org.broad.igv.track.AttributeManager;
import org.broad.igv.track.Track;
import org.broad.igv.util.FilterElement;
/**
* @author eflakes
*/
public class TrackFilterElement extends FilterElement {
public TrackFilterElement(TrackFilter filter, String stringRepresetation) {
super(filter, stringRepresetation.split(":")[0],
Operator.valueOf(stringRepresetation.split(":")[1]),
stringRepresetation.split(":")[2],
BooleanOperator.valueOf(stringRepresetation.split(":")[3]));
}
public TrackFilterElement(TrackFilter filter, String item,
Operator comparisonOperator, String value,
BooleanOperator booleanOperator) {
super(filter, item, comparisonOperator, value, booleanOperator);
}
public boolean evaluate(Track track, Boolean previousResult) {
String attributeKey = getSelectedItem();
String attribute = track.getAttributeValue(attributeKey);
return super.test(attribute, previousResult);
}
public boolean evaluate(String trackId, Boolean previousResult) {
String attributeKey = getSelectedItem();
String attribute = AttributeManager.getInstance().getAttribute(trackId, attributeKey);
return super.test(attribute, previousResult);
}
}
| [
"kiril@ubuntu.nrgene.local"
] | kiril@ubuntu.nrgene.local |
084ff737ac7a76918a9201ca3bd8d3400d95d750 | 55c6872b8391e0e6e8cf7c247a923f1c29f3fd52 | /order/src/main/java/com/advantage/order/store/config/AppSecurityConfig.java | 2c7a6cc1dbca0b2da605cf901d9c20930148883d | [] | no_license | Goose1451/aos_source | c39ef24aecc05bd536e249978b2c82f42928e153 | dd69fb71b143350bef8739cb3cfaa1981df796ee | refs/heads/master | 2023-07-14T23:06:19.594856 | 2021-08-23T14:52:33 | 2021-08-23T14:52:33 | 139,631,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 769 | java | package com.advantage.order.store.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import javax.sql.DataSource;
@Configuration
@EnableWebSecurity
public class AppSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
DataSource dataSource;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().permitAll();
}
}
| [
"evgeney.fiskin@hpe.com"
] | evgeney.fiskin@hpe.com |
75ae43a64b481d94f9da81a18ad72ec824e885e5 | 49a4a105befa9b16f9f8e958d846b1fe7f40f32c | /semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java | 67ae90e04de9f54341be8f7f761d38e30483ad86 | [
"Apache-2.0"
] | permissive | sfriberg/opentelemetry-java | 84e1953e36b2feba45c5efa17434b6bd45c17ac0 | 2ef73c83af9331dfbfd8b4a16b9d763e98175eab | refs/heads/main | 2023-03-15T18:08:58.316312 | 2022-07-21T14:41:43 | 2022-07-21T14:41:43 | 222,983,258 | 0 | 0 | Apache-2.0 | 2022-07-11T14:07:19 | 2019-11-20T16:42:26 | Java | UTF-8 | Java | false | false | 30,253 | java | /*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.semconv.resource.attributes;
import static io.opentelemetry.api.common.AttributeKey.longKey;
import static io.opentelemetry.api.common.AttributeKey.stringArrayKey;
import static io.opentelemetry.api.common.AttributeKey.stringKey;
import io.opentelemetry.api.common.AttributeKey;
import java.util.List;
// DO NOT EDIT, this is an Auto-generated file from
// buildscripts/semantic-convention/templates/SemanticAttributes.java.j2
public final class ResourceAttributes {
/** The URL of the OpenTelemetry schema for these keys and values. */
public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.9.0";
/** Name of the cloud provider. */
public static final AttributeKey<String> CLOUD_PROVIDER = stringKey("cloud.provider");
/** The cloud account ID the resource is assigned to. */
public static final AttributeKey<String> CLOUD_ACCOUNT_ID = stringKey("cloud.account.id");
/**
* The geographical region the resource is running.
*
* <p>Notes:
*
* <ul>
* <li>Refer to your provider's docs to see the available regions, for example <a
* href="https://www.alibabacloud.com/help/doc-detail/40654.htm">Alibaba Cloud regions</a>,
* <a href="https://aws.amazon.com/about-aws/global-infrastructure/regions_az/">AWS
* regions</a>, <a
* href="https://azure.microsoft.com/en-us/global-infrastructure/geographies/">Azure
* regions</a>, <a href="https://cloud.google.com/about/locations">Google Cloud regions</a>,
* or <a href="https://intl.cloud.tencent.com/document/product/213/6091">Tencent Cloud
* regions</a>.
* </ul>
*/
public static final AttributeKey<String> CLOUD_REGION = stringKey("cloud.region");
/**
* Cloud regions often have multiple, isolated locations known as zones to increase availability.
* Availability zone represents the zone where the resource is running.
*
* <p>Notes:
*
* <ul>
* <li>Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
* </ul>
*/
public static final AttributeKey<String> CLOUD_AVAILABILITY_ZONE =
stringKey("cloud.availability_zone");
/**
* The cloud platform in use.
*
* <p>Notes:
*
* <ul>
* <li>The prefix of the service SHOULD match the one specified in {@code cloud.provider}.
* </ul>
*/
public static final AttributeKey<String> CLOUD_PLATFORM = stringKey("cloud.platform");
/**
* The Amazon Resource Name (ARN) of an <a
* href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html">ECS
* container instance</a>.
*/
public static final AttributeKey<String> AWS_ECS_CONTAINER_ARN =
stringKey("aws.ecs.container.arn");
/**
* The ARN of an <a
* href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html">ECS
* cluster</a>.
*/
public static final AttributeKey<String> AWS_ECS_CLUSTER_ARN = stringKey("aws.ecs.cluster.arn");
/**
* The <a
* href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html">launch
* type</a> for an ECS task.
*/
public static final AttributeKey<String> AWS_ECS_LAUNCHTYPE = stringKey("aws.ecs.launchtype");
/**
* The ARN of an <a
* href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html">ECS
* task definition</a>.
*/
public static final AttributeKey<String> AWS_ECS_TASK_ARN = stringKey("aws.ecs.task.arn");
/** The task definition family this task definition is a member of. */
public static final AttributeKey<String> AWS_ECS_TASK_FAMILY = stringKey("aws.ecs.task.family");
/** The revision for this task definition. */
public static final AttributeKey<String> AWS_ECS_TASK_REVISION =
stringKey("aws.ecs.task.revision");
/** The ARN of an EKS cluster. */
public static final AttributeKey<String> AWS_EKS_CLUSTER_ARN = stringKey("aws.eks.cluster.arn");
/**
* The name(s) of the AWS log group(s) an application is writing to.
*
* <p>Notes:
*
* <ul>
* <li>Multiple log groups must be supported for cases like multi-container applications, where
* a single application has sidecar containers, and each write to their own log group.
* </ul>
*/
public static final AttributeKey<List<String>> AWS_LOG_GROUP_NAMES =
stringArrayKey("aws.log.group.names");
/**
* The Amazon Resource Name(s) (ARN) of the AWS log group(s).
*
* <p>Notes:
*
* <ul>
* <li>See the <a
* href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format">log
* group ARN format documentation</a>.
* </ul>
*/
public static final AttributeKey<List<String>> AWS_LOG_GROUP_ARNS =
stringArrayKey("aws.log.group.arns");
/** The name(s) of the AWS log stream(s) an application is writing to. */
public static final AttributeKey<List<String>> AWS_LOG_STREAM_NAMES =
stringArrayKey("aws.log.stream.names");
/**
* The ARN(s) of the AWS log stream(s).
*
* <p>Notes:
*
* <ul>
* <li>See the <a
* href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format">log
* stream ARN format documentation</a>. One log group can contain several log streams, so
* these ARNs necessarily identify both a log group and a log stream.
* </ul>
*/
public static final AttributeKey<List<String>> AWS_LOG_STREAM_ARNS =
stringArrayKey("aws.log.stream.arns");
/** Container name used by container runtime. */
public static final AttributeKey<String> CONTAINER_NAME = stringKey("container.name");
/**
* Container ID. Usually a UUID, as for example used to <a
* href="https://docs.docker.com/engine/reference/run/#container-identification">identify Docker
* containers</a>. The UUID might be abbreviated.
*/
public static final AttributeKey<String> CONTAINER_ID = stringKey("container.id");
/** The container runtime managing this container. */
public static final AttributeKey<String> CONTAINER_RUNTIME = stringKey("container.runtime");
/** Name of the image the container was built on. */
public static final AttributeKey<String> CONTAINER_IMAGE_NAME = stringKey("container.image.name");
/** Container image tag. */
public static final AttributeKey<String> CONTAINER_IMAGE_TAG = stringKey("container.image.tag");
/**
* Name of the <a href="https://en.wikipedia.org/wiki/Deployment_environment">deployment
* environment</a> (aka deployment tier).
*/
public static final AttributeKey<String> DEPLOYMENT_ENVIRONMENT =
stringKey("deployment.environment");
/**
* A unique identifier representing the device
*
* <p>Notes:
*
* <ul>
* <li>The device identifier MUST only be defined using the values outlined below. This value is
* not an advertising identifier and MUST NOT be used as such. On iOS (Swift or
* Objective-C), this value MUST be equal to the <a
* href="https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor">vendor
* identifier</a>. On Android (Java or Kotlin), this value MUST be equal to the Firebase
* Installation ID or a globally unique UUID which is persisted across sessions in your
* application. More information can be found <a
* href="https://developer.android.com/training/articles/user-data-ids">here</a> on best
* practices and exact implementation details. Caution should be taken when storing personal
* data or anything which can identify a user. GDPR and data protection laws may apply,
* ensure you do your own due diligence.
* </ul>
*/
public static final AttributeKey<String> DEVICE_ID = stringKey("device.id");
/**
* The model identifier for the device
*
* <p>Notes:
*
* <ul>
* <li>It's recommended this value represents a machine readable version of the model identifier
* rather than the market or consumer-friendly name of the device.
* </ul>
*/
public static final AttributeKey<String> DEVICE_MODEL_IDENTIFIER =
stringKey("device.model.identifier");
/**
* The marketing name for the device model
*
* <p>Notes:
*
* <ul>
* <li>It's recommended this value represents a human readable version of the device model
* rather than a machine readable alternative.
* </ul>
*/
public static final AttributeKey<String> DEVICE_MODEL_NAME = stringKey("device.model.name");
/**
* The name of the device manufacturer
*
* <p>Notes:
*
* <ul>
* <li>The Android OS provides this field via <a
* href="https://developer.android.com/reference/android/os/Build#MANUFACTURER">Build</a>.
* iOS apps SHOULD hardcode the value {@code Apple}.
* </ul>
*/
public static final AttributeKey<String> DEVICE_MANUFACTURER = stringKey("device.manufacturer");
/**
* The name of the single function that this runtime instance executes.
*
* <p>Notes:
*
* <ul>
* <li>This is the name of the function as configured/deployed on the FaaS platform and is
* usually different from the name of the callback function (which may be stored in the <a
* href="../../trace/semantic_conventions/span-general.md#source-code-attributes">{@code
* code.namespace}/{@code code.function}</a> span attributes).
* </ul>
*/
public static final AttributeKey<String> FAAS_NAME = stringKey("faas.name");
/**
* The unique ID of the single function that this runtime instance executes.
*
* <p>Notes:
*
* <ul>
* <li>Depending on the cloud provider, use:
* <li><strong>AWS Lambda:</strong> The function <a
* href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a>.
* <li>Take care not to use the "invoked ARN" directly but replace any <a
* href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html">alias
* suffix</a> with the resolved function version, as the same runtime instance may be
* invokable with multiple different aliases.
* <li><strong>GCP:</strong> The <a
* href="https://cloud.google.com/iam/docs/full-resource-names">URI of the resource</a>
* <li><strong>Azure:</strong> The <a
* href="https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id">Fully
* Qualified Resource ID</a>.
* <li>On some providers, it may not be possible to determine the full ID at startup, which is
* why this field cannot be made required. For example, on AWS the account ID part of the
* ARN is not available without calling another AWS API which may be deemed too slow for a
* short-running lambda function. As an alternative, consider setting {@code faas.id} as a
* span attribute instead.
* </ul>
*/
public static final AttributeKey<String> FAAS_ID = stringKey("faas.id");
/**
* The immutable version of the function being executed.
*
* <p>Notes:
*
* <ul>
* <li>Depending on the cloud provider and platform, use:
* <li><strong>AWS Lambda:</strong> The <a
* href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html">function
* version</a> (an integer represented as a decimal string).
* <li><strong>Google Cloud Run:</strong> The <a
* href="https://cloud.google.com/run/docs/managing/revisions">revision</a> (i.e., the
* function name plus the revision suffix).
* <li><strong>Google Cloud Functions:</strong> The value of the <a
* href="https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically">{@code
* K_REVISION} environment variable</a>.
* <li><strong>Azure Functions:</strong> Not applicable. Do not set this attribute.
* </ul>
*/
public static final AttributeKey<String> FAAS_VERSION = stringKey("faas.version");
/**
* The execution environment ID as a string, that will be potentially reused for other invocations
* to the same function/function version.
*
* <p>Notes:
*
* <ul>
* <li><strong>AWS Lambda:</strong> Use the (full) log stream name.
* </ul>
*/
public static final AttributeKey<String> FAAS_INSTANCE = stringKey("faas.instance");
/**
* The amount of memory available to the serverless function in MiB.
*
* <p>Notes:
*
* <ul>
* <li>It's recommended to set this attribute since e.g. too little memory can easily stop a
* Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable
* {@code AWS_LAMBDA_FUNCTION_MEMORY_SIZE} provides this information.
* </ul>
*/
public static final AttributeKey<Long> FAAS_MAX_MEMORY = longKey("faas.max_memory");
/** Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. */
public static final AttributeKey<String> HOST_ID = stringKey("host.id");
/**
* Name of the host. On Unix systems, it may contain what the hostname command returns, or the
* fully qualified hostname, or another name specified by the user.
*/
public static final AttributeKey<String> HOST_NAME = stringKey("host.name");
/** Type of host. For Cloud, this must be the machine type. */
public static final AttributeKey<String> HOST_TYPE = stringKey("host.type");
/** The CPU architecture the host system is running on. */
public static final AttributeKey<String> HOST_ARCH = stringKey("host.arch");
/** Name of the VM image or OS install the host was instantiated from. */
public static final AttributeKey<String> HOST_IMAGE_NAME = stringKey("host.image.name");
/** VM image ID. For Cloud, this value is from the provider. */
public static final AttributeKey<String> HOST_IMAGE_ID = stringKey("host.image.id");
/**
* The version string of the VM image as defined in <a href="README.md#version-attributes">Version
* Attributes</a>.
*/
public static final AttributeKey<String> HOST_IMAGE_VERSION = stringKey("host.image.version");
/** The name of the cluster. */
public static final AttributeKey<String> K8S_CLUSTER_NAME = stringKey("k8s.cluster.name");
/** The name of the Node. */
public static final AttributeKey<String> K8S_NODE_NAME = stringKey("k8s.node.name");
/** The UID of the Node. */
public static final AttributeKey<String> K8S_NODE_UID = stringKey("k8s.node.uid");
/** The name of the namespace that the pod is running in. */
public static final AttributeKey<String> K8S_NAMESPACE_NAME = stringKey("k8s.namespace.name");
/** The UID of the Pod. */
public static final AttributeKey<String> K8S_POD_UID = stringKey("k8s.pod.uid");
/** The name of the Pod. */
public static final AttributeKey<String> K8S_POD_NAME = stringKey("k8s.pod.name");
/**
* The name of the Container from Pod specification, must be unique within a Pod. Container
* runtime usually uses different globally unique name ({@code container.name}).
*/
public static final AttributeKey<String> K8S_CONTAINER_NAME = stringKey("k8s.container.name");
/**
* Number of times the container was restarted. This attribute can be used to identify a
* particular container (running or stopped) within a container spec.
*/
public static final AttributeKey<Long> K8S_CONTAINER_RESTART_COUNT =
longKey("k8s.container.restart_count");
/** The UID of the ReplicaSet. */
public static final AttributeKey<String> K8S_REPLICASET_UID = stringKey("k8s.replicaset.uid");
/** The name of the ReplicaSet. */
public static final AttributeKey<String> K8S_REPLICASET_NAME = stringKey("k8s.replicaset.name");
/** The UID of the Deployment. */
public static final AttributeKey<String> K8S_DEPLOYMENT_UID = stringKey("k8s.deployment.uid");
/** The name of the Deployment. */
public static final AttributeKey<String> K8S_DEPLOYMENT_NAME = stringKey("k8s.deployment.name");
/** The UID of the StatefulSet. */
public static final AttributeKey<String> K8S_STATEFULSET_UID = stringKey("k8s.statefulset.uid");
/** The name of the StatefulSet. */
public static final AttributeKey<String> K8S_STATEFULSET_NAME = stringKey("k8s.statefulset.name");
/** The UID of the DaemonSet. */
public static final AttributeKey<String> K8S_DAEMONSET_UID = stringKey("k8s.daemonset.uid");
/** The name of the DaemonSet. */
public static final AttributeKey<String> K8S_DAEMONSET_NAME = stringKey("k8s.daemonset.name");
/** The UID of the Job. */
public static final AttributeKey<String> K8S_JOB_UID = stringKey("k8s.job.uid");
/** The name of the Job. */
public static final AttributeKey<String> K8S_JOB_NAME = stringKey("k8s.job.name");
/** The UID of the CronJob. */
public static final AttributeKey<String> K8S_CRONJOB_UID = stringKey("k8s.cronjob.uid");
/** The name of the CronJob. */
public static final AttributeKey<String> K8S_CRONJOB_NAME = stringKey("k8s.cronjob.name");
/** The operating system type. */
public static final AttributeKey<String> OS_TYPE = stringKey("os.type");
/**
* Human readable (not intended to be parsed) OS version information, like e.g. reported by {@code
* ver} or {@code lsb_release -a} commands.
*/
public static final AttributeKey<String> OS_DESCRIPTION = stringKey("os.description");
/** Human readable operating system name. */
public static final AttributeKey<String> OS_NAME = stringKey("os.name");
/**
* The version string of the operating system as defined in <a
* href="../../resource/semantic_conventions/README.md#version-attributes">Version Attributes</a>.
*/
public static final AttributeKey<String> OS_VERSION = stringKey("os.version");
/** Process identifier (PID). */
public static final AttributeKey<Long> PROCESS_PID = longKey("process.pid");
/**
* The name of the process executable. On Linux based systems, can be set to the {@code Name} in
* {@code proc/[pid]/status}. On Windows, can be set to the base name of {@code
* GetProcessImageFileNameW}.
*/
public static final AttributeKey<String> PROCESS_EXECUTABLE_NAME =
stringKey("process.executable.name");
/**
* The full path to the process executable. On Linux based systems, can be set to the target of
* {@code proc/[pid]/exe}. On Windows, can be set to the result of {@code
* GetProcessImageFileNameW}.
*/
public static final AttributeKey<String> PROCESS_EXECUTABLE_PATH =
stringKey("process.executable.path");
/**
* The command used to launch the process (i.e. the command name). On Linux based systems, can be
* set to the zeroth string in {@code proc/[pid]/cmdline}. On Windows, can be set to the first
* parameter extracted from {@code GetCommandLineW}.
*/
public static final AttributeKey<String> PROCESS_COMMAND = stringKey("process.command");
/**
* The full command used to launch the process as a single string representing the full command.
* On Windows, can be set to the result of {@code GetCommandLineW}. Do not set this if you have to
* assemble it just for monitoring; use {@code process.command_args} instead.
*/
public static final AttributeKey<String> PROCESS_COMMAND_LINE = stringKey("process.command_line");
/**
* All the command arguments (including the command/executable itself) as received by the process.
* On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according
* to the list of null-delimited strings extracted from {@code proc/[pid]/cmdline}. For libc-based
* executables, this would be the full argv vector passed to {@code main}.
*/
public static final AttributeKey<List<String>> PROCESS_COMMAND_ARGS =
stringArrayKey("process.command_args");
/** The username of the user that owns the process. */
public static final AttributeKey<String> PROCESS_OWNER = stringKey("process.owner");
/**
* The name of the runtime of this process. For compiled native binaries, this SHOULD be the name
* of the compiler.
*/
public static final AttributeKey<String> PROCESS_RUNTIME_NAME = stringKey("process.runtime.name");
/**
* The version of the runtime of this process, as returned by the runtime without modification.
*/
public static final AttributeKey<String> PROCESS_RUNTIME_VERSION =
stringKey("process.runtime.version");
/**
* An additional description about the runtime of the process, for example a specific vendor
* customization of the runtime environment.
*/
public static final AttributeKey<String> PROCESS_RUNTIME_DESCRIPTION =
stringKey("process.runtime.description");
/**
* Logical name of the service.
*
* <p>Notes:
*
* <ul>
* <li>MUST be the same for all instances of horizontally scaled services. If the value was not
* specified, SDKs MUST fallback to {@code unknown_service:} concatenated with <a
* href="process.md#process">{@code process.executable.name}</a>, e.g. {@code
* unknown_service:bash}. If {@code process.executable.name} is not available, the value
* MUST be set to {@code unknown_service}.
* </ul>
*/
public static final AttributeKey<String> SERVICE_NAME = stringKey("service.name");
/**
* A namespace for {@code service.name}.
*
* <p>Notes:
*
* <ul>
* <li>A string value having a meaning that helps to distinguish a group of services, for
* example the team name that owns a group of services. {@code service.name} is expected to
* be unique within the same namespace. If {@code service.namespace} is not specified in the
* Resource then {@code service.name} is expected to be unique for all services that have no
* explicit namespace defined (so the empty/unspecified namespace is simply one more valid
* namespace). Zero-length namespace string is assumed equal to unspecified namespace.
* </ul>
*/
public static final AttributeKey<String> SERVICE_NAMESPACE = stringKey("service.namespace");
/**
* The string ID of the service instance.
*
* <p>Notes:
*
* <ul>
* <li>MUST be unique for each instance of the same {@code service.namespace,service.name} pair
* (in other words {@code service.namespace,service.name,service.instance.id} triplet MUST
* be globally unique). The ID helps to distinguish instances of the same service that exist
* at the same time (e.g. instances of a horizontally scaled service). It is preferable for
* the ID to be persistent and stay the same for the lifetime of the service instance,
* however it is acceptable that the ID is ephemeral and changes during important lifetime
* events for the service (e.g. service restarts). If the service has no inherent unique ID
* that can be used as the value of this attribute it is recommended to generate a random
* Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use
* Version 5, see RFC 4122 for more recommendations).
* </ul>
*/
public static final AttributeKey<String> SERVICE_INSTANCE_ID = stringKey("service.instance.id");
/** The version string of the service API or implementation. */
public static final AttributeKey<String> SERVICE_VERSION = stringKey("service.version");
/** The name of the telemetry SDK as defined above. */
public static final AttributeKey<String> TELEMETRY_SDK_NAME = stringKey("telemetry.sdk.name");
/** The language of the telemetry SDK. */
public static final AttributeKey<String> TELEMETRY_SDK_LANGUAGE =
stringKey("telemetry.sdk.language");
/** The version string of the telemetry SDK. */
public static final AttributeKey<String> TELEMETRY_SDK_VERSION =
stringKey("telemetry.sdk.version");
/** The version string of the auto instrumentation agent, if used. */
public static final AttributeKey<String> TELEMETRY_AUTO_VERSION =
stringKey("telemetry.auto.version");
/** The name of the web engine. */
public static final AttributeKey<String> WEBENGINE_NAME = stringKey("webengine.name");
/** The version of the web engine. */
public static final AttributeKey<String> WEBENGINE_VERSION = stringKey("webengine.version");
/** Additional description of the web engine (e.g. detailed version and edition information). */
public static final AttributeKey<String> WEBENGINE_DESCRIPTION =
stringKey("webengine.description");
// Enum definitions
public static final class CloudProviderValues {
/** Alibaba Cloud. */
public static final String ALIBABA_CLOUD = "alibaba_cloud";
/** Amazon Web Services. */
public static final String AWS = "aws";
/** Microsoft Azure. */
public static final String AZURE = "azure";
/** Google Cloud Platform. */
public static final String GCP = "gcp";
/** Tencent Cloud. */
public static final String TENCENT_CLOUD = "tencent_cloud";
private CloudProviderValues() {}
}
public static final class CloudPlatformValues {
/** Alibaba Cloud Elastic Compute Service. */
public static final String ALIBABA_CLOUD_ECS = "alibaba_cloud_ecs";
/** Alibaba Cloud Function Compute. */
public static final String ALIBABA_CLOUD_FC = "alibaba_cloud_fc";
/** AWS Elastic Compute Cloud. */
public static final String AWS_EC2 = "aws_ec2";
/** AWS Elastic Container Service. */
public static final String AWS_ECS = "aws_ecs";
/** AWS Elastic Kubernetes Service. */
public static final String AWS_EKS = "aws_eks";
/** AWS Lambda. */
public static final String AWS_LAMBDA = "aws_lambda";
/** AWS Elastic Beanstalk. */
public static final String AWS_ELASTIC_BEANSTALK = "aws_elastic_beanstalk";
/** AWS App Runner. */
public static final String AWS_APP_RUNNER = "aws_app_runner";
/** Azure Virtual Machines. */
public static final String AZURE_VM = "azure_vm";
/** Azure Container Instances. */
public static final String AZURE_CONTAINER_INSTANCES = "azure_container_instances";
/** Azure Kubernetes Service. */
public static final String AZURE_AKS = "azure_aks";
/** Azure Functions. */
public static final String AZURE_FUNCTIONS = "azure_functions";
/** Azure App Service. */
public static final String AZURE_APP_SERVICE = "azure_app_service";
/** Google Cloud Compute Engine (GCE). */
public static final String GCP_COMPUTE_ENGINE = "gcp_compute_engine";
/** Google Cloud Run. */
public static final String GCP_CLOUD_RUN = "gcp_cloud_run";
/** Google Cloud Kubernetes Engine (GKE). */
public static final String GCP_KUBERNETES_ENGINE = "gcp_kubernetes_engine";
/** Google Cloud Functions (GCF). */
public static final String GCP_CLOUD_FUNCTIONS = "gcp_cloud_functions";
/** Google Cloud App Engine (GAE). */
public static final String GCP_APP_ENGINE = "gcp_app_engine";
/** Tencent Cloud Cloud Virtual Machine (CVM). */
public static final String TENCENT_CLOUD_CVM = "tencent_cloud_cvm";
/** Tencent Cloud Elastic Kubernetes Service (EKS). */
public static final String TENCENT_CLOUD_EKS = "tencent_cloud_eks";
/** Tencent Cloud Serverless Cloud Function (SCF). */
public static final String TENCENT_CLOUD_SCF = "tencent_cloud_scf";
private CloudPlatformValues() {}
}
public static final class AwsEcsLaunchtypeValues {
/** ec2. */
public static final String EC2 = "ec2";
/** fargate. */
public static final String FARGATE = "fargate";
private AwsEcsLaunchtypeValues() {}
}
public static final class HostArchValues {
/** AMD64. */
public static final String AMD64 = "amd64";
/** ARM32. */
public static final String ARM32 = "arm32";
/** ARM64. */
public static final String ARM64 = "arm64";
/** Itanium. */
public static final String IA64 = "ia64";
/** 32-bit PowerPC. */
public static final String PPC32 = "ppc32";
/** 64-bit PowerPC. */
public static final String PPC64 = "ppc64";
/** IBM z/Architecture. */
public static final String S390X = "s390x";
/** 32-bit x86. */
public static final String X86 = "x86";
private HostArchValues() {}
}
public static final class OsTypeValues {
/** Microsoft Windows. */
public static final String WINDOWS = "windows";
/** Linux. */
public static final String LINUX = "linux";
/** Apple Darwin. */
public static final String DARWIN = "darwin";
/** FreeBSD. */
public static final String FREEBSD = "freebsd";
/** NetBSD. */
public static final String NETBSD = "netbsd";
/** OpenBSD. */
public static final String OPENBSD = "openbsd";
/** DragonFly BSD. */
public static final String DRAGONFLYBSD = "dragonflybsd";
/** HP-UX (Hewlett Packard Unix). */
public static final String HPUX = "hpux";
/** AIX (Advanced Interactive eXecutive). */
public static final String AIX = "aix";
/** Oracle Solaris. */
public static final String SOLARIS = "solaris";
/** IBM z/OS. */
public static final String Z_OS = "z_os";
private OsTypeValues() {}
}
public static final class TelemetrySdkLanguageValues {
/** cpp. */
public static final String CPP = "cpp";
/** dotnet. */
public static final String DOTNET = "dotnet";
/** erlang. */
public static final String ERLANG = "erlang";
/** go. */
public static final String GO = "go";
/** java. */
public static final String JAVA = "java";
/** nodejs. */
public static final String NODEJS = "nodejs";
/** php. */
public static final String PHP = "php";
/** python. */
public static final String PYTHON = "python";
/** ruby. */
public static final String RUBY = "ruby";
/** webjs. */
public static final String WEBJS = "webjs";
/** swift. */
public static final String SWIFT = "swift";
private TelemetrySdkLanguageValues() {}
}
private ResourceAttributes() {}
}
| [
"noreply@github.com"
] | sfriberg.noreply@github.com |
11bcf19975cd1da071913322767ed255b835f402 | 7fa0e2e3742f861bb64aabf283026882a1526869 | /src/main/java/io/digitalbits/sdk/responses/effects/ClaimableBalanceClaimantCreatedEffectResponse.java | 999758296aa11ffff70e14022abd529a6d3914f2 | [
"Apache-2.0"
] | permissive | PinkDiamond1/java-digitalbits-sdk | 3bd1133f1b17fcfdff89c49a440e028eeb5e96c3 | 8a2a4e6646042cddbef8f27650aeb46579fa914f | refs/heads/master | 2023-06-30T15:56:47.552099 | 2021-08-04T07:56:22 | 2021-08-04T07:56:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,401 | java | package io.digitalbits.sdk.responses.effects;
import com.google.gson.annotations.SerializedName;
import io.digitalbits.sdk.Asset;
import io.digitalbits.sdk.Predicate;
/**
* Represents claimable_balance_claimant_created effect response.
* @see <a href="https://developers.digitalbits.io/frontier/reference/resources/effect.html" target="_blank">Effect documentation</a>
* @see io.digitalbits.sdk.requests.EffectsRequestBuilder
* @see io.digitalbits.sdk.Server#effects()
*/
public class ClaimableBalanceClaimantCreatedEffectResponse extends EffectResponse {
@SerializedName("asset")
private final String assetString;
@SerializedName("amount")
protected final String amount;
@SerializedName("balance_id")
protected final String balanceId;
@SerializedName("predicate")
protected final Predicate predicate;
public ClaimableBalanceClaimantCreatedEffectResponse(String assetString, String amount, String balanceId, Predicate predicate) {
this.assetString = assetString;
this.amount = amount;
this.balanceId = balanceId;
this.predicate = predicate;
}
public String getAssetString() {
return assetString;
}
public Asset getAsset() {
return Asset.create(assetString);
}
public String getAmount() {
return amount;
}
public String getBalanceId() {
return balanceId;
}
public Predicate getPredicate() {
return predicate;
}
}
| [
"o.dievri@gmail.com"
] | o.dievri@gmail.com |
b004bde89ff1dfad3bf0c93e6b9d2217b212625d | 58e555e306f41d1a1d06f7c5e30db13eee2c1eed | /src/java/io/OutputStreamWriter.java | 2755d5ebcee6832cd48e89d0289932ddcba70365 | [] | no_license | SmartTalk/jdk8-source-reading | 33db15399d1b0de5c3062b2a2ec2d2ae3bbbaa4d | 0682559ef6c84a73addd8375253755dfb9e647fd | refs/heads/master | 2020-05-17T17:08:28.390691 | 2018-10-27T13:01:48 | 2018-10-27T13:01:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,743 | java | /*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.io;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import sun.nio.cs.StreamEncoder;
/**
* An OutputStreamWriter is a bridge from character streams to byte streams:
* Characters written to it are encoded into bytes using a specified {@link
* java.nio.charset.Charset charset}. The charset that it uses
* may be specified by name or may be given explicitly, or the platform's
* default charset may be accepted.
*
* <p> Each invocation of a write() method causes the encoding converter to be
* invoked on the given character(s). The resulting bytes are accumulated in a
* buffer before being written to the underlying output stream. The size of
* this buffer may be specified, but by default it is large enough for most
* purposes. Note that the characters passed to the write() methods are not
* buffered.
*
* <p> For top efficiency, consider wrapping an OutputStreamWriter within a
* BufferedWriter so as to avoid frequent converter invocations. For example:
*
* <pre>
* Writer out
* = new BufferedWriter(new OutputStreamWriter(System.out));
* </pre>
*
* <p> A <i>surrogate pair</i> is a character represented by a sequence of two
* <tt>char</tt> values: A <i>high</i> surrogate in the range '\uD800' to
* '\uDBFF' followed by a <i>low</i> surrogate in the range '\uDC00' to
* '\uDFFF'.
*
* <p> A <i>malformed surrogate element</i> is a high surrogate that is not
* followed by a low surrogate or a low surrogate that is not preceded by a
* high surrogate.
*
* <p> This class always replaces malformed surrogate elements and unmappable
* character sequences with the charset's default <i>substitution sequence</i>.
* The {@linkplain java.nio.charset.CharsetEncoder} class should be used when more
* control over the encoding process is required.
*
* @author Mark Reinhold
* @see BufferedWriter
* @see OutputStream
* @see java.nio.charset.Charset
* @since JDK1.1
*/
public class OutputStreamWriter extends Writer {
private final StreamEncoder se;
/**
* Creates an OutputStreamWriter that uses the named charset.
*
* @param out
* An OutputStream
* @param charsetName
* The name of a supported
* {@link java.nio.charset.Charset charset}
*
* @throws UnsupportedEncodingException
* If the named encoding is not supported
*/
public OutputStreamWriter(OutputStream out, String charsetName) throws UnsupportedEncodingException {
super(out);
if (charsetName == null) {
throw new NullPointerException("charsetName");
}
se = StreamEncoder.forOutputStreamWriter(out, this, charsetName);
}
/**
* Creates an OutputStreamWriter that uses the default character encoding.
*
* @param out
* An OutputStream
*/
public OutputStreamWriter(OutputStream out) {
super(out);
try {
se = StreamEncoder.forOutputStreamWriter(out, this, (String) null);
} catch (UnsupportedEncodingException e) {
throw new Error(e);
}
}
/**
* Creates an OutputStreamWriter that uses the given charset.
*
* @param out
* An OutputStream
* @param cs
* A charset
*
* @since 1.4
*/
public OutputStreamWriter(OutputStream out, Charset cs) {
super(out);
if (cs == null) {
throw new NullPointerException("charset");
}
se = StreamEncoder.forOutputStreamWriter(out, this, cs);
}
/**
* Creates an OutputStreamWriter that uses the given charset encoder.
*
* @param out
* An OutputStream
* @param enc
* A charset encoder
*
* @since 1.4
*/
public OutputStreamWriter(OutputStream out, CharsetEncoder enc) {
super(out);
if (enc == null) {
throw new NullPointerException("charset encoder");
}
se = StreamEncoder.forOutputStreamWriter(out, this, enc);
}
/**
* Returns the name of the character encoding being used by this stream.
*
* <p> If the encoding has an historical name then that name is returned;
* otherwise the encoding's canonical name is returned.
*
* <p> If this instance was created with the {@link
* #OutputStreamWriter(OutputStream, String)} constructor then the returned
* name, being unique for the encoding, may differ from the name passed to
* the constructor. This method may return <tt>null</tt> if the stream has
* been closed. </p>
*
* @return The historical name of this encoding, or possibly
* <code>null</code> if the stream has been closed
*
* @see java.nio.charset.Charset
*/
public String getEncoding() {
return se.getEncoding();
}
/**
* Flushes the output buffer to the underlying byte stream, without flushing
* the byte stream itself. This method is non-private only so that it may
* be invoked by PrintStream.
*/
void flushBuffer() throws IOException {
se.flushBuffer();
}
/**
* Writes a single character.
*
* @throws IOException
* If an I/O error occurs
*/
public void write(int c) throws IOException {
se.write(c);
}
/**
* Writes a portion of an array of characters.
*
* @param cbuf
* Buffer of characters
* @param off
* Offset from which to start writing characters
* @param len
* Number of characters to write
*
* @throws IOException
* If an I/O error occurs
*/
public void write(char cbuf[], int off, int len) throws IOException {
se.write(cbuf, off, len);
}
/**
* Writes a portion of a string.
*
* @param str
* A String
* @param off
* Offset from which to start writing characters
* @param len
* Number of characters to write
*
* @throws IOException
* If an I/O error occurs
*/
public void write(String str, int off, int len) throws IOException {
se.write(str, off, len);
}
/**
* Flushes the stream.
*
* @throws IOException
* If an I/O error occurs
*/
public void flush() throws IOException {
se.flush();
}
public void close() throws IOException {
se.close();
}
}
| [
"charpty@gmail.com"
] | charpty@gmail.com |
a728cd5c30ae69fb4ba66674ab33550640693041 | 838914db919e4afc5bbc7ae248684af36d764d67 | /app/src/main/java/com/example/mapleore/Admin/AdminAddNewProductActivity.java | d3b91bfcd5c1f53650e02452bc5552e05ca73c62 | [] | no_license | kingslayer2205/MapleOre | eefbca5cb302fd989a1e5c55e1fdcebb253504c0 | da2b4bfa787f722c375c3ed3a4252294bdd1a944 | refs/heads/main | 2023-01-24T08:51:36.575176 | 2020-11-24T19:37:39 | 2020-11-24T19:37:39 | 315,728,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,283 | java | package com.example.mapleore.Admin;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.example.mapleore.R;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
public class AdminAddNewProductActivity extends AppCompatActivity {
private String CatagoryName;
private ImageView ProductImage;
private Button AddProduct;
private EditText ProductName , ProductDescription , ProductPrice;
private Uri imageUri;
private static final int GalleryPick = 1;
private String Pname , PDescription ,PPrice;
private String SaveCurrentDate , SaveCurrentTime;
private String ProductRandomKey;
private StorageReference ProductImageRef;
private String DownloadImageURL;
private DatabaseReference productRef;
private ProgressDialog LoadingBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_add_new_product);
ProductImageRef = FirebaseStorage.getInstance().getReference().child("Product Image");
productRef = FirebaseDatabase.getInstance().getReference().child("Products");
CatagoryName = getIntent().getExtras().get("catagory").toString();
AddProduct = (Button)findViewById(R.id.Add_new_Product);
ProductName = (EditText)findViewById(R.id.product_name);
ProductDescription = (EditText)findViewById(R.id.product_description);
ProductPrice = (EditText)findViewById(R.id.product_price);
ProductImage = (ImageView)findViewById(R.id.select_product_image);
LoadingBar = new ProgressDialog(this);
ProductImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
OpenGallery();
}
});
AddProduct.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ValidateProductData();
}
});
}
private void ValidateProductData() {
PDescription = ProductDescription.getText().toString();
PPrice = ProductPrice.getText().toString();
Pname = ProductName.getText().toString();
if(imageUri == null){
Toast.makeText(AdminAddNewProductActivity.this , "Product Image Is mandatory" ,Toast.LENGTH_SHORT).show();
}
else if(TextUtils.isEmpty(Pname)){
Toast.makeText(AdminAddNewProductActivity.this , "Please, Write Product Name" ,Toast.LENGTH_SHORT).show();
}
else if(TextUtils.isEmpty(PDescription)){
Toast.makeText(AdminAddNewProductActivity.this , "Please, Write Product Description" ,Toast.LENGTH_SHORT).show();
}
else if(TextUtils.isEmpty(PPrice)){
Toast.makeText(AdminAddNewProductActivity.this , "Please, Write Product Price" ,Toast.LENGTH_SHORT).show();
}
else{
StoreProductInformation();
}
}
private void StoreProductInformation() {
LoadingBar.setTitle("Adding new Product");
LoadingBar.setMessage("Please wait, While we are Adding new Product...");
LoadingBar.setCanceledOnTouchOutside(false);
LoadingBar.show();
Calendar calender = Calendar.getInstance();
SimpleDateFormat currentdate = new SimpleDateFormat("MMM dd,yyyy");
SaveCurrentDate = currentdate.format(calender.getTime());
SimpleDateFormat currentTime = new SimpleDateFormat("HH:mm:ss a");
SaveCurrentTime = currentTime.format(calender.getTime());
ProductRandomKey = SaveCurrentDate + SaveCurrentTime ;
final StorageReference filepath = ProductImageRef.child(imageUri.getLastPathSegment() + ProductRandomKey);
final UploadTask uploadTask = filepath.putFile(imageUri);
uploadTask.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
String message = e.toString() ;
Toast.makeText(AdminAddNewProductActivity.this, "Error: " +message , Toast.LENGTH_SHORT).show();
LoadingBar.dismiss();
}
}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Toast.makeText(AdminAddNewProductActivity.this , "Image Uploaded SuccessFully...", Toast.LENGTH_SHORT).show();
Task<Uri> uriTask = uploadTask.continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() {
@Override
public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception {
if(!task.isSuccessful()){
throw task.getException();
}
DownloadImageURL = filepath.getDownloadUrl().toString();
return filepath.getDownloadUrl();
}
}).addOnCompleteListener(new OnCompleteListener<Uri>() {
@Override
public void onComplete(@NonNull Task<Uri> task) {
if(task.isSuccessful()){
DownloadImageURL = task.getResult().toString();
Toast.makeText(AdminAddNewProductActivity.this , "Product Image URL Saved Successfully...",Toast.LENGTH_SHORT).show();
SaveProductInfoTODatabase();
}
}
});
}
});
}
private void SaveProductInfoTODatabase() {
HashMap<String,Object> productMap = new HashMap<>();
productMap.put("pid" , ProductRandomKey);
productMap.put("date" ,SaveCurrentDate);
productMap.put("time" , SaveCurrentTime);
productMap.put("description" , PDescription);
productMap.put("image" ,DownloadImageURL);
productMap.put("catagory" , CatagoryName);
productMap.put("price" , PPrice);
productMap.put("name" , Pname);
productRef.child(ProductRandomKey).updateChildren(productMap)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()){
Intent intent = new Intent(AdminAddNewProductActivity.this, AdminCatagoryActivity.class);
startActivity(intent);
LoadingBar.dismiss();
Toast.makeText(AdminAddNewProductActivity.this , "Product Added Successfully." , Toast.LENGTH_SHORT).show();
}
else{
LoadingBar.dismiss();
String message = task.getException().toString();
Toast.makeText(AdminAddNewProductActivity.this , "Error: "+ message , Toast.LENGTH_SHORT).show();
}
}
});
}
private void OpenGallery() {
Intent galleryIntent = new Intent();
galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
galleryIntent.setType("image/*");
startActivityForResult(galleryIntent , GalleryPick);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == GalleryPick && resultCode == RESULT_OK && data!= null){
imageUri = data.getData();
ProductImage.setImageURI(imageUri);
}
}
}
| [
"ankitgoyal473@gmail.com"
] | ankitgoyal473@gmail.com |
96619e7c65974710623780eb02fb99d87298d50c | 2a0b13e49284319df81ffd7831b2f581a494aa7c | /app/src/main/java/com/nkvoronov/photogallery/PhotoGalleryActivity.java | 7610c4905f6f8e415ff25598efcf61bac0734d7b | [] | no_license | nkvoronov/PhotoGallery | 12a22682a192ef1c10fb628c55d31ec70c7220d6 | 829543ec5bd244fb1215263720343b693885add3 | refs/heads/master | 2020-07-05T18:08:19.949994 | 2019-08-16T15:59:00 | 2019-08-16T15:59:00 | 202,723,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.nkvoronov.photogallery;
import androidx.fragment.app.Fragment;
import android.os.Bundle;
public class PhotoGalleryActivity extends SingleFragmentActivity {
@Override
protected Fragment createFragment() {
return PhotoGalleryFragment.newInstance();
}
}
| [
"nkvoronov@gmail.com"
] | nkvoronov@gmail.com |
1b5e78688e4d76459a47772d9203c4ef94e5cb88 | 8d9293642d3c12f81cc5f930e0147a9d65bd6efb | /src/main/java/net/minecraft/world/entity/monster/Ravager.java | eb237e3239d9574cd674ae20abf8e008332375d1 | [] | no_license | NicholasBlackburn1/Blackburn-1.17 | 7c086591ac77cf433af248435026cf9275223daa | fd960b995b33df75ce61865ba119274d9b0e4704 | refs/heads/main | 2022-07-28T03:27:14.736924 | 2021-09-23T15:55:53 | 2021-09-23T15:55:53 | 399,960,376 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,891 | java | package net.minecraft.world.entity.monster;
import java.util.function.Predicate;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.EntityTypeTags;
import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.entity.animal.IronGolem;
import net.minecraft.world.entity.npc.AbstractVillager;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.raid.Raider;
import net.minecraft.world.entity.vehicle.Boat;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathFinder;
import net.minecraft.world.level.pathfinder.WalkNodeEvaluator;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
public class Ravager extends Raider {
private static final Predicate<Entity> NO_RAVAGER_AND_ALIVE = (p_33346_) -> {
return p_33346_.isAlive() && !(p_33346_ instanceof Ravager);
};
private static final double BASE_MOVEMENT_SPEED = 0.3D;
private static final double ATTACK_MOVEMENT_SPEED = 0.35D;
private static final int STUNNED_COLOR = 8356754;
private static final double STUNNED_COLOR_BLUE = 0.5725490196078431D;
private static final double STUNNED_COLOR_GREEN = 0.5137254901960784D;
private static final double STUNNED_COLOR_RED = 0.4980392156862745D;
private static final int ATTACK_DURATION = 10;
public static final int STUN_DURATION = 40;
private int attackTick;
private int stunnedTick;
private int roarTick;
public Ravager(EntityType<? extends Ravager> p_33325_, Level p_33326_) {
super(p_33325_, p_33326_);
this.maxUpStep = 1.0F;
this.xpReward = 20;
}
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(4, new Ravager.RavagerMeleeAttackGoal());
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.4D));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F));
this.targetSelector.addGoal(2, (new HurtByTargetGoal(this, Raider.class)).setAlertOthers());
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, true));
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, true));
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
}
protected void updateControlFlags() {
boolean flag = !(this.getControllingPassenger() instanceof Mob) || this.getControllingPassenger().getType().is(EntityTypeTags.RAIDERS);
boolean flag1 = !(this.getVehicle() instanceof Boat);
this.goalSelector.setControlFlag(Goal.Flag.MOVE, flag);
this.goalSelector.setControlFlag(Goal.Flag.JUMP, flag && flag1);
this.goalSelector.setControlFlag(Goal.Flag.LOOK, flag);
this.goalSelector.setControlFlag(Goal.Flag.TARGET, flag);
}
public static AttributeSupplier.Builder createAttributes() {
return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 100.0D).add(Attributes.MOVEMENT_SPEED, 0.3D).add(Attributes.KNOCKBACK_RESISTANCE, 0.75D).add(Attributes.ATTACK_DAMAGE, 12.0D).add(Attributes.ATTACK_KNOCKBACK, 1.5D).add(Attributes.FOLLOW_RANGE, 32.0D);
}
public void addAdditionalSaveData(CompoundTag p_33353_) {
super.addAdditionalSaveData(p_33353_);
p_33353_.putInt("AttackTick", this.attackTick);
p_33353_.putInt("StunTick", this.stunnedTick);
p_33353_.putInt("RoarTick", this.roarTick);
}
public void readAdditionalSaveData(CompoundTag p_33344_) {
super.readAdditionalSaveData(p_33344_);
this.attackTick = p_33344_.getInt("AttackTick");
this.stunnedTick = p_33344_.getInt("StunTick");
this.roarTick = p_33344_.getInt("RoarTick");
}
public SoundEvent getCelebrateSound() {
return SoundEvents.RAVAGER_CELEBRATE;
}
protected PathNavigation createNavigation(Level p_33348_) {
return new Ravager.RavagerNavigation(this, p_33348_);
}
public int getMaxHeadYRot() {
return 45;
}
public double getPassengersRidingOffset() {
return 2.1D;
}
public boolean canBeControlledByRider() {
return !this.isNoAi() && this.getControllingPassenger() instanceof LivingEntity;
}
@Nullable
public Entity getControllingPassenger() {
return this.getFirstPassenger();
}
public void aiStep() {
super.aiStep();
if (this.isAlive()) {
if (this.isImmobile()) {
this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0.0D);
} else {
double d0 = this.getTarget() != null ? 0.35D : 0.3D;
double d1 = this.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue();
this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1D, d1, d0));
}
if (this.horizontalCollision && this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
boolean flag = false;
AABB aabb = this.getBoundingBox().inflate(0.2D);
for(BlockPos blockpos : BlockPos.betweenClosed(Mth.floor(aabb.minX), Mth.floor(aabb.minY), Mth.floor(aabb.minZ), Mth.floor(aabb.maxX), Mth.floor(aabb.maxY), Mth.floor(aabb.maxZ))) {
BlockState blockstate = this.level.getBlockState(blockpos);
Block block = blockstate.getBlock();
if (block instanceof LeavesBlock) {
flag = this.level.destroyBlock(blockpos, true, this) || flag;
}
}
if (!flag && this.onGround) {
this.jumpFromGround();
}
}
if (this.roarTick > 0) {
--this.roarTick;
if (this.roarTick == 10) {
this.roar();
}
}
if (this.attackTick > 0) {
--this.attackTick;
}
if (this.stunnedTick > 0) {
--this.stunnedTick;
this.stunEffect();
if (this.stunnedTick == 0) {
this.playSound(SoundEvents.RAVAGER_ROAR, 1.0F, 1.0F);
this.roarTick = 20;
}
}
}
}
private void stunEffect() {
if (this.random.nextInt(6) == 0) {
double d0 = this.getX() - (double)this.getBbWidth() * Math.sin((double)(this.yBodyRot * ((float)Math.PI / 180F))) + (this.random.nextDouble() * 0.6D - 0.3D);
double d1 = this.getY() + (double)this.getBbHeight() - 0.3D;
double d2 = this.getZ() + (double)this.getBbWidth() * Math.cos((double)(this.yBodyRot * ((float)Math.PI / 180F))) + (this.random.nextDouble() * 0.6D - 0.3D);
this.level.addParticle(ParticleTypes.ENTITY_EFFECT, d0, d1, d2, 0.4980392156862745D, 0.5137254901960784D, 0.5725490196078431D);
}
}
protected boolean isImmobile() {
return super.isImmobile() || this.attackTick > 0 || this.stunnedTick > 0 || this.roarTick > 0;
}
public boolean hasLineOfSight(Entity p_149755_) {
return this.stunnedTick <= 0 && this.roarTick <= 0 ? super.hasLineOfSight(p_149755_) : false;
}
protected void blockedByShield(LivingEntity p_33361_) {
if (this.roarTick == 0) {
if (this.random.nextDouble() < 0.5D) {
this.stunnedTick = 40;
this.playSound(SoundEvents.RAVAGER_STUNNED, 1.0F, 1.0F);
this.level.broadcastEntityEvent(this, (byte)39);
p_33361_.push(this);
} else {
this.strongKnockback(p_33361_);
}
p_33361_.hurtMarked = true;
}
}
private void roar() {
if (this.isAlive()) {
for(LivingEntity livingentity : this.level.getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0D), NO_RAVAGER_AND_ALIVE)) {
if (!(livingentity instanceof AbstractIllager)) {
livingentity.hurt(DamageSource.mobAttack(this), 6.0F);
}
this.strongKnockback(livingentity);
}
Vec3 vec3 = this.getBoundingBox().getCenter();
for(int i = 0; i < 40; ++i) {
double d0 = this.random.nextGaussian() * 0.2D;
double d1 = this.random.nextGaussian() * 0.2D;
double d2 = this.random.nextGaussian() * 0.2D;
this.level.addParticle(ParticleTypes.POOF, vec3.x, vec3.y, vec3.z, d0, d1, d2);
}
this.level.gameEvent(this, GameEvent.RAVAGER_ROAR, this.eyeBlockPosition());
}
}
private void strongKnockback(Entity p_33340_) {
double d0 = p_33340_.getX() - this.getX();
double d1 = p_33340_.getZ() - this.getZ();
double d2 = Math.max(d0 * d0 + d1 * d1, 0.001D);
p_33340_.push(d0 / d2 * 4.0D, 0.2D, d1 / d2 * 4.0D);
}
public void handleEntityEvent(byte p_33335_) {
if (p_33335_ == 4) {
this.attackTick = 10;
this.playSound(SoundEvents.RAVAGER_ATTACK, 1.0F, 1.0F);
} else if (p_33335_ == 39) {
this.stunnedTick = 40;
}
super.handleEntityEvent(p_33335_);
}
public int getAttackTick() {
return this.attackTick;
}
public int getStunnedTick() {
return this.stunnedTick;
}
public int getRoarTick() {
return this.roarTick;
}
public boolean doHurtTarget(Entity p_33328_) {
this.attackTick = 10;
this.level.broadcastEntityEvent(this, (byte)4);
this.playSound(SoundEvents.RAVAGER_ATTACK, 1.0F, 1.0F);
return super.doHurtTarget(p_33328_);
}
@Nullable
protected SoundEvent getAmbientSound() {
return SoundEvents.RAVAGER_AMBIENT;
}
protected SoundEvent getHurtSound(DamageSource p_33359_) {
return SoundEvents.RAVAGER_HURT;
}
protected SoundEvent getDeathSound() {
return SoundEvents.RAVAGER_DEATH;
}
protected void playStepSound(BlockPos p_33350_, BlockState p_33351_) {
this.playSound(SoundEvents.RAVAGER_STEP, 0.15F, 1.0F);
}
public boolean checkSpawnObstruction(LevelReader p_33342_) {
return !p_33342_.containsAnyLiquid(this.getBoundingBox());
}
public void applyRaidBuffs(int p_33337_, boolean p_33338_) {
}
public boolean canBeLeader() {
return false;
}
class RavagerMeleeAttackGoal extends MeleeAttackGoal {
public RavagerMeleeAttackGoal() {
super(Ravager.this, 1.0D, true);
}
protected double getAttackReachSqr(LivingEntity p_33377_) {
float f = Ravager.this.getBbWidth() - 0.1F;
return (double)(f * 2.0F * f * 2.0F + p_33377_.getBbWidth());
}
}
static class RavagerNavigation extends GroundPathNavigation {
public RavagerNavigation(Mob p_33379_, Level p_33380_) {
super(p_33379_, p_33380_);
}
protected PathFinder createPathFinder(int p_33382_) {
this.nodeEvaluator = new Ravager.RavagerNodeEvaluator();
return new PathFinder(this.nodeEvaluator, p_33382_);
}
}
static class RavagerNodeEvaluator extends WalkNodeEvaluator {
protected BlockPathTypes evaluateBlockPathType(BlockGetter p_33387_, boolean p_33388_, boolean p_33389_, BlockPos p_33390_, BlockPathTypes p_33391_) {
return p_33391_ == BlockPathTypes.LEAVES ? BlockPathTypes.OPEN : super.evaluateBlockPathType(p_33387_, p_33388_, p_33389_, p_33390_, p_33391_);
}
}
} | [
"nickblackburn02@gmail.com"
] | nickblackburn02@gmail.com |
5d2e822a27a978bd90a4c1341986d7c7ad024582 | 0fb722139bb237dda7d9dd60b44f67701543a4e4 | /dubbo-demo-server/dubbo-demo-system-api/src/main/java/com/ln/demo/api/system/entity/Resource.java | 98c5355b28775fcbede7070a38d6e5be66466378 | [] | no_license | fpli/dubbo-demo | f46021b2c2e281bf8949c9cd4dd92c3983f675e0 | 5ea7e6722a2cbc4790f3c351fc54026481f377f8 | refs/heads/master | 2022-12-23T15:50:43.678104 | 2021-06-10T15:00:04 | 2021-06-10T15:00:04 | 221,000,176 | 0 | 0 | null | 2022-11-16T09:57:52 | 2019-11-11T14:32:39 | Java | UTF-8 | Java | false | false | 1,230 | java | package com.ln.demo.api.system.entity;
/**
* 资源实体类
*
* @author Lining
* @date 2017/10/25
*/
public class Resource implements java.io.Serializable {
private static final long serialVersionUID = 8286484183880343900L;
private Integer id;
private String name;
private String code;
private String url;
private String permission;
private boolean locked;
private Router router;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getUrl() {
return this.url;
}
public void setUrl(String url) {
this.url = url;
}
public String getPermission() {
return this.permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public Boolean getLocked() {
return this.locked;
}
public void setLocked(Boolean locked) {
this.locked = locked;
}
public Router getRouter() {
return this.router;
}
public void setRouter(Router router) {
this.router = router;
}
}
| [
"1394220859@qq.com"
] | 1394220859@qq.com |
accf3ce1a46d2aee360cc8f659f1406a1213c77b | 61602d4b976db2084059453edeafe63865f96ec5 | /com/tencent/bugly/beta/upgrade/UpgradeStateListener.java | 9a79a9d96a52fc89e36b8b288bd8aa8713b495f3 | [] | no_license | ZoranLi/thunder | 9d18fd0a0ec0a5bb3b3f920f9413c1ace2beb4d0 | 0778679ef03ba1103b1d9d9a626c8449b19be14b | refs/heads/master | 2020-03-20T23:29:27.131636 | 2018-06-19T06:43:26 | 2018-06-19T06:43:26 | 137,848,886 | 12 | 1 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.tencent.bugly.beta.upgrade;
/* compiled from: BUGLY */
public interface UpgradeStateListener {
void onDownloadCompleted(boolean z);
void onUpgradeFailed(boolean z);
void onUpgradeNoVersion(boolean z);
void onUpgradeSuccess(boolean z);
void onUpgrading(boolean z);
}
| [
"lizhangliao@xiaohongchun.com"
] | lizhangliao@xiaohongchun.com |
d113c0ea983fdbcb17de74e598451feaab374583 | 8bb8d513fcd3e700a1da1a9714a1fd5503ed72f8 | /spic2-demo/spic2-demo-mybatis/src/main/java/com/sprixin/demo/bootstrap/DemoMybatisApplication.java | b1089875b47b7590120ef69b12b7bb2a70bef19f | [] | no_license | supermoon0201/spic2-parent | a558f5891f8729416841dbc27ba7dfe4ed0afc63 | 980984d208cf3e5029ddc24d93ff7dfbb5dc8653 | refs/heads/master | 2020-03-31T21:31:11.601136 | 2018-11-09T10:38:40 | 2018-11-09T10:38:40 | 152,583,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.sprixin.demo.bootstrap;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {"com.sprixin.demo"})
// mapper 接口类扫描包配置
@MapperScan("com.sprixin.demo.dao")
public class DemoMybatisApplication {
public static void main(String[] args) {
SpringApplication.run(DemoMybatisApplication.class, args);
}
}
| [
"supermoon0201@163.com"
] | supermoon0201@163.com |
5c2637d176b07932fcf1ba9445418b3c6b37226e | d68fe55fd0a93ebe501206de0e92c3709b648500 | /src/main/java/hu/csapatnev/webshop/Config.java | 3ccaf81572702df8be8b69d0a88ef0329cc27ff4 | [
"MIT"
] | permissive | mgyori/webshop-for-sdt | 08176a3853482993d5be957cfdff8ee969f38009 | 8aaacf796d6a7cb7995bbfb61a9a1c8f2186b820 | refs/heads/master | 2023-01-23T04:05:00.373649 | 2020-12-03T14:33:15 | 2020-12-03T14:33:15 | 300,081,626 | 0 | 0 | MIT | 2020-12-03T14:33:16 | 2020-09-30T22:46:42 | CSS | UTF-8 | Java | false | false | 7,984 | java | package hu.csapatnev.webshop;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.servlet.ServletContext;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.session.jdbc.config.annotation.web.http.EnableJdbcHttpSession;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.web.context.support.ServletContextResource;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.servlet.resource.PathResourceResolver;
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
import org.springframework.web.servlet.resource.ResourceResolver;
import org.springframework.web.servlet.resource.ResourceUrlProvider;
import org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor;
import org.thymeleaf.templatemode.TemplateMode;
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
import org.thymeleaf.templateresolver.ITemplateResolver;
import hu.csapatnev.webshop.paypal.PaypalClient;
@EnableWebMvc
@EnableJdbcHttpSession
@Configuration
public class Config implements WebMvcConfigurer {
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { "classpath:/META-INF/resources/",
"classpath:/resources/", "classpath:/static/", "classpath:/public/" };
private Properties properties;
private static Config config;
@Autowired
private ServletContext servletContext;
@Autowired
private ApplicationContext appContext;
public Config() {
Properties prop = getProperties();
PaypalClient.initInstance(prop.getProperty("paypal.id"), prop.getProperty("paypal.secret"));
config = this;
}
@Bean
public ITemplateResolver templateResolver() {
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
resolver.setPrefix("/templates/");
resolver.setSuffix(".html");
resolver.setTemplateMode(TemplateMode.HTML);
resolver.setCharacterEncoding("UTF-8");
resolver.setCacheable(false);
return resolver;
}
@Bean
public DataSource dataSource() {
Properties prop = getProperties();
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUsername(prop.getProperty("db.user"));
dataSource.setPassword(prop.getProperty("db.pass"));
dataSource.setUrl("jdbc:mysql://" + prop.getProperty("db.host") + ":" + prop.getProperty("db.port") + "/"
+ prop.getProperty("db.base")
+ "?createDatabaseIfNotExist=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8&connectionCollation=utf8_general_ci&characterSetResults=utf8");
return dataSource;
}
@Bean
public PlatformTransactionManager transactionManager () {
EntityManagerFactory factory = (EntityManagerFactory) entityManagerFactory();
return new JpaTransactionManager(factory);
}
@Bean
public EntityManagerFactory entityManagerFactory () {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setShowSql(Boolean.TRUE);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("hu.csapatnev.webshop.jpa.model");
factory.setDataSource(dataSource());
factory.setJpaProperties(additionalProperties());
factory.afterPropertiesSet();
factory.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());
return factory.getObject();
}
public Properties getProperties() {
if (this.properties == null) {
this.properties = new Properties();
InputStream inputStream = App.class.getClassLoader().getResourceAsStream("application.properties");
try {
this.properties.load(inputStream);
} catch (Exception e) {
System.out.println(e);
}
}
return this.properties;
}
final Properties additionalProperties() {
final Properties hibernateProperties = new Properties();
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", "update");
hibernateProperties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", "false");
hibernateProperties.setProperty("hibernate.cache.use_query_cache", "false");
hibernateProperties.setProperty("hibernate.show_sql", "false");
return hibernateProperties;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
}
@Bean
public SimpleUrlHandlerMapping simpleUrlHandlerMapping() {
SimpleUrlHandlerMapping simpleUrlHandlerMapping = new SimpleUrlHandlerMapping();
Map<String, Object> map = new LinkedHashMap<>();
ResourceHttpRequestHandler resourceHttpRequestHandler = new ResourceHttpRequestHandler();
List<Resource> locations = new ArrayList<>();
locations.add(new ServletContextResource(servletContext, "/"));
for (String s : CLASSPATH_RESOURCE_LOCATIONS)
locations.add(new ClassPathResource(s.substring("classpath:/".length())));
resourceHttpRequestHandler.setLocations(locations);
resourceHttpRequestHandler.setApplicationContext(appContext);
List<ResourceResolver> resourceResolvers = new ArrayList<>();
PathResourceResolver resourceResolver = new PathResourceResolver();
resourceResolver.setAllowedLocations(locations.toArray(new Resource[locations.size()]));
resourceResolvers.add(resourceResolver);
resourceHttpRequestHandler.setResourceResolvers(resourceResolvers);
map.put("/**", resourceHttpRequestHandler);
simpleUrlHandlerMapping.setUrlMap(map);
ResourceUrlProvider resourceUrlProvider = new ResourceUrlProvider();
Map<String, ResourceHttpRequestHandler> handlerMap = new LinkedHashMap<>();
handlerMap.put("/**", resourceHttpRequestHandler);
resourceUrlProvider.setHandlerMap(handlerMap);
ResourceUrlProviderExposingInterceptor interceptor = new ResourceUrlProviderExposingInterceptor(
resourceUrlProvider);
simpleUrlHandlerMapping.setInterceptors(new Object[] { interceptor });
return simpleUrlHandlerMapping;
}
@Bean
public SimpleMappingExceptionResolver createSimpleMappingExceptionResolver() {
SimpleMappingExceptionResolver r = new SimpleMappingExceptionResolver();
r.setDefaultErrorView("error");
r.setExceptionAttribute("ex");
return r;
}
@Bean
public StringHttpMessageConverter stringHttpMessageConverter() {
return new StringHttpMessageConverter(Charset.forName("UTF-8"));
}
public static Config getInstance() {
if (config == null)
config = new Config();
return config;
}
} | [
"info@markgyori.eu"
] | info@markgyori.eu |
70cb588b9b9fb822697c29954855073962c7691e | 732d7c600b9eb5e31510344ab07997d9cd68c32d | /target/generated-sources/mule/org/mule/tooling/ui/contribution/EthereumActivator.java | 432f12ea2bbca5b186c2c68e6f9a2ed4b40090a8 | [] | no_license | djuang1/ethereum-connector | 78f11c0fcb159d28e3f88268e8b8bc1bc80c6ac5 | a58b91a9be960308fd0b7681040d517f56a3a6ec | refs/heads/master | 2021-09-10T21:41:37.957181 | 2018-04-02T19:05:33 | 2018-04-02T19:05:33 | 124,268,695 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,002 | java |
package org.mule.tooling.ui.contribution;
import javax.annotation.Generated;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*
*/
@SuppressWarnings("all")
@Generated(value = "Mule DevKit Version 3.9.0", date = "2018-03-22T09:49:46-05:00", comments = "Build UNNAMED.2793.f49b6c7")
public class EthereumActivator
extends AbstractUIPlugin
{
public final static String PLUGIN_ID = "org.mule.tooling.ui.contribution.ethereum";
private static org.mule.tooling.ui.contribution.EthereumActivator plugin;
public void start(BundleContext context)
throws Exception
{
super.start(context);
plugin = this;
}
public void stop(BundleContext context)
throws Exception
{
plugin = null;
super.stop(context);
}
public static org.mule.tooling.ui.contribution.EthereumActivator getDefault() {
return plugin;
}
}
| [
"dejim.juang@gmail.com"
] | dejim.juang@gmail.com |
f10166bbe6c88deddd2e74bc127b9d3c3b977911 | 4647290554538a73dd1fafb78a2f375a1c7ddd93 | /src/main/java/dev/java/db/model/CandidateState.java | 188b29f258948f97e9e418a50c79245c0de918c7 | [] | no_license | ksenya96/team2 | 96c87e435066c6ca89cf962b070d187c3b022541 | 7daa71ddeaf129ee65b9b31a58ccc323a22be87c | refs/heads/master | 2020-05-03T01:50:09.812349 | 2018-11-04T21:19:24 | 2018-11-04T21:19:24 | 158,599,333 | 0 | 0 | null | 2018-11-21T19:55:40 | 2018-11-21T19:55:40 | null | UTF-8 | Java | false | false | 873 | java | package dev.java.db.model;
import java.util.Objects;
public class CandidateState extends Entity {
private String name;
public CandidateState() {
}
public CandidateState(String name) {
this.name = name;
}
public String getName() {
return name;
}
public final void setName(String name) {
this.name = name;
}
@Override
public final boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CandidateState that = (CandidateState) o;
return Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
@Override
public String toString() {
return "CandidateState{" +
"name='" + name + '\'' +
'}';
}
}
| [
"zakrevskii_evgenii@mail.ru"
] | zakrevskii_evgenii@mail.ru |
36b1ef63d182bcea0a080a30a207a10460e15919 | 1d2b8bacc71b9bc27db142f82a9e9d1b5a45c4d1 | /src/main/java/biz/dfch/activiti/wrapper/controller/ProcessInvocationController.java | 94b7e53e0d2a11648c7b7c4122618be2b03196c2 | [
"Apache-2.0",
"MIT",
"BSD-3-Clause"
] | permissive | dfch/biz.dfch.j.activiti.wrapper | 20be214b76d7740cbf16f57436fd8de54b1d9c4e | f95aad7f2a093aefadc6a8b2db3eef53948da099 | refs/heads/master | 2016-09-07T18:42:21.327746 | 2015-07-03T08:17:18 | 2015-07-03T08:17:18 | 37,128,890 | 0 | 0 | null | 2015-07-03T08:17:41 | 2015-06-09T11:50:28 | Java | UTF-8 | Java | false | false | 2,023 | java | /**
* Copyright 2015 d-fens GmbH
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 biz.dfch.activiti.wrapper.controller;
import biz.dfch.activiti.wrapper.domain.ProcessMetadata;
import biz.dfch.activiti.wrapper.service.ActivitiService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RestController
@RequestMapping("/process-invocation")
public class ProcessInvocationController {
private static final Logger LOG = Logger.getLogger(ProcessInvocationController.class);
@Autowired
private ActivitiService activitiService;
@Autowired
private ObjectMapper objectMapper;
@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
public ResponseEntity<Void> invokeProcess(@Valid @RequestBody ProcessMetadata processMetadata) {
LOG.info("POST /process-invocation called");
try {
LOG.debug(objectMapper.writeValueAsString(processMetadata));
} catch (JsonProcessingException e) {
LOG.error("Conversion of request body to JSON failed", e);
}
activitiService.invokeProcess(processMetadata);
return new ResponseEntity<>(HttpStatus.OK);
}
}
| [
"marc.rufer@d-fens.net"
] | marc.rufer@d-fens.net |
e6a015f3c92144162ec27b361cb98c57e2d389d5 | 1c97205a3e80355034d6442bf8035cd122984f8e | /app/src/main/java/com/heqifuhou/view/MyRatingBar.java | d78c037d5ef0253ba4d3fdcaab3d321ec318eec2 | [
"MIT"
] | permissive | suntinghui/PhinfoOA4Android | 8a30f8f89824daa7294051e4de1b2575800741fd | fedbb973d7a2490d07d61c8b2c8cdefdc387f8fb | refs/heads/master | 2023-04-08T20:11:15.147365 | 2021-04-21T03:02:16 | 2021-04-21T03:02:16 | 323,909,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,690 | java | package com.heqifuhou.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import cn.com.phinfo.oaact.R;
/**
* Created by wuhui on 10/16/15.<br>
*/
public class MyRatingBar extends FrameLayout implements View.OnClickListener {
private static final String TAG = MyRatingBar.class.getSimpleName();
private static final int MAX_COUNT = 5;
/**
* Max count of star
*/
private int mMaxCount = MAX_COUNT;
/**
* Count of star
*/
private int mCount = 0;
/**
* Fill drawable of star
*/
private Drawable mFillDrawable = null;
/**
* Empty drawable of star
*/
private Drawable mEmptyDrawable = null;
private OnRatingChangeListener mOnRatingChangeListener = null;
/**
* Space between stars
*/
private int mSpace = 0;
public boolean isTouchRating() {
return mTouchRating;
}
public void setTouchRating(boolean touchRating) {
mTouchRating = touchRating;
}
public boolean isClickRating() {
return mClickRating;
}
public void setClickRating(boolean clickRating) {
mClickRating = clickRating;
}
private boolean mTouchRating = true;
private boolean mClickRating = true;
private LinearLayout mRootLayout;
private ImageView[] mImageViews = null;
private Context mContext;
private float mOldX = 0;
private float mOldY = 0;
private int mOldStarCount = 0;
public MyRatingBar(@NonNull Context context) {
super(context);
init(context, null);
}
public MyRatingBar(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public MyRatingBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
public int getSpace() {
return mSpace;
}
/**
* <p>Set space between stars </p>
*
* @param space space between stars in pixel unit
*/
public void setSpace(int space) {
space = Math.max(0, space);
if (mSpace == space) {
return;
}
mSpace = space;
updateStarViews();
}
public Drawable getFillDrawable() {
return mFillDrawable;
}
public void setFillDrawable(Drawable fillDrawable) {
if (mFillDrawable == fillDrawable) {
return;
}
mFillDrawable = fillDrawable;
updateStarViews();
}
/**
* <p>Set the fill star drawable resource </p>
*
* @param res drawable resource
*/
public void setFillDrawableRes(@DrawableRes int res) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// setFillDrawable(mContext.getDrawable(res));
// } else {
setFillDrawable(mContext.getResources().getDrawable(res));
// }
}
public Drawable getEmptyDrawable() {
return mEmptyDrawable;
}
public void setEmptyDrawable(@Nullable Drawable emptyDrawable) {
mEmptyDrawable = emptyDrawable;
updateStarViews();
}
/**
* <p>Set the empty star drawable resource </p>
*
* @param res drawable resource
*/
public void setEmptyDrawableRes(@DrawableRes int res) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// setEmptyDrawable(mContext.getDrawable(res));
// } else {
setEmptyDrawable(mContext.getResources().getDrawable(res));
// }
}
public void setOnRatingChangeListener(@Nullable OnRatingChangeListener listener) {
mOnRatingChangeListener = listener;
}
/**
* <p>Get max rating count</p>
*
* @return the max rating count
*/
public int getMaxCount() {
return mMaxCount;
}
/**
* <p>Set max rating count which will lead to RatingBar refreshing immediately </p>
*
* @param maxCount
*/
public void setMaxCount(int maxCount) {
maxCount = Math.max(0, maxCount);
if (maxCount == mMaxCount) {
return;
}
mMaxCount = maxCount;
createStarViews(maxCount);
if (maxCount < mCount) {
setCount(maxCount);
}
}
/**
* <p>Get rating count</p>
*
* @return the rating count.
*/
public int getCount() {
return mCount;
}
/**
* <p>Set rating count, this will update rating bar immediately.</p>
*
* @param count the new rating count. If count small than 0 it will be set to 0, or if count
* large than max count it will be set to the max count.
*/
public void setCount(int count) {
count = Math.max(0, Math.min(mMaxCount, count));
if (count == mCount) {
return;
}
int oldCount = mCount;
mCount = count;
updateStarViews();
if (mOnRatingChangeListener != null) {
mOnRatingChangeListener.onChange(this, oldCount, mCount);
}
}
private void init(Context context, AttributeSet attrs) {
mContext = context;
// Retrieve attributes
if (attrs == null) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// mFillDrawable = context.getDrawable(R.drawable.fill);
// mEmptyDrawable = context.getDrawable(R.drawable.empty);
// } else {
mFillDrawable = context.getResources().getDrawable(R.drawable.ratingbar_f);
mEmptyDrawable = context.getResources().getDrawable(R.drawable.ratingbar_n);
// }
} else {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MyRatingBar);
mMaxCount = typedArray.getInteger(R.styleable.MyRatingBar_rb_max_count, MAX_COUNT);
mCount = typedArray.getInteger(R.styleable.MyRatingBar_rb_count, 0);
mFillDrawable = typedArray.getDrawable(R.styleable.MyRatingBar_rb_fill);
mEmptyDrawable = typedArray.getDrawable(R.styleable.MyRatingBar_rb_empty);
mSpace = typedArray.getDimensionPixelSize(R.styleable.MyRatingBar_rb_space, 0);
mClickRating = typedArray.getBoolean(R.styleable.MyRatingBar_rb_click_rating, true);
mTouchRating = typedArray.getBoolean(R.styleable.MyRatingBar_rb_touch_rating, true);
typedArray.recycle();
if (mFillDrawable == null) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// mFillDrawable = context.getDrawable(R.drawable.fill);
// } else {
mFillDrawable = context.getResources().getDrawable(R.drawable.ratingbar_f);
// }
}
mMaxCount = Math.max(0, mMaxCount);
mCount = Math.max(0, Math.min(mCount, mMaxCount));
}
// Create root layout (LinearLayout) used to contain stars
mRootLayout = new LinearLayout(context);
addView(mRootLayout, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
));
createStarViews(mMaxCount);
}
// create star views
private void createStarViews(int count) {
// remove previous child views
if (mRootLayout.getChildCount() > 0) {
mRootLayout.removeAllViews();
}
// create new image views
mImageViews = new ImageView[count];
for (int i = 0; i < mImageViews.length; ++i) {
// Use FrameLayout to wrap the star view
FrameLayout frameLayout = new FrameLayout(getContext());
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(
0, ViewGroup.LayoutParams.MATCH_PARENT, 1
);
mRootLayout.addView(frameLayout, llp);
mImageViews[i] = new ImageView(getContext());
ImageView imageView = mImageViews[i];
imageView.setOnClickListener(this);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setTag(i);
FrameLayout.LayoutParams flp = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
Gravity.CENTER
);
frameLayout.addView(imageView, flp);
}
updateStarViews();
}
/**
* <p>Update the rating bar with current rating count.</p>
*/
private void updateStarViews() {
ImageView imgView;
// update drawable
for (int i = 0; i < mImageViews.length; ++i) {
imgView = mImageViews[i];
imgView.setImageDrawable((i < mCount) ? mFillDrawable : mEmptyDrawable);
// update margin between the stars whose drawable is not null
ViewGroup parent = (ViewGroup) imgView.getParent();
MarginLayoutParams mlp = (MarginLayoutParams) parent.getLayoutParams();
if (imgView.getDrawable() != null
&& (i - 1) >= 0
&& mImageViews[i - 1].getDrawable() != null) {
mlp.setMargins(mSpace, 0, 0, 0);
} else {
mlp.setMargins(0, 0, 0, 0);
}
parent.setLayoutParams(mlp);
}
}
@Override
public void onClick(View v) {
Integer index = (Integer) v.getTag();
setCount(index + 1);
}
@Override
public void setClickable(boolean clickable) {
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mOldX = event.getX();
mOldY = event.getY();
mOldStarCount = getTouchStarCount(event);
return true;
case MotionEvent.ACTION_MOVE:
if (mTouchRating) {
float deltaX = event.getX() - mOldX;
float deltaY = event.getY() - mOldY;
int distance = (int) Math.round(Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)));
if (distance >= ViewConfiguration.getTouchSlop()) {
setCount(getTouchStarCount(event));
}
}
mOldX = event.getX();
mOldY = event.getY();
break;
case MotionEvent.ACTION_UP:
if (mClickRating) {
int starCount = getTouchStarCount(event);
// if touch down and touch up hit the same view think it is a click event
if (starCount == mOldStarCount) {
setCount(starCount);
}
}
break;
default:
break;
}
return super.onTouchEvent(event) && false;
}
private View getStarView(int index) {
return mRootLayout.getChildAt(index);
}
/**
* <p>Get the star count on specified touch position</p>
* @param event touch event
* @return selected star count
*/
private int getTouchStarCount(MotionEvent event) {
int count = 1;
float rawX = event.getRawX();
for (int i = 0; i < getMaxCount(); ++i) {
Rect rect = new Rect();
View view = getStarView(i);
view.getGlobalVisibleRect(rect);
MarginLayoutParams mlp = (MarginLayoutParams) view.getLayoutParams();
if (rawX > rect.right + mlp.rightMargin) {
count += 1;
}
}
return count;
}
public interface OnRatingChangeListener {
/**
* <p>This method will be execute after every change of rating bar </p>
*
* @param preCount previous rating count
* @param curCount current rating count
*/
void onChange(MyRatingBar ratingBar, int preCount, int curCount);
}
}
| [
"tinghuisun@163.com"
] | tinghuisun@163.com |
f0def3bc018a281ccf485d27b2bb510f9496bf7e | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/smallest/93f87bf20be12abd3b52e14015efb6d78b6038d2022e0ab5889979f9c6b6c8c757d6b5a59feae9f8415158057992ae837da76609dc156ea76b5cca7a43a4678b/000/mutations/152/smallest_93f87bf2_000.java | 9398cab3bad924728460db439b84f9b62deeca73 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,457 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class smallest_93f87bf2_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
smallest_93f87bf2_000 mainClass = new smallest_93f87bf2_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
IntObj first = new IntObj (), second = new IntObj (), third =
new IntObj (), fourth = new IntObj ();
output +=
(String.format ("Please enter 4 numbers separated by spaces > "));
first.value = scanner.nextInt ();
second.value = scanner.nextInt ();
third.value = scanner.nextInt ();
fourth.value = scanner.nextInt ();
if (first.value < second.value && first.value < third.value
&& first.value < fourth.value) {
output += (String.format ("%d is the smallest \n ", first.value));
} else if (second.value < first.value && second.value < third.value
&& second.value < fourth.value) {
output += (String.format ("%d is the smallest \n ", second.value));
} else if (((second.value) < (first.value)) && ((second.value) < (third.value))) {
output += (String.format ("%d is the smallest \n ", third.value));
} else if (fourth.value < first.value && fourth.value < second.value
&& fourth.value < third.value) {
output += (String.format ("%d is the smallest \n ", fourth.value));
}
if (true)
return;;
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
7a9680907c669d59a02edbc3ba0bacc0f25a6951 | 43fdb32bf9154d0c84e233d11ae3176f94d67450 | /DoAction.java | c8de3d2c1d435b2370cd1eac1c1494260af81bb8 | [] | no_license | MuhammadjonTohirov/DoAction-java-class-for-android | f35016c70e445ce3f4bc77f7c09934fd973afd18 | 2c382e564ac5fabe9e12d7c5c5e3b7501c960120 | refs/heads/master | 2021-01-12T03:29:58.324690 | 2017-05-09T21:57:32 | 2017-05-09T21:57:32 | 78,220,502 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,655 | java | package uz.android.muhammadjon_tohirov.turbo_test_boss;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.nfc.FormatException;
import android.os.AsyncTask;
import android.util.Base64;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
/**
* Created by M_hacker on 06.12.2016.
*/
public class DoAction {
private static String TAG = "DO ACTION";
public static String convertIntToDate(Integer intDate, String format) throws FormatException {
return new SimpleDateFormat(format).format(intDate * 1000L);
}
public static String convertBitmapToString(Bitmap bitmap) {
Bitmap bm1 = bitmap;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm1.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] b = baos.toByteArray();
String result = Base64.encodeToString(b, Base64.DEFAULT);
return result;
}
public static Bitmap convertByteArrayToBitmap(byte[] bytes) {
return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
}
public static InputStream convertBitmapToInputStream(Bitmap bitmap) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
byte[] imageInByte = byteArrayOutputStream.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(imageInByte);
Log.d(TAG, "convertBitmapToInputStream: done");
return bis;
}
public static Bitmap convertStringToBitmap(String base64) {
byte[] bytes = Base64.decode(base64, Base64.DEFAULT);
return convertByteArrayToBitmap(bytes);
}
public static boolean loadImage(String url, Bitmap b) {
AsyncTask<String, Void, Bitmap> as = new AsyncTask<String, Void, Bitmap>(){
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
}
@Override
protected Bitmap doInBackground(String... strings) {
try {
URLConnection conn = null;
URL u = new URL(strings[0]);
conn = u.openConnection();
conn.connect();
InputStream istream = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(istream);
bis.close();
istream.close();
Log.e("trying", "for url " + strings[0]);
return BitmapFactory.decodeStream(bis);
} catch (Exception e) {
Log.e("failed", "for url "+strings[0]);
return null;
}
}
};
as.execute(url);
return true;
}
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();
return isConnected;
}
}
| [
"tohirov.muhammadjon@mail.ru"
] | tohirov.muhammadjon@mail.ru |
c7ff249e84a1137f58caf4d71e81d8b104887543 | 84e697e5f44a16579ddf727dc77ab2ae030acc57 | /rainbow-shopping-cart/rainbow-shopping-cart-ui-web/src/main/java/org/rainbow/shopping/cart/ui/web/lazy/LongIdLazyDataModel.java | 694209d61bfc3fd7d04fca5a44a109d0b109580f | [] | no_license | biya-bi/rainbow | 4f86414ecfcc884a9ee68984aaf86fb4143ff5bc | 4664bf1ac09a405b5776fd1577d6edeb602c2561 | refs/heads/master | 2020-03-25T12:26:55.188430 | 2018-08-06T19:56:25 | 2018-08-06T19:56:25 | 143,776,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | 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.rainbow.shopping.cart.ui.web.lazy;
/**
*
* @author Biya-Bi
* @param <TEntity>
*/
public abstract class LongIdLazyDataModel<TEntity> extends AbstractLazyDataModel<TEntity, Long> {
/**
*
*/
private static final long serialVersionUID = 6075974495435093548L;
@Override
protected Long toModelId(String rowKey) {
return Long.valueOf(rowKey);
}
}
| [
"biya-bi@hotmail.fr"
] | biya-bi@hotmail.fr |
686fff21cee7427c6dd8ca09892db03e55713df5 | afe1886eac8197104e7e2ab4c70a9ac128a71045 | /pet-clinic-data/src/main/java/petClinic/services/PetTypeService.java | ddda4e2cc8f24aa7397ea1c3dfdcfc354467a6d8 | [] | no_license | SawickiKamil/PetClinic | 8f282f89288cec401a62d72a47dd43e7a8e090e6 | 12f33129838c5da6f6824b9255e3e97821c4fb43 | refs/heads/master | 2020-12-13T12:45:38.030709 | 2020-01-26T20:49:03 | 2020-01-26T20:49:03 | 234,419,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package petClinic.services;
import petClinic.model.PetType;
public interface PetTypeService extends CrudService<PetType, Long> {
}
| [
"sawicki_kamil@onet.pl"
] | sawicki_kamil@onet.pl |
34e3bcec7b85d0dd29d85e1b8749afbb37f14f75 | 126477bc6fb1726d1e8a8c46c700610f3f1f32cb | /src/test/java/Homework1.java | 993a60917a4115ee4eafcf7019f9dcbd04e08917 | [] | no_license | Ksju6ka/QA2 | e78d8154c6dfdc5d6552fd71455badea93680ade | b7a5f5a47809e10d0eac6d9761fa55250c67a912 | refs/heads/master | 2021-06-02T05:39:12.700966 | 2018-08-24T18:53:38 | 2018-08-24T18:53:38 | 136,796,862 | 0 | 0 | null | 2021-02-09T19:24:10 | 2018-06-10T09:49:23 | Java | UTF-8 | Java | false | false | 957 | java | import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import pages.FoodPage;
import pages.HomePage;
import pages.RecipePage;
public class Homework1 {
private final String HOME_PAGE = "http://rus.delfi.lv";
private final String RECIPE_NAME = "Сочный свиной шашлык в быстром маринаде с лимонной кислотой";
@Test
public void Test(){
System.setProperty("webdriver.gecko.driver", "c:/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
HomePage homePage = new HomePage(driver);
homePage.openPage(HOME_PAGE);
homePage.clickFoodMenu();
FoodPage foodPage = new FoodPage(driver);
foodPage.openRecipe(RECIPE_NAME);
RecipePage recipePage = new RecipePage(driver);
recipePage.checkIngredients(RECIPE_NAME);
}
}
| [
"petrosova.oksana@gmail.com"
] | petrosova.oksana@gmail.com |
625ed423667b896562a541fd85ee164bf872b4ab | 4b43468c32afd9b5a18e43f7594235704ba3636f | /first.java | 90848411c55c971b33db5e963deae23f259e2aa4 | [] | no_license | kushagra-18/Kushagra_18CSU | 7d7ab8f4e5f3574e1bf4ec0831ef9a19900c4183 | 67f21d86ca0f9505efb323b0dcf5a69dd5187555 | refs/heads/master | 2020-04-15T20:11:03.811544 | 2019-02-04T09:18:04 | 2019-02-04T09:18:04 | 164,981,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 99 | java | class apples
{
public static void main(String args[])
{
System.out.println("Hello!");
}
} | [
"noreply@github.com"
] | kushagra-18.noreply@github.com |
f45ae967cde5e48977c148581608ca778bd2739b | 340809e9799d5bd0108dfe9711e6710299412da3 | /src/sindrn/pong/Paddle.java | e54b94ed0784aa666992339601c78e9880df2320 | [] | no_license | Sindrus/Pong | f2270c4153533d97deb83512f8c3fb3916a6c240 | 6b0e6e432aff0bb5b56822abd64e8cddab3fa4e9 | refs/heads/master | 2021-01-01T16:30:29.945981 | 2013-04-16T11:07:37 | 2013-04-16T11:07:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package sindrn.pong;
import sheep.game.Sprite;
import sheep.graphics.Image;
/*
* Use of template pattern. Both paddles use most of the same functions,
* only a few values are set differently.
*/
abstract class Paddle extends Sprite{
protected float height;
protected Paddle(Image sprite){
super(sprite);
}
public abstract void checkBounderies();
}
| [
"sindreny@gmail.com"
] | sindreny@gmail.com |
4a0764d5ff6fd1efe372ceba5b4335cbed2839c4 | 9689d469623b444b66346b122164cb2fee8bc473 | /assignment2/src/androidTest/java/se/dropmedia/milan/assignment_2/ApplicationTest.java | 6e9b6a24725efbc543f755d24dc6bde380e4e6d4 | [] | no_license | supergajic/DA401A_Milan_Gajic | 5904d2de2be6de7d3ba4119ea76b14cd16e7869c | b832eb7500e3418498f7291e0f149ec763f3bf89 | refs/heads/master | 2021-01-21T04:43:36.675039 | 2016-06-07T12:24:52 | 2016-06-07T12:24:52 | 42,012,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package se.dropmedia.milan.assignment_2;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"supergajic@gmail.com"
] | supergajic@gmail.com |
74c3aaf0935f240b6aac3d751e77d8bc9a27a984 | aa8a3972d192dc27805b6c564e6bd5a34eb34636 | /modules/adwords_appengine/src/test/java/com/google/api/ads/adwords/jaxws/AdWordsJaxWsSoapCompressionIntegrationTest.java | a29bb7c993c509e3200854c0956ec6317cad62dd | [
"Apache-2.0"
] | permissive | nafae/developer | 201e76ef6909097b07936dbc7f4ef05660fe2a26 | ea3ad63c72009c83c2cdbeebfc3868905a188166 | refs/heads/master | 2021-01-19T17:48:32.453689 | 2014-11-11T22:17:32 | 2014-11-11T22:17:32 | 26,411,286 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,841 | java | // Copyright 2014, Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.api.ads.adwords.jaxws;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.google.api.ads.adwords.jaxws.factory.AdWordsServices;
import com.google.api.ads.adwords.jaxws.testing.SoapRequestXmlProvider;
import com.google.api.ads.adwords.jaxws.v201406.cm.Budget;
import com.google.api.ads.adwords.jaxws.v201406.cm.BudgetBudgetDeliveryMethod;
import com.google.api.ads.adwords.jaxws.v201406.cm.BudgetBudgetPeriod;
import com.google.api.ads.adwords.jaxws.v201406.cm.BudgetOperation;
import com.google.api.ads.adwords.jaxws.v201406.cm.BudgetServiceInterface;
import com.google.api.ads.adwords.jaxws.v201406.cm.Money;
import com.google.api.ads.adwords.jaxws.v201406.cm.Operator;
import com.google.api.ads.adwords.lib.client.AdWordsSession;
import com.google.api.ads.adwords.lib.soap.testing.SoapResponseXmlProvider;
import com.google.api.ads.common.lib.testing.MockHttpIntegrationTest;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.common.collect.Lists;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* Tests that a AdWords JAX-WS SOAP call can be made end-to-end when SOAP compression is enabled.
* This test should be run in its own JVM because it makes changes to system properties that could
* cause issues with other integration tests.
*
* @author Josh Radcliff
*/
@RunWith(JUnit4.class)
public class AdWordsJaxWsSoapCompressionIntegrationTest extends MockHttpIntegrationTest {
private static final String API_VERSION = "v201406";
@BeforeClass
public static void setupClass() {
System.setProperty("api.adwords.useCompression", "true");
}
/**
* Tests making a JAX-WS AdWords API call with OAuth2 and compression enabled.
*/
@Test
public void testGoldenSoap_oauth2() throws Exception {
testHttpServer.setMockResponseBody(SoapResponseXmlProvider.getTestSoapResponse(API_VERSION));
GoogleCredential credential = new GoogleCredential.Builder().setTransport(
new NetHttpTransport()).setJsonFactory(new JacksonFactory()).build();
credential.setAccessToken("TEST_ACCESS_TOKEN");
AdWordsSession session = new AdWordsSession.Builder().withUserAgent("TEST_APP")
.withOAuth2Credential(credential)
.withEndpoint(testHttpServer.getServerUrl())
.withDeveloperToken("TEST_DEVELOPER_TOKEN")
.withClientCustomerId("TEST_CLIENT_CUSTOMER_ID")
.build();
BudgetServiceInterface budgetService =
new AdWordsServices().get(session, BudgetServiceInterface.class);
Budget budget = new Budget();
budget.setName("Test Budget Name");
budget.setPeriod(BudgetBudgetPeriod.DAILY);
Money money = new Money();
money.setMicroAmount(50000000L);
budget.setAmount(money);
budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
BudgetOperation operation = new BudgetOperation();
operation.setOperand(budget);
operation.setOperator(Operator.ADD);
Budget responseBudget = budgetService.mutate(Lists.newArrayList(operation)).getValue().get(0);
assertEquals("Budget ID does not match", 251877074L, responseBudget.getBudgetId().longValue());
assertEquals("Budget name does not match", budget.getName(), responseBudget.getName());
assertEquals("Budget period does not match", budget.getPeriod(), responseBudget.getPeriod());
assertEquals("Budget amount does not match", budget.getAmount().getMicroAmount(),
responseBudget.getAmount().getMicroAmount());
assertEquals("Budget delivery method does not match", budget.getDeliveryMethod(),
responseBudget.getDeliveryMethod());
assertTrue("Compression was enabled but the last request body was not compressed",
testHttpServer.wasLastRequestBodyCompressed());
assertEquals(SoapRequestXmlProvider.getOAuth2SoapRequest(API_VERSION),
testHttpServer.getLastRequestBody());
assertEquals("Bearer TEST_ACCESS_TOKEN", testHttpServer.getLastAuthorizationHttpHeader());
}
}
| [
"jradcliff@google.com"
] | jradcliff@google.com |
25a44f5cc9fe1c949b866cf440e9c44f7a04e138 | 03b7fea4f9cbe89034413a4dcacc81ac5e14331c | /src/main/java/com/xwsxjt/dao/PackPurInformationDaoImpl.java | 53d86f5d852ea34968aa9eea607f414df53669bd | [] | no_license | HeavenKiller/task_web | a6793c57a3b13ad51729d7d35201f80c04227282 | 53a6311867729d7e616eed5c54e653cc1eb4a9e4 | refs/heads/master | 2021-08-20T02:54:59.749180 | 2017-11-28T02:31:54 | 2017-11-28T02:31:54 | 111,492,654 | 2 | 1 | null | 2017-11-24T08:23:54 | 2017-11-21T03:13:07 | Java | UTF-8 | Java | false | false | 2,350 | java | package com.xwsxjt.dao; /**
* @Project: task-web
* @Package com.xwsxjt.dao
* @author xiaoshijie
* @date 2017/10/29 16:08
* @Copyright: 2017 www.zyht.com Inc. All rights reserved.
* @version V1.0
*/
import com.xwsxjt.base.dao.BaseDaoImpl;
import com.xwsxjt.domain.PackPurInformation;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @author xiaoshijie
* @ClassName PackPurInfoDaoImpl
* @Description 套餐购买Dao实现类
* @date 2017/10/29
*/
@Repository("packPurInformationDao")
public class PackPurInformationDaoImpl extends BaseDaoImpl<PackPurInformation> implements PackPurInformationDao {
/**
* @Title: 添加套餐购买信息
* @Description: savePackPurInfo
* @author xiaoshijie
* @date 2017-10-29
* @param packPurInformation
* @return long
*/
@Override
public long savePackPurInfo(PackPurInformation packPurInformation) {
sqlSessionTemplate.insert(getMybaitsNameSpace()+"savePackPurInfo", packPurInformation);
return packPurInformation.getId();
}
/**
* @Title: findPackPurInfoListByPageAndCustomerId
* @Description: 获得客户套餐购买记录
* @author xiaoshijie
* @date 2017-10-29
* @param pageMap
* @return List
*/
@Override
public List<PackPurInformation> findPackPurInfoListByPageAndCustomerId(Map pageMap) {
return sqlSessionTemplate.selectList(getMybaitsNameSpace() + "findPackPurInfoList", pageMap);
}
/**
* @Title: deletePackPurInfo
* @Description: 根据ID删除套餐信息
* @author xiaoshijie
* @date 2017-10-30
* @param packPurInfoMap
* @return int
*/
@Override
public int deletePackPurInfo(Map packPurInfoMap) {
return sqlSessionTemplate.delete(getMybaitsNameSpace()+"deletePackPurInfo", packPurInfoMap);
}
/**
* @Title: getRowCountForCustomer
* @Description: 获得客户的套餐购买记录
* @author xiaoshijie
* @date 2017-10-30
* @param customerId
* @return int
*/
@Override
public int getRowCountForCustomer(long customerId) {
return sqlSessionTemplate.selectOne(getMybaitsNameSpace()+"getRowCountForCustomer",customerId);
}
}
| [
"1710550406@qq.com"
] | 1710550406@qq.com |
65cf4bb3a79dcee14f1ada12a5ec8f9c1e1b1bcd | 924076bb9f7ecfd27eec7ed3c9936a222d1e70bc | /app/src/main/java/com/leo/events/shareutil/share/instance/WeiboShareInstance.java | 98d8281992830d573548272c731c0ff4e1578a47 | [] | no_license | JuneLeo/Share | f78049f61543413ae3b8cb2bfecf73982b9db9c5 | 6ccb6636f03c0a9330fbaa53baff8b64c22b1120 | refs/heads/master | 2021-06-28T14:11:06.406605 | 2020-09-27T02:22:30 | 2020-09-27T02:22:30 | 158,804,377 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,044 | java | package com.leo.events.shareutil.share.instance;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Pair;
import com.leo.events.shareutil.ShareUtil;
import com.leo.events.shareutil.share.ImageDecoder;
import com.leo.events.shareutil.share.ShareImageObject;
import com.leo.events.shareutil.share.ShareListener;
import com.sina.weibo.sdk.api.ImageObject;
import com.sina.weibo.sdk.api.TextObject;
import com.sina.weibo.sdk.api.WeiboMultiMessage;
import com.sina.weibo.sdk.api.share.IWeiboShareAPI;
import com.sina.weibo.sdk.api.share.SendMessageToWeiboResponse;
import com.sina.weibo.sdk.api.share.SendMultiMessageToWeiboRequest;
import com.sina.weibo.sdk.api.share.WeiboShareSDK;
import com.sina.weibo.sdk.constant.WBConstants;
import rx.Emitter;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.schedulers.Schedulers;
/**
* Created by shaohui on 2016/11/18.
*/
public class WeiboShareInstance implements ShareInstance {
/**
* 微博分享限制thumb image必须小于2097152,否则点击分享会没有反应
*/
private IWeiboShareAPI mWeiboShareAPI;
private static final int TARGET_SIZE = 1024;
private static final int TARGET_LENGTH = 2097152;
public WeiboShareInstance(Context context, String appId) {
mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(context, appId);
mWeiboShareAPI.registerApp();
}
@Override
public void shareText(int platform, String text, Activity activity, ShareListener listener) {
TextObject textObject = new TextObject();
textObject.text = text;
WeiboMultiMessage message = new WeiboMultiMessage();
message.textObject = textObject;
sendRequest(activity, message);
}
@Override
public void shareMedia(int platform, final String title, final String targetUrl, String summary,
ShareImageObject shareImageObject, final Activity activity,
final ShareListener listener) {
String content = String.format("%s %s", title, targetUrl);
shareTextOrImage(shareImageObject, content, activity, listener);
}
@Override
public void shareImage(int platform, ShareImageObject shareImageObject, Activity activity,
ShareListener listener) {
shareTextOrImage(shareImageObject, null, activity, listener);
}
@Override
public void handleResult(Intent intent) {
SendMessageToWeiboResponse baseResponse =
new SendMessageToWeiboResponse(intent.getExtras());
switch (baseResponse.errCode) {
case WBConstants.ErrorCode.ERR_OK:
ShareUtil.mShareListener.shareSuccess();
break;
case WBConstants.ErrorCode.ERR_FAIL:
ShareUtil.mShareListener.shareFailure(new Exception(baseResponse.errMsg));
break;
case WBConstants.ErrorCode.ERR_CANCEL:
ShareUtil.mShareListener.shareCancel();
break;
default:
ShareUtil.mShareListener.shareFailure(new Exception(baseResponse.errMsg));
}
}
@Override
public boolean isInstall(Context context) {
return mWeiboShareAPI.isWeiboAppInstalled();
}
@Override
public void recycle() {
mWeiboShareAPI = null;
}
private void shareTextOrImage(final ShareImageObject shareImageObject, final String text,
final Activity activity, final ShareListener listener) {
Observable.fromEmitter(new Action1<Emitter<Pair<String, byte[]>>>() {
@Override
public void call(Emitter<Pair<String, byte[]>> emitter) {
try {
String path = ImageDecoder.decode(activity, shareImageObject);
emitter.onNext(Pair.create(path,
ImageDecoder.compress2Byte(path, TARGET_SIZE, TARGET_LENGTH)));
emitter.onCompleted();
} catch (Exception e) {
emitter.onError(e);
}
}
}, Emitter.BackpressureMode.DROP)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnRequest(new Action1<Long>() {
@Override
public void call(Long aLong) {
listener.shareRequest();
}
})
.subscribe(new Action1<Pair<String, byte[]>>() {
@Override
public void call(Pair<String, byte[]> pair) {
ImageObject imageObject = new ImageObject();
imageObject.imageData = pair.second;
imageObject.imagePath = pair.first;
WeiboMultiMessage message = new WeiboMultiMessage();
message.imageObject = imageObject;
if (!TextUtils.isEmpty(text)) {
TextObject textObject = new TextObject();
textObject.text = text;
message.textObject = textObject;
}
sendRequest(activity, message);
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
activity.finish();
listener.shareFailure(new Exception(throwable));
}
});
}
private void sendRequest(Activity activity, WeiboMultiMessage message) {
SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
request.transaction = String.valueOf(System.currentTimeMillis());
request.multiMessage = message;
mWeiboShareAPI.sendRequest(activity, request);
}
}
| [
"june.leo.me@gmail.com"
] | june.leo.me@gmail.com |
447dbc524c710533fb0ee49a041d8482b83b460a | b98a59899a5bb8d81fbf5935b84e7a3e90f243a8 | /src/main/java/org/apache/playframework/util/DESedeCoder.java | 680d2798404a076c9aa36b9ad5eebf970371a09e | [] | no_license | willenfoo/playframework | 306c36aee3892f6a22c618c4f0b140b7d60a46e5 | bfc01b7c76ee16c08e4f87f8c7c6cd33b456b68c | refs/heads/master | 2022-12-26T05:34:55.672219 | 2017-03-15T01:30:10 | 2017-03-15T01:30:10 | 72,610,481 | 4 | 6 | null | 2022-12-16T10:34:38 | 2016-11-02T06:26:04 | Java | UTF-8 | Java | false | false | 4,008 | java | package org.apache.playframework.util;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
/**
* DESede对称加密算法演示
* @author kongqz
* */
public class DESedeCoder {
private static final String KEY = "mzc9Ms2wwYCbdfLf0JR5f8KXedwczVfs";
/**
* 密钥算法
*/
public static final String KEY_ALGORITHM = "DESede";
/**
* 加密/解密算法/工作模式/填充方式
*
*/
public static final String CIPHER_ALGORITHM = "DESede/ECB/PKCS5Padding";
/**
* 生成密钥
* @return byte[] 二进制密钥
* @throws NoSuchAlgorithmException
* */
public static byte[] initkey() throws NoSuchAlgorithmException {
//实例化密钥生成器
KeyGenerator kg = KeyGenerator.getInstance(KEY_ALGORITHM);
//初始化密钥生成器
kg.init(168);
//生成密钥
SecretKey secretKey = kg.generateKey();
//获取二进制密钥编码形式
return secretKey.getEncoded();
}
/**
* 转换密钥
* @param key 二进制密钥
* @return Key 密钥
* */
public static Key toKey(byte[] key) throws Exception {
//实例化Des密钥
DESedeKeySpec dks = new DESedeKeySpec(key);
//实例化密钥工厂
SecretKeyFactory keyFactory = SecretKeyFactory
.getInstance(KEY_ALGORITHM);
//生成密钥
SecretKey secretKey = keyFactory.generateSecret(dks);
return secretKey;
}
/**
* 加密数据
* @param data 待加密数据
* @param key 密钥
* @return byte[] 加密后的数据
* */
public static byte[] encrypt(byte[] data, byte[] key) throws Exception {
//还原密钥
Key k = toKey(key);
//实例化
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
//初始化,设置为加密模式
cipher.init(Cipher.ENCRYPT_MODE, k);
//执行操作
return cipher.doFinal(data);
}
/**
* 加密数据
* @param data 待加密数据
* @param key 密钥
* @return byte[] 加密后的数据
* */
public static byte[] encrypt(byte[] data) throws Exception {
//还原密钥
Key k = toKey(KEY.getBytes());
//实例化
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
//初始化,设置为加密模式
cipher.init(Cipher.ENCRYPT_MODE, k);
//执行操作
return cipher.doFinal(data);
}
/**
* 解密数据
* @param data 待解密数据
* @param key 密钥
* @return byte[] 解密后的数据
* */
public static byte[] decrypt(byte[] data, byte[] key) throws Exception {
//欢迎密钥
Key k = toKey(key);
//实例化
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
//初始化,设置为解密模式
cipher.init(Cipher.DECRYPT_MODE, k);
//执行操作
return cipher.doFinal(data);
}
/**
* 解密数据
* @param data 待解密数据
* @param key 密钥
* @return byte[] 解密后的数据
* */
public static byte[] decrypt(byte[] data) throws Exception {
//欢迎密钥
Key k = toKey(KEY.getBytes());
//实例化
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
//初始化,设置为解密模式
cipher.init(Cipher.DECRYPT_MODE, k);
//执行操作
return cipher.doFinal(data);
}
/**
* 进行加解密的测试
* @throws Exception
*/
public static void main(String[] args) throws Exception {
String str = "DESede";
System.out.println("原文:/t" + str);
//初始化密钥
byte[] key = DESedeCoder.initkey();
String ddd = Base64.encodeToString(key);
System.out.println("密钥:/t=====" + Base64.encodeToString(key));
//加密数据
byte[] data = DESedeCoder.encrypt(str.getBytes(),key);
//System.out.println("加密后:/t" + Base64.encodeToString(data));
//解密数据
data = DESedeCoder.decrypt(data,key);
System.out.println("解密后:/t" + new String(data));
}
} | [
"willenfoo@gmail.com"
] | willenfoo@gmail.com |
bffbeee2f01874906c3a27a6b532abc8d8289242 | 534226ba04e5d4b1b2fdd51929b5f4aab0c7f0eb | /UniversityMvn/src/main/java/com/solvd/UniversityMvn/exceptions/NullStudentsException.java | fc26d112a32e8dc32ac60600ddb83684012100ed | [] | no_license | TinchoLorenzo/SolvdCourseUniversity | 8d85c0338ec1313c5daa7346793e88653691c6cb | b41d96f69abe84c199c14f1266e690bcf87cd1ba | refs/heads/main | 2023-04-30T12:07:30.162018 | 2021-05-17T11:48:26 | 2021-05-17T11:48:26 | 354,650,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package com.solvd.UniversityMvn.exceptions;
public class NullStudentsException extends LessonException {
public NullStudentsException() {
// TODO Auto-generated constructor stub
super("The students cannot be null");
}
}
| [
"tincholorenz@gmail.com"
] | tincholorenz@gmail.com |
4dd064d1873244f0a8690c63d02a6c022a2ee025 | 1295f120e1fc852606996e4e1ea1920b7829a957 | /examples/oop/src/main/dependencyinjection/withDI/Consumer.java | f3f45c15cacedc2912f34409d12a0ab668a8c6e6 | [
"MIT"
] | permissive | superpikar/learnjava | f322ba2c8c72ad01c0a4407d7657e7a14bc0518e | 896e99cd39db4493c4e25fdd7491d0265ae0ecd4 | refs/heads/master | 2020-12-31T07:44:06.113080 | 2017-04-03T01:24:05 | 2017-04-03T01:24:05 | 86,529,108 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 122 | java | package dependencyinjection.withDI;
public interface Consumer {
void processMessage(String message, String receiver);
}
| [
"dzulfikar.adiputra@gmail.com"
] | dzulfikar.adiputra@gmail.com |
334e64a533132fc884fd8061ffd94b633efdd3e1 | 02295775c1c069dcd761a4782df4fc432daf7c84 | /src/main/java/kodlamaio/Hrms/core/utilities/adapters/abstracts/IEmailService.java | 162391b832abed2bc3eeaa1f540a2ca021edaa02 | [] | no_license | filizsgursan/HrmsProject | a24906f1aca09cc173a811293bbae14066d9d996 | de384ed4b2c0317864ee1a82066452e9e3730308 | refs/heads/main | 2023-06-15T18:30:57.083062 | 2021-07-11T09:28:49 | 2021-07-11T09:28:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package kodlamaio.Hrms.core.utilities.adapters.abstracts;
import kodlamaio.Hrms.entities.concretes.Users;
public interface IEmailService {
boolean verify (Users users);
void sendMail(String email,String message);
}
| [
"filizzgursan@outlook.com"
] | filizzgursan@outlook.com |
eabd88d4eed3c9d11da152ddd7518047d2b618b4 | 7da1235fc9c39c192ebf30e7529612c8f8dc604a | /app/src/main/java/com/hienthai/music_/Adapter/ViewPagerPlayNhac.java | 01dff01a6d1196e207076cd5be6aba90decf86d0 | [] | no_license | ThaiXuanHien/Music_ | 04387c3f20aef597394fd3cef2a066518677fd57 | 1fdb18564db527df1e76200c9e38af1cd40fb74e | refs/heads/master | 2023-06-03T02:44:18.987228 | 2021-06-21T10:36:24 | 2021-06-21T10:36:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 779 | java | package com.hienthai.music_.Adapter;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.ArrayList;
public class ViewPagerPlayNhac extends FragmentPagerAdapter {
public final ArrayList<Fragment> fragmentArrayList = new ArrayList<>();
public ViewPagerPlayNhac(@NonNull FragmentManager fm) {
super(fm);
}
@NonNull
@Override
public Fragment getItem(int position) {
return fragmentArrayList.get(position);
}
@Override
public int getCount() {
return fragmentArrayList.size();
}
public void addFragment(Fragment fragment) {
fragmentArrayList.add(fragment);
}
}
| [
"xtit6789@gmail.com"
] | xtit6789@gmail.com |
55069d763c7d286fe5660fd58fa7349e56b1b78d | 1b1324d377dfd47d0827d6d2c1ac1f7355a38079 | /AndroidStudio/Supervisor/app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/coordinatorlayout/R.java | d3b81db6b41eaae928b348eb1b1fd41a40b778d3 | [] | no_license | Alexjandrohum/LearningTecnologies | fe751a33dd34ee508161caac80d3843772092d0b | 833d7f2756523a75fe1d1c1fdf05519052dbe186 | refs/heads/main | 2022-12-26T21:53:37.926693 | 2020-10-05T17:54:49 | 2020-10-05T17:54:49 | 301,494,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,399 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.coordinatorlayout;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f040027;
public static final int coordinatorLayoutStyle = 0x7f0400ab;
public static final int font = 0x7f0400de;
public static final int fontProviderAuthority = 0x7f0400e0;
public static final int fontProviderCerts = 0x7f0400e1;
public static final int fontProviderFetchStrategy = 0x7f0400e2;
public static final int fontProviderFetchTimeout = 0x7f0400e3;
public static final int fontProviderPackage = 0x7f0400e4;
public static final int fontProviderQuery = 0x7f0400e5;
public static final int fontStyle = 0x7f0400e6;
public static final int fontVariationSettings = 0x7f0400e7;
public static final int fontWeight = 0x7f0400e8;
public static final int keylines = 0x7f040116;
public static final int layout_anchor = 0x7f04011b;
public static final int layout_anchorGravity = 0x7f04011c;
public static final int layout_behavior = 0x7f04011d;
public static final int layout_dodgeInsetEdges = 0x7f040149;
public static final int layout_insetEdge = 0x7f040152;
public static final int layout_keyline = 0x7f040153;
public static final int statusBarBackground = 0x7f0401b0;
public static final int ttcIndex = 0x7f040212;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f060090;
public static final int notification_icon_bg_color = 0x7f060091;
public static final int ripple_material_light = 0x7f0600a2;
public static final int secondary_text_default_material_light = 0x7f0600a5;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f070050;
public static final int compat_button_inset_vertical_material = 0x7f070051;
public static final int compat_button_padding_horizontal_material = 0x7f070052;
public static final int compat_button_padding_vertical_material = 0x7f070053;
public static final int compat_control_corner_material = 0x7f070054;
public static final int compat_notification_large_icon_max_height = 0x7f070055;
public static final int compat_notification_large_icon_max_width = 0x7f070056;
public static final int notification_action_icon_size = 0x7f0700c2;
public static final int notification_action_text_size = 0x7f0700c3;
public static final int notification_big_circle_margin = 0x7f0700c4;
public static final int notification_content_margin_start = 0x7f0700c5;
public static final int notification_large_icon_height = 0x7f0700c6;
public static final int notification_large_icon_width = 0x7f0700c7;
public static final int notification_main_column_padding_top = 0x7f0700c8;
public static final int notification_media_narrow_margin = 0x7f0700c9;
public static final int notification_right_icon_size = 0x7f0700ca;
public static final int notification_right_side_padding_top = 0x7f0700cb;
public static final int notification_small_icon_background_padding = 0x7f0700cc;
public static final int notification_small_icon_size_as_large = 0x7f0700cd;
public static final int notification_subtext_size = 0x7f0700ce;
public static final int notification_top_pad = 0x7f0700cf;
public static final int notification_top_pad_large_text = 0x7f0700d0;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f08009d;
public static final int notification_bg = 0x7f08009e;
public static final int notification_bg_low = 0x7f08009f;
public static final int notification_bg_low_normal = 0x7f0800a0;
public static final int notification_bg_low_pressed = 0x7f0800a1;
public static final int notification_bg_normal = 0x7f0800a2;
public static final int notification_bg_normal_pressed = 0x7f0800a3;
public static final int notification_icon_background = 0x7f0800a4;
public static final int notification_template_icon_bg = 0x7f0800a5;
public static final int notification_template_icon_low_bg = 0x7f0800a6;
public static final int notification_tile_bg = 0x7f0800a7;
public static final int notify_panel_notification_icon_bg = 0x7f0800a8;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f090012;
public static final int action_divider = 0x7f090014;
public static final int action_image = 0x7f090015;
public static final int action_text = 0x7f09001b;
public static final int actions = 0x7f09001c;
public static final int async = 0x7f090027;
public static final int blocking = 0x7f09002b;
public static final int bottom = 0x7f09002c;
public static final int chronometer = 0x7f090038;
public static final int end = 0x7f090059;
public static final int forever = 0x7f09006a;
public static final int icon = 0x7f090073;
public static final int icon_group = 0x7f090074;
public static final int info = 0x7f090080;
public static final int italic = 0x7f090084;
public static final int left = 0x7f09008f;
public static final int line1 = 0x7f090091;
public static final int line3 = 0x7f090092;
public static final int none = 0x7f09009f;
public static final int normal = 0x7f0900a0;
public static final int notification_background = 0x7f0900a1;
public static final int notification_main_column = 0x7f0900a2;
public static final int notification_main_column_container = 0x7f0900a3;
public static final int right = 0x7f0900b3;
public static final int right_icon = 0x7f0900b4;
public static final int right_side = 0x7f0900b5;
public static final int start = 0x7f0900df;
public static final int tag_transition_group = 0x7f0900e8;
public static final int tag_unhandled_key_event_manager = 0x7f0900e9;
public static final int tag_unhandled_key_listeners = 0x7f0900ea;
public static final int text = 0x7f0900eb;
public static final int text2 = 0x7f0900ec;
public static final int time = 0x7f0900f4;
public static final int title = 0x7f0900f5;
public static final int top = 0x7f0900f9;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f0a000f;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0c0046;
public static final int notification_action_tombstone = 0x7f0c0047;
public static final int notification_template_custom_big = 0x7f0c004e;
public static final int notification_template_icon_group = 0x7f0c004f;
public static final int notification_template_part_chronometer = 0x7f0c0053;
public static final int notification_template_part_time = 0x7f0c0054;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0e0079;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0f0119;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f011a;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f011c;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f011f;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0121;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f01c8;
public static final int Widget_Compat_NotificationActionText = 0x7f0f01c9;
public static final int Widget_Support_CoordinatorLayout = 0x7f0f01f8;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f040027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] CoordinatorLayout = { 0x7f040116, 0x7f0401b0 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f04011b, 0x7f04011c, 0x7f04011d, 0x7f040149, 0x7f040152, 0x7f040153 };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f0400e0, 0x7f0400e1, 0x7f0400e2, 0x7f0400e3, 0x7f0400e4, 0x7f0400e5 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0400de, 0x7f0400e6, 0x7f0400e7, 0x7f0400e8, 0x7f040212 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"alejandrohermen.97@gmail.com"
] | alejandrohermen.97@gmail.com |
8eca49286615b6695a008bfd421032de931d1ac2 | a58f28082498838d00c4d5b5cb55ebb05f68fa88 | /src/com/mipo/problem/Problems.java | 79c1d2d17dc6d2c2ae21bb04c5660f155a3dfbe4 | [] | no_license | mipo9527/leetcode | e61cd668e3c049c551701945b67c0f254cc94d92 | c33214f85bda8b33809670151ac0dd8d9468ead3 | refs/heads/master | 2021-07-16T22:27:02.771825 | 2018-12-19T07:01:58 | 2018-12-19T07:01:58 | 144,270,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,933 | java | package com.mipo.problem;
import java.util.Arrays;
import javax.management.RuntimeErrorException;
/**
* LeetCode Solutions
* @author mipo
*
*/
public class Problems {
public static class ListNode {
int val;
ListNode next;
ListNode(int x) { val = x; }
}
public static ListNode addTwoNumbers(ListNode l1, ListNode l2) {
int p = (l1.val+l2.val)/10;
ListNode root = new ListNode((l1.val+l2.val)%10);
ListNode f = l1;
ListNode s = l2;
ListNode c = root;
while(true){
if(f.next!=null&&s.next!=null){
c.next = new ListNode((f.next.val+s.next.val+p)%10);
c = c.next;
p = (f.next.val+s.next.val+p)/10;
f = f.next;
s = s.next;
continue;
}
if(f.next!=null){
c.next = new ListNode((f.next.val+p)%10);
c = c.next;
p = (f.next.val+p)/10;
f = f.next;
continue;
}else
if(s.next!=null){
c.next = new ListNode((s.next.val+p)%10);
c = c.next;
p = (s.next.val+p)/10;
s = s.next;
continue;
}
if(f.next==null&&s.next==null){
if(p!=0)c.next = new ListNode(p);
break;
}
}
return root;
}
public void test1(){
ListNode l1 = new ListNode(9);
l1.next = new ListNode(8);
//l1.next.next = new ListNode(1);
ListNode l2 = new ListNode(1);
ListNode res = addTwoNumbers(l1,l2);
while(res!=null){
System.out.println(res.val);
res= res.next;
}
}
/**
* There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
Example 1:
nums1 = [1, 3]
nums2 = [2]
The median is 2.0
* @param nums1
* @param nums2
* @return
*/
public double findMedianSortedArrays(int[] nums1, int[] nums2) {
boolean isOdd = (nums1.length+nums2.length)%2>0;
int mid = (nums1.length+nums2.length+1)/2;
if(nums2.length<nums1.length){
int[] tmp = nums1;nums1 = nums2;nums2 = tmp;
}
int begin = 0 ,end = nums1.length;
while(begin<=end){
int split1 = (begin+end)/2;
int split2 = mid - split1;
if(split1<end&&nums1[split1]<nums2[split2-1]){
begin++;
continue;
}
if(split1>begin&&nums2[split2]<nums1[split1-1]){
end--;
continue;
}
int maxLeft = 0;
if (split1 == 0) { maxLeft = nums2[split2-1]; }
else if (split2 == 0) { maxLeft = nums1[split1-1]; }
else { maxLeft = Math.max(nums1[split1-1], nums2[split2-1]); }
if (isOdd) { return maxLeft; }
int minRight = 0;
if (split1 == nums1.length) { minRight = nums2[split2]; }
else if (split2 == nums2.length) { minRight = nums1[split1]; }
else { minRight = Math.min(nums2[split2], nums1[split1]); }
return (maxLeft + minRight) / 2.0;
}
return 0;
}
public void test2(){
System.out.println(findMedianSortedArrays(new int[]{5}, new int[]{1,2,3,4,6}));
System.out.println(findMedianSortedArrays(new int[]{2}, new int[]{1,3,4,5,6}));
System.out.println(findMedianSortedArrays(new int[]{1}, new int[]{2,3,4,5,6}));
System.out.println(findMedianSortedArrays(new int[]{1,3}, new int[]{2}));
System.out.println(findMedianSortedArrays(new int[]{4}, new int[]{1,2,3,5}));
System.out.println(findMedianSortedArrays(new int[]{1,4}, new int[]{2,3}));
System.out.println(findMedianSortedArrays(new int[]{4}, new int[]{1,2,3}));
System.out.println(findMedianSortedArrays(new int[]{2}, new int[]{1,3,4}));
System.out.println(findMedianSortedArrays(new int[]{1, 3}, new int[]{2,4,5}));
System.out.println(findMedianSortedArrays(new int[]{1, 2}, new int[]{3,4,4,4}));
}
public static void main(String args[]){
ListNode l1 = new ListNode(9);
l1.next = new ListNode(8);
//l1.next.next = new ListNode(1);
ListNode l2 = new ListNode(1);
ListNode res = addTwoNumbers(l1,l2);
while(res!=null){
System.out.println(res.val);
res= res.next;
}
}
}
| [
"775335908@qq.com"
] | 775335908@qq.com |
3841bca7473f5e4216de65973754ea2f44df39aa | 48508d68095c67eb7024a33c420b46e3f14c7fe3 | /src/com/braker/core/model/AssetType.java | 59daac1c6c398e347f745daa13b218f0ef67de1b | [] | no_license | MengleiZhao/nkgl_tjsfj | ba33a3244dc318a6525d04b9f8195743f937cff9 | 80cf9ae7c557365d19e71429a05e9a5b21e32169 | refs/heads/master | 2022-07-30T04:31:47.631353 | 2021-04-22T03:36:52 | 2021-04-22T03:36:52 | 360,372,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,127 | java | package com.braker.core.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.braker.common.entity.Combobox;
import com.braker.common.entity.GenericEntityNow;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@SuppressWarnings("serial")
@Entity
@Table(name = "t_asset_type")
@JsonIgnoreProperties(ignoreUnknown = true)
public class AssetType extends GenericEntityNow{
@Column(name = "TYPECODE")
private String code;
@Column(name = "TYPENAME")
private String name;
@Column(name = "TYPE_ID")
private String typeId;
@Column(name = "shaort_name")
private String shortName;
@Column(name = "ASSET_TYPE")
private String assetType; //资产类型 0:固定资产 1:无形资产
@Column(name = "PARENTID")
private String parentId; //父级ID
@Column(name = "UNIT")
private String unit; //计量单位
@Column(name = "EXPLAIN")
private String explain; //说明
@Column(name = "LEVE")
private Integer leve; //级别
public String getCode() {
return code;
}
public String getAssetType() {
return assetType;
}
public void setAssetType(String assetType) {
this.assetType = assetType;
}
public String getTypeId() {
return typeId;
}
public String getExplain() {
return explain;
}
public void setExplain(String explain) {
this.explain = explain;
}
public void setTypeId(String typeId) {
this.typeId = typeId;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public Integer getLeve() {
return leve;
}
public void setLeve(Integer leve) {
this.leve = leve;
}
}
| [
"32733288+MengleiZhao@users.noreply.github.com"
] | 32733288+MengleiZhao@users.noreply.github.com |
ead47819b45e392650c2ed4778b454bd0ef9ab1f | 7c8d2d2791b63d49edaf464129849a585460c880 | /2运营管理系统/AccWebOp/src/com/goldsign/acc/app/prminfo/entity/Contc.java | b8ef0a9d463df89ad9acecf930115ea8d5618a12 | [] | no_license | wuqq-20191129/wlmq | 5cd3ebc50945bde41d0fd615ba93ca95ab1a2235 | ae26d439af09097b65c90cad8d22954cd91fe5f5 | refs/heads/master | 2023-01-14T03:19:23.226824 | 2020-11-24T01:43:22 | 2020-11-24T02:09:41 | 315,494,185 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,438 | 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.goldsign.acc.app.prminfo.entity;
import java.io.Serializable;
/**
*
* @author:mh
* @create date: 2017-6-16
*/
public class Contc implements Serializable{
/**
* @return the contc_id
*/
public String getContc_id() {
return contc_id;
}
/**
* @param contc_id the contc_id to set
*/
public void setContc_id(String contc_id) {
this.contc_id = contc_id;
}
/**
* @return the contc_name
*/
public String getContc_name() {
return contc_name;
}
/**
* @param contc_name the contc_name to set
*/
public void setContc_name(String contc_name) {
this.contc_name = contc_name;
}
/**
* @return the link_man
*/
public String getLink_man() {
return link_man;
}
/**
* @param link_man the link_man to set
*/
public void setLink_man(String link_man) {
this.link_man = link_man;
}
/**
* @return the tel
*/
public String getTel() {
return tel;
}
/**
* @param tel the tel to set
*/
public void setTel(String tel) {
this.tel = tel;
}
/**
* @return the fax
*/
public String getFax() {
return fax;
}
/**
* @param fax the fax to set
*/
public void setFax(String fax) {
this.fax = fax;
}
/**
* @return the sequence
*/
public String getSequence() {
return sequence;
}
/**
* @param Sequence the sequence to set
*/
public void setSequence(String sequence) {
this.sequence = sequence;
}
/**
* @return the record_flag
*/
public String getRecord_flag() {
return record_flag;
}
/**
* @param record_flag the record_flag to set
*/
public void setRecord_flag(String record_flag) {
this.record_flag = record_flag;
}
private String contc_id;
private String contc_name;
private String link_man;
private String tel;
private String fax;
private String sequence;
private String record_flag;
}
| [
"13821571040@163.com"
] | 13821571040@163.com |
60acc656d35ebd987b36d6335b1dd0a5ac57e8ef | db77bbcf6b7be8112eb676677ac6e5ffc928b91c | /Lab3Task2/src/SVertexP2T2.java | d3d7af03feb1a9f428d606c2813e24833a226204 | [] | no_license | AlexanderChibirev/ComputerGraphics | 7bd74c5ebff1a3470636d5efce633b6c4d910813 | 29b2f4e243e302347b8fb107fe879cb8d4511eb0 | refs/heads/master | 2021-01-18T18:51:55.145522 | 2017-01-11T22:05:14 | 2017-01-11T22:05:14 | 68,323,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | import javax.vecmath.Vector2f;
public class SVertexP2T2 {
public Vector2f position;
public Vector2f texCoord;
public SVertexP2T2(Vector2f position, Vector2f texCoord){
this.position = position;
this.texCoord = texCoord;
}
}; | [
"www.darmagh@mail.ru"
] | www.darmagh@mail.ru |
0a8e4133d706f596ecf31c99c829fc5e810bbb2f | 2cbaa206212960b2d999a65b21490323976158a2 | /src/main/java/org/springframework/transaction/jta/WebSphereTransactionManagerFactoryBean.java | 8c8c8672892c19bcfb6122365cf4c7e082317092 | [] | no_license | mangr3n/spring-2.5.6-java8 | a40b8cd5c80846e6ca1fa37dafe64668d47677e4 | 7da66576c873054b4779a0a197f89e44452a9419 | refs/heads/master | 2023-02-10T00:42:18.256318 | 2021-01-11T16:54:54 | 2021-01-11T16:54:54 | 328,728,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,591 | java | /*
* Copyright 2002-2007 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 org.springframework.transaction.jta;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.transaction.TransactionManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.transaction.TransactionSystemException;
/**
* {@link org.springframework.beans.factory.FactoryBean} that retrieves
* the JTA TransactionManager for IBM's WebSphere application servers
* (versions 5.1, 6.0 and 6.1).
*
* <p>Uses WebSphere's static accessor methods to obtain the internal JTA
* TransactionManager. This is known to work reliably on all tested WebSphere
* versions; however, access to the internal TransactionManager facility
* is not officially supported by IBM.
*
* <p>In combination with Spring's JtaTransactionManager, this FactoryBean
* can be used to enable transaction suspension (PROPAGATION_REQUIRES_NEW,
* PROPAGATION_NOT_SUPPORTED) on WebSphere:
*
* <pre>
* <bean id="wsJtaTm" class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean"/>
*
* <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
* <property name="transactionManager ref="wsJtaTm"/>
* </bean></pre>
*
* Note that Spring's JtaTransactionManager will continue to use the JTA
* UserTransaction for standard transaction demarcation, as defined by
* standard J2EE. It will only use the provided WebSphere TransactionManager
* in case of actual transaction suspension needs. <i>If you do not require
* transaction suspension in the first place, do not bother with this FactoryBean.</i>
*
* <p><b>NOTE: On recent WebSphere 6.0.x and 6.1.x versions, this class has
* been superseded by the {@link WebSphereUowTransactionManager} class, which
* uses IBM's official UOWManager API facility for transaction suspension.</b>
* The WebSphereUowTransactionManager class is a direct replacement for a
* standard JtaTransactionManager definition, without further configuration.
*
* @author Juergen Hoeller
* @since 21.01.2004
* @see JtaTransactionManager#setTransactionManager
* @see com.ibm.ws.Transaction.TransactionManagerFactory#getTransactionManager
* @see WebSphereUowTransactionManager
*/
public class WebSphereTransactionManagerFactoryBean implements FactoryBean {
private static final String FACTORY_CLASS_5_1 = "com.ibm.ws.Transaction.TransactionManagerFactory";
protected final Log logger = LogFactory.getLog(getClass());
private final TransactionManager transactionManager;
/**
* This constructor retrieves the WebSphere TransactionManager factory class,
* so we can get access to the JTA TransactionManager.
*/
public WebSphereTransactionManagerFactoryBean() throws TransactionSystemException {
try {
// Using the thread context class loader for compatibility with the WSAD test server.
Class clazz = Thread.currentThread().getContextClassLoader().loadClass(FACTORY_CLASS_5_1);
Method method = clazz.getMethod("getTransactionManager", (Class[]) null);
this.transactionManager = (TransactionManager) method.invoke(null, (Object[]) null);
}
catch (ClassNotFoundException ex) {
throw new TransactionSystemException(
"Could not find WebSphere 5.1/6.0/6.1 TransactionManager factory class", ex);
}
catch (InvocationTargetException ex) {
throw new TransactionSystemException(
"WebSphere's TransactionManagerFactory.getTransactionManager method failed", ex.getTargetException());
}
catch (Exception ex) {
throw new TransactionSystemException(
"Could not access WebSphere's TransactionManagerFactory.getTransactionManager method", ex);
}
}
public Object getObject() {
return this.transactionManager;
}
public Class getObjectType() {
return this.transactionManager.getClass();
}
public boolean isSingleton() {
return true;
}
}
| [
"mangr3n@gmail.com"
] | mangr3n@gmail.com |
0a6626077a457ed17a54824f3ae218a63f4aa01b | 94545847bdb12a1caf02d3c07e57a8d963bac7b2 | /app/src/main/java/ivan/mamula/creitive/Activites/SplashScreenActivity.java | 4422209ac0eab8815eec425c5511874b1f65bca1 | [] | no_license | imamula/creitive | 0910d034d822150b96fe29b8841689118667d06b | 3824cdf8efde8b8ce4473fd8cacb26ed73807267 | refs/heads/master | 2021-09-08T17:35:32.815192 | 2018-03-11T12:20:23 | 2018-03-11T12:20:23 | 124,525,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,352 | java | package ivan.mamula.creitive.Activites;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import ivan.mamula.creitive.R;
import ivan.mamula.creitive.Utils.Constants;
public class SplashScreenActivity extends AppCompatActivity {
private static int SPLASH_SCREEN_DURATION = 1000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_splash_screen);
Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
public void run() {
Intent showNextScreenIntent;
if(Constants.getToken(getApplicationContext())==null) {
showNextScreenIntent = new Intent(SplashScreenActivity.this,
LoginActivity.class);
}
else
{
showNextScreenIntent = new Intent(SplashScreenActivity.this,
BlogsListActivity.class);
}
startActivity(showNextScreenIntent);
finish();
}
};
handler.postDelayed(runnable, SPLASH_SCREEN_DURATION);
}
}
| [
"mamula82@gmail.com"
] | mamula82@gmail.com |
5d396565a67a6cb4dea82ac770a1d1e383901f44 | 6c66447ec04f61193b15dd6d0447bb292415dd35 | /PromotoriaPedidos/PromotoriaPedidos/app/src/main/java/promotoria/grocus/mx/promotoriapedidos/business/rest/Get/PreguntasEncuestaRest.java | a0a9bce04f33b837735f6bfd9cefa054dfc742ce | [] | no_license | HumbertoSMH/Alpha-PromotoriaPedidos | f005863c85b16a04d928c562e81ba9247cd1e87a | c11a96d8346d9191b071403fc8ebbef410b76695 | refs/heads/master | 2021-01-20T12:52:08.919167 | 2017-05-05T22:20:06 | 2017-05-05T22:20:06 | 90,421,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,029 | java | package promotoria.grocus.mx.promotoriapedidos.business.rest.Get;
import java.util.Arrays;
/**
* Created by devmac03 on 03/08/15.
*/
public class PreguntasEncuestaRest {
private int idPregunta;
private String descripcion;
private RespuestasPreguntaRest[] respuestasPregunta;
public PreguntasEncuestaRest( ) {
this.idPregunta = 0;
this.descripcion = "";
this.respuestasPregunta = new RespuestasPreguntaRest[0];
}
public int getIdPregunta() {
return idPregunta;
}
public void setIdPregunta(int idPregunta) {
this.idPregunta = idPregunta;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public RespuestasPreguntaRest[] getRespuestasPregunta() {
return respuestasPregunta;
}
public void setRespuestasPregunta(RespuestasPreguntaRest[] respuestasPregunta) {
this.respuestasPregunta = respuestasPregunta;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PreguntasEncuestaRest that = (PreguntasEncuestaRest) o;
if (idPregunta != that.idPregunta) return false;
if (!descripcion.equals(that.descripcion)) return false;
if (!Arrays.equals(respuestasPregunta, that.respuestasPregunta)) return false;
return true;
}
@Override
public int hashCode() {
int result = idPregunta;
result = 31 * result + descripcion.hashCode();
result = 31 * result + Arrays.hashCode(respuestasPregunta);
return result;
}
@Override
public String toString() {
return "PreguntasEncuestaRest{" +
"idPregunta=" + idPregunta +
", descripcion='" + descripcion + '\'' +
", respuestasPregunta=" + Arrays.toString(respuestasPregunta) +
'}';
}
}
| [
"sasori250393@gmail.com"
] | sasori250393@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.