blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fe1fd6db4741107136ce811ad8cc24726190d708 | 0784f5a7a5ed1ce877eba6f6f7201df64b6a6c12 | /src/javafx/WerkplaatsApp/stages/ArtikelenBestellenStage.java | 38e3273b11ba42c7f41667d3f311ec3b27754598 | [] | no_license | ninozn/ThemaopdrachtBlok3 | a0b503b6bcdb3f039b1abc02a9989d4da3af1b67 | 47c0d5724bb290480ae2f423f62b94de13025b4d | refs/heads/master | 2021-01-22T09:17:19.373074 | 2017-02-16T19:50:37 | 2017-02-16T19:50:37 | 81,946,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,175 | java | package javafx.WerkplaatsApp.stages;
import java.awt.FlowLayout;
import java.io.IOException;
import java.util.Optional;
import javafx.WerkplaatsApp.domein.Bedrijf;
import javafx.application.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonBar.ButtonData;
import javafx.scene.layout.*;
import javafx.stage.Stage;
public class ArtikelenBestellenStage extends Stage {
private Bedrijf hetBedrijf;
private Stage stage;
public ArtikelenBestellenStage(Bedrijf b) {
hetBedrijf = b;
Label labArtNummer = new Label("Voer artikelnummer in:");
labArtNummer.setPrefWidth(300);
labArtNummer.setPadding(new Insets(15, 0, 5, 10));
labArtNummer.setStyle("-fx-font-size: 12; -fx-font-weight: bold");
Label labAantal = new Label("Voer het aantal in:");
labArtNummer.setPrefWidth(300);
labArtNummer.setPadding(new Insets(15, 0, 5, 10));
labAantal.setStyle("-fx-font-size: 12; -fx-font-weight: bold");
TextField tfArtNummer = new TextField();
tfArtNummer.setPrefWidth(300);
TextField tfAantal = new TextField();
tfAantal.setPrefWidth(300);
Button annuleer = new Button("Annuleer");
annuleer.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent e) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Waarschuwing!");
alert.setHeaderText("Annuleren klantgegevens bewerken!");
alert.setContentText("Weet u zeker dat u het bewerken van de klantgegevens wilt annuleren?\n\nDe wijzigingen zullen niet worden opgeslagen.");
ButtonType annuleer = new ButtonType("Annuleer",
ButtonData.CANCEL_CLOSE);
ButtonType ok = new ButtonType("OK", ButtonData.APPLY);
alert.getButtonTypes().setAll(annuleer, ok);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == annuleer) {
alert.close();
}
else {
ArtikelenBestellenStage.this.close();
}
}
});
Button bestellen = new Button("Bestellen");
bestellen.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent e) {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Bestelling bevestigen");
alert.setHeaderText("Controleer s.v.p. de gewijzigde gegevens:\n");
alert.setContentText("\t\t" + "Artikelnummer: "+ tfArtNummer.getText() + "\t\t" + "\n\t\t"+ "Aantal: " + tfAantal.getText() + "\t\t"+ "\n\n\t\tZijn bovenstaande gegevens juist?");
ButtonType annuleer = new ButtonType("Annuleer", ButtonData.CANCEL_CLOSE);
ButtonType bevestigen = new ButtonType("Bevestigen", ButtonData.APPLY);
alert.getButtonTypes().setAll(annuleer, bevestigen);
if (!tfArtNummer.equals("") && !tfAantal.equals("")) {
int artnummer = Integer.parseInt(tfArtNummer.getText());
int aantal = Integer.parseInt(tfAantal.getText());
hetBedrijf.maakBestelling(artnummer, aantal);
}
else {
System.out.println("vul alle velden in");
Alert a = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Alle Velden invullen svp");
alert.setHeaderText("Controleer s.v.p. de ingevoerde gegevens:\n");
alert.setContentText("\t\t" + "Artikelnummer: "
+ tfArtNummer.getText() + "\t\t" + "\n\t\t"
+ "Aantal: " + tfAantal.getText() + "\t\t"
+ "\n\n\t\tZijn bovenstaande gegevens juist?");
ButtonType ok = new ButtonType("Annuleer",
ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(ok);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ok) {
a.close();
}
}
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == annuleer) {
alert.close();
} else {
alert.close();
Alert success = new Alert(AlertType.INFORMATION);
success.setTitle("Onderdeel succelvol besteld!");
success.setHeaderText("Onderdeel succelvol besteld!");
success.setContentText("Het onderdeel is succesvol toegevoegd aan de bestelling!"+ "\n\nWilt u terugkeren naar het hoofdmenu?");
ButtonType bestellen = new ButtonType("Meer artikelen bestellen", ButtonData.NO);
ButtonType hoofdmenu = new ButtonType("Terugkeren naar het hoofdmenu", ButtonData.APPLY);
success.getButtonTypes().setAll(bestellen, hoofdmenu);
Optional<ButtonType> result2 = success.showAndWait();
if (result2.get() == bestellen) {
tfArtNummer.setText("");
tfAantal.setText("");
success.close();
}
if (result2.get() == hoofdmenu){
ArtikelenBestellenStage.this.close();
}
}
}
});
VBox vbox = new VBox(5);
vbox.getChildren().addAll(labArtNummer, tfArtNummer, labAantal,tfAantal);
HBox hbox = new HBox(5);
hbox.getChildren().addAll(annuleer, bestellen);
hbox.setAlignment(Pos.CENTER);
FlowPane flow = new FlowPane();
flow.getChildren().addAll(vbox, hbox);
Scene scene = new Scene(flow, 300, 270);
setTitle("Artikelen bestellen");
setScene(scene);
show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
| [
"nino-zijderveld@hotmail.com"
] | nino-zijderveld@hotmail.com |
81a8bebe86f922c2b7f581564dc6fcfa5a8864c6 | b38ec825e951f6fb1312c9ef442483d675dfa345 | /pet-clinic-data/src/main/java/fr/afcepf/ad1/springpetclinic/services/map/VisitMapService.java | f1903d4a5042444f8e8c425eb9795996401e4e58 | [] | no_license | melapal3/PetClinic | d752a63e3737165c28774c508c79141a877f72fd | f3b2f5a66cdcd25c1c0e18d9c117a2c13ece4fd0 | refs/heads/master | 2022-11-20T08:05:07.068996 | 2020-07-17T16:06:33 | 2020-07-17T16:06:33 | 280,110,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,008 | java | package fr.afcepf.ad1.springpetclinic.services.map;
import fr.afcepf.ad1.springpetclinic.model.Visit;
import fr.afcepf.ad1.springpetclinic.services.VisitService;
import org.springframework.stereotype.Service;
import java.util.Set;
@Service
public class VisitMapService extends AbstractMapService<Visit, Long> implements VisitService {
@Override
public Set<Visit> findAll() {
return super.findAll();
}
@Override
public Visit save(Visit object) {
if(object.getPet() == null || object.getPet().getOwner() == null || object.getPet().getId() == null || object.getPet().getOwner().getId() == null){
throw new RuntimeException("Invalid Visit !!!!!!");
}
return super.save(object);
}
@Override
public void deleteById(Long id) {
super.deleteById(id);
}
@Override
public void delete(Visit object) {
super.delete(object);
}
@Override
public Visit findById(Long id) {
return findById(id);
}
}
| [
"melany.pallaro.03@gmail.com"
] | melany.pallaro.03@gmail.com |
6354d9709af6f3a4dd20ea637af00caff2923d77 | 9dfd2390e654dc2c2eed29b58c8a062118b7b8b4 | /chrome/browser/profile_card/android/internal/java/src/org/chromium/chrome/browser/profile_card/ProfileCardCoordinatorImpl.java | 66653d0633bf127ca04919d342b5fa85df5bd291 | [
"BSD-3-Clause"
] | permissive | tongchiyang/chromium | d8136aeefa4646b7b2cf4c859fc84b2f22491e49 | 58cf4e036131385006e9e5b846577be7df717a9c | refs/heads/master | 2023-03-01T18:24:50.959530 | 2020-03-06T07:28:27 | 2020-03-06T07:28:27 | 245,365,574 | 1 | 0 | null | 2020-03-06T08:22:06 | 2020-03-06T08:22:05 | null | UTF-8 | Java | false | false | 1,603 | java | // Copyright 2020 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.profile_card;
import android.view.View;
import org.chromium.ui.modelutil.PropertyModel;
import org.chromium.ui.modelutil.PropertyModelChangeProcessor;
import org.chromium.ui.widget.ViewRectProvider;
/**
* Implements ProfileCardCoordinator.
* Talks to other components and decides when to show/update the profile card.
*/
public class ProfileCardCoordinatorImpl implements ProfileCardCoordinator {
private PropertyModel mModel;
private ProfileCardView mView;
private ProfileCardMediator mMediator;
private PropertyModelChangeProcessor mModelChangeProcessor;
private CreatorMetadata mCreatorMetadata;
@Override
public void init(View anchorView, CreatorMetadata creatorMetadata) {
ViewRectProvider rectProvider = new ViewRectProvider(anchorView);
mView = new ProfileCardView(anchorView.getContext(), anchorView, /*stringId=*/"",
/*accessibilityStringId=*/"", rectProvider);
mCreatorMetadata = creatorMetadata;
mModel = new PropertyModel(ProfileCardProperties.ALL_KEYS);
mModelChangeProcessor =
PropertyModelChangeProcessor.create(mModel, mView, ProfileCardViewBinder::bind);
mMediator = new ProfileCardMediator(mModel, creatorMetadata);
}
@Override
public void show() {
mMediator.show();
}
@Override
public void hide() {
mMediator.hide();
}
}
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
57194b913f221076b32a8c7d60a4322d9cdd7542 | 93e14ba08f0438d091978493b63b3d4b257aedbb | /src/main/java/com/cym/controller/adminPage/ServerController.java | 161396995a7e171a8f8b8ec713de9dd92bdba3fc | [
"LicenseRef-scancode-mulanpsl-1.0-en",
"MulanPSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | cym1102/nginxWebUI | 8d45e399de62dfb96029ba7e37e87185b4eb25d9 | bfbf2200df4b338c89a15267a46dc840f4d8aaea | refs/heads/master | 2023-08-25T17:35:13.310216 | 2023-08-17T03:07:47 | 2023-08-17T03:07:47 | 264,408,495 | 1,762 | 291 | NOASSERTION | 2023-07-31T05:39:52 | 2020-05-16T10:04:14 | HTML | UTF-8 | Java | false | false | 11,814 | java | package com.cym.controller.adminPage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.core.handle.Context;
import org.noear.solon.core.handle.ModelAndView;
import org.noear.solon.core.handle.UploadedFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cym.ext.ServerExt;
import com.cym.model.Cert;
import com.cym.model.Http;
import com.cym.model.Location;
import com.cym.model.Password;
import com.cym.model.Remote;
import com.cym.model.Server;
import com.cym.model.Stream;
import com.cym.model.Upstream;
import com.cym.model.Www;
import com.cym.service.ConfService;
import com.cym.service.ParamService;
import com.cym.service.ServerService;
import com.cym.service.SettingService;
import com.cym.service.UpstreamService;
import com.cym.sqlhelper.bean.Page;
import com.cym.sqlhelper.bean.Sort;
import com.cym.sqlhelper.bean.Sort.Direction;
import com.cym.utils.BaseController;
import com.cym.utils.JsonResult;
import com.cym.utils.SnowFlakeUtils;
import com.cym.utils.TelnetUtils;
import com.cym.utils.ToolUtils;
import com.github.odiszapc.nginxparser.NgxBlock;
import com.github.odiszapc.nginxparser.NgxConfig;
import com.github.odiszapc.nginxparser.NgxDumper;
import com.github.odiszapc.nginxparser.NgxParam;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
@Controller
@Mapping("/adminPage/server")
public class ServerController extends BaseController {
Logger logger = LoggerFactory.getLogger(this.getClass());
@Inject
ServerService serverService;
@Inject
UpstreamService upstreamService;
@Inject
ParamService paramService;
@Inject
SettingService settingService;
@Inject
ConfService confService;
@Mapping("")
public ModelAndView index(ModelAndView modelAndView, Page page, String keywords) {
page = serverService.search(page, keywords);
List<ServerExt> exts = new ArrayList<ServerExt>();
for (Server server : (List<Server>) page.getRecords()) {
ServerExt serverExt = new ServerExt();
if (server.getEnable() == null) {
server.setEnable(false);
}
// 描述回车转<br>
if (StrUtil.isNotEmpty(server.getDescr())) {
server.setDescr(server.getDescr().replace("\n", "<br>").replace(" ", " "));
}
serverExt.setServer(server);
if (server.getProxyType() == 0) {
serverExt.setLocationStr(buildLocationStr(server.getId()));
} else {
Upstream upstream = sqlHelper.findById(server.getProxyUpstreamId(), Upstream.class);
serverExt.setLocationStr(m.get("serverStr.server") + ": " + (upstream != null ? upstream.getName() : ""));
}
serverExt.setHref((server.getSsl() == 1 ? "https" : "http") + ("://" + server.getServerName() + ":" + server.getListen()));
exts.add(serverExt);
}
page.setRecords(exts);
modelAndView.put("page", page);
List<Upstream> upstreamList = upstreamService.getListByProxyType(0);
modelAndView.put("upstreamList", upstreamList);
modelAndView.put("upstreamSize", upstreamList.size());
List<Upstream> upstreamTcpList = upstreamService.getListByProxyType(1);
modelAndView.put("upstreamTcpList", upstreamTcpList);
modelAndView.put("upstreamTcpSize", upstreamTcpList.size());
List<Cert> certs = sqlHelper.findAll(Cert.class);
for (Cert cert : certs) {
if (cert.getType() == 0 || cert.getType() == 2) {
cert.setDomain(cert.getDomain() + "(" + cert.getEncryption() + ")");
}
}
modelAndView.put("certList", certs);
modelAndView.put("wwwList", sqlHelper.findAll(Www.class));
modelAndView.put("passwordList", sqlHelper.findAll(Password.class));
modelAndView.put("keywords", keywords);
modelAndView.view("/adminPage/server/index.html");
return modelAndView;
}
private String buildLocationStr(String id) {
List<String> str = new ArrayList<String>();
List<Location> locations = serverService.getLocationByServerId(id);
for (Location location : locations) {
String descr = m.get("commonStr.descr");
if (StrUtil.isNotEmpty(location.getDescr())) {
descr = location.getDescr();
}
if (location.getType() == 0) {
str.add("<span class='path'>" + location.getPath() + "</span>"//
+ "<a class='descrBtn' href='javascript:editLocationDescr(\"" + location.getId() + "\")'>" + descr + "</a>"//
+ "<br>"//
+ "<span class='value'>" + location.getValue() + "</span>");
} else if (location.getType() == 1) {
str.add("<span class='path'>" + location.getPath() + "</span>"//
+ "<a class='descrBtn' href='javascript:editLocationDescr(\"" + location.getId() + "\")'>" + descr + "</a>"//
+ "<br>"//
+ "<span class='value'>"//
+ location.getRootPath() + "</span>");
} else if (location.getType() == 2) {
Upstream upstream = sqlHelper.findById(location.getUpstreamId(), Upstream.class);
if (upstream != null) {
str.add("<span class='path'>" + location.getPath() + "</span>"//
+ "<a class='descrBtn' href='javascript:editLocationDescr(\"" + location.getId() + "\")'>" + descr + "</a>"//
+ "<br>"//
+ "<span class='value'>http://" + upstream.getName() + (location.getUpstreamPath() != null ? location.getUpstreamPath() : "") + "</span>");
}
} else if (location.getType() == 3) {
str.add("<span class='path'>" + location.getPath() + "</span>" //
+ "<a class='descrBtn' href='javascript:editLocationDescr(\"" + location.getId() + "\")'>" + descr + "</a>");
}
}
return StrUtil.join("<br>", str);
}
@Mapping("addOver")
public JsonResult addOver(String serverJson, String serverParamJson, String locationJson) {
Server server = JSONUtil.toBean(serverJson, Server.class);
List<Location> locations = JSONUtil.toList(JSONUtil.parseArray(locationJson), Location.class);
if (StrUtil.isEmpty(server.getId())) {
server.setSeq(SnowFlakeUtils.getId());
}
if (server.getProxyType() == 0) {
serverService.addOver(server, serverParamJson, locations);
} else {
serverService.addOverTcp(server, serverParamJson);
}
return renderSuccess();
}
@Mapping("setEnable")
public JsonResult setEnable(Server server) {
sqlHelper.updateById(server);
return renderSuccess();
}
@Mapping("detail")
public JsonResult detail(String id) {
Server server = sqlHelper.findById(id, Server.class);
ServerExt serverExt = new ServerExt();
serverExt.setServer(server);
List<Location> list = serverService.getLocationByServerId(id);
for (Location location : list) {
String json = paramService.getJsonByTypeId(location.getId(), "location");
location.setLocationParamJson(json != null ? json : null);
}
serverExt.setLocationList(list);
String json = paramService.getJsonByTypeId(server.getId(), "server");
serverExt.setParamJson(json != null ? json : null);
return renderSuccess(serverExt);
}
@Mapping("del")
public JsonResult del(String id) {
serverService.deleteById(id);
return renderSuccess();
}
@Mapping("importServer")
public JsonResult importServer(String nginxPath) {
if (StrUtil.isEmpty(nginxPath) || !FileUtil.exist(nginxPath)) {
return renderError(m.get("serverStr.fileNotExist"));
}
try {
serverService.importServer(nginxPath);
return renderSuccess(m.get("serverStr.importSuccess"));
} catch (Exception e) {
logger.error(e.getMessage(), e);
return renderError(m.get("serverStr.importFail"));
}
}
@Mapping("testPort")
public JsonResult testPort() {
List<Server> servers = sqlHelper.findAll(Server.class);
List<String> ips = new ArrayList<>();
for (Server server : servers) {
String ip = "";
String port = "";
if (server.getListen().contains(":")) {
String[] strArray = server.getListen().split(":");
port = strArray[strArray.length - 1];
ip = server.getListen().replace(":" + port, "");
} else {
ip = "127.0.0.1";
port = server.getListen();
}
if (TelnetUtils.isRunning(ip, Integer.parseInt(port)) && !ips.contains(server.getListen())) {
ips.add(server.getListen());
}
}
if (ips.size() == 0) {
return renderSuccess();
} else {
return renderError(m.get("serverStr.portUserdList") + ": " + StrUtil.join(" , ", ips));
}
}
@Mapping("editDescr")
public JsonResult editDescr(String id, String descr) {
Server server = new Server();
server.setId(id);
server.setDescr(descr);
sqlHelper.updateById(server);
return renderSuccess();
}
@Mapping("preview")
public JsonResult preview(String id, String type) {
NgxBlock ngxBlock = null;
if (type.equals("server")) {
Server server = sqlHelper.findById(id, Server.class);
ngxBlock = confService.bulidBlockServer(server);
} else if (type.equals("upstream")) {
Upstream upstream = sqlHelper.findById(id, Upstream.class);
ngxBlock = confService.buildBlockUpstream(upstream);
} else if (type.equals("http")) {
List<Http> httpList = sqlHelper.findAll(new Sort("seq", Direction.ASC), Http.class);
ngxBlock = new NgxBlock();
ngxBlock.addValue("http");
for (Http http : httpList) {
if (http.getEnable() == null || !http.getEnable()) {
continue;
}
NgxParam ngxParam = new NgxParam();
ngxParam.addValue(http.getName().trim() + " " + http.getValue().trim());
ngxBlock.addEntry(ngxParam);
}
} else if (type.equals("stream")) {
List<Stream> streamList = sqlHelper.findAll(new Sort("seq", Direction.ASC), Stream.class);
ngxBlock = new NgxBlock();
ngxBlock.addValue("stream");
for (Stream stream : streamList) {
NgxParam ngxParam = new NgxParam();
ngxParam.addValue(stream.getName() + " " + stream.getValue());
ngxBlock.addEntry(ngxParam);
}
}
NgxConfig ngxConfig = new NgxConfig();
ngxConfig.addEntry(ngxBlock);
String conf = ToolUtils.handleConf(new NgxDumper(ngxConfig).dump());
return renderSuccess(conf);
}
@Mapping("setOrder")
public JsonResult setOrder(String id, Integer count) {
serverService.setSeq(id, count);
return renderSuccess();
}
@Mapping("getDescr")
public JsonResult getDescr(String id) {
Server server = sqlHelper.findById(id, Server.class);
return renderSuccess(server.getDescr());
}
@Mapping("getLocationDescr")
public JsonResult getLocationDescr(String id) {
Location location = sqlHelper.findById(id, Location.class);
return renderSuccess(location.getDescr());
}
@Mapping("setLocationDescr")
public JsonResult setLocationDescr(String id, String descr) {
Location location = new Location();
location.setId(id);
location.setDescr(descr);
sqlHelper.updateById(location);
return renderSuccess();
}
@Mapping("upload")
public JsonResult upload(Context context, UploadedFile file) {
try {
File temp = new File(FileUtil.getTmpDir() + "/" + file.getName());
file.transferTo(temp);
// 移动文件
File dest = new File(homeConfig.home + "cert/" + file.getName());
while (FileUtil.exist(dest)) {
dest = new File(dest.getPath() + "_1");
}
FileUtil.move(temp, dest, true);
String localType = (String) context.session("localType");
if ("remote".equals(localType)) {
Remote remote = (Remote) context.session("remote");
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("file", temp);
String rs = HttpUtil.post(remote.getProtocol() + "://" + remote.getIp() + ":" + remote.getPort() + "/upload", paramMap);
JsonResult jsonResult = JSONUtil.toBean(rs, JsonResult.class);
FileUtil.del(temp);
return jsonResult;
}
return renderSuccess(dest.getPath().replace("\\", "/"));
} catch (IllegalStateException | IOException e) {
logger.error(e.getMessage(), e);
}
return renderError();
}
}
| [
"cym1102@qq.com"
] | cym1102@qq.com |
350e62d2edbc668294443b21762c86fa2520e1e3 | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Spring/Spring13542.java | 9b7f105caf7190f9f9647d5cd738687766274812 | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | @Override
protected void extendRequest(MockHttpServletRequest request) {
TestBean bean = new TestBean();
bean.setName("foo");
bean.setFavouriteColour(Colour.GREEN);
bean.setStringArray(ARRAY);
bean.setSpouse(new TestBean("Sally"));
bean.setSomeNumber(new Float("12.34"));
List friends = new ArrayList();
friends.add(new TestBean("bar"));
friends.add(new TestBean("penc"));
bean.setFriends(friends);
request.setAttribute("testBean", bean);
}
| [
"Qing.Mi@my.cityu.edu.hk"
] | Qing.Mi@my.cityu.edu.hk |
e8fa419b31d8c76c109e13e5b0a8c81088dec0ca | abda16e051b78404102e5af67afacefa364134fb | /environment/src/main/java/jetbrains/exodus/tree/btree/DupLeafNodeMutable.java | abe995c7cb625859861b07787be06945e657154d | [
"Apache-2.0"
] | permissive | yusuke/xodus | c000e9dc098d58e1e30f6d912ab5283650d3f5c0 | f84bb539ec16d96136d35600eb6f0966cc7b3b07 | refs/heads/master | 2023-09-04T12:35:52.294475 | 2017-12-01T18:46:24 | 2017-12-01T18:46:52 | 112,916,407 | 0 | 0 | null | 2017-12-03T09:46:15 | 2017-12-03T09:46:15 | null | UTF-8 | Java | false | false | 2,494 | java | /**
* Copyright 2010 - 2017 JetBrains s.r.o.
*
* 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 jetbrains.exodus.tree.btree;
import jetbrains.exodus.ByteIterable;
import jetbrains.exodus.CompoundByteIterable;
import jetbrains.exodus.log.CompressedUnsignedLongByteIterable;
import jetbrains.exodus.log.Loggable;
import jetbrains.exodus.tree.ITree;
import org.jetbrains.annotations.NotNull;
/**
* Stateful leaf node for mutable tree of duplicates
*/
class DupLeafNodeMutable extends BaseLeafNodeMutable {
protected long address = Loggable.NULL_ADDRESS;
protected final ByteIterable key;
protected final BTreeDupMutable dupTree;
DupLeafNodeMutable(@NotNull ByteIterable key, @NotNull BTreeDupMutable dupTree) {
this.key = key;
this.dupTree = dupTree;
}
@Override
public boolean isDupLeaf() {
return true;
}
@Override
@NotNull
public ByteIterable getKey() {
return key;
}
@Override
@NotNull
public ByteIterable getValue() {
return dupTree.key;
}
@Override
public long getAddress() {
return address;
}
@Override
public long save(ITree mainTree) {
assert mainTree == dupTree;
if (address != Loggable.NULL_ADDRESS) {
throw new IllegalStateException("Leaf already saved");
}
address = mainTree.getLog().write(((BTreeMutable) mainTree).getLeafType(),
mainTree.getStructureId(),
new CompoundByteIterable(new ByteIterable[]{
CompressedUnsignedLongByteIterable.getIterable(key.getLength()),
key
}));
return address;
}
@Override
public boolean delete(ByteIterable value) {
throw new UnsupportedOperationException("Supported by dup node only");
}
@Override
public String toString() {
return "DLN* {key:" + getKey().toString() + "} @ " + getAddress();
}
}
| [
"lvo@intellij.net"
] | lvo@intellij.net |
8e65cf996464d9e4011e85466ede50ffa7ab72d7 | 91c7575c1c647e163748d82bd4383424d3852d75 | /25.java | 90bcd7cfc2adcdf898814f2520e36bdce0eb6368 | [] | no_license | CROSSWF/Coding_Interviews_in_Java | 4fb9b7eaf5fbda15e2be840a442189fcca858086 | 63c76d95cba2aa7d06854d1ab4452e8a6014c8eb | refs/heads/master | 2020-04-05T15:01:01.051704 | 2018-11-10T05:01:21 | 2018-11-10T05:01:21 | 156,948,459 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,086 | java | /*
public class ListNode {
int val;
ListNode next = null;
ListNode(int val) {
this.val = val;
}
}*/
public class Solution {
public ListNode Merge(ListNode list1,ListNode list2) {
ListNode head = null;
if(list1 == null) return list2;
if(list2 == null) return list1;
if(list1.val > list2.val){
head = list2;
list2 = list2.next;
head.next = null;
}else{
head = list1;
list1 = list1.next;
head.next = null;
}
ListNode first = head;
while(list1 != null && list2 != null){
if(list1.val > list2.val){
head.next = new ListNode(list2.val);
list2 = list2.next;
head = head.next;
}else{
head.next = new ListNode(list1.val);
list1 = list1.next;
head = head.next;
}
}
if(list1 == null) head.next = list2;
else head.next = list1;
return first;
}
}
| [
"crosswf@qq.com"
] | crosswf@qq.com |
af381678d51980d8c3e572d3bfdbe9338ed9b1e9 | f3f44380502515956839f929318da0d3ff9b2690 | /src/main/java/com/gmail/dimaliahov/controller/CartController.java | d9df986e9e87a70bd8aab356f618ebc8fec123a0 | [] | no_license | LiakhovDmitriy/Adidas_SpringMVC_release | 382e847c00833cbee6fb48630ab08d1f2e4859c8 | 78a88eee1febb26a9674362a24b9d97491edd565 | refs/heads/master | 2023-01-05T03:12:50.526616 | 2020-10-31T15:06:10 | 2020-10-31T15:06:10 | 294,409,861 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,191 | java | package com.gmail.dimaliahov.controller;
import com.gmail.dimaliahov.serviceForController.serviceInterface.CartControllerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpSession;
@Controller
public class CartController {
@Autowired
private CartControllerService cartControllerService;
@RequestMapping (value = "/cart", method = RequestMethod.GET)
public String getCart (HttpSession session) {
return cartControllerService.getCart(session);
}
@RequestMapping (value = "/cart", method = RequestMethod.POST)
public String postCart (HttpSession session,
@RequestParam (value = "removeId", defaultValue = "test") String removeStr,
@RequestParam (value = "idProduct", defaultValue = "test") String productId,
@RequestParam (value = "amount", defaultValue = "test") String amount
) {
return cartControllerService.postCart(session, removeStr, productId, amount);
}
}
| [
"dimaliahov@gmail.com"
] | dimaliahov@gmail.com |
7357ea653a59ab12f8f27c32effc1e4dd4af3fbf | c3519a97e09b756a0950fa6ca41f2e4834e62181 | /maven-compiler-plugin/src/it/automodules-application/src/main/java/org/maven/test/Main.java | 570983c4575b78fd4629813441f57e2840fe8337 | [
"Apache-2.0"
] | permissive | mattnelson/maven-plugins | fe00b3a09d4c6ac1265d430a04cc088d86ef2c9d | 71c24e418afd37b8f4290fd1a4e0419bc9e2285a | refs/heads/trunk | 2020-12-30T16:48:02.527643 | 2017-05-11T21:13:27 | 2017-05-11T21:13:27 | 91,035,145 | 0 | 0 | null | 2018-03-09T00:24:35 | 2017-05-12T00:37:05 | Java | UTF-8 | Java | false | false | 1,097 | java | package org.maven.test;
/*
* 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.
*/
import java.util.ArrayList;
import java.util.List;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
List blah = new ArrayList();
blah.add("hello");
}
}
| [
"rfscholte@apache.org"
] | rfscholte@apache.org |
1bfd0fe3a165a423af4d1815680ebff006fc328c | ca0e9689023cc9998c7f24b9e0532261fd976e0e | /src/com/tencent/mm/plugin/webview/ui/tools/jsapi/f$7.java | f67190fc96c513f780f9713f6074745c8a686982 | [] | no_license | honeyflyfish/com.tencent.mm | c7e992f51070f6ac5e9c05e9a2babd7b712cf713 | ce6e605ff98164359a7073ab9a62a3f3101b8c34 | refs/heads/master | 2020-03-28T15:42:52.284117 | 2016-07-19T16:33:30 | 2016-07-19T16:33:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 751 | java | package com.tencent.mm.plugin.webview.ui.tools.jsapi;
import com.tencent.mm.sdk.platformtools.u;
import com.tencent.mm.ui.widget.MMWebView;
public final class f$7
implements Runnable
{
public f$7(f paramf, String paramString) {}
public final void run()
{
try
{
f.c(irg).evaluateJavascript("javascript:WeixinJSBridge._handleMessageFromWeixin(" + irh + ")", null);
return;
}
catch (Exception localException)
{
u.e("!32@/B4Tb64lLpJkA9LZbWsTvpjmW6KIbHU+", "onVoiceUploadProgress fail, ex = %s", new Object[] { localException.getMessage() });
}
}
}
/* Location:
* Qualified Name: com.tencent.mm.plugin.webview.ui.tools.jsapi.f.7
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
e5ecf043ff4be98122e7901d2e8c2e2f432ab1a2 | a74931620918827d0d5f9130459ac52f1e3ef2f2 | /GeekUniversity/Week_03/NQueens.java | 0f01c4806311b32306e02638efcd88a86472fa20 | [] | no_license | mengMia/algorithm016 | a081b4af84cbd59c2bbd195a90687d6c841bc387 | ccea551bf925fbbd5a8bd8139986ae618bdbe71d | refs/heads/master | 2023-03-20T13:30:48.114757 | 2021-03-20T05:29:23 | 2021-03-20T05:29:23 | 294,893,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,003 | java | package leetcode.editor.cn;
//n 皇后问题研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击。
//
//
//
// 上图为 8 皇后问题的一种解法。
//
// 给定一个整数 n,返回所有不同的 n 皇后问题的解决方案。
//
// 每一种解法包含一个明确的 n 皇后问题的棋子放置方案,该方案中 'Q' 和 '.' 分别代表了皇后和空位。
//
//
//
// 示例:
//
// 输入:4
//输出:[
// [".Q..", // 解法 1
// "...Q",
// "Q...",
// "..Q."],
//
// ["..Q.", // 解法 2
// "Q...",
// "...Q",
// ".Q.."]
//]
//解释: 4 皇后问题存在两个不同的解法。
//
//
//
//
// 提示:
//
//
// 皇后彼此不能相互攻击,也就是说:任何两个皇后都不能处于同一条横行、纵行或斜线上。
//
// Related Topics 回溯算法
// 👍 620 👎 0
import java.util.*;
public class NQueens{
public static void main(String[] args) {
Solution solution = new NQueens().new Solution();
}
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
//成员变量,减少参数传递
private Set<Integer> cols;
private Set<Integer> pie;
private Set<Integer> na;
private int n;
private List<List<String>> res;
public List<List<String>> solveNQueens(int n) {
this.n = n;
res = new ArrayList<>();
if (n < 1) return res;
//之前的皇后所攻击的位置(列、pie、na)
cols = new HashSet<>();
pie = new HashSet<>();
na = new HashSet<>();
Deque<Integer> path = new ArrayDeque<>();
dfs(0, path);
return res;
}
private void dfs(int row, Deque<Integer> path) {
if (row == n) {
List<String> board = convert2board(path);
res.add(board);
return;
}
//遍历列columns,将皇后挨个尝试放置
for (int i = 0; i < n; i++) {
//如果当前位置不会受到攻击,则可以放置
if (!cols.contains(i) && !pie.contains(row + i) && !na.contains(row - i)) {
path.addLast(i);
cols.add(i);
pie.add(row + i);
na.add(row - i);
//drill down
dfs(row + 1, path);
//revert states
cols.remove(i);
na.remove(row - i);
pie.remove(row + i);
path.removeLast();
}
}
}
private List<String> convert2board(Deque<Integer> path) {
List<String> board = new ArrayList<>();
for (Integer num : path) {
StringBuilder row = new StringBuilder();
row.append(".".repeat(Math.max(0, n)));
row.replace(num, num + 1, "Q");
board.add(row.toString());
}
return board;
}
}
//leetcode submit region end(Prohibit modification and deletion)
} | [
"mengya@ahu.edu.cn"
] | mengya@ahu.edu.cn |
0e2f9e30e7cb8b7be16b3fa05229ae266b068078 | b90ebc30d819788319ceda196d07c56ccd2e7b57 | /src/lv/tsi/metodi/Main.java | a01954e9d92d8df3d1803719d818300422fc3e73 | [] | no_license | andermax/Chislennie | 32dbb88385c56d7bf6380fc730462bf79d03cd74 | f1b3c1e1c077f9842a21e481dabfb08f07bd00cc | refs/heads/master | 2020-03-28T21:11:07.007776 | 2018-09-21T14:58:51 | 2018-09-21T14:58:51 | 149,136,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | package lv.tsi.metodi;
import lv.tsi.metodi.Calculator.ICalculator;
import lv.tsi.metodi.Calculator.Gauss;
import lv.tsi.metodi.printers.ConsolePrinter;
import lv.tsi.metodi.printers.IPrinter;
public class Main {
public static void main(String[] args) {
double[][] values = {
{4.0, 3.0, -2.0, 4.0},
{5.0, 8.0, 1.0, 8.0},
{3.0, 2.0, -3.2, 10.0}
};
System.out.println(" ");
IPrinter printer = new ConsolePrinter();
Gauss calc = new Gauss();
Matrix mtx = new Matrix(values);
System.out.print("print values");
printer.print(mtx.getValues());
printer.print(mtx.getVectorB());
System.out.println("metof gaussa");
printer.print(calc.forward(mtx.getMtxA(),mtx.getVectorB()));
}
}
| [
"maks@cateye.lv"
] | maks@cateye.lv |
d8f2865fe555873f4c43936fa3617db4c749d380 | 92998b68149621042e2b4053b8e00f2375548cb2 | /src/main/java/io/springlab/springexceptions/model/Product.java | c6db8cf7364b1b7b81cfa253be447bb29e508169 | [] | no_license | priyodas12/spring-exceptions | d8d843b235de7abfab89dd673bcc59d621b67521 | dd878631d809ec2a931a54e28f9dd4b0060f4e66 | refs/heads/master | 2022-08-26T14:17:03.128448 | 2020-05-19T20:28:01 | 2020-05-19T20:28:01 | 265,353,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | package io.springlab.springexceptions.model;
import java.io.Serializable;
public class Product implements Serializable {
private static final long serialVersionUID = -4665965070554387387L;
private int id;
private String category;
private double price;
private String producer;
protected Product(int id, String category, double price, String producer) {
this.id = id;
this.category = category;
this.price = price;
this.producer = producer;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getProducer() {
return producer;
}
public void setProducer(String producer) {
this.producer = producer;
}
}
| [
"priyodas12@gmail.com"
] | priyodas12@gmail.com |
2e738c8ec8504fdb454a97b2f3a717e8814e7dc9 | 5b41548e608034b347a80581e77d3881050b069f | /DAM2/PMM/Ejercicios Resueltos/Proyecto607/app/src/main/java/com/example/juan11791/proyecto607/Actividad1.java | ea578820923059c0b0480ba2f0c15405b41a18df | [] | no_license | ColaboraGIT/DAM | ff4e6c2fda336224cfcaeb49b41718e8d4adebee | c7721f0767d843c8552c21f5cf06beecd3bb18aa | refs/heads/master | 2023-09-01T07:43:47.493781 | 2021-10-09T06:04:57 | 2021-10-09T06:04:57 | 317,482,034 | 0 | 3 | null | 2020-12-09T17:23:45 | 2020-12-01T08:58:03 | Java | UTF-8 | Java | false | false | 896 | java | package com.example.juan11791.proyecto607;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
public class Actividad1 extends AppCompatActivity
{
private TextView tv1;
private String nombre, genero;
private int edad;
private float salario;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_actividad1);
Bundle bundle = getIntent().getExtras();
tv1 = (TextView)findViewById(R.id.tv1);
nombre = bundle.getString("Nombre");
genero = bundle.getString("Género");
edad = bundle.getInt("Edad", 0);
salario = bundle.getFloat("Salario", 0);
tv1.setText(nombre + " es " + genero + " de " + edad + " años de edad, con un salario de " + salario + "€");
}
}
| [
"juanrobertogarciasanchez@gmail.com"
] | juanrobertogarciasanchez@gmail.com |
1b7e6315ef9a0677fc4937a4b89770e85f3b993e | 9948b6ffbc8822048e8d1c747d5da73ba8edf0bd | /src/main/java/dbs/project/dao/event/CardEventDao.java | 1b2b9a3710a8442da43fb2ee02cb5ce88118fc7d | [] | no_license | gitmo/WM | 7bc98f8a84b1dbe7d8062efa3486f5ae957fe37d | 40b66e65de47c55ae07b474e8f46d9fc95c2861f | refs/heads/master | 2021-03-12T23:02:07.221311 | 2010-08-03T11:28:26 | 2010-08-03T11:28:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package dbs.project.dao.event;
import java.util.List;
import org.hibernate.criterion.Restrictions;
import dbs.project.dao.DaoBase;
import dbs.project.entity.Match;
import dbs.project.entity.event.player.CardEvent;
public class CardEventDao extends DaoBase{
@SuppressWarnings("unchecked")
public static List<CardEvent> findAllByMatch(Match match) {
return session.createCriteria(CardEvent.class)
.add(Restrictions.eq("match", match)).list();
}
@SuppressWarnings("unchecked")
public static List<CardEvent> findAll(){
return session.createCriteria(CardEvent.class).list();
}
}
| [
"f.hoeffken@fu-berlin.de"
] | f.hoeffken@fu-berlin.de |
bb45a4961f4520e0b5d94fd4f5210d6ea94b5f98 | 01c63c60b48375c008aa9114fad25bf41c659c54 | /FinalProject/data-vilij/src/settings/AppPropertyTypes.java | ae97585dda89e7375d60552bcbd21d11dd5a5824 | [] | no_license | adityataday/DataViLiJ | 39242065a3e3d49e908e7e90b55572401ef137c2 | 6449f505568242135163ac682e53bcd65966b7ff | refs/heads/master | 2020-03-19T10:35:53.829901 | 2018-05-07T05:08:56 | 2018-05-07T05:08:56 | 136,385,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | java | package settings;
/**
* This enumerable type lists the various application-specific property types listed in the initial set of properties to
* be loaded from the workspace properties <code>xml</code> file specified by the initialization parameters.
*
* @author Ritwik Banerjee
* @see vilij.settings.InitializationParams
*/
public enum AppPropertyTypes {
/* resource files and folders */
DATA_RESOURCE_PATH,
GUI_RESOURCE_PATH,
CSS_RESOURCE_PATH,
CSS_RESOURCE_FILENAME,
CLASSIFICATION_RESOURCE_PATH,
CLUSTERING_RESOURCE_PATH,
/* user interface icon file names */
SCREENSHOT_ICON,
RESTART_ICON,
CONFIG_ICON,
RUN_ICON,
/* tooltips for user interface buttons */
SCREENSHOT_TOOLTIP,
RESTART_TOOLTIP,
/* error messages */
RESOURCE_SUBDIR_NOT_FOUND,
INCORRECT_FILE_EXTENSION_DATA,
INCORRECT_FILE_EXTENSION_IMAGE,
LABEL_ALREADY_EXISTS,
EXIT_WHILE_RUNNING_WARNING,
EXIT_WHILE_RUNNING_WARNING_TITLE,
NO_ALGORITHM_FOUND_TITLE,
/* application-specific message titles */
SAVE_UNSAVED_WORK_TITLE,
LOAD_DATA,
TO_MANY_LINES,
TO_MANY_LINES_MSG_1,
TO_MANY_LINES_MSG_2,
SAVE_IMAGE,
ALGORITHM_DONE_TITLE,
/* application-specific messages */
SAVE_UNSAVED_WORK,
ALGORITHM_DONE_MESSAGE,
/* application-specific parameters */
DATA_FILE_EXT,
IMAGE_FILE_EXT,
DATA_FILE_EXT_DESC,
IMAGE_FILE_EXT_DESC,
TEXT_AREA,
SPECIFIED_FILE,
LEFT_PANE_TITLE,
LEFT_PANE_TITLEFONT,
LEFT_PANE_TITLESIZE,
CHART_TITLE,
DISPLAY_BUTTON_TEXT,
CHECKBOX_LABEL
}
| [
"adi.taday@gmail.com"
] | adi.taday@gmail.com |
a7e1b405a7e8d8855cd23a0d5723a9edae5638f2 | 8c085f12963e120be684f8a049175f07d0b8c4e5 | /castor/branches/JDO_DEV_0_9_2/castor-2002/castor/src/main/org/exolab/castor/builder/CollectionInfoODMG30.java | 36a3312dd6371eba20dd39f3a7416ccf69658cf9 | [] | no_license | alam93mahboob/castor | 9963d4110126b8f4ef81d82adfe62bab8c5f5bce | 974f853be5680427a195a6b8ae3ce63a65a309b6 | refs/heads/master | 2020-05-17T08:03:26.321249 | 2014-01-01T20:48:45 | 2014-01-01T20:48:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,434 | java | package org.exolab.castor.builder;
import org.exolab.castor.builder.*;
import org.exolab.castor.builder.types.*;
import org.exolab.castor.xml.JavaNaming;
import org.exolab.javasource.*;
import java.util.Vector;
/**
* A helper used for generating source that deals with Collections.
* @author <a href="mailto:frank.thelen@poet.de">Frank Thelen</a>
* @author <a href="mailto:bernd.deichmann@poet.de">Bernd Deichmann</a>
* @version $Revision$ $Date$
**/
public class CollectionInfoODMG30 extends CollectionInfo {
/**
* Creates a new CollectionInfoODMG30
* @param contextType the content type of the collection, ie. the type
* of objects that the collection will contain
* @param name the name of the Collection
* @param elementName the element name for each element in collection
**/
public CollectionInfoODMG30(XSType contentType, String name, String elementName)
{
super(contentType, name, elementName);
//getSchemaType().setJType(new JClass("org.odmg.DArray"));
setSchemaType(new XSListODMG30(contentType));
} //-- CollectionInfoODMG30
/**
* Creates code for initialization of this Member
* @param jsc the JSourceCode in which to add the source to
**/
public void generateInitializerCode(JSourceCode jsc) {
jsc.add(getName());
//jsc.append(" = new Vector();");
jsc.append(" = ODMG.getImplementation().newDArray();");
} //-- generateConstructorCode
//------------------/
//- Public Methods -/
//------------------/
/**
* Creates implementation of add method.
**/
public void createAddMethod(JMethod method) {
JSourceCode jsc = method.getSourceCode();
int maxSize = getXSList().getMaximumSize();
if (maxSize > 0) {
jsc.add("if (!(");
jsc.append(getName());
jsc.append(".size() < ");
jsc.append(Integer.toString(maxSize));
jsc.append(")) {");
jsc.indent();
jsc.add("throw new IndexOutOfBoundsException();");
jsc.unindent();
jsc.add("}");
}
jsc.add(getName());
//jsc.append(".addElement(");
jsc.append(".add(");
jsc.append(getContentType().createToJavaObjectCode(getContentName()));
jsc.append(");");
} //-- createAddMethod
/**
* Creates implementation of object[] get() method.
**/
public void createGetMethod(JMethod method) {
JSourceCode jsc = method.getSourceCode();
JType jType = method.getReturnType();
jsc.add("int size = ");
jsc.append(getName());
jsc.append(".size();");
//String variableName = getName()+".elementAt(index)";
String variableName = getName()+".get(index)";
JType compType = jType.getComponentType();
jsc.add(compType.toString());
jsc.append("[] mArray = new ");
jsc.append(compType.getLocalName());
jsc.append("[size]");
//-- if component is an array, we must add [] after setting
//-- size
if (compType.isArray()) jsc.append("[]");
jsc.append(";");
jsc.add("for (int index = 0; index < size; index++) {");
jsc.indent();
jsc.add("mArray[index] = ");
if (getContentType().getType() == XSType.CLASS) {
jsc.append("(");
jsc.append(jType.getLocalName());
jsc.append(") ");
jsc.append(variableName);
}
else {
jsc.append(getContentType().createFromJavaObjectCode(variableName));
}
jsc.append(";");
jsc.unindent();
jsc.add("}");
jsc.add("return mArray;");
} //-- createGetMethod
/**
* Creates implementation of the get(index) method.
**/
public void createGetByIndexMethod(JMethod method) {
JSourceCode jsc = method.getSourceCode();
JType jType = method.getReturnType();
jsc.add("//-- check bounds for index");
jsc.add("if ((index < 0) || (index > ");
jsc.append(getName());
jsc.append(".size())) {");
jsc.indent();
jsc.add("throw new IndexOutOfBoundsException();");
jsc.unindent();
jsc.add("}");
jsc.add("");
jsc.add("return ");
//String variableName = getName()+".elementAt(index)";
String variableName = getName()+".get(index)";
if (getContentType().getType() == XSType.CLASS) {
jsc.append("(");
jsc.append(jType.toString());
jsc.append(") ");
jsc.append(variableName);
}
else {
jsc.append(getContentType().createFromJavaObjectCode(variableName));
}
jsc.append(";");
} //-- createGetByIndex
/**
* Creates implementation of array set method
*
* Method added 12/14/2000 BD
**/
public void createSetArrayMethod(JMethod method) {
JSourceCode jsc = method.getSourceCode();
String paramName = method.getParameter(0).getName();
String index = "i";
if (paramName.equals(index)) index = "j";
jsc.add("//-- copy array");
jsc.add(getName());
jsc.append(".clear();");
jsc.add("for (int ");
jsc.append(index);
jsc.append(" = 0; ");
jsc.append(index);
jsc.append(" < ");
jsc.append(paramName);
jsc.append(".length; ");
jsc.append(index);
jsc.append("++) {");
jsc.indent();
jsc.add(getName());
jsc.append(".add(");
jsc.append(getContentType().createToJavaObjectCode(paramName+'['+index+']'));
jsc.append(");");
jsc.unindent();
jsc.add("}");
//-- bound properties
if (isBound())
createBoundPropertyCode(jsc);
} //-- createSetArrayMethod
/**
* Creates implementation of set method.
**/
public void createSetByIndexMethod(JMethod method) {
JSourceCode jsc = method.getSourceCode();
jsc.add("//-- check bounds for index");
jsc.add("if ((index < 0) || (index > ");
jsc.append(getName());
jsc.append(".size())) {");
jsc.indent();
jsc.add("throw new IndexOutOfBoundsException();");
jsc.unindent();
jsc.add("}");
int maxSize = getXSList().getMaximumSize();
if (maxSize != 0) {
jsc.add("if (!(");
jsc.append(getName());
jsc.append(".size() < ");
jsc.append(Integer.toString(maxSize));
jsc.append(")) {");
jsc.indent();
jsc.add("throw new IndexOutOfBoundsException();");
jsc.unindent();
jsc.add("}");
}
jsc.add(getName());
//jsc.append(".setElementAt(");
//jsc.append(getContentType().createToJavaObjectCode(getContentName()));
//jsc.append(", index);");
jsc.append(".set("); // ODMG 3.0
jsc.append("index, ");
jsc.append(getContentType().createToJavaObjectCode(getContentName()));
jsc.append(");");
} //-- createSetMethod
/**
* Creates implementation of getCount method.
**/
public void createGetCountMethod(JMethod method) {
super.createGetCountMethod(method);
} //-- createGetCoundMethod
/**
* Creates implementation of Enumerate method.
**/
public void createEnumerateMethod(JMethod method) {
JSourceCode jsc = method.getSourceCode();
//jsc.add("return ");
//jsc.append(getName());
//jsc.append(".elements();");
jsc.add("java.util.Vector v = new java.util.Vector();"); // ODMG 3.0
jsc.add("java.util.Iterator i = ");
jsc.append(getName());
jsc.append(".iterator();");
jsc.add("while(i.hasNext()) v.add(i.next());");
jsc.add("return v.elements();");
} //-- createEnumerateMethod
/**
* Creates implementation of remove(Object) method.
**/
public void createRemoveByObjectMethod(JMethod method) {
super.createRemoveByObjectMethod(method);
} //-- createRemoveByObjectMethod
/**
* Creates implementation of remove(int i) method.
**/
public void createRemoveByIndexMethod(JMethod method) {
JSourceCode jsc = method.getSourceCode();
JType jType = method.getReturnType();
jsc.add("Object obj = ");
jsc.append(getName());
//jsc.append(".elementAt(index);");
jsc.append(".get(index);");
jsc.add(getName());
//jsc.append(".removeElementAt(index);");
jsc.append(".remove(index);");
jsc.add("return ");
if (getContentType().getType() == XSType.CLASS) {
jsc.append("(");
jsc.append(jType.getName());
jsc.append(") obj;");
}
else {
jsc.append(getContentType().createFromJavaObjectCode("obj"));
jsc.append(";");
}
} //-- createRemoveByIndexMethod
/**
* Creates implementation of removeAll() method.
**/
public void createRemoveAllMethod (JMethod method) {
JSourceCode jsc = method.getSourceCode();
jsc.add(getName());
//jsc.append(".removeAllElements();");
jsc.append(".clear();");
} //-- createRemoveAllMethod
} //-- CollectionInfoODMG30
| [
"nobody@b24b0d9a-6811-0410-802a-946fa971d308"
] | nobody@b24b0d9a-6811-0410-802a-946fa971d308 |
af8a0778b512205dc6c7ec229bfc7d9338ac7da1 | 4a425b23a2e67922d5e9769de19ed86a41512008 | /flower/src/com/xhc/model/Catalog.java | fc015cce0333232ab91dc3045c44892c08a770c9 | [
"Apache-2.0"
] | permissive | cnxhc/homework_10 | f5fc07070061afd5c82e781382ba28c2ceadafd1 | a22f7bd62742977bbd9e0f5ced1ad226b0f95817 | refs/heads/master | 2021-01-20T19:59:35.512844 | 2016-08-14T07:58:06 | 2016-08-14T07:58:06 | 65,653,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package com.xhc.model;
import java.util.HashSet;
import java.util.Set;
/**
* Category entity. @author MyEclipse Persistence Tools
*/
public class Catalog implements java.io.Serializable {
// Fields
private Integer id;
private String catalogName;
private Set goodses;
// Constructors
/** default constructor */
public Catalog() {
}
/** minimal constructor */
public Catalog(String catalogName) {
this.catalogName = catalogName;
}
/** full constructor */
public Catalog(String catalogName, Set goodses) {
this.catalogName = catalogName;
this.goodses = goodses;
}
// Property accessors
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCatalogName() {
return catalogName;
}
public void setCatalogName(String catalogName) {
this.catalogName = catalogName;
}
public Set getGoodses() {
return this.goodses;
}
public void setGoodses(Set goodses) {
this.goodses = goodses;
}
} | [
"1035723742@qq.com"
] | 1035723742@qq.com |
7e5c009ee33f0a05c3469277573708c5b39279c6 | ce84a78f88e00ff8f87d283813d625d164005fdd | /src/main/java/com/depas/hackerrank/Array.java | 6ea650b89d5b9b20ef02c0f6bf67b738bc953014 | [
"Unlicense"
] | permissive | depas98/hackerrank_java | 87b24e7b012f7f97e38cd7853740e776e3f08ea4 | ff7ef72618bb066816c83a2263ffee6b6ee04354 | refs/heads/master | 2020-12-30T15:22:21.556831 | 2017-05-12T23:24:27 | 2017-05-12T23:24:27 | 91,136,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package com.depas.hackerrank;
import java.util.Scanner;
public class Array {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] arr = new int[n];
for(int i=0; i < n; i++){
arr[i] = in.nextInt();
}
in.close();
String del = "";
for(int i=arr.length-1; i>-1; i--){
System.out.print(del + arr[i]);
del = " ";
}
}
}
| [
"mike.depasquale@solarwinds.com"
] | mike.depasquale@solarwinds.com |
7b8dd838cdf080ff53342d6cf19477724c6d518c | f0d7dd6ac3ebb360b0f633a6784d6b0a0f9584e1 | /spring-rabbitmq/src/main/java/com/mohsinkd786/config/RabbitMqSettings.java | bb6b8fbbfbf9a0a8ea6b08c816677d5dee68295f | [
"Apache-2.0"
] | permissive | mohsinkd786/spring | ed8124c93c855b44003a24548d0dac22ab44fcb0 | 6a41f7bcd77b58146dd77bae2373bfbb5206ec52 | refs/heads/master | 2022-11-30T16:10:51.841094 | 2021-07-26T10:04:28 | 2021-07-26T10:04:28 | 148,882,120 | 6 | 4 | Apache-2.0 | 2022-11-24T09:24:11 | 2018-09-15T08:00:15 | Java | UTF-8 | Java | false | false | 955 | java | package com.mohsinkd786.config;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RabbitMqSettings {
// Topic Exchange configs
public final static String TOPIC_USER_QUEUE = "com.mohsinkd786.topic.user";
public final static String TOPIC_EMPLOYEE_QUEUE = "com.mohsinkd786.topic.employee";
public final static String TOPIC_EXCHANGE = "com.mohsinkd786.topic.exchange";
public final static String BINDING_PATTERN_EMPLOYED = "*.employed.*";
public final static String BINDING_PATTERN_UNEMPLOYED = "#.unemployed";
// Fanout Exchange configs
public final static String FANOUT_USER_QUEUE = "com.mohsinkd786.fanout.user";
public final static String FANOUT_EMPLOYEE_QUEUE = "com.mohsinkd786.fanout.employee";
public final static String FANOUT_CANDIDATE_QUEUE = "com.mohsinkd786.fanout.candidate";
public final static String FANOUT_EXCHANGE = "com.mohsinkd786.fanout.exchange";
}
| [
"mohsin.khursheed@techjini.com"
] | mohsin.khursheed@techjini.com |
13916a5b060591867cbb8adc8cd7e5d9847299e5 | e17f492e91d08c79f9737317d0d102018f398f46 | /15-TeamB-最终完整文档/06测试报告及测试脚本/测试脚本/scripts/TestReducer/TestReducer_Reduce.java | 03f3a03320b467c84bc542e200b5154deb81945e | [] | no_license | bhsei/TeamB | b6ea633d99cc670c0d6b6938a73ee81bdba74d33 | 289de17e111be4fa74cc462472779b5f3b053f5f | refs/heads/master | 2021-01-15T18:00:55.287170 | 2015-06-17T02:44:43 | 2015-06-17T02:44:43 | 32,782,421 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,245 | java | package com.buaa.KNN;
import java.io.IOException;
import java.util.Comparator;
import java.util.Iterator;
import java.util.PriorityQueue;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
public class TestReducer_Reduce extends Reducer<Text, Text, Text, Text> {
private Text keyout = new Text();
private Text result = new Text();
final static int k = 10;
private static Comparator<Node> comparator = new Comparator<Node>() {
public int compare(Node o1, Node o2) {
if(o1.getDist() >= o2.getDist()) return 1;
else return 0;
};
};
public void reduce(Text _key, Iterable<Text> values, Context context)
throws IOException, InterruptedException {
Iterator<Text> itr = values.iterator();
PriorityQueue<Node> pq = new PriorityQueue<Node>(k, comparator);
while(itr.hasNext()){
String tmp = itr.next().toString();
String[] ss = tmp.split(":");
Node node = new Node(Double.parseDouble(ss[0].trim()), ss[1].trim());
Node top = pq.peek();
if(top==null){
pq.add(node);
}else if(top.getDist() > node.getDist()){
pq.remove();
pq.add(node);
}
}
Tools knn = new Tools();
keyout.set(_key);
result.set(knn.getMostClass(pq));
context.write(keyout, result);
}
}
| [
"zhengsiwen_s@163.com"
] | zhengsiwen_s@163.com |
010e43058fc5fab853968f9738a3ab22dd767eb1 | a9dd1697e2aead7d1d91191686b610f354252874 | /src/main/java/org/o7planning/tutorial/hibernate/beans/ShortEmpInfo.java | 62cea1c7dc2b92f1798c9bdbe73addd56ab98896 | [] | no_license | serg03092017/Hibernate-Persistence | 443f05a0e68be3a1fe5127c8160d48cfb8185a3d | 658a4a751a2c956051558d70f142c0e42b6d1717 | refs/heads/master | 2022-12-08T04:21:12.515202 | 2019-09-20T10:01:02 | 2019-09-20T10:01:02 | 209,757,193 | 0 | 0 | null | 2022-11-24T08:45:37 | 2019-09-20T09:43:13 | Java | UTF-8 | Java | false | false | 827 | java | package org.o7planning.tutorial.hibernate.beans;
public class ShortEmpInfo {
private Long empId;
private String empNo;
private String empName;
//
// Constructor have 3 parameters, will be used in the Hibernate Query.
//
public ShortEmpInfo(Long empId, String empNo, String empName) {
this.empId = empId;
this.empNo = empNo;
this.empName = empName;
}
public Long getEmpId() {
return empId;
}
public void setEmpId(Long empId) {
this.empId = empId;
}
public String getEmpNo() {
return empNo;
}
public void setEmpNo(String empNo) {
this.empNo = empNo;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
} | [
"mr.freak@inbox.ru"
] | mr.freak@inbox.ru |
3127e000fead3d90b685ff9bf7471caf735bb342 | b7348f2172a81dcc8253aaf4a46826f75692656a | /library/src/main/java/com/github/amlcurran/showcaseview/MaterialShowcaseDrawer.java | 3187371ffc2fe88b91471b945f0fa23f10044c17 | [] | no_license | michaelwolfram/PadThai | 8d3fa5c240d58e6a85ff346840c4479d8fa3f402 | 7efcbbeab5c0feb3fb6866399d2920b678d44cf0 | refs/heads/master | 2023-02-10T12:20:14.192133 | 2021-01-05T11:21:23 | 2021-01-05T11:21:23 | 185,665,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,035 | java | package com.github.amlcurran.showcaseview;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
public class MaterialShowcaseDrawer implements ShowcaseDrawer {
private float radius;
private final Paint basicPaint;
private final Paint eraserPaint;
private int backgroundColor;
public MaterialShowcaseDrawer(Resources resources) {
this.radius = resources.getDimension(R.dimen.showcase_radius_material);
this.eraserPaint = new Paint();
this.eraserPaint.setColor(0xFFFFFF);
this.eraserPaint.setAlpha(0);
this.eraserPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
this.eraserPaint.setAntiAlias(true);
this.basicPaint = new Paint();
}
@Override
public void setShowcaseColour(int color) {
// no-op
}
public void setRadius(float radius) {
this.radius = radius;
}
@Override
public void drawShowcase(Bitmap buffer, float x, float y, float scaleMultiplier) {
Canvas bufferCanvas = new Canvas(buffer);
bufferCanvas.drawCircle(x, y, radius, eraserPaint);
}
@Override
public int getShowcaseWidth() {
return (int) (radius * 2);
}
@Override
public int getShowcaseHeight() {
return (int) (radius * 2);
}
@Override
public void setShowcaseRadius(int radius) {
this.radius = radius;
}
@Override
public float getBlockedRadius() {
return radius;
}
@Override
public void setBackgroundColour(int backgroundColor) {
this.backgroundColor = backgroundColor;
}
@Override
public void erase(Bitmap bitmapBuffer) {
bitmapBuffer.eraseColor(backgroundColor);
}
@Override
public void drawToCanvas(Canvas canvas, Bitmap bitmapBuffer) {
canvas.drawBitmap(bitmapBuffer, 0, 0, basicPaint);
}
}
| [
"michaelwolfram@gmx.de"
] | michaelwolfram@gmx.de |
843cecf75014257cea0a1a7f8cd58eebf04d5d1b | 8afb5afd38548c631f6f9536846039ef6cb297b9 | /MY_REPOS/Lambda-Resource-Static-Assets/2-content/14-Pure-Education/java-data-struc/java-prep/src/test/java/data/structures/java/heaps/FindMedianTest.java | 43e264c43364f4b7d08174d2eb4bef214fa7b405 | [
"MIT"
] | permissive | bgoonz/UsefulResourceRepo2.0 | d87588ffd668bb498f7787b896cc7b20d83ce0ad | 2cb4b45dd14a230aa0e800042e893f8dfb23beda | refs/heads/master | 2023-03-17T01:22:05.254751 | 2022-08-11T03:18:22 | 2022-08-11T03:18:22 | 382,628,698 | 10 | 12 | MIT | 2022-10-10T14:13:54 | 2021-07-03T13:58:52 | null | UTF-8 | Java | false | false | 335 | java | package data.structures.java.heaps;
import org.junit.Test;
import static org.junit.Assert.*;
public class FindMedianTest
{
@Test
public void getMedian()
{
FindMedian findMedian = new FindMedian(new int[] {3, 9, 5, 0, 1, 8, 2, 7, 4, 6});
findMedian.populate();
assertEquals(4.5, findMedian.getMedian(), 0.0);
}
} | [
"bryan.guner@gmail.com"
] | bryan.guner@gmail.com |
fa44bc830cdd6fc1bf61ed168e158aedaa72eedc | 4abd6d05d2b3105a9e86a76e8aef481a8328bd7e | /shoppingCart/DVD.java | 0e6dc60dab0d93e6c1099fbba797f63e5a530244 | [] | no_license | tomasz-g/ShoppingCartApplication | 827b865a96dc87f753e628edb93e273d0e8428e6 | f53a8473e077c7e9922d95166b88964285dfbe94 | refs/heads/master | 2016-09-13T19:12:26.966411 | 2016-04-14T16:23:29 | 2016-04-14T16:23:29 | 56,189,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package shoppingCart;
public class DVD extends Product{
private String category;
private String language;
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
}
| [
"tomaszdamiang@gmail.com"
] | tomaszdamiang@gmail.com |
8b28e5250780d41969f9d1600dc7897d99b188c6 | 5ced23aba5bc9b164c0ce61156ce043f256ebe8f | /Leetcode347.java | 31f07862ac37b1b1995d863115f43667a3b20d7e | [] | no_license | TSNEUBIT/leetcode | 5c2cea7b13ba5de7e592011203c2ab53d4012ab3 | 134b31e478736e5f02c587207c8a911624637a1e | refs/heads/master | 2021-02-18T13:41:05.759124 | 2020-03-05T15:56:06 | 2020-03-05T15:56:06 | 245,186,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,447 | java |
import java.util.*;
/*
@author lushuai
@date 2019/8/31-14:44
题目描述:给定一个非空的整数数组,返回其中出现频率前 k 高的元素。
例如,给定数组 [1,1,1,2,2,3] , 和 k = 2,返回 [1,2]。
注意:
你可以假设给定的 k 总是合理的,1 ≤ k ≤ 数组中不相同的元素的个数。
你的算法的时间复杂度必须优于 O(n log n) , n 是数组的大小
*/
public class Leetcode347 {
public static void main(String[] args) {
int[] nums={1,1,1,2,2,3};
System.out.println(topKFrequent(nums,2));
}
public static List<Integer> topKFrequent(int[] nums, int k) {
HashMap<Integer, Integer> map = new HashMap<>();
//遍历数组,把出现的数字以及出现的次数,存到哈希表中
for (int i = 0; i < nums.length; i++) {
map.put(nums[i], map.getOrDefault(nums[i], 0) + 1);
}
PriorityQueue<Map.Entry<Integer, Integer>> maxHeap = new PriorityQueue<>(new Comparator<Map.Entry<Integer, Integer>>() {
@Override
public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) {
return o2.getValue() - o1.getValue();
}
});
maxHeap.addAll(map.entrySet());
List<Integer> res = new LinkedList<>();
for (int i = 0; i < k; i++) {
res.add(maxHeap.poll().getKey());
}
return res;
}
}
| [
"2576246570@qq.com"
] | 2576246570@qq.com |
5a3bfd3827239db876525b1f0f6b9fedff72d23f | afd8be503fe037306fcc6c7f721c9e0ec1a8c7c2 | /src/main/java/com/uzdz/结构型模式/适配器模式/project/adapter/PassportAdapter.java | 3c7e70609daff80a0d7f3bd54c665ddd8167a3bf | [] | no_license | uzdz/design-pattern | 512a45a63f4929ea25d312044ac71d3fa88c2272 | 6f5bfabcef0e09346dedc33ee12b71260fe75f94 | refs/heads/master | 2020-04-27T15:34:53.137965 | 2019-04-09T08:04:32 | 2019-04-09T08:04:32 | 174,451,614 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 907 | java | package com.uzdz.结构型模式.适配器模式.project.adapter;
import com.uzdz.结构型模式.适配器模式.project.passport.abs.Passport;
/**
* 通过中国护照申请美国护照的适配器
* @author Uzdz
* @date: 2019/3/25 14:25
* @since 0.1.0
*/
public class PassportAdapter implements Passport {
/**
* 中国护照
*/
private Passport passport;
public PassportAdapter(Passport passport) {
this.passport = passport;
}
@Override
public String getPassport() {
if ("china".equals(passport.getPassport())) {
System.out.println("<适配器> 验证中国护照成功,并颁发美国护照!");
return "usa";
} else {
System.out.println("<适配器> 验证中国护照失败,当前护照类型为:" + passport.getPassport() +"!");
return passport.getPassport();
}
}
}
| [
"devmen@163.com"
] | devmen@163.com |
d628b4cddab3a95d2242bf3d7d90cd8501cd2787 | 2d7606a80eed81f4ff7c127ec1d7deea4e2608b2 | /ex01/src/main/java/org/zerock/domain/pageDTO.java | 8e080aa5f1327ada206f5e8f173b4262d2fe23fa | [] | no_license | HyungWookJ/ex01 | 002652dc3327f75477e72b71d3a03e9f96db4da0 | 7272f44b0201ad1e3ad72184267669d1f35c6b38 | refs/heads/master | 2023-07-22T18:38:47.448587 | 2021-09-01T04:35:37 | 2021-09-01T04:35:37 | 398,939,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,821 | java | package org.zerock.domain;
public class pageDTO {
//1, 11, 21, 31... 저장하는 startPage변수
private int startPage;
//10, 20, 30, 40... 저장하는 endPage변수
private int endPage;
// 이전버튼 유무를 저장하는 prev변수
private boolean prev;
// 다음버튼 유무를 저장하는 next변수
private boolean next;
// 전체 데이터를 저장하는 total변수
private int total;
// Criteria데이터 저장
private Criteria cri;
public pageDTO(Criteria cri, int total) {
this.cri = cri;
this.total = total;
this.endPage = (int)(Math.ceil(cri.getPageNum()/10.0))*10;
this.startPage = this.endPage-9;
int realEnd = (int)(Math.ceil((total*1.0)/cri.getAmount()));
if(realEnd < this.endPage) {
this.endPage = realEnd;
}
this.prev = this.startPage > 1;
this.next = this.endPage < realEnd;
}
public int getStartPage() {
return startPage;
}
public void setStartPage(int startPage) {
this.startPage = startPage;
}
public int getEndPage() {
return endPage;
}
public void setEndPage(int endPage) {
this.endPage = endPage;
}
public boolean isPrev() {
return prev;
}
public void setPrev(boolean prev) {
this.prev = prev;
}
public boolean isNext() {
return next;
}
public void setNext(boolean next) {
this.next = next;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public Criteria getCri() {
return cri;
}
public void setCri(Criteria cri) {
this.cri = cri;
}
@Override
public String toString() {
return "pageDTO [startPage=" + startPage + ", endPage=" + endPage + ", prev=" + prev + ", next=" + next
+ ", total=" + total + ", cri=" + cri + "]";
}
}
| [
"GreenArt@DESKTOP-758VK1T"
] | GreenArt@DESKTOP-758VK1T |
0c54b12391cac719c8cf37678e2a4d6419f03da4 | 16329d961b768fa41eeab9503b691e7656568147 | /perenc/perenc.ups/src/main/java/com/perenc/xh/lsp/controller/admin/menu/MenuController.java | 8f3965dd60103a49a5b7921d03fee60215335942 | [] | no_license | chenlongd/wlc-park | ff558d422f788f119620e7584b1b85be9f34ee94 | 2c46a5b00a92feb7daf0bbf59cc5e9af7f0dd594 | refs/heads/master | 2022-12-21T21:01:18.795624 | 2020-03-12T07:26:46 | 2020-03-12T07:26:46 | 246,764,097 | 0 | 3 | null | 2022-12-16T03:19:05 | 2020-03-12T06:53:26 | Java | UTF-8 | Java | false | false | 12,418 | java | package com.perenc.xh.lsp.controller.admin.menu;
import com.perenc.xh.commonUtils.model.DataCodeUtil;
import com.perenc.xh.commonUtils.model.ReturnJsonData;
import com.perenc.xh.commonUtils.model.Tree;
import com.perenc.xh.commonUtils.utils.StringOrDate.DateHelperUtils;
import com.perenc.xh.lsp.entity.menu.Menu;
import com.perenc.xh.lsp.entity.user.User;
import com.perenc.xh.lsp.service.menu.MenuService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("menu")
public class MenuController {
@Autowired(required = false)
private MenuService wmMenuService;
/**
* 跳转添加菜单的页面
* @param request
* @param response
* @return
*/
// @RequestMapping("add")
// public String add(HttpServletRequest request, HttpServletResponse response){
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
//
// return "redirect:"+ PropertiesGetValue.getProperty("PAGE.URL")+"menu_add.html";
// }
/**
* 跳转修改菜单的页面
* @param request
* @param response
* @return
*/
// @RequestMapping("update")
// public String update(HttpServletRequest request,HttpServletResponse response){
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
//
// String id = request.getParameter("id");
//
// return "redirect:"+ PropertiesGetValue.getProperty("PAGE.URL")+"menu_update.html?menuId="+id;
// }
/**
* 左边的树形结构
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("/queryMenuTree")
@ResponseBody
public ReturnJsonData queryMenuTree(HttpServletRequest request, HttpServletResponse response) throws Exception{
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
String id = request.getParameter("superId");
User user = (User) request.getSession().getAttribute("user");
List<Tree> treeList = wmMenuService.queryMenuTreeByManagerId(user,id);
Map<String, Object> condition = new HashMap<>();
condition.put("treeList",treeList);
return new ReturnJsonData(DataCodeUtil.SUCCESS,"获取数据成功",condition);
}
/**
* 获取所有的菜单列表(菜单和按钮)
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("getMenuList")
@ResponseBody
public ReturnJsonData getMenuList(HttpServletRequest request, HttpServletResponse response) throws Exception {
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
String id = request.getParameter("id");
List<Tree> treeList = wmMenuService.getWmMenuList(id);
Map<String, Object> condition = new HashMap<>();
condition.put("treeList",treeList);
return new ReturnJsonData(DataCodeUtil.SUCCESS,"获取数据成功",condition);
}
/**
* 后台删除
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("delMenuById")
@ResponseBody
public ReturnJsonData delWmMenuById(HttpServletRequest request, HttpServletResponse response) throws Exception{
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
String id = request.getParameter("menuId");
if(StringUtils.isNotEmpty(id)){
return wmMenuService.delWmMenu(Integer.valueOf(id));
}else {
return new ReturnJsonData(DataCodeUtil.PARAM_ERROR,"传入的参数为空",null);
}
}
/**
* 后台添加
* @param request
* @return
* @throws Exception
*/
@RequestMapping("addMenu")
@ResponseBody
public ReturnJsonData addMenu(HttpServletRequest request,HttpServletResponse response) throws Exception{
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
Menu wmMenu = new Menu();
String menuName = ServletRequestUtils.getStringParameter(request,"menuName","");
if(StringUtils.isNotEmpty(menuName)){
wmMenu.setMenuName(menuName);
}
String menuUrl = ServletRequestUtils.getStringParameter(request,"menuUrl","");
if(StringUtils.isNotEmpty(menuUrl)){
wmMenu.setMenuUrl(menuUrl);
}
Integer superId = ServletRequestUtils.getIntParameter(request,"superId",0);
if(superId != 0){
wmMenu.setSuperId(superId);
}else{
wmMenu.setSuperId(0);
}
String headImageUrl = ServletRequestUtils.getStringParameter(request,"headImageUrl","");
if(StringUtils.isNotEmpty(headImageUrl)){
wmMenu.setHeadImageUrl(headImageUrl);
}
int menuType = ServletRequestUtils.getIntParameter(request,"menuType",1);
if(menuType != 0){
wmMenu.setMenuType(menuType);
}else{
wmMenu.setMenuType(0);
}
int menuSort = ServletRequestUtils.getIntParameter(request,"menuSort",0);
if(menuSort != 0){
wmMenu.setMenuSort(menuSort);
}else{
wmMenu.setMenuSort(0);
}
wmMenu.setCreateTime(DateHelperUtils.getSystem(DateHelperUtils.DATE_FORMATE_YYYYMMDDHHMMSS));
return wmMenuService.insertWmMenu(wmMenu);
}
/**
* 后台 修改
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("updateMenu")
public ReturnJsonData updateMenu(HttpServletRequest request,HttpServletResponse response)throws Exception{
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
Menu wmMenu = new Menu();
String id = request.getParameter("menuId");
if(StringUtils.isNotEmpty(id)){
wmMenu.setId(Integer.valueOf(id));
}
String menuName = ServletRequestUtils.getStringParameter(request,"menuName","");
if(StringUtils.isNotEmpty(menuName)){
wmMenu.setMenuName(menuName);
}
String menuUrl = ServletRequestUtils.getStringParameter(request,"menuUrl","");
if(StringUtils.isNotEmpty(menuUrl)){
wmMenu.setMenuUrl(menuUrl);
}
Integer superId = ServletRequestUtils.getIntParameter(request,"superId",0);
if(superId != 0){
wmMenu.setSuperId(superId);
}else{
wmMenu.setSuperId(0);
}
String headImageUrl = ServletRequestUtils.getStringParameter(request,"headImageUrl","");
if(StringUtils.isNotEmpty(headImageUrl)){
wmMenu.setHeadImageUrl(headImageUrl);
}
int menuType = ServletRequestUtils.getIntParameter(request,"menuType",1);
if(menuType != 0){
wmMenu.setMenuType(menuType);
}else{
wmMenu.setMenuType(0);
}
int menuSort = ServletRequestUtils.getIntParameter(request,"menuSort",0);
if(menuSort != 0){
wmMenu.setMenuSort(menuSort);
}else{
wmMenu.setMenuSort(0);
}
return wmMenuService.updateWmMenu(wmMenu);
}
/**
* 后台 单个信息
* @param request
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping("/getMenuInfo")
public ReturnJsonData getMenuInfo(HttpServletRequest request,HttpServletResponse response) throws Exception {
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
String id = request.getParameter("menuId");
if(StringUtils.isNotEmpty(id)) {
Menu menu = wmMenuService.getWmMenuById(Integer.valueOf(id));
Map<String,Object> condition = new HashMap<>();
condition.put("menu",menu);
return new ReturnJsonData(DataCodeUtil.SUCCESS,"获取数据成功",condition);
}
return new ReturnJsonData(DataCodeUtil.SELECT_DATABASE,"获取数据失败",null);
}
/**
* 根据路径查询按钮
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("getMenuByMenuUrl")
@ResponseBody
public ReturnJsonData getMenuByMenuUrl(HttpServletRequest request, HttpServletResponse response) throws Exception {
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
String menuUrl = ServletRequestUtils.getStringParameter(request, "menuUrl", "");
if(StringUtils.isEmpty(menuUrl)){
return new ReturnJsonData(DataCodeUtil.PARAM_ERROR,"传入的路径为空",null);
}
User user =(User)request.getSession().getAttribute("user");
if(StringUtils.isNotEmpty(menuUrl) && user!=null){
Map<String,Object> param = new HashMap<>();
param.put("menuUrl",menuUrl);
param.put("userId",user.getId());
param.put("userType",user.getUserType());
List<Menu> wmMenuList = wmMenuService.queryMenuByMenuUrl(param);
Map<String, Object> condition = new HashMap<>();
condition.put("list",wmMenuList);
return new ReturnJsonData(DataCodeUtil.SUCCESS,"获取数据成功",condition);
}
return new ReturnJsonData(DataCodeUtil.SELECT_DATABASE,"获取数据失败",null);
}
/**
* 根据路径查询按钮
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("queryAllMenu")
@ResponseBody
public ReturnJsonData queryAllMenu(HttpServletRequest request, HttpServletResponse response) throws Exception {
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("text/json; charset=utf-8");
User user =(User)request.getSession().getAttribute("user");
if(user == null){
return new ReturnJsonData(DataCodeUtil.PARAM_ERROR,"登录已超时,请重新登录",null);
}
List<Tree> trees = wmMenuService.queryAllMenu(user);
return new ReturnJsonData(DataCodeUtil.SUCCESS,"获取数据成功",trees);
}
}
| [
"chenlongd@126.com"
] | chenlongd@126.com |
0c4c43120ef6624b8ae36c73f7698444a1a0a991 | 3d9cadf58e8776f79c52fb9e81a413d750b7c21c | /src/main/java/cn/conifercone/uaa/util/SaTokenJwtUtil.java | c9ef704f5fbd062665d411488a05201091649d86 | [
"MIT"
] | permissive | zhogjiane/uaa | 649d2488be566c4566af10152ea61c7d9a170042 | 2608950ae9ae8e19b7bab535756ab0cf4b386824 | refs/heads/main | 2023-07-27T02:51:37.900453 | 2021-09-07T10:26:33 | 2021-09-07T10:26:33 | 406,658,472 | 2 | 0 | MIT | 2021-09-15T07:34:39 | 2021-09-15T07:34:38 | null | UTF-8 | Java | false | false | 3,929 | java | /*
* MIT License
*
* Copyright (c) [2021] [sky5486560@gmail.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package cn.conifercone.uaa.util;
import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.exception.SaTokenException;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.map.MapUtil;
import io.jsonwebtoken.*;
import java.util.Date;
import java.util.Map;
/**
* Jwt工具类
*
* @author sky5486560@gmail.com
* @date 2021/9/6
*/
@SuppressWarnings("unused")
public class SaTokenJwtUtil {
private SaTokenJwtUtil() {
}
/**
* 秘钥 (随便手打几个字母就好了)
*/
public static final String BASE64_SECURITY = "79e7c69681b8270162386e6daa53d1dd";
/**
* token有效期 (单位: 秒)
*/
public static final long TIMEOUT = 3600;
public static final String LOGIN_ID_KEY = "loginId";
/**
* 根据userId生成token
*
* @param loginId 账号id
* @return jwt-token
*/
public static String createToken(Object loginId, Map<String, Object> map) {
// 在这里你可以使用官方提供的claim方法构建载荷,也可以使用setPayload自定义载荷,但是两者不可一起使用
JwtBuilder builder = Jwts.builder()
.setHeaderParam("type", "JWT")
.setId(String.valueOf(loginId))
.claim(LOGIN_ID_KEY, String.valueOf(loginId))
.setIssuedAt(new Date()) // 签发日期
.setExpiration(new Date(System.currentTimeMillis() + 1000 * TIMEOUT)) // 有效截止日期
.signWith(SignatureAlgorithm.HS256, BASE64_SECURITY.getBytes()); // 加密算法
if (MapUtil.isNotEmpty(map)) {
map.forEach(builder::claim);
}
//生成JWT
return builder.compact();
}
/**
* 从一个jwt里面解析出Claims
*
* @param tokenValue token值
* @return Claims对象
*/
public static Claims getClaims(String tokenValue) {
return Jwts.parser()
.setSigningKey(BASE64_SECURITY.getBytes())
.parseClaimsJws(tokenValue).getBody();
}
/**
* 从一个jwt里面解析loginId
*
* @param tokenValue token值
* @return loginId
*/
public static String getLoginId(String tokenValue) {
try {
Object loginId = getClaims(tokenValue).get(LOGIN_ID_KEY);
if (loginId == null) {
return null;
}
return String.valueOf(loginId);
} catch (ExpiredJwtException e) {
return NotLoginException.TOKEN_TIMEOUT;
} catch (MalformedJwtException e) {
throw NotLoginException.newInstance(StpUtil.stpLogic.loginType, NotLoginException.INVALID_TOKEN);
} catch (Exception e) {
throw new SaTokenException(e);
}
}
}
| [
"547913250@qq.com"
] | 547913250@qq.com |
485ffd661a1a0003d01e6c15d0a399fc04d3ecae | 17b1142f325d471c2c66e1444f0b8fee366222ce | /src/service/StudentService.java | f4032dd7c3f630c4168d35eb821e0479a44fd100 | [] | no_license | balantain/java_exceptions | 93c71e97193a1eef5cf1ee2ece1c77b5b0d9e05c | 9d7668d6e50c91bcd27d4d60b5c71c6bb0bb3489 | refs/heads/main | 2023-09-03T02:58:18.619372 | 2021-09-25T14:38:09 | 2021-09-25T14:38:09 | 399,919,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,363 | java | package service;
import exceptions.MarkValueException;
import exceptions.NoDisciplineException;
import model.Discipline;
import model.Student;
import java.util.Map;
import java.util.Random;
public class StudentService {
public static void printStudentInfo (Student student){
System.out.print(student.getName() + " | ");
for (Discipline discipline : student.getDairy().keySet()){
System.out.print(discipline.getTitle() + " - " + student.getDairy().get(discipline) + " | ");
}
}
public static void printAvrMarkForStudentDairy (Student student) throws MarkValueException, NoDisciplineException {
int result = 0;
if (student.getDairy().isEmpty()){
throw new NoDisciplineException("There are no disciplines in " + student.getName() + " dairy.");
}
for (Discipline discipline : student.getDairy().keySet()){
if (student.getDairy().get(discipline) < 0 || student.getDairy().get(discipline) > 10){
throw new MarkValueException("Student's mark for " + discipline.getTitle() + " is not in diapason between 0 and 10.");
}
result += student.getDairy().get(discipline);
}
System.out.println("Average mark value for student " + student.getName() + " is: " + (result / student.getDairy().size()) + "\n");
}
}
| [
"dyrikov.a@gmail.com"
] | dyrikov.a@gmail.com |
9a2aeae56710812b4c790431788715077581a9f6 | 46ff044f1727f4a8f1ec8d8184793fa5136348f1 | /07 - ORIENTACAO-A-OBJETOS/src/aula24/labs/LivroLivraria.java | e072270c8e3705123262ae20c6b73a1979fc4b17 | [] | no_license | josemalcher/Curso-JAVA-1-Loiane | 744516ce152c6d5cee41402ca70e3ae3e500108a | 7532dfc41926ac12f71407f4f15f3c00bd5bbb9b | refs/heads/master | 2020-04-06T07:10:14.620808 | 2016-08-30T01:56:50 | 2016-08-30T01:56:50 | 63,444,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package aula24.labs;
public class LivroLivraria {
String nome;
String autor;
String isbn;
int quantidadePaginas;
int anoLacamento;
int quantidadeEstoque;
double preco;
}
| [
"malcher.malch@gmail.com"
] | malcher.malch@gmail.com |
1024a8e8f4d1383b528e341a449cb1574061e78f | c29385de6cd8fb230c137e11b9d2f799816fae15 | /Design/src/test/java/com/com/Design/AppTest.java | 24d2a6b9f562d4f69c9fcda8217046b71f5cb88b | [] | no_license | srivallisreya/srivallisreya-design | b386d4820aa1c5d3e5b2cac1c4488715459e483e | 3a119cb395522392975621ada539a6c800dce65e | refs/heads/master | 2021-03-02T14:31:00.877579 | 2020-03-08T19:34:20 | 2020-03-08T19:34:20 | 245,875,234 | 0 | 0 | null | 2020-10-13T20:10:57 | 2020-03-08T19:30:57 | Java | UTF-8 | Java | false | false | 642 | java | package com.com.Design;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"srivallisreya1234@gmail.com"
] | srivallisreya1234@gmail.com |
dffe41f7976a7a7755724b895f26e858a23de3dd | e96b25c64a1084470a2ddabef60cd72c0eda917f | /src/com/google/protobuf/TextFormat.java | 6879cb2fc2ea659cb7b6169960d4c155b2a50e06 | [
"MIT"
] | permissive | adetalhouet/Profiler | f7cfc6ec173c36886c0932ec221ea204b1ce85b5 | 9e3bcc736e5f4012806ed7953f28d0cf0c994783 | refs/heads/master | 2020-07-21T14:25:29.478319 | 2015-09-12T15:35:06 | 2015-09-12T15:35:06 | 30,164,390 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48,333 | java | // Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.protobuf;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.CharBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.EnumDescriptor;
import com.google.protobuf.Descriptors.EnumValueDescriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
/**
* Provide text parsing and formatting support for proto2 instances. The
* implementation largely follows google/protobuf/text_format.cc.
*
* @author wenboz@google.com Wenbo Zhu
* @author kenton@google.com Kenton Varda
*/
public final class TextFormat {
private TextFormat() {
}
private static final Printer DEFAULT_PRINTER = new Printer();
private static final Printer SINGLE_LINE_PRINTER = (new Printer())
.setSingleLineMode(true);
private static final Printer UNICODE_PRINTER = (new Printer())
.setEscapeNonAscii(false);
/**
* Outputs a textual representation of the Protocol Message supplied into
* the parameter output. (This representation is the new version of the
* classic "ProtocolPrinter" output from the original Protocol Buffer
* system)
*/
public static void print(final MessageOrBuilder message,
final Appendable output) throws IOException {
DEFAULT_PRINTER.print(message, new TextGenerator(output));
}
/** Outputs a textual representation of {@code fields} to {@code output}. */
public static void print(final UnknownFieldSet fields,
final Appendable output) throws IOException {
DEFAULT_PRINTER.printUnknownFields(fields, new TextGenerator(output));
}
/**
* Generates a human readable form of this message, useful for debugging and
* other purposes, with no newline characters.
*/
public static String shortDebugString(final MessageOrBuilder message) {
try {
final StringBuilder sb = new StringBuilder();
SINGLE_LINE_PRINTER.print(message, new TextGenerator(sb));
// Single line mode currently might have an extra space at the end.
return sb.toString().trim();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Generates a human readable form of the unknown fields, useful for
* debugging and other purposes, with no newline characters.
*/
public static String shortDebugString(final UnknownFieldSet fields) {
try {
final StringBuilder sb = new StringBuilder();
SINGLE_LINE_PRINTER.printUnknownFields(fields,
new TextGenerator(sb));
// Single line mode currently might have an extra space at the end.
return sb.toString().trim();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Like {@code print()}, but writes directly to a {@code String} and returns
* it.
*/
public static String printToString(final MessageOrBuilder message) {
try {
final StringBuilder text = new StringBuilder();
print(message, text);
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Like {@code print()}, but writes directly to a {@code String} and returns
* it.
*/
public static String printToString(final UnknownFieldSet fields) {
try {
final StringBuilder text = new StringBuilder();
print(fields, text);
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Same as {@code printToString()}, except that non-ASCII characters in
* string type fields are not escaped in backslash+octals.
*/
public static String printToUnicodeString(final MessageOrBuilder message) {
try {
final StringBuilder text = new StringBuilder();
UNICODE_PRINTER.print(message, new TextGenerator(text));
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Same as {@code printToString()}, except that non-ASCII characters in
* string type fields are not escaped in backslash+octals.
*/
public static String printToUnicodeString(final UnknownFieldSet fields) {
try {
final StringBuilder text = new StringBuilder();
UNICODE_PRINTER.printUnknownFields(fields, new TextGenerator(text));
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
public static void printField(final FieldDescriptor field,
final Object value, final Appendable output) throws IOException {
DEFAULT_PRINTER.printField(field, value, new TextGenerator(output));
}
public static String printFieldToString(final FieldDescriptor field,
final Object value) {
try {
final StringBuilder text = new StringBuilder();
printField(field, value, text);
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Outputs a textual representation of the value of given field value.
*
* @param field
* the descriptor of the field
* @param value
* the value of the field
* @param output
* the output to which to append the formatted value
* @throws ClassCastException
* if the value is not appropriate for the given field
* descriptor
* @throws IOException
* if there is an exception writing to the output
*/
public static void printFieldValue(final FieldDescriptor field,
final Object value, final Appendable output) throws IOException {
DEFAULT_PRINTER
.printFieldValue(field, value, new TextGenerator(output));
}
/**
* Outputs a textual representation of the value of an unknown field.
*
* @param tag
* the field's tag number
* @param value
* the value of the field
* @param output
* the output to which to append the formatted value
* @throws ClassCastException
* if the value is not appropriate for the given field
* descriptor
* @throws IOException
* if there is an exception writing to the output
*/
public static void printUnknownFieldValue(final int tag,
final Object value, final Appendable output) throws IOException {
printUnknownFieldValue(tag, value, new TextGenerator(output));
}
private static void printUnknownFieldValue(final int tag,
final Object value, final TextGenerator generator)
throws IOException {
switch (WireFormat.getTagWireType(tag)) {
case WireFormat.WIRETYPE_VARINT:
generator.print(unsignedToString((Long) value));
break;
case WireFormat.WIRETYPE_FIXED32:
generator.print(String.format((Locale) null, "0x%08x",
(Integer) value));
break;
case WireFormat.WIRETYPE_FIXED64:
generator.print(String.format((Locale) null, "0x%016x",
(Long) value));
break;
case WireFormat.WIRETYPE_LENGTH_DELIMITED:
generator.print("\"");
generator.print(escapeBytes((ByteString) value));
generator.print("\"");
break;
case WireFormat.WIRETYPE_START_GROUP:
DEFAULT_PRINTER.printUnknownFields((UnknownFieldSet) value,
generator);
break;
default:
throw new IllegalArgumentException("Bad tag: " + tag);
}
}
/** Helper class for converting protobufs to text. */
private static final class Printer {
/** Whether to omit newlines from the output. */
boolean singleLineMode = false;
/** Whether to escape non ASCII characters with backslash and octal. */
boolean escapeNonAscii = true;
private Printer() {
}
/** Setter of singleLineMode */
private Printer setSingleLineMode(boolean singleLineMode) {
this.singleLineMode = singleLineMode;
return this;
}
/** Setter of escapeNonAscii */
private Printer setEscapeNonAscii(boolean escapeNonAscii) {
this.escapeNonAscii = escapeNonAscii;
return this;
}
private void print(final MessageOrBuilder message,
final TextGenerator generator) throws IOException {
for (Map.Entry<FieldDescriptor, Object> field : message
.getAllFields().entrySet()) {
printField(field.getKey(), field.getValue(), generator);
}
printUnknownFields(message.getUnknownFields(), generator);
}
private void printField(final FieldDescriptor field,
final Object value, final TextGenerator generator)
throws IOException {
if (field.isRepeated()) {
// Repeated field. Print each element.
for (Object element : (List<?>) value) {
printSingleField(field, element, generator);
}
} else {
printSingleField(field, value, generator);
}
}
private void printSingleField(final FieldDescriptor field,
final Object value, final TextGenerator generator)
throws IOException {
if (field.isExtension()) {
generator.print("[");
// We special-case MessageSet elements for compatibility with
// proto1.
if (field.getContainingType().getOptions()
.getMessageSetWireFormat()
&& (field.getType() == FieldDescriptor.Type.MESSAGE)
&& (field.isOptional())
// object equality
&& (field.getExtensionScope() == field.getMessageType())) {
generator.print(field.getMessageType().getFullName());
} else {
generator.print(field.getFullName());
}
generator.print("]");
} else {
if (field.getType() == FieldDescriptor.Type.GROUP) {
// Groups must be serialized with their original
// capitalization.
generator.print(field.getMessageType().getName());
} else {
generator.print(field.getName());
}
}
if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
if (singleLineMode) {
generator.print(" { ");
} else {
generator.print(" {\n");
generator.indent();
}
} else {
generator.print(": ");
}
printFieldValue(field, value, generator);
if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
if (singleLineMode) {
generator.print("} ");
} else {
generator.outdent();
generator.print("}\n");
}
} else {
if (singleLineMode) {
generator.print(" ");
} else {
generator.print("\n");
}
}
}
private void printFieldValue(final FieldDescriptor field,
final Object value, final TextGenerator generator)
throws IOException {
switch (field.getType()) {
case INT32:
case SINT32:
case SFIXED32:
generator.print(((Integer) value).toString());
break;
case INT64:
case SINT64:
case SFIXED64:
generator.print(((Long) value).toString());
break;
case BOOL:
generator.print(((Boolean) value).toString());
break;
case FLOAT:
generator.print(((Float) value).toString());
break;
case DOUBLE:
generator.print(((Double) value).toString());
break;
case UINT32:
case FIXED32:
generator.print(unsignedToString((Integer) value));
break;
case UINT64:
case FIXED64:
generator.print(unsignedToString((Long) value));
break;
case STRING:
generator.print("\"");
generator.print(escapeNonAscii ? escapeText((String) value)
: (String) value);
generator.print("\"");
break;
case BYTES:
generator.print("\"");
generator.print(escapeBytes((ByteString) value));
generator.print("\"");
break;
case ENUM:
generator.print(((EnumValueDescriptor) value).getName());
break;
case MESSAGE:
case GROUP:
print((Message) value, generator);
break;
}
}
private void printUnknownFields(final UnknownFieldSet unknownFields,
final TextGenerator generator) throws IOException {
for (Map.Entry<Integer, UnknownFieldSet.Field> entry : unknownFields
.asMap().entrySet()) {
final int number = entry.getKey();
final UnknownFieldSet.Field field = entry.getValue();
printUnknownField(number, WireFormat.WIRETYPE_VARINT,
field.getVarintList(), generator);
printUnknownField(number, WireFormat.WIRETYPE_FIXED32,
field.getFixed32List(), generator);
printUnknownField(number, WireFormat.WIRETYPE_FIXED64,
field.getFixed64List(), generator);
printUnknownField(number, WireFormat.WIRETYPE_LENGTH_DELIMITED,
field.getLengthDelimitedList(), generator);
for (final UnknownFieldSet value : field.getGroupList()) {
generator.print(entry.getKey().toString());
if (singleLineMode) {
generator.print(" { ");
} else {
generator.print(" {\n");
generator.indent();
}
printUnknownFields(value, generator);
if (singleLineMode) {
generator.print("} ");
} else {
generator.outdent();
generator.print("}\n");
}
}
}
}
private void printUnknownField(final int number, final int wireType,
final List<?> values, final TextGenerator generator)
throws IOException {
for (final Object value : values) {
generator.print(String.valueOf(number));
generator.print(": ");
printUnknownFieldValue(wireType, value, generator);
generator.print(singleLineMode ? " " : "\n");
}
}
}
/** Convert an unsigned 32-bit integer to a string. */
private static String unsignedToString(final int value) {
if (value >= 0) {
return Integer.toString(value);
} else {
return Long.toString(((long) value) & 0x00000000FFFFFFFFL);
}
}
/** Convert an unsigned 64-bit integer to a string. */
private static String unsignedToString(final long value) {
if (value >= 0) {
return Long.toString(value);
} else {
// Pull off the most-significant bit so that BigInteger doesn't
// think
// the number is negative, then set it again using setBit().
return BigInteger.valueOf(value & 0x7FFFFFFFFFFFFFFFL).setBit(63)
.toString();
}
}
/**
* An inner class for writing text to the output stream.
*/
private static final class TextGenerator {
private final Appendable output;
private final StringBuilder indent = new StringBuilder();
private boolean atStartOfLine = true;
private TextGenerator(final Appendable output) {
this.output = output;
}
/**
* Indent text by two spaces. After calling Indent(), two spaces will be
* inserted at the beginning of each line of text. Indent() may be
* called multiple times to produce deeper indents.
*/
public void indent() {
indent.append(" ");
}
/**
* Reduces the current indent level by two spaces, or crashes if the
* indent level is zero.
*/
public void outdent() {
final int length = indent.length();
if (length == 0) {
throw new IllegalArgumentException(
" Outdent() without matching Indent().");
}
indent.delete(length - 2, length);
}
/**
* Print text to the output stream.
*/
public void print(final CharSequence text) throws IOException {
final int size = text.length();
int pos = 0;
for (int i = 0; i < size; i++) {
if (text.charAt(i) == '\n') {
write(text.subSequence(pos, size), i - pos + 1);
pos = i + 1;
atStartOfLine = true;
}
}
write(text.subSequence(pos, size), size - pos);
}
private void write(final CharSequence data, final int size)
throws IOException {
if (size == 0) {
return;
}
if (atStartOfLine) {
atStartOfLine = false;
output.append(indent);
}
output.append(data);
}
}
// =================================================================
// Parsing
/**
* Represents a stream of tokens parsed from a {@code String}.
*
* <p>
* The Java standard library provides many classes that you might think
* would be useful for implementing this, but aren't. For example:
*
* <ul>
* <li>{@code java.io.StreamTokenizer}: This almost does what we want -- or,
* at least, something that would get us close to what we want -- except for
* one fatal flaw: It automatically un-escapes strings using Java escape
* sequences, which do not include all the escape sequences we need to
* support (e.g. '\x').
* <li>{@code java.util.Scanner}: This seems like a great way at least to
* parse regular expressions out of a stream (so we wouldn't have to load
* the entire input into a single string before parsing). Sadly,
* {@code Scanner} requires that tokens be delimited with some delimiter.
* Thus, although the text "foo:" should parse to two tokens ("foo" and
* ":"), {@code Scanner} would recognize it only as a single token.
* Furthermore, {@code Scanner} provides no way to inspect the contents of
* delimiters, making it impossible to keep track of line and column
* numbers.
* </ul>
*
* <p>
* Luckily, Java's regular expression support does manage to be useful to
* us. (Barely: We need {@code Matcher.usePattern()}, which is new in Java
* 1.5.) So, we can use that, at least. Unfortunately, this implies that we
* need to have the entire input in one contiguous string.
*/
private static final class Tokenizer {
private final CharSequence text;
private final Matcher matcher;
private String currentToken;
// The character index within this.text at which the current token
// begins.
private int pos = 0;
// The line and column numbers of the current token.
private int line = 0;
private int column = 0;
// The line and column numbers of the previous token (allows throwing
// errors *after* consuming).
private int previousLine = 0;
private int previousColumn = 0;
// We use possessive quantifiers (*+ and ++) because otherwise the Java
// regex matcher has stack overflows on large inputs.
private static final Pattern WHITESPACE = Pattern.compile(
"(\\s|(#.*$))++", Pattern.MULTILINE);
private static final Pattern TOKEN = Pattern.compile(
"[a-zA-Z_][0-9a-zA-Z_+-]*+|" + // an identifier
"[.]?[0-9+-][0-9a-zA-Z_.+-]*+|" + // a number
"\"([^\"\n\\\\]|\\\\.)*+(\"|\\\\?$)|" + // a
// double-quoted
// string
"\'([^\'\n\\\\]|\\\\.)*+(\'|\\\\?$)", // a single-quoted
// string
Pattern.MULTILINE);
private static final Pattern DOUBLE_INFINITY = Pattern.compile(
"-?inf(inity)?", Pattern.CASE_INSENSITIVE);
private static final Pattern FLOAT_INFINITY = Pattern.compile(
"-?inf(inity)?f?", Pattern.CASE_INSENSITIVE);
private static final Pattern FLOAT_NAN = Pattern.compile("nanf?",
Pattern.CASE_INSENSITIVE);
/** Construct a tokenizer that parses tokens from the given text. */
private Tokenizer(final CharSequence text) {
this.text = text;
this.matcher = WHITESPACE.matcher(text);
skipWhitespace();
nextToken();
}
/** Are we at the end of the input? */
public boolean atEnd() {
return currentToken.length() == 0;
}
/** Advance to the next token. */
public void nextToken() {
previousLine = line;
previousColumn = column;
// Advance the line counter to the current position.
while (pos < matcher.regionStart()) {
if (text.charAt(pos) == '\n') {
++line;
column = 0;
} else {
++column;
}
++pos;
}
// Match the next token.
if (matcher.regionStart() == matcher.regionEnd()) {
// EOF
currentToken = "";
} else {
matcher.usePattern(TOKEN);
if (matcher.lookingAt()) {
currentToken = matcher.group();
matcher.region(matcher.end(), matcher.regionEnd());
} else {
// Take one character.
currentToken = String.valueOf(text.charAt(pos));
matcher.region(pos + 1, matcher.regionEnd());
}
skipWhitespace();
}
}
/**
* Skip over any whitespace so that the matcher region starts at the
* next token.
*/
private void skipWhitespace() {
matcher.usePattern(WHITESPACE);
if (matcher.lookingAt()) {
matcher.region(matcher.end(), matcher.regionEnd());
}
}
/**
* If the next token exactly matches {@code token}, consume it and
* return {@code true}. Otherwise, return {@code false} without doing
* anything.
*/
public boolean tryConsume(final String token) {
if (currentToken.equals(token)) {
nextToken();
return true;
} else {
return false;
}
}
/**
* If the next token exactly matches {@code token}, consume it.
* Otherwise, throw a {@link ParseException}.
*/
public void consume(final String token) throws ParseException {
if (!tryConsume(token)) {
throw parseException("Expected \"" + token + "\".");
}
}
/**
* Returns {@code true} if the next token is an integer, but does not
* consume it.
*/
public boolean lookingAtInteger() {
if (currentToken.length() == 0) {
return false;
}
final char c = currentToken.charAt(0);
return ('0' <= c && c <= '9') || c == '-' || c == '+';
}
/**
* If the next token is an identifier, consume it and return its value.
* Otherwise, throw a {@link ParseException}.
*/
public String consumeIdentifier() throws ParseException {
for (int i = 0; i < currentToken.length(); i++) {
final char c = currentToken.charAt(i);
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')
|| ('0' <= c && c <= '9') || (c == '_') || (c == '.')) {
// OK
} else {
throw parseException("Expected identifier.");
}
}
final String result = currentToken;
nextToken();
return result;
}
/**
* If the next token is a 32-bit signed integer, consume it and return
* its value. Otherwise, throw a {@link ParseException}.
*/
public int consumeInt32() throws ParseException {
try {
final int result = parseInt32(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw integerParseException(e);
}
}
/**
* If the next token is a 32-bit unsigned integer, consume it and return
* its value. Otherwise, throw a {@link ParseException}.
*/
public int consumeUInt32() throws ParseException {
try {
final int result = parseUInt32(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw integerParseException(e);
}
}
/**
* If the next token is a 64-bit signed integer, consume it and return
* its value. Otherwise, throw a {@link ParseException}.
*/
public long consumeInt64() throws ParseException {
try {
final long result = parseInt64(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw integerParseException(e);
}
}
/**
* If the next token is a 64-bit unsigned integer, consume it and return
* its value. Otherwise, throw a {@link ParseException}.
*/
public long consumeUInt64() throws ParseException {
try {
final long result = parseUInt64(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw integerParseException(e);
}
}
/**
* If the next token is a double, consume it and return its value.
* Otherwise, throw a {@link ParseException}.
*/
public double consumeDouble() throws ParseException {
// We need to parse infinity and nan separately because
// Double.parseDouble() does not accept "inf", "infinity", or "nan".
if (DOUBLE_INFINITY.matcher(currentToken).matches()) {
final boolean negative = currentToken.startsWith("-");
nextToken();
return negative ? Double.NEGATIVE_INFINITY
: Double.POSITIVE_INFINITY;
}
if (currentToken.equalsIgnoreCase("nan")) {
nextToken();
return Double.NaN;
}
try {
final double result = Double.parseDouble(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw floatParseException(e);
}
}
/**
* If the next token is a float, consume it and return its value.
* Otherwise, throw a {@link ParseException}.
*/
public float consumeFloat() throws ParseException {
// We need to parse infinity and nan separately because
// Float.parseFloat() does not accept "inf", "infinity", or "nan".
if (FLOAT_INFINITY.matcher(currentToken).matches()) {
final boolean negative = currentToken.startsWith("-");
nextToken();
return negative ? Float.NEGATIVE_INFINITY
: Float.POSITIVE_INFINITY;
}
if (FLOAT_NAN.matcher(currentToken).matches()) {
nextToken();
return Float.NaN;
}
try {
final float result = Float.parseFloat(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw floatParseException(e);
}
}
/**
* If the next token is a boolean, consume it and return its value.
* Otherwise, throw a {@link ParseException}.
*/
public boolean consumeBoolean() throws ParseException {
if (currentToken.equals("true") || currentToken.equals("t")
|| currentToken.equals("1")) {
nextToken();
return true;
} else if (currentToken.equals("false") || currentToken.equals("f")
|| currentToken.equals("0")) {
nextToken();
return false;
} else {
throw parseException("Expected \"true\" or \"false\".");
}
}
/**
* If the next token is a string, consume it and return its (unescaped)
* value. Otherwise, throw a {@link ParseException}.
*/
public String consumeString() throws ParseException {
return consumeByteString().toStringUtf8();
}
/**
* If the next token is a string, consume it, unescape it as a
* {@link ByteString}, and return it. Otherwise, throw a
* {@link ParseException}.
*/
public ByteString consumeByteString() throws ParseException {
List<ByteString> list = new ArrayList<ByteString>();
consumeByteString(list);
while (currentToken.startsWith("'")
|| currentToken.startsWith("\"")) {
consumeByteString(list);
}
return ByteString.copyFrom(list);
}
/**
* Like {@link #consumeByteString()} but adds each token of the string
* to the given list. String literals (whether bytes or text) may come
* in multiple adjacent tokens which are automatically concatenated,
* like in C or Python.
*/
private void consumeByteString(List<ByteString> list)
throws ParseException {
final char quote = currentToken.length() > 0 ? currentToken
.charAt(0) : '\0';
if (quote != '\"' && quote != '\'') {
throw parseException("Expected string.");
}
if (currentToken.length() < 2
|| currentToken.charAt(currentToken.length() - 1) != quote) {
throw parseException("String missing ending quote.");
}
try {
final String escaped = currentToken.substring(1,
currentToken.length() - 1);
final ByteString result = unescapeBytes(escaped);
nextToken();
list.add(result);
} catch (InvalidEscapeSequenceException e) {
throw parseException(e.getMessage());
}
}
/**
* Returns a {@link ParseException} with the current line and column
* numbers in the description, suitable for throwing.
*/
public ParseException parseException(final String description) {
// Note: People generally prefer one-based line and column numbers.
return new ParseException(line + 1, column + 1, description);
}
/**
* Returns a {@link ParseException} with the line and column numbers of
* the previous token in the description, suitable for throwing.
*/
public ParseException parseExceptionPreviousToken(
final String description) {
// Note: People generally prefer one-based line and column numbers.
return new ParseException(previousLine + 1, previousColumn + 1,
description);
}
/**
* Constructs an appropriate {@link ParseException} for the given
* {@code NumberFormatException} when trying to parse an integer.
*/
private ParseException integerParseException(
final NumberFormatException e) {
return parseException("Couldn't parse integer: " + e.getMessage());
}
/**
* Constructs an appropriate {@link ParseException} for the given
* {@code NumberFormatException} when trying to parse a float or double.
*/
private ParseException floatParseException(final NumberFormatException e) {
return parseException("Couldn't parse number: " + e.getMessage());
}
}
/** Thrown when parsing an invalid text format message. */
public static class ParseException extends IOException {
private static final long serialVersionUID = 3196188060225107702L;
private final int line;
private final int column;
/** Create a new instance, with -1 as the line and column numbers. */
public ParseException(final String message) {
this(-1, -1, message);
}
/**
* Create a new instance
*
* @param line
* the line number where the parse error occurred, using
* 1-offset.
* @param column
* the column number where the parser error occurred, using
* 1-offset.
*/
public ParseException(final int line, final int column,
final String message) {
super(Integer.toString(line) + ":" + column + ": " + message);
this.line = line;
this.column = column;
}
/**
* Return the line where the parse exception occurred, or -1 when none
* is provided. The value is specified as 1-offset, so the first line is
* line 1.
*/
public int getLine() {
return line;
}
/**
* Return the column where the parse exception occurred, or -1 when none
* is provided. The value is specified as 1-offset, so the first line is
* line 1.
*/
public int getColumn() {
return column;
}
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}.
*/
public static void merge(final Readable input, final Message.Builder builder)
throws IOException {
merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}.
*/
public static void merge(final CharSequence input,
final Message.Builder builder) throws ParseException {
merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}. Extensions will be recognized if they are
* registered in {@code extensionRegistry}.
*/
public static void merge(final Readable input,
final ExtensionRegistry extensionRegistry,
final Message.Builder builder) throws IOException {
// Read the entire input to a String then parse that.
// If StreamTokenizer were not quite so crippled, or if there were a
// kind
// of Reader that could read in chunks that match some particular regex,
// or if we wanted to write a custom Reader to tokenize our stream, then
// we would not have to read to one big String. Alas, none of these is
// the case. Oh well.
merge(toStringBuilder(input), extensionRegistry, builder);
}
private static final int BUFFER_SIZE = 4096;
// TODO(chrisn): See if working around java.io.Reader#read(CharBuffer)
// overhead is worthwhile
private static StringBuilder toStringBuilder(final Readable input)
throws IOException {
final StringBuilder text = new StringBuilder();
final CharBuffer buffer = CharBuffer.allocate(BUFFER_SIZE);
while (true) {
final int n = input.read(buffer);
if (n == -1) {
break;
}
buffer.flip();
text.append(buffer, 0, n);
}
return text;
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}. Extensions will be recognized if they are
* registered in {@code extensionRegistry}.
*/
public static void merge(final CharSequence input,
final ExtensionRegistry extensionRegistry,
final Message.Builder builder) throws ParseException {
final Tokenizer tokenizer = new Tokenizer(input);
while (!tokenizer.atEnd()) {
mergeField(tokenizer, extensionRegistry, builder);
}
}
/**
* Parse a single field from {@code tokenizer} and merge it into
* {@code builder}.
*/
private static void mergeField(final Tokenizer tokenizer,
final ExtensionRegistry extensionRegistry,
final Message.Builder builder) throws ParseException {
FieldDescriptor field;
final Descriptor type = builder.getDescriptorForType();
ExtensionRegistry.ExtensionInfo extension = null;
if (tokenizer.tryConsume("[")) {
// An extension.
final StringBuilder name = new StringBuilder(
tokenizer.consumeIdentifier());
while (tokenizer.tryConsume(".")) {
name.append('.');
name.append(tokenizer.consumeIdentifier());
}
extension = extensionRegistry.findExtensionByName(name.toString());
if (extension == null) {
throw tokenizer.parseExceptionPreviousToken("Extension \""
+ name + "\" not found in the ExtensionRegistry.");
} else if (extension.descriptor.getContainingType() != type) {
throw tokenizer.parseExceptionPreviousToken("Extension \""
+ name + "\" does not extend message type \""
+ type.getFullName() + "\".");
}
tokenizer.consume("]");
field = extension.descriptor;
} else {
final String name = tokenizer.consumeIdentifier();
field = type.findFieldByName(name);
// Group names are expected to be capitalized as they appear in the
// .proto file, which actually matches their type names, not their
// field
// names.
if (field == null) {
// Explicitly specify US locale so that this code does not break
// when
// executing in Turkey.
final String lowerName = name.toLowerCase(Locale.US);
field = type.findFieldByName(lowerName);
// If the case-insensitive match worked but the field is NOT a
// group,
if (field != null
&& field.getType() != FieldDescriptor.Type.GROUP) {
field = null;
}
}
// Again, special-case group names as described above.
if (field != null && field.getType() == FieldDescriptor.Type.GROUP
&& !field.getMessageType().getName().equals(name)) {
field = null;
}
if (field == null) {
throw tokenizer.parseExceptionPreviousToken("Message type \""
+ type.getFullName() + "\" has no field named \""
+ name + "\".");
}
}
Object value = null;
if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
tokenizer.tryConsume(":"); // optional
final String endToken;
if (tokenizer.tryConsume("<")) {
endToken = ">";
} else {
tokenizer.consume("{");
endToken = "}";
}
final Message.Builder subBuilder;
if (extension == null) {
subBuilder = builder.newBuilderForField(field);
} else {
subBuilder = extension.defaultInstance.newBuilderForType();
}
while (!tokenizer.tryConsume(endToken)) {
if (tokenizer.atEnd()) {
throw tokenizer.parseException("Expected \"" + endToken
+ "\".");
}
mergeField(tokenizer, extensionRegistry, subBuilder);
}
value = subBuilder.buildPartial();
} else {
tokenizer.consume(":");
switch (field.getType()) {
case INT32:
case SINT32:
case SFIXED32:
value = tokenizer.consumeInt32();
break;
case INT64:
case SINT64:
case SFIXED64:
value = tokenizer.consumeInt64();
break;
case UINT32:
case FIXED32:
value = tokenizer.consumeUInt32();
break;
case UINT64:
case FIXED64:
value = tokenizer.consumeUInt64();
break;
case FLOAT:
value = tokenizer.consumeFloat();
break;
case DOUBLE:
value = tokenizer.consumeDouble();
break;
case BOOL:
value = tokenizer.consumeBoolean();
break;
case STRING:
value = tokenizer.consumeString();
break;
case BYTES:
value = tokenizer.consumeByteString();
break;
case ENUM:
final EnumDescriptor enumType = field.getEnumType();
if (tokenizer.lookingAtInteger()) {
final int number = tokenizer.consumeInt32();
value = enumType.findValueByNumber(number);
if (value == null) {
throw tokenizer
.parseExceptionPreviousToken("Enum type \""
+ enumType.getFullName()
+ "\" has no value with number "
+ number + '.');
}
} else {
final String id = tokenizer.consumeIdentifier();
value = enumType.findValueByName(id);
if (value == null) {
throw tokenizer
.parseExceptionPreviousToken("Enum type \""
+ enumType.getFullName()
+ "\" has no value named \"" + id
+ "\".");
}
}
break;
case MESSAGE:
case GROUP:
throw new RuntimeException("Can't get here.");
}
}
if (field.isRepeated()) {
builder.addRepeatedField(field, value);
} else {
builder.setField(field, value);
}
}
// =================================================================
// Utility functions
//
// Some of these methods are package-private because Descriptors.java uses
// them.
/**
* Escapes bytes in the format used in protocol buffer text format, which is
* the same as the format used for C string literals. All bytes that are not
* printable 7-bit ASCII characters are escaped, as well as backslash,
* single-quote, and double-quote characters. Characters for which no
* defined short-hand escape sequence is defined will be escaped using
* 3-digit octal sequences.
*/
static String escapeBytes(final ByteString input) {
final StringBuilder builder = new StringBuilder(input.size());
for (int i = 0; i < input.size(); i++) {
final byte b = input.byteAt(i);
switch (b) {
// Java does not recognize \a or \v, apparently.
case 0x07:
builder.append("\\a");
break;
case '\b':
builder.append("\\b");
break;
case '\f':
builder.append("\\f");
break;
case '\n':
builder.append("\\n");
break;
case '\r':
builder.append("\\r");
break;
case '\t':
builder.append("\\t");
break;
case 0x0b:
builder.append("\\v");
break;
case '\\':
builder.append("\\\\");
break;
case '\'':
builder.append("\\\'");
break;
case '"':
builder.append("\\\"");
break;
default:
// Note: Bytes with the high-order bit set should be escaped.
// Since
// bytes are signed, such bytes will compare less than 0x20,
// hence
// the following line is correct.
if (b >= 0x20) {
builder.append((char) b);
} else {
builder.append('\\');
builder.append((char) ('0' + ((b >>> 6) & 3)));
builder.append((char) ('0' + ((b >>> 3) & 7)));
builder.append((char) ('0' + (b & 7)));
}
break;
}
}
return builder.toString();
}
/**
* Un-escape a byte sequence as escaped using
* {@link #escapeBytes(ByteString)}. Two-digit hex escapes (starting with
* "\x") are also recognized.
*/
static ByteString unescapeBytes(final CharSequence charString)
throws InvalidEscapeSequenceException {
// First convert the Java character sequence to UTF-8 bytes.
ByteString input = ByteString.copyFromUtf8(charString.toString());
// Then unescape certain byte sequences introduced by ASCII '\\'. The
// valid
// escapes can all be expressed with ASCII characters, so it is safe to
// operate on bytes here.
//
// Unescaping the input byte array will result in a byte sequence that's
// no
// longer than the input. That's because each escape sequence is between
// two and four bytes long and stands for a single byte.
final byte[] result = new byte[input.size()];
int pos = 0;
for (int i = 0; i < input.size(); i++) {
byte c = input.byteAt(i);
if (c == '\\') {
if (i + 1 < input.size()) {
++i;
c = input.byteAt(i);
if (isOctal(c)) {
// Octal escape.
int code = digitValue(c);
if (i + 1 < input.size()
&& isOctal(input.byteAt(i + 1))) {
++i;
code = code * 8 + digitValue(input.byteAt(i));
}
if (i + 1 < input.size()
&& isOctal(input.byteAt(i + 1))) {
++i;
code = code * 8 + digitValue(input.byteAt(i));
}
// TODO: Check that 0 <= code && code <= 0xFF.
result[pos++] = (byte) code;
} else {
switch (c) {
case 'a':
result[pos++] = 0x07;
break;
case 'b':
result[pos++] = '\b';
break;
case 'f':
result[pos++] = '\f';
break;
case 'n':
result[pos++] = '\n';
break;
case 'r':
result[pos++] = '\r';
break;
case 't':
result[pos++] = '\t';
break;
case 'v':
result[pos++] = 0x0b;
break;
case '\\':
result[pos++] = '\\';
break;
case '\'':
result[pos++] = '\'';
break;
case '"':
result[pos++] = '\"';
break;
case 'x':
// hex escape
int code = 0;
if (i + 1 < input.size()
&& isHex(input.byteAt(i + 1))) {
++i;
code = digitValue(input.byteAt(i));
} else {
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\x' with no digits");
}
if (i + 1 < input.size()
&& isHex(input.byteAt(i + 1))) {
++i;
code = code * 16 + digitValue(input.byteAt(i));
}
result[pos++] = (byte) code;
break;
default:
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\" + (char) c
+ '\'');
}
}
} else {
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\' at end of string.");
}
} else {
result[pos++] = c;
}
}
return ByteString.copyFrom(result, 0, pos);
}
/**
* Thrown by {@link TextFormat#unescapeBytes} and
* {@link TextFormat#unescapeText} when an invalid escape sequence is seen.
*/
static class InvalidEscapeSequenceException extends IOException {
private static final long serialVersionUID = -8164033650142593304L;
InvalidEscapeSequenceException(final String description) {
super(description);
}
}
/**
* Like {@link #escapeBytes(ByteString)}, but escapes a text string.
* Non-ASCII characters are first encoded as UTF-8, then each byte is
* escaped individually as a 3-digit octal escape. Yes, it's weird.
*/
static String escapeText(final String input) {
return escapeBytes(ByteString.copyFromUtf8(input));
}
/**
* Un-escape a text string as escaped using {@link #escapeText(String)}.
* Two-digit hex escapes (starting with "\x") are also recognized.
*/
static String unescapeText(final String input)
throws InvalidEscapeSequenceException {
return unescapeBytes(input).toStringUtf8();
}
/** Is this an octal digit? */
private static boolean isOctal(final byte c) {
return '0' <= c && c <= '7';
}
/** Is this a hex digit? */
private static boolean isHex(final byte c) {
return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f')
|| ('A' <= c && c <= 'F');
}
/**
* Interpret a character as a digit (in any base up to 36) and return the
* numeric value. This is like {@code Character.digit()} but we don't accept
* non-ASCII digits.
*/
private static int digitValue(final byte c) {
if ('0' <= c && c <= '9') {
return c - '0';
} else if ('a' <= c && c <= 'z') {
return c - 'a' + 10;
} else {
return c - 'A' + 10;
}
}
/**
* Parse a 32-bit signed integer from the text. Unlike the Java standard
* {@code Integer.parseInt()}, this function recognizes the prefixes "0x"
* and "0" to signify hexadecimal and octal numbers, respectively.
*/
static int parseInt32(final String text) throws NumberFormatException {
return (int) parseInteger(text, true, false);
}
/**
* Parse a 32-bit unsigned integer from the text. Unlike the Java standard
* {@code Integer.parseInt()}, this function recognizes the prefixes "0x"
* and "0" to signify hexadecimal and octal numbers, respectively. The
* result is coerced to a (signed) {@code int} when returned since Java has
* no unsigned integer type.
*/
static int parseUInt32(final String text) throws NumberFormatException {
return (int) parseInteger(text, false, false);
}
/**
* Parse a 64-bit signed integer from the text. Unlike the Java standard
* {@code Integer.parseInt()}, this function recognizes the prefixes "0x"
* and "0" to signify hexadecimal and octal numbers, respectively.
*/
static long parseInt64(final String text) throws NumberFormatException {
return parseInteger(text, true, true);
}
/**
* Parse a 64-bit unsigned integer from the text. Unlike the Java standard
* {@code Integer.parseInt()}, this function recognizes the prefixes "0x"
* and "0" to signify hexadecimal and octal numbers, respectively. The
* result is coerced to a (signed) {@code long} when returned since Java has
* no unsigned long type.
*/
static long parseUInt64(final String text) throws NumberFormatException {
return parseInteger(text, false, true);
}
private static long parseInteger(final String text, final boolean isSigned,
final boolean isLong) throws NumberFormatException {
int pos = 0;
boolean negative = false;
if (text.startsWith("-", pos)) {
if (!isSigned) {
throw new NumberFormatException("Number must be positive: "
+ text);
}
++pos;
negative = true;
}
int radix = 10;
if (text.startsWith("0x", pos)) {
pos += 2;
radix = 16;
} else if (text.startsWith("0", pos)) {
radix = 8;
}
final String numberText = text.substring(pos);
long result = 0;
if (numberText.length() < 16) {
// Can safely assume no overflow.
result = Long.parseLong(numberText, radix);
if (negative) {
result = -result;
}
// Check bounds.
// No need to check for 64-bit numbers since they'd have to be 16
// chars
// or longer to overflow.
if (!isLong) {
if (isSigned) {
if (result > Integer.MAX_VALUE
|| result < Integer.MIN_VALUE) {
throw new NumberFormatException(
"Number out of range for 32-bit signed integer: "
+ text);
}
} else {
if (result >= (1L << 32) || result < 0) {
throw new NumberFormatException(
"Number out of range for 32-bit unsigned integer: "
+ text);
}
}
}
} else {
BigInteger bigValue = new BigInteger(numberText, radix);
if (negative) {
bigValue = bigValue.negate();
}
// Check bounds.
if (!isLong) {
if (isSigned) {
if (bigValue.bitLength() > 31) {
throw new NumberFormatException(
"Number out of range for 32-bit signed integer: "
+ text);
}
} else {
if (bigValue.bitLength() > 32) {
throw new NumberFormatException(
"Number out of range for 32-bit unsigned integer: "
+ text);
}
}
} else {
if (isSigned) {
if (bigValue.bitLength() > 63) {
throw new NumberFormatException(
"Number out of range for 64-bit signed integer: "
+ text);
}
} else {
if (bigValue.bitLength() > 64) {
throw new NumberFormatException(
"Number out of range for 64-bit unsigned integer: "
+ text);
}
}
}
result = bigValue.longValue();
}
return result;
}
}
| [
"alexisdet@MacBook-Pro-de-Alexis.local"
] | alexisdet@MacBook-Pro-de-Alexis.local |
669374cb5e0501f3b7a36a44316d65e1149cd77d | 1e8bcb2302cc0e44556b6db24dc59f1365b4bbfa | /commons/src/main/java/one/show/common/security/Sign.java | c07aebd4f2e306c3266fa7e7b37d98c6cac519d1 | [] | no_license | xiongben-tongxue/show-server | e7ddba7ac14d05400d37c50d7a21379242c8f8cb | 2cccf75ea2dd1b103e5aae0ae18feab4418850f8 | refs/heads/master | 2020-03-14T01:28:42.153462 | 2018-04-25T15:53:19 | 2018-04-25T15:53:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,707 | java | /**
*
*/
package one.show.common.security;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import one.show.common.MD5;
import one.show.common.Constant.USER_AGENT;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Haliaeetus leucocephalus 2018年1月6日 下午6:45:48
*
*/
public class Sign {
private static final Logger log = LoggerFactory.getLogger(Sign.class);
/**
* 签名生成算法
* @param HashMap<String,String> params 请求参数集,所有参数必须已转换为字符串类型
* @param String secret 签名密钥
* @return 签名
* @throws IOException
*/
public static String getSignature(Map<String,String> params, String secret, USER_AGENT userAgent)
{
// 先将参数以其参数名的字典序升序进行排序
Map<String, String> sortedParams = new TreeMap<String, String>(params);
Set<Entry<String, String>> entrys = sortedParams.entrySet();
// 遍历排序后的字典,将所有参数按"key=value"格式拼接在一起
StringBuilder basestring = new StringBuilder();
for (Entry<String, String> param : entrys) {
String value = param.getValue()==null?"":param.getValue();
/*
if (!value.equals("")){
try {
value = URLEncoder.encode(value, "utf-8");
} catch (UnsupportedEncodingException e) {
}
}
*/
basestring.append(param.getKey()).append("=").append(value);
}
basestring.append(secret);
String str = basestring.toString();
try {
if (userAgent != null && userAgent == USER_AGENT.IOS){
str = IOSURLEncoder.encode(str, "utf-8");
}else{
str = URLEncoder.encode(str, "utf-8");
}
} catch (UnsupportedEncodingException e) {
log.error(e.getMessage(), e);
}
log.info("sign basestring : "+ str);
return MD5.md5(str);
}
public static void main(String[] args) throws IOException {
String SECRET = "Knk9ss{3jMM;KD%;k8km,s;sks/.,.]ski2G9,^43*5KM./a.aNNlf/.sdfgnp==>(mskI^8*NKD::I&^(^(KDH,WND..LK*%KJD8'%73djkssj...;'][sks";
Map<String, String> map = new HashMap<String, String>();
map.put("Show-Userid", "916541832572321792");
map.put("Show-UserToken", "368a02f17905d5ac7242851b5e7f9df76a20618b3fb2ec56f51dc44cfa7016c0");
map.put("OS", "iOS");
map.put("App-Version", "3.1.3");
map.put("Kernel-Version", "11.0.1");
map.put("Longitude", "108.735674");
map.put("Latitude", "34.346783");
map.put("City", "%E5%92%B8%E9%98%B3%E5%B8%82");
map.put("Device-Uuid", "C108C419-FEF8-49C5-B1B3-A62CD1EA3536");
map.put("Device-Name", "%E6%9B%B9%E8%94%A1%E6%B4%81");
map.put("Phone-Type", "iPhone");
map.put("Phone-Number", null);
map.put("Channel", "iOS");
map.put("Push-Id", "916541832572321792");
map.put("Net-Type", "1");
map.put("MAC", "02:00:00:00:00:00");
map.put("IM", null);
map.put("IDFA", "7232333C-3117-440F-B80F-B61D0F75E43D");
map.put("IDFY", "C108C419-FEF8-49Cµ-B1Bs-A42CD1EA3536");
map.put("OP", "3");
map.put("CO", "china");
map.put("SC", "1125.000000*2001.000000");
map.put("VN", "3.1.3");
map.put("TAG", null);
map.put("Time", "1507398215");
String mySign = Sign.getSignature(map, SECRET , USER_AGENT.IOS);
System.out.println(mySign);
// System.out.println(IOSURLEncoder.encode("~+* !'();:@&=+$,/?%#[]", "utf-8"));
// System.out.println(URLEncoder.encode("~+* !'();:@&=+$,/?%#[]", "utf-8"));
System.out.println(URLDecoder.decode("App-Version%3D3.1.3Show-UserToken%3D368a02f17905d5ac7242851b5e7f9df76a20618b3fb2ec56f51dc44cfa7016c0Show-Userid%3D916541832572321792CO%3DchinaChannel%3DiOSCity%3D%25E5%2592%25B8%25E9%2598%25B3%25E5%25B8%2582Device-Name%3D%25E6%259B%25B9%25E8%2594%25A1%25E6%25B4%2581Device-Uuid%3DC108C419-FEF8-49C5-B1B3-A62CD1EA3536IDFA%3D7232333C-3117-440F-B80F-B61D0F75E43DIDFY%3DC108C419-FEF8-49C%C2%B5-B1Bs-A42CD1EA3536IM%3DKernel-Version%3D11.0.1Latitude%3D34.346783Longitude%3D108.735674MAC%3D02%3A00%3A00%3A00%3A00%3A00Net-Type%3D1OP%3D3OS%3DiOSPhone-Number%3DPhone-Type%3DiPhonePush-Id%3D916541832572321792SC%3D1125.000000*2001.000000Time%3D1507398215VN%3D3.1.3Knk9ss%7B3jMM%3BKD%25%3Bk8km%2Cs%3Bsks%2F.%2C.%5Dski2G9%2C%5E43*5KM.%2Fa.aNNlf%2F.sdfgnp%3D%3D%3E%28mskI%5E8*NKD%3A%3AI%26%5E%28%5E%28KDH%2CWND..LK*%25KJD8%27%2573djkssj...%3B%27%5D%5Bsks", "utf-8"));
// System.out.println(getSignature(map,"Knk9ss{3jMM;KD%;kl;jafo'jaUG9,^43*5KM./a.aNNlf/.sdfgnp==>(mskI^8*NKD::I&^(^(KDH,WND..LK*%KJD8'%73djkssj...;'][sks"));
}
}
| [
"zhangwei01@hifun.mobi"
] | zhangwei01@hifun.mobi |
45ecc74a99bb2aa43826c68478df2b97a6f00eed | 8397f568ec839882b32bbd7e7ae1887d32dab9c5 | /entity-store/src/main/java/jetbrains/exodus/entitystore/iterate/IdFilter.java | c81c2903f577f159910d66ec9f4d646cafada8f3 | [
"Apache-2.0"
] | permissive | marcelmay/xodus | 7604e5600786c7a189d5a8cb11222cf6379f3388 | 0b0ec85f2202c5e6fbdf214004155782490696c7 | refs/heads/master | 2020-09-28T19:35:39.897524 | 2019-12-06T18:39:46 | 2019-12-06T18:39:46 | 226,847,554 | 0 | 0 | Apache-2.0 | 2019-12-09T10:42:50 | 2019-12-09T10:42:50 | null | UTF-8 | Java | false | false | 3,733 | java | /**
* Copyright 2010 - 2019 JetBrains s.r.o.
*
* 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 jetbrains.exodus.entitystore.iterate;
import org.jetbrains.annotations.NotNull;
interface IdFilter {
int[] EMPTY_ID_ARRAY = new int[0];
boolean hasId(int id);
}
final class TrivialNegativeIdFilter implements IdFilter {
static final IdFilter INSTANCE = new TrivialNegativeIdFilter();
private TrivialNegativeIdFilter() {
}
@Override
public boolean hasId(final int id) {
return false;
}
}
abstract class InitialIdFilter implements IdFilter {
@Override
public boolean hasId(final int id) {
final int[] ids = getIds();
final int idCount = ids.length;
if (idCount == 0) {
setFinalIdFilter(TrivialNegativeIdFilter.INSTANCE);
return false;
}
if (idCount == 1) {
final int singleId = ids[0];
setFinalIdFilter(new SingleIdFilter(singleId));
return singleId == id;
}
final BloomIdFilter finalFilter = idCount < 4 ? new LinearSearchIdFilter(ids) : new BinarySearchIdFilter(ids);
setFinalIdFilter(finalFilter);
return finalFilter.hasId(id);
}
abstract int[] getIds();
abstract void setFinalIdFilter(@NotNull IdFilter filter);
}
final class SingleIdFilter implements IdFilter {
private final int id;
SingleIdFilter(final int id) {
this.id = id;
}
@Override
public boolean hasId(int id) {
return id == this.id;
}
}
abstract class BloomIdFilter implements IdFilter {
final int[] ids;
private final int bloomFilter;
BloomIdFilter(@NotNull final int[] ids) {
this.ids = ids;
int bloomFilter = 0;
for (int id : ids) {
bloomFilter |= (1 << (id & 0x1f));
}
this.bloomFilter = bloomFilter;
}
@Override
public boolean hasId(final int id) {
return (bloomFilter & (1 << (id & 0x1f))) != 0;
}
}
final class LinearSearchIdFilter extends BloomIdFilter {
LinearSearchIdFilter(@NotNull final int[] ids) {
super(ids);
}
@Override
public boolean hasId(final int id) {
if (super.hasId(id)) {
for (int i : ids) {
if (i == id) {
return true;
}
if (i > id) {
break;
}
}
}
return false;
}
}
final class BinarySearchIdFilter extends BloomIdFilter {
BinarySearchIdFilter(@NotNull final int[] ids) {
super(ids);
}
@Override
public boolean hasId(final int id) {
if (super.hasId(id)) {
// copy-pasted Arrays.binarySearch
int high = ids.length - 1;
int low = 0;
while (low <= high) {
final int mid = (low + high) >>> 1;
final int midVal = ids[mid];
if (midVal < id) {
low = mid + 1;
} else if (midVal > id) {
high = mid - 1;
} else {
return true;
}
}
}
return false;
}
} | [
"lvo@intellij.net"
] | lvo@intellij.net |
dd6da3b394f6b50943ce1baf3529a5afede73eb5 | 39455e681cfeda24252e0a1eb1139ce6067e1aea | /Spring/MicroServices Sirs code/config-server/src/test/java/com/mycompany/ConfigServerApplicationTests.java | 43484d3bdb2621bfd83bf562e1bd9ec904117e6c | [] | no_license | sanga03/IBM-FSD-000GKY | bb78f2d0bf0973db24e34770fe77447d6e399b30 | 65b9d0412a7150a8028660da044bdb0a95d14e43 | refs/heads/master | 2023-01-12T00:03:28.843823 | 2021-10-02T04:13:14 | 2021-10-02T04:13:14 | 195,184,805 | 1 | 4 | null | 2023-01-07T08:38:35 | 2019-07-04T06:48:06 | Java | UTF-8 | Java | false | false | 336 | java | package com.mycompany;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ConfigServerApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"b4ibmjava20@iiht.tech"
] | b4ibmjava20@iiht.tech |
da7fbc229cf9a0290d7580565de44c8e479341a7 | ea925d29f0d52699d3335d5b0c7a20b5445e3512 | /bd-parent/bd-core/src/main/java/com/bdqa/tag/service/impl/TagServiceImpl.java | 136a2b1e79634bccd75e94cc4c862e7e1350abc3 | [] | no_license | WenZiJie/ssm | f40cc7e1f82df0fc77c3306fe0bbdfcb80e1399b | 991c0eac37691b3140fa84733955e2136d03600b | refs/heads/master | 2020-03-23T04:49:15.965120 | 2018-07-30T13:49:28 | 2018-07-30T13:49:28 | 141,107,215 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,190 | java | package com.bdqa.tag.service.impl;
import java.io.IOException;
import java.rmi.RemoteException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.config.annotation.Service;
import com.bdqa.question.domain.Question;
import com.bdqa.tag.domain.Tag;
import com.bdqa.tag.mapper.TagMapper;
import com.bdqa.tag.service.TagService;
@Service()
public class TagServiceImpl implements TagService{
public TagServiceImpl() throws RemoteException {
super();
}
@Autowired
private TagMapper tagMapper;
@Override
public List<Tag> queryTagByPath(String tagPath){
List<Tag> tagLisst = tagMapper.queryTagByPath(tagPath);
return tagLisst;
}
@Override
public Tag queryTagById(Integer tagId){
Tag tag = tagMapper.queryTagById(tagId);
return tag;
}
/**
* 根据标签名精确查找
* @param name
* @return
*/
public List<Tag> queryByTagName(String tagName){
return tagMapper.queryByTagName(tagName);
}
/**
* 新增提问处理
* @param question
* @param file
* @return
* @throws IOException
*/
public int addQuestion(Question question) {
return tagMapper.addQuestion(question);
}
}
| [
"965401342@qq.com"
] | 965401342@qq.com |
149345c50146817b213873320d60a28308d30d56 | 180469847c2f0ed6566901e3164cb138fea1597d | /AITTimeShow/app/src/main/java/hu/ait/aittimeshow/MainActivity.java | 4c0081b941b52e0b513282c142f08ef8d1ca6045 | [] | no_license | peekler/AIT2017Summer | 3faf8bad661d957ff750ea1a0667387d5541fec1 | 6b1e7864fea9e8a3be3307126ef372e9d09ba1e5 | refs/heads/master | 2021-01-24T07:27:43.079996 | 2017-07-05T18:01:48 | 2017-07-05T18:01:48 | 93,342,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,097 | java | package hu.ait.aittimeshow;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Date;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnTime = (Button) findViewById(R.id.btnTime);
final TextView tvTime = (TextView) findViewById(R.id.tvTime);
final EditText etName = (EditText) findViewById(R.id.etName);
final LinearLayout layoutContent = (LinearLayout) findViewById(R.id.layoutContent);
btnTime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("TAG_MAIN", "btnTime was pressed");
String name = etName.getText().toString();
if (!TextUtils.isEmpty(name)) {
String time = getString(R.string.time_message, name,
new Date(System.currentTimeMillis()).toString());
//Toast.makeText(MainActivity.this, time,
// Toast.LENGTH_SHORT).show();
Snackbar.make(layoutContent, time, Snackbar.LENGTH_LONG).setAction(
"Ok", new View.OnClickListener() {
@Override
public void onClick(View v) {
tvTime.setText("OK");
}
}
).show();
tvTime.setText(time);
} else {
etName.setError(getString(R.string.error_empty));
}
}
});
}
}
| [
"peter.ekler@gmail.com"
] | peter.ekler@gmail.com |
90a35d506e2a69990309b241a0c12363f25a6036 | cb13711005fc701cb6fe2cb3bf394ada4dc83588 | /app/src/main/java/com/ivy/baseproject/test/bean/response/EnvProportion.java | bb4371231f75ef881e49e88a0de67a67605649aa | [
"Apache-2.0"
] | permissive | wixche/BaseProject | cb3f8e149bed089ff8799473f08344b66035aa5f | 448c806351e9d174f97e0a05f368b7da5ab3f742 | refs/heads/master | 2020-03-11T18:12:21.965386 | 2019-04-18T12:34:54 | 2019-04-18T12:34:54 | 130,170,519 | 1 | 0 | null | 2019-04-18T12:34:55 | 2018-04-19T06:42:28 | Java | UTF-8 | Java | false | false | 2,443 | java | package com.ivy.baseproject.test.bean.response;
/**
* @author
* @version 1.0
* @date 2018/8/3
*/
public class EnvProportion {
/**
* code : 200
* msg : OK
* data : {"pm25":12,"pm10":23,"so2":45,"no2":27,"o3":47,"co":34,"time":"2017-08-12 11:11:11"}
*/
private int code;
private String msg;
private DataBean data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean {
/**
* pm25 : 12.0
* pm10 : 23.0
* so2 : 45.0
* no2 : 27.0
* o3 : 47.0
* co : 34.0
* time : 2017-08-12 11:11:11
*/
private double pm25;
private double pm10;
private double so2;
private double no2;
private double o3;
private double co;
private String time;
public double getPm25() {
return pm25;
}
public void setPm25(double pm25) {
this.pm25 = pm25;
}
public double getPm10() {
return pm10;
}
public void setPm10(double pm10) {
this.pm10 = pm10;
}
public double getSo2() {
return so2;
}
public void setSo2(double so2) {
this.so2 = so2;
}
public double getNo2() {
return no2;
}
public void setNo2(double no2) {
this.no2 = no2;
}
public double getO3() {
return o3;
}
public void setO3(double o3) {
this.o3 = o3;
}
public double getCo() {
return co;
}
public void setCo(double co) {
this.co = co;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
@Override
public String toString() {
return "DataBean{" + "pm25=" + pm25 + ", pm10=" + pm10 + ", so2=" + so2 + ", no2=" + no2 + ", o3=" + o3 + ", co=" + co + ", time='" + time + '\'' + '}';
}
}
}
| [
"13521549681"
] | 13521549681 |
e5c5a00eef20efd845eff00174752becb0f08b22 | 1a8e6c1579a0ad2f7e611d32ce25ac455da24935 | /app/src/main/java/com/isao/mizurima/receiver/SystemBootReceiver.java | f92bfc15b3385c5a1945b8982c5e532a4b1d3aeb | [
"Apache-2.0"
] | permissive | guavaouji/Mizurima | 36d3ff3cc7867b64661126ac0ae102d7d6bc5d87 | b29120df2de691516623751c0dc3de693537f061 | refs/heads/master | 2022-12-02T09:22:56.362159 | 2020-08-18T00:55:02 | 2020-08-18T00:55:02 | 286,924,101 | 0 | 0 | Apache-2.0 | 2020-08-17T07:10:38 | 2020-08-12T05:23:48 | Java | UTF-8 | Java | false | false | 1,033 | java | package com.isao.mizurima.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import com.isao.mizurima.R;
import com.isao.mizurima.utils.DailyTaskUtils;
import com.isao.mizurima.utils.NotificationUtils;
import java.text.ParseException;
public class SystemBootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
try {
// 今日、明日の通知のスケジュール更新
NotificationUtils.update(context, 0, 1);
} catch (ParseException e) {
Toast.makeText(context,
R.string.notification_update_failed_message,
Toast.LENGTH_SHORT).show();
}
// 日次処理のスケジュール登録
DailyTaskUtils.saveSchedule(context);
}
}
}
| [
"guavaouji@gmail.com"
] | guavaouji@gmail.com |
7d474bc679974dad00ee7732a017e8d59b5c344c | 7a0c5c36319a22e8591a0d5f4f2825feb0438d37 | /backend/src/main/java/se/klartext/data/elasticsearch/repository/impl/WordElasticsearchRepositoryImpl.java | 6bc241944cf75316026a32122e375abe69a65fa7 | [] | no_license | chuan-su/klartext | c0ea352625187bd58a2c1860614ea1ae758e929d | 7d4140e878a8e08cf44de255f346adb0afa212f2 | refs/heads/master | 2021-01-15T14:01:38.253744 | 2018-02-15T20:06:59 | 2018-02-15T20:06:59 | 91,384,724 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,335 | java | package se.klartext.data.elasticsearch.repository.impl;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.reactivex.Single;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.index.query.QueryBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import se.klartext.data.elasticsearch.repository.api.WordElasticsearchRepository;
import se.klartext.data.elasticsearch.document.Word;
import java.util.ArrayList;
import java.util.List;
import static org.elasticsearch.index.query.QueryBuilders.multiMatchQuery;
@Repository
public class WordElasticsearchRepositoryImpl extends ElasticsearchBaseRepositoryImpl<Word>
implements WordElasticsearchRepository {
@Autowired
public WordElasticsearchRepositoryImpl(TransportClient esClient) {
super(esClient);
}
@Override
public Single<List<Word>> findWordMatch(String query) {
QueryBuilder multiMathQuery = multiMatchQuery(query, "value","inflection","translation");
return this.find(multiMathQuery)
.map(source -> new ObjectMapper().convertValue(source,Word.class))
.collect(ArrayList::new,List::add);
}
@Override
public String getDocumentType() {
return "word";
}
}
| [
"chuansu@icloud.com"
] | chuansu@icloud.com |
9ac5b3b2ecc9e72fa6cf53ed1e6391fd130d9a82 | 0585d4599081607da90bb888b20c0fc408e82f41 | /app/src/main/java/com/example/benimprojem/fragments/HomeFragment.java | abfc4c12891a9cf30a8df3360096984823d6411d | [] | no_license | atakfatmazehra/GlutensizYasamTam | 663358e757d59fe64b0043f5f112c7cc981bc9eb | 8d560143e0a180fa3d57351d79e7c1799486455e | refs/heads/master | 2022-04-30T20:31:39.350083 | 2022-04-01T07:36:11 | 2022-04-01T07:36:11 | 213,584,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,354 | java | package com.example.benimprojem.fragments;
import android.content.Intent;
import android.database.DatabaseErrorHandler;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.SearchView;
import android.widget.Toast;
import com.example.benimprojem.AddPostActivity;
import com.example.benimprojem.DiyetisyenActivity;
import com.example.benimprojem.MainActivity;
import com.example.benimprojem.R;
import com.example.benimprojem.SavedPostActivity;
import com.example.benimprojem.adapters.AdapterPosts;
import com.example.benimprojem.models.ModelPost;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
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;
import java.util.ArrayList;
import java.util.List;
import java.util.ServiceConfigurationError;
/**
* A simple {@link Fragment} subclass.
*/
public class HomeFragment extends Fragment {
FirebaseAuth firebaseAuth;
RecyclerView recyclerView;
List<ModelPost> postList;
AdapterPosts adapterPosts;
public HomeFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_home, container, false);
firebaseAuth =FirebaseAuth.getInstance();
//recycler view and its properties
recyclerView = view.findViewById(R.id.postRecyc);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
layoutManager.setStackFromEnd(true);
layoutManager.setReverseLayout(true);
recyclerView.setLayoutManager(layoutManager);
//init post list
postList = new ArrayList<>();
loadPost();
return view;
}
private void loadPost() {
//path of all post
DatabaseReference ref = FirebaseDatabase.getInstance().getReference("Posts");
//get all data from this ref
ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
postList.clear();
for (DataSnapshot ds: dataSnapshot.getChildren()){
ModelPost modelPost = ds.getValue(ModelPost.class);
postList.add(modelPost);
adapterPosts = new AdapterPosts(getActivity(), postList);
recyclerView.setAdapter(adapterPosts);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
//in case of error
Toast.makeText(getActivity(), ""+databaseError.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
private void searchPosts(final String searchQuery){
DatabaseReference ref = FirebaseDatabase.getInstance().getReference("Posts");
//get all data from this ref
ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
postList.clear();
for (DataSnapshot ds: dataSnapshot.getChildren()){
ModelPost modelPost = ds.getValue(ModelPost.class);
if (modelPost.getpTitle().toLowerCase().contains(searchQuery.toLowerCase()) ||
modelPost.getpDescr().toLowerCase().contains(searchQuery.toLowerCase())){
postList.add(modelPost);
}
adapterPosts = new AdapterPosts(getActivity(), postList);
recyclerView.setAdapter(adapterPosts);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
//in case of error
Toast.makeText(getActivity(), ""+databaseError.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
private void checkUserStatus(){
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null){
//ProfilActivity Dashboard olarak değitirildi
//mProfilP.setText(user.getEmail());
}
else{
startActivity(new Intent(getActivity(), MainActivity.class));
getActivity().finish();
}
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
setHasOptionsMenu(true); // to show menu option in fragment
super.onCreate(savedInstanceState);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_main, menu);
MenuItem item = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
if (!TextUtils.isEmpty(s)){
searchPosts(s);
}
else{
loadPost();
}
return false;
}
@Override
public boolean onQueryTextChange(String s) {
if (!TextUtils.isEmpty(s)){
searchPosts(s);
}
else{
loadPost();
}
return false;
}
});
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if (id ==R.id.action_logout){
firebaseAuth.signOut();
checkUserStatus();
}
//Post eklemek için AddPostActivity sayfasına yönlendirir. Benim için önemli olan addpostactivity deki kodları fragmente aktarabilmek
if (id ==R.id.action_add_post){
startActivity(new Intent(getActivity(), AddPostActivity.class));
}
if (id ==R.id.action_saved){
startActivity(new Intent(getActivity(), SavedPostActivity.class));
}
if (id ==R.id.action_saved){
startActivity(new Intent(getActivity(), SavedPostActivity.class));
}
if (id ==R.id.action_diyetisyen){
startActivity(new Intent(getActivity(), DiyetisyenActivity.class));
}
return super.onOptionsItemSelected(item);
}
}
| [
"atakfatmazehra@gmail.com"
] | atakfatmazehra@gmail.com |
1bc320ac8af426e77fc98344afeaa5d5ba0d0a87 | a59de99ca972dbf2bbab67a3d798df5065983ac5 | /HashMap/src/ArrayList/RemoveSpchrString.java | a58be291efe9ca953d1ba38d3f3055d6065c8455 | [] | no_license | AriyanAyan/AriyanAyan | 322aba2b26459b0dd0a392a05c2d7a8d267112a0 | b493c17dd5a195312ea080cc635590542f6239d7 | refs/heads/master | 2023-07-06T07:54:03.025899 | 2021-08-04T22:51:13 | 2021-08-04T22:51:13 | 392,245,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 250 | java | package ArrayList;
public class RemoveSpchrString {
public static void main(String[] args) {
String name = "B!a@n(g#lad^es%h*";
// Regular Expression.....
name = name.replaceAll("[^a-zA-Z0-9]", "");
System.out.println(name);
}
}
| [
"ariyanayan07@gmail.com"
] | ariyanayan07@gmail.com |
51d470f475e27ccd47fbcc2ce7646f8b20f24dec | 9f1c80cebe0398734daf9bbc84cb0feece826da5 | /app/src/main/java/pe/dquispe/labcalificado3/adapters/OperationAdapter.java | f958239858fb06ea64fc0392f3f0d5a31dfe951a | [] | no_license | dquispeo/LabCalificado3 | 4cedcb76c8dca3c210bd7697333d5df4da4d6d46 | 173a7ee268dbc87a5d1c1feffd29b23030dd2fe2 | refs/heads/master | 2020-08-05T08:39:38.094518 | 2019-10-03T00:24:01 | 2019-10-03T00:24:01 | 212,467,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,957 | java | package pe.dquispe.labcalificado3.adapters;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.github.curioustechizen.ago.RelativeTimeTextView;
import java.util.ArrayList;
import java.util.List;
import pe.dquispe.labcalificado3.R;
import pe.dquispe.labcalificado3.activities.DetailActivity;
import pe.dquispe.labcalificado3.models.Operation;
import pe.dquispe.labcalificado3.repositories.OperationRepository;
public class OperationAdapter extends RecyclerView.Adapter<OperationAdapter.ViewHolder> {
private static final String TAG = OperationAdapter.class.getSimpleName();
private List<Operation> operations;
public OperationAdapter(){
this.operations = new ArrayList<>();
}
public void setOperations(List<Operation> operations) {
this.operations = operations;
}
public class ViewHolder extends RecyclerView.ViewHolder{
public TextView inputMonto;
public TextView inputIngEgr;
public TextView inputTipo;
public TextView dateText;
public ViewHolder(View itemView) {
super(itemView);
inputMonto = (TextView) itemView.findViewById(R.id.input_monto_detail);
inputIngEgr = (TextView) itemView.findViewById(R.id.input_ingegr_detail);
inputTipo = (TextView) itemView.findViewById(R.id.input_tipo_detail);
dateText = (TextView) itemView.findViewById(R.id.date_text);
}
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_detail, parent, false);
ViewHolder viewHolder = new ViewHolder(itemView);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) {
final Operation operation = this.operations.get(position);
viewHolder.inputMonto.setText(operation.getMonto());
viewHolder.inputIngEgr.setText(operation.getIngEgr());
viewHolder.inputTipo.setText(operation.getTipoCuenta());
viewHolder.dateText.setText(operation.getDate());
// OnClick on Detail
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(view.getContext(), DetailActivity.class);
intent.putExtra("ID", operation.getId());
view.getContext().startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return this.operations.size();
}
}
| [
"daniel.quispe.o@gmail.com"
] | daniel.quispe.o@gmail.com |
1039ea0c6d37d85ba27a6300eadbaf79455e0c7a | 3532b9af4a8ddcfb26013d6b9bbb65f875a79483 | /src/Internals/Registro_Pago.java | 05cdb7e8b79fa6d53d31483164876fe97694bfd7 | [] | no_license | aldomar-mc/Sistema-de-comedor-universitario | 5d6cec99845d00ebaedb894c635bd1b09d0d40eb | a8cb97907bceffa860b3e56d4f9492a15876c0cf | refs/heads/master | 2021-05-17T14:30:16.120005 | 2020-03-28T15:23:56 | 2020-03-28T15:23:56 | 250,821,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 37,210 | java |
package Internals;
/**** @author Ing. Miguel Angel Silva Zapata. **********/
import javax.swing.*;
import Clases.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import jxl.*;
import java.util.Map;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.util.Date;
import javax.swing.filechooser.FileNameExtensionFilter;
public class Registro_Pago extends javax.swing.JInternalFrame {
/*************************Atributos**********************/
Mimodelo modelo=new Mimodelo();
Mimodelo modelo1=new Mimodelo();
Controlador control=new Controlador();
String idBnc;
private double tarifa=0;
String soloal="0";
private int identificador=0;
private JFileChooser chooser = new JFileChooser();
private JFileChooser chooserim = new JFileChooser();
/*************************Atributos**********************/
/*************************Métodos************************/
public void CrearBanco(){
if(lbComensal.getText().trim().length()==0 || cbTipoComensal.getSelectedIndex()<0){
JOptionPane.showMessageDialog(rootPane,"Faltan datos");
//txFoto.requestFocus();
}
else{
control.Sql=String.format("select * from pago where fecha='%s' and idconsumidores='%s' and monto='%s' and numcomprobante='%s';",
control.Formato_Amd(fcFechaUno.getDate()),idBnc,txmontoPago.getText(),txNuncomprobante.getText());
if(control.Verificandoconsulta(control.Sql)!=true){
try {
if(identificador==4){
control.Sql=String.format("insert into pago values(null,'%s','0.00',curdate(),'1','null','001-00100','0');",idBnc);
}else{
String tipcompro=control.DevolverRegistroDto("select idtipocomprobante from tipocomprobante where descricomproba='"+cbtipoComprobante.getSelectedItem().toString()+"';",1);
String facu=control.DevolverRegistroDto("select idfacultad from facultad where descrifacu='"+cbTipoComensal.getSelectedItem().toString()+"';",1);
control.Sql=String.format("insert into pago values(null,'%s','%s','%s','%s','%s','%s','1');",idBnc,txmontoPago.getText(),control.Formato_Amd(fcFechaUno.getDate()),tipcompro,"null",txNuncomprobante.getText());
}
int idpago=control.executeAndGetId(control.Sql);
control.fila=0;
int dias=Integer.parseInt(lbNumDiasConsumo.getText());
while(control.fila<dias){
control.Sql=String.format("insert into cronogramaconsumo values(null,'%s','%s','%s','%s');",
idpago,""+jTable1.getValueAt(control.fila, 2).toString(), "0",soloal);
control.CrearRegistro(control.Sql );
control.fila++;
}
JOptionPane.showMessageDialog(null, "Se ha Ingresado Correctamente el Pago y se Genero el Cronograma para el Comensal");
MostrarBancos();
Cancelar();
} catch (Exception e) {
e.printStackTrace();
}
}
else{
JOptionPane.showMessageDialog(null, "EL Pago Ya se ha Registrado anteriormente\n Ya se genero el Cronograma","",3);
}
}
}
public void Cancelar(){
tBancos.clearSelection();
txBuscar.setText(null);
txmontoPago.requestFocus();
bCrear.setEnabled(true);
txmontoPago.setText(null);
cbtipoComprobante.setSelectedIndex(0);
lbComensal.setText(" ");
lbDni.setText(" ");
lbEstado.setText(" ");
lbNumDiasConsumo.setText(" ");
lbTarifa.setText(" ");
tarifa=0;
cbtipoComprobante.setSelectedIndex(-1);
fcFechaUno.setDate(new Date());
fcFechaDos.setDate(new Date());
txNuncomprobante.setText(" ");
txmontoPago.setText(" ");
control.LimTabla(modelo1);
chbLun.setSelected(true);
chbMar.setSelected(true);
chbMier.setSelected(true);
chbJuev.setSelected(true);
chbVier.setSelected(true);
chbSab.setSelected(false);
chbDom.setSelected(false);
jCheckBox1.setSelected(false);
cbtipoComprobante.setEnabled(true);
txNuncomprobante.setEnabled(true);
//jDateChooser1.setEnabled(true);
lbFechaFinal.setText("Inicio de Consumo:");
lbFechaInicio.setText("Fecha Pago:");
txmontoPago.setEnabled(true);
}
public void VerBanco(){
control.fila=tBancos.getSelectedRow();
if(control.fila>=0){
if(identificador==4){
idBnc =tBancos.getValueAt(control.fila,0).toString();
lbComensal.setText(tBancos.getValueAt(control.fila,2).toString().toUpperCase());
lbDni.setText(tBancos.getValueAt(control.fila,1).toString());
lbEstado.setText(tBancos.getValueAt(control.fila,4).toString().toUpperCase());
lbTarifa.setText(tBancos.getValueAt(control.fila,6).toString());
tarifa=Double.parseDouble(tBancos.getValueAt(control.fila,6).toString());
cbtipoComprobante.setEnabled(false);
txNuncomprobante.setEnabled(false);
txmontoPago.setEnabled(false);
lbFechaFinal.setText("Fecha Final:");
lbFechaInicio.setText("Fecha Inicio:");
}else{
idBnc =tBancos.getValueAt(control.fila,0).toString();
lbComensal.setText(tBancos.getValueAt(control.fila,2).toString().toUpperCase());
lbDni.setText(tBancos.getValueAt(control.fila,1).toString());
lbEstado.setText(tBancos.getValueAt(control.fila,4).toString().toUpperCase());
lbTarifa.setText(tBancos.getValueAt(control.fila,6).toString());
tarifa=Double.parseDouble(tBancos.getValueAt(control.fila,6).toString());
}
}
}
public void MostrarBancos(){
BuscarBanco();
}
public void BuscarBanco(){
int idtipo=Integer.parseInt(control.DevolverRegistroDto("select * from tipocomensal where descritipcom='"+cbTipoComensal.getSelectedItem().toString()+"';", 1));
identificador=idtipo;
if(idtipo==1){
control.Sql=" SELECT " +
" idconsumidores,dni, nombres, if(genero='0','Masculino','Femenino'), if(c.estado=0,'Activo','InActivo'), descrifacu, monto, categor, descrisemestre, descritipcom " +
" FROM alumnos a, consumidores c, facultad f,tarifas t,semestre s, tipocomensal tc " +
" where a.idfacultad=f.idfacultad and a.idalumnos=c.idcomensales and c.idtipocomensal=tc.idtipocomensal " +
" and c.idtarifas=t.idtarifas and c.idsemestre=s.idsemestre and tc.idtipocomensal='1' and s.estadosem='0' " +
" and (dni like '%"+txBuscar.getText()+"%' or nombres like '%"+txBuscar.getText()+"%')";
}else{
if(idtipo==2){
control.Sql=" SELECT " +
" idconsumidores,dni, nombres, if(genero='0','Masculino','Femenino'), if(c.estado=0,'Activo','InActivo'), 'No Asignado', monto, categor, descrisemestre, descritipcom " +
" FROM docentes a, consumidores c,tarifas t,semestre s, tipocomensal tc " +
" where a.iddocentes=c.idcomensales and c.idtipocomensal=tc.idtipocomensal " +
" and c.idtarifas=t.idtarifas and c.idsemestre=s.idsemestre and tc.idtipocomensal='2' and s.estadosem='0' " +
" and (dni like '%"+txBuscar.getText()+"%' or nombres like '%"+txBuscar.getText()+"%')";
}else{
if(idtipo==3){
control.Sql=" SELECT " +
" idconsumidores,dni, nombres, if(genero='0','Masculino','Femenino'), if(c.estado=0,'Activo','InActivo'), 'No Asignado', monto, categor, descrisemestre, descritipcom " +
" FROM administrativos a, consumidores c,tarifas t,semestre s, tipocomensal tc " +
" where a.idadministrativos=c.idcomensales and c.idtipocomensal=tc.idtipocomensal " +
" and c.idtarifas=t.idtarifas and c.idsemestre=s.idsemestre and tc.idtipocomensal='3' and s.estadosem='0' " +
" and (dni like '%"+txBuscar.getText()+"%' or nombres like '%"+txBuscar.getText()+"%')";
}else{
control.Sql=" SELECT " +
" idconsumidores,dni, nombres, if(genero='0','Masculino','Femenino'), if(c.estado=0,'Activo','InActivo'), codcasoesp, monto, categor, descrisemestre, descritipcom " +
" FROM regcasosespeciales a, consumidores c,tarifas t,semestre s, tipocomensal tc , casoespecial cas" +
" where a.idregcasosespeciales=c.idcomensales and c.idtipocomensal=tc.idtipocomensal and a.idcasoespecial=cas.idcasoespecial " +
" and c.idtarifas=t.idtarifas and c.idsemestre=s.idsemestre and tc.idtipocomensal='4' and s.estadosem='0' " +
" and (dni like '%"+txBuscar.getText()+"%' or nombres like '%"+txBuscar.getText()+"%')";
}
}
}
System.out.println(control.Sql);
control.LlenarJTabla(modelo,control.Sql,10);
}
public void ValidardatosBancos(){
}
public Registro_Pago() {
initComponents();setTitle("Registro de Pagos");
this.setFrameIcon(new ImageIcon(this.getClass().getResource("/Imagenes/Vender.png")));
tBancos.setModel(modelo);modelo.setColumnIdentifiers(new String[] {"Id","DNI/CODIGO","Nombres","Genero","Estado","Facultad","Tarifa","Categoria","Semestre","Tipo Comsumidor"});
tBancos.getColumnModel().getColumn(0).setMaxWidth(0);
tBancos.getColumnModel().getColumn(0).setMinWidth(0);
tBancos.getColumnModel().getColumn(0).setPreferredWidth(0);
tBancos.getColumnModel().getColumn(1).setPreferredWidth(30);
tBancos.getColumnModel().getColumn(2).setPreferredWidth(140);
tBancos.getColumnModel().getColumn(3).setPreferredWidth(30);
tBancos.getColumnModel().getColumn(4).setMaxWidth(0);
tBancos.getColumnModel().getColumn(4).setMinWidth(0);
tBancos.getColumnModel().getColumn(4).setPreferredWidth(0);
tBancos.getColumnModel().getColumn(5).setPreferredWidth(40);
tBancos.getColumnModel().getColumn(6).setPreferredWidth(30);
tBancos.getColumnModel().getColumn(7).setPreferredWidth(30);
tBancos.getColumnModel().getColumn(8).setMaxWidth(0);
tBancos.getColumnModel().getColumn(8).setMinWidth(0);
tBancos.getColumnModel().getColumn(8).setPreferredWidth(0);
tBancos.getColumnModel().getColumn(9).setMaxWidth(0);
tBancos.getColumnModel().getColumn(9).setMinWidth(0);
tBancos.getColumnModel().getColumn(9).setPreferredWidth(0);
jTable1.setModel(modelo1);
fcFechaUno.setDate(new Date());
fcFechaDos.setDate(new Date());
modelo1.setColumnIdentifiers(new String[] {"N°","Dia","Fecha"});
bCrear.setMnemonic('c');bCancelar.setMnemonic('a');
// bModificar.setMnemonic('d');bEliminar.setMnemonic('e');
bSalir.setMnemonic('s');
FormatoTabla ft= new FormatoTabla(2);
tBancos.setDefaultRenderer(Object.class, ft);
jTable1.setDefaultRenderer(Object.class, ft);
chbLun.setSelected(true);
chbMar.setSelected(true);
chbMier.setSelected(true);
chbJuev.setSelected(true);
chbVier.setSelected(true);
chbSab.setSelected(false);
chbDom.setSelected(false);
control.LlenarCombo(cbTipoComensal,"SELECT * FROM tipocomensal",2);
control.LlenarCombo(cbtipoComprobante,"SELECT * FROM tipocomprobante;",2);
cbTipoComensal.setSelectedIndex(0);
MostrarBancos();
cbTipoComensal.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
MostrarBancos();
Cancelar();
}
});
}
/*************************Métodos************************/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
bSalir = new javax.swing.JButton();
bCrear = new javax.swing.JButton();
bCancelar = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tBancos = new javax.swing.JTable();
jPanel2 = new javax.swing.JPanel();
lbTarifa = new javax.swing.JLabel();
lbComensal = new javax.swing.JLabel();
lbDni = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
lbEstado = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
txBuscar = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
cbTipoComensal = new javax.swing.JComboBox();
jLabel8 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
lbFechaFinal = new javax.swing.JLabel();
cbtipoComprobante = new javax.swing.JComboBox();
jLabel9 = new javax.swing.JLabel();
txmontoPago = new javax.swing.JTextField();
fcFechaUno = new com.toedter.calendar.JDateChooser();
lbNumDiasConsumo = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
chbDom = new javax.swing.JCheckBox();
chbLun = new javax.swing.JCheckBox();
chbMar = new javax.swing.JCheckBox();
chbMier = new javax.swing.JCheckBox();
chbJuev = new javax.swing.JCheckBox();
chbVier = new javax.swing.JCheckBox();
chbSab = new javax.swing.JCheckBox();
jButton2 = new javax.swing.JButton();
jLabel13 = new javax.swing.JLabel();
txNuncomprobante = new javax.swing.JTextField();
lbFechaInicio = new javax.swing.JLabel();
fcFechaDos = new com.toedter.calendar.JDateChooser();
jCheckBox1 = new javax.swing.JCheckBox();
setBackground(new java.awt.Color(51, 153, 255));
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(51, 153, 255));
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
bSalir.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
bSalir.setForeground(new java.awt.Color(0, 51, 102));
bSalir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/salir.png"))); // NOI18N
bSalir.setText("Salir");
bSalir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bSalirActionPerformed(evt);
}
});
jPanel1.add(bSalir, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 10, 100, 40));
bCrear.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
bCrear.setForeground(new java.awt.Color(0, 51, 102));
bCrear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Accept.png"))); // NOI18N
bCrear.setText("Crear");
bCrear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bCrearActionPerformed(evt);
}
});
jPanel1.add(bCrear, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 10, 100, 40));
bCancelar.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
bCancelar.setForeground(new java.awt.Color(0, 51, 102));
bCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/cancel.png"))); // NOI18N
bCancelar.setText("Cancelar");
bCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bCancelarActionPerformed(evt);
}
});
jPanel1.add(bCancelar, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 10, 110, 40));
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 0, 480, 60));
tBancos.setAutoCreateRowSorter(true);
tBancos.setForeground(new java.awt.Color(0, 51, 102));
tBancos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
tBancos.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tBancosMouseClicked(evt);
}
});
jScrollPane1.setViewportView(tBancos);
getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, 640, 470));
jPanel2.setBackground(new java.awt.Color(51, 153, 255));
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos Comensal", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 12), new java.awt.Color(0, 51, 102))); // NOI18N
jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
lbTarifa.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
lbTarifa.setForeground(new java.awt.Color(204, 51, 0));
lbTarifa.setText(" ");
jPanel2.add(lbTarifa, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 80, 140, 20));
lbComensal.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
lbComensal.setForeground(new java.awt.Color(204, 51, 0));
lbComensal.setText(" ");
jPanel2.add(lbComensal, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 20, 290, 20));
lbDni.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
lbDni.setForeground(new java.awt.Color(204, 51, 0));
jPanel2.add(lbDni, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 50, 140, 20));
jLabel11.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel11.setForeground(new java.awt.Color(0, 51, 153));
jLabel11.setText("COMENSAL");
jPanel2.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 20, -1, 20));
jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel10.setForeground(new java.awt.Color(0, 51, 153));
jLabel10.setText("CODIGO/DNI");
jPanel2.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 50, -1, 20));
lbEstado.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
lbEstado.setForeground(new java.awt.Color(204, 51, 0));
lbEstado.setText(" ");
jPanel2.add(lbEstado, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 110, 140, 20));
jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel5.setForeground(new java.awt.Color(0, 51, 153));
jLabel5.setText("TARIFA");
jPanel2.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 80, -1, 20));
jLabel12.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel12.setForeground(new java.awt.Color(0, 51, 153));
jLabel12.setText("ESTADO");
jPanel2.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 110, -1, 20));
getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(660, 60, 500, 140));
jPanel3.setBackground(new java.awt.Color(51, 153, 255));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Lista de Comensales", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 12), new java.awt.Color(0, 0, 153))); // NOI18N
jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
txBuscar.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txBuscarKeyReleased(evt);
}
});
jPanel3.add(txBuscar, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 20, 180, -1));
jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel2.setForeground(new java.awt.Color(0, 51, 153));
jLabel2.setText("Buscar");
jPanel3.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, -1, 20));
jPanel3.add(cbTipoComensal, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 20, 150, -1));
jLabel8.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel8.setForeground(new java.awt.Color(0, 51, 153));
jLabel8.setText("Tipo de Comensal");
jPanel3.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 20, -1, 20));
getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 60, 660, 530));
jPanel4.setBackground(new java.awt.Color(51, 153, 255));
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Registro Pagos", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 12), new java.awt.Color(0, 51, 102))); // NOI18N
jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel6.setForeground(new java.awt.Color(0, 51, 153));
jLabel6.setText("Monto de Pago");
jPanel4.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(35, 80, 80, 20));
lbFechaFinal.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
lbFechaFinal.setForeground(new java.awt.Color(0, 51, 153));
lbFechaFinal.setText("Inicio de Consumo");
jPanel4.add(lbFechaFinal, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 50, -1, 20));
jPanel4.add(cbtipoComprobante, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 20, 130, -1));
jLabel9.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel9.setForeground(new java.awt.Color(0, 51, 153));
jLabel9.setText("N° Comprobante");
jPanel4.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 20, 100, 20));
txmontoPago.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txmontoPagoKeyTyped(evt);
}
});
jPanel4.add(txmontoPago, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 80, 130, -1));
jPanel4.add(fcFechaUno, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 50, 130, -1));
lbNumDiasConsumo.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
lbNumDiasConsumo.setForeground(new java.awt.Color(0, 51, 153));
lbNumDiasConsumo.setText("Numero de Dias");
jPanel4.add(lbNumDiasConsumo, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 110, 130, 20));
jLabel15.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel15.setForeground(new java.awt.Color(0, 51, 153));
jLabel15.setText("Numero de Dias");
jPanel4.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(25, 110, 90, 20));
jButton1.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
jButton1.setForeground(new java.awt.Color(0, 51, 102));
jButton1.setText("Limpiar Cronograma");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel4.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 140, -1, -1));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane2.setViewportView(jTable1);
jPanel4.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 210, 470, 170));
chbDom.setText("Dom");
jPanel4.add(chbDom, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 180, -1, -1));
chbLun.setText("Lun");
jPanel4.add(chbLun, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 180, -1, -1));
chbMar.setText("Mar");
jPanel4.add(chbMar, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 180, -1, -1));
chbMier.setText("Mier");
jPanel4.add(chbMier, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 180, -1, -1));
chbJuev.setText("Juev");
jPanel4.add(chbJuev, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 180, -1, -1));
chbVier.setText("Vier");
jPanel4.add(chbVier, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 180, -1, -1));
chbSab.setText("Sab");
jPanel4.add(chbSab, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 180, -1, -1));
jButton2.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
jButton2.setForeground(new java.awt.Color(0, 51, 102));
jButton2.setText("Generar Cronograma");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel4.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 140, -1, -1));
jLabel13.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jLabel13.setForeground(new java.awt.Color(0, 51, 153));
jLabel13.setText("Tipo Comprobante");
jPanel4.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, -1, 20));
jPanel4.add(txNuncomprobante, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 20, 100, -1));
lbFechaInicio.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
lbFechaInicio.setForeground(new java.awt.Color(0, 51, 153));
lbFechaInicio.setText("Fecha Pago");
jPanel4.add(lbFechaInicio, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 50, -1, 20));
jPanel4.add(fcFechaDos, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 50, 100, -1));
jCheckBox1.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
jCheckBox1.setForeground(new java.awt.Color(0, 51, 153));
jCheckBox1.setText("Solo Almuerzo");
jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt);
}
});
jPanel4.add(jCheckBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 80, 210, -1));
getContentPane().add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(660, 200, 500, 390));
pack();
}// </editor-fold>//GEN-END:initComponents
private void bSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bSalirActionPerformed
dispose();
}//GEN-LAST:event_bSalirActionPerformed
private void bCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bCrearActionPerformed
CrearBanco();
}//GEN-LAST:event_bCrearActionPerformed
private void bCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bCancelarActionPerformed
Cancelar();
}//GEN-LAST:event_bCancelarActionPerformed
private void txBuscarKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txBuscarKeyReleased
BuscarBanco();
}//GEN-LAST:event_txBuscarKeyReleased
private void tBancosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tBancosMouseClicked
if(evt.getClickCount()==2){
if(tBancos.getSelectedRowCount()==1){
VerBanco();
}
}
}//GEN-LAST:event_tBancosMouseClicked
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
control.LimTabla(modelo1);
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
if(identificador==4){
// if(txmontoPago.getText().trim().length()>0 && lbComensal.getText().trim().length()>0){
generarCronograma();
// }else{
// JOptionPane.showMessageDialog(null,"Selecione un Comensal e Ingrese El monto del Pago");
// }
}else{
if(txmontoPago.getText().trim().length()>0 && lbComensal.getText().trim().length()>0){
generarCronograma();
}else{
JOptionPane.showMessageDialog(null,"Selecione un Comensal e Ingrese El monto del Pago");
}
}
}//GEN-LAST:event_jButton2ActionPerformed
private void txmontoPagoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txmontoPagoKeyTyped
control.Solonumeros(evt);
}//GEN-LAST:event_txmontoPagoKeyTyped
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
if(jCheckBox1.isSelected()){
soloal="1";
}else{
soloal="0";
}
}//GEN-LAST:event_jCheckBox1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bCancelar;
private javax.swing.JButton bCrear;
private javax.swing.JButton bSalir;
private javax.swing.JComboBox cbTipoComensal;
private javax.swing.JComboBox cbtipoComprobante;
private javax.swing.JCheckBox chbDom;
private javax.swing.JCheckBox chbJuev;
private javax.swing.JCheckBox chbLun;
private javax.swing.JCheckBox chbMar;
private javax.swing.JCheckBox chbMier;
private javax.swing.JCheckBox chbSab;
private javax.swing.JCheckBox chbVier;
private com.toedter.calendar.JDateChooser fcFechaDos;
private com.toedter.calendar.JDateChooser fcFechaUno;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTable jTable1;
private javax.swing.JLabel lbComensal;
private javax.swing.JLabel lbDni;
private javax.swing.JLabel lbEstado;
private javax.swing.JLabel lbFechaFinal;
private javax.swing.JLabel lbFechaInicio;
private javax.swing.JLabel lbNumDiasConsumo;
private javax.swing.JLabel lbTarifa;
private javax.swing.JTable tBancos;
private javax.swing.JTextField txBuscar;
private javax.swing.JTextField txNuncomprobante;
private javax.swing.JTextField txmontoPago;
// End of variables declaration//GEN-END:variables
private void generarCronograma(){
if(identificador==4){
boolean flag=true;
String fe="";
String fecini=control.Formato_Amd(fcFechaUno.getDate());
String fecfin=control.Formato_Amd(fcFechaDos.getDate());
//int diastotal=Integer.parseInt(control.DevolverRegistroDto("select datediff( '"+fecfin+"','"+ fecini+"');",1));
//lbNumDiasConsumo.setText(""+(diastotal+1));
int contador=0,aunemt=0;
String [] datos= new String[3];
while(flag){
control.Sql="select dayname(adddate('"+fecini+"', interval "+aunemt+" day)),adddate('"+fecini+"', interval "+aunemt+" day);";
if(verdia(control.DevolverRegistroDto(control.Sql, 1))){
System.out.println(control.DevolverRegistroDto(control.Sql, 2));
System.out.println(control.DevolverRegistroDto(control.Sql, 1));
datos[1]=diasespañol(control.DevolverRegistroDto(control.Sql, 1));
datos[2]=control.DevolverRegistroDto(control.Sql, 2);
fe=control.DevolverRegistroDto(control.Sql, 2);
contador++;
datos[0]=""+contador;
modelo1.addRow(datos);
}
aunemt++;
control.Sql="select datediff('"+fecfin+"','"+fe+"');";
int ver=Integer.parseInt(control.DevolverRegistroDto(control.Sql, 1));
if(ver==0){
lbNumDiasConsumo.setText(""+contador);
flag=false;
}
}
}else{
double pago=Double.parseDouble(txmontoPago.getText());
if(pago%tarifa!=0){
JOptionPane.showMessageDialog(null, "Ingrese una Cantidad Multiple de Su Tarifa!!!");
txmontoPago.requestFocus();
return;
}
control.LimTabla(modelo1);
String fecini=control.Formato_Amd(fcFechaDos.getDate());
String diain=control.DevolverRegistroDto("select dayname('"+fecini+"')",1);
lbNumDiasConsumo.setText(String.valueOf((int)(pago/tarifa)));
int diastotal=(int)(pago/tarifa);
int contador=0,aunemt=0;
String [] datos= new String[3];
while(contador<diastotal){
control.Sql="select dayname(adddate('"+fecini+"', interval "+aunemt+" day)),adddate('"+fecini+"', interval "+aunemt+" day);";
if(verdia(control.DevolverRegistroDto(control.Sql, 1))){
System.out.println(control.DevolverRegistroDto(control.Sql, 2));
System.out.println(control.DevolverRegistroDto(control.Sql, 1));
datos[1]=diasespañol(control.DevolverRegistroDto(control.Sql, 1));
datos[2]=control.DevolverRegistroDto(control.Sql, 2);
contador++;
datos[0]=""+contador;
modelo1.addRow(datos);
}
aunemt++;
}
}
}
private boolean verdia(String dia){
boolean d=true;
switch(dia){
case "Monday":
if(chbLun.isSelected()){d=true;}else{d=false;}
break;
case "Tuesday":
if(chbMar.isSelected()){d=true;}else{d=false;}
break;
case "Wednesday":
if(chbMier.isSelected()){d=true;}else{d=false;}
break;
case "Thursday":
if(chbJuev.isSelected()){d=true;}else{d=false;}
break;
case "Friday":
if(chbVier.isSelected()){d=true;}else{d=false;}
break;
case "Saturday":
if(chbSab.isSelected()){d=true;}else{d=false;}
break;
case "Sunday":
if(chbDom.isSelected()){d=true;}else{d=false;}
break;
}
return d;
}
private String diasespañol(String dia){
String d="";
switch(dia){
case "Monday":
d="Lunes";
break;
case "Tuesday":
d="Martes";
break;
case "Wednesday":
d="Miercoles";
break;
case "Thursday":
d="Jueves";
break;
case "Friday":
d="Viernes";
break;
case "Saturday":
d="Sabado";
break;
case "Sunday":
d="Domingo";
break;
}
return d;
}
}
| [
"aomc@outlook.es"
] | aomc@outlook.es |
d6db5157caa9ab60d6bdd6752b2b751967039190 | 9579689e589789208537f5a74d7ba8dfa812b3ac | /src/main/java/client/UNSPSCClient.java | c293edfbcfeb1a80a9b7aa788ab2aef942d9f7e4 | [] | no_license | pauriarte/JavaWS | 9149e2721afd3df7a5988e6585e2b1b4a4cf6643 | c60ebc0079495ad7a0c6d8eb69fc3b87dcaa342e | refs/heads/master | 2020-12-30T16:27:16.076386 | 2017-05-11T13:20:57 | 2017-05-11T13:20:57 | 90,981,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | package client;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import org.springframework.ws.soap.client.core.SoapActionCallback;
import client.wsdl.GetUNSPSCSegments;
import client.wsdl.GetUNSPSCSegmentsResponse;
public class UNSPSCClient extends WebServiceGatewaySupport {
public GetUNSPSCSegmentsResponse getGetUNSPSCSegments(){
GetUNSPSCSegments request = new GetUNSPSCSegments();
GetUNSPSCSegmentsResponse response = (GetUNSPSCSegmentsResponse) getWebServiceTemplate()
.marshalSendAndReceive("http://www.webservicex.net/GenericUNSPSC.asmx",
request,
new SoapActionCallback("http://www.webservicex.net/GetUNSPSCSegments"));
return response;
}
}
| [
"pauriarte@gmail.com"
] | pauriarte@gmail.com |
49d5c14f7ed7333e4d1ca83c4a9d6f02d1a7dca5 | 18b4c0cc1cc0a890b59f3e786510d55544e8d809 | /WebProject/no220/src/main/java/LogoutServlet.java | 13f5648aec1f4b661856eea089ff92692af48d5e | [] | no_license | systemi-yokohama/Systemi_Training_2020 | ee1bcdd9547cd1f1f68e2f3229e4d1210d097060 | 3710a3b9db22c191c129dd24c8ef23b091108f12 | refs/heads/master | 2022-07-14T13:57:50.184173 | 2020-07-11T23:15:56 | 2020-07-11T23:15:56 | 252,630,204 | 2 | 34 | null | 2022-06-21T03:37:41 | 2020-04-03T04:13:40 | Java | UTF-8 | Java | false | false | 738 | java |
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@WebServlet(urlPatterns = { "/logout" })
public class LogoutServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
session.invalidate(); // セッションの無効化
response.sendRedirect("./");
}
} | [
"h-kogushi@systemi.co.jp"
] | h-kogushi@systemi.co.jp |
ed223811c93fa8f1be30de000ed8d0836cacd51f | e09746d602a38cce8cea977a67eab8f66d4466ca | /src/main/java/com/fh/util/ObjectExcelRead.java | 50426ce8de9e67bcf794cda07227b270d9c77d0c | [] | no_license | wzx010901/myProject | 6fae5773364cc0ca11a1b9dd99f8020611b18e2d | 6926adff9fcb21cb0a9fb0c324637dce3e224d97 | refs/heads/master | 2020-09-17T23:41:50.828026 | 2017-03-30T09:02:21 | 2017-03-30T09:02:21 | 67,968,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,317 | java | package com.fh.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellValue;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
/**
* 从EXCEL导入到数据库 创建人:WZX Q149156999 创建时间:2014年12月23日
*
* @version
*/
public class ObjectExcelRead {
/**
* @param filepath
* //文件路径
* @param filename
* //文件名
* @param startrow
* //开始行号
* @param startcol
* //开始列号
* @param sheetnum
* //sheet
* @return list
*/
@SuppressWarnings({ "deprecation" })
public static List<PageData> readExcel(String filepath, String filename, int startrow, int startcol, int sheetnum) {
List<PageData> varList = new ArrayList<PageData>();
InputStream inp = null;
Workbook workbook = null;
try {
File target = new File(filepath, filename);
inp = new FileInputStream(target);
workbook = WorkbookFactory.create(inp);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
Sheet sheet = workbook.getSheetAt(sheetnum);
PageData varpd = new PageData();
System.out.println("----------" + sheet.getSheetName() + "----------");
int rowNum = sheet.getLastRowNum() + 1;
for (int i = startrow; i < rowNum; i++) {// 行循环开始
Row row = sheet.getRow(i);
int cellNum = row.getLastCellNum() + 1;
for (int j = startcol; j < cellNum; j++) {// 列循环开始
Cell cell = row.getCell(j);
String cellValue = null;
if (null != cell) {
switch (cell.getCellTypeEnum()) {
case _NONE: // 为空
cellValue = "";
break;
case NUMERIC: // 数字
cellValue = String.valueOf((int) cell.getNumericCellValue());
break;
case STRING: // 字符串
cellValue = cell.getStringCellValue();
break;
case BOOLEAN: // Boolean
cellValue = String.valueOf(cell.getBooleanCellValue());
break;
case FORMULA: // 公式
// cellValue = cell.getNumericCellValue() + "";
// 会打印出原本单元格的公式
// System.out.print(cell.getCellFormula() +
// "\t");
// NumberFormat nf = new DecimalFormat("#.#");
// String value =
// nf.format(cell.getNumericCellValue());
CellValue cellValue1 = evaluator.evaluate(cell);
switch (cellValue1.getCellTypeEnum()) {
case _NONE:
// System.out.print("_NONE" + "\t");
cellValue = "";
break;
case BLANK:
cellValue = "";
break;
case BOOLEAN:
cellValue = String.valueOf(cell.getBooleanCellValue());
break;
case ERROR:
cellValue = String.valueOf(cell.getErrorCellValue());
break;
case NUMERIC:
cellValue = String.valueOf((int) cell.getNumericCellValue());
break;
case STRING:
cellValue = cell.getStringCellValue();
// System.out.print(cell.getRichStringCellValue()
// + "\t");
break;
default:
// System.out.print("default" + "\t");
break;
}
break;
case BLANK: // 空值
cellValue = "";
break;
case ERROR: // 故障
// cellValue = "非法字符";
cellValue = String.valueOf(cell.getErrorCellValue());
break;
default:
cellValue = "";
// System.out.print("default未知类型" + "\t");
break;
}
} else {
cellValue = "";
// System.out.print("空值未知类型" + "\t");
}
varpd.put("var" + j, cellValue);
}
varList.add(varpd);
}
} catch (Exception e) {
System.out.println(e);
}
return varList;
}
public static void main(String[] args) {
readExcel("E:/Program Files (x86)/Tencent/Tencent Files/149156999/FileRecv/", "t_commodity.xls", 0, 0, 0);
}
}
| [
"wzx010901@163.com"
] | wzx010901@163.com |
c30438f14b127b70d09f5ae361469be5cf0ff3cb | 30e1eef1c5038f4a6889d0c2e65c2c9b35e6864c | /warehouse/query-core/src/test/java/datawave/query/function/AncestorRangeProviderTest.java | b0bd45ddc7e6aca7a0282a79668a1a338f636a97 | [
"Apache-2.0"
] | permissive | NationalSecurityAgency/datawave | 9ffbbd5582943cd26a585b67e2a9be11f6f777f5 | 736bca2589cde8e87d99da0af17db0f2afcdecda | refs/heads/integration | 2023-08-19T00:30:07.639228 | 2023-08-18T11:48:38 | 2023-08-18T11:48:38 | 116,999,027 | 533 | 263 | Apache-2.0 | 2023-09-14T17:13:30 | 2018-01-10T19:05:58 | Java | UTF-8 | Java | false | false | 4,285 | java | package datawave.query.function;
import static org.junit.Assert.assertEquals;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.junit.Test;
public class AncestorRangeProviderTest {
private final Key docKey = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok");
private final Key docKeyField = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok", "FIELD");
private final Key docKeyFieldValue = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok", "FIELD\0value");
private final Key childDocKey = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12");
private final Key childDocKeyField = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12", "FIELD");
private final Key childDocKeyFieldValue = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12", "FIELD\0value");
private final Key grandchildDocKey = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12.34");
private final Key grandchildDocKeyField = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12.34", "FIELD");
private final Key grandchildDocKeyFieldValue = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12.34", "FIELD\0value");
private final RangeProvider rangeProvider = new AncestorRangeProvider();
@Test
public void testGetStartKey() {
assertEquals(docKey, rangeProvider.getStartKey(docKey));
assertEquals(docKey, rangeProvider.getStartKey(docKeyField));
assertEquals(docKey, rangeProvider.getStartKey(docKeyFieldValue));
assertEquals(docKey, rangeProvider.getStartKey(childDocKey));
assertEquals(docKey, rangeProvider.getStartKey(childDocKeyField));
assertEquals(docKey, rangeProvider.getStartKey(childDocKeyFieldValue));
assertEquals(docKey, rangeProvider.getStartKey(grandchildDocKey));
assertEquals(docKey, rangeProvider.getStartKey(grandchildDocKeyField));
assertEquals(docKey, rangeProvider.getStartKey(grandchildDocKeyFieldValue));
}
@Test
public void testGetStopKey() {
Key expectedStopKey = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok\0");
assertEquals(expectedStopKey, rangeProvider.getStopKey(docKey));
assertEquals(expectedStopKey, rangeProvider.getStopKey(docKeyField));
assertEquals(expectedStopKey, rangeProvider.getStopKey(docKeyFieldValue));
expectedStopKey = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12\0");
assertEquals(expectedStopKey, rangeProvider.getStopKey(childDocKey));
assertEquals(expectedStopKey, rangeProvider.getStopKey(childDocKeyField));
assertEquals(expectedStopKey, rangeProvider.getStopKey(childDocKeyFieldValue));
expectedStopKey = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12.34\0");
assertEquals(expectedStopKey, rangeProvider.getStopKey(grandchildDocKey));
assertEquals(expectedStopKey, rangeProvider.getStopKey(grandchildDocKeyField));
assertEquals(expectedStopKey, rangeProvider.getStopKey(grandchildDocKeyFieldValue));
}
@Test
public void testGetScanRange() {
Key start = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok");
Key end = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok\0");
Range expectedRange = new Range(start, true, end, false);
assertEquals(expectedRange, rangeProvider.getRange(docKey));
assertEquals(expectedRange, rangeProvider.getRange(docKeyField));
assertEquals(expectedRange, rangeProvider.getRange(docKeyFieldValue));
end = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12\0");
expectedRange = new Range(start, true, end, false);
assertEquals(expectedRange, rangeProvider.getRange(childDocKey));
assertEquals(expectedRange, rangeProvider.getRange(childDocKeyField));
assertEquals(expectedRange, rangeProvider.getRange(childDocKeyFieldValue));
end = new Key("row", "datatype\0d8zay2.-3pnndm.-anolok.12.34\0");
expectedRange = new Range(start, true, end, false);
assertEquals(expectedRange, rangeProvider.getRange(grandchildDocKey));
assertEquals(expectedRange, rangeProvider.getRange(grandchildDocKeyField));
assertEquals(expectedRange, rangeProvider.getRange(grandchildDocKeyFieldValue));
}
}
| [
"noreply@github.com"
] | NationalSecurityAgency.noreply@github.com |
9798fd5657d640559fb1aa221e6ad6f4639b3f1d | a8811d7b78ec5f9adc703407a1f1aeb1735e7892 | /BullsAndCows/src/main/java/ajplarson/bullsandcows/models/GuessResult.java | aa612deb6504ad6b7a5c0cd74d2a742d570b56d9 | [] | no_license | ajplarson/SWGProjects | edb3198e3249ebea77ebaa7959539d9c6e2c0828 | ac06b56c6f31e0a6e491fdd0f5e7ad179e18f887 | refs/heads/master | 2022-06-22T05:26:32.264484 | 2021-09-07T19:03:25 | 2021-09-07T19:03:25 | 190,452,259 | 0 | 0 | null | 2021-01-29T19:17:46 | 2019-06-05T19:00:16 | Java | UTF-8 | Java | false | false | 698 | java | package ajplarson.bullsandcows.models;
/**
* @author ajplarson
*/
public class GuessResult {
private GuessStatus status = GuessStatus.NotFound;
private int partialGuess;
private int exactGuess;
public int getPartialGuess() {
return partialGuess;
}
public void setPartialGuess(int partialGuess) {
this.partialGuess = partialGuess;
}
public int getExactGuess() {
return exactGuess;
}
public void setExactGuess(int exactGuess) {
this.exactGuess = exactGuess;
}
public GuessStatus getStatus() {
return status;
}
public void setStatus(GuessStatus status) {
this.status = status;
}
}
| [
"andrewjplarson@gmail.com"
] | andrewjplarson@gmail.com |
39359577a62a7006cd110c1dfb83354087af8ab0 | ef7178759e59fd2480cbb58cc348264bafd7308e | /gen/net/masterthought/dlanguage/psi/impl/DLanguageStatementImpl.java | a08dd08c1424bed3c258607b0f38219c4c44de89 | [] | no_license | TrollBoxs/DLanguage | 2588b1c2506332430874c5c376780a4761a8fe72 | 61c923a4528fe8b9f41c90750c079b539c9deae0 | refs/heads/master | 2021-06-12T23:06:58.575167 | 2016-12-17T16:23:46 | 2016-12-17T16:23:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 1,245 | java | // This is a generated file. Not intended for manual editing.
package net.masterthought.dlanguage.psi.impl;
import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import static net.masterthought.dlanguage.psi.DLanguageTypes.*;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import net.masterthought.dlanguage.psi.*;
public class DLanguageStatementImpl extends ASTWrapperPsiElement implements DLanguageStatement {
public DLanguageStatementImpl(ASTNode node) {
super(node);
}
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof DLanguageVisitor) ((DLanguageVisitor)visitor).visitStatement(this);
else super.accept(visitor);
}
@Override
@Nullable
public DLanguageBlockStatement getBlockStatement() {
return findChildByClass(DLanguageBlockStatement.class);
}
@Override
@Nullable
public DLanguageNonEmptyStatement getNonEmptyStatement() {
return findChildByClass(DLanguageNonEmptyStatement.class);
}
@Override
@Nullable
public PsiElement getOpScolon() {
return findChildByType(OP_SCOLON);
}
}
| [
"kingsleyhendrickse@me.com"
] | kingsleyhendrickse@me.com |
486b41af35bde99c27a46405bb2267ce7e6dfb07 | aa893cbdbaf95e5c2744cae5330d4e99e6810cc7 | /ppmtool/src/main/java/com/yash/ppmtool/services/ProjectService.java | 95e6449abfd6093fbd70a36d45fc97f00bddbb90 | [] | no_license | AnveshV98/MyPPM | 595bcb86fe6e63bffc1b471f02f538ddba7cafc8 | cca4dea59055a3ba03ac78dc7b85b1a7800be26f | refs/heads/master | 2023-08-27T11:08:07.536334 | 2021-10-26T11:02:05 | 2021-10-26T11:02:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 450 | java | package com.yash.ppmtool.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yash.ppmtool.domain.Project;
import com.yash.ppmtool.repositories.ProjectRepository;
@Service
public class ProjectService {
@Autowired
private ProjectRepository projectRepository;
public Project saveOrUpdateProject(Project project) {
return projectRepository.save(project);
}
}
| [
"anvesh.veldhandi@yash.com"
] | anvesh.veldhandi@yash.com |
0be452762e191ea22371c085d10eec2a60a4b5f9 | eb5af3e0f13a059749b179c988c4c2f5815feb0f | /eclipsecode/myShopping/src/com/wxws/sms/management/Verify.java | dedceb2331f62612579c975400eb849308482b32 | [] | no_license | xiakai007/wokniuxcode | ae686753da5ec3dd607b0246ec45fb11cf6b8968 | d9918fb349bc982f0ee9d3ea3bf7537e11d062a2 | refs/heads/master | 2023-04-13T02:54:15.675440 | 2021-05-02T05:09:47 | 2021-05-02T05:09:47 | 363,570,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package com.wxws.sms.management;
import java.util.Scanner;
public class Verify {
public boolean verif(String userName,String passWord) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入用户名:");
String name = sc.next();
System.out.println("请输入密码:");
String pwd = sc.next();
if(name.equals(userName)&&pwd.equals(passWord)) {
return true;
}else {
return false;
}
}
}
| [
"980385778@qq.com"
] | 980385778@qq.com |
11914429583438b18c377e29d4350acd1ac8854c | 08c501d725edc01ae2e22f8e3c9b4f341b7641f9 | /week-03/day-02-Arrays_and_functions/12-Arrays-PrintAll (Print elements).java | e556c738dab670329ef8a07fb34b87d22ca8e64b | [] | no_license | green-fox-academy/sskreber | 26dd3727d0f57ea1c623dacd08623770fca0464b | a860e4d5dfcf4ae351516463428ac5d3427df2bf | refs/heads/master | 2020-03-09T03:43:39.014306 | 2018-08-23T18:36:41 | 2018-08-23T18:36:41 | 128,571,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | // - Create an array variable named `af`
// with the following content: `[4, 5, 6, 7]`
// - Print all the elements of `af`
// SOLUTION 1: output is: "4" "5" "6" "7"
public class PrintAll {
public static void main(String... args) {
int[] af = new int[]{4, 5, 6, 7};
for (int i = 0; i < af.length; i++) {
System.out.print("\"" + af[i] + "\" ");
}
}
}
// SOLUTION 2: prints the elements under each other
public class PrintAll {
public static void main(String... args) {
int[] af = new int[]{4, 5, 6, 7};
for (int i = 0; i < af.length; i++) {
System.out.println(af[i]);
}
}
} | [
"zsu.karap@gmail.com"
] | zsu.karap@gmail.com |
495b4f639cada4b273410656eace81a7aeb8bd48 | 4145b809fe85b2a7f3b29688f4af53751d289243 | /src/main/java/krati/store/StoreWriter.java | d6d70151bafed762e392809b6f643cea8c1f0847 | [
"Apache-2.0"
] | permissive | scottcarey/krati | a3b8891ae88a15f1d2ecf9b4e3c70268bc781f65 | a3d5e4518cb1eaa5f8806a7935bf0aec9c0870ae | refs/heads/master | 2020-12-24T13:43:54.597059 | 2011-10-19T05:51:17 | 2011-10-19T05:51:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 973 | java | package krati.store;
/**
* StoreWriter
*
* @author jwu
* @since 09/15, 2011
*/
public interface StoreWriter<K, V> {
/**
* Maps the specified <code>key</code> to the specified <code>value</code> in this store.
*
* @param key - the key
* @param value - the value
* @return <code>true</code> if this store is changed as a result of this operation.
* Otherwise, <cod>false</code>.
* @throws Exception if this operation cannot be completed for any reasons.
*/
public boolean put(K key, V value) throws Exception;
/**
* Removes the specified <code>key</code> from this store.
*
* @param key - the key
* @return <code>true</code> if this store is changed as a result of this operation.
* Otherwise, <cod>false</code>.
* @throws Exception if this operation cannot be completed for any reasons.
*/
public boolean delete(K key) throws Exception;
}
| [
"jwu@jwu-ld.linkedin.biz"
] | jwu@jwu-ld.linkedin.biz |
1b6072dab7dd5f7dc4ac570029d79222b3791984 | 3d84e2d9dff8d94143753ded67fc8cdd3e1559ea | /src/main/java/convex_layers/data/Base2DTree.java | 6ffbac12e1b6648f6dc46626a38253dc2762e78a | [] | no_license | Kaj0Wortel/2IMA15_geo_alg | 06aa89ab7c103e364acca699fc08090441e16b24 | 58dcace0908e29cb3471b9ba662287ef92b40e2b | refs/heads/master | 2023-08-21T20:31:36.401271 | 2023-08-15T18:27:53 | 2023-08-15T18:27:53 | 221,718,666 | 0 | 0 | null | 2023-08-15T18:27:54 | 2019-11-14T14:39:31 | Java | UTF-8 | Java | false | false | 1,902 | java | package convex_layers.data;
import java.util.Collection;
/**
* Abstract base class for the search trees.
*
* @param <T> The type of the elements.
*/
public interface Base2DTree<T extends Node2D<T>>
extends Collection<T> {
/* ----------------------------------------------------------------------
* Functions.
* ----------------------------------------------------------------------
*/
@Override
default boolean isEmpty() {
return size() == 0;
}
@Override
default Object[] toArray() {
return toArray(new Node2D[size()]);
}
@Override
@SuppressWarnings("unchecked")
default <T1> T1[] toArray(T1[] arr) {
int i = 0;
for (T data : this) {
arr[i++] = (T1) data;
}
return arr;
}
@Override
default boolean containsAll(Collection<?> col) {
for (Object obj : col) {
if (!contains(obj)) return false;
}
return true;
}
@Override
default boolean addAll(Collection<? extends T> col) {
boolean mod = false;
for (T data : col) {
if (add(data)) mod = true;
}
return mod;
}
@Override
default boolean removeAll(Collection<?> col) {
boolean mod = false;
for (Object obj : col) {
if (remove(obj)) mod = true;
}
return mod;
}
@Override
default boolean retainAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
/**
* Used to initialize the search structure.
*
* @param col The collection containing the elements.
*/
void init(Collection<T> col);
/**
* @param obj The search key.
*
* @return The value in the tree which corresponds with the given key.
*/
T get(Object obj);
}
| [
"kaj.wortel@gmail.com"
] | kaj.wortel@gmail.com |
d22a34245aac39663352cc962f32588e6eceb923 | 317138d37430f9f52d740b823ba81162886cd8d9 | /opacitor/test_external_dir/src/test/IterativeBubbleSort.java | 114754f2f25c21df1fd52170e651cce37c91d2a6 | [] | no_license | AnnieFraz/GIN | dffb35140a7080d6a9b814f986225dda1240f1ec | e3dfe1e87cea21b4897399fb5e64a48ba9d67e1a | refs/heads/master | 2021-10-26T00:15:41.820527 | 2019-02-27T12:23:43 | 2019-02-27T12:23:43 | 150,884,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 629 | java | package test;
import java.util.Arrays;
public class IterativeBubbleSort {
static void bubbleSort(int array[], int n){
if (n==1){
return;
}
for (int i=0; i < n; i++){
if (array[i] > array[i+1]){
int temp = array[i];
array[i] = array[i=1];
array[i+1] = temp;
}
}
}
public static void main(String[] args) {
int array[] = {7, 69, 76, 102, 94, 53, 62 , 101};
bubbleSort(array, array.length);
System.out.println("Recursive - Sorted array: " + Arrays.toString(array));
}
}
| [
"annarasburn97@gmail.com"
] | annarasburn97@gmail.com |
d20ff44499e472574c1181203a4b539b02861683 | c5a0a18fbdb55dea39aea11d61c506a20c5e98ff | /src/java/com/sforce/soap/partner/DebuggingInfo.java | e34ef0599175e2f5b3ff0cb15fcf681c0177e8eb | [] | no_license | sypticus/grails-force-plugin | d861141aeae807bde00e6a1fa72c559b82dd2def | 58e3ea2fed2586f3f4618eb58048736c1ac289c8 | refs/heads/master | 2020-12-29T02:54:26.223620 | 2009-12-18T17:28:39 | 2009-12-18T17:28:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,980 | java |
/**
* DebuggingInfo.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.5 Built on : Apr 30, 2009 (06:07:47 EDT)
*/
package com.sforce.soap.partner;
/**
* DebuggingInfo bean class
*/
public class DebuggingInfo
implements org.apache.axis2.databinding.ADBBean{
public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"urn:partner.soap.sforce.com",
"DebuggingInfo",
"ns1");
private static java.lang.String generatePrefix(java.lang.String namespace) {
if(namespace.equals("urn:partner.soap.sforce.com")){
return "ns1";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* field for DebugLog
*/
protected java.lang.String localDebugLog ;
/**
* Auto generated getter method
* @return java.lang.String
*/
public java.lang.String getDebugLog(){
return localDebugLog;
}
/**
* Auto generated setter method
* @param param DebugLog
*/
public void setDebugLog(java.lang.String param){
this.localDebugLog=param;
}
/**
* isReaderMTOMAware
* @return true if the reader supports MTOM
*/
public static boolean isReaderMTOMAware(javax.xml.stream.XMLStreamReader reader) {
boolean isReaderMTOMAware = false;
try{
isReaderMTOMAware = java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE));
}catch(java.lang.IllegalArgumentException e){
isReaderMTOMAware = false;
}
return isReaderMTOMAware;
}
/**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement (
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{
org.apache.axiom.om.OMDataSource dataSource =
new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME){
public void serialize(org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
DebuggingInfo.this.serialize(MY_QNAME,factory,xmlWriter);
}
};
return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl(
MY_QNAME,factory,dataSource);
}
public void serialize(final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory,
org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
serialize(parentQName,factory,xmlWriter,false);
}
public void serialize(final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory,
org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter,
boolean serializeType)
throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{
java.lang.String prefix = null;
java.lang.String namespace = null;
prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
if ((namespace != null) && (namespace.trim().length() > 0)) {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, parentQName.getLocalPart());
} else {
if (prefix == null) {
prefix = generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
} else {
xmlWriter.writeStartElement(parentQName.getLocalPart());
}
if (serializeType){
java.lang.String namespacePrefix = registerPrefix(xmlWriter,"urn:partner.soap.sforce.com");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
namespacePrefix+":DebuggingInfo",
xmlWriter);
} else {
writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type",
"DebuggingInfo",
xmlWriter);
}
}
namespace = "urn:partner.soap.sforce.com";
if (! namespace.equals("")) {
prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
xmlWriter.writeStartElement(prefix,"debugLog", namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
} else {
xmlWriter.writeStartElement(namespace,"debugLog");
}
} else {
xmlWriter.writeStartElement("debugLog");
}
if (localDebugLog==null){
// write the nil attribute
throw new org.apache.axis2.databinding.ADBException("debugLog cannot be null!!");
}else{
xmlWriter.writeCharacters(localDebugLog);
}
xmlWriter.writeEndElement();
xmlWriter.writeEndElement();
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace,attName,attValue);
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,java.lang.String attName,
java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{
if (namespace.equals(""))
{
xmlWriter.writeAttribute(attName,attValue);
}
else
{
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName,
javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/
private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}
if (prefix.trim().length() > 0){
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null;
for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}
if (prefix.trim().length() > 0){
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException{
java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList();
elementList.add(new javax.xml.namespace.QName("urn:partner.soap.sforce.com",
"debugLog"));
if (localDebugLog != null){
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDebugLog));
} else {
throw new org.apache.axis2.databinding.ADBException("debugLog cannot be null!!");
}
return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
}
/**
* Factory class that keeps the parse method
*/
public static class Factory{
/**
* static method to create the object
* Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable
* If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
* Postcondition: If this object is an element, the reader is positioned at its end element
* If this object is a complex type, the reader is positioned at the end element of its outer element
*/
public static DebuggingInfo parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
DebuggingInfo object =
new DebuggingInfo();
int event;
java.lang.String nillableValue = null;
java.lang.String prefix ="";
java.lang.String namespaceuri ="";
try {
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName!=null){
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1){
nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix==null?"":nsPrefix;
java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);
if (!"DebuggingInfo".equals(type)){
//find namespace for the prefix
java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (DebuggingInfo)com.sforce.soap.partner.sobject.ExtensionMapper.getTypeObject(
nsUri,type,reader);
}
}
}
// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector();
reader.next();
while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
if (reader.isStartElement() && new javax.xml.namespace.QName("urn:partner.soap.sforce.com","debugLog").equals(reader.getName())){
java.lang.String content = reader.getElementText();
object.setDebugLog(
org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));
reader.next();
} // End of if for expected property start element
else{
// A start element we are not expecting indicates an invalid parameter was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
}
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isStartElement())
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}//end of factory class
}
| [
"carlos.munoz@riptidesoftware.com"
] | carlos.munoz@riptidesoftware.com |
b74f00aa83bc3353f4dca098fb0858936a65d104 | 6fc1240c9ae2a7b3d8eead384668e1f4b58d47da | /assignments/mosquerak/unit3/HW15-DataBase/Tourist Guest/src/tourist/guest/TouristGuest.java | f405ad4f760ef3ada6f53fc779ebdf4d8acd110c | [] | no_license | elascano/ESPE202105-OOP-TC-3730 | 38028e870d4de004cbbdf82fc5f8578126f8ca32 | 4275a03d410cf6f1929b1794301823e990fa0ef4 | refs/heads/main | 2023-08-09T13:24:26.898865 | 2021-09-13T17:08:10 | 2021-09-13T17:08:10 | 371,089,640 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 454 | 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 tourist.guest;
/**
*
* @author Kerly Mosquera CODE ESPE-DCCO
*/
public class TouristGuest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
| [
"kemosquera1@espe.edu.ec"
] | kemosquera1@espe.edu.ec |
dbdc7e961b261dfb2dcc8bcf7f7a270cbce55a78 | b9bc72fbf97c8cf3d555546a87e8f63d4caf1fc9 | /lucene/src/java/org/apache/lucene/index/NoMergeScheduler.java | 158abe842ce4aede8e11943a911e862d333d7d5e | [
"MIT",
"Apache-2.0",
"ICU",
"LicenseRef-scancode-unicode",
"BSD-3-Clause",
"LicenseRef-scancode-unicode-mappings",
"Python-2.0"
] | permissive | simplegeo/lucene-solr | f0f1779eb2ad980a12a4b8c2ef226dc52ea1d85d | d9f360a7910a335fb49b320e78ed739d86aa4afc | refs/heads/master | 2021-01-18T04:32:17.237625 | 2011-12-16T00:32:48 | 2011-12-16T00:32:48 | 928,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,865 | java | package org.apache.lucene.index;
/**
* 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.
*/
import java.io.IOException;
/**
* A {@link MergeScheduler} which never executes any merges. It is also a
* singleton and can be accessed through {@link NoMergeScheduler#INSTANCE}. Use
* it if you want to prevent an {@link IndexWriter} from ever executing merges,
* irregardles of the {@link MergePolicy} used. Note that you can achieve the
* same thing by using {@link NoMergePolicy}, however with
* {@link NoMergeScheduler} you also ensure that no unnecessary code of any
* {@link MergeScheduler} implementation is ever executed. Hence it is
* recommended to use both if you want to disable merges from ever happening.
*/
public final class NoMergeScheduler extends MergeScheduler {
/** The single instance of {@link NoMergeScheduler} */
public static final MergeScheduler INSTANCE = new NoMergeScheduler();
private NoMergeScheduler() {
// prevent instantiation
}
@Override
public void close() {}
@Override
public void merge(IndexWriter writer) throws CorruptIndexException, IOException {}
}
| [
"mikemccand@apache.org"
] | mikemccand@apache.org |
6c0735476fecc5f2467191e337a70a5914994498 | 5246feaeda9771220f035bf34b26d65ad1d21df6 | /mongodb-springdata-v2-driver/src/main/java/com/github/cloudyrock/mongock/driver/mongodb/springdata/v2/decorator/operation/executable/find/TerminatingFindDecorator.java | f5a8014b6fb4f535b2eeedc147fa4fb4d7bd1be9 | [
"Apache-2.0"
] | permissive | oliverlockwood/mongock | dd47ade9f3c1d6606811ee1ab97211f1e839f32b | 5caaf20b0976f6a976c231b065fe5137d1841902 | refs/heads/master | 2023-05-14T18:31:44.886241 | 2021-04-28T17:11:13 | 2021-04-28T17:11:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,350 | java | package com.github.cloudyrock.mongock.driver.mongodb.springdata.v2.decorator.operation.executable.find;
import com.github.cloudyrock.mongock.driver.api.lock.guard.invoker.LockGuardInvoker;
import org.springframework.data.mongodb.core.ExecutableFindOperation;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
public interface TerminatingFindDecorator<T> extends ExecutableFindOperation.TerminatingFind<T> {
ExecutableFindOperation.TerminatingFind<T> getImpl();
LockGuardInvoker getInvoker();
@Override
default Optional<T> one() {
return getInvoker().invoke(()-> getImpl().one());
}
@Override
default T oneValue() {
return getInvoker().invoke(()-> getImpl().oneValue());
}
@Override
default Optional<T> first() {
return getInvoker().invoke(()-> getImpl().first());
}
@Override
default T firstValue() {
return getInvoker().invoke(()-> getImpl().firstValue());
}
@Override
default List<T> all() {
return getInvoker().invoke(()-> getImpl().all());
}
@Override
default Stream<T> stream() {
return getInvoker().invoke(()-> getImpl().stream());
}
@Override
default long count() {
return getInvoker().invoke(()-> getImpl().count());
}
@Override
default boolean exists() {
return getInvoker().invoke(()-> getImpl().exists());
}
}
| [
"noreply@github.com"
] | oliverlockwood.noreply@github.com |
18fddc8e99c7644f8d540a37eaaa132ba63ecfb8 | 53a1c5f9b9c7d8ec742dfc9720e5fca0b3cd9202 | /src/com/android/phone/VTCallForwardOptions.java | 25862b7780834bdc71e29be2f05ffb501841f89a | [] | no_license | BORQS-Software/Phone | 174f8e1d94a256b4c071fda2e8d98a19501ba538 | 242c14cac36cb2302de591b2ecc502cbf5847aaf | refs/heads/master | 2021-01-23T03:21:21.410317 | 2012-10-19T07:53:27 | 2012-10-19T07:53:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,697 | java | /* ------------------------------------------------------------------
* Copyright (C) 2012 BORQS Software Solutions Pvt Ltd.
*
* 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.android.phone;
import com.android.internal.telephony.CallForwardInfo;
import com.android.internal.telephony.CommandsInterface;
import android.app.ActionBar;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.util.Log;
import android.view.MenuItem;
import java.util.ArrayList;
public class VTCallForwardOptions extends TimeConsumingPreferenceActivity {
private static final String LOG_TAG = "VTCallForwardOptions";
private final boolean DBG = (PhoneApp.DBG_LEVEL >= 2);
private static final String NUM_PROJECTION[] = {Phone.NUMBER};
private static final String BUTTON_VT_CFU_KEY = "button_vt_cfu_key";
private static final String BUTTON_VT_CFB_KEY = "button_vt_cfb_key";
private static final String BUTTON_VT_CFNRY_KEY = "button_vt_cfnry_key";
private static final String BUTTON_VT_CFNRC_KEY = "button_vt_cfnrc_key";
private static final String KEY_TOGGLE = "toggle";
private static final String KEY_STATUS = "status";
private static final String KEY_NUMBER = "number";
private CallForwardEditPreference mButtonCFU;
private CallForwardEditPreference mButtonCFB;
private CallForwardEditPreference mButtonCFNRy;
private CallForwardEditPreference mButtonCFNRc;
private final ArrayList<CallForwardEditPreference> mPreferences =
new ArrayList<CallForwardEditPreference> ();
private int mInitIndex= 0;
private boolean mFirstResume;
private Bundle mIcicle;
private int mSubscription = 0;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.videocall_callforward_options);
PreferenceScreen prefSet = getPreferenceScreen();
mButtonCFU = (CallForwardEditPreference) prefSet.findPreference(BUTTON_VT_CFU_KEY);
mButtonCFB = (CallForwardEditPreference) prefSet.findPreference(BUTTON_VT_CFB_KEY);
mButtonCFNRy = (CallForwardEditPreference) prefSet.findPreference(BUTTON_VT_CFNRY_KEY);
mButtonCFNRc = (CallForwardEditPreference) prefSet.findPreference(BUTTON_VT_CFNRC_KEY);
mButtonCFU.setParentActivity(this, mButtonCFU.reason);
mButtonCFB.setParentActivity(this, mButtonCFB.reason);
mButtonCFNRy.setParentActivity(this, mButtonCFNRy.reason);
mButtonCFNRc.setParentActivity(this, mButtonCFNRc.reason);
mButtonCFU.setParameter(this, mSubscription);
mButtonCFB.setParameter(this, mSubscription);
mButtonCFNRy.setParameter(this, mSubscription);
mButtonCFNRc.setParameter(this, mSubscription);
mPreferences.add(mButtonCFU);
mPreferences.add(mButtonCFB);
mPreferences.add(mButtonCFNRy);
mPreferences.add(mButtonCFNRc);
// we wait to do the initialization until onResume so that the
// TimeConsumingPreferenceActivity dialog can display as it
// relies on onResume / onPause to maintain its foreground state.
mFirstResume = true;
mIcicle = icicle;
ActionBar actionBar = getActionBar();
if (actionBar != null) {
// android.R.id.home will be triggered in onOptionsItemSelected()
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
@Override
public void onResume() {
super.onResume();
if (mFirstResume) {
if (mIcicle != null) {
mInitIndex = mPreferences.size();
for (CallForwardEditPreference pref : mPreferences) {
Bundle bundle = mIcicle.getParcelable(pref.getKey());
pref.setToggled(bundle.getBoolean(KEY_TOGGLE));
CallForwardInfo cf = new CallForwardInfo();
cf.number = bundle.getString(KEY_NUMBER);
cf.status = bundle.getInt(KEY_STATUS);
pref.handleCallForwardResult(cf);
pref.init(true);
}
}
for (CallForwardEditPreference pref : mPreferences) {
pref.setSummaryOff(R.string.sum_cf_update);
}
mFirstResume = false;
mIcicle=null;
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
for (CallForwardEditPreference pref : mPreferences) {
Bundle bundle = new Bundle();
bundle.putBoolean(KEY_TOGGLE, pref.isToggled());
if (pref.callForwardInfo != null) {
bundle.putString(KEY_NUMBER, pref.callForwardInfo.number);
bundle.putInt(KEY_STATUS, pref.callForwardInfo.status);
}
outState.putParcelable(pref.getKey(), bundle);
}
}
@Override
public void onFinished(Preference preference, boolean reading) {
// if (mInitIndex < mPreferences.size()-1 && !isFinishing()) {
// mInitIndex++;
// mPreferences.get(mInitIndex).init(false);
// }
super.onFinished(preference, reading);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (DBG) Log.d(LOG_TAG, "onActivityResult: done");
if (resultCode != RESULT_OK) {
if (DBG) Log.d(LOG_TAG, "onActivityResult: contact picker result not OK.");
return;
}
Cursor cursor = getContentResolver().query(data.getData(),
NUM_PROJECTION, null, null, null);
if ((cursor == null) || (!cursor.moveToFirst())) {
if (DBG) Log.d(LOG_TAG, "onActivityResult: bad contact data, no results found.");
return;
}
switch (requestCode) {
case CommandsInterface.CF_REASON_UNCONDITIONAL:
mButtonCFU.onPickActivityResult(cursor.getString(0));
break;
case CommandsInterface.CF_REASON_BUSY:
mButtonCFB.onPickActivityResult(cursor.getString(0));
break;
case CommandsInterface.CF_REASON_NO_REPLY:
mButtonCFNRy.onPickActivityResult(cursor.getString(0));
break;
case CommandsInterface.CF_REASON_NOT_REACHABLE:
mButtonCFNRc.onPickActivityResult(cursor.getString(0));
break;
default:
// TODO: may need exception here.
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
final int itemId = item.getItemId();
if (itemId == android.R.id.home) { // See ActionBar#setDisplayHomeAsUpEnabled()
CallFeaturesSetting.goUpToTopLevelSetting(this);
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"shalabh.kumar@borqs.com"
] | shalabh.kumar@borqs.com |
aaf6f7caa6eb6bcdc2f314a42bfd7abd06efdff4 | c6e92a1b7b333ac945f046d4fffef368905de2ac | /app/build/tmp/kapt3/stubs/debug/edu/ucsmub/kqvoting/db/model/Notification.java | d0eb136c94929fb435e33ed9b5eb5a9bdbf4e06e | [] | no_license | itclubucsmub/KQVoting | 4ffa5fe61ef19130aa6cb86b50bf4753efcf9160 | fc994a49fcb6d0d4f29fe7538478561081e9ef76 | refs/heads/master | 2020-04-15T21:35:08.525144 | 2019-02-19T17:39:23 | 2019-02-19T17:39:23 | 165,038,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,689 | java | package edu.ucsmub.kqvoting.db.model;
import java.lang.System;
@androidx.room.TypeConverters(value = {edu.ucsmub.kqvoting.db.DateTImeConverter.class})
@androidx.room.Entity(tableName = "notification")
@kotlin.Metadata(mv = {1, 1, 13}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0017\n\u0002\u0010\u000b\n\u0002\b\u0004\b\u0087\b\u0018\u00002\u00020\u0001B\'\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0005\u0012\u0006\u0010\u0007\u001a\u00020\b\u00a2\u0006\u0002\u0010\tJ\u0010\u0010\u0019\u001a\u0004\u0018\u00010\u0003H\u00c6\u0003\u00a2\u0006\u0002\u0010\u000fJ\t\u0010\u001a\u001a\u00020\u0005H\u00c6\u0003J\t\u0010\u001b\u001a\u00020\u0005H\u00c6\u0003J\t\u0010\u001c\u001a\u00020\bH\u00c6\u0003J8\u0010\u001d\u001a\u00020\u00002\n\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u00032\b\b\u0002\u0010\u0004\u001a\u00020\u00052\b\b\u0002\u0010\u0006\u001a\u00020\u00052\b\b\u0002\u0010\u0007\u001a\u00020\bH\u00c6\u0001\u00a2\u0006\u0002\u0010\u001eJ\u0013\u0010\u001f\u001a\u00020 2\b\u0010!\u001a\u0004\u0018\u00010\u0001H\u00d6\u0003J\t\u0010\"\u001a\u00020\u0003H\u00d6\u0001J\t\u0010#\u001a\u00020\u0005H\u00d6\u0001R\u001e\u0010\u0006\u001a\u00020\u00058\u0006@\u0006X\u0087\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\n\u0010\u000b\"\u0004\b\f\u0010\rR\"\u0010\u0002\u001a\u0004\u0018\u00010\u00038\u0006@\u0006X\u0087\u000e\u00a2\u0006\u0010\n\u0002\u0010\u0012\u001a\u0004\b\u000e\u0010\u000f\"\u0004\b\u0010\u0010\u0011R\u001e\u0010\u0007\u001a\u00020\b8\u0006@\u0006X\u0087\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u0013\u0010\u0014\"\u0004\b\u0015\u0010\u0016R\u001e\u0010\u0004\u001a\u00020\u00058\u0006@\u0006X\u0087\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u0017\u0010\u000b\"\u0004\b\u0018\u0010\r\u00a8\u0006$"}, d2 = {"Ledu/ucsmub/kqvoting/db/model/Notification;", "", "id", "", "title", "", "body", "time", "Ljava/util/Date;", "(Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/util/Date;)V", "getBody", "()Ljava/lang/String;", "setBody", "(Ljava/lang/String;)V", "getId", "()Ljava/lang/Integer;", "setId", "(Ljava/lang/Integer;)V", "Ljava/lang/Integer;", "getTime", "()Ljava/util/Date;", "setTime", "(Ljava/util/Date;)V", "getTitle", "setTitle", "component1", "component2", "component3", "component4", "copy", "(Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/util/Date;)Ledu/ucsmub/kqvoting/db/model/Notification;", "equals", "", "other", "hashCode", "toString", "app_debug"})
public final class Notification {
@org.jetbrains.annotations.Nullable()
@androidx.room.ColumnInfo(name = "id")
@androidx.room.PrimaryKey(autoGenerate = true)
private java.lang.Integer id;
@org.jetbrains.annotations.NotNull()
@androidx.room.ColumnInfo(name = "title")
private java.lang.String title;
@org.jetbrains.annotations.NotNull()
@androidx.room.ColumnInfo(name = "body")
private java.lang.String body;
@org.jetbrains.annotations.NotNull()
@androidx.room.ColumnInfo(name = "time")
private java.util.Date time;
@org.jetbrains.annotations.Nullable()
public final java.lang.Integer getId() {
return null;
}
public final void setId(@org.jetbrains.annotations.Nullable()
java.lang.Integer p0) {
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String getTitle() {
return null;
}
public final void setTitle(@org.jetbrains.annotations.NotNull()
java.lang.String p0) {
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String getBody() {
return null;
}
public final void setBody(@org.jetbrains.annotations.NotNull()
java.lang.String p0) {
}
@org.jetbrains.annotations.NotNull()
public final java.util.Date getTime() {
return null;
}
public final void setTime(@org.jetbrains.annotations.NotNull()
java.util.Date p0) {
}
public Notification(@org.jetbrains.annotations.Nullable()
java.lang.Integer id, @org.jetbrains.annotations.NotNull()
java.lang.String title, @org.jetbrains.annotations.NotNull()
java.lang.String body, @org.jetbrains.annotations.NotNull()
java.util.Date time) {
super();
}
@org.jetbrains.annotations.Nullable()
public final java.lang.Integer component1() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String component2() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String component3() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final java.util.Date component4() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final edu.ucsmub.kqvoting.db.model.Notification copy(@org.jetbrains.annotations.Nullable()
java.lang.Integer id, @org.jetbrains.annotations.NotNull()
java.lang.String title, @org.jetbrains.annotations.NotNull()
java.lang.String body, @org.jetbrains.annotations.NotNull()
java.util.Date time) {
return null;
}
@org.jetbrains.annotations.NotNull()
@java.lang.Override()
public java.lang.String toString() {
return null;
}
@java.lang.Override()
public int hashCode() {
return 0;
}
@java.lang.Override()
public boolean equals(@org.jetbrains.annotations.Nullable()
java.lang.Object p0) {
return false;
}
} | [
"halucsmub@gmail.com"
] | halucsmub@gmail.com |
21d29183c830fffdcbd23d433deb39caafd93790 | d4d42147fa758b74e035ea15124f61a72806f654 | /app/src/main/java/com/ch/myapplication/ui/accommodation/AccommodationList.java | de6e746ad0b1a6d705f883375cfc49a17dafa02c | [] | no_license | omgitsele/LoveChaniaAndroid | cae653b39b461ca38dce0f4dc56a31e3abbd08b8 | a374e310a31d775faee5cc63d3bdc8b84af40902 | refs/heads/master | 2023-06-25T02:33:43.362047 | 2021-07-22T08:26:05 | 2021-07-22T08:26:05 | 388,374,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,547 | java | package com.ch.myapplication.ui.accommodation;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Looper;
import android.provider.Settings;
import android.util.Log;
import android.widget.GridView;
import android.widget.Toast;
import com.ch.myapplication.Place;
import com.ch.myapplication.R;
import com.ch.myapplication.ui.ads.AdsCustomGrid;
import com.ch.myapplication.ui.poi.CustomGrid;
import com.ch.myapplication.ui.shops.ShopsActivity;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.interstitial.InterstitialAd;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
import java.util.ArrayList;
import java.util.List;
public class AccommodationList extends AppCompatActivity {
private final String adUnitID = "ca-app-pub-6122629245886275/5177829663";
private final String testUnitID = "ca-app-pub-3940256099942544/1033173712";
GridView grid;
private String currentLat = "0.0";
private String currentLongt = "0.0";
int PERMISSION_ID = 44;
private FusedLocationProviderClient mFusedLocationClient;
List<Place> placeList = new ArrayList<>();
boolean flag = false;
String[] accomodationList = {
"Porto Veneziano",
"Sunrise Village",
"Sunny Bay",
"Vranas",
"Klinakis",
"Evans House",
"Nikolas Rooms",
"Casa Veneta"
};
int[] imageId = {
R.drawable.portoveneziano0,
R.drawable.sunrisevillage0,
R.drawable.sunnybay0,
R.drawable.vranas0,
R.drawable.klinakis0,
R.drawable.evanshouse0,
R.drawable.nikolasrooms0,
R.drawable.casaveneta0,
};
int [] poiNoPhotos = { 5, 14, 5, 3, 2, 3, 4, 5};
char[] hasPhone = {'1', '1', '1', '1', '1', '1', '1', '1'} ;
String[] phoneList = {"+302821027100", "+302821083640", "+302822083062", "+302821058618", "+306947663585", "+306974814184", "+306978187357", "+302821090007"};
private double[] Lat = {35.518916, 35.515179, 35.497736, 35.515588, 35.512961, 35.515028, 35.515451, 35.517829};
private double[] Longt = { 24.022742, 23.915792, 23.662395, 24.018468, 24.003265, 24.027404, 24.017892, 24.015040};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// MobileAds.initialize(this, initializationStatus -> {
// });
setContentView(R.layout.activity_accommodation_list);
setTitle("Accommodation");
// add back arrow to toolbar
if (getSupportActionBar() != null){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
// method to get the location
placeList.add(new Place("Porto Veneziano", R.drawable.portoveneziano0, 5, 35.518916, 24.022742, '1', "+302821027100"));
placeList.add(new Place("Sunrise Village", R.drawable.sunrisevillage0, 14, 35.515179, 23.915792, '1', "+302821083640"));
placeList.add(new Place("Sunny Bay", R.drawable.sunnybay0, 5, 35.497736, 23.662395, '1', "+302822083062"));
placeList.add(new Place("Vranas", R.drawable.vranas0, 3, 35.515588, 24.018468, '1', "+302821058618"));
placeList.add(new Place("Klinakis", R.drawable.klinakis0, 2, 35.512961, 24.003265, '1', "+306947663585"));
placeList.add(new Place("Evans House", R.drawable.evanshouse0, 3, 35.515028, 24.027404, '1', "+306974814184"));
placeList.add(new Place("Nikolas Rooms", R.drawable.nikolasrooms0, 4, 35.515451, 24.017892, '1', "+306978187357"));
placeList.add(new Place("Casa Veneta", R.drawable.casaveneta0, 5, 35.517829, 24.01504, '1', "+302821090007"));
getLastLocation();
}
private LocationCallback mLocationCallback = new LocationCallback() {
@Override
public void onLocationResult(LocationResult locationResult) {
Location mLastLocation = locationResult.getLastLocation();
currentLat = String.valueOf(mLastLocation.getLatitude());
currentLongt = String.valueOf(mLastLocation.getLongitude());
}
};
// method to check for permissions
private boolean checkPermissions() {
return ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
// If we want background location
// on Android 10.0 and higher,
// use:
// ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED
}
// method to request for permissions
private void requestPermissions() {
ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSION_ID);
}
// method to check
// if location is enabled
private boolean isLocationEnabled() {
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
}
// If everything is alright then
@Override
public void
onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_ID) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
getLastLocation();
}
}
}
@SuppressLint("MissingPermission")
private void getLastLocation() {
// check if permissions are given
if (checkPermissions()) {
// check if location is enabled
if (isLocationEnabled()) {
// getting last
// location from
// FusedLocationClient
// object
mFusedLocationClient.getLastLocation().addOnCompleteListener(task -> {
Location location = task.getResult();
if (location == null) {
requestNewLocationData();
} else {
currentLat = String.valueOf(location.getLatitude());
currentLongt = String.valueOf(location.getLongitude());
// for (int i=0; i< accomodationList.length; i++)
// {
//
// Location locationA = new Location("point A");
//
// locationA.setLatitude(Lat[i]);
// locationA.setLongitude(Longt[i]);
//
// Location locationB = new Location("point B");
//
// locationB.setLatitude(Double.parseDouble(currentLat));
// locationB.setLongitude(Double.parseDouble(currentLongt));
//
// float distanceTo = locationA.distanceTo(locationB) / 1000;
// Log.d("Distance", ""+distanceTo);
// Place p = new Place(accomodationList[i], imageId[i], poiNoPhotos[i], Lat[i], Longt[i], distanceTo, hasPhone[i], phoneList[i]);
// placeList.add(p);
// }
AdsCustomGrid adapter = new AdsCustomGrid(AccommodationList.this, placeList, currentLat, currentLongt);
grid = findViewById(R.id.grid);
grid.setAdapter(adapter);
Log.d("LATLONG", "Lat: " + currentLat + " Longt: " + currentLongt);
}
});
} else {
AdsCustomGrid adapter = new AdsCustomGrid(AccommodationList.this, accomodationList, imageId, poiNoPhotos, Lat, Longt, hasPhone, phoneList, adUnitID);
grid = findViewById(R.id.grid);
grid.setAdapter(adapter);
if (!flag) {
flag = true;
Toast.makeText(this, "Please turn on" + " your location...", Toast.LENGTH_LONG).show();
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
}
}
} else {
// if permissions aren't available,
// request for permissions
requestPermissions();
}
}
@SuppressLint("MissingPermission")
private void requestNewLocationData() {
// Initializing LocationRequest
// object with appropriate methods
LocationRequest mLocationRequest = new LocationRequest();
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
mLocationRequest.setInterval(5);
mLocationRequest.setFastestInterval(0);
mLocationRequest.setNumUpdates(1);
// setting LocationRequest
// on FusedLocationClient
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
mFusedLocationClient.requestLocationUpdates(mLocationRequest, mLocationCallback, Looper.myLooper());
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
finish();
return true;
}
}
| [
"eleftheriadis_dimitris@yahoo.gr"
] | eleftheriadis_dimitris@yahoo.gr |
9fab5d11775b75815043ae17a47335e14c1c7531 | c3741c45d30c38a9a685b43630664a338ee6d0fc | /Assignment8.java | 766a75bd14239f93b164c7d98c63e51d3d4f9f89 | [] | no_license | rselvi1987/Week3-Day1 | c8cc6538d80625764b1d3a4196ac28d7d66dec27 | 5c05a1628b80c064cfe67999a7312d2648fd29d0 | refs/heads/main | 2023-08-24T01:36:40.601700 | 2021-10-16T17:25:53 | 2021-10-16T17:25:53 | 417,898,363 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 607 | java | package week3.Day1;
public class Assignment8 {
/*
* Write a Java program to replace a specified character with another character
* and add # to the given string.
*
* String sentence = "I am working with Java8" replace 8 to 11 Print the
* characters from 5 to 14
*/
public static void main(String[] args) {
String sentence = "I am working with Java8";
String replacedsentence = sentence.replace("8","11");
System.out.println("New Sentence is" + replacedsentence);
String substring = sentence.substring(5, 14);
System.out.println(substring);
}
}
| [
"noreply@github.com"
] | rselvi1987.noreply@github.com |
699395c0eb5f53df7ede0f67e130c2178bcc174d | 0cac40daf2279252c1137e268b0de6ab5cfb3d0d | /src/at/tspi/ebnf/ebnfparser/EbnfElement_DefiningSymbol.java | 05927c0b9a2a9a038fd662f3a9751154c1e1ba4c | [] | no_license | tspspi/jebnfc | 34790acc8c506830bb0b9a9587166e3894dfd8f7 | 2d7ae9bcea9ec155493e3a413cd23ad0d1fc38fa | refs/heads/master | 2020-04-17T15:26:47.565805 | 2019-01-20T19:12:10 | 2019-01-20T19:12:10 | 166,699,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | package at.tspi.ebnf.ebnfparser;
import at.tspi.ebnf.parser.ParserElement;
import at.tspi.ebnf.parser.ParserElementConstant;
public class EbnfElement_DefiningSymbol extends ParserElementConstant {
public EbnfElement_DefiningSymbol(ParserElement parent) { super(parent, "=", "DefiningSymbol", false); }
public ParserElement factory(ParserElement parent) { return new EbnfElement_DefiningSymbol(parent); }
public String toString() { return "="; }
} | [
"11219971+tspspi@users.noreply.github.com"
] | 11219971+tspspi@users.noreply.github.com |
c5f4122dcde2b4b9b6e98fa7940f71bf243faf50 | 104cda8eafe0617e2a5fa1e2b9f242d78370521b | /aliyun-java-sdk-r-kvstore/src/main/java/com/aliyuncs/r_kvstore/model/v20150101/CreateShardingInstanceRequest.java | 8d870f1c2b5849639541878cf23716c6a4d456da | [
"Apache-2.0"
] | permissive | SanthosheG/aliyun-openapi-java-sdk | 89f9b245c1bcdff8dac0866c36ff9a261aa40684 | 38a910b1a7f4bdb1b0dd29601a1450efb1220f79 | refs/heads/master | 2020-07-24T00:00:59.491294 | 2019-09-09T23:00:27 | 2019-09-11T04:29:56 | 207,744,099 | 2 | 0 | NOASSERTION | 2019-09-11T06:55:58 | 2019-09-11T06:55:58 | null | UTF-8 | Java | false | false | 11,499 | java | /*
* 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.aliyuncs.r_kvstore.model.v20150101;
import com.aliyuncs.RpcAcsRequest;
/**
* @author auto create
* @version
*/
public class CreateShardingInstanceRequest extends RpcAcsRequest<CreateShardingInstanceResponse> {
public CreateShardingInstanceRequest() {
super("R-kvstore", "2015-01-01", "CreateShardingInstance", "redisa");
}
private Integer shardStorageQuantity;
private Long resourceOwnerId;
private String nodeType;
private String couponNo;
private String networkType;
private String engineVersion;
private String instanceClass;
private Long capacity;
private String password;
private String shardReplicaClass;
private String securityToken;
private String incrementalBackupMode;
private String instanceType;
private String businessInfo;
private String period;
private String resourceOwnerAccount;
private String srcDBInstanceId;
private String ownerAccount;
private String backupId;
private Long ownerId;
private String token;
private Integer shardQuantity;
private String vSwitchId;
private String privateIpAddress;
private String securityIPList;
private String instanceName;
private Integer shardReplicaQuantity;
private String architectureType;
private String vpcId;
private String redisManagerClass;
private String zoneId;
private String chargeType;
private Integer proxyQuantity;
private String config;
private String proxyMode;
public Integer getShardStorageQuantity() {
return this.shardStorageQuantity;
}
public void setShardStorageQuantity(Integer shardStorageQuantity) {
this.shardStorageQuantity = shardStorageQuantity;
if(shardStorageQuantity != null){
putQueryParameter("ShardStorageQuantity", shardStorageQuantity.toString());
}
}
public Long getResourceOwnerId() {
return this.resourceOwnerId;
}
public void setResourceOwnerId(Long resourceOwnerId) {
this.resourceOwnerId = resourceOwnerId;
if(resourceOwnerId != null){
putQueryParameter("ResourceOwnerId", resourceOwnerId.toString());
}
}
public String getNodeType() {
return this.nodeType;
}
public void setNodeType(String nodeType) {
this.nodeType = nodeType;
if(nodeType != null){
putQueryParameter("NodeType", nodeType);
}
}
public String getCouponNo() {
return this.couponNo;
}
public void setCouponNo(String couponNo) {
this.couponNo = couponNo;
if(couponNo != null){
putQueryParameter("CouponNo", couponNo);
}
}
public String getNetworkType() {
return this.networkType;
}
public void setNetworkType(String networkType) {
this.networkType = networkType;
if(networkType != null){
putQueryParameter("NetworkType", networkType);
}
}
public String getEngineVersion() {
return this.engineVersion;
}
public void setEngineVersion(String engineVersion) {
this.engineVersion = engineVersion;
if(engineVersion != null){
putQueryParameter("EngineVersion", engineVersion);
}
}
public String getInstanceClass() {
return this.instanceClass;
}
public void setInstanceClass(String instanceClass) {
this.instanceClass = instanceClass;
if(instanceClass != null){
putQueryParameter("InstanceClass", instanceClass);
}
}
public Long getCapacity() {
return this.capacity;
}
public void setCapacity(Long capacity) {
this.capacity = capacity;
if(capacity != null){
putQueryParameter("Capacity", capacity.toString());
}
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
if(password != null){
putQueryParameter("Password", password);
}
}
public String getShardReplicaClass() {
return this.shardReplicaClass;
}
public void setShardReplicaClass(String shardReplicaClass) {
this.shardReplicaClass = shardReplicaClass;
if(shardReplicaClass != null){
putQueryParameter("ShardReplicaClass", shardReplicaClass);
}
}
public String getBizSecurityToken() {
return this.securityToken;
}
public void setBizSecurityToken(String securityToken) {
this.securityToken = securityToken;
if(securityToken != null){
putQueryParameter("SecurityToken", securityToken);
}
}
/**
* @deprecated use getBizSecurityToken instead of this.
*/
@Deprecated
public String getSecurityToken() {
return this.securityToken;
}
/**
* @deprecated use setBizSecurityToken instead of this.
*/
@Deprecated
public void setSecurityToken(String securityToken) {
this.securityToken = securityToken;
if(securityToken != null){
putQueryParameter("SecurityToken", securityToken);
}
}
public String getIncrementalBackupMode() {
return this.incrementalBackupMode;
}
public void setIncrementalBackupMode(String incrementalBackupMode) {
this.incrementalBackupMode = incrementalBackupMode;
if(incrementalBackupMode != null){
putQueryParameter("IncrementalBackupMode", incrementalBackupMode);
}
}
public String getInstanceType() {
return this.instanceType;
}
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
if(instanceType != null){
putQueryParameter("InstanceType", instanceType);
}
}
public String getBusinessInfo() {
return this.businessInfo;
}
public void setBusinessInfo(String businessInfo) {
this.businessInfo = businessInfo;
if(businessInfo != null){
putQueryParameter("BusinessInfo", businessInfo);
}
}
public String getPeriod() {
return this.period;
}
public void setPeriod(String period) {
this.period = period;
if(period != null){
putQueryParameter("Period", period);
}
}
public String getResourceOwnerAccount() {
return this.resourceOwnerAccount;
}
public void setResourceOwnerAccount(String resourceOwnerAccount) {
this.resourceOwnerAccount = resourceOwnerAccount;
if(resourceOwnerAccount != null){
putQueryParameter("ResourceOwnerAccount", resourceOwnerAccount);
}
}
public String getSrcDBInstanceId() {
return this.srcDBInstanceId;
}
public void setSrcDBInstanceId(String srcDBInstanceId) {
this.srcDBInstanceId = srcDBInstanceId;
if(srcDBInstanceId != null){
putQueryParameter("SrcDBInstanceId", srcDBInstanceId);
}
}
public String getOwnerAccount() {
return this.ownerAccount;
}
public void setOwnerAccount(String ownerAccount) {
this.ownerAccount = ownerAccount;
if(ownerAccount != null){
putQueryParameter("OwnerAccount", ownerAccount);
}
}
public String getBackupId() {
return this.backupId;
}
public void setBackupId(String backupId) {
this.backupId = backupId;
if(backupId != null){
putQueryParameter("BackupId", backupId);
}
}
public Long getOwnerId() {
return this.ownerId;
}
public void setOwnerId(Long ownerId) {
this.ownerId = ownerId;
if(ownerId != null){
putQueryParameter("OwnerId", ownerId.toString());
}
}
public String getToken() {
return this.token;
}
public void setToken(String token) {
this.token = token;
if(token != null){
putQueryParameter("Token", token);
}
}
public Integer getShardQuantity() {
return this.shardQuantity;
}
public void setShardQuantity(Integer shardQuantity) {
this.shardQuantity = shardQuantity;
if(shardQuantity != null){
putQueryParameter("ShardQuantity", shardQuantity.toString());
}
}
public String getVSwitchId() {
return this.vSwitchId;
}
public void setVSwitchId(String vSwitchId) {
this.vSwitchId = vSwitchId;
if(vSwitchId != null){
putQueryParameter("VSwitchId", vSwitchId);
}
}
public String getPrivateIpAddress() {
return this.privateIpAddress;
}
public void setPrivateIpAddress(String privateIpAddress) {
this.privateIpAddress = privateIpAddress;
if(privateIpAddress != null){
putQueryParameter("PrivateIpAddress", privateIpAddress);
}
}
public String getSecurityIPList() {
return this.securityIPList;
}
public void setSecurityIPList(String securityIPList) {
this.securityIPList = securityIPList;
if(securityIPList != null){
putQueryParameter("SecurityIPList", securityIPList);
}
}
public String getInstanceName() {
return this.instanceName;
}
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
if(instanceName != null){
putQueryParameter("InstanceName", instanceName);
}
}
public Integer getShardReplicaQuantity() {
return this.shardReplicaQuantity;
}
public void setShardReplicaQuantity(Integer shardReplicaQuantity) {
this.shardReplicaQuantity = shardReplicaQuantity;
if(shardReplicaQuantity != null){
putQueryParameter("ShardReplicaQuantity", shardReplicaQuantity.toString());
}
}
public String getArchitectureType() {
return this.architectureType;
}
public void setArchitectureType(String architectureType) {
this.architectureType = architectureType;
if(architectureType != null){
putQueryParameter("ArchitectureType", architectureType);
}
}
public String getVpcId() {
return this.vpcId;
}
public void setVpcId(String vpcId) {
this.vpcId = vpcId;
if(vpcId != null){
putQueryParameter("VpcId", vpcId);
}
}
public String getRedisManagerClass() {
return this.redisManagerClass;
}
public void setRedisManagerClass(String redisManagerClass) {
this.redisManagerClass = redisManagerClass;
if(redisManagerClass != null){
putQueryParameter("RedisManagerClass", redisManagerClass);
}
}
public String getZoneId() {
return this.zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
if(zoneId != null){
putQueryParameter("ZoneId", zoneId);
}
}
public String getChargeType() {
return this.chargeType;
}
public void setChargeType(String chargeType) {
this.chargeType = chargeType;
if(chargeType != null){
putQueryParameter("ChargeType", chargeType);
}
}
public Integer getProxyQuantity() {
return this.proxyQuantity;
}
public void setProxyQuantity(Integer proxyQuantity) {
this.proxyQuantity = proxyQuantity;
if(proxyQuantity != null){
putQueryParameter("ProxyQuantity", proxyQuantity.toString());
}
}
public String getConfig() {
return this.config;
}
public void setConfig(String config) {
this.config = config;
if(config != null){
putQueryParameter("Config", config);
}
}
public String getProxyMode() {
return this.proxyMode;
}
public void setProxyMode(String proxyMode) {
this.proxyMode = proxyMode;
if(proxyMode != null){
putQueryParameter("ProxyMode", proxyMode);
}
}
@Override
public Class<CreateShardingInstanceResponse> getResponseClass() {
return CreateShardingInstanceResponse.class;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
3e1dc6b1a2ac5a11ff4725b62d8f95998a3504c3 | df5e44ff44c2bba0adc155fc25969516e8073d23 | /src/main/java/com/main/cloudapi/entity/Comfort.java | d70dedc98e27a5cd0a661a4ee30d0a51d06102af | [] | no_license | mirxak/CloudAPI | 0ac2b96c7819c596ed9c181b373a1d41149700f6 | 2b4ada98f204240878a3a61d5e0ab073afb13e81 | refs/heads/master | 2021-01-25T03:27:00.585800 | 2015-05-27T22:29:57 | 2015-05-27T22:29:57 | 32,181,781 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,952 | java | package com.main.cloudapi.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.main.cloudapi.entity.base.BaseEntity;
import org.hibernate.annotations.Where;
import javax.persistence.*;
/**
* Created by mirxak on 21.01.15.
*/
@Entity
@Table(name = Comfort.TABLE)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Comfort extends BaseEntity {
public static final String CATEGORY = "comforts";
public static final String TABLE = "comfort";
//<editor-fold desc="fields">
private Integer conditioner;
private Integer climateControl;
private Integer boardComputer;
private Integer lightSensor;
private Integer rainSensor;
private Integer audioCd;
private Integer audioCdMp3;
private Integer cdChanger;
private Integer powerSteering;
private Integer centralLocking;
private Integer duCentralLocking;
private Integer electricalMirrors;
private Integer mirrorsHeating;
private Integer frontEwindows;
private Integer rearEwindows;
private Integer seatsHeating;
private Integer adjustableSteering;
private Integer adjustableDriverSeat;
//</editor-fold>
@Override
@Transient
public String getTable() {
return TABLE;
}
@Override
@Transient
public String getObjectCategory() {
return CATEGORY;
}
@Override
public BaseEntity generateEntity() {
return new Comfort();
}
@Column(name = "conditioner")
public Integer getConditioner() {
return conditioner;
}
public void setConditioner(Integer conditioner) {
this.conditioner = conditioner;
}
@Column(name = "climate_control")
public Integer getClimateControl() {
return climateControl;
}
public void setClimateControl(Integer climateControl) {
this.climateControl = climateControl;
}
@Column(name = "board_computer")
public Integer getBoardComputer() {
return boardComputer;
}
public void setBoardComputer(Integer boardComputer) {
this.boardComputer = boardComputer;
}
@Column(name = "light_sensor")
public Integer getLightSensor() {
return lightSensor;
}
public void setLightSensor(Integer lightSensor) {
this.lightSensor = lightSensor;
}
@Column(name = "rain_sensor")
public Integer getRainSensor() {
return rainSensor;
}
public void setRainSensor(Integer rainSensor) {
this.rainSensor = rainSensor;
}
@Column(name = "audio_cd")
public Integer getAudioCd() {
return audioCd;
}
public void setAudioCd(Integer audioCd) {
this.audioCd = audioCd;
}
@Column(name = "audio_cd_mp3")
public Integer getAudioCdMp3() {
return audioCdMp3;
}
public void setAudioCdMp3(Integer audioCdMp3) {
this.audioCdMp3 = audioCdMp3;
}
@Column(name = "cd_changer")
public Integer getCdChanger() {
return cdChanger;
}
public void setCdChanger(Integer cdChanger) {
this.cdChanger = cdChanger;
}
@Column(name = "power_steering")
public Integer getPowerSteering() {
return powerSteering;
}
public void setPowerSteering(Integer powerSteering) {
this.powerSteering = powerSteering;
}
@Column(name = "central_locking")
public Integer getCentralLocking() {
return centralLocking;
}
public void setCentralLocking(Integer centralLocking) {
this.centralLocking = centralLocking;
}
@Column(name = "du_central_locking")
public Integer getDuCentralLocking() {
return duCentralLocking;
}
public void setDuCentralLocking(Integer duCentralLocking) {
this.duCentralLocking = duCentralLocking;
}
@Column(name = "electrical_mirrors")
public Integer getElectricalMirrors() {
return electricalMirrors;
}
public void setElectricalMirrors(Integer electricalMirrors) {
this.electricalMirrors = electricalMirrors;
}
@Column(name = "mirrors_heating")
public Integer getMirrorsHeating() {
return mirrorsHeating;
}
public void setMirrorsHeating(Integer mirrorsHeating) {
this.mirrorsHeating = mirrorsHeating;
}
@Column(name = "front_ewindows")
public Integer getFrontEwindows() {
return frontEwindows;
}
public void setFrontEwindows(Integer frontEwindows) {
this.frontEwindows = frontEwindows;
}
@Column(name = "rear_ewindows")
public Integer getRearEwindows() {
return rearEwindows;
}
public void setRearEwindows(Integer rearEwindows) {
this.rearEwindows = rearEwindows;
}
@Column(name = "seats_heating")
public Integer getSeatsHeating() {
return seatsHeating;
}
public void setSeatsHeating(Integer seatsHeating) {
this.seatsHeating = seatsHeating;
}
@Column(name = "adjustable_steering")
public Integer getAdjustableSteering() {
return adjustableSteering;
}
public void setAdjustableSteering(Integer adjustableSteering) {
this.adjustableSteering = adjustableSteering;
}
@Column(name = "adjustable_driver_seat")
public Integer getAdjustableDriverSeat() {
return adjustableDriverSeat;
}
public void setAdjustableDriverSeat(Integer adjustableDriverSeat) {
this.adjustableDriverSeat = adjustableDriverSeat;
}
//<editor-fold desc="Complectation">
@JsonIgnore
private Complectation complectation;
@OneToOne(fetch = FetchType.LAZY, mappedBy = "comfort")
@Where(clause = "coalesce(is_deleted,0) <> 1")
public Complectation getComplectation() {
return complectation;
}
public void setComplectation(Complectation complectation) {
this.complectation = complectation;
}
//</editor-fold>
}
| [
"mir-ehjnari@yandex.ru"
] | mir-ehjnari@yandex.ru |
19fbfd9807b556f6351505ddcf84a450d510d464 | f31ac0a23464e582bc53bc3c5accfab058287234 | /AntoineThomas/serverAT/test/data/ParticipantTest.java | 278f1f12a40790343f801fcab66f917164a3f5e4 | [] | no_license | tibiow/SI3-JavaWebService | 99d46d547fc66e47660cfcc8e82c186d85e0ec9a | 36a6769005da400ede8977d76ca941e9e0d705a5 | refs/heads/master | 2020-03-21T18:46:25.042459 | 2018-06-27T17:24:38 | 2018-06-27T17:24:38 | 138,912,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | 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 data;
import org.json.simple.JSONObject;
import org.junit.Before;
import org.junit.Test;
/**
*
* @author Thom
*/
public class ParticipantTest {
Participant part;
public ParticipantTest() {
}
@Before
public void setUp() {
part = new Participant("Not Sure", "toto@gmail.col", 0);
}
/**
* Test of tojson method, of class Participant.
*/
@Test
public void testTojson() {
JSONObject a = part.toJSON();
System.out.println(a.toJSONString());
}
}
| [
"thibaut.gonnin@gmail.com"
] | thibaut.gonnin@gmail.com |
13454944485795cbde9957f82158b17f1a0c0e39 | 366d742a009ee5ed23029d24721ed5ffbf81bd13 | /src/headfirst/observer/weather/CurrentConditionsDisplay.java | ac0fa5ec0084e842329c1542c8d4890875570f78 | [] | no_license | limjeongmin/j1_201611101 | 3254f63c06bfa5007f2d0da187ce5c4d422d24fe | c3afad16bc9828038042d026e0153db40716fe9a | refs/heads/master | 2021-01-16T23:21:27.814728 | 2017-06-07T10:01:30 | 2017-06-07T10:01:30 | 68,719,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 659 | java | package headfirst.observer.weather;
public class CurrentConditionsDisplay implements Observer, DisplayElement {
private float temperature;
private float humidity;
private Subject weatherData;
public CurrentConditionsDisplay(Subject weatherData) {
this.weatherData = weatherData;
weatherData.registerObserver(this);
}
public void update(float temperature, float humidity, float pressure){
this.temperature=temperature;
this.humidity=humidity;
display();
}
public void display(){
System.out.println("Current conditions: " + temperature
+ "F degrees and " + humidity + "% humidity");
}
} | [
"noreply@github.com"
] | limjeongmin.noreply@github.com |
ad670fa56febfebf40673c09bbddd30710e2c5c9 | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Struts/Struts2351.java | 5a5892935ebcc0a7b76f4872c34cc505b7ef8f3a | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 567 | java | public void testRequiredLabelPositionRight() throws Exception {
TestAction testAction = (TestAction) action;
testAction.setFoo("bar");
TextFieldTag tag = new TextFieldTag();
tag.setPageContext(pageContext);
tag.setId("myId");
tag.setLabel("mylabel");
tag.setName("foo");
tag.setValue("bar");
tag.setRequiredLabel("true");
tag.setRequiredPosition("right");
tag.doStartTag();
tag.doEndTag();
verify(TextFieldTag.class.getResource("Textfield-12.txt"));
}
| [
"Qing.Mi@my.cityu.edu.hk"
] | Qing.Mi@my.cityu.edu.hk |
4e7acfc2c333cf8a8d9864fa03b550de958b8a21 | 642a92742060f1d40f56b2fcf2c6c9ecf640ce06 | /406-queue-reconstruction-by-height.java | 283254a10e305cb59fc2ade53583ba6c6c894ff1 | [] | no_license | KenjiChao/LeetCode-Java | 35c35776e172f54d76171e84a20ec5dc03424afb | 227adb9bce74d1085cc6e63c28c04e39a800eaa9 | refs/heads/master | 2020-04-12T07:20:41.199082 | 2017-01-30T02:59:54 | 2017-01-30T02:59:54 | 63,702,525 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | public class Solution {
public int[][] reconstructQueue(int[][] people) {
Arrays.sort(people, new Comparator<int[]>() {
@Override
public int compare(int[] p1, int[] p2) {
if (p1[0] != p2[0]) {
return -(p1[0] - p2[0]);
} else {
return p1[1] - p2[1];
}
}});
List<int[]> res = new ArrayList<>();
for (int[] p : people) {
res.add(p[1], new int[]{p[0], p[1]});
}
return res.toArray(new int[people.length][]);
}
}
| [
"kenji.chao@sv.cmu.edu"
] | kenji.chao@sv.cmu.edu |
ea13cd0fcadc2f4b3072cd5fd1aad220fa04a3cb | 1d2309a5ce5fe9f24ad33d97c2f8bdb1c9ed267e | /src/main/java/pl/edu/uj/cenuj/utils/DateConstants.java | 4cbbccf93e23597d1af8c1149b133729f95c2dc8 | [] | no_license | pzfaisuj/backend | a71fc843de0b7e79510c16d74ca1c8ca4b29075b | 457ac9e8d9e725571fd6445e2092adbd479b5bb0 | refs/heads/master | 2021-04-18T22:11:52.497614 | 2018-06-25T07:54:11 | 2018-06-25T07:54:11 | 126,301,511 | 0 | 1 | null | 2018-06-25T07:54:12 | 2018-03-22T08:10:28 | Java | UTF-8 | Java | false | false | 152 | java | package pl.edu.uj.cenuj.utils;
public class DateConstants {
public static final String DAY_FORMAT = "yyyy-MM-dd";
private DateConstants() {}
}
| [
"mijo@ailleron.com"
] | mijo@ailleron.com |
c895587f997b21dc707446a11cf69d11e30d2426 | b05d8c75a7dc62eb6b24fdde32dd254234a4eb1f | /ums-push/integration/src/main/java/com/quanshi/ums/task/YunwenRetryTask.java | 6b9184256135db6e472aab01b48a957c804f56a8 | [] | no_license | waterif/example1 | 2ebbaf873b974a78f08b03693f9b574242b093ea | a871bde177a8426bfbec1afa58c7da4e95d3639d | refs/heads/master | 2021-01-23T09:25:49.806168 | 2017-09-06T07:57:02 | 2017-09-06T07:57:02 | 102,579,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 877 | java | /**
*
*/
package com.quanshi.ums.task;
import java.util.Date;
import javax.annotation.Resource;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Component;
import com.quanshi.ums.base.Base;
import com.quanshi.ums.service.PushLogService;
import com.quanshi.ums.util.DateHelp;
/**
*
* @author yanxiang.huang 2017-06-16 16:34:00
*/
@Component
public class YunwenRetryTask extends Base
{
@Resource
private PushLogService pushLogService;
public synchronized void run()
{
logger.info( "push log retry interval. time:{}.",
DateFormatUtils.format( new Date(), DateHelp.DEFAULT_FORMAT ) );
try
{
pushLogService.retryInterval();
}
catch ( Exception e )
{
logger.error( "push log retry interval error.", e );
}
}
}
| [
"waterif@yeah.net"
] | waterif@yeah.net |
683b182ddacd5625ec70d9b08f146342ba0d5721 | cc367c6ddd149b0d95b74bd6eef0034e547a794c | /MyTestingApp/src/mytestingapp/MyForm.java | ab0f6c75a0fdbd00696bd47c8c2cc5a11db80351 | [] | no_license | Mariela34/Laboratorio1-Parte1_DComponentes | 904fdf1aaa54cee081beea07c2d242158b122d37 | 43e66fe96b3cd49e50beb7bd7a4b8fdf8692db77 | refs/heads/master | 2022-12-20T11:04:16.524810 | 2020-09-26T17:08:30 | 2020-09-26T17:08:30 | 297,874,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,904 | 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 mytestingapp;
/**
*
* @author Dell
*/
public class MyForm extends javax.swing.JFrame {
/**
* Creates new form MyForm
*/
public MyForm() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panelPrincipal1 = new com.cenfotec.componentes.control.PanelPrincipal();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(76, 76, 76)
.addComponent(panelPrincipal1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(124, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(panelPrincipal1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(179, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MyForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MyForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MyForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MyForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MyForm().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private com.cenfotec.componentes.control.PanelPrincipal panelPrincipal1;
// End of variables declaration//GEN-END:variables
}
| [
"mbonilla.guti@gmail.com"
] | mbonilla.guti@gmail.com |
984708bdbf2b5be878a730aafa5801b846fc043f | 31b0ff01f107d8769d7a4667c8698a2eb74b04ae | /Programmers/Level1/src/Problem1.java | adfaa7cd1cca3abe6c5b492ad3493b228b91c03c | [] | no_license | dodamtanguri/Web-programmer | 9953c642ed8c699842ad82973c438ccd637245cc | f0a93bf7cf984a7e7f853689ce3fecb6fff860a7 | refs/heads/main | 2023-08-29T17:38:43.943617 | 2021-11-14T08:07:31 | 2021-11-14T08:07:31 | 318,128,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | import java.util.Arrays;
public class Problem1 {
public int[][] solution(int[][] arr1, int[][] arr2) {
int[][] answer = new int[arr1.length][arr1[0].length];
for (int i = 0; i < arr1.length; i++) {
for (int j = 0; j < arr1[0].length; j++) {
answer[i][j] = arr1[i][j] + arr2[i][j];
}
}
return answer;
}
public static void main(String[] args) {
Problem1 test = new Problem1();
int[][] arr1 = {{1},
{2}};
int[][] arr2 = {{3},{4}};
System.out.println(Arrays.deepToString(test.solution(arr1, arr2)));
}
}
| [
"sh663746@gmail.com"
] | sh663746@gmail.com |
7f6fe95cb1827d9bf906b90f937c199333b3c9fa | c00e7d17e92f73f68f39c9e84d51d8a42ce30946 | /src/com/perky/safeguard361/activities/HomeActivity.java | 2b7f3b667a0c2fe36a7a9cc68bc4cc4d4597b60b | [] | no_license | ft115637850/SafeGuard361 | 7c82fe54bb1efe43577c778820eec1c1def8ab9b | b1fd427b9fdd688d419785f1bebc9d3f70da1f37 | refs/heads/master | 2021-01-02T23:02:54.745778 | 2015-12-09T14:55:40 | 2015-12-09T14:55:40 | 39,013,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,396 | java | package com.perky.safeguard361.activities;
import com.perky.safeguard361.R;
import com.perky.safeguard361.utils.MD5Utils;
import com.perky.safeguard361.utils.UIUtils;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
public class HomeActivity extends Activity {
private GridView gv_home;
private String[] funcLStrings;
private int[] icons = { R.drawable.phone_selector, R.drawable.cmm_selector,
R.drawable.software_selector, R.drawable.process_selector,
R.drawable.traffic_selector, R.drawable.virus_selector,
R.drawable.cache_selector, R.drawable.adv_selector,
R.drawable.setting_selector };
private SharedPreferences sp;
private EditText pwdEt;
private EditText cfmEt;
private Button cfmBtn;
private Button cancelBtn;
private AlertDialog dlg;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
funcLStrings = new String[] { this.getString(R.string.phone_guard),
this.getString(R.string.communication_guard),
this.getString(R.string.software_mgr),
this.getString(R.string.process_mgr),
this.getString(R.string.traffic_sum),
this.getString(R.string.anti_virus),
this.getString(R.string.cache_clear),
this.getString(R.string.advanced_tool),
this.getString(R.string.setting_center) };
sp = getSharedPreferences("config", MODE_PRIVATE);
gv_home = (GridView) findViewById(R.id.gv_home);
gv_home.setOnItemClickListener(new GvClickListener());
}
@Override
protected void onStart() {
gv_home.setAdapter(new GvAdapter());
super.onStart();
}
private class GvAdapter extends BaseAdapter {
@Override
public int getCount() {
// TODO Auto-generated method stub
return funcLStrings.length;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view;
if (convertView == null) {
view = View.inflate(getApplicationContext(),
R.layout.item_home_gv, null);
} else {
view = convertView;
}
ImageView iv_homeitem_icon = (ImageView) view
.findViewById(R.id.iv_homeitem_icon);
iv_homeitem_icon.setImageResource(icons[position]);
TextView tv_homeitem_name = (TextView) view
.findViewById(R.id.tv_homeitem_name);
tv_homeitem_name.setText(funcLStrings[position]);
if (position == 0) {
String newName = getSharedPreferences("config", MODE_PRIVATE)
.getString("newname", "");
if (!TextUtils.isEmpty(newName)) {
tv_homeitem_name.setText(newName);
}
}
return view;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
}
private class GvClickListener implements OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
Intent intent;
switch (position) {
case 0:
if (isPwdSet()) {
showEnterPwdDlg();
} else {
showSetPwdDlg();
}
break;
case 1:
intent = new Intent(HomeActivity.this,
CallSmsSafeActivity.class);
startActivity(intent);
break;
case 2:
intent = new Intent(HomeActivity.this, AppManagerActivity.class);
startActivity(intent);
break;
case 3:
intent = new Intent(HomeActivity.this,
TaskManagerActivity.class);
startActivity(intent);
break;
case 4:
intent = new Intent(HomeActivity.this, TrafficMgrActivity.class);
startActivity(intent);
break;
case 5:
intent = new Intent(HomeActivity.this, AntiVirusActivity.class);
startActivity(intent);
break;
case 6:
intent = new Intent(HomeActivity.this, ClearCacheActivity.class);
startActivity(intent);
break;
case 7:
intent = new Intent(HomeActivity.this, ToolsActivity.class);
startActivity(intent);
break;
case 8:
intent = new Intent(HomeActivity.this,
SettingCenterActivity.class);
startActivity(intent);
break;
default:
break;
}
}
private void showSetPwdDlg() {
AlertDialog.Builder dlgBlder = new Builder(HomeActivity.this);
View view = View.inflate(HomeActivity.this,
R.layout.dialog_setup_pwd, null);
pwdEt = (EditText) view.findViewById(R.id.et_pwd);
cfmEt = (EditText) view.findViewById(R.id.et_confirm);
cfmBtn = (Button) view.findViewById(R.id.btn_confirm);
cancelBtn = (Button) view.findViewById(R.id.btn_cancel);
cfmBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String pwd = pwdEt.getText().toString().trim();
String pwdCfm = cfmEt.getText().toString().trim();
if (TextUtils.isEmpty(pwd) || TextUtils.isEmpty(pwdCfm)) {
UIUtils.showToast(HomeActivity.this, getResources()
.getString(R.string.err_no_pwd));
return;
}
if (!pwd.equals(pwdCfm)) {
UIUtils.showToast(HomeActivity.this, getResources()
.getString(R.string.err_pwd));
return;
}
Editor ed = sp.edit();
ed.putString("pwd", MD5Utils.md5Encode(pwd));
ed.commit();
dlg.dismiss();
}
});
cancelBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dlg.dismiss();
}
});
dlgBlder.setView(view);
dlg = dlgBlder.show();
}
private void showEnterPwdDlg() {
AlertDialog.Builder dlgBlder = new Builder(HomeActivity.this);
View view = View.inflate(HomeActivity.this,
R.layout.dialog_enter_pwd, null);
pwdEt = (EditText) view.findViewById(R.id.et_pwd);
cfmBtn = (Button) view.findViewById(R.id.btn_confirm);
cancelBtn = (Button) view.findViewById(R.id.btn_cancel);
cfmBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String pwd = pwdEt.getText().toString().trim();
if (TextUtils.isEmpty(pwd)) {
UIUtils.showToast(HomeActivity.this, getResources()
.getString(R.string.err_no_pwd));
return;
}
String savedPwd = sp.getString("pwd", "");
if (savedPwd.equals(MD5Utils.md5Encode(pwd))) {
Intent intent = new Intent(HomeActivity.this,
LostFoundActivity.class);
startActivity(intent);
dlg.dismiss();
} else {
UIUtils.showToast(HomeActivity.this, getResources()
.getString(R.string.err_pwd));
return;
}
}
});
cancelBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dlg.dismiss();
}
});
dlgBlder.setView(view);
dlg = dlgBlder.show();
}
private boolean isPwdSet() {
String pwd = sp.getString("pwd", null);
if (TextUtils.isEmpty(pwd)) {
return false;
} else {
return true;
}
}
}
}
| [
"115637850@qq.com"
] | 115637850@qq.com |
fb176cda64e9995674cb353073b55555f9db7acc | a95fbe4532cd3eb84f63906167f3557eda0e1fa3 | /src/main/java/l2f/gameserver/network/serverpackets/ExMPCCOpen.java | 38a0f36d446e8cbf42419883174e0a8b85a45e97 | [
"MIT"
] | permissive | Kryspo/L2jRamsheart | a20395f7d1f0f3909ae2c30ff181c47302d3b906 | 98c39d754f5aba1806f92acc9e8e63b3b827be49 | refs/heads/master | 2021-04-12T10:34:51.419843 | 2018-03-26T22:41:39 | 2018-03-26T22:41:39 | 126,892,421 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package l2f.gameserver.network.serverpackets;
/**
* Opens the CommandChannel Information window
*/
public class ExMPCCOpen extends L2GameServerPacket
{
public static final L2GameServerPacket STATIC = new ExMPCCOpen();
@Override
protected void writeImpl()
{
writeEx(0x12);
}
} | [
"cristianleon48@gmail.com"
] | cristianleon48@gmail.com |
ed6153e8df47f4bfe07ee030758fd16b874c4ef6 | d01a8435d32082408f07ffa92a998a250f175895 | /ekirana-rest/src/main/java/com/sig/team/webworks/ekirana/crud/entity/AccessRoles.java | b55840dc9a3be7414806335b2d96f694725ee90a | [] | no_license | dinesh6101/sig-rest | 3f46c3adb28ab8a86b60926df020cbafe06ce5ec | 4372d354898319671348a422be3a946efc8277c1 | refs/heads/master | 2016-08-11T11:08:43.527212 | 2016-03-19T11:52:20 | 2016-03-19T11:53:28 | 53,196,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,567 | java | /*
* Created on 18 Oct 2015 ( Time 18:29:34 )
* Generated by Telosys Tools Generator ( version 2.1.0 )
*/
// This Bean has a basic Primary Key (not composite)
package com.sig.team.webworks.ekirana.crud.entity;
import java.io.Serializable;
//import javax.validation.constraints.* ;
//import org.hibernate.validator.constraints.* ;
import javax.persistence.*;
/**
* Persistent class for entity stored in table "access_roles"
*
* @author Telosys Tools Generator
*
*/
@Entity
@Table(name="access_roles")
// Define named queries here
@NamedQueries ( {
@NamedQuery ( name="AccessRoles.countAll", query="SELECT COUNT(x) FROM AccessRoles x" )
} )
public class AccessRoles implements Serializable
{
private static final long serialVersionUID = 1L;
//----------------------------------------------------------------------
// ENTITY PRIMARY KEY ( BASED ON A SINGLE FIELD )
//----------------------------------------------------------------------
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="RoleId", nullable=false)
private Integer roleid ;
//----------------------------------------------------------------------
// ENTITY DATA FIELDS
//----------------------------------------------------------------------
@Column(name="RoleName", nullable=false, length=100)
private String rolename ;
@Column(name="Description", nullable=false, length=100)
private String description ;
//----------------------------------------------------------------------
// ENTITY LINKS ( RELATIONSHIP )
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// CONSTRUCTOR(S)
//----------------------------------------------------------------------
public AccessRoles()
{
super();
}
//----------------------------------------------------------------------
// GETTER & SETTER FOR THE KEY FIELD
//----------------------------------------------------------------------
public void setRoleid( Integer roleid )
{
this.roleid = roleid ;
}
public Integer getRoleid()
{
return this.roleid;
}
//----------------------------------------------------------------------
// GETTERS & SETTERS FOR FIELDS
//----------------------------------------------------------------------
//--- DATABASE MAPPING : RoleName ( VARCHAR )
public void setRolename( String rolename )
{
this.rolename = rolename;
}
public String getRolename()
{
return this.rolename;
}
//--- DATABASE MAPPING : Description ( VARCHAR )
public void setDescription( String description )
{
this.description = description;
}
public String getDescription()
{
return this.description;
}
//----------------------------------------------------------------------
// GETTERS & SETTERS FOR LINKS
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// toString METHOD
//----------------------------------------------------------------------
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("[");
sb.append(roleid);
sb.append("]:");
sb.append(rolename);
sb.append("|");
sb.append(description);
return sb.toString();
}
} | [
"dinesh@spreadItguru.com"
] | dinesh@spreadItguru.com |
d634f0b056a4736c9ad8ea71467ae74d3e10fbf5 | 0e4c00bc90e439b7fbbde78290550efcc2ecd6b9 | /src/arraysMatrices/Actividad29.java | a735269189479954d8b35a020857719762ddf389 | [] | no_license | meskion/Fernandez_de_Heredia_Delgado_Manuel_PROGUT6_I.E.6.1 | 6cff12477e5e9117b4924c159c7f895622234cd3 | 030511f270627adb182217f164540f328fb22d61 | refs/heads/master | 2023-02-23T19:37:52.951405 | 2021-01-18T19:20:20 | 2021-01-18T19:20:20 | 330,606,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package arraysMatrices;
import java.util.Scanner;
import util.Words;
public class Actividad29 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Introducir una cadena de texto:");
String s = scan.nextLine();
System.out.println("Es un NIF Valido? ");
if (Words.isNIF(s)){
//Muestra el dni sin la letra.
System.out.println(s.substring(0, s.length()-1));
} else {
System.out.println("NIF no valido");
}
scan.close();
}
}
| [
"manufdh@hotmail.com"
] | manufdh@hotmail.com |
bf02521c6dff8fe915310f1612e8c9814b58ef10 | f20af063f99487a25b7c70134378c1b3201964bf | /appengine/src/main/java/com/dereekb/gae/server/notification/user/service/UserPushNotificationDeviceService.java | 123bd7f5d4dc2d2afa02843301bdb94d36e74add | [] | no_license | dereekb/appengine | d45ad5c81c77cf3fcca57af1aac91bc73106ccbb | d0869fca8925193d5a9adafd267987b3edbf2048 | refs/heads/master | 2022-12-19T22:59:13.980905 | 2020-01-26T20:10:15 | 2020-01-26T20:10:15 | 165,971,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package com.dereekb.gae.server.notification.user.service;
import com.dereekb.gae.server.datastore.models.keys.ModelKey;
import com.dereekb.gae.server.notification.service.PushNotificationDevice;
/**
* Service for adding/removing devices to/from the push notification service for
* a user.
*
* @author dereekb
*
*/
public interface UserPushNotificationDeviceService {
/**
* Adds a device to the user.
*
* @param userKey
* @param device
* {@link UserPushNotificationDevice}. Never {@code null}.
*/
public void addDevice(ModelKey userKey,
PushNotificationDevice device);
/**
* Removes a device from the user.
*
* @param deviceId
* {@link String}. Never {@code null} or empty.
*/
/*
public void removeDevice(ModelKey user,
String deviceId);
*/
}
| [
"noreply@github.com"
] | dereekb.noreply@github.com |
2967c6fce27e4a5913af337f6ac07fccec95f406 | 44d39ffc76998cf2c157bc1fa19a6989d910c583 | /java/keywords/kw_thisandsuper/ThisDemo.java | bab7fab8550f58317360f78c93e60bcc27dfdea7 | [] | no_license | Faithlmy/java_SE | 1df8645dce9252e6650048ef62574ea1888fdbaa | b9b51b180c34466528bca7b4779ce124e3f81ed6 | refs/heads/master | 2021-06-30T06:03:50.086494 | 2018-08-31T12:11:14 | 2018-08-31T12:11:14 | 107,294,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package kw_thisandsuper;
public class ThisDemo {
public static void main(String[] args) {
Student s = new Student("faith", 18);
System.out.println(s.toString()); // Student[name= null, age= 0]
s.age = 11;
s.name = "g";
myfaith f = new myfaith("dream", 36);
System.out.println(f.toString()); // Student[name= dream, age= 36]
mydream d = new mydream(null);
System.out.println(d.toString());
}
}
class Student {
String name;
int age;
public Student(String name, int age) {
name = name;
age = age;
}
public String toString() {
return "Student[name= " + name + ", "+ "age= " + age + "]";
}
}
class myfaith {
String name;
int age;
public myfaith(String name, int age) {
this.name = name;
this.age = age;
}
public String toString() {
return "Student[name= " + name + ", "+ "age= " + age + "]";
}
}
class mydream{
String name;
int age;
int id;
public mydream() {};
public mydream(String name, int age, int id) {
this.name = name;
this.age = age;
this.id = id;
System.out.println("构造器3已调用");
}
public mydream(String name, int age) {
this(name,age,0);
System.out.println("构造器2已调用");
}
public mydream(String name) {
this(name,0);//参数不足,就使用参数默认值补全
System.out.println("构造器1已调用");
}
@Override
public String toString() {
return "Student [ id=" + id + ", name=" + name + ", age=" + age +"]";
}
}
| [
"lmengyy@126.com"
] | lmengyy@126.com |
aa185fc8caeb24f8ad16f1a3844a953c5ae28ccd | 73a41271001ffde1223df992bd7a4a39b3eaeac9 | /session/src/main/java/com/example/session/tomcat/RequestHelper.java | 511bbdab4a5844cdf1d4275c4e83268c0c76e7a6 | [] | no_license | BigPayno/SpringGuide | 389d8e429c725f7cbb77a2570d21401a7a0ffd2d | b9f51463b5cb1fbf429656df8bbf584ca328e7f5 | refs/heads/master | 2022-12-11T05:21:07.360284 | 2020-06-01T03:39:22 | 2020-06-01T03:39:22 | 222,332,739 | 1 | 0 | null | 2022-06-17T03:30:24 | 2019-11-18T00:32:16 | Java | UTF-8 | Java | false | false | 1,445 | java | package com.example.session.tomcat;
import org.apache.catalina.Session;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.RequestFacade;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Field;
/**
* @author payno
* @date 2019/12/10 09:57
* @description
* 因为Request.getSession总是有Session返回,如果想真实拿到Session必须通过反射
*/
public final class RequestHelper {
private static Request getCurRequest(RequestFacade requestFacade) throws IllegalAccessException{
Field field=ReflectionUtils.findField(RequestFacade.class,"request",Request.class);
field.setAccessible(true);
return (Request) field.get(requestFacade);
}
public static Session getCurSession(RequestFacade requestFacade){
try{
Request request=getCurRequest(requestFacade);
Field field=ReflectionUtils.findField(Request.class,"session");
field.setAccessible(true);
return (Session)field.get(request);
}catch (IllegalAccessException e){
e.printStackTrace();
}
return null;
}
public static void main(String[] args) {
RequestFacade requestFacade=new RequestFacade(new Request(new Connector()));
Session session=getCurSession(requestFacade);
System.out.println(session==null);
}
}
| [
"1361098889@qq.com"
] | 1361098889@qq.com |
fd44cb9d4d72a1c1f3017ebb7582f68022ed83ba | 1dc3d063a4a796810f862bd6288a77a365a271ab | /app/src/main/java/com/example/android/miwok/WordAdapter.java | 7b88b4ae740889e269159b3430dd7add90283171 | [] | no_license | mahmoud-anwer/Miwok | 194242470f748843b73524abcbed5dcbb07a779b | 055498768af7a4332d2c44573d2ceb0005190727 | refs/heads/master | 2020-05-04T23:15:53.099474 | 2019-04-04T15:44:13 | 2019-04-04T15:44:13 | 179,528,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,858 | java | package com.example.android.miwok;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
public class WordAdapter extends ArrayAdapter<Word> {
private int mColorResourceId;
public WordAdapter(Activity context, ArrayList<Word> words, int colorResourceId) {
super(context, 0, words);
mColorResourceId = colorResourceId;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Check if the existing view is being reused, otherwise inflate the view
// inflate means that we create a new item using the list_item layout
View listItemView = convertView;
if (listItemView == null) {
listItemView = LayoutInflater.from(getContext()).inflate(R.layout.list_item, parent, false);
}
final Word currentWord = getItem(position);
/*
String tmp = String.valueOf(currentWord.getImageResourceId());
Toast.makeText(getContext(), tmp, Toast.LENGTH_LONG).show();
*/
int color = ContextCompat.getColor(getContext(), mColorResourceId);
// set the background
View textContainer = listItemView.findViewById(R.id.text_container);
textContainer.setBackgroundColor(color);
ImageView imageView = (ImageView) listItemView.findViewById(R.id.image);
if(currentWord.hasImage()) {
imageView.setImageResource(currentWord.getImageResourceId());
imageView.setVisibility(View.VISIBLE);
}else{
imageView.setVisibility(View.GONE);
}
TextView miwokTextView = (TextView) listItemView.findViewById(R.id.miwok_text_view);
miwokTextView.setText(currentWord.getMiwokTranslation());
TextView defaultTextView = (TextView) listItemView.findViewById(R.id.default_text_view);
defaultTextView.setText(currentWord.getDefaultTranslation());
//textContainer.setBackgroundResource(mColorResourceId);
/*
Button playButton = (Button)listItemView.findViewById(R.id.button_play);
playButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MediaPlayer mediaPlayer= MediaPlayer.create(getContext(),currentWord.getAudioResourceId());
mediaPlayer.start();
}
});
*/
return listItemView;
}
}
| [
"mahmoudanwer071@gmail.com"
] | mahmoudanwer071@gmail.com |
87e0ccfbd0c111cee15ac3923c69499d6776db48 | 4f88477f9d61f9668b390411da10c339f5967c14 | /src/main/java/com/ue/auditmanage/controller/service/BModuleInter.java | 9ed039b98315607233df0736c05030ad759fa915 | [] | no_license | dxcy/ffz | 9e8228402941c9ec46f122636f139918c781d566 | 42207f21faf5070668772d02d8f60dd8d11d22a0 | refs/heads/master | 2021-01-11T00:10:53.177804 | 2016-10-11T06:11:41 | 2016-10-11T06:11:41 | 70,562,822 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 619 | java | package com.ue.auditmanage.controller.service;
import java.io.Serializable;
import java.util.List;
import entity.BModule;
public interface BModuleInter {
public void save(BModule ydData);
public boolean deletUserById(int uid);
public void update(BModule ydData);
public BModule getObject(Class<BModule> cl,Serializable id);
public List<BModule> findAllData(String hql);
public List<BModule> findDataByFenye(String hql, List<?> paras,int page,int rows);
public List<BModule> findData( String hql,String[] paras);
public Long getTotal(String hql,List<Object>paras);
public BModule findByName(String name);
}
| [
"riverplant@hotmail.com"
] | riverplant@hotmail.com |
b0c7dfdc83c3b55467402b2d8809c468b0557eb6 | 71ad829c6baa32cc935d8c99596c59c862231555 | /src/com/rodrigor/rbtree/RBInputReader.java | 2c91b45a4c155badffdcc21157484f5c022e1dbf | [
"Apache-2.0"
] | permissive | rodrigor/RBTree | 5d9d38c7014c9635d0d7742f60bab4c02a125eb4 | a7435ca2df5b269af9e869415ad49f4ac85ca9bf | refs/heads/master | 2021-01-25T05:10:32.237426 | 2017-06-06T13:15:11 | 2017-06-06T13:15:11 | 93,519,486 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 791 | java | package com.rodrigor.rbtree;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.LinkedList;
import java.util.List;
/**
* Read lines from a given file.
* Ignore lines beginning with the "#" character.
*
* @author Rodrigo Rebouças de Almeida (http://github.com/rodrigor)
* @date Jun, 2017
*/
public class RBInputReader {
public static List<String> readFrom(File file) {
LinkedList<String> list = new LinkedList<String>();
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(file));
String line;
while ((line = reader.readLine()) != null) {
if (!line.startsWith("#"))
list.add(line);
}
reader.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
return list;
}
}
| [
"rodrigor@dcx.ufpb.br"
] | rodrigor@dcx.ufpb.br |
11e743f9c66376773c3d7b40501285dfe9e1db49 | d5f09c7b0e954cd20dd613af600afd91b039c48a | /sources/com/coolapk/market/view/search/SuperSearchResultActivity$onCreate$1.java | 2148f43055f169e55eafbefa4f07824a65a0c5c4 | [] | no_license | t0HiiBwn/CoolapkRelease | af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3 | a6a2b03e32cde0e5163016e0078391271a8d33ab | refs/heads/main | 2022-07-29T23:28:35.867734 | 2021-03-26T11:41:18 | 2021-03-26T11:41:18 | 345,290,891 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package com.coolapk.market.view.search;
import kotlin.Metadata;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 4, 2})
/* compiled from: SuperSearchResultActivity.kt */
final class SuperSearchResultActivity$onCreate$1 implements Runnable {
final /* synthetic */ SuperSearchResultActivity this$0;
SuperSearchResultActivity$onCreate$1(SuperSearchResultActivity superSearchResultActivity) {
this.this$0 = superSearchResultActivity;
}
@Override // java.lang.Runnable
public final void run() {
this.this$0.setTabLayoutDoubleClickListener();
}
}
| [
"test@gmail.com"
] | test@gmail.com |
db717d3459e720f80df3718dcd68f1e08dab2734 | 9965baa395873b746ff2dd393a0290ace3d1832d | /src/de/tobchen/util/Rect.java | c489be20bdbe64c59bdb5b5c521bf1f5777793e3 | [] | no_license | tobchen/JumpTobyJump | 47d3c0db756cd8f40dba170a8bf92f4319be4816 | 9b49ec6bad076569a1950ad59df5877c802d20a7 | refs/heads/master | 2020-12-24T19:13:01.943769 | 2016-05-21T08:21:57 | 2016-05-21T08:21:57 | 59,349,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package de.tobchen.util;
public class Rect {
public int x;
public int y;
public int width;
public int height;
public Rect(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
| [
"tobi@tobchen.de"
] | tobi@tobchen.de |
92980640be37ce9d465b398c009e5db6109e631e | c08f2df77713474a5b80e9b392b35c275572c53b | /src/main/java/com/malskyi/project/config/jwt/JWTTokenProvider.java | ca4400e14ffb56f5faae99460d9964d487cf2a5b | [] | no_license | YuriiMalskyi/portfolio | 2eebe94ae56ad51d050499a037991a82c55c4649 | faf9cbde72bd05b6178b66fbf4e6aea66a265c8e | refs/heads/master | 2020-06-17T03:15:25.416061 | 2020-01-27T17:57:15 | 2020-01-27T17:57:15 | 195,777,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,469 | java | package com.malskyi.project.config.jwt;
import static com.malskyi.project.constants.SecurityConstants.EXPIRATION_TIME;
import static com.malskyi.project.constants.SecurityConstants.HEADER_STRING;
import static com.malskyi.project.constants.SecurityConstants.TOKEN_PREFIX;
import static com.malskyi.project.constants.SecurityConstants.TOKEN_SECRET;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component;
import com.malskyi.project.entity.enums.Roles;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
@Component
public class JWTTokenProvider {
@Autowired
private UserDetailsService userDetailsService;
public String createToken(String username, Roles role) {
Claims claims = Jwts.claims().setSubject(username);
claims.put("auth", AuthorityUtils.createAuthorityList(String.valueOf(role)));
Date now = new Date();
Date validity = new Date(now.getTime() + EXPIRATION_TIME);
return Jwts.builder()
.setClaims(claims)
.setIssuedAt(now)
.setExpiration(validity)
.signWith(SignatureAlgorithm.HS256, TOKEN_SECRET)
.compact();
}
public Authentication getAuthentication(String token) {
UserDetails userDetails = userDetailsService.loadUserByUsername(getUsername(token));
return new UsernamePasswordAuthenticationToken(userDetails, "", userDetails.getAuthorities());
}
public String getUsername(String token) {
return Jwts.parser().setSigningKey(TOKEN_SECRET).parseClaimsJws(token).getBody().getSubject();
}
public String resolveToken(HttpServletRequest req) {
String bearerToken = req.getHeader(HEADER_STRING);
if(bearerToken != null && bearerToken.startsWith(TOKEN_PREFIX)) {
return bearerToken.substring(7, bearerToken.length());
}
return null;
}
public boolean validateToken(String token) {
try {
Jwts.parser().setSigningKey(TOKEN_SECRET).parseClaimsJws(token);
return true;
}catch(Exception e) {
e.printStackTrace();
return false;
}
}
}
| [
"yurii.malskyi@gmail.com"
] | yurii.malskyi@gmail.com |
72c96d577aa623f1fc3f225d83db20f257f98d01 | 9a39b98fabdb23805dfa4bb26ef20fec298d0eb4 | /canute-core/src/main/java/me/henry/canutecore/ui/scanner/ScannerDelegate.java | 9116ea653816223c99698cf8f1b3d3fb0672708c | [] | no_license | Henryyyyyyy/Canute | b48113baf4dc491a5bb5a957bcb9d9e0f2ae8f5a | c057e679818844e40331ae1a707e2d7b268a43e4 | refs/heads/master | 2021-01-16T17:49:32.296850 | 2017-09-30T11:18:50 | 2017-09-30T11:18:50 | 100,014,405 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,875 | java | package me.henry.canutecore.ui.scanner;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import me.dm7.barcodescanner.zbar.Result;
import me.dm7.barcodescanner.zbar.ZBarScannerView;
import me.henry.canutecore.delegates.CanuteDelegate;
import me.henry.canutecore.util.callback.CallbackManager;
import me.henry.canutecore.util.callback.CallbackType;
import me.henry.canutecore.util.callback.IGlobalCallback;
public class ScannerDelegate extends CanuteDelegate implements ZBarScannerView.ResultHandler {
private ScanView mScanView = null;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (mScanView == null) {
mScanView = new ScanView(getContext());
}
mScanView.setAutoFocus(true);
mScanView.setResultHandler(this);
}
@Override
public Object setLayout() {
return mScanView;
}
@Override
public void onBindView(@Nullable Bundle savedInstanceState, @NonNull View rootView) {
}
@Override
public void onResume() {
super.onResume();
if (mScanView != null) {
mScanView.startCamera();
}
}
@Override
public void onPause() {
super.onPause();
if (mScanView != null) {
mScanView.stopCameraPreview();
mScanView.stopCamera();
}
}
@Override
public void handleResult(Result result) {
@SuppressWarnings("unchecked")
final IGlobalCallback<String> callback = CallbackManager
.getInstance()
.getCallback(CallbackType.ON_SCAN);
if (callback != null) {
callback.executeCallback(result.getContents());
}
getSupportDelegate().pop();
}
}
| [
"549688959@qq.com"
] | 549688959@qq.com |
04914ef052d90e5a002c72179efb267489b0a7b6 | c1e4263434d0b2021dcd9668f0e8576180fb04c1 | /src/com/pos/libs/ExtendedViewPager.java | d758010398efa5b84342fdf219e210da3f1309a5 | [] | no_license | huyhai/posap8 | 08afdea7c2089501fc70e61c3ef044eb18e95781 | 61545dce7d1b353faff93d21ec755f0f37ce1c23 | refs/heads/master | 2021-01-16T23:10:01.366821 | 2016-10-29T13:40:59 | 2016-10-29T13:40:59 | 72,286,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | package com.pos.libs;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
public class ExtendedViewPager extends ViewPager {
public ExtendedViewPager(Context context) {
super(context);
}
public ExtendedViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
if (v instanceof TouchImageView) {
//
// canScrollHorizontally is not supported for Api < 14. To get around this issue,
// ViewPager is extended and canScrollHorizontallyFroyo, a wrapper around
// canScrollHorizontally supporting Api >= 8, is called.
//
return ((TouchImageView) v).canScrollHorizontallyFroyo(-dx);
} else {
return super.canScroll(v, checkV, dx, x, y);
}
}
}
| [
"tranhuyhai8@gmail.com"
] | tranhuyhai8@gmail.com |
4a18a2b330aad8f25543cf95eb450a4d70df672f | 6da76434512c75a95422024ffa7e6efd08dffb9c | /app/src/main/java/net/jiawa/pullnestedscrollview/widgets/PullNestedScrollView.java | 2979d29b6f7b2ab74d2d6fb53c92a59888e01cf4 | [
"Apache-2.0"
] | permissive | zxixia/PullNestedScrollView | 761650bb131c3e4163fc1924463f397a0d132ff8 | 22d906a5fa55d28918db381fa0e6c236fd4ec8d7 | refs/heads/master | 2021-07-07T12:43:07.969510 | 2017-09-28T05:32:03 | 2017-09-28T05:32:03 | 104,997,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,231 | java | package net.jiawa.pullnestedscrollview.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.TranslateAnimation;
import android.support.v4.widget.NestedScrollView;
import net.jiawa.pullnestedscrollview.R;
/**
* Created by zhaoxin5 on 2017/4/21.
*/
/**
* 改编自
* https://github.com/MarkMjw/PullScrollView
*
* 说明
* 1,onTouchEvent只处理向下滑动
* 2,onScrollChanged处理向上滑动
*/
public class PullNestedScrollView extends NestedScrollView {
private static final String LOG_TAG = "PullNestedScrollView";
/** 阻尼系数,越小阻力就越大. */
private static final float SCROLL_RATIO = 0.5f;
/** 头部view. */
private View mHeader;
/** 头部view显示高度. */
private int mHeaderVisibleHeight;
/** ScrollView的content view. */
private View mContentView;
/**
* ScrollView的content view矩形.
* 记录最开始的坐标
* */
private Rect mContentRect = null;
/**
* 首次点击的Y坐标.
* 当现在是由NestedScrollView本身处理的向上滑动时
* 要时刻更新这个Y坐标
* 避免由onTouchEvent中进行处理时
* 计算y位移差出现较大的偏差
* */
private PointF mStartPoint = new PointF();
/** 是否开始向下移动. */
private boolean mIsMovingDown = false;
/** 头部图片拖动时顶部和底部. */
private int mCurrentTop, mCurrentBottom;
/**
* 保存顶部图片的最原始的left, top, right, bottom
*/
private Rect mHeaderRect = null;
public PullNestedScrollView(Context context) {
super(context);
init(context, null);
}
public PullNestedScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public PullNestedScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
// set scroll mode
setOverScrollMode(OVER_SCROLL_NEVER);
if (null != attrs) {
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PullNestedScrollView);
if (ta != null) {
mHeaderVisibleHeight = (int) ta.getDimension(R.styleable
.PullNestedScrollView_headerVisibleHeight, -1);
ta.recycle();
}
}
}
/**
* 设置Header
*
* @param view
*/
public void setHeader(View view) {
mHeader = view;
}
@Override
protected void onFinishInflate() {
if (getChildCount() > 0) {
mContentView = getChildAt(0);
}
}
@Override
protected void onScrollChanged(int scrollX, int scrollY,
int oldScrollX, int oldScrollY) {
super.onScrollChanged(scrollX, scrollY, oldScrollX, oldScrollY);
final int originalTop = mHeaderRect.top;
final int maxMove = (int) (Math.abs(originalTop) / 0.5f / SCROLL_RATIO);
if (0 <= scrollY && scrollY <= maxMove) {
// 在此范围内
// 上滑ScrollView,会把顶部的图片也滑动上去
/*mHeader.layout(mHeaderRect.left, mHeaderRect.top - scrollY,
mHeaderRect.right, mHeaderRect.bottom - scrollY);*/
/***
*
* 如果使用layout方式,会有一个bug,
* 1,将整个上滑一点
* 2,滑动横向RecyclerView
* 3,然后顶部的header会突变一下,调用log如下
*
*/
mHeader.scrollTo(0, scrollY);
}
}
@Override
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
super.requestDisallowInterceptTouchEvent(disallowIntercept);
}
float mNestedScrollDeltaY = 0;
@Override
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
mNestedScrollDeltaY = 0;
return super.onStartNestedScroll(child, target, nestedScrollAxes);
}
/****
*
* 针对的是内嵌垂直的Nested子View,它会抢占Touch事件,然后通过requestDisallowInterceptTouchEvent
* 阻止当前View进入onInterceptTouchEvent,此时当前View无法响应onTouch
* 只能通过子View将多余的touch量从onNestedScroll传递回来
*
*/
@Override
public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
if (dyUnconsumed < 0 && getScrollY() == 0) {
// 这是往下滑的情形
mNestedScrollDeltaY = mNestedScrollDeltaY + Math.abs(dyUnconsumed);
doMoveDown(mNestedScrollDeltaY);
} else {
if (mNestedScrollDeltaY >0 ) {
/**
* 这是往下滑然后又
* 回滚的情形
*/
mNestedScrollDeltaY = mNestedScrollDeltaY - Math.abs(dyUnconsumed);
doMoveDown(mNestedScrollDeltaY);
} else {
super.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
}
}
}
@Override
public void onStopNestedScroll(View target) {
mNestedScrollDeltaY = 0;
super.onStopNestedScroll(target);
}
/***
*
* 针对的是嵌套横向的NestedView的情形
* 会一直进入当前View的onInterceptTouchEvent,直到满足了拦截条件,
* 拦截,然后进入当前View的onTouch事件
* 同时注意要将mStartPoint的坐标重置,而且只会进一次,
* onInterceptTouchEvent返回true以后,将不会再次进入这个方法
*
*/
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
boolean onInterceptTouchEvent = super.onInterceptTouchEvent(ev);
final float yDiff = ev.getY() - mStartPoint.y;
if(onInterceptTouchEvent && getScrollY() == 0 && yDiff > 0) {
mStartPoint.set(ev.getX(), ev.getY());
}
return onInterceptTouchEvent;
}
/***
* Touch的处理是这样的:
* 1, dispatchTouchEvent
* 2,onInterceptTouchEvent
* 3, onTouchEvent
*
* 肯定首先进入这个dispatchTouchEvent, 在这里记录当前点击位置,
* 因为有可能不进入onTouchEvent的MotionEvent.ACTION_DOWN分支
*
* @param ev
* @return
*/
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
int action = ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
mStartPoint.set(ev.getX(), ev.getY());
if (null == mHeaderRect) {
// 顶部图片最原始的位置信息
mHeaderRect = new Rect();
mHeaderRect.set(mHeader.getLeft(), mHeader.getTop(),
mHeader.getRight(), mHeader.getBottom());
}
// 初始化content view矩形
if (null == mContentRect) {
// 保存正常的布局位置
// 这是最开始的布局位置信息
mContentRect = new Rect();
mContentRect.set(mContentView.getLeft(), mContentView.getTop(),
mContentView.getRight(), mContentView.getBottom());
}
break;
case MotionEvent.ACTION_MOVE:
if (getScrollY() > 0) {
/**
* 修复将ScrollView先上滚一段距离
* 然后下拉图片时,会有突变的情形出现
*/
mStartPoint.set(ev.getX(), ev.getY());
}
break;
case MotionEvent.ACTION_UP:
// 回滚动画
if (isNeedAnimation()) {
rollBackAnimation();
}
mIsMovingDown = false;
break;
}
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (mContentView != null) {
int action = ev.getAction();
switch (action) {
case MotionEvent.ACTION_MOVE:
float deltaY = ev.getY() - mStartPoint.y;
// 确保是纵轴方向
// 向下的滑动
if (deltaY > 0 && getScrollY() == 0) {
mHeader.clearAnimation();
mContentView.clearAnimation();
mIsMovingDown = true;
doMoveDown(ev.getY() - mStartPoint.y);
} else {
if (mIsMovingDown) {
/**
* 用户正在向下滑动
* 然后继续回退准备向上滑动
*
* 要将ImageView和ContentView回退到原始的位置
*/
rollBackAnimation(false);
}
mIsMovingDown = false;
}
break;
}
}
// 禁止控件本身的滑动.
boolean isHandle = mIsMovingDown;
if (!mIsMovingDown) {
try {
isHandle = super.onTouchEvent(ev);
} catch (Exception e) {
Log.w(LOG_TAG, e);
}
}
return isHandle;
}
/**
* 执行移动动画
*
* @param
*/
private void doMoveDown(float deltaY) {
/***
*
* 不要越界
* 最小是0, 最大是顶部图片的高度
*
* deltaY 只能分一半给顶部的imageview的top值
* 同时这个一半还需要乘以一个阻尼系数SCROLL_RATIO
*
* 然后初始的mHeaderRect.top肯定是负的
* 只有将这个mHeaderRect.top从负值变成0
* 才能实现完整的将顶部图片拖出的全过程
*
*/
int maxMove = (int) (Math.abs(mHeaderRect.top) / 0.5f / SCROLL_RATIO);
deltaY = deltaY < 0 ? 0 : (deltaY > maxMove ? maxMove : deltaY);
// 计算header移动距离(手势移动的距离*阻尼系数*0.5)
float headerMoveHeight = deltaY * 0.5f * SCROLL_RATIO;
// 这里的0.5是表明上下各分一半
mCurrentTop = (int) (mHeaderRect.top + headerMoveHeight);
mCurrentBottom = (int) (mHeaderRect.bottom + headerMoveHeight);
// 计算content移动距离(手势移动的距离*阻尼系数)
float contentMoveHeight = deltaY * SCROLL_RATIO;
/***
*
* 刚开始:
*
* --------------- <- mHeaderRect.top,
* | | 顶部图片的原始top位置,
* | invisible | layout_marginTop="-100dp"实现的
* | |
* | |
* phone --------------------------------------------------------------------- <- mContentRect.top,
* | | | | contentView的原始top值
* | | | invisible |
* | visible | | |
* | | | |
* ------------------------------------------------------------------ <- layout_marginTop="100dp"实现的
* | | | visible area |
* | invisible | | of the |
* | | | scrollView |
* | | | |
* --------------- <- mHeaderRect.bottom, | |
* original bottom of the | |
* top image | |
* ---------------------- <- mContentRect.bottom,
* contentView的原始bottom值
* 移动中:
*
* --------------- <- mCurrentTop = mHeaderRect.top + headerMoveHeight,
* | invisible | 当前顶部图片的top位置
* | | 移动了2个单位
* phone ----------------------------------------------------------------------------
* | | ↑
* | visible | 位移了
* | | image visible area 4个单位
* | | becomes enlarge ↓
* ---- ------------------------------ <- top
* | | | |
* | visible | | invisible |
* | | | |
* | | | |
* ------------------------------------------------------------------ <- layout_marginTop="100dp"实现的
* | invisible | | | 这个必须要大于mCurrentBottom
* | | | visible area |
* --------------- <- mCurrentBottom, | of the |
* current bottom of the | scrollView |
* top image view | |
* move down for | |
* 2 | |
* --------------------- <- bottom
*
*
*
* 移动到最下面: mCurrentTop = mHeaderRect.top + headerMoveHeight,
* ↓ 当前顶部图片的top位置,移动了4个单位
* phone ----------------------------------------------------------------------------
* | | |
* | | |
* | | |
* | visible |
* ---- 移动了8个单位
* | | image visible area
* | | becomes enlarge |
* | | |
* | visible | |
* ---- ------------------------------ <- top
* | | | |
* | | | invisible |
* | | | |
* | visible | | |
* ------------------------------------------------------------------ <- layout_marginTop="100dp"实现的
* A | | 这个必须要大于mCurrentBottom
* | | visible area | 不能再往下移动
* mCurrentBottom | of the | 否则,盖不住顶部的图片
* current bottom of the | scrollView |
* top image view | |
* move down for 4 | |
* | |
* --------------------- <- bottom
*
* 从上图可知
* top + layout_marginTop="100dp" <= mCurrentBottom
*
*/
// 修正content移动的距离,避免超过header的底边缘
int headerBottom = mCurrentBottom - mHeaderVisibleHeight;
int top = (int) (mContentRect.top + contentMoveHeight);
int bottom = (int) (mContentRect.bottom + contentMoveHeight);
if (top <= headerBottom) {
// 移动content view
mContentView.layout(mContentRect.left, top, mContentRect.right, bottom);
// 移动header view
mHeader.layout(mHeader.getLeft(), mCurrentTop, mHeader.getRight(), mCurrentBottom);
}
}
private void rollBackAnimation() {
rollBackAnimation(true);
}
private void rollBackAnimation(boolean animate) {
if (animate) {
TranslateAnimation tranAnim = new TranslateAnimation(0, 0,
Math.abs(mHeaderRect.top - mCurrentTop), 0);
tranAnim.setDuration(200);
mHeader.startAnimation(tranAnim);
}
mHeader.layout(mHeaderRect.left, mHeaderRect.top, mHeaderRect.right, mHeaderRect.bottom);
// 开启移动动画
if (animate) {
TranslateAnimation innerAnim = new TranslateAnimation(0, 0, mContentView.getTop(), mContentRect.top);
innerAnim.setDuration(200);
mContentView.startAnimation(innerAnim);
}
mContentView.layout(mContentRect.left, mContentRect.top, mContentRect.right, mContentRect.bottom);
}
/**
* 是否需要开启动画
*/
private boolean isNeedAnimation() {
return !mContentRect.isEmpty() && (mIsMovingDown || mNestedScrollDeltaY > 0) && getScrollY() == 0;
}
}
| [
"xixia@jiawa.net"
] | xixia@jiawa.net |
9e0d2ce2ead0c9d52ce1a996b2728e3a58e38793 | 18153dc6b1e1c53c1690b22961e41c498d03548e | /src/main/java/org/osadev/osa/simapis/modeling/SimulationTimeAPI.java | ea3359090c5d50ad7544b4cd63ef8590c482663d | [] | no_license | osadevs/ooo.simapis.newdes | c78b4e47d27ec4398e6749c864b41f4fea0b1e14 | 9185177e371065b9884a46d110d40299d9926efe | refs/heads/master | 2021-01-10T06:03:31.644117 | 2015-11-28T19:39:14 | 2015-11-28T19:39:14 | 46,410,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,584 | java | /**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<!-- Open Simulation Architecture (OSA) -->
<!-- -->
<!-- This software is distributed under the terms of the -->
<!-- CECILL-C FREE SOFTWARE LICENSE AGREEMENT -->
<!-- (see http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html) -->
<!-- -->
<!-- Copyright © 2006-2015 Université Nice Sophia Antipolis -->
<!-- Contact author: Olivier Dalle (olivier.dalle@unice.fr) -->
<!-- -->
<!-- Parts of this software development were supported and hosted by -->
<!-- INRIA from 2006 to 2015, in the context of the common research -->
<!-- teams of INRIA and I3S, UMR CNRS 7172 (MASCOTTE, COATI, OASIS and -->
<!-- SCALE). -->
<!--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**/
package org.osadev.osa.simapis.modeling;
public interface SimulationTimeAPI<U extends Comparable<U>> {
/**
* Give the current simulation time.
*
* The values are normalized to 64 bits long integers (long type) and
* the internal representation time unit is defined by {@link TimeUnit#INTERN_UNIT}.
*
* @return The current simulation time expressed in units of internal time.
*/
ModelingTimeAPI<U> getSimulationTime();
}
| [
"olivier.dalle@inria.fr"
] | olivier.dalle@inria.fr |
c9bd8f851430e509402b33a7d27349cd749e7a03 | fbc78e5eef0ec352ff501359f47cf3664239d9ea | /Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/workflow/DisassembleAtPcDebuggerBot.java | c4e1b0c782c4a27c070348dfaea33ca682d69138 | [
"Apache-2.0",
"GPL-1.0-or-later",
"GPL-3.0-only",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-only",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | AYIDouble/ghidra | a6b218b823bf475ac010a82840bf99e09dfc14e5 | 3066bc941ce89a66e8dced1f558cc352a6f38fdd | refs/heads/master | 2022-05-27T04:09:13.440867 | 2022-04-30T23:25:27 | 2022-04-30T23:25:27 | 203,525,745 | 20 | 2 | Apache-2.0 | 2019-08-21T07:02:35 | 2019-08-21T06:58:25 | Java | UTF-8 | Java | false | false | 11,496 | java | /* ###
* IP: GHIDRA
*
* 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 ghidra.app.plugin.core.debug.workflow;
import java.util.*;
import java.util.Map.Entry;
import javax.swing.event.ChangeListener;
import com.google.common.collect.Range;
import ghidra.app.cmd.disassemble.DisassembleCommand;
import ghidra.app.plugin.core.debug.service.workflow.*;
import ghidra.app.services.DebuggerBot;
import ghidra.app.services.DebuggerBotInfo;
import ghidra.async.AsyncDebouncer;
import ghidra.async.AsyncTimer;
import ghidra.framework.model.DomainObject;
import ghidra.framework.options.annotation.HelpInfo;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.address.*;
import ghidra.program.model.data.PointerDataType;
import ghidra.program.model.lang.Register;
import ghidra.program.model.util.CodeUnitInsertionException;
import ghidra.trace.model.Trace;
import ghidra.trace.model.Trace.TraceMemoryBytesChangeType;
import ghidra.trace.model.Trace.TraceStackChangeType;
import ghidra.trace.model.TraceAddressSnapRange;
import ghidra.trace.model.listing.*;
import ghidra.trace.model.memory.*;
import ghidra.trace.model.program.TraceProgramView;
import ghidra.trace.model.stack.*;
import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.util.*;
import ghidra.util.*;
import ghidra.util.classfinder.ClassSearcher;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor;
@DebuggerBotInfo( //
description = "Disassemble memory at the program counter", //
details = "Listens for changes in memory or pc (stack or registers) and disassembles", //
help = @HelpInfo(anchor = "disassemble_at_pc"), //
enabledByDefault = true //
)
public class DisassembleAtPcDebuggerBot implements DebuggerBot {
protected class ForDisassemblyTraceListener extends AbstractMultiToolTraceListener {
private final TraceStackManager stackManager;
private final TraceMemoryManager memoryManager;
private final TraceCodeManager codeManager;
private final TraceTimeViewport viewport;
private final Register pc;
private final AddressRange pcRange;
private final Set<DisassemblyInject> injects = new LinkedHashSet<>();
private final ChangeListener injectsChangeListener = e -> updateInjects();
// Offload disassembly evaluation from swing thread
private final Deque<Runnable> runQueue = new LinkedList<>();
private final AsyncDebouncer<Void> runDebouncer =
new AsyncDebouncer<>(AsyncTimer.DEFAULT_TIMER, 100);
public ForDisassemblyTraceListener(Trace trace) {
super(trace);
this.stackManager = trace.getStackManager();
this.memoryManager = trace.getMemoryManager();
this.codeManager = trace.getCodeManager();
this.viewport = trace.getProgramView().getViewport();
this.pc = trace.getBaseLanguage().getProgramCounter();
this.pcRange = TraceRegisterUtils.rangeForRegister(pc);
ClassSearcher.addChangeListener(injectsChangeListener);
updateInjects();
runDebouncer.addListener(this::processQueue);
listenFor(TraceMemoryBytesChangeType.CHANGED, this::valuesChanged);
listenFor(TraceStackChangeType.CHANGED, this::stackChanged);
// Do initial analysis?
}
private void updateInjects() {
synchronized (injects) {
injects.clear();
ClassSearcher.getInstances(DisassemblyInject.class)
.stream()
.filter(i -> i.isApplicable(trace))
.sorted(Comparator.comparing(i -> i.getPriority()))
.forEach(injects::add);
}
}
private void queueRunnable(Runnable r) {
synchronized (runQueue) {
runQueue.add(r);
}
runDebouncer.contact(null);
}
private void processQueue(Void __) {
try {
List<Runnable> copy;
synchronized (runQueue) {
copy = List.copyOf(runQueue);
runQueue.clear();
}
for (Runnable r : copy) {
r.run();
}
}
catch (Throwable e) {
Msg.error(this, "Error processing queue", e);
}
}
private void valuesChanged(TraceAddressSpace space, TraceAddressSnapRange range,
byte[] oldValue, byte[] newValue) {
if (space.getAddressSpace().isRegisterSpace()) {
registersChanged(space, range);
}
else {
memoryChanged(range);
}
}
private void stackChanged(TraceStack stack) {
queueRunnable(() -> {
disassembleStackPcVals(stack, stack.getSnap(), null);
});
}
private long findNonScratchSnap(long snap) {
if (snap >= 0) {
return snap;
}
TraceViewportSpanIterator spit = new TraceViewportSpanIterator(trace, snap);
while (spit.hasNext()) {
Range<Long> span = spit.next();
if (span.upperEndpoint() >= 0) {
return span.upperEndpoint();
}
}
return snap;
}
private void memoryChanged(TraceAddressSnapRange range) {
if (!viewport.containsAnyUpper(range.getLifespan())) {
return;
}
// This is a wonky case, because we care about where the user is looking.
long pcSnap = trace.getProgramView().getSnap();
long memSnap = range.getY1();
queueRunnable(() -> {
for (TraceThread thread : trace.getThreadManager()
.getLiveThreads(findNonScratchSnap(pcSnap))) {
TraceStack stack = stackManager.getLatestStack(thread, pcSnap);
if (stack != null) {
disassembleStackPcVals(stack, memSnap, range.getRange());
}
else {
disassembleRegPcVal(thread, 0, pcSnap, memSnap);
}
}
});
}
private void registersChanged(TraceAddressSpace space, TraceAddressSnapRange range) {
queueRunnable(() -> {
if (space.getFrameLevel() != 0) {
return;
}
if (!range.getRange().intersects(pcRange)) {
return;
}
TraceThread thread = space.getThread();
long snap = range.getY1();
if (stackManager.getLatestStack(thread, snap) != null) {
return;
}
disassembleRegPcVal(thread, space.getFrameLevel(), snap, snap);
});
}
protected void disassembleStackPcVals(TraceStack stack, long memSnap, AddressRange range) {
TraceStackFrame frame = stack.getFrame(0, false);
if (frame == null) {
return;
}
Address pcVal = frame.getProgramCounter();
if (pcVal == null) {
return;
}
if (range == null || range.contains(pcVal)) {
// NOTE: If non-0 frames are ever used, level should be passed in for injects
disassemble(pcVal, stack.getThread(), memSnap);
}
}
protected void disassembleRegPcVal(TraceThread thread, int frameLevel, long pcSnap,
long memSnap) {
TraceData pcUnit = null;
try (UndoableTransaction tid =
UndoableTransaction.start(trace, "Disassemble: PC is code pointer", true)) {
TraceCodeRegisterSpace regCode =
codeManager.getCodeRegisterSpace(thread, frameLevel, true);
try {
pcUnit = regCode.definedData()
.create(Range.atLeast(pcSnap), pc, PointerDataType.dataType);
}
catch (CodeUnitInsertionException e) {
// I guess something's already there. Leave it, then!
// Try to get it, in case it's already a pointer type
pcUnit = regCode.definedData().getForRegister(pcSnap, pc);
}
}
if (pcUnit != null) {
Address pcVal = (Address) TraceRegisterUtils.getValueHackPointer(pcUnit);
if (pcVal != null) {
disassemble(pcVal, thread, memSnap);
}
}
}
protected Long isKnownRWOrEverKnownRO(Address start, long snap) {
Entry<Long, TraceMemoryState> kent = memoryManager.getViewState(snap, start);
if (kent != null && kent.getValue() == TraceMemoryState.KNOWN) {
return kent.getKey();
}
Entry<TraceAddressSnapRange, TraceMemoryState> mrent =
memoryManager.getViewMostRecentStateEntry(snap, start);
if (mrent == null || mrent.getValue() != TraceMemoryState.KNOWN) {
// It has never been known up to this snap
return null;
}
TraceMemoryRegion region =
memoryManager.getRegionContaining(mrent.getKey().getY1(), start);
if (region == null || region.isWrite()) {
// It could have changed this snap, so unknown
return null;
}
return mrent.getKey().getY1();
}
protected void disassemble(Address start, TraceThread thread, long snap) {
Long knownSnap = isKnownRWOrEverKnownRO(start, snap);
if (knownSnap == null) {
return;
}
long ks = knownSnap;
if (codeManager.definedUnits().containsAddress(ks, start)) {
return;
}
/**
* TODO: Is this composition of laziness upon laziness efficient enough?
*
* <p>
* Can experiment with ordering of address-set-view "expression" to optimize early
* termination.
*
* <p>
* Want addresses satisfying {@code known | (readOnly & everKnown)}
*/
AddressSetView readOnly =
memoryManager.getRegionsAddressSetWith(ks, r -> !r.isWrite());
AddressSetView everKnown = memoryManager.getAddressesWithState(Range.atMost(ks),
s -> s == TraceMemoryState.KNOWN);
AddressSetView roEverKnown = new IntersectionAddressSetView(readOnly, everKnown);
AddressSetView known =
memoryManager.getAddressesWithState(ks, s -> s == TraceMemoryState.KNOWN);
AddressSetView disassemblable =
new AddressSet(new UnionAddressSetView(known, roEverKnown));
// TODO: Should I just keep a variable-snap view around?
TraceProgramView view = trace.getFixedProgramView(ks);
DisassembleCommand dis =
new DisassembleCommand(start, disassemblable, true) {
@Override
public boolean applyTo(DomainObject obj, TaskMonitor monitor) {
synchronized (injects) {
try {
if (codeManager.definedUnits().containsAddress(ks, start)) {
return true;
}
for (DisassemblyInject i : injects) {
i.pre(plugin.getTool(), this, view, thread,
new AddressSet(start, start),
disassemblable);
}
boolean result = super.applyTo(obj, monitor);
if (!result) {
Msg.error(this, "Auto-disassembly error: " + getStatusMsg());
return true; // No pop-up errors
}
for (DisassemblyInject i : injects) {
i.post(plugin.getTool(), view, getDisassembledAddressSet());
}
return true;
}
catch (Throwable e) {
Msg.error(this, "Auto-disassembly error: " + e);
return true; // No pop-up errors
}
}
}
};
// TODO: Queue commands so no two for the same trace run concurrently
plugin.getTool().executeBackgroundCommand(dis, view);
}
}
private DebuggerWorkflowServicePlugin plugin;
private final MultiToolTraceListenerManager<ForDisassemblyTraceListener> listeners =
new MultiToolTraceListenerManager<>(ForDisassemblyTraceListener::new);
@Override
public boolean isEnabled() {
return plugin != null;
}
@Override
public void enable(DebuggerWorkflowServicePlugin wp) {
this.plugin = wp;
listeners.enable(wp);
}
@Override
public void disable() {
this.plugin = null;
listeners.disable();
}
@Override
public void traceOpened(PluginTool tool, Trace trace) {
listeners.traceOpened(tool, trace);
}
@Override
public void traceClosed(PluginTool tool, Trace trace) {
listeners.traceClosed(tool, trace);
}
}
| [
"46821332+nsadeveloper789@users.noreply.github.com"
] | 46821332+nsadeveloper789@users.noreply.github.com |
362800d7cd6ebc495499d33f065526d2cac601a4 | b6a66acb9bb6f8b8f4ec1597d716b56447f8cfee | /src/com/javarush/test/level16/lesson13/home10/Solution.java | fb64d3de061c516464fe90d6d9771eec2efefad0 | [] | no_license | Nemo-Illusionist/MyJavaRush | 07644ab650cfc81819a584e4ffb387d3d80ddaea | 11307352cf3fda6ab9badcb7d987fa86ff1520f3 | refs/heads/master | 2020-12-24T08:08:37.134580 | 2016-09-03T08:46:07 | 2016-09-03T08:46:07 | 58,821,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,299 | java | package com.javarush.test.level16.lesson13.home10;
import java.io.*;
import java.util.Scanner;
/* Последовательный вывод файлов
1. Разберись, что делает программа.
2. В статическом блоке считай 2 имени файла firstFileName и secondFileName.
3. Внутри класса Solution создай нить public static ReadFileThread, которая реализует
интерфейс ReadFileInterface (Подумай, что больше подходит - Thread или Runnable).
3.1. Метод setFileName должен устанавливать имя файла, из которого будет читаться содержимое.
3.2. Метод getFileContent должен возвращать содержимое файла.
3.3. В методе run считай содержимое файла, закрой поток. Раздели пробелом строки файла.
4. Подумай, в каком месте нужно подождать окончания работы нити, чтобы обеспечить последовательный вывод файлов.
4.1. Для этого добавь вызов соответствующего метода.
Ожидаемый вывод:
[все тело первого файла]
[все тело второго файла]
*/
public class Solution {
public static String firstFileName;
public static String secondFileName;
static {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
firstFileName = br.readLine();
secondFileName = br.readLine();
}
catch (IOException e) {
}
}
public static void main(String[] args) throws InterruptedException {
systemOutPrintln(firstFileName);
systemOutPrintln(secondFileName);
}
public static void systemOutPrintln(String fileName) throws InterruptedException {
ReadFileInterface f = new ReadFileThread();
f.setFileName(fileName);
f.start();
f.join();
System.out.println(f.getFileContent());
}
public static class ReadFileThread extends Thread implements ReadFileInterface{
private String fullFileName;
private StringBuilder FileContent = new StringBuilder();
@Override
public void setFileName(String fullFileName)
{
this.fullFileName = fullFileName;
}
@Override
public String getFileContent()
{
return FileContent.toString();
}
@Override
public void run()
{
String s;
try {
BufferedReader in = new BufferedReader(new FileReader(this.fullFileName));
while ((s=in.readLine())!=null){
FileContent.append(s);
FileContent.append(" ");
}
in.close();
}
catch (Exception e) {
}
}
}
public static interface ReadFileInterface {
void setFileName(String fullFileName);
String getFileContent();
void join() throws InterruptedException;
void start();
}
}
| [
"illusionist.nemo@gmail.com"
] | illusionist.nemo@gmail.com |
bd4c9420e0aeac5771de24e0d89a39494e32b981 | 0076adea8c02f0b2500ee7e6914ad12dd33ae8e6 | /src/main/java/com/wxservice/framework/report/core/XslExport.java | 22e8dd743cb7e1638604fcc01916d52a10220f9e | [] | no_license | 116518135/Wxservice | 14ea7ccee1cc1e1aff499083eddb142aef0108ca | d102528f41d2c530285742174c5f5671291bc905 | refs/heads/master | 2021-01-20T06:27:43.349090 | 2015-06-24T23:51:34 | 2015-06-24T23:51:34 | 37,895,352 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,518 | java | package com.wxservice.framework.report.core;
import java.io.File;
import java.io.IOException;
import jxl.write.WritableImage;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import org.springframework.util.ReflectionUtils;
import com.wxservice.framework.report.base.ReportConfig;
import com.wxservice.framework.report.base.ReportPrint;
import com.wxservice.framework.report.base.ReportRequest;
import com.wxservice.framework.report.exception.ExportException;
import com.wxservice.framework.report.exception.FillException;
import com.wxservice.framework.util.SysFinal;
public class XslExport extends XslProcessor {
public Object export(ReportRequest ctx) throws ExportException {
try {
ReportConfig rc = ctx.getRc();
FillService fs = new FillService(ctx);
ReportPrint rp = fs.fillReport();
// this.saveRc(rp, rc, ctx.getContext().getForm(),
// ctx.getContext().getRequest());
WritableWorkbook workbook = this.getWorkbook(ctx);
WritableSheet s = workbook.createSheet("报表数据", 0);
ctx.setWorkbook(workbook);
printHeader(s, rp);
printPageHeader(rp, ctx);
printDetail(rp, ctx);
int idx = printFooter(rp, ctx);
ctx.getWorkbook().write();
ctx.getWorkbook().close();
rp = null;
byte[] buffer = zip(ctx);
return buffer;
} catch (FillException e) {
ReflectionUtils.handleReflectionException(e);
throw new ExportException(e.getError());
} catch (Exception e) {
ReflectionUtils.handleReflectionException(e);
throw new ExportException(e.getMessage());
}
}
public Object cache(ReportRequest ctx) throws ExportException {
try {
System.out.println(34235423);
ReportConfig rc = ctx.getRc();
ReportPrint rp = this.loadRc(rc, ctx.getContext().getForm(), ctx
.getContext().getRequest());
WritableWorkbook workbook = this.getWorkbook(ctx);
WritableSheet s = workbook.createSheet("报表数据", 0);
ctx.setWorkbook(workbook);
printHeader(s, rp);
printPageHeader(rp, ctx);
printDetail(rp, ctx);
int idx = printFooter(rp, ctx);
ctx.getWorkbook().write();
ctx.getWorkbook().close();
rp = null;
byte[] buffer = zip(ctx);
return buffer;
} catch (FillException e) {
ReflectionUtils.handleReflectionException(e);
throw new ExportException(e.getError());
} catch (Exception e) {
ReflectionUtils.handleReflectionException(e);
throw new ExportException(e.getMessage());
}
}
}
| [
"116518135@qq.com"
] | 116518135@qq.com |
a77adc4787d1ad6ab03eada5b4d0b20b93f75b5d | d5a847e82746a395d80019b3e63f9899e85ac89b | /spring-event-sourcing/src/main/java/org/uniknow/spring/eventStore/ListEventStream.java | 1291c03d733c31f41d8ef7992ad7339c69ddef8b | [] | no_license | UniKnow/AgileDev | 69a68fe9429b0ba644c4687781e994a8786550d4 | 87c2bc953621a403c8faae926ac4cc003c697759 | refs/heads/develop | 2020-05-21T15:06:52.210006 | 2017-06-13T06:31:39 | 2017-06-13T06:31:39 | 21,005,837 | 7 | 10 | null | 2017-03-01T12:10:23 | 2014-06-19T15:39:30 | Java | UTF-8 | Java | false | false | 3,007 | java | /**
* Copyright (C) 2014 uniknow. All rights reserved.
*
* This Java class is subject of the following restrictions:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by uniknow." Alternately, this acknowledgment may appear in the
* software itself, if and wherever such third-party acknowledgments normally
* appear.
*
* 4. The name ''uniknow'' must not be used to endorse or promote products
* derived from this software without prior written permission.
*
* 5. Products derived from this software may not be called ''UniKnow'', nor may
* ''uniknow'' appear in their name, without prior written permission of
* uniknow.
*
* THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WWS OR ITS
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.uniknow.spring.eventStore;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class ListEventStream<E extends Event> implements EventStream<Long, E> {
private final long version;
private final List<E> events;
public ListEventStream() {
this.version = 0;
events = Collections.emptyList();
}
public ListEventStream(long version, List<E> events) {
this.version = version;
this.events = events;
}
public ListEventStream append(List<E> newEvents) {
List<E> events = new LinkedList<>(this.events);
events.addAll(newEvents);
return new ListEventStream(version + 1,
Collections.unmodifiableList(events));
}
@Override
public Iterator<E> iterator() {
return new EventStreamIterator(events);
// return events.iterator();
}
@Override
public Long version() {
return version;
}
} | [
"mark.schenk@tomtom.com"
] | mark.schenk@tomtom.com |
cb27753205ac8463c93e19db052a5c75e8f48f65 | aa6997aba1475b414c1688c9acb482ebf06511d9 | /src/javax/swing/table/TableStringConverter.java | 9a62324ffea2079caa7038d542aa5841abae0fdb | [] | no_license | yueny/JDKSource1.8 | eefb5bc88b80ae065db4bc63ac4697bd83f1383e | b88b99265ecf7a98777dd23bccaaff8846baaa98 | refs/heads/master | 2021-06-28T00:47:52.426412 | 2020-12-17T13:34:40 | 2020-12-17T13:34:40 | 196,523,101 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.swing.table;
/**
* TableStringConverter is used to convert objects from the model into
* strings. This is useful in filtering and searching when the model returns
* objects that do not have meaningful <code>toString</code> implementations.
*
* @since 1.6
*/
public abstract class TableStringConverter {
/**
* Returns the string representation of the value at the specified
* location.
*
* @param model the <code>TableModel</code> to fetch the value from
* @param row the row the string is being requested for
* @param column the column the string is being requested for
* @return the string representation. This should never return null.
* @throws NullPointerException if <code>model</code> is null
* @throws IndexOutOfBoundsException if the arguments are outside the bounds of the model
*/
public abstract String toString(TableModel model, int row, int column);
}
| [
"yueny09@163.com"
] | yueny09@163.com |
666728900c552333bae7d4e7ac92d2371fe89edb | 4e883ef26cf8197f960aff201a4b64c9ce068fb3 | /cxs-extension/src/main/java/com/cxs/extension/ath/controller/SubSystemController.java | fbf909a3a236f4597a195f92bd0dfb879bc200de | [] | no_license | wjcac/ykqProject | ad4301882588116f0f2493e375f8f6ae903b679f | a9335e38bad4d7782341a0f3ae1272573598a8fe | refs/heads/master | 2021-09-06T08:31:56.067598 | 2018-02-04T10:06:40 | 2018-02-04T10:06:40 | 119,955,789 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,655 | java | package com.cxs.extension.ath.controller;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cxs.extension.ath.dto.SubSystemDto;
import com.cxs.extension.ath.result.ResourceResult;
import com.cxs.extension.ath.service.api.SubSystemService;
import com.cxs.framework.dto.PageDto;
import com.cxs.framework.dto.ResultDo;
/**
*
* @Description: 子系统控制器
* @ClassName: SubSystemController
* @author: ryan.guo
* @email: chinazan@qq.com
* @date: 2017年05月25日
*/
@Controller
@RequestMapping("/ath")
public class SubSystemController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SubSystemService subSystemService;
/*保存子系统*/
@RequestMapping(value = "/saveSubSystem")
@ResponseBody
public ResultDo<SubSystemDto> saveSubSystem(SubSystemDto subSystemDto, HttpServletRequest request){
return subSystemService.saveSubSystem(subSystemDto);
}
/*删除子系统*/
@RequestMapping(value = "/deleteSubSystem")
@ResponseBody
public ResultDo<String> deleteSubSystemById(String id){
return subSystemService.deleteSubSystemById(id);
}
/*删除子系统*/
@RequestMapping(value = "/deleteAllSubSystem")
@ResponseBody
public ResultDo<String []> deleteAllSubSystem(String [] ids,HttpServletRequest request){
ResultDo<String []> resultDo = new ResultDo<String []>();
try {
resultDo = subSystemService.deleteSubSystemByIds(ids);
} catch (Exception e) {
resultDo.setResultDo(ResourceResult.DELETE_BY_IDS_FAILURE);
logger.error(ResourceResult.DELETE_BY_IDS_FAILURE.getValue(), e);
}
return resultDo;
}
/*更新子系统*/
@RequestMapping(value = "/updateSubSystem")
@ResponseBody
public ResultDo<SubSystemDto> updateSubSystem(SubSystemDto subSystemDto){
return subSystemService.updateSubSystem(subSystemDto);
}
/*显示子系统详情*/
@RequestMapping("/viewSubSystem")
@ResponseBody
public ResultDo<SubSystemDto> viewSubSystem(String id){
logger.info("subSystemId:"+id);
return subSystemService.findSubSystemById(id);
}
/*查询子系统*/
@RequestMapping("/findSubSystem")
@ResponseBody
public ResultDo<PageDto<SubSystemDto>> findSubSystem(PageDto<SubSystemDto> pageDto, SubSystemDto subSystemDto){
return subSystemService.findSubSystem(pageDto, subSystemDto);
}
}
| [
"1137320988@qq.com"
] | 1137320988@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.