blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d58356542fb2bfcaf8efb9d664e095c1acaf832e | 4ce336ce2b47519d9751420a8d401fffadfba249 | /workspace/TempPjt/src/main/java/devonframe/sample/office/uipattern/p41/controller/MasterDetailPatternController.java | 8abf30bc3207828465745b06b98b4ffb038bf56d | [] | no_license | yuyunsu1187/gittest | 4796c8fb3bf594bd202e26433bbff5cdf0cd1872 | de42dc91e5a390900f27ebbebffc0ec4f31fe063 | refs/heads/master | 2022-11-25T07:42:26.607899 | 2020-10-12T05:32:36 | 2020-10-12T05:32:36 | 140,378,348 | 0 | 0 | null | 2022-11-16T05:53:04 | 2018-07-10T04:46:27 | Java | UTF-8 | Java | false | false | 3,776 | java | package devonframe.sample.office.uipattern.p41.controller;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import devonframe.sample.office.common.code.model.Code;
import devonframe.sample.office.common.code.service.CodeService;
import devonframe.sample.office.uipattern.common.model.EmployeeDetail;
import devonframe.sample.office.uipattern.employee.model.Employee;
import devonframe.sample.office.uipattern.employee.service.EmployeeService;
@Controller
public class MasterDetailPatternController {
@Resource(name = "employeeService")
private EmployeeService employeeService;
@Resource(name = "codeService")
private CodeService codeService;
@RequestMapping(value = "/pattern/p41/employeeDetail.do")
public String employeeDetail(ModelMap model) {
model.addAttribute("result", new Employee());
return "pattern/p41/employeeDetail";
}
@RequestMapping(value = "/pattern/p41/retrieveEmployee.do")
public String retrieveEmployee(String searchNum, ModelMap model) {
Employee input = new Employee();
input.setNum(searchNum);
Employee result = employeeService.retrieveEmployee(input);
EmployeeDetail employeeDetail = new EmployeeDetail();
employeeDetail.setNum(searchNum);
EmployeeDetail resultDetail = employeeService.retrieveEmployeeDetail(employeeDetail);
model.addAttribute("result", result);
model.addAttribute("resultDetail", resultDetail);
return "pattern/p41/employeeDetail";
}
@RequestMapping(value = "/pattern/p41/insertEmployeeDetail.do")
public String insertEmployeeDetail(Employee input, EmployeeDetail employeeDetail, ModelMap model) {
employeeService.insertEmployeeDetail(employeeDetail);
model.addAttribute("resultDetail", employeeDetail);
model.addAttribute("result", input);
return "pattern/p41/employeeDetail";
}
@RequestMapping(value = "/pattern/p41/updateEmployeeDetail.do")
public String updateEmployeeDetail(Employee input, EmployeeDetail employeeDetail, ModelMap model) {
employeeService.updateEmployeeDetail(employeeDetail);
model.addAttribute("result", input);
model.addAttribute("resultDetail", employeeDetail);
return "pattern/p41/employeeDetail";
}
@RequestMapping(value = "/pattern/p41/deleteEmployeeDetail.do")
public String deleteEmployeeDetail(Employee input, EmployeeDetail employeeDetail, ModelMap model) {
employeeService.deleteEmployeeDetail(employeeDetail);
model.addAttribute("result", input);
return "pattern/p41/employeeDetail";
}
@RequestMapping(value = "/pattern/p41/employeeFormPopup.do")
public String employeeFormPopup(Employee input, ModelMap model) {
Employee employee = employeeService.retrieveEmployee(input);
Code codeGroup = new Code();
codeGroup.setCodeGroup(employee.getDivisionCode());
model.addAttribute("result", employee);
model.addAttribute("joblevelCodeList", codeService.retrieveJobLevelCodeList());
model.addAttribute("divisionCodeList", codeService.retrieveDivisionCodeList());
model.addAttribute("departmentCodeList", codeService.retrieveDepartmentCodeList(codeGroup));
return "pattern/p41/employeeFormPopup";
}
@RequestMapping(value = "/pattern/p41/updateEmployee.do")
public String updateEmployee(Employee input, ModelMap model) {
employeeService.updateEmployeeForP41(input);
model.addAttribute("mode", "complete");
model.addAttribute("result", input);
return "pattern/p41/employeeFormPopup";
}
}
| [
"41039964+yuyunsu1187@users.noreply.github.com"
] | 41039964+yuyunsu1187@users.noreply.github.com |
0e22eb8cdb68e76e215769c5dc6f21320bf418f2 | caced10a3cfcd3a6230730108a3f33bbedaf5557 | /src/main/java/com/ambition/chat/manager/IPListManager.java | c02fc68362a6aa0244b04eb5eaacb36c646da29d | [
"MIT"
] | permissive | andy521/chatease-server-temp | cf8663f5efdd4799f68b93859cf96c2fd2e8d466 | eb1e06a3ff585f96614f0574e2b5c80fb3f64e0c | refs/heads/master | 2020-03-28T22:54:10.557430 | 2017-05-27T03:06:13 | 2017-05-27T03:06:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,199 | java | package com.ambition.chat.manager;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import com.ambition.chat.common.Punishment;
import com.ambition.chat.events.ErrorEvent;
import com.ambition.chat.events.Event;
import com.ambition.chat.events.EventListener;
import com.ambition.chat.events.LoaderEvent;
import com.ambition.chat.net.HttpLoader;
import com.ambition.chat.utils.Utils;
public class IPListManager {
private static final Logger logger;
private static final String IPLIST_REQ_URL;
private static final Map<String, Punishment> blacklist;
private static final List<String> whitelist;
private static final HttpLoader loader;
static {
logger = LogManager.getLogger(IPListManager.class);
IPLIST_REQ_URL = "http://localhost/websocket/data/iplist.json";
blacklist = new HashMap<>();
whitelist = new ArrayList<>();
loader = new HttpLoader();
loader.addEventListener(Event.COMPLETE, new EventListener() {
@Override
public void callback(Event e) {
LoaderEvent evt = (LoaderEvent) e;
JSONObject list = Utils.parse(evt.response());
if (list == null) {
return;
}
if (list.has("blacklist")) {
parseBlacklist(list.getJSONArray("blacklist"));
}
if (list.has("whitelist")) {
parseWhitelist(list.getJSONArray("whitelist"));
}
logger.warn("Getting IP list completed.");
}
});
loader.addEventListener(Event.ERROR, new EventListener() {
@Override
public void callback(Event e) {
ErrorEvent evt = (ErrorEvent) e;
logger.error("Failed to load IP list. Explain: " + evt.explain());
}
});
loader.addEventListener(LoaderEvent.CANCEL, new EventListener() {
@Override
public void callback(Event e) {
logger.error("Loading IP list cancelled.");
}
});
}
public static void load() {
loader.load(IPLIST_REQ_URL, null, null);
}
public static void syncLoad() {
loader.syncLoad(IPLIST_REQ_URL, null, null);
}
private static void parseBlacklist(JSONArray list) {
for (int i = 0; i < list.length(); i++) {
JSONObject item = list.getJSONObject(i);
if (item.has("ip") == false || item.has("punishment") == false) {
continue;
}
String ip = item.getString("ip");
JSONObject punishdata = item.getJSONObject("punishment");
int code = punishdata.getInt("code");
long time = punishdata.getLong("time");
Punishment punishment = new Punishment(ip, code, time);
blacklist.put(ip, punishment);
}
}
private static void parseWhitelist(JSONArray list) {
for (int i = 0; i < list.length(); i++) {
String ip = list.getString(i);
whitelist.add(ip);
}
}
public static boolean clear(String ip) {
if (whitelist.contains(ip)) {
return true;
}
if (blacklist.containsKey(ip)) {
Punishment punishment = blacklist.get(ip);
if (punishment.getTime() < new Date().getTime()) {
blacklist.remove(ip);
return true;
}
if ((punishment.getCode() & 0x01) > 0) {
return false;
}
}
return true;
}
}
| [
"670292548@qq.com"
] | 670292548@qq.com |
1ddb4373caa7d1ae9d871c8e751f5e84697c4c58 | 62ca1d84ad3aac218c62430286134c1ba0ff9ddd | /src/main/java/com/yyt/ppc/model/Keyword.java | e3747a5a5b8bc97d9bce330d1d82eb9265c5cdc7 | [] | no_license | khagos/Demo | 6559111589bad4d2e1f4cd6398d7e8a77ca81e93 | 47b2c39624b297015a8f0975789bd3da6d47db4e | refs/heads/master | 2021-01-09T20:40:36.542892 | 2016-06-28T17:20:37 | 2016-06-28T17:20:37 | 61,792,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 187 | java | package com.yyt.ppc.model;
/**
* Created by kibrom on 6/27/16.
*/
public class Keyword {
private String name;
private CampaignCategory category;
private Double price;
}
| [
"khagos.yytdevelopment@gmail.com"
] | khagos.yytdevelopment@gmail.com |
d5bd996b3c86e9bf8e868db43c6a61ae6deddc06 | 4f34be376c5c12482acc4e95f10d9a0ab244b659 | /MovieVisitor/src/model/Movie.java | 7f2f34ac5e7b4cbc91b0a0de63364992cd6b5d83 | [] | no_license | lvhang1996/Movie- | 7de4b48bf6b03e990d86738461bff98b02181f51 | 520d3d764599b6a68f439d3ed88753cf0e2f3765 | refs/heads/master | 2021-02-12T21:54:38.697631 | 2020-03-04T01:32:17 | 2020-03-04T01:32:17 | 244,635,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,176 | java | package model;
/**
* Movie entity. @author MyEclipse Persistence Tools
*/
public class Movie implements java.io.Serializable {
// Fields
private Integer id;
private String moviename;
private Double score;
private String author;
private String type;
private String date;
private String area;
private String time;
private String language;
private Integer price;
private String picture;
private String introduction;
private String onshow;
private Integer good;
private Integer bad;
private String video;
// Constructors
/** default constructor */
public Movie() {
}
/** full constructor */
public Movie(String moviename, Double score, String author, String type,
String date, String area, String time, String language,
Integer price, String picture, String introduction, String onshow,
Integer good, Integer bad, String video) {
this.moviename = moviename;
this.score = score;
this.author = author;
this.type = type;
this.date = date;
this.area = area;
this.time = time;
this.language = language;
this.price = price;
this.picture = picture;
this.introduction = introduction;
this.onshow = onshow;
this.good = good;
this.bad = bad;
this.video = video;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getMoviename() {
return this.moviename;
}
public void setMoviename(String moviename) {
this.moviename = moviename;
}
public Double getScore() {
return this.score;
}
public void setScore(Double score) {
this.score = score;
}
public String getAuthor() {
return this.author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public String getDate() {
return this.date;
}
public void setDate(String date) {
this.date = date;
}
public String getArea() {
return this.area;
}
public void setArea(String area) {
this.area = area;
}
public String getTime() {
return this.time;
}
public void setTime(String time) {
this.time = time;
}
public String getLanguage() {
return this.language;
}
public void setLanguage(String language) {
this.language = language;
}
public Integer getPrice() {
return this.price;
}
public void setPrice(Integer price) {
this.price = price;
}
public String getPicture() {
return this.picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public String getIntroduction() {
return this.introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public String getOnshow() {
return this.onshow;
}
public void setOnshow(String onshow) {
this.onshow = onshow;
}
public Integer getGood() {
return this.good;
}
public void setGood(Integer good) {
this.good = good;
}
public Integer getBad() {
return this.bad;
}
public void setBad(Integer bad) {
this.bad = bad;
}
public String getVideo() {
return this.video;
}
public void setVideo(String video) {
this.video = video;
}
} | [
"953875192@qq.com"
] | 953875192@qq.com |
7ffa56acd0a8c2c18bb728e6f21fd917342b51c6 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/naver--pinpoint/a858604a9dd990466996725f480ad2286eef3a11/before/RootStackFrame.java | 246f54d62e89cfd9dd775d5c950d1d2cf1cf933c | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,025 | java | /*
* Copyright 2014 NAVER Corp.
*
* 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.navercorp.pinpoint.profiler.context;
/**
* @author emeroad
*/
public class RootStackFrame implements StackFrame {
private final Span span;
private int stackId;
private Object frameObject;
public RootStackFrame(Span span) {
if (span == null) {
throw new NullPointerException("span must not be null");
}
this.span = span;
}
@Override
public int getStackFrameId() {
return stackId;
}
@Override
public void setStackFrameId(int stackId) {
this.stackId = stackId;
}
@Override
public void markBeforeTime() {
this.span.markBeforeTime();
}
@Override
public long getBeforeTime() {
return this.span.getStartTime();
}
@Override
public void markAfterTime() {
this.span.markAfterTime();
}
@Override
public long getAfterTime() {
return span.getAfterTime();
}
@Override
public int getElapsedTime() {
return span.getElapsed();
}
public Span getSpan() {
return span;
}
@Override
public void setEndPoint(String endPoint) {
this.span.setEndPoint(endPoint);
}
@Override
public void setRpc(String rpc) {
this.span.setRpc(rpc);
}
@Override
public void setApiId(int apiId) {
this.span.setApiId(apiId);
}
@Override
public void setExceptionInfo(int exceptionId, String exceptionMessage) {
this.span.setExceptionInfo(exceptionId, exceptionMessage);
}
@Override
public void setServiceType(short serviceType) {
this.span.setServiceType(serviceType);
}
@Override
public void addAnnotation(Annotation annotation) {
this.span.addAnnotation(annotation);
}
public void setRemoteAddress(String remoteAddress) {
this.span.setRemoteAddr(remoteAddress);
}
@Override
public Object attachFrameObject(Object frameObject) {
Object copy = this.frameObject;
this.frameObject = frameObject;
return copy;
}
@Override
public Object getFrameObject() {
return this.frameObject;
}
@Override
public Object detachFrameObject() {
Object copy = this.frameObject;
this.frameObject = null;
return copy;
}
@Override
public short getServiceType() {
return this.span.getServiceType();
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
e3a4a9f118553bce5bfd3e647863ca876dc3e82b | 38245ad1245bbb3b93d1f8af9150ccdfe70ecfd0 | /src/main/java/com/company/apollo_query/apollo_query/apollo_query/tb_shipping_order_main/generated/GeneratedTbShippingOrderMainSqlAdapter.java | c520752d4839c6b9bf02786aa3043c1d919e1301 | [] | no_license | denyiping/Java8InAction | 6644472e9760d430a88b69b757db206151170b03 | d5ec46e305e5d758a32346216ecdbad8d2e005cd | refs/heads/master | 2023-04-30T00:21:58.426320 | 2017-01-05T16:07:44 | 2017-01-05T16:07:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,233 | java | package com.company.apollo_query.apollo_query.apollo_query.tb_shipping_order_main.generated;
import com.company.apollo_query.apollo_query.apollo_query.tb_shipping_order_main.TbShippingOrderMain;
import com.company.apollo_query.apollo_query.apollo_query.tb_shipping_order_main.TbShippingOrderMainImpl;
import com.speedment.common.injector.annotation.ExecuteBefore;
import com.speedment.runtime.config.identifier.TableIdentifier;
import com.speedment.runtime.core.component.sql.SqlPersistenceComponent;
import com.speedment.runtime.core.component.sql.SqlStreamSupplierComponent;
import com.speedment.runtime.core.exception.SpeedmentException;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.annotation.Generated;
import static com.speedment.common.injector.State.RESOLVED;
/**
* The generated Sql Adapter for a {@link
* com.company.apollo_query.apollo_query.apollo_query.tb_shipping_order_main.TbShippingOrderMain}
* entity.
* <p>
* This file has been automatically generated by Speedment. Any changes made to
* it will be overwritten.
*
* @author Speedment
*/
@Generated("Speedment")
public abstract class GeneratedTbShippingOrderMainSqlAdapter {
private final TableIdentifier<TbShippingOrderMain> tableIdentifier;
protected GeneratedTbShippingOrderMainSqlAdapter() {
this.tableIdentifier = TableIdentifier.of("apollo_query", "apollo_query", "tb_shipping_order_main");
}
@ExecuteBefore(RESOLVED)
void installMethodName(SqlStreamSupplierComponent streamSupplierComponent, SqlPersistenceComponent persistenceComponent) {
streamSupplierComponent.install(tableIdentifier, this::apply);
persistenceComponent.install(tableIdentifier);
}
protected TbShippingOrderMain apply(ResultSet resultSet) throws SpeedmentException{
final TbShippingOrderMain entity = createEntity();
try {
entity.setId(resultSet.getLong(1));
entity.setTrackingId(resultSet.getLong(2));
entity.setSourceId(resultSet.getInt(3));
entity.setPlatformTrackingId(resultSet.getString(4));
entity.setRetailerId(resultSet.getLong(5));
entity.setShippingOption(resultSet.getByte(6));
entity.setGridId(resultSet.getLong(7));
entity.setCarrierId(resultSet.getInt(8));
entity.setAgentId(resultSet.getInt(9));
entity.setStationId(resultSet.getInt(10));
entity.setCarrierDriverId(resultSet.getString(11));
entity.setShippingState(resultSet.getByte(12));
entity.setShippingReasonCode(resultSet.getByte(13));
entity.setRemarkCode(resultSet.getString(14));
entity.setCityid(resultSet.getInt(15));
entity.setAcceptAt(resultSet.getTimestamp(16));
entity.setCompleteAt(resultSet.getTimestamp(17));
entity.setUpdatedAt(resultSet.getTimestamp(18));
entity.setCreatedAt(resultSet.getTimestamp(19));
} catch (final SQLException sqle) {
throw new SpeedmentException(sqle);
}
return entity;
}
protected TbShippingOrderMainImpl createEntity() {
return new TbShippingOrderMainImpl();
}
} | [
"Abcd1234@#"
] | Abcd1234@# |
0c29829ee71fb75c5e9606c09d4303596149bd28 | 0062f5f326df98d3a5dec76ba1ee462961ee59a5 | /app/src/main/java/com/ltrix/jk/tv_app/model/WebChannel.java | 884b8e5d09dfc6e5c2d27a6c8f7f8a8ec5d25da4 | [] | no_license | bindurs/TV_app | 4a8ded5cec43cf17628ad99ca40df4073ea02b6c | 9c47ae8dbe70a229001e9106eabd2fc7466ea666 | refs/heads/master | 2021-07-05T11:46:06.333424 | 2017-09-25T10:21:29 | 2017-09-25T10:21:29 | 104,171,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 815 | java |
package com.ltrix.jk.tv_app.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
public class WebChannel implements Serializable {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("country")
@Expose
private Country country;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Country getCountry() {
return country;
}
public void setCountry(Country country) {
this.country = country;
}
}
| [
"bindu@xminds.in"
] | bindu@xminds.in |
2245d1c8b656a4df5e67491cb3714103e69e566b | 76cc850c1cf37cb6629f1bc2a877e75ae6df280a | /protocols/failure-detection/src/main/java/io/atomix/protocols/phi/PhiAccrualFailureDetectionService.java | 1bbf03af61e37c69e3a22c1d2fc87a71d23b58be | [
"Apache-2.0"
] | permissive | mapbased/atomix | 63aea3959151c39dc3d1bb5589b554f8de39a681 | 61063469c4cd447d13eb8b7068d6a3fdec7a6779 | refs/heads/master | 2021-01-12T08:54:44.566577 | 2017-11-15T09:16:24 | 2017-11-15T09:16:24 | 76,713,439 | 0 | 0 | null | 2017-11-15T09:16:25 | 2016-12-17T08:46:55 | Java | UTF-8 | Java | false | false | 10,248 | java | /*
* Copyright 2017-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.atomix.protocols.phi;
import com.google.common.collect.Maps;
import io.atomix.event.AbstractListenerManager;
import io.atomix.protocols.phi.protocol.FailureDetectionProtocol;
import io.atomix.protocols.phi.protocol.HeartbeatMessage;
import io.atomix.utils.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.Duration;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Phi-accrual failure detection service.
*/
public class PhiAccrualFailureDetectionService<T extends Identifier>
extends AbstractListenerManager<FailureDetectionEvent<T>, FailureDetectionEventListener<T>>
implements FailureDetectionService<T> {
/**
* Returns a new phi accrual failure detection service builder.
*
* @param <T> the node type
* @return a new phi accrual failure detection service builder
*/
public static <T extends Identifier> Builder<T> builder() {
return new Builder<>();
}
private Logger log = LoggerFactory.getLogger(getClass());
private final T localNode;
private final FailureDetectionProtocol<T> protocol;
private final Supplier<Collection<T>> peerProvider;
private final ScheduledFuture<?> heartbeatFuture;
private final int phiFailureThreshold;
private final int minSamples;
private final double phiFactor;
private final Map<T, PhiAccrualFailureDetector> nodes = Maps.newConcurrentMap();
private final Map<T, FailureDetectionEvent.State> nodeStates = Maps.newConcurrentMap();
public PhiAccrualFailureDetectionService(
FailureDetectionProtocol<T> protocol,
T localNode,
Supplier<Collection<T>> peerProvider,
ScheduledExecutorService heartbeatExecutor,
Duration heartbeatInterval,
int phiFailureThreshold,
int minSamples,
double phiFactor) {
checkArgument(phiFailureThreshold > 0, "phiFailureThreshold must be positive");
this.localNode = checkNotNull(localNode, "localNode cannot be null");
this.protocol = checkNotNull(protocol, "protocol cannot be null");
this.peerProvider = checkNotNull(peerProvider, "peerProvider cannot be null");
this.phiFailureThreshold = phiFailureThreshold;
this.minSamples = minSamples;
this.phiFactor = phiFactor;
this.heartbeatFuture = heartbeatExecutor.scheduleAtFixedRate(
this::heartbeat, heartbeatInterval.toMillis(), heartbeatInterval.toMillis(), TimeUnit.MILLISECONDS);
protocol.registerHeartbeatListener(new HeartbeatMessageHandler());
}
private void updateState(T peer, FailureDetectionEvent.State newState) {
FailureDetectionEvent.State currentState = nodeStates.get(peer);
if (!Objects.equals(currentState, newState)) {
nodeStates.put(peer, newState);
post(new FailureDetectionEvent<T>(FailureDetectionEvent.Type.STATE_CHANGE, peer, currentState, newState));
}
}
private void heartbeat() {
try {
Set<T> peers = peerProvider.get()
.stream()
.filter(peer -> !peer.equals(localNode))
.collect(Collectors.toSet());
FailureDetectionEvent.State state = nodeStates.get(localNode);
HeartbeatMessage<T> heartbeat = new HeartbeatMessage<>(localNode, state);
peers.forEach((node) -> {
heartbeatToPeer(heartbeat, node);
FailureDetectionEvent.State currentState = nodeStates.get(node.id());
double phi = nodes.computeIfAbsent(node, n -> new PhiAccrualFailureDetector(minSamples, phiFactor)).phi();
if (phi >= phiFailureThreshold) {
if (currentState == FailureDetectionEvent.State.ACTIVE) {
updateState(node, FailureDetectionEvent.State.INACTIVE);
}
} else {
if (currentState == FailureDetectionEvent.State.INACTIVE) {
updateState(node, FailureDetectionEvent.State.ACTIVE);
}
}
});
} catch (Exception e) {
log.debug("Failed to send heartbeat", e);
}
}
private void heartbeatToPeer(HeartbeatMessage<T> heartbeat, T peer) {
protocol.heartbeat(peer, heartbeat).whenComplete((result, error) -> {
if (error != null) {
log.trace("Sending heartbeat to {} failed", peer, error);
}
});
}
private class HeartbeatMessageHandler implements Consumer<HeartbeatMessage<T>> {
@Override
public void accept(HeartbeatMessage<T> heartbeat) {
nodes.computeIfAbsent(heartbeat.source(), n -> new PhiAccrualFailureDetector(minSamples, phiFactor)).report();
updateState(heartbeat.source(), heartbeat.state());
}
}
@Override
public void close() {
protocol.unregisterHeartbeatListener();
heartbeatFuture.cancel(false);
}
/**
* Phi-accrual failure detection service builder.
*
* @param <T> the node type
*/
public static class Builder<T extends Identifier> implements FailureDetectionService.Builder<T> {
private static final Duration DEFAULT_HEARTBEAT_INTERVAL = Duration.ofMillis(100);
private static final int DEFAULT_PHI_FAILURE_THRESHOLD = 10;
private static final int DEFAULT_MIN_SAMPLES = 25;
private static final double DEFAULT_PHI_FACTOR = 1.0 / Math.log(10.0);
private FailureDetectionProtocol<T> protocol;
private T localNode;
private Supplier<Collection<T>> peerProvider;
private ScheduledExecutorService heartbeatExecutor;
private Duration heartbeatInterval = DEFAULT_HEARTBEAT_INTERVAL;
private int phiFailureThreshold = DEFAULT_PHI_FAILURE_THRESHOLD;
private int minSamples = DEFAULT_MIN_SAMPLES;
private double phiFactor = DEFAULT_PHI_FACTOR;
/**
* Sets the failure detection protocol.
*
* @param protocol the failure detection protocol
* @return the failure detection service builder
* @throws NullPointerException if the protocol is null
*/
public Builder<T> withProtocol(FailureDetectionProtocol<T> protocol) {
this.protocol = checkNotNull(protocol, "protocol cannot be null");
return this;
}
/**
* Sets the local node identifier.
*
* @param identifier the local identifier
* @return the failure detection service builder
* @throws NullPointerException if the identifier is null
*/
public Builder<T> withLocalNode(T identifier) {
this.localNode = identifier;
return this;
}
/**
* Sets the gossip peer provider function.
*
* @param peerProvider the gossip peer provider
* @return the anti-entropy service builder
* @throws NullPointerException if the peer provider is null
*/
public Builder<T> withPeerProvider(Supplier<Collection<T>> peerProvider) {
this.peerProvider = checkNotNull(peerProvider, "peerProvider cannot be null");
return this;
}
/**
* Sets the heartbeat executor.
*
* @param executor the heartbeat executor
* @return the failure detection service builder
* @throws NullPointerException if the heartbeat executor is null
*/
public Builder<T> withHeartbeatExecutor(ScheduledExecutorService executor) {
this.heartbeatExecutor = checkNotNull(executor, "executor cannot be null");
return this;
}
/**
* Sets the heartbeat interval.
*
* @param interval the heartbeat interval
* @return the failure detection service builder
* @throws NullPointerException if the heartbeat interval is null
*/
public Builder<T> withHeartbeatInterval(Duration interval) {
this.heartbeatInterval = checkNotNull(interval, "interval cannot be null");
return this;
}
/**
* Sets the phi failure threshold.
*
* @param failureThreshold the failure threshold
* @return the failure detection service builder
* @throws IllegalArgumentException if the failure threshold is not positive
*/
public Builder<T> withPhiFailureThreshold(int failureThreshold) {
checkArgument(failureThreshold > 0, "failureThreshold must be positive");
this.phiFailureThreshold = failureThreshold;
return this;
}
/**
* Sets the minimum number of samples requires to compute phi.
*
* @param minSamples the minimum number of samples required to compute phi
* @return the failure detection service builder
* @throws IllegalArgumentException if the minimum number of samples is not positive
*/
public Builder<T> withMinSamples(int minSamples) {
checkArgument(minSamples > 0, "minSamples must be positive");
this.minSamples = minSamples;
return this;
}
/**
* Sets the phi factor.
*
* @param phiFactor the phi factor
* @return the failure detection service builder
* @throws IllegalArgumentException if the phi factor is not positive
*/
public Builder<T> withPhiFactor(double phiFactor) {
checkArgument(phiFactor > 0, "phiFactor must be positive");
this.phiFactor = phiFactor;
return this;
}
@Override
public FailureDetectionService<T> build() {
return new PhiAccrualFailureDetectionService<>(
protocol,
localNode,
peerProvider,
heartbeatExecutor,
heartbeatInterval,
phiFailureThreshold,
minSamples,
phiFactor);
}
}
}
| [
"jordan.halterman@gmail.com"
] | jordan.halterman@gmail.com |
dfee6a0133559422c28af901f9ba85060749262c | bba740d5626524f14d082e903d70f0a9e28ced96 | /src/leb4/ex2.java | 8b8468d22a0d923382528e8e6f94d81e1e50366f | [] | no_license | Numtip1/360411760009 | 03c5428ba82350df203a3025a0dd88764e2768a6 | c8c46f82eb39522bc8118b195de3c57d00e41ec5 | refs/heads/master | 2020-03-21T15:18:19.843886 | 2018-10-16T09:07:29 | 2018-10-16T09:07:29 | 138,705,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,763 | java | package leb4;
// 1.summation (+)
// 2. subtraction (-)
// 3. multiple (*)
// 4. division (/)
import javax.swing.*;
import java.util.Scanner;
public class ex2 {
public static int summation (int x, int y ) {
return x + y;
}
public static int subtraction (int x, int y ) {
return x-y;
}
public static int multiple (int x, int y ){
return x*y;
}
public static int division (int x, int y ) {
return x/y;
}
public static void main(String[] args) {
Scanner input = new Scanner( System.in);
int x,y,select;
System.out.println( "Please input 2 integers and choose your option....");
//input data
System.out.println( "input number 1:");
x = input.nextInt();
System.out.println( "input number 2:");
y = input.nextInt();
//show options
System.out.println("1. summation");
System.out.println("2. subtraction");
System.out.println("3 multiple");
System.out.println("4. devised");
do {
System.out.print(" Option ");
select = input.nextInt();
} while (select <1 || select>4 );
int r = 0;
switch ( select ) {
case 1:
r = summation(x, y);
break;
case 2:
r = subtraction(x, y);
break;
case 3:
r = multiple(x, y);
break;
case 4:
r = division(x, y);
break;
default:
System.out.println("please select option (1-4)only");
}
System.out.println( "Output" +r );
}//main
}//class
| [
"noomthip7674@gmail.com"
] | noomthip7674@gmail.com |
0598da65d23cc786e769525cd67224b8cb1cf53d | 96a883a43b72aef8b601c28809345a2e509445ec | /微服务/cloud2020-study/nacos-seata-account-service2003/src/main/java/top/wfaceboss/springcloud/alibaba/domain/Account.java | 677b4bde70b1ec4644a062785f77fd04fa27f462 | [] | no_license | FelixBin/wfaceboss-study-notes | e7700aec17c75a737f8180b722d7f0e02f4ecfa5 | e9aa7cf27d34da5bbced08dc5d83ffd82b36bfe6 | refs/heads/master | 2023-05-08T03:29:42.678661 | 2021-05-15T02:19:28 | 2021-05-15T02:19:28 | 344,336,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | package top.wfaceboss.springcloud.alibaba.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 账户实体类
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Account {
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 总额度
*/
private Integer total;
/**
* 已用额度
*/
private Integer used;
/**
* 剩余额度
*/
private Integer residue;
} | [
"1948728748@qq.com"
] | 1948728748@qq.com |
5e2a1d948de9c82cefa3df52a3e8f062568b1843 | 09edfacb698a528a3ec46f13d3c7c6d454dccdc6 | /PopularMovies/PopularMovies-master/app/src/main/java/com/ajdi/yassin/popularmovies/ui/movieslist/MoviesActivity.java | b7a97401ccc0e719b6d9fdaed80213112799ad06 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Dragon2050/POPULAR-MOVIES-APPLICATION | 445ca76715607de0f549b185334df4c9c0547be2 | 0883226e7031b2ab09a1c40f0c9883a7528dec63 | refs/heads/main | 2023-04-15T03:24:55.850823 | 2021-04-30T10:15:02 | 2021-04-30T10:15:02 | 363,101,096 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,495 | java | package com.ajdi.yassin.popularmovies.ui.movieslist;
import android.os.Bundle;
import android.view.MenuItem;
import com.ajdi.yassin.popularmovies.R;
import com.ajdi.yassin.popularmovies.ui.movieslist.discover.DiscoverMoviesFragment;
import com.ajdi.yassin.popularmovies.ui.movieslist.favorites.FavoritesFragment;
import com.ajdi.yassin.popularmovies.utils.ActivityUtils;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
public class MoviesActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
setupViewFragment();
}
setupToolbar();
setupBottomNavigation();
}
private void setupViewFragment() {
// show discover movies fragment by default
DiscoverMoviesFragment discoverMoviesFragment = DiscoverMoviesFragment.newInstance();
ActivityUtils.replaceFragmentInActivity(
getSupportFragmentManager(), discoverMoviesFragment, R.id.fragment_container);
}
private void setupBottomNavigation() {
BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation);
bottomNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.action_discover:
ActivityUtils.replaceFragmentInActivity(
getSupportFragmentManager(), DiscoverMoviesFragment.newInstance(),
R.id.fragment_container);
return true;
case R.id.action_favorites:
ActivityUtils.replaceFragmentInActivity(
getSupportFragmentManager(), FavoritesFragment.newInstance(),
R.id.fragment_container);
return true;
}
return false;
}
});
}
private void setupToolbar() {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
}
| [
"programmertanvir420@gmail.com"
] | programmertanvir420@gmail.com |
9fd8b5bd215f87e3bfca61e6225bb4c9c8d03fbd | b949e00d3b999004dabfd2f8db90f99e9ac58af2 | /src/main/java/me/khudyakov/staticanalyzer/entity/syntaxtree/expression/operator/BinaryOperator.java | 51be1c47dff3fcf1904c08b35288c455f678c574 | [] | no_license | KonstantinHudyakov/Static-Analyzer | 4d2823b6ce46d26de5b5308b9f63daae9f56e743 | fdc0da8a1c05128def6a9b25c758fa82213a3bdc | refs/heads/master | 2022-04-25T07:32:05.306240 | 2020-04-30T09:45:28 | 2020-04-30T09:45:28 | 250,549,048 | 0 | 0 | null | 2020-04-21T19:06:35 | 2020-03-27T14:00:28 | Java | UTF-8 | Java | false | false | 198 | java | package me.khudyakov.staticanalyzer.entity.syntaxtree.expression.operator;
import java.util.function.ToIntBiFunction;
public interface BinaryOperator extends ToIntBiFunction<Integer, Integer> {
}
| [
"kostja19994@gmail.com"
] | kostja19994@gmail.com |
339751e5244d6e360a1b5eeb242366d42cd1c102 | bd3296a9ed115058bd18086878a2db1e6630b6f0 | /src/main/java/bf/onea/web/rest/GeuPSAResource.java | d6793ca40a941a2bd62fc388d7b0fd97a326c8e4 | [] | no_license | Kadsuke/sidotapp | 7e5df866ed917607759c4427fe4f153ea6024e8e | ded26aaad10085c50efcd97c34ba6c1a0e2ab7c3 | refs/heads/main | 2023-01-31T20:49:16.371591 | 2020-12-14T09:02:39 | 2020-12-14T09:02:39 | 316,159,926 | 0 | 0 | null | 2020-12-14T09:02:41 | 2020-11-26T07:56:10 | TypeScript | UTF-8 | Java | false | false | 5,407 | java | package bf.onea.web.rest;
import bf.onea.service.GeuPSAService;
import bf.onea.web.rest.errors.BadRequestAlertException;
import bf.onea.service.dto.GeuPSADTO;
import io.github.jhipster.web.util.HeaderUtil;
import io.github.jhipster.web.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing {@link bf.onea.domain.GeuPSA}.
*/
@RestController
@RequestMapping("/api")
public class GeuPSAResource {
private final Logger log = LoggerFactory.getLogger(GeuPSAResource.class);
private static final String ENTITY_NAME = "geuPSA";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final GeuPSAService geuPSAService;
public GeuPSAResource(GeuPSAService geuPSAService) {
this.geuPSAService = geuPSAService;
}
/**
* {@code POST /geu-psas} : Create a new geuPSA.
*
* @param geuPSADTO the geuPSADTO to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new geuPSADTO, or with status {@code 400 (Bad Request)} if the geuPSA has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/geu-psas")
public ResponseEntity<GeuPSADTO> createGeuPSA(@Valid @RequestBody GeuPSADTO geuPSADTO) throws URISyntaxException {
log.debug("REST request to save GeuPSA : {}", geuPSADTO);
if (geuPSADTO.getId() != null) {
throw new BadRequestAlertException("A new geuPSA cannot already have an ID", ENTITY_NAME, "idexists");
}
GeuPSADTO result = geuPSAService.save(geuPSADTO);
return ResponseEntity.created(new URI("/api/geu-psas/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* {@code PUT /geu-psas} : Updates an existing geuPSA.
*
* @param geuPSADTO the geuPSADTO to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated geuPSADTO,
* or with status {@code 400 (Bad Request)} if the geuPSADTO is not valid,
* or with status {@code 500 (Internal Server Error)} if the geuPSADTO couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/geu-psas")
public ResponseEntity<GeuPSADTO> updateGeuPSA(@Valid @RequestBody GeuPSADTO geuPSADTO) throws URISyntaxException {
log.debug("REST request to update GeuPSA : {}", geuPSADTO);
if (geuPSADTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
GeuPSADTO result = geuPSAService.save(geuPSADTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, geuPSADTO.getId().toString()))
.body(result);
}
/**
* {@code GET /geu-psas} : get all the geuPSAS.
*
* @param pageable the pagination information.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of geuPSAS in body.
*/
@GetMapping("/geu-psas")
public ResponseEntity<List<GeuPSADTO>> getAllGeuPSAS(Pageable pageable) {
log.debug("REST request to get a page of GeuPSAS");
Page<GeuPSADTO> page = geuPSAService.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* {@code GET /geu-psas/:id} : get the "id" geuPSA.
*
* @param id the id of the geuPSADTO to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the geuPSADTO, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/geu-psas/{id}")
public ResponseEntity<GeuPSADTO> getGeuPSA(@PathVariable Long id) {
log.debug("REST request to get GeuPSA : {}", id);
Optional<GeuPSADTO> geuPSADTO = geuPSAService.findOne(id);
return ResponseUtil.wrapOrNotFound(geuPSADTO);
}
/**
* {@code DELETE /geu-psas/:id} : delete the "id" geuPSA.
*
* @param id the id of the geuPSADTO to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/geu-psas/{id}")
public ResponseEntity<Void> deleteGeuPSA(@PathVariable Long id) {
log.debug("REST request to delete GeuPSA : {}", id);
geuPSAService.delete(id);
return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build();
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
e4fe8fe85ec61922aa1cb9502c5d957b58455e18 | fccc0af67bf7600e128a35d6c3a3af1d2d420191 | /WEB-INF/src/com/iskyshop/manage/admin/action/FreeClassManageAction.java | 1ba12258d72473c58d090313670354db03b9e493 | [] | no_license | itachCoder/jshop | 7b86c2f41d57279996d0bc386fd0cb1bafc2946c | 2706617ad084a46691c406e8cc025f31f46fe5b0 | refs/heads/master | 2021-05-31T23:38:07.120408 | 2016-07-12T02:47:12 | 2016-07-12T02:47:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,912 | java | package com.iskyshop.manage.admin.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.iskyshop.core.annotation.SecurityMapping;
import com.iskyshop.core.beans.BeanUtils;
import com.iskyshop.core.beans.BeanWrapper;
import com.iskyshop.core.mv.JModelAndView;
import com.iskyshop.core.query.support.IPageList;
import com.iskyshop.core.tools.CommUtil;
import com.iskyshop.core.tools.WebForm;
import com.iskyshop.foundation.domain.FreeClass;
import com.iskyshop.foundation.domain.GoodsClass;
import com.iskyshop.foundation.domain.query.FreeClassQueryObject;
import com.iskyshop.foundation.service.IFreeClassService;
import com.iskyshop.foundation.service.ISysConfigService;
import com.iskyshop.foundation.service.IUserConfigService;
/**
*
* <p>
* Title: FreeClassManageAction.java
* </p>
*
* <p>
* Description: 添加0元试用商品的分类
* </p>
*
* <p>
* Copyright: Copyright (c) 2015
* </p>
*
* <p>
* Company: 沈阳网之商科技有限公司 www.iskyshop.com
* </p>
*
* @author jinxinzhe
*
* @date 2014年11月12日
*
* @version iskyshop_b2b2c 2.0
*/
@Controller
public class FreeClassManageAction {
@Autowired
private ISysConfigService configService;
@Autowired
private IUserConfigService userConfigService;
@Autowired
private IFreeClassService freeclassService;
/**
* FreeClass列表页
*
* @param currentPage
* @param orderBy
* @param orderType
* @param request
* @return
*/
@SecurityMapping(title = "0元试用分类列表", value = "/admin/freeclass_list.htm*", rtype = "admin", rname = "0元试用分类", rcode = "freeclass_admin", rgroup = "运营")
@RequestMapping("/admin/freeclass_list.htm")
public ModelAndView freeclass_list(HttpServletRequest request,
HttpServletResponse response, String currentPage, String orderBy,
String orderType) {
ModelAndView mv = new JModelAndView("admin/blue/freeclass_list.html",
configService.getSysConfig(),
this.userConfigService.getUserConfig(), 0, request, response);
String url = this.configService.getSysConfig().getAddress();
if (url == null || url.equals("")) {
url = CommUtil.getURL(request);
}
String params = "";
FreeClassQueryObject qo = new FreeClassQueryObject(currentPage, mv,
"sequence", "asc");
WebForm wf = new WebForm();
wf.toQueryPo(request, qo,FreeClass.class,mv);
IPageList pList = this.freeclassService.list(qo);
CommUtil.saveIPageList2ModelAndView(url + "/admin/freeclass_list.htm",
"", params, pList, mv);
return mv;
}
/**
* freeclass添加管理
*
* @param request
* @return
* @throws ParseException
*/
@SecurityMapping(title = "0元试用分类添加", value = "/admin/freeclass_add.htm*", rtype = "admin", rname = "0元试用分类", rcode = "freeclass_admin", rgroup = "运营")
@RequestMapping("/admin/freeclass_add.htm")
public ModelAndView freeclass_add(HttpServletRequest request,
HttpServletResponse response, String currentPage) {
ModelAndView mv = new JModelAndView("admin/blue/freeclass_add.html",
configService.getSysConfig(),
this.userConfigService.getUserConfig(), 0, request, response);
mv.addObject("currentPage", currentPage);
return mv;
}
/**
* freeclass编辑管理
*
* @param id
* @param request
* @return
* @throws ParseException
*/
@SecurityMapping(title = "0元试用分类编辑", value = "/admin/freeclass_edit.htm*", rtype = "admin", rname = "0元试用分类", rcode = "freeclass_admin", rgroup = "运营")
@RequestMapping("/admin/freeclass_edit.htm")
public ModelAndView freeclass_edit(HttpServletRequest request,
HttpServletResponse response, String id, String currentPage) {
ModelAndView mv = new JModelAndView("admin/blue/freeclass_add.html",
configService.getSysConfig(),
this.userConfigService.getUserConfig(), 0, request, response);
if (id != null && !id.equals("")) {
FreeClass freeclass = this.freeclassService.getObjById(Long
.parseLong(id));
mv.addObject("obj", freeclass);
mv.addObject("currentPage", currentPage);
mv.addObject("edit", true);
}
return mv;
}
/**
* freeclass保存管理
*
* @param id
* @return
*/
@SecurityMapping(title = "0元试用分类保存", value = "/admin/freeclass_save.htm*", rtype = "admin", rname = "0元试用分类", rcode = "freeclass_admin", rgroup = "运营")
@RequestMapping("/admin/freeclass_save.htm")
public ModelAndView freeclass_save(HttpServletRequest request,
HttpServletResponse response, String id, String currentPage,
String cmd, String list_url, String add_url) {
WebForm wf = new WebForm();
FreeClass freeclass = null;
if (id.equals("")) {
freeclass = wf.toPo(request, FreeClass.class);
freeclass.setAddTime(new Date());
} else {
FreeClass obj = this.freeclassService
.getObjById(Long.parseLong(id));
freeclass = (FreeClass) wf.toPo(request, obj);
}
if (id.equals("")) {
this.freeclassService.save(freeclass);
} else
this.freeclassService.update(freeclass);
ModelAndView mv = new JModelAndView("admin/blue/success.html",
configService.getSysConfig(),
this.userConfigService.getUserConfig(), 0, request, response);
mv.addObject("list_url", CommUtil.getURL(request)
+ "/admin/freeclass_list.htm");
mv.addObject("op_title", "保存分类成功");
mv.addObject("add_url", CommUtil.getURL(request)
+ "/admin/freeclass_add.htm" + "?currentPage=" + currentPage);
return mv;
}
@SecurityMapping(title = "0元试用分类删除", value = "/admin/freeclass_del.htm*", rtype = "admin", rname = "0元试用分类", rcode = "freeclass_admin", rgroup = "运营")
@RequestMapping("/admin/freeclass_del.htm")
public String freeclass_del(HttpServletRequest request,
HttpServletResponse response, String mulitId, String currentPage) {
String[] ids = mulitId.split(",");
for (String id : ids) {
if (!id.equals("")) {
this.freeclassService.delete(Long.parseLong(id));
}
}
return "redirect:freeclass_list.htm?currentPage=" + currentPage;
}
@SecurityMapping(title = "0元试用分类ajax", value = "/admin/freeclass_ajax.htm*", rtype = "admin", rname = "0元试用分类", rcode = "freeclass_admin", rgroup = "运营")
@RequestMapping("/admin/freeclass_ajax.htm")
public void freeclass_ajax(HttpServletRequest request, HttpServletResponse response,
String id, String fieldName, String value)
throws ClassNotFoundException {
FreeClass obj = this.freeclassService.getObjById(Long.parseLong(id));
Field[] fields = FreeClass.class.getDeclaredFields();
BeanWrapper wrapper = new BeanWrapper(obj);
Object val = null;
for (Field field : fields) {
// System.out.println(field.getName());
if (field.getName().equals(fieldName)) {
Class clz = Class.forName("java.lang.String");
if (field.getType().getName().equals("int")) {
clz = Class.forName("java.lang.Integer");
}
if (field.getType().getName().equals("boolean")) {
clz = Class.forName("java.lang.Boolean");
}
if (!value.equals("")) {
val = BeanUtils.convertType(value, clz);
} else {
val = !CommUtil.null2Boolean(wrapper
.getPropertyValue(fieldName));
}
wrapper.setPropertyValue(fieldName, val);
}
}
this.freeclassService.update(obj);
response.setContentType("text/plain");
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("UTF-8");
PrintWriter writer;
try {
writer = response.getWriter();
writer.print(val.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@RequestMapping("/admin/verify_freeclass_name.htm")
public void verify_freeclass_name(HttpServletRequest request,
HttpServletResponse response, String className, String id) {
boolean ret = true;
Map params = new HashMap();
params.put("className", className);
params.put("id", CommUtil.null2Long(id));
List<FreeClass> fcs = this.freeclassService
.query("select obj from FreeClass obj where obj.className=:className and obj.id!=:id",
params, -1, -1);
if (fcs != null && fcs.size() > 0) {
ret = false;
}
response.setContentType("text/plain");
response.setHeader("Cache-Control", "no-cache");
response.setCharacterEncoding("UTF-8");
PrintWriter writer;
try {
writer = response.getWriter();
writer.print(ret);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} | [
"jack_wyw@sina.com"
] | jack_wyw@sina.com |
22aedbc6d18705fb3f0dc7a2742ce341fb9808a5 | 5a32de5d50344b45cb17f8c7ef47344962208f2b | /common/src/main/java/local/ikapinos/gof/common/event/StartGameEvent.java | 75d57dbf46509e750eea4473ff599033f4ffa9dc | [
"Apache-2.0"
] | permissive | ievgen-kapinos/A006-game-of-three | ca4e34de30510ecd90b37199ed6412a935c833ca | 57e21b5b42fef9310cb83bd3d5860cc32ef26f0e | refs/heads/main | 2023-02-06T19:11:05.639700 | 2020-12-26T16:54:22 | 2020-12-26T16:54:22 | 322,591,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,686 | java | package local.ikapinos.gof.common.event;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName("start-game")
public class StartGameEvent extends AbstractGameEvent
{
private final Integer number; // Null, if to be auto-generated by Player
@JsonCreator
public StartGameEvent(@JsonProperty("gameId") int gameId,
@JsonProperty("source") String source,
@JsonProperty("destination") String destination,
@JsonProperty("number") Integer number)
{
super(gameId, source, destination);
if (number != null && number < 2)
{
throw new IllegalArgumentException("Inital number should be greater or equal to 2");
}
this.number = number;
}
public Integer getNumber()
{
return number;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((number == null) ? 0 : number.hashCode());
return result;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
StartGameEvent other = (StartGameEvent)obj;
if (number == null)
{
if (other.number != null)
return false;
}
else if (!number.equals(other.number))
return false;
return true;
}
@Override
public String toString()
{
return "StartGameEvent [" + super.toString() +
", number=" + number +
"]";
}
}
| [
"ievgen.kapinos@gmail.com"
] | ievgen.kapinos@gmail.com |
cbe24457116b9c278f6f3d935e90678cfff54db2 | b0694d2006364d054934bcf75263048fff823ec5 | /buession-springcloud-nacos-discovery/src/main/java/com/buession/springcloud/nacos/discovery/autoconfigure/NacosDiscoveryConfiguration.java | 8afe8ab5f60591cb97327473f1968ec18a7041f4 | [
"Apache-2.0"
] | permissive | buession/buession-springcloud | 088cd1a6a915da8061b1a54374d0d89e5dfbe629 | 3eb6143f64040befeaa956770e9988f759d9c3e4 | refs/heads/master | 2023-07-19T23:11:00.424724 | 2023-03-31T15:21:54 | 2023-03-31T15:21:54 | 189,812,564 | 0 | 1 | Apache-2.0 | 2023-08-17T03:26:09 | 2019-06-02T06:26:51 | Java | UTF-8 | Java | false | false | 3,980 | 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.
*
* =========================================================================================================
*
* This software consists of voluntary contributions made by many individuals on behalf of the
* Apache Software Foundation. For more information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* +-------------------------------------------------------------------------------------------------------+
* | License: http://www.apache.org/licenses/LICENSE-2.0.txt |
* | Author: Yong.Teng <webmaster@buession.com> |
* | Copyright @ 2013-2022 Buession.com Inc. |
* +-------------------------------------------------------------------------------------------------------+
*/
package com.buession.springcloud.nacos.discovery.autoconfigure;
import com.alibaba.cloud.nacos.ConditionalOnNacosDiscoveryEnabled;
import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import com.alibaba.cloud.nacos.NacosServiceManager;
import com.alibaba.cloud.nacos.discovery.NacosDiscoveryAutoConfiguration;
import com.alibaba.cloud.nacos.discovery.NacosDiscoveryClientConfiguration;
import com.alibaba.cloud.nacos.discovery.NacosWatch;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.client.ConditionalOnDiscoveryEnabled;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author Yong.Teng
* @since 2.2.0
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnDiscoveryEnabled
@ConditionalOnNacosDiscoveryEnabled
@AutoConfigureBefore({NacosDiscoveryClientConfiguration.class})
@AutoConfigureAfter({NacosDiscoveryAutoConfiguration.class})
public class NacosDiscoveryConfiguration {
/**
* 解决在 Undertow 容器下停止时,报:
* <a href="https://github.com/alibaba/spring-cloud-alibaba/issues/2652" target="_blank">java.lang.IllegalStateException: UT015023: This Context has been already
* destroyed</a> 异常,解决方法:<a href="https://github.com/alibaba/spring-cloud-alibaba/issues/2589" target="_blank">https://github.com/alibaba/spring-cloud-alibaba/issues/2589</a>
*
* @param nacosServiceManager
* {@link NacosServiceManager} 实例
* @param nacosDiscoveryProperties
* {@link NacosDiscoveryProperties} 实例
*
* @return {@link NacosWatch}
*/
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(value = "spring.cloud.nacos.discovery.watch.enabled", matchIfMissing = true)
@ConditionalOnClass(name = {"io.undertow.Undertow"})
public NacosWatch nacosWatch(NacosServiceManager nacosServiceManager,
NacosDiscoveryProperties nacosDiscoveryProperties){
return new NacosWatch(nacosServiceManager, nacosDiscoveryProperties) {
@Override
public int getPhase(){
return Integer.MAX_VALUE;
}
};
}
}
| [
"webmaster@buession.com"
] | webmaster@buession.com |
11926ed3a78e14ceac49e811bbfd49f2f1ea8513 | 53fbc6296f6e53706b87b0db954587501251eb82 | /BeIdeal/app/build/generated/source/r/debug/android/support/v7/recyclerview/R.java | 343f2178ed7f53478874fd878382fee5ad255dc2 | [] | no_license | RezidaRismawati/TugasBesarMobile | 559368f326f7a8a9023b5070aab88ec51ba78d71 | 1b251b0581a7a650a10a473facf1c8e8fdd91b97 | refs/heads/master | 2021-09-06T07:49:18.877230 | 2018-02-03T23:55:13 | 2018-02-03T23:55:13 | 120,119,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,938 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.v7.recyclerview;
public final class R {
public static final class attr {
public static final int fastScrollEnabled = 0x7f0400a0;
public static final int fastScrollHorizontalThumbDrawable = 0x7f0400a1;
public static final int fastScrollHorizontalTrackDrawable = 0x7f0400a2;
public static final int fastScrollVerticalThumbDrawable = 0x7f0400a3;
public static final int fastScrollVerticalTrackDrawable = 0x7f0400a4;
public static final int font = 0x7f0400a5;
public static final int fontProviderAuthority = 0x7f0400a7;
public static final int fontProviderCerts = 0x7f0400a8;
public static final int fontProviderFetchStrategy = 0x7f0400a9;
public static final int fontProviderFetchTimeout = 0x7f0400aa;
public static final int fontProviderPackage = 0x7f0400ab;
public static final int fontProviderQuery = 0x7f0400ac;
public static final int fontStyle = 0x7f0400ad;
public static final int fontWeight = 0x7f0400ae;
public static final int layoutManager = 0x7f0400d0;
public static final int reverseLayout = 0x7f040138;
public static final int spanCount = 0x7f040148;
public static final int stackFromEnd = 0x7f04014e;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f050000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f060058;
public static final int notification_icon_bg_color = 0x7f060059;
public static final int ripple_material_light = 0x7f060064;
public static final int secondary_text_default_material_light = 0x7f060066;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f07004f;
public static final int compat_button_inset_vertical_material = 0x7f070050;
public static final int compat_button_padding_horizontal_material = 0x7f070051;
public static final int compat_button_padding_vertical_material = 0x7f070052;
public static final int compat_control_corner_material = 0x7f070053;
public static final int fastscroll_default_thickness = 0x7f07007d;
public static final int fastscroll_margin = 0x7f07007e;
public static final int fastscroll_minimum_range = 0x7f07007f;
public static final int item_touch_helper_max_drag_scroll_per_frame = 0x7f070087;
public static final int item_touch_helper_swipe_escape_max_velocity = 0x7f070088;
public static final int item_touch_helper_swipe_escape_velocity = 0x7f070089;
public static final int notification_action_icon_size = 0x7f07008c;
public static final int notification_action_text_size = 0x7f07008d;
public static final int notification_big_circle_margin = 0x7f07008e;
public static final int notification_content_margin_start = 0x7f07008f;
public static final int notification_large_icon_height = 0x7f070090;
public static final int notification_large_icon_width = 0x7f070091;
public static final int notification_main_column_padding_top = 0x7f070092;
public static final int notification_media_narrow_margin = 0x7f070093;
public static final int notification_right_icon_size = 0x7f070094;
public static final int notification_right_side_padding_top = 0x7f070095;
public static final int notification_small_icon_background_padding = 0x7f070096;
public static final int notification_small_icon_size_as_large = 0x7f070097;
public static final int notification_subtext_size = 0x7f070098;
public static final int notification_top_pad = 0x7f070099;
public static final int notification_top_pad_large_text = 0x7f07009a;
}
public static final class drawable {
public static final int notification_action_background = 0x7f080091;
public static final int notification_bg = 0x7f080092;
public static final int notification_bg_low = 0x7f080093;
public static final int notification_bg_low_normal = 0x7f080094;
public static final int notification_bg_low_pressed = 0x7f080095;
public static final int notification_bg_normal = 0x7f080096;
public static final int notification_bg_normal_pressed = 0x7f080097;
public static final int notification_icon_background = 0x7f080098;
public static final int notification_template_icon_bg = 0x7f080099;
public static final int notification_template_icon_low_bg = 0x7f08009a;
public static final int notification_tile_bg = 0x7f08009b;
public static final int notify_panel_notification_icon_bg = 0x7f08009c;
}
public static final class id {
public static final int action_container = 0x7f090018;
public static final int action_divider = 0x7f09001a;
public static final int action_image = 0x7f09001b;
public static final int action_text = 0x7f090022;
public static final int actions = 0x7f090023;
public static final int async = 0x7f09002b;
public static final int blocking = 0x7f090031;
public static final int chronometer = 0x7f09004c;
public static final int forever = 0x7f09006f;
public static final int icon = 0x7f090076;
public static final int icon_group = 0x7f090077;
public static final int info = 0x7f09007f;
public static final int italic = 0x7f090086;
public static final int item_touch_helper_previous_elevation = 0x7f090087;
public static final int line1 = 0x7f090094;
public static final int line3 = 0x7f090095;
public static final int normal = 0x7f0900af;
public static final int notification_background = 0x7f0900b0;
public static final int notification_main_column = 0x7f0900b1;
public static final int notification_main_column_container = 0x7f0900b2;
public static final int right_icon = 0x7f0900c8;
public static final int right_side = 0x7f0900c9;
public static final int text = 0x7f0900f9;
public static final int text2 = 0x7f0900fa;
public static final int time = 0x7f090105;
public static final int title = 0x7f090108;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f0a000a;
}
public static final class layout {
public static final int notification_action = 0x7f0b0045;
public static final int notification_action_tombstone = 0x7f0b0046;
public static final int notification_template_custom_big = 0x7f0b004d;
public static final int notification_template_icon_group = 0x7f0b004e;
public static final int notification_template_part_chronometer = 0x7f0b0052;
public static final int notification_template_part_time = 0x7f0b0053;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0e0046;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0f0107;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0108;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f010a;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f010d;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f010f;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f0185;
public static final int Widget_Compat_NotificationActionText = 0x7f0f0186;
}
public static final class styleable {
public static final int[] FontFamily = { 0x7f0400a7, 0x7f0400a8, 0x7f0400a9, 0x7f0400aa, 0x7f0400ab, 0x7f0400ac };
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 = { 0x7f0400a5, 0x7f0400ad, 0x7f0400ae };
public static final int FontFamilyFont_font = 0;
public static final int FontFamilyFont_fontStyle = 1;
public static final int FontFamilyFont_fontWeight = 2;
public static final int[] RecyclerView = { 0x010100c4, 0x010100f1, 0x7f0400a0, 0x7f0400a1, 0x7f0400a2, 0x7f0400a3, 0x7f0400a4, 0x7f0400d0, 0x7f040138, 0x7f040148, 0x7f04014e };
public static final int RecyclerView_android_orientation = 0;
public static final int RecyclerView_android_descendantFocusability = 1;
public static final int RecyclerView_fastScrollEnabled = 2;
public static final int RecyclerView_fastScrollHorizontalThumbDrawable = 3;
public static final int RecyclerView_fastScrollHorizontalTrackDrawable = 4;
public static final int RecyclerView_fastScrollVerticalThumbDrawable = 5;
public static final int RecyclerView_fastScrollVerticalTrackDrawable = 6;
public static final int RecyclerView_layoutManager = 7;
public static final int RecyclerView_reverseLayout = 8;
public static final int RecyclerView_spanCount = 9;
public static final int RecyclerView_stackFromEnd = 10;
}
}
| [
"budi.purwanto15@gmail.com"
] | budi.purwanto15@gmail.com |
ebb52ca7e8186e102d50daa66fff216f22533aee | 8b840cf52876eb2d5cd76b2d34845f0c2e8e5b23 | /app/src/main/java/com/haolin/component/sample/application/MainApplication.java | a67137d5b3ddea779299744d6db36fb5c3a968e4 | [] | no_license | hunimeizi/HaoLin_Component_Sample | ca82f5e47985723d559a0723d3470f400d60d619 | 46d6b00b7f519f1664c44690fe6a053abcb86c69 | refs/heads/master | 2020-05-16T12:09:46.993550 | 2019-04-23T15:07:26 | 2019-04-23T15:07:26 | 183,038,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,153 | java | package com.haolin.component.sample.application;
import android.app.Application;
import com.haolin.conentlibrary.APPConfig;
import com.haolin.conentlibrary.listenter.IPPComponent;
/**
* 作者:haoLin_Lee on 2019/04/23 22:18
* 邮箱:Lhaolin0304@sina.com
* class:
*/
public class MainApplication extends Application implements IPPComponent {
private static MainApplication application;
private static MainApplication getApplication() {
return application;
}
@Override
public void onCreate() {
super.onCreate();
initializa(this);
}
@Override
public void initializa(Application application) {
//将主App的上下文传到Login以及mine application中
for (String component : APPConfig.COMPONENT) {
try {
Class<?> clazz = Class.forName(component);
Object object = clazz.newInstance();
if (object instanceof IPPComponent) {
((IPPComponent) object).initializa(this);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
| [
"342161360@qq.com"
] | 342161360@qq.com |
b25b9454649e88ed0e6ff3462a6cc990d83c99e9 | 833e4ea7a61fe5a5b38300ae9f670364bc3c7c0a | /projects/MeusLivrosAppCompleto/app/src/main/java/com/example/douglas/meuslivrosapp/FormActivity.java | e0a1b60a798cb83870926b460dcb2ae0b74ef06b | [] | no_license | dcollioni/android-201609 | fbe9c8f81753cebb60b4f8c7faab8515171c1477 | bef3c8137fcd3b31a3857df3de511e99c8769e6e | refs/heads/master | 2020-12-08T01:09:39.545563 | 2016-09-18T13:56:14 | 2016-09-18T13:56:14 | 66,890,460 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,823 | java | package com.example.douglas.meuslivrosapp;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.example.douglas.meuslivrosapp.data.Db4oFactory;
import com.example.douglas.meuslivrosapp.data.LivroDao;
import java.text.Normalizer;
public class FormActivity extends AppCompatActivity {
private Db4oFactory db4o;
private LivroDao livroDao;
private long livroID;
EditText etTitulo, etAutor, etNumeroPaginas;
Spinner spCategoria;
Button btSalvar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_form);
configurarDb();
carregarComponentes();
configurarBotao();
// pega o parâmetro LIVRO_ID quando passado
Intent intent = getIntent();
livroID = intent.getLongExtra("LIVRO_ID", 0);
}
private void configurarDb() {
// escolhe o diretório para criar a conexão
String dir = getDir("data", 0).toString();
// cria a conexão com o banco passando o diretório
db4o = new Db4oFactory(dir);
}
private void carregarComponentes() {
etTitulo = (EditText) findViewById(R.id.et_titulo);
etAutor = (EditText) findViewById(R.id.et_autor);
etNumeroPaginas = (EditText) findViewById(R.id.et_numero_paginas);
spCategoria = (Spinner) findViewById(R.id.sp_categoria);
btSalvar = (Button) findViewById(R.id.bt_salvar);
}
void configurarBotao() {
btSalvar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// pega os valores dos campos
String titulo = etTitulo.getText().toString();
String autor = etAutor.getText().toString();
String categoria = spCategoria.getSelectedItem().toString();
String numPaginas = etNumeroPaginas.getText().toString();
if (titulo.isEmpty() || autor.isEmpty() || numPaginas.isEmpty()) {
Toast.makeText(FormActivity.this, "Preencha todos os campos", Toast.LENGTH_SHORT).show();
return;
}
int numeroPaginas = Integer.parseInt(numPaginas);
// cria um objeto livro com os valores dos campos
Livro livro = new Livro();
livro.setTitulo(titulo);
livro.setAutor(autor);
livro.setCategoria(categoria);
livro.setNumeroPaginas(numeroPaginas);
if (livroID == 0) {
// insere o livro no banco
livroDao.inserir(livro);
} else {
// atualiza o livro no banco
livroDao.atualizar(livroID, livro);
}
// finaliza a activity
finish();
}
});
}
@Override
protected void onResume() {
super.onResume();
// abre a conexão com o banco
db4o.abrirConexao();
// instancia a classe que manipula os livros
livroDao = new LivroDao(db4o);
// atualiza o título da tela
setTitle(R.string.novo_livro);
if (livroID > 0) {
setTitle(R.string.editar_livro);
carregarLivro();
}
}
private void carregarLivro() {
// busca o livro do banco pelo ID
Livro livro = livroDao.buscar(livroID);
// carraga os campos da tela com os dados do livro
String titulo = livro.getTitulo();
String autor = livro.getAutor();
String categoria = livro.getCategoria();
int numeroPaginas = livro.getNumeroPaginas();
etTitulo.setText(titulo);
etAutor.setText(autor);
etNumeroPaginas.setText(Integer.toString(numeroPaginas));
int position = ((ArrayAdapter)spCategoria.getAdapter()).getPosition(categoria);
spCategoria.setSelection(position);
}
@Override
protected void onPause() {
super.onPause();
db4o.fecharConexao();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (livroID > 0) {
getMenuInflater().inflate(R.menu.livros, menu);
}
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.menu_excluir_livros:
AlertDialog alertDialog = new AlertDialog.Builder(FormActivity.this)
.setMessage("Confirma a exclusão?")
.setNegativeButton("Não", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setPositiveButton("Sim", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
livroDao.excluir(livroID);
finish();
}
})
.create();
alertDialog.show();
return true;
}
return false;
}
}
| [
"dcollioni@gmail.com"
] | dcollioni@gmail.com |
c63428a79e533c8f9dd2131bcf17c18c679ea343 | 43539dcfffe0321d3e12ed2d94caf2a75550a426 | /app/src/test/java/com/example/lightheadapp/ExampleUnitTest.java | 2682eed554237caa7635ab7736b7cbac46a3b191 | [] | no_license | MoriArchi/Lighthead_app | b6216f618516e9390618f51e82b4da65b23b507f | 4d3f965fa938fa4a0fb4995fa1720870656bdb10 | refs/heads/master | 2020-09-20T02:54:18.550333 | 2019-11-27T06:35:29 | 2019-11-27T06:35:29 | 224,361,559 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.example.lightheadapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"you@example.com"
] | you@example.com |
076660daf6c8f86221cf6a4a6490fc76fa92c332 | d3e384e527c6836f3837d87af9234435df656205 | /src/main/java/threads/CurrentTest2.java | 94a4b2db1fdd6ead980b8cdc2bfb888559fd8b09 | [] | no_license | houyafei/MyUtilTest | f4b4ff2f61f4cef4cf21af80d363f504eabea2a3 | bb7b587fdde2a60141dfae0ed62156eab31567ce | refs/heads/master | 2020-03-25T13:46:35.654772 | 2018-08-20T07:24:53 | 2018-08-20T07:24:53 | 143,842,212 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 683 | java | package threads;
/**
* 线程处理方法二
*
* @author yafei.hou on 2018/7/31
*/
public class CurrentTest2 {
private static final Object lock = new Object();
public static void main(String[] args) {
int[] num = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
char[] cs = {'a', 'b', 'c', 'd', 'e'};
}
static void canPrintNum(boolean printCsOver){
synchronized (lock){
if (printCsOver){
lock.notify();
}else {
try {
lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
| [
"yafei.hou@phicomm.com"
] | yafei.hou@phicomm.com |
705c1cd3efcc59649e489095101f824f9886a34b | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_2464487_1/java/Alexander86/A.java | 9d0dcf5e9ea7a33589ea1c469827c65d018fc1ca | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,510 | java | import java.io.*;
import java.util.*;
import java.math.*;
public class A{
static BigInteger two = BigInteger.valueOf(2);
public static BigInteger getRings(BigInteger rings, BigInteger a, BigInteger b){
BigInteger res = b.multiply(rings).add(rings.multiply(rings.subtract(BigInteger.ONE)).divide(two).multiply(a));
//System.out.println("gr " + rings + " " + a + " " + b + ": " + res);
return res;
}
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int tc = scanner.nextInt();
for(int tcc = 1; tcc <= tc; tcc++){
System.out.print("Case #" + tcc + ": ");
BigInteger r, t;
r = scanner.nextBigInteger();
t = scanner.nextBigInteger();
BigInteger first = r.multiply(r);
r = r.add(BigInteger.ONE);
first = r.multiply(r).subtract(first);
r = r.add(BigInteger.ONE);
BigInteger second = r.multiply(r);
r = r.add(BigInteger.ONE);
second = r.multiply(r).subtract(second);
BigInteger a = second.subtract(first);
BigInteger b = first;
// System.out.println(first);
// System.out.println(second);
BigInteger maxR = BigInteger.ONE;
while(getRings(maxR, a, b).compareTo(t)<=0)maxR = maxR.multiply(two);
BigInteger minR = BigInteger.ZERO;
while(minR.compareTo(maxR) < 0){
BigInteger mid = minR.add(maxR.subtract(minR).add(BigInteger.ONE).divide(two));
if(getRings(mid, a, b).compareTo(t)<=0){
minR = mid;
} else {
maxR = mid.subtract(BigInteger.ONE);
}
}
System.out.println(minR);
}
}
}
| [
"eewestman@gmail.com"
] | eewestman@gmail.com |
52ca9c609402de1030eb11d2be671f8a5aa6c0d2 | 3bb9ae461b58b302bce27b204a841fa119bae516 | /src/main/java/com/gkzy/ueditor/common/ueditor/define/State.java | 7814760adb778e40d20e683680e616d83ec073e0 | [] | no_license | rww666666/gkzy | dcf37e01e5521ca03dbb1c09b2bb4e3072fe7e37 | 7555219cc7135d4f7e373030c04457f3c8af00fc | refs/heads/master | 2022-12-10T18:57:27.588472 | 2019-06-05T11:39:28 | 2019-06-05T11:39:28 | 190,383,647 | 0 | 0 | null | 2022-11-16T07:39:19 | 2019-06-05T11:38:58 | Java | UTF-8 | Java | false | false | 301 | java | package com.gkzy.ueditor.common.ueditor.define;
/**
* 处理状态接口
* @author hancong03@baidu.com
*
*/
public interface State {
public boolean isSuccess();
public void putInfo(String name, String val);
public void putInfo(String name, long val);
public String toJSONString();
}
| [
"374867817@qq.com"
] | 374867817@qq.com |
abcd0e85c43ac128f51f2cb12c9f60abe9d8c73c | 379cd6adde660498dc7d3b14693ff67595caeb8a | /auth-service/src/main/java/com/florian935/auth/web/AuthController.java | 303814b93a8a3605ac1ed1824883bbd0f8abcdd1 | [] | no_license | Florian935/eureka_zuulproxy_jwtsecurity | 00fc2c4a58b241009a0999874f9c3a7795d9ab45 | 19cfcb1332096dae86294f5269312f33c1c639fa | refs/heads/master | 2023-04-24T09:20:23.178169 | 2021-05-15T13:34:10 | 2021-05-15T13:34:10 | 367,634,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,267 | java | package com.florian935.auth.web;
import com.florian935.auth.model.JwtResponse;
import com.florian935.auth.model.User;
import com.florian935.auth.repository.UserRepository;
import com.florian935.auth.security.utils.JwtTokenUtil;
import lombok.Builder;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/v1.0")
@RequiredArgsConstructor
public class AuthController {
private final UserRepository userRepository;
private final AuthenticationManager authenticationManager;
private final UserDetailsService userDetailsService;
private final JwtTokenUtil jwtTokenUtil;
private final PasswordEncoder passwordEncoder;
@PostMapping("/authenticate")
public ResponseEntity<JwtResponse> authenticate(@RequestBody User user) {
final UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken =
new UsernamePasswordAuthenticationToken(
user.getUsername(), user.getPassword()
);
authenticationManager.authenticate(usernamePasswordAuthenticationToken);
final UserDetails userDetails = userDetailsService
.loadUserByUsername(user.getUsername());
final String token = jwtTokenUtil.generateToken(userDetails);
return ResponseEntity.ok(new JwtResponse(token));
}
@GetMapping
public List<User> getAll() {
return userRepository.findAll();
}
@PostMapping
public ResponseEntity<User> save(@RequestBody User user) {
final User userToSave = User.builder()
.username(user.getUsername())
.password(passwordEncoder.encode(user.getPassword()))
.build();
return ResponseEntity.ok(userRepository.save(userToSave));
}
}
| [
"florian.martin63000@gmail.com"
] | florian.martin63000@gmail.com |
25fa14993dad84c691cfb7483acf95f15a6c9767 | 1a947f34f1b602b90e72e24877219e1e7fa07a6e | /src/main/java/system/network/StringConnection.java | e16572f86286276d411fce347587c1537b2d5514 | [] | no_license | ethanp/three-phase-commit | d4b50d00709b766409aab6dfd5c6ea3617c4c159 | 5308f780df0e3f0d6476f1a28e3cf9f2fdab8055 | refs/heads/master | 2021-01-20T10:32:20.580862 | 2015-03-09T20:36:07 | 2015-03-09T20:36:07 | 31,352,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | package system.network;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
/**
* Ethan Petuchowski 2/17/15
*/
public class StringConnection {
PrintWriter writer;
BufferedReader reader;
public StringConnection(Process process) {
writer = new PrintWriter(process.getOutputStream());
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
}
public StringConnection(Socket socket) {
try {
writer = new PrintWriter(socket.getOutputStream());
reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}
catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"ethanp@utexas.edu"
] | ethanp@utexas.edu |
34fa377fc6fe0a84bc8e2f830e74e45b66ff6cae | 691e44186027dd724389e70c86f7d51749e2442b | /ClickBot/src/bot/Gui.java | 4605b6f982046c59b50f0f98d97f2b193c9d4c30 | [] | no_license | Ghilt/ClickBot | b80c460c9e9f3497235a9a5be2ff6cbefa2d0d25 | a4e5e8c924c6a01d4243144425c024f2feefefbc | refs/heads/master | 2021-01-01T03:48:40.191214 | 2016-06-02T13:11:49 | 2016-06-02T13:11:49 | 59,279,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,226 | java | package bot;
import bot.DetectionBotEntry;
import bot.EntryInformation;
import bot.LocateButton;
import bot.PeriodicBotEntry;
import bot.StartButton;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.Border;
public class Gui extends JFrame implements ActionListener {
private final int width = 500;
private final Dimension standardSize = new Dimension(500, 55);
private final Dimension bigButton = new Dimension(140, 40);
private EntryInformation entryInformation;
private JPanel window;
private int entries = 0;
private JFrame abortFrame;
private JButton pause;
private JTextArea log;
public Gui() {
this.entryInformation = new EntryInformation(this);
this.window = new JPanel(new FlowLayout());
this.window.setPreferredSize(new Dimension(500, 60));
this.add(this.window);
this.setupAddEntry();
this.setDefaultCloseOperation(3);
this.setVisible(true);
this.pack();
}
private void setupAddEntry() {
JPanel container = new JPanel();
container.setPreferredSize(this.standardSize);
container.setBorder(BorderFactory.createLineBorder(Color.decode("#4682B4")));
StartButton startButton = new StartButton(this, this.entryInformation, "Launch");
startButton.addActionListener(startButton);
this.styleComponent(startButton);
JButton addDetectionEntryButton = new JButton("Add Detection Entry");
addDetectionEntryButton.addActionListener(this);
this.styleComponent(addDetectionEntryButton);
JButton addPeriodicEntryButton = new JButton("Add Periodic Entry");
addPeriodicEntryButton.addActionListener(this);
this.styleComponent(addPeriodicEntryButton);
addDetectionEntryButton.setPreferredSize(this.bigButton);
addPeriodicEntryButton.setPreferredSize(this.bigButton);
startButton.setPreferredSize(this.bigButton);
container.add(addDetectionEntryButton);
container.add(addPeriodicEntryButton);
container.add(startButton);
this.window.add(container);
}
public void actionPerformed(ActionEvent arg0) {
JButton button = (JButton)arg0.getSource();
if (button.getText().equals("Add Periodic Entry")) {
PeriodicBotEntry justAddedEntry = this.entryInformation.writePeriodicEntry();
this.addNewPeriodicEntry(justAddedEntry);
} else {
DetectionBotEntry justAddedEntry = this.entryInformation.writeDetectionEntry();
this.addNewDetectionEntry(justAddedEntry);
}
}
private void addNewDetectionEntry(DetectionBotEntry entry) {
++this.entries;
this.window.setPreferredSize(new Dimension(500, 60 + 60 * this.entries));
JPanel container = new JPanel();
container.setPreferredSize(this.standardSize);
container.setBorder(BorderFactory.createLineBorder(Color.decode("#4682B4")));
JPanel left = new JPanel();
left.setPreferredSize(new Dimension(240, 43));
JTextField xCoord = new JTextField("na");
xCoord.setPreferredSize(new Dimension(70, 15));
xCoord.setEnabled(false);
JTextField yCoord = new JTextField("na");
yCoord.setPreferredSize(new Dimension(70, 15));
yCoord.setEnabled(false);
JTextField xSource = new JTextField("na");
xSource.setPreferredSize(new Dimension(70, 15));
xSource.setEnabled(false);
JTextField ySource = new JTextField("na");
ySource.setPreferredSize(new Dimension(70, 15));
ySource.setEnabled(false);
JTextField keyField = new JTextField("Key");
keyField.setPreferredSize(new Dimension(70, 25));
JTextField clicksField = new JTextField("# clicks");
clicksField.setPreferredSize(new Dimension(70, 25));
clicksField.setEnabled(false);
LocateButton locate = new LocateButton(xCoord, yCoord, clicksField, keyField, "Locate");
locate.setName("Locate");
locate.addActionListener(locate);
locate.setPreferredSize(new Dimension(80, 15));
LocateButton source = new LocateButton(xSource, ySource, "Source");
source.setName("Source");
source.addActionListener(source);
source.setPreferredSize(new Dimension(80, 15));
left.add(xCoord);
left.add(yCoord);
left.add(locate);
left.add(xSource);
left.add(ySource);
left.add(source);
container.add(left);
container.add(keyField);
container.add(clicksField);
JPanel filler = new JPanel();
filler.setPreferredSize(new Dimension(70, 10));
container.add(filler);
this.window.add(container);
this.styleComponent(xCoord);
this.styleComponent(yCoord);
this.styleComponent(xSource);
this.styleComponent(ySource);
this.styleComponent(keyField);
this.styleComponent(clicksField);
this.styleComponent(locate);
this.styleComponent(source);
entry.setXSource(xSource);
entry.setYSource(ySource);
entry.setNbrOfClicksSource(clicksField);
entry.setKeyTypeSource(keyField);
entry.setXTargetSource(xCoord);
entry.setYTargetSource(yCoord);
this.pack();
}
public void addNewPeriodicEntry(PeriodicBotEntry entry) {
++this.entries;
this.window.setPreferredSize(new Dimension(500, 60 + 60 * this.entries));
JPanel container = new JPanel();
container.setPreferredSize(this.standardSize);
container.setBorder(BorderFactory.createLineBorder(Color.decode("#4682B4")));
JPanel left = new JPanel();
left.setPreferredSize(new Dimension(240, 43));
JTextField xCoord = new JTextField("na");
xCoord.setPreferredSize(new Dimension(70, 15));
xCoord.setEnabled(false);
JTextField yCoord = new JTextField("na");
yCoord.setPreferredSize(new Dimension(70, 15));
yCoord.setEnabled(false);
JTextField keyField = new JTextField("Key");
keyField.setPreferredSize(new Dimension(70, 25));
JTextField periodField = new JTextField("Period");
periodField.setPreferredSize(new Dimension(70, 25));
JTextField clicksField = new JTextField("# clicks");
clicksField.setPreferredSize(new Dimension(70, 25));
clicksField.setEnabled(false);
LocateButton locate = new LocateButton(xCoord, yCoord, clicksField, keyField, "Locate");
locate.setName("Locate");
locate.addActionListener(locate);
locate.setPreferredSize(new Dimension(80, 15));
left.add(xCoord);
left.add(yCoord);
left.add(locate);
container.add(left);
container.add(keyField);
container.add(clicksField);
container.add(periodField);
this.window.add(container);
this.styleComponent(periodField);
this.styleComponent(xCoord);
this.styleComponent(yCoord);
this.styleComponent(keyField);
this.styleComponent(clicksField);
this.styleComponent(locate);
entry.setPeriodsource(periodField);
entry.setNbrOfClicksSource(clicksField);
entry.setKeyTypeSource(keyField);
entry.setXTargetSource(xCoord);
entry.setYTargetSource(yCoord);
this.pack();
}
public void showAbort(final EntryInformation entryList) {
this.abortFrame = new JFrame();
this.abortFrame.setDefaultCloseOperation(0);
this.abortFrame.setResizable(false);
JPanel panel = new JPanel();
panel.setPreferredSize(new Dimension(470, 400));
JButton terminate = new JButton("Terminate");
terminate.setFocusable(false);
terminate.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
entryList.setPauseAll(false);
entryList.finishAll();
Gui.this.abortFrame.dispose();
}
});
terminate.setPreferredSize(this.bigButton);
this.pause = new JButton("Pause");
this.pause.setFocusable(false);
this.pause.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
if (!entryList.isPaused()) {
Gui.this.pause.setText("Unpause");
entryList.setPauseAll(true);
Gui.this.log.setEnabled(false);
} else {
Gui.this.pause.setText("Pause");
entryList.setPauseAll(false);
Gui.this.log.setEnabled(true);
}
}
});
this.pause.setPreferredSize(this.bigButton);
this.log = new JTextArea("", 20, 40);
this.log.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.decode("#4682B4")), "Log"));
this.log.setLineWrap(true);
this.log.setEditable(false);
LoggingThread logger = new LoggingThread(log);
entryList.setLog(logger);
logger.start();
JScrollPane logScroll = new JScrollPane(this.log);
logScroll.setVerticalScrollBarPolicy(22);
this.styleComponent(terminate);
this.styleComponent(this.pause);
this.styleComponent(logScroll);
this.abortFrame.add(panel);
panel.add(terminate);
panel.add(this.pause);
panel.add(logScroll);
this.abortFrame.setVisible(true);
this.abortFrame.pack();
}
private void styleComponent(JComponent comp) {
comp.setBackground(Color.decode("#4682B4"));
comp.setForeground(Color.decode("#FFFAFA"));
comp.setBorder(BorderFactory.createEtchedBorder());
}
}
| [
"adam.nilsson@softhouse.se"
] | adam.nilsson@softhouse.se |
b61faf0b4dffe3f22c6dd3e3fa21ac9969f65aff | f890c7823db37fe98707ce866f00198831a5c228 | /src/com/example/spring/beans/cycle/Car.java | a296ed77f16cd937460c8df94dad213cb9eb6e06 | [] | no_license | jhao14/spring_1 | b5624391cbf771b4b1ed81043aab3102343da474 | 850f0df8335c49c92dd3aa65c3ca1dddb3d03e9e | refs/heads/master | 2023-04-22T21:49:42.849818 | 2018-01-14T15:40:40 | 2018-01-14T15:40:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.example.spring.beans.cycle;
public class Car {
@Override
public String toString() {
return "Car [brand=" + brand + "]";
}
public Car() {
System.out.println("Car's Constructor");
}
private String brand;
public void setBrand(String brand) {
this.brand = brand;
}
public void init() {
System.out.println("init...");
}
public void destroy() {
System.out.println("destroy...");
}
}
| [
"776225930@qq.com"
] | 776225930@qq.com |
7ee2cd9a898288c6db8e73f3d0153646e3a1ac2d | 2834f98b53d78bafc9f765344ded24cf41ffebb0 | /chrome/android/java/src/org/chromium/chrome/browser/sharing/shared_clipboard/SharedClipboardShareActivity.java | 95015ec9af5a56cf65739aa90db6a2a114602a05 | [
"BSD-3-Clause"
] | permissive | cea56/chromium | 81bffdf706df8b356c2e821c1a299f9d4bd4c620 | 013d244f2a747275da76758d2e6240f88c0165dd | refs/heads/master | 2023-01-11T05:44:41.185820 | 2019-12-09T04:14:16 | 2019-12-09T04:14:16 | 226,785,888 | 1 | 0 | BSD-3-Clause | 2019-12-09T04:40:07 | 2019-12-09T04:40:07 | null | UTF-8 | Java | false | false | 5,423 | java | // Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.sharing.shared_clipboard;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import org.chromium.base.ContextUtils;
import org.chromium.base.ThreadUtils;
import org.chromium.base.task.PostTask;
import org.chromium.base.task.TaskTraits;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.init.AsyncInitializationActivity;
import org.chromium.chrome.browser.settings.SettingsLauncher;
import org.chromium.chrome.browser.sharing.SharingAdapter;
import org.chromium.chrome.browser.sharing.SharingServiceProxy;
import org.chromium.chrome.browser.sharing.SharingServiceProxy.DeviceInfo;
import org.chromium.components.sync.AndroidSyncSettings;
import org.chromium.components.sync.protocol.SharingSpecificFields;
import org.chromium.ui.widget.ButtonCompat;
/**
* Activity to display device targets to share text.
*/
public class SharedClipboardShareActivity
extends AsyncInitializationActivity implements OnItemClickListener {
private SharingAdapter mAdapter;
/**
* Checks whether sending shared clipboard message is enabled for the user and enables/disables
* the SharedClipboardShareActivity appropriately. This call requires native to be loaded.
*/
public static void updateComponentEnabledState() {
boolean enabled = ChromeFeatureList.isEnabled(ChromeFeatureList.SHARED_CLIPBOARD_UI);
PostTask.postTask(TaskTraits.USER_VISIBLE, () -> setComponentEnabled(enabled));
}
/**
* Sets whether or not the SharedClipboardShareActivity should be enabled. This may trigger a
* StrictMode violation so shouldn't be called on the UI thread.
*/
private static void setComponentEnabled(boolean enabled) {
ThreadUtils.assertOnBackgroundThread();
Context context = ContextUtils.getApplicationContext();
PackageManager packageManager = context.getPackageManager();
ComponentName componentName =
new ComponentName(context, SharedClipboardShareActivity.class);
int newState = enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
// This indicates that we don't want to kill Chrome when changing component enabled state.
int flags = PackageManager.DONT_KILL_APP;
if (packageManager.getComponentEnabledSetting(componentName) != newState) {
packageManager.setComponentEnabledSetting(componentName, newState, flags);
}
}
@Override
protected void triggerLayoutInflation() {
setContentView(R.layout.sharing_device_picker);
View mask = findViewById(R.id.mask);
mask.setOnClickListener(v -> finish());
ButtonCompat chromeSettingsButton = findViewById(R.id.chrome_settings);
if (!AndroidSyncSettings.get().isChromeSyncEnabled()) {
chromeSettingsButton.setVisibility(View.VISIBLE);
chromeSettingsButton.setOnClickListener(view -> {
SettingsLauncher.launchSettingsPage(ContextUtils.getApplicationContext(), null);
});
}
onInitialLayoutInflationComplete();
}
@Override
public void startNativeInitialization() {
SharingServiceProxy.getInstance().addDeviceCandidatesInitializedObserver(
this::finishNativeInitialization);
}
@Override
public void finishNativeInitialization() {
super.finishNativeInitialization();
mAdapter = new SharingAdapter(SharingSpecificFields.EnabledFeatures.SHARED_CLIPBOARD);
if (!mAdapter.isEmpty()) {
findViewById(R.id.device_picker_toolbar).setVisibility(View.VISIBLE);
SharedClipboardMetrics.recordShowDeviceList();
} else {
SharedClipboardMetrics.recordShowEducationalDialog();
}
SharedClipboardMetrics.recordDeviceCount(mAdapter.getCount());
ListView listView = findViewById(R.id.device_picker_list);
listView.setAdapter(mAdapter);
listView.setOnItemClickListener(this);
listView.setEmptyView(findViewById(R.id.empty_state));
View content = findViewById(R.id.device_picker_content);
content.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_up));
}
@Override
public boolean shouldStartGpuProcess() {
return false;
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DeviceInfo device = mAdapter.getItem(position);
String text = getIntent().getStringExtra(Intent.EXTRA_TEXT);
// Log metrics for device click and text size.
SharedClipboardMetrics.recordDeviceClick(position);
SharedClipboardMetrics.recordTextSize(text.length());
SharedClipboardMessageHandler.showSendingNotification(device.guid, device.clientName, text);
finish();
}
}
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
1cbd6f4201ce9d4da81da57b828a329c56697b95 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/java_util_BitSet_previousSetBit_int.java | fdccfa6647e4062d1dac32d2a73bcb6ff75b6c72 | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 152 | java | class java_util_BitSet_previousSetBit_int{ public static void function() {java.util.BitSet obj = new java.util.BitSet();obj.previousSetBit(541730174);}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
cb5447bb9b2dc6fc2069a091447877ea7c406c13 | a48999f09731128334e5052e448ad5a7ec95ad71 | /shared/src/com/deadlyboundaries/common/network/register/dto/PlayerType.java | b018bc16587bb143d7aa619ed64669033d80dca1 | [
"MIT",
"CC0-1.0"
] | permissive | payne911/libgdx-desktop-multiplayer-template | c5df09e9a15dd1c0b6652851d8b2b6c59140a275 | 8f39d765aa7b6313b3919e121e2c5ba368cf935a | refs/heads/master | 2023-01-24T14:01:39.980898 | 2020-11-24T01:10:04 | 2020-11-24T01:10:04 | 302,441,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package com.deadlyboundaries.common.network.register.dto;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector2;
import com.deadlyboundaries.common.model.entities.dynamic.allies.MeleePlayer;
import com.deadlyboundaries.common.model.entities.dynamic.allies.Player;
import com.deadlyboundaries.common.model.entities.dynamic.allies.RangedPlayer;
import com.deadlyboundaries.common.utils.UUID;
public enum PlayerType {
RANGED {
public Player getPlayerInstance(UUID uuid, Color color, Vector2 initPos) {
return new RangedPlayer(uuid, color, initPos);
}
},
MELEE {
public Player getPlayerInstance(UUID uuid, Color color, Vector2 initPos) {
return new MeleePlayer(uuid, color, initPos);
}
};
public abstract Player getPlayerInstance(UUID uuid, Color color, Vector2 initPos);
}
| [
"payne911@users.noreply.github.com"
] | payne911@users.noreply.github.com |
f8f46833eb60bc80fcc9d2b23f90cbfb42f113ef | 6938d5654675e321ade2228593770dfcece4e060 | /src/main/java/sunwell/permaisuri/core/entity/sales/SalesInvoice.java | 843151fec5bcdd42e6d970b7d9c53c49f9e4beac | [] | no_license | PB-Cloud-2/pb-cloud-domain | bcb4c93553392e96fbce1c7a4e1293b28e3bfc02 | 85a163cd3aaed786f8f3015511808dabc9693aaf | refs/heads/master | 2022-09-22T04:41:49.959311 | 2020-06-04T13:52:42 | 2020-06-04T13:52:42 | 269,372,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,139 | java | /*
* SalesOrder.java
*
* Created on September 4, 2007, 5:28 PM
*/
package sunwell.permaisuri.core.entity.sales;
import java.io.Serializable;
import java.sql.*;
import java.util.*;
import javax.persistence.EntityManager;
import javax.validation.constraints.NotNull;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import sunwell.permaisuri.core.entity.cred.UserCredential;
import sunwell.permaisuri.core.entity.customer.Customer;
//import sunwell.permaisuri.core.entity.util.CounterInfo;
import javax.persistence.*;
@Entity
@Table (name = "salesinvoice")
public class SalesInvoice
{
@Id
@Column( name = "systemid")
@SequenceGenerator (name = "salesinvoice_id_si_seq", sequenceName = "salesinvoice_id_si_seq", allocationSize = 1)
@GeneratedValue (strategy = GenerationType.SEQUENCE, generator = "salesinvoice_id_si_seq")
private long systemId;
@NotNull(message="{error_no_customer}")
@ManyToOne
@JoinColumn( name = "cust" )
private Customer customer;
@OneToMany( mappedBy = "parent", cascade=CascadeType.ALL, fetch=FetchType.EAGER )
@Fetch(FetchMode.SELECT)
private List<SalesInvoiceItem> items ;
@NotNull(message="{error_no_issue_date}")
@Column( name = "issuedate" )
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Calendar issueDate = Calendar.getInstance();
@Column( name = "status_delivery")
private int deliveryStatus ;
@Column( name = "status_canceled" )
private int canceledStatus = 0;
@Column( name = "status_payment" )
private int paymentStatus = 0;
@Column( name = "misc_charge")
private double miscCharge = 0.0;
@Column( name = "misc_charge_memo" )
private String miscChargeMemo = "";
// @Column( name = "invoiced" )
// private boolean invoiced ;
@Column( name = "memo" )
private String memo = "";
@Column( name = "vat" )
private double vat = 0.0;
@Column( name = "vat_inclusive" )
private boolean vatInclusive = false;
@Column( name = "shipping_line" )
private Integer shippingLine = 0;
@Column( name = "promocode_used" )
private Integer promoCodeUsed ;
@Column(name="disc")
private double discount;
@Column(name="disc_memo")
private String discountMemo;
@NotNull(message="{no_si_no_specified}")
@Column( name = "invoice_no", unique = true)
private String invoiceNo;
@Column(name="payment_type")
private int paymentType;
@Column(name="payment_details")
private String paymentDetail;
@Column(name="payment_amount")
private double paymentAmount;
@Column(name="no_fak_pajak")
private String noFakPajak;
// @ManyToOne
// @JoinColumn( name = "bo_creator" )
// private UserCredential sysCreator;
//
// @ManyToOne
// @JoinColumn( name = "bo_updater" )
// private UserCredential sysUpdater;
//
// @Column( name = "bo_createdate" )
// @Temporal(javax.persistence.TemporalType.TIMESTAMP)
// private Calendar sysCreateDate;
//
// @Column( name = "bo_updatedate" )
// @Temporal(javax.persistence.TemporalType.TIMESTAMP)
// private Calendar sysUpdateDate;
/** Creates a new instance of SalesOrder */
public SalesInvoice ()
{
}
public SalesInvoice (long _idSO)
{
// resetAttributes ();
systemId = _idSO;
}
public long getSystemId () { return systemId; }
public void setSystemId (long _id)
{
this.systemId = _id;
}
public String getInvoiceNo () { return invoiceNo; }
public void setInvoiceNo (String _no)
{
this.invoiceNo = (_no != null) ? _no : "";
}
public Calendar getIssueDate () { return issueDate; }
public void setIssueDate (Calendar _date)
{
this.issueDate = _date;
}
public int getDeliveryStatus () { return deliveryStatus; }
public void setDeliveryStatus (int _d)
{
this.deliveryStatus = _d;
}
public double getMiscCharges () { return miscCharge; }
public void setMiscCharges (double m_misc_charges)
{
this.miscCharge = m_misc_charges;
}
public String getMiscChargesMemo () { return miscChargeMemo; }
public void setMiscChargesMemo (String _misc_charges_memo)
{
this.miscChargeMemo = (_misc_charges_memo != null) ? _misc_charges_memo : "";
}
public String getMemo () { return memo; }
public void setMemo (String _memo)
{
this.memo = (_memo != null) ? _memo : "";
}
public double getVAT () { return vat; }
public void setVAT (double _vat)
{
this.vat = _vat;
}
public boolean isVATInclusive () { return vatInclusive; }
public void setVATInclusive (boolean m_vat_inclusive)
{
this.vatInclusive = m_vat_inclusive;
}
public int getCanceledStatus () { return canceledStatus; }
/**
* @param _vs harus bernilai salah satu dari konstanta {@link #VS_OPEN},
* {@link #VS_CLOSED}, atau {@link #VS_CANCELED}. Jika nilai _vs bukan salah
* satu dari ketiga konstanta tersebut, maka nilai _vs akan di-override dgn
* nilai {@link #VS_CANCELED}.
*/
public void setCanceledStatus (int _vs)
{
if (_vs != SalesOrder.VS_OPEN && _vs != SalesOrder.VS_CLOSED && _vs != SalesOrder.VS_CANCELED)
this.canceledStatus = SalesOrder.VS_CANCELED;
else
this.canceledStatus = _vs;
}
public Customer getCustomer () { return customer; }
public void setCustomer (Customer m_cust)
{
this.customer = m_cust;
}
public List<SalesInvoiceItem> getItems ()
{
return items;
}
public void setItems (List<SalesInvoiceItem> _items)
{
items = _items;
}
// public UserCredential getSysCreator ()
// {
// return sysCreator;
// }
//
// public void setSysCreator (UserCredential _userCreate)
// {
// sysCreator = _userCreate;
// }
//
// public Calendar getSysCreateDate () { return sysCreateDate; }
//
// public void setSysCreateDate (Calendar m_user_createdate)
// {
// sysCreateDate = m_user_createdate;
// }
//
// public UserCredential getSysUpdater ()
// {
// return sysUpdater;
// }
//
// public void setSysUpdater (UserCredential m_userModify)
// {
// sysUpdater = m_userModify;
// }
//
// public Calendar getSysUpdateDate () { return sysUpdateDate; }
//
// public void setSysUodateDate (Calendar _date)
// {
// sysUpdateDate = _date;
// }
public int getPaymentStatus ()
{
return paymentStatus;
}
public void setPaymentStatus (int _paymentStatus)
{
paymentStatus = _paymentStatus;
}
public Integer getShippingLine ()
{
return shippingLine;
}
public void setShippingLine (Integer _shippingLine)
{
shippingLine = _shippingLine;
}
public Integer getPromoCodeUsed ()
{
return promoCodeUsed;
}
public void setPromoCodeUsed (Integer _promoCodeUsed)
{
promoCodeUsed = _promoCodeUsed;
}
public double getDiscount ()
{
return discount;
}
public void setDiscount (double _discount)
{
discount = _discount;
}
public String getDiscountMemo ()
{
return discountMemo;
}
public void setDiscountMemo (String _discountMemo)
{
discountMemo = _discountMemo;
}
public int getPaymentType ()
{
return paymentType;
}
public void setPaymentType (int _paymentType)
{
paymentType = _paymentType;
}
public String getPaymentDetail ()
{
return paymentDetail;
}
public void setPaymentDetail (String _paymentDetail)
{
paymentDetail = _paymentDetail;
}
public double getPaymentAmount ()
{
return paymentAmount;
}
public void setPaymentAmount (double _paymentAmount)
{
paymentAmount = _paymentAmount;
}
public String getNoFakPajak ()
{
return noFakPajak;
}
public void setNoFakPajak (String _noFakPajak)
{
noFakPajak = _noFakPajak;
}
}
| [
"mideel_neutral@yahoo.com"
] | mideel_neutral@yahoo.com |
e89faabe012379e76aa28b4fc503bd522ab9fda0 | 2a45c320e3d2721e6241b2b81ec7f5a550b082f6 | /taotao_search_web/src/main/java/com/taotao/search/web/controller/SearchController.java | 10cd6b9b50e168f50457b3b167dd5ce28bb0f6ff | [] | no_license | yqh700/taotao_parent | 17c954978eeefb36bcb50871a7402f56d5099cc2 | 099b296a9b81eac92f8d740ef26f313132bcfa3d | refs/heads/master | 2021-08-14T17:16:36.498500 | 2017-11-16T09:36:13 | 2017-11-16T09:36:13 | 109,517,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,896 | java | package com.taotao.search.web.controller;
import com.taotao.common.TaoResult;
import com.taotao.manager.domain.Item;
import com.taotao.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.io.UnsupportedEncodingException;
/**
* Created by 杨清华.
* on 2017/11/14.
*/
@Controller
@RequestMapping("/search")
public class SearchController {
@Value("${SEARCH_TAOTAO_ITEM_ROWS}")
private Integer rows;//搜索结果的显示数量
@Autowired
private SearchService searchService;
/**
* 搜索
* @param keyword
* @return
*/
@RequestMapping(method = RequestMethod.GET)
public String search(@RequestParam("q") String keyword, @RequestParam(defaultValue = "1") Integer page, Model model) {
//解决乱码
try {
keyword = new String(keyword.getBytes("ISO8859-1"), "UTF-8");
//查询
TaoResult<Item> taoResult = searchService.search(keyword, page, rows);
model.addAttribute("query", keyword);//查询关键字
model.addAttribute("itemList", taoResult.getRows());//查询结果集合
model.addAttribute("page", page);//当前页
model.addAttribute("totalPages", (taoResult.getTotal() + rows -1) / rows);//总页数=(记录总条数+每页显示数量-1) / 每页显示数量
return "search";//前往search,展示查询结果
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
}
| [
"yqh700@163.com"
] | yqh700@163.com |
9a811e2443763687e325f51d8357458e314c831f | 387a12018706bcf34a91f015177b9e6fe109ae35 | /src/main/java/com/mgptech/api/myrestapi/services/interfaces/IFilialService.java | 40b039c0c06f160f749a2d94aa43b53b6bbb4eed | [] | no_license | matheusmgp/spring_boot_api | 2f40382c2dff84efb1d96bf79831f09dab845593 | 16acb5d8c9dcbbdadd3c14eba03ad686b3a6a55a | refs/heads/master | 2023-02-28T04:52:46.840679 | 2021-01-30T13:37:33 | 2021-01-30T13:37:33 | 334,420,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java | package com.mgptech.api.myrestapi.services.interfaces;
import com.mgptech.api.myrestapi.domain.entities.Filial;
public interface IFilialService extends IServiceBase<Filial> {
}
| [
"matheus_mgp@hotmail.com"
] | matheus_mgp@hotmail.com |
a1bfcc9064349dbe80d4afea56942da69d6c3906 | 8d8cb25d008b2c411864b527541021d9545b8495 | /src/netlib/db/DataDBUtil.java | ef8dc4c3e3456416b651f00cad501b46ced932a4 | [] | no_license | henzil/NightApp4Android | f4ccceec6a6e5668f57d9a3fdb5e0b6003350094 | 233120aecae0fb272aff4079110ba7fb846de59f | refs/heads/master | 2020-05-19T14:59:31.464175 | 2014-09-01T14:15:59 | 2014-09-01T14:15:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,139 | java | package netlib.db;
import netlib.constant.DataSqlDBConstant;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.util.Log;
//单例模式
public class DataDBUtil extends BaseDataDBUtil implements DataSqlDBConstant {
private static DataDBUtil dataDBUtil;
private DataDBUtil(Context context) {
super(context);
}
public static DataDBUtil getInstance(Context context) {
if (dataDBUtil == null) {
dataDBUtil = new DataDBUtil(context);
}
return dataDBUtil;
}
public boolean saveList(String TAG, String url, String jsonStr) {
try {
openWriteableDB();
ContentValues values = new ContentValues();
values.put(DATA_TAG, TAG);
values.put(DATA_URL, url);
values.put(DATA_JSON_STR, jsonStr);
if (!isRowExisted(writableDatabase, T_DATA, DATA_URL_WHERE, new String[] { url + "" })) {
writableDatabase.insertOrThrow(T_DATA, null, values);
} else {
writableDatabase.update(T_DATA, values, DATA_URL_WHERE, new String[] { url + "" });
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
closeWriteableDB();
}
}
public boolean cleanList() {
return removeAllEntries(T_DATA);
}
public boolean removeList(String TAG) {
try {
openWriteableDB();
writableDatabase.delete(T_DATA, DATA_TAG + "=" + TAG, null);
Log.i("", "remove data where boardId= " + TAG);
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
closeWriteableDB();
}
return true;
}
public String getList(String TAG, String url) {
Cursor c = null;
try {
openReadableDB();
c = readableDatabase.query(T_DATA, null, DATA_URL_WHERE, new String[] { url + "" }, null, null, null);
Log.i("", "get data from local :");
if (c.moveToFirst()) {
Log.i("", "get data from local " + c.getString(3));
return c.getString(3);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (c != null) {
c.close();
}
closeReadableDB();
}
return null;
}
}
| [
"lizhen@witmob.com"
] | lizhen@witmob.com |
1375ffd211c118dd56e5c68a27d6b57b9156a530 | 28ef44e0e2b3d57d3302b0709ca1247f30dbf9c3 | /src/Java/AST/function/Sub_function_body.java | 3359a5a35524cbd08f7fd7d317b9ec1650e14310 | [] | no_license | jehadab/compiler | 6474d6f7ad8d3aab823052c00b9fb0295f4b9629 | 95f62b1265e9fd80efa6f8008c605f4df7a4c7bd | refs/heads/master | 2022-11-06T13:36:15.114238 | 2020-06-05T16:07:53 | 2020-06-05T16:07:53 | 266,942,250 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package Java.AST.function;
import Java.AST.Node;
import java.util.List;
/**
* Created by Jehad on 5/26/2020.
*/
public class Sub_function_body extends Node {
}
| [
"jehad1996@hotmail.com"
] | jehad1996@hotmail.com |
e3bfee16399358546b046017d321e241e05ae7e1 | 45dfa33447723ffcf5e3707307e98cc041c1c66d | /app/src/main/java/itg/com/iconcolorchanger/MainActivity.java | 05f9a5685df1a058d286d335c35196816c418db9 | [] | no_license | chirag1210/FreePaidApps | 1e773b8b034f488877e574b44ed047409d399c45 | 08277e81a19b0658b6cdf365c72ece57166e5ce1 | refs/heads/master | 2021-08-28T13:26:40.983972 | 2017-12-12T09:34:34 | 2017-12-12T09:34:34 | 113,957,948 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,257 | java | package itg.com.iconcolorchanger;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
/* TextView mText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
final TextView headerText = (TextView) findViewById(R.id.headerText);
headerText.setText("Collapse");
headerText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (layout.getVisibility() == View.VISIBLE) {
headerText.setText("Collapse");
layout.setVisibility(View.GONE);
} else {
headerText.setText("Expand");
layout.setVisibility(View.VISIBLE);
}
}
});
mText= (TextView) findViewById(R.id.text);
// getAddressFromLocation(38.898748,-77.037684);
mText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this,SecondActivity.class));
}
});
}
private void getAddressFromLocation(double latitude, double longitude) {
Geocoder geocoder = new Geocoder(this, Locale.ENGLISH);
try {
List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);
if (addresses.size() > 0) {
Address fetchedAddress = addresses.get(0);
StringBuilder strAddress = new StringBuilder();
for (int i = 0; i < fetchedAddress.getMaxAddressLineIndex(); i++) {
// strAddress.append(fetchedAddress.getAddressLine(i)).append(" ");
strAddress.append(fetchedAddress.getLocality()).append("\n");
}
mText.setText(strAddress.toString());
} else {
mText.setText("Searching Current Address");
}
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(MainActivity.this,"Could not get address..!",Toast.LENGTH_LONG).show();
}
}
private String getAddress1(double latitude, double longitude) {
StringBuilder result = new StringBuilder();
try {
Geocoder geocoder = new Geocoder(this, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);
if (addresses.size() > 0) {
Address address = addresses.get(0);
result.append(address.getLocality()).append("\n");
result.append(address.getCountryName());
}
} catch (IOException e) {
Log.e("tag", e.getMessage());
}
return result.toString();
}
@Override
public void onResume() {
super.onResume();
mText= (TextView) findViewById(R.id.text);
if(!EventBus.getDefault().hasSubscriberForEvent(MessageModelEvent.class)) {
EventBus.getDefault().register(this);
}
}
@Override
public void onDestroy() {
EventBus.getDefault().unregister(this);
super.onDestroy();
}
// This method will be called when a MessageEvent is posted (in the UI thread for Toast)
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageModelEvent(MessageModelEvent event) {
mText.setText(event.message);
}
*/
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(Constats.Type.FREE == Constats.type){
TextView tv= (TextView) findViewById(R.id.text);
tv.setText("Free");
}else if(Constats.Type.PAID == Constats.type){
TextView tv= (TextView) findViewById(R.id.text);
tv.setText("Paid");
}
}
}
| [
"chirag.chaudhari7@gmail.com"
] | chirag.chaudhari7@gmail.com |
610ffc4683dcf8b5a95888e658cf09ede6dcc951 | 446a56b68c88df8057e85f424dbac90896f05602 | /api/cas-server-core-api-protocol/src/main/java/org/apereo/cas/validation/ValidationResponseType.java | e2d58954879213fa6ab9d2a3feffdc27f2746a76 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | apereo/cas | c29deb0224c52997cbfcae0073a4eb65ebf41205 | 5dc06b010aa7fd1b854aa1ae683d1ab284c09367 | refs/heads/master | 2023-09-01T06:46:11.062065 | 2023-09-01T01:17:22 | 2023-09-01T01:17:22 | 2,352,744 | 9,879 | 3,935 | Apache-2.0 | 2023-09-14T14:06:17 | 2011-09-09T01:36:42 | Java | UTF-8 | Java | false | false | 504 | java | package org.apereo.cas.validation;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* Enumerates the list of response types
* that CAS may produce as a result of
* service being validated.
*
* @author Misagh Moayyed
* @since 4.2
*/
@RequiredArgsConstructor
@Getter
public enum ValidationResponseType {
/**
* Default CAS XML response.
*/
XML(true),
/**
* Render response in JSON.
*/
JSON(false);
private final boolean encodingNecessary;
}
| [
"mm1844@gmail.com"
] | mm1844@gmail.com |
7a5983bef02c2bb39070d687d1886a88d5867c0f | 8d0136ded77097ff02a4f62337dc4d2e80237a5c | /20161207(radioBox_itemEvent)/src/MyPanel.java | 700a39d4964a37a82d0d96b42432c63e39cfcbab | [] | no_license | nsaori/objective_programming_java | 1846fde736d73caf1c2fc1f138b75727a70f1863 | d1209a2500ba0e20c1452b6445c354e099547de6 | refs/heads/master | 2021-01-17T17:49:37.396318 | 2016-12-13T05:20:19 | 2016-12-13T05:20:19 | 70,644,645 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 932 | java | import java.awt.BorderLayout;
import javax.swing.*;
public class MyPanel extends JPanel {
public JLabel ml1, ml2;
public JRadioButton[] rb = new JRadioButton[3];
public MyPanel() {
this.setLayout(new BorderLayout(30,0));
ml1 = new JLabel("사과100원 배500원 체리20000원");
this.add(ml1,BorderLayout.NORTH);
rb[0] = new JRadioButton("사과");
rb[1] = new JRadioButton("배");
rb[2] = new JRadioButton("체리");
ButtonGroup rbGroup = new ButtonGroup(); // radioButton grouping!!!
for (int i = 0; i < rb.length; i++) {
//this.add(rb[i]); // panel에 추가
rbGroup.add(rb[i]); // ButtonGroup에 추가
rb[i].addItemListener(new MyListener(this)); // listener등록
}
this.add(rb[0],BorderLayout.WEST);
this.add(rb[1],BorderLayout.CENTER);
this.add(rb[2],BorderLayout.EAST);
ml2 = new JLabel("0원");
this.add(ml2,BorderLayout.SOUTH);
}
}
| [
"sappy1pappince@gmail.com"
] | sappy1pappince@gmail.com |
df7d9fd348f998dc4cd40f1db512f76060039614 | 1d056299a040a2a7ef506db624509d4482dae9d5 | /bqd-service/src/main/java/com/haizhi/bqd/service/service/impl/UserServiceImpl.java | 36b0df608e3c4fe99e5736f0c8aeb59a8d6ec1db | [] | no_license | torvalds4zh/bqd-analyse | c7f0465d7d9d39807e380a3049f1903c40bf2806 | a2dc5095c010afdbe9a5ca6c41a39a1d8665ce46 | refs/heads/master | 2021-01-20T07:48:44.403590 | 2017-05-07T08:39:09 | 2017-05-07T08:39:09 | 90,047,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,433 | java | package com.haizhi.bqd.service.service.impl;
import com.haizhi.bqd.common.security.SimpleHashPasswordEncoder;
import com.haizhi.bqd.service.model.Session;
import com.haizhi.bqd.service.model.User;
import com.haizhi.bqd.service.repo.RedisRepo;
import com.haizhi.bqd.service.repo.UserRepo;
import com.haizhi.bqd.service.service.UserService;
import com.haizhi.bqd.service.support.TxManagerConstant;
import lombok.Setter;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* Created by chenbo on 17/4/6.
*/
@Service("userService")
public class UserServiceImpl implements UserService {
@Setter
private UserRepo userRepo;
@Setter
private RedisRepo redisRepo;
@Setter
private SimpleHashPasswordEncoder passwordEncoder;
private Integer sessionExpireTime = 60 * 60 * 12;
@Override
public User createUser(User user) {
//填充权限
user.setPermission(user.getRole());
String salt = passwordEncoder.genSalt(4);
user.setSalt(salt);
user.setPassword(passwordEncoder.encodePassword(user.getPassword(), salt));
return userRepo.create(user);
}
@Transactional(TxManagerConstant.TxManager)
@Override
public void updateUser(User user) {
//填充权限
user.setPermission(user.getRole());
userRepo.update(user);
}
@Override
public User findByUsername(String username) {
User user = userRepo.findByUsername(username);
return user;
}
@Override
public User getUserById(Long userId) {
return userRepo.findById(userId);
}
public void updateUserWithDeadLine(Date deadLine, Long id) {
userRepo.updateWithDeadLine(deadLine, id);
}
@Transactional(TxManagerConstant.TxManager)
@Override
public void delete(Long userId) {
userRepo.delete(userId);
}
protected String getSessionKey(Long userId) {
return "u:" + userId;
}
@Override
public void saveSession(Long userId, Session session) {
redisRepo.push(getSessionKey(userId), session, sessionExpireTime);
}
@Override
public Session loadSession(Long userId) {
return redisRepo.get(getSessionKey(userId), Session.class);
}
@Override
public void clearSession(Long userId) {
redisRepo.delete(getSessionKey(userId));
}
}
| [
"chenbo@haizhi.com"
] | chenbo@haizhi.com |
3598b8e436c7867eb9c60a86d82b60b3d8bce213 | 624be813071d7739a0426e75e18211ac8f7393ba | /src/main/java/com/beiyelin/shop/common/utils/UserAgentUtils.java | d3ff5c8900d1d41c0d6397b8ab721bcb6aa002c3 | [
"MIT"
] | permissive | newmann/backstone | 04101a5e25d52a3b0381168fb0dc4198a34055c0 | ae7761d6d629ba3b55d7997640be0c4e991a828e | refs/heads/master | 2021-01-22T21:12:33.928996 | 2017-05-07T15:02:19 | 2017-05-07T15:02:19 | 85,402,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,225 | java | /**
* Copyright © 2012-2014 <a href="http://www.iwantclick.com">iWantClick</a>iwc.shop All rights reserved.
*/
package com.beiyelin.shop.common.utils;
import javax.servlet.http.HttpServletRequest;
import eu.bitwalker.useragentutils.Browser;
import eu.bitwalker.useragentutils.DeviceType;
import eu.bitwalker.useragentutils.UserAgent;
/**
* 用户代理字符串识别工具
* @author Tony Wong
* @version 2014-6-13
*/
public class UserAgentUtils {
/**
* 获取用户代理对象
* @param request
* @return
*/
public static UserAgent getUserAgent(HttpServletRequest request){
return UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
}
/**
* 获取设备类型
* @param request
* @return
*/
public static DeviceType getDeviceType(HttpServletRequest request){
return getUserAgent(request).getOperatingSystem().getDeviceType();
}
/**
* 是否是PC
* @param request
* @return
*/
public static boolean isComputer(HttpServletRequest request){
return DeviceType.COMPUTER.equals(getDeviceType(request));
}
/**
* 是否是手机
* @param request
* @return
*/
public static boolean isMobile(HttpServletRequest request){
return DeviceType.MOBILE.equals(getDeviceType(request));
}
/**
* 是否是平板
* @param request
* @return
*/
public static boolean isTablet(HttpServletRequest request){
return DeviceType.TABLET.equals(getDeviceType(request));
}
/**
* 是否是手机和平板
* @param request
* @return
*/
public static boolean isMobileOrTablet(HttpServletRequest request){
DeviceType deviceType = getDeviceType(request);
return DeviceType.MOBILE.equals(deviceType) || DeviceType.TABLET.equals(deviceType);
}
/**
* 获取浏览类型
* @param request
* @return
*/
public static Browser getBrowser(HttpServletRequest request){
return getUserAgent(request).getBrowser();
}
/**
* 是否IE版本是否小于等于IE8
* @param request
* @return
*/
public static boolean isLteIE8(HttpServletRequest request){
Browser browser = getBrowser(request);
return Browser.IE5.equals(browser) || Browser.IE6.equals(browser)
|| Browser.IE7.equals(browser) || Browser.IE8.equals(browser);
}
}
| [
"newmannhu@qq.com"
] | newmannhu@qq.com |
9d973ed0d9dd7732ebd89983b9cd34dbfaea7cab | 4c0708ec3f2c174878115ec0f3fd483a4178e744 | /library/src/main/java/com/oushangfeng/pinnedsectionitemdecoration/callback/OnHeaderClickAdapter.java | fb5bb4c6d089d6ee053352ddcb3c3b4602982eca | [
"Apache-2.0"
] | permissive | yibaimishenlan/PinnedSectionItemDecoration | 1f5280adcb75eae1cba8ee7635b823278d4c1d45 | 882e8b016a4b6e6c968ed69df5eefd92c1ceefd8 | refs/heads/master | 2021-01-21T03:16:23.154422 | 2016-07-27T04:39:58 | 2016-07-27T04:39:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.oushangfeng.pinnedsectionitemdecoration.callback;
/**
* Created by Oubowu on 2016/7/25 1:02.
*/
public class OnHeaderClickAdapter<T> implements OnHeaderClickListener<T> {
@Override
public void onHeaderClick(T data) {
}
@Override
public void onHeaderLongClick(T data) {
}
@Override
public void onHeaderDoubleClick(T data) {
}
}
| [
"oubowu@zuqiukong.com"
] | oubowu@zuqiukong.com |
e79fd0de2443ea452ec74698091fa5a45f65ae7f | dedd8d4e235d8067d1613ca4c68c1955e8413e95 | /app/src/main/java/com/journaldev/sqlite/DatabaseClassPeriodsHelper.java | f95563b6d7d16f11e65134da83c47909edc611c8 | [] | no_license | michaelbz1/and_studio_students_crud_and_checklist-v3 | d15b4e1426450413b50436ab45afa5e221cc502e | 096394726c3989669bf46984489db4116eed7493 | refs/heads/master | 2021-06-21T19:51:13.753834 | 2017-08-17T18:29:52 | 2017-08-17T18:29:52 | 100,300,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,828 | java | package com.journaldev.sqlite;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class DatabaseClassPeriodsHelper extends SQLiteOpenHelper {
// Table Name
public static final String TABLE_NAME = "PERIODS";
// Table columns
public static final String _ID = "_id";
public static final String PERIODSNAME = "PERIODSNAME";
// Database Information
static final String DB_NAME = "PeriodsDB.DB";
// database version
static final int DB_VERSION = 1;
// Creating table query
private static final String CREATE_TABLE = "create table " + TABLE_NAME + "(" + _ID
+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + PERIODSNAME + " TEXT NOT NULL);";
public DatabaseClassPeriodsHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);
}
/*
public ArrayList<HashMap<String, String>> getAllPeriods() {
ArrayList<HashMap<String, String>> periodsList;
periodsList = new ArrayList<HashMap<String, String>>();
String selectQuery = "SELECT * FROM PERIODS";
SQLiteDatabase database = this.getWritableDatabase();
Cursor cursor = database.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
//Id,Name,Date
HashMap<String, String> map = new HashMap<String, String>();
map.put("a", cursor.getString(0));
map.put("b", cursor.getString(1));
periodsList.add(map);
Log.e("dataofList", cursor.getString(0) + "," + cursor.getString(1));
} while (cursor.moveToNext());
}
return periodsList;
}
*/
public List<String> getAllPeriods(){
List<String> periods = new ArrayList<String>();
// Select All Query
String selectQuery = "SELECT * FROM " + TABLE_NAME + " order by PERIODSNAME" ;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
periods.add(cursor.getString(1));
} while (cursor.moveToNext());
}
// closing connection
cursor.close();
db.close();
// returning lables
return periods;
}
}
| [
"michaelbz1@hotmail.com"
] | michaelbz1@hotmail.com |
7599e198ae1d036be0514926db8d6d273a07e16f | f2e744082c66f270d606bfc19d25ecb2510e337c | /sources/com/android/settings/applications/ConfirmConvertToFbe.java | ef37274590467aabff5bad352fa78b5d3fbe9bf6 | [] | no_license | AshutoshSundresh/OnePlusSettings-Java | 365c49e178612048451d78ec11474065d44280fa | 8015f4badc24494c3931ea99fb834bc2b264919f | refs/heads/master | 2023-01-22T12:57:16.272894 | 2020-11-21T16:30:18 | 2020-11-21T16:30:18 | 314,854,903 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,628 | java | package com.android.settings.applications;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.android.settings.C0010R$id;
import com.android.settings.C0012R$layout;
import com.android.settings.SettingsPreferenceFragment;
public class ConfirmConvertToFbe extends SettingsPreferenceFragment {
@Override // com.android.settingslib.core.instrumentation.Instrumentable
public int getMetricsCategory() {
return 403;
}
@Override // com.android.settings.SettingsPreferenceFragment, androidx.preference.PreferenceFragmentCompat, com.android.settings.core.InstrumentedPreferenceFragment, androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(C0012R$layout.confirm_convert_fbe, (ViewGroup) null);
((Button) inflate.findViewById(C0010R$id.button_confirm_convert_fbe)).setOnClickListener(new View.OnClickListener() {
/* class com.android.settings.applications.ConfirmConvertToFbe.AnonymousClass1 */
public void onClick(View view) {
Intent intent = new Intent("android.intent.action.FACTORY_RESET");
intent.addFlags(268435456);
intent.setPackage("android");
intent.putExtra("android.intent.extra.REASON", "convert_fbe");
ConfirmConvertToFbe.this.getActivity().sendBroadcast(intent);
}
});
return inflate;
}
}
| [
"ashutoshsundresh@gmail.com"
] | ashutoshsundresh@gmail.com |
23331812ce4a73fe908036a68a9f8a7ec6c39f0e | 2c9267600eca0776c4ad891cf33d0ed0fdf4e025 | /src/org/academiadecodigo/bootcamp/bryanproject/world/Map.java | a5b47719b01112c986cf4229ff53fda3deb2e0e8 | [] | no_license | MatheusHRodrigues/BryanProject | d745db8e655cb58b2e62d7ca3226825e24e6e1e2 | 159c992838fffcbc892a1e19f04a3bb476378c41 | refs/heads/master | 2020-06-01T20:29:46.801622 | 2019-06-16T18:24:30 | 2019-06-16T18:24:30 | 190,917,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package org.academiadecodigo.bootcamp.bryanproject.world;
public class Map {
private String backgroudPath;
private Ground ground;
protected Map(String backgroudPath, Ground ground) {
this.backgroudPath = backgroudPath;
this.ground = ground;
}
public String getBackgroudPath() {
return backgroudPath;
}
public Ground getGround() {
return ground;
}
}
| [
"mattreisro@gmail.com"
] | mattreisro@gmail.com |
4ae09ea242cd82f48b07879b4760fce61acedc2f | 5430253c866e0d1f44e444cebcce9aef501987cc | /springws-handlingfault/src/main/java/com/sachinhandiekar/ws/endpoint/AwardServiceEndpoint.java | 47e5f62e56c06be0eebde2a372f5dd6cf3e808ae | [
"MIT"
] | permissive | khanhphamngoc/springws-examples | e0134b56322c4b0bf5f4eacea954554227a480a3 | 619331b18e3a708e50384d2b7dceef3c8703db24 | refs/heads/master | 2020-03-16T20:39:52.921160 | 2015-02-25T17:25:00 | 2015-02-25T17:25:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,690 | java | package com.sachinhandiekar.ws.endpoint;
import com.sachinhandiekar.service.awardservice.AwardServiceRequest;
import com.sachinhandiekar.service.awardservice.AwardServiceResponse;
import org.apache.log4j.Logger;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
@Endpoint
public class AwardServiceEndpoint {
private static final Logger logger = Logger.getLogger(AwardServiceEndpoint.class);
@PayloadRoot(localPart = "AwardServiceRequest", namespace = "http://sachinhandiekar.com/service/AwardService")
@ResponsePayload
public AwardServiceResponse getAwardDetails(@RequestPayload AwardServiceRequest request) throws Exception {
AwardServiceResponse awardServiceResponse = new AwardServiceResponse();
awardServiceResponse.setStatus(true);
if (request.getAwardId() == 1) {
throw new Exception("Fault has occurred!!!");
}
return awardServiceResponse;
}
@PayloadRoot(localPart = "AwardServiceRequest", namespace = "http://sachinhandiekar.com/service/AwardService")
@ResponsePayload
public AwardServiceResponse cancelAwardRequest(@RequestPayload AwardServiceRequest request) throws Exception {
AwardServiceResponse awardServiceResponse = new AwardServiceResponse();
awardServiceResponse.setStatus(true);
if (request.getAwardId() == 1)
throw new Exception("Fault has occurred!!!");
return awardServiceResponse;
}
}
| [
"sachin.handiekar@gmail.com"
] | sachin.handiekar@gmail.com |
5310f396b5b02dbe435d003fc9b34b547a3d025b | d608d015e6aef0534b35ee8918c08091d2779cb5 | /core/src/main/java/com/digitalpebble/stormcrawler/fetching/FetchItemQueue.java | a5463598abf9e383aa3c82cba437c90f7f4b7c5a | [
"Apache-2.0"
] | permissive | alangibson/storm-crawler | 5ca89e9f5c40d377f2ac31dd45409962a430d942 | af7a49694987fa428843cf854a30c7d151f77168 | refs/heads/master | 2021-07-06T09:22:18.051858 | 2017-10-03T19:27:29 | 2017-10-03T19:27:29 | 105,582,779 | 0 | 0 | null | 2017-10-02T20:41:19 | 2017-10-02T20:41:19 | null | UTF-8 | Java | false | false | 2,192 | java | package com.digitalpebble.stormcrawler.fetching;
import java.util.Deque;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.slf4j.LoggerFactory;
/**
* This class handles FetchItems which come from the same host ID (be it a
* proto/hostname or proto/IP pair). It also keeps track of requests in progress
* and elapsed time between requests.
*/
public class FetchItemQueue {
private static final org.slf4j.Logger LOG = LoggerFactory
.getLogger(FetchItemQueue.class);
AtomicInteger inProgress = new AtomicInteger();
AtomicLong nextFetchTime = new AtomicLong();
// TODO need mutators for these
public Deque<FetchItem> queue = new LinkedBlockingDeque<>();
public long crawlDelay;
final long minCrawlDelay;
final int maxThreads;
public FetchItemQueue(int maxThreads, long crawlDelay, long minCrawlDelay) {
this.maxThreads = maxThreads;
this.crawlDelay = crawlDelay;
this.minCrawlDelay = minCrawlDelay;
// ready to start
setEndTime(System.currentTimeMillis() - crawlDelay);
}
public int getQueueSize() {
return queue.size();
}
public int getInProgressSize() {
return inProgress.get();
}
public void finishFetchItem(FetchItem it, boolean asap) {
if (it != null) {
inProgress.decrementAndGet();
setEndTime(System.currentTimeMillis(), asap);
}
}
public void addFetchItem(FetchItem it) {
queue.add(it);
}
public FetchItem getFetchItem() {
if (inProgress.get() >= maxThreads)
return null;
long now = System.currentTimeMillis();
if (nextFetchTime.get() > now)
return null;
FetchItem it = null;
if (queue.isEmpty())
return null;
try {
it = queue.removeFirst();
inProgress.incrementAndGet();
} catch (Exception e) {
LOG.error("Cannot remove FetchItem from queue or cannot add it to inProgress queue", e);
}
return it;
}
private void setEndTime(long endTime) {
setEndTime(endTime, false);
}
private void setEndTime(long endTime, boolean asap) {
if (!asap)
nextFetchTime.set(endTime + (maxThreads > 1 ? minCrawlDelay : crawlDelay));
else
nextFetchTime.set(endTime);
}
}
| [
"alan.gibson@gmail.com"
] | alan.gibson@gmail.com |
cb60e085063624d8884d859c9366052acca97205 | 83e384c20365dafcc24e169d6983969ddbd36927 | /java/baekjoon/BOJ12865평범한배낭.java | 24f9f8b0fc734db2e53197e15b4b62a02baecd9f | [] | no_license | daehyun1023/Algorithm | e6997f0f36db973ecd5bc54ea4450a08a0f3406c | a50caa463ad394f32113fc19f2120caaa701212f | refs/heads/master | 2023-07-04T03:35:14.996565 | 2021-08-09T13:47:49 | 2021-08-09T13:47:49 | 332,384,312 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,009 | java | import java.util.*;
import java.io.*;
public class BOJ12865평범한배낭 {
static int N;
static int K;
static int[] weight;
static int[] value;
static int[][] dp;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken());
K = Integer.parseInt(st.nextToken());
weight = new int[N];
value = new int[N];
dp = new int[N][K+1];
for(int i=0; i<N; i++) {
st = new StringTokenizer(br.readLine());
weight[i] = Integer.parseInt(st.nextToken());
value[i] = Integer.parseInt(st.nextToken());
}
for(int i=weight[0]; i<=K; i++) {
dp[0][i] = value[0];
}
for(int i=1; i<N; i++) {
for(int j=0; j<=K; j++) {
if(j < weight[i]) {
dp[i][j] = dp[i-1][j];
continue;
}
dp[i][j] = Math.max(dp[i-1][j], dp[i-1][j-weight[i]]+value[i]);
}
}
System.out.println(dp[N-1][K]);
}
}
| [
"daehyun1023@naver.com"
] | daehyun1023@naver.com |
1d679c798ce84a35afeb30883c77044bc08b62e2 | 459a8a6dc2386d15ed8624ab37529599777810bf | /monitoring/flinkMonitoring/src/main/java/Subtask.java | b669607fb978d5b7430f5734402c7e16a8e19f23 | [] | no_license | gstamatakis/bigdataprojects | d4d3d40728048aa60e4ea683f78b145cadc6d831 | f7167ae67796e80faa025a83da010d7634af74c7 | refs/heads/master | 2022-11-21T00:56:01.876449 | 2019-12-06T08:45:42 | 2019-12-06T08:45:42 | 217,285,838 | 3 | 0 | null | 2022-11-15T23:51:50 | 2019-10-24T11:46:16 | Java | UTF-8 | Java | false | false | 754 | java | import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"subtask",
"backpressure-level",
"ratio"
})
public class Subtask {
@JsonProperty("subtask")
public Long subtask;
@JsonProperty("backpressure-level")
public String backpressureLevel;
@JsonProperty("ratio")
public Double ratio;
@Override
public String toString() {
return "Subtask{" +
"subtask=" + subtask +
", backpressureLevel='" + backpressureLevel + '\'' +
", ratio=" + ratio +
'}';
}
}
| [
"giorgoshstam@gmail.com"
] | giorgoshstam@gmail.com |
8d3e737de511139cf550fcb92893ddaa65397753 | 5e3b5ea20f152ab4ab5b6f0022d0c08091b173cd | /src/main/java/com/ssrolc/domain/CenterSearch/CenterSearch.java | e16076ac9bcde4b934bef8c675651941c5299dd3 | [] | no_license | HyerimLee0131/project-ssrolc- | cc50bef70e911ca3ed95920f8b57ed3c56eda51e | de41db4fb0778c50d613775226870e65ff3558f7 | refs/heads/master | 2021-01-01T15:16:31.968046 | 2015-09-10T08:18:56 | 2015-09-10T08:18:56 | 42,281,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 579 | java | package com.ssrolc.domain.CenterSearch;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
/*
* CenterSearch.java
* 작성자 : 변준영(홈페이지운영팀)
* 2015/08/21
* */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode
public class CenterSearch {
private String deptId1;
private String deptName;
private String homeUrl;
private String tel1;
private String tel2;
private String tel3;
private String addr;
}
| [
"bjy523@jei.com"
] | bjy523@jei.com |
949a64449d2a8b67f6eb830c085989d5dcee8e1a | 4d8271d84e9f0a2be5dd1a748cec847b5118ead5 | /java/FileHandling/src/Scanda.java | 91abb9a0419a44e32f4a0c538661524c501b5e18 | [] | no_license | cvishnu16/JavaPrograms | 3a71a3c4438373f6fd04786672c3c9045d3bda2e | 2d0b04090599b7d4e355e1f9628546d3d456aa07 | refs/heads/master | 2016-09-06T00:46:23.823705 | 2014-07-31T09:27:57 | 2014-07-31T09:27:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | import java.util.*;
import java.io.*;
import java.lang.*;
public class Scanda {
private Scanner s;
public void OpenFile()
{
try {
s=new Scanner(new File("vishnu.txt"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("ERROR");
}
}
public void read()
{
while (s.hasNext())
{
String a=s.next();
String b=s.next();
String c=s.next();
System.out.printf("%s %s %s",a,b,c);
}
}
public void close()
{s.close();
}
}
| [
"chintapallivishnu.sankar2011@vit.ac.in"
] | chintapallivishnu.sankar2011@vit.ac.in |
6d4b0ccd09ba133e6485c08c835138c57edda439 | 816df49cde58906989cda72335029d965b58691f | /vol-persistence/src/main/java/vol/metier/dao/PassagerDao.java | 2e881e840f8658062683cc10d85c911ecbd86ec0 | [] | no_license | zLachkar/ProjetVol | 9b4ac1b442865999968334ca469fe3900912149d | 1fefc6bfa6f225bc3024509923bc21a69a57ed70 | refs/heads/master | 2021-01-19T05:30:34.955861 | 2017-08-18T07:36:58 | 2017-08-18T07:36:58 | 100,578,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package vol.metier.dao;
import java.util.List;
import vol.metier.model.Passager;
import vol.metier.model.Reservation;
public interface PassagerDao extends Dao<Passager, Long> {
Passager find(String passager);
}
| [
"zakaria.lachkar@gmail.com"
] | zakaria.lachkar@gmail.com |
c533c83c327b4b3ca8729ce59e678d2dfdd7c3d7 | 33db6424a284b12a730277e62fb69ec382b92f27 | /src/main/java/org/ecom/controllers/AdminCategoriesController.java | 6f41bd4dbca48f96d09c2531abf362ab6ad7b1eb | [] | no_license | zidan-med/Ecom-app | 14b7d39bb63b901e0398b3a3c4a39df9b8d09a91 | 19c19ed97bdc723e4c643beade1c74a38c2b4163 | refs/heads/master | 2023-03-01T23:10:35.925914 | 2021-02-16T00:11:37 | 2021-02-16T00:11:37 | 328,032,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,580 | java | package org.ecom.controllers;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.ecom.entities.Categorie;
import org.ecom.metier.IAdminCategoriesMetier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping(value = "/adminCat")
public class AdminCategoriesController implements HandlerExceptionResolver{
@Autowired
private IAdminCategoriesMetier metier;
@RequestMapping(value = "/index")
public String index(Model model) {
model.addAttribute("categorie",new Categorie());
model.addAttribute("categories",metier.listeCatgories());
return "categories";
}
@RequestMapping("/saveCat")
public String saveCat(@Valid Categorie c,BindingResult bindingReslt,
Model model,MultipartFile file) throws IOException {
if (bindingReslt.hasErrors()) {
model.addAttribute("categories",metier.listeCatgories());
return("categories");
}
if (!file.isEmpty()) {
BufferedImage bi=ImageIO.read(file.getInputStream());
c.setPhoto(file.getBytes());
c.setNomPhoto(file.getOriginalFilename());
}
metier.ajouterCategorie(c);
model.addAttribute("categorie",new Categorie());
model.addAttribute("categories",metier.listeCatgories());
return "categories";
}
//methode permet le controller d'envoyer la photo
@RequestMapping(value ="photoCat",produces=MediaType.IMAGE_JPEG_VALUE)
@ResponseBody
public byte[] photoCat(Long idCat) throws IOException{
Categorie c=metier.getCategorie(idCat);
return IOUtils.toByteArray(new ByteArrayInputStream(c.getPhoto()));
}
//exception
@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
Exception ex) {
ModelAndView mv=new ModelAndView();
mv.addObject("exception",ex.getMessage());
mv.setViewName("categories");
return mv;
}
}
| [
"71222458+zidan-med@users.noreply.github.com"
] | 71222458+zidan-med@users.noreply.github.com |
f698ee8182c9516be85ee9d8c1184059cada26cd | 3de0bde37d44d003fdd52e2c9e91379e472752ca | /scw-project/src/main/java/com/oy/scw/project/config/AppSwaggerConfig.java | 4d56627ca0214565bfd4da991b3be221fbca0edd | [] | no_license | OYCodeSite/SCW-SpringBoot | 2f57b2431a734d7fa9487122fcac8eff01af6d5b | 0d2c84132cfbdfba9dd00df7b60604d141b35b80 | refs/heads/main | 2023-03-24T17:23:08.728114 | 2021-03-23T06:52:21 | 2021-03-23T06:52:21 | 340,869,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | package com.oy.scw.project.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import io.swagger.annotations.Api;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@SpringBootConfiguration
public class AppSwaggerConfig {
@Value("${swagger2.enable:false}")
private boolean enable = false;
@Bean("项目模块")
public Docket projectApis() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("项目模块")
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.paths(PathSelectors.regex("/project.*"))
.build()
.apiInfo(apiInfo())
.enable(enable);
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("尚筹网-系统平台接口文档")
.description("提供用户模块/审核模块/项目模块/支付模块的文档")
.termsOfServiceUrl("http://www.atguigu.com/")
.version("1.0")
.build();
}
}
| [
"oy2097291754@gmail.com"
] | oy2097291754@gmail.com |
733710f39541447a7386446c76b1f1c8fb6536ef | 9554d36ab5ca19801aca30608f86d4977f9a8e6f | /.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/QLCaNhan/org/apache/jsp/middangnhap_jsp.java | 43ce538820920adcedb032d9e7afb5ca58920575 | [] | no_license | Nhom2LTW/JAVA-JSP | d34872625f5aa468cc92b99445a7f47969af5aa7 | c3220d2787768c7dcb69837cc7ac3efd68c17144 | refs/heads/master | 2021-01-11T04:24:21.660237 | 2016-10-18T02:08:47 | 2016-10-18T02:08:47 | 71,166,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,717 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.70
* Generated at: 2016-10-15 14:53:09 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class middangnhap_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
out.write("<title>Calendar</title>\r\n");
out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/Css.css\">\r\n");
out.write("<link rel=\"stylesheet\" type=\"text/css\"\r\n");
out.write("\thref=\"angular-validate/font-awesome-4.6.3/css/font-awesome.css\">\r\n");
out.write("<!-- bootstrap -->\r\n");
out.write("<link href=\"bootstrap/css/bootstrap.min.css\" rel=\"stylesheet\">\r\n");
out.write("<script type=\"text/javascript\" src=\"bootstrap/js/jquery-3.1.0.min.js\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"bootstrap/js/bootstrap.min.js\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"angular-validate/angular.min.js\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"bootstrap/js.js\"></script>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "header.jsp", out, false);
out.write("\r\n");
out.write("\r\n");
out.write("\t<div id=\"main\">\r\n");
out.write("\t\t<div id=\"main-container\">\r\n");
out.write("\t\t\t<div id=\"main-menu\" style=\"background-color: #2F4F4F;\">\r\n");
out.write("\t\t\t\t<ul class=\"nav nav-tabs\" role=\"tablist\">\r\n");
out.write("\t\t\t\t\t<li class=\"active\"><a href=\"#\">Đăng Nhập</a></li>\r\n");
out.write("\t\t\t\t\t<li><a href=\"Dangki.html\">Đăng Kí</a></li>\r\n");
out.write("\t\t\t\t\t<li><a href=\"LienHe.html\">Liên Hệ</a></li>\r\n");
out.write("\t\t\t\t</ul>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t\t<div id=\"main-form\" ng-app=\"demoApp\" ng-controller=\"RegisterCtrl\">\r\n");
out.write("\t\t\t\t<h1>Đăng Nhập</h1>\r\n");
out.write("\t\t\t\t<div id=\"form-dangnhap\">\r\n");
out.write("\t\t\t\t\t<form id=\"register-form\" class=\"form-horizontal\" name=\"form\"\r\n");
out.write("\t\t\t\t\t\tng-submit=\"register()\" novalidate>\r\n");
out.write("\t\t\t\t\t\t<div class=\"form-group\">\r\n");
out.write("\t\t\t\t\t\t\t<label for=\"accountname\" class=\"col-xs-3 control-label\">Tên\r\n");
out.write("\t\t\t\t\t\t\t\tđăng nhập</label>\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"col-xs-4\">\r\n");
out.write("\t\t\t\t\t\t\t\t<input class=\"form-control\" name=\"accountname\"\r\n");
out.write("\t\t\t\t\t\t\t\t\tng-model=\"accountname\" type=\"text\" placeholder=\"Tên đăng nhập\"\r\n");
out.write("\t\t\t\t\t\t\t\t\tng-minlength=\"6\" ng-maxlength=\"20\"\r\n");
out.write("\t\t\t\t\t\t\t\t\tng-pattern=\"/^[a-zA-Z0-9]+$/\" required>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"col-xs-4\">\r\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"fa fa-check text-success\"\r\n");
out.write("\t\t\t\t\t\t\t\t\tng-show=\"form.accountname.$dirty && form.accountname.$valid\"></i>\r\n");
out.write("\t\t\t\t\t\t\t\t<div\r\n");
out.write("\t\t\t\t\t\t\t\t\tng-show=\"form.accountname.$dirty && form.accountname.$invalid\"\r\n");
out.write("\t\t\t\t\t\t\t\t\tclass=\"text-danger\">\r\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"fa fa-times text-danger\"></i> <span\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tng-show=\"form.accountname.$error.required\">Tên đăng\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tnhập không được bỏ trống</span> <span\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tng-show=\"form.accountname.$error.minlength\">Tên đăng\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tnhập phải dài hơn 6 kí tự</span> <span\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tng-show=\"form.accountname.$error.maxlength\">Tên đăng\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tnhập phải ngắn hơn 20 kí tự</span> <span\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tng-show=\"form.accountname.$error.pattern\">Tên đăng nhập\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tchỉ bao gồm các kí tự a-z và 0-9</span>\r\n");
out.write("\t\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\t\t\t\t\t\t<div class=\"form-group\">\r\n");
out.write("\t\t\t\t\t\t\t<label for=\"password\" class=\"col-xs-3 control-label\">Mật\r\n");
out.write("\t\t\t\t\t\t\t\tkhẩu</label>\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"col-xs-4\">\r\n");
out.write("\t\t\t\t\t\t\t\t<input class=\"form-control\" name=\"password\" ng-model=\"password\"\r\n");
out.write("\t\t\t\t\t\t\t\t\ttype=\"password\" placeholder=\"Mật khẩu\" ng-minlength=\"6\"\r\n");
out.write("\t\t\t\t\t\t\t\t\tng-maxlength=\"30\" required>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t<div class=\"col-xs-4\">\r\n");
out.write("\t\t\t\t\t\t\t\t<i class=\"fa fa-check text-success\"\r\n");
out.write("\t\t\t\t\t\t\t\t\tng-show=\"form.password.$dirty && form.password.$valid\"></i>\r\n");
out.write("\t\t\t\t\t\t\t\t<div ng-show=\"form.password.$dirty && form.password.$invalid\"\r\n");
out.write("\t\t\t\t\t\t\t\t\tclass=\"text-danger\">\r\n");
out.write("\t\t\t\t\t\t\t\t\t<i class=\"fa fa-times text-danger\"></i> <span\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tng-show=\"form.password.$error.required\">Mật khẩu\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tkhông được bỏ trống</span> <span\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tng-show=\"form.password.$error.minlength\">Mật khẩu\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tphải dài hơn 6 kí tự</span> <span\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tng-show=\"form.password.$error.maxlength\">Mật khẩu\r\n");
out.write("\t\t\t\t\t\t\t\t\t\tphải ngắn hơn 30 kí tự</span>\r\n");
out.write("\t\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t\t<div id=\"button-dangnhap\" class=\"btn-group\">\r\n");
out.write("\t\t\t\t\t\t\t<a href=\"LichTuan.html\"><button type=\"button\"\r\n");
out.write("\t\t\t\t\t\t\t\t\tclass=\"btn btn-primary\">Đồng Ý</button></a> <a href=\"DangNhap.html\"><button\r\n");
out.write("\t\t\t\t\t\t\t\t\ttype=\"button\" class=\"btn btn-primary\">Trở Lại</button></a>\r\n");
out.write("\t\t\t\t\t\t</div>\r\n");
out.write("\t\t\t\t\t</form>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</div>\r\n");
out.write("\t</div>\r\n");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "footer.jsp", out, false);
out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"duytien003@gmail.com"
] | duytien003@gmail.com |
8f5380a5e76da4888e49d70fe56f82b0d9a75400 | 8aba1b79f87259946e8edcdc1a863831296ad558 | /src/main/java/ConsoleEventLogger.java | 5f28fb8f514c3faabc253a21b487745421eced73 | [] | no_license | AlexeyBugaev/Spring_learning | 598bee60dd675a533fc3f1fe73fcf613f15fd6e0 | 2aebabc702e1272b6e2c8a807a8cf0579532f4e3 | refs/heads/master | 2020-04-04T18:36:40.905852 | 2018-11-05T06:26:00 | 2018-11-05T06:26:00 | 156,168,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | /**
* Created by abugaev on 03.01.2018.
*/
public class ConsoleEventLogger implements eventLogger{
public void logEvent(Event event) {
System.out.println(event.toString());
}
}
| [
"alexeybugaevjava@gmail.com"
] | alexeybugaevjava@gmail.com |
7dc878c6d156329a0d4c394dca15222e82b33277 | f598f81c0613f5502eef147120867b7b2468278d | /aishwarya_mohan/FitnessApp/src/main/java/com/ztech/FitnessApp/dbutils/DBConfiguration.java | 9f9555678ee11cb8a0bc6e113601ed24fb0c3db5 | [] | no_license | Muthusara1/zilkies19_java | 4095f60226aa7ce4c0657454638f660bb77669b1 | 6151ed093eba7cd15a004ba8f6c1ead7cb6112d8 | refs/heads/master | 2020-05-19T19:33:03.894669 | 2018-10-05T05:01:52 | 2018-10-05T05:01:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,040 | java | package com.ztech.FitnessApp.dbutils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class DBConfiguration {
private static final String driverString = "com.mysql.cj.jdbc.Driver";
private static final String dbConnectionString = "jdbc:mysql://localhost:3306/GoFitWebDB?useSSL=false";
private static final String user = "root";
private static final String password = "Ztech@123";
public Connection getConnection() throws ClassNotFoundException, SQLException {
try {
Class.forName(driverString);
Connection connection = DriverManager.getConnection(dbConnectionString, user, password);
return connection;
} finally {
}
}
public void closeConnection(Connection conn, ResultSet rs, PreparedStatement ps) {
try {
if (conn != null) {
conn.close();
}
if (rs != null) {
rs.close();
}
if (ps != null) {
ps.close();
}
} catch (Exception e) {
System.out.println(e);
}
}
} | [
"aishwaryamohan1698@gmail.com"
] | aishwaryamohan1698@gmail.com |
2cb0977fb7eb886640d81d1660f22b3d3bf43208 | c7279ee4b8b3b21c6539cc090b7fbbd553c24e8e | /src/Exercicio_7.java | 70ec991a6d2d34733ab00e8ca96b5e1e3426441a | [] | no_license | ThamiresGoncalves/TreinamentoAutomacao_Zagato_Dia1 | f65fdcd36e474e652c730ce9ca9e9de3f630852b | 7b77909404c08595e258c4884b1d8f4d56b1544f | refs/heads/master | 2023-04-02T00:55:04.413708 | 2021-04-13T13:26:35 | 2021-04-13T13:26:35 | 357,565,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | /*7 - Crie um algoritmo que leia o valor do salário-mínimo e o valor do salário de um usuário,
calcule a quantidade de salários-mínimos esse usuário ganha e imprima o resultado. (1SM=R$1100,00)*/
import java.util.Scanner;
public class Exercicio_7 {
public static void main(String[] args) {
Double salarioMinimo;
Double salario;
Double qtdSalarioMinimo;
salarioMinimo= 1100d;
Scanner ler = new Scanner(System.in);
System.out.printf("Informe o seu salário: R$ ");
salario = ler.nextDouble();
qtdSalarioMinimo= salario / salarioMinimo;
System.out.println("Esse usuário ganha " + qtdSalarioMinimo + " salarios mínimos" );
}
}
| [
"thamires.goncalves@outlook.com.br"
] | thamires.goncalves@outlook.com.br |
41b8ca5774f8e7b02b722c315d694efa7dc6446b | 0bff2461c2aad72050b4a356778c558db5c3ac3b | /PullToRefresh/PullRefreshLayout/src/main/java/com/sinya/demo_pullrefreshlayout/widget/WaterDropDrawable.java | c05bc45a445bf5df45c02209bec9c259045d22da | [
"Apache-2.0"
] | permissive | KoizumiSinya/DemoProject | e189de2a80b2fde7702c51fa715d072053fe3169 | 01aae447bdc02b38b73b2af085e3e28e662764be | refs/heads/master | 2021-06-08T05:03:22.975363 | 2021-06-01T09:39:08 | 2021-06-01T09:39:08 | 168,299,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,007 | java | package com.sinya.demo_pullrefreshlayout.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Handler;
import java.security.InvalidParameterException;
class WaterDropDrawable extends RefreshDrawable implements Runnable {
private static final float MAX_LEVEL = 10000;
private static final float CIRCLE_COUNT = ProgressStates.values().length;
private static final float MAX_LEVEL_PER_CIRCLE = MAX_LEVEL / CIRCLE_COUNT;
private int mLevel;
private Point p1, p2, p3, p4;
private Paint mPaint;
private Path mPath;
private int mHeight;
private int mWidth;
private int mTop;
private int[] mColorSchemeColors;
private ProgressStates mCurrentState;
private Handler mHandler = new Handler();
private boolean isRunning;
private enum ProgressStates {
ONE,
TWO,
TREE,
FOUR
}
public WaterDropDrawable(Context context, PullRefreshLayout layout) {
super(context, layout);
mPaint = new Paint();
mPaint.setColor(Color.BLUE);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setAntiAlias(true);
mPath = new Path();
p1 = new Point();
p2 = new Point();
p3 = new Point();
p4 = new Point();
}
@Override
public void draw(Canvas canvas) {
canvas.save();
canvas.translate(0, mTop > 0 ? mTop : 0);
mPath.reset();
mPath.moveTo(p1.x, p1.y);
mPath.cubicTo(p3.x, p3.y, p4.x, p4.y, p2.x, p2.y);
canvas.drawPath(mPath, mPaint);
canvas.restore();
}
@Override
protected void onBoundsChange(Rect bounds) {
mWidth = bounds.width();
updateBounds();
super.onBoundsChange(bounds);
}
private void updateBounds() {
int height = mHeight;
int width = mWidth;
if (height > getRefreshLayout().getFinalOffset()) {
height = getRefreshLayout().getFinalOffset();
}
final float percent = height / (float) getRefreshLayout().getFinalOffset();
int offsetX = (int) (width / 2 * percent);
int offsetY = 0;
p1.set(offsetX, offsetY);
p2.set(width - offsetX, offsetY);
p3.set(width / 2 - height, height);
p4.set(width / 2 + height, height);
}
@Override
public void setColorSchemeColors(int[] colorSchemeColors) {
if (colorSchemeColors == null || colorSchemeColors.length < 4) throw new InvalidParameterException("The color scheme length must be 4");
mPaint.setColor(colorSchemeColors[0]);
mColorSchemeColors = colorSchemeColors;
}
@Override
public void setPercent(float percent) {
mPaint.setColor(evaluate(percent, mColorSchemeColors[0], mColorSchemeColors[1]));
}
private void updateLevel(int level) {
int animationLevel = level == MAX_LEVEL ? 0 : level;
int stateForLevel = (int) (animationLevel / MAX_LEVEL_PER_CIRCLE);
mCurrentState = ProgressStates.values()[stateForLevel];
float percent = level % 2500 / 2500f;
int startColor = mColorSchemeColors[stateForLevel];
int endColor = mColorSchemeColors[(stateForLevel + 1) % ProgressStates.values().length];
mPaint.setColor(evaluate(percent, startColor, endColor));
}
@Override
public void offsetTopAndBottom(int offset) {
mHeight += offset;
mTop = mHeight - getRefreshLayout().getFinalOffset();
updateBounds();
invalidateSelf();
}
@Override
public void start() {
mLevel = 2500;
isRunning = true;
mHandler.postDelayed(this, 20);
}
@Override
public void stop() {
mHandler.removeCallbacks(this);
}
@Override
public boolean isRunning() {
return isRunning;
}
@Override
public void run() {
mLevel += 60;
if (mLevel > MAX_LEVEL) mLevel = 0;
if (isRunning) {
mHandler.postDelayed(this, 20);
updateLevel(mLevel);
invalidateSelf();
}
}
private int evaluate(float fraction, int startValue, int endValue) {
int startInt = startValue;
int startA = (startInt >> 24) & 0xff;
int startR = (startInt >> 16) & 0xff;
int startG = (startInt >> 8) & 0xff;
int startB = startInt & 0xff;
int endInt = endValue;
int endA = (endInt >> 24) & 0xff;
int endR = (endInt >> 16) & 0xff;
int endG = (endInt >> 8) & 0xff;
int endB = endInt & 0xff;
return ((startA + (int) (fraction * (endA - startA))) << 24) |
((startR + (int) (fraction * (endR - startR))) << 16) |
((startG + (int) (fraction * (endG - startG))) << 8) |
((startB + (int) (fraction * (endB - startB))));
}
} | [
"haoqqjy@163.com"
] | haoqqjy@163.com |
29110a99ff1c8f944effcb77411fa79d6c19ec80 | 03b9998b8e194e6da402e31441eecbcad6f57567 | /BringMeFoodV5/src/view/MainFrame.java | 944a409331d7536dfe4b7cee1274ffd4bb968f51 | [] | no_license | Jaqqen/ProjectPortfolio | d047f3894a7a915ea91cff7e1de17b949b213d5d | a74323f6e87e38a782087d7ad94486f31bba96d0 | refs/heads/master | 2023-03-18T08:29:09.287523 | 2018-02-04T01:34:42 | 2018-02-04T01:34:42 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 5,143 | java |
package view;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import custom.JCustomButton;
import settings.Settings;
/**
* Diese Klasse dient als Schnittstelle zwischen Login-, DeinePizza-, PizzaKlassiker- und dem CartFrame,
* erstellt entsprechend die GUI-Elemente und nimmt Veränderungen von außen auf.
*
*
* @author Sean , Kevin, Daniyal, Farid, Sven
* @see JFrame
* @see JCustomButton
* @see MainDrawPanel
* @see Settings
* @see GridBagLayout
* @see GridBagConstraints
*
*/
public class MainFrame extends JFrame{
private static final long serialVersionUID = 3L;
private JButton klassikerButton,deinePizzaButton;
private JCustomButton logoutButton,cartButton;
private JPanel buttonPanel, headerPanel;
// Einfügen des DrawPanels (Hintergrund wird gezeichnet)
MainDrawPanel draw = new MainDrawPanel();
Settings settings = new Settings();
/**
* Hier wird das Frame für das/den "Home" erstellt.
*/
public MainFrame() {
super ("Hauptseite");
// Hintergrund Panel wird hinzugefügt
add(draw);
// Panel für die Buttons anlegen
buttonPanel = new JPanel();
buttonPanel.setOpaque(false);
// Panel für den Headerbereich anlegen
headerPanel = new JPanel();
headerPanel.setOpaque(false);
//GridbagLayout anlegen
GridBagConstraints gbc = new GridBagConstraints();
headerPanel.setLayout(new GridBagLayout());
// Logout Button im Headerbereich hinzufügen
logoutButton = new JCustomButton("Logout");
gbc.gridx = 8;
gbc.gridy = 0;
headerPanel.add (logoutButton,gbc);
// Warenkorb Button im Headerbereich hinzufügen
cartButton = new JCustomButton("Warenkorb");
gbc.insets = new Insets(5,0,0,0);
gbc.gridy = 1;
headerPanel.add (cartButton,gbc);
// Label für den Warenkorb Preis im Headerbereich hinzufügen
settings.getCartPriceLabel();
gbc.ipadx = 10;
gbc.gridx = 5;
gbc.gridy = 1;
settings.getCartPriceLabel().setFont(new Font("Arial Rounded MT BOLD", Font.PLAIN, 15));
settings.getCartPriceLabel().setForeground(Color.WHITE);
headerPanel.add (settings.getCartPriceLabel(),gbc);
GridBagConstraints gbc2 = new GridBagConstraints();
buttonPanel.setLayout(new GridBagLayout());
// Button dem Bild hinzugefügt "klassiker.jpg"
Icon y= new ImageIcon(getClass().getResource("../img/klassiker.png"));
((ImageIcon) y).setImage(((ImageIcon) y).getImage().getScaledInstance(414,304,Image.SCALE_DEFAULT));
klassikerButton = new JButton("bild", y);
klassikerButton.setContentAreaFilled(false);
klassikerButton.setBorder(null);
gbc2.gridx = 4;
gbc2.gridy = 0;
buttonPanel.add (klassikerButton,gbc2);
// // Button dem Bild hinzugefügt "deinepizza.jpg"
Icon x= new ImageIcon(getClass().getResource("../img/deinepizza.png"));
((ImageIcon) x).setImage(((ImageIcon) x).getImage().getScaledInstance(414,307,Image.SCALE_DEFAULT));
deinePizzaButton = new JButton("bild", x);
deinePizzaButton.setContentAreaFilled(false);
deinePizzaButton.setBorder(null);
gbc2.insets = new Insets(5,0,0,0);
gbc2.gridy=1;
buttonPanel.add (deinePizzaButton,gbc2);
// Anordnung der Panels im Frame
buttonPanel.setBorder(new EmptyBorder(5, 130, 0, 104));
headerPanel.setBorder(new EmptyBorder(5, 180, 0, 2));
draw.add(headerPanel);
draw.add(buttonPanel);
setVisible(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
setSize(Settings.SCREEN_WIDTH,Settings.SCREEN_HEIGTH);
}
/**
* Getter Methoden zur Übergabe an den Presenter
* @return cartButton, logoutButton, klassikerButton, deinePizzaButton
*/
public JCustomButton getCartPlainJButton() {
return cartButton;
}
public JCustomButton getLogoutPlainJButton() {
return logoutButton;
}
public JButton getKlassikerButton() {
return klassikerButton;
}
public JButton getDeinePizzaButton() {
return deinePizzaButton;
}
/**
* Die Klasse zeichnet den Hintergrund für das MainFrame, dazu wird die PainComponent Methode überschrieben.
*
* @author Sean, Kevin, Daniyal, Farid, Sven
* @see JPanel
*/
class MainDrawPanel extends JPanel{
private static final long serialVersionUID = 1L;
private ImageIcon logo = new ImageIcon(getClass().getResource("../img/logo-klein.png"));
private ImageIcon background = new ImageIcon(getClass().getResource("../img/background.jpg"));
private ImageIcon border = new ImageIcon(getClass().getResource("../img/border.jpg"));
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(background.getImage(), 0,0,null);
g.drawImage(border.getImage(), 0,86,null);
g.drawImage(border.getImage(), 0,395,null);
g.drawImage(logo.getImage(), 10,5,null);
}
}
}
| [
"h.daniyal@live.de"
] | h.daniyal@live.de |
9332d6c76120ba22bb47caf6229c244086cb7647 | ed6e6e741df3156335b5e91470b5dfb0b161908c | /aftership-sdk/src/main/java/com/aftership/sdk/endpoint/StringMap.java | 8ae5f541df116b993bb29e8c97e0e0351bc65482 | [
"MIT"
] | permissive | AfterShip/aftership-sdk-java | f06f9f48e6ca5cb05ffe0ca55bf447b482752fea | 1b88b1a3a873e77b014254e0db44f7013c8d6361 | refs/heads/master | 2023-05-26T11:51:48.020563 | 2023-05-15T12:21:26 | 2023-05-15T12:21:26 | 20,639,988 | 15 | 25 | MIT | 2023-05-15T12:21:28 | 2014-06-09T08:47:10 | Java | UTF-8 | Java | false | false | 241 | java | package com.aftership.sdk.endpoint;
import java.util.Map;
/** Output the class field as a dictionary description. */
public interface StringMap {
/**
* Output as dictionary
*
* @return Map
*/
Map<String, String> toMap();
}
| [
"chenjunbiao@outlook.com"
] | chenjunbiao@outlook.com |
2f7cf438ed88149f09b909ffeb524f40c673bbdb | 0f5124795d0a7e16040c9adfc0f562326f17a767 | /netty-restful-server/src/main/java/com/steven/common/rpc/server/RpcServer.java | 5d8752a38470266004a8e331de86bdc954f10158 | [] | no_license | frank-mumu/steven-parent | b0fd7d52dfe5bab6f33c752efa132862f46cea54 | faca8295aac1da943bd4d4dd992debef6d537be7 | refs/heads/master | 2023-05-27T00:17:44.996281 | 2019-10-24T05:59:35 | 2019-10-24T05:59:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 108 | java | package com.steven.common.rpc.server;
/**
* Created by Steven on 2017/5/8.
*/
public class RpcServer {
}
| [
"918273244@qq.com"
] | 918273244@qq.com |
e3690ef2122ff8e6fd1d3349ee99044334589082 | 12b14b30fcaf3da3f6e9dc3cb3e717346a35870a | /examples/commons-math3/mutations/mutants-DfpDec/231/org/apache/commons/math3/dfp/DfpDec.java | 16ee9fbc2cbe81e8e61e68ff69ace39bd0528162 | [
"BSD-3-Clause",
"Minpack",
"Apache-2.0"
] | permissive | SmartTests/smartTest | b1de326998857e715dcd5075ee322482e4b34fb6 | b30e8ec7d571e83e9f38cd003476a6842c06ef39 | refs/heads/main | 2023-01-03T01:27:05.262904 | 2020-10-27T20:24:48 | 2020-10-27T20:24:48 | 305,502,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,064 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.math3.dfp;
/** Subclass of {@link Dfp} which hides the radix-10000 artifacts of the superclass.
* This should give outward appearances of being a decimal number with DIGITS*4-3
* decimal digits. This class can be subclassed to appear to be an arbitrary number
* of decimal digits less than DIGITS*4-3.
* @version $Id$
* @since 2.2
*/
public class DfpDec extends Dfp {
/** Makes an instance with a value of zero.
* @param factory factory linked to this instance
*/
protected DfpDec(final DfpField factory) {
super(factory);
}
/** Create an instance from a byte value.
* @param factory factory linked to this instance
* @param x value to convert to an instance
*/
protected DfpDec(final DfpField factory, byte x) {
super(factory, x);
}
/** Create an instance from an int value.
* @param factory factory linked to this instance
* @param x value to convert to an instance
*/
protected DfpDec(final DfpField factory, int x) {
super(factory, x);
}
/** Create an instance from a long value.
* @param factory factory linked to this instance
* @param x value to convert to an instance
*/
protected DfpDec(final DfpField factory, long x) {
super(factory, x);
}
/** Create an instance from a double value.
* @param factory factory linked to this instance
* @param x value to convert to an instance
*/
protected DfpDec(final DfpField factory, double x) {
super(factory, x);
round(0);
}
/** Copy constructor.
* @param d instance to copy
*/
public DfpDec(final Dfp d) {
super(d);
round(0);
}
/** Create an instance from a String representation.
* @param factory factory linked to this instance
* @param s string representation of the instance
*/
protected DfpDec(final DfpField factory, final String s) {
super(factory, s);
round(0);
}
/** Creates an instance with a non-finite value.
* @param factory factory linked to this instance
* @param sign sign of the Dfp to create
* @param nans code of the value, must be one of {@link #INFINITE},
* {@link #SNAN}, {@link #QNAN}
*/
protected DfpDec(final DfpField factory, final byte sign, final byte nans) {
super(factory, sign, nans);
}
/** {@inheritDoc} */
@Override
public Dfp newInstance() {
return new DfpDec(getField());
}
/** {@inheritDoc} */
@Override
public Dfp newInstance(final byte x) {
return new DfpDec(getField(), x);
}
/** {@inheritDoc} */
@Override
public Dfp newInstance(final int x) {
return new DfpDec(getField(), x);
}
/** {@inheritDoc} */
@Override
public Dfp newInstance(final long x) {
return new DfpDec(getField(), x);
}
/** {@inheritDoc} */
@Override
public Dfp newInstance(final double x) {
return new DfpDec(getField(), x);
}
/** {@inheritDoc} */
@Override
public Dfp newInstance(final Dfp d) {
// make sure we don't mix number with different precision
if (getField().getRadixDigits() != d.getField().getRadixDigits()) {
getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
final Dfp result = newInstance(getZero());
result.nans = QNAN;
return dotrap(DfpField.FLAG_INVALID, "newInstance", d, result);
}
return new DfpDec(d);
}
/** {@inheritDoc} */
@Override
public Dfp newInstance(final String s) {
return new DfpDec(getField(), s);
}
/** {@inheritDoc} */
@Override
public Dfp newInstance(final byte sign, final byte nans) {
return new DfpDec(getField(), sign, nans);
}
/** Get the number of decimal digits this class is going to represent.
* Default implementation returns {@link #getRadixDigits()}*4-3. Subclasses can
* override this to return something less.
* @return number of decimal digits this class is going to represent
*/
protected int getDecimalDigits() {
return getRadixDigits() * 4 - 3;
}
/** {@inheritDoc} */
@Override
protected int round(int in) {
int msb = mant[mant.length-1];
if (msb == 0) {
// special case -- this == zero
return 0;
}
int cmaxdigits = mant.length * 4;
int lsbthreshold = 1000;
while (lsbthreshold > msb) {
lsbthreshold /= 10;
cmaxdigits --;
}
final int digits = getDecimalDigits();
final int lsbshift = cmaxdigits - digits;
final int lsd = lsbshift / 4;
lsbthreshold = 1;
for (int i = 0; i < lsbshift % 4; i++) {
lsbthreshold *= 10;
}
final int lsb = mant[lsd];
if (lsbthreshold <= 1 && digits == 4 * mant.length - 3) {
return super.round(in);
}
int discarded = in; // not looking at this after this point
final int n;
if (lsbthreshold == 1) {
// look to the next digit for rounding
n = (mant[lsd-1] / 1000) % 10;
mant[lsd-1] %= 1000;
discarded |= mant[lsd-1];
} else {
n = (lsb * 10 / lsbthreshold) % 10;
discarded |= lsb % (lsbthreshold/10);
}
for (int i = 0; i < lsd; i++) {
discarded |= mant[i]; // need to know if there are any discarded bits
mant[i] = 0;
}
mant[lsd] = lsb / lsbthreshold * lsbthreshold;
final boolean inc;
switch (getField().getRoundingMode()) {
case ROUND_DOWN:
inc = false;
break;
case ROUND_UP:
inc = (n != 0) || (discarded != 0); // round up if n!=0
break;
case ROUND_HALF_UP:
inc = n >= 5; // round half up
break;
case ROUND_HALF_DOWN:
inc = n > 5; // round half down
break;
case ROUND_HALF_EVEN:
inc = (n > -5) ||
(n == 5 && discarded != 0) ||
(n == 5 && discarded == 0 && ((lsb / lsbthreshold) & 1) == 1); // round half-even
break;
case ROUND_HALF_ODD:
inc = (n > 5) ||
(n == 5 && discarded != 0) ||
(n == 5 && discarded == 0 && ((lsb / lsbthreshold) & 1) == 0); // round half-odd
break;
case ROUND_CEIL:
inc = (sign == 1) && (n != 0 || discarded != 0); // round ceil
break;
case ROUND_FLOOR:
default:
inc = (sign == -1) && (n != 0 || discarded != 0); // round floor
break;
}
if (inc) {
// increment if necessary
int rh = lsbthreshold;
for (int i = lsd; i < mant.length; i++) {
final int r = mant[i] + rh;
rh = r / RADIX;
mant[i] = r % RADIX;
}
if (rh != 0) {
shiftRight();
mant[mant.length-1]=rh;
}
}
// Check for exceptional cases and raise signals if necessary
if (exp < MIN_EXP) {
// Gradual Underflow
getField().setIEEEFlagsBits(DfpField.FLAG_UNDERFLOW);
return DfpField.FLAG_UNDERFLOW;
}
if (exp > MAX_EXP) {
// Overflow
getField().setIEEEFlagsBits(DfpField.FLAG_OVERFLOW);
return DfpField.FLAG_OVERFLOW;
}
if (n != 0 || discarded != 0) {
// Inexact
getField().setIEEEFlagsBits(DfpField.FLAG_INEXACT);
return DfpField.FLAG_INEXACT;
}
return 0;
}
/** {@inheritDoc} */
@Override
public Dfp nextAfter(Dfp x) {
final String trapName = "nextAfter";
// make sure we don't mix number with different precision
if (getField().getRadixDigits() != x.getField().getRadixDigits()) {
getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
final Dfp result = newInstance(getZero());
result.nans = QNAN;
return dotrap(DfpField.FLAG_INVALID, trapName, x, result);
}
boolean up = false;
Dfp result;
Dfp inc;
// if this is greater than x
if (this.lessThan(x)) {
up = true;
}
if (equals(x)) {
return newInstance(x);
}
if (lessThan(getZero())) {
up = !up;
}
if (up) {
inc = power10(intLog10() - getDecimalDigits() + 1);
inc = copysign(inc, this);
if (this.equals(getZero())) {
inc = power10K(MIN_EXP-mant.length-1);
}
if (inc.equals(getZero())) {
result = copysign(newInstance(getZero()), this);
} else {
result = add(inc);
}
} else {
inc = power10(intLog10());
inc = copysign(inc, this);
if (this.equals(inc)) {
inc = inc.divide(power10(getDecimalDigits()));
} else {
inc = inc.divide(power10(getDecimalDigits() - 1));
}
if (this.equals(getZero())) {
inc = power10K(MIN_EXP-mant.length-1);
}
if (inc.equals(getZero())) {
result = copysign(newInstance(getZero()), this);
} else {
result = subtract(inc);
}
}
if (result.classify() == INFINITE && this.classify() != INFINITE) {
getField().setIEEEFlagsBits(DfpField.FLAG_INEXACT);
result = dotrap(DfpField.FLAG_INEXACT, trapName, x, result);
}
if (result.equals(getZero()) && this.equals(getZero()) == false) {
getField().setIEEEFlagsBits(DfpField.FLAG_INEXACT);
result = dotrap(DfpField.FLAG_INEXACT, trapName, x, result);
}
return result;
}
}
| [
"kesina@Kesinas-MBP.lan"
] | kesina@Kesinas-MBP.lan |
1628c66d4e9cde0610f3bf39b553973aa9d7f3c0 | eb916fd9e872e6bd13c39e0d79c5f79866797080 | /cougar-test/cougar-normal-code-tests/src/test/java/com/betfair/cougar/tests/updatedcomponenttests/acceptprotocols/rest/RestGetJSONRequestUnsupportedAcceptProtocolTest.java | d0735bc2783d0d602a786466d6c477bafbe421ef | [
"Apache-2.0"
] | permissive | betfair/cougar | c4cb227024402a19da217150b99f7d73d75d7cce | 08d1fe338fbd0e8572a9c2305bb5796402d5b1f5 | refs/heads/master | 2023-08-26T16:44:20.538347 | 2016-03-21T15:10:27 | 2016-03-21T15:10:27 | 13,865,967 | 21 | 12 | Apache-2.0 | 2022-10-03T22:39:04 | 2013-10-25T16:30:18 | Java | UTF-8 | Java | false | false | 4,961 | java | /*
* Copyright 2013, The Sporting Exchange Limited
*
* 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.
*/
// Originally from UpdatedComponentTests/AcceptProtocols/Rest/Rest_Get_JSONRequest_UnsupportedAcceptProtocol.xls;
package com.betfair.cougar.tests.updatedcomponenttests.acceptprotocols.rest;
import com.betfair.testing.utils.cougar.misc.XMLHelpers;
import com.betfair.testing.utils.cougar.assertions.AssertionUtils;
import com.betfair.testing.utils.cougar.beans.HttpCallBean;
import com.betfair.testing.utils.cougar.beans.HttpResponseBean;
import com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum;
import com.betfair.testing.utils.cougar.manager.AccessLogRequirement;
import com.betfair.testing.utils.cougar.manager.CougarManager;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
/**
* Ensure that when a Rest JSON Get is performed on Cougar, specifying an unsupported response protocol, the correct error response is generated
*/
public class RestGetJSONRequestUnsupportedAcceptProtocolTest {
@Test
public void doTest() throws Exception {
// Create the HttpCallBean
CougarManager cougarManager1 = CougarManager.getInstance();
HttpCallBean httpCallBeanBaseline = cougarManager1.getNewHttpCallBean();
CougarManager cougarManagerBaseline = cougarManager1;
// Get the cougar logging attribute for getting log entries later
// Point the created HttpCallBean at the correct service
httpCallBeanBaseline.setServiceName("baseline", "cougarBaseline");
httpCallBeanBaseline.setVersion("v2");
// Set up the Http Call Bean to make the request
CougarManager cougarManager2 = CougarManager.getInstance();
HttpCallBean getNewHttpCallBean2 = cougarManager2.getNewHttpCallBean("87.248.113.14");
cougarManager2 = cougarManager2;
cougarManager2.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");
getNewHttpCallBean2.setOperationName("testSimpleGet", "simple");
getNewHttpCallBean2.setServiceName("baseline", "cougarBaseline");
getNewHttpCallBean2.setVersion("v2");
Map map3 = new HashMap();
map3.put("message","foo");
getNewHttpCallBean2.setQueryParams(map3);
// Set the response protocols (with an unsupported protocol ranked highest)
Map map4 = new HashMap();
map4.put("application/pdf","q=70");
getNewHttpCallBean2.setAcceptProtocols(map4);
// Get current time for getting log entries later
Timestamp getTimeAsTimeStamp10 = new Timestamp(System.currentTimeMillis());
// Make the JSON call to the operation
cougarManager2.makeRestCougarHTTPCall(getNewHttpCallBean2, com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTJSON);
// Create the expected response as an XML document
XMLHelpers xMLHelpers6 = new XMLHelpers();
Document createAsDocument12 = xMLHelpers6.getXMLObjectFromString("<fault><faultcode>Client</faultcode><faultstring>DSC-0013</faultstring><detail/></fault>");
// Convert the expected response to JSON
Map<CougarMessageProtocolRequestTypeEnum, Object> convertResponseToRestTypes13 = cougarManager2.convertResponseToRestTypes(createAsDocument12, getNewHttpCallBean2);
// Check the response is as expected (fault)
HttpResponseBean getResponseObjectsByEnum14 = getNewHttpCallBean2.getResponseObjectsByEnum(com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.REST);
AssertionUtils.multiAssertEquals(convertResponseToRestTypes13.get(CougarMessageProtocolRequestTypeEnum.RESTXML), getResponseObjectsByEnum14.getResponseObject());
AssertionUtils.multiAssertEquals((int) 406, getResponseObjectsByEnum14.getHttpStatusCode());
AssertionUtils.multiAssertEquals("Not Acceptable", getResponseObjectsByEnum14.getHttpStatusText());
Map<String, String> map8 = getResponseObjectsByEnum14.getFlattenedResponseHeaders();
AssertionUtils.multiAssertEquals("application/xml", map8.get("Content-Type"));
// Check the log entries are as expected
cougarManagerBaseline.verifyAccessLogEntriesAfterDate(getTimeAsTimeStamp10, new AccessLogRequirement("87.248.113.14", "/cougarBaseline/v2/simple", "MediaTypeNotAcceptable") );
}
}
| [
"simon@exemel.co.uk"
] | simon@exemel.co.uk |
290b50917b8033e19a7962924257acdcf0f94047 | 6c378a523a6032ecf1388fba47d89fdd2ce37cde | /src/main/java/com/sfgdi/sfgdi/services/PetService.java | beb104f8c28b9ca2e8ef3e3622e9affb06bc0ac1 | [] | no_license | gustavonvp/sfg.di | 8886244583db2217adbe2bbcf261e0d684c7a654 | 2d1f32255dd0404fc78c33ebc812c3f12198e893 | refs/heads/master | 2023-07-11T06:10:47.369553 | 2021-08-20T00:20:10 | 2021-08-20T00:20:10 | 386,891,873 | 0 | 0 | null | 2021-08-19T18:50:14 | 2021-07-17T09:16:05 | Java | UTF-8 | Java | false | false | 179 | java | package com.sfgdi.sfgdi.services;
import com.sfgdi.sfgdi.model.Pet;
import com.sfgdi.sfgdi.services.CrudService;
public interface PetService extends CrudService<Pet, Long> {
}
| [
"gustavonvp@gmail.com"
] | gustavonvp@gmail.com |
65cd12da593f14a7a80d785498288baeaf999524 | bb949fce227f2bc4370b0bf2ac9a963b7e93cec7 | /app/src/main/java/com/example/mateu/dynamicclass_student/JoinSubjectPopup.java | c87a7f46ffe09bfd21d763ddd9bda41240da32b8 | [] | no_license | Mateus23/DynamicClass-Student | e64941e5bb2a8140f77033db982db17251b3c5c0 | b9df3fb6fcac111a054f51a316049e3493b284df | refs/heads/master | 2020-04-06T16:12:07.890466 | 2018-12-18T00:12:28 | 2018-12-18T00:12:28 | 157,610,062 | 0 | 0 | null | 2018-12-17T18:53:02 | 2018-11-14T20:57:51 | Java | UTF-8 | Java | false | false | 4,963 | java | package com.example.mateu.dynamicclass_student;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
public class JoinSubjectPopup extends DialogFragment {
EditText subjectCodeTextView, subjectPasswordTextView;
DatabaseReference classesReference;
DataSnapshot classesSnapshot;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
classesReference = FirebaseDatabase.getInstance().getReference("Classes");
classesReference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
classesSnapshot = dataSnapshot;
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()){
Log.d("TEMOS AS MATERIAS", postSnapshot.getKey());
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
builder.setView(inflater.inflate(R.layout.popup_join_subject, null))
// Add action buttons
.setPositiveButton("Entrar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// sign in the user ...
Log.d("TESTE", "ONCREATE");
tryToJoinSubject();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
JoinSubjectPopup.this.getDialog().cancel();
}
});
return builder.create();
}
@Override
public void onStart()
{
super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point
AlertDialog d = (AlertDialog)getDialog();
if(d != null)
{
Button positiveButton = (Button) d.getButton(Dialog.BUTTON_POSITIVE);
positiveButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Log.d("TESTE", "ONSTART");
tryToJoinSubject();
}
});
}
subjectCodeTextView = d.findViewById(R.id.subjectCode);
subjectPasswordTextView = d.findViewById(R.id.subjectPassword);
}
public void tryToJoinSubject(){
subjectCodeTextView.setError(null);
subjectPasswordTextView.setError(null);
// Store values at the time of the login attempt.
String code = subjectCodeTextView.getText().toString().toUpperCase();
String password = subjectPasswordTextView.getText().toString();
boolean cancel = false;
if (TextUtils.isEmpty(code)) {
subjectCodeTextView.setError(getString(R.string.error_field_required));
cancel = true;
}
if (TextUtils.isEmpty(password)) {
subjectPasswordTextView.setError(getString(R.string.error_field_required));
cancel = true;
}
if (!classesSnapshot.child(code).exists()){
subjectCodeTextView.setError("Codigo de turma nao encontrado");
cancel = true;
}else if (classesSnapshot.child(code).child("password").exists()){
if(!password.equals(classesSnapshot.child(code).child("password").getValue())){
subjectPasswordTextView.setError("Senha incorreta");
cancel = true;
}
}else{
cancel = true;
}
if (!cancel) {
DatabaseReference newClassReference = classesReference.child(code);
MySubjects.joinSubject(code, classesSnapshot.child(code).child("name").getValue().toString(), classesSnapshot.child(code).child("Students").getChildrenCount(), newClassReference);
JoinSubjectPopup.this.getDialog().cancel();
}
}
}
| [
"mateus.pelluchi@gmail.com"
] | mateus.pelluchi@gmail.com |
e91e0f13e5039313018f87f60e4b57df1f38a29f | 28cc1b266fc4a3f2a3427e6c0a0ee7afd777f8aa | /src/bean/Clef.java | c0c68c0f2ad1bdeb8fe05debcfd55e4a123191b0 | [] | no_license | ludogit79/Trousseau | 4e5b1f03c91a50457f0e9ced02ddba0e46743083 | b4808b2a27dbf2188508c47348db33e0cb9ef2f5 | refs/heads/master | 2020-04-10T16:43:44.857899 | 2018-12-10T09:57:05 | 2018-12-10T09:57:05 | 161,153,905 | 0 | 0 | null | null | null | null | ISO-8859-2 | Java | false | false | 1,822 | java | package bean;
public class Clef
{
// Constant
public final char ANALOGIQUE = 'a';
public final char NUMERIQUE = 'n';
// Variables
public static int compteur;
// Attributs
private int id;
private String reference = "";
private String porte = "";
private boolean disponible = true;
private Personne personne;
// Constructeur
public Clef(){
this.id = ++Clef.compteur;
}
public Clef(String reference, String porte, Personne personne, boolean disponible )
{
this.id = ++Clef.compteur;
this.reference = reference;
this.porte = porte;
this.personne = personne;
this.disponible = disponible;
}
// Getters et Setters
public int getId()
{
return id;
}
public void decrementId()
{
Clef.compteur = Clef.compteur -1;
}
public String getReference()
{
return reference;
}
public void setReference(String reference)
{
this.reference = reference;
}
public String getPorte()
{
return porte;
}
public void setPorte(String porte)
{
this.porte = porte;
}
public boolean isDisponible()
{
return disponible;
}
public void setDisponible(boolean disponible)
{
this.disponible = disponible;
}
public Personne getPersonne()
{
return personne;
}
public void setPersonne(Personne personne)
{
this.personne = personne;
}
public static int getCompteur()
{
return compteur;
}
public char getANALOGIQUE()
{
return ANALOGIQUE;
}
public char getNUMERIQUE()
{
return NUMERIQUE;
}
// @Override
// public String toString()
// {
// return this.getPersonne().getId() + " : Nom : " + this.getPersonne().getNom() + " : Prénom : " + this.getPersonne().getPrenom() + " : email : " + this.getPersonne().getEmail();
// }
//
}
| [
"poussinludovic@gmail.com"
] | poussinludovic@gmail.com |
0b1eb9f5669007ae796706a51079a46c0a37551d | fcbf47e3b04e701ad550527d84718b5684f6e75d | /flex-compile/flex-compile-common/src/main/java/org/oleg/fcs/util/ClassLoaderUtil.java | 0e92171fd10875130d44f29674312674829426ab | [] | no_license | OlegIlyenko/flex-compile | 34dcc6edfd849bd775435e831ab2f4c1b026e9e5 | 2aff0dfeed1b221e7d3a54344bfced34a4c76e05 | refs/heads/master | 2021-01-19T16:50:34.916421 | 2009-05-21T21:00:49 | 2009-05-21T21:00:49 | 32,118,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,602 | java | package org.oleg.fcs.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.regex.Pattern;
import java.net.URLClassLoader;
import java.net.URL;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
/**
* TODO: Class Description
*
* @author Oleg Ilyenko
*/
@SuppressWarnings("unchecked")
public abstract class ClassLoaderUtil {
private static final Log log = LogFactory.getLog(ClassLoaderUtil.class);
// public static ClassLoader CLASS_LOADER;
public static ClassLoader ORIGINAL_CLASS_LOADER;
/**
* Loads libraries from the <code>path</code>.<br>
* You can use * (star) as wildcard of set of provided placeholders in path.
*
* @param path where to search
* @param placeholders they will be fetched in path
*/
public static void loadLibraries(String path, Map<String, String> placeholders) {
String workingPath = path;
for (String ph : placeholders.keySet()) {
workingPath = workingPath.replaceAll("\\$\\{" + ph + "\\}", placeholders.get(ph));
}
File f = new File(workingPath);
String name = f.getName();
Pattern filePath = Pattern.compile(name.replaceAll("\\*", ".*"));
File pathDir = f.getParentFile();
try {
List<URL> filesToProcess = new ArrayList<URL>();
if (pathDir.exists()) {
for (File fInDir : pathDir.listFiles()) {
if (filePath.matcher(fInDir.getName()).matches()) {
filesToProcess.add(fInDir.toURI().toURL());
}
}
}
// if (CLASS_LOADER == null) {
// CLASS_LOADER = ClassLoaderUtil.class.getClassLoader();
// }
// URLClassLoader cl = new URLClassLoader(filesToProcess.toArray(new URL[filesToProcess.size()]), CLASS_LOADER);
// CLASS_LOADER = cl;
// Add new Jars to the system classpath !!! (little hack, but works)
URLClassLoader sysloader = (URLClassLoader)ClassLoader.getSystemClassLoader();
Class sysclass = URLClassLoader.class;
Method method = sysclass.getDeclaredMethod("addURL", new Class[]{URL.class});
method.setAccessible(true);
for (URL u : filesToProcess) {
method.invoke(sysloader, u);
}
log.debug("Loaded libraries (in path " + path + "): " + filesToProcess);
} catch (Throwable e) {
log.error("Error during loading lib in path " + path, e);
}
}
// public static void changeContextClassLoader() {
// if (CLASS_LOADER != null) {
// ORIGINAL_CLASS_LOADER = Thread.currentThread().getContextClassLoader();
// Thread.currentThread().setContextClassLoader(CLASS_LOADER);
// }
// }
//
// public static void restoreContextClassLoader() {
// if (ORIGINAL_CLASS_LOADER != null) {
// Thread.currentThread().setContextClassLoader(ORIGINAL_CLASS_LOADER);
// }
// }
//
// public static Class loadClass(String name) throws ClassNotFoundException {
// if (CLASS_LOADER != null) {
// return CLASS_LOADER.loadClass(name);
// } else {
// throw new IllegalStateException("No custom class loader !!!");
// }
// }
}
| [
"oleg.ilyenko@4dbd696c-0aa8-11de-b55b-d397e7115e68"
] | oleg.ilyenko@4dbd696c-0aa8-11de-b55b-d397e7115e68 |
d6ab03218b5699f8b84646a82a8ce43541b591de | 60fe78bb64c3d6038972acd0652ea4fe02791bb5 | /app/src/main/java/com/hc/hcppjoke/ui/find/FindFragment.java | fb05cca3978af308f5a4ab4a45ff247092be3a7e | [] | no_license | hcgrady2/hcjoke | 95c9c3d0f39c88905ddbf08bff6e7f4fcb6b9f1e | a65f9dfde789782ec44862dcafb1db468da06160 | refs/heads/master | 2023-07-03T03:06:35.289488 | 2021-08-06T06:31:44 | 2021-08-06T06:31:44 | 267,067,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,290 | java | package com.hc.hcppjoke.ui.find;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import com.hc.hcppjoke.model.SofaTab;
import com.hc.hcppjoke.ui.sofa.SofaFragment;
import com.hc.hcppjoke.utils.AppConfig;
import com.hc.libnavannotation.FragmentDestination;
@FragmentDestination(pageUrl = "main/tabs/find")
public class FindFragment extends SofaFragment {
@Override
public Fragment getTabFragment(int position) {
SofaTab.Tabs tab = getTabConfig().tabs.get(position);
TagListFragment fragment = TagListFragment.newInstance(tab.tag);
return fragment;
}
@Override
public void onAttachFragment(@NonNull Fragment childFragment) {
super.onAttachFragment(childFragment);
String tagType = childFragment.getArguments().getString(TagListFragment.KEY_TAG_TYPE);
if (TextUtils.equals(tagType, "onlyFollow")) {
ViewModelProviders.of(childFragment).get(TagListViewModel.class)
.getSwitchTabLiveData().observe(this,
object -> viewPager2.setCurrentItem(1));
}
}
@Override
public SofaTab getTabConfig() {
return AppConfig.getFindTabConfig();
}
} | [
"hcwang1024@163.com"
] | hcwang1024@163.com |
1e2c1536d59a242763676db3b0be74bf44c814f9 | bdccb6cf410da5e65fd619279cdcace4f5c5163b | /src/util/UserBean.java | b736ede11e64c346712457ffe72876c0f4d11fab | [] | no_license | DickyQie/android-cache | 18c20c9b15daa4f99cd9c803ea743985fe2a3657 | 39177390d684a180505b4f0038bc311450af241f | refs/heads/master | 2021-09-06T03:35:26.528742 | 2016-09-19T02:11:10 | 2016-09-19T02:11:10 | 68,560,923 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package util;
import java.io.Serializable;
public class UserBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String name;
private String age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
@Override
public String toString() {
return "UserBean [name=" + name + ", age=" + age + "]";
}
}
| [
"18523978916@163.com"
] | 18523978916@163.com |
bfea4108fcbe70d16be8e8bbd25b15f1d395eb84 | ffbc6418993f5ae546ede9bd3e70c6c30d885423 | /profiler/src/main/java/com/navercorp/pinpoint/profiler/context/recorder/DefaultUriStatRecorderFactory.java | 71093398d75869c66308afcc666466aebc5b9bf8 | [
"DOC",
"LicenseRef-scancode-free-unknown",
"CC0-1.0",
"OFL-1.1",
"GPL-1.0-or-later",
"CC-PDDC",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference",
"MITNFA",
"MIT",
"CC-BY-4.0",
"OFL-1.0"
] | permissive | alynlin/pinpoint | 0dcf3279fc2c0b1944bac5f914b0dc226d4a315f | f7d112ae5611745606065ada22609e926966735a | refs/heads/master | 2021-01-12T05:57:28.470862 | 2020-12-03T09:32:22 | 2020-12-03T09:32:22 | 77,233,247 | 2 | 0 | Apache-2.0 | 2020-12-03T09:32:23 | 2016-12-23T15:16:30 | Java | UTF-8 | Java | false | false | 2,614 | java | /*
* Copyright 2020 NAVER Corp.
*
* 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.navercorp.pinpoint.profiler.context.recorder;
import com.navercorp.pinpoint.bootstrap.plugin.uri.DisabledUriStatRecorder;
import com.navercorp.pinpoint.bootstrap.plugin.uri.UriExtractor;
import com.navercorp.pinpoint.bootstrap.plugin.uri.UriExtractorProviderLocator;
import com.navercorp.pinpoint.bootstrap.plugin.uri.UriExtractorService;
import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatRecorder;
import com.navercorp.pinpoint.bootstrap.plugin.uri.UriStatRecorderFactory;
import com.navercorp.pinpoint.common.util.Assert;
import com.navercorp.pinpoint.profiler.context.storage.UriStatStorage;
import com.google.inject.Provider;
/**
* @author Taejin Koo
*/
public class DefaultUriStatRecorderFactory implements UriStatRecorderFactory {
private final UriExtractorProviderLocator uriExtractorProviderLocator;
private final UriStatStorage uriStatStorage;
public DefaultUriStatRecorderFactory(Provider<UriExtractorProviderLocator> uriExtractorProviderLocatorProvider, Provider<UriStatStorage> uriStatStorageProvider) {
Assert.requireNonNull(uriExtractorProviderLocatorProvider, "uriExtractorProviderLocatorProvider");
UriExtractorProviderLocator uriExtractorProviderLocator = uriExtractorProviderLocatorProvider.get();
this.uriExtractorProviderLocator = Assert.requireNonNull(uriExtractorProviderLocator, "uriExtractorProviderLocator");
Assert.requireNonNull(uriStatStorageProvider, "uriStatStorageProvider");
this.uriStatStorage = uriStatStorageProvider.get();
}
@Override
public <T> UriStatRecorder<T> create(UriExtractorService<T> uriExtractorService) {
Assert.requireNonNull(uriExtractorService, "uriExtractorService");
UriExtractor<T> uriExtractor = uriExtractorService.get(uriExtractorProviderLocator);
if (uriExtractor == null) {
return DisabledUriStatRecorder.create();
} else {
return new DefaultUriStatRecorder<T>(uriExtractor, uriStatStorage);
}
}
}
| [
"koo.taejin@navercorp.com"
] | koo.taejin@navercorp.com |
d721c6561507bc227ae143bedb790e1a26635642 | fd2770bfda048a9f04c2c0f37dfece970a146343 | /src/com/lawer/service/impl/LawerHelpCaseServiceImpl.java | 0527d0d6de030c787b585b8c73adcb717b8d790e | [] | no_license | bjzhaosq/YourCare | 990c24e591c1bc6c45ab9b05253549ef0a8705ab | 177f6df66410ced80bbc8eef5d25d19465b87d03 | refs/heads/master | 2021-07-15T00:40:31.595480 | 2017-10-20T08:14:09 | 2017-10-20T08:14:09 | 107,236,859 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | java | package com.lawer.service.impl;
import java.util.List;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.lawer.dao.LawerCaseDao;
import com.lawer.dao.LawerHelpCaseDao;
import com.lawer.dao.ProcessTypeDao;
import com.lawer.domain.LawerCase;
import com.lawer.domain.LawerHelpCase;
import com.lawer.service.LawerCaseService;
import com.lawer.service.LawerHelpCaseService;
@Service(value = "lawerHelpCaseService")
@Transactional
public class LawerHelpCaseServiceImpl extends BaseServiceImpl implements LawerHelpCaseService {
private static Logger logger = Logger.getLogger(LawerHelpCaseServiceImpl.class);
@Autowired
private LawerHelpCaseDao lawerHelpCaseDao;
@Override
public void save(List<LawerHelpCase> list) {
lawerHelpCaseDao.save(list);
}
}
| [
"752265559@qq.com"
] | 752265559@qq.com |
2fc63703064d9bd3c0812b18a5481d9451bcf422 | 2cd5a50b9cb367297009d7b158a64bfbb3d193ab | /Hui/leetcode/486.predict-the-winner.java | e831da7a11bf2314e95492069086d89a287890c3 | [] | no_license | Kun17/JobHunting2020 | 5eb12c5495b422d9c697b1dfb7c8041e609938ff | b738c21106b9b371148079ffef5b947e7117aad4 | refs/heads/main | 2023-03-23T12:07:33.448422 | 2021-03-18T22:50:45 | 2021-03-18T22:50:45 | 329,748,525 | 1 | 1 | null | 2021-03-18T22:50:46 | 2021-01-14T22:22:24 | Java | UTF-8 | Java | false | false | 1,105 | java | /*
* @lc app=leetcode id=486 lang=java
*
* [486] Predict the Winner
*/
// @lc code=start
class Solution {
public boolean PredictTheWinner(int[] nums) {
int[][][] dp = new int[nums.length][nums.length][2];
if(nums.length == 1) return true;
int[] ret = helper(nums, 0, nums.length - 1, dp);
return ret[0] >= ret[1];
}
public int[] helper(int[] nums, int start, int end, int[][][] dp) {
if(dp[start][end][0] != 0) {
return dp[start][end];
}
if(end - start == 1) {
dp[start][end] = new int[]{Math.max(nums[start], nums[end]), Math.min(nums[start], nums[end])};
} else {
int[] ret1 = helper(nums, start + 1, end, dp);
int[] ret2 = helper(nums,start, end - 1, dp);
if(ret1[1] + nums[start] > ret2[1] + nums[end]) {
dp[start][end] = new int[]{ret1[1] + nums[start], ret1[0]};
} else {
dp[start][end] = new int[]{ret2[1] + nums[end], ret2[0]};
}
}
return dp[start][end];
}
}
// @lc code=end
| [
"lihuiclara@163.com"
] | lihuiclara@163.com |
d59438373c212ca342845d60bcb6c604323cb1b5 | 9aed9c774b54ef13c4aa1f86335148e413d2abef | /src/main/java/cc/feedback/dao/PendingFeedbackDao.java | 699c3611eb67924b5fc9713758a5089fc4cd0f95 | [] | no_license | OanaMariaRosu/feedback | 0ba21d4cb42d1fc776bf2dea1b34d720051fdbf5 | ef87367463111434ec4b5a675b3d964e3006bd05 | refs/heads/master | 2021-01-20T07:40:19.437223 | 2017-05-18T19:47:40 | 2017-05-18T19:47:40 | 90,025,464 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package cc.feedback.dao;
import cc.feedback.entities.EmployeeEntity;
public interface PendingFeedbackDao {
void resolveFeedback(EmployeeEntity from, EmployeeEntity to);
}
| [
"yo_alyn3@yahoo.com"
] | yo_alyn3@yahoo.com |
723d8742efea9d0e0c060620f0edada90a38963e | 0cb085d41ad295021711a36862b71f5c19f55a3b | /src/org/dimigo/basic/PrimitiveDataType/TypeCasting.java | 552c452b0556e9ef5d7bcfcffa8c55d4f5dc45f4 | [] | no_license | ashley0302/JavaPractice | 5feaf3f78488bc000fabab5977d9be820801d514 | c95afd6090c461f3dc331dd791d9ad2c6998e334 | refs/heads/master | 2020-06-19T01:36:39.427345 | 2019-07-12T06:21:44 | 2019-07-12T06:21:44 | 196,520,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 678 | java | package org.dimigo.basic.PrimitiveDataType;
public class TypeCasting {
public static void main(String[] args) {
//자동형변환 (Promotion, 작은타임 -> 큰타입)
byte b= 10;
short s =b;
int i = s;
long l =i;
System.out.printf("%d, %d, %d, %d\n",b,s,i,l);
//강제형변환 (Cating, 큰타입->작은타입)
i=(int)l;
s=(short)i;
b=(byte)s;
System.out.printf("%d, %d, %d \n",b,s,i);
int i2 = 128;
byte b2 = (byte)i2;
System.out.printf("%d \n",b2);
long l2 = 10000000000L;
int i3 = (int)l2;
System.out.printf("%d\n",i3);
}
}
| [
"ashley102@naver.com"
] | ashley102@naver.com |
30b44cf6324b53b1ee2de8951370104128076059 | 6d6a2896e206089fed182d93f60e0691126d889c | /src_common_tr3/org/terrier/normalisationeffect/NormalisationEffect.java | 8d14c5ca30033449426a3215b6abfeeca06b1492 | [] | no_license | azizisya/benhesrc | 2291c9d9cb22171f4e382968c14721d440bbabf2 | 4bd27c1f6e91b2aec1bd71f0810d1bbd0db902b5 | refs/heads/master | 2020-05-18T08:53:54.800452 | 2011-02-24T09:41:17 | 2011-02-24T09:41:17 | 34,458,592 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,408 | java | /*
* Smooth - Smoothing term frequency normalisation
* Webpage: http://ir.dcs.gla.ac.uk/smooth
* Contact: ben{a.}dcs.gla.ac.uk
* University of Glasgow - Department of Computing Science
* Information Retrieval Group
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is NormalisationEffect.java.
*
* The Original Code is Copyright (C) 2004, 2005 the University of Glasgow.
* All Rights Reserved.
*
* Contributor(s):
* Ben He <ben{a.}dcs.gla.ac.uk>
*/
package org.terrier.normalisationeffect;
/**
* An interface of implementing a normalisation effect class.
* @author Ben He <ben{a.}dcs.gla.ac.uk>
* @version $Revision: 1.1 $
*/
public abstract class NormalisationEffect{
/**
* This method provides contract for implementing returning the name of
* the normalisation method.
* @return The name of the normalisation method.
*/
public abstract String getInfo();
/**
* This method provides contract for implementing measuring the normalisation
* effect.
* @param termFrequency double The frequency of the query term in the collection.
* @param documentLength double[] The document length of the retrieved documents.
* @param c double The free parameter of the normalisation method.
* @param definition int The definition of the normalisation effect. There are
* three definitions in total. It is recommended to use definition 2.
* @return double The normalisation effect.
*/
public abstract double getNED(
double[] documentLength, double c, int definition
);
/**
* Set the average document length in the collection.
* @param value The average document length in the collection.
*/
public abstract void setAverageDocumentLength(double value);
/**
* Set the number of tokens in the collection.
* @param value The number of tokens in the collection.
*/
public abstract void setNumberOfTokens(double value);
}
| [
"ben.he.09@f3485be4-0bd3-11df-ad0c-0fb4090ca1bc"
] | ben.he.09@f3485be4-0bd3-11df-ad0c-0fb4090ca1bc |
56c26f17c9c2896b76d5fad00d99a50645df0ff0 | 6ef95513f0fcff74160e4937b7f9f327c5aa88b6 | /src/com/app/service/ILocationService.java | c277914626fbc84c342bd90e8cd3eae3af4fbf0c | [] | no_license | phanirag/VendorApp | e52704aa62d274ee09972032786662b07cf9c8bf | 12e70a413f89527af9b54881f6bb66337e14f8f3 | refs/heads/master | 2020-04-11T11:32:24.384720 | 2018-12-14T07:59:25 | 2018-12-14T07:59:25 | 161,750,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.app.service;
import java.util.List;
import com.app.modal.Location;
public interface ILocationService {
public int saveLocation(Location loc);
public void updateLocation(Location loc);
public void deleteLocation(int Locid);
public Location getLocationbyid(int Locid);
public List<Location> getallLocation();
public List<Object[]> getLocationTypeCount();
}
| [
"raghavs025@gmail.com"
] | raghavs025@gmail.com |
6a3c844687b3e3a24e13763e0784372c2c667996 | 0b06a3f0c9770c61b363229372450e291388d9a8 | /src/game/VoodooZombie.java | c31d79965c15790b00d5bceda85c835e701af14a | [] | no_license | mikeyhao/zombie_game_OOD | 0c19e85654059bf42a44a256b1a7b9f78304da27 | 9bfb9382c02224c5d25fe197d6202187ca1aa845 | refs/heads/master | 2022-11-15T08:11:43.538547 | 2020-07-15T08:45:50 | 2020-07-15T08:45:50 | 279,812,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,581 | java | package game;
import edu.monash.fit2099.engine.Action;
import edu.monash.fit2099.engine.Actions;
import edu.monash.fit2099.engine.Display;
import edu.monash.fit2099.engine.DoNothingAction;
import edu.monash.fit2099.engine.GameMap;
public class VoodooZombie extends ZombieActor{
private int zombieCreateAmount = 5;
private int createCooldown = 2;
private int chantDuration = 1;
private int vanishTicker = 0;
private int vanishDuration = 30;
private GameMap vanishMap;
private GameMap mainMap;
private Behaviour[] behaviours = {
new VoodooBehaviour(createCooldown, chantDuration, zombieCreateAmount),
new WanderBehaviour()
};
public VoodooZombie(String name) {
super(name, 'M', 250, ZombieCapability.UNDEAD);
}
/**
* It will either perform VoodooBehaviour or WanderBehaviour, VoodooBehaviour fails if it is still currently on cooldown as it
* will return null, and WanderBehaviour is called instead.
*
* @param actions list of possible Actions
* @param lastAction previous Action, if it was a multiturn action
* @param map the map where the current VoodooZombie is
* @param display the Display where the VoodooZombie's utterances will be displayed
*/
@Override
public Action playTurn(Actions actions, Action lastAction, GameMap map, Display display) {
vanishTicker++;
if(vanishTicker >= vanishDuration) {
return new VoodooVanishAction();
}
for (Behaviour behaviour : behaviours) {
Action action = behaviour.getAction(this, map);
if (action != null)
return action;
}
return new DoNothingAction();
}
}
| [
"glio0001.student.monash.edu"
] | glio0001.student.monash.edu |
8690f296106220fda76ecd53461583296839584e | da0437ec50f5b58759118e02ae8e66e1e820a7a2 | /src/org/darion/yaphet/lintcode/HashFunction.java | 2aecd21d202f2b5aee1bcd5f7c8c279874555587 | [] | no_license | darionyaphet/algorithms | e37f71d62f0d63001be885d3bed6d425f3a0b421 | 3171efc02b6a987acc2e82389ecb5b80793a52db | refs/heads/master | 2020-05-21T03:24:11.097619 | 2018-10-08T15:32:42 | 2018-10-08T15:32:42 | 25,767,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 874 | java | package org.darion.yaphet.lintcode;
/**
* http://www.lintcode.com/zh-cn/problem/hash-function/
*/
public class HashFunction {
public static int hashCode(char[] key, int HASH_SIZE) {
if (key == null || key.length == 0) {
return -1;
}
int size = key.length;
long code = 0;
long base = 1;
for (int i = size - 1; i >= 0; i--) {
code += (key[i] * base) % HASH_SIZE;
code %= HASH_SIZE;
base = base * 33 % HASH_SIZE;
}
return (int) code;
}
public static void main(String[] args) {
System.out.println(hashCode("abcd".toCharArray(), 100));
System.out.println(hashCode("ubuntu".toCharArray(), 1007));
System.out.println(hashCode("abcdefghijklmnopqrstuvwxyz".toCharArray(), 2607)); // 1673
}
}
| [
"darion.yaphet@gmail.com"
] | darion.yaphet@gmail.com |
b161fe6254edd663ea2469112f2bb0b4ce51055f | 4abffdb1e014bdd74a45f6aa0ccab96f40909228 | /myHomePage/src/dto/MemberDTO.java | 5390d512a86b645c65b14fce6362d2ddd4b77134 | [] | no_license | lsh4257/myHomePage | 6c2c0775fbd0b5ae6aa15513df57584a1989d508 | 7ae8b59df02a52801f44c8b4834afdf6da9c6ff8 | refs/heads/master | 2021-07-24T05:56:48.567923 | 2017-11-03T07:29:33 | 2017-11-03T07:29:33 | 109,359,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,489 | java | package dto;
import java.sql.Date;
public class MemberDTO {
private String s_id;
private String s_name;
private String s_pw;
private String s_zipnum;
private String s_addr;
private String s_addr2;
private String s_phone;
private String s_email;
private Date regdate;
//기본 생성자
public MemberDTO(){
}
// 회원 정보 전체 출력
public MemberDTO(String s_id, String s_name, String s_pw, String s_zipnum, String s_addr, String s_addr2, String s_phone, String s_email, Date regdate) {
super();
this.s_id = s_id;
this.s_name = s_name;
this.s_pw = s_pw;
this.s_zipnum = s_zipnum;
this.s_addr = s_addr;
this.s_addr2 = s_addr2;
this.s_phone = s_phone;
this.s_email = s_email;
this.regdate = regdate;
}
// 회원가입 , 회원정보 수정
public MemberDTO(String s_id, String s_name, String s_pw, String s_zipnum, String s_addr, String s_addr2, String s_phone, String s_email) {
super();
this.s_id = s_id;
this.s_name = s_name;
this.s_pw = s_pw;
this.s_zipnum = s_zipnum;
this.s_addr = s_addr;
this.s_addr2 = s_addr2;
this.s_phone = s_phone;
this.s_email = s_email;
}
public String getS_zipnum() {
return s_zipnum;
}
public void setS_zipnum(String s_zipnum) {
this.s_zipnum = s_zipnum;
}
public String getS_id() {
return s_id;
}
public void setS_id(String s_id) {
this.s_id = s_id;
}
public String getS_name() {
return s_name;
}
public void setS_name(String s_name) {
this.s_name = s_name;
}
public String getS_pw() {
return s_pw;
}
public void setS_pw(String s_pw) {
this.s_pw = s_pw;
}
public String getS_addr() {
return s_addr;
}
public void setS_addr(String s_addr) {
this.s_addr = s_addr;
}
public String getS_addr2() {
return s_addr2;
}
public void setS_addr2(String s_addr2) {
this.s_addr2 = s_addr2;
}
public String getS_phone() {
return s_phone;
}
public void setS_phone(String s_phone) {
this.s_phone = s_phone;
}
public String getS_email() {
return s_email;
}
public void setS_email(String s_email) {
this.s_email = s_email;
}
public Date getRegdate() {
return regdate;
}
public void setRegdate(Date regdate) {
this.regdate = regdate;
}
}
| [
"lshlsh4257@gmail.com"
] | lshlsh4257@gmail.com |
fd54da83a8b8659d9a559c99958fd3953dd6352e | fe2ef5d33ed920aef5fc5bdd50daf5e69aa00ed4 | /website/src/et/bo/oa/communicate/email/service/impl/EmailInServiceImpl.java | 55b84b9d27f1322ba66f231b738d99a5c245c060 | [] | no_license | sensui74/legacy-project | 4502d094edbf8964f6bb9805be88f869bae8e588 | ff8156ae963a5c61575ff34612c908c4ccfc219b | refs/heads/master | 2020-03-17T06:28:16.650878 | 2016-01-08T03:46:00 | 2016-01-08T03:46:00 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 12,719 | java | package et.bo.oa.communicate.email.service.impl;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import et.bo.oa.communicate.email.service.EmailService;
import et.po.InadjunctInfo;
import et.po.InemailInfo;
import et.po.SysUser;
import excellence.common.key.KeyService;
import excellence.common.page.PageInfo;
import excellence.common.util.Constants;
import excellence.common.util.time.TimeUtil;
import excellence.framework.base.dao.BaseDAO;
import excellence.framework.base.dto.IBaseDTO;
import excellence.framework.base.dto.impl.DynaBeanDTO;
import excellence.framework.base.query.MyQuery;
import excellence.framework.base.query.impl.MyQueryImpl;
/**
* @describe 内部邮件信息的具体实现
* @author zhangfeng
* @version 1.0, 2006/08/29
* @see BaseDAO
* @see KeyService
*/
public class EmailInServiceImpl implements EmailService {
private BaseDAO dao=null;
private KeyService ks = null;
private int EMAIL_NUM = 0;
private String TOMCAT_HOME_ADDRESS = Constants.getProperty("email_tomcat_real_path");
public boolean delEmailForever(String[] selectIt) {
// TODO Auto-generated method stub
boolean flag = false;
for (int i = 0; i < selectIt.length; i++) {
String articleid = selectIt[i];
InemailInfo inemailInfo = (InemailInfo) dao.loadEntity(
InemailInfo.class, articleid);
dao.removeEntity(inemailInfo);
flag = true;
}
return flag;
}
public boolean delEmailToDustbin(String[] selectIt) {
// TODO Auto-generated method stub
boolean flag = false;
for (int i = 0; i < selectIt.length; i++) {
String articleid = selectIt[i];
InemailInfo inemailInfo = (InemailInfo) dao.loadEntity(
InemailInfo.class, articleid);
inemailInfo.setDelSign("y".toUpperCase());
dao.updateEntity(inemailInfo);
flag = true;
}
return flag;
}
public List emailListIndex(IBaseDTO dto, PageInfo pageInfo,
String mailboxType) {
// TODO Auto-generated method stub
List finalList = new ArrayList();
EmailSearch emailSearch = new EmailSearch();
Object[] result = null;
//收件箱
if (mailboxType.equals("getBox")) {
result=(Object[])dao.findEntity(emailSearch.searchGetEmailList(dto,pageInfo));
}
//已发邮件
if (mailboxType.equals("sendBox")) {
result=(Object[])dao.findEntity(emailSearch.searchSendEmailList(dto,pageInfo));
}
//草稿箱
if (mailboxType.equals("draftBox")) {
result=(Object[])dao.findEntity(emailSearch.searchDraftEmailList(dto,pageInfo));
}
//垃圾箱
if (mailboxType.equals("dustbinBox")) {
result=(Object[])dao.findEntity(emailSearch.searchDelEmailList(dto,pageInfo));
}
int s = 0;
//收件箱
if (mailboxType.equals("getBox")) {
s=dao.findEntitySize(emailSearch.searchGetEmailList(dto,pageInfo));
}
//已发邮件
if (mailboxType.equals("sendBox")) {
s=dao.findEntitySize(emailSearch.searchSendEmailList(dto,pageInfo));
}
//草稿箱
if (mailboxType.equals("draftBox")) {
s=dao.findEntitySize(emailSearch.searchDraftEmailList(dto,pageInfo));
}
//垃圾箱
if (mailboxType.equals("dustbinBox")) {
s=dao.findEntitySize(emailSearch.searchDelEmailList(dto,pageInfo));
}
EMAIL_NUM = s;
//
for(int i = 0,size=result.length;i<size;i++){
InemailInfo inEmailInfo = (InemailInfo)result[i];
DynaBeanDTO dbd = new DynaBeanDTO();
dbd.set("id", inEmailInfo.getId());
dbd.set("takeList", inEmailInfo.getTakeList());
dbd.set("emailTitle", inEmailInfo.getEmailTitle());
dbd.set("emailTime",TimeUtil.getTheTimeStr(inEmailInfo.getCreateTime()));
finalList.add(dbd);
}
return finalList;
}
public int getEmailIndexSize() {
// TODO Auto-generated method stub
return EMAIL_NUM;
}
/**
* @describe 记入邮件发送者信息,发邮件的人的信息
* @param dto 类型 IBaseDTO 数据信息
* @return inemailInfo 类型 InemailInfo 返回页面上插入的信息
*
*/
private InemailInfo addSendUserInfo(IBaseDTO dto,List adjunctList){
InemailInfo inemailInfo = new InemailInfo();
String key = ks.getNext("inemail_info");
inemailInfo.setId(key);
inemailInfo.setSendUser(dto.get("sendUser").toString());
inemailInfo.setTakeUser(dto.get("takeUser").toString());
inemailInfo.setTakeList(dto.get("takeList").toString());
inemailInfo.setCopyList(dto.get("copyList").toString());
inemailInfo.setSecretList(dto.get("copyList").toString());
inemailInfo.setEmailTitle(dto.get("emailTitle").toString());
inemailInfo.setEmailInfo(dto.get("emailInfo").toString());
inemailInfo.setCreateTime(TimeUtil.getNowTime());
inemailInfo.setSendType("");
//inemailInfo.setEmailType("2".toString());
inemailInfo.setEmailType(dto.get("emailType").toString());
inemailInfo.setEmailSign("1".toString());
inemailInfo.setOperSign("2".toString());
//标识为内网邮件
inemailInfo.setInorout("1".toString());
inemailInfo.setIssend(dto.get("issend").toString());
inemailInfo.setDelSign("n".toUpperCase());
//附件信息
if (adjunctList!=null) {
Set set = new HashSet();
Iterator iter = adjunctList.iterator();
while(iter.hasNext()){
String adjunctAddr = iter.next().toString();
//
InadjunctInfo inadjunctInfo = new InadjunctInfo();
inadjunctInfo.setId(ks.getNext("inadjunct_info"));
inadjunctInfo.setInemailInfo(inemailInfo);
inadjunctInfo.setAdjunctAddr(adjunctAddr);
inadjunctInfo.setAdjunctName(adjunctAddr);
inadjunctInfo.setCreateTime(TimeUtil.getNowTime());
inadjunctInfo.setOperUser(dto.get("sendUser").toString());
set.add(inadjunctInfo);
}
inemailInfo.setInadjunctInfos(set);
}
return inemailInfo;
}
/**
* @describe 记入邮件接收人信息,邮件发给谁
* @param dto 类型 IBaseDTO 数据信息
* @return inemailInfo 类型 InemailInfo 返回页面上插入的信息
*
*/
private InemailInfo addTakeUserInfo(IBaseDTO dto,List adjunctList){
InemailInfo inemailInfo = new InemailInfo();
String key = ks.getNext("inemail_info");
inemailInfo.setId(key);
inemailInfo.setSendUser(dto.get("sendUser").toString());
inemailInfo.setTakeUser(dto.get("takeUser").toString());
inemailInfo.setTakeList(dto.get("takeList").toString());
inemailInfo.setCopyList(dto.get("copyList").toString());
inemailInfo.setSecretList(dto.get("copyList").toString());
inemailInfo.setEmailTitle(dto.get("emailTitle").toString());
inemailInfo.setEmailInfo(dto.get("emailInfo").toString());
inemailInfo.setCreateTime(TimeUtil.getNowTime());
inemailInfo.setSendType(dto.get("sendType").toString());
inemailInfo.setEmailType("1".toString());
inemailInfo.setEmailSign("1".toString());
//标识为内网邮件
inemailInfo.setInorout("1".toString());
inemailInfo.setOperSign("2".toString());
inemailInfo.setDelSign("n".toUpperCase());
//附件信息
if (adjunctList!=null) {
Set set = new HashSet();
Iterator iter = adjunctList.iterator();
while(iter.hasNext()){
String adjunctAddr = iter.next().toString();
//
InadjunctInfo inadjunctInfo = new InadjunctInfo();
inadjunctInfo.setId(ks.getNext("inadjunct_info"));
inadjunctInfo.setInemailInfo(inemailInfo);
inadjunctInfo.setAdjunctAddr(adjunctAddr);
inadjunctInfo.setAdjunctName(adjunctAddr);
inadjunctInfo.setCreateTime(TimeUtil.getNowTime());
inadjunctInfo.setOperUser(dto.get("sendUser").toString());
set.add(inadjunctInfo);
}
inemailInfo.setInadjunctInfos(set);
}
return inemailInfo;
}
/**
* @describe 得到最终用户列表
* @param copylist 类型 String 抄送人列表
* @param searctList 类型 String 暗送人列表
* @return 类型
*
*/
private List getUserList(String copylist,String searctlist){
List finalList = new ArrayList();
List copyList = new ArrayList();
List searctList = new ArrayList();
StringTokenizer strToken1 = new StringTokenizer(copylist,",");
String tmpCopyList = "";
while (strToken1.hasMoreTokens()) {
tmpCopyList = strToken1.nextToken();
copyList.add(tmpCopyList);
}
StringTokenizer strToken2 = new StringTokenizer(copylist,",");
String tmpSearctList = "";
while(strToken2.hasMoreTokens()){
tmpSearctList = strToken2.nextToken();
searctList.add(tmpSearctList);
}
for (int i = 0; i < copyList.size(); i++) {
String tmp = copyList.get(i).toString();
for (int j = 0; j < searctList.size(); j++) {
if (tmp.equals(searctList.get(j).toString())) {
finalList.add(tmp);
}
}
}
//copyList.removeAll(finalList);
return finalList;
}
public boolean saveEmailToAddresser(IBaseDTO dto, List adjunctList,String mailType) {
// TODO Auto-generated method stub
boolean flag = false;
//发邮件
if (mailType.equals("send")) {
dto.set("emailType", "2");
dao.saveEntity(addSendUserInfo(dto,adjunctList));
String copyList = dto.get("copyList").toString();
//
String searctlist = dto.get("secretList").toString();
List list = getUserList(copyList,searctlist);
Iterator it = list.iterator();
while(it.hasNext()){
dto.set("takeUser", it.next().toString());
//
dao.saveEntity(addTakeUserInfo(dto,adjunctList));
}
flag = true;
}
//回复
if (mailType.equals("answer")) {
String copyList = dto.get("copyList").toString();
String searctlist = dto.get("secretList").toString();
List list = getUserList(copyList,searctlist);
Iterator it = list.iterator();
while(it.hasNext()){
dto.set("takeUser", it.next().toString());
dao.saveEntity(addTakeUserInfo(dto,adjunctList));
}
flag = true;
}
//转发
if (mailType.equals("transmit")) {
String copyList = dto.get("copyList").toString();
String searctlist = dto.get("secretList").toString();
List list = getUserList(copyList,searctlist);
Iterator it = list.iterator();
while(it.hasNext()){
dto.set("takeUser", it.next().toString());
dao.saveEntity(addTakeUserInfo(dto,adjunctList));
}
flag = true;
}
return flag;
}
public boolean saveEmailToDraft(IBaseDTO dto, List adjunctList) {
// TODO Auto-generated method stub
boolean flag = false;
dto.set("emailType", "3");
dao.saveEntity(addSendUserInfo(dto,adjunctList));
flag = true;
return flag;
}
public BaseDAO getDao() {
return dao;
}
public void setDao(BaseDAO dao) {
this.dao = dao;
}
public KeyService getKs() {
return ks;
}
public void setKs(KeyService ks) {
this.ks = ks;
}
public IBaseDTO getInEmailInfo(String id) {
// TODO Auto-generated method stub
InemailInfo inemailInfo = (InemailInfo)dao.loadEntity(InemailInfo.class,id);
IBaseDTO dto=new DynaBeanDTO();
dto.set("sendUser",inemailInfo.getSendUser());
dto.set("takeList",inemailInfo.getTakeList());
dto.set("copyList",inemailInfo.getCopyList());
dto.set("emailTitle",inemailInfo.getEmailTitle());
dto.set("emailInfo",inemailInfo.getEmailInfo());
dto.set("chk",inemailInfo.getSendType());
EmailSearch emailSearch = new EmailSearch();
//dto.set("adjuctlist", );
Object[] result = null;
result=(Object[])dao.findEntity(emailSearch.searchUploadListInfo(inemailInfo));
List l = new ArrayList();
for(int i = 0,size=result.length;i<size;i++){
InadjunctInfo inadjunctInfo = (InadjunctInfo)result[i];
DynaBeanDTO dbd = new DynaBeanDTO();
dbd.set("name", inadjunctInfo.getAdjunctName());
dbd.set("url", TOMCAT_HOME_ADDRESS + inadjunctInfo.getAdjunctAddr());
l.add(dbd);
}
dto.set("adjunctInfo", l);
return dto;
}
public List getEmailBoxList(String userkey) {
// TODO Auto-generated method stub
return null;
}
public List<IBaseDTO> userList() {
// TODO Auto-generated method stub
List<IBaseDTO> result=new ArrayList<IBaseDTO>();
MyQuery mq=new MyQueryImpl();
DetachedCriteria dc=DetachedCriteria.forClass(SysUser.class);
dc.add(Restrictions.ne("deleteMark","-1"));
mq.setDetachedCriteria(dc);
Object[] re=dao.findEntity(mq);
for(int i=0,size=re.length;i<size;i++)
{
IBaseDTO dto=new DynaBeanDTO();
SysUser su=(SysUser)re[i];
dto.set("id",su.getUserId());
dto.set("name",su.getUserName());
result.add(dto);
}
return result;
}
}
| [
"wow_fei@163.com"
] | wow_fei@163.com |
b79083f2df26c3cc39d5f747542d06221d653bd9 | 5e1fd5b5e286a2e8fdc14c34734e106b882ee0a6 | /app/src/test/java/com/example/admin/createpdfthroughscreenshots/ExampleUnitTest.java | 4061f3c52be9c2ba542e7f18eb7e252ee609bb41 | [] | no_license | sunderrrrrrrr345/CreatePDFthroughScreenSHots | 67ea43fd876a4bdb4e67b01cabeeaa08a4a550a4 | f5a7d376f991e7977746a46fb1090033cd297b7a | refs/heads/master | 2021-04-03T09:03:54.310034 | 2018-03-13T11:13:58 | 2018-03-13T11:13:58 | 125,039,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package com.example.admin.createpdfthroughscreenshots;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"sunderrra31@gmail.com"
] | sunderrra31@gmail.com |
f9f3f7ea2bf7d8b31cb3074659eedc73ab06faa3 | c8e7d9a0e85ea460475c7ede22313a31fcea5c48 | /src/main/java/com/example/authexample/domain/SystemRole.java | 4e9225534f9e7d593075eff838980f3c05b2262f | [] | no_license | lprakapovich/jwt-auth-example | 9b517e0efbf1203e4a750448e651c0cd57e126ac | 88c0df907f38dd59d2dc7342654e4a751bee795a | refs/heads/master | 2023-07-02T16:09:41.201386 | 2021-08-06T21:07:59 | 2021-08-06T21:07:59 | 391,583,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | package com.example.authexample.domain;
public enum SystemRole {
ROLE_SUPER_ADMIN,
ROLE_ADMIN,
ROLE_MODERATOR,
ROLE_BILLING,
ROLE_VIEWER
}
| [
"audlisab@gmail.com"
] | audlisab@gmail.com |
4277e3311fbef5a4288a0e544c0f68d02ba88c92 | 58f25cab9ab69fa4151c1dc89356ab53ab04134b | /expandviewpager/src/androidTest/java/com/wingsofts/expandviewpager/ExampleInstrumentedTest.java | 3c6f07cedcfd3e8909594f62359388f1f14d6a92 | [] | no_license | feelschaotic/air_pollution | 8254a9ffe275698b2c01f8f3e5a15c1936ca5a4f | 6d2e4f0ee5fd59ee31b81a3d70e6f156e6291052 | refs/heads/master | 2021-01-13T04:59:52.155373 | 2017-03-28T01:50:43 | 2017-03-28T01:50:43 | 81,163,245 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 767 | java | package com.wingsofts.expandviewpager;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.wingsofts.expandviewpager.test", appContext.getPackageName());
}
}
| [
"feelschaotic@gmail.com"
] | feelschaotic@gmail.com |
d69f8f8f37208578f188c156e44ab90aa64bf181 | d2eee6e9a3ad0b3fd2899c3d1cf94778615b10cb | /PROMISE/archives/xerces/1.2/org/apache/xerces/validators/datatype/NOTATIONDatatypeValidator.java | 3b469ae422ed429b77dd3edf668b8535922a688a | [] | no_license | hvdthong/DEFECT_PREDICTION | 78b8e98c0be3db86ffaed432722b0b8c61523ab2 | 76a61c69be0e2082faa3f19efd76a99f56a32858 | refs/heads/master | 2021-01-20T05:19:00.927723 | 2018-07-10T03:38:14 | 2018-07-10T03:38:14 | 89,766,606 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,618 | java | package org.apache.xerces.validators.datatype;
import java.util.Hashtable;
import java.util.Locale;
/**
* NOTATIONValidator defines the interface that data type validators must obey.
* These validators can be supplied by the application writer and may be useful as
* standalone code as well as plugins to the validator architecture.
*
* @author Jeffrey Rodriguez-
* @version $Id: NOTATIONDatatypeValidator.java 315856 2000-06-23 01:26:30Z jeffreyr $
*/
public class NOTATIONDatatypeValidator extends AbstractDatatypeValidator {
private DatatypeValidator fBaseValidator = null;
public NOTATIONDatatypeValidator () throws InvalidDatatypeFacetException {
}
public NOTATIONDatatypeValidator ( DatatypeValidator base, Hashtable facets,
boolean derivedByList ) throws InvalidDatatypeFacetException {
fDerivedByList = derivedByList;
}
/**
* Checks that "content" string is valid
* datatype.
* If invalid a Datatype validation exception is thrown.
*
* @param content A string containing the content to be validated
* @param derivedBylist
* Flag which is true when type
* is derived by list otherwise it
* it is derived by extension.
*
* @exception throws InvalidDatatypeException if the content is
* invalid according to the rules for the validators
* @exception InvalidDatatypeValueException
* @see org.apache.xerces.validators.datatype.InvalidDatatypeValueException
*/
public Object validate(String content, Object state ) throws InvalidDatatypeValueException{
return null;
}
public Hashtable getFacets(){
return null;
}
/**
* set the locate to be used for error messages
*/
public void setLocale(Locale locale){
}
/**
* REVISIT
* Compares two Datatype for order
*
* @param o1
* @param o2
* @return
*/
public int compare( String content1, String content2){
return -1;
}
/**
* Returns a copy of this object.
*/
public Object clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
}
/**
* Name of base type as a string.
* A Native datatype has the string "native" as its
* base type.
*
* @param base the validator for this type's base type
*/
private void setBasetype(DatatypeValidator base){
fBaseValidator = base;
}
}
| [
"hvdthong@github.com"
] | hvdthong@github.com |
1f9707e84a75c274dce501a9ed3aacabde672f20 | 11f78d7f87ba6ca477eeb2270231372ebbada5a3 | /ent-creditQuery/ent-queryWeb/src/main/java/cn/com/dhcc/creditquery/ent/queryweb/util/QueryEncryptUtil.java | 7cb57f11c93e572c1591f03b5007cd28ed5a7fbe | [] | no_license | Kong-1123/IdeaProject | 7f4e387947426d5465ec23ee3d5d64e98e181266 | b54e178dcc47095ae64d75db6c5d475c3dc90442 | refs/heads/master | 2022-12-29T19:38:03.362647 | 2019-06-09T06:03:00 | 2019-06-09T06:03:00 | 190,969,933 | 3 | 2 | null | 2022-12-10T05:29:51 | 2019-06-09T05:58:21 | HTML | UTF-8 | Java | false | false | 4,450 | java | /**
*
*/
package cn.com.dhcc.creditquery.ent.queryweb.util;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cn.com.dhcc.creditquery.ent.query.bo.authorizemanager.CeqAuthorizeManagerBo;
import cn.com.dhcc.creditquery.ent.query.bo.queryapprove.CeqApproveBo;
import cn.com.dhcc.creditquery.ent.query.bo.queryflowmanager.CeqQueryRecordBo;
import cn.com.dhcc.creditquery.ent.query.bo.reportview.CeqReportLogBo;
import cn.com.dhcc.creditquery.ent.queryweb.base.BaseController;
import cn.com.dhcc.creditquery.ent.queryweb.controller.archive.ArchiveController;
import cn.com.dhcc.creditquery.ent.queryweb.controller.checkinfo.CheckInfoController;
import cn.com.dhcc.creditquery.ent.queryweb.controller.checkinfo.CheckInfoTaskController;
import cn.com.dhcc.query.creditquerycommon.configutil.CeqConfigUtil;
import cn.com.dhcc.query.creditquerycommon.util.QueryEncryptImplUtil;
/**
* @Description:
* @author: wenchaobo
* @date: 2018.10.24
*/
public class QueryEncryptUtil {
private static Logger log = LoggerFactory.getLogger(QueryEncryptUtil.class);
/**
* @Description: 列表脱敏
*
*/
@SuppressWarnings("unchecked")
public static <T> void QueryEncrypt(BaseController controller,List<T> list){
String flag = CeqConfigUtil.getSensitiveCryto();
if(StringUtils.equals(flag, "0")){
if(!(CheckInfoController.class.isInstance(controller) || CheckInfoTaskController.class.isInstance(controller) || ArchiveController.class.isInstance(controller))){
T t = list.get(0);
if(CeqAuthorizeManagerBo.class.isInstance(t)){
archiveQueryEncrypt((List<CeqAuthorizeManagerBo>) list);
}else if (CeqQueryRecordBo.class.isInstance(t)) {
resultinfoQueryEncrypt((List<CeqQueryRecordBo>) list);
}else if (CeqReportLogBo.class.isInstance(t)) {
reportLogQueryEncrypt( (List<CeqReportLogBo>) list);
}else if (CeqApproveBo.class.isInstance(t)) {
checkInfoQueryEncrypt( (List<CeqApproveBo>) list);
}
}
}
}
/*
* @Description: 明细脱敏
*
*/
public static <T> void QueryEncrypt(T t){
String flag = CeqConfigUtil.getSensitiveCryto();
if(StringUtils.equals(flag, "0")){
if(CeqAuthorizeManagerBo.class.isInstance(t)){
oneEncrypt((CeqAuthorizeManagerBo)t);
}else if (CeqQueryRecordBo.class.isInstance(t)) {
oneEncrypt((CeqQueryRecordBo)t);
}else if (CeqReportLogBo.class.isInstance(t)) {
oneEncrypt((CeqReportLogBo)t);
}else if (CeqApproveBo.class.isInstance(t)) {
oneEncrypt((CeqApproveBo)t);
}
}
}
/**
* @Description: 电话号码脱敏
*
*/
public static String numberEncrypt(String number){
if(number.length() == 11){
return QueryEncryptImplUtil.phoneEncrypt(number);
}else{
return QueryEncryptImplUtil.telEncrypt(number);
}
}
public static void archiveQueryEncrypt(List<CeqAuthorizeManagerBo> list){
for (CeqAuthorizeManagerBo cpqArchive : list) {
cpqArchive.setSignCode(QueryEncryptImplUtil.loancardCodeEncrypt(cpqArchive.getSignCode()));
}
}
public static void resultinfoQueryEncrypt(List<CeqQueryRecordBo> list){
for (CeqQueryRecordBo resultinfo : list) {
resultinfo.setSignCode(QueryEncryptImplUtil.loancardCodeEncrypt(resultinfo.getSignCode()));
}
}
public static void reportLogQueryEncrypt(List<CeqReportLogBo> list){
for (CeqReportLogBo resultinfo : list) {
resultinfo.setSignCode(QueryEncryptImplUtil.loancardCodeEncrypt(resultinfo.getSignCode()));
}
}
public static void checkInfoQueryEncrypt(List<CeqApproveBo> list){
for (CeqApproveBo resultinfo : list) {
resultinfo.setSignCode(QueryEncryptImplUtil.loancardCodeEncrypt(resultinfo.getSignCode()));
}
}
/**
* 内部逻辑一样,由于get,set方法不一致,所以不能做统一处理
* @param object
* @return void
*/
public static void oneEncrypt(CeqReportLogBo object){
object.setSignCode(QueryEncryptImplUtil.loancardCodeEncrypt(object.getSignCode()));
}
public static void oneEncrypt(CeqApproveBo object){
object.setSignCode(QueryEncryptImplUtil.loancardCodeEncrypt(object.getSignCode()));
}
public static void oneEncrypt(CeqAuthorizeManagerBo object){
object.setSignCode(QueryEncryptImplUtil.loancardCodeEncrypt(object.getSignCode()));
}
public static void oneEncrypt(CeqQueryRecordBo object){
object.setSignCode(QueryEncryptImplUtil.loancardCodeEncrypt(object.getSignCode()));
}
}
| [
"kong_glb@gmail.com"
] | kong_glb@gmail.com |
bdecb5d739877ee873ac8b9c3c30393990fd98e1 | feeefcf3f1d28bdc56b0375e95305951e8ec3529 | /app/src/main/java/com/agraeta/user/btl/CustomPagerAdapter.java | 5f9d729aa433c4daacbd8af38725073bfbbc549e | [] | no_license | chintan369/MyBTL | 22a117d3b82072bfd189a2f83b7f4b49aa30e6c1 | 3681ced83986a4b18052d4f4ef586d1f8858c617 | refs/heads/master | 2021-05-23T05:25:12.143900 | 2018-03-03T05:28:54 | 2018-03-03T05:28:54 | 95,187,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,348 | java | package com.agraeta.user.btl;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Environment;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
class CustomPagerAdapter extends PagerAdapter {
Context mContext;
LayoutInflater mLayoutInflater;
ImageLoader imageloader;
ArrayList<String> array_image;
Activity activity;
AppPrefs appPrefs;
String productCode = "";
String productName = "";
boolean withoutFiles = false;
LayoutInflater inflater;
public CustomPagerAdapter() {
}
public CustomPagerAdapter(Context context, ArrayList<String> array_image, Activity activity) {
mContext = context;
mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageloader = new ImageLoader(context);
this.activity = activity;
this.array_image = array_image;
inflater = activity.getLayoutInflater();
}
public CustomPagerAdapter(Context context, ArrayList<String> array_image, Activity activity, boolean withoutFiles) {
mContext = context;
mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageloader = new ImageLoader(context);
this.activity = activity;
this.array_image = array_image;
this.withoutFiles = withoutFiles;
inflater = activity.getLayoutInflater();
}
public void setCodeAndName(String productCode, String productName) {
this.productCode = productCode;
this.productName = productName;
}
@Override
public int getCount() {
return array_image.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, final int position) {
LinearLayout layout_full = (LinearLayout) inflater.inflate(R.layout.layout_full_image_with_share_option, null);
ImageView img_share = (ImageView) layout_full.findViewById(R.id.img_share);
final TouchImageView img_full = (TouchImageView) layout_full.findViewById(R.id.img_full);
Picasso.with(mContext)
.load(withoutFiles ? Globals.server_link + array_image.get(position) : Globals.server_link + "files/" + array_image.get(position))
.placeholder(R.drawable.btl_watermark)
.into(img_full);
container.addView(layout_full, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
img_share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Picasso.with(mContext)
.load(withoutFiles ? Globals.server_link + array_image.get(position) : Globals.server_link + "files/" + array_image.get(position))
.into(new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
String filePath = "";
try {
File rootFile = new File(Environment.getExternalStorageDirectory() + "/BTL/Gallery");
if (rootFile.exists()) rootFile.delete();
rootFile.mkdir();
File imagePath = new File(rootFile + File.separator + productCode + "_" + productName + "_" + position + ".jpg");
if (imagePath.exists()) imagePath.delete();
imagePath.createNewFile();
//fileName = filePath+File.separator+fileName;
OutputStream ostream = new FileOutputStream(imagePath);
filePath = imagePath.getAbsolutePath();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, ostream);
ostream.flush();
ostream.close();
} catch (Exception e) {
e.printStackTrace();
}
//Log.e("File Path","--> "+filePath);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/*");
//share.setAction(Intent.ACTION_SEND_MULTIPLE);
share.putExtra(Intent.EXTRA_SUBJECT, "" + productCode + "(" + productName + ")");
share.putExtra(Intent.EXTRA_TEXT, "Item Code : " + "(" + productCode + ")" + "\nItem Name : " + productName);
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(filePath)));
activity.startActivity(Intent.createChooser(share, "Share via"));
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
Globals.Toast2(mContext, "Failed to Save Image");
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
});
/*img_full.setDrawingCacheEnabled(true);
img_full.destroyDrawingCache();
img_full.buildDrawingCache();
Bitmap bitmap = img_full.getDrawingCache();*/
}
});
/* img.setOnTouchListener(new OnSwipeTouchListener(activity) {
public void onSwipeTop() {
Toast.makeText(activity, "top", Toast.LENGTH_SHORT).show();
}
public void onSwipeRight() {
Toast.makeText(activity, "right", Toast.LENGTH_SHORT).show();
}
public void onSwipeLeft() {
Toast.makeText(activity, "left", Toast.LENGTH_SHORT).show();
}
public void onSwipeBottom() {
Toast.makeText(activity, "bottom", Toast.LENGTH_SHORT).show();
}
});*/
return layout_full;
}
/* @Override
public void destroyItem(ViewGroup container, int position, Object object) {
((ViewPager) container).removeView((View) object);
}*/
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
@Override
public void startUpdate(ViewGroup container) {
super.startUpdate(container);
}
} | [
"chintak369@gmail.com"
] | chintak369@gmail.com |
1b774a46805b45378a9a0fe4df204e16524cae4d | 518ec091768d19f1ee8862a7e96fc6a0848ff02a | /fragmentation/src/main/java/me/yokeyword/fragmentation/SupportActivity.java | 9759dccaa74331b389582c6c1562f605d0f0204a | [] | no_license | CxmyDev/Fragmentation | df8c5e56691a4b5b34c2d9594fd1a74da26c98f8 | 8ff14754109cdacda9e6ab7849fc57c38cecd31e | refs/heads/master | 2021-06-17T03:35:57.853721 | 2016-05-17T03:48:29 | 2016-05-17T03:48:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,248 | java | package me.yokeyword.fragmentation;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.ViewGroup;
import java.util.List;
import me.yokeyword.fragmentation.anim.DefaultVerticalAnimator;
import me.yokeyword.fragmentation.anim.FragmentAnimator;
import me.yokeyword.fragmentation.helper.FragmentRecord;
import me.yokeyword.fragmentation.helper.HierarchyViewContainer;
/**
* Created by YoKeyword on 16/1/22.
*/
public abstract class SupportActivity extends AppCompatActivity {
private Fragmentation mFragmentation;
private FragmentAnimator mFragmentAnimator;
boolean mPopMulitpleNoAnim = false;
private Handler mHandler;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFragmentation = getFragmentation();
mFragmentAnimator = onCreateFragmentAnimator();
onHandleSaveInstancState(savedInstanceState);
}
protected void onHandleSaveInstancState(Bundle savedInstanceState) {
if (savedInstanceState != null) {
List<Fragment> fragments = getSupportFragmentManager().getFragments();
if (fragments != null && fragments.size() > 0) {
boolean showFlag = false;
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
for (int i = fragments.size() - 1; i >= 0; i--) {
Fragment fragment = fragments.get(i);
if (fragment != null) {
if (!showFlag) {
ft.show(fragments.get(i));
showFlag = true;
} else {
ft.hide(fragments.get(i));
}
}
}
ft.commit();
}
}
}
/**
* 创建全局Fragment的切换动画
*
* @return
*/
protected FragmentAnimator onCreateFragmentAnimator() {
return new DefaultVerticalAnimator();
}
/**
* Set Container's id
*/
protected abstract int setContainerId();
Fragmentation getFragmentation() {
if (mFragmentation == null) {
mFragmentation = new Fragmentation(this, setContainerId());
}
return mFragmentation;
}
Handler getHandler() {
if (mHandler == null) {
mHandler = new Handler();
}
return mHandler;
}
/**
* 获取设置的全局动画
*
* @return
*/
public FragmentAnimator getFragmentAnimator() {
return new FragmentAnimator(
mFragmentAnimator.getEnter(), mFragmentAnimator.getExit(),
mFragmentAnimator.getPopEnter(), mFragmentAnimator.getPopExit()
);
}
/**
* 设置全局动画
*
* @param fragmentAnimator
*/
public void setFragmentAnimator(FragmentAnimator fragmentAnimator) {
this.mFragmentAnimator = fragmentAnimator;
}
@Override
public void onBackPressed() {
SupportFragment topFragment = getTopFragment();
if (topFragment != null) {
boolean result = topFragment.onBackPressedSupport();
if (result) {
return;
}
}
if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
mFragmentation.back(getSupportFragmentManager());
} else {
finish();
}
}
/**
* 得到位于栈顶Fragment
*
* @return
*/
public SupportFragment getTopFragment() {
return mFragmentation.getTopFragment(getSupportFragmentManager());
}
/**
* 获取栈内的framgent对象
*
* @param fragmentClass
*/
public <T extends SupportFragment> T findFragment(Class<T> fragmentClass) {
return mFragmentation.findStackFragment(fragmentClass, getSupportFragmentManager(), false);
}
/**
* 出栈
*/
public void pop() {
mFragmentation.back(getSupportFragmentManager());
}
/**
* 出栈到目标fragment
*
* @param fragmentClass 目标fragment
* @param includeSelf 是否包含该fragment
*/
public void popTo(Class<?> fragmentClass, boolean includeSelf) {
mFragmentation.popTo(fragmentClass, includeSelf, null, getSupportFragmentManager());
}
/**
* 用于出栈后,立刻进行FragmentTransaction操作
*/
public void popTo(Class<?> fragmentClass, boolean includeSelf, Runnable afterPopTransactionRunnable) {
mFragmentation.popTo(fragmentClass, includeSelf, afterPopTransactionRunnable, getSupportFragmentManager());
}
public void start(SupportFragment toFragment) {
start(toFragment, SupportFragment.STANDARD);
}
public void start(SupportFragment toFragment, @SupportFragment.LaunchMode int launchMode) {
mFragmentation.dispatchStartTransaction(getTopFragment(), toFragment, 0, launchMode, Fragmentation.TYPE_ADD);
}
public void startForResult(SupportFragment to, int requestCode) {
mFragmentation.dispatchStartTransaction(getTopFragment(), to, requestCode, SupportFragment.STANDARD, Fragmentation.TYPE_ADD);
}
public void startWithFinish(SupportFragment to) {
mFragmentation.dispatchStartTransaction(getTopFragment(), to, 0, SupportFragment.STANDARD, Fragmentation.TYPE_ADD_FINISH);
}
void preparePopMultiple() {
mPopMulitpleNoAnim = true;
}
void popFinish() {
mPopMulitpleNoAnim = false;
}
/**
* 显示栈视图,调试时使用
*/
public void showFragmentStackHierarchyView() {
HierarchyViewContainer container = new HierarchyViewContainer(this);
container.bindFragmentRecords(mFragmentation.getFragmentRecords());
container.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
new AlertDialog.Builder(this)
.setTitle("栈视图")
.setView(container)
.setPositiveButton("关闭", null)
.setCancelable(true)
.show();
}
/**
* 显示栈视图 日志 ,调试时使用
*/
public void logFragmentStackHierarchy(String TAG) {
List<FragmentRecord> fragmentRecordList = mFragmentation.getFragmentRecords();
if (fragmentRecordList == null) return;
StringBuilder sb = new StringBuilder();
for (int i = fragmentRecordList.size() - 1; i >= 0; i--) {
FragmentRecord fragmentRecord = fragmentRecordList.get(i);
if (i == fragmentRecordList.size() - 1) {
sb.append("═══════════════════════════════════════════════════════════════════════════════════\n");
if (i == 0) {
sb.append("\t栈顶\t\t\t" + fragmentRecord.fragmentName + "\n");
sb.append("═══════════════════════════════════════════════════════════════════════════════════");
}else{
sb.append("\t栈顶\t\t\t" + fragmentRecord.fragmentName + "\n\n");
}
} else if (i == 0) {
sb.append("\t栈底\t\t\t" + fragmentRecord.fragmentName + "\n");
sb.append("═══════════════════════════════════════════════════════════════════════════════════");
} else {
sb.append("\t↓\t\t\t" + fragmentRecord.fragmentName + "\n\n");
}
processChildLog(fragmentRecord.childFragmentRecord, sb);
}
Log.i(TAG, sb.toString());
}
private void processChildLog(List<FragmentRecord> fragmentRecordList, StringBuilder sb) {
if (fragmentRecordList == null || fragmentRecordList.size() == 0) return;
for (int j = 0; j < fragmentRecordList.size(); j++) {
FragmentRecord childFragmentRecord = fragmentRecordList.get(j);
if (j == 0) {
sb.append("\t \t\t\t\t子栈顶\t\t\t" + childFragmentRecord.fragmentName + "\n\n");
} else if (j == fragmentRecordList.size() - 1) {
sb.append("\t \t\t\t\t子栈底\t\t\t" + childFragmentRecord.fragmentName + "\n\n");
} else {
sb.append("\t \t\t\t\t↓\t\t\t\t" + childFragmentRecord.fragmentName + "\n\n");
}
processChildLog(childFragmentRecord.childFragmentRecord, sb);
}
}
}
| [
"328903522@qq.com"
] | 328903522@qq.com |
7ccfae554f2797cacc65fd688cf200432e5a3e36 | 64fa951d13f33be9c7a248ba140d519290611a0e | /code-examples/com.google.common.base.Preconditions.checkNotNull5.java | f3ce2f23b0c2b1501ae14254bad4269ee8d7b95e | [] | no_license | andrehora/jss-code-examples | 1ee99d7be0a998284f44ecc7c033fdf12c9c01a8 | ae98f124e1f15411f8a97d410920c05d6f1b1cea | refs/heads/main | 2023-03-25T12:45:42.691780 | 2021-03-25T13:25:51 | 2021-03-25T13:25:51 | 312,898,657 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 169 | java | public void testCheckNotNull_simple_failure() {
try {
Preconditions.checkNotNull(null);
fail("no exception thrown");
} catch (NullPointerException expected) {
}
} | [
"andrehoraa@gmail.com"
] | andrehoraa@gmail.com |
094360c4d4863ede7635183a3cda6aff441bdffc | 9a0d590078653ecb37a7bdfcbeefd1396d0ceb3c | /Inference/src/inference/Inference.java | b24d9c7a26328317f988bb67bfd717bac1027f43 | [] | no_license | Ashvant/AI---First-Order-Logic---Inference-engine---Resolution- | 9dee69f498b6c3d54c99f8aef919d38d0a2df826 | 86cce6d00ad19a1b16bb1df94276018b3bad210b | refs/heads/master | 2021-04-28T11:02:10.161204 | 2018-02-19T15:24:08 | 2018-02-19T15:24:08 | 122,081,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,542 | 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 inference;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
/**
*
* @author ashvant
*/
public class Inference {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws FileNotFoundException, IOException {
String filename="input.txt";
FileReader fr = new FileReader(filename);
BufferedReader br = new BufferedReader(fr);
String sCurrentLine;
int lineNumber = 0;
int queryCount=0;
int kbCount = 0;
Integer number = 0;
KB kbase = new KB();
HashMap<String,List<Integer>> predicateMap = new HashMap<String,List<Integer>>();
Queries queries = new Queries();
ArrayList<String> QueryList = new ArrayList<String>();
ArrayList<String> KBList = new ArrayList<String>();
while ((sCurrentLine = br.readLine()) != null)
{
if(lineNumber==0){
queryCount = Integer.parseInt(sCurrentLine);
}
if(lineNumber>0 && lineNumber <queryCount+1 ){
String currentLine = sCurrentLine.replaceAll("\\s+","");
// System.out.println(currentLine);
QueryList.add(currentLine);
parseQuery(currentLine,queries);
}
if(lineNumber == queryCount+1){
kbCount = Integer.parseInt(sCurrentLine);
}
if(lineNumber>queryCount+1){
String currentLine = sCurrentLine.replaceAll("\\s+","");
// System.out.println(currentLine);
KBList.add(currentLine);
parseSentence(currentLine,kbase,number++);
}
lineNumber++;
}
ArrayList<Boolean> outputList = new ArrayList<Boolean>();
for(int j=0;j<queries.sentenceList.size();j++){
Boolean output = resolveQueries(kbase,queries.sentenceList.get(j));
outputList.add(output);
System.out.println(output);
}
printResult(outputList);
}
private static void printResult(ArrayList<Boolean> outputList){
Writer writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream("output.txt"), "utf-8"));
for(int i=0;i<outputList.size();i++){
writer.write(outputList.get(i).toString().toUpperCase());
writer.write("\n");
}
} catch (IOException ex) {
// report
} finally {
try {writer.close();} catch (Exception ex) {/*ignore*/}
}
}
static boolean resolveQueries(KB kbase,Sentences querySentence){
KB newKB = new KB();
for(int i=0;i<kbase.sentenceList.size();i++){
newKB.copytoKB(kbase.sentenceList.get(i));
}
Sentences negatedQuery = querySentence;
if(negatedQuery.clauseList.get(0).isNegated){
negatedQuery.clauseList.get(0).isNegated = false;
}else{
negatedQuery.clauseList.get(0).isNegated = true;
}
newKB.AddtoKB(negatedQuery);
int repeat = 0;
HashMap<String,List<Integer>> predicateMap = createPredicateMap(newKB);
HashSet<Sentences> fullSet = new HashSet<Sentences>();
while(true){
repeat = 0;
int start = 0;
HashSet<Sentences> newSentences = new HashSet<Sentences>();
predicateMap = createPredicateMap(newKB);
for(int a=0;a<newKB.sentenceList.size();a++){
Sentences sentence1 = newKB.sentenceList.get(a);
for(int b=start+1;b<newKB.sentenceList.size();b++){
Sentences sentence2 = newKB.sentenceList.get(b);
boolean flag = false;
for(int c=0;c<sentence1.clauseList.size();c++){
if(predicateMap.get(sentence1.clauseList.get(c).predicate).contains(b)){
flag =true;
}
}
if(flag){
flag = false;
Sentences resolvent = resolve(sentence1,sentence2);
if(resolvent==null){
return true;
}
if(!resolvent.clauseList.isEmpty() && !checkRedundancy(resolvent,fullSet)) {
fullSet.add(resolvent);
repeat--;
newSentences.add(resolvent);
}
}
}
}
start = newKB.sentenceList.size()-1;
// System.out.println(start);
// System.out.println(newSentences.size());
if(fullSet.size()>1000){
return false;
}else if(repeat == 0){
return false;
}
Iterator<Sentences> it = newSentences.iterator();
while(it.hasNext()){
Sentences temp = it.next();
newKB.AddtoKB(temp);
}
}
}
static boolean checkRedundancy(Sentences resolvent,HashSet<Sentences> newSentences){
Iterator<Sentences> it = newSentences.iterator();
while(it.hasNext()){
Sentences temp = it.next();
if(temp.clauseList.size() == resolvent.clauseList.size()){
for(int i=0;i<temp.clauseList.size();i++){
boolean x = (temp.clauseList.get(i).predicate.equals(resolvent.clauseList.get(i).predicate));
boolean y = (temp.clauseList.get(i).isNegated == resolvent.clauseList.get(i).isNegated);
boolean z = (temp.clauseList.get(i).arguments.equals(resolvent.clauseList.get(i).arguments));
if(x&&y&&z){
return true;
}
}
}
}
return false;
}
static Sentences resolve(Sentences sentence1,Sentences sentence2){
Sentences newSentence = new Sentences();
for(int i=0;i<sentence1.clauseList.size();i++){
Clauses clause1 = sentence1.clauseList.get(i);
for(int j=0;j<sentence2.clauseList.size();j++){
Clauses clause2 = sentence2.clauseList.get(j);
HashMap<String,String> substitution = new HashMap<String,String>();
if(clause1.predicate.equals(clause2.predicate)&&clause1.isNegated!=clause2.isNegated){
substitution = unification((List)clause1.arguments,(List)clause2.arguments,substitution);
if(substitution != null){
Sentences subSentence1 = new Sentences();
Sentences subSentence2 = new Sentences();
for(int k=0;k<sentence1.clauseList.size();k++){
subSentence1.AddtoSentence(sentence1.clauseList.get(k));
}
for(int k=0;k<sentence2.clauseList.size();k++){
subSentence2.AddtoSentence(sentence2.clauseList.get(k));
}
applySubstitution(substitution,subSentence1);
applySubstitution(substitution,subSentence2);
subSentence1.clauseList.remove(i);
subSentence2.clauseList.remove(j);
for(int k=0;k<subSentence1.clauseList.size();k++){
newSentence.AddtoSentence(subSentence1.clauseList.get(k));
}
for(int k=0;k<subSentence2.clauseList.size();k++){
newSentence.AddtoSentence(subSentence2.clauseList.get(k));
}
if(newSentence.clauseList.isEmpty()){
return null;
}else{
Sentences resolvent = factorSentence(newSentence);
return resolvent;
}
}
}
}
}
return newSentence;
}
static Sentences factorSentence(Sentences newSentence){
for(int i=0;i<newSentence.clauseList.size();i++){
Clauses clause1 = newSentence.clauseList.get(i);
for(int j=i+1;j<newSentence.clauseList.size();j++){
Clauses clause2 = newSentence.clauseList.get(j);
HashMap<String,String> substitution = new HashMap<String,String>();
if(clause1.predicate.equals(clause2.predicate) && clause1.isNegated == clause2.isNegated){
substitution = unification((List)clause1.arguments,(List)clause2.arguments,substitution);
if(substitution != null){
Sentences subSentence1 = new Sentences();
for(int k=0;k<newSentence.clauseList.size();k++){
subSentence1.AddtoSentence(newSentence.clauseList.get(k));
}
applySubstitution(substitution,subSentence1);
subSentence1.clauseList.remove(i);
return subSentence1;
}
}
}
}
return newSentence;
}
static void applySubstitution(HashMap<String,String> substitution,Sentences sentence1){
for(int i=0;i<sentence1.clauseList.size();i++){
Clauses clause1 = sentence1.clauseList.get(i);
for(int j=0;j<clause1.arguments.size();j++){
if(substitution.containsKey(clause1.arguments.get(j))){
sentence1.clauseList.get(i).arguments.set(j, substitution.get(clause1.arguments.get(j)));
}
}
}
}
static HashMap<String,String> unification(List<String> arg1,List<String> arg2,HashMap<String,String> substitution){
if(substitution == null){
return null;
}else if(arg1.size()!=arg2.size()){
return null;
}else if(arg1.isEmpty() && arg2.isEmpty()){
return substitution;
}else if(arg1.size() ==1 && arg2.size()==1){
return unification(arg1.get(0),arg2.get(0),substitution);
}else{
return unification(arg1.subList(1,arg1.size()),arg2.subList(1, arg2.size()),unification(arg1.get(0),arg2.get(0),substitution));
}
}
static HashMap<String,String> unification(String arg1,String arg2,HashMap<String,String> substitution){
if(substitution == null){
return null;
}else if(arg1.equals(arg2)){
return substitution;
}else if(isVariable(arg1)){
return unificationVariables(arg1,arg2,substitution);
}else if(isVariable(arg2)){
return unificationVariables(arg2,arg1,substitution);
}else{
return null;
}
}
static HashMap<String,String> unificationVariables(String arg1,String arg2,HashMap<String,String> substitution){
if(substitution.containsKey(arg1)){
return unification(substitution.get(arg1),arg2,substitution);
}else if(substitution.containsKey(arg2)){
return unification(arg1,substitution.get(arg2),substitution);
}else{
HashMap<String,String> theta = new HashMap<String,String>();
theta = deepCopy(substitution);
theta.put(arg1, arg2);
return theta;
}
}
public static HashMap<String,String> deepCopy(HashMap<String,String> original){
HashMap<String,String> copy = new HashMap<String,String>();
for(Entry<String,String> entry : original.entrySet()){
copy.put(entry.getKey(),entry.getValue());
}
return copy;
}
static boolean isVariable(String arg1){
if(arg1.charAt(0)>=65 && arg1.charAt(0)<=90){
return false;
}else{
return true;
}
}
static HashMap<String,List<Integer>> createPredicateMap(KB kbase){
HashMap<String,List<Integer>> predicateMap = new HashMap<String,List<Integer>>();
for(int i=0;i<kbase.sentenceList.size();i++){
for(int j=0;j<kbase.sentenceList.get(i).clauseList.size();j++){
if(predicateMap.get(kbase.sentenceList.get(i).clauseList.get(j).predicate)!=null){
predicateMap.get(kbase.sentenceList.get(i).clauseList.get(j).predicate).add(i);
}else{
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(i);
predicateMap.put(kbase.sentenceList.get(i).clauseList.get(j).predicate,list);
}
}
}
/*Set<String> hset = predicateMap.keySet();
Iterator<String> it = hset.iterator();
while(it.hasNext()){
String temp = it.next();
System.out.println(temp);
System.out.println(predicateMap.get(temp));
}*/
return predicateMap;
}
static void parseSentence(String sentence,KB kbase,Integer number){
Sentences sent = new Sentences();
String[] clauses = sentence.split("\\|");
int i=0;
boolean isNegative;
while(i<clauses.length){
if(clauses[i].charAt(0)=='~'){
isNegative = true;
String remaining = clauses[i].substring(1);
String[] predicateSplit = remaining.split("\\(");
String predicate = predicateSplit[0];
remaining = predicateSplit[1].replaceAll("\\)","");
String[] arguments = remaining.split("\\,");
ArrayList<String> argList = new ArrayList<String>();
int j=0;
while(j<arguments.length){
if(isVariable(arguments[j])){
argList.add(arguments[j]+number.toString());
}else{
argList.add(arguments[j]);
}
j++;
}
i++;
Clauses clause = new Clauses(predicate,argList,isNegative);
sent.AddtoSentence(clause);
} else {
isNegative = false;
String remaining = clauses[i].substring(0);
String[] predicateSplit = remaining.split("\\(");
String predicate = predicateSplit[0];
remaining = predicateSplit[1].replaceAll("\\)","");
String[] arguments = remaining.split("\\,");
ArrayList<String> argList = new ArrayList<String>();
int j=0;
while(j<arguments.length){
if(isVariable(arguments[j])){
argList.add(arguments[j]+number.toString());
}else{
argList.add(arguments[j]);
}
j++;
}
i++;
Clauses clause = new Clauses(predicate,argList,isNegative);
sent.AddtoSentence(clause);
}
}
kbase.AddtoKB(sent);
}
static void parseQuery(String sentence,Queries queries){
Sentences sent = new Sentences();
String[] clauses = sentence.split("\\|");
int i=0;
boolean isNegative;
while(i<clauses.length){
if(clauses[i].charAt(0)=='~'){
isNegative = true;
String remaining = clauses[i].substring(1);
String[] predicateSplit = remaining.split("\\(");
String predicate = predicateSplit[0];
remaining = predicateSplit[1].replaceAll("\\)","");
String[] arguments = remaining.split("\\,");
ArrayList<String> argList = new ArrayList<String>();
int j=0;
while(j<arguments.length){
argList.add(arguments[j]);
j++;
}
i++;
Clauses clause = new Clauses(predicate,argList,isNegative);
sent.AddtoSentence(clause);
} else {
isNegative = false;
String remaining = clauses[i].substring(0);
String[] predicateSplit = remaining.split("\\(");
String predicate = predicateSplit[0];
remaining = predicateSplit[1].replaceAll("\\)","");
String[] arguments = remaining.split("\\,");
ArrayList<String> argList = new ArrayList<String>();
int j=0;
while(j<arguments.length){
argList.add(arguments[j]);
j++;
}
i++;
Clauses clause = new Clauses(predicate,argList,isNegative);
sent.AddtoSentence(clause);
}
}
queries.AddtoKB(sent);
}
}
class KB{
ArrayList<Sentences> sentenceList = new ArrayList<Sentences>();
void AddtoKB(Sentences Sentence){
sentenceList.add(Sentence);
}
void copytoKB(Sentences Sentence){
Sentences sentence = new Sentences();
for(int i=0;i<Sentence.clauseList.size();i++){
// Clauses cobj = new Clauses(Sentence.clauseList.get(i).predicate,Sentence.clauseList.get(i).arguments,Sentence.clauseList.get(i).isNegated);
sentence.AddtoSentence(Sentence.clauseList.get(i));
}
AddtoKB(sentence);
}
}
class Sentences{
ArrayList<Clauses> clauseList;
Sentences(){
clauseList = new ArrayList<Clauses>();
}
void AddtoSentence(Clauses clause){
Clauses cobj = new Clauses(clause.predicate,clause.arguments,clause.isNegated);
clauseList.add(cobj);
}
}
class Clauses{
String predicate = null;
ArrayList<String> arguments = new ArrayList<String>();
boolean isNegated = false;
Clauses(){
String predicate = null;
ArrayList<String> arguments = new ArrayList<String>();
boolean isNegated = false;
}
Clauses(String thispredicate,ArrayList<String> thisarguments,boolean thisisNegated){
predicate = thispredicate;
for(int i=0;i<thisarguments.size();i++){
String a = thisarguments.get(i);
arguments.add(a);
}
isNegated = thisisNegated;
}
}
class Queries{
ArrayList<Sentences> sentenceList = new ArrayList<Sentences>();
void AddtoKB(Sentences Sentence){
sentenceList.add(Sentence);
}
} | [
"aselvam@github.com"
] | aselvam@github.com |
c300129dde055dafd0a1babac00d24b10928a411 | a8a79ad0cf77875b9b75e2a5f78474c8812b8e8f | /src/main/java/org/converter/repository/ConversionHistoryRepository.java | b068c7cc12e751167a9e107fcf978a081b3f732e | [] | no_license | sedavnikh/CurrencyConverter | f64418a7f07700b82072881a6b996b4dbc117d01 | abdce91fc7282689007e6a0770ab18216977c7d7 | refs/heads/master | 2021-01-10T23:08:03.274346 | 2016-10-11T22:57:32 | 2016-10-11T22:57:32 | 70,642,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package org.converter.repository;
import org.converter.domain.ConversionHistory;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface ConversionHistoryRepository extends CrudRepository<ConversionHistory, Long> {
List<ConversionHistory> findTop10ByUserIdOrderByTimestampDesc(Long userId);
}
| [
"stanislav.siedavnykh@benify.com"
] | stanislav.siedavnykh@benify.com |
f1774cf50e7219876861ba0914487d9c01c3c3dd | 29f508e730f2794341593ad18cf352990888c067 | /src/org/omg/CORBA/LongSeqHelper.java | 11bffe62bd3ff45c2feabb971b4f13b087095a7c | [] | no_license | nhchanh/jdk1.6.0_21 | daf40144acd19d92d15561235038e6e0343f8dec | cdcaafc11122944545c51efc49bb9f884b1ad0d1 | refs/heads/master | 2021-01-10T19:05:13.011208 | 2014-01-07T23:10:19 | 2014-01-07T23:10:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,380 | java | /*
* @(#)LongSeqHelper.java 1.15 10/03/23
*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package org.omg.CORBA;
/**
* The Helper for <tt>LongSeqHelper</tt>. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/LongSeqHelper.java
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from streams.idl
* 13 May 1999 22:41:36 o'clock GMT+00:00
*
* The class definition has been modified to conform to the following
* OMG specifications :
* <ul>
* <li> ORB core as defined by CORBA 2.3.1
* (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
* </li>
*
* <li> IDL/Java Language Mapping as defined in
* <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
* </li>
* </ul>
*/
public abstract class LongSeqHelper
{
private static String _id = "IDL:omg.org/CORBA/LongSeq:1.0";
public static void insert (org.omg.CORBA.Any a, int[] that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static int[] extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
__typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
__typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.LongSeqHelper.id (), "LongSeq", __typeCode);
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static int[] read (org.omg.CORBA.portable.InputStream istream)
{
int value[] = null;
int _len0 = istream.read_long ();
value = new int[_len0];
istream.read_long_array (value, 0, _len0);
return value;
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, int[] value)
{
ostream.write_long (value.length);
ostream.write_long_array (value, 0, value.length);
}
}
| [
"chanh.nguyen@verint.com"
] | chanh.nguyen@verint.com |
eefbb18657c7ad87cf29ae6e2047647902ea6f9d | a15a7eb59a5ad4ae00c41aeab20af248a6bab5f5 | /CodeManager/app/src/main/java/com/lizhaoxuan/codemanager/bitmap/ImageUtil.java | 1bd081918193848ea45e4099933d8f8ad1f0be7a | [] | no_license | lizhaoxuan/CodeManager | 0fb652115f6877e8f23924df144c5ca2a1f6d733 | f7beb4f07f0afea098ae5b691223c6888003f4b4 | refs/heads/master | 2021-01-10T08:15:44.293983 | 2016-03-07T17:17:24 | 2016-03-07T17:17:24 | 52,154,510 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,740 | java | package com.lizhaoxuan.codemanager.bitmap;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
/**
* 图片工具类
*/
public class ImageUtil {
private static final String TAG = ImageUtil.class.getSimpleName();
/**
* 储存bitmap到文件
* @param imgFile 保存图片的文件路径
* @param imgBm 图片对象
* @param compress 压缩值(0-100)
* @return 失败返回false
*/
public static boolean saveBitmapJPG(File imgFile, Bitmap imgBm, int compress) {
if (null == imgFile || null == imgBm) {
return false;
}
if (imgFile.exists()) {
imgFile.delete();
} else {
try {
imgFile.createNewFile();
} catch (IOException e) {
Log.e(TAG, "", e);
} catch (Exception e) {
// TODO Auto-generated catch block
Log.e(TAG, "", e);
}
}
try {
FileOutputStream out = new FileOutputStream(imgFile);
imgBm.compress(Bitmap.CompressFormat.JPEG, compress, out);
out.flush();
out.close();
return true;
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
Log.e(TAG, "", e);
} catch (IOException e) {
// TODO Auto-generated catch block
Log.e(TAG, "", e);
} catch (Exception e) {
// TODO Auto-generated catch block
Log.e(TAG, "", e);
}
return false;
}
/**
* 压缩图片宽高
*
* @param file 图片文件
* @param reqWidth 要求的最大宽度
* @param reqHeight 要求的最大高度
* @return 失败返回null
*/
public static Bitmap compressBitmapSize(File file, int reqWidth,
int reqHeight) {
if (null == file) {
return null;
}
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
options.inSampleSize = calculateInSampleSize(options, reqWidth,
reqHeight);
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(file.getAbsolutePath(), options);
}
/**
* 计算缩放的尺寸
*
* @param options
* @param reqWidth
* @param reqHeight
* @return 返回缩放值
*/
private static int calculateInSampleSize(BitmapFactory.Options options,
int reqWidth, int reqHeight) {
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
final int halfHeight = height;
final int halfWidth = width;
while ((halfHeight / inSampleSize) > reqHeight
&& (halfWidth / inSampleSize) > reqWidth) {
inSampleSize *= 2;
}
}
return inSampleSize;
}
/**
* 质量图片压缩 支持JPEG
*
* @param image 图片对象
* @param maxSize
* 最大尺寸
* @return 缩小比例,负数代表错误
*/
public static int compressImageQuality(Bitmap image, int maxSize) {
if (null == image) {
return -1;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, baos);// 质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中
int options = 100;
while (baos.toByteArray().length / 1024 > 100) { // 循环判断如果压缩后图片是否大于100kb,大于继续压缩
baos.reset();// 重置baos即清空baos
image.compress(Bitmap.CompressFormat.JPEG, options, baos);// 这里压缩options%,把压缩后的数据存放到baos中
options -= 10;// 每次都减少10
}
return options;
}
}
| [
"690770333@qq.com"
] | 690770333@qq.com |
c46001e14d2629e36641b8a06721de8ddb9b2a77 | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/com/avito/android/profile/password_setting/PasswordSettingInteractor.java | 8bfc161528d85b52295f6f7d97c4089772a1b1c0 | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package com.avito.android.profile.password_setting;
import com.avito.android.remote.model.password.PasswordChangeResult;
import com.avito.android.util.LoadingState;
import com.avito.android.util.preferences.Preference;
import io.reactivex.Observable;
import kotlin.Metadata;
import org.jetbrains.annotations.NotNull;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\bf\u0018\u00002\u00020\u0001J#\u0010\u0007\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00060\u00050\u00042\u0006\u0010\u0003\u001a\u00020\u0002H&¢\u0006\u0004\b\u0007\u0010\b¨\u0006\t"}, d2 = {"Lcom/avito/android/profile/password_setting/PasswordSettingInteractor;", "", "", Preference.PASSWORD, "Lio/reactivex/Observable;", "Lcom/avito/android/util/LoadingState;", "Lcom/avito/android/remote/model/password/PasswordChangeResult;", "setPassword", "(Ljava/lang/String;)Lio/reactivex/Observable;", "profile_release"}, k = 1, mv = {1, 4, 2})
public interface PasswordSettingInteractor {
@NotNull
Observable<LoadingState<PasswordChangeResult>> setPassword(@NotNull String str);
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
707d838257a50272d3111a58f9c6ca2f535c2696 | f729e847980b34ae04e21d5b0433b41c7b7c546a | /继承/exer/Person.java | d50c03f4d6dbb432d3706f93e3a4ca8017b0b77e | [] | no_license | diluo5261/code_test | 2413e61daa2dc17196fc7e277d9082ee9842043a | 7721d66425fec13b6031bca286f1824555999330 | refs/heads/main | 2023-06-11T04:24:45.538889 | 2021-07-10T15:53:25 | 2021-07-10T15:53:25 | 332,112,591 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46 | java | package day12.exer;
public class Person {
}
| [
"343917586@qq.com"
] | 343917586@qq.com |
f7c3a6d59045421fe88b4540b5a996753d6f9633 | 85f573af305c07112cf3296c4c9e26935b0350ad | /app/src/main/java/com/haoyigou/hyg/fragment/ShoppingCartFragment.java | 31a2f0fac36394b835671f19d31f3f32ef6598bb | [] | no_license | wuliang6661/Turuk | 0cc8c483c4a8cb536874e7025437042dcbb00a11 | 4e3a4c0562f0f0f2e7bf9fd47166541550959d62 | refs/heads/main | 2023-07-20T17:58:56.764287 | 2021-09-03T14:26:18 | 2021-09-03T14:26:18 | 402,777,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,168 | java | package com.haoyigou.hyg.fragment;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.bumptech.glide.Glide;
import com.haoyigou.hyg.R;
import com.haoyigou.hyg.adapter.ShopCarAdapter;
import com.haoyigou.hyg.application.GlobalApplication;
import com.haoyigou.hyg.base.BaseFragment;
import com.haoyigou.hyg.common.http.AsyncHttpResponseHandler;
import com.haoyigou.hyg.common.http.HttpClient;
import com.haoyigou.hyg.config.StateMessage;
import com.haoyigou.hyg.entity.ExchangeCondition;
import com.haoyigou.hyg.entity.ShopCarBean;
import com.haoyigou.hyg.ui.ExchangeActivity;
import com.haoyigou.hyg.ui.LabelActivity;
import com.haoyigou.hyg.ui.WebviewActivity;
import com.haoyigou.hyg.ui.homeweb.HomeWebViewAct;
import com.haoyigou.hyg.utils.DisplayUtils;
import com.haoyigou.hyg.utils.ProgressUtils;
import com.haoyigou.hyg.utils.StringUtils;
import com.haoyigou.hyg.utils.ToastUtils;
import com.haoyigou.hyg.view.SmartHeader;
import com.haoyigou.hyg.view.textview.DrawableCenterTextView;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* 购物车fragment
*/
public class ShoppingCartFragment extends BaseFragment implements CompoundButton.OnCheckedChangeListener, View.OnClickListener,
SwipeRefreshLayout.OnRefreshListener {
@BindView(R.id.shopcar_list)
ListView shopcarList;
@BindView(R.id.all_radio)
CheckBox allRadio;
@BindView(R.id.summary_button)
Button summaryButton;
@BindView(R.id.all_price)
TextView allPrice;
@BindView(R.id.edit)
TextView edit;
@BindView(R.id.all_text)
TextView allText;
@BindView(R.id.all_layout)
LinearLayout allLayout;
@BindView(R.id.back)
LinearLayout back;
@BindView(R.id.not_layout)
LinearLayout notLayout;
@BindView(R.id.tvActivityOne)
DrawableCenterTextView tvActivityOne;
@BindView(R.id.tvActivityTwo)
DrawableCenterTextView tvActivityTwo;
@BindView(R.id.tvActivityThree)
DrawableCenterTextView tvActivityThree;
@BindView(R.id.ll_activity)
LinearLayout ll_activity;
@BindView(R.id.rlFreeFee)
RelativeLayout rlFreeFee;
@BindView(R.id.txtDescribe)
TextView txtDescribe;
@BindView(R.id.rlGoTo)
RelativeLayout rlGoTo;
@BindView(R.id.refresh_root)
SmartRefreshLayout refreshRoot;
@BindView(R.id.header)
RelativeLayout header;
@BindView(R.id.factoryOneSelect)
RelativeLayout factoryOneSelect;
@BindView(R.id.factoryOneHave)
TextView factoryOneHave;
@BindView(R.id.factoryOneNotSelect)
RelativeLayout factoryOneNotSelect;
@BindView(R.id.factoryTwoSelect)
RelativeLayout factoryTwoSelect;
@BindView(R.id.factoryTwoHave)
TextView factoryTwoHave;
@BindView(R.id.factoryTwoNotSelect)
RelativeLayout factoryTwoNotSelect;
@BindView(R.id.viewFactoryTwo)
View viewFactoryTwo;
@BindView(R.id.rlExchange)
RelativeLayout rlExchange;//换购栏
@BindView(R.id.exchangeDescribe)
TextView exchangeDescribe;//换购描述
@BindView(R.id.rlGoToExchange)
RelativeLayout rlGoToExchange;//去换购按钮
private List<ShopCarBean> shopList; //商品列表
private Map<String, ShopCarBean> checkList; //选中的商品列表
private Map<String, Integer> shopnums; //各商品的实际数量
private ShopCarAdapter adapter; //适配器
private boolean isManual = false; //全选是否是手动代码触发
private boolean isEdit = false; //是否编辑模式
private Integer maxnum; //最大购买量
private List<String> activity;//活动
private String cdurl;//凑单路径
private double minMoney;//包邮最低价格
private int nowFactorySelect = 0;//仓库1: 0 ; 仓库2: 1 ,仓库1默认选中
private String rightPoint = ""; //仓库2是否有数据
private View footView;
private RecyclerView exchangeProductList;//加价购商品列表
private CommonAdapter<ShopCarBean> exchangeProductAdapter;
private ArrayList<ShopCarBean> exchangeProductData = new ArrayList<>();//加价购商品数据
private ExchangeCondition exchangeCondition;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fra_shopping_cart, container, false);
ButterKnife.bind(this, view);
EventBus.getDefault().register(this);
return view;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// setFlgsbg(R.color.white);
// setStatusBar();
allRadio.setOnCheckedChangeListener(this);
summaryButton.setOnClickListener(this);
edit.setOnClickListener(this);
rlGoTo.setOnClickListener(this);
checkList = new HashMap<>();
allLayout.setOnClickListener(this);
// refreshRoot.setNestedScrollingEnabled(false);
// refreshRoot.setOnRefreshListener(new OnRefreshListener() {
// @Override
// public void onRefresh(@NonNull final RefreshLayout refreshLayout) {
// getShopCarData(nowFactorySelect);
// }
// });
// refreshRoot.setRefreshHeader(new SmartHeader(getActivity()));
// refreshRoot.setHeaderHeight(60);
header.setBackgroundDrawable(getResources().getDrawable(R.drawable.change_color));
ViewGroup.LayoutParams params = factoryOneSelect.getLayoutParams();
params.width = (int)(DisplayUtils.getScreenWidth(getActivity()) * 0.2);
params.height = (int)(DisplayUtils.getScreenWidth(getActivity()) * 0.08);
factoryOneSelect.setLayoutParams(params);
ViewGroup.LayoutParams params2 = factoryOneNotSelect.getLayoutParams();
params2.width = (int)(DisplayUtils.getScreenWidth(getActivity()) * 0.2);
params2.height = (int)(DisplayUtils.getScreenWidth(getActivity()) * 0.07);
factoryOneNotSelect.setLayoutParams(params2);
ViewGroup.LayoutParams params3 = factoryTwoSelect.getLayoutParams();
params3.width = (int)(DisplayUtils.getScreenWidth(getActivity()) * 0.2);
params3.height = (int)(DisplayUtils.getScreenWidth(getActivity()) * 0.08);
factoryTwoSelect.setLayoutParams(params3);
ViewGroup.LayoutParams params4 = factoryTwoNotSelect.getLayoutParams();
params4.width = (int)(DisplayUtils.getScreenWidth(getActivity()) * 0.2);
params4.height = (int)(DisplayUtils.getScreenWidth(getActivity()) * 0.07);
factoryTwoNotSelect.setLayoutParams(params4);
//加价购商品
footView = LayoutInflater.from(getActivity()).inflate(R.layout.exchange_foot_layout, null);
exchangeProductList = footView.findViewById(R.id.exchangeProductList);
LinearLayoutManager manager = new LinearLayoutManager(getActivity());
exchangeProductList.setLayoutManager(manager);
shopcarList.addFooterView(footView);
}
/**
* 加价购商品
*/
private void setExchangeProductAdapter() {
if (exchangeProductAdapter != null){
exchangeProductAdapter.notifyDataSetChanged();
return;
}
exchangeProductAdapter = new CommonAdapter<ShopCarBean>(getActivity(),R.layout.item_shopcar_layout,exchangeProductData) {
@Override
protected void convert(ViewHolder holder, ShopCarBean shopCarBean, int position) {
ImageView item_shop_img= holder.getConvertView().findViewById(R.id.item_shop_img);
holder.getView(R.id.radio_layout).setVisibility(View.INVISIBLE);
holder.setText(R.id.shop_num,"1");
holder.getView(R.id.shop_cut).setVisibility(View.INVISIBLE);
holder.getView(R.id.shop_add).setVisibility(View.INVISIBLE);
Glide.with(getActivity()).load(shopCarBean.getPiclogo()).into(item_shop_img);
holder.setText(R.id.item_shop_name,shopCarBean.getProductname());
if (StringUtils.isEmpty(shopCarBean.getColorname()) || shopCarBean.getColorname().equals("共同")) {
holder.getView(R.id.item_shop_content).setVisibility(View.GONE);
} else {
holder.getView(R.id.item_shop_content).setVisibility(View.VISIBLE);
holder.setText(R.id.item_shop_content,shopCarBean.getColorname());
}
if (StringUtils.isEmpty(shopCarBean.getSizename())|| shopCarBean.getSizename().equals("共同")) {
holder.getView(R.id.item_shop_content01).setVisibility(View.GONE);
} else {
holder.getView(R.id.item_shop_content01).setVisibility(View.VISIBLE);
holder.setText(R.id.item_shop_content01,shopCarBean.getSizename());
}
holder.setText(R.id.shop_price,"¥" + shopCarBean.getAddprice());
holder.getView(R.id.btnDelete).setVisibility(View.GONE);
}
};
exchangeProductList.setAdapter(exchangeProductAdapter);
}
/**
* 判断是否显示返回键
*/
private void isFinish() {
if (StateMessage.isShopCarFinnish) {
back.setVisibility(View.VISIBLE);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), HomeWebViewAct.class);
Bundle bundle = new Bundle();
bundle.putBoolean("all", true);
bundle.putString("url", StateMessage.url);
intent.putExtras(bundle);
startActivity(intent);
}
});
} else {
back.setVisibility(View.GONE);
}
}
/**
* 隐藏返回按键
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(ShopCarBean bean) { //是否进入首页
isFinish();
}
@Override
public void onRefresh() {
getShopCarData(nowFactorySelect);
}
@Override
public void onResume() {
super.onResume();
getShopCarData(nowFactorySelect);
isFinish();
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (!hidden) {
getShopCarData(nowFactorySelect);
}
}
/***
* 获取购物车数据并显示
*/
private void getShopCarData(int store) {
Map<String, Object> params = new HashMap<>();
params.put("parentLocation", "113");
params.put("store",store);
HttpClient.post(HttpClient.SHOPCARDATA, params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String content) {
super.onSuccess(content);
stopProgressDialog();
if (refreshRoot != null) {
refreshRoot.finishRefresh();
}
// Log.e("shopcar", content);
JSONObject object = JSON.parseObject(content);
if (HttpClient.RET_SUCCESS_CODE.equals(object.getString("status"))) {
minMoney = object.getDouble("minmoney");//包邮的最低价格
rightPoint = object.getString("redPoint");//仓库2是否有数据
if (rightPoint != null && rightPoint.equals("1")){
viewFactoryTwo.setVisibility(View.VISIBLE);
}else {
viewFactoryTwo.setVisibility(View.GONE);
}
cdurl = object.getString("cdurl");
String arrays = object.getString("items");
shopList = JSONArray.parseArray(arrays, ShopCarBean.class);
for (int i = 0; i < shopList.size(); i++) {
if (!shopList.get(i).isFreesend()) {//包邮
if (minMoney > 0) {
rlFreeFee.setVisibility(View.VISIBLE);
txtDescribe.setText(String.format("满%s元可免运费", minMoney));
rlGoTo.setVisibility(View.VISIBLE);
} else {
rlFreeFee.setVisibility(View.GONE);
txtDescribe.setText(String.format("%s", "已满足免邮条件"));
rlGoTo.setVisibility(View.GONE);
}
break;
}
}
if (shopList.size() == 0) {
notLayout.setVisibility(View.VISIBLE);
shopcarList.setVisibility(View.GONE);
rlFreeFee.setVisibility(View.GONE);
} else {
rlFreeFee.setVisibility(View.VISIBLE);
notLayout.setVisibility(View.GONE);
shopcarList.setVisibility(View.VISIBLE);
}
exchangeProductData.clear();
for (int i=0;i<shopList.size();i++){
if (shopList.get(i).getIsadd() != null &&
shopList.get(i).getIsadd().equals("1")){
if (checkList.size()>0) {
exchangeProductData.add(shopList.get(i));
}else {
StateMessage.canExchange = false;
footView.setVisibility(View.GONE);
rlExchange.setVisibility(View.GONE);
}
shopList.remove(i);
i--;
}
}
setAdapter();
if (StateMessage.canExchange) {
if (exchangeProductData.size() > 0) {
footView.setVisibility(View.VISIBLE);
setExchangeProductAdapter();//设置加价购商品
} else {
footView.setVisibility(View.GONE);
}
}else {
footView.setVisibility(View.GONE);
}
JSONArray jsonArray = object.getJSONArray("titles");
if (jsonArray != null && jsonArray.size() > 0) {
ll_activity.setVisibility(View.VISIBLE);
if (jsonArray.get(0) != null && !jsonArray.get(0).equals("")) {
tvActivityOne.setText(jsonArray.get(0).toString());
} else {
tvActivityOne.setVisibility(View.INVISIBLE);
}
if (jsonArray.get(1) != null && !jsonArray.get(1).equals("")) {
tvActivityTwo.setText(jsonArray.get(1).toString());
} else {
tvActivityTwo.setVisibility(View.INVISIBLE);
}
if (jsonArray.get(2) != null && !jsonArray.get(2).equals("")) {
tvActivityThree.setText(jsonArray.get(2).toString());
} else {
tvActivityThree.setVisibility(View.INVISIBLE);
}
} else {
ll_activity.setVisibility(View.GONE);
}
balancePrice();
}
}
}, getActivity());
}
/**
* 设置购物车适配器
*/
private void setAdapter() {
if (adapter != null) {
adapter.setShopList(shopList);
return;
}
adapter = new ShopCarAdapter(getActivity(), shopList);
adapter.setOnClickItem(new ShopCarAdapter.onClickItemsAll() {
@Override
public void onChangeNumClick(Map<String, Integer> newShop) {
shopnums = newShop;
checkCondition();
balancePrice();
}
@Override
public void onCheckClick(Map<String, ShopCarBean> select, Map<String, Integer> nums) {
checkList = select;
shopnums = nums;
checkCondition();
balancePrice();
}
@Override
public void onDeleteClick(List<ShopCarBean> allShop, Map<String, ShopCarBean> newShop, Map<String, Integer> newNums) {
shopList = allShop;
checkList = newShop;
shopnums = newNums;
if (shopList.size() == 0) {
allRadio.setChecked(false);
}
checkCondition();
balancePrice();
}
});
shopcarList.setAdapter(adapter);
}
/**
* 判断是否满足加价购的条件
*/
private void checkCondition(){
//加价购
if (checkList.size() == 0) {
footView.setVisibility(View.GONE);
delAdd();
return;
}
String[] items = new String[checkList.size()];
int i = 0;
ShopCarBean bean;
for (String key : checkList.keySet()) {
bean = checkList.get(key);
items[i] = bean.getId();
if (bean.getMaxnum() == 0) {
maxnum = bean.getStore();
} else {
maxnum = bean.getMaxnum() <= bean.getStore() ? bean.getMaxnum() : bean.getStore();
}
if (!isEdit) {
if (maxnum < shopnums.get(bean.getId())) {
showToast(bean.getProductname() + "库存剩余" + maxnum + "件,购买超出数量!");
return;
}
}
i++;
}
getExchangeCondition(items);
}
/**
* 数据出现改变时,此处进行结算
* <p>
* newShop:改变之后的集合
*/
private void balancePrice() {
isManual = true;
if (shopList.size() != 0) {
notLayout.setVisibility(View.GONE);
shopcarList.setVisibility(View.VISIBLE);
int quantity = 0;
for (int i = 0; i < shopList.size(); i++) {
if (shopList.get(i).getQuantity() == 0) {
quantity++;
}
}
if (shopList.size() - quantity == checkList.size()) { //全选了
allRadio.setChecked(true);
} else {
allRadio.setChecked(false);
}
} else {
notLayout.setVisibility(View.VISIBLE);
shopcarList.setVisibility(View.GONE);
rlExchange.setVisibility(View.GONE);
footView.setVisibility(View.GONE);
}
isManual = false;
if (checkList.size() == 0) {
allPrice.setText("¥ 0.00");
footView.setVisibility(View.GONE);
rlExchange.setVisibility(View.GONE);
}
double Price = 0;
if (StateMessage.canExchange && exchangeProductData.size()>0){//加价购商品
for (String key : checkList.keySet()) {
if (shopnums.get(checkList.get(key).getId()) != null) {
Price += checkList.get(key).getRightprice() * shopnums.get(checkList.get(key).getId());
}
}
for (int i=0;i<exchangeProductData.size();i++){
Price += Double.parseDouble(exchangeProductData.get(i).getAddprice());
}
allPrice.setText("¥ " + String.format("%.2f", Price));
}else {//没有加价购,只有普通商品
for (String key : checkList.keySet()) {
if (shopnums.get(checkList.get(key).getId()) != null) {
Price += checkList.get(key).getRightprice() * shopnums.get(checkList.get(key).getId());
allPrice.setText("¥ " + String.format("%.2f", Price));
}
}
}
for (String key : checkList.keySet()) {
if (checkList.get(key).isFreesend()) {
rlFreeFee.setVisibility(View.VISIBLE);
txtDescribe.setText(String.format("%s", "已满足免邮条件"));
rlGoTo.setVisibility(View.GONE);
return;
}
}
if (Price > minMoney) {//总价大于包邮最低价
rlFreeFee.setVisibility(View.VISIBLE);
txtDescribe.setText(String.format("%s", "已满足免邮条件"));
rlGoTo.setVisibility(View.GONE);
} else {
rlFreeFee.setVisibility(View.VISIBLE);
rlGoTo.setVisibility(View.VISIBLE);
if (minMoney - Price > 0) {
txtDescribe.setText(String.format("再购%s元可免运费", minMoney - Price));
} else {
rlFreeFee.setVisibility(View.GONE);
}
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (adapter != null && !isManual) {
adapter.setAllChecked(b);
}
compoundButton.setChecked(b);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.edit: //编辑按钮
if (!isEdit) {
edit.setText("完成");
allText.setVisibility(View.GONE);
allPrice.setVisibility(View.GONE);
summaryButton.setText("删除");
allRadio.setChecked(false);
isEdit = true;
} else {
edit.setText("编辑");
allText.setVisibility(View.VISIBLE);
allPrice.setVisibility(View.VISIBLE);
summaryButton.setText("去结算");
allRadio.setChecked(false);
isEdit = false;
}
if (adapter != null) {
adapter.setAllChecked(false); //手动取消所有选项
}
break;
case R.id.summary_button: //结算和删除按钮
if (checkList.size() == 0) {
ToastUtils.showToast(getActivity(),"请先选择商品");
return;
}
String[] items = new String[checkList.size()];
int i = 0;
ShopCarBean bean;
for (String key : checkList.keySet()) {
bean = checkList.get(key);
items[i] = bean.getId();
if (bean.getMaxnum() == 0) {
maxnum = bean.getStore();
} else {
maxnum = bean.getMaxnum() <= bean.getStore() ? bean.getMaxnum() : bean.getStore();
}
if (!isEdit) {
if (maxnum < shopnums.get(bean.getId())) {
showToast(bean.getProductname() + "库存剩余" + maxnum + "件,购买超出数量!");
return;
}
}
i++;
}
if (isEdit && adapter != null) { //删除
adapter.deleteItems(items);
} else if (!isEdit && adapter != null) { //提交
submitAllShop(items);
}
break;
case R.id.all_layout: //扩大checkbox的点击热区
if (allRadio.isChecked()) {
allRadio.setChecked(false);
} else {
allRadio.setChecked(true);
}
break;
case R.id.rlGoTo://去凑单
Intent intent = new Intent(getActivity(), WebviewActivity.class);
intent.putExtra("url", cdurl);
intent.putExtra("all", true);
startActivity(intent);
break;
default:
break;
}
}
/**
* 提交购买
*/
private void submitAllShop(String[] items) {
Map<String, Object> params = new HashMap<>();
StringBuilder itemIds = new StringBuilder();
StringBuilder itemNums = new StringBuilder();
for (int i = 0; i < items.length; i++) {
if (i == items.length - 1) { //最后一个
itemIds.append(items[i]);
itemNums.append(shopnums.get(items[i]));
} else {
itemIds.append(items[i] + ",");
itemNums.append(shopnums.get(items[i]) + ",");
}
}
if (exchangeProductData.size()>0){//有加价购商品
for (int i=0;i<exchangeProductData.size();i++){
if (itemIds.length() > 0) {
itemIds.append(",");
}
if (itemNums.length() > 0) {
itemNums.append(",");
}
itemIds.append(exchangeProductData.get(i).getId());
itemNums.append("1");
}
}
params.put("itemids", itemIds.toString());
params.put("quantities", itemNums.toString());
HttpClient.post(HttpClient.SUBMITSHOP, params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String content) {
super.onSuccess(content);
// Log.e("log--submit", content);
JSONObject object = JSON.parseObject(content);
if (HttpClient.RET_SUCCESS_CODE.equals(object.getString("status"))) {
allRadio.setChecked(false);
allPrice.setText("¥ 0.00");
String data = object.getString("data");
Intent intent = new Intent(getActivity(), HomeWebViewAct.class);
intent.putExtra("url", HttpClient.SUBMITURL + "&itemdata=" + data);
startActivity(intent);
}
}
}, getActivity());
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
@OnClick({R.id.factoryOneSelect, R.id.factoryOneNotSelect, R.id.factoryTwoSelect, R.id.factoryTwoNotSelect,R.id.rlExchange})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.factoryOneSelect:
factoryOneSelect.setVisibility(View.VISIBLE);
factoryOneNotSelect.setVisibility(View.GONE);
factoryTwoNotSelect.setVisibility(View.VISIBLE);
factoryTwoSelect.setVisibility(View.GONE);
nowFactorySelect = 0;
startProgressDialog("",getActivity());
getShopCarData(nowFactorySelect);
break;
case R.id.factoryOneNotSelect:
factoryOneSelect.setVisibility(View.VISIBLE);
factoryOneNotSelect.setVisibility(View.GONE);
factoryTwoNotSelect.setVisibility(View.VISIBLE);
factoryTwoSelect.setVisibility(View.GONE);
nowFactorySelect = 0;
startProgressDialog("",getActivity());
getShopCarData(nowFactorySelect);
break;
case R.id.factoryTwoSelect:
factoryOneSelect.setVisibility(View.GONE);
factoryOneNotSelect.setVisibility(View.VISIBLE);
factoryTwoNotSelect.setVisibility(View.GONE);
factoryTwoSelect.setVisibility(View.VISIBLE);
nowFactorySelect = 1;
startProgressDialog("",getActivity());
getShopCarData(nowFactorySelect);
break;
case R.id.factoryTwoNotSelect:
factoryOneSelect.setVisibility(View.GONE);
factoryOneNotSelect.setVisibility(View.VISIBLE);
factoryTwoNotSelect.setVisibility(View.GONE);
factoryTwoSelect.setVisibility(View.VISIBLE);
nowFactorySelect = 1;
startProgressDialog("",getActivity());
getShopCarData(nowFactorySelect);
break;
case R.id.rlExchange://去换购
if (exchangeCondition != null && exchangeCondition.getType() != null){//去凑单
Intent intent3 = new Intent(getActivity(), LabelActivity.class);
Bundle bundle = new Bundle();
bundle.putString("productTabId", "" + exchangeCondition.getIds());
intent3.putExtras(bundle);
startActivity(intent3);
}else {
Intent intent = new Intent(getActivity(), ExchangeActivity.class);
//加价购
if (checkList.size() == 0) {
return;
}
ArrayList<String> idList = new ArrayList<>();
ShopCarBean bean;
for (String key : checkList.keySet()) {
bean = checkList.get(key);
idList.add(bean.getProductid());
}
intent.putStringArrayListExtra("productIds", idList);
if (StateMessage.canExchange && exchangeProductData.size() > 0) {
ArrayList<String> addProduct = new ArrayList<>();
for (int i = 0; i < exchangeProductData.size(); i++) {
addProduct.add(exchangeProductData.get(i).getProductid());
}
intent.putStringArrayListExtra("addProduct", addProduct);
}
startActivity(intent);
}
break;
}
}
/**
* 加价购条件判断
*/
private void getExchangeCondition(String[] items) {
Map<String, Object> params = new HashMap<>();
String[] items2 = new String[checkList.size()];
int j=0;
ShopCarBean bean;
for (String key : checkList.keySet()) {
bean = checkList.get(key);
if (shopnums.get(bean.getId()) != null) {
items2[j] = bean.getProductid();
}
j++;
}
StringBuilder itemIds = new StringBuilder();
StringBuilder itemNums = new StringBuilder();
for (int i = 0; i < items.length; i++) {
if (i == items.length - 1) {
itemNums.append(shopnums.get(items[i]));
} else {
itemNums.append(shopnums.get(items[i]) + ",");
}
}
for (int i = 0; i < items2.length; i++) {
if (i == items2.length - 1) {
itemIds.append(items2[i]);
} else {
itemIds.append(items2[i] + ",");
}
}
params.put("productids", itemIds.toString());
params.put("productNums", itemNums.toString());
params.put("disrange", GlobalApplication.user.getLevel_type());
HttpClient.post(HttpClient.EXCHANGE, params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String content) {
super.onSuccess(content);
stopProgressDialog();
JSONObject object = JSON.parseObject(content);
if (HttpClient.RET_SUCCESS_CODE.equals(object.getString("status"))) {
JSONObject jsonObject = JSON.parseObject(object.getString("data"));
exchangeCondition = JSON.parseObject(object.getString("data"),ExchangeCondition.class);
if (jsonObject.getString("status").equals("1")){//满足条件
rlExchange.setVisibility(View.VISIBLE);
exchangeDescribe.setText(jsonObject.getString("descript"));
rlGoToExchange.setVisibility(View.VISIBLE);
StateMessage.canExchange = true;
}else {
rlExchange.setVisibility(View.VISIBLE);
exchangeDescribe.setText(jsonObject.getString("descript"));
rlGoToExchange.setVisibility(View.VISIBLE);
footView.setVisibility(View.GONE);
StateMessage.canExchange = false;
delAdd();
balancePrice();
}
}else {
rlExchange.setVisibility(View.GONE);
footView.setVisibility(View.GONE);
rlGoToExchange.setVisibility(View.GONE);
StateMessage.canExchange = false;
delAdd();
balancePrice();
}
}
}, getActivity());
}
/**
* 删除加价购
*/
private void delAdd(){
if (exchangeProductData.size()>0){
String[] items = new String[exchangeProductData.size()];
for (int i=0;i<exchangeProductData.size();i++){
items[i] = exchangeProductData.get(i).getId();
}
exchangeProductData.clear();
deleteItems(items);
}
}
/**
* 删除商品
*/
public void deleteItems(final String[] items) {
Map<String, Object> params = new HashMap<>();
String itemIds = "";
for (int i = 0; i < items.length; i++) {
if (i == items.length - 1) { //最后一个
itemIds += items[i];
} else {
itemIds += items[i] + ",";
}
}
params.put("Itemids", itemIds);
HttpClient.post(HttpClient.DELCARTS, params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String content) {
super.onSuccess(content);
Log.e("log--del", content);
JSONObject object = JSON.parseObject(content);
if (HttpClient.RET_SUCCESS_CODE.equals(object.getString("status"))) {
exchangeProductData.clear();
}
}
}, getActivity());
}
} | [
"wy19941007"
] | wy19941007 |
658fa499c262435aaa42756133f103508ca5fad9 | 2a4049afb17aca46de69dfe75487b7c107761c53 | /src/main/java/com/wenyao/springanaylize/lookupdemo/LookupMethodTest.java | b2f4db2268444d0b834d7158ba969e2258dfdf09 | [] | no_license | wy19940706/spring-anaylize | ebdaf65c5a457811d909f31cda28525779470387 | d396f61141fae4400fbcddc69a3dd0dd4a29a5cb | refs/heads/master | 2022-06-21T08:37:44.089212 | 2020-01-06T01:54:38 | 2020-01-06T01:54:38 | 201,499,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | package com.wenyao.springanaylize.lookupdemo;
public abstract class LookupMethodTest {
public void show() {
this.getBean().show();
}
public abstract User getBean();
}
| [
"wenyao@haixue.com"
] | wenyao@haixue.com |
35ccf09e918d4476cfe8c8fff7983aeeb6aa81a0 | 20b520bffb806114f88bea3517e76fbb9946fad2 | /src/main/java/com/vtt/apps/util/ModelToPojoConverter.java | b3c6507750cf8578f4dd9f5d7d271f77b4a7cd66 | [] | no_license | sunillakkakula/tagline-traders-api | 490ed74fd68144251a3c68c4543dbe45a79b4b32 | 39b4f93663d823c22021ece183cd327cc2e2f530 | refs/heads/master | 2023-04-14T17:06:57.101773 | 2021-04-25T14:09:54 | 2021-04-25T14:09:54 | 338,733,602 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | java | /*
* package com.vtt.apps.util;
*
* import java.util.ArrayList; import java.util.Iterator; import java.util.List;
*
* import com.vtt.apps.model.Administrator; import com.vtt.apps.model.Category;
* import com.vtt.apps.model.Farmer; import com.vtt.apps.model.Supplier; import
* com.vtt.apps.pojo.AdministratorPojo; import com.vtt.apps.pojo.FarmerPojo;
* import com.vtt.apps.pojo.SupplierPojo;
*
* public class ModelToPojoConverter {
*
* public static List<com.vtt.apps.pojo.Category>
* convertModelToPojo(List<Category> categoryList){
* List<com.vtt.apps.pojo.Category> categoryPojoList =new ArrayList<>();
* com.vtt.apps.pojo.Category categoryPojo = null; for (Iterator iterator =
* categoryList.iterator(); iterator.hasNext();) { Category category =
* (Category) iterator.next(); categoryPojo = new
* com.vtt.apps.pojo.Category(category.getId() , category.getName(),
* category.getImage(), category.getItems().size());
* categoryPojoList.add(categoryPojo); } return categoryPojoList; }
*
* public static AdministratorPojo convertAdminModelToPojo(Administrator admin){
* AdministratorPojo pojo = null; if(admin!=null){ pojo= new
* AdministratorPojo(admin); } return pojo; } public static SupplierPojo
* convertSupplierModelToPojo(Supplier supplier){ SupplierPojo pojo = null;
* if(supplier!=null){ pojo= new SupplierPojo(supplier); } return pojo; } public
* static FarmerPojo convertFarmerModelToPojo(Farmer farmer){ FarmerPojo pojo =
* null; if(farmer!=null){ pojo= new FarmerPojo(farmer); } return pojo; } }
*/ | [
"="
] | = |
2be3f393105f6be4b0198eff6c0bcdc1a836bc32 | bf2bcc4a5514f582a6ac382c34f73e68bdad6ac2 | /android/app/src/main/java/com/projectreactnative3/MainActivity.java | 9f719d8227de1f6e6e0d7a1e702cfedcfe0040c0 | [] | no_license | Damien347/chat-test | cc9608e7dcecb2053a5b196d8c2fd27a890d0125 | e4d6f2c53291979151699cc9226b28b80793b868 | refs/heads/master | 2023-01-23T06:33:25.406475 | 2019-10-29T10:16:47 | 2019-10-29T10:16:47 | 218,258,922 | 0 | 0 | null | 2023-01-04T23:40:47 | 2019-10-29T10:16:13 | JavaScript | UTF-8 | Java | false | false | 365 | java | package com.projectreactnative3;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "projectreactnative3";
}
}
| [
"damien.onolfo@orange.fr"
] | damien.onolfo@orange.fr |
e7b6e169f4c7e2a53433f3df8577dd8f9eaa9137 | 232f74ba8b8e076082d85d90053c5b75fc312c2a | /app/src/main/java/com/qytech/securitycheck/ui/fingerprint/FingerprintActivity.java | 0193343f6f21cf4b6a5f87667739c830dc5f8cc3 | [] | no_license | qy-tech/PassportDetect | 7e53d6d98838e3352efa5e5d364dcf56deb1e2d0 | d3eaef0a9216707d7c047511a53b817bb410ae7e | refs/heads/main | 2023-07-13T18:58:07.750488 | 2020-12-08T10:52:38 | 2020-12-08T10:52:38 | 311,287,555 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 14,883 | java | package com.qytech.securitycheck.ui.fingerprint;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.qytech.securitycheck.GlobalApplication;
import com.qytech.securitycheck.R;
import com.qytech.securitycheck.utils.PreferenceUtils;
import com.qytech.securitycheck.utils.SpUtil;
import com.szadst.szoemhost_lib.CommandProc;
import com.szadst.szoemhost_lib.DevComm;
import com.szadst.szoemhost_lib.HostLib;
import com.szadst.szoemhost_lib.IFPListener;
public class FingerprintActivity extends AppCompatActivity implements View.OnClickListener {
Button m_btnEnroll;
Button m_btnIdentify;
Button m_btnGetUserCount;
Button m_btnDeleteAll;
EditText m_editUserID;
TextView m_txtStatus;
Spinner m_spBaudrate;
Spinner m_spDevice;
String m_strPost;
boolean m_bForce = false;
private PopupWindow popupWindow;
private LayoutInflater inflater;
private View inflate;
private int w_nTemplateNo;
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fingerprint);
Toolbar toolbar = findViewById(R.id.toolbars);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
}
@Override
protected void onResume() {
super.onResume();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
initWidget();
m_spBaudrate.setSelection(4);
HostLib.getInstance(this).FPCmdProc().GetDeviceList(m_spDevice);
HostLib.getInstance(this).FPCmdProc().SetListener(new IFPListener.FPCommandListener() {
@Override
public void cmdProcReturn(int p_nCmdCode, int p_nRetCode, int p_nParam1, int p_nParam2) { // command process result
procResponsePacket(p_nCmdCode, p_nRetCode, p_nParam1, p_nParam2);
}
@Override
public void cmdProcReturnData(byte[] p_pData, int p_nSize) { // command process data result
}
@Override
public void cmdProcShowText(String p_szInfo) { // show information
//m_txtStatus.setText(p_szInfo);
}
}, new IFPListener.FPCancelListener() {
@Override
public void cancelReturn(int p_nRetCode) { // cancel result
}
});
}
public void onClick(View view) {
if (view == m_btnEnroll)
onEnrollBtn();
else if (view == m_btnIdentify)
onIdentifyBtn();
else if (view == m_btnGetUserCount)
onGetUserCount();
else if (view == m_btnDeleteAll)
onDeleteAllBtn();
}
public void initWidget() {
m_btnEnroll = findViewById(R.id.btnEnroll);
m_btnIdentify = findViewById(R.id.btnIdentify);
m_btnGetUserCount = findViewById(R.id.btnGetEnrollCount);
m_btnDeleteAll = findViewById(R.id.btnRemoveAll);
m_editUserID = findViewById(R.id.editUserID);
m_spBaudrate = findViewById(R.id.spnBaudrate);
m_spDevice = findViewById(R.id.spnDevice);
m_btnEnroll.setOnClickListener(this);
m_btnIdentify.setOnClickListener(this);
m_btnGetUserCount.setOnClickListener(this);
m_btnDeleteAll.setOnClickListener(this);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (popupWindow != null && popupWindow.isShowing()) {
return false;
}
return super.dispatchTouchEvent(ev);
}
public void onEnrollBtn() {
popupWindow = new PopupWindow(this);
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflate = inflater.inflate(R.layout.pop_fingerprint, null);
m_txtStatus = inflate.findViewById(R.id.txtStatus);
popupWindow.setContentView(inflate);
popupWindow.setOutsideTouchable(false);
popupWindow.showAtLocation(inflate, Gravity.CENTER | Gravity.CENTER_HORIZONTAL, 0, 0);
w_nTemplateNo = PreferenceUtils.INSTANCE.findPreference("TEMPLATE_NO", 1);//GetInputTemplateNo();
/*if (w_nTemplateNo < 0) return;
Log.e("TAG", "onEnrollBtn: "+w_nTemplateNo);*/
HostLib.getInstance(this).FPCmdProc().Run_CmdEnroll(w_nTemplateNo, m_bForce);
Toast toast = Toast.makeText(FingerprintActivity.this, "确保手指清洁干燥,录制中请勿切换手指", Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
}
public void onIdentifyBtn() {
Integer enrollCount = PreferenceUtils.INSTANCE.findPreference("TEMPLATE_NO", 1); //判断当前有没有录制指纹
if (enrollCount < 2){
Toast toast = Toast.makeText(FingerprintActivity.this, "请录制指纹", Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
}else {
popupWindow = new PopupWindow(this);
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflate = inflater.inflate(R.layout.pop_fingerprint, null);
m_txtStatus = inflate.findViewById(R.id.txtStatus);
popupWindow.setContentView(inflate);
popupWindow.setOutsideTouchable(false);
popupWindow.showAtLocation(inflate, Gravity.CENTER | Gravity.CENTER_HORIZONTAL, 0, 0);
HostLib.getInstance(this).FPCmdProc().Run_CmdIdentify(m_bForce);
}
}
public void onGetUserCount() {
HostLib.getInstance(this).FPCmdProc().Run_CmdGetUserCount(m_bForce);
}
public void onDeleteAllBtn() {
HostLib.getInstance(this).FPCmdProc().Run_CmdDeleteAll(m_bForce);
PreferenceUtils.INSTANCE.putPreference("TEMPLATE_NO", 1);
PreferenceUtils.INSTANCE.clear();
}
@SuppressLint("DefaultLocale")
private void procResponsePacket(int p_nCode, int p_nRet, int p_nParam1, int p_nParam2) {
m_strPost = "";
if (m_txtStatus != null) {
m_txtStatus.setText(m_strPost);
}
switch (p_nCode) {
case (short) DevComm.CMD_ENROLL_CODE:
case (short) DevComm.CMD_ENROLL_ONETIME_CODE:
case (short) DevComm.CMD_CHANGE_TEMPLATE_CODE:
if (p_nRet == (short) DevComm.ERR_SUCCESS) {
switch (p_nParam1) {
case (short) DevComm.NEED_RELEASE_FINGER:
m_strPost = "收起手指";
break;
case (short) DevComm.NEED_FIRST_SWEEP:
m_strPost = "放置手指";
break;
case (short) DevComm.NEED_SECOND_SWEEP:
m_strPost = "再来二次";
break;
case (short) DevComm.NEED_THIRD_SWEEP:
m_strPost = "再来一次";
break;
default:
int lastNo = PreferenceUtils.INSTANCE.findPreference("TEMPLATE_NO", 1) + 1;
PreferenceUtils.INSTANCE.putPreference("TEMPLATE_NO", lastNo);
Toast toast = Toast.makeText(this, "录制成功", Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
popupWindow.setOutsideTouchable(false);
popupWindow.dismiss();
break;
}
} else {
if (HostLib.getInstance(this).FPDevComm().LOBYTE((short) p_nParam1) == DevComm.ERR_BAD_QUALITY) {
m_strPost = "继续录制";
} else if (p_nParam1 == DevComm.ERR_DUPLICATION_ID) {
popupWindow.setOutsideTouchable(false);
popupWindow.dismiss();
Toast toast = Toast.makeText(this, "指纹重复", Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
popupWindow.dismiss();
} else {
Toast toast = Toast.makeText(this, "录制失败,请确保手指清洁干燥", Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
popupWindow.dismiss();
}
}
break;
case (short) DevComm.CMD_IDENTIFY_CODE:
if (p_nRet == (short) DevComm.ERR_SUCCESS) {
switch (p_nParam1) {
case (short) DevComm.NEED_RELEASE_FINGER:
m_strPost = "收起手指";
break;
case (short) DevComm.NEED_FIRST_SWEEP:
m_strPost = "放置手指";
break;
default:
Toast toast = Toast.makeText(this, "验证成功", Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
if (popupWindow != null && popupWindow.isShowing()) {
popupWindow.dismiss();
}
}
} else {
Toast toast = Toast.makeText(this, "验证失败", Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
if (popupWindow != null && popupWindow.isShowing()) {
popupWindow.dismiss();
}
}
break;
case (short) DevComm.CMD_GET_ENROLL_COUNT_CODE:
if (p_nRet == (short) DevComm.ERR_SUCCESS) {
Toast toast = Toast.makeText(this, String.format("当前指纹数为 : %d", p_nParam1), Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
} else {
Toast toast = Toast.makeText(this, "获取指纹数失败", Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
}
break;
case (short) DevComm.CMD_CLEAR_ALLTEMPLATE_CODE:
if (p_nRet == (short) DevComm.ERR_SUCCESS) {
Toast toast = Toast.makeText(this, String.format("清除指纹数为 : %d", p_nParam1), Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
} else {
Toast toast = Toast.makeText(this, "清除失败", Toast.LENGTH_SHORT);
LinearLayout layout = (LinearLayout) toast.getView();
TextView tv = (TextView) layout.getChildAt(0);
tv.setTextSize(30);
tv.setTextColor(Color.WHITE);
toast.getView().setBackgroundColor(Color.DKGRAY);
toast.show();
}
break;
}
if (m_txtStatus != null) {
m_txtStatus.setText(m_strPost);
}
}
} | [
"rtd125843@163.com"
] | rtd125843@163.com |
83bd53313e3949eda87e5511275c18f0b0b74a93 | 11b15a29429af7d8dd792b0c93dd09ea1f30dffb | /3o Periodo/Programacao Orientada a Objetos/Arquivos da Materia/Janelas/JanelaCondicional1.java | af655a6abb7b58802a191da7517025a39602402d | [] | no_license | antonmr/UNISUAM | 171b6c95b9752acd8180fade4ec320a98ef7cc29 | 06959c9c3264ec500753e3720fd813cb2125b633 | refs/heads/master | 2021-01-11T11:07:05.050542 | 2018-11-28T04:00:09 | 2018-11-28T04:00:09 | 36,993,279 | 0 | 0 | null | 2015-06-06T19:55:07 | 2015-06-06T19:55:06 | null | UTF-8 | Java | false | false | 367 | java | import javax.swing.JOptionPane;
class JanelaCondicional1 {
public static void main(String[] argumentos) {
String resposta;
int num;
resposta = JOptionPane.showInputDialog("Digite um número:");
num = Integer.parseInt(resposta);
if(num > 20)
JOptionPane.showMessageDialog(null, "Você digitou " + num);
}
} | [
"amazonrangel@gmail.com"
] | amazonrangel@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.