blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ad2e083d91ee496d828ca941430dc72c1b002fd7 | 83736cb0042e0338f82ad1d1e0592346c98edb05 | /src/main/java/com/hht/controller/JobController.java | e758a79a6233183243f93dd195e57887b3e6ba51 | [] | no_license | jyn66/cluster-quartz | cc90d8ae2535d899f62435691f95922d9ed76a5f | 705b3245263a6535e82909f3acee90ced28173e9 | refs/heads/master | 2020-06-07T18:50:47.034547 | 2019-01-07T03:19:33 | 2019-01-07T03:19:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,723 | java | /**
* Project Name:cluster-quartz
* File Name:JobController.java
* Package Name:com.hht.controller
* Date:2018年11月29日
* Copyright (c) 2018 深圳市鸿合创新信息技术 Inc.All Rights Reserved.
*/
package com.hht.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.hht.service.JobService;
/**
* @author zhangguokang
*
* @description
*/
@RestController
@RequestMapping("/quartztest")
public class JobController {
@Autowired
private JobService jobService;
/**
* 创建cron任务
* @param jobName
* @param jobGroup
* @return
*/
@RequestMapping(value = "/cron",method = RequestMethod.POST)
public String startCronJob(@RequestParam("jobName") String jobName, @RequestParam("jobGroup") String jobGroup){
jobService.addCronJob(jobName,jobGroup);
return "create cron task success";
}
/**
* 创建异步任务
* @param jobName
* @param jobGroup
* @return
*/
@RequestMapping(value = "/async",method = RequestMethod.POST)
public String startAsyncJob(@RequestParam("jobName") String jobName, @RequestParam("jobGroup") String jobGroup){
jobService.addAsyncJob(jobName,jobGroup);
return "create async task success";
}
/**
* 暂停任务
* @param jobName
* @param jobGroup
* @return
*/
@RequestMapping(value = "/pause",method = RequestMethod.POST)
public String pauseJob(@RequestParam("jobName") String jobName, @RequestParam("jobGroup") String jobGroup){
jobService.pauseJob(jobName,jobGroup);
return "pause job success";
}
/**
* 恢复任务
* @param jobName
* @param jobGroup
* @return
*/
@RequestMapping(value = "/resume",method = RequestMethod.POST)
public String resumeJob(@RequestParam("jobName") String jobName, @RequestParam("jobGroup") String jobGroup){
jobService.resumeJob(jobName,jobGroup);
return "resume job success";
}
/**
* 删除务
* @param jobName
* @param jobGroup
* @return
*/
@RequestMapping(value = "/delete",method = RequestMethod.PUT)
public String deleteJob(@RequestParam("jobName") String jobName, @RequestParam("jobGroup") String jobGroup){
jobService.deleteJob(jobName,jobGroup);
return "delete job success";
}
}
| [
"1030403684@qq.com"
] | 1030403684@qq.com |
e338e040e9e29fcad9022dd9a1c7ba3bfea328ce | ba41ba7a6866a7eb9b35e82d476fa69b4a9472cc | /src/main/java/de/bayern/gdi/gui/AtomItemModel.java | 779a457ee3f499801078a333dae6b0ca8664c077 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Michael-81/downloadclient | 6239e18c8d1acd0e2db25f151513cded4aeed120 | b17e424fd39e444e1602cd7f4fd41555d5fc9bb8 | refs/heads/master | 2021-01-18T11:15:44.825183 | 2016-06-10T16:31:19 | 2016-06-10T16:31:19 | 61,027,050 | 1 | 0 | null | 2016-06-13T10:22:25 | 2016-06-13T10:22:25 | null | UTF-8 | Java | false | false | 1,205 | java | /*
* DownloadClient Geodateninfrastruktur Bayern
*
* (c) 2016 GSt. GDI-BY (gdi.bayern.de)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.bayern.gdi.gui;
import de.bayern.gdi.services.Atom;
/**
* Wrapper for Atom service items.
*/
public class AtomItemModel implements ItemModel {
private Atom.Item item;
/**
* Construct the wrapper.
* @param i the wrapped item
*/
public AtomItemModel(Atom.Item i) {
this.item = i;
}
public Object getItem() {
return this.item;
}
public String getDataset() {
return item.id;
}
@Override
public String toString() {
return this.item.title;
}
}
| [
"raimund.renkert@intevation.de"
] | raimund.renkert@intevation.de |
8197ca54f526c7fd3f113d6ec66d2702d0555855 | 560fd932091371768628b5744e35ad6686e022c4 | /src/main/java/com/genericrest/service/Impl/ItensVendaRestService.java | 12b5e094109dfa40910b4d7cae2d786d12aeb4fb | [] | no_license | marcelogaldino/Comercial | 5d4fd42b5cdce1dc2f6a1d9848278cb16f6e60f6 | 994c360ceb16100d596dc4b656b768de72271aa2 | refs/heads/master | 2021-07-07T15:39:00.668900 | 2017-09-29T03:32:15 | 2017-09-29T03:32:15 | 105,225,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java | package com.genericrest.service.Impl;
import com.genericrest.dao.DAO;
import com.genericrest.model.ItensVenda;
import com.genericrest.service.GenericCRUDRestService;
import java.util.List;
import javax.annotation.ManagedBean;
import javax.inject.Inject;
import javax.ws.rs.Path;
import javax.ws.rs.core.GenericEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.genericrest.dao.ItensVendaDAO;
import com.genericrest.service.ProdutoService;
/**
*
* @author marcelo
*/
@ManagedBean
@Path("/ItensVenda")
public class ItensVendaRestService extends GenericCRUDRestService<ItensVenda> implements ProdutoService{
private static final Logger LOG = LoggerFactory.getLogger(ItensVendaRestService.class);
@Inject
private ItensVendaDAO itensVendaDAO;
public ItensVendaRestService() {
super(ItensVenda.class);
}
@Override
public GenericEntity listToGenericEntity(List<ItensVenda> list) {
return new GenericEntity<List<ItensVenda>>(list){};
}
@Override
public DAO getDao() {
return itensVendaDAO;
}
@Override
public Logger getLogger() {
return LOG;
}
}
| [
"marcelinhomgo@gmail.com"
] | marcelinhomgo@gmail.com |
ff7aa26c2daa3c2b5fc532ee5845970b5645522e | 43210b4de0598ee643b6ad74d4dcbb086b3d4935 | /src/test/java/lab/zlren/leetcode/test/hashmaphashcode/Main.java | 976adcda8e36bd0841fe2858db1cf7f4694eb4bb | [] | no_license | zlren/algorithm | d4ea99df82cff1bee7c268ed1f73a3c69c8da9be | 3c915a08351f421fd3bd2005bd22bf2453874cba | refs/heads/master | 2021-09-13T17:25:20.246245 | 2018-05-02T14:38:38 | 2018-05-02T14:38:38 | 105,986,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package lab.zlren.leetcode.test.hashmaphashcode;
/**
* @author zlren
* @date 2018-04-12
*/
public class Main {
public static void main(String[] args) {
boolean interrupted = Thread.interrupted();
}
private static class MyThread extends Thread {
@Override
public void run() {
System.out.println("哈哈");
}
}
}
| [
"zlren2012@163.com"
] | zlren2012@163.com |
d6e22d9c2bad87aef36ed8dfc0f2aa1544ebd807 | 399bfc9db2204949c501b33e90da9e8a712f0541 | /src/DBConn.java | 4eaabf7ca02d1e3857bb4713db1ce712db63028e | [] | no_license | unstad/Databaseprosjekt | ebcd9f977e807da28a28acccd4129cbd9e43141a | 043034210959dac7200515cdacbe343f4e28e58f | refs/heads/master | 2021-01-10T02:06:35.708113 | 2016-03-17T11:30:42 | 2016-03-17T11:30:42 | 53,501,451 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 814 | java |
import java.sql.*;
import java.util.Properties;
public abstract class DBConn {
protected Connection conn;
public DBConn () {
}
public void connect() {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
// Properties for user and password.
Properties p = new Properties();
p.put("user", "root");
p.put("password", "datdat");
// conn = DriverManager.getConnection("jdbc:mysql://mysql.ansatt.ntnu.no/sveinbra_ektdb?autoReconnect=true&useSSL=false",p);
conn = DriverManager.getConnection("jdbc:mysql://mysql.stud.ntnu.no/aashilb_treningsdagbok?autoReconnect=true&useSSL=false",p);
} catch (Exception e)
{
throw new RuntimeException("Unable to connect", e);
}
}
}
| [
"galinavj@stud.ntnu.no"
] | galinavj@stud.ntnu.no |
4b0533f01af97d4447e8dbbca55a72752a42315b | 789a2a6ca5962f78bf5d4e8c0361a20d55071be2 | /app/src/main/java/com/example/param/emall/productdetail.java | baf1cdeb9d754933b7d673010bcc803baa785c74 | [] | no_license | parammoradiya/EMALL | 17db175f1fab67539d67b2687e86efc54c630f1a | 1dff6eb25c9e7dd453a73f734bde800c9e53ea08 | refs/heads/master | 2020-05-03T09:38:43.277663 | 2019-08-10T05:41:35 | 2019-08-10T05:41:35 | 178,133,122 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 508 | java | package com.example.param.emall;
public class productdetail {
String P_code,P_name;
productdetail(){
}
public productdetail(String p_code, String p_name) {
P_code = p_code;
P_name = p_name;
}
public String getP_code() {
return P_code;
}
public void setP_code(String p_code) {
P_code = p_code;
}
public String getP_name() {
return P_name;
}
public void setP_name(String p_name) {
P_name = p_name;
}
}
| [
"parammoradiya98@gmail.com"
] | parammoradiya98@gmail.com |
d3433c458af9853bfcbdc9cf2719a0f026a91c75 | bdb451f5aefbc9845f142e7185d2640975eb6120 | /src/main/java/offer2/p080/Solution.java | 726c57382cee4808aaeca367d224f9ad03e011e0 | [] | no_license | scheshan/leetcode | e674b898f90b45a7af40e28ceab977dc24c169aa | 30e5ed1aad4af78a0d2212869d8b457bdb80509c | refs/heads/master | 2023-04-15T03:40:35.019743 | 2023-03-27T03:16:24 | 2023-03-27T03:16:24 | 244,325,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 874 | java | package offer2.p080;
import java.util.ArrayList;
import java.util.List;
/**
* Solution
*
* @author heshan
* @date 2023/1/27
*/
public class Solution {
public List<List<Integer>> combine(int n, int k) {
List<List<Integer>> res = new ArrayList<>();
ArrayList<Integer> path = new ArrayList<>(k);
for (int i = 1; i <= n; i++) {
path.add(i);
perm(n, k, i, path, res);
path.remove(path.size() - 1);
}
return res;
}
private void perm(int n, int k, int cur, ArrayList<Integer> path, List<List<Integer>> res) {
if (path.size() == k) {
res.add(new ArrayList<>(path));
return;
}
for (int i = cur + 1; i <= n; i++) {
path.add(i);
perm(n, k, i, path, res);
path.remove(path.size() - 1);
}
}
}
| [
"5373827@qq.com"
] | 5373827@qq.com |
35f3cedcbd9dd2ff8c6afff1ea3925260e4ec57d | 7d0a32492078a8f96c9406c817dd2a0401c1b99f | /OBL/src/GUI/LibrarianSearchBookGUI.java | 6990cc19deeb11da51af7e4b2f9480e9d7cc7b9c | [] | no_license | lior203/obl-12 | 35e876bf4e0ef60b7ef8264ec24843557ee8b056 | 402486246136766b37bf323d06cd71b5c5ba55c6 | refs/heads/master | 2020-04-14T16:23:07.594011 | 2019-01-28T20:05:43 | 2019-01-28T20:05:43 | 163,950,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,233 | java | package GUI;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
import Common.BookPro;
import Common.GuiInterface;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Modality;
import javafx.stage.Stage;
import logic.Main;
import logic.SearchBookController;
public class LibrarianSearchBookGUI implements GuiInterface, Initializable{
@FXML
private RadioButton radio_btn_copy_id;
@FXML
private ToggleGroup group;
@FXML
private TextField txtCopy_ID;
@FXML
private RadioButton radio_btn_book_name;
@FXML
private TextField txtBook_Name;
@FXML
private RadioButton radio_btn_authors_name;
@FXML
private TextField txtAuthor_name;
@FXML
private RadioButton radio_btn_book_theme;
@FXML
private TextField txtBook_Theme;
@FXML
private RadioButton radio_btn_free_text;
@FXML
private TextField txtFree_Text;
@FXML
void SearchBook(ActionEvent event) {
String searchPick;
if (group.getSelectedToggle().equals(radio_btn_book_name))
{
searchPick = "Book Name";
SearchBookController.searchBook(searchPick,txtBook_Name.getText());
}
else if (group.getSelectedToggle().equals(radio_btn_authors_name))
{
searchPick = "Authors Name";
SearchBookController.searchBook(searchPick,txtAuthor_name.getText());
}
else if (group.getSelectedToggle().equals(radio_btn_book_theme))
{
searchPick = "Book Theme";
SearchBookController.searchBook(searchPick,txtBook_Theme.getText());
}
else if (group.getSelectedToggle().equals(radio_btn_free_text))
{
searchPick = "Free text";
SearchBookController.searchBook(searchPick, txtFree_Text.getText());
}
else if (group.getSelectedToggle().equals(radio_btn_copy_id))
{
searchPick = "Copy ID";
SearchBookController.searchBook(searchPick, txtCopy_ID.getText());
}
}
@FXML
void openAndCloseFields(ActionEvent event)
{
if (group.getSelectedToggle().equals(radio_btn_book_name))
{
freshStart();
txtBook_Name.setDisable(false);
txtAuthor_name.setDisable(true);
txtBook_Theme.setDisable(true);
txtFree_Text.setDisable(true);
txtCopy_ID.setDisable(true);
}
if(group.getSelectedToggle().equals(radio_btn_authors_name))
{
freshStart();
txtAuthor_name.setDisable(false);
txtBook_Name.setDisable(true);
txtBook_Theme.setDisable(true);
txtFree_Text.setDisable(true);
txtCopy_ID.setDisable(true);
}
if(group.getSelectedToggle().equals(radio_btn_book_theme))
{
freshStart();
txtBook_Theme.setDisable(false);
txtAuthor_name.setDisable(true);
txtBook_Name.setDisable(true);
txtFree_Text.setDisable(true);
txtCopy_ID.setDisable(true);
}
if(group.getSelectedToggle().equals(radio_btn_free_text))
{
freshStart();
txtFree_Text.setDisable(false);
txtBook_Theme.setDisable(true);
txtAuthor_name.setDisable(true);
txtBook_Name.setDisable(true);
txtCopy_ID.setDisable(true);
}
if(group.getSelectedToggle().equals(radio_btn_copy_id))
{
freshStart();
txtCopy_ID.setDisable(false);
txtFree_Text.setDisable(true);
txtBook_Theme.setDisable(true);
txtAuthor_name.setDisable(true);
txtBook_Name.setDisable(true);
}
}
@Override
public void showSuccess(String string) {
// TODO Auto-generated method stub
}
@Override
public void display(Object obj) {
ArrayList<String> datalist = (ArrayList<String>)obj;
int numberOfBook = (datalist.size()-4)/8;
int i = 0;
int j = 0;
Label searchLab = new Label("Search book result");
Stage primaryStage = new Stage();
VBox root = new VBox(20);
ObservableList<BookPro> bookList = FXCollections.observableArrayList();
TableView<BookPro> table = new TableView<BookPro>();
TableColumn<BookPro, String> bookNameCol = new TableColumn<>("Book name");
TableColumn<BookPro, String> authorNameCol = new TableColumn<>("Author name");
TableColumn<BookPro, String> bookGenreCol = new TableColumn<>("Book genre");
TableColumn<BookPro, String> descriptionCol = new TableColumn<>("Description");
TableColumn<BookPro, String> bookIDCol = new TableColumn<>("Book ID");
TableColumn<BookPro, String> numberOfCopiesCol = new TableColumn<>("Number of copies");
TableColumn<BookPro, String> wantedCol = new TableColumn<>("Is wanted");
TableColumn<BookPro, String> shelfLocationCol = new TableColumn<>("Shelf location");
primaryStage.initModality(Modality.APPLICATION_MODAL);
table.getColumns().addAll(bookIDCol,bookNameCol,authorNameCol,bookGenreCol,descriptionCol,numberOfCopiesCol,wantedCol,shelfLocationCol);
table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
numberOfCopiesCol.setMinWidth(40);
bookNameCol.setCellValueFactory(cellData -> cellData.getValue().getBookName());
authorNameCol.setCellValueFactory(cellData -> cellData.getValue().getAuthorName());
bookGenreCol.setCellValueFactory(cellData-> cellData.getValue().getBookGenre());
descriptionCol.setCellValueFactory(cellData -> cellData.getValue().getDescription());
bookIDCol.setCellValueFactory(cellData -> cellData.getValue().getBookID());
numberOfCopiesCol.setCellValueFactory(cellData -> cellData.getValue().getNumberOfCopies());
wantedCol.setCellValueFactory(cellData -> cellData.getValue().getWanted());
shelfLocationCol.setCellValueFactory(cellData -> cellData.getValue().getShelfLocation());
while(i<numberOfBook)
{
BookPro newBook = new BookPro(datalist.get(j+4), datalist.get(j+5),datalist.get(j+6),datalist.get(j+7),datalist.get(j+8),datalist.get(j+10),datalist.get(j+11),datalist.get(j+9));
bookList.add(newBook);
i++;
j+=8;
}
System.out.println(obj);
table.setItems(bookList);
root.getChildren().addAll(searchLab,table);
searchLab.setFont(new Font(20));
searchLab.setStyle("-fx-font-weight: bold");
searchLab.setPrefWidth(180);
searchLab.setPrefHeight(35);
primaryStage.setTitle("Search book result");
root.setAlignment(Pos.CENTER);
root.setPrefWidth(800);
root.setPrefHeight(400);
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.showAndWait();
}
@Override
public void showFailed(String message) {
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Message");
alert.setHeaderText("No matches results to your search");
alert.showAndWait();
}
@Override
public void freshStart() {
txtCopy_ID.clear();
txtBook_Name.clear();
txtAuthor_name.clear();
txtBook_Theme.clear();
txtFree_Text.clear();
}
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
Main.client.clientUI = this;
}
} | [
"46168838+idan9532@users.noreply.github.com"
] | 46168838+idan9532@users.noreply.github.com |
432d5ace999f67238cb9f1b6116ee9ba8da94f49 | 7050d1a197670e6b7a4c58d3e20f91db082a3fe6 | /src/main/java/app/Main.java | 4248a9198ab46a4a9ad235fc84ce0b7b3656f982 | [] | no_license | UralovAbdulhay/StudyCenterProject | daae3781b6ffe8b1896f717da7a039ceee27704c | b9f2202a95be4396213992ecc091f7ef5b6faa3d | refs/heads/master | 2023-06-03T02:12:14.509212 | 2021-06-23T05:44:24 | 2021-06-23T05:44:24 | 379,492,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 837 | java | package app;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/view/dashboard.fxml"));
Parent parent = loader.load();
stage.setTitle("Study Center");
Scene scene = new Scene(parent);
stage.setScene(scene);
stage.setMaximized(true);
stage.setOnCloseRequest(e -> {
Platform.exit();
System.exit(0);
});
stage.show();
}
}
| [
"abdulhayuralov8185603@gmail.com"
] | abdulhayuralov8185603@gmail.com |
afccb690c70afaa111d6584216c85149dab5ddfc | 11b9a30ada6672f428c8292937dec7ce9f35c71b | /src/main/java/com/sun/source/tree/ParameterizedTypeTree.java | 084d94c70df5124b2d7b4ccfbdda0cbae9b77653 | [] | no_license | bogle-zhao/jdk8 | 5b0a3978526723b3952a0c5d7221a3686039910b | 8a66f021a824acfb48962721a20d27553523350d | refs/heads/master | 2022-12-13T10:44:17.426522 | 2020-09-27T13:37:00 | 2020-09-27T13:37:00 | 299,039,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 922 | java | /***** Lobxxx Translate Finished ******/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.source.tree;
import java.util.List;
/**
* A tree node for a type expression involving type parameters.
*
* For example:
* <pre>
* <em>type</em> < <em>typeArguments</em> >
* </pre>
*
* @jls section 4.5.1
*
* <p>
* 涉及类型参数的类型表达式的树节点。
*
* 例如:
* <pre>
* <em>键入<em> </em> <em> typeArguments </em>>
*
* @author Peter von der Ahé
* @author Jonathan Gibbons
* @since 1.6
*/
@jdk.Exported
public interface ParameterizedTypeTree extends Tree {
Tree getType();
List<? extends Tree> getTypeArguments();
}
| [
"zhaobo@MacBook-Pro.local"
] | zhaobo@MacBook-Pro.local |
867d4ace57c5ce5df53550d40a4527caaccd32d2 | 5ec8ce07ca8bdc56a1c7bbaca306a32a8876108a | /shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-api/src/test/java/org/apache/shardingsphere/sharding/factory/KeyGenerateAlgorithmFactoryTest.java | 79c65fcb51c9fa549b0503f0607d607b8faf86b0 | [
"Apache-2.0"
] | permissive | wornxiao/shardingsphere | c2c5b0c4ebe91f248bdb504529ced0dd1084810a | 04cbfa2a807811e15a80148351f6ca5d01c83da0 | refs/heads/master | 2022-10-21T20:11:10.042821 | 2022-07-17T06:33:44 | 2022-07-17T06:33:44 | 272,212,232 | 1 | 0 | Apache-2.0 | 2020-06-14T13:54:42 | 2020-06-14T13:54:41 | null | UTF-8 | Java | false | false | 1,925 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.factory;
import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.sharding.fixture.KeyGenerateAlgorithmFixture;
import org.junit.Test;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
public final class KeyGenerateAlgorithmFactoryTest {
@Test
public void assertNewInstance() {
assertThat(KeyGenerateAlgorithmFactory.newInstance(), instanceOf(KeyGenerateAlgorithmFixture.class));
}
@Test
public void assertNewInstanceWithShardingSphereAlgorithmConfiguration() {
ShardingSphereAlgorithmConfiguration configuration = new ShardingSphereAlgorithmConfiguration("FIXTURE", new Properties());
assertThat(KeyGenerateAlgorithmFactory.newInstance(configuration), instanceOf(KeyGenerateAlgorithmFixture.class));
}
@Test
public void assertContains() {
assertTrue(KeyGenerateAlgorithmFactory.contains("FIXTURE"));
}
}
| [
"noreply@github.com"
] | noreply@github.com |
a9f17ade1eee37d647782c8c2ce8ee4a7e0f3de8 | 0cf90d7a9b0aa6b776bffb1a1d029cf5b356ad12 | /SpringMusicProject/src/main/java/com/sist/naver/Channel.java | 7815be65a789ce7c20c43522ba842083b855ee03 | [] | no_license | scurrymode/springDevUbuntu | 8fb1c04c76e26c4fdc744903f086520deb3b8377 | 33c44ad3eb863be27f4272f1217673a19f54c7d9 | refs/heads/master | 2020-12-13T19:56:31.764790 | 2017-07-21T08:35:06 | 2017-07-21T08:35:06 | 95,505,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 283 | java | package com.sist.naver;
import java.util.*;
import com.sun.xml.txw2.annotation.XmlElement;
public class Channel {
private List<Item> item = new ArrayList<Item>();
public List<Item> getItem() {
return item;
}
public void setItem(List<Item> item) {
this.item = item;
}
}
| [
"scurrymode@gmail.com"
] | scurrymode@gmail.com |
a60380cd4dd1e33952c3fe7c5b9ed357d5f2b0ff | 7ee5780f9816d56bd261756be86f1818d3506112 | /HackerRank/src/algorithms/TimeConversion.java | cf85a78856a22de2a4ddcb016ae4dc7998629d61 | [] | no_license | pranav2579/CodingChallenge | a8c3dabbfe2c614af7a446075f4612229113b244 | 1971c3f1bc2e57c8ab9ff1302b80925129d690a0 | refs/heads/master | 2020-12-24T19:46:41.867734 | 2017-02-05T17:33:58 | 2017-02-05T17:33:58 | 57,306,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 813 | java | package algorithms;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
/**
* Created by Pranav on 28/04/16.
*/
public class TimeConversion {
public static void main(String[] args) throws Exception{
Scanner S = new Scanner(System.in);
String inputTime;
inputTime = S.nextLine();
//System.out.println(inputTime);
StringBuffer sb = new StringBuffer(inputTime);
sb.insert(sb.length()-2," ");
inputTime = sb.toString();
//System.out.println(inputTime);
SimpleDateFormat parseformat = new SimpleDateFormat("hh:mm:ss a");
Date d = parseformat.parse(inputTime);
SimpleDateFormat displayformat = new SimpleDateFormat("HH:mm:ss");
System.out.println(displayformat.format(d));
}
}
| [
"pranav2579@gmail.com"
] | pranav2579@gmail.com |
2e92eadfdaafa9ac2d69e08cf6f895d558b8ed88 | 78ae6b125cbd8df23db5deab84a2474b3c2bc45b | /Subuwuliu/src/com/easemob/chatuidemo/activity/GroupSimpleDetailActivity.java | ee47754456620356537aa82740d0d45d7f319e87 | [] | no_license | henryxzw/subuwuliu | 5778603b81a3c2a76d206142282acf86f36e72c7 | b99927e80402b4cc21f9dc77478c8b9324047b17 | refs/heads/master | 2021-01-18T04:23:44.724637 | 2016-11-24T03:07:17 | 2016-11-24T03:07:17 | 13,641,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,092 | java | /**
* Copyright (C) 2013-2014 EaseMob Technologies. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.easemob.chatuidemo.activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.easemob.chat.EMChatManager;
import com.easemob.chat.EMGroup;
import com.easemob.chat.EMGroupInfo;
import com.easemob.chat.EMGroupManager;
import com.easemob.exceptions.EaseMobException;
import com.johan.subuwuliu.R;
public class GroupSimpleDetailActivity extends BaseActivity {
private Button btn_add_group;
private TextView tv_admin;
private TextView tv_name;
private TextView tv_introduction;
private EMGroup group;
private String groupid;
private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.easeui_activity_group_simle_details);
tv_name = (TextView) findViewById(R.id.name);
tv_admin = (TextView) findViewById(R.id.tv_admin);
btn_add_group = (Button) findViewById(R.id.btn_add_to_group);
tv_introduction = (TextView) findViewById(R.id.tv_introduction);
progressBar = (ProgressBar) findViewById(R.id.loading);
EMGroupInfo groupInfo = (EMGroupInfo) getIntent().getSerializableExtra("groupinfo");
String groupname = null;
if(groupInfo != null){
groupname = groupInfo.getGroupName();
groupid = groupInfo.getGroupId();
}else{
group = PublicGroupsSeachActivity.searchedGroup;
if(group == null)
return;
groupname = group.getGroupName();
groupid = group.getGroupId();
}
tv_name.setText(groupname);
if(group != null){
showGroupDetail();
return;
}
new Thread(new Runnable() {
public void run() {
//从服务器获取详情
try {
group = EMGroupManager.getInstance().getGroupFromServer(groupid);
runOnUiThread(new Runnable() {
public void run() {
showGroupDetail();
}
});
} catch (final EaseMobException e) {
e.printStackTrace();
final String st1 = getResources().getString(R.string.Failed_to_get_group_chat_information);
runOnUiThread(new Runnable() {
public void run() {
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(GroupSimpleDetailActivity.this, st1+e.getMessage(), 1).show();
}
});
}
}
}).start();
}
//加入群聊
public void addToGroup(View view){
String st1 = getResources().getString(R.string.Is_sending_a_request);
final String st2 = getResources().getString(R.string.Request_to_join);
final String st3 = getResources().getString(R.string.send_the_request_is);
final String st4 = getResources().getString(R.string.Join_the_group_chat);
final String st5 = getResources().getString(R.string.Failed_to_join_the_group_chat);
final ProgressDialog pd = new ProgressDialog(this);
// getResources().getString(R.string)
pd.setMessage(st1);
pd.setCanceledOnTouchOutside(false);
pd.show();
new Thread(new Runnable() {
public void run() {
try {
//如果是membersOnly的群,需要申请加入,不能直接join
if(group.isMembersOnly()){
EMGroupManager.getInstance().applyJoinToGroup(groupid, st2);
}else{
EMGroupManager.getInstance().joinGroup(groupid);
}
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
if(group.isMembersOnly())
Toast.makeText(GroupSimpleDetailActivity.this, st3, 0).show();
else
Toast.makeText(GroupSimpleDetailActivity.this, st4, 0).show();
btn_add_group.setEnabled(false);
}
});
} catch (final EaseMobException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(GroupSimpleDetailActivity.this, st5+e.getMessage(), 0).show();
}
});
}
}
}).start();
}
private void showGroupDetail() {
progressBar.setVisibility(View.INVISIBLE);
//获取详情成功,并且自己不在群中,才让加入群聊按钮可点击
if(!group.getMembers().contains(EMChatManager.getInstance().getCurrentUser()))
btn_add_group.setEnabled(true);
tv_name.setText(group.getGroupName());
tv_admin.setText(group.getOwner());
tv_introduction.setText(group.getDescription());
}
public void back(View view){
finish();
}
}
| [
"xiaziwentyu@126.com"
] | xiaziwentyu@126.com |
4f5d6bb5d1d1d8ca711ba91763376fbc05942afb | b274c65c8a66e3aa9d687fb4a01a6d9ef61f6131 | /runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoOverlay.java | 1fb701db7d294a714deef52d52379cac839f597a | [
"BSD-2-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | Wtrader1/runelite | 7fc20ad2b9b48a3f42e409b00d66ee8de912bc41 | f4e3fe9724f84c0c83737b0efe40c9da02fe49e3 | refs/heads/master | 2023-02-06T17:48:01.574455 | 2020-12-28T17:52:43 | 2020-12-28T17:52:43 | 270,298,773 | 0 | 0 | BSD-2-Clause | 2020-06-07T12:25:08 | 2020-06-07T12:25:08 | null | UTF-8 | Java | false | false | 21,050 | java | package net.runelite.client.plugins.inferno;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.Prayer;
import net.runelite.api.NPC;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.plugins.inferno.displaymodes.InfernoPrayerDisplayMode;
import net.runelite.client.plugins.inferno.displaymodes.InfernoSafespotDisplayMode;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.OverlayUtil;
public class InfernoOverlay extends Overlay
{
private static final int TICK_PIXEL_SIZE = 60;
private static final int BOX_WIDTH = 10;
private static final int BOX_HEIGHT = 5;
private final InfernoPlugin plugin;
private final Client client;
@Inject
private InfernoOverlay(final Client client, final InfernoPlugin plugin)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_WIDGETS);
setPriority(OverlayPriority.HIGHEST);
this.client = client;
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics)
{
final Widget meleePrayerWidget = client.getWidget(WidgetInfo.PRAYER_PROTECT_FROM_MELEE);
final Widget rangePrayerWidget = client.getWidget(WidgetInfo.PRAYER_PROTECT_FROM_MISSILES);
final Widget magicPrayerWidget = client.getWidget(WidgetInfo.PRAYER_PROTECT_FROM_MAGIC);
if (plugin.isIndicateObstacles())
{
renderObstacles(graphics);
}
if (plugin.getSafespotDisplayMode() == InfernoSafespotDisplayMode.AREA)
{
renderAreaSafepots(graphics);
}
else if (plugin.getSafespotDisplayMode() == InfernoSafespotDisplayMode.INDIVIDUAL_TILES)
{
renderIndividualTilesSafespots(graphics);
}
for (InfernoNPC infernoNPC : plugin.getInfernoNpcs())
{
if (infernoNPC.getNpc().getConvexHull() != null)
{
if (plugin.isIndicateNonSafespotted() && plugin.isNormalSafespots(infernoNPC)
&& infernoNPC.canAttack(client, client.getLocalPlayer().getWorldLocation()))
{
OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.RED);
}
if (plugin.isIndicateTemporarySafespotted() && plugin.isNormalSafespots(infernoNPC)
&& infernoNPC.canMoveToAttack(client, client.getLocalPlayer().getWorldLocation(), plugin.getObstacles()))
{
OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.YELLOW);
}
if (plugin.isIndicateSafespotted() && plugin.isNormalSafespots(infernoNPC))
{
OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.GREEN);
}
if (plugin.isIndicateNibblers() && infernoNPC.getType() == InfernoNPC.Type.NIBBLER
&& (!plugin.isIndicateCentralNibbler() || plugin.getCentralNibbler() != infernoNPC))
{
OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.CYAN);
}
if (plugin.isIndicateCentralNibbler() && infernoNPC.getType() == InfernoNPC.Type.NIBBLER
&& plugin.getCentralNibbler() == infernoNPC)
{
OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.BLUE);
}
if (plugin.isIndicateActiveHealersJad() && infernoNPC.getType() == InfernoNPC.Type.HEALER_JAD
&& infernoNPC.getNpc().getInteracting() != client.getLocalPlayer())
{
OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.CYAN);
}
if (plugin.isIndicateActiveHealersZuk() && infernoNPC.getType() == InfernoNPC.Type.HEALER_ZUK
&& infernoNPC.getNpc().getInteracting() != client.getLocalPlayer())
{
OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.CYAN);
}
}
if (plugin.isIndicateNpcPosition(infernoNPC))
{
renderNpcLocation(graphics, infernoNPC);
}
if (plugin.isTicksOnNpc(infernoNPC) && infernoNPC.getTicksTillNextAttack() > 0)
{
renderTicksOnNpc(graphics, infernoNPC, infernoNPC.getNpc());
}
if (plugin.isTicksOnNpcZukShield() && infernoNPC.getType() == InfernoNPC.Type.ZUK && plugin.getZukShield() != null && infernoNPC.getTicksTillNextAttack() > 0)
{
renderTicksOnNpc(graphics, infernoNPC, plugin.getZukShield());
}
}
if ((plugin.getPrayerDisplayMode() == InfernoPrayerDisplayMode.PRAYER_TAB
|| plugin.getPrayerDisplayMode() == InfernoPrayerDisplayMode.BOTH)
&& (meleePrayerWidget != null && !meleePrayerWidget.isHidden()
&& rangePrayerWidget != null && !rangePrayerWidget.isHidden()
&& magicPrayerWidget != null && !magicPrayerWidget.isHidden()))
{
renderPrayerIconOverlay(graphics);
if (plugin.isDescendingBoxes())
{
renderDescendingBoxes(graphics);
}
}
return null;
}
private void renderObstacles(Graphics2D graphics)
{
for (WorldPoint worldPoint : plugin.getObstacles())
{
final LocalPoint localPoint = LocalPoint.fromWorld(client, worldPoint);
if (localPoint == null)
{
continue;
}
final Polygon tilePoly = Perspective.getCanvasTilePoly(client, localPoint);
if (tilePoly == null)
{
continue;
}
OverlayUtil.renderPolygon(graphics, tilePoly, Color.BLUE);
}
}
private void renderAreaSafepots(Graphics2D graphics)
{
for (int safeSpotId : plugin.getSafeSpotAreas().keySet())
{
if (safeSpotId > 6)
{
continue;
}
Color colorEdge1;
Color colorEdge2 = null;
Color colorFill;
switch (safeSpotId)
{
case 0:
colorEdge1 = Color.WHITE;
colorFill = Color.WHITE;
break;
case 1:
colorEdge1 = Color.RED;
colorFill = Color.RED;
break;
case 2:
colorEdge1 = Color.GREEN;
colorFill = Color.GREEN;
break;
case 3:
colorEdge1 = Color.BLUE;
colorFill = Color.BLUE;
break;
case 4:
colorEdge1 = Color.RED;
colorEdge2 = Color.GREEN;
colorFill = Color.YELLOW;
break;
case 5:
colorEdge1 = Color.RED;
colorEdge2 = Color.BLUE;
colorFill = new Color(255, 0, 255);
break;
case 6:
colorEdge1 = Color.GREEN;
colorEdge2 = Color.BLUE;
colorFill = new Color(0, 255, 255);
break;
default:
continue;
}
//Add all edges, calculate average edgeSize and indicate tiles
final List<int[][]> allEdges = new ArrayList<>();
int edgeSizeSquared = 0;
for (WorldPoint worldPoint : plugin.getSafeSpotAreas().get(safeSpotId))
{
final LocalPoint localPoint = LocalPoint.fromWorld(client, worldPoint);
if (localPoint == null)
{
continue;
}
final Polygon tilePoly = Perspective.getCanvasTilePoly(client, localPoint);
if (tilePoly == null)
{
continue;
}
//todo:: veranderd van OverlayUtil.renderAreaTilePolygon(graphics, tilePoly, colorFill); naar
OverlayUtil.renderPolygon(graphics,tilePoly,colorFill);
final int[][] edge1 = new int[][]{{tilePoly.xpoints[0], tilePoly.ypoints[0]}, {tilePoly.xpoints[1], tilePoly.ypoints[1]}};
edgeSizeSquared += Math.pow(tilePoly.xpoints[0] - tilePoly.xpoints[1], 2) + Math.pow(tilePoly.ypoints[0] - tilePoly.ypoints[1], 2);
allEdges.add(edge1);
final int[][] edge2 = new int[][]{{tilePoly.xpoints[1], tilePoly.ypoints[1]}, {tilePoly.xpoints[2], tilePoly.ypoints[2]}};
edgeSizeSquared += Math.pow(tilePoly.xpoints[1] - tilePoly.xpoints[2], 2) + Math.pow(tilePoly.ypoints[1] - tilePoly.ypoints[2], 2);
allEdges.add(edge2);
final int[][] edge3 = new int[][]{{tilePoly.xpoints[2], tilePoly.ypoints[2]}, {tilePoly.xpoints[3], tilePoly.ypoints[3]}};
edgeSizeSquared += Math.pow(tilePoly.xpoints[2] - tilePoly.xpoints[3], 2) + Math.pow(tilePoly.ypoints[2] - tilePoly.ypoints[3], 2);
allEdges.add(edge3);
final int[][] edge4 = new int[][]{{tilePoly.xpoints[3], tilePoly.ypoints[3]}, {tilePoly.xpoints[0], tilePoly.ypoints[0]}};
edgeSizeSquared += Math.pow(tilePoly.xpoints[3] - tilePoly.xpoints[0], 2) + Math.pow(tilePoly.ypoints[3] - tilePoly.ypoints[0], 2);
allEdges.add(edge4);
}
if (allEdges.size() <= 0)
{
continue;
}
edgeSizeSquared /= allEdges.size();
//Find and indicate unique edges
final int toleranceSquared = (int) Math.ceil(edgeSizeSquared / 6);
for (int i = 0; i < allEdges.size(); i++)
{
int[][] baseEdge = allEdges.get(i);
boolean duplicate = false;
for (int j = 0; j < allEdges.size(); j++)
{
if (i == j)
{
continue;
}
int[][] checkEdge = allEdges.get(j);
if (edgeEqualsEdge(baseEdge, checkEdge, toleranceSquared))
{
duplicate = true;
break;
}
}
if (!duplicate)
{
//todo::OverlayUtil.renderFullLine(graphics, baseEdge, colorEdge1); voor deze 2 nieuwe functie
renderFullLine(graphics,baseEdge,colorEdge1);
if (colorEdge2 != null)
{
//OverlayUtil.renderDashedLine(graphics, baseEdge, colorEdge2);
renderDashedLine(graphics,baseEdge,colorEdge2);
}
}
}
}
}
private static void renderFullLine(Graphics2D graphics, int[][] line, Color color){
graphics.setColor(color);
final Stroke originalStroke = graphics.getStroke();
graphics.setStroke(new BasicStroke(2));
graphics.drawLine(line[0][0],line[0][1],line[1][0],line[1][1]);
graphics.setStroke(originalStroke);
}
public static void renderDashedLine(Graphics2D graphics, int[][] line, Color color)
{
graphics.setColor(color);
final Stroke originalStroke = graphics.getStroke();
graphics.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{9}, 0));
graphics.drawLine(line[0][0], line[0][1], line[1][0], line[1][1]);
graphics.setStroke(originalStroke);
}
private void renderIndividualTilesSafespots(Graphics2D graphics)
{
for (WorldPoint worldPoint : plugin.getSafeSpotMap().keySet())
{
final int safeSpotId = plugin.getSafeSpotMap().get(worldPoint);
if (safeSpotId > 6)
{
continue;
}
final LocalPoint localPoint = LocalPoint.fromWorld(client, worldPoint);
if (localPoint == null)
{
continue;
}
final Polygon tilePoly = Perspective.getCanvasTilePoly(client, localPoint);
if (tilePoly == null)
{
continue;
}
Color color;
switch (safeSpotId)
{
case 0:
color = Color.WHITE;
break;
case 1:
color = Color.RED;
break;
case 2:
color = Color.GREEN;
break;
case 3:
color = Color.BLUE;
break;
case 4:
color = new Color(255, 255, 0);
break;
case 5:
color = new Color(255, 0, 255);
break;
case 6:
color = new Color(0, 255, 255);
break;
default:
continue;
}
OverlayUtil.renderPolygon(graphics, tilePoly, color);
}
}
private void renderTicksOnNpc(Graphics2D graphics, InfernoNPC infernoNPC, NPC renderOnNPC)
{
final Color color = (infernoNPC.getTicksTillNextAttack() == 1
|| (infernoNPC.getType() == InfernoNPC.Type.BLOB && infernoNPC.getTicksTillNextAttack() == 4))
? infernoNPC.getNextAttack().getCriticalColor() : infernoNPC.getNextAttack().getNormalColor();
final Point canvasPoint = renderOnNPC.getCanvasTextLocation(
graphics, String.valueOf(infernoNPC.getTicksTillNextAttack()), 0);
OverlayUtil.renderTextLocation(graphics,canvasPoint,String.valueOf(infernoNPC.getTicksTillNextAttack()),color);
//todo:: OverlayUtil.renderTextLocation(graphics, String.valueOf(infernoNPC.getTicksTillNextAttack()), aanpassing gemaakt hierin functi bestaat niet meer
//plugin.getTextSize(), plugin.getFontStyle().getFont(), color, canvasPoint, false, 0);
}
private void renderNpcLocation(Graphics2D graphics, InfernoNPC infernoNPC)
{
final LocalPoint localPoint = LocalPoint.fromWorld(client, infernoNPC.getNpc().getWorldLocation());
if (localPoint != null)
{
final Polygon tilePolygon = Perspective.getCanvasTilePoly(client, localPoint);
if (tilePolygon != null)
{
OverlayUtil.renderPolygon(graphics, tilePolygon, Color.BLUE);
}
}
}
private void renderDescendingBoxes(Graphics2D graphics)
{
for (Integer tick : plugin.getUpcomingAttacks().keySet())
{
final Map<InfernoNPC.Attack, Integer> attackPriority = plugin.getUpcomingAttacks().get(tick);
int bestPriority = 999;
InfernoNPC.Attack bestAttack = null;
for (Map.Entry<InfernoNPC.Attack, Integer> attackEntry : attackPriority.entrySet())
{
if (attackEntry.getValue() < bestPriority)
{
bestAttack = attackEntry.getKey();
bestPriority = attackEntry.getValue();
}
}
for (InfernoNPC.Attack currentAttack : attackPriority.keySet())
{
//TODO: Config values for these colors
final Color color = (tick == 1 && currentAttack == bestAttack) ? Color.RED : Color.ORANGE;
final Widget prayerWidget = client.getWidget(WidgetID.PRAYER_GROUP_ID);
int baseX = (int) prayerWidget.getBounds().getX();
baseX += prayerWidget.getBounds().getWidth() / 2;
baseX -= BOX_WIDTH / 2;
int baseY = (int) prayerWidget.getBounds().getY() - tick * TICK_PIXEL_SIZE - BOX_HEIGHT;
baseY += TICK_PIXEL_SIZE - ((plugin.getLastTick() + 600 - System.currentTimeMillis()) / 600.0 * TICK_PIXEL_SIZE);
final Rectangle boxRectangle = new Rectangle(BOX_WIDTH, BOX_HEIGHT);
boxRectangle.translate(baseX, baseY);
Polygon build = RectangleToPolygon(boxRectangle);
if (currentAttack == bestAttack)
{
//todo::deze veranderd OverlayUtil.renderFilledPolygon(graphics, boxRectangle, color);
renderFilledPolygon(graphics,build,color);
}
else if (plugin.isIndicateNonPriorityDescendingBoxes())
{
//todo::deze veranderd OverlayUtil.renderOutlinePolygon(graphics, boxRectangle, color);
renderOutlinePolygon(graphics,build,color);
}
}
}
}
public static Polygon RectangleToPolygon(Rectangle rect) {
int[] xpoints = {rect.x, rect.x + rect.width, rect.x + rect.width, rect.x};
int[] ypoints = {rect.y, rect.y, rect.y + rect.height, rect.y + rect.height};
return new Polygon(xpoints, ypoints, 4);
}
public static void renderOutlinePolygon(Graphics2D graphics, Polygon poly, Color color)
{
graphics.setColor(color);
final Stroke originalStroke = graphics.getStroke();
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(poly);
graphics.setStroke(originalStroke);
}
public static void renderFilledPolygon(Graphics2D graphics, Polygon poly, Color color)
{
graphics.setColor(color);
final Stroke originalStroke = graphics.getStroke();
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(poly);
graphics.fillPolygon(poly);
graphics.setStroke(originalStroke);
}
private void renderPrayerIconOverlay(Graphics2D graphics)
{
if (plugin.getClosestAttack() != null)
{
// Prayer indicator in prayer tab
InfernoNPC.Attack prayerForAttack = null;
if (client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC))
{
prayerForAttack = InfernoNPC.Attack.MAGIC;
}
else if (client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES))
{
prayerForAttack = InfernoNPC.Attack.RANGED;
}
else if (client.isPrayerActive(Prayer.PROTECT_FROM_MELEE))
{
prayerForAttack = InfernoNPC.Attack.MELEE;
}
if (plugin.getClosestAttack() != prayerForAttack || plugin.isIndicateWhenPrayingCorrectly())
{
//todo:: het was dit: final Widget prayerWidget = client.getWidget(plugin.getClosestAttack().getPrayer().getWidgetInfo());
//final Rectangle prayerRectangle = new Rectangle((int) prayerWidget.getBounds().getWidth(),
// (int) prayerWidget.getBounds().getHeight());
//prayerRectangle.translate((int) prayerWidget.getBounds().getX(), (int) prayerWidget.getBounds().getY());
//TODO: Config values for these colors
Color prayerColor;
if (plugin.getClosestAttack() == prayerForAttack)
{
prayerColor = Color.GREEN;
}
else
{
prayerColor = Color.RED;
}
//OverlayUtil.renderOutlinePolygon(graphics, prayerRectangle, prayerColor);
}
}
}
private boolean edgeEqualsEdge(int[][] edge1, int[][] edge2, int toleranceSquared)
{
return (pointEqualsPoint(edge1[0], edge2[0], toleranceSquared) && pointEqualsPoint(edge1[1], edge2[1], toleranceSquared))
|| (pointEqualsPoint(edge1[0], edge2[1], toleranceSquared) && pointEqualsPoint(edge1[1], edge2[0], toleranceSquared));
}
private boolean pointEqualsPoint(int[] point1, int[] point2, int toleranceSquared)
{
double distanceSquared = Math.pow(point1[0] - point2[0], 2) + Math.pow(point1[1] - point2[1], 2);
return distanceSquared <= toleranceSquared;
}
} | [
"willemhuisman9@msn.com"
] | willemhuisman9@msn.com |
63217b2fd2c6207ac40baae42e0ee2822dfe1606 | 4339f882dead368a538799bb3136ddd8c3499b8d | /src/main/java/com/soccer/entity/Stat.java | 11f9eb512299630b3b50826ea0752ab404bc4f28 | [] | no_license | gagangupta111/Soccer | 51f07f00be8a5a8018a8ea06dedafc9db9bc067c | 3caf5b8da54ae4c59354eea3d9a6bc9dc9749119 | refs/heads/master | 2020-03-11T07:54:39.821670 | 2018-04-23T10:50:38 | 2018-04-23T10:50:38 | 129,869,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,417 | java | package com.soccer.entity;
public class Stat {
private Integer id;
private Stat_Event_Type stat_event_type;
private Integer score_team1;
private Integer score_team2;
public Stat() {
}
public Stat(Stat_Event_Type stat_event_type, Integer score_team1, Integer score_team2) {
this.stat_event_type = stat_event_type;
this.score_team1 = score_team1;
this.score_team2 = score_team2;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Stat_Event_Type getStat_event_type() {
return stat_event_type;
}
public void setStat_event_type(Stat_Event_Type stat_event_type) {
this.stat_event_type = stat_event_type;
}
public Integer getScore_team1() {
return score_team1;
}
public void setScore_team1(Integer score_team1) {
this.score_team1 = score_team1;
}
public Integer getScore_team2() {
return score_team2;
}
public void setScore_team2(Integer score_team2) {
this.score_team2 = score_team2;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Stat stat = (Stat) o;
if (id != null ? !id.equals(stat.id) : stat.id != null) return false;
if (stat_event_type != null ? !stat_event_type.equals(stat.stat_event_type) : stat.stat_event_type != null)
return false;
if (score_team1 != null ? !score_team1.equals(stat.score_team1) : stat.score_team1 != null) return false;
return score_team2 != null ? score_team2.equals(stat.score_team2) : stat.score_team2 == null;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (stat_event_type != null ? stat_event_type.hashCode() : 0);
result = 31 * result + (score_team1 != null ? score_team1.hashCode() : 0);
result = 31 * result + (score_team2 != null ? score_team2.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "Stat{" +
"id=" + id +
", stat_event_type=" + stat_event_type +
", score_team1=" + score_team1 +
", score_team2=" + score_team2 +
'}';
}
}
| [
"gagan_gupta111@yahoo.com"
] | gagan_gupta111@yahoo.com |
4f552ce421b652e0f56e2472f0cbcf7280ac563b | 1c5d3672a281065deb6fdbfc590b65118ac7533a | /app/src/main/java/com/es/angles/piychat/StartActivity.java | 8a5443ff8e523c5528035b53f28abd7975907254 | [] | no_license | giothihay/android | d071a7d7cd11831ac407d63eddd902b4d14f2cf5 | a05515e045be8699f2a80b543c8183d1987fb447 | refs/heads/master | 2020-04-29T03:33:59.448971 | 2019-03-15T12:31:11 | 2019-03-15T12:31:11 | 175,815,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package com.es.angles.piychat;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class StartActivity extends AppCompatActivity {
private Button mRegBtn;
private Button mLoginBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
mRegBtn = (Button) findViewById(R.id.start_reg_btn);
mLoginBtn = (Button) findViewById(R.id.start_login_btn);
mRegBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent reg_intent = new Intent(StartActivity.this, RegisterActivity.class);
startActivity(reg_intent);
}
});
mLoginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent login_intent = new Intent(StartActivity.this, LoginActivity.class);
startActivity(login_intent);
}
});
}
}
| [
"giothihay@gmail.com"
] | giothihay@gmail.com |
1778677187874dbe97814c5c4fcd09d4ecf35305 | d05543f3fc82024832a006b6f5a91f3337aea593 | /src/main/java/com/pcitc/impl/rtcal/dao/StudentDao.java | a7254157ad1353734bf09d38c317160b120d83d6 | [] | no_license | mrjohnz/test | 9898c069ea5dd46973d7c815a699e2eb818ab9a7 | 4d1cef1f762bb80e654f896bc4eff55dde631ecb | refs/heads/master | 2021-07-05T07:47:43.205605 | 2017-09-27T13:26:45 | 2017-09-27T13:26:45 | 104,341,572 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,824 | java | package com.pcitc.impl.rtcal.dao;
import java.util.List;
import org.hibernate.annotations.SQLDelete;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import com.pcitc.impl.rtcal.pojo.Student;
public interface StudentDao extends JpaRepository<Student, Long>{
/**
* @Title: getStudents
* @Description: 查询所有Student
* @return List<Student>
*/
@Query("from Student")
List<com.pcitc.impl.rtcal.pojo.Student> getStudents();
/**
* @Title: getStudentById
* @Description: 根据条件查询Student
* @param id 唯一条件
* @return Student
*/
@Query("from Student a where id = :id")
com.pcitc.impl.rtcal.pojo.Student getStudentById(@Param("id") String id);
/**
* @Description: 判断是否存在指定Student
* @param code
* @return App
*/
@Query("from Student a where id = :id")
com.pcitc.impl.rtcal.pojo.Student queryById(@Param("id") String id);
/**
* @Title: updateStudent
* @Description: 更新Student
* @param id
* @param name
* @param age
*/
@Modifying
@Transactional
@Query(" update Student set name = :name, age = :age where id = :id")
void updateStudentById(@Param("id") String id,
@Param("name") String name,
@Param("age") String age);
/**
* @Title: deleteStudent
* @Description: 删除指定Student
* @param id 唯一条件
*/
@Transactional
@SQLDelete(sql = "delete from Student where id = :id")
void deleteStudentById(@Param("id") String id);
@Query("from Student a where id in (:id)")
List<com.pcitc.impl.rtcal.pojo.Student> getStudentsById(@Param("id") List<String> ids);
}
| [
"dongsheng.zhao@pcitc.com"
] | dongsheng.zhao@pcitc.com |
30032e6ba6ec7d054faee2d5c0626ac9d5201d03 | b3b3b0e343a7538bd925a09cc6b3cb9b2892a561 | /code/pattern/src/com/pattern/intro/bstrategy/Context.java | 00b6f16c97805c5f47052387e6fb714e2998255b | [] | no_license | lietou1986/learn-designpattern | b83f05fb6ed0ccf1a5620ef55ed8a8e884852acd | f3d57270ee1bd0f5c52307c8d198c1588e3a5570 | refs/heads/master | 2020-03-17T14:51:25.897122 | 2017-07-11T01:32:18 | 2017-07-11T01:32:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | package com.pattern.intro.bstrategy;
/**
* 策略模式和简单工厂模式结合
* @author xuxhm
*
*/
public class Context {
//聚合策略对象
private Strategy strategy;
public Context(char type){
switch(type){
case 'A':
strategy = new ConcreteStrategyA();
break;
case 'B':
strategy = new ConcreteStrategyB();
break;
}
}
public void ContextInterface(){
strategy.AlgorithmInterface();
}
}
| [
"1394779282@qq.com"
] | 1394779282@qq.com |
e8e84766b1103852050b81747c6e6f350375b181 | 6506bd157e1711bb5a42b21014e87a412c927c99 | /model/src/main/java/org/openforis/collect/android/viewmodelmanager/ViewModelRepository.java | 0c22916b548664fc111b3f73ef8cd257141456f3 | [
"MIT"
] | permissive | DroidSky/collect-mobile | c536c9f9a86c2b6140529eccd8c04718f25d9a00 | ecda783a132979d24989ace036fce5a75b93958f | refs/heads/master | 2021-08-30T16:17:46.752290 | 2017-11-14T11:24:27 | 2017-11-14T11:24:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,571 | java | package org.openforis.collect.android.viewmodelmanager;
import org.openforis.collect.android.DefinitionProvider;
import org.openforis.collect.android.attributeconverter.AttributeConverter;
import org.openforis.collect.android.gui.util.meter.Timer;
import org.openforis.collect.android.viewmodel.*;
import java.util.*;
import static org.openforis.collect.android.viewmodelmanager.NodeDto.Collection;
/**
* @author Daniel Wiell
*/
public interface ViewModelRepository {
void insertRecord(UiRecord record);
UiRecord recordById(UiSurvey survey, int recordId);
List<UiRecord.Placeholder> surveyRecords(int surveyId);
void insertEntity(UiEntity entity, Map<Integer, StatusChange> statusChanges);
void insertAttribute(UiAttribute attribute, Map<Integer, StatusChange> statusChanges);
void updateAttribute(UiAttribute attribute, Map<Integer, StatusChange> statusChanges);
void removeNode(UiNode node, Map<Integer, StatusChange> statusChanges);
void removeRecord(int recordId);
class DatabaseViewModelRepository implements ViewModelRepository {
private final DefinitionProvider definitionProvider;
private final NodeRepository repo;
public DatabaseViewModelRepository(DefinitionProvider definitionProvider, NodeRepository repo) {
this.definitionProvider = definitionProvider;
this.repo = repo;
}
public void insertRecord(UiRecord record) {
repo.insert(toNodeDtoList(record), new HashMap<Integer, StatusChange>());
}
public UiRecord recordById(UiSurvey survey, int recordId) {
Collection nodeCollection = repo.recordNodes(recordId);
return toRecord(survey, nodeCollection);
}
public List<UiRecord.Placeholder> surveyRecords(int surveyId) {
Collection nodeCollection = repo.surveyRecords(surveyId);
List<UiRecord.Placeholder> placeholders = new ArrayList<UiRecord.Placeholder>();
List<NodeDto> recordNodes = nodeCollection.childrenOf(null);
for (NodeDto recordNode : recordNodes)
placeholders.add(
new UiRecord.Placeholder(
recordNode.id,
UiNode.Status.valueOf(recordNode.status),
recordNode.recordCollectionName,
definitionProvider.getById(recordNode.definitionId),
getRecordKeyAttributes(nodeCollection, recordNode)
)
);
return placeholders;
}
private List<UiAttribute> getRecordKeyAttributes(Collection nodeCollection, NodeDto recordNode) {
List<NodeDto> keyAttributeDtoList = nodeCollection.childrenOf(recordNode.id);
List<UiAttribute> keyAttributes = new ArrayList<UiAttribute>();
for (NodeDto keyAttributeDto : keyAttributeDtoList)
keyAttributes.add((UiAttribute) toUiNode(keyAttributeDto));
return keyAttributes;
}
public void insertEntity(UiEntity entity, final Map<Integer, StatusChange> statusChanges) {
final List<NodeDto> nodes = toNodeDtoList(entity);
Timer.time(NodeRepository.class, "insert", new Runnable() {
public void run() {
repo.insert(nodes, statusChanges);
}
});
}
public void insertAttribute(UiAttribute attribute, final Map<Integer, StatusChange> statusChanges) {
repo.insert(Arrays.asList(uiAttributeToDto(attribute)), statusChanges);
}
public void updateAttribute(UiAttribute attribute, Map<Integer, StatusChange> statusChanges) {
repo.update(uiAttributeToDto(attribute), statusChanges);
}
public void removeNode(UiNode node, Map<Integer, StatusChange> statusChanges) {
repo.removeAll(toIds(node), statusChanges);
}
public void removeRecord(int recordId) {
repo.removeRecord(recordId);
}
private List<Integer> toIds(UiNode node) {
List<Integer> ids = new ArrayList<Integer>();
ids.add(node.getId());
if (node instanceof UiInternalNode)
for (UiNode childNode : ((UiInternalNode) node).getChildren())
ids.addAll(toIds(childNode));
return ids;
}
private UiRecord toRecord(UiSurvey survey, Collection nodeCollection) {
NodeDto recordNode = nodeCollection.getRootNode();
UiRecordCollection recordCollection = survey.lookupRecordCollection(recordNode.recordCollectionName);
Definition definition = definitionProvider.getById(recordNode.definitionId);
UiRecord record = new UiRecord(recordNode.id, definition, recordCollection, (UiRecord.Placeholder) recordCollection.getChildById(recordNode.id));
record.setStatus(UiNode.Status.valueOf(recordNode.status));
addChildNodes(record, nodeCollection);
record.init();
return record;
}
private void addChildNodes(UiInternalNode parentNode, Collection nodeCollection) {
List<NodeDto> childNodeDtoList = nodeCollection.childrenOf(parentNode.getId());
for (NodeDto nodeDto : childNodeDtoList) {
UiNode child = toUiNode(nodeDto);
child.setStatus(UiNode.Status.valueOf(nodeDto.status));
parentNode.addChild(child);
if (child instanceof UiInternalNode)
addChildNodes((UiInternalNode) child, nodeCollection);
}
}
// TODO: Move conversion logic somewhere else
private UiNode toUiNode(NodeDto nodeDto) {
Definition definition = definitionProvider.getById(nodeDto.definitionId);
switch (nodeDto.type) {
case ENTITY:
return new UiEntity(nodeDto.id, nodeDto.relevant, definition);
case INTERNAL_NODE:
return new UiInternalNode(nodeDto.id, nodeDto.relevant, definition);
case ENTITY_COLLECTION:
return new UiEntityCollection(nodeDto.id, nodeDto.parentEntityId, nodeDto.relevant, definition);
case ATTRIBUTE_COLLECTION:
return new UiAttributeCollection(nodeDto.id, nodeDto.parentEntityId, nodeDto.relevant, (UiAttributeCollectionDefinition) definition);
default:
return AttributeConverter.toUiAttribute(nodeDto, (UiAttributeDefinition) definition);
}
}
private List<NodeDto> toNodeDtoList(UiNode uiNode) {
List<NodeDto> nodes = new ArrayList<NodeDto>();
NodeDto node = toNodeDto(uiNode);
node.status = uiNode.getStatus().name();
nodes.add(node);
if (uiNode instanceof UiInternalNode) {
for (UiNode childUiNode : ((UiInternalNode) uiNode).getChildren())
nodes.addAll(toNodeDtoList(childUiNode));
}
return nodes;
}
private NodeDto toNodeDto(UiNode uiNode) {
if (uiNode instanceof UiRecord)
return uiRecordToDto((UiRecord) uiNode);
if (uiNode instanceof UiEntity)
return uiEntityToDto((UiEntity) uiNode);
if (uiNode instanceof UiEntityCollection)
return uiEntityCollectionToDto((UiEntityCollection) uiNode);
if (uiNode instanceof UiAttributeCollection)
return uiAttributeCollectionToDto((UiAttributeCollection) uiNode);
if (uiNode instanceof UiInternalNode)
return uiNodeToDto(uiNode);
if (uiNode instanceof UiAttribute)
return uiAttributeToDto((UiAttribute) uiNode);
throw new IllegalStateException("Unexpected uiNode type: " + uiNode);
}
private NodeDto uiEntityCollectionToDto(UiEntityCollection uiEntityCollection) {
NodeDto dto = uiNodeToDto(uiEntityCollection);
dto.parentEntityId = uiEntityCollection.getParentEntityId();
return dto;
}
private NodeDto uiAttributeCollectionToDto(UiAttributeCollection uiAttributeCollection) {
NodeDto dto = uiNodeToDto(uiAttributeCollection);
dto.parentEntityId = uiAttributeCollection.getParentEntityId();
return dto;
}
private NodeDto uiRecordToDto(UiRecord uiRecord) {
NodeDto dto = uiNodeToDto(uiRecord);
dto.parentId = null;
dto.definitionId = uiRecord.getDefinition().id;
dto.recordCollectionName = uiRecord.getParent().getDefinition().name;
return dto;
}
private NodeDto uiAttributeToDto(UiAttribute attribute) {
return AttributeConverter.toDto(attribute);
}
private NodeDto uiEntityToDto(UiEntity entity) {
return uiNodeToDto(entity);
}
private NodeDto uiNodeToDto(UiNode node) {
NodeDto dto = new NodeDto();
dto.id = node.getId();
dto.definitionId = node.getDefinition().id;
dto.parentId = node.getParent().getId();
dto.surveyId = node.getUiSurvey().getId();
dto.recordId = node.getUiRecord().getId();
dto.type = NodeDto.Type.ofUiNode(node);
dto.relevant = node.isRelevant();
return dto;
}
}
} | [
"daniel.wiell@fao.org"
] | daniel.wiell@fao.org |
84a20b1a0ff8b9dcc3bd067e90f8864eac770345 | 9a234a23e75a4da14087de2aaffe0d85e781de9e | /p4core/src/eu/prestoprime/model/mets/BehaviorType.java | 62da807c1badc242f7214c0a464ca3c17011e5a2 | [] | no_license | eurix/p4 | fb7acdb265fe42010d892754910cacf703079b6c | be59827c43bf86b0629bb7dcc464e81d534ff865 | refs/heads/master | 2020-12-26T03:21:54.970003 | 2013-07-29T15:35:34 | 2013-07-29T15:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,665 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.08.04 at 02:21:33 PM CEST
//
package eu.prestoprime.model.mets;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlIDREF;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* behaviorType: Complex Type for Behaviors A behavior can be used to associate
* executable behaviors with content in the METS object. A behavior element has
* an interface definition element that represents an abstract definition of the
* set of behaviors represented by a particular behavior. A behavior element
* also has an behavior mechanism which is a module of executable code that
* implements and runs the behavior defined abstractly by the interface
* definition.
*
*
* <p>
* Java class for behaviorType complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* <complexType name="behaviorType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="interfaceDef" type="{http://www.loc.gov/METS/}objectType" minOccurs="0"/>
* <element name="mechanism" type="{http://www.loc.gov/METS/}objectType"/>
* </sequence>
* <attribute name="ID" type="{http://www.w3.org/2001/XMLSchema}ID" />
* <attribute name="STRUCTID" type="{http://www.w3.org/2001/XMLSchema}IDREFS" />
* <attribute name="BTYPE" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="CREATED" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
* <attribute name="LABEL" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="GROUPID" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="ADMID" type="{http://www.w3.org/2001/XMLSchema}IDREFS" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "behaviorType", propOrder = { "interfaceDef", "mechanism" })
public class BehaviorType implements Serializable {
private final static long serialVersionUID = 1L;
protected ObjectType interfaceDef;
@XmlElement(required = true)
protected ObjectType mechanism;
@XmlAttribute(name = "ID")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
@XmlAttribute(name = "STRUCTID")
@XmlIDREF
@XmlSchemaType(name = "IDREFS")
protected List<Object> structid;
@XmlAttribute(name = "BTYPE")
protected String btype;
@XmlAttribute(name = "CREATED")
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar created;
@XmlAttribute(name = "LABEL")
protected String label;
@XmlAttribute(name = "GROUPID")
protected String groupid;
@XmlAttribute(name = "ADMID")
@XmlIDREF
@XmlSchemaType(name = "IDREFS")
protected List<Object> admid;
/**
* Gets the value of the interfaceDef property.
*
* @return possible object is {@link ObjectType }
*
*/
public ObjectType getInterfaceDef() {
return interfaceDef;
}
/**
* Sets the value of the interfaceDef property.
*
* @param value
* allowed object is {@link ObjectType }
*
*/
public void setInterfaceDef(ObjectType value) {
this.interfaceDef = value;
}
/**
* Gets the value of the mechanism property.
*
* @return possible object is {@link ObjectType }
*
*/
public ObjectType getMechanism() {
return mechanism;
}
/**
* Sets the value of the mechanism property.
*
* @param value
* allowed object is {@link ObjectType }
*
*/
public void setMechanism(ObjectType value) {
this.mechanism = value;
}
/**
* Gets the value of the id property.
*
* @return possible object is {@link String }
*
*/
public String getID() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setID(String value) {
this.id = value;
}
/**
* Gets the value of the structid property.
*
* <p>
* This accessor method returns a reference to the live list, not a
* snapshot. Therefore any modification you make to the returned list will
* be present inside the JAXB object. This is why there is not a
* <CODE>set</CODE> method for the structid property.
*
* <p>
* For example, to add a new item, do as follows:
*
* <pre>
* getSTRUCTID().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list {@link Object }
*
*
*/
public List<Object> getSTRUCTID() {
if (structid == null) {
structid = new ArrayList<Object>();
}
return this.structid;
}
/**
* Gets the value of the btype property.
*
* @return possible object is {@link String }
*
*/
public String getBTYPE() {
return btype;
}
/**
* Sets the value of the btype property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setBTYPE(String value) {
this.btype = value;
}
/**
* Gets the value of the created property.
*
* @return possible object is {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getCREATED() {
return created;
}
/**
* Sets the value of the created property.
*
* @param value
* allowed object is {@link XMLGregorianCalendar }
*
*/
public void setCREATED(XMLGregorianCalendar value) {
this.created = value;
}
/**
* Gets the value of the label property.
*
* @return possible object is {@link String }
*
*/
public String getLABEL() {
return label;
}
/**
* Sets the value of the label property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setLABEL(String value) {
this.label = value;
}
/**
* Gets the value of the groupid property.
*
* @return possible object is {@link String }
*
*/
public String getGROUPID() {
return groupid;
}
/**
* Sets the value of the groupid property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setGROUPID(String value) {
this.groupid = value;
}
/**
* Gets the value of the admid property.
*
* <p>
* This accessor method returns a reference to the live list, not a
* snapshot. Therefore any modification you make to the returned list will
* be present inside the JAXB object. This is why there is not a
* <CODE>set</CODE> method for the admid property.
*
* <p>
* For example, to add a new item, do as follows:
*
* <pre>
* getADMID().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list {@link Object }
*
*
*/
public List<Object> getADMID() {
if (admid == null) {
admid = new ArrayList<Object>();
}
return this.admid;
}
}
| [
"prestoprime@eurixgroup.com"
] | prestoprime@eurixgroup.com |
a705e3e4a90da19e5378fce178bf0408e06a6ccd | f422c95885fc7295d8571818d818f04d2dad3576 | /CRUD_Simples/src/DAO/PilotoDAO.java | 2a0c3ac39bc98a99dd7966b92ba061ede6d096ab | [] | no_license | JVZavatin/DB1-BCC | 2f1d45a9c250c7d21d06f7f8265ba0eb4aa72735 | 4037d21bdac2c227d7ac6615d097b23ee3f44c25 | refs/heads/master | 2020-03-19T10:28:22.814432 | 2018-06-28T02:28:46 | 2018-06-28T02:28:46 | 136,373,831 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,286 | java | package DAO;
//import MODEL.Piloto; --> ATOR
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
/**
*
* @author André Schwerz
*/
public class PilotoDAO extends DbConnection {/*
private Connection conn;
private final String sqlInsert = "INSERT INTO Piloto(nome, equipe_id, pais_sigla, status) VALUES (?,?,?,?)";
private final String sqlUpdate = "UPDATE Piloto SET nome= ?, equipe_id= ?, pais_sigla= ?, status= ? WHERE id = ?";
private final String sqlRemove = "DELETE FROM Piloto WHERE id = ?";
private final String sqlList = "SELECT id, pais_sigla, equipe_id, nome, status FROM Piloto ORDER BY nome";
private final String sqlFind = "SELECT id, pais_sigla, equipe_id, nome, status FROM Piloto WHERE id = ?";
public void insert(Piloto piloto) throws SQLException {
PreparedStatement ps = null;
try {
conn = connect();
ps = conn.prepareStatement(sqlInsert);
ps.setString(1, piloto.getNome());
ps.setInt(2, piloto.getEquipeAtual().getId());
ps.setString(3, piloto.getPais().getSigla());
ps.setBoolean(4, piloto.isStatus());
ps.execute();
} finally {
ps.close();
close(conn);
}
}
public void update(Piloto piloto) throws SQLException {
PreparedStatement ps = null;
try {
conn = connect();
ps = conn.prepareStatement(sqlUpdate);
ps.setString(1, piloto.getNome());
ps.setInt(2, piloto.getEquipeAtual().getId());
ps.setString(3, piloto.getPais().getSigla());
ps.setBoolean(4, piloto.isStatus());
ps.setInt(5, piloto.getId());
ps.execute();
} finally {
ps.close();
close(conn);
}
}
public void remove(int id) throws SQLException {
PreparedStatement ps = null;
try {
conn = connect();
ps = conn.prepareStatement(sqlRemove);
ps.setInt(1, id);
ps.execute();
} finally {
ps.close();
close(conn);
}
}
public ArrayList<Piloto> list() throws SQLException, ClassNotFoundException, IOException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
conn = connect();
ps = conn.prepareStatement(sqlList);
rs = ps.executeQuery();
ArrayList<Piloto> list = new ArrayList<>();
Piloto piloto;
PaisDAO paisDao = new PaisDAO();
EquipeDAO equipeDAO = new EquipeDAO();
while (rs.next()) {
piloto = new Piloto();
piloto.setId(rs.getInt("id"));
piloto.setEquipeAtual(equipeDAO.find(rs.getInt("equipe_id")));
piloto.setPais(paisDao.find(rs.getString("pais_sigla")));
piloto.setNome(rs.getString("nome"));
piloto.setStatus(rs.getBoolean("status"));
list.add(piloto);
}
return list;
} finally {
rs.close();
ps.close();
close(conn);
}
}
public Piloto find(int id) throws SQLException, ClassNotFoundException, IOException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
conn = connect();
ps = conn.prepareStatement(sqlFind);
ps.setInt(1, id);
rs = ps.executeQuery();
Piloto piloto = null;
PaisDAO paisDao = new PaisDAO();
EquipeDAO equipeDao = new EquipeDAO();
if (rs.next()) {
piloto = new Piloto();
piloto.setId(rs.getInt("id"));
piloto.setEquipeAtual(equipeDao.find(rs.getInt("equipe_id")));
piloto.setPais(paisDao.find(rs.getString("pais_sigla")));
piloto.setNome(rs.getString("nome"));
piloto.setStatus(rs.getBoolean("status"));
}
return piloto;
} finally {
rs.close();
ps.close();
close(conn);
}
}
*/
} | [
"noreply@github.com"
] | noreply@github.com |
a901e8efdec9a113ce05f46ad2b2d106a1fa7ead | e24c4aa9c881b86dde5ca21676f5bcdcd0a9d55b | /JAVA/Flipkart/src/com/flipkart/ustglobal/flipkart/user/Payment.java | 3798dedc984d2038ca3cea09aab1667cb661ec62 | [] | no_license | amritaraj1995/USTGlobal-16sept-19-Amrita-Raj | ade27614c2d01cbf85cfddb7f411141f4f224fb4 | 3dbc28db6518f9c5129fde6e2a3a671f038ce790 | refs/heads/master | 2023-01-08T18:34:13.943121 | 2019-12-21T13:18:39 | 2019-12-21T13:18:39 | 215,535,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 73 | java | package com.flipkart.ustglobal.flipkart.user;
public class Payment {
}
| [
"amritaraj1995@gmail.com"
] | amritaraj1995@gmail.com |
50ea24f8e9d9d20d1cf1dc67434bef418c75435b | 998b09ad651631f0b78051c8c7a160ecc7253591 | /src/shared/main/tv/codely/shared/infrastructure/bus/inmemory/InMemoryEventBus.java | 9083b4ca17271c33db479328fa06a5289e09ebf3 | [] | no_license | jlezcanof/java-ddd-skeleton | abedb2ae777c4a0549101f314b9dc452aa474905 | a54d5696e676dbb4cd24c62c5c49b381fee23223 | refs/heads/main | 2022-12-30T13:22:54.274020 | 2022-10-07T12:38:49 | 2022-10-07T12:38:49 | 299,089,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package tv.codely.shared.infrastructure.bus.inmemory;
import java.util.ArrayList;
import java.util.List;
import tv.codely.shared.domain.Service;
import tv.codely.shared.domain.bus.event.DomainEvent;
import tv.codely.shared.domain.bus.event.EventBus;
@Service
public final class InMemoryEventBus implements EventBus {
private List<DomainEvent> events;
public InMemoryEventBus(){
events = new ArrayList<>();
}
@Override
public void publish(List<DomainEvent> events) {
events.forEach(this::publish);
}
private void publish(DomainEvent domainEvent) {
events.add(domainEvent);
}
}
| [
"jmlezcano@atsistemas.com"
] | jmlezcano@atsistemas.com |
0b1b15563b5bff3c0859d902fc14e32ad7d416dc | 73b5d880fa06943c20ff0a9aee9d0c1d1eeebe10 | /tinyos-0.6.x/tools/net/tinyos/social/names/UserDB.java | 32f681e1c200ba6fb52f29f333cdb2be35a47bae | [] | no_license | x3ro/tinyos-legacy | 101d19f9e639f5a9d59d3edd4ed04b1f53221e63 | cdc0e7ba1cac505fcace33b974b2e0aca1ccc56a | refs/heads/master | 2021-01-16T19:20:21.744228 | 2015-06-30T20:23:05 | 2015-06-30T20:23:05 | 38,358,728 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,607 | java | package net.tinyos.social.names;
import javax.swing.DefaultListModel;
import java.util.Enumeration;
class UserDB extends DefaultListModel
{
Sql sql;
DefaultListModel names;
MoteInfo add(int moteId) {
MoteInfo m = add(new MoteInfo(moteId));
sql.addMote(m.moteId, m.name);
return m;
}
MoteInfo add(MoteInfo m) {
// Add in sorted order
Enumeration elems = names.elements();
int index = 0;
while (elems.hasMoreElements()) {
MoteInfo elem = (MoteInfo)elems.nextElement();
if (m.moteId == elem.moteId)
return null; // duplicate
if (m.moteId < elem.moteId) {
break;
}
index++;
}
names.add(index, m);
return m;
}
int lookupIndex(int moteId) {
Enumeration elems = names.elements();
int index = 0;
while (elems.hasMoreElements()) {
MoteInfo elem = (MoteInfo)elems.nextElement();
if (elem.moteId == moteId)
return index;
index++;
}
return -1;
}
MoteInfo lookupByIndex(int index) {
if (index < 0 || index >= names.size())
return null;
return (MoteInfo)names.elementAt(index);
}
boolean delIndex(int index) {
if (index < 0 || index >= names.size())
return false;
sql.delMote(lookupByIndex(index).moteId);
names.remove(index);
return true;
}
boolean setNameByIndex(int index, String name) {
if (index < 0 || index >= names.size())
return false;
MoteInfo m = (MoteInfo)names.get(index);
m.name = name;
names.set(index, m);
sql.setMoteName(m.moteId, name);
return true;
}
UserDB() {
names = this;
sql = new Sql();
sql.connect();
sql.getMotes(this);
}
}
| [
"lucas@x3ro.de"
] | lucas@x3ro.de |
c59f47c3f776f6a53a1f54eb57602aae6ddf7bc5 | 7abc3448fb637f3ff558f585c733957a29218002 | /app/src/main/java/com/lichi/goodrongyi/ui/activity/course/PurchaseCourseActivity.java | be9f7fc02ace3e58aac5e2b125e6a80e06aa48b7 | [] | no_license | sengeiou/GoodRongYi | 0c807bd5ac9e111c3377062ef883b775e11dac4f | 8670104c3d1ae662202f10695caa0f197fc81d96 | refs/heads/master | 2021-09-13T20:31:01.068265 | 2018-05-04T01:22:00 | 2018-05-04T01:22:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,076 | java | package com.lichi.goodrongyi.ui.activity.course;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.alipay.sdk.app.PayTask;
import com.lichi.goodrongyi.R;
import com.lichi.goodrongyi.logger.Logger;
import com.lichi.goodrongyi.mvp.model.CoursePayBean;
import com.lichi.goodrongyi.mvp.model.CustomerBean;
import com.lichi.goodrongyi.mvp.model.UserBean;
import com.lichi.goodrongyi.mvp.model.VerificationCodeBean;
import com.lichi.goodrongyi.mvp.presenter.PurchaseCoursePresenter;
import com.lichi.goodrongyi.mvp.view.PurchaseCourseView;
import com.lichi.goodrongyi.ui.activity.video.VideoActivity;
import com.lichi.goodrongyi.ui.base.BaseActivity;
import com.lichi.goodrongyi.utill.CommonUtils;
import com.lichi.goodrongyi.utill.Constants;
import com.lichi.goodrongyi.utill.CountDownTimerUtils;
import com.lichi.goodrongyi.utill.IOUtils;
import com.lichi.goodrongyi.utill.JudgeInstall;
import com.lichi.goodrongyi.utill.PayResult;
import com.lichi.goodrongyi.utill.PhoneUtil;
import com.lichi.goodrongyi.utill.ThreadPoolProxy;
import com.umeng.socialize.ShareAction;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.UMShareListener;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.media.UMImage;
import com.umeng.socialize.shareboard.SnsPlatform;
import com.umeng.socialize.utils.Log;
import com.umeng.socialize.utils.ShareBoardlistener;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
public class PurchaseCourseActivity extends BaseActivity<PurchaseCourseView, PurchaseCoursePresenter> implements View.OnClickListener, PurchaseCourseView {
private ImageView mIVWeinxinCheck;
private ImageView mIVAlipayCheck;
private TextView mTVOriginalPrice;
private TextView mTVCourseTitle;
private TextView mTVChangePhone;
private Button mBtnCustomer; //购买
private TextView mETUserName;
private EditText mETNote;
private EditText mEtVerifyCode;
private Button mBTNSignUp;
private LinearLayout mApplylayout; //验证码布局
private TextView mTvUserType;
private TextView mTvPrice;
private TextView mPhoneNumber; //本机号码
private EditText mTvPhoneNumber; //手机号
private TextView mTvChangePhone; //切换
private TextView mBtnSendVerifyCode; //验证码
public String ID;
public String money;
public String title;
public boolean isSwitchover = true;
private UMShareListener mShareListener;
private ShareAction mShareAction;
UserBean userBean;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_purchase_course);
ID = getIntent().getStringExtra(Constants.IntentParams.ID);
money = getIntent().getStringExtra(Constants.IntentParams.ID2);
title = getIntent().getStringExtra(Constants.IntentParams.ID3);
initData();
initView();
/* if (TextUtils.isEmpty(IOUtils.getToken(mContext))) {
mApplylayout.setVisibility(View.VISIBLE);
mTvChangePhone.setVisibility(View.GONE);
mTvPhoneNumber.setVisibility(View.VISIBLE);
mPhoneNumber.setVisibility(View.GONE);
} else {
mApplylayout.setVisibility(View.GONE);
mTvChangePhone.setVisibility(View.VISIBLE);
UserBean userBean = IOUtils.getUserBean(mContext);
if (userBean != null) {
mETUserName.setText(userBean.nickname);
if (!TextUtils.isEmpty(userBean.mobile)) {
if (!TextUtils.isEmpty(userBean.mobile)) {
mPhoneNumber.setText(userBean.mobile);
} else {
mTvPhoneNumber.setText("");
mApplylayout.setVisibility(View.VISIBLE);
mTvChangePhone.setVisibility(View.GONE);
}
} else {
mApplylayout.setVisibility(View.VISIBLE);
mTvChangePhone.setVisibility(View.GONE);
mTvPhoneNumber.setVisibility(View.VISIBLE);
mPhoneNumber.setVisibility(View.GONE);
}
}
}*/
userBean = IOUtils.getUserBean(mContext);
mETUserName.setText(userBean.nickname);
mPhoneNumber.setText(userBean.mobile);
mTvPrice.setText("¥ " + money);
mTVCourseTitle.setText("" + title);
}
public void initView() {
mBtnCustomer = (Button) findViewById(R.id.btn_customer);
mBtnSendVerifyCode = (TextView) findViewById(R.id.btn_send_verify_code);
mTvChangePhone = (TextView) findViewById(R.id.tv_change_phone);
mEtVerifyCode = (EditText) findViewById(R.id.et_verify_code);
mPhoneNumber = (TextView) findViewById(R.id.phone_number);
mTvPrice = (TextView) findViewById(R.id.tv_price);
mTvPhoneNumber = (EditText) findViewById(R.id.tv_phone_number);
mApplylayout = (LinearLayout) findViewById(R.id.applylayout);
mTvUserType = (TextView) findViewById(R.id.tv_user_type);
mTVCourseTitle = (TextView) findViewById(R.id.tv_course_title);
mETUserName = (TextView) findViewById(R.id.et_user_name);
mETNote = (EditText) findViewById(R.id.et_note);
mTVOriginalPrice = (TextView) findViewById(R.id.tv_original_price);
mTVOriginalPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); // 给原价添加中划线
mIVWeinxinCheck = (ImageView) findViewById(R.id.iv_weixin_checked);
mIVAlipayCheck = (ImageView) findViewById(R.id.iv_alipay_checked);
mIVWeinxinCheck.setOnClickListener(this);
mIVAlipayCheck.setOnClickListener(this);
findViewById(R.id.iv_back).setOnClickListener(this);
findViewById(R.id.tv_back).setOnClickListener(this);
mTvChangePhone.setOnClickListener(this);
findViewById(R.id.btn_signup).setOnClickListener(this);
mBtnSendVerifyCode.setOnClickListener(this);
mBtnCustomer.setOnClickListener(this);
}
@Override
public PurchaseCoursePresenter initPresenter() {
return new PurchaseCoursePresenter();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_back:
case R.id.tv_back:
PurchaseCourseActivity.this.finish();
break;
case R.id.btn_customer:
// PurchaseCourseActivity.this.finish();
mPresenter.getCustomer("4");
break;
case R.id.iv_weixin_checked:
mIVWeinxinCheck.setImageResource(R.mipmap.checked_true);
mIVAlipayCheck.setImageResource(R.mipmap.checked_false);
break;
case R.id.iv_alipay_checked:
mIVWeinxinCheck.setImageResource(R.mipmap.checked_false);
mIVAlipayCheck.setImageResource(R.mipmap.checked_true);
break;
case R.id.btn_send_verify_code:
if (TextUtils.isEmpty(mTvPhoneNumber.getText().toString().trim())) {
CommonUtils.showToast(mContext, "请输入手机号");
return;
}
if (!PhoneUtil.isMobileNO(mTvPhoneNumber.getText().toString().trim())) {
CommonUtils.showToast(mContext, "请输入正确的手机号");
return;
}
closeKeyboard();
mPresenter.verificationCode(mTvPhoneNumber.getText().toString().trim());
break;
case R.id.btn_signup:
/* ShareBoardConfig config = new ShareBoardConfig();
config.setMenuItemBackgroundShape(ShareBoardConfig.BG_SHAPE_NONE);
config.setTitleText("分享");
mShareAction.open(config);*/
// mPresenter.getPayCourse(ID);
mPresenter.getPayZfbCourse(ID);
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
mPresenter.dettach();
}
private void initData() {
mShareListener = new CustomShareListener(PurchaseCourseActivity.this);
/*增加自定义按钮的分享面板*/
mShareAction = new ShareAction(PurchaseCourseActivity.this).setDisplayList(
SHARE_MEDIA.WEIXIN)
.setShareboardclickCallback(new ShareBoardlistener() {
@Override
public void onclick(SnsPlatform snsPlatform, SHARE_MEDIA share_media) {
if (snsPlatform.mShowWord.equals("umeng_sharebutton_copy")) {
Toast.makeText(PurchaseCourseActivity.this, "复制文本按钮", Toast.LENGTH_LONG).show();
} else if (snsPlatform.mShowWord.equals("umeng_sharebutton_copyurl")) {
Toast.makeText(PurchaseCourseActivity.this, "复制链接按钮", Toast.LENGTH_LONG).show();
} else if (share_media == SHARE_MEDIA.SMS) {
new ShareAction(PurchaseCourseActivity.this).withText("来自分享面板标题")
.setPlatform(share_media)
.setCallback(mShareListener)
.share();
} else {
UMImage imageurl = new UMImage(PurchaseCourseActivity.this, R.drawable.receipt);
new ShareAction(PurchaseCourseActivity.this).withMedia(imageurl)
.setPlatform(share_media)
.setCallback(mShareListener).share();
}
}
});
}
@Override
public void setLoadingIndicator(boolean active) {
showLoadingIndicator(active);
}
@Override
public void showLoadingTasksError() {
CommonUtils.showToast(mContext, R.string.app_abnormal);
}
@Override
public void dataListSucceed(CoursePayBean courseBeans) {
}
@Override
public void dataCodeSucceed(VerificationCodeBean verificationCodeBean) {
CountDownTimerUtils mCountDownTimerUtils = new CountDownTimerUtils(mBtnSendVerifyCode, 60000, 1000, R.color.line, R.color.colorPrimary);
mCountDownTimerUtils.start();
}
@Override
public void CustomerSucceed(CustomerBean bean) {
if (!TextUtils.isEmpty(bean.qq)) {
if (JudgeInstall.isQQClientAvailable(mContext)) {
String urlview = "mqqwpa://im/chat?chat_type=wpa&uin=" + bean.qq;
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(urlview)));
} else {
CommonUtils.showToast(mContext, "请先安装QQ或IM");
}
} else {
CommonUtils.showToast(mContext, "暂无客服,请稍等");
}
}
@Override
public void PayCourseSucceed(String url) {
Map<String, Serializable> args = new HashMap<>();
args.put(Constants.IntentParams.ID, url);
CommonUtils.startNewActivity(mContext, args, PayWebActivity.class);
// startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
@Override
public void PayZfbCourseSucceed(String data) {
execAlipay(data);
}
/**
* 支付宝支付
*/
private void execAlipay(final String orderInfo) {
ThreadPoolProxy.getInstance().executeTask(new Runnable() {
@Override
public void run() {
PayTask alipay = new PayTask(PurchaseCourseActivity.this);
Map map = alipay.payV2(orderInfo, true);
Message msg = mHandler.obtainMessage();
msg.obj = map;
msg.what = SDK_PAY_FLAG;
mHandler.sendMessage(msg);
Logger.d("支付宝:" + map);
}
});
}
private static final int SDK_PAY_FLAG = 1;
@SuppressLint("HandlerLeak")
private Handler mHandler = new Handler() {
@SuppressWarnings("unused")
public void handleMessage(Message msg) {
switch (msg.what) {
case SDK_PAY_FLAG: {
@SuppressWarnings("unchecked")
PayResult payResult = new PayResult((Map<String, String>) msg.obj);
/**
对于支付结果,请商户依赖服务端的异步通知结果。同步通知结果,仅作为支付结束的通知。
*/
String resultInfo = payResult.getResult();// 同步返回需要验证的信息
String resultStatus = payResult.getResultStatus();
// 判断resultStatus 为9000则代表支付成功
if (TextUtils.equals(resultStatus, "9000")) {
// 该笔订单是否真实支付成功,需要依赖服务端的异步通知。
Toast.makeText(mContext, "支付成功", Toast.LENGTH_SHORT).show();
finish();
} else {
// 该笔订单真实的支付结果,需要依赖服务端的异步通知。
Toast.makeText(mContext, "支付失败", Toast.LENGTH_SHORT).show();
}
break;
}
default:
break;
}
}
;
};
@Override
public void dataDefeated(String msg) {
CommonUtils.showToast(mContext, msg);
}
@Override
public Context getContext() {
return mContext;
}
private static class CustomShareListener implements UMShareListener {
private WeakReference<PurchaseCourseActivity> mActivity;
private CustomShareListener(PurchaseCourseActivity activity) {
mActivity = new WeakReference(activity);
}
@Override
public void onStart(SHARE_MEDIA platform) {
}
@Override
public void onResult(SHARE_MEDIA platform) {
if (platform.name().equals("WEIXIN_FAVORITE")) {
Toast.makeText(mActivity.get(), platform + " 收藏成功啦", Toast.LENGTH_SHORT).show();
} else {
if (platform != SHARE_MEDIA.MORE && platform != SHARE_MEDIA.SMS
&& platform != SHARE_MEDIA.EMAIL
&& platform != SHARE_MEDIA.FLICKR
&& platform != SHARE_MEDIA.FOURSQUARE
&& platform != SHARE_MEDIA.TUMBLR
&& platform != SHARE_MEDIA.POCKET
&& platform != SHARE_MEDIA.PINTEREST
&& platform != SHARE_MEDIA.INSTAGRAM
&& platform != SHARE_MEDIA.GOOGLEPLUS
&& platform != SHARE_MEDIA.YNOTE
&& platform != SHARE_MEDIA.EVERNOTE) {
Toast.makeText(mActivity.get(), " 分享成功啦", Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onError(SHARE_MEDIA platform, Throwable t) {
if (platform != SHARE_MEDIA.MORE && platform != SHARE_MEDIA.SMS
&& platform != SHARE_MEDIA.EMAIL
&& platform != SHARE_MEDIA.FLICKR
&& platform != SHARE_MEDIA.FOURSQUARE
&& platform != SHARE_MEDIA.TUMBLR
&& platform != SHARE_MEDIA.POCKET
&& platform != SHARE_MEDIA.PINTEREST
&& platform != SHARE_MEDIA.INSTAGRAM
&& platform != SHARE_MEDIA.GOOGLEPLUS
&& platform != SHARE_MEDIA.YNOTE
&& platform != SHARE_MEDIA.EVERNOTE) {
Toast.makeText(mActivity.get(), " 分享失败啦", Toast.LENGTH_SHORT).show();
if (t != null) {
Log.d("throw", "throw:" + t.getMessage());
}
}
}
@Override
public void onCancel(SHARE_MEDIA platform) {
//Toast.makeText(mActivity.get(), platform + " 分享取消了", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data);
}
}
| [
"328797668@qq.com"
] | 328797668@qq.com |
63134974530534c35af4159b3e7315ca3d683b08 | e73b7c0b7305d83a3efade341c43884acfaa7b32 | /src/main/java/com/example/kubermarket/domain/User.java | 9f059937b95b2448e02bccebd23f5fd4fcc29fbf | [] | no_license | ahnseongeun/kubermarket-single-module | 9eb00e5c9ce37bc74694612c08266acc321e4afb | f3d2eb87ff6231e584ba945409c4a188f40c35fa | refs/heads/master | 2023-01-28T15:44:06.080349 | 2020-12-09T10:21:14 | 2020-12-09T10:21:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,020 | java | package com.example.kubermarket.domain;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Accessors(chain = true)
@Entity
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString (exclude = {"products","productReviews","chatRooms"})
@Table(name = "user")
public class User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(updatable = false,nullable = false,unique = true)
private String email;
@NotNull
private String password;
private String address1;
private String address2;
@CreationTimestamp
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime createDate;
@NotNull
private String nickName;
private String profileImageUrl;
@OneToMany(mappedBy = "user", fetch= FetchType.LAZY, cascade = CascadeType.ALL)
@JsonManagedReference("product_user")
private List<Product> products = new ArrayList<>();
@OneToMany(mappedBy = "user", fetch=FetchType.LAZY, cascade = CascadeType.ALL)
@JsonManagedReference("user_productReview")
private List<ProductReview> productReviews = new ArrayList<>();
@OneToMany(mappedBy = "user", fetch=FetchType.LAZY, cascade = CascadeType.ALL)
@JsonManagedReference("user_chatRoom")
private List<ChatRoom> chatRooms = new ArrayList<>();
}
| [
"ast3138@naver.com"
] | ast3138@naver.com |
e97d34cbd43d8859aaa558bdd5dd672f5455370c | 8541c4131798f505d43d6a9a5a7e3fbdd4c5d043 | /rest-two/src/main/java/com/samstercode/karafrecipes/rest/KarafRest.java | ccce7ab45ec8b4722d3b2185cd23c2109cc12b98 | [] | no_license | samster/karaf-recipes | 901fd9660c66efe3da6a19952ffd5934206e9333 | 39df86a3158d3e014d96fcc98b5db74f32eaeba4 | refs/heads/master | 2021-01-10T19:12:57.411269 | 2015-04-27T19:07:00 | 2015-04-27T19:07:00 | 22,387,683 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,042 | java | package com.samstercode.karafrecipes.rest;
import com.samstercode.karafrecipes.svc.KarafSvc;
import org.apache.cxf.rs.security.cors.CorsHeaderConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import java.util.ArrayList;
import java.util.List;
/**
* @author samster
*/
@Path("/")
@Produces({"application/json"})
public class KarafRest {
private static final transient Logger LOGGER = LoggerFactory.getLogger(KarafRest.class);
private List<KarafSvc> karafSvcList;
private List<KarafSvc> cachedKarafSvcList;
@Context
UriInfo uriInfo;
@GET
@Path("/")
@Produces("application/json")
public Response sayHelloWorld() {
LOGGER.debug("Entering sayHelloWorld()");
String returnString = "Unavailable";
if (cachedKarafSvcList.isEmpty()) {
//LOGGER.debug("Karaf service unavailable");
} else {
returnString = cachedKarafSvcList.get(0).getHelloWorld();
}
return Response.ok(returnString, MediaType.APPLICATION_JSON).
header(CorsHeaderConstants.HEADER_AC_ALLOW_ORIGIN, "*").build();
}
private synchronized void sortKarafSvcList() {
if (karafSvcList != null) {
cachedKarafSvcList = new ArrayList<KarafSvc>(karafSvcList);
}
}
public void bind(KarafSvc karafSvc) {
// LOGGER.debug("entering bind()");
sortKarafSvcList();
}
public synchronized void unbind(KarafSvc karafSvc) {
// LOGGER.debug("entering unbind()");
if (cachedKarafSvcList != null) {
cachedKarafSvcList.remove(karafSvc);
}
}
public void setKarafSvcList(List<KarafSvc> karafSvcList) {
// LOGGER.debug("entering setKarafSvcList()");
this.karafSvcList = karafSvcList;
sortKarafSvcList();
}
} | [
"samstercode@gmail.com"
] | samstercode@gmail.com |
820fb7ce3fc07d88a1ed2bc0a930ccdb494a4ba9 | ab19da3afe41875f59873a946a0053d1848ed04a | /XMPP_Client/src/imp/xmpp/XmppConversation.java | c3560e82fff0c193a3358e9659ff5ea6522a9a2c | [] | no_license | lgriffin/Misc-Java-Projects | 3b75b89e780f0a3c4d61462eb57dc9968a47f3ca | 07cebba267e7f3a6faeced2c4a4cba0ad2639952 | refs/heads/master | 2021-01-01T20:15:50.881883 | 2012-01-05T12:53:55 | 2012-01-05T12:53:55 | 3,109,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package imp.xmpp;
import imp.im.ImpBuddy;
import imp.im.ImpConversation;
import java.beans.PropertyChangeSupport;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.packet.Message;
public class XmppConversation implements ImpConversation, MessageListener
{
private Chat chat;
private ImpBuddy buddy;
private PropertyChangeSupport pcs;
public XmppConversation(ImpBuddy buddy, Chat chat)
{
this.chat = chat;
this.buddy = buddy;
chat.addMessageListener(this);
}
public ImpBuddy getBuddy()
{
return buddy;
}
public void sendMessage(String message) throws Exception
{
chat.sendMessage(message);
}
public PropertyChangeSupport getPCS()
{
return pcs;
}
public void processMessage(Chat chat, final Message message)
{
pcs.firePropertyChange("message", null, message.getBody());
}
}
| [
"lgriffin@tssg.org"
] | lgriffin@tssg.org |
bc73b78ce5d7a039e97e27a0947c0c8aa0471095 | 9d0ff754c58c190828214f51ceebdd82c207f872 | /src/main/java/com/demo/service/impl/EsiServiceImpl.java | 4df6e72496a1738903b3860917c54f30e6c3a3c8 | [] | no_license | huskyui/eve | aa3aab6f15f79153f2541d9ce300e715999d9caa | 68fe16f59b3a8a30566523f8f16c8e2758c83b7d | refs/heads/master | 2022-12-03T15:18:38.745911 | 2020-08-15T08:24:34 | 2020-08-15T08:24:34 | 287,421,059 | 0 | 0 | null | 2020-08-14T02:04:47 | 2020-08-14T02:04:47 | null | UTF-8 | Java | false | false | 137 | java | package com.demo.service.impl;
import org.springframework.stereotype.Service;
@Service("esiService")
public class EsiServiceImpl {
}
| [
"376195987@qq.com"
] | 376195987@qq.com |
46782c3909012113213d3eb0ea7ece3b5cfc51d6 | 1a84d45caa3d587154ad8a09c03d1c59c3560b7c | /steemj-core/src/test/java/eu/bittrade/libs/steemj/base/models/operations/SetResetAccountOperationIT.java | 463b048479ef627b58396dfac24afc82a695cb28 | [
"MIT"
] | permissive | BoomApps-LLC/SteemApp-Android | 694484c2c58ec835330272b0a87c6ba8fcb0c32c | f8ff7b430b221dc12ebb1e411b881d23f6db1c75 | refs/heads/master | 2020-03-20T15:46:23.258448 | 2018-08-30T20:32:17 | 2018-08-30T20:32:17 | 137,521,625 | 3 | 4 | MIT | 2018-09-01T08:52:05 | 2018-06-15T18:49:08 | Java | UTF-8 | Java | false | false | 3,251 | java | package eu.bittrade.libs.steemj.base.models.operations;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import java.util.ArrayList;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import eu.bittrade.libs.steemj.BaseTransactionVerificationIT;
import eu.bittrade.libs.steemj.IntegrationTest;
import eu.bittrade.libs.steemj.base.models.AccountName;
import eu.bittrade.libs.steemj.base.models.SignedTransaction;
import eu.bittrade.libs.steemj.base.models.TimePointSec;
/**
* Verify the functionality of the "set reset account operation" under the use
* of real api calls.
*
* @author <a href="http://steemit.com/@dez1337">dez1337</a>
*/
public class SetResetAccountOperationIT extends BaseTransactionVerificationIT {
private static final String EXPECTED_TRANSACTION_HEX = "f68585abf4dcebc8045701260764657a313333370006737465656d6a"
+ "00011b7d16fb4917505355d0ae04ceab7aa063904b692c321c850fed56a6bedd86967f2f225260e699a5ec23984b03d81824e"
+ "8ff0ba0a16164e03a730b5575f87f1097";
private static final String EXPECTED_TRANSACTION_HEX_TESTNET = "f68585abf4dce8c8045701260764657a3133333700067374"
+ "65656d6a00011c5b01313cf44b76c0211009b7ccb806a5a2b5aba0302c2318c316f053696f473c72f6fad5d275962d5772249"
+ "d807cdebc1cc1132cb60cfda63a773a67947ef945";
/**
* <b>Attention:</b> This test class requires a valid owner key of the used
* "account". If no owner key is provided or the owner key is not valid an
* Exception will be thrown. The owner key is passed as a -D parameter
* during test execution.
*
* @throws Exception
* If something went wrong.
*/
@BeforeClass()
public static void prepareTestClass() throws Exception {
setupIntegrationTestEnvironmentForTransactionVerificationTests(HTTP_MODE_IDENTIFIER,
STEEMNET_ENDPOINT_IDENTIFIER);
AccountName account = new AccountName("dez1337");
AccountName currentResetAccount = new AccountName("");
AccountName newResetAccount = new AccountName("steemj");
SetResetAccountOperation setResetAccountOperation = new SetResetAccountOperation(account, currentResetAccount,
newResetAccount);
ArrayList<Operation> operations = new ArrayList<>();
operations.add(setResetAccountOperation);
signedTransaction = new SignedTransaction(REF_BLOCK_NUM, REF_BLOCK_PREFIX, new TimePointSec(EXPIRATION_DATE),
operations, null);
signedTransaction.sign();
}
@Category({ IntegrationTest.class })
@Test
public void verifyTransaction() throws Exception {
assertThat(steemJ.verifyAuthority(signedTransaction), equalTo(true));
}
@Category({ IntegrationTest.class })
@Test
public void getTransactionHex() throws Exception {
if (TEST_ENDPOINT.equals(TESTNET_ENDPOINT_IDENTIFIER)) {
assertThat(steemJ.getTransactionHex(signedTransaction), equalTo(EXPECTED_TRANSACTION_HEX_TESTNET));
} else {
assertThat(steemJ.getTransactionHex(signedTransaction), equalTo(EXPECTED_TRANSACTION_HEX));
}
}
}
| [
"Vitaliy.Grechikha@artezio.com"
] | Vitaliy.Grechikha@artezio.com |
61ce4d871f5e4394bee1234629192cc19a774ed5 | 926d9fb0d947b1ecee3094c1560c6bf5096908b6 | /src/main/java/anubahv/insuracne/insuranceagency/repository/TokenRepository.java | 6b4037f91ecfb1f1b516ac820249c8db771c6ab7 | [] | no_license | kavyanshgangwar/InsuranceAgency | e3e9a58c832fddd8a001ec59e76a9d9235037073 | 47837ad72126169913dd2513c710c46df92feacb | refs/heads/master | 2023-01-06T19:39:02.002282 | 2020-11-15T19:30:51 | 2020-11-15T19:30:51 | 298,500,160 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package anubahv.insuracne.insuranceagency.repository;
import anubahv.insuracne.insuranceagency.models.VerificationToken;
public interface TokenRepository {
public VerificationToken getVerificationToken(String token);
public void save(VerificationToken verificationToken);
}
| [
"kavyanshgangwar.cse18@itbhu.ac.in"
] | kavyanshgangwar.cse18@itbhu.ac.in |
83e146029b2bca534f27d26284c2477ba43e7d24 | b51c5006dacdbccb439c4f8ccd7f78b943080589 | /Java Projects/Weather Project_3/stats/Record.java | b15fa6017db1459b547f9e3e0d8d87e4d6f032dd | [] | no_license | mtxg/Past-Projects | 5f5d96aa8a9aefc27de13d401fb4aac8df7b3a02 | e4e04579bf7e4d26f3b0435b0564a0e604914b9e | refs/heads/master | 2021-01-10T06:49:38.007657 | 2015-11-09T22:23:11 | 2015-11-09T22:23:11 | 45,870,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package stats;
/**
* Abstract class to hold records (highs and lows) data
*
* @author amy
*
*/
public abstract class Record {
protected double value;
protected int year;
/**
* Create a record with just the year and value
*
* @param value
* @param year
*/
public Record(double value, int year) {
}
/**
* Create a record with just the value
*
* @param value
*/
public Record(double value) {
}
/**
* Require the child classes to print themselves out well
*/
abstract public String toString();
public double getValue() {
}
public void setValue(double value) {
}
public int getYear() {
}
public void setYear(int year) {
}
}
| [
"max_guerrero@Maxs-MacBook-Pro.local"
] | max_guerrero@Maxs-MacBook-Pro.local |
87a2f010e0a254249848f4dbe2a8e598082ff8de | 08b0cb881c123bddede4f0b25c48c4041d83f8d0 | /src/main/java/facades/SalesTaxSeederFacade.java | 506dc7f7eadba13c61da58eab12c5439f6327ef4 | [
"Apache-2.0"
] | permissive | ErnestHolloway8482/retailmenot-taxesapi-holloway | 1963c6acbbd55e28bc4b6a67bf86de604f3b37aa | bfccc3e14389074548c7c1467bdca1017aad9ad7 | refs/heads/master | 2020-03-28T08:49:18.803188 | 2018-09-12T22:04:45 | 2018-09-12T22:04:45 | 147,991,866 | 0 | 0 | Apache-2.0 | 2018-09-12T21:57:49 | 2018-09-09T04:07:56 | Java | UTF-8 | Java | false | false | 4,628 | java | package facades;
import daos.SalesTaxDAO;
import managers.ObjectDBManager;
import managers.SalesTaxFileManager;
import mappers.SalesTaxMapper;
import models.database.SalesTaxDBModel;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;
/**
* @author ernestholloway
* <p>
* This class provides a series of convenience functions to handle seeding the tax data for
* all of 52 States in the USA to the embedded databse. It also allows the user to search the correct
* sales tax data by zipcode.
*/
@Singleton
public class SalesTaxSeederFacade {
public static final int TOTAL_NUMBER_OF_TAX_FILES = 52;
private final SalesTaxFileManager salesTaxFileManager;
private final SalesTaxMapper salesTaxMapper;
private final SalesTaxDAO salesTaxDAO;
private final ObjectDBManager objectDBManager;
private String databaseFileName = "sales_tax.odb";
private String databaseFileNameBackup = "sales_tax.odb$";
/**
* CTOR
*
* @param salesTaxFileManager
* @param salesTaxMapper
* @param salesTaxDAO
* @param objectDBManager
*/
@Inject
public SalesTaxSeederFacade(final SalesTaxFileManager salesTaxFileManager, final SalesTaxMapper salesTaxMapper, final SalesTaxDAO salesTaxDAO, final ObjectDBManager objectDBManager) {
this.salesTaxFileManager = salesTaxFileManager;
this.salesTaxMapper = salesTaxMapper;
this.salesTaxDAO = salesTaxDAO;
this.objectDBManager = objectDBManager;
}
/**
* Sets the file name and path for the database file and auto-sets the backup file that ends in "$".
*
* @param fileNameAndPath is the full file name and path for the database file.
*/
public void setDatabaseFileName(final String fileNameAndPath) {
if (fileNameAndPath == null) {
return;
}
databaseFileName = fileNameAndPath;
databaseFileNameBackup = fileNameAndPath + "$";
}
/**
* Seeds all of the .csv files containing the sales tax information into the object database.
*
* @return true if successfully seeded, false otherwise.
*/
public boolean seedSalesTaxData() {
boolean successful = false;
//If we've already seeded the data into our database, no need to do it again.
if (salesTaxDAO.getTotalNumber() > 0) {
System.out.println("Sales Tax Data Has Already Been Seeded.");
return false;
}
String[] fileNames = salesTaxFileManager.getTaxFileNames();
//The file name should not be null and we should have 52, one tax file for each state.
if (fileNames == null || fileNames.length < TOTAL_NUMBER_OF_TAX_FILES) {
System.out.println("The Sales Tax Data Cannot Be Accessed.");
return false;
}
//Create the database file. If we can't create it, bail.
if (!objectDBManager.openDataBase(databaseFileName)) {
System.out.println("The database cannot be opened.");
return false;
}
for (String fileName : fileNames) {
List<String> rawData = salesTaxFileManager.getSalesTaxData(fileName);
if (rawData != null && !rawData.isEmpty()) {
for (String rowContent : rawData) {
SalesTaxDBModel dbModel = salesTaxMapper.map(rowContent);
if (dbModel != null) {
successful = salesTaxDAO.create(dbModel);
}
}
}
}
return successful;
}
/**
* Returns a {@link SalesTaxDBModel} based on the zipCode.
*
* @param zipCode is the zipCode that is used to search for the corresponding sales tax.
* @return {@link SalesTaxDBModel} if found for the zipcode, null otherwise.
*/
public SalesTaxDBModel getSalesTaxDataByZipCode(final String zipCode) {
return salesTaxDAO.readByZipCode(zipCode);
}
/**
* Removes all of the {@link SalesTaxDBModel} from the database and deletes the database file.
*
* @return true if the sales tax info and database file are successfully deleted, false otherwise.
*/
public boolean deleteSalesTaxDatabaseFile() {
boolean dataCleared = salesTaxDAO.deleteAll();
//If we can't close the database bail.
objectDBManager.closeDataBase(databaseFileName);
boolean databaseFileCleared = objectDBManager.deleteDataBase(databaseFileName);
objectDBManager.deleteDataBase(databaseFileNameBackup);
return dataCleared && databaseFileCleared;
}
}
| [
"ernest.holloway@embersoftwarellc.com"
] | ernest.holloway@embersoftwarellc.com |
337811626bfc0a5b54a75baf4a450f7b95c9bb2b | 8f854fa78f5ddaceeabb7ffcd4da6a83e3eb808c | /Downwork-collective project/back-end/apigateway/src/main/java/ro/ubb/downWork/apigateway/dto/ApiGatewayJobDto.java | 24bb3b4d2dd98445eacf6001433d33f81e724e71 | [] | no_license | ancafai/faculty-projects | c3ac890a0abb724767517c72d2ab64fbfaf3fc2a | 015492f50a20479513817fabed72910436a7effa | refs/heads/master | 2020-04-01T14:01:17.473456 | 2018-10-16T12:15:56 | 2018-10-16T12:15:56 | 153,277,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,567 | java | package ro.ubb.downWork.apigateway.dto;
import ro.ubb.downWork.profilemicro.model.CostType;
import ro.ubb.downWork.profilemicro.model.JobOccurrence;
import ro.ubb.downWork.profilemicro.model.JobStatus;
import java.sql.Date;
import java.sql.Time;
public class ApiGatewayJobDto extends ApiGatewayNewJobDto {
private Long id;
private JobStatus status;
private Time startTime;
private Time endTime;
private ApiGatewayJobDto() {
}
public ApiGatewayJobDto(Long id, String title, String description, JobStatus status, String location, JobOccurrence occurrence,
Date startDate, Date endDate,
Time startTime, Time endTime, Double cost,
CostType costType, String owner, String jobtype, Boolean isOffer) {
super(title, description, location, occurrence, startDate, endDate, cost, costType, owner, jobtype, isOffer);
this.id = id;
this.status = status;
this.startTime = startTime;
this.endTime = endTime;
}
public Long getId() {
return id;
}
public JobStatus getStatus() {
return status;
}
public Time getStartTime() {
return startTime;
}
public Time getEndTime() {
return endTime;
}
@Override
public String toString() {
return "ApiGatewayJobDto{" +
"id=" + id +
", status=" + status +
", startTime=" + startTime +
", endTime=" + endTime +
'}';
}
}
| [
"anca.okey@yahoo.com"
] | anca.okey@yahoo.com |
c6c190c4294813399661c054816bb6a10b407788 | c93fca9aaba2c664946caa230457cb07718992b6 | /src/main/java/com/deezer/web/controller/ArtistController.java | 9b24c787d9bc73f939112dad871f9afb73e3bbc5 | [] | no_license | DmitriyShalimov/Deezer | a5ca6beb1d7fe7c92f9db01431a5dda47fefa873 | c312617d01070c6cf9dcd0699459cd0ac8fd2336 | refs/heads/master | 2020-03-28T13:12:51.242631 | 2018-12-11T14:21:17 | 2018-12-11T14:21:17 | 148,375,558 | 0 | 0 | null | 2018-12-11T13:23:15 | 2018-09-11T20:22:44 | Java | UTF-8 | Java | false | false | 1,751 | java | package com.deezer.web.controller;
import com.deezer.entity.Artist;
import com.deezer.service.ArtistService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/artist")
public class ArtistController {
private final Logger logger = LoggerFactory.getLogger(getClass());
private ArtistService artistService;
@Autowired
public ArtistController(ArtistService artistService) {
this.artistService = artistService;
}
@GetMapping(value = "search/{mask}", produces = MediaType.APPLICATION_JSON_VALUE)
public List<Artist> getArtistsByMask(@PathVariable String mask) {
logger.info("Start request to get artist by mask {}", mask);
long start = System.currentTimeMillis();
List<Artist> artistsByMask = artistService.getArtistsByMask(mask);
logger.info("Artist by mask {} are {}. It took {} ms", mask, artistsByMask, System.currentTimeMillis() - start);
return artistsByMask;
}
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public List<Artist> getAllArtists() {
return artistService.getAll();
}
@GetMapping(value = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public Artist getArtistById(@PathVariable int id) {
logger.info("Start retrieving artist {}", id);
return artistService.getById(id);
}
}
| [
"eugeniadzytsiuk@ukr.net"
] | eugeniadzytsiuk@ukr.net |
2f1bd2a8f4f2d57da1136f1e111bf0ba40834d40 | 8d3852e0e4b7d8df4be85afe913d3b7d1671588a | /src/org/hong/thread/api/ThreadPriorityApi.java | 2fcd941446a1ffa265ad64306934fb0e0bd084cd | [] | no_license | jinhongliang2020/java-concurrent-examples | ddfac23e06535bbbcb2c1374d2d89b35bb200350 | 14315144ac85a096f8efecbd0c098e4342977d20 | refs/heads/master | 2021-08-19T21:35:30.401714 | 2017-11-27T13:03:12 | 2017-11-27T13:03:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,355 | java | package org.hong.thread.api;
/**
* @Description: (Thread 类api之线程优先级.)
* @author hong
* @date 2017/11/17
* @version v1.1
*/
public class ThreadPriorityApi {
public static void main(String[] args) {
Thread thread_1 =new Thread(){
@Override
public void run() {
for (int i = 0; i < 1000; i++) {
System.out.println(Thread.currentThread().getName() + "-Index" + i);
}
}
};
thread_1.setPriority(Thread.NORM_PRIORITY);
Thread thread_2 =new Thread(){
@Override
public void run() {
for (int i = 0; i < 1000; i++) {
System.out.println(Thread.currentThread().getName() + "-Index" + i);
}
}
};
thread_2.setPriority(Thread.MIN_PRIORITY);
Thread thread_3 =new Thread(){
@Override
public void run() {
for (int i = 0; i < 1000; i++) {
System.out.println(Thread.currentThread().getName() + "-Index" + i);
}
}
};
thread_3.setPriority(Thread.MAX_PRIORITY);
// 注:设置为优先级高的不一定优先执行
thread_1.start();
thread_2.start();
thread_3.start();
}
}
| [
"1043518275@qq.com"
] | 1043518275@qq.com |
611b4fedeaff6a5acaeac0303e98682b6fc02de9 | 7d51b03a1904e0fd023b67e80b6c1816b691ae1b | /src/test/java/tests/CheckPriceTest.java | dd95d04eed1da4494d6ef5916c4bb5ecf74ac9c7 | [] | no_license | HannaKaniewska/XTMTestProject | d5ea9ee6a80eccb09a3711184444da02e7922fa8 | e951d0e9918e8952751be6dc1509b5f0329b1dd4 | refs/heads/master | 2023-05-07T21:16:47.696863 | 2021-05-21T10:05:25 | 2021-05-21T10:05:25 | 369,300,486 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | package tests;
import org.testng.Assert;
import org.testng.annotations.Test;
import pages.CalculatorPage;
import pages.MainPage;
import utils.AccountType;
import utils.Currency;
public class CheckPriceTest extends BaseTest {
@Test
public void checkPriceTest() {
//Go to Calculator page, change account type, number of users and subscription length
CalculatorPage calculatorPage = new MainPage(driver)
.choosePricingMenuItem()
.chooseCalculatorMenuItem()
.changeAccountType(AccountType.LSP)
.changeNumberOfUsers(7)
.changeSubscriptionLength(3);
//check the price in GBP (default selection), EUR and USD
Assert.assertEquals(calculatorPage.getTotalCost(), "£1065,00");
calculatorPage.changeCurrency(Currency.EUR);
Assert.assertEquals(calculatorPage.getTotalCost(), "€1214,10");
calculatorPage.changeCurrency(Currency.USD);
Assert.assertEquals(calculatorPage.getTotalCost(), "$1533,60");
}
}
| [
"hanna.kaniewska@gmail.com"
] | hanna.kaniewska@gmail.com |
3f70640ab017a49fe91c0330197f75ea16b4c35e | 90d1baf4421af2d886d16c10dbfea274113c5469 | /src/by/htp/luchko/decomposition/Task07.java | aa8999d0c4b536d6476893031a3d2a858d8f6783 | [] | no_license | altrosa/HomeWork_Java_Fundamentals_part2 | 4701ae9f524e5c5e00e50d09fe5f55e9ce5f7d2a | de1bdb761859222f8613f7f4c796117342c6d184 | refs/heads/master | 2020-09-08T04:23:54.767122 | 2019-11-11T15:58:16 | 2019-11-11T15:58:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package by.htp.luchko.decomposition;
public class Task07 {
/*
* На плоскости заданы своими координатами n точек. Написать метод(методы),
* определяющие, между какими из пар точек самое большое расстояние. Указание.
* Координаты точек занести в массив.
*
*/
public static void main(String[] args) {
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e6c35a0d2ac7272211bd1387c533347d41796920 | 42866e55dbb6d9d795ee16aa36369ba13ceba9f8 | /src/main/java/com/test/gogo/conditional/ConditionalOnBeanTest.java | 968a0dbb23871515a9703b8495477063be7c99e2 | [] | no_license | 648539234/happy | 6a5911885ec09f1410a641e5da3979f83633d995 | 134208779a34d343d6dd8bdcd50ed615c86c0787 | refs/heads/master | 2022-09-01T11:18:46.037149 | 2020-06-02T01:46:23 | 2020-06-02T01:46:23 | 267,475,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.test.gogo.conditional;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Auther: WuYuXiang
* @Date: 2020/1/13
* @Description: com.test.gogo.conditional
* @version: 1.0
*/
@Configuration
public class ConditionalOnBeanTest {
@Bean
@ConditionalOnBean
public Person getPerson(){
return new Person("111",12);
}
}
| [
"648539234@qq.com"
] | 648539234@qq.com |
050e84699fa7091dc5867bf9304c8428dc75b340 | fdf823d773713103016b118477fc4fec6d07ebe1 | /testGit/src/testGit/Main.java | 20b5a2b1a7ce03af73e02e0b2a8a70d8523fae6c | [] | no_license | nao7009/testEclipse | f3a3824dd8ca6e678a5c679192892fdef832d76c | d7abe20fe8059b213070d8f605ca0c3048445a47 | refs/heads/master | 2022-11-22T19:10:53.663381 | 2020-07-29T01:20:15 | 2020-07-29T01:20:15 | 283,357,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | package testGit;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ"
System.out.println("Hello GitHub!");
System.out.println("Hello GitHub!");
}
}
| [
"nao0909n@yahoo.co.jp"
] | nao0909n@yahoo.co.jp |
59fb6de9116c8a279a870b3d395c0362d8a1c14e | caf0201f8f1aaf6a8de954150a423859d8cf0402 | /src/main/java/com/sydoruk1ua/lessons/lesson10/Main.java | 2c6303527d2cb470e079324078476f02b0c7b3a4 | [] | no_license | Sydoruk1ua/lessonsAndHomework | 88523c1c5fda6670a0e474794380f7ea3c129050 | bc57da5338a87f78fdfd31a5558d4eb35f49671e | refs/heads/master | 2022-11-21T12:38:41.563646 | 2019-05-18T17:39:21 | 2019-05-25T04:39:22 | 177,133,035 | 0 | 0 | null | 2022-11-16T12:20:30 | 2019-03-22T12:05:51 | Java | UTF-8 | Java | false | false | 1,732 | java | package com.sydoruk1ua.lessons.lesson10;
import com.sydoruk1ua.lessons.lesson10.example1.*;
public class Main {
public static void main(String[] args) {
IntContainer intContainer = new IntContainer(1);
int intValue = intContainer.getA();
StringContainer stringContainer = new StringContainer("string");
String stringValue = stringContainer.getA();
AContainer aContainer = new AContainer(new A());
A aValue = aContainer.getA();
ObjectContainer intObjectContainer = new ObjectContainer(1);
Integer intObjectValue = (Integer) intObjectContainer.getA();
ObjectContainer stringObjectContainer = new ObjectContainer("string");
String stringObjectValue = (String) stringObjectContainer.getA();
// Integer stringObjectValueFake = (Integer) stringObjectContainer.getA();
GenericContainer<Integer> genericContainer = new GenericContainer<>(1);
Integer a = genericContainer.getA();
GenericContainer<A> aGenericContainer = new GenericContainer<>(new A());
A a1 = aGenericContainer.getA();
GenericContainer<A> bGenericContainer = new GenericContainer<>(new B());
/* B b = (B) aGenericContainer.getA();
b.methodB();*/
Number[] numberArray = {1, 2.0, 3.0};
ArrayContainer<Number> numberArrayContainer = new ArrayContainer<>(numberArray);
ArrayContainer<Integer> integerArrayContainer = new ArrayContainer<>(new Integer[]{1, 2, 3});
System.out.println(numberArrayContainer.sum());
System.out.println(numberArrayContainer.isEquals(integerArrayContainer));
// System.out.println(integerArrayContainer.isEquals(numberArrayContainer));
}
}
| [
"sydoruk1ua@gmail.com"
] | sydoruk1ua@gmail.com |
e387d1e615e8313fbbde367086c4574fede73768 | cafafc7250b461b2c3e5f65008c34061bb84f69c | /excel/src/main/java/excel/excel/Excelnew.java | 1c686dd61e4970647a39a3960f9a00e51794750f | [] | no_license | sankorkumar/excel | 0e355a644580cbc4dad699e7da72b40e5f89c2e2 | 480cc355761d347c495551486d6ce82915867cf2 | refs/heads/master | 2023-05-09T04:46:22.137106 | 2021-06-06T01:59:17 | 2021-06-06T01:59:17 | 374,247,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 779 | java | package excel.excel;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Cell;
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.xssf.usermodel.XSSFWorkbook;
public class Excelnew {
public static void main(String[] args) throws IOException {
String s="data/Sample.xlsx";
FileOutputStream fw=new FileOutputStream(s);
Workbook wb=new XSSFWorkbook();
Sheet sh =wb.createSheet("Sheet1");
Row r =sh.createRow(0);
Cell c=r.createCell(0);
Cell c1=r.createCell(1);
c.setCellValue("java");
c1.setCellValue("fun");
wb.write(fw);
fw.close();
}
}
| [
"sankorkumar1976@gmail.com"
] | sankorkumar1976@gmail.com |
a631a3722d59b5ae638eb3a2fdb9a33f00b5e259 | 284d9839c86c6537957272b62c699b87d6e18e7c | /Old/VersoesSemTela/coletaInteligente_comTelas/src/coletaInteligente/Status.java | 55b47afabfcfed77f17511e6b7f98388aabe18c4 | [] | no_license | codingwiththi/POO1-Coleta-Inteligente | 45cd28057abdb2959c2e011eec9c06f65a54c450 | 810ac8e7d85a6f0594412514aca9e272877c92e8 | refs/heads/master | 2023-04-07T05:04:01.684436 | 2019-07-05T01:16:07 | 2019-07-05T01:16:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,047 | java |
package coletaInteligente;
import Validador.ValidadorStatus;
import java.util.Random;
public class Status {
private int codigo;
private String descricao;
public Status(){
}
public Status(String descricao) throws Exception{
Random random = new Random();
setCodigo(Integer.toString(random.nextInt(90)));
setDescricao(descricao);
}
public int getCodigo() {
return codigo;
}
public void setCodigo(String codigo) throws Exception {
ValidadorStatus valida = new ValidadorStatus();
valida.codigo(codigo);
this.codigo = Integer.parseInt(codigo);
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) throws Exception {
ValidadorStatus valida = new ValidadorStatus();
valida.descricao(descricao);
this.descricao = descricao;
}
@Override
public String toString() {
return getCodigo()+", "+getDescricao();
}
}
| [
"jacksonwilliansilvaagostinho@gmail.com"
] | jacksonwilliansilvaagostinho@gmail.com |
00b0e8ec3e6c938461a20bee2f867289a43a1700 | d743888c3f214c9e7954db39b171dec346ead657 | /Spring Data Advanced Querying - Lab/shampoo_company/src/main/java/app/dao/ProductionBatchDao.java | fda0c9d6686758b2538bd6036a77bcb4cbaa3d37 | [] | no_license | GeorgeK95/DatabasesAdvanced | 6683000266d922e7855cca4e55b246d8a97d0b49 | cb2ed0fcaff163617460d860af70f2105471a7e1 | refs/heads/master | 2020-12-03T07:58:46.414568 | 2017-08-31T11:10:10 | 2017-08-31T11:10:10 | 95,643,423 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 707 | java | package app.dao;
import app.domain.impl.ProductionBatch;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
/**
* Created by George-Lenovo on 7/23/2017.
*/
@Repository
@Transactional
public interface ProductionBatchDao extends JpaRepository<ProductionBatch, Long> {
List<ProductionBatch> findByName(String name);
List<ProductionBatch> findProductionBatchByBatchDateAfter(Date date);
List<ProductionBatch> findProductionBatchByBatchDateBefore(Date date);
List<ProductionBatch> findBasicIngredientsJoinProductionBatchByShampoosNull();
}
| [
"george_it@abv.bg"
] | george_it@abv.bg |
173597f46010e16fa2f0ccdac085ef103ce9e275 | 5554460dbfe2d6b4653e0ee278d6060210480767 | /ToDoList/app/src/test/java/ch/ibw/reto/todolist/ExampleUnitTest.java | c82c290e550529e557afdb237fb3fa1c70dfcf10 | [] | no_license | Reto7/Android-All | 172fa4c6c3a89966aa8d03b5b104d39112edc7cb | 50c9c0de6ed483a527da4f8af9eea0dee6487fbd | refs/heads/master | 2021-01-20T00:37:49.593999 | 2017-06-15T19:01:18 | 2017-06-15T19:01:18 | 89,163,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package ch.ibw.reto.todolist;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"reto.kaufmann@adon.li"
] | reto.kaufmann@adon.li |
dcee1da03e988828c5e0c2f5be3a99d238a3401a | 7c5bb728c6d349306057ee027726481ef3344b09 | /src/replit_assignments/r_156MethodsWithReturn.java | b65f7bd75c2e148c4c130f11ebc427885807b03a | [] | no_license | sheeraz47/Summer2019-Java | df6d4bd2bd114dd98e1abf759707683e42f5f3f4 | 51078264adecf95778d49710f3d2674862473f28 | refs/heads/master | 2020-12-03T09:06:40.958667 | 2020-01-01T21:40:11 | 2020-01-01T21:40:11 | 221,108,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | package replit_assignments;
public class r_156MethodsWithReturn {
/*
Create a method that gets an array of strings and a string, the method returns an int.
It counts how many times a string appears in the array and returns the count.
for example (pseudo code):
some_array = ["a","foo","bar","foo","bla"]
some_string = "foo"
count_appearance(some_array ,some_string )
will return 2 because some_array has 2 appearances of "foo" string.
*/
public static int count_appearance(String[] arr, String t) {
int count=0;
for(int i=0; i<arr.length; i++) {
if(arr[i].equals(t)) {
count++;
}
}
System.out.println(count);
return count;
} //end count_appearance
public static void main(String[] args) {
String t="apple";
String[] arr= {"apple", "melon", "pech", "apple", "apple"};
count_appearance(arr, t);
}
}
| [
"sheeraz47@gmail.com"
] | sheeraz47@gmail.com |
3720cd8ba8e883e999c6717cbbec479aa47d0393 | 163d27c75d802b07a32901f9ee39c2ff13996cf0 | /src/main/java/com/fid/demo/entity/Dividend.java | 92287fd8523b0cb89c52787a6361a8017e97d732 | [] | no_license | fidelyoldasalkan/stock-management | 0647ec0652d0d5e26d757dbedd31223ac627be7a | ed67627d84b1b91fba11630bdf88eb97adb05e7d | refs/heads/master | 2023-06-01T22:22:11.505754 | 2021-06-20T23:43:28 | 2021-06-20T23:43:28 | 378,509,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 456 | java | package com.fid.demo.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Where;
import javax.persistence.Entity;
import java.time.LocalDate;
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@Where(clause = "is_active = true")
public class Dividend extends BaseEntity {
private Integer accountId;
private LocalDate date;
private String stock;
private Integer lot;
private Double amount;
}
| [
"fidely.alkan@gmail.com"
] | fidely.alkan@gmail.com |
dd51554e6a4832407a1dcbd681099332e0b7bb60 | 9724780c9c5eebdbfc2748cd6a0571eb76a72135 | /app/src/androidTest/java/com/example/test03/ExampleInstrumentedTest.java | dc24b74549dd93668876a514c13f3a026a1837c3 | [] | no_license | ZhouXiaoZhouHonor/Test03 | a07375c0a4c934b769527f13fad2df59eb090358 | ef683c5640f244f03859b0ffa3972c82ce7cd3e8 | refs/heads/master | 2020-08-10T14:41:35.385649 | 2019-10-11T06:37:17 | 2019-10-11T06:37:17 | 214,361,729 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package com.example.test03;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.test03", appContext.getPackageName());
}
}
| [
"48113550+ZhouXiaoZhouHonor@users.noreply.github.com"
] | 48113550+ZhouXiaoZhouHonor@users.noreply.github.com |
0942c378e78c743163e7ec74f29dc5a28f164b0b | f95054af6ade93a24607fec96d333f538212884e | /Project_4/src/p4_package/QuadCalc_Class_S4.java | bd3aa85adc98fb74a60c8cb05ea92b20fba4a18e | [] | no_license | qejmc/cs136 | b304fa4a34e126d10c5d7b23a1cfa1ba79522f9d | 8035aa61b4ea71f3de2eb0e31811c98ae6d1f543 | refs/heads/master | 2023-04-02T04:34:00.474919 | 2021-04-13T22:39:30 | 2021-04-13T22:39:30 | 345,461,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,450 | java | package p4_package;
public class QuadCalc_Class_S4
{
//Standard character constants
public static final char DASH = '-';
public static final char DOUBLE_DASH = '=';
public static final char PIPE = '|';
public static final char CROSS = '+';
//Character constants with spacing
public static final String PIPE_SPACE = "| ";
public static final String SPACE_PIPE = " |";
public static final String CROSS_SPACE = "+ ";
//Integer constants
public static final int PRECISION = 2;
public static final int TABLE_WIDTH = 44;
public static final int NAME_BLOCK_WIDTH = 29;
public static final int VALUE_BLOCK_WIDTH = 12;
public static final int DENOMINATOR_COEFF = 2;
public static final int DISCRIMINANT_COEFF = 4;
//Spacing constant
public static final int TWO_ENDLINES = 2;
//Precision constant
public static final double PRECISION_OFFSET = 0.000001;
//Create console IO instance
private static Console_IO_Class conIO = new Console_IO_Class();
public static void main(String[] args)
{
//Quadratic Formula:
//x = (-b +- sqrt(b^2 - 4ac))/ 2a
//Variable declarations
int coeffA, coeffB, coeffC;
double discriminant, discriminantSqrt, denominator;
boolean complexFlag = false;
double rootOne = 0.0, rootTwo = 0.0;
//print title
//Method: printString, printEndline(s), printChars
conIO.printString("Quadratic Root Finding Program");
conIO.printEndline();
conIO.printChars(NAME_BLOCK_WIDTH + 1, DOUBLE_DASH);
conIO.printEndlines(TWO_ENDLINES);
//prompt user for a,b,c
//Method: promptForInt, printEndlines
coeffA = conIO.promptForInt(" Enter Coefficient A: ");
coeffB = conIO.promptForInt(" Enter Coefficient B: ");
coeffC = conIO.promptForInt(" Enter Coefficient C: ");
conIO.printEndlines(TWO_ENDLINES);
//find roots if possible
//find discriminant
discriminant = coeffB * coeffB -
DISCRIMINANT_COEFF * coeffA * coeffC;
//check for complex root
//set complex flag to true
if(discriminant < 0)
{
complexFlag = true;
}
//otherwise, find roots (assume 1 or 2 roots)
else
{
//find square root of discriminant
discriminantSqrt = Math.sqrt(discriminant);
//find denominator
denominator = DENOMINATOR_COEFF * coeffA;
//calculate both roots
rootOne = (-coeffB + discriminantSqrt) / denominator;
rootTwo = (-coeffB - discriminantSqrt) / denominator;
}
//display table
//methods: printChar, printChars, printString, printEndline,
//printDouble
//line 1
conIO.printChar(PIPE);
conIO.printChars(TABLE_WIDTH, DOUBLE_DASH);
conIO.printChar(PIPE);
conIO.printEndline();
//line 2
conIO.printChar(PIPE);
conIO.printString("QUADRATIC ROOT RESULTS", TABLE_WIDTH, "CENTER");
conIO.printChar(PIPE);
conIO.printEndline();
//line 3
conIO.printChar(PIPE);
conIO.printChars(TABLE_WIDTH, DASH);
conIO.printChar(PIPE);
conIO.printEndline();
//line 4
conIO.printString(PIPE_SPACE);
conIO.printString("VALUE NAME", NAME_BLOCK_WIDTH, "CENTER");
conIO.printChar(PIPE);
conIO.printString("VALUE", VALUE_BLOCK_WIDTH, "CENTER");
conIO.printString(SPACE_PIPE);
conIO.printEndline();
//line 5
conIO.printChar(PIPE);
conIO.printChars(NAME_BLOCK_WIDTH + 1, DOUBLE_DASH);
conIO.printChar(PIPE);
conIO.printChars(VALUE_BLOCK_WIDTH + 1, DOUBLE_DASH);
conIO.printChar(PIPE);
conIO.printEndline();
//line 6
conIO.printString(PIPE_SPACE);
conIO.printString("Coefficient A", NAME_BLOCK_WIDTH, "LEFT");
conIO.printChar(CROSS);
conIO.printDouble(coeffA, PRECISION, VALUE_BLOCK_WIDTH, "RIGHT");
conIO.printString(SPACE_PIPE);
conIO.printEndline();
//line 7
conIO.printChar(PIPE);
conIO.printChars(NAME_BLOCK_WIDTH + 1, DASH);
conIO.printChar(PIPE);
conIO.printChars(VALUE_BLOCK_WIDTH + 1, DASH);
conIO.printChar(PIPE);
conIO.printEndline();
//line 8
conIO.printString(PIPE_SPACE);
conIO.printString("Coefficient B", NAME_BLOCK_WIDTH, "LEFT");
conIO.printChar(CROSS);
conIO.printDouble(coeffB, PRECISION, VALUE_BLOCK_WIDTH, "RIGHT");
conIO.printString(SPACE_PIPE);
conIO.printEndline();
//line 9
conIO.printChar(PIPE);
conIO.printChars(NAME_BLOCK_WIDTH + 1, DASH);
conIO.printChar(PIPE);
conIO.printChars(VALUE_BLOCK_WIDTH + 1, DASH);
conIO.printChar(PIPE);
conIO.printEndline();
//line 10
conIO.printString(PIPE_SPACE);
conIO.printString("Coefficient C", NAME_BLOCK_WIDTH, "LEFT");
conIO.printChar(CROSS);
conIO.printDouble(coeffC, PRECISION, VALUE_BLOCK_WIDTH, "RIGHT");
conIO.printString(SPACE_PIPE);
conIO.printEndline();
//line 11
conIO.printChar(PIPE);
conIO.printChars(NAME_BLOCK_WIDTH + 1, DOUBLE_DASH);
conIO.printChar(PIPE);
conIO.printChars(VALUE_BLOCK_WIDTH + 1, DOUBLE_DASH);
conIO.printChar(PIPE);
conIO.printEndline();
//check for complex
//Method: if statement, printString, printChar, printEndline
if(complexFlag)
{
//subline 1
conIO.printString(PIPE_SPACE);
conIO.printString("Roots", NAME_BLOCK_WIDTH, "LEFT");
conIO.printChar(CROSS);
conIO.printString("Complex", VALUE_BLOCK_WIDTH, "RIGHT");
conIO.printString(SPACE_PIPE);
conIO.printEndline();
}
//check for only 1 root
// if((num1 + offset > num2) && (num1 - offset < num2))
// num1 == num2 within precision
//Method: else if statement, printString, printChar, printDouble,
//printEndline
else if((rootOne + PRECISION_OFFSET > rootTwo) &&
(rootOne - PRECISION_OFFSET < rootTwo))
{
//subline 1
conIO.printString(PIPE_SPACE);
conIO.printString("Single Root", NAME_BLOCK_WIDTH, "LEFT");
conIO.printChar(CROSS);
conIO.printDouble(rootOne, PRECISION,
VALUE_BLOCK_WIDTH, "RIGHT");
conIO.printString(SPACE_PIPE);
conIO.printEndline();
}
//otherwise, 2 roots
//Method: else, printString, printChar, printDouble, printEndline
else
{
//subline 1
conIO.printString(PIPE_SPACE);
conIO.printString("Root One", NAME_BLOCK_WIDTH, "LEFT");
conIO.printChar(CROSS);
conIO.printDouble(rootOne, PRECISION,
VALUE_BLOCK_WIDTH, "RIGHT");
conIO.printString(SPACE_PIPE);
conIO.printEndline();
//subline 2
conIO.printChar(PIPE);
conIO.printChars(NAME_BLOCK_WIDTH + 1, DASH);
conIO.printChar(PIPE);
conIO.printChars(VALUE_BLOCK_WIDTH + 1, DASH);
conIO.printChar(PIPE);
conIO.printEndline();
//subline 3
conIO.printString(PIPE_SPACE);
conIO.printString("Root Two", NAME_BLOCK_WIDTH, "LEFT");
conIO.printChar(CROSS);
conIO.printDouble(rootTwo, PRECISION,
VALUE_BLOCK_WIDTH, "RIGHT");
conIO.printString(SPACE_PIPE);
conIO.printEndline();
}
//Ending line
conIO.printChar(PIPE);
conIO.printChars(NAME_BLOCK_WIDTH + 1, DOUBLE_DASH);
conIO.printChar(PIPE);
conIO.printChars(VALUE_BLOCK_WIDTH + 1, DOUBLE_DASH);
conIO.printChar(PIPE);
conIO.printEndlines(TWO_ENDLINES);
//Print End Program
conIO.printString("End Program");
}
}
| [
"35905481+qejmc@users.noreply.github.com"
] | 35905481+qejmc@users.noreply.github.com |
35f93e9b4a2d1bcdbbc710e5943ad0e3486ec5c4 | dbb96864058fcf1de7dadb8cab313c219771cf0f | /src/com/stockAcc/Examples/login.java | bb8103e126ed60d2ead8ac97bb3a0d634cf6ec12 | [] | no_license | sunithap/ojt321 | e69c5545d7582aa66946ac69306a4fe9ac0ddb81 | 5fa1686d854f9f42dfd69ac538be10526276d7db | refs/heads/master | 2021-01-17T08:47:31.916329 | 2016-07-13T06:35:41 | 2016-07-13T06:35:41 | 63,220,745 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.stockAcc.Examples;
public class login {
public static void main(String[] args) {
stockMaster sm = new stockMaster();
String res=sm.stockAcc_Launch("http://webapp.qedgetech.com");
System.out.println(res);
res=sm.stockAcc_Login("admin","master");
System.out.println(res);
res=sm.stockAcc_Logout();
System.out.println(res);
sm.stockAcc_Close();
}
}
| [
"sunitha@qedge.com"
] | sunitha@qedge.com |
59b6b9866d4464058bee52990be1e10d3c9ff687 | 92a27bc461d4d9a500473a32af349cb0c8d4d39d | /src/main/java/au/com/shinetech/config/metrics/DatabaseHealthIndicator.java | 189d47b6b8fa1500369db4c9882c60f665fd44b1 | [] | no_license | mickleroy/fitdonations | 95c7cc23b96ef596fcdaeb7a41ebce6ac24234b3 | 8365e34c74d9db50b69657d8c124182116b0ab19 | refs/heads/master | 2020-12-24T14:18:10.761177 | 2015-02-01T01:16:45 | 2015-02-01T01:16:45 | 30,099,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,369 | java | package au.com.shinetech.config.metrics;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils;
import javax.sql.DataSource;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
/**
* SpringBoot Actuator HealthIndicator check for the Database.
*/
public class DatabaseHealthIndicator extends AbstractHealthIndicator {
private DataSource dataSource;
private JdbcTemplate jdbcTemplate;
private static Map<String, String> queries = new HashMap<>();
static {
queries.put("HSQL Database Engine",
"SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_USERS");
queries.put("Oracle", "SELECT 'Hello' from DUAL");
queries.put("Apache Derby", "SELECT 1 FROM SYSIBM.SYSDUMMY1");
queries.put("MySQL", "SELECT 1");
queries.put("PostgreSQL", "SELECT 1");
queries.put("Microsoft SQL Server", "SELECT 1");
}
private static String DEFAULT_QUERY = "SELECT 1";
private String query = null;
public DatabaseHealthIndicator(DataSource dataSource) {
this.dataSource = dataSource;
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
String product = getProduct();
builder.up().withDetail("database", product);
String query = detectQuery(product);
if (StringUtils.hasText(query)) {
try {
builder.withDetail("hello",
this.jdbcTemplate.queryForObject(query, Object.class));
} catch (Exception ex) {
builder.down(ex);
}
}
}
private String getProduct() {
return this.jdbcTemplate.execute((Connection connection) -> connection.getMetaData().getDatabaseProductName());
}
protected String detectQuery(String product) {
String query = this.query;
if (!StringUtils.hasText(query)) {
query = queries.get(product);
}
if (!StringUtils.hasText(query)) {
query = DEFAULT_QUERY;
}
return query;
}
public void setQuery(String query) {
this.query = query;
}
}
| [
"mickjleroy@gmail.com"
] | mickjleroy@gmail.com |
af79a98c60eb64d3b452ac1574c3db7225366567 | cfb2e3a19dd18e5ad89d1b5ddb031cd41eea6d3f | /algorithmSourceCode/排序算法.java | 38e9af030376ea8b569a984ec6dd21b5da4b0c68 | [] | no_license | jackwangc/RecruitNote | ac875234eb9a2dec215847db8de3acf78642df29 | 87ab3b09546a21373dae8e4e395745653a324aa4 | refs/heads/master | 2020-03-31T13:07:08.153270 | 2019-07-23T02:38:09 | 2019-07-23T02:38:09 | 152,242,257 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,062 | java | import java.util.Arrays;
/*
* @Author: jackwang
* @Date: 2019-01-04 19:54:19
* @LastEditTime: 2019-01-14 19:20:58
* @decription: 经典排序算法总结
*/
class ArraySort {
// 1. 冒泡排序
public int[] bubbleSort(int[] array) {
// 如果想要不改变输入元素
// int[] arr = Arrays.copyOf(sourceArray, sourceArray.length);
int len = array.length;
for (int i = 0; i < len; i++){
boolean flag = true; // 优化标记 当一次排序没有发生元素交换时,排序已经完成
for (int j = 0; j < len - i; j++){
if (array[j] > array[j + 1]) {
int temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
flag = false; // 优化标记
}
}
// 判断优化
if (flag) {
break;
}
}
return array;
}
// 2. 选择排序
public int[] selectSort(int[] array) {
// 每次选择比较出最小值放在最前面
for (int i = 0; i < array.length - 1; i++) {
int min = i;
for (int j = i + 1; j < array.length; j++) {
if (array[min] > array[j]){
min = j;
}
}
if (i!=min) {
int temp = array[i];
array[i] = array[min];
array[min] = temp;
}
}
return arr;
}
// 3. 插入排序
public int[] insertSort(int[] array) {
for (int i = 1; i < array.length; i++) {
int temp = array[i];
int j = i;
while (j > 0 && temp < array[j - 1]){
arr[j] = arr[j - 1];
j--;
}
if(j!=i){
arr[j] = temp;
}
}
return array;
}
public void insertSort2(int[] arr) {
int n = arr.length;
for (int i = 1; i < n; ++i) {
int value = arr[i];
int j = 0;//插入的位置
for (j = i-1; j >= 0; j--) {
if (arr[j] > value) {
arr[j+1] = arr[j];//移动数据
} else {
break;
}
}
arr[j+1] = value; //插入数据
}
}
// 4. 希尔排序 希尔排序是插入排序的改进
public int[] ShellSort(int[] arr) {
int gap = 1;
while (gap < arr.length){
gap = gap * 3 + 1;
}
while (gap > 0){
for (int i = gap; i < arr.length; i++){
int tmp = arr[i];
int j = i - gap;
while (j >= 0 && arr[j] > tmp) {
arr[j + gap] = arr[j];
j -= gap;
}
arr[j + gap] = tmp;
}
gap = (int)Math.floor(gap / 3);
}
return arr;
}
// 5. 快速排序
public int[] quickSort(int[] arr) {
return quickSort(arr, 0, arr.length - 1);
}
// 递归
private int[] quickSort(int[] arr, int left, int right){
if (left < right){
int partitionIndex = partition(arr, left, right); // 寻找基准值的交换位置
quickSort(arr, left, partitionIndex - 1);
quickSort(arr, partition + 1, right);
}
return arr;
}
// 基准数左边的数小于基准数 基准数右边的数大于基准数
// 找到比基准数小的数 置换到左边
private int partition (int[] arr, int left, int right) {
int pivot = left; // 基准数
int index = pivot + 1;
for (int i = index; i <= right; i++) {
if (arr[i] < arr[pivot]) {
swap(arr, i, index);
index++; // 记录基准数
}
}
swap(arr, pivot, index - 1);
return index - 1; // 将基准数放在中间的位置
}
// 另外一种判断基准位置的方法
private int partition2 (int[] arr, int left, int right) {
int i = left, j = right;
int tmp = arr[left]; // 基准数
// 重复步骤,直到左右两个指针相遇
while (i != j) {
// 从右往左扫描,找到一个小于基准值的元素
while (i < j && arr[j] > tmp) {
j--;
}
// 从左往右找到一个大于基准值的元素
while (i < j && arr[i] < tmp){
i++;
}
// 交换这两个元素的位置
if (i < j) {
swap(arr,i,j);
}
}
// 再将基准值与左侧最右边的元素交换
arr[left] = a[i];
arr[i] = tmp;
return i;
}
// 6. 堆排序
// 堆排序的思路
// 将待排序序列构造成一个大顶堆,此时,整个序列的最大值就是堆顶的根节点。
// 将其与末尾元素进行交换,此时末尾就为最大值。
// 然后将剩余n-1个元素重新构造成一个堆,这样会得到n个元素的次小值。如此反复执行,便能得到一个有序序列了
public int[] heapSort(int[] arr) {
int len = arr.length;
buildMaxHeap(arr, len); // 构建大顶堆
for (int i = len - 1; i > 0; i--) {
swap(arr, 0 , i); // 交换顶堆头部元素到末尾
len--;
heapify(arr, 0, len); // 重新构造大顶堆
}
return arr;
}
// 构建大顶堆
// 堆 具有以下性质的完全二叉树 大顶堆,每个节点的值大于或等于其左右孩子节点的值
// 小顶堆 每个节点的值小于或等于其左右孩子结点的值
private void buildMaxHeap(int[] arr, int len) {
for (int i = (int)Math.floor(len/2); i >= 0; i--) { // (int)Math.floor(len/2) 最后一个非叶子节点;i-- 寻找下一个非叶子节点
heapify(arr, i, len); // 第一次被排除掉 从 i-1 开始
}
}
// 堆调整
private void heapify(int[] arr, int i, int len) {
int left = 2 * i + 1;
int right = 2 * i + 2;
int largest = i;
// 比较单个节点序列 寻找节点最大值的下标
if (left < len && arr[left] > arr[largest]) {
largest = left;
}
if (right < len && arr[right] > arr[largest]) {
largest = right;
}
// 如果最大值不是父节点,交换,然后继续调整堆
if (largest != i) {
swap(arr, i, largest);
heapify(arr, largest, len); // 交换会导致子节点结构混乱,调整子节点
}
}
// 7. 归并排序
public int[] mergeSort(int[] arr) {
if (arr.length < 2){
return arr;
}
int middle = (int)Math.floor(arr.length / 2);
int[] left = Arrays.copyOfRange(arr, 0, middle);
int[] right = Arrays.copyOfRange(arr,middle,arr.length);
return merge(mergeSort(left),mergeSort(right));
}
//
private int[] merge(int[] left, int[] right){
int[] result = new int[left.length + right.length];
int i = 0;
while (left.length > 0 && right.length > 0) {
if (left[0] <= right[0]){
result[i++] = left[0]; // 将比较结果移动到结果数组中
left = Arrays.copyOfRange(left,1,left.length);
}else{
result[i++] = right[0];
right = Arrays.copyOfRange(right,1,right.length);
}
}
while (left.length > 0) { // 将剩余元素放进结果中,当有一边为0时,进入这个循环
result[i++] = left[0];
left = Arrays.copyOfRange(left,1,left.length);
}
while (right.length > 0) {
result[i++] = right[0];
right = Arrays.copyOfRange(right,1,right.length);
}
return result;
}
// 归并排序,好理解的版本
public void mergeSort2(int[] arr){
// 1. 数组长度
int len = arr.length;
// 2. 分枝
sort(arr, 0, len - 1);
}
private void sort(int[] arr, int left, int right){
if (left < right) {
int mid = left + (right - left) >> 1;
sort(arr, left, mid);
sort(arr, mid, right);
// 3. 合并
merge(data, left, mid + 1, right);
}
}
public static void merge(int[] data, int left, int center, int right) {
// 临时数组
int[] tmpArr = new int[data.length];
// 右数组第一个元素索引
int mid = center + 1;
// third 记录临时数组的索引
int third = left;
// 缓存左数组第一个元素的索引
int tmp = left;
while (left <= center && mid <= right) {
// 从两个数组中取出最小的放入临时数组
if (data[left] <= data[mid]) {
tmpArr[third++] = data[left++];
} else {
tmpArr[third++] = data[mid++];
}
}
// 剩余部分依次放入临时数组(实际上两个 while 只会执行其中一个)
while (mid <= right) {
tmpArr[third++] = data[mid++];
}
while (left <= center) {
tmpArr[third++] = data[left++];
}
// 将临时数组中的内容拷贝回原数组中
// (原 left-right 范围的内容被复制回原数组)
while (tmp <= right) {
data[tmp] = tmpArr[tmp++];
}
}
// 交换函数 java 中不能使用 交换函数,因为 java 的参数传递 传递的是值,没有传递地址
// public void swap(num1, num2) {
//
// }
// 交换函数 只能将数组一并传入
public void swap(int[] arr, int i, int j){
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
| [
"wang.jie.jack6@gmail.com"
] | wang.jie.jack6@gmail.com |
7716230ae876585e9f85dd5e19307255acbd11bc | 8d2b3fcfd7e4111aaa7f64baa49f816848e3dc02 | /src/com/flexymind/alpha/player/Note.java | edf3b09b3774070427951c3b4cf3c4f1dc6674a4 | [] | no_license | ilya-korytnyy/flexymind-alpha | d992db53ea36d00cc65fd9c3bfb415646b691afe | 260532bfdb9d2d338866c8143f0d49f5057a7e1c | refs/heads/master | 2016-09-10T20:37:01.061563 | 2012-05-25T22:25:13 | 2012-05-25T22:25:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,000 | java | package com.flexymind.alpha.player;
import java.util.Arrays;
public enum Note {
C, // до
Cz, // до диез
D, // ре
Dz, // ре диез
E, // ми
F, // фа
Fz, // фа диез
G, // соль
Gz, // соль диез
A, // ля
Az, // ля диез
H, // си
C1, // до
UNKNOW;
private static Note[] blackNotes = new Note[] { Cz, Dz, Fz, Gz, Az };
private static Note[] whiteNotes = new Note[] { C, D, E, F, G, A, H, C1 };
private static Note[] allNotes = new Note[] { C, Cz, D, Dz, E, F, Fz, G, Gz, A, Az, H, C1 };
/**
* Returns the tone associated with the specified {@code id}. ID is set up in Midi parsing library.
*
* @param id ID of the Note
* @return The Note
*/
public static Note getToneByMidiFileId(int id){
switch (id){
case 57:
return Note.A;
case 58:
return Note.Az;
case 48:
return Note.C;
case 49:
return Note.Cz;
case 60:
return Note.C1;
case 50:
return Note.D;
case 51:
return Note.Dz;
case 52:
return Note.E;
case 53:
return Note.F;
case 54:
return Note.Fz;
case 55:
return Note.G;
case 56:
return Note.Gz;
case 59:
return Note.H;
default:
return Note.UNKNOW;
}
}
public static Note[] getNotesForBlackKeys() {
return blackNotes;
}
public static Note[] getNotesForWhiteKeys() {
return whiteNotes;
}
public static Note[] getNotesForAllKeys() {
return allNotes;
}
}
| [
"azkobain@ya.ru"
] | azkobain@ya.ru |
561ec6c9aeec36db63d97f28baabab6023724f39 | 72f9e89cd6e32d04ecc8a2d0794c9f3c00b274e5 | /app/src/main/java/com/andrinotech/studentapp/CreatePostFragmentnew.java | 4f881c9c2ef4b4b8ff6ce9924da55f62199c77a9 | [] | no_license | ZAidBinAsif/StuudentApp | ed3262cc19a30137b0be5fe0f2c2f94f7996aedd | bc1b5c0771bd6bf6c9df3843bf7ef97c00b728ab | refs/heads/master | 2020-03-31T16:53:06.565075 | 2018-10-10T09:23:37 | 2018-10-10T09:23:37 | 152,396,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 783 | java | package com.andrinotech.studentapp;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@SuppressLint("ValidFragment")
public class CreatePostFragmentnew extends Fragment {
////////////////
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_login, container, false);
return view;
// return super.onCreateView(inflater, container, savedInstanceState);
}
}
| [
"chetna.sharda.coder@gmail.com"
] | chetna.sharda.coder@gmail.com |
edfa0098bba25c5fb43e7e2a238051a013e97f9e | 03f6205164afb3208147f8fc7b8cc6ff2c241a1c | /src/main/java/com/aks/gradle/guava/MetricCode.java | 4cd30b6b1bfc942437f29fbc0a76934dcbd9cd89 | [] | no_license | asharma2/jgenerals | 10721d72f9348e2cba038137d342f84e321ad07c | 50241c82c6e69c7a9ec4657824d0b028c53708bf | refs/heads/master | 2020-03-28T18:30:17.101089 | 2018-09-26T06:20:15 | 2018-09-26T06:20:15 | 148,886,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 909 | java | package com.aks.gradle.guava;
public class MetricCode {
String name;
int code;
public String getName() {
return name;
}
public MetricCode setName(String name) {
this.name = name;
return this;
}
public int getCode() {
return code;
}
public MetricCode setCode(int code) {
this.code = code;
return this;
}
@Override
public int hashCode() {
int prime = 23;
int result = 31;
result = result * prime + code;
result = result * prime + (name != null ? name.hashCode() : 0);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof MetricCode))
return false;
MetricCode that = (MetricCode) obj;
return (this.name.equals(that.name) && this.code == that.code);
}
@Override
public String toString() {
return "Metric [name=" + name + ", code=" + code + "]";
}
}
| [
"atul_sharma@spglobal.com"
] | atul_sharma@spglobal.com |
d0fabe1aaa821c02e168c16a56845b9db4923188 | ac19beb6459c82e14305b6c320fcda7b967e8b76 | /src/main/java/nl/mad/toucanpdf/pdf/syntax/PdfPage.java | 7b2dc8a258da33e46f927306b1d5b4de12f185a9 | [] | no_license | lequynhnhu/pdf-library | ed82cf7f565d13d3d8cd12da93d6c7776a8a818d | 43704656191e3021ddc6807f8d8fa957dbf1bf09 | refs/heads/master | 2020-12-25T23:57:15.033226 | 2014-06-03T09:02:37 | 2014-06-03T09:02:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,638 | java | package nl.mad.toucanpdf.pdf.syntax;
import nl.mad.toucanpdf.model.PdfNameValue;
/**
* PdfPage stores all the data necessary to form a page. The class is responsible for holding it's own content and used resources.
*
* @author Dylan de Wolff
*/
public class PdfPage extends PdfDictionary {
private int width;
private int height;
private int marginLeft;
private int marginRight;
private int marginTop;
private int marginBottom;
private int leading;
/**
* The amount of resources this page uses.
*/
private int resourceCount;
/**
* The current content stream.
*/
private PdfStream currentStream;
private static final PdfName CONTENT = new PdfName(PdfNameValue.CONTENTS);
private static final PdfName RESOURCES = new PdfName(PdfNameValue.RESOURCES);
private static final String RESOURCE_REFERENCE_PREFIX = "R";
/**
* Creates a new instance of PdfPage with the given width and height.
* @param width Width of page.
* @param height Height of page.
* @param leading the space between lines.
*/
public PdfPage(int width, int height, int leading, int rotation) {
super(PdfObjectType.PAGE);
this.width = width;
this.height = height;
this.leading = leading;
this.resourceCount = 0;
this.initPage(rotation);
}
/**
* Initializes the page by adding type, mediabox, resources and content.
*/
private void initPage(int rotation) {
put(PdfNameValue.TYPE, PdfNameValue.PAGE);
put(PdfNameValue.MEDIA_BOX, createMediabox());
put(RESOURCES, new PdfDictionary(PdfObjectType.DICTIONARY));
put(CONTENT, new PdfArray());
put(PdfNameValue.ROTATION, new PdfNumber(rotation));
}
/**
* Creates a new Mediabox PdfArray based on the height and width of the page.
* The mediabox is responsible for specifying the size/visible area of the page
* @return
*/
private PdfArray createMediabox() {
PdfArray mediabox = new PdfArray();
mediabox.addValue(new PdfNumber(0));
mediabox.addValue(new PdfNumber(0));
mediabox.addValue(new PdfNumber(width));
mediabox.addValue(new PdfNumber(height));
return mediabox;
}
/**
* Adds an indirect object to the resources or contents of this page.
* @param indirectObject Object to be added.
*/
public void add(PdfIndirectObject indirectObject) {
switch (indirectObject.getObject().getType()) {
case STREAM:
this.addContent(indirectObject);
break;
case XOBJECT:
case FONT:
this.addResource(indirectObject);
break;
default:
break;
}
}
/**
* Adds a reference to the given object to the contents array.
* @param indirectObject IndirectObject to be added.
*/
public void addContent(PdfIndirectObject indirectObject) {
PdfArray currentContent = (PdfArray) this.get(CONTENT);
currentContent.addValue(indirectObject.getReference());
this.currentStream = (PdfStream) indirectObject.getObject();
}
/**
* Adds a resource to the resource array.
* @param indirectObject Resource to be added.
*/
public void addResource(PdfIndirectObject indirectObject) {
PdfDictionary currentResources = (PdfDictionary) this.get(RESOURCES);
PdfName key = getKeyForType(indirectObject.getObject().getType());
if (!objectInResources(indirectObject, currentResources, key)) {
++resourceCount;
String resourceReference = RESOURCE_REFERENCE_PREFIX + this.resourceCount;
indirectObject.getReference().setResourceReference(resourceReference);
PdfName resourceKey = new PdfName(resourceReference);
if (currentResources.get(key) != null) {
PdfDictionary keyResourceDictionary = (PdfDictionary) currentResources.get(key);
keyResourceDictionary.put(resourceKey, indirectObject.getReference());
} else {
PdfDictionary newResource = new PdfDictionary(PdfObjectType.DICTIONARY);
newResource.put(resourceKey, indirectObject.getReference());
currentResources.put(key, newResource);
}
}
}
private boolean objectInResources(PdfIndirectObject indirectObject, PdfDictionary currentResources, PdfName key) {
if (currentResources.get(key) != null) {
PdfDictionary keyResources = (PdfDictionary) currentResources.get(key);
if (keyResources.containsValue(indirectObject.getReference())) {
return true;
}
}
return false;
}
/**
* Returns dictionary key corresponding to the given type.
* @param type Type of object.
* @return Key for the dictionary.
*/
private PdfName getKeyForType(PdfObjectType type) {
PdfName key = null;
switch (type) {
case FONT:
key = new PdfName(PdfNameValue.FONT);
break;
case XOBJECT:
key = new PdfName(PdfNameValue.XOBJECT);
break;
default:
break;
}
return key;
}
public void setCurrentStream(PdfStream stream) {
this.currentStream = stream;
}
public PdfStream getCurrentStream() {
return this.currentStream;
}
/**
* Checks if the stream is empty.
* @return true if the stream is empty, false otherwise
*/
public boolean streamEmpty() {
if (this.currentStream != null && this.currentStream.getContentSize() > 0) {
return false;
}
return true;
}
public int getWidth() {
return this.width;
}
public int getHeight() {
return this.height;
}
/**
* @return the marginLeft
*/
public int getMarginLeft() {
return marginLeft;
}
/**
* @param marginLeft the marginLeft to set
*/
public void setMarginLeft(int marginLeft) {
this.marginLeft = marginLeft;
}
/**
* @return the marginRight
*/
public int getMarginRight() {
return marginRight;
}
/**
* @param marginRight the marginRight to set
*/
public void setMarginRight(int marginRight) {
this.marginRight = marginRight;
}
/**
* @return the marginTop
*/
public int getMarginTop() {
return marginTop;
}
/**
* @param marginTop the marginTop to set
*/
public void setMarginTop(int marginTop) {
this.marginTop = marginTop;
}
/**
* @return the marginBottom
*/
public int getMarginBottom() {
return marginBottom;
}
/**
* @param marginBottom the marginBottom to set
*/
public void setMarginBottom(int marginBottom) {
this.marginBottom = marginBottom;
}
/**
* Sets the values for all margins.
* @param leftMargin Left margin to use.
* @param rightMargin Right margin to use.
* @param bottomMargin Bottom margin to use.
* @param topMargin Top margin to use.
*/
public void setMargins(int leftMargin, int rightMargin, int bottomMargin, int topMargin) {
this.marginLeft = leftMargin;
this.marginRight = rightMargin;
this.marginBottom = bottomMargin;
this.marginTop = topMargin;
}
public int getLeading() {
return leading;
}
public void setLeading(int leading) {
this.leading = leading;
}
}
| [
"dylandewolff@gmail.com"
] | dylandewolff@gmail.com |
79f9cddc6401e51046b9c272484be53959986f78 | 3ae143db05140a528c026ba99c264a7fe20fb7d1 | /src/main/java/com/zhuanye/wiki/resp/PageResp.java | be2514a78ec3e37076362395f36aa5ad20956624 | [] | no_license | April412A/cyj | 4bc5a82b179d05041e71d3fd342d8d0757efbbd9 | bd9671fa65fe0e5c2118c9aa886653fb724f3c82 | refs/heads/main | 2023-04-26T01:50:34.964759 | 2021-05-18T01:25:39 | 2021-05-18T01:25:39 | 344,997,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package com.zhuanye.wiki.resp;
import java.util.List;
public class PageResp<T> {
private long total;
private List<T> list;
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("PageResp{");
sb.append("total=").append(total);
sb.append(", list=").append(list);
sb.append('}');
return sb.toString();
}
}
| [
"1540069377@qq.com"
] | 1540069377@qq.com |
99de8a72fd4b4aac3868237419490a12c51bc993 | a68dd5d6c172106166a07453a049231683cd22cc | /boot-single/src/main/java/com/xzm/single/common/utils/RegexUtils.java | 0dbbff41da5b8c8b71c141c04555177f7b992702 | [] | no_license | sengeiou/boot-project | 1139c0e23b3709baf80f0f3353169188442b15a7 | 6a1d136fd6105ea7691a8b5b567f2a22be50b223 | refs/heads/master | 2020-06-01T02:39:51.852669 | 2019-05-31T08:36:44 | 2019-05-31T08:36:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,113 | java | package com.xzm.single.common.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2016/08/02
* desc : 正则相关工具类
* </pre>
*/
public final class RegexUtils {
private RegexUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
///////////////////////////////////////////////////////////////////////////
// If u want more please visit http://toutiao.com/i6231678548520731137
///////////////////////////////////////////////////////////////////////////
/**
* 验证手机号(简单)
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isMobileSimple(final CharSequence input) {
return isMatch(RegexConstants.REGEX_MOBILE_SIMPLE, input);
}
/**
* 验证手机号(精确)
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isMobileExact(final CharSequence input) {
return isMatch(RegexConstants.REGEX_MOBILE_EXACT, input);
}
/**
* 验证电话号码
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isTel(final CharSequence input) {
return isMatch(RegexConstants.REGEX_TEL, input);
}
/**
* 验证身份证号码15位
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isIDCard15(final CharSequence input) {
return isMatch(RegexConstants.REGEX_ID_CARD15, input);
}
/**
* 验证身份证号码18位
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isIDCard18(final CharSequence input) {
return isMatch(RegexConstants.REGEX_ID_CARD18, input);
}
/**
* 验证邮箱
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isEmail(final CharSequence input) {
return isMatch(RegexConstants.REGEX_EMAIL, input);
}
/**
* 验证URL
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isURL(final CharSequence input) {
return isMatch(RegexConstants.REGEX_URL, input);
}
/**
* 验证汉字
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isZh(final CharSequence input) {
return isMatch(RegexConstants.REGEX_ZH, input);
}
/**
* 验证用户名
* <p>取值范围为a-z,A-Z,0-9,"_",汉字,不能以"_"结尾,用户名必须是6-20位</p>
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isUsername(final CharSequence input) {
return isMatch(RegexConstants.REGEX_USERNAME, input);
}
/**
* 验证yyyy-MM-dd格式的日期校验,已考虑平闰年
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isDate(final CharSequence input) {
return isMatch(RegexConstants.REGEX_DATE, input);
}
/**
* 验证IP地址
*
* @param input 待验证文本
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isIP(final CharSequence input) {
return isMatch(RegexConstants.REGEX_IP, input);
}
/**
* 判断是否匹配正则
*
* @param regex 正则表达式
* @param input 要匹配的字符串
* @return {@code true}: 匹配<br>{@code false}: 不匹配
*/
public static boolean isMatch(final String regex, final CharSequence input) {
return input != null && input.length() > 0 && Pattern.matches(regex, input);
}
/**
* 获取正则匹配的部分
*
* @param regex 正则表达式
* @param input 要匹配的字符串
* @return 正则匹配的部分
*/
public static List<String> getMatches(final String regex, final CharSequence input) {
if (input == null) return null;
List<String> matches = new ArrayList<>();
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
while (matcher.find()) {
matches.add(matcher.group());
}
return matches;
}
/**
* 获取正则匹配分组
*
* @param input 要分组的字符串
* @param regex 正则表达式
* @return 正则匹配分组
*/
public static String[] getSplits(final String input, final String regex) {
if (input == null) return null;
return input.split(regex);
}
/**
* 替换正则匹配的第一部分
*
* @param input 要替换的字符串
* @param regex 正则表达式
* @param replacement 代替者
* @return 替换正则匹配的第一部分
*/
public static String getReplaceFirst(final String input, final String regex, final String replacement) {
if (input == null) return null;
return Pattern.compile(regex).matcher(input).replaceFirst(replacement);
}
/**
* 替换所有正则匹配的部分
*
* @param input 要替换的字符串
* @param regex 正则表达式
* @param replacement 代替者
* @return 替换所有正则匹配的部分
*/
public static String getReplaceAll(final String input, final String regex, final String replacement) {
if (input == null) return null;
return Pattern.compile(regex).matcher(input).replaceAll(replacement);
}
}
| [
"1102207843@qq.com"
] | 1102207843@qq.com |
6e8ab604796571570763a3b57c57049b3700f973 | 0a8c0d9a48c7ec324316479199e83a1b795bc08d | /src/main/java/club/wshuai/huamanxi_wx/domain/Rhesis.java | a5af48f80bf518585bf32e6731201d5ae81a48e7 | [] | no_license | Allen-wang-shuai/huamanxi_wx | b80bdff8d4995cfb3f66bca31610d16296aec4c5 | dcaa0455b96149a214058cc46526b827cca4c097 | refs/heads/master | 2022-07-17T13:18:45.493728 | 2020-05-16T05:58:47 | 2020-05-16T05:58:47 | 261,620,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,041 | java | package club.wshuai.huamanxi_wx.domain;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.io.Serializable;
@Data
@ToString
@Document(indexName = "rhesis",type = "rhesis")
public class Rhesis implements Serializable {
@Id
@Field(type = FieldType.Integer,store = true)
private Integer rhesisId;
@Field(type = FieldType.Text,store = true,analyzer = "ik_max_word")
private String rhesisContent;
@Field(type = FieldType.Integer,store = true)
private Integer authorId;
@Field(type = FieldType.Text,store = true,analyzer = "ik_max_word")
private String authorName;
@Field(type = FieldType.Integer,store = true)
private Integer poemId;
@Field(type = FieldType.Text,store = true,analyzer = "ik_max_word")
private String poemTitle;
}
| [
"1911560799@qq.com"
] | 1911560799@qq.com |
63118669192da71977f6716daa2d79ec3efbafb1 | 1722bdf4e50c38704424c0814c677d1136dfd2ae | /app/src/main/java/com/platform/middlewares/plugins/CameraPlugin.java | 64fa2cbc00d72c622a7d1124ff03999552e4223b | [
"MIT"
] | permissive | mirzaei-ce/android-harambit | 70d8559f0686eb9c05073f1ceba4ff2ba18f980b | 8c2bfe239b537c233163b80c2d188d905015c741 | refs/heads/master | 2021-08-28T07:53:11.678445 | 2017-12-11T15:20:45 | 2017-12-11T15:20:45 | 113,874,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,077 | java | package com.platform.middlewares.plugins;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.util.Base64;
import android.util.Log;
import android.widget.Toast;
import com.harambitwallet.HarambitWalletApp;
import com.harambitwallet.R;
import com.harambitwallet.presenter.activities.MainActivity;
import com.harambitwallet.tools.crypto.CryptoHelper;
import com.harambitwallet.tools.util.BRConstants;
import com.platform.BRHTTPHelper;
import com.platform.interfaces.Plugin;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.commons.io.FileUtils;
import org.eclipse.jetty.continuation.Continuation;
import org.eclipse.jetty.continuation.ContinuationSupport;
import org.eclipse.jetty.server.Request;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static com.harambitwallet.tools.util.BRConstants.REQUEST_IMAGE_CAPTURE;
/**
* BreadWallet
* <p/>
* Created by Mihail Gutan on <mihail@breadwallet.com> 11/2/16.
* Copyright (c) 2016 breadwallet LLC
* <p/>
* 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:
* <p/>
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p/>
* 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.
*/
public class CameraPlugin implements Plugin {
public static final String TAG = CameraPlugin.class.getName();
private static Request globalBaseRequest;
private static Continuation continuation;
@Override
public boolean handle(String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) {
// GET /_camera/take_picture
//
// Optionally pass ?overlay=<id> (see overlay ids below) to show an overlay
// in picture taking mode
//
// Status codes:
// - 200: Successful image capture
// - 204: User canceled image picker
// - 404: Camera is not available on this device
// - 423: Multiple concurrent take_picture requests. Only one take_picture request may be in flight at once.
//
if (target.startsWith("/_camera/take_picture")) {
Log.i(TAG, "handling: " + target + " " + baseRequest.getMethod());
final MainActivity app = MainActivity.app;
if (app == null) {
Log.e(TAG, "handle: context is null: " + target + " " + baseRequest.getMethod());
return BRHTTPHelper.handleError(500, "context is null", baseRequest, response);
}
if (globalBaseRequest != null) {
Log.e(TAG, "handle: already taking a picture: " + target + " " + baseRequest.getMethod());
return BRHTTPHelper.handleError(423, null, baseRequest, response);
}
PackageManager pm = app.getPackageManager();
if (!pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
Log.e(TAG, "handle: no camera available: ");
return BRHTTPHelper.handleError(402, null, baseRequest, response);
}
if (ContextCompat.checkSelfPermission(app,
Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(app,
Manifest.permission.CAMERA)) {
Log.e(TAG, "handle: no camera access, showing instructions");
((HarambitWalletApp) app.getApplication()).showCustomToast(app,
app.getString(R.string.allow_camera_access),
MainActivity.screenParametersPoint.y / 2, Toast.LENGTH_LONG, 0);
} else {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(app,
new String[]{Manifest.permission.CAMERA},
BRConstants.CAMERA_REQUEST_GLIDERA_ID);
}
} else {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(app.getPackageManager()) != null) {
app.startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}
continuation = ContinuationSupport.getContinuation(request);
continuation.suspend(response);
globalBaseRequest = baseRequest;
}
return true;
} else if (target.startsWith("/_camera/picture/")) {
Log.i(TAG, "handling: " + target + " " + baseRequest.getMethod());
final MainActivity app = MainActivity.app;
if (app == null) {
Log.e(TAG, "handle: context is null: " + target + " " + baseRequest.getMethod());
return BRHTTPHelper.handleError(500, "context is null", baseRequest, response);
}
String id = target.replace("/_camera/picture/", "");
byte[] pictureBytes = readPictureForId(app, id);
if (pictureBytes == null) {
Log.e(TAG, "handle: WARNING pictureBytes is null: " + target + " " + baseRequest.getMethod());
return BRHTTPHelper.handleError(500, "pictureBytes is null", baseRequest, response);
}
byte[] imgBytes = pictureBytes;
String b64opt = request.getParameter("base64");
String contentType = "image/jpeg";
if (b64opt != null && !b64opt.isEmpty()) {
contentType = "text/plain";
String b64 = "data:image/jpeg;base64," + Base64.encodeToString(pictureBytes, Base64.NO_WRAP);
try {
imgBytes = b64.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return BRHTTPHelper.handleError(500, null, baseRequest, response);
}
}
return BRHTTPHelper.handleSuccess(200, null, baseRequest, response, contentType);
} else return false;
}
public static void handleCameraImageTaken(final Context context, final Bitmap img) {
new Thread(new Runnable() {
@Override
public void run() {
if (globalBaseRequest == null || continuation == null) {
Log.e(TAG, "handleCameraImageTaken: WARNING: " + continuation + " " + globalBaseRequest);
return;
}
try {
if (img == null) {
globalBaseRequest.setHandled(true);
((HttpServletResponse) continuation.getServletResponse()).setStatus(204);
continuation.complete();
continuation = null;
return;
}
String id = writeToFile(context, img);
if (id != null) {
JSONObject respJson = new JSONObject();
try {
respJson.put("id", id);
} catch (JSONException e) {
e.printStackTrace();
globalBaseRequest.setHandled(true);
try {
((HttpServletResponse) continuation.getServletResponse()).sendError(500);
} catch (IOException e1) {
e1.printStackTrace();
}
continuation.complete();
continuation = null;
return;
}
Log.i(TAG, "handleCameraImageTaken: wrote image to: " + id);
try {
((HttpServletResponse) continuation.getServletResponse()).setStatus(200);
continuation.getServletResponse().getWriter().write(respJson.toString());
globalBaseRequest.setHandled(true);
continuation.complete();
continuation = null;
} catch (IOException e) {
e.printStackTrace();
}
} else {
Log.e(TAG, "handleCameraImageTaken: error writing image");
try {
globalBaseRequest.setHandled(true);
((HttpServletResponse) continuation.getServletResponse()).sendError(500);
continuation.complete();
continuation = null;
} catch (IOException e) {
e.printStackTrace();
}
}
} finally {
globalBaseRequest = null;
continuation = null;
}
}
}).start();
}
private static String writeToFile(Context context, Bitmap img) {
String name = null;
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
img.compress(Bitmap.CompressFormat.JPEG, 50, out);
name = CryptoHelper.base58ofSha256(out.toByteArray());
File storageDir = new File(context.getFilesDir().getAbsolutePath() + "/pictures/");
File image = new File(storageDir, name + ".jpeg");
FileUtils.writeByteArrayToFile(image, out.toByteArray());
return name;
// PNG is a lossless format, the compression factor (100) is ignored
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
public byte[] readPictureForId(Context context, String id) {
Log.i(TAG, "readPictureForId: " + id);
try {
//create FileInputStream object
FileInputStream fin = new FileInputStream(new File(context.getFilesDir().getAbsolutePath() + "/pictures/" + id + ".jpeg"));
//create string from byte array
return IOUtils.toByteArray(fin);
} catch (FileNotFoundException e) {
Log.e(TAG, "File not found " + e);
} catch (IOException ioe) {
Log.e(TAG, "Exception while reading the file " + ioe);
}
return null;
}
}
| [
"mirzaei@ce.sharif.edu"
] | mirzaei@ce.sharif.edu |
a2759c481c7be3a84743af07e47d6f8b1d4e8e22 | 06e0e3a3844e6a6e8ade4a2f8785befb39a8faf8 | /src/main/java/com/amazon/opendistroforelasticsearch/sql/expression/ExpressionNodeVisitor.java | 4c3799c25fdce059354dacade1b5d9951865f40c | [
"Apache-2.0"
] | permissive | YANG-DB/sql-open-distro | 09505abbe72ef8e71e9c860b5817dadda85d33d2 | fb4ff5a35b6c04f33df03d5a460505f83e8ac05c | refs/heads/main | 2023-01-09T13:29:11.148593 | 2020-11-13T23:02:52 | 2020-11-13T23:02:52 | 310,531,657 | 2 | 1 | Apache-2.0 | 2020-11-06T08:06:34 | 2020-11-06T08:06:25 | null | UTF-8 | Java | false | false | 2,449 | java | /*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*
*/
package com.amazon.opendistroforelasticsearch.sql.expression;
import com.amazon.opendistroforelasticsearch.sql.expression.aggregation.Aggregator;
import com.amazon.opendistroforelasticsearch.sql.expression.aggregation.NamedAggregator;
import com.amazon.opendistroforelasticsearch.sql.expression.function.FunctionImplementation;
/**
* Abstract visitor for expression tree nodes.
* @param <T> type of return value to accumulate when visiting.
* @param <C> type of context.
*/
public abstract class ExpressionNodeVisitor<T, C> {
public T visitNode(Expression node, C context) {
return null;
}
/**
* Visit children nodes in function arguments.
* @param node function node
* @param context context
* @return result
*/
public T visitChildren(FunctionImplementation node, C context) {
T result = defaultResult();
for (Expression child : node.getArguments()) {
T childResult = child.accept(this, context);
result = aggregateResult(result, childResult);
}
return result;
}
private T defaultResult() {
return null;
}
private T aggregateResult(T aggregate, T nextResult) {
return nextResult;
}
public T visitLiteral(LiteralExpression node, C context) {
return visitNode(node, context);
}
public T visitNamed(NamedExpression node, C context) {
return visitNode(node, context);
}
public T visitReference(ReferenceExpression node, C context) {
return visitNode(node, context);
}
public T visitFunction(FunctionExpression node, C context) {
return visitChildren(node, context);
}
public T visitAggregator(Aggregator<?> node, C context) {
return visitChildren(node, context);
}
public T visitNamedAggregator(NamedAggregator node, C context) {
return visitChildren(node, context);
}
}
| [
"yang.db.dev@gmail.com"
] | yang.db.dev@gmail.com |
5c95329a442c9cfb66d16d67b7ef354ea4d167e7 | cc7fbb3090d763420beeb82fdee2f7b4c41c3b5e | /app/src/main/java/com/huangyifei/android/androidexample/unittest/TestModel.java | 3f20439927c584a2a8974d94eb6dcfd19ebc5254 | [] | no_license | huangyifei/AndroidExample | dd964bbd0005736d9d4467b0da365b98d9d80aaf | 9a176794a91d2727090c002a95e827066b578e0b | refs/heads/master | 2021-01-17T17:54:37.526065 | 2016-11-15T09:08:44 | 2016-11-15T09:08:44 | 70,705,389 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.huangyifei.android.androidexample.unittest;
/**
* Created by huangyifei on 16/10/18.
*/
public class TestModel {
public double sum(double a, double b) {
return a + b;
}
}
| [
"bupt.huangyifei@gmail.com"
] | bupt.huangyifei@gmail.com |
7a8e2597dfa484f5fe3a3d46f7009433a8e0a502 | 68318f61fefa98db958ccf91d2f62fd471d79349 | /Photo-Editor/src/a8/PictureImpl.java | 3ace2cdd359893cc4d9c62e6e2f245abde19d0cb | [] | no_license | jgersfeld/Photo-Editor | 5d455db366f167f747e4dc39448002506fde255a | 4a5faed2a7fd31a89dc31e902eca60401443bb60 | refs/heads/master | 2021-05-02T15:23:32.736257 | 2018-02-08T01:41:44 | 2018-02-08T01:41:44 | 120,694,605 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,088 | java | package a8;
public class PictureImpl extends AnyPicture {
private Pixel[][] pixels;
private static final Pixel INITIAL_PIXEL = new GrayPixel(1.0);
public PictureImpl(int width, int height) {
pixels = new Pixel[width][height];
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
pixels[x][y] = INITIAL_PIXEL;
}
}
}
@Override
public void setPixel(int x, int y, Pixel p) {
if (p == null) {
throw new RuntimeException("Pixel p is null");
}
if (x < 0 || x >= getWidth()) {
throw new RuntimeException("x is out of bounds");
}
if (y < 0 || y >= getHeight()) {
throw new RuntimeException("y is out of bounds");
}
pixels[x][y] = p;
}
@Override
public Pixel getPixel(int x, int y) {
if (x < 0 || x >= getWidth()) {
throw new RuntimeException("x is out of bounds");
}
if (y < 0 || y >= getHeight()) {
throw new RuntimeException("y is out of bounds");
}
return pixels[x][y];
}
@Override
public int getWidth() {
return pixels.length;
}
@Override
public int getHeight() {
return pixels[0].length;
}
}
| [
"jgersfeld@gmail.com"
] | jgersfeld@gmail.com |
1fe0b611e0984656f7b7b06658b8e5405e9291c3 | e68861f98ee082c7917a56631e98e14a12dc5e6b | /buttermilk-core/src/main/java/com/cryptoregistry/signature/SignatureMetadata.java | 6b11ed90702c6ec5296f30852e860904fc9ba3c4 | [] | no_license | dpellow/buttermilk | d3541bb5d4d339cb9d54b6361855113cd515b710 | 0ad88da1978e02a2daf186e42b4cd92cf485a289 | refs/heads/master | 2021-01-21T20:07:16.687280 | 2015-04-04T05:33:46 | 2015-04-04T05:33:46 | 35,840,706 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,308 | java | /*
* This file is part of Buttermilk
* Copyright 2011-2014 David R. Smith All Rights Reserved.
*
*/
package com.cryptoregistry.signature;
import java.util.Date;
import java.util.UUID;
import com.cryptoregistry.SignatureAlgorithm;
public class SignatureMetadata {
public static final String defaultDigestAlg ="SHA-256";
public final String handle; // unique identifier for this signature
public final Date createdOn; // will use ISO 8601 format for String representation
public final SignatureAlgorithm sigAlg; //known routines in Buttermilk
public String digestAlg; // associated digest algorithm used
public final String signedWith; // handle of key used to sign
public final String signedBy; // registration handle of the signer key
public SignatureMetadata(String handle, Date createdOn,
SignatureAlgorithm sigAlg, String digestAlg, String signedWith,
String signedBy) {
super();
this.handle = handle;
this.createdOn = createdOn;
this.sigAlg = sigAlg;
this.digestAlg = digestAlg;
this.signedWith = signedWith;
this.signedBy = signedBy;
}
public SignatureMetadata(SignatureAlgorithm sigAlg, String hashAlg, String signedWith,String signedBy){
this(UUID.randomUUID().toString(),new Date(),sigAlg,hashAlg,signedWith,signedBy);
}
public SignatureMetadata(SignatureAlgorithm sigAlg,String signedWith,String signedBy){
this(UUID.randomUUID().toString(),new Date(),sigAlg,defaultDigestAlg,signedWith,signedBy);
}
@Override
public String toString() {
return "SignatureMetadata [getHandle()=" + getHandle() + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((createdOn == null) ? 0 : createdOn.hashCode());
result = prime * result + ((handle == null) ? 0 : handle.hashCode());
result = prime * result + ((sigAlg == null) ? 0 : sigAlg.hashCode());
result = prime * result
+ ((signedBy == null) ? 0 : signedBy.hashCode());
result = prime * result
+ ((signedWith == null) ? 0 : signedWith.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SignatureMetadata other = (SignatureMetadata) obj;
if (createdOn == null) {
if (other.createdOn != null)
return false;
} else if (!createdOn.equals(other.createdOn))
return false;
if (handle == null) {
if (other.handle != null)
return false;
} else if (!handle.equals(other.handle))
return false;
if (sigAlg != other.sigAlg)
return false;
if (signedBy == null) {
if (other.signedBy != null)
return false;
} else if (!signedBy.equals(other.signedBy))
return false;
if (signedWith == null) {
if (other.signedWith != null)
return false;
} else if (!signedWith.equals(other.signedWith))
return false;
return true;
}
public SignatureAlgorithm getSigAlg() {
return sigAlg;
}
public String getHandle() {
return handle;
}
public Date getCreatedOn() {
return createdOn;
}
public String getSignedWith() {
return signedWith;
}
public String getSignedBy() {
return signedBy;
}
}
| [
"davesmith.gbs@gmail.com@c95ee3aa-bd1a-c76a-db35-d8dc5d9f496b"
] | davesmith.gbs@gmail.com@c95ee3aa-bd1a-c76a-db35-d8dc5d9f496b |
caec18c5538cec32e1761db67cb70a5e930b643c | 76e03769e060b5ea4b8605079f023064634d31c1 | /srcApplet/view/model/cache/MemCacheAddColumns.java | eb15d3eb2dd85a5300c57f22d9543bd547b66302 | [] | no_license | beevageeva/sj-ext | 620d6abdb96b607fa4cf9ad0e25886657b9f895b | e699ad86f37cd40747adbc11f3a76f7988d2e964 | refs/heads/master | 2021-01-23T12:18:08.048139 | 2013-11-20T17:56:10 | 2013-11-20T17:56:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 645 | java | package view.model.cache;
public class MemCacheAddColumns implements AddColumns<EntryI>{
public EntryI createNewEntry() {
return new EntryI() ;
}
public int getColCount() {
return 1;
}
public String getColname(int col) {
if(col==0){
return "key";
}
return null;
}
public int getEvictionValue(EntryI entry) {
return 0;
}
public boolean isEligible(int row, int key, int pid, short instrType) {
return true;
}
public boolean isEligible(EntryI entry, int key, int pid, short instrType) {
return true;
}
public void setValues(EntryI entry, int pid, short instrType, int... keys) {
entry.p = keys[0];
}
}
| [
"geeva@igueste.isaatc.ull.es"
] | geeva@igueste.isaatc.ull.es |
b2314bbc9437b2450fc3beae80dc0f5cdca648da | 27bd9ddd78814af95e84d14c9f2a89d7c014603b | /src/main/java/com/ednilton/cmc/dto/CategoriaDTO.java | 381061fa5b0ffd7f3843845be4de5ded0f041075 | [] | no_license | ednilton/ednilton-spring-boot-ionic-backend | 65c40f1b2259e565adedb816632169f7d49f34c5 | 56b204b04a12759d67827b4c605c76034e80ec60 | refs/heads/master | 2021-05-17T16:26:38.376969 | 2020-04-14T12:58:50 | 2020-04-14T12:58:50 | 250,870,969 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package com.ednilton.cmc.dto;
import java.io.Serializable;
import com.ednilton.cmc.domain.Categoria;
import javax.validation.constraints.NotEmpty;
import org.hibernate.validator.constraints.Length;
public class CategoriaDTO implements Serializable{
private static final long serialVersionUID = 1L;
private Integer id;
@NotEmpty(message="Preenchimento obrigatório.")
@Length(min=5, max=80, message="O tamanho deve ser entre 5 e 80 caracteres")
private String nome;
public CategoriaDTO() {
}
public CategoriaDTO(Categoria obj) {
id = obj.getId();
nome = obj.getNome();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
}
| [
"edrauh@gmail.com"
] | edrauh@gmail.com |
a31aa143f170af473511c7ed1a7927718f2a631b | a758c2e7e3502d6099843a4ffab6190db50821b0 | /android/app/src/main/java/com/gasosa/uefs/acitivity/contribuirActivity.java | d277954c7513b9c7438e87bf69538978e0d622c2 | [] | no_license | wstroks/startupGasosa | 9fbd2a92dc6e5fb75cc8cdfc8faa7d8aba496ff3 | e0721f95d3222ece157fe9a2c7dab3c5ca4e4e51 | refs/heads/master | 2021-07-03T20:03:49.006248 | 2020-10-10T01:10:24 | 2020-10-10T01:10:24 | 188,119,328 | 0 | 0 | null | 2020-09-12T21:58:10 | 2019-05-22T21:58:59 | JavaScript | UTF-8 | Java | false | false | 2,826 | java | package com.gasosa.uefs.acitivity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.gasosa.uefs.R;
import com.gasosa.uefs.model.CadastrarContribuirGas;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.text.SimpleDateFormat;
import java.util.Date;
public class contribuirActivity extends AppCompatActivity {
private EditText precoGas_enviar;
private TextView nome_enviar;
private Button enviar;
private DatabaseReference db;
private FirebaseAuth autenticacao;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contribuir);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("Contribuir Preço Gnv");
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp);
db = FirebaseDatabase.getInstance().getReference();
autenticacao = FirebaseAuth.getInstance();
String nome =getIntent().getStringExtra("nome");
String gas =getIntent().getStringExtra("gas");
nome_enviar=findViewById(R.id.textoGasPreco);
precoGas_enviar=findViewById(R.id.precoGas);
enviar=findViewById(R.id.gasCalcular);
nome_enviar.setText(nome);
precoGas_enviar.setText(gas.toString());
enviar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CadastrarContribuirGas agora = new CadastrarContribuirGas();
agora.setNome(nome_enviar.getText().toString());
agora.setGas(Double.parseDouble(precoGas_enviar.getText().toString()));
SimpleDateFormat formataData = new SimpleDateFormat("dd-MM-yyyy");
Date data = new Date();
String dataFormatada = formataData.format(data);
agora.setData(dataFormatada);
DatabaseReference add = db.child("cadastroPrecosGas");
String email = autenticacao.getCurrentUser().getEmail();
agora.setUsuario(email);
add.push().setValue(agora);
Toast.makeText(contribuirActivity.this, "Enviado com sucesso!", Toast.LENGTH_SHORT).show();
// startActivity(new Intent(getApplicationContext(), MainActivity.class));
finish();
}
});
}
@Override
public boolean onSupportNavigateUp() {
finish();
return false;
}
}
| [
"wstroks@gmail.com"
] | wstroks@gmail.com |
f58deb9837c37aa4f96f2dded8d0b1ee410ddda6 | 8cb4141cc3148c484f65f2acfdf8285c92d06110 | /src/com/practice/mg/SecondSmallestNumber.java | 6170d8f57b06d2ddb89c1b33a8012f85a7deeb4e | [] | no_license | sasidharreddy-a/java-practice | c1fc3aa98f38e76d65dd368097e37252528fc705 | 27e2894a19d30f655786703f448780357c0f13a5 | refs/heads/master | 2023-07-10T02:53:02.957896 | 2021-08-20T05:22:26 | 2021-08-20T05:22:26 | 361,398,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package com.practice.mg;
import java.util.Arrays;
public class SecondSmallestNumber {
public static void main(String[] args) {
int A[] = {10, 3, 6, 9, 2, 4, 15, 23};int k=2;
System.out.println(solution(A,k));
}
private static int solution(int[] a,int k) {
// TODO Auto-generated method stub
Arrays.sort(a);
return a[k-1];
}
}
| [
"ailreddyr@nextgen.com"
] | ailreddyr@nextgen.com |
77109b643e56003998b03c471912d1f663c62717 | 049a7026a3b3652f35370490149f5c1e16440303 | /app/src/main/java/com/DailyNeeds/dailyneeds/Utils/Assigned_servicesNew.java | 87a9466c113a599ea5fda1b7be5389649b8552bb | [] | no_license | surajabhimanyu/dneeds_connect | 9ecbb430f5f707d2ddfcfc81109d23417e2c99af | 8ebd20be2c222a85bf6ad57a584205bce87c7434 | refs/heads/main | 2023-07-28T15:35:50.994905 | 2021-09-07T19:34:06 | 2021-09-07T19:34:06 | 404,099,005 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,017 | java | package com.DailyNeeds.dailyneeds.Utils;
public class Assigned_servicesNew{
private String zipcode;
private String user_first_name;
private String address;
private String is_vendor_accepted;
private String user_id;
private String service;
private String service_id;
private String order_id;
private String duration;
private String distance;
public String getDuration() {
return duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public String getDistance() {
return distance;
}
public void setDistance(String distance) {
this.distance = distance;
}
private String lat;
private String lng;
public String getLng() {
return lng;
}
public void setLng(String lng) {
this.lng = lng;
}
private String is_order_completed;
public String getZipcode ()
{
return zipcode;
}
public void setZipcode (String zipcode)
{
this.zipcode = zipcode;
}
public String getUser_first_name ()
{
return user_first_name;
}
public void setUser_first_name (String user_first_name)
{
this.user_first_name = user_first_name;
}
public String getAddress ()
{
return address;
}
public void setAddress (String address)
{
this.address = address;
}
public String getIs_vendor_accepted ()
{
return is_vendor_accepted;
}
public void setIs_vendor_accepted (String is_vendor_accepted)
{
this.is_vendor_accepted = is_vendor_accepted;
}
public String getUser_id ()
{
return user_id;
}
public void setUser_id (String user_id)
{
this.user_id = user_id;
}
public String getService ()
{
return service;
}
public void setService (String service)
{
this.service = service;
}
public String getService_id ()
{
return service_id;
}
public void setService_id (String service_id)
{
this.service_id = service_id;
}
public String getOrder_id ()
{
return order_id;
}
public void setOrder_id (String order_id)
{
this.order_id = order_id;
}
public String getLat ()
{
return lat;
}
public void setLat (String lat)
{
this.lat = lat;
}
public String getIs_order_completed ()
{
return is_order_completed;
}
public void setIs_order_completed (String is_order_completed)
{
this.is_order_completed = is_order_completed;
}
@Override
public String toString()
{
return "ClassPojo [zipcode = "+zipcode+", user_first_name = "+user_first_name+", address = "+address+", is_vendor_accepted = "+is_vendor_accepted+", user_id = "+user_id+", service = "+service+", service_id = "+service_id+", order_id = "+order_id+","+is_order_completed+"]";
}
}
| [
"suraj@xvaluetech.com"
] | suraj@xvaluetech.com |
15710046bf52d46db53d4e20f83036cbb9af3429 | 2605a602f005f7b04d16dca4271992c04135d23f | /src/localsearch/selectors/MaxSelector.java | 3288036017ecd48167061ac8ce915a165f37d4ad | [] | no_license | dungkhmt/planningoptimization | bbb0f7da7a8ed85ef7bebbe55163ce747165e764 | da80550b8c6455db667a5ab71afc252912b190f7 | refs/heads/master | 2023-04-04T23:29:40.450149 | 2021-04-07T07:00:53 | 2021-04-07T07:00:53 | 299,484,267 | 2 | 3 | null | 2020-11-03T02:17:24 | 2020-09-29T02:31:35 | Java | UTF-8 | Java | false | false | 593 | java | package localsearch.selectors;
// import localsearch.functions.*;
import localsearch.model.*;
import localsearch.invariants.*;
import java.util.*;
public class MaxSelector {
/**
* @param args
*/
private ArgMax _argMaxInvr;
private ArrayList<Integer> _L;
private Random _R;
public MaxSelector(IFunction[] f){
_argMaxInvr = new ArgMax(f);
_L = _argMaxInvr.getIndices();
_R = new Random();
}
public int get(){
int i = _R.nextInt()%_L.size();
if(i < 0) i = -i;
return _L.get(i);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"dungkhmt@gmail.com"
] | dungkhmt@gmail.com |
02fcedbc906a4d05e172116ecadd6aab271698aa | 0c0fa58b42b3ad29284662c0f06b1f5f46283ea0 | /src/polymorh/covariant/CovariantReturn.java | 0e5ccc348011163ef951bc39816b9e5d7ffda280 | [] | no_license | zhukis/java_edu_ekkel | a976eb0a382a1c9557840714b9aadba4125c271d | 670a7a5b950a29c79e2a103b63f49315ebb51678 | refs/heads/master | 2021-01-01T19:04:48.520095 | 2017-08-20T21:13:52 | 2017-08-20T21:13:52 | 98,501,377 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 289 | java | package polymorh.covariant;
public class CovariantReturn {
public static void main(String[] args) {
Mill m = new Mill();
Grain g = m.process();
System.out.println(g);
m = new WheatMill();
g = m.process();
System.out.println(g);
}
}
| [
"izhu@ericpol.com"
] | izhu@ericpol.com |
c92c0a7ae2e5249fceb41d4fa7972db15f2a0520 | eb3ad750a23be626d4190eeb48d1047cb8e32c3e | /BWCommon/src/main/java/org/w3c/dom/css_bad/CSSImportRule.java | dbc38355aff4ca30e81125eb280642b55100acab | [] | no_license | 00mjk/beowulf-1 | 1ad29e79e2caee0c76a8b0bd5e15c24c22017d56 | d28d7dfd6b9080130540fc7427bfe7ad01209ade | refs/heads/master | 2021-05-26T23:07:39.561391 | 2013-01-23T03:09:44 | 2013-01-23T03:09:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,762 | java | /*
* Copyright (c) 2000 World Wide Web Consortium, (Massachusetts Institute of
* Technology, Institut National de Recherche en Informatique et en Automatique,
* Keio University). All Rights Reserved. This program is distributed under the
* W3C's Software Intellectual Property License. This program is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.css_bad;
import org.w3c.dom.stylesheets.MediaList;
/**
* The <code>CSSImportRule</code> interface represents a
*
* @import rule within a CSS style sheet. The <code>@import</code> rule is used
* to import style rules from other style sheets.
* <p>
* See also the <a
* href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Docum
* e n t Object Model (DOM) Level 2 Style Specification</a>.
* @since DOM Level 2
*/
public interface CSSImportRule extends CSSRule {
/**
* The location of the style sheet to be imported. The attribute will not
* contain the <code>"url(...)"</code> specifier around the URI.
*/
public String getHref();
/**
* A list of media types for which this style sheet may be used.
*/
public MediaList getMedia();
/**
* The style sheet referred to by this rule, if it has been loaded. The
* value of this attribute is <code>null</code> if the style sheet has not
* yet been loaded or if it will not be loaded (e.g. if the style sheet is
* for a media type not supported by the user agent).
*/
public CSSStyleSheet getStyleSheet();
}
| [
"nibin012@gmail.com"
] | nibin012@gmail.com |
2396c5717479fcc9a37d4cc4e14d72b0e73d5652 | 14c8213abe7223fe64ff89a47f70b0396e623933 | /com/fasterxml/jackson/core/io/NumberInput.java | 9e2d6e95245bddfb0b53899fbefa5f7db03eb0f6 | [
"MIT"
] | permissive | PolitePeoplePlan/backdoored | c804327a0c2ac5fe3fbfff272ca5afcb97c36e53 | 3928ac16a21662e4f044db9f054d509222a8400e | refs/heads/main | 2023-05-31T04:19:55.497741 | 2021-06-23T15:20:03 | 2021-06-23T15:20:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,134 | java | package com.fasterxml.jackson.core.io;
import java.math.*;
public final class NumberInput
{
public static final String NASTY_SMALL_DOUBLE = "2.2250738585072012e-308";
static final long L_BILLION = 1000000000L;
static final String MIN_LONG_STR_NO_SIGN;
static final String MAX_LONG_STR;
public NumberInput() {
super();
}
public static int parseInt(final char[] a1, int a2, int a3) {
int v1 = a1[a2] - '0';
if (a3 > 4) {
v1 = v1 * 10 + (a1[++a2] - '0');
v1 = v1 * 10 + (a1[++a2] - '0');
v1 = v1 * 10 + (a1[++a2] - '0');
v1 = v1 * 10 + (a1[++a2] - '0');
a3 -= 4;
if (a3 > 4) {
v1 = v1 * 10 + (a1[++a2] - '0');
v1 = v1 * 10 + (a1[++a2] - '0');
v1 = v1 * 10 + (a1[++a2] - '0');
v1 = v1 * 10 + (a1[++a2] - '0');
return v1;
}
}
if (a3 > 1) {
v1 = v1 * 10 + (a1[++a2] - '0');
if (a3 > 2) {
v1 = v1 * 10 + (a1[++a2] - '0');
if (a3 > 3) {
v1 = v1 * 10 + (a1[++a2] - '0');
}
}
}
return v1;
}
public static int parseInt(final String a1) {
char v1 = a1.charAt(0);
final int v2 = a1.length();
final boolean v3 = v1 == '-';
int v4 = 1;
if (v3) {
if (v2 == 1 || v2 > 10) {
return Integer.parseInt(a1);
}
v1 = a1.charAt(v4++);
}
else if (v2 > 9) {
return Integer.parseInt(a1);
}
if (v1 > '9' || v1 < '0') {
return Integer.parseInt(a1);
}
int v5 = v1 - '0';
if (v4 < v2) {
v1 = a1.charAt(v4++);
if (v1 > '9' || v1 < '0') {
return Integer.parseInt(a1);
}
v5 = v5 * 10 + (v1 - '0');
if (v4 < v2) {
v1 = a1.charAt(v4++);
if (v1 > '9' || v1 < '0') {
return Integer.parseInt(a1);
}
v5 = v5 * 10 + (v1 - '0');
if (v4 < v2) {
do {
v1 = a1.charAt(v4++);
if (v1 > '9' || v1 < '0') {
return Integer.parseInt(a1);
}
v5 = v5 * 10 + (v1 - '0');
} while (v4 < v2);
}
}
}
return v3 ? (-v5) : v5;
}
public static long parseLong(final char[] a1, final int a2, final int a3) {
final int v1 = a3 - 9;
final long v2 = parseInt(a1, a2, v1) * 1000000000L;
return v2 + parseInt(a1, a2 + v1, 9);
}
public static long parseLong(final String a1) {
final int v1 = a1.length();
if (v1 <= 9) {
return parseInt(a1);
}
return Long.parseLong(a1);
}
public static boolean inLongRange(final char[] a3, final int a4, final int v1, final boolean v2) {
final String v3 = v2 ? NumberInput.MIN_LONG_STR_NO_SIGN : NumberInput.MAX_LONG_STR;
final int v4 = v3.length();
if (v1 < v4) {
return true;
}
if (v1 > v4) {
return false;
}
for (int a5 = 0; a5 < v4; ++a5) {
final int a6 = a3[a4 + a5] - v3.charAt(a5);
if (a6 != 0) {
return a6 < 0;
}
}
return true;
}
public static boolean inLongRange(final String v1, final boolean v2) {
final String v3 = v2 ? NumberInput.MIN_LONG_STR_NO_SIGN : NumberInput.MAX_LONG_STR;
final int v4 = v3.length();
final int v5 = v1.length();
if (v5 < v4) {
return true;
}
if (v5 > v4) {
return false;
}
for (int a2 = 0; a2 < v4; ++a2) {
final int a3 = v1.charAt(a2) - v3.charAt(a2);
if (a3 != 0) {
return a3 < 0;
}
}
return true;
}
public static int parseAsInt(String v-3, final int v-2) {
if (v-3 == null) {
return v-2;
}
v-3 = v-3.trim();
int n = v-3.length();
if (n == 0) {
return v-2;
}
int v0 = 0;
if (v0 < n) {
final char a1 = v-3.charAt(0);
if (a1 == '+') {
v-3 = v-3.substring(1);
n = v-3.length();
}
else if (a1 == '-') {
++v0;
}
}
while (v0 < n) {
final char v2 = v-3.charAt(v0);
Label_0103: {
if (v2 <= '9') {
if (v2 >= '0') {
break Label_0103;
}
}
try {
return (int)parseDouble(v-3);
}
catch (NumberFormatException a2) {
return v-2;
}
}
++v0;
}
try {
return Integer.parseInt(v-3);
}
catch (NumberFormatException v3) {
return v-2;
}
}
public static long parseAsLong(String v-4, final long v-3) {
if (v-4 == null) {
return v-3;
}
v-4 = v-4.trim();
int n = v-4.length();
if (n == 0) {
return v-3;
}
int v0 = 0;
if (v0 < n) {
final char a1 = v-4.charAt(0);
if (a1 == '+') {
v-4 = v-4.substring(1);
n = v-4.length();
}
else if (a1 == '-') {
++v0;
}
}
while (v0 < n) {
final char v2 = v-4.charAt(v0);
Label_0107: {
if (v2 <= '9') {
if (v2 >= '0') {
break Label_0107;
}
}
try {
return (long)parseDouble(v-4);
}
catch (NumberFormatException a2) {
return v-3;
}
}
++v0;
}
try {
return Long.parseLong(v-4);
}
catch (NumberFormatException v3) {
return v-3;
}
}
public static double parseAsDouble(String a2, final double v1) {
if (a2 == null) {
return v1;
}
a2 = a2.trim();
final int v2 = a2.length();
if (v2 == 0) {
return v1;
}
try {
return parseDouble(a2);
}
catch (NumberFormatException a3) {
return v1;
}
}
public static double parseDouble(final String a1) throws NumberFormatException {
if ("2.2250738585072012e-308".equals(a1)) {
return Double.MIN_VALUE;
}
return Double.parseDouble(a1);
}
public static BigDecimal parseBigDecimal(final String v1) throws NumberFormatException {
try {
return new BigDecimal(v1);
}
catch (NumberFormatException a1) {
throw _badBD(v1);
}
}
public static BigDecimal parseBigDecimal(final char[] a1) throws NumberFormatException {
return parseBigDecimal(a1, 0, a1.length);
}
public static BigDecimal parseBigDecimal(final char[] a2, final int a3, final int v1) throws NumberFormatException {
try {
return new BigDecimal(a2, a3, v1);
}
catch (NumberFormatException a4) {
throw _badBD(new String(a2, a3, v1));
}
}
private static NumberFormatException _badBD(final String a1) {
return new NumberFormatException("Value \"" + a1 + "\" can not be represented as BigDecimal");
}
static {
MIN_LONG_STR_NO_SIGN = String.valueOf(Long.MIN_VALUE).substring(1);
MAX_LONG_STR = String.valueOf(4294967295L);
}
}
| [
"66845682+chrispycreme420@users.noreply.github.com"
] | 66845682+chrispycreme420@users.noreply.github.com |
58b1ce8a48047a70017cf7b2c3ce462baa4d2cc2 | 97baf7d5296a1e613eddfe4ed9ee86e47aa9e791 | /main/java/br/com/minhamusica/gerenciadorlayout/MainActivity.java | 25df8f5d281fa18283ca621d15ccc165b79fcfeb | [] | no_license | Josecarlo/GerenciadorLayout | 2f77b129c5ae7c0564ae94116b506c6f75a742bf | c40b83581eceae616734f7c84c8073798e7de79c | refs/heads/master | 2020-03-23T12:49:34.716822 | 2018-07-19T13:41:17 | 2018-07-19T13:41:17 | 141,584,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,144 | java | package br.com.minhamusica.gerenciadorlayout;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
//private TextView tv;
//private Button btn;
//private EditText edt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b = findViewById(R.id.idButton);
b.setOnClickListener(this);
}
public void onClick(View v){
EditText edt = findViewById(R.id.idEditText);
Context contexto = getApplicationContext();
String texto = edt.getText().toString();
int duracao = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(contexto, texto, duracao);
toast.show();
setContentView(R.layout.activity_home);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b4593183e900e10b3c32347b402bcb0d69476305 | 77f5ce0039fac42d31dbaf05f1875dd4f9773b74 | /MaratonaJava/src/javacore/newio/NormalizacaoTest.java | b724740f17a8fff41a1244b57971f434695845b9 | [] | no_license | devleandrodias/maratona-java | 16011d6e3325ce6cb25a49b1a363612e6683953e | 9cc1f18e0ed8ead542d0306f71c23f5e0c569d25 | refs/heads/master | 2020-11-24T03:42:05.472317 | 2020-01-26T15:16:26 | 2020-01-26T15:16:26 | 227,949,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 539 | java | package javacore.newio;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* NormalizacaoTest
*/
public class NormalizacaoTest {
public static void main(String[] args) {
String diretorioProjeto = "MaratonaJava\\home\\leandro\\dev";
String arquivoTxt = "..\\..\\arquivo.txt";
Path p1 = Paths.get(diretorioProjeto, arquivoTxt);
System.out.println(p1.normalize()); // Normalização
Path p2 = Paths.get("/home/./leandro/./dev/");
System.out.println(p2);
System.out.println(p2.normalize());
}
} | [
"leandro.dias_profissional@outlook.com.br"
] | leandro.dias_profissional@outlook.com.br |
344cd3ede82580d496bb1b669eb590f7cb33730d | 56d6fa60f900fb52362d4cce950fa81f949b7f9b | /aws-sdk-java/src/main/java/com/amazonaws/services/simpleworkflow/model/ActivityTypeDetail.java | 3306a28529baba273e738a854961367ccada62a9 | [
"JSON",
"Apache-2.0"
] | permissive | TarantulaTechnology/aws | 5f9d3981646e193c89f1c3fa746ec3db30252913 | 8ce079f5628334f83786c152c76abd03f37281fe | refs/heads/master | 2021-01-19T11:14:53.050332 | 2013-09-15T02:37:02 | 2013-09-15T02:37:02 | 12,839,311 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,412 | java | /*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.simpleworkflow.model;
import java.io.Serializable;
/**
* <p>
* Detailed information about an activity type.
* </p>
*/
public class ActivityTypeDetail implements Serializable {
/**
* General information about the activity type. <p> The status of
* activity type (returned in the ActivityTypeInfo structure) can be one
* of the following. <ul> <li> <b>REGISTERED</b>: The type is registered
* and available. Workers supporting this type should be running. </li>
* <li> <b>DEPRECATED</b>: The type was deprecated using
* <a>DeprecateActivityType</a>, but is still in use. You should keep
* workers supporting this type running. You cannot create new tasks of
* this type. </li> </ul>
*/
private ActivityTypeInfo typeInfo;
/**
* The configuration settings registered with the activity type.
*/
private ActivityTypeConfiguration configuration;
/**
* General information about the activity type. <p> The status of
* activity type (returned in the ActivityTypeInfo structure) can be one
* of the following. <ul> <li> <b>REGISTERED</b>: The type is registered
* and available. Workers supporting this type should be running. </li>
* <li> <b>DEPRECATED</b>: The type was deprecated using
* <a>DeprecateActivityType</a>, but is still in use. You should keep
* workers supporting this type running. You cannot create new tasks of
* this type. </li> </ul>
*
* @return General information about the activity type. <p> The status of
* activity type (returned in the ActivityTypeInfo structure) can be one
* of the following. <ul> <li> <b>REGISTERED</b>: The type is registered
* and available. Workers supporting this type should be running. </li>
* <li> <b>DEPRECATED</b>: The type was deprecated using
* <a>DeprecateActivityType</a>, but is still in use. You should keep
* workers supporting this type running. You cannot create new tasks of
* this type. </li> </ul>
*/
public ActivityTypeInfo getTypeInfo() {
return typeInfo;
}
/**
* General information about the activity type. <p> The status of
* activity type (returned in the ActivityTypeInfo structure) can be one
* of the following. <ul> <li> <b>REGISTERED</b>: The type is registered
* and available. Workers supporting this type should be running. </li>
* <li> <b>DEPRECATED</b>: The type was deprecated using
* <a>DeprecateActivityType</a>, but is still in use. You should keep
* workers supporting this type running. You cannot create new tasks of
* this type. </li> </ul>
*
* @param typeInfo General information about the activity type. <p> The status of
* activity type (returned in the ActivityTypeInfo structure) can be one
* of the following. <ul> <li> <b>REGISTERED</b>: The type is registered
* and available. Workers supporting this type should be running. </li>
* <li> <b>DEPRECATED</b>: The type was deprecated using
* <a>DeprecateActivityType</a>, but is still in use. You should keep
* workers supporting this type running. You cannot create new tasks of
* this type. </li> </ul>
*/
public void setTypeInfo(ActivityTypeInfo typeInfo) {
this.typeInfo = typeInfo;
}
/**
* General information about the activity type. <p> The status of
* activity type (returned in the ActivityTypeInfo structure) can be one
* of the following. <ul> <li> <b>REGISTERED</b>: The type is registered
* and available. Workers supporting this type should be running. </li>
* <li> <b>DEPRECATED</b>: The type was deprecated using
* <a>DeprecateActivityType</a>, but is still in use. You should keep
* workers supporting this type running. You cannot create new tasks of
* this type. </li> </ul>
* <p>
* Returns a reference to this object so that method calls can be chained together.
*
* @param typeInfo General information about the activity type. <p> The status of
* activity type (returned in the ActivityTypeInfo structure) can be one
* of the following. <ul> <li> <b>REGISTERED</b>: The type is registered
* and available. Workers supporting this type should be running. </li>
* <li> <b>DEPRECATED</b>: The type was deprecated using
* <a>DeprecateActivityType</a>, but is still in use. You should keep
* workers supporting this type running. You cannot create new tasks of
* this type. </li> </ul>
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ActivityTypeDetail withTypeInfo(ActivityTypeInfo typeInfo) {
this.typeInfo = typeInfo;
return this;
}
/**
* The configuration settings registered with the activity type.
*
* @return The configuration settings registered with the activity type.
*/
public ActivityTypeConfiguration getConfiguration() {
return configuration;
}
/**
* The configuration settings registered with the activity type.
*
* @param configuration The configuration settings registered with the activity type.
*/
public void setConfiguration(ActivityTypeConfiguration configuration) {
this.configuration = configuration;
}
/**
* The configuration settings registered with the activity type.
* <p>
* Returns a reference to this object so that method calls can be chained together.
*
* @param configuration The configuration settings registered with the activity type.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ActivityTypeDetail withConfiguration(ActivityTypeConfiguration configuration) {
this.configuration = configuration;
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getTypeInfo() != null) sb.append("TypeInfo: " + getTypeInfo() + ",");
if (getConfiguration() != null) sb.append("Configuration: " + getConfiguration() );
sb.append("}");
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTypeInfo() == null) ? 0 : getTypeInfo().hashCode());
hashCode = prime * hashCode + ((getConfiguration() == null) ? 0 : getConfiguration().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (obj instanceof ActivityTypeDetail == false) return false;
ActivityTypeDetail other = (ActivityTypeDetail)obj;
if (other.getTypeInfo() == null ^ this.getTypeInfo() == null) return false;
if (other.getTypeInfo() != null && other.getTypeInfo().equals(this.getTypeInfo()) == false) return false;
if (other.getConfiguration() == null ^ this.getConfiguration() == null) return false;
if (other.getConfiguration() != null && other.getConfiguration().equals(this.getConfiguration()) == false) return false;
return true;
}
}
| [
"TarantulaTechnology@users.noreply.github.com"
] | TarantulaTechnology@users.noreply.github.com |
85e4ab4aa37f7db9c342dbdb5f03445883acb3ce | 745cf8cc6f05b68bb906ea0c2f8e7a98c6ab6e6b | /src/main/java/com/example/common/service/impl/BaseService.java | 2ad0db2e83559ca617652f2ba06dd3d097934cd6 | [] | no_license | fangyefei/testDemo | e78911aadf96815bdf5f984698b51de459520b6f | 5f733e07d5edd05e431db5370fd301fe6e7df2e1 | refs/heads/master | 2022-09-29T04:21:11.719041 | 2019-08-16T09:21:34 | 2019-08-16T09:21:34 | 170,813,598 | 0 | 0 | null | 2022-09-01T23:11:16 | 2019-02-15T06:31:34 | JavaScript | UTF-8 | Java | false | false | 1,852 | java | package com.example.common.service.impl;
import com.example.common.dao.SeqenceMapper;
import com.example.common.service.IService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public abstract class BaseService<T> implements IService<T> {
@Autowired
protected Mapper<T> mapper;
@Autowired
protected SeqenceMapper seqenceMapper;
public Mapper<T> getMapper() {
return mapper;
}
@Override
public Long getSequence(@Param("seqName") String seqName) {
return seqenceMapper.getSequence(seqName);
}
@Override
public List<T> selectAll() {
return mapper.selectAll();
}
@Override
public T selectByKey(Object key) {
return mapper.selectByPrimaryKey(key);
}
@Override
@Transactional
public int save(T entity) {
return mapper.insert(entity);
}
@Override
@Transactional
public int delete(Object key) {
return mapper.deleteByPrimaryKey(key);
}
@Override
@Transactional
public int batchDelete(List<String> list, String property, Class<T> clazz) {
Example example = new Example(clazz);
example.createCriteria().andIn(property, list);
return this.mapper.deleteByExample(example);
}
@Override
@Transactional
public int updateAll(T entity) {
return mapper.updateByPrimaryKey(entity);
}
@Override
@Transactional
public int updateNotNull(T entity) {
return mapper.updateByPrimaryKeySelective(entity);
}
@Override
public List<T> selectByExample(Object example) {
return mapper.selectByExample(example);
}
}
| [
"401079183@qq.com"
] | 401079183@qq.com |
6f472eb685a8fa570092a72d0d068bc1a6ed225a | 45fcd971317b35f65693af452b4ed1a237cf0152 | /chirr/chirr_server/chirr/core/src/main/java/com/capgemini/devonfw/chirr/general/service/impl/rest/SecurityRestServiceImpl.java | b89e220cb5ffa6fa8f739a5bbb7b452a1f7a9d3a | [] | no_license | CoEValencia/Holdthedoors | 402a0486927d0c5b4decc3632faf0fe5fa537092 | 7c92227169bdee4165a041622d67e800034acd00 | refs/heads/master | 2021-01-17T11:32:00.371580 | 2016-07-30T16:31:36 | 2016-07-30T16:31:36 | 60,361,644 | 0 | 9 | null | 2016-07-27T11:39:47 | 2016-06-03T16:20:09 | JavaScript | UTF-8 | Java | false | false | 3,166 | java | package com.capgemini.devonfw.chirr.general.service.impl.rest;
import com.capgemini.devonfw.chirr.general.common.api.exception.NoActiveUserException;
import com.capgemini.devonfw.chirr.general.common.api.security.UserData;
import com.capgemini.devonfw.chirr.general.common.api.to.UserDetailsClientTo;
import javax.annotation.security.PermitAll;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.security.web.csrf.CsrfTokenRepository;
/**
* The security REST service provides access to the csrf token, the authenticated user's meta-data. Furthermore, it
* provides functionality to check permissions and roles of the authenticated user.
*
* @author <a href="malte.brunnlieb@capgemini.com">Malte Brunnlieb</a>
*/
@Path("/security/v1")
@Named("SecurityRestService")
@Transactional
public class SecurityRestServiceImpl {
/** Logger instance. */
private static final Logger LOG = LoggerFactory.getLogger(SecurityRestServiceImpl.class);
/**
* Use {@link CsrfTokenRepository} for CSRF protection.
*/
private CsrfTokenRepository csrfTokenRepository;
/**
* Retrieves the CSRF token from the server session.
*
* @param request {@link HttpServletRequest} to retrieve the current session from
* @param response {@link HttpServletResponse} to send additional information
* @return the Spring Security {@link CsrfToken}
*/
@Produces(MediaType.APPLICATION_JSON)
@GET
@Path("/csrftoken/")
@PermitAll
public CsrfToken getCsrfToken(@Context HttpServletRequest request, @Context HttpServletResponse response) {
// return (CsrfToken) request.getSession().getAttribute(
// HttpSessionCsrfTokenRepository.class.getName().concat(".CSRF_TOKEN"));
CsrfToken token = this.csrfTokenRepository.loadToken(request);
if (token == null) {
LOG.warn("No CsrfToken could be found - instanciating a new Token");
token = this.csrfTokenRepository.generateToken(request);
this.csrfTokenRepository.saveToken(token, request, response);
}
return token;
}
/**
* Gets the profile of the user being currently logged in.
*
* @param request provided by the RS-Context
* @return the {@link UserData} taken from the Spring Security context
*/
@Produces(MediaType.APPLICATION_JSON)
@GET
@Path("/currentuser/")
@PermitAll
public UserDetailsClientTo getCurrentUser(@Context HttpServletRequest request) {
if (request.getRemoteUser() == null) {
throw new NoActiveUserException();
}
return UserData.get().toClientTo();
}
/**
* @param csrfTokenRepository the csrfTokenRepository to set
*/
@Inject
public void setCsrfTokenRepository(CsrfTokenRepository csrfTokenRepository) {
this.csrfTokenRepository = csrfTokenRepository;
}
}
| [
"jhcore@capgemini.com"
] | jhcore@capgemini.com |
1f0fa49974aa455d773a7bfb29abe8e15b472d93 | aa6997aba1475b414c1688c9acb482ebf06511d9 | /src/javax/print/attribute/standard/JobStateReasons.java | 7a2ec2d3cfd3205e449b4a1bfd21aee596ab0110 | [] | 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 | 6,199 | java | /*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.print.attribute.standard;
import java.util.Collection;
import java.util.HashSet;
import javax.print.attribute.Attribute;
import javax.print.attribute.PrintJobAttribute;
/**
* Class JobStateReasons is a printing attribute class, a set of enumeration
* values, that provides additional information about the job's current state,
* i.e., information that augments the value of the job's {@link JobState
* JobState} attribute.
* <P>
* Instances of {@link JobStateReason JobStateReason} do not appear in a Print
* Job's attribute set directly. Rather, a JobStateReasons attribute appears in
* the Print Job's attribute set. The JobStateReasons attribute contains zero,
* one, or more than one {@link JobStateReason JobStateReason} objects which
* pertain to the Print Job's status. The printer adds a {@link JobStateReason
* JobStateReason} object to the Print Job's JobStateReasons attribute when the
* corresponding condition becomes true of the Print Job, and the printer
* removes the {@link JobStateReason JobStateReason} object again when the
* corresponding condition becomes false, regardless of whether the Print Job's
* overall {@link JobState JobState} also changed.
* <P>
* Class JobStateReasons inherits its implementation from class {@link
* java.util.HashSet java.util.HashSet}. Unlike most printing attributes which
* are immutable once constructed, class JobStateReasons is designed to be
* mutable; you can add {@link JobStateReason JobStateReason} objects to an
* existing JobStateReasons object and remove them again. However, like class
* {@link java.util.HashSet java.util.HashSet}, class JobStateReasons is not
* multiple thread safe. If a JobStateReasons object will be used by multiple
* threads, be sure to synchronize its operations (e.g., using a synchronized
* set view obtained from class {@link java.util.Collections
* java.util.Collections}).
* <P>
* <B>IPP Compatibility:</B> The string value returned by each individual {@link
* JobStateReason JobStateReason} object's <CODE>toString()</CODE> method gives
* the IPP keyword value. The category name returned by <CODE>getName()</CODE>
* gives the IPP attribute name.
* <P>
*
* @author Alan Kaminsky
*/
public final class JobStateReasons
extends HashSet<JobStateReason> implements PrintJobAttribute {
private static final long serialVersionUID = 8849088261264331812L;
/**
* Construct a new, empty job state reasons attribute; the underlying hash
* set has the default initial capacity and load factor.
*/
public JobStateReasons() {
super();
}
/**
* Construct a new, empty job state reasons attribute; the underlying hash
* set has the given initial capacity and the default load factor.
*
* @param initialCapacity Initial capacity.
* @throws IllegalArgumentException if the initial capacity is less than zero.
*/
public JobStateReasons(int initialCapacity) {
super(initialCapacity);
}
/**
* Construct a new, empty job state reasons attribute; the underlying hash
* set has the given initial capacity and load factor.
*
* @param initialCapacity Initial capacity.
* @param loadFactor Load factor.
* @throws IllegalArgumentException if the initial capacity is less than zero.
*/
public JobStateReasons(int initialCapacity, float loadFactor) {
super(initialCapacity, loadFactor);
}
/**
* Construct a new job state reasons attribute that contains the same
* {@link JobStateReason JobStateReason} objects as the given collection.
* The underlying hash set's initial capacity and load factor are as
* specified in the superclass constructor {@link
* java.util.HashSet#HashSet(java.util.Collection)
* HashSet(Collection)}.
*
* @param collection Collection to copy.
* @throws NullPointerException (unchecked exception) Thrown if <CODE>collection</CODE> is null or
* if any element in <CODE>collection</CODE> is null.
* @throws ClassCastException (unchecked exception) Thrown if any element in
* <CODE>collection</CODE> is not an instance of class {@link JobStateReason JobStateReason}.
*/
public JobStateReasons(Collection<JobStateReason> collection) {
super(collection);
}
/**
* Adds the specified element to this job state reasons attribute if it is
* not already present. The element to be added must be an instance of class
* {@link JobStateReason JobStateReason}. If this job state reasons
* attribute already contains the specified element, the call leaves this
* job state reasons attribute unchanged and returns <tt>false</tt>.
*
* @param o Element to be added to this job state reasons attribute.
* @return <tt>true</tt> if this job state reasons attribute did not already contain the specified
* element.
* @throws NullPointerException (unchecked exception) Thrown if the specified element is null.
* @throws ClassCastException (unchecked exception) Thrown if the specified element is not an
* instance of class {@link JobStateReason JobStateReason}.
* @since 1.5
*/
public boolean add(JobStateReason o) {
if (o == null) {
throw new NullPointerException();
}
return super.add((JobStateReason) o);
}
/**
* Get the printing attribute class which is to be used as the "category"
* for this printing attribute value.
* <P>
* For class JobStateReasons, the category is class JobStateReasons itself.
*
* @return Printing attribute class (category), an instance of class {@link java.lang.Class
* java.lang.Class}.
*/
public final Class<? extends Attribute> getCategory() {
return JobStateReasons.class;
}
/**
* Get the name of the category of which this attribute value is an
* instance.
* <P>
* For class JobStateReasons, the category
* name is <CODE>"job-state-reasons"</CODE>.
*
* @return Attribute category name.
*/
public final String getName() {
return "job-state-reasons";
}
}
| [
"yueny09@163.com"
] | yueny09@163.com |
51d71563335217561079e6b48bde8727e89d3dc3 | 4c49cb11ba268ec00a9c9503049bfaf206b792ae | /WEB-INF/src/kit/jiseki/AriaList/JisekiAriaList_InitFunction.java | f78a2f91d22a4025ff28c8546f8d60cc0840510b | [] | no_license | heddyzhang/tt1 | bda0e01d5a269e231d8dd2691c440811124a37ec | 275cf78f3f3a50a12d8339ed8a403de85e03a257 | refs/heads/master | 2020-03-22T03:48:14.889988 | 2019-12-10T07:33:20 | 2019-12-10T07:33:20 | 139,453,246 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,558 | java | package kit.jiseki.AriaList;
import static kit.jiseki.AriaList.IJisekiAriaList.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import fb.inf.KitFunction;
import fb.inf.exception.KitException;
import fb.inf.pbs.PbsUtil;
/**
* 初期表示処理の実装クラスです
*/
public class JisekiAriaList_InitFunction extends KitFunction {
/**
*
*/
private static final long serialVersionUID = 4603217942167239281L;
// -----------------------------------------
// create log4j instance & Config LogLevel
// -----------------------------------------
private static String className__ = JisekiAriaList_InitFunction.class.getName();
// -----------------------------------------
// define variable
// -----------------------------------------
private static final boolean isTransactionalFunction = false;
/**
* Transaction制御フラグを返却する。
*
* @return Transaction制御フラグ
*/
@Override
protected boolean isTransactionalFunction() {
return isTransactionalFunction;
}
/**
* クラス名を返却する。
*
* @return クラス名
*/
@Override
protected String getFunctionName() {
return className__;
}
/**
* コンストラクタ。
*
* @param mapping
* ActionMapping
* @param form
* ActionForm
* @param request
* HttpサーブレットRequest
* @param response
* HttpサーブレットResponse
*/
public JisekiAriaList_InitFunction(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
super(mapping, form, request, response);
}
/**
* 初期処理を実行する。<br>
* 初期リストを取得する
*
* @return Forward情報
* @throws KitException
* @Override
*/
public String execute_() throws KitException {
String sForwardPage = FORWARD_SUCCESS;
// 画面を初期化
JisekiAriaList_SearchForm searchForm = new JisekiAriaList_SearchForm();
// 日付を初期化
searchForm.setShiteibi(PbsUtil.getCurrentDate());
// 表示単位
searchForm.setHyoujiTanyi(RDO_TANI_KINGAKU);
// 検索日時
searchForm.setKensakuNiji("");
// 検索フォームをセッションに格納する
setSession(KEY_SS_SEARCHFORM, searchForm);
// 次画面へ遷移する
return sForwardPage;
}
} | [
"heddyzhangt@gmail.com"
] | heddyzhangt@gmail.com |
e1be57791b20568aaa5037b609fbd6119b7dbe3b | 68161311619a32ad10e75b7a1b1b7fb7f74c4dca | /target/maven-jsf-plugin/main/java/org/primefaces/touch/component/inputswitch/InputSwitchTag.java | a6e61a745db93ca933998827d8053bc71e7d4e2b | [] | no_license | oyesiji/legacy | 32cbdd3471030ec2295ad0d9632b22141df13718 | 5f352d58361fe795a80f2ee757e319f125084c3f | refs/heads/master | 2021-01-17T20:27:18.330724 | 2015-11-26T22:11:58 | 2015-11-26T22:11:58 | 46,948,496 | 0 | 0 | null | 2015-11-26T22:01:53 | 2015-11-26T22:01:53 | null | UTF-8 | Java | false | false | 4,005 | java | /*
* Copyright 2009 Prime Technology.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.primefaces.touch.component.inputswitch;
import javax.faces.webapp.UIComponentELTag;
import javax.faces.component.UIComponent;
public class InputSwitchTag extends UIComponentELTag {
private javax.el.ValueExpression _value;
private javax.el.ValueExpression _converter;
private javax.el.ValueExpression _immediate;
private javax.el.ValueExpression _required;
private javax.el.MethodExpression _validator;
private javax.el.MethodExpression _valueChangeListener;
private javax.el.ValueExpression _requiredMessage;
private javax.el.ValueExpression _converterMessage;
private javax.el.ValueExpression _validatorMessage;
public void release(){
super.release();
this._value = null;
this._converter = null;
this._immediate = null;
this._required = null;
this._validator = null;
this._valueChangeListener = null;
this._requiredMessage = null;
this._converterMessage = null;
this._validatorMessage = null;
}
protected void setProperties(UIComponent comp){
super.setProperties(comp);
org.primefaces.touch.component.inputswitch.InputSwitch component = null;
try {
component = (org.primefaces.touch.component.inputswitch.InputSwitch) comp;
} catch(ClassCastException cce) {
throw new IllegalStateException("Component " + component.toString() + " not expected type.");
}
if(_value != null) {
component.setValueExpression("value", _value);
}
if(_converter != null) {
component.setValueExpression("converter", _converter);
}
if(_immediate != null) {
component.setValueExpression("immediate", _immediate);
}
if(_required != null) {
component.setValueExpression("required", _required);
}
if(_validator != null) {
component.addValidator(new javax.faces.validator.MethodExpressionValidator(_validator));
}
if(_valueChangeListener != null) {
component.addValueChangeListener(new javax.faces.event.MethodExpressionValueChangeListener(_valueChangeListener));
}
if(_requiredMessage != null) {
component.setValueExpression("requiredMessage", _requiredMessage);
}
if(_converterMessage != null) {
component.setValueExpression("converterMessage", _converterMessage);
}
if(_validatorMessage != null) {
component.setValueExpression("validatorMessage", _validatorMessage);
}
}
public String getComponentType() {
return InputSwitch.COMPONENT_TYPE;
}
public String getRendererType() {
return "org.primefaces.touch.component.InputSwitchRenderer";
}
public void setValue(javax.el.ValueExpression expression){
this._value = expression;
}
public void setConverter(javax.el.ValueExpression expression){
this._converter = expression;
}
public void setImmediate(javax.el.ValueExpression expression){
this._immediate = expression;
}
public void setRequired(javax.el.ValueExpression expression){
this._required = expression;
}
public void setValidator(javax.el.MethodExpression expression){
this._validator = expression;
}
public void setValueChangeListener(javax.el.MethodExpression expression){
this._valueChangeListener = expression;
}
public void setRequiredMessage(javax.el.ValueExpression expression){
this._requiredMessage = expression;
}
public void setConverterMessage(javax.el.ValueExpression expression){
this._converterMessage = expression;
}
public void setValidatorMessage(javax.el.ValueExpression expression){
this._validatorMessage = expression;
}
} | [
"oyesiji@gmail.com"
] | oyesiji@gmail.com |
19ca89f8f8fd0a47e038cc052514a291ef11b9df | ea2cf9e65408a9c9f7a4a3d84a57d236ca6c5c2e | /src/com/xaviar/collect/sms/SmsUtil.java | c1ee623a7a8f79e1cbb7b21fcfc7ea75bcd9320f | [] | no_license | xaviar001/flower | 7e4e903911817076deb8817272b6ab902b592111 | 7e5b7affe17e2b22c6e8296dacf0f628e7974770 | refs/heads/master | 2020-05-31T19:49:23.688416 | 2014-01-25T21:10:16 | 2014-01-25T21:10:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,718 | java | package com.xaviar.collect.sms;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import flexjson.JSONSerializer;
public class SmsUtil {
public static List<Sms> getAllSms(Context ctx) {
List<Sms> lstSms = new ArrayList<Sms>();
Sms objSms = new Sms();
Uri message = Uri.parse("content://sms/");
ContentResolver cr = ctx.getContentResolver();
Cursor c = cr.query(message, null, null, null, null);
int totalSMS = c.getCount();
if (c.moveToFirst()) {
for (int i = 0; i < totalSMS; i++) {
objSms = new Sms();
String smsID = c.getString(c.getColumnIndexOrThrow("_id"));
objSms.setId(smsID);
objSms.setAddress(c.getString(c
.getColumnIndexOrThrow("address")));
objSms.setMsg(c.getString(c.getColumnIndexOrThrow("body")));
objSms.setReadState(c.getString(c.getColumnIndex("read")));
objSms.setTime(c.getString(c.getColumnIndexOrThrow("date")));
if (c.getString(c.getColumnIndexOrThrow("type")).contains("1")) {
objSms.setFolderName("inbox");
} else {
objSms.setFolderName("sent");
}
lstSms.add(objSms);
c.moveToNext();
}
}
// else {
// throw new RuntimeException("You have no SMS");
// }
c.close();
return lstSms;
}
public static String toJsonArray(Collection<Sms> collection) {
return new JSONSerializer().exclude("*.class").serialize(collection);
}
}
| [
"eitan567@gmail.com"
] | eitan567@gmail.com |
c4124cc4d7551d833b9d0a0d1d9ffb60ff3b4275 | f36d1894274d0995eef9ac8ce6ec9a4f3a4a3aca | /sc-eureka-client-consumer-ribbon-hystrix/src/main/java/sc/consumer/controller/UserController.java | 3619acc97ba484168d7af868356d41d5761225ef | [
"Apache-2.0"
] | permissive | happyhuangjinjin/junit | 9b3141ce95048e5d923f4ecda32d9b85e6532a9c | ee12116680987c8ed233192d3618b09286568767 | refs/heads/master | 2021-01-10T11:34:31.314992 | 2019-05-02T02:07:36 | 2019-05-02T02:07:36 | 43,192,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,641 | java | package sc.consumer.controller;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import sc.consumer.model.User;
import sc.consumer.service.UserService;
@RestController
public class UserController {
@Autowired
private UserService userService;
@GetMapping(value = "/cli/user/getUser/{id}")
@ResponseBody
public Map<String, Object> getUser(@PathVariable Long id) {
return userService.getUser(id);
}
@RequestMapping(value = "/cli/user/listUser", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> listUser() {
return userService.listUser();
}
@PostMapping(value = "/cli/user/addUser")
@ResponseBody
public Map<String, Object> addUser(User user) {
return userService.addUser(user);
}
@PutMapping(value = "/cli/user/updateUser")
@ResponseBody
public Map<String, Object> updateUser(User user) {
return userService.updateUser(user);
}
@DeleteMapping(value = "/cli/user/deleteUser/{id}")
@ResponseBody
public Map<String, Object> deleteUser(@PathVariable Long id) {
return userService.deleteUser(id);
}
}
| [
"happyhuangjinjin@sina.com"
] | happyhuangjinjin@sina.com |
118087a4136925871b91467c1c6ea6b15dd531af | 0386dd72896464326174b50eb6743a02d1a87c3f | /core20/src/test/java/org/apache/myfaces/component/html/ext/HtmlMessagesTest.java | 4ce2861300efa790c0d57fc076c2bbffac8c5033 | [] | no_license | bschuette/tomahawk | f6922930bbb54e6914325fce11764eeeff63ef07 | 8e300e4adbadeb7221df00c3bb2e71ead86b656f | refs/heads/master | 2023-01-04T06:06:33.733606 | 2020-11-05T20:33:48 | 2020-11-05T20:33:48 | 310,410,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,704 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.myfaces.component.html.ext;
import java.io.IOException;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import junit.framework.Test;
import org.apache.myfaces.test.AbstractTomahawkViewControllerTestCase;
import org.apache.myfaces.test.utils.TestUtils;
public class HtmlMessagesTest extends AbstractTomahawkViewControllerTestCase
{
public HtmlMessagesTest(String name)
{
super(name);
}
protected void setUp() throws Exception
{
super.setUp();
}
protected void tearDown() throws Exception
{
super.tearDown();
}
/**
* Verify component renders with the default renderer.
*/
public void testDefaultRenderer()
{
// Define required panel group
HtmlPanelGroup panelGroup = new HtmlPanelGroup();
// Define the referenced component
UIComponent referencedComponent = new HtmlInputText();
referencedComponent.setId("referencedComponent");
//referencedComponent.setParent(panelGroup);
panelGroup.getChildren().add(referencedComponent);
facesContext.addMessage(referencedComponent.getId(), new FacesMessage(
FacesMessage.SEVERITY_ERROR, "summary", "detail"));
// Define the component
HtmlMessages component = new HtmlMessages();
component.setId("TestComponent");
referencedComponent.setParent(panelGroup);
panelGroup.getChildren().add(component);
// Render the component
try
{
TestUtils.renderComponent(facesContext, component);
}
catch (IOException e)
{
fail(e.getMessage());
}
// Verify component was rendered
assertIdExists(component.getId());
}
}
| [
"bjoern@schuette.se"
] | bjoern@schuette.se |
4315dffd703da78746750a306dca27bfe9e1fd70 | cd80ba33e45b1ad219aca4c362f9067dd561cf3a | /app/src/main/java/com/neworld/youyou/activity/MyChildActivity.java | 1bf39a9b19b85f874f72eca41dca3f3758080422 | [] | no_license | NextOrigins/Youyou | 83c6edb72e70b58594c1fa09dfaa7ded0deda04c | defb3fee41a370140cae3ac432bb25c62381a79b | refs/heads/master | 2021-09-14T19:50:19.743309 | 2018-05-18T10:26:30 | 2018-05-18T10:26:30 | 113,118,548 | 0 | 0 | null | 2017-12-06T10:27:58 | 2017-12-05T01:59:42 | Java | UTF-8 | Java | false | false | 1,353 | java | package com.neworld.youyou.activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import com.neworld.youyou.R;
public class MyChildActivity extends AppCompatActivity implements View.OnClickListener {
private Button btChild;
private ImageView ivCancel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_child);
initView();
}
private void initView() {
btChild = (Button) findViewById(R.id.bt_my_child);
ivCancel = (ImageView) findViewById(R.id.iv_cancel);
btChild.setOnClickListener(this);
ivCancel.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.bt_my_child:
startActivity(new Intent(this, AddChildActivity.class));
break;
case R.id.iv_cancel:
finish();
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
}
| [
"894250099@qq.com"
] | 894250099@qq.com |
012cb8ad45bb8184ae0cf8b802cc51532d5f978a | 510ef92398e6e431dc902c7ea1ff59e113d5ae5e | /app/src/main/java/com/example/faiflytest/DBInfo.java | 21aba4ecbf915b9cae6ab41c2cc9fa5ef9287cb1 | [] | no_license | bogs696/p_test_geonamesWikipedia | 36c0a3ceca3a8cf19d42a814ed306711bf081654 | f18ecd8c9bb66cec4e5a1cc4d1c56fd549fd0ac8 | refs/heads/master | 2020-06-13T11:38:45.863406 | 2019-07-01T09:26:06 | 2019-07-01T09:26:06 | 194,641,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,377 | java | package com.example.faiflytest;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class DBInfo extends SQLiteOpenHelper {
private static final String LOG_TAG = "DB_INFO";
private static final String NAME_DB = "Info";
private JSONObject jsonObject;
private final String URL_JSON = "https://raw.githubusercontent.com/David-Haim/CountriesToCitiesJSON/master/countriesToCities.json";
public DBInfo(Context context, SQLiteDatabase.CursorFactory factory, int version) {
super(context, NAME_DB, factory, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table country ("
+ "id integer primary key autoincrement,"
+ "name text" + ");");
db.execSQL("create table city ("
+ "id integer primary key autoincrement,"
+ "idCountry integer,"
+ "name text" + ");");
HttpHendler sh = new HttpHendler();
String jsonStr = sh.makeServiceCall(URL_JSON);
ContentValues cv;
if(jsonStr != null){
try {
jsonObject = new JSONObject(jsonStr);
JSONArray country = jsonObject.names();
for(int i=0; i<country.length(); i++){
JSONArray city = jsonObject.getJSONArray(country.getString(i));
cv = new ContentValues();
cv.put("name", country.getString(i));
long indexCountry = db.insert("country", null, cv);
for (int y=0; y<city.length();y++){
cv = new ContentValues();
cv.put("idCountry", indexCountry);
cv.put("name", city.getString(y));
db.insert("city", null, cv);
}
}
} catch (JSONException e){
Log.e(LOG_TAG, e.getMessage());
}
} else{
Log.e(LOG_TAG, "Erorr connect to JSON country-city");
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| [
"bogs696@gmail.com"
] | bogs696@gmail.com |
ee8c82d6593411abfd8d3af9d1964479f6270568 | fcf6bdc9f19b512ba63abb78fbeb4e3659c01f68 | /app/src/main/java/studio/xmatrix/coffee/ui/user/UserHandler.java | 885ef1aacc96f0bbe3b9eb36ad7fb9e2daf8f666 | [] | no_license | gfzheng/Coffee.Android | 0f2c777537f39c06796c479591468e3bd7c87096 | 4ea60a2c0b6bd7d312e9732fc1716d207ba5f31a | refs/heads/master | 2021-10-11T00:00:36.277583 | 2019-01-19T13:11:26 | 2019-01-19T13:11:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,140 | java | package studio.xmatrix.coffee.ui.user;
import android.arch.lifecycle.ViewModelProvider;
import android.arch.lifecycle.ViewModelProviders;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.Toolbar;
import android.view.View;
import com.lzy.ninegrid.NineGridView;
import studio.xmatrix.coffee.R;
import studio.xmatrix.coffee.data.common.network.Status;
import studio.xmatrix.coffee.data.model.User;
import studio.xmatrix.coffee.databinding.UserActivityBinding;
import studio.xmatrix.coffee.inject.AppInjector;
import studio.xmatrix.coffee.inject.Injectable;
import studio.xmatrix.coffee.ui.home.HomeAdapter;
import studio.xmatrix.coffee.ui.home.HomeListManger;
import studio.xmatrix.coffee.ui.home.HomeViewModel;
import studio.xmatrix.coffee.ui.nav.MyImageLoader;
import javax.inject.Inject;
import java.util.Objects;
import static studio.xmatrix.coffee.ui.AvatarImageBehavior.startAlphaAnimation;
public class UserHandler implements AppBarLayout.OnOffsetChangedListener, Injectable {
private static final float PERCENTAGE_TO_SHOW_TITLE_AT_TOOLBAR = 0.6f;
private static final float PERCENTAGE_TO_HIDE_TITLE_DETAILS = 0.3f;
private static final int ALPHA_ANIMATIONS_DURATION = 200;
private boolean mIsTheTitleVisible = false;
private boolean mIsTheTitleContainerVisible = true;
private UserActivity activity;
private UserActivityBinding binding;
private String id;
HomeListManger listManger;
@Inject
ViewModelProvider.Factory viewModelFactory;
private HomeViewModel viewModel;
UserHandler(UserActivity activity, UserActivityBinding binding) {
this.activity = activity;
this.binding = binding;
Bundle bundle = activity.getIntent().getExtras();
this.id = Objects.requireNonNull(bundle).getString("id", "");
if (this.id.equals("")) {
activity.finish();
return;
}
AppInjector.Companion.inject(this);
viewModel = ViewModelProviders.of(activity, viewModelFactory).get(HomeViewModel.class);
initView();
listManger = new HomeListManger(activity, binding.userInclude, viewModel);
listManger.setId(id);
initData();
}
void setImageLoader() {
NineGridView.setImageLoader(new MyImageLoader(activity, viewModel));
}
private void initData() {
viewModel.getUserInfo(id).observe(activity, res -> {
if (res != null) {
switch (res.getStatus()) {
case SUCCESS:
User info = Objects.requireNonNull(res.getData()).getResource();
if (info != null) {
binding.userToolbarTitle.setText(info.getName());
binding.userTitle.setText(info.getName());
binding.userBio.setText(info.getBio());
viewModel.getUserAvatar(info.getAvatar()).observe(activity, avatarRes -> {
if (avatarRes != null && avatarRes.getStatus() == Status.SUCCESS) {
binding.userBigAvatar.setImageBitmap(avatarRes.getData());
}
});
}
break;
}
}
});
}
private void initView() {
binding.userInclude.homeList.setLayoutManager(new LinearLayoutManager(activity));
binding.userInclude.homeList.setAdapter(new HomeAdapter(activity));
Toolbar toolbar = binding.userToolbar;
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_black_24dp);
toolbar.setTitle("");
activity.setSupportActionBar(toolbar);
binding.userAppBar.addOnOffsetChangedListener(this);
startAlphaAnimation(binding.userToolbarTitle, 0, View.INVISIBLE);
}
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int offset) {
int maxScroll = appBarLayout.getTotalScrollRange();
float percentage = (float) Math.abs(offset) / (float) maxScroll;
if (percentage >= PERCENTAGE_TO_SHOW_TITLE_AT_TOOLBAR) {
if (!mIsTheTitleVisible) {
startAlphaAnimation(binding.userToolbarTitle, ALPHA_ANIMATIONS_DURATION, View.VISIBLE);
mIsTheTitleVisible = true;
}
} else if (mIsTheTitleVisible) {
startAlphaAnimation(binding.userToolbarTitle, ALPHA_ANIMATIONS_DURATION, View.INVISIBLE);
mIsTheTitleVisible = false;
}
if (percentage >= PERCENTAGE_TO_HIDE_TITLE_DETAILS) {
if (mIsTheTitleContainerVisible) {
startAlphaAnimation(binding.userLinear, ALPHA_ANIMATIONS_DURATION, View.INVISIBLE);
mIsTheTitleContainerVisible = false;
}
} else if (!mIsTheTitleContainerVisible) {
startAlphaAnimation(binding.userLinear, ALPHA_ANIMATIONS_DURATION, View.VISIBLE);
mIsTheTitleContainerVisible = true;
}
}
}
| [
"zhenlychen@foxmail.com"
] | zhenlychen@foxmail.com |
8af0a01a3a74440a5b9d3d3fe237fd03f94fa413 | 5958a032b25c3d108bb556dcc81a8a604e035269 | /Outil-service/src/main/java/com/example/demo/OutilServiceApplication.java | 73089e48dc8218f50fa3ad9b8e937267da4cfd48 | [] | no_license | salsabilsehli/GestionLaboratoireSpringBoot | b11a4ba1d9cd191b9c45c27087daa10baa7ce6ac | 093b0e500af7c25f77aadb9f48959d221c0229ea | refs/heads/master | 2023-02-15T13:10:30.758944 | 2021-01-07T19:47:05 | 2021-01-07T19:47:05 | 327,709,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | package com.example.demo;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import com.example.demo.entities.Outil;
import com.example.demo.service.IOutilService;
@SpringBootApplication
@EnableDiscoveryClient
public class OutilServiceApplication implements CommandLineRunner{
@Autowired
IOutilService outilService;
@Autowired
RepositoryRestConfiguration configuration;
public static void main(String[] args) {
SpringApplication.run(OutilServiceApplication.class, args);
}
public void run(String... args) throws Exception {
configuration.exposeIdsFor(Outil.class);
SimpleDateFormat dateFormattor = new SimpleDateFormat("yyyy-mm-dd");
Date date1 = dateFormattor.parse("1997-11-24");
Outil o1=new Outil(date1,"source1");
outilService.addOutil(o1);
}
}
| [
"salsabil.sehli@stud.enis.tn"
] | salsabil.sehli@stud.enis.tn |
846eadd56440e00c71952db9ea856396b0f8735a | 9f778f74628c4baf4f2b45e5fd84aa7bc86097ef | /cloudstorage/src/main/java/com/udacity/jwdnd/course1/cloudstorage/controller/SignupController.java | d112380a19f4e115daf53f646b0f0789ca453342 | [] | no_license | Afzalkhan644/SuperDrive | d6ca80d13151d8a161b4d2b53e1209fdd1d6d2fd | b052d3270d617033449de50e7a71ee4842ecf839 | refs/heads/master | 2023-04-11T02:20:26.415552 | 2020-08-24T04:33:05 | 2020-08-24T04:33:05 | 279,111,149 | 0 | 0 | null | 2021-04-26T20:33:39 | 2020-07-12T17:10:38 | Java | UTF-8 | Java | false | false | 1,558 | java | package com.udacity.jwdnd.course1.cloudstorage.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.udacity.jwdnd.course1.cloudstorage.model.User;
import com.udacity.jwdnd.course1.cloudstorage.services.UserService;
@Controller()
@RequestMapping("/signup")
public class SignupController {
private final UserService userService;
public SignupController(UserService userService) {
this.userService = userService;
}
@GetMapping()
public String signupView() {
return "signup";
}
@PostMapping()
public String signupUser(@ModelAttribute User user, Model model) {
String signupError = null;
if (!userService.isUsernameAvailable(user.getUsername())) {
signupError = "The username already exists.";
}
if (signupError == null) {
int rowsAdded = userService.createUser(user);
if (rowsAdded < 0) {
signupError = "There was an error signing you up. Please try again.";
}
}
if (signupError == null) {
model.addAttribute("signupSuccess", true);
} else {
model.addAttribute("signupError", signupError);
}
return "signup";
}
} | [
"afzalkhan644@gmail.com"
] | afzalkhan644@gmail.com |
10d4db1297915a66fd5466318f1d0e031080af7f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_af3314b6488f2c521d40bcab92763f5aa2020738/ProtocolCodecFilter/9_af3314b6488f2c521d40bcab92763f5aa2020738_ProtocolCodecFilter_t.java | a5d94221ff23690277d152ee39e6f5c442ec2682 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 12,748 | java | /*
* @(#) $Id$
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.mina.filter.codec;
import org.apache.mina.common.ByteBuffer;
import org.apache.mina.common.ByteBufferProxy;
import org.apache.mina.common.IoFilter;
import org.apache.mina.common.IoFilterAdapter;
import org.apache.mina.common.IoFilterChain;
import org.apache.mina.common.IoSession;
import org.apache.mina.common.WriteFuture;
import org.apache.mina.common.support.DefaultWriteFuture;
import org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput;
import org.apache.mina.filter.codec.support.SimpleProtocolEncoderOutput;
import org.apache.mina.util.Queue;
import org.apache.mina.util.SessionLog;
/**
* An {@link IoFilter} which translates binary or protocol specific data into
* message object and vice versa using {@link ProtocolCodecFactory},
* {@link ProtocolEncoder}, or {@link ProtocolDecoder}.
*
* @author The Apache Directory Project (mina-dev@directory.apache.org)
* @version $Rev$, $Date$
*/
public class ProtocolCodecFilter extends IoFilterAdapter
{
public static final String ENCODER = ProtocolCodecFilter.class.getName() + ".encoder";
public static final String DECODER = ProtocolCodecFilter.class.getName() + ".decoder";
public static final String ENCODER_OUT = ProtocolCodecFilter.class.getName() + ".encoderOutput";
public static final String DECODER_OUT = ProtocolCodecFilter.class.getName() + ".decoderOutput";
private static final Class[] EMPTY_PARAMS = new Class[0];
private final ProtocolCodecFactory factory;
public ProtocolCodecFilter( ProtocolCodecFactory factory )
{
if( factory == null )
{
throw new NullPointerException( "factory" );
}
this.factory = factory;
}
public ProtocolCodecFilter( final ProtocolEncoder encoder, final ProtocolDecoder decoder )
{
if( encoder == null )
{
throw new NullPointerException( "encoder" );
}
if( decoder == null )
{
throw new NullPointerException( "decoder" );
}
this.factory = new ProtocolCodecFactory()
{
public ProtocolEncoder getEncoder()
{
return encoder;
}
public ProtocolDecoder getDecoder()
{
return decoder;
}
};
}
public ProtocolCodecFilter( final Class encoderClass, final Class decoderClass )
{
if( encoderClass == null )
{
throw new NullPointerException( "encoderClass" );
}
if( decoderClass == null )
{
throw new NullPointerException( "decoderClass" );
}
if( !ProtocolEncoder.class.isAssignableFrom( encoderClass ) )
{
throw new IllegalArgumentException( "encoderClass: " + encoderClass.getName() );
}
if( !ProtocolDecoder.class.isAssignableFrom( decoderClass ) )
{
throw new IllegalArgumentException( "decoderClass: " + decoderClass.getName() );
}
try
{
encoderClass.getConstructor( EMPTY_PARAMS );
}
catch( NoSuchMethodException e )
{
throw new IllegalArgumentException( "encoderClass doesn't have a public default constructor." );
}
try
{
decoderClass.getConstructor( EMPTY_PARAMS );
}
catch( NoSuchMethodException e )
{
throw new IllegalArgumentException( "decoderClass doesn't have a public default constructor." );
}
this.factory = new ProtocolCodecFactory()
{
public ProtocolEncoder getEncoder() throws Exception
{
return ( ProtocolEncoder ) encoderClass.newInstance();
}
public ProtocolDecoder getDecoder() throws Exception
{
return ( ProtocolDecoder ) decoderClass.newInstance();
}
};
}
public void onPreAdd( IoFilterChain parent, String name, NextFilter nextFilter ) throws Exception
{
if( parent.contains( ProtocolCodecFilter.class ) )
{
throw new IllegalStateException( "A filter chain cannot contain more than one ProtocolCodecFilter." );
}
}
public void messageReceived( NextFilter nextFilter, IoSession session, Object message ) throws Exception
{
if( !( message instanceof ByteBuffer ) )
{
nextFilter.messageReceived( session, message );
return;
}
ByteBuffer in = ( ByteBuffer ) message;
ProtocolDecoder decoder = getDecoder( session );
SimpleProtocolDecoderOutput decoderOut = getDecoderOut( session );
try
{
decoder.decode( session, in, decoderOut );
}
catch( Throwable t )
{
ProtocolDecoderException pde;
if( t instanceof ProtocolDecoderException )
{
pde = ( ProtocolDecoderException ) t;
}
else
{
pde = new ProtocolDecoderException( t );
}
pde.setHexdump( in.getHexDump() );
throw pde;
}
finally
{
// Dispose the decoder if this session is connectionless.
if( session.getTransportType().isConnectionless() )
{
disposeDecoder( session );
}
// Release the read buffer.
in.release();
Queue queue = decoderOut.getMessageQueue();
while( !queue.isEmpty() )
{
nextFilter.messageReceived( session, queue.pop() );
}
}
}
public void messageSent( NextFilter nextFilter, IoSession session, Object message ) throws Exception
{
if( ! ( message instanceof MessageByteBuffer ) )
{
nextFilter.messageSent( session, message );
return;
}
MessageByteBuffer buf = ( MessageByteBuffer ) message;
try
{
buf.release();
}
finally
{
nextFilter.messageSent( session, buf.message );
}
}
public void filterWrite( NextFilter nextFilter, IoSession session, WriteRequest writeRequest ) throws Exception
{
Object message = writeRequest.getMessage();
if( message instanceof ByteBuffer )
{
nextFilter.filterWrite( session, writeRequest );
return;
}
ProtocolEncoder encoder = getEncoder( session );
ProtocolEncoderOutputImpl encoderOut = getEncoderOut( session );
encoderOut.nextFilter = nextFilter;
try
{
encoderOut.writeRequest = writeRequest;
encoder.encode( session, message, encoderOut );
}
catch( Throwable t )
{
ProtocolEncoderException pee;
if( t instanceof ProtocolEncoderException )
{
pee = ( ProtocolEncoderException ) t;
}
else
{
pee = new ProtocolEncoderException( t );
}
throw pee;
}
finally
{
encoderOut.flush();
encoderOut.writeRequest = null;
// Dispose the encoder if this session is connectionless.
if( session.getTransportType().isConnectionless() )
{
disposeEncoder( session );
}
}
}
public void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception
{
disposeEncoder( session );
disposeDecoder( session );
nextFilter.sessionClosed( session );
}
private ProtocolEncoder getEncoder( IoSession session ) throws Exception
{
ProtocolEncoder encoder = ( ProtocolEncoder ) session.getAttribute( ENCODER );
if( encoder == null )
{
encoder = factory.getEncoder();
session.setAttribute( ENCODER, encoder );
}
return encoder;
}
private ProtocolEncoderOutputImpl getEncoderOut( IoSession session )
{
ProtocolEncoderOutputImpl out = ( ProtocolEncoderOutputImpl ) session.getAttribute( ENCODER_OUT );
if( out == null )
{
out = new ProtocolEncoderOutputImpl( session );
session.setAttribute( ENCODER_OUT, out );
}
return out;
}
private ProtocolDecoder getDecoder( IoSession session ) throws Exception
{
ProtocolDecoder decoder = ( ProtocolDecoder ) session.getAttribute( DECODER );
if( decoder == null )
{
decoder = factory.getDecoder();
session.setAttribute( DECODER, decoder );
}
return decoder;
}
private SimpleProtocolDecoderOutput getDecoderOut( IoSession session )
{
SimpleProtocolDecoderOutput out = ( SimpleProtocolDecoderOutput ) session.getAttribute( DECODER_OUT );
if( out == null )
{
out = new SimpleProtocolDecoderOutput();
session.setAttribute( DECODER_OUT, out );
}
return out;
}
private void disposeEncoder( IoSession session )
{
session.removeAttribute( ENCODER_OUT );
ProtocolEncoder encoder = ( ProtocolEncoder ) session.removeAttribute( ENCODER );
if( encoder == null )
{
return;
}
try
{
encoder.dispose( session );
}
catch( Throwable t )
{
SessionLog.warn(
session,
"Failed to dispose: " + encoder.getClass().getName() +
" (" + encoder + ')' );
}
}
private void disposeDecoder( IoSession session )
{
session.removeAttribute( DECODER_OUT );
ProtocolDecoder decoder = ( ProtocolDecoder ) session.removeAttribute( DECODER );
if( decoder == null )
{
return;
}
try
{
decoder.dispose( session );
}
catch( Throwable t )
{
SessionLog.warn(
session,
"Falied to dispose: " + decoder.getClass().getName() +
" (" + decoder + ')' );
}
}
private static class MessageByteBuffer extends ByteBufferProxy
{
private final Object message;
private MessageByteBuffer( ByteBuffer buf, Object message )
{
super( buf );
this.message = message;
}
}
private static class ProtocolEncoderOutputImpl extends SimpleProtocolEncoderOutput
{
private final IoSession session;
private NextFilter nextFilter;
private WriteRequest writeRequest;
public ProtocolEncoderOutputImpl( IoSession session )
{
this.session = session;
}
protected WriteFuture doFlush( ByteBuffer buf )
{
WriteFuture future;
if( writeRequest != null )
{
future = writeRequest.getFuture();
nextFilter.filterWrite(
session,
new WriteRequest(
new MessageByteBuffer(
buf, writeRequest.getMessage() ), future ) );
}
else
{
future = new DefaultWriteFuture( session );
nextFilter.filterWrite( session, new WriteRequest( buf, future ) );
}
return future;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
3aef355c6d2e03bc0f4b47aae99fd1b9fd029d8e | b0cb34780fd36c3c19cafcecd523c37ac8e0c38b | /app/src/main/java/team/wucaipintu/pinyipin/bean/PostItem.java | 384b921f4cc382ca5a879cf9266fcefc30422cfb | [] | no_license | cykun/Pinyipin | 174975b6a3a89c716b24650c2ed8688be706ef4a | 93a7ff15fe5cfd613bed2b555f7258f1152f5d77 | refs/heads/master | 2021-06-12T13:54:33.286213 | 2021-03-25T01:41:00 | 2021-03-25T01:41:00 | 157,963,419 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | package team.wucaipintu.pinyipin.bean;
public class PostItem {
private int postId;//postid
private String nikeName;//用户名
private String title;//标题
private String content;//内容
private String datatime;//发布时间
public int getPostId() {
return postId;
}
public void setPostId(int postId) {
this.postId = postId;
}
public String getNikeName() {
return nikeName;
}
public void setNikeName(String nikeName) {
this.nikeName = nikeName;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getDatatime() {
return datatime;
}
public void setDatatime(String datatime) {
this.datatime = datatime;
}
}
| [
"zhengxk1122@139.com"
] | zhengxk1122@139.com |
2549717e1d63f63f0eee64caf9a7a785f9b64dac | c249af8d96cd90402d333c4da3040d1999f0cba6 | /src/main/java/com/igt/demo/bc/BetLeg.java | 9e923904c552f5a85f2fc08f5aea7c31eabe16a1 | [] | no_license | mcekovic/unit-testing-demo-java | 3f3bc869332356858b4ca004402365695136739a | 2187be9d64e3be60385c8c577c5d84bb7c470215 | refs/heads/main | 2023-05-23T04:13:34.558067 | 2021-06-07T15:20:28 | 2021-06-07T15:20:28 | 373,241,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 984 | java | package com.igt.demo.bc;
import java.math.*;
import lombok.*;
import static java.util.Objects.*;
@Data
public class BetLeg {
public static BetLeg banker(String price) {
return banker(price, IrDescriptor.UNKNOWN);
}
public static BetLeg banker(String price, IrDescriptor descriptor) {
return new BetLeg(new BigDecimal(price), descriptor, true);
}
private BigDecimal price;
private IrDescriptor descriptor;
private boolean banker;
public BetLeg(String price) {
this(price, IrDescriptor.UNKNOWN);
}
public BetLeg(String price, IrDescriptor descriptor) {
this.price = new BigDecimal(price);
this.descriptor = descriptor;
}
public BetLeg(BigDecimal price, IrDescriptor descriptor, boolean banker) {
this.price = requireNonNull(price, "price");
this.descriptor = requireNonNull(descriptor, "descriptor");
this.banker = banker;
if (price.compareTo(BigDecimal.ONE) < 0)
throw new IllegalArgumentException("BetLeg price cannot be less than 1");
}
}
| [
"mcekovic@gmail.com"
] | mcekovic@gmail.com |
e4779a69e8fe31a786c1f0ec38c196ccda854c4f | 43fd1f7c22117504edea48f1c6ddcad0a4867403 | /src/todo/tasksdao/TaskDao.java | 5e67ccd2ca35694646bc9d86311336c44aa0684a | [] | no_license | Snerdette/To_Do_List_jholewa_klafrance | 3b79a480a5e1072b15090d9600dac7665e4cf924 | d79d53783a4b7522c9f065439c5167bf14a4f0f6 | refs/heads/master | 2020-03-07T15:53:48.155797 | 2018-10-31T18:15:26 | 2018-10-31T18:15:26 | 127,567,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,398 | java | package todo.tasksdao;
import java.util.ArrayList;
import todo.entities.Task;
public class TaskDao implements DaoInterface {
private ArrayList<Task> taskList = new ArrayList<Task>();
private int idCounter = 1;
//public TaskDao(){
//setting some initial data
//Task washCar = new Task(1, true, "Wash the car");
// Task cleanRoom = new Task(2, true, "Clean the bedroom");
//Task cleanRoom2 = new Task(2, true, "Clean the bedroom");
// taskList.add(washCar);
//taskList.add(cleanRoom);
//taskList.add(cleanRoom2);
//}
public ArrayList<Task> getList() {
return taskList;
}
public ArrayList<Task> getCompleted (){
ArrayList<Task> completedTasks = new ArrayList<Task>();
for(Task complete : taskList) {
if(complete.isChecked()) {
completedTasks.add(complete);
}
}
return completedTasks;
}
public ArrayList<Task> getIncompleted (){
ArrayList<Task> incompletedTasks = new ArrayList<Task>();
for(Task incomplete : taskList) {
if(!incomplete.isChecked()) {
incompletedTasks.add(incomplete);
}
}
return incompletedTasks;
}
public void addTask(Task addTask, String description) {
addTask.setTaskNum(idCounter);
addTask.setChecked(false);
addTask.setDescription(description);
taskList.add(addTask);
idCounter++;
}
public void removeTask(int removeTask) {
Task taskToRemove = null;
for(Task rmTask : taskList){
if(removeTask == rmTask.getTaskNum()){
taskToRemove = rmTask;
}
}
taskList.remove(taskToRemove);
}
public void updateTask(int updateTask, String newTaskNm) { //method for updating a task.
for(Task udTsk : taskList) {
if(updateTask == udTsk.getTaskNum()) {
udTsk.setTaskName(newTaskNm);
}
}
}
public void taskComplete(int cmpTask) {
for(Task taskComp : taskList) {
if(cmpTask == taskComp.getTaskNum()) {
taskComp.setChecked(true);
}
}
}
public void taskIncomplete(int incmpTask) {
for(Task taskIncomp : taskList) {
if(incmpTask == taskIncomp.getTaskNum()) {
taskIncomp.setChecked(false);
}
}
}
public void taskInProgress(int status){
for(Task taskInProg : taskList){
if(status == taskInProg.getTaskNum()){
taskInProg.setStatus(true);
}
}
}
public void taskNotStarted(int status){
for(Task notStarted : taskList){
if(status == notStarted.getTaskNum()){
notStarted.setStatus(false);
}
}
}
}
| [
"snerdette@gmail.com"
] | snerdette@gmail.com |
065326a14cc01fbf9d9657c1cfee69b0ca44c25a | 5a5cd6db46ac925d8d9814e35fca64c9632efe5b | /src/com/colabug/glass/reporting/ReportingActivity.java | da55387828b17f11febc72cb9f1f872178d2e615 | [] | no_license | colabug/Glass311Reporting | 509b924face5c72730049cd0f0cd3e2e12264bc3 | 11c128a23e83114bc1802d8e546e559b5fb831db | refs/heads/master | 2021-01-01T06:55:20.948881 | 2014-03-08T23:17:47 | 2014-03-08T23:17:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,705 | java | package com.colabug.glass.reporting;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import com.google.android.glass.app.Card;
import java.util.List;
// TODO: Implement the rest of the flow
// * Add menu for the first card
// * After selecting a category, prompt for more text
// * Show a summary card with category and text
// * Share data with the API
// * Allow sharing of photos
public class ReportingActivity extends Activity
{
private static final int SPEECH_REQUEST = 0;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
displaySpeechRecognizer();
}
private void displaySpeechRecognizer()
{
Intent intent = new Intent( RecognizerIntent.ACTION_RECOGNIZE_SPEECH );
startActivityForResult( intent, SPEECH_REQUEST );
}
@Override
protected void onActivityResult( int requestCode,
int resultCode,
Intent data )
{
super.onActivityResult( requestCode, resultCode, data );
if ( requestCode == SPEECH_REQUEST && resultCode == RESULT_OK )
{
List<String> results = data.getStringArrayListExtra(
RecognizerIntent.EXTRA_RESULTS );
String spokenText = results.get( 0 );
// Determine what to do based on the category keyword
Card card = new Card( this );
// Pothole
if ( spokenText.contains( "hole" ) )
{
card.setText( "You just reported a pothole." );
card.setFootnote( "You just said \"" + spokenText + "\"" );
}
// Street light
else if ( spokenText.contains( "street light" ) )
{
card.setText( "You just reported a broken street light." );
card.setFootnote( "You just said \"" + spokenText + "\"" );
}
// Dangerous building
else if ( spokenText.contains( "building" ) )
{
card.setText( "You just reported a dangerous building." );
card.setFootnote( "You just said \"" + spokenText + "\"" );
}
// Unknown category
else
{
card.setText( "Please use a known category: pothole, dangerous building, or street light." );
card.setFootnote( "You just said \"" + spokenText + "\"" );
}
setContentView( card.toView() );
}
}
}
| [
"colabug@gmail.com"
] | colabug@gmail.com |
1a16e7fb5d5f378d06fe08d81aa43c1093b7ca13 | 163abf914ea29a733eba0a716f1264213d2d5430 | /RadioServer/src/radioServer/radioHttpRequestHandler.java | e80f79b6473a2d54641f19e57e0aa57a4436c18c | [] | no_license | Spirit-ofJoy/Ampify | 21b3324028612226f29f414a784957c69a1cfca5 | b6d93e9dbdecf3648f53e364cffc7b0d42410425 | refs/heads/master | 2023-03-22T11:34:20.233991 | 2021-03-17T18:01:02 | 2021-03-17T18:01:02 | 301,436,651 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package radioServer;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collections;
@SuppressWarnings("restriction")
public class radioHttpRequestHandler implements HttpHandler {
private static final String PARAM_STRING = "paramString";
private static final int HTTP_OK_STATUS = 200;
/**
* handle handle the http request and send the files the user is asking for
* @param exchange
* @throws IOException
*/
public void handle(HttpExchange exchange) throws IOException {
// Get the @PARAM_STRING from the request. Here we know where is the song in server that the user is asking for
// response is the file_destination of the requested song
String response=exchange.getAttribute(PARAM_STRING).toString();;
exchange.getResponseHeaders().put("Content-Type", Collections.singletonList(("text/plain"))); //for a audio file
System.out.println("Response: " + response);
exchange.sendResponseHeaders(200, response.length());
byte[] buff=response.getBytes();
OutputStream os = exchange.getResponseBody();
os.write(buff);
os.close(); // Closing the streams
}
}
| [
"ayayushsharma@users.noreply.github.com"
] | ayayushsharma@users.noreply.github.com |
e2506589aa5a6913e58c9531b08ce097e0ad872b | 6d0295d891de2e724cce8333119c4f895562b719 | /app/src/main/java/com/wiltech/novamaxapp/MyBookingsActivity.java | 6f07704dcdf6ff075b9197de17632eba2522e4a5 | [] | no_license | morris254/Android_Booking_Sytem-Nova_Max_App | c819cd2d24a643da0e56c83c8a315d414c560f8c | 5e8fee5879fc69356b9d19daa8f18b3adc5d1301 | refs/heads/master | 2020-12-07T00:34:36.357277 | 2015-07-16T18:29:17 | 2015-07-16T18:29:17 | 48,498,863 | 1 | 0 | null | 2015-12-23T15:58:47 | 2015-12-23T15:58:46 | null | UTF-8 | Java | false | false | 3,297 | java | package com.wiltech.novamaxapp;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class MyBookingsActivity extends ActionBarActivity {
//DB handler
DBBookingsHandler dbBookingsHandler;
String userName = "Wil";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_bookings);
//get the user name
userName = SaveUserLoggedInSharedPreference.getPrefUserName(MyBookingsActivity.this);
//Database to read day's select bookings
dbBookingsHandler = new DBBookingsHandler(this, null, null, 1);
//Implement the List View
//String[] foods = {"Bacon", "Ham", "Tuna", "Candy", "Meatball", "Potato", "Eggs", "Pasta", "Spaghetti", "Pizza"};
//String to hold the number of values returned from the database
String myBookings[];
myBookings = dbBookingsHandler.getMyBookingsFromDB(userName);
//create an array of strings of the size of how many rows have returned
String myCurrentBookings[] = new String[myBookings.length];
//check for null values
for(int i =0; i<myBookings.length;i++){
if(myBookings[i] != null){
myCurrentBookings[i] = myBookings[i];
}
}
//create the adapter to convert Array of strings into list items
ListAdapter wilsAdapter = new BookingsMyListViewAdapter(this, myBookings);
//declare your list view
ListView wilsListView = (ListView) findViewById(R.id.lViewMyBookings);
//Convert the array of strings and add it to the list view
wilsListView.setAdapter(wilsAdapter);
//create a listener for each item on the list view to respond to touch
wilsListView.setOnItemClickListener(
new AdapterView.OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String bookingDetails = String.valueOf(parent.getItemAtPosition(position));
Toast.makeText(MyBookingsActivity.this, bookingDetails, Toast.LENGTH_LONG).show();
}
}
);//ends setOnItemClickListener
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_my_bookings, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"wiliam334@hotmail.com"
] | wiliam334@hotmail.com |
3478fc3f0e4b92cceac0230a5ca7ab869764ebeb | 5dac34c9e4d2f763cd66934b5f37e457eeb7e710 | /LG_CoreLib/src/com/zuzu/coreapi/ZZAPIRequest.java | c60c1a1d63d133397712b3c5b2e3aab3b79691a3 | [] | no_license | thiensuhack/thiensu-little-genius | 62cff225b8cfa947fc71fa48ded7f1145845db98 | 9a7c1acf6298914b763ff10f86a9acb9cceb4770 | refs/heads/master | 2021-01-15T11:48:38.550774 | 2014-10-06T18:17:50 | 2014-10-06T18:17:50 | 32,838,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,035 | java | package com.zuzu.coreapi;
import org.apache.http.HttpResponse;
import org.json.JSONObject;
import android.os.Bundle;
import com.zuzu.corelib.HttpErrors;
import com.zuzu.corelib.RequestMethodEnum;
import com.zuzu.corelib.ZZHttpRequest;
import com.zuzu.corelib.ZZHttpRequestResult;
public class ZZAPIRequest extends ZZHttpRequest {
protected IDelegateAPIRequestGetter mDelegate;
private APIRequestResult apiRequestResult = null;
private HttpErrors error = null;
private boolean doRightNow = false;
public ZZAPIRequest(int requestType, String endpoint, Bundle params,
IDelegateAPIRequestGetter delegate, boolean debug) {
super(requestType, endpoint, params, ZZHttpRequestResult.JSONResult,
debug);
this.mDelegate = delegate;
}
public ZZAPIRequest(int requestType, String endpoint, Bundle params,
RequestMethodEnum method, IDelegateAPIRequestGetter delegate,
boolean debug) {
super(requestType, endpoint, params, method,
ZZHttpRequestResult.JSONResult, debug);
this.mDelegate = delegate;
}
public ZZAPIRequest(int requestType, String endpoint, Bundle params,
RequestMethodEnum method, IDelegateAPIRequestGetter delegate,
boolean debug, ZZHttpRequestResult resultType) {
super(requestType, endpoint, params, method, resultType, debug);
this.mDelegate = delegate;
}
public ZZAPIRequest(int requestType, String endpoint, Bundle params,
RequestMethodEnum method, boolean debug,
ZZHttpRequestResult resultType) {
super(requestType, endpoint, params, method, resultType, debug);
}
public ZZAPIRequest(int requestType, String endpoint, Bundle params,
RequestMethodEnum method, boolean debug) {
super(requestType, endpoint, params, method,
ZZHttpRequestResult.JSONResult, debug);
}
public void doRightNow() {
this.doRightNow = true;
this.execute();
}
public HttpErrors getError() {
return error;
}
public APIRequestResult getAPIRequestResult() {
return this.apiRequestResult;
}
@Override
public void onGetJsonDataCompleted(final int requestType,
final JSONObject data) {
// TODO Auto-generated method stub
if (data == null) {
onGetDataError(requestType, new HttpErrors(HttpErrors.NULL_DATA,
"data null"));
return;
}
try {
int errorCode = -999999;
if (data.has("error_code")) {
errorCode = data.getInt("error_code");
}
String errorMsg = "";
if (data.has("error_msg")) {
errorMsg = data.getString("error_msg");
}
String errorType = "";
if (data.has("error_type")) {
errorType = data.getString("error_type");
}
Object _data = null;
if (data.has("data") && !data.isNull("data")) {
_data = data.get("data");
}
final APIRequestResult ret = new APIRequestResult();
ret.error_code = errorCode;
ret.error_msg = errorMsg;
ret.error_type = errorType;
ret.data = _data;
if (this.doRightNow) {
this.apiRequestResult = ret;
} else {
if (this.mDelegate != null) {
// MyHandler.getInstance().post(new Runnable() {
// @Override
// public void run() {
// // mDelegate.onGetDataError(Errors.NETWORK_UNKNOWN);
// mDelegate.onGetAPIRequestDataCompleted(requestType,
// ret);
// }
// });
}
}
} catch (final Exception ex) {
onGetDataError(requestType, new HttpErrors(
HttpErrors.JSON_PARSE_ERROR, ex.getMessage()));
}
}
@Override
public void onGetStringDataCompleted(final int requestType,
final String data) {
// TODO Auto-generated method stub
// if (this.mDelegate != null) {
// MyHandler.getInstance().post(new Runnable() {
// @Override
// public void run() {
// // mDelegate.onGetDataError(Errors.NETWORK_UNKNOWN);
// mDelegate.onGetStringDataCompleted(requestType, data);
// }
// });
// }
}
@Override
public void onGetBinaryDataCompleted(final int requestType,
final byte[] data) {
// TODO Auto-generated method stub
// if (this.mDelegate != null) {
// MyHandler.getInstance().post(new Runnable() {
// @Override
// public void run() {
// // mDelegate.onGetDataError(Errors.NETWORK_UNKNOWN);
// mDelegate.onGetBinaryDataCompleted(requestType, data);
// }
// });
// }
}
@Override
public void onGetRawDataCompleted(final int requestType,
final HttpResponse data) {
// TODO Auto-generated method stub
// if (this.mDelegate != null) {
// MyHandler.getInstance().post(new Runnable() {
// @Override
// public void run() {
// // mDelegate.onGetDataError(Errors.NETWORK_UNKNOWN);
// mDelegate.onGetRawDataCompleted(requestType, data);
// }
// });
// }
}
@Override
public void onGetDataError(final int requestType, final HttpErrors error) {
// TODO Auto-generated method stub
if (this.doRightNow) {
this.error = error;
}
// else if (this.mDelegate != null) {
// MyHandler.getInstance().post(new Runnable() {
// @Override
// public void run() {
// // mDelegate.onGetDataError(Errors.NETWORK_UNKNOWN);
// mDelegate.onGetDataError(requestType, error);
// }
// });
// }
}
}
| [
"minhthien.le010190@gmail.com@6e4b3ab7-e781-19b7-9e48-9f70c7ce57ac"
] | minhthien.le010190@gmail.com@6e4b3ab7-e781-19b7-9e48-9f70c7ce57ac |
2e824c1ed0edf0270da1a94281832fed15b2b7f5 | 79d1f832010e57616d5c1c6cda0b4abb6370228d | /server/src/main/java/com/chqiuu/proxy/config/MybatisConfig.java | 049c57e2f00d65b0c2fc2fd1d0eadbc21e7cdb31 | [
"Apache-2.0"
] | permissive | chqiuu/proxy-ip-pool | e3d5bf183b87cc02510a3fd7d757b5bfe68ddc96 | cd74007c94dc6d2d95f51d2f46543eb7b3a89589 | refs/heads/main | 2023-06-27T03:41:25.566402 | 2021-07-16T08:21:43 | 2021-07-16T08:21:43 | 375,223,475 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | package com.chqiuu.proxy.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Mybatis配置
*
* @author chqiu
*/
@Configuration(proxyBeanMethods = false)
@MapperScan("com.chqiuu.proxy.**.mapper")
public class MybatisConfig {
/**
* 3.4.0 以后的配置方式
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 乐观锁
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
// 分页配置
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}
} | [
"35096687+chqiuu@users.noreply.github.com"
] | 35096687+chqiuu@users.noreply.github.com |
a73386383ca5a46faf313c787a6ca2eeba0d839a | 607386530d05a3176b442aa51e313f30ff08e9de | /seamcat/model/plugin/Function2D.java | db8015b0eeddd4690b298b98d095f74d8a59c5af | [] | no_license | rayvo/seamcat | 6b532137b2a6d9149f8a5102a48327188dcbec3c | 4f9cfbab3532bb94cb35911d535af2099d779a04 | refs/heads/master | 2021-01-10T21:33:57.171281 | 2009-03-27T12:35:45 | 2009-03-27T12:35:45 | 33,710,648 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Function2D.java
package org.seamcat.model.plugin;
public interface Function2D
{
public abstract void addPoint(double d, double d1);
public abstract double evaluate(double d)
throws Exception;
public abstract double integrate(double d, double d1)
throws Exception;
}
| [
"voquocduy1983@0fa86794-1aca-11de-9c9a-2d325a3e6494"
] | voquocduy1983@0fa86794-1aca-11de-9c9a-2d325a3e6494 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.