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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0a4ab5c4928f35ff7da3e701ae907feff461f532 | db22bba828ee0118f5766c3a07390cc197d2cc65 | /20210105/src/Main.java | 8c68e9f1f910a1c6134c4dbb3dcaebf7cef3ce77 | []
| no_license | LHJ-123/everydat | 4fb3318966f6bd0dcbf550074e96ec1ea425e00c | 61e9ac2da2d86559b2a22bc8508ea639d4d41315 | refs/heads/master | 2022-12-23T13:56:18.976377 | 2021-03-28T01:09:52 | 2021-03-28T01:09:52 | 246,778,966 | 0 | 0 | null | 2022-12-16T00:40:11 | 2020-03-12T08:15:48 | Java | UTF-8 | Java | false | false | 630 | java | public class Main {
static int count = 0;
public static void main(String[] args) {
int[] a = {1,2,3};
test(a,0);
System.out.println(count);
}
public static void test(int[] a,int b){
if(b>=a.length){
count++;
System.out.println(java.util.Arrays.toString(a));
}
for (int i = b; i < a.length; i++) {
{int k = a[b];a[b] = a[i];a[i] = k;}//两个数字,进行交换
test(a,b+1);//用递归进行下一个数的交换
{int k = a[b];a[b] = a[i];a[i] = k;}//再次交换两个数字,换回来
}
}
} | [
"[email protected]"
]
| |
91e5955c04906152716a9a0f08531edd4426528b | 18d379f43245547072a9eed382fb015462493e7c | /src/edu/marist/jointstudy/essence/ui/HomeController.java | ca2b8a37fc876fdcdfb605ffacd26f46ab0a9b6f | [
"MIT"
]
| permissive | tommagnusson/blockchain | 8395b1bf4d48ff2be4c64a26ca62127afd1ff3c0 | 6b68c17415d79726c9deb00bf0e755c453c7c4df | refs/heads/master | 2021-10-25T05:01:04.989262 | 2019-04-01T13:10:02 | 2019-04-01T13:10:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,717 | java | package edu.marist.jointstudy.essence.ui;
import com.sun.javafx.collections.ObservableListWrapper;
import edu.marist.jointstudy.essence.api.Peer;
import edu.marist.jointstudy.essence.api.client.BlockchainPullObserver;
import edu.marist.jointstudy.essence.api.client.Friend;
import edu.marist.jointstudy.essence.api.client.LoggingBlockchainObserver;
import edu.marist.jointstudy.essence.api.server.APIConstants;
import edu.marist.jointstudy.essence.api.store.Preferences;
import edu.marist.jointstudy.essence.core.hash.Hashcode;
import edu.marist.jointstudy.essence.core.structures.Block;
import edu.marist.jointstudy.essence.core.structures.Transaction;
import javafx.application.Platform;
import javafx.beans.property.*;
import javafx.beans.value.ChangeListener;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import okhttp3.HttpUrl;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.*;
import java.util.stream.Collectors;
import static edu.marist.jointstudy.essence.ui.Helpers.newFakeIntegerProperty;
import static edu.marist.jointstudy.essence.ui.Helpers.newFakeStringProperty;
public class HomeController {
private App app;
/** Peers contain the server and client logic associated with the node. */
private Peer peer;
@FXML private AnchorPane transactionBufferPane;
@FXML private TransactionTableViewController transactionBufferPaneController;
@FXML private MenuItem requestMiningItem;
@FXML private ProgressIndicator miningIndicator;
@FXML private Button requestMiningButton;
// Blockchain table
@FXML private TableView<Block> blockchainTableView;
@FXML private TableColumn<Block, Integer> blockIdColumn;
@FXML private TableColumn<Block, String> hashColumn;
@FXML private TableColumn<Block, String> nonceColumn;
@FXML private TableColumn<Block, String> merkleRootColumn;
@FXML private TableColumn<Block, String> previousBlockHashColumn;
@FXML private TableColumn<Block, Integer> numberOfTxColumn;
@FXML private AnchorPane selectedBlock;
@FXML private TransactionTableViewController selectedBlockController;
@FXML private Button toggleServerButton;
@FXML private Label peerStatusLabel;
@FXML private Label apiNameLabel;
@FXML private Label toastLabel;
@FXML private ListView<String> friendListView;
@FXML private AnchorPane currentFriendDownloadStatus;
private List<Friend> friends;
/** An observable boolean value indicating whether the peer is running. */
private BooleanProperty peerIsRunning = new SimpleBooleanProperty();
// setup goes here
@FXML private void initialize() {
apiNameLabel.setText(APIConstants.apiName);
// if the serverIsRunning boolean changes, automatically update the label
peerIsRunning.addListener(this.onPeerStatusChanged);
peerIsRunning.setValue(false);
}
/**
* Setup for after the initialize goes here.
* Must be called after the {@code setApp()} is set.
*/
public void initServer() {
this.peer = new Peer(Preferences.getPort(), Preferences.getFriendlyUrls());
this.friends = peer.friends();
this.friendListView.getItems().setAll(
this.friends.stream().map((f) -> f.baseUrl().toString()).collect(Collectors.toList())
);
// observe all the friends through logging
this.friends.forEach((f) -> f.addObserver(new LoggingBlockchainObserver(f.baseUrl().toString())));
initTransactionBufferTable();
initBlockchainTable();
initFriendListView();
Helpers.makeToast(toastLabel,"Welcome!", 2);
peer.start();
}
private void initTransactionBufferTable() {
startPeriodicRunnable(2, this::refreshTxBuffer);
}
private void initBlockchainTable() {
blockIdColumn.setCellValueFactory((cellData) -> newFakeIntegerProperty(cellData.getValue().getId()));
hashColumn.setCellValueFactory((cellData) -> newFakeStringProperty(cellData.getValue().getHash().toString()));
nonceColumn.setCellValueFactory((cellData) -> newFakeStringProperty(cellData.getValue().getNonce().toString()));
merkleRootColumn.setCellValueFactory((cellData) ->
newFakeStringProperty(cellData.getValue().getTransactionsAsMerkleTree().getMerkleRoot().toString()));
previousBlockHashColumn.setCellValueFactory((cellData) -> {
Optional<Hashcode> hashCode = cellData.getValue().getPreviousBlockHash();
return newFakeStringProperty(hashCode.isPresent() ? hashCode.get().toString() : "None");
});
numberOfTxColumn.setCellValueFactory((cellData) ->
newFakeIntegerProperty(cellData.getValue().getTransactions().size()));
startPeriodicRunnable(2, this::refreshBlockchain);
blockchainTableView.getSelectionModel().selectedItemProperty().addListener(
((observable, oldValue, newValue) -> {
showBlock(newValue);
})
);
}
private void showBlock(Block b) {
if(b != null) {
this.selectedBlockController.setTransactions(b);
}
}
private void initFriendListView() {
this.currentFriendDownloadStatus.getChildren().add(
new HBox(10, dlStatusLabel, dlStatusBar, countdownLabel)
);
dlStatusBar.setVisible(false);
this.friendListView.getSelectionModel().selectedItemProperty().addListener(
(observable, oldValue, newValue) -> {
dlStatusBar.setVisible(true);
showDownload(newValue);
}
);
}
private Friend selectedFriend;
private Label dlStatusLabel = new Label();
private ProgressBar dlStatusBar = new ProgressBar();
private Label countdownLabel = new Label();
private BlockchainPullObserver obs = new UIBlockchainObserver(dlStatusLabel, dlStatusBar, countdownLabel, 5);
private void showDownload(String friendUrl) {
// find the friend in the list of our friends based on the selected url
Optional<Friend> maybeFriend =
this.friends.stream().filter((f) -> f.baseUrl().toString().equals(friendUrl)).findFirst();
// if it's not in our list, no biggie, just don't do anything
if(!maybeFriend.isPresent()) {
System.err.println("Warning: selected a download with an invalid friend url.");
return;
}
// our observer is observing the previous selected friend, remove it because we don't want to
// observe that friend anymore
if(selectedFriend != null) {
selectedFriend.removeObserver(obs);
}
// get the new friend
selectedFriend = maybeFriend.get();
// start observing that new friend, displayed on the right in the GUI
selectedFriend.addObserver(obs);
}
@FXML
private void onRequestMining(ActionEvent ae) {
CompletableFuture<Void> miningRequest = peer.requestMining();
if(miningRequest == null) {
Helpers.makeToast(toastLabel, "No transactions to mine.", 1);
return;
}
setMiningUIOn(true);
// after the mining is completed...
miningRequest.thenAccept((ignored) -> {
setMiningUIOn(false);
refreshAll(); // both tx buffer and blockchain
// make sure that rendering the toast happens on JavaFX's main thread
Platform.runLater(() -> Helpers.makeToast(toastLabel, "Finished mining.", 1));
});
Helpers.makeToast(toastLabel, "Started mining.", 1);
}
private void setMiningUIOn(boolean miningIsHappening) {
miningIndicator.setVisible(miningIsHappening);
requestMiningButton.setDisable(miningIsHappening);
requestMiningItem.setDisable(miningIsHappening);
}
/**
* 1. Change the peer status label to reflect the new peer status.
* 2. Turn peer on or off if changed.
*/
private final ChangeListener<? super Boolean> onPeerStatusChanged = (observable, wasRunning, isCurrentlyRunning) -> {
peerStatusLabel.setText(isCurrentlyRunning ? "running" : "stopped");
if(!wasRunning && isCurrentlyRunning) {
// better have that server running
peer.start();
toggleServerButton.setText("Stop Server");
peerStatusLabel.setTextFill(Color.GREEN);
} else if (wasRunning && !isCurrentlyRunning){
// turn it off!
peer.stop();
toggleServerButton.setText("Start Server");
peerStatusLabel.setTextFill(Color.MAROON);
}
};
/** Refresh the transaction buffer tableview every secondsBetween seconds */
private void startPeriodicRunnable(long secondsBetween, Runnable r) {
ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();
exec.scheduleAtFixedRate(
r,
0,
secondsBetween,
TimeUnit.SECONDS
);
}
/** Refreshes the transaction buffer and blockchain. */
private void refreshAll() {
refreshTxBuffer();
refreshBlockchain();
}
private void refreshTxBuffer() {
Platform.runLater(() -> transactionBufferPaneController.setTransactions(peer.transactionBuffer()));
}
private void refreshBlockchain() {
Platform.runLater(() -> blockchainTableView.setItems(new ObservableListWrapper<>(peer.blocks())));
}
@FXML private void onToggleServer(ActionEvent ae) {
peerIsRunning.setValue(toggleServerButton.getText().equals("Start Server"));
}
@FXML private void onAddFriend(ActionEvent ae) {
Optional<HttpUrl> friend = app.showAddFriendDialog();
if(friend.isPresent()) {
Helpers.makeToast(toastLabel, friend + " added.", 2);
}
}
@FXML private void onAddTransactionToBuffer(ActionEvent ae) {
Dialog<Transaction> d = Dialogs.createTransaction();
d.showAndWait().ifPresent((transaction) -> {
peer.submitTransactionToBuffer(transaction);
refreshTxBuffer();
});
}
@FXML private void onPreferencesAction(ActionEvent e) {
Dialogs.preferences(Preferences.getPort()).showAndWait().ifPresent(System.out::println);
}
@FXML private void onQuit() {
System.exit(0);
}
public void setApp(App app) {
this.app = app;
}
}
| [
"[email protected]"
]
| |
2b92be25dd38fb1446fa331c05bebe2b4cf98aae | 844bee261d07f5235e5e18f931e647a4c19a4b6f | /NetBeansProjects/Testcallrun2/src/testcallrun2/Testcallrun2.java | 42808790c3c7c6fb3953b95967a89746a8b7891f | []
| no_license | PSN123/javacodes | faac1f7273dcf09ea8c70336933f7f664678ac7c | aca5634ef8ece5f0415963898035ec930c0b5e2a | refs/heads/master | 2020-04-02T23:30:41.473369 | 2018-10-26T17:33:48 | 2018-10-26T17:33:48 | 154,870,182 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package testcallrun2;
public class Testcallrun2 extends Thread {
public void run(){
for(int i=1;i<20;i++){
try{Thread.sleep(500);
}catch(InterruptedException e){System.out.println(e);}
System.out.println(i);
}
}
public static void main(String[] args) {
Testcallrun2 t1=new Testcallrun2();
Testcallrun2 t2=new Testcallrun2();
t1.start();
t2.start();
}
}
| [
"[email protected]"
]
| |
a94c6a0cfbfe5b380a6d13693dd14969a44c2e45 | 155ab03f76a2074f1364e3de2acc7293f783b42b | /2019-aug/4.domain layer patterns/src/com/alg/order/repository/specifications/ISqlSpecification.java | 32f763b16edff29b8aabe5e2c62a086679bb0648 | []
| no_license | khaja-syed/architectural-patterns | 7a9ca9787191e82de8997db657fe4bebaf3024f2 | c6173add2aa9cd83faa38c4fab202e76672b29f6 | refs/heads/master | 2020-11-29T01:10:08.101474 | 2019-11-10T01:46:34 | 2019-11-10T01:46:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 118 | java | package com.alg.order.repository.specifications;
public interface ISqlSpecification {
String toSqlClauses();
}
| [
"[email protected]"
]
| |
2655f39cda0b491560827d6d5270b65ae5084926 | cbcddaf39860916271fb435ccaf0d2915c4661de | /Jacos-Core/src/main/java/com/americanexpress/jacos/model/BulkConnectorResponse.java | 3ef3b067661898efc207d6b4e023acdf6dc9f5a7 | [
"Apache-2.0"
]
| permissive | americanexpress/jacos | 1aa62fb3c8e1e0fa336fee4c15ea971c62274d0c | f4d5fe7bd287178be3dce748e8f5cbe3ffa70a36 | refs/heads/master | 2021-12-15T05:02:20.644287 | 2020-04-06T15:45:41 | 2020-04-06T15:45:41 | 252,784,766 | 3 | 5 | Apache-2.0 | 2021-12-14T21:43:37 | 2020-04-03T16:31:03 | Java | UTF-8 | Java | false | false | 1,391 | java | /*
* Copyright 2020 American Express Travel Related Services Company, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package com.americanexpress.jacos.model;
import java.io.Serializable;
public class BulkConnectorResponse implements Serializable {
private static final long serialVersionUID = 72347236423432423L;
protected String status;
protected String description;
public BulkConnectorResponse message(String description, String status) {
this.status = status;
this.description = description;
return this;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"[email protected]"
]
| |
84c6ea92b1bed2e56bd2397f41153abf61b0d569 | 03d14a09c88f0e0b4eea07960554356a7114c054 | /lab11/lab11_2/src/lab11_2/Cat.java | 003540c36eafd934e0a11dcf3b72ed00d7400d64 | []
| no_license | pdppandee/LabJava-freshy1-2 | 231eadb91e36d3889d787bbf2940d5afc5fd571b | 0dbb87b0418f9c65685222a074f0a92c7ce914bc | refs/heads/main | 2023-09-05T11:05:36.390408 | 2021-11-18T10:37:41 | 2021-11-18T10:37:41 | 429,381,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,401 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package lab11_2;
/**
*
* @author USER
*/
public class Cat extends Animal implements CanWalk{
public Cat(String name) {
super(name);
}
@Override
public void walk(Terrain terrain) {
if(terrain.canMove(this)) {
System.out.println(this.getName() +"(" +this.getClass().getSimpleName()
+") can walk on " + terrain.getName() + "("+terrain.getClass().getSimpleName()+")");
} else {
System.out.println(this.getName() +"(" +this.getClass().getSimpleName()
+") can not walk on " + terrain.getName() + "("+terrain.getClass().getSimpleName()+")");
}
}
@Override
public void run(Terrain terrain) {
if(terrain.canMove(this)) {
System.out.println(this.getName() +"(" +this.getClass().getSimpleName()
+") can run on " + terrain.getName() + "("+terrain.getClass().getSimpleName()+")");
} else {
System.out.println(this.getName() +"(" +this.getClass().getSimpleName()
+") can not run on " + terrain.getName() + "("+terrain.getClass().getSimpleName()+")");
}
}
}
| [
"[email protected]"
]
| |
614bc50fdb996ababcfc78b85a02d7bba0fc09cb | 4e488db7ddba982f72769f9d047224125fba65ec | /src/main/java/kr/co/itcen/mysite/service/UserService.java | 107cc9cb7e2808514eb62f17349fa56015b230b8 | []
| no_license | youjin-kim/mysite3 | 0aa2d34fd72c5210d5026a5c3c4fe2847e95c0c6 | d95c77365f2149caa7d0e4da01427d4e85bcb099 | refs/heads/master | 2022-12-25T01:27:20.735740 | 2019-09-27T02:32:52 | 2019-09-27T02:32:52 | 210,542,768 | 0 | 0 | null | 2022-12-16T09:59:55 | 2019-09-24T07:46:06 | Java | UTF-8 | Java | false | false | 602 | java | package kr.co.itcen.mysite.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import kr.co.itcen.mysite.repository.UserDao;
import kr.co.itcen.mysite.vo.UserVo;
@Service
public class UserService {
@Autowired
private UserDao userDao;
public void join(UserVo vo) {
userDao.insert(vo);
}
public UserVo getUser(UserVo vo) {
return userDao.get(vo);
}
public UserVo getUserInfo(Long userNo) {
return userDao.get(userNo);
}
public void update(UserVo vo) {
userDao.update(vo);
}
}
| [
"Xnote@LG"
]
| Xnote@LG |
589d03658b01a232b48698f6bc204c659cc51dd9 | d8fc9a8b455a9fd7ed5ba2f760af92d6c44b919d | /src/chatclient/ChatClient.java | 41f30ded8468215c99e80eb7b688d637d8c87593 | []
| no_license | nijeshu/ChatClientApplication | a1b945d7fc7aed142da344f2a9c0fb9a16a37037 | ac5fdf9643f204cc79ed192ae141fb03618d1b44 | refs/heads/master | 2020-03-23T22:54:55.441474 | 2018-07-24T20:22:25 | 2018-07-24T20:22:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 775 | java | package chatclient;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
*/
public class ChatClient extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setTitle("Chat Client");
stage.setOnCloseRequest(event->System.exit(0));
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"[email protected]"
]
| |
65dd6d8255675913dae355049c482a1dee0bc723 | 0a6e41da01e43562e8a5ef6d227e10159fc253b3 | /common/src/main/java/com/spring/base/vo/baseinfo/instrumentdetail/InstrumentDetailAddVo.java | 8a3c7ee01beac1e193ee99e851655014961899cd | []
| no_license | chq347796066/base-interface | 917914190be0b487929f38d2cce68f7e396c149e | 356aabbdcf827c9a65083d17c3e7ade259801bfd | refs/heads/main | 2023-02-26T13:53:26.205433 | 2021-02-08T10:24:36 | 2021-02-08T10:24:36 | 337,037,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,022 | java | package com.spring.base.vo.baseinfo.instrumentdetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
/**
* @author 作者:ZhaoJinHua
* @date : 创建时间:2020-04-03 16:03:23
* @Desc类说明: 新增仪明细vo
*/
@ApiModel
@Data
@ToString
public class InstrumentDetailAddVo {
//小区id
@ApiModelProperty(value = "小区id")
private String communityId;
//楼栋id
@ApiModelProperty(value = "楼栋id")
private String buildId;
//房屋编码
@ApiModelProperty(value = "房屋编码")
private String houseCode;
//仪表id
@ApiModelProperty(value = "仪表id")
private String instrumentId;
//仪表名称
@ApiModelProperty(value = "仪表名称")
private String instrumentName;
//抄表状态(0 已抄表 1 未抄表)
@ApiModelProperty(value = "抄表状态(0 已抄表 1 未抄表)")
private String readingStatus;
//上期抄表时间
@ApiModelProperty(value = "上期抄表时间")
private Date lastReadingTime;
//上期抄表读数
@ApiModelProperty(value = "上期抄表读数")
private Integer lastReadingNumber;
//本期抄表时间
@ApiModelProperty(value = "本期抄表时间")
private Date issueReadingTime;
//本期抄表读数
@ApiModelProperty(value = "本期抄表读数")
private Integer issueReadingNumber;
//仪表倍率
@ApiModelProperty(value = "仪表倍率")
private Integer ratio;
//用量
@ApiModelProperty(value = "用量")
private Integer dosage;
//创建人
@ApiModelProperty(value = "创建人")
private String createUser;
//修改人
@ApiModelProperty(value = "修改人")
private String modifyUser;
//删除标志(0 未删除 1 已删除)
@ApiModelProperty(value = "删除标志(0 未删除 1 已删除)")
private Integer delFlag;
//租户id
@ApiModelProperty(value = "租户id")
private String tenantId;
}
| [
"[email protected]"
]
| |
915049524449b9f0baedcefaa72de2a2d7459a86 | b2c99a12ac3a14f96af0dbb91225f7b10e119634 | /src/main/java/storage/JdbcStorage.java | 60e8794e3e25756f89bcc9dc72b72ec8101b51f1 | []
| no_license | 1nt3g3r/java10_jdbc | 9a7eeef753c45bf6becfaf6d09f48bfe94543973 | 25f04429e23ad6ebad9117f8ac49870e2c5b0903 | refs/heads/master | 2020-03-07T06:39:52.477111 | 2018-04-10T17:29:34 | 2018-04-10T17:29:34 | 127,328,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,723 | java | package storage;
import entity.Cat;
import entity.Owner;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class JdbcStorage {
private static final String[] CAT_NAMES = {
"Ліза",
"Лизун",
"Барсик",
"Байт",
"Кицьондра",
"Платон",
"Кузя",
"Барсик",
"Нюра",
"Ксюша",
"Том",
"Інга",
"Мурчик"
};
private String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
private String SERVER_PATH = "localhost";
private String DB_NAME = "my_first_db";
private String DB_LOGIN = "root";
private String DB_PASSWORD = "integer231992";
private Connection connection;
private Statement st;
private PreparedStatement createCatSt;
private PreparedStatement updateCatSt;
private PreparedStatement searchCatSt;
private PreparedStatement selectCatsByOwnerId;
private PreparedStatement createOwnerSt;
private PreparedStatement selectOwnerSt;
public JdbcStorage() {
initDbDriver();
initConnection();
initPreparedStatements();
}
private void initDbDriver() {
try {
Class.forName(DB_DRIVER);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
private void initConnection() {
String connectionUrl = "jdbc:mysql://" + SERVER_PATH + "/" + DB_NAME;
connectionUrl += "?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
try {
connection = DriverManager.getConnection(connectionUrl, DB_LOGIN, DB_PASSWORD);
st = connection.createStatement();
} catch (SQLException e) {
e.printStackTrace();
}
}
private void initPreparedStatements() {
try {
createCatSt =
connection.prepareStatement("INSERT INTO Cat (cat_name, weight, sex) VALUES(?, ?, ?)");
updateCatSt =
connection.prepareStatement("UPDATE Cat SET cat_name=?, weight=?, sex=?, owner_id=? WHERE id=?");
searchCatSt =
connection.prepareStatement("SELECT id, cat_name, weight, sex, owner_id FROM Cat WHERE" +
" cat_name like ?");
createOwnerSt = connection.prepareStatement("INSERT INTO Owner(FIRST_NAME, LAST_NAME) VALUES(?, ?)");
selectOwnerSt = connection.prepareStatement("SELECT first_name, last_name from Owner where id=?");
selectCatsByOwnerId = connection.prepareStatement("SELECT id, cat_name, weight, sex from Cat where owner_id=?");
} catch (Exception e) {
e.printStackTrace();
}
}
public Cat getCatById(long catId) {
String selectSql =
"SELECT id, cat_name, weight, sex, owner_id " +
"FROM Cat " +
"WHERE id=" + catId;
ResultSet rs = null;
try {
rs = st.executeQuery(selectSql);
if (rs.first()) {
Cat cat = new Cat();
cat.setId(rs.getLong("id"));
cat.setCatName(rs.getString("cat_name"));
cat.setWeight(rs.getFloat("weight"));
cat.setSex(rs.getBoolean("sex"));
cat.setOwnerId(rs.getLong("owner_id"));
return cat;
} else {
return null;
}
} catch (SQLException e) {
e.printStackTrace();
return null;
} finally {
closeResultSet(rs);
}
}
public void createCasts(List<Cat> cats) throws SQLException {
connection.setAutoCommit(false);
for (Cat cat : cats) {
createCatSt.setString(1, cat.getCatName());
createCatSt.setFloat(2, cat.getWeight());
createCatSt.setBoolean(3, cat.getSex());
createCatSt.addBatch();
}
createCatSt.executeBatch();
connection.setAutoCommit(true);
}
public void createOwner(Owner owner) {
try {
createOwnerSt.setString(1, owner.getFirstName());
createOwnerSt.setString(2, owner.getLastName());
createOwnerSt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
}
public Owner getOwnerById(long id) {
ResultSet rs = null;
try {
selectOwnerSt.setLong(1, id);
rs = selectOwnerSt.executeQuery();
if (rs.first()) {
Owner owner = new Owner();
owner.setId(id);
owner.setFirstName(rs.getString("first_name"));
owner.setLastName(rs.getString("last_name"));
return owner;
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
closeResultSet(rs);
}
return null;
}
public void createCat(Cat cat) {
try {
createCatSt.setString(1, cat.getCatName());
createCatSt.setFloat(2, cat.getWeight());
createCatSt.setBoolean(3, cat.getSex());
createCatSt.executeUpdate();
cat.setId(getLastCatId());
} catch (Exception e) {
e.printStackTrace();
}
}
public void updateCats(List<Cat> cats) throws SQLException {
connection.setAutoCommit(false);
for(Cat cat: cats) {
updateCatSt.setString(1, cat.getCatName());
updateCatSt.setFloat(2, cat.getWeight());
updateCatSt.setBoolean(3, cat.getSex());
updateCatSt.setLong(4, cat.getOwnerId());
updateCatSt.setLong(5, cat.getId());
updateCatSt.addBatch();
}
updateCatSt.executeBatch();
connection.setAutoCommit(true);
}
public void updateCat(Cat cat) {
try {
updateCatSt.setString(1, cat.getCatName());
updateCatSt.setFloat(2, cat.getWeight());
updateCatSt.setBoolean(3, cat.getSex());
updateCatSt.setLong(4, cat.getOwnerId());
updateCatSt.setLong(5, cat.getId());
updateCatSt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
}
public void deleteCatById(long id) {
String sql = "DELETE FROM Cat WHERE id=" + id;
try {
st.executeUpdate(sql);
} catch (Exception e) {
e.printStackTrace();
}
}
private long getLastCatId() {
String sql = "select id from cat order by id desc limit 1";
ResultSet rs = null;
try {
rs = st.executeQuery(sql);
if (rs.first()) {
return rs.getLong("id");
} else {
return -1;
}
} catch (Exception e) {
e.printStackTrace();
return -1;
} finally {
closeResultSet(rs);
}
}
private void closeResultSet(ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public void clear() {
String sql = "DELETE FROM Cat";
try {
st.executeUpdate(sql);
} catch (Exception e) {
e.printStackTrace();
}
}
public List<Cat> getAllCatsForOwner(Owner owner) {
List<Cat> result = new ArrayList<Cat>();
ResultSet rs = null;
try {
selectCatsByOwnerId.setLong(1, owner.getId());
rs = selectCatsByOwnerId.executeQuery();
while(rs.next()) {
Cat cat = new Cat();
cat.setId(rs.getLong("id"));
cat.setCatName(rs.getString("cat_name"));
cat.setWeight(rs.getFloat("weight"));
cat.setSex(rs.getBoolean("sex"));
cat.setOwnerId(owner.getId());
result.add(cat);
}
} catch (SQLException e) {
e.printStackTrace();
}
return result;
}
public List<Cat> getAllCats() {
List<Cat> result = new ArrayList<Cat>();
String sql = "SELECT id, cat_name, weight, sex, owner_id FROM Cat";
ResultSet rs = null;
try {
rs = st.executeQuery(sql);
while(rs.next()) {
Cat cat = new Cat();
cat.setId(rs.getLong("id"));
cat.setCatName(rs.getString("cat_name"));
cat.setWeight(rs.getFloat("weight"));
cat.setSex(rs.getBoolean("sex"));
cat.setOwnerId(rs.getLong("owner_id"));
result.add(cat);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
closeResultSet(rs);
}
return result;
}
public List<Cat> search(String part) {
List<Cat> result = new ArrayList<Cat>();
ResultSet rs = null;
try {
searchCatSt.setString(1, "%" + part + "%");
rs = searchCatSt.executeQuery();
while(rs.next()) {
Cat cat = new Cat();
cat.setId(rs.getLong("id"));
cat.setCatName(rs.getString("cat_name"));
cat.setWeight(rs.getFloat("weight"));
cat.setSex(rs.getBoolean("sex"));
cat.setOwnerId(rs.getLong("owner_id"));
result.add(cat);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
closeResultSet(rs);
}
return result;
}
private Cat randomCat() {
Random r = new Random();
String catName = CAT_NAMES[r.nextInt(CAT_NAMES.length)];
Cat cat = new Cat();
cat.setCatName(catName);
cat.setWeight(r.nextFloat());
cat.setSex(r.nextBoolean());
return cat;
}
public void setOwnerForCat(Cat cat, Owner owner) {
cat.setOwnerId(owner.getId());
updateCat(cat);
}
public void deleteOwner(Owner owner) {
String deleteSql = "delete from Owner where owner.id=" + owner.getId();
try {
st.executeUpdate(deleteSql);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws SQLException {
JdbcStorage storage = new JdbcStorage();
storage.deleteOwner(storage.getOwnerById(4));
}
}
| [
"[email protected]"
]
| |
103b7f3daa92e65f05c33f7d8887cfca770f174d | c4b6ebfe822f2263ea7e864d9d3c61b4beca90dc | /src/main/java/be/chaixdev/streamarksbackend/model/Type.java | 55ba2ede622c6d47db6b020eb37b5f9ac8352561 | []
| no_license | chaixdev/streamarks-backend | 48e196865d715fb032adfce7ced8670585ee9628 | d7ca5b04b390401a290c567bebca494818608e39 | refs/heads/master | 2022-11-27T21:56:19.688690 | 2020-08-06T14:21:00 | 2020-08-06T14:21:00 | 278,242,515 | 0 | 0 | null | 2020-07-09T02:34:07 | 2020-07-09T02:27:40 | null | UTF-8 | Java | false | false | 86 | java | package be.chaixdev.streamarksbackend.model;
public enum Type {
YOUTUBE, TIMER
}
| [
"[email protected]"
]
| |
e611dc92f1845f187db956e83ce8ffcfeb87ba64 | dba72dcd74e2e04b256dde1c3326ffdb3881bc9b | /week-01/day-4/src/SecondsInADay.java | e708613aa536fab113fbee0d96abc819ecff6c17 | []
| no_license | green-fox-academy/rdgrv | dc0c6681359706c78acd5776799af54e316c1de5 | 22a24b7f8c0fcd91859600d7d1d75ec32d288cd2 | refs/heads/master | 2021-07-11T05:07:00.242402 | 2019-01-24T09:30:20 | 2019-01-24T09:30:20 | 143,150,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | public class SecondsInADay {
public static void main(String[] args) {
int currentHours = 14;
int currentMinutes = 34;
int currentSeconds = 42;
int currentTime = currentHours * 60 * 60 + currentMinutes * 60 + currentSeconds;
int secondsinaDay = 24 * 60 * 60;
System.out.println(secondsinaDay - currentTime);
}
}
| [
"[email protected]"
]
| |
b33a0d80ce87c9d59ffb4115f3d513b0caccc89b | 289eeacf513cd590fe7c90cf79ca7f34881931fc | /app/src/androidTest/java/com/example/marco/contacts_isi/ExampleInstrumentedTest.java | dc679c842e7a5a0173633680924234ebc7e262e7 | []
| no_license | marcovoliveira/Android_Contacts | 0f52109f5c74b25cd9a17f9a244a0e0a421961a8 | 1f850978c0587faee4fbc210215dec8e2a679f8c | refs/heads/master | 2021-08-28T12:35:56.127112 | 2017-12-12T08:56:27 | 2017-12-12T08:56:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package com.example.marco.contacts_isi;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.marco.contacts_isi", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
6559b383905127e5df91f24433e6d29a632ff3ee | 75d5f2955b7cc38dbed300a9c77ef1cdc77df0fe | /ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/parsers/DeleteTapeDriveSpectraS3ResponseParser.java | 9591d6baae55d884e540aba137e22b6f0f15ba8d | [
"Apache-2.0"
]
| permissive | shabtaisharon/ds3_java_sdk | 00b4cc960daf2007c567be04dd07843c814a475f | f97d10d0e644f20a7a40c5e51101bab3e4bd6c8f | refs/heads/master | 2021-01-18T00:44:19.369801 | 2018-09-18T18:17:23 | 2018-09-18T18:17:23 | 43,845,561 | 0 | 0 | null | 2015-10-07T21:25:06 | 2015-10-07T21:25:06 | null | UTF-8 | Java | false | false | 2,123 | java | /*
* ******************************************************************************
* Copyright 2014-2017 Spectra Logic Corporation. 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.
* ****************************************************************************
*/
// This code is auto-generated, do not modify
package com.spectralogic.ds3client.commands.parsers;
import com.spectralogic.ds3client.commands.parsers.interfaces.AbstractResponseParser;
import com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils;
import com.spectralogic.ds3client.commands.spectrads3.DeleteTapeDriveSpectraS3Response;
import com.spectralogic.ds3client.networking.WebResponse;
import java.io.IOException;
public class DeleteTapeDriveSpectraS3ResponseParser extends AbstractResponseParser<DeleteTapeDriveSpectraS3Response> {
private final int[] expectedStatusCodes = new int[]{204};
@Override
public DeleteTapeDriveSpectraS3Response parseXmlResponse(final WebResponse response) throws IOException {
final int statusCode = response.getStatusCode();
if (ResponseParserUtils.validateStatusCode(statusCode, expectedStatusCodes)) {
switch (statusCode) {
case 204:
//There is no payload, return an empty response handler
return new DeleteTapeDriveSpectraS3Response(this.getChecksum(), this.getChecksumType());
default:
assert false: "validateStatusCode should have made it impossible to reach this line";
}
}
throw ResponseParserUtils.createFailedRequest(response, expectedStatusCodes);
}
} | [
"[email protected]"
]
| |
8520d979deeb1a530c4f9feecb74a1962ea85404 | 6d7982a75dd44fa6cea93e686d493c335ef28926 | /Programs/basics/src/Pearl1/Grapes.java | 9ef99a05cc19dee5dbfa22ae9f50b04439fe9159 | []
| no_license | lucky7886/Code9 | f27f7f645625bf5623ef84f4bc9861fefd206b5c | 2b964980d1c56b1e9ed9dedc23b9e0950b914336 | refs/heads/master | 2021-10-22T00:24:05.426640 | 2019-03-07T09:07:55 | 2019-03-07T09:07:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 141 | java | package Pearl1;
public class Grapes extends Fruits {
int a;
public void eat()
{
System.out.println("Grapes are good!!");
}
}
| [
"[email protected]"
]
| |
6f24ececf355371220d324cb5c350c7bb4376c50 | 7f7243e105024cfcc26d0fa5b3438edfcecf15a1 | /src/main/java/com/wangzai/accounting/dao/mapper/UserInfoMapper.java | eab3d3e6c8e00e77939f811930c626160a5ea644 | [
"MIT"
]
| permissive | LeoDrliu/MilkAccountingService | 7ca2c90a7093c5ff2b20e25536ebb9cb1de8e8b0 | 9012e1fafb94b159fb0fe3446934c4a94f1c722f | refs/heads/main | 2023-08-14T07:57:32.294046 | 2021-10-03T02:21:24 | 2021-10-03T02:26:06 | 389,674,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package com.wangzai.accounting.dao.mapper;
import com.wangzai.accounting.model.DO.UserInfoDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface UserInfoMapper {
@Select("SELECT id, username, password, create_time, update_time FROM milk_userinfo WHERE id = #{id}")
UserInfoDO getUserInfoByUserId(@Param("id") Long id);
}
| [
"[email protected]"
]
| |
ca2192408277db988021b3e3c898e94f0c46c3e6 | c57ac70e0446b90dbb666feef6e78ef7342dbc8d | /app/src/main/java/com/vikoo/calendar/screens/agendaview/viewholder/HeaderViewHolder.java | 914013670a6e23e26a28d3ceffad24f5bd4268fd | []
| no_license | vikoo/MyCalender | e02e3729e63b3a2f58013ca04d77905398e1137a | e5fc60b80de5256ce403f5b2704b729673b33eb8 | refs/heads/master | 2021-06-30T22:44:49.735117 | 2017-09-23T09:34:02 | 2017-09-23T09:34:02 | 103,848,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package com.vikoo.calendar.screens.agendaview.viewholder;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.vikoo.calendar.R;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by vikoo on 17/09/17.
*/
public class HeaderViewHolder extends RecyclerView.ViewHolder{
@BindView(R.id.group_date)
public TextView mTvDate;
@BindView(R.id.header_layout)
public LinearLayout mHeaderLayout;
public HeaderViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
mTvDate = itemView.findViewById(R.id.group_date);
}
}
| [
"[email protected]"
]
| |
42ce406c7b589413f56e30a46ac16b338c02abe1 | c5a9fc34456de3a56dbf5eaa9cf14c04945b6b19 | /20151104691_liutingxu/20151104691_liutingxu_Auction/src/com/imnu/model/AuWallet.java | a93911d09075a2088659c3eec764b13ea205adfb | []
| no_license | ciec20151104703/NetWork_Graduation2015_Real | cad2a00bdd1b690e6f71668cdd58ea1dcd8b1092 | d93a21ed56f677ba9553629e72c5f0e846ee60cb | refs/heads/master | 2022-01-09T08:15:19.508907 | 2019-05-04T14:40:38 | 2019-05-04T14:40:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,233 | java | package com.imnu.model;
import java.math.BigDecimal;
public class AuWallet {
private String waId;
private String userId;
private BigDecimal waBalance;
private String userName;
private Integer curPage;
private String wrMoney;
public String getWrMoney() {
return wrMoney;
}
public void setWrMoney(String wrMoney) {
this.wrMoney = wrMoney;
}
public Integer getCurPage() {
return curPage;
}
public void setCurPage(Integer curPage) {
this.curPage = curPage;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getWaId() {
return waId;
}
public void setWaId(String waId) {
this.waId = waId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
public BigDecimal getWaBalance() {
return waBalance;
}
public void setWaBalance(BigDecimal waBalance) {
this.waBalance = waBalance;
}
public void setWrMoney(BigDecimal bigDecimal) {
// TODO Auto-generated method stub
}
} | [
"[email protected]"
]
| |
1feceeb38cb01012040d1cd5f6cfe9a271d26c68 | b1b88fe543bf272d2fc5c51b43298fb7cfca7c60 | /src/com/day6assign/perfectnum/PerfectNum.java | ed36138e4c47208d72c1086a3c127cd9a07ab8ce | []
| no_license | P-RASHMI/Logical-programs-day6 | 0c1a218702862c313fdba6d580b9ff053f3c8cc1 | 69df3f15f45c43c139bd7e43306b06297011a0ac | refs/heads/master | 2023-06-26T22:45:43.863566 | 2021-07-31T21:06:50 | 2021-07-31T21:06:50 | 391,335,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | package com.day6assign.perfectnum;
import java.util.Scanner;
public class PerfectNum {
public static void main(String[] args) {
int n,sum=0;
Scanner sc=new Scanner(System.in);
System.out.println("Enter a number :");
n=sc.nextInt();
int i=1;
while(i<=n/2)
{
if(n%i==0)
{
sum+=i;
}
i++;
}
if(sum==n)
{
System.out.println(n +" is a perfect number");
}
else
System.out.println(n +" is not a perfect number");
sc.close();
}
}
| [
"[email protected]"
]
| |
3228bde4af2239a4747dac0fbf2955aa34f6c3d6 | 0ebf12825c3bafb75f903807f84fea7f0c7c2cb3 | /src/ch/hsr/girlpower/schatzkarte/MyItemizedOverlay.java | c9e8a15cca9882cf6c309c04959eb3bd39afebad | []
| no_license | 1607vroni/Schatzkarte | 7360b5750e2b41a77fde5727b0e6c888be496e18 | fde7648f873c44978ee02c67a6d7d6470782319f | refs/heads/master | 2016-09-05T11:43:10.925596 | 2013-12-12T20:48:10 | 2013-12-12T20:48:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,708 | java | package ch.hsr.girlpower.schatzkarte;
import java.util.ArrayList;
import org.osmdroid.ResourceProxy;
import org.osmdroid.api.IMapView;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.overlay.ItemizedOverlay;
import org.osmdroid.views.overlay.OverlayItem;
import ch.hsr.girlpower.schatzkarte.RemoveItemCallback;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
public class MyItemizedOverlay extends ItemizedOverlay<OverlayItem> implements Parcelable {
private ArrayList<OverlayItem> overlayItemList = new ArrayList<OverlayItem>();
private RemoveItemCallback callback;
private ResourceProxy resourceProxy;
private Drawable marker;
private RemoveItemCallback removeItemCallback;
public MyItemizedOverlay(Drawable pDefaultMarker,
ResourceProxy pResourceProxy) {
super(pDefaultMarker, pResourceProxy);
}
public MyItemizedOverlay(Drawable pDefaultMarker,
ResourceProxy pResourceProxy,RemoveItemCallback callback) {
super(pDefaultMarker, pResourceProxy);
this.callback=callback;
this.setMarker(pDefaultMarker);
//this.setResourceProxy(pResourceProxy);
this.setRemoveItemCallback(callback);
}
@Override
protected boolean onTap(int index) {
super.onTap(index);
callback.removed(index);
return true;
}
public void addItem(GeoPoint p, String title, String snippet){
OverlayItem newItem = new OverlayItem(title, snippet, p);
overlayItemList.add(newItem);
populate();
}
public void remove(int index){
overlayItemList.remove(index);
}
public void setHomeLocation(GeoPoint p, String title, String snippet){
if(overlayItemList.size() > 0){
overlayItemList.remove(0);
OverlayItem ovlitm = new OverlayItem(title, snippet, p);
overlayItemList.add(0, ovlitm);
}
else{
this.addItem(p, title, snippet);
}
}
@Override
public boolean onSnapToItem(int arg0, int arg1, Point arg2, IMapView arg3) {
return false;
}
@Override
protected OverlayItem createItem(int arg0) {
return overlayItemList.get(arg0);
}
@Override
public int size() {
return overlayItemList.size();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
public ResourceProxy getResourceProxy() {
return resourceProxy;
}
public Drawable getMarker() {
return marker;
}
public void setMarker(Drawable marker) {
this.marker = marker;
}
public RemoveItemCallback getRemoveItemCallback() {
return removeItemCallback;
}
public void setRemoveItemCallback(RemoveItemCallback removeItemCallback) {
this.removeItemCallback = removeItemCallback;
}
} | [
"[email protected]"
]
| |
7194945c864c1e3bbe3eecdba067adc5073a1311 | 06e902e769d7bb0739c734bee1109c3b5a75ec45 | /foodie-dev-mapper/src/main/java/com/imooc/mapper/ItemsMapperCustom.java | 32db476ce8660ee5991c5b0e91bcfa9b845f4610 | []
| no_license | L1021204735/foodie-dev | 6cc0ea4fe77f5216f49037c24ed921f88ea97997 | 55d2b1cd792d2ebeb31dd5ab437c1397cdd815c9 | refs/heads/master | 2022-12-23T06:12:49.448256 | 2020-10-07T06:45:38 | 2020-10-07T06:45:38 | 301,946,554 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 799 | java | package com.imooc.mapper;
import com.imooc.pojo.vo.ItemCommentVO;
import com.imooc.pojo.vo.SearchItemsVO;
import com.imooc.pojo.vo.ShopcartVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface ItemsMapperCustom {
public List<ItemCommentVO> queryItemComments(@Param("paramsMap") Map<String, Object> map);
public List<SearchItemsVO> searchItems(@Param("paramsMap") Map<String, Object> map);
public List<SearchItemsVO> searchItemsByThirdCat(@Param("paramsMap") Map<String, Object> map);
public List<ShopcartVO> queryItemsBySpecIds(@Param("paramsList") List specIdsList);
public int decreaseItemSpecStock(@Param("specId") String specId,
@Param("pendingCounts") int pendingCounts);
} | [
"[email protected]"
]
| |
2093b9533587c9a5c8b17525047c14d04d8cb27b | fd6e4fffa71475c0a91c394f6373d8e3abc50e77 | /src/BoZ/IState.java | df8f955d65eb662640ba9cc54e4c5da71d2738ac | []
| no_license | thieuhuyenuit88/DemoOpenGLJavaV2 | 03d8521d300f96b7e82360a931f6221b28b66e48 | 0df59e6ea2c5ce0892bdb5b5e9f86817c16f91c7 | refs/heads/master | 2021-01-17T08:14:37.817534 | 2017-03-04T05:55:33 | 2017-03-04T05:55:33 | 83,869,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package BoZ;
import java.awt.event.KeyEvent;
import javax.media.opengl.GL;
import javax.media.opengl.glu.GLU;
public class IState {
public IPlay m_Play;
public int m_IDState;
public IState (IPlay _Play){
m_Play=_Play;
}
public void Init (){
}
public void Update (){
}
public void Display (GLU glu,GL gl){
}
public void Destroy (){
}
public void keyPressed(KeyEvent arg0) {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
]
| |
250e623c188ea05b516d89c38b87597405e58dbb | 769fbc9dfad06375b34bfcfdfd9c62d7782322b3 | /src/BasicCalculatorII.java | b27d7d043bebcb108f4641f8f4e808a8f739759b | []
| no_license | rutygithub/MyJavaCode | 634cd4bba3cc92406d3f077341ba30440335a0ba | 3b7d15ab8ca491abd1343b6946e1be02de079a34 | refs/heads/master | 2023-06-07T21:07:46.862533 | 2023-05-26T07:54:39 | 2023-05-26T07:54:39 | 241,004,791 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,238 | java | import java.util.Stack;
public class BasicCalculatorII {
public int calculate(String s) {
//https://leetcode.com/problems/basic-calculator-ii/discuss/63003/Share-my-java-solution
int len;
if (s == null || (len = s.length()) == 0) return 0;
//edge case
Stack<Integer> stack = new Stack<>();
int num = 0;
char lastSign = '+';
for (int i = 0; i < len; i++) {
if (Character.isDigit(s.charAt(i))) {
num = num * 10 + s.charAt(i) - '0';
}
if ((!Character.isDigit(s.charAt(i)) && ' ' != s.charAt(i)) || i == len - 1) {
if (lastSign == '-') {
stack.push(-num);
}
if (lastSign == '+') {
stack.push(num);
}
if (lastSign == '*') {
stack.push(stack.pop() * num);
}
if (lastSign == '/') {
stack.push(stack.pop() / num);
}
lastSign = s.charAt(i);
num = 0;
}
}
int res = 0;
for (int i : stack) {
res += i;
}
return res;
}
}
| [
"[email protected]"
]
| |
414f17113a99a67126e301a7e728ef6e1834fcca | 155e2a91a5b6aa383d12304ba57c6e6f3f8a05ca | /src/main/java/com/mini10/miniserver/mapper/TagMapper.java | fe30426311251e4e5360c803b9d11433bc19ba89 | []
| no_license | dxysun/mini-server | 564a16a388f1a9878909bf84dbe06f4bd43263b3 | 32e23a1aa85d03ee8cf39648806bb1b399b74d09 | refs/heads/master | 2020-07-21T21:48:57.521640 | 2019-09-08T06:20:27 | 2019-09-08T06:20:27 | 206,981,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package com.mini10.miniserver.mapper;
import com.mini10.miniserver.model.Tag;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
@Component
public interface TagMapper extends Mapper<Tag> {
List<Tag> queryTagByTagType(@Param("tagType") Integer tagType);
String queryTagNameById(Integer id);
Integer queryTagClassifyById(Integer id);
List<Tag> queryTagByIds(@Param("list") List<Integer> ids);
void bathAddTags(List<Tag> tagList);
} | [
"[email protected]"
]
| |
00493e1f9c25df86a33603f4c77fffd335a44c6a | 4ed52e55d6b1a2425116a783291eb3afe0d44ac5 | /unicorn-multi-test/src/main/java/com/unicorn/unicornmultitest/xml/definition/Parameter.java | cd127054c140d7a0fd118855925d5934dbbb7dd1 | []
| no_license | lzdong0714/BootDemo | fccc69d12587411ab90604c34ff82791f396f8a7 | c0ff6c892e87f5c7dfd5b08f2f21d9d07206561b | refs/heads/master | 2020-12-05T09:23:45.241151 | 2020-09-22T02:48:57 | 2020-09-22T02:48:57 | 232,068,390 | 0 | 0 | null | 2020-05-31T10:36:44 | 2020-01-06T09:36:02 | Java | UTF-8 | Java | false | false | 285 | java | package com.unicorn.unicornmultitest.xml.definition;
import lombok.Data;
/**
* @Author: Liu Zhendong
* @Description
* @createTime 2020年07月16日 14:35:00
*/
@Data
public class Parameter {
private String name;
private DataType type;
private String defaultValue;
}
| [
"[email protected]"
]
| |
3a323e1e1f5575a6bbdef64876e82fc92713b11d | bfbd5c05a39673f983fa4fc26970861776f0fe99 | /verbo-system/verbo-api/src/main/java/br/com/unisul/verbo/service/impl/BaseServiceImpl.java | 1be6d43622c37fa1e183a69c8554325d1d71b2de | []
| no_license | victorhugoof/bitbucket | e735d9d2776f53e2c6c382c77e3cce57966ad80b | 5bf9cc167e9db7dd9c1a7f7f80eb7c4c6d0a3a0e | refs/heads/master | 2022-07-05T14:34:42.358282 | 2020-05-19T16:53:02 | 2020-05-19T16:53:02 | 260,617,163 | 0 | 0 | null | 2020-05-19T16:54:06 | 2020-05-02T05:00:12 | TSQL | UTF-8 | Java | false | false | 2,883 | java | package br.com.unisul.verbo.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import br.com.unisul.verbo.domain.BaseEntidadeImpl;
import br.com.unisul.verbo.exception.BusinessException;
import br.com.unisul.verbo.exception.NotImplementedException;
import br.com.unisul.verbo.helper.Utils;
import br.com.unisul.verbo.model.BaseModelImpl;
import br.com.unisul.verbo.repository.BaseRepository;
import br.com.unisul.verbo.service.BaseService;
@Transactional
@Service
public abstract class BaseServiceImpl<T extends BaseEntidadeImpl<T, M>, M extends BaseModelImpl<T, M>>
implements BaseService<T, M> {
@Autowired
private BaseRepository<T, M, Long> repository;
@Autowired
SimpMessagingTemplate messageingTemplate;
@Override
public Boolean excluir(Long id) {
var object = this.findByIdOptional(id);
if (!object.isPresent()) {
return false;
}
if (object.get() instanceof BaseEntidadeImpl) {
object.get().excluir();
repository.save(object.get());
return true;
}
return false;
}
@Override
public T findById(Long id) {
var object = findByIdOptional(id);
if (!object.isPresent()) {
throw new BusinessException(Utils.getClassType(getClass(), 1));
}
return object.get();
}
@Override
public T findByModel(M model) {
var object = findByModelOptional(model);
if (!object.isPresent()) {
throw new BusinessException(Utils.getClassType(getClass(), 1));
}
return object.get();
}
@Override
public Optional<T> findByIdOptional(Long id) {
return repository.findById(id);
}
@Override
public T salvar(M model) {
return repository.save(getT().gerarDomain(model));
}
@Override
public T atualizar(M model) {
if (Objects.isNull(model.getId())) {
throw new BusinessException(Utils.getClassType(getClass(), 1));
}
var object = this.findById(model.getId());
object.atualizar(model);
return repository.save(object);
}
@Override
public Page<M> filter(M model, Pageable pageable) {
throw new NotImplementedException();
}
@Override
public List<M> findAll() {
var lista = new ArrayList<M>();
repository.findAll().forEach(obj -> lista.add(getM().gerarModel(obj)));
messageingTemplate.convertAndSend("/topic/greetings","Estados ok!");
return lista;
}
@SuppressWarnings("unchecked")
private T getT() {
return (T) Utils.getObjetoFromClassType(getClass(), 0);
}
@SuppressWarnings("unchecked")
private M getM() {
return (M) Utils.getObjetoFromClassType(getClass(), 1);
}
}
| [
"[email protected]"
]
| |
5266589392dbda23fdd48191215e88b88c590ce9 | a31a66801301aaf35578c5ef415db612e08e586f | /StringManipulation/src/com/jn/edu/SearchString.java | bfe29bea0dc4d7ef45edbcf0111804764db81856 | []
| no_license | JohnN4/MyEclipse | 306e29dd0182e1eafa7cf5315a2d3f7fbb07b506 | aa8cf30ded12a342fa50adab9381f30130ffb0b1 | refs/heads/master | 2020-05-07T21:53:45.802001 | 2019-06-11T23:04:45 | 2019-06-11T23:04:45 | 180,921,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 913 | java | /**
*
*/
package com.jn.edu;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashSet;
import java.util.Scanner;
/**
* @author JohnN
*
*/
public class SearchString {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashSet<String> textFile = new HashSet<String>();
try (BufferedReader br = new BufferedReader(
new FileReader("C:\\Users\\JohnN\\Desktop\\Eclipse Work\\Draw.io\\word_list.txt"))) {
String currentLine;
while ((currentLine = br.readLine()) != null) {
textFile.add(currentLine);
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Enter Word to Search ");
String input = sc.next();
if (textFile.contains(input)) {
System.out.println("Text File Contains " + input);
} else {
System.out.println("Text File does not Contains " + input);
}
}
}
| [
"[email protected]"
]
| |
f591d9c961d3e18caf626e70ec7a73a2878daf3e | a1f88b35222838a52e0b665d0a29c21a0be070c4 | /src/main/tonivade/db/command/set/SetIntersectionCommand.java | 2929d725fbad2bb93e4772aa5c8cf9e273eed935 | [
"MIT"
]
| permissive | yourcaptain/tinydb | 2c053e6ede6f6e8c950016ae3c8aa2042a977ccf | b7fda73b668380eaaa38136af2f9c11d06538a8a | refs/heads/master | 2021-01-10T18:52:33.957124 | 2016-07-15T08:45:37 | 2016-07-15T08:45:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,518 | java | /*
* Copyright (c) 2015, Antonio Gabriel Muñoz Conejo <antoniogmc at gmail dot com>
* Distributed under the terms of the MIT License
*/
package tonivade.db.command.set;
import static java.util.stream.Collectors.toList;
import static tonivade.db.data.DatabaseKey.safeKey;
import java.util.HashSet;
import java.util.Set;
import tonivade.db.command.ITinyDBCommand;
import tonivade.db.command.annotation.ParamType;
import tonivade.db.command.annotation.ReadOnly;
import tonivade.db.data.DataType;
import tonivade.db.data.DatabaseKey;
import tonivade.db.data.DatabaseValue;
import tonivade.db.data.IDatabase;
import tonivade.redis.annotation.Command;
import tonivade.redis.annotation.ParamLength;
import tonivade.redis.command.IRequest;
import tonivade.redis.command.IResponse;
import tonivade.redis.protocol.SafeString;
@ReadOnly
@Command("sinter")
@ParamLength(2)
@ParamType(DataType.SET)
public class SetIntersectionCommand implements ITinyDBCommand {
@Override
public void execute(IDatabase db, IRequest request, IResponse response) {
DatabaseValue first = db.getOrDefault(safeKey(request.getParam(0)), DatabaseValue.EMPTY_SET);
Set<SafeString> result = new HashSet<>(first.<Set<SafeString>>getValue());
for (DatabaseKey param : request.getParams().stream().skip(1).map((item) -> safeKey(item)).collect(toList())) {
result.retainAll(db.getOrDefault(param, DatabaseValue.EMPTY_SET).<Set<SafeString>>getValue());
}
response.addArray(result);
}
}
| [
"[email protected]"
]
| |
baba9de8b6157863786804b9a61a96d37bcbc917 | 84125a032c2b2e150f62616c15f0089016aca05d | /src/com/leet/algo/Prob839.java | ded67d078447a553a246f639db0ff984c2e64653 | []
| no_license | achowdhury80/leetcode | c577acc1bc8bce3da0c99e12d6d447c74fbed5c3 | 5ec97794cc5617cd7f35bafb058ada502ee7d802 | refs/heads/master | 2023-02-06T01:08:49.888440 | 2023-01-22T03:23:37 | 2023-01-22T03:23:37 | 115,574,715 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java | package com.leet.algo;
import java.util.*;
public class Prob839 {
/**
* instead of going through all combinations of swaping chars use list of string provided
* @param A
* @return
*/
public int numSimilarGroups(String[] A) {
if (A.length == 1) return 1;
Map<String, Boolean> visited = new HashMap<>();
for (String a : A) visited.put(a, false);
int result = 0;
for (String a : A) {
if (visited.get(a)) continue;
result++;
Queue<String> q = new LinkedList<>();
q.offer(a);
visited.put(a, true);
while(!q.isEmpty()) {
String b = q.poll();
for (String key : visited.keySet()) {
if (!visited.get(key) && isSimilar(b, key)) {
q.offer(key);
visited.put(key, true);
}
}
}
}
return result;
}
private boolean isSimilar(String str1, String str2) {
int count=0;
for(int i=0; i<str1.length(); i++) {
if(str1.charAt(i) != str2.charAt(i)) {
count++;
}
if(count > 2) return false;
}
return true;
}
}
| [
"[email protected]"
]
| |
9baf12ebbf873ce41471c33ee2a688677649e19c | dce70b4a5c4ef11f06f77bcca31e6ff3946073de | /app/src/main/java/nl/dtt/rsr_pechhulp/view/maps/MapsActivity.java | 2e5e7de7aaf07ea8344a5a9b64024e7116dace45 | []
| no_license | davele-itsme/DTT-project | c9d92a015b9d3fdd2ca4ea1722c12f7a156470a2 | d92ed85b6d52a2d45f81c3e9beb83aaccb10804c | refs/heads/master | 2021-07-23T19:38:05.365533 | 2021-05-05T19:24:51 | 2021-05-05T19:24:51 | 249,077,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,005 | java | package nl.dtt.rsr_pechhulp.view.maps;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.databinding.DataBindingUtil;
import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationManager;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.tasks.Task;
import java.util.Objects;
import nl.dtt.rsr_pechhulp.R;
import nl.dtt.rsr_pechhulp.databinding.ActivityMapsBinding;
import nl.dtt.rsr_pechhulp.presenter.maps.MapsContract;
import nl.dtt.rsr_pechhulp.presenter.maps.MapsPresenter;
import nl.dtt.rsr_pechhulp.view.maps.changereceiver.LocationChangeReceiver;
import nl.dtt.rsr_pechhulp.view.maps.changereceiver.NetworkChangeReceiver;
/**
* The type Maps activity.
*/
public class MapsActivity extends AppCompatActivity implements OnMapReadyCallback, MapsContract.MapsView, GoogleMap.OnInfoWindowClickListener {
private static final int REQUEST_PHONE_CALL = 1;
private static final int REQUEST_LOCATION = 101;
private Location currentLocation;
private FusedLocationProviderClient fusedLocationProviderClient;
private Dialog contactDialog;
private ActivityMapsBinding mapsBinding;
private LocationChangeReceiver locationChangeReceiver;
private NetworkChangeReceiver networkChangeReceiver;
/**
* The Maps presenter.
*/
MapsPresenter mapsPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mapsBinding = DataBindingUtil.setContentView(this, R.layout.activity_maps);
mapsPresenter = new MapsPresenter(this);
mapsBinding.setPresenter(mapsPresenter);
fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
fetchLocation();
Toolbar toolbar = findViewById(R.id.main_toolbar);
toolbar.setTitle(R.string.rsr_pechhulp);
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
//Check whether GPS and network is enabled
isGPSEnabled();
isNetworkEnabled();
locationChangeReceiver = new LocationChangeReceiver(this);
networkChangeReceiver = new NetworkChangeReceiver(this);
}
//System checks wifi and gps state
@Override
protected void onStart() {
super.onStart();
//registering broadcast receiver dynamically
IntentFilter filterGPS = new IntentFilter(LocationManager.PROVIDERS_CHANGED_ACTION);
filterGPS.addAction(Intent.ACTION_PROVIDER_CHANGED);
this.registerReceiver(locationChangeReceiver, filterGPS);
IntentFilter filterWifi = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION);
this.registerReceiver(networkChangeReceiver, filterWifi);
}
@Override
protected void onStop() {
super.onStop();
//unregistering broadcast receivers for Wifi and GPS
this.unregisterReceiver(locationChangeReceiver);
this.unregisterReceiver(networkChangeReceiver);
}
@Override
//finish on activity when up navigation is clicked
public boolean onSupportNavigateUp() {
finish();
return true;
}
private void fetchLocation() {
//checking the permission for GPS
if (ActivityCompat.checkSelfPermission(
this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MapsActivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION);
return;
}
Task<Location> task = fusedLocationProviderClient.getLastLocation();
task.addOnSuccessListener(location -> {
if (location != null) {
currentLocation = location;
SupportMapFragment supportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.google_map);
assert supportMapFragment != null;
supportMapFragment.getMapAsync(MapsActivity.this);
}
});
}
/**
* method called when maps are ready
* getting string address using Geocoder and putting the string to custom information window {@link MapInfoWindow}
*/
@Override
public void onMapReady(GoogleMap googleMap) {
LatLng latLng = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude());
String title = getResources().getString(R.string.map_info_title);
String fullAddress = mapsPresenter.getAddress(latLng);
MarkerOptions markerOptions = new MarkerOptions().position(latLng).title(title).snippet(fullAddress);
markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.map_marker));
//set info window adapter
googleMap.setInfoWindowAdapter(new MapInfoWindow(this));
googleMap.setOnInfoWindowClickListener(this);
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 16.0f));
googleMap.addMarker(markerOptions).showInfoWindow();
}
// This function is called when user accept or decline the permission.
// Request Code is used to check which permission called this function.
// This request code is provided when user is prompt for permission.
@Override
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case REQUEST_LOCATION: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
fetchLocation();
} else {
finish();
}
return;
}
case REQUEST_PHONE_CALL: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
makePhoneCall();
}
return;
}
}
}
@Override
public void onInfoWindowClick(Marker marker) {
}
//Creating dialog and for contacting on mobile devices
@Override
public void openContactDialog() {
contactDialog = new Dialog(this);
nl.dtt.rsr_pechhulp.databinding.ContactDialogBinding contactBinding = DataBindingUtil.inflate(contactDialog.getLayoutInflater(), R.layout.contact_dialog, null, true);
contactBinding.setPresenter(mapsPresenter);
contactDialog.setContentView(contactBinding.getRoot());
//Making it unable to cancel when touching outside
contactDialog.setCanceledOnTouchOutside(false);
//Making the dialog transparent
Objects.requireNonNull(contactDialog.getWindow()).setBackgroundDrawableResource(android.R.color.transparent);
contactDialog.show();
//sets invisible prior button
assert mapsBinding.mapsLinearLayout != null;
mapsBinding.mapsLinearLayout.setVisibility(View.GONE);
setContactDialogPosition();
}
@Override
public void closeContactDialog() {
contactDialog.dismiss();
assert mapsBinding.mapsLinearLayout != null;
mapsBinding.mapsLinearLayout.setVisibility(View.VISIBLE);
}
@Override
public void makeCall() {
makePhoneCall();
}
@Override
public Activity getViewActivity()
{
return MapsActivity.this;
}
//Instantiating MainMenuDialog fragment to display dialog
@Override
public void openGPSDialog() {
GPSDialog gpsDialog = new GPSDialog(MapsActivity.this);
gpsDialog.setCancelable(false);
gpsDialog.show(getSupportFragmentManager(), "gps dialog");
}
//Instantiating NetworkDialog fragment to display dialog
@Override
public void openNetworkDialog() {
NetworkDialog networkDialog = new NetworkDialog(MapsActivity.this);
networkDialog.setCancelable(false);
networkDialog.show(getSupportFragmentManager(), "network dialog");
}
//Method to call a specific phone number for the assistance
//It checks for the permission from the user firstly
private void makePhoneCall() {
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + getResources().getString(R.string.phone_number)));
if (ActivityCompat.checkSelfPermission(MapsActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(MapsActivity.this, new String[]{Manifest.permission.CALL_PHONE}, REQUEST_PHONE_CALL);
return;
} else {
startActivity(intent);
}
}
//Checks when the maps screen is opened to check if GPS is enabled
private void isGPSEnabled() {
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
boolean enabled = Objects.requireNonNull(service)
.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!enabled) {
openGPSDialog();
}
}
/**
* Is network enabled.
* Using two approaches - using the deprecated NetworkInfo for older versions than Android Q, using NetworkCapabilities for Android Q and higher
*/
private void isNetworkEnabled() {
boolean networkEnabled = mapsPresenter.getNetworkConnection();
if (!networkEnabled) {
openNetworkDialog();
}
}
//sets the position for the dialog
private void setContactDialogPosition()
{
Window window = contactDialog.getWindow();
WindowManager.LayoutParams wlp;
if (window != null) {
wlp = window.getAttributes();
wlp.gravity = Gravity.BOTTOM;
wlp.y = 60;
window.setAttributes(wlp);
}
}
}
| [
"[email protected]"
]
| |
105ffe319a458c9ab4aa94171e5fc1bc653b7027 | aeef2494b283012ed619870c4275e7d015f4017a | /sdk/java/src/main/java/com/pulumi/gcp/dataplex/outputs/TaskNotebookInfrastructureSpecContainerImage.java | 58225d781fa60cd66e39c10c33549fc280a6a5c8 | [
"BSD-3-Clause",
"MPL-2.0",
"Apache-2.0"
]
| permissive | pulumi/pulumi-gcp | d4fd3f80c3df5290edaf33eb5eafe34e6699d0ff | 7deea0a50a4ee5ab7bd722a83eca01707e298f85 | refs/heads/master | 2023-08-31T07:12:45.921522 | 2023-08-31T06:16:27 | 2023-08-31T06:16:27 | 97,485,806 | 160 | 63 | Apache-2.0 | 2023-09-14T19:49:36 | 2017-07-17T14:28:37 | Java | UTF-8 | Java | false | false | 4,818 | java | // *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.gcp.dataplex.outputs;
import com.pulumi.core.annotations.CustomType;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;
@CustomType
public final class TaskNotebookInfrastructureSpecContainerImage {
/**
* @return Container image to use.
*
*/
private @Nullable String image;
/**
* @return A list of Java JARS to add to the classpath. Valid input includes Cloud Storage URIs to Jar binaries. For example, gs://bucket-name/my/path/to/file.jar
*
*/
private @Nullable List<String> javaJars;
/**
* @return Override to common configuration of open source components installed on the Dataproc cluster. The properties to set on daemon config files. Property keys are specified in prefix:property format, for example core:hadoop.tmp.dir. For more information, see Cluster properties.
*
*/
private @Nullable Map<String,String> properties;
/**
* @return A list of python packages to be installed. Valid formats include Cloud Storage URI to a PIP installable library. For example, gs://bucket-name/my/path/to/lib.tar.gz
*
*/
private @Nullable List<String> pythonPackages;
private TaskNotebookInfrastructureSpecContainerImage() {}
/**
* @return Container image to use.
*
*/
public Optional<String> image() {
return Optional.ofNullable(this.image);
}
/**
* @return A list of Java JARS to add to the classpath. Valid input includes Cloud Storage URIs to Jar binaries. For example, gs://bucket-name/my/path/to/file.jar
*
*/
public List<String> javaJars() {
return this.javaJars == null ? List.of() : this.javaJars;
}
/**
* @return Override to common configuration of open source components installed on the Dataproc cluster. The properties to set on daemon config files. Property keys are specified in prefix:property format, for example core:hadoop.tmp.dir. For more information, see Cluster properties.
*
*/
public Map<String,String> properties() {
return this.properties == null ? Map.of() : this.properties;
}
/**
* @return A list of python packages to be installed. Valid formats include Cloud Storage URI to a PIP installable library. For example, gs://bucket-name/my/path/to/lib.tar.gz
*
*/
public List<String> pythonPackages() {
return this.pythonPackages == null ? List.of() : this.pythonPackages;
}
public static Builder builder() {
return new Builder();
}
public static Builder builder(TaskNotebookInfrastructureSpecContainerImage defaults) {
return new Builder(defaults);
}
@CustomType.Builder
public static final class Builder {
private @Nullable String image;
private @Nullable List<String> javaJars;
private @Nullable Map<String,String> properties;
private @Nullable List<String> pythonPackages;
public Builder() {}
public Builder(TaskNotebookInfrastructureSpecContainerImage defaults) {
Objects.requireNonNull(defaults);
this.image = defaults.image;
this.javaJars = defaults.javaJars;
this.properties = defaults.properties;
this.pythonPackages = defaults.pythonPackages;
}
@CustomType.Setter
public Builder image(@Nullable String image) {
this.image = image;
return this;
}
@CustomType.Setter
public Builder javaJars(@Nullable List<String> javaJars) {
this.javaJars = javaJars;
return this;
}
public Builder javaJars(String... javaJars) {
return javaJars(List.of(javaJars));
}
@CustomType.Setter
public Builder properties(@Nullable Map<String,String> properties) {
this.properties = properties;
return this;
}
@CustomType.Setter
public Builder pythonPackages(@Nullable List<String> pythonPackages) {
this.pythonPackages = pythonPackages;
return this;
}
public Builder pythonPackages(String... pythonPackages) {
return pythonPackages(List.of(pythonPackages));
}
public TaskNotebookInfrastructureSpecContainerImage build() {
final var o = new TaskNotebookInfrastructureSpecContainerImage();
o.image = image;
o.javaJars = javaJars;
o.properties = properties;
o.pythonPackages = pythonPackages;
return o;
}
}
}
| [
"[email protected]"
]
| |
7e3033f32814ab498224b8b20e6acdcf678b3d27 | 5691ae6d001798de273db72a9fbb96e8fbe5c881 | /src/main/java/com/headfirst/designpatterns/compound/combining/decorator/Goose.java | a42e70f25f9f34e969cd14a02f582e50e25107d9 | []
| no_license | mrchaoyang/head-first-design-patterns | 9d85f645ae6541feafdabb476be8e54f3fd023b7 | 04a2d97dfc6714f202e74e9d8f1e94d01e99e8e2 | refs/heads/master | 2020-06-04T13:16:20.711934 | 2019-06-15T05:50:32 | 2019-06-15T05:50:32 | 192,037,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package com.headfirst.designpatterns.compound.combining.decorator;
public class Goose {
public void honk() {
System.out.println("Honk");
}
} | [
"[email protected]"
]
| |
b29d2f27db1ffee76cf688b8d7e81f6db6c8d561 | 9fb21757a846264d57cdfc940cc57b793e7c2020 | /spring/nov26_2018/src/main/java/homework/leg/ILegImpl.java | def701b923084cadec50b1f43884c7c33a00c0a3 | []
| no_license | SerhiiIvko/JavaCourse | 9bb64cbe133e000e8dfb0d4314c5b6510bdc8112 | 15f2df00b4420433a86dadf9e1cbadd4d7625c59 | refs/heads/master | 2022-12-23T00:29:48.087522 | 2020-07-14T14:47:37 | 2020-07-14T14:47:37 | 114,253,827 | 1 | 0 | null | 2022-12-16T00:37:55 | 2017-12-14T13:26:56 | Java | UTF-8 | Java | false | false | 508 | java | package homework.leg;
public class ILegImpl implements ILeg {
private String stepStrangeAction;
private String stepBackAction;
private String stop;
@Override
public String stepStrange() {
stepStrangeAction = "Step strange";
return stepStrangeAction;
}
@Override
public String stepBack() {
stepBackAction = "Step back";
return stepBackAction;
}
@Override
public String stop() {
stop = "Stop";
return stop;
}
} | [
"[email protected]"
]
| |
682e59da1b8db813966fd45a305cb3b72502759c | ebc786eeedd4f35128bbf756d9800edac60e12ec | /app/microDon/clients/models/Bank.java | 9af84efb06ba258595301f1fd2ccc415d0b96c63 | [
"CC0-1.0"
]
| permissive | thomaspierre/play-starter-rest-api | 5ffdb00e0421271ce1cd4bba3e0dcb0f3668b730 | 8b099b3689857a199d9a4d6e1746a549c5ac31b2 | refs/heads/master | 2021-08-23T12:24:28.595935 | 2017-12-04T22:18:53 | 2017-12-04T22:18:53 | 112,760,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package microDon.clients.models;
/**
* Author: tpierre
*/
public class Bank {
private String id;
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
]
| |
2fa39ebcbfcfb021bd636c399ec0e52266d351c1 | 52893025680cd0f450d979978cfdb7dbebcb014f | /Grafo/src/com/clopez/grafql/Node.java | 2130432e3940311499d1052facf0740139dc1b52 | []
| no_license | cluis-lopez/JavaGraph | 6eaa3c34dc3523b41cc0e21817775deeb04bb7db | 81339798d4acdd0b18105ee5c9af61c81cf1f483 | refs/heads/master | 2020-03-19T14:56:27.241017 | 2018-09-16T18:48:16 | 2018-09-16T18:48:16 | 136,647,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,490 | java | package com.clopez.grafql;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class Node {
/**
*
*/
private String kind;
private HashMap<String,Object> keypair;
private ArrayList<Edge> edges;
public Node(String k) {
kind = k;
keypair = new HashMap<>();
edges = new ArrayList<>();
}
public Node(String k, String key, Object val) {
kind = k;
keypair = new HashMap<>();
edges = new ArrayList<>();
keypair.put(key, val);
}
public String getKind() {
return kind;
}
public Edge addEdge(String name, Node n) {
Edge e = new Edge(name, this, n);
edges.add(e);
return e;
}
public void addKeyPair(String k, Object v) {
keypair.put(k, v);
}
public List<Edge> getEdges(){
return edges;
}
public boolean has(String k, Object v) {
if ( ! keypair.containsKey(k))
return false;
if (keypair.get(k).equals(v))
return true;
return false;
}
public Object has(String k) {
return keypair.get(k);
}
public ArrayList<Node> outE(){
ArrayList<Node> nodes = new ArrayList<>();
for(Edge e: edges) {
nodes.add(e.getTo());
}
return nodes;
}
public ArrayList<Node> outE(String key){
ArrayList<Node> nodes = new ArrayList<>();
for(Edge e: edges) {
if (e.getName().equals(key))
nodes.add(e.getTo());
}
return nodes;
}
public boolean hasEdges() {
return !edges.isEmpty();
}
}
| [
"[email protected]"
]
| |
323b303689f275854416dea2c0985f8800d26c51 | 6e1f23f7b5496514ac8b2f837359baca37412c67 | /src/main/java/com/zhangyu/raft/node/Client.java | 96eecd65c14a6360046eb6b9c2ef556c06f3edae | [
"MIT"
]
| permissive | zhangyu1402/K-V-Store | 6735822ba8ac8467d1a8f2d06fb4d0e1e5b0d71c | 81d9bbf1a165ec2d30d07b9bf4184e5fe5129c18 | refs/heads/master | 2022-12-11T06:10:37.325854 | 2020-02-20T20:25:05 | 2020-02-20T20:25:05 | 240,347,207 | 1 | 0 | null | 2022-11-16T09:23:32 | 2020-02-13T19:48:29 | Java | UTF-8 | Java | false | false | 56 | java | package com.zhangyu.raft.node;
public class Client {
}
| [
"[email protected]"
]
| |
06b686ebfa11ca3e92f826f76270da4a23d581a8 | 5a112e7b9ae1d5d38bdf8150a39716a935b9daef | /common/src/main/java/com/renard/common/google/gson/JsonDeserializer.java | fc7ae43125de95e8d67731940904f6fe565e2d3c | []
| no_license | QAQ-QVQ/hjyGameLy | 619ff4c54c9efecb91010192c86f71c6e02ca8d5 | 8cddfc4455642a168c57e4066844dc33ff34e25e | refs/heads/master | 2020-08-02T02:48:56.366094 | 2019-09-27T01:37:38 | 2019-09-27T01:37:38 | 211,212,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,691 | java | /*
* Copyright (C) 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.renard.common.google.gson;
import java.lang.reflect.Type;
/**
* <p>Interface representing a custom deserializer for Json. You should write a custom
* deserializer, if you are not happy with the default deserialization done by Gson. You will
* also need to register this deserializer through
* {@link GsonBuilder#registerTypeAdapter(Type, Object)}.</p>
*
* <p>Let us look at example where defining a deserializer will be useful. The {@code Id} class
* defined below has two fields: {@code clazz} and {@code value}.</p>
*
* <pre>
* public class Id<T> {
* private final Class<T> clazz;
* private final long value;
* public Id(Class<T> clazz, long value) {
* this.clazz = clazz;
* this.value = value;
* }
* public long getValue() {
* return value;
* }
* }
* </pre>
*
* <p>The default deserialization of {@code Id(com.foo.MyObject.class, 20L)} will require the
* Json string to be <code>{"clazz":com.foo.MyObject,"value":20}</code>. Suppose, you already know
* the type of the field that the {@code Id} will be deserialized into, and hence just want to
* deserialize it from a Json string {@code 20}. You can achieve that by writing a custom
* deserializer:</p>
*
* <pre>
* class IdDeserializer implements JsonDeserializer<Id>() {
* public Id deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
* throws JsonParseException {
* return new Id((Class)typeOfT, id.getValue());
* }
* </pre>
*
* <p>You will also need to register {@code IdDeserializer} with Gson as follows:</p>
*
* <pre>
* Gson gson = new GsonBuilder().registerTypeAdapter(Id.class, new IdDeserializer()).create();
* </pre>
*
* <p>New applications should prefer {@link TypeAdapter}, whose streaming API
* is more efficient than this interface's tree API.
*
* @author Inderjeet Singh
* @author Joel Leitch
*
* @param <T> type for which the deserializer is being registered. It is possible that a
* deserializer may be asked to deserialize a specific generic type of the T.
*/
public interface JsonDeserializer<T> {
/**
* Gson invokes this call-back method during deserialization when it encounters a field of the
* specified type.
* <p>In the implementation of this call-back method, you should consider invoking
* {@link JsonDeserializationContext#deserialize(JsonElement, Type)} method to create objects
* for any non-trivial field of the returned object. However, you should never invoke it on the
* the same type passing {@code json} since that will cause an infinite loop (Gson will call your
* call-back method again).
*
* @param json The Json data being deserialized
* @param typeOfT The type of the Object to deserialize to
* @return a deserialized object of the specified type typeOfT which is a subclass of {@code T}
* @throws JsonParseException if json is not in the expected format of {@code typeofT}
*/
public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException;
}
| [
"[email protected]"
]
| |
d8a2c1b9e0288ade1f32c3467685792a23a359fd | 56810f945542cac384d8495a6068aeb4c974d307 | /SeleniumWS_2017/SmitaSeDemo/src/com/sbk/selenium/webdriver/TestImplicitWaits.java | d2cd1927d95cc717cb80054c010ff1ec83de5e6e | []
| no_license | brijeshsmita/Selenium_Demos | 2bd9f7a89f78cd997ceb53d11147804c833026ac | 17c7b02db4e11ca762c9303a6a90eccfdf3e31f1 | refs/heads/master | 2023-06-24T16:12:24.230954 | 2023-06-20T10:44:46 | 2023-06-20T10:44:46 | 200,798,551 | 0 | 0 | null | 2022-12-16T04:24:44 | 2019-08-06T07:21:43 | JavaScript | UTF-8 | Java | false | false | 1,044 | java | package com.sbk.selenium.webdriver;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.By;
public class TestImplicitWaits
{
//implicit wait provide to load DOM object for a particular of time before trying to locate element on page.
//Default implicit wait is 0. We need to set implicit wait once and it apply for whole life of Webdriver object.
public static void main(String[] args)
{
// TODO Auto-generated method stub
WebDriver driver;
String baseUrl;
driver = new FirefoxDriver();
baseUrl = "http://www.wikipedia.org/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get(baseUrl + "/wiki/Main_Page");
driver.findElement(By.id("searchInput")).clear();
driver.findElement(By.id("searchInput")).sendKeys("India");
driver.findElement(By.id("searchButton")).click();
//driver.quit();
}
}
| [
"[email protected]"
]
| |
864dc4c8da528acf2fad777c155d73cc76c4436f | b27d7111c59b6246c5f34726c8457e4db44e4e9e | /app/src/main/java/com/example/zc/missingreports2/NIDActivity.java | 89e0d9a9d99a82e84aa1a98e28ae8ec1800e7ec9 | []
| no_license | Joy-karmaker/Missing-Reports | 52426eba6e445f53adf9541bfeb243f89c6dd728 | 18a452a69ca7422d5557d96f464a231f45c684f3 | refs/heads/master | 2020-04-28T14:50:18.403381 | 2019-03-27T09:38:54 | 2019-03-27T09:38:54 | 175,350,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,699 | java | package com.example.zc.missingreports2;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class NIDActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener{
SharedPreferences preferences;
SharedPreferences.Editor editor;
String gender, skin, location, Useremail, CheckOption ;
Button nidsubmit;
EditText nidname, nidage, nidnumber;
ImageView nidhomebutton, nidnewsfeed, nidnotification, nidchat,nidback;
Toolbar toolbar;
TextView title;
RequestQueue requestQueue;
//private ProgressDialog progress;
StringRequest request;
ArrayAdapter<CharSequence> adapterBG;
ArrayAdapter<CharSequence> adapterAvailability;
String Gender[] = {"Select", "Male", "Female", "Other"};
String Location[] = {"Select", "Savar", "Shahbag", "Kalabagan", "Gulshan", "Mohakhali", "Tejgaon", "Mirpur", "Mohammadpur", "Motijheel", "Newmarket", "Uttora", "Paltan"};
List<String> listsource = new ArrayList<>();
List<String> listsource3 = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nid);
toolbar = (Toolbar) findViewById(R.id.toolbar2);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("");
preferences= PreferenceManager.getDefaultSharedPreferences(this);
editor =preferences.edit();
title = (TextView)findViewById(R.id.title);
title.setText("MISSING NID");
nidback = (ImageView) findViewById(R.id.nidback);
nidsubmit=(Button)findViewById(R.id.nidsubmit);
nidname = (EditText)findViewById(R.id.nidname);
nidage = (EditText)findViewById(R.id.nidage);
nidnumber = (EditText)findViewById(R.id.nidnumber);
nidhomebutton = (ImageView)findViewById(R.id.nid);
nidnewsfeed = (ImageView)findViewById(R.id.nid1);
nidnotification = (ImageView)findViewById(R.id.nid2);
nidchat = (ImageView)findViewById(R.id.nid3);
//progress = new ProgressDialog(this);
CheckOption=getIntent().getStringExtra("Check");
if(CheckOption.equals("found")){
title.setText("FOUND NID");
}
Useremail = getIntent().getStringExtra("Useremail");
Toast.makeText(NIDActivity.this, Useremail, Toast.LENGTH_SHORT).show();
Toast.makeText(NIDActivity.this, CheckOption, Toast.LENGTH_SHORT).show();
generateData();
generateData2();
Spinner spin = (Spinner) findViewById(R.id.nidspinner);
ArrayAdapter<String> aa = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, Gender);
aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spin.setAdapter(aa);
spin.setOnItemSelectedListener(this);
Spinner spin3 = (Spinner) findViewById(R.id.nidlocation);
ArrayAdapter<String> cc = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, Location);
cc.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spin3.setAdapter(cc);
spin3.setOnItemSelectedListener(this);
nidsubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addpost();
}
});
nidback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(NIDActivity.this, DocumentActivity.class);
intent1.putExtra("Check", CheckOption);
intent1.putExtra("Useremail", Useremail);
//intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent1);
}
});
nidhomebutton.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(NIDActivity.this, OptionActivity.class);
intent1.putExtra("Useremail", Useremail);
//intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent1);
}
}
);
nidnewsfeed.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(NIDActivity.this, Newsfeed.class);
intent1.putExtra("Useremail", Useremail);
//intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent1);
}
}
);
nidnotification.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(NIDActivity.this, Notifications.class);
intent1.putExtra("Useremail", Useremail);
//intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent1);
}
}
);
nidchat.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent(NIDActivity.this, OptionActivity.class);
intent1.putExtra("Useremail", Useremail);
//intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent1);
}
}
);
}
private void generateData() {
for (int i = 0; i < 4; i++) {
listsource.add(Gender[i]);
}
}
private void generateData2() {
for (int i = 0; i < 13; i++) {
listsource3.add(Location[i]);
}
}
public void onItemSelected(AdapterView<?> parent, View view,
int position, long Id) {
Spinner spinner = (Spinner) parent;
Spinner spinner3 = (Spinner) parent;
if (spinner.getId() == R.id.nidspinner) {
gender = parent.getItemAtPosition(position).toString();
//Log.d("Blood_gp",Blood_gp);
}
else if (spinner3.getId() == R.id.nidlocation) {
location = parent.getItemAtPosition(position).toString();
//Toast.makeText(AddDonor.this,availability,Toast.LENGTH_SHORT).show();
}
}
public void onNothingSelected(AdapterView<?> parent) {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == R.id.UpdateProfile) {
startActivity(new Intent(NIDActivity.this, OptionActivity.class));
}
if(item.getItemId() == R.id.myreports) {
Intent intent1 = new Intent(NIDActivity.this, Newsfeed.class);
intent1.putExtra("Useremail", Useremail);
intent1.putExtra("myreports", "myreports");
//intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent1);
}
if(item.getItemId() == R.id.logout) {
editor.putString("Username",null);
//editor.putString("admin","user");
editor.apply();
Intent intent1 = new Intent(NIDActivity.this, LoginActivity.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent1);
}
if(item.getItemId() == R.id.feedback) {
startActivity(new Intent(NIDActivity.this, OptionActivity.class));
}
return super.onOptionsItemSelected(item);
}
public void addpost() {
//progress.setMessage("Please Wait......");
//progress.show();
//Toast.makeText(AddDonor.this,bloodgroup+gender+availability+"here we go",Toast.LENGTH_SHORT).show();
request = new StringRequest(Request.Method.POST, UrlClass.missingnid, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
// Toast.makeText(AddDonor.this,response,Toast.LENGTH_SHORT).show();
JSONObject jsonObject=new JSONObject(response);
String testing = jsonObject.getString("count");
Toast.makeText(NIDActivity.this,testing+" possible match found",Toast.LENGTH_SHORT).show();
if(jsonObject.names().get(0).equals("success")){
//progress.dismiss();
//String user=jsonObject.getString("donor");
Toast.makeText(NIDActivity.this,"Your post Added "+Useremail,Toast.LENGTH_SHORT).show();
}
else if(jsonObject.names().get(0).equals("notsuccess")){
//progress.dismiss();
Toast.makeText(NIDActivity.this,"Already present ",Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("name",nidname.getText().toString());
params.put("age",nidage.getText().toString());
params.put("nid",nidnumber.getText().toString());
params.put("email", Useremail);
params.put("gender",gender);
params.put("location",location);
params.put("CheckOption",CheckOption);
return params;
}
};
requestQueue= Volley.newRequestQueue(this);
requestQueue.add(request);
}
}
| [
"[email protected]"
]
| |
a424dfeb1da9160254ce2493c49eac59868c35da | 31469acc1743ed397276be105bdba3be5fe924c5 | /RebookServer/src/utils/Livro.java | a49bb5a4345c4b0180c57a5741fe15b96d638d3c | []
| no_license | tfsimoes/rebook | 590c7c61ba31f1d0e41658e9876d7408ad111f74 | 9ad61e3ac525e39d673134f384c905defda7e208 | refs/heads/master | 2020-05-17T17:49:48.483546 | 2014-05-05T14:27:45 | 2014-05-05T14:27:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | package utils;
public class Livro {
int idLivro;
String nome;
String nomeficheiro;
int derivado;
public Livro(int idLivro, String nome, String nomeFicheiro, int derivado){
this.idLivro = idLivro;
this.nome = nome;
this.nomeficheiro = nomeFicheiro;
this.derivado = derivado;
}
public int getIdLivro(){
return this.idLivro;
}
public String getNome(){
return this.nome;
}
public String getNomeFicheiro(){
return this.nomeficheiro;
}
public int getDerivado(){
return this.derivado;
}
}
| [
"[email protected]"
]
| |
37a3d478be3145ab3a8174b2da3d887aae52523c | 678bd9385c614f0fabe5bf1532b558866d0529d8 | /android/app/src/main/java/com/frontobjetperdu/MainActivity.java | c6262cafdca69bd50afb6769ba68e2f9acea333c | []
| no_license | JeremyNoh/frontObjetPerdu | f46c12548d7020b22234499628ff416dce614b39 | 56404a08a8f80fb586b722c89b9483e3bd41059f | refs/heads/master | 2020-03-22T11:15:17.430872 | 2018-09-07T11:23:30 | 2018-09-07T11:23:30 | 139,958,740 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package com.frontobjetperdu;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "frontObjetPerdu";
}
}
| [
"[email protected]"
]
| |
678512d87a12630cc7ef4b291a18e81a8a9ea9c3 | 0451824746b9d709fd43bf667bcafadfe438e434 | /src/main/java/de/hpi/data_change/imdb/parsing/TitleEndRecognizer.java | 73fcfeae5e18ffd449e7858bf8d8405e9cbde162 | []
| no_license | ChanchalGupta/IMDBParser | 7575550d7f2112891eca16b3037fd3f3f1cd10cb | 61458cfcf9a9c32c1d51987f8ba640738c0b84a5 | refs/heads/master | 2020-07-01T03:50:10.651264 | 2018-04-13T12:31:08 | 2018-04-13T12:31:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,169 | java | package de.hpi.data_change.imdb.parsing;
import de.hpi.data_change.data.Pair;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TitleEndRecognizer {
//private static final String regexLastTitleElement = "\\(((([0-9]{4}|\\?{4})(/([IXVL])+)?)|TV|V|VG)\\)|\\{\\{SUSPENDED\\}\\}|\\{(.*?)\\}|\\([0-9]{4}\\)";
private static final Pattern suspendedPattern = Pattern.compile("\\{\\{SUSPENDED\\}\\}");
private static final Pattern yearPattern = Pattern.compile("\\(([0-9]{4}|\\?{4})(/([IXVL])+)?\\)");
private static final Pattern typePattern = Pattern.compile("\\((TV|V|VG)\\)");
private static final Pattern episodeNamePattern = Pattern.compile("\\{(.*?)\\}");
public static Pair<String,String> splitAfterTitle(String line){
Matcher yearMatcher = yearPattern.matcher(line);
boolean foundYear = yearMatcher.find();
assert(foundYear);
int preliminaryStart = yearMatcher.end();
String fromYearEnd = line.substring(preliminaryStart);
//other matchers
Matcher typeMatcher = typePattern.matcher(fromYearEnd);
Matcher episodeNameMatcher = episodeNamePattern.matcher(fromYearEnd);
Matcher supendedMatcher = suspendedPattern.matcher(fromYearEnd);
int secondHalfStart = preliminaryStart;
if(supendedMatcher.find()){
secondHalfStart = supendedMatcher.end() + preliminaryStart;
} else if(episodeNameMatcher.find()){
secondHalfStart = episodeNameMatcher.end() + preliminaryStart;
} else if (typeMatcher.find()) {
secondHalfStart = typeMatcher.end() + preliminaryStart;
}
return new Pair<>(line.substring(0,secondHalfStart),line.substring(secondHalfStart));
}
public static int lastIndexOfRegex(Matcher matcher) {
// Default to the NOT_FOUND constant
int lastIndex = -1;
// Search for the given pattern
while (matcher.find())
{
lastIndex = matcher.end();
}
assert(lastIndex!=-1);
return lastIndex;
}
}
| [
"[email protected]"
]
| |
819562996fec9103d53f1d2794ac1b0f9a5abc2a | d61706df9ac39a9965ee9a2eadbc58bd2acaae8c | /src/main/java/admin_update_info_servlet/AdminUpdateInfoAdvanced.java | ec2fe1a98af5b76a137dac4a37b6b0a7985d96c2 | []
| no_license | Congtrinhh/shoes_store | c88666b37210b50fad5aa019cf5a11ebfd85d215 | d2fa0fd44e6f57c1437abce4945495d002f31b65 | refs/heads/master | 2023-07-08T02:47:35.915667 | 2021-08-19T11:31:32 | 2021-08-19T11:31:32 | 389,997,515 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,373 | java | package admin_update_info_servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import entities.Admin;
@WebServlet(urlPatterns = {"/admin-update-advanced"})
public class AdminUpdateInfoAdvanced extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
RequestDispatcher dispatcher = req.getServletContext().getRequestDispatcher("/WEB-INF/views/admin_update_info/updateAdvancedInfo.jsp");
dispatcher.forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String ad_old_password = req.getParameter("ad_old_password");
String ad_new_password = req.getParameter("ad_new_password");
String ad_confirmed_password = req.getParameter("ad_confirmed_password");
// kiểm tra mật khẩu cũ hợp lệ
HttpSession session = req.getSession();
Admin adminInSession = (Admin) session.getAttribute(Admin.LOGED_IN_ADMIN_IN_SESSION);
String errorMessage = null;
if (!adminInSession.getAd_password().equals(ad_old_password)) {
errorMessage = "mật khẩu cũ không đúng";
req.setAttribute(Admin.ERROR_MESSAGE_IN_REQUEST, errorMessage);
RequestDispatcher dispatcher = req.getServletContext().getRequestDispatcher("/WEB-INF/views/admin_update_info/updateAdvancedInfo.jsp");
dispatcher.forward(req, resp);
} else {
// verify nhè nhẹ
if (ad_new_password.equals(ad_confirmed_password)) {
Connection conn = common_utils.MyUtils.getStoredConnection(req);
try {
db_admin_update_info_utils.AdminUpdateAdvancedInfo.updatePassword(adminInSession.getAdmin_id(), ad_confirmed_password, conn);
// nếu cập nhật mật khẩu thành công, update lại session của admin
adminInSession.setAd_password(ad_confirmed_password);
session.setAttribute(Admin.LOGED_IN_ADMIN_IN_SESSION, adminInSession);
errorMessage = "Cập nhật mật khẩu thành công";
req.setAttribute(Admin.ERROR_MESSAGE_IN_REQUEST, errorMessage);
RequestDispatcher dispatcher = req.getServletContext().getRequestDispatcher("/WEB-INF/views/admin_update_info/updateAdvancedInfo.jsp");
dispatcher.forward(req, resp);
} catch (SQLException e) {
e.printStackTrace();
errorMessage = e.getMessage();
req.setAttribute(Admin.ERROR_MESSAGE_IN_REQUEST, errorMessage);
RequestDispatcher dispatcher = req.getServletContext().getRequestDispatcher("/WEB-INF/views/admin_update_info/updateAdvancedInfo.jsp");
dispatcher.forward(req, resp);
return;
}
}
else {
errorMessage = "mật khẩu xác nhận không khớp";
req.setAttribute(Admin.ERROR_MESSAGE_IN_REQUEST, errorMessage);
RequestDispatcher dispatcher = req.getServletContext().getRequestDispatcher("/WEB-INF/views/admin_update_info/updateAdvancedInfo.jsp");
dispatcher.forward(req, resp);
}
}
}
}
| [
"[email protected]"
]
| |
c21daa95faaaf8a73b48982aba950198924b87a1 | 2ac09e1df530d7bd72a1b356b504ea2841851d2d | /java/net/sf/l2j/gameserver/Shutdown.java | 1e124c5965bc8453f9aad40f3cbb2369939de2eb | []
| no_license | DeMarko1984/leagueoflineage | 5d4470b5bed4e132a8e63555bd2581728117e864 | 7552026c310242723c884fe29bab503de9154ae3 | refs/heads/main | 2023-07-16T08:16:40.994221 | 2021-09-10T06:20:26 | 2021-09-10T06:20:26 | 403,709,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,342 | java | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package net.sf.l2j.gameserver;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.l2j.Config;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.gameserverpackets.ServerStatus;
import net.sf.l2j.gameserver.instancemanager.ItemsOnGroundManager;
import net.sf.l2j.gameserver.instancemanager.QuestManager;
import net.sf.l2j.gameserver.instancemanager.RaidBossSpawnManager;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.L2GameClient;
import net.sf.l2j.gameserver.serverpackets.ServerClose;
/**
* This class provides the functions for shutting down and restarting the server It closes all open clientconnections and saves all data.
* @version $Revision: 1.2.4.5 $ $Date: 2005/03/27 15:29:09 $
*/
public class Shutdown extends Thread
{
private static Logger _log = Logger.getLogger(Shutdown.class.getName());
private static Shutdown _instance;
private static Shutdown _counterInstance = null;
private int _secondsShut;
private int _shutdownMode;
public static final int SIGTERM = 0;
public static final int GM_SHUTDOWN = 1;
public static final int GM_RESTART = 2;
public static final int ABORT = 3;
private static final String[] MODE_TEXT =
{
"SIGTERM",
"shutting down",
"restarting",
"aborting"
};
/**
* This function starts a shutdown countdown from Telnet (Copied from Function startShutdown())
* @param IP IP Which Issued shutdown command
* @param seconds seconds until shutdown
* @param restart true if the server will restart after shutdown
*/
public void startTelnetShutdown(String IP, int seconds, boolean restart)
{
Announcements _an = Announcements.getInstance();
_log.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
// _an.announceToAll("Server is " + _modeText[shutdownMode] + " in "+seconds+ " seconds!");
if (restart)
{
_shutdownMode = GM_RESTART;
}
else
{
_shutdownMode = GM_SHUTDOWN;
}
if (_shutdownMode > 0)
{
_an.announceToAll("Attention players!");
_an.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
if ((_shutdownMode == 1) || (_shutdownMode == 2))
{
_an.announceToAll("Please, avoid to use Gatekeepers/SoE");
_an.announceToAll("during server " + MODE_TEXT[_shutdownMode] + " procedure.");
}
}
if (_counterInstance != null)
{
_counterInstance._abort();
}
_counterInstance = new Shutdown(seconds, restart);
_counterInstance.start();
}
/**
* This function aborts a running countdown
* @param IP IP Which Issued shutdown command
*/
public void telnetAbort(String IP)
{
Announcements _an = Announcements.getInstance();
_log.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
_an.announceToAll("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!");
if (_counterInstance != null)
{
_counterInstance._abort();
}
}
/**
* Default constucter is only used internal to create the shutdown-hook instance
*/
public Shutdown()
{
_secondsShut = -1;
_shutdownMode = SIGTERM;
}
/**
* This creates a countdown instance of Shutdown.
* @param seconds how many seconds until shutdown
* @param restart true is the server shall restart after shutdown
*/
public Shutdown(int seconds, boolean restart)
{
if (seconds < 0)
{
seconds = 0;
}
_secondsShut = seconds;
if (restart)
{
_shutdownMode = GM_RESTART;
}
else
{
_shutdownMode = GM_SHUTDOWN;
}
}
/**
* get the shutdown-hook instance the shutdown-hook instance is created by the first call of this function, but it has to be registrered externaly.
* @return instance of Shutdown, to be used as shutdown hook
*/
public static Shutdown getInstance()
{
if (_instance == null)
{
_instance = new Shutdown();
}
return _instance;
}
/**
* this function is called, when a new thread starts if this thread is the thread of getInstance, then this is the shutdown hook and we save all data and disconnect all clients. after this thread ends, the server will completely exit if this is not the thread of getInstance, then this is a
* countdown thread. we start the countdown, and when we finished it, and it was not aborted, we tell the shutdown-hook why we call exit, and then call exit when the exit status of the server is 1, startServer.sh / startServer.bat will restart the server.
*/
@Override
public void run()
{
// disallow new logins
try
{
// Doesnt actually do anything
// Server.gameServer.getLoginController().setMaxAllowedOnlinePlayers(0);
}
catch (Throwable t)
{
// ignore
}
if (this == _instance)
{
// ensure all services are stopped
try
{
GameTimeController.getInstance().stopTimer();
}
catch (Throwable t)
{
// ignore
}
// stop all threadpolls
try
{
ThreadPoolManager.getInstance().shutdown();
}
catch (Throwable t)
{
// ignore
}
// last byebye, save all data and quit this server
// logging doesnt work here :(
saveData();
try
{
LoginServerThread.getInstance().interrupt();
}
catch (Throwable t)
{
// ignore
}
// saveData sends messages to exit players, so sgutdown selector after it
try
{
GameServer.gameServer.getSelectorThread().shutdown();
GameServer.gameServer.getSelectorThread().setDaemon(true);
}
catch (Throwable t)
{
// ignore
}
// commit data, last chance
try
{
L2DatabaseFactory.getInstance().shutdown();
}
catch (Throwable t)
{
}
// server will quit, when this function ends.
if (_instance._shutdownMode == GM_RESTART)
{
Runtime.getRuntime().halt(2);
}
else
{
Runtime.getRuntime().halt(0);
}
}
else
{
// gm shutdown: send warnings and then call exit to start shutdown sequence
countdown();
// last point where logging is operational :(
_log.warning("GM shutdown countdown is over. " + MODE_TEXT[_shutdownMode] + " NOW!");
switch (_shutdownMode)
{
case GM_SHUTDOWN:
_instance.setMode(GM_SHUTDOWN);
System.exit(0);
break;
case GM_RESTART:
_instance.setMode(GM_RESTART);
System.exit(2);
break;
}
}
}
/**
* This functions starts a shutdown countdown
* @param activeChar GM who issued the shutdown command
* @param seconds seconds until shutdown
* @param restart true if the server will restart after shutdown
*/
public void startShutdown(L2PcInstance activeChar, int seconds, boolean restart)
{
Announcements _an = Announcements.getInstance();
_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
if (restart)
{
_shutdownMode = GM_RESTART;
}
else
{
_shutdownMode = GM_SHUTDOWN;
}
if (_shutdownMode > 0)
{
_an.announceToAll("Attention players!");
_an.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
if ((_shutdownMode == 1) || (_shutdownMode == 2))
{
_an.announceToAll("Please, avoid to use Gatekeepers/SoE");
_an.announceToAll("during server " + MODE_TEXT[_shutdownMode] + " procedure.");
}
}
if (_counterInstance != null)
{
_counterInstance._abort();
}
// the main instance should only run for shutdown hook, so we start a new instance
_counterInstance = new Shutdown(seconds, restart);
_counterInstance.start();
}
/**
* This function aborts a running countdown
* @param activeChar GM who issued the abort command
*/
public void abort(L2PcInstance activeChar)
{
Announcements _an = Announcements.getInstance();
_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
_an.announceToAll("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!");
if (_counterInstance != null)
{
_counterInstance._abort();
}
}
/**
* set the shutdown mode
* @param mode what mode shall be set
*/
private void setMode(int mode)
{
_shutdownMode = mode;
}
/**
* set shutdown mode to ABORT
*/
private void _abort()
{
_shutdownMode = ABORT;
}
/**
* this counts the countdown and reports it to all players countdown is aborted if mode changes to ABORT
*/
private void countdown()
{
Announcements _an = Announcements.getInstance();
try
{
while (_secondsShut > 0)
{
switch (_secondsShut)
{
case 540:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 9 minutes.");
break;
case 480:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 8 minutes.");
break;
case 420:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 7 minutes.");
break;
case 360:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 6 minutes.");
break;
case 300:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 5 minutes.");
break;
case 240:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 4 minutes.");
break;
case 180:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 3 minutes.");
break;
case 120:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 2 minutes.");
break;
case 60:
LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_DOWN); // avoids new players from logging in
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 1 minute.");
break;
case 30:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 30 seconds.");
break;
case 5:
_an.announceToAll("The server is " + MODE_TEXT[_shutdownMode] + " in 5 seconds, please delog NOW !");
break;
}
_secondsShut--;
int delay = 1000; // milliseconds
Thread.sleep(delay);
if (_shutdownMode == ABORT)
{
break;
}
}
}
catch (InterruptedException e)
{
// this will never happen
}
}
/**
* this sends a last byebye, disconnects all players and saves data
*/
private void saveData()
{
Announcements _an = Announcements.getInstance();
switch (_shutdownMode)
{
case SIGTERM:
System.err.println("SIGTERM received. Shutting down NOW!");
break;
case GM_SHUTDOWN:
System.err.println("GM shutdown received. Shutting down NOW!");
break;
case GM_RESTART:
System.err.println("GM restart received. Restarting NOW!");
break;
}
if (Config.ACTIVATE_POSITION_RECORDER)
{
Universe.getInstance().implode(true);
}
try
{
_an.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " NOW!");
}
catch (Throwable t)
{
_log.log(Level.INFO, "", t);
}
// we cannt abort shutdown anymore, so i removed the "if"
disconnectAllCharacters();
// Seven Signs data is now saved along with Festival data.
// if (!SevenSigns.getInstance().isSealValidationPeriod())
// {
// SevenSignsFestival.getInstance().saveFestivalData(false);
// }
// Save Seven Signs data before closing. :)
// SevenSigns.getInstance().saveSevenSignsData(null, true);
// Save all raidboss status ^_^
RaidBossSpawnManager.getInstance().cleanUp();
System.err.println("RaidBossSpawnManager: All raidboss info saved!!");
TradeController.getInstance().dataCountStore();
System.err.println("TradeController: All count Item Saved");
// try
// {
// Olympiad.getInstance().save();
// }
// catch (Exception e)
// {
// e.printStackTrace();
// }
// System.err.println("Olympiad System: Data saved!!");
// Save Cursed Weapons data before closing.
// CursedWeaponsManager.getInstance().saveData();
// Save all manor data
// CastleManorManager.getInstance().save();
// Save all global (non-player specific) Quest data that needs to persist after reboot
QuestManager.getInstance().save();
// Save items on ground before closing
if (Config.SAVE_DROPPED_ITEM)
{
ItemsOnGroundManager.getInstance().saveInDb();
ItemsOnGroundManager.getInstance().cleanUp();
System.err.println("ItemsOnGroundManager: All items on ground saved!!");
}
System.err.println("Data saved. All players disconnected, shutting down.");
try
{
int delay = 5000;
Thread.sleep(delay);
}
catch (InterruptedException e)
{
// never happens :p
}
}
/**
* this disconnects all clients from the server
*/
private void disconnectAllCharacters()
{
for (L2PcInstance player : L2World.getInstance().getAllPlayers())
{
// Logout Character
try
{
L2GameClient.saveCharToDisk(player);
// SystemMessage sm = new SystemMessage(SystemMessage.YOU_HAVE_WON_THE_WAR_OVER_THE_S1_CLAN);
// player.sendPacket(sm);
ServerClose ql = new ServerClose();
player.sendPacket(ql);
}
catch (Throwable t)
{
}
}
try
{
Thread.sleep(1000);
}
catch (Throwable t)
{
_log.log(Level.INFO, "", t);
}
for (L2PcInstance player : L2World.getInstance().getAllPlayers())
{
try
{
player.closeNetConnection();
}
catch (Throwable t)
{
// just to make sure we try to kill the connection
}
}
}
}
| [
"[email protected]"
]
| |
ed0181991320d447f673cc615a1d4a580f19e81c | bc366e03592e92180f3f23e13dbf8d79a8e77566 | /tanhua-admin/src/main/java/com/itheima/web/controller/AdminController.java | 6459bc3aa18311e8028a507cc890e84ccf485365 | []
| no_license | stephendengbl/tanhua | 136df8b168e9bf87061dcb73303ec93e30aed1ee | 53c8fb9317be7cbd0f7a53fceb8a2d6242f8d684 | refs/heads/main | 2023-06-11T23:17:55.282428 | 2021-07-11T09:15:13 | 2021-07-11T09:15:13 | 384,902,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,607 | java | package com.itheima.web.controller;
import cn.hutool.captcha.LineCaptcha;
import cn.hutool.core.bean.BeanUtil;
import com.itheima.domain.db.Admin;
import com.itheima.util.JwtUtil;
import com.itheima.web.interceptor.AdminHolder;
import com.itheima.web.manager.AdminManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@RestController
public class AdminController {
@Autowired
private AdminManager adminManager;
//生成验证码
@GetMapping("/system/users/verification")
public void genVerification(String uuid, HttpServletResponse response) throws IOException {
//1. 调用manager生成验证码
LineCaptcha lineCaptcha = adminManager.genVerification(uuid);
//2. 返回验证码
response.setContentType("image/jpeg");//声明返回的数据的Content-Type
lineCaptcha.write(response.getOutputStream());
}
//用户登录
@PostMapping("/system/users/login")
public Map<String, String> login(@RequestBody Map<String, String> map) {
//1. 接收参数
String username = map.get("username");
String password = map.get("password");
String verificationCode = map.get("verificationCode");
String uuid = map.get("uuid");
//2. 调用manager登录,返回token
String token = adminManager.login(username, password, verificationCode, uuid);
//3. 组装返回map
Map<String, String> tokenMap = new HashMap<>();
tokenMap.put("token", token);
return tokenMap;
}
//获取用户基本信息
@PostMapping("/system/users/profile")
public Map<String, String> findUserInfo(@RequestHeader("Authorization") String token) {
//1. 从token中获取用户Admin
Admin admin = AdminHolder.getAdmin();
//2. 查询头像
admin = adminManager.findByUsername(admin.getUsername());
//3. 根据admin封装返回map
HashMap<String, String> map = new HashMap<>();
map.put("uid", admin.getId() + "");
map.put("username", admin.getUsername());
map.put("avatar", admin.getAvatar());
return map;
}
//用户退出
@PostMapping("/system/users/logout")
public void logout(@RequestHeader("Authorization") String token){
//获取到了token
token = token.replaceAll("Bearer ", "");
//调用manager退出
adminManager.logout(token);
}
}
| [
"[email protected]"
]
| |
486554e2758974b9961ff822f8db02942afe9740 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipsejdt_cluster/71061/tar_0.java | f6bfc2e212f1416789afe7f51186cfd950acea90 | []
| no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,255 | java | /*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.core.search.matching;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.search.IJavaSearchResultCollector;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
import org.eclipse.jdt.internal.compiler.env.*;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
import org.eclipse.jdt.internal.core.*;
public class PotentialMatch implements ICompilationUnit {
public static final String NO_SOURCE_FILE_NAME = "NO SOURCE FILE NAME"; //$NON-NLS-1$
public static IType getTopLevelType(IType binaryType) {
// ensure it is not a local or anoymous type (see bug 28752 J Search resports non-existent Java element)
String typeName = binaryType.getElementName();
int lastDollar = typeName.lastIndexOf('$');
int length = typeName.length();
if (lastDollar != -1 && lastDollar < length-1) {
if (Character.isDigit(typeName.charAt(lastDollar+1))) {
// local or anonymous type
typeName = typeName.substring(0, lastDollar);
IClassFile classFile = binaryType.getPackageFragment().getClassFile(typeName+".class"); //$NON-NLS-1$
try {
binaryType = classFile.getType();
} catch (JavaModelException e) {
// ignore as implementation of getType() cannot throw this exception
}
}
}
// ensure it is a top level type
IType declaringType = binaryType.getDeclaringType();
while (declaringType != null) {
binaryType = declaringType;
declaringType = binaryType.getDeclaringType();
}
return binaryType;
}
public char[][] compoundName;
private MatchLocator locator;
MatchingNodeSet matchingNodeSet;
public Openable openable;
public IResource resource;
private String sourceFileName;
public PotentialMatch(
MatchLocator locator,
IResource resource,
Openable openable) {
this.locator = locator;
this.resource = resource;
this.openable = openable;
this.matchingNodeSet = new MatchingNodeSet(locator);
char[] qualifiedName = getQualifiedName();
if (qualifiedName != null) {
this.compoundName = CharOperation.splitOn('.', qualifiedName);
}
}
public boolean equals(Object obj) {
if (this.compoundName == null) return super.equals(obj);
if (!(obj instanceof PotentialMatch)) return false;
return CharOperation.equals(this.compoundName, ((PotentialMatch)obj).compoundName);
}
/*
* Finds the source of this class file.
* Returns null if not found.
*/
private char[] findClassFileSource() {
String fileName = getSourceFileName();
if (fileName == NO_SOURCE_FILE_NAME) return null;
char[] source = null;
try {
SourceMapper sourceMapper = this.openable.getSourceMapper();
if (sourceMapper != null) {
IType type = ((ClassFile)this.openable).getType();
source = sourceMapper.findSource(type, fileName);
}
} catch (JavaModelException e) {
}
return source;
}
public char[] getContents() {
char[] source = null;
try {
if (this.openable instanceof WorkingCopy) {
IBuffer buffer = this.openable.getBuffer();
if (buffer == null) return null;
source = buffer.getCharacters();
} else if (this.openable instanceof CompilationUnit) {
source = Util.getResourceContentsAsCharArray((IFile)this.resource);
} else if (this.openable instanceof ClassFile) {
source = findClassFileSource();
}
} catch (JavaModelException e) {
}
if (source == null) return CharOperation.NO_CHAR;
return source;
}
public char[] getFileName() {
return this.openable.getPath().toString().toCharArray();
}
public char[] getMainTypeName() {
return null; // cannot know the main type name without opening .java or .class file
// see http://bugs.eclipse.org/bugs/show_bug.cgi?id=32182
}
public char[][] getPackageName() {
int length;
if ((length = this.compoundName.length) > 1) {
return CharOperation.subarray(this.compoundName, 0, length-1);
} else {
return CharOperation.NO_CHAR_CHAR;
}
}
/*
* Returns the fully qualified name of the main type of the compilation unit
* or the main type of the .java file that defined the class file.
*/
private char[] getQualifiedName() {
if (this.openable instanceof CompilationUnit) {
// get file name
String fileName = this.resource.getFullPath().lastSegment();
// get main type name
char[] mainTypeName = fileName.substring(0, fileName.length()-5).toCharArray();
CompilationUnit cu = (CompilationUnit)this.openable;
return cu.getType(new String(mainTypeName)).getFullyQualifiedName().toCharArray();
} else if (this.openable instanceof ClassFile) {
String fileName = getSourceFileName();
if (fileName == NO_SOURCE_FILE_NAME) {
try {
return ((ClassFile)this.openable).getType().getFullyQualifiedName('.').toCharArray();
} catch (JavaModelException e) {
return null;
}
}
String simpleName = fileName.substring(0, fileName.length()-5); // length-".java".length()
String pkgName = this.openable.getParent().getElementName();
if (pkgName.length() == 0) {
return simpleName.toCharArray();
} else {
return (pkgName + '.' + simpleName).toCharArray();
}
} else {
return null;
}
}
/*
* Returns the source file name of the class file.
* Returns NO_SOURCE_FILE_NAME if not found.
*/
private String getSourceFileName() {
if (this.sourceFileName != null) return this.sourceFileName;
this.sourceFileName = NO_SOURCE_FILE_NAME;
try {
SourceMapper sourceMapper = this.openable.getSourceMapper();
if (sourceMapper != null) {
IType type = ((ClassFile)this.openable).getType();
ClassFileReader reader = this.locator.classFileReader(type);
if (reader != null) {
this.sourceFileName = sourceMapper.findSourceFileName(type, reader);
}
}
} catch (JavaModelException e) {
}
return this.sourceFileName;
}
public int hashCode() {
if (this.compoundName == null) return super.hashCode();
int hashCode = 0;
for (int i = 0, length = this.compoundName.length; i < length; i++) {
hashCode += CharOperation.hashCode(this.compoundName[i]);
}
return hashCode;
}
/**
* Locate declaration in the current class file. This class file is always in a jar.
*/
public void locateMatchesInClassFile() throws CoreException {
org.eclipse.jdt.internal.core.ClassFile classFile = (org.eclipse.jdt.internal.core.ClassFile)this.openable;
IBinaryType info = this.locator.getBinaryInfo(classFile, this.resource);
if (info == null)
return; // unable to go further
// check class definition
BinaryType binaryType = (BinaryType)classFile.getType();
if (this.locator.pattern.matchesBinary(info, null)) {
this.locator.reportBinaryMatch(binaryType, info, IJavaSearchResultCollector.EXACT_MATCH);
}
boolean compilationAborted = false;
if (this.locator.pattern.needsResolve) {
// resolve
BinaryTypeBinding binding = null;
try {
binding = this.locator.cacheBinaryType(binaryType);
if (binding != null) {
// filter out element not in hierarchy scope
if (this.locator.hierarchyResolver != null
&& !this.locator.hierarchyResolver.subOrSuperOfFocus(binding)) {
return;
}
// check methods
MethodBinding[] methods = binding.methods();
for (int i = 0; i < methods.length; i++) {
MethodBinding method = methods[i];
int level = this.locator.pattern.matchLevel(method);
switch (level) {
case SearchPattern.IMPOSSIBLE_MATCH:
case SearchPattern.INACCURATE_MATCH:
break;
default:
IMethod methodHandle =
binaryType.getMethod(
new String(method.isConstructor() ? binding.compoundName[binding.compoundName.length-1] : method.selector),
Signature.getParameterTypes(new String(method.signature()).replace('/', '.'))
);
this.locator.reportBinaryMatch(
methodHandle,
info,
level == SearchPattern.ACCURATE_MATCH ?
IJavaSearchResultCollector.EXACT_MATCH :
IJavaSearchResultCollector.POTENTIAL_MATCH);
}
}
// check fields
FieldBinding[] fields = binding.fields();
for (int i = 0; i < fields.length; i++) {
FieldBinding field = fields[i];
int level = this.locator.pattern.matchLevel(field);
switch (level) {
case SearchPattern.IMPOSSIBLE_MATCH:
case SearchPattern.INACCURATE_MATCH:
break;
default:
IField fieldHandle = binaryType.getField(new String(field.name));
this.locator.reportBinaryMatch(
fieldHandle,
info,
level == SearchPattern.ACCURATE_MATCH ?
IJavaSearchResultCollector.EXACT_MATCH :
IJavaSearchResultCollector.POTENTIAL_MATCH);
}
}
}
} catch (AbortCompilation e) {
binding = null;
}
// no need to check binary info if resolve was successful
compilationAborted = binding == null;
if (!compilationAborted) return;
}
// if compilation was aborted it is a problem with the class path:
// report as a potential match if binary info matches the pattern
int accuracy = compilationAborted ? IJavaSearchResultCollector.POTENTIAL_MATCH : IJavaSearchResultCollector.EXACT_MATCH;
// check methods
IBinaryMethod[] methods = info.getMethods();
int length = methods == null ? 0 : methods.length;
for (int i = 0; i < length; i++) {
IBinaryMethod method = methods[i];
if (this.locator.pattern.matchesBinary(method, info)) {
IMethod methodHandle =
binaryType.getMethod(
new String(method.isConstructor() ? info.getName() : method.getSelector()),
Signature.getParameterTypes(new String(method.getMethodDescriptor()).replace('/', '.'))
);
this.locator.reportBinaryMatch(methodHandle, info, accuracy);
}
}
// check fields
IBinaryField[] fields = info.getFields();
length = fields == null ? 0 : fields.length;
for (int i = 0; i < length; i++) {
IBinaryField field = fields[i];
if (this.locator.pattern.matchesBinary(field, info)) {
IField fieldHandle = binaryType.getField(new String(field.getName()));
this.locator.reportBinaryMatch(fieldHandle, info, accuracy);
}
}
}
public String toString() {
return this.openable == null ? "Fake PotentialMatch" : this.openable.toString(); //$NON-NLS-1$
}
}
| [
"[email protected]"
]
| |
d596a81da921f452a1a597631d567648ae6ac043 | 736d52af62202656e6623ffe92528d1315f9980c | /batik/badapt_classes/org/apache/batik/ext/awt/image/rendered/SpecularLightingRed.java | c82e823457d654b5f23d2e76ec60d0341e2cdc96 | [
"Apache-2.0"
]
| permissive | anthonycanino1/entbench-pi | 1548ef975c7112881f053fd8930b3746d0fbf456 | 0fa0ae889aec3883138a547bdb8231e669c6eda1 | refs/heads/master | 2020-02-26T14:32:23.975709 | 2016-08-15T17:37:47 | 2016-08-15T17:37:47 | 65,744,715 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 29,844 | java | package org.apache.batik.ext.awt.image.rendered;
public class SpecularLightingRed extends org.apache.batik.ext.awt.image.rendered.AbstractTiledRed {
private double ks;
private double specularExponent;
private org.apache.batik.ext.awt.image.Light light;
private org.apache.batik.ext.awt.image.rendered.BumpMap bumpMap;
private double scaleX;
private double scaleY;
private java.awt.Rectangle litRegion;
private boolean linear;
public SpecularLightingRed(double ks, double specularExponent, org.apache.batik.ext.awt.image.Light light,
org.apache.batik.ext.awt.image.rendered.BumpMap bumpMap,
java.awt.Rectangle litRegion,
double scaleX,
double scaleY,
boolean linear) { super();
this.ks =
ks;
this.specularExponent =
specularExponent;
this.light =
light;
this.bumpMap =
bumpMap;
this.litRegion =
litRegion;
this.scaleX =
scaleX;
this.scaleY =
scaleY;
this.linear =
linear;
java.awt.image.ColorModel cm;
if (linear)
cm =
org.apache.batik.ext.awt.image.GraphicsUtil.
Linear_sRGB_Unpre;
else
cm =
org.apache.batik.ext.awt.image.GraphicsUtil.
sRGB_Unpre;
int tw =
litRegion.
width;
int th =
litRegion.
height;
int defSz =
org.apache.batik.ext.awt.image.rendered.AbstractTiledRed.
getDefaultTileSize(
);
if (tw >
defSz)
tw =
defSz;
if (th >
defSz)
th =
defSz;
java.awt.image.SampleModel sm =
cm.
createCompatibleSampleModel(
tw,
th);
init(
(org.apache.batik.ext.awt.image.rendered.CachableRed)
null,
litRegion,
cm,
sm,
litRegion.
x,
litRegion.
y,
null);
}
public java.awt.image.WritableRaster copyData(java.awt.image.WritableRaster wr) {
copyToRaster(
wr);
return wr;
}
public void genRect(java.awt.image.WritableRaster wr) {
final double scaleX =
this.
scaleX;
final double scaleY =
this.
scaleY;
final double[] lightColor =
light.
getColor(
linear);
final int w =
wr.
getWidth(
);
final int h =
wr.
getHeight(
);
final int minX =
wr.
getMinX(
);
final int minY =
wr.
getMinY(
);
final java.awt.image.DataBufferInt db =
(java.awt.image.DataBufferInt)
wr.
getDataBuffer(
);
final int[] pixels =
db.
getBankData(
)[0];
final java.awt.image.SinglePixelPackedSampleModel sppsm;
sppsm =
(java.awt.image.SinglePixelPackedSampleModel)
wr.
getSampleModel(
);
final int offset =
db.
getOffset(
) +
sppsm.
getOffset(
minX -
wr.
getSampleModelTranslateX(
),
minY -
wr.
getSampleModelTranslateY(
));
final int scanStride =
sppsm.
getScanlineStride(
);
final int adjust =
scanStride -
w;
int p =
offset;
int a =
0;
int i =
0;
int j =
0;
double x =
scaleX *
minX;
double y =
scaleY *
minY;
double norm =
0;
int pixel =
0;
int tmp;
double mult;
mult =
lightColor[0] >
lightColor[1]
? lightColor[0]
: lightColor[1];
mult =
mult >
lightColor[2]
? mult
: lightColor[2];
double scale =
255 /
mult;
pixel =
(int)
(lightColor[0] *
scale +
0.5);
tmp =
(int)
(lightColor[1] *
scale +
0.5);
pixel =
pixel <<
8 |
tmp;
tmp =
(int)
(lightColor[2] *
scale +
0.5);
pixel =
pixel <<
8 |
tmp;
mult *=
255 *
ks;
final double[][][] NA =
bumpMap.
getNormalArray(
minX,
minY,
w,
h);
if (light instanceof org.apache.batik.ext.awt.image.SpotLight) {
org.apache.batik.ext.awt.image.SpotLight slight =
(org.apache.batik.ext.awt.image.SpotLight)
light;
final double[][] LA =
new double[w][4];
for (i =
0;
i <
h;
i++) {
final double[][] NR =
NA[i];
slight.
getLightRow4(
x,
y +
i *
scaleY,
scaleX,
w,
NR,
LA);
for (j =
0;
j <
w;
j++) {
final double[] N =
NR[j];
final double[] L =
LA[j];
double vs =
L[3];
if (vs ==
0) {
a =
0;
}
else {
L[2] +=
1;
norm =
L[0] *
L[0] +
L[1] *
L[1] +
L[2] *
L[2];
norm =
java.lang.Math.
sqrt(
norm);
double dot =
N[0] *
L[0] +
N[1] *
L[1] +
N[2] *
L[2];
vs =
vs *
java.lang.Math.
pow(
dot /
norm,
specularExponent);
a =
(int)
(mult *
vs +
0.5);
if ((a &
-256) !=
0)
a =
(a &
-2147483648) !=
0
? 0
: 255;
}
pixels[p++] =
a <<
24 |
pixel;
}
p +=
adjust;
}
}
else
if (!light.
isConstant(
)) {
final double[][] LA =
new double[w][4];
for (i =
0;
i <
h;
i++) {
final double[][] NR =
NA[i];
light.
getLightRow(
x,
y +
i *
scaleY,
scaleX,
w,
NR,
LA);
for (j =
0;
j <
w;
j++) {
final double[] N =
NR[j];
final double[] L =
LA[j];
L[2] +=
1;
norm =
L[0] *
L[0] +
L[1] *
L[1] +
L[2] *
L[2];
norm =
java.lang.Math.
sqrt(
norm);
double dot =
N[0] *
L[0] +
N[1] *
L[1] +
N[2] *
L[2];
norm =
java.lang.Math.
pow(
dot /
norm,
specularExponent);
a =
(int)
(mult *
norm +
0.5);
if ((a &
-256) !=
0)
a =
(a &
-2147483648) !=
0
? 0
: 255;
pixels[p++] =
a <<
24 |
pixel;
}
p +=
adjust;
}
}
else {
final double[] L =
new double[3];
light.
getLight(
0,
0,
0,
L);
L[2] +=
1;
norm =
java.lang.Math.
sqrt(
L[0] *
L[0] +
L[1] *
L[1] +
L[2] *
L[2]);
if (norm >
0) {
L[0] /=
norm;
L[1] /=
norm;
L[2] /=
norm;
}
for (i =
0;
i <
h;
i++) {
final double[][] NR =
NA[i];
for (j =
0;
j <
w;
j++) {
final double[] N =
NR[j];
a =
(int)
(mult *
java.lang.Math.
pow(
N[0] *
L[0] +
N[1] *
L[1] +
N[2] *
L[2],
specularExponent) +
0.5);
if ((a &
-256) !=
0)
a =
(a &
-2147483648) !=
0
? 0
: 255;
pixels[p++] =
a <<
24 |
pixel;
}
p +=
adjust;
}
}
}
public static final java.lang.String jlc$CompilerVersion$jl7 =
"2.7.0";
public static final long jlc$SourceLastModified$jl7 =
1471028785000L;
public static final java.lang.String jlc$ClassType$jl7 =
("H4sIAAAAAAAAAL0Za2wcxXl8dvyKEz/yMnk4ieMQOcAd7waZBhLHIYZzYtkh" +
"FKfhMrc359t4b3ezO2tfAmkhFJFSlaY0BFpBfgUlIEhoVQRVAaVCLSBoK14F" +
"SoGqVCotRRBVpVVpS79vZvf2cY9gqe1JO7s7+33ffO/vm7mHPyQzbIt0MZ3H" +
"+R6T2fEBnQ9Ty2aZfo3a9laYSyn31NK/3PD+5stipH6MzM5Re0ihNtuoMi1j" +
"j5Elqm5zqivM3sxYBjGGLWYza5Jy1dDHyDzVHsybmqqofMjIMATYRq0kaaec" +
"W2ra4WzQJcDJkiRwkhCcJNZFP/clSYtimHt88M4AeH/gC0Lm/bVsTtqSu+gk" +
"TThc1RJJ1eZ9BYucYxrannHN4HFW4PFd2iWuCq5OXlKigu5HWz/59GCuTahg" +
"DtV1gwvx7BFmG9okyyRJqz87oLG8vZt8hdQmycwAMCc9SW/RBCyagEU9aX0o" +
"4H4W0518vyHE4R6lelNBhjhZHiZiUovmXTLDgmeg0Mhd2QUySLusKK2UskTE" +
"u89JHLrnhrYf1JLWMdKq6qPIjgJMcFhkDBTK8mlm2esyGZYZI+06GHuUWSrV" +
"1L2upTtsdVyn3AHze2rBScdklljT1xXYEWSzHIUbVlG8rHAo921GVqPjIOt8" +
"X1Yp4UacBwGbVWDMylLwOxelbkLVM5wsjWIUZey5BgAAtSHPeM4oLlWnU5gg" +
"HdJFNKqPJ0bB9fRxAJ1hgANanCysSBR1bVJlgo6zFHpkBG5YfgKoJqEIROFk" +
"XhRMUAIrLYxYKWCfDzdffueN+iY9RmqA5wxTNOR/JiB1RZBGWJZZDOJAIras" +
"Th6m8586ECMEgOdFgCXM4zedvvLcrlPPSZhFZWC2pHcxhaeUo+nZLy3u772s" +
"FtloNA1bReOHJBdRNux+6SuYkGHmFynix7j38dTIz66/+SH2QYw0D5J6xdCc" +
"PPhRu2LkTVVj1lVMZxblLDNImpie6RffB0kDPCdVncnZLdmszfggqdPEVL0h" +
"3kFFWSCBKmqGZ1XPGt6zSXlOPBdMQkgDXKQFrpVE/sSdEz2RM/IsQRWqq7qR" +
"GLYMlN9OQMZJg25ziTR4/UTCNhwLXDBhWOMJCn6QY+4HjEw6xRNqHsyfAHNk" +
"wCaZxKjJFEeD/KeO5zj42AjLxNHvzP/7igXUwZypmhowz+JoctAgrjYZGlBI" +
"KYec9QOnT6RekI6HweJqj5M+YCIumYgLJkQqBSbigom4x0S8DBOkpkasPReZ" +
"kW4BRp2A9AD5uaV3dMfVOw9014I/mlN1YBEE7Q7VqX4/h3iJP6Wc7Ji1d/k7" +
"FzwTI3VJ0kEV7lANy846axwSmjLhxnxLGiqYX0iWBQoJVkDLUFgG8lilguJS" +
"aTQmmYXznMwNUPDKHAZ0onKRKcs/OXXv1C3bvnp+jMTCtQOXnAFpD9GHMeMX" +
"M3tPNGeUo9t6+/ufnDy8z/CzR6gYeTW0BBNl6I56R1Q9KWX1MvpY6ql9PULt" +
"TZDdOYVohMTZFV0jlJz6vESPsjSCwFnDylMNP3k6buY5y5jyZ4TbtovnueAW" +
"MzFau+C6xg1fccev800cF0g3Rz+LSCEKyRdHzfvf+MUfLxLq9mpOa6BZGGW8" +
"L5DnkFiHyGjtvttutRgDuLfvHf7O3R/evl34LECsKLdgD479kN/AhKDm257b" +
"/ea77xx9Neb7OYdC76ShXyoUhcR50lxFSFjtbJ8fyJMaZA70mp5rdfBPNavS" +
"tMYwsP7ZuvKCx/58Z5v0Aw1mPDc698wE/Pmz1pObX7jhb12CTI2CddrXmQ8m" +
"k/8cn/I6y6J7kI/CLS8v+e6z9H4oI5C6bXUvE9m4UeigMRzrGE+jTtqGuFTz" +
"YIZJt7BdOLxTOdAz/HtZtM4qgyDh5h1PfHPb67teFEZuxMjHeZR7ViCuIUME" +
"PKxNKv8z+NXA9W+8UOk4IQtER79bpZYVy5RpFoDz3ip9ZViAxL6Odyfue/8R" +
"KUC0jEeA2YFDd3wWv/OQtJzsdVaUtBtBHNnvSHFwuAy5W15tFYGx8Q8n9/34" +
"+L7bJVcd4co9AI3pI7/614vxe3/7fJmCUJ8xwHdlqF6M3lzM3XPD5pEybfh6" +
"65MHO2o3QtoYJI2Oru522GAmSBS6NdtJB+zlt1FiIigd2oaTmtVgBpxYI7jo" +
"hDx3hiolipIHnPi8JW29kzeHqOnhdQgnR7gR8H1oImXzscbn5FLXBnjrCzxf" +
"wUlD2jA0RvWo3vB1oCCkuUR8O78IQQQEEd9GcVhpB0tB2PUCu4uUcvDVj2dt" +
"+/jp08J84e1JMPOBbNJ32nE4G31nQbRUb6J2DuAuPrX5y23aqU+B4hhQVKA9" +
"sbdYoKZCKE+60DMafv2TZ+bvfKmWxDaSZs2gmY1UlBzSBLme2TnoOwrmFVfK" +
"VDfVCEObEJWUCF8ygelmaflENpA3uUg9e59Y8MPLjx15R+RcU9JYVMw7i0M9" +
"htjk+mXuoVe+8Nqxbx+ekqFRJdAjeJ3/2KKl9//u7yUqF1W9TOxH8McSD9+3" +
"sH/tBwLfL6+I3VMobd+gRfFxL3wo/9dYd/1PY6RhjLQp7qZyG9UcLFpjsJGy" +
"vZ0mbDxD38ObIrkD6Cu2D4ujySewbLSwBwO6joeC16/l2IWT+XD1umWuN1rL" +
"a4h4kPlllRhX43CeVzobTEudhFQcqZ0zqxDlJDZhF0N1jnjcikNWErmuoiem" +
"wpz3wBV3F4lX4FxafBUOuVIWK2FzKEduAz1QMA0dXLQcw8Y0Ge6E6yJ3yYsq" +
"MOxUZbgSNiczNEyq+HJVhMvJaXK5GK417jprKnB5U1UuK2Fj3pVJHF8HI3zu" +
"myaf3XCtdVdaW4HPW6vyWQkbyqqtUI19qZzRv/Y/YPMOHG7zlr2+3LLfmOay" +
"y+Dqd5ftr7Dst6pqpxI2J02aykfYuNueXxPh9OA0OV0E1yZ3rU0VOD1cldNK" +
"2KBQPKOgIm8PRdi8pwqbBX+5c4rLiV89iRxcBJYLFDaC1XtJpbMl0fUd3X/o" +
"SGbLAxfE3J7iStArN8zzNDbJtACpGFIK1cghcZrmF5y3Z9/13o96xtdPZwuO" +
"c11n2GTj+1Kodqsrl90oK8/u/9PCrWtzO6exm14a0VKU5INDDz9/1dnKXTFx" +
"dCgrYcmRYxipL1z/mi3GHUsPt7ArinZd6EWp5tpVizqh7zkRlyjuEyuhRnpI" +
"rzvHd2hhlxRbWNnqXmepHLd9I9Tm0Msh1CNVutDv43Cck0Y8pN9AOcX3E76H" +
"P3imQKze2eHEDtluHw1v/1cLIeVv9/SVVQm1vLKEUILqk1V08TQOj0OBGWc6" +
"7gfKNf11k4aa8dXzxH9DPQVO5pQ5a8O2uLPkDwB5aK2cONLauODIta+LeC0e" +
"LLdA5GUdTQs2boHnetNiWVXI2iLbOLnpep6TVZ9zBwWe4j0KcZ6TFF7kpKs6" +
"BeguxD2I9UtOOithcVILYxD6ZU7mloMGSBiDkK9B7xWFhPXFPQj3BifNPhxk" +
"evkQBHkLqAMIPv6muG1c83m3m+vSNrcgmW5VNZYBkxZqwvm96EfzzuRHgZKw" +
"IpRKxR9JXtpz5F9JKeXkkas333j60gfkEZmi0b17kcpM2JnL07pi6lxekZpH" +
"q35T76ezH21a6RWZdsmwH6OLAjG0A6LNRM9dGDk/snuKx0hvHr386Z8fqH8Z" +
"NkbbSQ0F799eumMpmA7UrO3J0hMIKDPiYKuv93t71p6b/egtsSck8sRicWX4" +
"lPLqsR2v3NV5tCtGZg6CO4KRCmIrtWEPxvukNUZmqfZAAVgEKirVQscbszHI" +
"KP7FJPTiqnNWcRYPWDnpLj3cKT2Whv3zFLPWG46eEcUEypw/E/qHy6s+jmlG" +
"EPyZwAHYBpms0Brgt6nkkGl6Z19N75ki3QyUP67A8SPxiMPH/wHd7vnKZB4A" +
"AA==");
public static final java.lang.String jlc$CompilerVersion$jl5 =
"2.7.0";
public static final long jlc$SourceLastModified$jl5 =
1471028785000L;
public static final java.lang.String jlc$ClassType$jl5 =
("H4sIAAAAAAAAAL16e+wr113n3F9yH7lNc2/SNs2GJk3SGyAx/Mbjscce0oZ6" +
"PLbH8/CMx/bYHh7peN6ep+dhjwcCbbVsq61UKjYtRYL8sSraXVRotQsCtAsK" +
"IKAIhFTEG9ECAi27bLX0j2UR3V32zPj3zr3JveJhaY7PnPme7/l8z/d7vt/z" +
"+uxXoMtxBFXCwN2ZbpAc6llyuHIbh8ku1ONDmm0IShTrWsdV4ngCyl5Sn/n8" +
"jb/52iesmwfQFRl6m+L7QaIkduDHoh4H7kbXWOjGaWnX1b04gW6yK2WjwGli" +
"uzBrx8kLLPSWM1UT6BZ7DAEGEGAAAS4hwO1TKlDprbqfep2ihuIn8Rr6HugS" +
"C10J1QJeAj19nkmoRIp3xEYoJQAcrhXvEhCqrJxF0FMnsu9lfp3An6zAr/zg" +
"d978j/dBN2Tohu2PCzgqAJGARmToQU/3lnoUtzVN12ToYV/XtbEe2Ypr5yVu" +
"GXoktk1fSdJIP+mkojAN9ahs87TnHlQL2aJUTYLoRDzD1l3t+O2y4SomkPXR" +
"U1n3EvaKciDgdRsAiwxF1Y+r3O/YvpZA775Y40TGWwwgAFWvenpiBSdN3e8r" +
"oAB6ZK87V/FNeJxEtm8C0stBClpJoMfvyLTo61BRHcXUX0qgxy7SCftPgOqB" +
"siOKKgn0jotkJSegpccvaOmMfr4yfO/Hv8un/IMSs6arboH/Gqj05IVKom7o" +
"ke6r+r7ig8+zn1Ie/bmPHkAQIH7HBeI9zU9/91ff/01PvvaFPc3X3YaGX650" +
"NXlJ/czyoS++q/Mcfl8B41oYxHah/HOSl+YvHH15IQvByHv0hGPx8fD442vi" +
"ryw++GP6Xx1A1wfQFTVwUw/Y0cNq4IW2q0d93dcjJdG1AfSA7mud8vsAugry" +
"rO3r+1LeMGI9GUD3u2XRlaB8B11kABZFF10Feds3guN8qCRWmc9CCIKuggd6" +
"EDzPQvtf+Z9APmwFng4rquLbfgALUVDIH8O6nyxB31rwEli9A8dBGgEThIPI" +
"hBVgB5Z+9KEYmco2gW0PqB8G6tCATjR4HOpq6ioRa5tWAmxM1LXDwu7Cf/YW" +
"s6IPbm4vXQLqeddF5+CCcUUFLuDwkvpKSnS/+hMv/frByWA56r0EegGAONyD" +
"OCxBlI4VgDgsQRwegzi8DQjo0qWy7bcXYPZmAZTqAPcAHOeDz42/g/7AR5+5" +
"D9hjuL0faKQghe/svzunDmVQuk0VWDX02qe3H5K+t3oAHZx3xIUAoOh6UV0o" +
"3OeJm7x1cQDeju+Nj/zl33zuUy8Hp0PxnGc/8hCvr1mM8GcudnUUqLoGfOYp" +
"++efUn7qpZ97+dYBdD9wG8BVJgowbeCFnrzYxrmR/sKx1yxkuQwENoLIU9zi" +
"07Gru55YUbA9LSlt4KEy/zDo47cUpv8keJijsVD+F1/fFhbp2/c2UyjtghSl" +
"V37fOPyR3//N/4aW3X3swG+cCYljPXnhjNMomN0o3cPDpzYwiXQd0P3xp4V/" +
"88mvfOTbSgMAFO+5XYO3irQDnAVQIejm7/vC+g++/KXP/PbBqdEkIGqmS9dW" +
"sxMhi3Lo+hsICVr7+lM8wOm4YBgWVnNr6nuBZhu2snT1wkr/z41nkZ/6Hx+/" +
"ubcDF5Qcm9E3vTmD0/J/QUAf/PXv/N9PlmwuqUXQO+2zU7K9J33bKed2FCm7" +
"Akf2od964od+VfkR4JOBH4ztXC9d27WyD66BSs+9wcQnsj2gjc1RsIBffuTL" +
"zg//5Y/vA8HFyHKBWP/oK//67w8//srBmfD7ntdFwLN19iG4NKO37jXy9+B3" +
"CTz/r3gKTRQFexf8SOcoDjx1EgjCMAPiPP1GsMomev/1cy//53//8kf2Yjxy" +
"Pvp0weTqx3/3//7G4af/5Ndu49SuaAEwmfIdLTG+A4zuN3F0pV87Jobv1isS" +
"qRdySnhc75FStQWdCDQO5iFHIE6RVIukvrdlLIGuLoPA1RW/7E+4LH2+TA+L" +
"Diy1D5XfyCJ5d3zWvZ03hDPTz5fUT/z2X79V+uuf/2rZN+fnr2dHM0C+1+RD" +
"RfJUoZh3XvTllBJbgK7+2vDbb7qvfQ1wlAFHFcSvmI9AJ2Tnxv4R9eWrf/gL" +
"v/ToB754H3TQg667gaL1lNKNQg8A/6XHFghMWfit798P3+01kNwsRYVeJ/y+" +
"qx4r397yxgOhV0w/T53wY3/Hu8sP/9nfvq4Tythxm7Fxob4Mf/aHH++8+Fdl" +
"/VMnXtR+Mnt9xAVT9dO6tR/z/tfBM1d++QC6KkM31aN1gKS4aeEaZTD3jY8X" +
"B2CtcO77+XnsftL2wkmQetfFwXmm2Yvh43RQgHxBXeSvX4gYxcQJehQ8zx05" +
"0+cuRoxLUJkRyypPl+mtIvmGYwd9NYzsDRjbJed6Ah048YnV3yyz3SIZ71VJ" +
"3VHt3HlQt8BzeATq8A6g5DuAKrLSMZ6b8dHcpZuFgQ8mY7dD9233iO4x8KBH" +
"6NA7oFPuBt1lt/A8xcu3XIC0vEdI7wJP6whS6w6QrLuBdHW5d2vF63svgLLv" +
"EdQz4HnxCNSLdwAV3A2oK7GquPr8droL/wkwbe4e0+J2mLb3iOkp8HSOMHXu" +
"gOnlu8H0gGsnom4ezc5evADre+4R1teBhzqCRd0B1r+8q64qFndK6T3ffwHT" +
"970pppJHdgn4msu1w+ZhGUQ/dvtW7yuy31ioptz9ADUM21fcYxjvXLnqreNZ" +
"iaRHMeinWyu3eRzBb5axrHC9h/sthAtY63eNFcSqh06ZsYFvvvCxP//Eb3z/" +
"e74MAgoNXd4Uzh7EkTMtDtNig+ZfffaTT7zllT/5WDkJBt0offDZ/1kudz/1" +
"RhIXyfcXySeORX28EHVcrjVZJU64ct6qayfSXpiK3O8G/wBpkxvvp+rxoH38" +
"Y6uyUtuq2dxtaZsd083hHec7dVvnRrza1ppbRSYslhos5HyROFaPMSwuUtEG" +
"ntSXqJ7ztcRoe6Cc7o1dZVEleiFhmFN30LUCaSRKbUXqsGMiYJB6bxz011In" +
"SESRkEJJCsdNfCNvjJq6wM21jtB8M25WUNQweHjjNT1K2I3y5SCpcjJKVURs" +
"UjO6hD/CJ7uaIhsBquCgwfHOR5EhA6MCWWnEiR1SGJdzDVGv2tYwSQPORlar" +
"Rtdde418bW84NM4WxKrfZ2eLXGnQO0QjqR2ZS1S8W3rrdWBwqwHXnizEddVR" +
"FF2d1SKlPstHtErSji1uHauj0kO5J8CqO14ktkclrRZXb+sUbHaqrAcvpXiS" +
"rMdpxXQmE0tFRJpGdBknFqm6yCIwuaGGdao3qws9rWbP0s66wc9dxjbTBjXL" +
"4Qbe76QTxTLJRELM7SZrEj2vjwfObifS67zVDNh+ayMnLUsbeTt12+Y6Kj6e" +
"wSLR2Slmd4or82pQp+qzagNpbXZUty5iru4OCWtlyZQt29Ng480nLGl6ulnl" +
"LK02mu7GbBozTG0aO5Nu2sJpio18K1oYCM3OOI1ZY2thsDJpTu1ZDklMmJbn" +
"ejU93vXlhTyoVLE+lU5n40hC2FoaTpJYk4BS2lSu1yJirGqO664mSDZfdGfj" +
"nBpMl5Lbb0VUO8BrSF9aC6sBn7TmyCKsTxWV2PaX0ozkdi675TPdXTqsxDW2" +
"8Wo2mMr6rkGY7XYypgSdqwesO/OnDdOkNLo3ZNYCXV0SuCFmbRqxzPZQ8Tu7" +
"eEyIyFKiXTPA8h4VOkS/sTBMJqDX3YHI95y5JXLT9iBiF9mCmXUMMtcMI9WH" +
"FXuBi9663dhmkyEvwrRNIKJM9Ge0LJM8DWoo8cTCvFajhXU7XNfktZ7ZmXP1" +
"XNc2G1aNXEEYy1ZPnnVqIaVmlqJPg4ovszs0bTZrcS9xg2EbWYo6T9GEJg7T" +
"rIKN04XTp7zezrez5gptaZNBjmFwZUzVRottlWzQWKZ1VEGwxLTGOhNJWiGu" +
"xMnZ0mXJ4QD4Sh0TDYOoOqTQ0SRfBe1pXpwbprnWhK7EVi3U6fVm4w7BeOu+" +
"jMyFfoLl47nLC4TGjRyTnDOjXhRKXTgea928JnLwIB6Js/W6uRb77IJzhzg/" +
"4mTarDVyeyLW4emkM7S27JwkrBnP0R0fGy0qdWrV3WKZOFyDcWW0qaGz7Shy" +
"xqzoXlcnYUbnG/mqXmuv2GxIbXIBbtrmfLqVd6FnBdu8Qgdq0jaj1ULuu8SA" +
"WegqPuL9CSbqzgCjtjq9XjW4yqIzSL2FydLOaE2Ml7YZePWsOm6RBO+EjhIL" +
"oi47szohhrU23iYbqSKhGmdI/BavIvUB7LlDZEF0u81RU1rP67CF2rSAzdQm" +
"bSMa7DR7+XYyQCW66nSlptse7lp1TMm2Y2/FWpmfsX17vZhX7RkxCmjJIdlp" +
"z+y3XNs1U3qsTEaet5jnPrcdTgWSodpyNfAZkVFjmJ/PN0gHXW78sLLiJp1k" +
"xM/9di8k8T7F6dycQxNh2Af2gidYBU4Nn9y1criTi5i50CezKkEMXWzQwERk" +
"hDOzOcJtwgW2dnFhyiYTmdT4hRRY3ETuSdWVS+fYpjsW4tW4s+0BTi43FFAH" +
"W6aLxq6x2sn1yTIJNn6qt2dc3lPSSgfLTMQA68ZNq1pVe1UTFfMKO+50mZ2o" +
"UbmxMSrc1GAzdo17Ia9ghNzvz1psg/Sdnk3t+qtkkyRpIppkyhobymjyqAjr" +
"Gxets91OzLCaSdabuDOE2xZDerVGcwnrSrOZZfhQXzb5hdZpYmNrvgumlio2" +
"qm7WG/dWyZJuGTuaU+R2s+qFjUgzCGGobMYJt9jGQlNON0wngxstubGptreI" +
"J5Aqhre2XVjwciTkl/Pmyloitc5kUOtoWjT3Ri3PgVuqDw+wHUY3nQEM4lRr" +
"U9GxHKfqwaDRwZbz6aaLe/WpbpucmEf9bmUFfHs/7U3yxUCmkyah8Ww24bV2" +
"DlOJnHD1tbkjrYaFCAYlLLFmove6cppxK0qXxaZkd9LBlOsKTDZkNq28Mpy3" +
"8VmlNeWd+mCUdMUmvgzlhbRriGEvIHPUDnFZstsZi/HaDngluCUy00511dXb" +
"tUWP1NDtbAPzo4TOgc9VpgmRENTQ34yp3jZt7xozpJH0Fv2sNWr5OIzWK2xz" +
"SUuqVlcDvD1Aw0ETxpD6JtNRuGnQXmdKt7ItpbnrHsahbs6hc4FshN3d0rAw" +
"rMFRfC1AR0mwoAc1PkobtVq/7Y2JMTbUEpqo5G6C9OyBbWq1QJl4iWQSYbYY" +
"NFeBRWaoZQeuHQ4oX7Bb9KyGO7lOrXkfhDHTF5um2KKQYODN81hd+o0eOyf8" +
"VdTJM2M7dcnaql0VN7MA3RBI0Ok46VRs8c3WYDQadbsa3lclKySqCVETpp20" +
"nk7VDSmtalpSgVdhtUW36mBuwQk8sRzSaM3v1vso4o+W4nSJ0TUybadCNG/s" +
"aqiynlaIumWNJKaNx0ttETByh+lWsCrJKcamNpEry43BeLOMVMZyXDO9BTJ1" +
"iXxMsJ5em/gBv428nmQwEmlInS6/7NKzaafX2pm66ymG2x2GbTSdmrjewBct" +
"TmBXGdIQK6I6xemFxG2bdpXDrWTlVLx5Gkh6pTVcZ8usojvrnkhr7ZVOo3CN" +
"YVwchtPmbrruITN8wmdUi1PHJF5BYwpOiC1rsFgFuC0uWGoVUzR6GYtuAxjX" +
"FhqMCAtMtFbsKGyu5V0fn6psL1zFdH+3kaveksxItMUvB5FDYp20RtbT1W6s" +
"b5fseEtseWwV6B0Eg93aYDapzEkk9WbpEIlYpW7VHcF1XdGa19GOLuXBEswk" +
"NKs3UtdyNV9npEuTIBhWh8jKX6m2M5x1Iy8NbN3bhjm6JSS0V3fn9V6mGMSU" +
"T6XBjKn1cqarpe0cGXHtqjZnR+q2taj2dayL7Wh0t4jXHJ9N5aU5HtpqPuzu" +
"1hWKlixuQytzptFn6khzFUaMTzSmyDQF/FZoKNFUr0UN0Dz1doqBzjuJJmnK" +
"rE4JM2yzm42c5W69TqYDBF/LubiBF/BC4Hiq38zdqFZBWdbweGW3q5BrrWEk" +
"UZOMEyxch9mgRldrys4xFukw1eeZYOF8u8pL1S6yk9FoWpV4ElFdbcjUGGIk" +
"MLw58FqCqNmtcLteEvNKQ61HrC21cFvMVIJesD1S6SDzhA6XnFs1pho6h4Nx" +
"f8m2M6OL0k17nLSjYSvPh+SSTtqdsN8bMIhqWqoMbLCxQ2UcRtAAx7JEE+Rt" +
"yqsI4tf6k1UFYQJtHUcuXg2YFpzCuNCJZknOY3rmIXWlKjHTxmBIkjlgoPnM" +
"fNIDUw4zWqieuMjskEVy2LPRPjWNhaTZBgsvWcO6s7CRhJKdr61m7ojubpV2" +
"d6kl+uEgyjeUVrMsNxOXs6G/nnt6SLEaPsAnXpWLLaQzlNKE3AC7UZ3qohUO" +
"8TavztFuE6ME1PZGDJhG6lSXTNyU2iIbGFHZgS5tcHgsSSMP2bBMdzpg1w4i" +
"VVuTEb+q8mCSpmJN02CGBoI4dUVpafM8o3BSGEl8Ixw1lBZfS1nBIbdEQ2Fq" +
"Kj9klZQnB4lSYfVOVWdZrd3oT7XJKK4tA8rXk6E9k+aDms0uedYP9RCbSDKe" +
"E9uZXl9VGVXGJr1e0wmZGCN0M83I2gCfJjxvJ5YqDcDUksTkadNzA64/JmzS" +
"YXCimc16ljDvCaMVStjGULAyR984I4Jy2HWbGwgbzEv7iNpCPdSrbMbDSDW9" +
"WUMaygvCyeT1duPhWNfI81SkTJnZDkKRyUScnidh3ujhNKPPHTAFQlF0hVVN" +
"w+nKnl1dIk1HDbka7bPVZmhjbqY7ckit0cakiek5VUMUTJzJWuxtKYxn26t+" +
"tY2xQ5HDtT7pwLGfMlnV2lAR2sLklrGmWvLQWS7Ho2qvieN66nGh125OIx6l" +
"qxY3YEjBXjDpBkeTJhJiIM6bSTxWnVYs2upsXncFdh2LtQ06lBpJJ+nLJtbh" +
"64zY8QZRMusK2SZ1hlPZWxtyuy2ZXcaOpBEIEDFYRTBCs0cLE3vtD2equBBm" +
"pB+yK1RlJrWZtUHzHivM+nVM76rT7i7cwl14Te2wuLLy3H5X2MnbNrUgQi+u" +
"EpGZYL7j9F1MRvBhs+HY6Gg3FbBmuzUWMpsTKBgExebGZ2SiDhbM73tfsZT+" +
"t/e2xH+43M04uR0BVvbFhx+4h1X8/tPTRfLsyc5P+bsCXThRP7Pzc2ZPHipO" +
"DZ6406WH8ijnMx9+5VWN/1Hk4Ogso5lADyRB+M2uvtHdM6wOAKfn77y9z5V3" +
"Pk732H/1w//98cmL1gfu4Wz43RdwXmT5H7jP/lr/69UfOIDuO9lxf91tlPOV" +
"Xji/z3490pM08ifndtufOOnZx4+3H92jnnUv7qmd6u72G2rfuNf9haOiS0cn" +
"7Ee7WE+cnEPtz6tmkZ0UJ5aiEid6VHL4mTc4bPovRfKfEuiaGoQ7UkmU4v1n" +
"Tw3qJ99sW+gsw7Lg8+dPqJ8vhd7/1v+oPVAiLQl+5Q0E/EKR/EICXTV1vzip" +
"u+1+2CawtVOZf/FeZM4S6G23uTBRnP4+9rpbXPubR+pPvHrj2jtfnf5eeWfg" +
"5HbQAyx0zUhd9+xRzpn8lTDSDbuU6YH9wU5Y/v1WAn3DXZ5hAjUfZ0s5vrjn" +
"8DsJ9OQbc0igy+X/2Vq/n0CP3alWAt0H0rPUf5RAb78dNaAE6VnKLyXQzYuU" +
"oP3y/yzdnybQ9VO6BLqyz5wl+XPAHZAU2b84Obht3e2Bb3sZJ5GiJhPb1TWg" +
"0uzSeV94Yi+PvJm9nHGf7znn9MrbgMcOKt3fB3xJ/dyr9PC7vor96P5qhuoq" +
"eV5wucZCV/e3RE6c3NN35HbM6wr13Nce+vwDzx475If2gE8H3hls7779PYiu" +
"FyblzYX8Z975k+/9d69+qdyt/v958qPepikAAA==");
}
| [
"[email protected]"
]
| |
256dddd817bf27234f95535b7dffad21265ec59c | 09ff7bf81f63980a42cb5dbf396d872162725f65 | /TrainerApp/src/com/trainerapp/ActivitySlideDescripcion.java | 4d8173b0f7e937d5d20109d7bc2fc7b0e814db22 | []
| no_license | jgacitua/TrainerAppFinal | a1365ad0a36d5dc95e6f9f0247c1ba2c1edef165 | 2dc53770befc2d624c8252955e0352b19fe71d82 | refs/heads/master | 2020-04-30T06:27:17.177272 | 2014-07-06T13:11:32 | 2014-07-06T13:11:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,362 | java | package com.trainerapp;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
public class ActivitySlideDescripcion extends FragmentActivity {
private MyPagerAdapter adapterViewPager;
private static Bundle b;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_screen_slide);
ViewPager vpPager = (ViewPager) findViewById(R.id.vpPager);
adapterViewPager = new MyPagerAdapter(getSupportFragmentManager());
vpPager.setPageTransformer(true, new ZoomOutPageTransformer());
vpPager.setAdapter(adapterViewPager);
Intent iin= getIntent();
b = iin.getExtras();
}
public static class MyPagerAdapter extends FragmentPagerAdapter {
private static int NUM_ITEMS = 3;
public MyPagerAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
}
// Returns total number of pages
@Override
public int getCount() {
return NUM_ITEMS;
}
// Returns the fragment to display for that page
@Override
public Fragment getItem(int position) {
switch (position) {
case 0: // Fragment # 0 - This will show FirstFragment
return FragmentInicio.newInstance(0, "Page # 1",b.getString("ID"),b.getString("DIA"));
case 1: // Fragment # 0 - This will show FirstFragment different title
return FragmentFinal.newInstance(1, "Page # 2",b.getString("ID"),b.getString("DIA"));
case 2: // Fragment # 1 - This will show SecondFragment
return FragmentDescripcion.newInstance(2, "Page # 3",b.getString("ID"),b.getString("DIA"));
default:
return null;
}
}
// Returns the page title for the top indicator
@Override
public CharSequence getPageTitle(int position) {
return "Pagina " + position;
}
}
} | [
"Jorge@Mohami"
]
| Jorge@Mohami |
47cb72d8172cb2b650399237dc53b28263207b5a | 62915153bbba21a0aed0f43a91e6ff30aecf54f0 | /release/v1/src/main/java/uk/ac/standrews/cs/cs3099/useri/risk/clients/AI/evolve/genetic/Generation.java | 8b2196e6dcb0aa9f2bd2c72c8c5a7af34d6ce71d | []
| no_license | AlexWilton/Risk-World-Domination-Game | 934b4213e0200ae9f77edd905d1c0f8d09bba32e | 4d34bf9a2f92f8d83648c6964d2025819a7b89b3 | refs/heads/master | 2021-09-22T10:29:34.435024 | 2018-09-08T10:28:52 | 2018-09-08T10:28:52 | 28,974,470 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,518 | java | package uk.ac.standrews.cs.cs3099.useri.risk.clients.AI.evolve.genetic;
import uk.ac.standrews.cs.cs3099.useri.risk.clients.AI.evolve.CommandRaterAIClient;
import uk.ac.standrews.cs.cs3099.useri.risk.clients.AI.evolve.CommandRaterFitnessTester;
import uk.ac.standrews.cs.cs3099.useri.risk.clients.AI.evolve.RatedCommand;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
/**
* holds one generation of the evolution and can create fillial generations
* has a function for storing to file
*
*/
/**
* @author bs44
*
*/
public class Generation {
private LinkedList<Genome> individuals;
private FitnessTester fitnessTester;
private Initialiser initialiser;
private Crosser crosser;
private int generationNumber;
/**
* writes this generation to a file
*/
public void writeToFile(String file) throws IOException {
PrintWriter out = new PrintWriter(new FileWriter(file));
out.println(generationNumber);
for (Genome g : individuals) {
out.println(g.toInformationString());
}
out.close();
}
/**
* Constructor, takes the testers for this generation, inits it from a file
*/
public Generation(String file, FitnessTester fitnessTester,
Initialiser initialiser, Crosser crosser)
throws InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException, IOException {
this.crosser = crosser;
this.initialiser = initialiser;
this.fitnessTester = fitnessTester;
individuals = new LinkedList<Genome>();
BufferedReader in = new BufferedReader(new FileReader(file));
String numberBuffer = in.readLine();
generationNumber = Integer.parseInt(numberBuffer);
while (in.ready()) {
Genome g = new Genome();
g.initFromString(in.readLine());
individuals.add(g);
}
in.close();
}
/**
* Constructor, creates an empty generation
*/
public Generation(FitnessTester fitnessTester, Initialiser initialiser,
Crosser crosser) {
this.crosser = crosser;
this.initialiser = initialiser;
this.fitnessTester = fitnessTester;
generationNumber = 0;
individuals = new LinkedList<Genome>();
}
/**
* Constructor, creates an empty generation and adds the initially contained genome
*/
public Generation(FitnessTester fitnessTester, Initialiser initialiser,
Crosser crosser, ArrayList<Genome> initialGenomes) {
this.crosser = crosser;
this.initialiser = initialiser;
this.fitnessTester = fitnessTester;
generationNumber = 0;
individuals = new LinkedList<>();
individuals.addAll(initialGenomes);
}
/**
* initialises a generation at random
*/
public void randomInit(int populationSize) throws InstantiationException,
IllegalAccessException, IllegalArgumentException,
InvocationTargetException, NoSuchMethodException, SecurityException {
for (int i = individuals.size(); i < populationSize; i++) {
Genome temp = new Genome();
temp.randomValidInitialisation(initialiser);
individuals.add(temp);
}
((CommandRaterFitnessTester) fitnessTester).makeAllClients(individuals);
sortForFitness();
}
/**
* Creates an offspring genration
*/
public Generation createFillialGeneration() throws InstantiationException,
IllegalAccessException, IllegalArgumentException,
InvocationTargetException, NoSuchMethodException, SecurityException {
LinkedList<Genome> newIndividuals = new LinkedList<Genome>();
//add origin
newIndividuals.add((new CommandRaterAIClient()).toWeightSet());
// Add fresh blood
for (int i = 1; i < individuals.size() * EvolutionConstants.FRESH_BLOOD; i++) {
Genome temp = new Genome();
temp.randomValidInitialisation(initialiser);
newIndividuals.add(temp);
}
// preserve Elite
newIndividuals
.addAll(individuals.subList(
0,
(int) (individuals.size() * EvolutionConstants.ELITE_PRESERVED)));
// mutate Elite
LinkedList<Genome> mutants = new LinkedList<Genome>();
mutants.addAll(individuals.subList(0,
(int) (individuals.size() * EvolutionConstants.MUTATANT_ELITE)));
for (int i = 0; i < mutants.size(); i++) {
mutants.set(i, mutants.get(i).clone());
mutants.get(i).mutate();
}
newIndividuals.addAll(mutants);
// Deduce Parent subgroup
ArrayList<Genome> parents = new ArrayList<Genome>(individuals.subList(
0, (int) (individuals.size() * EvolutionConstants.PARENT_RATE)));
// Children mutants
LinkedList<Genome> childrenMutants = new LinkedList<Genome>();
for (int i = 0; i < (int) (individuals.size() * EvolutionConstants.MUTATANT_CHILDREN); i++) {
Genome child = crosser.cross(
parents.get((int) (Math.random() * parents.size())),
parents.get((int) (Math.random() * parents.size())));
child.mutate();
childrenMutants.add(child);
}
newIndividuals.addAll(childrenMutants);
// Add children
while (newIndividuals.size() < individuals.size()) {
Genome child = crosser.cross(
parents.get((int) (Math.random() * parents.size())),
parents.get((int) (Math.random() * parents.size())));
newIndividuals.add(child);
}
Generation fillial = new Generation(this.fitnessTester,
this.initialiser, this.crosser);
fillial.setIndividuals(newIndividuals);
fillial.sortForFitness();
fillial.generationNumber = generationNumber + 1;
return fillial;
}
public Genome getFittestIndividuum() {
return individuals.getFirst();
}
public void setIndividuals(LinkedList<Genome> individuals) {
this.individuals = individuals;
}
/**
* calculates fitness of individuals and sorts them
*/
private void sortForFitness() throws InstantiationException,
IllegalAccessException, IllegalArgumentException,
InvocationTargetException, NoSuchMethodException, SecurityException {
((CommandRaterFitnessTester) fitnessTester).makeAllClients(individuals);
for (Genome g : individuals)
g.calculateFitness(fitnessTester);
Comparator<Genome> comp = new FitnessComparator();
Collections.sort(individuals, comp);
}
public int getGenerationNumber() {
return this.generationNumber;
}
public LinkedList<Genome> getAllGenomes() {
return individuals;
}
}
| [
"[email protected]"
]
| |
05a54ce8169f61f29c0d04da39c4ffef39757336 | 705db8448540f47493846a58f8cd93b8fffecf8e | /app/src/main/java/com/example/youtubebg/Playlists/Views/Fragment_Playlists.java | a28e0f95105ffab5c447e234d52c813b8a3e0c0a | []
| no_license | Miltentt/YoutubeBG | 1f2e61cda8d6c35b2d4ed148b01e889e168f7e62 | 18832fc8947af7b4e9747695008aa68fa2a9e6c5 | refs/heads/master | 2021-05-19T09:21:33.444954 | 2020-08-20T14:26:29 | 2020-08-20T14:26:29 | 251,626,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,415 | java | package com.example.youtubebg.Playlists.Views;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import io.reactivex.FlowableSubscriber;
import com.example.youtubebg.Models.Playlist_card;
import com.example.youtubebg.Playlists.ViewModels.Playlists_SharedViewModel;
import com.example.youtubebg.R;
import com.example.youtubebg.Playlists.Adapters.Playlist_Adapter;
import java.util.LinkedList;
import java.util.List;
public class Fragment_Playlists extends Fragment implements Playlist_Adapter.callBack {
RecyclerView recyclerView;
private Playlists_SharedViewModel playlists_sharedViewModel;
private Playlist_Adapter adapter;
private FlowableSubscriber observer;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.playlists,container,false);
playlists_sharedViewModel = ViewModelProviders.of(getActivity()).get(Playlists_SharedViewModel.class);
initObserver();
adapter = new Playlist_Adapter(new LinkedList<Playlist_card>(), Fragment_Playlists.this);
initRecycler(v);
initObserver();
return v;
}
public void initRecycler(View v) {
recyclerView = v.findViewById(R.id.Youtube_playlists);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(adapter);
}
@Override
public void openPlaylist(int id) {
Intent i = new Intent(getContext(), Play_Playlist_Activity.class);
i.putExtra("id", id);
startActivity(i);
}
private void initObserver() {
playlists_sharedViewModel.returnPlaylists().observe(this, new Observer<List<Playlist_card>>() {
@Override
public void onChanged(List<Playlist_card> playlist_cards) {
adapter.update(playlist_cards);
}
});
}
} | [
"[email protected]"
]
| |
46d7bca2feb2c00e0a147861f1d8e462390d46bf | a5ec31338b172b8ddeb123d4ea3e9e3135c556a4 | /app/src/main/java/com/example/manhngo/ms/models/MSRepo.java | 2db2caee3db803bdba9c78eedcb8bd8ebfff7ef8 | []
| no_license | manhngodh/ms | 3853991a735a034ed522afa63d7b4dcabc479964 | 88a51d7d4f86f48c48491be9421025b0e93a8d85 | refs/heads/master | 2021-07-13T05:24:38.779198 | 2017-10-12T16:19:38 | 2017-10-12T16:19:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,204 | java | //package com.example.manhngo.ms.models;
//
//import android.content.ContentValues;
//import android.content.Context;
//import android.database.Cursor;
//import android.database.sqlite.SQLiteDatabase;
//
//import com.example.manhngo.ms.Player;
//import com.example.manhngo.ms.Util.DBUtitls;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by manhngo on 9/14/17.
// */
//
//public class MSRepo {
// private static MSRepo ourInstance;
// private MSSqLiteHelper msSqLiteHelper;
//
// private MSRepo(Context context) {
// msSqLiteHelper = new MSSqLiteHelper(context);
// }
//
// public static MSRepo getInstance(Context context) {
// return (ourInstance == null) ? new MSRepo(context) : ourInstance;
// }
//
// public List<Player> getPlayers() {
// List<Player> players = new ArrayList<>();
// SQLiteDatabase database = msSqLiteHelper.getReadableDatabase();
// String[] columns = {
// DBUtitls.PLAYER_COLUMN_ID,
// DBUtitls.PLAYER_COLUMN_NAME
// };
// Cursor cursor = database.query(DBUtitls.PLAYER_TABLE_NAME, columns, null, null, null, null, null);
// if (cursor != null && cursor.getCount() > 0) {
// while (cursor.moveToNext()) {
// String playerId = cursor.getString(cursor.getColumnIndexOrThrow(DBUtitls.PLAYER_COLUMN_ID));
// String playerName = cursor.getString(cursor.getColumnIndexOrThrow(DBUtitls.PLAYER_COLUMN_NAME));
//
// players.add(new Player(playerId, playerName));
// }
// }
// return players;
// }
//
// public void insertPlayer(Player player) {
// SQLiteDatabase database = msSqLiteHelper.getWritableDatabase();
// ContentValues contentValues = new ContentValues();
// contentValues.put(DBUtitls.PLAYER_COLUMN_ID, player.getId());
// contentValues.put(DBUtitls.PLAYER_COLUMN_NAME, player.getName());
// String selections = DBUtitls.PLAYER_COLUMN_ID + " = ?";
// String[] selectionArgs = {player.getId()};
// database.update(DBUtitls.PLAYER_TABLE_NAME, contentValues, selections, selectionArgs);
// }
//
//
//}
| [
"[email protected]"
]
| |
8079ab33339acb911df92e14e0373e0d066388da | 4db13d8b3fc8307678dc9012ae256ea39210b6c0 | /chapter_002/src/main/java/ru/job4j/coffee/CoffeeMachine.java | f9864336eb2afcb509f266ef3f128518adc3f709 | [
"Apache-2.0"
]
| permissive | alexanderpetrenko/job4j | 01b203482ebc92ecfaf962f18a98d1252d29e4cf | 052d6639d0311f2cd935dd2f5091c5d2ded72a3e | refs/heads/master | 2021-06-27T05:16:30.852124 | 2020-10-27T09:11:49 | 2020-10-27T09:11:49 | 166,085,575 | 0 | 0 | Apache-2.0 | 2020-10-13T11:42:28 | 2019-01-16T17:55:20 | Java | UTF-8 | Java | false | false | 2,238 | java | package ru.job4j.coffee;
import java.util.Arrays;
/**
* The {@code CoffeeMachine} class calculates change for the coffee.
*
* @author Alexander Petrenko ([email protected])
* @version 1.0
* @since 16.03.2019
*/
public class CoffeeMachine {
/**
* Array of coins for change.
*/
private int[] coins;
/**
* The class constructor initialises array of coins for change.
*
* @param coins Array of coins, that are available for change.
*/
public CoffeeMachine(int[] coins) {
this.coins = CoffeeMachine.descSort(coins);
}
/**
* The method for descending sort of the array of coins.
* The method uses Bubble Sort algorithm.
*
* @param array The array of coins for change.
* @return The array of coins sorted in descending order.
*/
private static int[] descSort(int[] array) {
for (int i = array.length - 1; i > 0; i--) {
for (int j = 0; j < i; j++) {
if (array[j] < array[j + 1]) {
int tmp = array[j];
array[j] = array[j + 1];
array[j + 1] = tmp;
}
}
}
return array;
}
/**
* The method counts the customer's change for coffee.
* @param value The customers money for the coffee.
* @param price The coffee price.
* @return Array of coins for change.
* @throws NotEnoughMoney - exception, when customer has not enough money for the coffee.
*/
public int[] changes(int value, int price) {
int delta = value - price;
if (delta < 0) {
throw new NotEnoughMoney("You have not enough money for your order.");
}
int[] result = new int[delta];
int position = 0;
if (delta == 0) {
position++;
} else {
for (int coin : coins) {
while (delta != 0) {
if (delta - coin >= 0) {
delta -= coin;
result[position++] = coin;
} else {
break;
}
}
}
}
return Arrays.copyOf(result, position);
}
}
| [
"[email protected]"
]
| |
a34086a362080b2bc7d917753970967abef0228f | 61f333b2966330c9bb2e78e546e54f1524722c0a | /finalProject/src/test/java/stepDefinitions/GeoShippingSteps.java | f135a76ca9e80d6ef8ddc9b71215eb4cb8e57ad7 | []
| no_license | Jevgenijs-C/No-Name | dd59ca7377b9fc43adb61b6278f8a422eba33086 | ca070cbdea3b1f631be4ba680460462cc827facc | refs/heads/master | 2021-03-11T04:30:25.218373 | 2020-03-08T14:17:27 | 2020-03-08T14:17:27 | 246,509,551 | 0 | 1 | null | 2020-10-13T20:16:36 | 2020-03-11T08:01:02 | Java | UTF-8 | Java | false | false | 3,554 | java | package stepDefinitions;
import org.junit.Assert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import pages_sample.CheckoutPage2;
public class GeoShippingSteps {
private WebDriver driver;
private CheckoutPage2 checkoutPage2;
public GeoShippingSteps() {
this.driver = Hooks.driver;
checkoutPage2 = PageFactory.initElements(Hooks.driver, CheckoutPage2.class);
/*checkoutPage.setDriver(driver);*/
checkoutPage2.setDriver(driver);
}
@Given("^demoshop homepage is opened$")
public void demoshop_homepage_is_opened() throws Throwable {
driver.get("http://demoshop24.com/");
}
@When("^i have created product order in UK$")
public void i_have_created_product_order_in_UK() throws Throwable {
checkoutPage2.addToCart();
checkoutPage2.createOrder();
}
@And("^i collect data about Shipping Rate$")
public void i_collect_data_about_Shipping_Rate() throws Throwable {
checkoutPage2.collectShipRateUK();
}
@And("^i collect data about Eco Tax$")
public void i_collect_data_about_Eco_Tax() throws Throwable {
checkoutPage2.collectEcoTaxUK();
}
@And("^i collect data about VAT$")
public void i_collect_data_about_VAT() throws Throwable {
checkoutPage2.collectVATUK();
}
@And("^i change target adress from UK to Latvia$")
public void i_change_target_adress_from_UK_to_Latvia() throws Throwable {
checkoutPage2.changeTargetAdressLatvia();
}
@When("^i collect data about Shipping Rate again$")
public void i_collect_data_about_Shipping_Rate_again() throws Throwable {
checkoutPage2.collectShipRateLV();
}
@When("^i collect data about Eco Tax again$")
public void i_collect_data_about_Eco_Tax_again() throws Throwable {
checkoutPage2.collectEcoTaxLV();
}
@When("^i collect data about VAT again$")
public void i_collect_data_about_VAT_again() throws Throwable {
checkoutPage2.collectVATLV();
}
@Then("^i see that Shipping Rate differs between UK and Latvia$")
public void i_see_that_Shipping_Rate_differs_between_UK_and_Latvia() throws Throwable {
System.out.println("UK Shipping rate = " + checkoutPage2.collectShipRateUK());
System.out.println("LV Shipping rate = " + checkoutPage2.collectShipRateLV());
// System.out.println(checkoutPage2.collectShipRateUK().equals(checkoutPage2.collectShipRateLV())); //true
Assert.assertFalse(checkoutPage2.collectShipRateUK().equals(checkoutPage2.collectShipRateLV()));
}
@And("^Eco Tax differs between UK and Latvia$")
public void eco_Tax_differs_between_UK_and_Latvia() throws Throwable {
String a = checkoutPage2.collectEcoTaxLV();
if (a == null) {
System.out.println("Eco Tax is not displayed");
} else {
Assert.assertFalse(checkoutPage2.collectEcoTaxUK().equals(checkoutPage2.collectEcoTaxLV()));
}
}
@And("^VAT differs between UK and Latvia$")
public void vat_differs_between_UK_and_Latvia() throws Throwable {
String a = checkoutPage2.collectVATLV();
if (a == null) {
System.out.println("VAT is not displayed");
} else {
Assert.assertFalse(checkoutPage2.collectVATUK().equals(checkoutPage2.collectVATLV()));
}
}
}
| [
"[email protected]"
]
| |
67c8898ffd94378111166d292efd8328fe6b13e1 | 9be14f9dc9e5806891ba48b7066c43dd043ac276 | /src/main/java/uk/nhs/digital/mait/tkwx/spinetools/SendDistEnvelopeHandler.java | 709846b06ac825c8af066678d67de89e19b7219d | [
"Apache-2.0"
]
| permissive | nhsdigitalmait/TKW-x | 58c001ed684a2b7471039febed0f393fc8b953c2 | 7e90cb035cd65464d42085870ce45a6aeeef53e1 | refs/heads/master | 2022-11-23T14:38:47.421837 | 2022-11-22T08:45:48 | 2022-11-22T08:45:48 | 232,580,623 | 0 | 1 | Apache-2.0 | 2022-01-12T15:57:29 | 2020-01-08T14:22:29 | Java | UTF-8 | Java | false | false | 7,294 | java | /*
Copyright 2014 Health and Social Care Information Centre
Solution Assurance [email protected]
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 uk.nhs.digital.mait.tkwx.spinetools;
import java.io.File;
import java.io.FileNotFoundException;
import uk.nhs.digital.mait.distributionenvelopetools.itk.distributionenvelope.AckDistributionEnvelope;
import uk.nhs.digital.mait.distributionenvelopetools.itk.distributionenvelope.DistributionEnvelope;
import uk.nhs.digital.mait.distributionenvelopetools.itk.distributionenvelope.NackDistributionEnvelope;
import uk.nhs.digital.mait.distributionenvelopetools.itk.util.ITKException;
import uk.nhs.digital.mait.spinetools.spine.messaging.DistributionEnvelopeHandler;
import static uk.nhs.digital.mait.tkwx.tk.GeneralConstants.*;
import static uk.nhs.digital.mait.tkwx.tk.PropertyNameConstants.*;
import uk.nhs.digital.mait.tkwx.util.Utils;
import static uk.nhs.digital.mait.tkwx.util.Utils.isY;
/**
* A DistributionEnvelope handler that : 1. writes the envelope and its
* content,to a file on disk. This is the default behaviour of the MHS' ITK
* Trunk handler 2. responds to the requestor with a infrastructure
* acknowledgement (+ve or negative - configurable) 3.then business ack is also
* sent (+ve or negative - configurable)
*
* @author Richard Robinson [email protected]
*/
public class SendDistEnvelopeHandler extends AbstractDistEnvelopeHandler
implements DistributionEnvelopeHandler {
private static final String ITK_INFRASTRUCTURE_ACK_INTERACTION = "urn:nhs-itk:interaction:ITKInfrastructureAcknowledgement-v1-0";
private static final String INTERACTION = "urn:nhs-itk:ns:201005:interaction";
/**
* Constructor
* @throws FileNotFoundException
* @throws IllegalArgumentException
*/
public SendDistEnvelopeHandler()
throws FileNotFoundException, IllegalArgumentException {
super();
}
/**
* Parses the distribution envelope payloads, and writes the envelope plus
* contents to disk. It will then respond to the requestor with the
* appropriate ack(s) dynamically depending on the content of the requesting
* Handling Spec
*
* @param d the distribution envelope object
* @throws Exception
*/
@Override
public void handle(DistributionEnvelope d)
throws Exception {
// The initial parsing for the DistributionEnvlope doesn't extract
// the payloads (because it is intended to be called by routers that
// don't need to know about payloads). That will cause an exception
// to be thrown when we try to write the DE to a string, so call
// "parsePayloads()" here..
//
d.parsePayloads();
String s = d.getService();
s = s.replaceAll(":", "_");
StringBuilder sb = new StringBuilder(s);
sb.append("_");
sb.append(getFileSafeMessageID(d.getTrackingId()));
sb.append(".message");
File outfile = new File(fileSaveDirectory, sb.toString());
Utils.writeString2File(outfile,d.toString());
if (reportFilename) {
System.out.println(outfile.getCanonicalPath());
}
String interaction = d.getHandlingSpecification(INTERACTION);
if (interaction == null || interaction.equals("")) {
//Assume it's a infack and do nothing
} else if (interaction.equals(ITK_BUSINESS_ACK_INTERACTION)) {
//Send Infrastructure Acknowledgement
String infackReq = d.getHandlingSpecification(INFACKREQUESTED_HANDLINGSPEC);
if (infackReq != null && infackReq.toLowerCase().equals("true")) {
sendInfAck(d);
}
} else if (interaction.equals(ITK_INFRASTRUCTURE_ACK_INTERACTION)) {
//it's a infack and do nothing
} else {
//assume anything not busack or null or infack is a requesting message
//Send Infrastructure Acknowledgement
String infackReq = d.getHandlingSpecification(INFACKREQUESTED_HANDLINGSPEC);
if (infackReq != null && infackReq.toLowerCase().equals("true")) {
sendInfAck(d);
//if a negative ebxml is configured do no further processing
if (isY(System.getProperty(ORG_NEGEBXMLACK))) {
return;
}
SendDistEnvelopeHandler.sleep(3000);
}
//Send Business Acknowledgement
String busackReq = d.getHandlingSpecification(ACKREQUESTED_HANDLINGSPEC);
if (busackReq != null && busackReq.toLowerCase().equals("true")) {
ApplicationAcknowledgment aa = new ApplicationAcknowledgment(d);
aa.addHandlingSpecification(INFACKREQUESTED_HANDLINGSPEC, "true");
aa.setService(SEND_DIST_ENVELOPE_SERVICE);
send(d, aa);
}
}
}
private void sendInfAck(DistributionEnvelope d) throws Exception {
if (System.getProperty(ORG_NEGINFACK).trim().toLowerCase().equals("n")) {
String errorCode = System.getProperty(ORG_INFACKNACKERRORCODE);
String errorText = System.getProperty(ORG_INFACKNACKERRORTEXT);
String diagText = System.getProperty(ORG_INFACKNACKDIAGTEXT);
if (errorCode == null) {
errorCode = "1000";
}
if (errorText == null) {
errorText = "Example error";
}
if (diagText == null) {
diagText = "Example diagnostic text";
}
ITKException ie = new ITKException(errorCode, errorText, diagText);
NackDistributionEnvelope nde = new NackDistributionEnvelope(d, ie);
nde.setService(SEND_DIST_ENVELOPE_SERVICE);
/**
* This is to support ITKv3 behaviour whereby the inf ack contains a
* handling spec which is populated with an interaction id - this is
* a consequence of the discredited decision to have generic
* services.
*/
nde.setAckTemplate(NACK_TEMPLATE_PATH);
nde.makeMessage();
send(d, nde);
} else {
AckDistributionEnvelope ade = new AckDistributionEnvelope(d);
ade.setService(SEND_DIST_ENVELOPE_SERVICE);
/**
* This is to support ITKv3 behaviour whereby the inf ack contains a
* handling spec which is populated with an interaction id - this is
* a consequence of the discredited decision to have generic
* services.
*/
ade.setAckTemplate(ACK_TEMPLATE_PATH);
ade.makeMessage();
send(d, ade);
}
}
}
| [
"[email protected]"
]
| |
bdf3ca8570236c5667c47a74de51bb8867f6615b | 97670b111a88d8e8147b01c95d7661d0a2d8159c | /dl4j-examples/src/main/java/org/deeplearning4j/examples/recurrent/seqClassification/UCISequenceClassificationExample.java | c9ec0eea3ef99a3e45bcf7a95e5cd25467c11416 | [
"Apache-2.0"
]
| permissive | crockpotveggies/dl4j-examples | f2c32b5d85f046cb750d47f4da562b0a7cfc92fc | a357048e8a1e9dc77d45c70a12af99e470cb4b61 | refs/heads/master | 2021-01-09T05:59:10.302403 | 2018-08-16T00:35:54 | 2018-08-16T00:35:54 | 80,881,478 | 11 | 4 | null | 2017-02-04T00:36:02 | 2017-02-04T00:36:02 | null | UTF-8 | Java | false | false | 10,972 | java | package org.deeplearning4j.examples.recurrent.seqClassification;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.datavec.api.berkeley.Pair;
import org.datavec.api.records.reader.SequenceRecordReader;
import org.datavec.api.records.reader.impl.csv.CSVSequenceRecordReader;
import org.datavec.api.split.NumberedFileInputSplit;
import org.deeplearning4j.datasets.datavec.SequenceRecordReaderDataSetIterator;
import org.deeplearning4j.eval.Evaluation;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.GradientNormalization;
import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.conf.Updater;
import org.deeplearning4j.nn.conf.layers.GravesLSTM;
import org.deeplearning4j.nn.conf.layers.RnnOutputLayer;
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork;
import org.deeplearning4j.nn.weights.WeightInit;
import org.deeplearning4j.optimize.listeners.ScoreIterationListener;
import org.nd4j.linalg.activations.Activation;
import org.nd4j.linalg.dataset.api.iterator.DataSetIterator;
import org.nd4j.linalg.dataset.api.preprocessor.DataNormalization;
import org.nd4j.linalg.dataset.api.preprocessor.NormalizerStandardize;
import org.nd4j.linalg.lossfunctions.LossFunctions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
/**
* Sequence Classification Example Using a LSTM Recurrent Neural Network
*
* This example learns how to classify univariate time series as belonging to one of six categories.
* Categories are: Normal, Cyclic, Increasing trend, Decreasing trend, Upward shift, Downward shift
*
* Data is the UCI Synthetic Control Chart Time Series Data Set
* Details: https://archive.ics.uci.edu/ml/datasets/Synthetic+Control+Chart+Time+Series
* Data: https://archive.ics.uci.edu/ml/machine-learning-databases/synthetic_control-mld/synthetic_control.data
* Image: https://archive.ics.uci.edu/ml/machine-learning-databases/synthetic_control-mld/data.jpeg
*
* This example proceeds as follows:
* 1. Download and prepare the data (in downloadUCIData() method)
* (a) Split the 600 sequences into train set of size 450, and test set of size 150
* (b) Write the data into a format suitable for loading using the CSVSequenceRecordReader for sequence classification
* This format: one time series per file, and a separate file for the labels.
* For example, train/features/0.csv is the features using with the labels file train/labels/0.csv
* Because the data is a univariate time series, we only have one column in the CSV files. Normally, each column
* would contain multiple values - one time step per row.
* Furthermore, because we have only one label for each time series, the labels CSV files contain only a single value
*
* 2. Load the training data using CSVSequenceRecordReader (to load/parse the CSV files) and SequenceRecordReaderDataSetIterator
* (to convert it to DataSet objects, ready to train)
* For more details on this step, see: http://deeplearning4j.org/usingrnns#data
*
* 3. Normalize the data. The raw data contain values that are too large for effective training, and need to be normalized.
* Normalization is conducted using NormalizerStandardize, based on statistics (mean, st.dev) collected on the training
* data only. Note that both the training data and test data are normalized in the same way.
*
* 4. Configure the network
* The data set here is very small, so we can't afford to use a large network with many parameters.
* We are using one small LSTM layer and one RNN output layer
*
* 5. Train the network for 40 epochs
* At each epoch, evaluate and print the accuracy and f1 on the test set
*
* @author Alex Black
*/
public class UCISequenceClassificationExample {
private static final Logger log = LoggerFactory.getLogger(UCISequenceClassificationExample.class);
//'baseDir': Base directory for the data. Change this if you want to save the data somewhere else
private static File baseDir = new File("src/main/resources/uci/");
private static File baseTrainDir = new File(baseDir, "train");
private static File featuresDirTrain = new File(baseTrainDir, "features");
private static File labelsDirTrain = new File(baseTrainDir, "labels");
private static File baseTestDir = new File(baseDir, "test");
private static File featuresDirTest = new File(baseTestDir, "features");
private static File labelsDirTest = new File(baseTestDir, "labels");
public static void main(String[] args) throws Exception {
downloadUCIData();
// ----- Load the training data -----
//Note that we have 450 training files for features: train/features/0.csv through train/features/449.csv
SequenceRecordReader trainFeatures = new CSVSequenceRecordReader();
trainFeatures.initialize(new NumberedFileInputSplit(featuresDirTrain.getAbsolutePath() + "/%d.csv", 0, 449));
SequenceRecordReader trainLabels = new CSVSequenceRecordReader();
trainLabels.initialize(new NumberedFileInputSplit(labelsDirTrain.getAbsolutePath() + "/%d.csv", 0, 449));
int miniBatchSize = 10;
int numLabelClasses = 6;
DataSetIterator trainData = new SequenceRecordReaderDataSetIterator(trainFeatures, trainLabels, miniBatchSize, numLabelClasses,
false, SequenceRecordReaderDataSetIterator.AlignmentMode.ALIGN_END);
//Normalize the training data
DataNormalization normalizer = new NormalizerStandardize();
normalizer.fit(trainData); //Collect training data statistics
trainData.reset();
//Use previously collected statistics to normalize on-the-fly. Each DataSet returned by 'trainData' iterator will be normalized
trainData.setPreProcessor(normalizer);
// ----- Load the test data -----
//Same process as for the training data.
SequenceRecordReader testFeatures = new CSVSequenceRecordReader();
testFeatures.initialize(new NumberedFileInputSplit(featuresDirTest.getAbsolutePath() + "/%d.csv", 0, 149));
SequenceRecordReader testLabels = new CSVSequenceRecordReader();
testLabels.initialize(new NumberedFileInputSplit(labelsDirTest.getAbsolutePath() + "/%d.csv", 0, 149));
DataSetIterator testData = new SequenceRecordReaderDataSetIterator(testFeatures, testLabels, miniBatchSize, numLabelClasses,
false, SequenceRecordReaderDataSetIterator.AlignmentMode.ALIGN_END);
testData.setPreProcessor(normalizer); //Note that we are using the exact same normalization process as the training data
// ----- Configure the network -----
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
.seed(123) //Random number generator seed for improved repeatability. Optional.
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT).iterations(1)
.weightInit(WeightInit.XAVIER)
.updater(Updater.NESTEROVS).momentum(0.9)
.learningRate(0.005)
.gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue) //Not always required, but helps with this data set
.gradientNormalizationThreshold(0.5)
.list()
.layer(0, new GravesLSTM.Builder().activation(Activation.TANH).nIn(1).nOut(10).build())
.layer(1, new RnnOutputLayer.Builder(LossFunctions.LossFunction.MCXENT)
.activation(Activation.SOFTMAX).nIn(10).nOut(numLabelClasses).build())
.pretrain(false).backprop(true).build();
MultiLayerNetwork net = new MultiLayerNetwork(conf);
net.init();
net.setListeners(new ScoreIterationListener(20)); //Print the score (loss function value) every 20 iterations
// ----- Train the network, evaluating the test set performance at each epoch -----
int nEpochs = 40;
String str = "Test set evaluation at epoch %d: Accuracy = %.2f, F1 = %.2f";
for (int i = 0; i < nEpochs; i++) {
net.fit(trainData);
//Evaluate on the test set:
Evaluation evaluation = net.evaluate(testData);
log.info(String.format(str, i, evaluation.accuracy(), evaluation.f1()));
testData.reset();
trainData.reset();
}
log.info("----- Example Complete -----");
}
//This method downloads the data, and converts the "one time series per line" format into a suitable
//CSV sequence format that DataVec (CsvSequenceRecordReader) and DL4J can read.
private static void downloadUCIData() throws Exception {
if (baseDir.exists()) return; //Data already exists, don't download it again
String url = "https://archive.ics.uci.edu/ml/machine-learning-databases/synthetic_control-mld/synthetic_control.data";
String data = IOUtils.toString(new URL(url));
String[] lines = data.split("\n");
//Create directories
baseDir.mkdir();
baseTrainDir.mkdir();
featuresDirTrain.mkdir();
labelsDirTrain.mkdir();
baseTestDir.mkdir();
featuresDirTest.mkdir();
labelsDirTest.mkdir();
int lineCount = 0;
List<Pair<String, Integer>> contentAndLabels = new ArrayList<>();
for (String line : lines) {
String transposed = line.replaceAll(" +", "\n");
//Labels: first 100 examples (lines) are label 0, second 100 examples are label 1, and so on
contentAndLabels.add(new Pair<>(transposed, lineCount++ / 100));
}
//Randomize and do a train/test split:
Collections.shuffle(contentAndLabels, new Random(12345));
int nTrain = 450; //75% train, 25% test
int trainCount = 0;
int testCount = 0;
for (Pair<String, Integer> p : contentAndLabels) {
//Write output in a format we can read, in the appropriate locations
File outPathFeatures;
File outPathLabels;
if (trainCount < nTrain) {
outPathFeatures = new File(featuresDirTrain, trainCount + ".csv");
outPathLabels = new File(labelsDirTrain, trainCount + ".csv");
trainCount++;
} else {
outPathFeatures = new File(featuresDirTest, testCount + ".csv");
outPathLabels = new File(labelsDirTest, testCount + ".csv");
testCount++;
}
FileUtils.writeStringToFile(outPathFeatures, p.getFirst());
FileUtils.writeStringToFile(outPathLabels, p.getSecond().toString());
}
}
}
| [
"[email protected]"
]
| |
87f39919f1d5a02e0006c78cf4bc941a0d18f74a | 6cd9a3133c68d4156e4a9e3e74ebcbda9881753d | /shop_restful_service/src/main/java/com/fh/shop/api/student/biz/StudentService.java | 1322b79f2fd588e2f3f14c19df728505809f9353 | []
| no_license | XinLong6868/shop | 9008ac0b3b6736a19b5c1903b0b5b06f87196502 | 76afad47aaeaf7d04a0eb0a4803f8f8bad95833a | refs/heads/master | 2020-05-07T12:50:13.127204 | 2019-04-10T07:51:27 | 2019-04-10T07:51:27 | 179,986,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package com.fh.shop.api.student.biz;
import com.fh.shop.api.common.ServerResponse;
import com.fh.shop.api.student.po.Student;
/**
* @author DELL
* @title: StudentService
* @projectName shop-1808-Xinlong
* @description: TODO
* @date 2019/3/2114:32
*/
public interface StudentService {
public ServerResponse addStudent(Student student);
ServerResponse deleteStudent(Integer id);
ServerResponse findStudent(Integer id);
ServerResponse updateStudent(Student student);
}
| [
"[email protected]"
]
| |
a4ecde6740b8dbdd54b5ec02816da1ad9a59b9d5 | f46b319c1718f07c740a0debdf088a1e54ea6ef3 | /voting-service/src/main/java/com/voting/service/user/UserLoginService.java | d7d686b08b03cd9c6576d6a0d094f713c2eef768 | []
| no_license | swtsoso/Base | 6b7c5b155d32e860f2989b49303fba8424d84a59 | 7c33ceb384e7a6a92990a483b035ab6411a78c20 | refs/heads/master | 2021-05-14T14:22:42.535457 | 2018-01-02T07:45:06 | 2018-01-02T07:45:06 | 115,969,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 71 | java | package com.voting.service.user;
public interface UserLoginService {
} | [
"[email protected]"
]
| |
f7952a4781db2de3fe0bacb43cdce072b785f8ad | 3b066087c5f92e8e1f1601b03aa1e37ca37112f0 | /migrat-common/src/main/java/com/ymy/xxb/migrat/common/service/RedisService.java | 3aa5d0a498b9c47fe920c3b90a239bc83718bb83 | [
"Apache-2.0"
]
| permissive | moyu3390/migrat | 0880d9fb1c7a9a2914322cbb95a5ee07de9b5c97 | 0cc2b568227ed67e339e9f876bdaf429ade1e47a | refs/heads/master | 2023-08-23T18:27:42.163798 | 2020-06-20T07:35:41 | 2020-06-20T07:35:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,683 | java | package com.ymy.xxb.migrat.common.service;
import java.io.Serializable;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
/**
* @author wangyi
*/
@Component
public class RedisService {
@Autowired
private RedisTemplate<String, Serializable> redisTemplate;
/**
* 写入缓存
* @param key
* @param value
* @return
*/
public boolean set(String key, Serializable value) {
boolean result = false;
try {
redisTemplate.opsForValue().set(key, value);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 写入缓存并设置失效时间
* @param key
* @param value
* @param expireTime
* @return
*/
public boolean setEx(String key, Serializable value, Long expireTime) {
boolean result = false;
try {
redisTemplate.opsForValue().set(key, value);
redisTemplate.expire(key, expireTime, TimeUnit.SECONDS);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 判断key是否存在
* @param key
* @return
*/
public boolean exist(String key) {
return redisTemplate.hasKey(key);
}
/**
* 读取key值
* @param key
* @return
*/
public Serializable get(String key) {
Serializable serializable = redisTemplate.opsForValue().get(key);
return serializable;
}
/**
* 删除对应的key
* @param key
* @return
*/
public boolean remove(String key) {
if (exist(key)) {
return redisTemplate.delete(key);
}
return false;
}
// TODO Add Other Method
}
| [
"[email protected]"
]
| |
f2e3c66d2b7e9b502554f1735de7e9ac3c9017c0 | 3d48b554c6fbd05300111b8526e09c3f0bd093f0 | /src/main/java/com/spring/periodicals/service/impl/UserServiceImpl.java | 6e13efc709cd9e86c58ef5a535af85b548ae5f6a | []
| no_license | leradoughnut/Periodicals | fa61ff24f5462f67677366b2c4b8d97377257373 | 29094af22baea427221d57feb8fc1a929703b31d | refs/heads/master | 2023-01-19T21:47:46.638874 | 2020-11-27T18:42:39 | 2020-11-27T18:42:39 | 316,574,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,483 | java | package com.spring.periodicals.service.impl;
import com.spring.periodicals.dto.UserDTO;
import com.spring.periodicals.entity.Role;
import com.spring.periodicals.entity.Status;
import com.spring.periodicals.entity.User;
import com.spring.periodicals.repository.UserRepository;
import com.spring.periodicals.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {
UserRepository userRepository;
BCryptPasswordEncoder bCryptPasswordEncoder;
@Autowired
public UserServiceImpl(UserRepository userRepository, BCryptPasswordEncoder bCryptPasswordEncoder) {
this.userRepository = userRepository;
this.bCryptPasswordEncoder = bCryptPasswordEncoder;
}
@Override
public List<User> findAll() {
return userRepository.findAll();
}
@Override
public void saveUser(UserDTO userDTO) {
userRepository.save(buildUserFromDTO(userDTO));
}
public User buildUserFromDTO(UserDTO userDTO){
return User.builder()
.name(userDTO.getName())
.email(userDTO.getEmail())
.password(bCryptPasswordEncoder.encode(userDTO.getPassword()))
.role(Role.USER)
.status(Status.ACTIVE)
.build();
}
}
| [
"[email protected]"
]
| |
c798b6db03aa61c1ee773700f31d17aaecb35c1a | b28aa614c7563527e408475374058de2ad061c3e | /samples/bird-service-sample/src/main/java/com/bird/service/sample/service/TabStringService.java | 4f091d8bacbae023648a69803d08dca6a7946116 | [
"MIT"
]
| permissive | xldc/bird-java | 53209a06f91605b648eece35e85d826dece6eb79 | 2be6b17240ac17b42535308bf1065b6dc9faa671 | refs/heads/master | 2020-08-19T10:27:51.355484 | 2019-10-17T02:03:43 | 2019-10-17T02:35:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.bird.service.sample.service;
import com.bird.service.common.service.GenericStringService;
import com.bird.service.sample.model.TabString;
import com.bird.service.sample.service.mapper.TabStringMapper;
import org.springframework.stereotype.Service;
/**
* @author liuxx
* @date 2019/8/29
*/
@Service
public class TabStringService extends GenericStringService<TabStringMapper, TabString> {
}
| [
"[email protected]"
]
| |
082d490829af3617bf1003537d4398a523e56f27 | 15c016f9568bf8b9f35be3154bcfa09fd06148b2 | /Tarefa2/ContaEspecial.java | 0335c7cea0441aa85f91edf33a97ae924e412ffa | []
| no_license | miguelfesanbar/DesenvolvimentoFullStack | f9be4142663b85460f9ecd112e1758d20a3a6451 | 8c1781d802df976422d7a75f771bba719d0c535e | refs/heads/main | 2023-05-07T18:54:26.957630 | 2021-05-21T21:10:05 | 2021-05-21T21:10:05 | 347,098,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java |
public class ContaEspecial extends Conta {
private Double limite;
public ContaEspecial(Pessoa cliente, Integer nrConta, Double saldo, Double limite) {
super(cliente, nrConta, saldo);
this.limite = limite;
}
public Double getLimite() {
return limite;
}
public void setLimite(Double limite) {
this.limite = limite;
}
protected Boolean temSaldo(Double valor) {
return (valor <= (this.saldo + this.limite));
}
}
| [
"[email protected]"
]
| |
6de2a773624efb48ca04848927d2c7ef2f159ac6 | 585e56c03bb14c8b6801470c3cbc31429840e1bc | /Monte Carlo - PI/test/src/main/App.java | 772da43dc15506bf4176c6477631cf2413b18c43 | []
| no_license | koja5/ApacheIgnite | 1cadac0d425de9a7fe44990389ba0ecd1bf26965 | c92d709f8c7326ac9f9d91b9feb5ad8b1407019d | refs/heads/master | 2020-03-28T19:46:56.194084 | 2018-09-19T15:58:54 | 2018-09-19T15:58:54 | 149,009,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | package com.test.test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.ToIntFunction;
import java.lang.*;
import java.util.IntSummaryStatistics;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeTaskAdapter;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteReducer;
import org.jetbrains.annotations.Nullable;
public class App
{
public static void main(String[] args) throws IgniteException {
try (Ignite ignite = Ignition.start()) {
ignite.compute().broadcast(() -> System.out.println("Hello!"));
}
}
}
| [
"[email protected]"
]
| |
d958b442775c3b80bfe8df74651e756634674ea5 | 4a34fb516c112e0da070d8d70ce467e3c2a2463e | /src/models/Fish.java | 2dcb0b4c55df2d623a32cf7cee58364e49125876 | []
| no_license | abenbyy/os-week-4 | 445a6f9cc271bf307ab2b955468f6d3437fd7569 | 3e519299476f6067e1e749d5e37897a64e00e2d5 | refs/heads/master | 2022-12-25T11:26:42.290692 | 2020-10-07T05:45:03 | 2020-10-07T05:45:03 | 301,938,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package models;
public class Fish extends Pet{
public Fish(String name, int price) {
super.name = name;
super.price = price;
super.sold = 0;
}
public String getName() {
return super.name;
}
public int getPrice() {
return super.price;
}
@Override
public void feed() {
System.out.println(super.name + " is being fed a pellet, it's relatively quiet");
}
public void swim() {
System.out.println(super.name + " goes 'blub blub blub' and swims around");
}
}
| [
"[email protected]"
]
| |
93563dcebbb5452618370aa6cb1317ed6882cf6e | c0da02f70ac38acb92cc3ac77e394ca0a901c3f2 | /app/src/main/java/ru/timekiller/SecondsHelper.java | 3cb0491242e54d2d9bf80d872a2dd9dae8d231a9 | []
| no_license | shdevlp/timekiller | 1ceb6dc4b89cf961e5c2afed6250f846502e947f | fe5f03378ebf9c63178ed7647b2d52b023d142f3 | refs/heads/master | 2021-01-18T14:41:00.568159 | 2015-04-17T11:31:25 | 2015-04-17T11:31:37 | 33,868,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | package ru.timekiller;
import java.util.Calendar;
/**
* Created by Дмитрий on 16.04.2015.
*/
public class SecondsHelper {
private long _counter;
private String _lastSecond;
public SecondsHelper() {
reset();
}
/**
* Стартуем заново
*/
public void reset() {
_counter = System.currentTimeMillis();
}
/**
*
* @return
*/
public String lastSecond() {
return _lastSecond;
}
/**
* Получить строку секундомера
* @return
*/
public String getSeconds() {
final long secs = System.currentTimeMillis() - _counter;
Calendar cl = Calendar.getInstance();
cl.setTimeInMillis(secs);
_lastSecond = cl.get(Calendar.MINUTE) + ":" + cl.get(Calendar.SECOND)
+ ":" + cl.get(Calendar.MILLISECOND);
return _lastSecond;
}
}
| [
"[email protected]"
]
| |
07eb9a00c32965cfc6e9c1161d5d0467c3fe8cb6 | 660f78db11f7fbbaed3328db3867604fa3d85216 | /src/ConfigManager.java | 23d59b39f11d1d9e0ce181508bcce333ad2835df | []
| no_license | bverma0808/Web-Crawler | 83cfa9c547d02b78df0b7b7b3693c88f2314ba9a | 7b7348df8f32d5d6dda726bc093506548b6b3211 | refs/heads/master | 2021-01-21T12:26:47.986388 | 2015-05-23T19:41:41 | 2015-05-23T19:41:41 | 35,688,857 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,968 | java | import java.util.*;
/**
* <pre>
* This class contains the configurations of our web-crawler
* Its a singleton class . At first it tries to load the configurations from the config file
* and if it fails to do that then it will load the default configurations
*</pre>
*/
public class ConfigManager {
static ConfigManager configManager; //for containing the reference to one and only one object of ConfigManager class
public HashMap<String,Object> configs; //map of configurations, which specify the functionality of crawler
/**
* Constructor for SingleTone class
* @param fileFullPath : name of configuration file along with absolute path
* @return
*/
private ConfigManager(String fileFullPath){
//load from config file specified
if(!loadConfigs(fileFullPath)){
//since loading of configurations from config-file is failed, so load default configurations
loadDefaultConfigs();
}
}
/**
* This method will return ConfigManager's singleton object
* @param fileFullPath : name of configuration file along with absolute path
* @return configManager : reference to the SingleTone Object of ConfigManager
*/
public static ConfigManager getConfigManager(String fileFullPath){
if(configManager==null){
configManager = new ConfigManager(fileFullPath);
}
return configManager;
}
/**
* Loads a config file into the memory
* @param fileFullPath : name of configuration file along with absolute path
* @return true if configurations successfully loaded
* false otherwise
*/
private boolean loadConfigs(String fileFullPath){
configs = ConfigParser.parse(fileFullPath);
if(configs==null){
//falied to load configs
return false;
}
//configs loaded successfully
return true;
}
/**
* This method will load default configurations in the system
* @param
* @return void
*/
private void loadDefaultConfigs(){
//initialising configs map
configs = new HashMap<String,Object>();
//------- put the default values in config ---------
configs.put("downloadHtmlPageContent", false);
LinkedList<String> blockedLinkTypes = new LinkedList<String>();
blockedLinkTypes.add("png");
blockedLinkTypes.add("jpeg");
blockedLinkTypes.add("jpg");
blockedLinkTypes.add("mp3");
blockedLinkTypes.add("css");
configs.put("blockedLinkTypes", blockedLinkTypes);
LinkedList<String> knownLinkTypes = new LinkedList<String>();
knownLinkTypes.add("js");
knownLinkTypes.add("css");
knownLinkTypes.add("html");
knownLinkTypes.add("htm");
knownLinkTypes.add("jpeg");
knownLinkTypes.add("jpg");
knownLinkTypes.add("png");
knownLinkTypes.add("mp3");
knownLinkTypes.add("pdf");
configs.put("knownLinkTypes", knownLinkTypes);
configs.put("crawlDepth", 4);
configs.put("politenessDelay", 5000);
configs.put("maxLinksToCrawl", 5);
}
} | [
"[email protected]"
]
| |
dd847fd97fee6ab884bd5032fc046b017f9a1ffb | 6494431bcd79c7de8e465481c7fc0914b5ef89d5 | /src/main/java/com/coinbase/android/MainActivity$$Lambda$1.java | 6b4bfb24f9c863abe6e0978f4263b50201ec1e6c | []
| no_license | maisamali/coinbase_decompile | 97975a22962e7c8623bdec5c201e015d7f2c911d | 8cb94962be91a7734a2182cc625efc64feae21bf | refs/heads/master | 2020-06-04T07:10:24.589247 | 2018-07-18T05:11:02 | 2018-07-18T05:11:02 | 191,918,070 | 2 | 0 | null | 2019-06-14T09:45:43 | 2019-06-14T09:45:43 | null | UTF-8 | Java | false | false | 496 | java | package com.coinbase.android;
import rx.functions.Action1;
final /* synthetic */ class MainActivity$$Lambda$1 implements Action1 {
private final MainActivity arg$1;
private MainActivity$$Lambda$1(MainActivity mainActivity) {
this.arg$1 = mainActivity;
}
public static Action1 lambdaFactory$(MainActivity mainActivity) {
return new MainActivity$$Lambda$1(mainActivity);
}
public void call(Object obj) {
this.arg$1.onRefreshRequested();
}
}
| [
"[email protected]"
]
| |
04d94fe725f186edaf7669ee6037f524270f5cc6 | 96e17ab60e04b953e5e27a523827363ed8e55072 | /src/CoffeeOrder.java | 0c98c4456080f7a48ad3ef1726a4ce14e9497aad | []
| no_license | melikearslan/KahveSiparisUygulamasi | a3ce733c1b93c624a828c57f35ad1be8a1211d1d | e3bbe574c29c7bcda47773ecce8a7a3e4b8a622d | refs/heads/master | 2023-06-23T15:44:57.417272 | 2021-07-18T20:07:14 | 2021-07-18T20:07:14 | 387,260,374 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,171 | java | import java.util.HashMap;
import java.util.Map;
public class CoffeeOrder {
private final int coffeeNumber;
private final String name;
private final int price; // Türk lirası
private final Map<String, Integer> ingredients;
public CoffeeOrder(int coffeeNumber, String name, int price, Map<String, Integer> ingredients) {
this.coffeeNumber = coffeeNumber;
this.name = name;
this.price = price;
this.ingredients = new HashMap<String, Integer>(ingredients);
}
public String coffeeInfo() {
return coffeeNumber + ". " + name + " (" + price + " ₺)";
}
public String orderInfo() {
int ind = 0;
StringBuilder orderInfo = new StringBuilder(name + " seçtiniz. Bu içeceğimiz ");
for (Map.Entry<String, Integer> entry: ingredients.entrySet()) {
orderInfo.append(entry.getValue()).append(" doz ").append(entry.getKey().toLowerCase());
ind++;
if (ind != ingredients.entrySet().size())
orderInfo.append(", ");
}
orderInfo.append(" içermektedir. Afiyet olsun.");
return orderInfo.toString();
}
}
| [
"[email protected]"
]
| |
0dd93eef6e14a7e40b0e4f0c2b0a044392317732 | c94ebfa489cb39df80d53ff24e69a2d6a2933fd7 | /src/main/java/task/response/ResponseCreator.java | b4710a09d024e10c4460bdc7247d10786e232ccc | []
| no_license | yurictec/GPRest | c1ee69cc35ed2285d28ea6866e5bea854c259272 | 837690969547f69439d813462a767c3cac6c13c3 | refs/heads/master | 2021-01-18T23:34:28.372663 | 2017-04-04T09:40:59 | 2017-04-04T09:40:59 | 87,118,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package task.response;
import javax.ws.rs.core.Response;
public class ResponseCreator {
public static Response error(int status, int errorCode, String version) {
Response.ResponseBuilder response = Response.status(status);
response.header("version", version);
response.header("errorcode", errorCode);
response.entity("none");
return response.build();
}
public static Response success(String version, Object object) {
Response.ResponseBuilder response = Response.ok();
response.header("version", version);
if (object != null) {
response.entity(object);
} else {
response.entity("none");
}
return response.build();
}
}
| [
"[email protected]"
]
| |
15781e27d9e5ace53977c79867fc5e1b5778eeb2 | 637e51d29b1c99e61bb4cf49817032cf288ebd64 | /engine/src/main/java/com/arcadedb/query/sql/executor/WhileMatchStep.java | bf0404ba923778bb5033bfab749f5bb5325d666e | [
"Apache-2.0"
]
| permissive | elegoff/arcadedb | 41e1b326b42c45bc62f333f7a67e3147523dd213 | 7de1f4b1088ff4ea0680148126da6d2594bf57d0 | refs/heads/main | 2023-07-16T16:29:36.036766 | 2021-09-02T14:29:07 | 2021-09-02T14:29:07 | 402,422,407 | 0 | 0 | Apache-2.0 | 2021-09-02T13:02:53 | 2021-09-02T13:02:52 | null | UTF-8 | Java | false | false | 2,470 | java | /*
* Copyright 2021 Arcade Data Ltd
*
* 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 com.arcadedb.query.sql.executor;
import com.arcadedb.query.sql.parser.WhereClause;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Created by luigidellaquila on 13/10/16.
*/
public class WhileMatchStep extends AbstractUnrollStep {
private final InternalExecutionPlan body;
private final WhereClause condition;
public WhileMatchStep(CommandContext ctx, WhereClause condition, InternalExecutionPlan body, boolean profilingEnabled) {
super(ctx, profilingEnabled);
this.body = body;
this.condition = condition;
}
@Override protected Collection<Result> unroll(Result doc, CommandContext iContext) {
body.reset(iContext);
List<Result> result = new ArrayList<>();
ResultSet block = body.fetchNext(100);
while(block.hasNext()){
while(block.hasNext()){
result.add(block.next());
}
block = body.fetchNext(100);
}
return result;
}
@Override public String prettyPrint(int depth, int indent) {
String indentStep = ExecutionStepInternal.getIndent(1, indent);
String spaces = ExecutionStepInternal.getIndent(depth, indent);
StringBuilder result = new StringBuilder();
result.append(spaces);
result.append("+ WHILE\n");
result.append(spaces);
result.append(indentStep);
result.append(condition.toString());
result.append("\n");
result.append(spaces);
result.append(" DO\n");
result.append(body.prettyPrint(depth+1, indent));
result.append("\n");
result.append(spaces);
result.append(" END\n");
return result.toString();
}
}
| [
"[email protected]"
]
| |
8d715dc8f621332a2a0de37c61e5b9cc2ff67824 | beceb5d635179fa01e9267cae4c2ad035f3ffcb9 | /src/main/java/com/ricardo/interfaces/QuartoService.java | 1b2c602438e7d049cb5c98e01b668791ea3ee8db | []
| no_license | ricardocasaca/hotel | ab10a68740e673938ca4614581c5d7ecbb986bf3 | f0a064d5baa258d16a1d409c5cba483fca585d82 | refs/heads/master | 2021-01-09T20:13:56.847126 | 2016-07-05T14:46:46 | 2016-07-05T14:46:46 | 61,151,405 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package com.ricardo.interfaces;
import com.ricardo.suites.Quarto;
import java.util.List;
/**
* @author Kennedy Oliveira
*/
public interface QuartoService {
List<Quarto> getQuartos();
void cadastrarQuarto(Quarto quarto);
boolean existeQuarto(Quarto quarto);
}
| [
"[email protected]"
]
| |
28e28de346f077aaa96d2732ef2e004e8a7f3325 | b95fdc1556e25c9117815986e69dab769764d30b | /lunar-proj2/core/src/com/badlogic/lunarproj/Instructions.java | a68cb799a978e84fe78a202fd44aa0e083027ef9 | []
| no_license | Matt-Cohen-CS/FinalFrontierGame | 4cff1eace1bbf4d2b5e10ea7d54f6919bb9ea062 | 2447e67e12e84b7814f7fd22c165b4af883ebf7f | refs/heads/master | 2020-12-02T02:18:11.036055 | 2019-12-30T06:02:39 | 2019-12-30T06:02:39 | 230,856,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,170 | java | package com.badlogic.lunarproj;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
/*
The Instructions class is used for the instructions screen in the mainmenu to direct users as to how to play the game.
*/
public class Instructions implements Screen {
/*
Instance variables
*/
final Lunar game;
OrthographicCamera camera;
Sprite bgSprite;
Sprite mKeySprite;
Sprite titleSprite;
Sprite instructions_Sprite;
Sprite backSprite;
Texture title;
Texture background;
Texture instructions;
Texture back;
Texture mKey;
Music backgroundMusic;
/*
Instructions constructor
*/
public Instructions(Lunar gam) {
game = gam;
backgroundMusic = Gdx.audio.newMusic(Gdx.files.internal("instructions.mp3")); //sets backgroundmusic
backgroundMusic.setLooping(true);
/*
Sprite declarations are used to create a more legible screen for the user. Each image are sprites for easy manipulation. For example,
the "Instructions" portion of the instructions screen is actually a sprite. Breaking the screen in multiple sprites easily enables simple
changes to the instructions screen.
*/
background = new Texture("splash.png"); //sets background image
bgSprite = new Sprite(background);
bgSprite.setSize(800,480);
title = new Texture("instruction.png");
titleSprite = new Sprite(title);
titleSprite.setSize(600, 60);
titleSprite.setCenter(410,440);
instructions = new Texture("inst_txt.png");
instructions_Sprite = new Sprite(instructions);
instructions_Sprite.setSize(650, 280);
instructions_Sprite.setCenter(410,260);
back = new Texture("backtomenu.png");
backSprite = new Sprite(back);
backSprite.setSize(260, 38);
backSprite.setCenter(410,90);
mKey = new Texture("mkey.png");
mKeySprite = new Sprite(mKey);
mKeySprite.setSize(85, 27);
mKeySprite.setCenter(410,45);
// End creating instructions screen
camera = new OrthographicCamera();
camera.setToOrtho(false, 800, 480);
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0.2f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
game.batch.setProjectionMatrix(camera.combined);
game.batch.begin();
/*
Drawing each sprite for instructions screen
*/
bgSprite.draw(game.batch);
titleSprite.draw(game.batch);
instructions_Sprite.draw(game.batch);
backSprite.draw(game.batch);
mKeySprite.draw(game.batch);
game.batch.end();
if (Gdx.input.isKeyPressed(Input.Keys.M)) {
game.setScreen(new MainMenuScreen(game));
backgroundMusic.stop();
dispose();
} // returns player to main menu screen
}
@Override
public void resize(int width, int height) {
}
@Override
public void show() {
backgroundMusic.play();
}
@Override
public void hide() {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void dispose() {
backgroundMusic.dispose();
}
}
| [
"[email protected]"
]
| |
46aa6b713cb6fa1301ad417413111e31159f615a | f6762c7c13b3d092599dfd16464957c56607cc06 | /app/src/main/java/id/co/horveno/testgits/view/LoginView.java | 33a0e87837ada86a31f83404eaa130fdd2f5da6f | []
| no_license | MAlvinR/GitsWisataApps | f5544f002e12052e8e102f69896cc3ed2bee4ac7 | bbf8a436a697ed4c9a2b458a048e35ca9211aeb1 | refs/heads/master | 2021-06-27T11:37:46.117394 | 2017-09-15T12:58:16 | 2017-09-15T12:58:16 | 103,645,778 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 108 | java | package id.co.horveno.testgits.view;
public interface LoginView {
void onLoginError(String message);
}
| [
"[email protected]"
]
| |
fdd8adc1694393651edc8152e56602d6bd5e4056 | c764ba568d471df7c31aad4fe73982b305cfd0d0 | /src/main/java/br/com/arsmachina/authentication/entity/UserGroup.java | 62d5248e3a3e6eef77dc81b673a074851e471e64 | [
"Apache-2.0"
]
| permissive | thiagohp/generic-authentication | b57619e5f14053c27c40cd3f4c4a929eba7cb29f | a61db7380cf75e1a5b378e9213f3dde30f1b0417 | refs/heads/master | 2021-01-22T04:33:49.776845 | 2009-11-21T17:33:09 | 2009-11-21T17:33:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,246 | java | // Copyright 2008-2009 Thiago H. de Paula Figueiredo
//
// 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 br.com.arsmachina.authentication.entity;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
/**
* Class that represents a group of users.
*
* @author Thiago H. de Paula Figueiredo
*/
@Entity
@Table(name = "usergroup")
public class UserGroup {
/**
* Minimum name length.
*/
public static final int MINIMUM_NAME_LENGTH = 2;
/**
* Maximum name length.
*/
public static final int MAXIMUM_NAME_LENGTH = 50;
private Integer id;
private String name;
private List<User> users = new ArrayList<User>();
/**
* Retorna o valor da propriedade <code>id</code>.
*
* @return o valor de <code>id</code>.
*/
@Id
@GeneratedValue
@Column(nullable = false)
public Integer getId() {
return id;
}
/**
* Altera o valor da propriedade <code>id</code>.
*
* @param <code>id</code> o novo valor da propriedade <code>id</code>.
*/
public void setId(Integer id) {
this.id = id;
}
/**
* Retorna o valor da propriedade <code>name</code>.
*
* @return o valor de <code>name</code>.
*/
@Column(nullable = false, length = MAXIMUM_NAME_LENGTH, unique = true)
@NotNull
@Length(min = User.MINIMUM_NAME_LENGTH, max = User.MAXIMUM_NAME_LENGTH)
public String getName() {
return name;
}
/**
* Altera o valor da propriedade <code>name</code>.
*
* @param <code>name</code> o novo valor da propriedade <code>name</code>.
*/
public void setName(String name) {
this.name = name;
}
/**
* Retorna o valor da propriedade <code>users</code>.
*
* @return o valor de <code>users</code>.
*/
@ManyToMany
@JoinTable(name = "usergroup_user",
joinColumns = @JoinColumn(name = "usergroup_id", nullable = false),
inverseJoinColumns = @JoinColumn(name = "user_id", nullable = false),
uniqueConstraints = @UniqueConstraint(columnNames = {"usergroup_id", "user_id"}))
public List<User> getUsers() {
return users;
}
/**
* Altera o valor da propriedade <code>users</code>.
*
* @param <code>users</code> o novo valor da propriedade <code>users</code>.
*/
@Deprecated
public void setUsers(List<User> users) {
this.users = users;
}
}
| [
"[email protected]"
]
| |
d820a6abb624c00dbfb470348635c2276c160cad | 16d1489a90121348489bed0a31903c4fe5e42256 | /mq-demos/mq-demos/src/main/java/ca/sfu/cmpt383/RPCClient.java | a5e58796d1fa70bb6afe22468847a08157fe6e13 | []
| no_license | vking34/docker-compose-freelancer-00 | 99fbaddb72c8cd31ab8786afd10b8c20ecdcb286 | 93c7eb6a47b670c07767a99cefe9a6d48fad7c3f | refs/heads/master | 2023-01-24T08:29:09.949208 | 2020-12-12T10:50:54 | 2020-12-12T10:50:54 | 320,807,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,459 | java | package ca.sfu.cmpt383;
// based on https://www.rabbitmq.com/tutorials/tutorial-six-java.html
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.json.JSONObject;
import java.io.IOException;
import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeoutException;
public class RPCClient implements AutoCloseable {
private Connection connection;
private Channel channel;
private String requestQueueName = "rpc_queue";
public RPCClient() throws IOException, TimeoutException {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("rabbitmq");
connection = factory.newConnection();
channel = connection.createChannel();
}
public static void main(String[] argv) {
try (RPCClient rpcClient = new RPCClient()) {
var arg = new JSONObject();
arg.put("string", "test string");
String body = rpcClient.call(arg.toString());
var response = new JSONObject(body);
System.out.println(response.getInt("length"));
} catch (IOException | TimeoutException | InterruptedException e) {
e.printStackTrace();
}
}
public String call(String message) throws IOException, InterruptedException {
final String corrId = UUID.randomUUID().toString();
String replyQueueName = channel.queueDeclare().getQueue();
AMQP.BasicProperties props = new AMQP.BasicProperties
.Builder()
.correlationId(corrId)
.replyTo(replyQueueName)
.build();
channel.basicPublish("", requestQueueName, props, message.getBytes("UTF-8"));
final BlockingQueue<String> response = new ArrayBlockingQueue<>(1);
String ctag = channel.basicConsume(replyQueueName, true, (consumerTag, delivery) -> {
if (delivery.getProperties().getCorrelationId().equals(corrId)) {
response.offer(new String(delivery.getBody(), "UTF-8"));
}
}, consumerTag -> {
});
String result = response.take();
channel.basicCancel(ctag);
return result;
}
public void close() throws IOException {
connection.close();
}
}
| [
"[email protected]"
]
| |
ab0e02952e9a4ebbe2dc7678e71060bdaf5e14b5 | 0c59cd403d8dd051d9f279715d76c7d3642b677c | /src/main/java/com/kky/tank/cor/ColliderChain.java | 20791a4b66cd9c7a7f89b773cfee095e95fd5719 | []
| no_license | Maoyf/tank | d8e0a4bc37316ff1f6cb694f14794c61f5c98bd4 | 5e34f2a99bb5c849d61f8e00ed86f90fc494a2d4 | refs/heads/master | 2023-06-01T22:01:31.610146 | 2021-06-25T07:34:20 | 2021-06-25T07:34:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 934 | java | package com.kky.tank.cor;
import com.kky.tank.GameObject;
import java.util.LinkedList;
import java.util.List;
/**
* @author 柯凯元
* @create 2021/6/15 21:16
*/
/**
* 碰撞检测的责任链
* CollideChain为什么要继承Collider?
* 这样两个链条就可以拼接到一起
*/
public class ColliderChain implements Collider {
private List<Collider> colliders = new LinkedList<>();
public ColliderChain() {
add(new BulletTankCollider());
add(new TanksCollider());
add(new BulletWallCollier());
add(new TankWallCollider());
}
public void add(Collider collider) {
colliders.add(collider);
}
@Override
public boolean collide(GameObject o1, GameObject o2) {
for (int i = 0; i < colliders.size(); i++) {
if (colliders.get(i).collide(o1, o2)) {
return false;
}
}
return true;
}
}
| [
"[email protected]"
]
| |
5f2700a7242a457ac9a97054135849b32f005ba4 | 9c69114192afc883e2ecdc0d733a58c225fbb67c | /src/main/java/com/fpx/demo/exception/ExceptionEnum.java | 2ca416dc97b829c591a007384af550d41252ad33 | []
| no_license | yundiangeqian/spring-boot-base-demo | 3b2e9454515fb9637b5e7bfe4957267229ad9e4e | 3f52feb54b59bd2f143fd43039225cec83f57cb9 | refs/heads/master | 2020-06-13T22:31:39.362920 | 2019-10-24T09:31:31 | 2019-10-24T09:31:31 | 194,809,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 779 | java | /*
* Copyright (c) 2016 4PX Information Technology Co.,Ltd. All rights reserved.
*/
package com.fpx.demo.exception;
/**
*
* @author CaoMian
* @date 2019年7月3日
*/
public enum ExceptionEnum {
EXCEPTION_NULLPOINTE("00001", "空指针异常");
/**
* 错误代码
*/
private String code;
/**
* 通用提示
*/
private String message;
ExceptionEnum(String code, String message) {
this.code = code;
this.message = message;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| [
"[email protected]"
]
| |
b38ae10368ef377a08301e275dcba1f80d45a584 | 21d6bb2a4b1470ecfb2409d933a248fb1a5a1b6e | /src/com/mobilefox/superclean/swipeback/SwipeBackLayout.java | e964722c14457d1ea91e86be54b4b7028d6dc675 | []
| no_license | wds1181977/SuperClean-master | 1a53cd68161c94a22fe5e0db3ea1cd638029c76a | 51559cbc44d75d4143fd270295424456baa4eb5e | refs/heads/master | 2016-09-12T02:00:29.231828 | 2016-04-29T08:36:05 | 2016-04-29T08:36:05 | 54,952,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,836 | java | package com.mobilefox.superclean.swipeback;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.mobilefox.superclean.R;
import java.util.ArrayList;
import java.util.List;
public class SwipeBackLayout extends FrameLayout {
/**
* Minimum velocity that will be detected as a fling
*/
private static final int MIN_FLING_VELOCITY = 400; // dips per second
private static final int DEFAULT_SCRIM_COLOR = 0x99000000;
private static final int FULL_ALPHA = 255;
/**
* Edge flag indicating that the left edge should be affected.
*/
public static final int EDGE_LEFT = ViewDragHelper.EDGE_LEFT;
/**
* Edge flag indicating that the right edge should be affected.
*/
public static final int EDGE_RIGHT = ViewDragHelper.EDGE_RIGHT;
/**
* Edge flag indicating that the bottom edge should be affected.
*/
public static final int EDGE_BOTTOM = ViewDragHelper.EDGE_BOTTOM;
/**
* Edge flag set indicating all edges should be affected.
*/
public static final int EDGE_ALL = EDGE_LEFT | EDGE_RIGHT | EDGE_BOTTOM;
/**
* A view is not currently being dragged or animating as a result of a
* fling/snap.
*/
public static final int STATE_IDLE = ViewDragHelper.STATE_IDLE;
/**
* A view is currently being dragged. The position is currently changing as
* a result of user input or simulated user input.
*/
public static final int STATE_DRAGGING = ViewDragHelper.STATE_DRAGGING;
/**
* A view is currently settling into place as a result of a fling or
* predefined non-interactive motion.
*/
public static final int STATE_SETTLING = ViewDragHelper.STATE_SETTLING;
/**
* Default threshold of scroll
*/
private static final float DEFAULT_SCROLL_THRESHOLD = 0.3f;
private static final int OVERSCROLL_DISTANCE = 10;
private static final int[] EDGE_FLAGS = {
EDGE_LEFT, EDGE_RIGHT, EDGE_BOTTOM, EDGE_ALL
};
private int mEdgeFlag;
/**
* Threshold of scroll, we will close the activity, when scrollPercent over
* this value;
*/
private float mScrollThreshold = DEFAULT_SCROLL_THRESHOLD;
private Activity mActivity;
private boolean mEnable = true;
private View mContentView;
private ViewDragHelper mDragHelper;
private float mScrollPercent;
private int mContentLeft;
private int mContentTop;
/**
* The set of listeners to be sent events through.
*/
private List<SwipeListener> mListeners;
private Drawable mShadowLeft;
private Drawable mShadowRight;
private Drawable mShadowBottom;
private float mScrimOpacity;
private int mScrimColor = DEFAULT_SCRIM_COLOR;
private boolean mInLayout;
private Rect mTmpRect = new Rect();
/**
* Edge being dragged
*/
private int mTrackingEdge;
public SwipeBackLayout(Context context) {
this(context, null);
}
public SwipeBackLayout(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.SwipeBackLayoutStyle);
}
public SwipeBackLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs);
mDragHelper = ViewDragHelper.create(this, new ViewDragCallback());
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SwipeBackLayout, defStyle,
R.style.SwipeBackLayout);
int edgeSize = a.getDimensionPixelSize(R.styleable.SwipeBackLayout_edge_size, -1);
if (edgeSize > 0)
setEdgeSize(edgeSize);
int mode = EDGE_FLAGS[a.getInt(R.styleable.SwipeBackLayout_edge_flag, 0)];
setEdgeTrackingEnabled(mode);
int shadowLeft = a.getResourceId(R.styleable.SwipeBackLayout_shadow_left,
R.drawable.shadow_left);
int shadowRight = a.getResourceId(R.styleable.SwipeBackLayout_shadow_right,
R.drawable.shadow_right);
int shadowBottom = a.getResourceId(R.styleable.SwipeBackLayout_shadow_bottom,
R.drawable.shadow_bottom);
setShadow(shadowLeft, EDGE_LEFT);
setShadow(shadowRight, EDGE_RIGHT);
setShadow(shadowBottom, EDGE_BOTTOM);
a.recycle();
final float density = getResources().getDisplayMetrics().density;
final float minVel = MIN_FLING_VELOCITY * density;
mDragHelper.setMinVelocity(minVel);
mDragHelper.setMaxVelocity(minVel * 2f);
}
/**
* Sets the sensitivity of the NavigationLayout.
*
* @param context The application context.
* @param sensitivity value between 0 and 1, the final value for touchSlop =
* ViewConfiguration.getScaledTouchSlop * (1 / s);
*/
public void setSensitivity(Context context, float sensitivity) {
mDragHelper.setSensitivity(context, sensitivity);
}
/**
* Set up contentView which will be moved by user gesture
*
* @param view
*/
private void setContentView(View view) {
mContentView = view;
}
public void setEnableGesture(boolean enable) {
mEnable = enable;
}
/**
* Enable edge tracking for the selected edges of the parent view. The
* callback's
* methods will only be invoked for edges for which edge tracking has been
* enabled.
*
* @param edgeFlags Combination of edge flags describing the edges to watch
* @see #EDGE_LEFT
* @see #EDGE_RIGHT
* @see #EDGE_BOTTOM
*/
public void setEdgeTrackingEnabled(int edgeFlags) {
mEdgeFlag = edgeFlags;
mDragHelper.setEdgeTrackingEnabled(mEdgeFlag);
}
/**
* Set a color to use for the scrim that obscures primary content while a
* drawer is open.
*
* @param color Color to use in 0xAARRGGBB format.
*/
public void setScrimColor(int color) {
mScrimColor = color;
invalidate();
}
/**
* Set the size of an edge. This is the range in pixels along the edges of
* this view that will actively detect edge touches or drags if edge
* tracking is enabled.
*
* @param size The size of an edge in pixels
*/
public void setEdgeSize(int size) {
mDragHelper.setEdgeSize(size);
}
/**
* Register a callback to be invoked when a swipe event is sent to this
* view.
*
* @param listener the swipe listener to attach to this view
* @deprecated use {@link #addSwipeListener} instead
*/
@Deprecated
public void setSwipeListener(SwipeListener listener) {
addSwipeListener(listener);
}
/**
* Add a callback to be invoked when a swipe event is sent to this view.
*
* @param listener the swipe listener to attach to this view
*/
public void addSwipeListener(SwipeListener listener) {
if (mListeners == null) {
mListeners = new ArrayList<SwipeListener>();
}
mListeners.add(listener);
}
/**
* Removes a listener from the set of listeners
*
* @param listener
*/
public void removeSwipeListener(SwipeListener listener) {
if (mListeners == null) {
return;
}
mListeners.remove(listener);
}
public static interface SwipeListener {
/**
* Invoke when state change
*
* @param state flag to describe scroll state
* @param scrollPercent scroll percent of this view
* @see #STATE_IDLE
* @see #STATE_DRAGGING
* @see #STATE_SETTLING
*/
public void onScrollStateChange(int state, float scrollPercent);
/**
* Invoke when edge touched
*
* @param edgeFlag edge flag describing the edge being touched
* @see #EDGE_LEFT
* @see #EDGE_RIGHT
* @see #EDGE_BOTTOM
*/
public void onEdgeTouch(int edgeFlag);
/**
* Invoke when scroll percent over the threshold for the first time
*/
public void onScrollOverThreshold();
}
/**
* Set scroll threshold, we will close the activity, when scrollPercent over
* this value
*
* @param threshold
*/
public void setScrollThresHold(float threshold) {
if (threshold >= 1.0f || threshold <= 0) {
throw new IllegalArgumentException("Threshold value should be between 0 and 1.0");
}
mScrollThreshold = threshold;
}
/**
* Set a drawable used for edge shadow.
*
* @param shadow Drawable to use
* @see #EDGE_LEFT
* @see #EDGE_RIGHT
* @see #EDGE_BOTTOM
*/
public void setShadow(Drawable shadow, int edgeFlag) {
if ((edgeFlag & EDGE_LEFT) != 0) {
mShadowLeft = shadow;
} else if ((edgeFlag & EDGE_RIGHT) != 0) {
mShadowRight = shadow;
} else if ((edgeFlag & EDGE_BOTTOM) != 0) {
mShadowBottom = shadow;
}
invalidate();
}
/**
* Set a drawable used for edge shadow.
*
* @param resId Resource of drawable to use
* @see #EDGE_LEFT
* @see #EDGE_RIGHT
* @see #EDGE_BOTTOM
*/
public void setShadow(int resId, int edgeFlag) {
setShadow(getResources().getDrawable(resId), edgeFlag);
}
/**
* Scroll out contentView and finish the activity
*/
public void scrollToFinishActivity() {
final int childWidth = mContentView.getWidth();
final int childHeight = mContentView.getHeight();
int left = 0, top = 0;
if ((mEdgeFlag & EDGE_LEFT) != 0) {
left = childWidth + mShadowLeft.getIntrinsicWidth() + OVERSCROLL_DISTANCE;
mTrackingEdge = EDGE_LEFT;
} else if ((mEdgeFlag & EDGE_RIGHT) != 0) {
left = -childWidth - mShadowRight.getIntrinsicWidth() - OVERSCROLL_DISTANCE;
mTrackingEdge = EDGE_RIGHT;
} else if ((mEdgeFlag & EDGE_BOTTOM) != 0) {
top = -childHeight - mShadowBottom.getIntrinsicHeight() - OVERSCROLL_DISTANCE;
mTrackingEdge = EDGE_BOTTOM;
}
mDragHelper.smoothSlideViewTo(mContentView, left, top);
invalidate();
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (!mEnable) {
return false;
}
try {
return mDragHelper.shouldInterceptTouchEvent(event);
} catch (ArrayIndexOutOfBoundsException e) {
// FIXME: handle exception
// issues #9
return false;
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (!mEnable) {
return false;
}
mDragHelper.processTouchEvent(event);
return true;
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
mInLayout = true;
if (mContentView != null)
mContentView.layout(mContentLeft, mContentTop,
mContentLeft + mContentView.getMeasuredWidth(),
mContentTop + mContentView.getMeasuredHeight());
mInLayout = false;
}
@Override
public void requestLayout() {
if (!mInLayout) {
super.requestLayout();
}
}
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
final boolean drawContent = child == mContentView;
boolean ret = super.drawChild(canvas, child, drawingTime);
if (mScrimOpacity > 0 && drawContent
&& mDragHelper.getViewDragState() != ViewDragHelper.STATE_IDLE) {
drawShadow(canvas, child);
drawScrim(canvas, child);
}
return ret;
}
private void drawScrim(Canvas canvas, View child) {
final int baseAlpha = (mScrimColor & 0xff000000) >>> 24;
final int alpha = (int) (baseAlpha * mScrimOpacity);
final int color = alpha << 24 | (mScrimColor & 0xffffff);
if ((mTrackingEdge & EDGE_LEFT) != 0) {
canvas.clipRect(0, 0, child.getLeft(), getHeight());
} else if ((mTrackingEdge & EDGE_RIGHT) != 0) {
canvas.clipRect(child.getRight(), 0, getRight(), getHeight());
} else if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
canvas.clipRect(child.getLeft(), child.getBottom(), getRight(), getHeight());
}
canvas.drawColor(color);
}
private void drawShadow(Canvas canvas, View child) {
final Rect childRect = mTmpRect;
child.getHitRect(childRect);
if ((mEdgeFlag & EDGE_LEFT) != 0) {
mShadowLeft.setBounds(childRect.left - mShadowLeft.getIntrinsicWidth(), childRect.top,
childRect.left, childRect.bottom);
mShadowLeft.setAlpha((int) (mScrimOpacity * FULL_ALPHA));
mShadowLeft.draw(canvas);
}
if ((mEdgeFlag & EDGE_RIGHT) != 0) {
mShadowRight.setBounds(childRect.right, childRect.top,
childRect.right + mShadowRight.getIntrinsicWidth(), childRect.bottom);
mShadowRight.setAlpha((int) (mScrimOpacity * FULL_ALPHA));
mShadowRight.draw(canvas);
}
if ((mEdgeFlag & EDGE_BOTTOM) != 0) {
mShadowBottom.setBounds(childRect.left, childRect.bottom, childRect.right,
childRect.bottom + mShadowBottom.getIntrinsicHeight());
mShadowBottom.setAlpha((int) (mScrimOpacity * FULL_ALPHA));
mShadowBottom.draw(canvas);
}
}
public void attachToActivity(Activity activity) {
mActivity = activity;
TypedArray a = activity.getTheme().obtainStyledAttributes(new int[]{
android.R.attr.windowBackground
});
int background = a.getResourceId(0, 0);
a.recycle();
ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
decorChild.setBackgroundResource(background);
decor.removeView(decorChild);
addView(decorChild);
setContentView(decorChild);
decor.addView(this);
}
@Override
public void computeScroll() {
mScrimOpacity = 1 - mScrollPercent;
if (mDragHelper.continueSettling(true)) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
private class ViewDragCallback extends ViewDragHelper.Callback {
private boolean mIsScrollOverValid;
@Override
public boolean tryCaptureView(View view, int i) {
boolean ret = mDragHelper.isEdgeTouched(mEdgeFlag, i);
if (ret) {
if (mDragHelper.isEdgeTouched(EDGE_LEFT, i)) {
mTrackingEdge = EDGE_LEFT;
} else if (mDragHelper.isEdgeTouched(EDGE_RIGHT, i)) {
mTrackingEdge = EDGE_RIGHT;
} else if (mDragHelper.isEdgeTouched(EDGE_BOTTOM, i)) {
mTrackingEdge = EDGE_BOTTOM;
}
if (mListeners != null && !mListeners.isEmpty()) {
for (SwipeListener listener : mListeners) {
listener.onEdgeTouch(mTrackingEdge);
}
}
mIsScrollOverValid = true;
}
return ret;
}
@Override
public int getViewHorizontalDragRange(View child) {
return mEdgeFlag & (EDGE_LEFT | EDGE_RIGHT);
}
@Override
public int getViewVerticalDragRange(View child) {
return mEdgeFlag & EDGE_BOTTOM;
}
@Override
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
super.onViewPositionChanged(changedView, left, top, dx, dy);
if ((mTrackingEdge & EDGE_LEFT) != 0) {
mScrollPercent = Math.abs((float) left
/ (mContentView.getWidth() + mShadowLeft.getIntrinsicWidth()));
} else if ((mTrackingEdge & EDGE_RIGHT) != 0) {
mScrollPercent = Math.abs((float) left
/ (mContentView.getWidth() + mShadowRight.getIntrinsicWidth()));
} else if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
mScrollPercent = Math.abs((float) top
/ (mContentView.getHeight() + mShadowBottom.getIntrinsicHeight()));
}
mContentLeft = left;
mContentTop = top;
invalidate();
if (mScrollPercent < mScrollThreshold && !mIsScrollOverValid) {
mIsScrollOverValid = true;
}
if (mListeners != null && !mListeners.isEmpty()
&& mDragHelper.getViewDragState() == STATE_DRAGGING
&& mScrollPercent >= mScrollThreshold && mIsScrollOverValid) {
mIsScrollOverValid = false;
for (SwipeListener listener : mListeners) {
listener.onScrollOverThreshold();
}
}
if (mScrollPercent >= 1) {
if (!mActivity.isFinishing())
mActivity.finish();
}
}
@Override
public void onViewReleased(View releasedChild, float xvel, float yvel) {
final int childWidth = releasedChild.getWidth();
final int childHeight = releasedChild.getHeight();
int left = 0, top = 0;
if ((mTrackingEdge & EDGE_LEFT) != 0) {
left = xvel > 0 || xvel == 0 && mScrollPercent > mScrollThreshold ? childWidth
+ mShadowLeft.getIntrinsicWidth() + OVERSCROLL_DISTANCE : 0;
} else if ((mTrackingEdge & EDGE_RIGHT) != 0) {
left = xvel < 0 || xvel == 0 && mScrollPercent > mScrollThreshold ? -(childWidth
+ mShadowLeft.getIntrinsicWidth() + OVERSCROLL_DISTANCE) : 0;
} else if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
top = yvel < 0 || yvel == 0 && mScrollPercent > mScrollThreshold ? -(childHeight
+ mShadowBottom.getIntrinsicHeight() + OVERSCROLL_DISTANCE) : 0;
}
mDragHelper.settleCapturedViewAt(left, top);
invalidate();
}
@Override
public int clampViewPositionHorizontal(View child, int left, int dx) {
int ret = 0;
if ((mTrackingEdge & EDGE_LEFT) != 0) {
ret = Math.min(child.getWidth(), Math.max(left, 0));
} else if ((mTrackingEdge & EDGE_RIGHT) != 0) {
ret = Math.min(0, Math.max(left, -child.getWidth()));
}
return ret;
}
@Override
public int clampViewPositionVertical(View child, int top, int dy) {
int ret = 0;
if ((mTrackingEdge & EDGE_BOTTOM) != 0) {
ret = Math.min(0, Math.max(top, -child.getHeight()));
}
return ret;
}
@Override
public void onViewDragStateChanged(int state) {
super.onViewDragStateChanged(state);
if (mListeners != null && !mListeners.isEmpty()) {
for (SwipeListener listener : mListeners) {
listener.onScrollStateChange(state, mScrollPercent);
}
}
}
}
}
| [
"[email protected]"
]
| |
66d9bbb15bf10c4723306dec51f270c5df9dcd4d | 4df2493c78eca1926ce8d67bcbf4c358ea9552ff | /src/main/java/com/vdcrx/rest/api/v1/mapper/entities/AddressMapper.java | 3ea96d81f0870071c4e8490795b8782b23aaf6b9 | []
| no_license | rdelpilar/vdcrx-restful-api | 7032260116e8a8e245cae1f39e37f2da8ed58d67 | d779c6e5709a117e9cd5a352f90925d9da4c32ce | refs/heads/master | 2020-03-10T10:12:54.040600 | 2018-06-20T23:14:21 | 2018-06-20T23:14:21 | 129,328,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | package com.vdcrx.rest.api.v1.mapper.entities;
import com.vdcrx.rest.api.v1.model.dto.AddressDto;
import com.vdcrx.rest.domain.entities.Address;
import org.mapstruct.CollectionMappingStrategy;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import java.util.List;
import java.util.Set;
/**
* Address mapper
*
* @author Ranel del Pilar
*/
@Mapper(componentModel = "spring",
collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED,
unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface AddressMapper {
AddressDto mapToAddressDto(final Address address);
Address mapToAddress(final AddressDto dto);
List<AddressDto> mapToAddressDtoList(final Set<Address> addresses);
}
| [
"[email protected]"
]
| |
461ec77c3d929cd8355e44e8b29e907eb56b393c | ff7ba57455adf6b95ec0b42c4030601d895e7552 | /src/main/java/com/mmall/util/DateTimeUtil.java | 8e6834788f72ce647e925ef855294aee92be752c | []
| no_license | colazxd/springmall | af42dcb35ff1bcb5ccc068f81a7cf73593e6dd1b | d1d2b03da5f9fbd5119872d411c72e52631c4d86 | refs/heads/master | 2022-12-22T08:13:26.585152 | 2019-05-29T15:38:41 | 2019-05-29T15:38:41 | 183,912,252 | 0 | 0 | null | 2022-12-16T03:06:14 | 2019-04-28T13:31:45 | Java | UTF-8 | Java | false | false | 1,388 | java | package com.mmall.util;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.util.Date;
/**
* @author colaz
* @date 2019/5/3
**/
public class DateTimeUtil {
//使用joda time
public static final String STANDARD_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static Date strToDate(String strDate, String format) {
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(format);
DateTime dateTime = dateTimeFormatter.parseDateTime(strDate);
return dateTime.toDate();
}
public static Date strToDate(String strDate) {
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(STANDARD_FORMAT);
DateTime dateTime = dateTimeFormatter.parseDateTime(strDate);
return dateTime.toDate();
}
public static String dateToStr(Date date, String format) {
if (date == null)
return StringUtils.EMPTY;
DateTime dateTime = new DateTime(date);
return dateTime.toString(format);
}
public static String dateToStr(Date date) {
if (date == null)
return StringUtils.EMPTY;
DateTime dateTime = new DateTime(date);
return dateTime.toString(STANDARD_FORMAT);
}
}
| [
"[email protected]"
]
| |
f6c0d64bbd097d428f39fb05a3b84f75a32f97f7 | e86b98ab6cfc6deced170e7152622df1a5d91de9 | /core/src/main/java/io/nessus/actions/core/model/ModelRouteBuilder.java | 7931144a614ceb2a3f93a16ce287e6537f734d77 | [
"Apache-2.0"
]
| permissive | tdiesler/nessus-actions | be72f11e740b549c4270063c244ce641991ba07c | 38e3cbd9fb6dae58743ae1f07d9e3dcb50da1c0f | refs/heads/master | 2023-05-31T20:38:15.455814 | 2021-03-08T09:09:28 | 2021-06-09T09:08:50 | 278,860,107 | 1 | 0 | Apache-2.0 | 2021-04-29T21:57:57 | 2020-07-11T12:46:51 | Java | UTF-8 | Java | false | false | 3,394 | java | package io.nessus.actions.core.model;
import static io.nessus.actions.core.model.RouteModel.CAMEL_ROUTE_MODEL_RESOURCE_NAME;
import java.io.IOException;
import java.net.URL;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.model.dataformat.JsonLibrary;
import org.apache.camel.spi.TypeConverterRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.nessus.actions.core.model.MarshalStep.MarshalStepContent;
import io.nessus.actions.core.model.UnmarshalStep.UnmarshalStepContent;
import io.nessus.common.AssertState;
/**
* A generic model based route builder
*/
public class ModelRouteBuilder extends RouteBuilder {
static final Logger LOG = LoggerFactory.getLogger(ModelRouteBuilder.class);
private String modelResource;
public ModelRouteBuilder() {
modelResource = "/" + CAMEL_ROUTE_MODEL_RESOURCE_NAME;
}
public ModelRouteBuilder withModelResource(String respath) {
this.modelResource = respath;
return this;
}
@Override
public void configure() throws Exception {
configure(this);
}
public void configure(RouteBuilder routes) throws Exception {
configureWithModel(routes, loadModel());
}
public RouteModel loadModel() throws IOException {
// Find the Camel Actions definition resource
URL resurl = getClass().getResource(modelResource);
AssertState.notNull(resurl, "Cannot find: " + modelResource);
// Read the Camel Actions Model
LOG.info("Loading model ...");
RouteModel model = RouteModel.read(resurl);
return model;
}
public void configureWithModel(RouteBuilder routes, RouteModel model) {
LOG.info("Configure with {}", model);
// Define the Camel route using the Model
String fromUri = model.getFrom().toCamelUri();
LOG.info("From: {}", fromUri);
RouteDefinition rdef = routes.fromF(fromUri);
model.getSteps().forEach(step -> {
if (step instanceof ToStep) {
ToStep aux = (ToStep) step;
String toUri = aux.toCamelUri();
LOG.info("To: {}", toUri);
rdef.to(toUri);
}
else if (step instanceof MarshalStep) {
MarshalStep aux = (MarshalStep) step;
MarshalStepContent content = aux.getContent();
String format = content.getFormat();
LOG.info("Marshal: {}", format);
if ("json".equals(format)) {
Boolean pretty = content.isPretty();
rdef.marshal().json(JsonLibrary.Jackson, pretty);
}
}
else if (step instanceof UnmarshalStep) {
UnmarshalStep aux = (UnmarshalStep) step;
UnmarshalStepContent content = aux.getContent();
String format = content.getFormat();
LOG.info("Unmarshal: {}", format);
if ("json".equals(format)) {
rdef.unmarshal().json(JsonLibrary.Jackson);
}
}
});
}
public void addToCamelContext(CamelContext context) throws Exception {
// [TODO] Remove when this is part of Camel
// [CAMEL-15301] Provide various type converters for camel-xchange
TypeConverterRegistry registry = context.getTypeConverterRegistry();
registry.addTypeConverters(new TickerTypeConverters());
}
} | [
"[email protected]"
]
| |
5a51f4dec298ac6baecec7a35ad03730a4c4a470 | 5242a4b3158e5af84fa6288b08c3cac9c2009798 | /PorpoiseMobileApp/PorpoiseMobileApp/PorpoiseMobileApp.Droid/obj/Debug/android/src/md5204979768ea66d3a79201c4efd7c602a/MvxFragmentCompatActivity_1.java | d78c445b1a786f07f5f0e6f99620eb9dd337f544 | []
| no_license | LuisSoftwareMaster/Mapp | 19241fc4b20059b80e2f00201a7d8bd40897fa38 | 80ad6efa9d8caa9af33d70c0226f144c08c1c00f | refs/heads/master | 2020-12-02T18:06:41.002754 | 2017-07-06T23:49:36 | 2017-07-06T23:49:36 | 96,471,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,210 | java | package md5204979768ea66d3a79201c4efd7c602a;
public abstract class MvxFragmentCompatActivity_1
extends mvvmcross.droid.support.v7.appcompat.MvxFragmentCompatActivity
implements
mono.android.IGCUserPeer
{
/** @hide */
public static final String __md_methods;
static {
__md_methods =
"";
mono.android.Runtime.register ("MvvmCross.Droid.Support.V7.AppCompat.MvxFragmentCompatActivity`1, MvvmCross.Droid.Support.V7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", MvxFragmentCompatActivity_1.class, __md_methods);
}
public MvxFragmentCompatActivity_1 () throws java.lang.Throwable
{
super ();
if (getClass () == MvxFragmentCompatActivity_1.class)
mono.android.TypeManager.Activate ("MvvmCross.Droid.Support.V7.AppCompat.MvxFragmentCompatActivity`1, MvvmCross.Droid.Support.V7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { });
}
private java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void monodroidClearReferences ()
{
if (refList != null)
refList.clear ();
}
}
| [
"[email protected]"
]
| |
91ae2dfac84f325425cfefef07ff25b3c1906ad6 | d944234f35651bd5a23f8d14b77555390c729926 | /springmvc-learn/springmvc-day1/src/main/java/com/itheima/domain/Account.java | 592bf4866ffacf1b328282bf985557d0ca6f6865 | []
| no_license | LJJ1994/Java-Learn | 4f2d5981c291da24b4be11afa9506e3665d45d6d | 1932dfc8416f7e4498c848671f59e2a816b1316b | refs/heads/master | 2022-11-06T09:34:32.841582 | 2020-08-01T05:00:09 | 2020-08-01T05:00:09 | 247,892,292 | 0 | 0 | null | 2022-10-12T20:44:53 | 2020-03-17T06:06:00 | Java | UTF-8 | Java | false | false | 1,114 | java | package com.itheima.domain;
import java.io.Serializable;
/**
* @Author: LJJ
* @Program: springmvc-day1
* @Description:
* @Create: 2020-05-10 03:15:15
* @Modified By:
*/
public class Account implements Serializable {
private Integer id;
private String name;
private Float money;
private Address address;
@Override
public String toString() {
return "Account{" +
"id=" + id +
", name='" + name + '\'' +
", money=" + money +
", address=" + address +
'}';
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Float getMoney() {
return money;
}
public void setMoney(Float money) {
this.money = money;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
| [
"[email protected]"
]
| |
b707d4a9a673fd181b4e07c5fd668b9c8d368db1 | 2c4b8b59db6111c3a0a33a062743ff26437fe776 | /anywherefitness/src/main/java/com/lambdaschool/anywherefitness/models/package-info.java | f24cff799813cd3e931fec81124fd88db1cbc62a | [
"MIT"
]
| permissive | MartinezM87/bw-backend | 0856ffb613085b1efd6ea715b1b9120813b7232e | 8264cfc0404c52c16f3a0ea85c0e9285a4a1b890 | refs/heads/master | 2022-11-24T06:32:49.080593 | 2020-07-31T05:50:49 | 2020-07-31T05:50:49 | 283,816,578 | 0 | 0 | null | 2020-07-30T15:51:29 | 2020-07-30T15:51:28 | null | UTF-8 | Java | false | false | 338 | java | /**
* contains the layouts of all data used in the application.
* This included persistent data that is saved to a database, and non-persistent data used only during application execution.
*
* @author John Mitchell ([email protected]) with Lambda School unless otherwise noted.
*/
package com.lambdaschool.anywherefitness.models; | [
"[email protected]"
]
| |
0b406c2524723bf1c7e9e8d38a9a9f0ba8bfc836 | d5a18ee9626b87dfa7e1dc854d1929fe8ab959bf | /recursao-projeto/src/br/univille/estd/recursao/exemplo/Main.java | 08e66d4d08d6c68fea72156dea22592b30dcf4bd | []
| no_license | gabrisamartinez/estrutura-de-dados-2020 | f3aaa49c77c9bf9fa1155b25e3cccad2bafc55f9 | 9e668ade19e1fa27f32a9fc8524ecb5d6a11e814 | refs/heads/master | 2022-12-28T00:04:50.055323 | 2020-10-10T14:40:03 | 2020-10-10T14:40:03 | 251,451,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,432 | java | package br.univille.estd.recursao.exemplo;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void procurePelaCaixa(Caixa caixa){
// Coloca a caixa principal no monte
List<Caixa> monte = new ArrayList<Caixa>();
monte.add(caixa);
while(!monte.isEmpty()){
// Pega uma caixa do monte
Caixa c = monte.remove(0);
System.out.println(c.toString());
// Caixa está vazia?
if(c.getItem() != null){
Item i = c.getItem();
if(i instanceof Chave){
System.out.println("Achei a chave");
}else{
// O item é uma Caixa Adiciona no monte
monte.add((Caixa) i);
}
}
}
}
public static void procurePelaCaixaRecursivo(Caixa caixa){
System.out.println(caixa.toString());
// Caixa está vazia?
if(caixa.getItem() != null){
// pega o item
Item i = caixa.getItem();
// O item é uma chave?
if(i instanceof Chave){
// Encontrei a chave, finaliza
System.out.println("Achei a chave");
}else{
// chamada recursiva
procurePelaCaixaRecursivo((Caixa)i );
}
}
}
public static void main(String[] args) {
Chave chave = new Chave();
Caixa a = new Caixa("a", chave);
Caixa b = new Caixa("b", a);
Caixa c = new Caixa("c", b);
Caixa d = new Caixa("d", c);
Caixa e = new Caixa("e", d);
procurePelaCaixa(e);
System.out.println("==================");
procurePelaCaixaRecursivo(e);
}
}
| [
"[email protected]"
]
| |
2c5ca0442a86473a6efbb06f68941ebc9154a09e | b8ac6808d131403d34398551859271ea7cecf88d | /dongyimai-sms-service/src/main/java/com/sun/sms/controller/smsController.java | 0392cc2de7dc6480a3a20a84d6c2f9dbc0be6f01 | []
| no_license | SunBin528/Dongyimai | 4bd7bc02fc3879d34776a94145467239ed888777 | 15e4c26a6e1ad28ffed9d9dea6283e797c8d46d1 | refs/heads/master | 2023-05-08T02:39:55.723875 | 2021-06-02T14:51:23 | 2021-06-02T14:51:23 | 373,193,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,043 | java | package com.sun.sms.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.jms.*;
@RestController
public class smsController {
@Autowired
private JmsTemplate jmsTemplate;
@Autowired
private Destination queueSmsDestination;
@RequestMapping("/sendsms")
public String sendMsg(final String mobile,final String msg){
jmsTemplate.send(queueSmsDestination, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
MapMessage mapMessage = session.createMapMessage();
mapMessage.setString("mobile",mobile);
mapMessage.setString("param",msg);
return mapMessage;
}
});
return "sendOK!!!!";
}
}
| [
"[email protected]"
]
| |
6c410dd0d7430d842053703c149a71685e6641aa | 4ee20015ad08afa094b23bd3c75cdec1e19c77e6 | /dev/infrared2/agent/src/main/java/net/sf/infrared/agent/transport/impl/PooledAggregator.java | 623fc715cec64818e095a6f205b25eddb81910bd | []
| no_license | anyframejava/anyframe-monitoring | 5b2953c7839f6f643e265cefe9cfd0ec8ec1d535 | 07590d5d321fd6e4a6d6f1f61ca2b011f4bc3fcf | refs/heads/master | 2021-01-17T18:31:53.009247 | 2016-11-07T01:36:20 | 2016-11-07T01:36:20 | 71,343,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,602 | java | /*
* Copyright 2005 Tavant Technologies and Contributors
*
* 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.
*
*
*
* Original Author: binil.thomas (Tavant Technologies)
* Contributor(s): -;
*
*/
package net.sf.infrared.agent.transport.impl;
import net.sf.infrared.agent.MonitorConfig;
import net.sf.infrared.agent.transport.Aggregator;
import net.sf.infrared.agent.transport.Forwarder;
import net.sf.infrared.base.model.OperationStatistics;
import net.sf.infrared.base.util.LoggingFactory;
import org.apache.log4j.Logger;
import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer;
import EDU.oswego.cs.dl.util.concurrent.Executor;
import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
/**
*
* @author binil.thomas
*/
public class PooledAggregator implements Aggregator {
private static final Logger log = LoggingFactory.getLogger(PooledAggregator.class);
private PooledExecutor executor;
private Aggregator aggregator;
public PooledAggregator(Aggregator aggregator, int bufferLength, int maxThreads) {
this.aggregator = aggregator;
executor = new PooledExecutor(new BoundedBuffer(bufferLength), maxThreads);
executor.setKeepAliveTime(1000 * 60 * 5); // 5 minutes
executor.discardOldestWhenBlocked();
}
public void aggregate(final OperationStatistics stats) {
try {
executor.execute(new Runnable() {
public void run() {
aggregator.aggregate(stats);
}
});
if (log.isDebugEnabled()) {
log.debug("Scheduled " + stats + " for merging");
}
} catch (InterruptedException e) {
log.error("Error in aggregate, ignoring", e);
}
}
public void flush() {
aggregator.flush();
}
public void setForwarder(Forwarder forwarder) {
aggregator.setForwarder(forwarder);
}
public void shutdown() {
executor.shutdownNow();
aggregator.shutdown();
}
public boolean init(MonitorConfig configuration) {
return true;
}
}
| [
"[email protected]"
]
| |
8c07ce2ea4f4a2be49334c9e4c264cf03178bf0e | 6cfab0fcbfdf8b36d6ea01003867163b17579f4a | /base/JH-Publish/src/main/java/com/jh/data/entity/DataResult.java | c69df2058880d2fbc5eab6430ad59eed5429a94e | []
| no_license | Fairy008/JiaHeDC | ac5ed60ae3db608d8656957ce0b0364c2253e51b | bf31ffe8f452f33d2554dd587770467cecd994ee | refs/heads/master | 2020-12-27T13:42:30.153810 | 2020-02-02T10:28:31 | 2020-02-02T10:28:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,223 | java | package com.jh.data.entity;
import com.jh.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* Description:
* 1.成果数据
*
* @version <1> 2018-05-02 15:54 zhangshen: Created.
*/
@ApiModel(value = "成果数据对象")
public class DataResult extends BaseEntity {
@ApiModelProperty(value = "成果数据主键ID")
private Integer resultdataId;
@ApiModelProperty(value = "区域ID")
private Long regionId;
@ApiModelProperty(value = "数据分类ID(卫星Id)")
private Integer satId;
@ApiModelProperty(value = "农作物ID")
private Integer cropId;
@ApiModelProperty(value = "分辨率")
private Integer resolution;
@ApiModelProperty(value = "数据日期")
private Date dataTime;
@ApiModelProperty(value = "文件路径")
private String filePath;
@ApiModelProperty(value = "图层路径")
private String tiffPath;
public Integer getResultdataId() {
return resultdataId;
}
public void setResultdataId(Integer resultdataId) {
this.resultdataId = resultdataId;
}
public Long getRegionId() {
return regionId;
}
public void setRegionId(Long regionId) {
this.regionId = regionId;
}
public Integer getSatId() {
return satId;
}
public void setSatId(Integer satId) {
this.satId = satId;
}
public Integer getCropId() {
return cropId;
}
public void setCropId(Integer cropId) {
this.cropId = cropId;
}
public Integer getResolution() {
return resolution;
}
public void setResolution(Integer resolution) {
this.resolution = resolution;
}
public Date getDataTime() {
return dataTime;
}
public void setDataTime(Date dataTime) {
this.dataTime = dataTime;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getTiffPath() {
return tiffPath;
}
public void setTiffPath(String tiffPath) {
this.tiffPath = tiffPath;
}
}
| [
"[email protected]"
]
| |
319d3da6d91b10f9f6fdcd09314aef5715101c1e | 0eea64effffea3bfc2717ad8ab160ab418cd8e18 | /app/src/main/java/com/fireflylearning/tasksummary/logic/database/TasksDB.java | 72281aeb9e08aab07accdcfbf7c2622dadf0bac7 | []
| no_license | Sivious/TaskSummary | 27aef235c1187c4f16a4e74053f39265d7534657 | a9921de2e03bb9de7637d59d260df26da315a9e1 | refs/heads/master | 2021-05-12T16:26:48.039791 | 2018-01-14T14:53:48 | 2018-01-14T14:53:48 | 117,013,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,138 | java | package com.fireflylearning.tasksummary.logic.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.fireflylearning.tasksummary.framework.DBHelper;
import java.util.Date;
/**
* Created by javie on 12/01/2018.
*/
public class TasksDB {
//region Variables
private DBHelper dbHelper;
private SQLiteDatabase database;
public final static String TASKS_TABLE = "Tasks";
public final static String TASK_ID = "id";
public final static String TASK_TITLE = "title";
public final static String TASK_DESCRIPTION_PAGE_URL = "description_page_url";
public final static String TASK_SET = "set_date";
public final static String TASK_DUE = "due_date";
public final static String TASK_ARCHIVED = "archived";
public final static String TASK_DRAFT = "draft";
public final static String TASK_SHOW_IN_MARKBOOK = "show_in_markbook";
public final static String TASK_HIGHLIGHT_IN_MARKBOOK = "highlight_in_markbook";
public final static String TASK_SHOW_IN_PARENT_PORTAL = "show_in_parent_portal";
public final static String TASK_HIDE_ADDRESSEES = "hide_addressees";
//endregion
/**
* @param context
*/
public TasksDB(Context context) {
dbHelper = new DBHelper(context);
database = dbHelper.getWritableDatabase();
}
public long createRecords(int id, String title, String description_page_url, String set, String due,
Boolean archived, Boolean draft, Boolean show_in_markbook, Boolean highlight_in_markbook, Boolean show_in_parent_portal, Boolean hide_addressees) {
ContentValues contentValues = new ContentValues();
contentValues.put("id", id);
contentValues.put("title", title);
contentValues.put("description_page_url", description_page_url);
contentValues.put("set_date", set);
contentValues.put("due_date", due);
contentValues.put("archived", archived);
contentValues.put("draft", draft);
contentValues.put("show_in_markbook", show_in_markbook);
contentValues.put("highlight_in_markbook", highlight_in_markbook);
contentValues.put("show_in_parent_portal", show_in_parent_portal);
contentValues.put("hide_addressees", hide_addressees);
return database.insert(TASKS_TABLE, null, contentValues);
}
public Cursor selectRecords() {
String[] cols = new String[]{TASK_ID,
TASK_TITLE,
TASK_DESCRIPTION_PAGE_URL,
TASK_SET,
TASK_DUE,
TASK_ARCHIVED,
TASK_DRAFT,
TASK_SHOW_IN_MARKBOOK,
TASK_HIGHLIGHT_IN_MARKBOOK,
TASK_SHOW_IN_PARENT_PORTAL,
TASK_HIDE_ADDRESSEES};
Cursor mCursor = database.query(true, TASKS_TABLE, cols, null
, null, null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor; // iterate to get each value.
}
}
| [
"[email protected]"
]
| |
9a0d06294aa4aeed7c9a75fd70a48a02b245c7f0 | b65a658857a30a9d9ded8073b7fe568f930ac30f | /app/src/main/java/com/mohmedhassan/otleb/RegisterActivity.java | 134bc1dbeb82318c6e72065bb508b7882177a274 | []
| no_license | MohamedHassan275/Otlob | 6332ad34f9505ee3c767b9913a10255669e6b5e1 | b812a7ea92793d2de422daa90e141db29d30df2d | refs/heads/master | 2020-05-15T23:28:42.242362 | 2019-04-21T23:46:31 | 2019-04-21T23:46:31 | 180,132,583 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,961 | java | package com.mohmedhassan.otleb;
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
public class RegisterActivity extends AppCompatActivity {
Context context;
Button Btn_Register;
TextView Tv_Regiseter_Login;
EditText Ed_birthDay_register;
private int mYear, mMonth, mDay;
EditText Ed_Password,Ed_ConfirmPassword;
private CheckBox checkBoxShowPassword;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
RegisterActivity.this.setTitle(R.string.register);
Btn_Register = findViewById(R.id.btn_register_register);
Tv_Regiseter_Login = findViewById(R.id.tv_register_login);
Ed_birthDay_register = findViewById(R.id.Ed_birthDay_register);
Ed_Password = findViewById(R.id.password_register);
Ed_ConfirmPassword = findViewById(R.id.confirmPassword_register);
checkBoxShowPassword = findViewById(R.id.checkboxPassword_register);
checkBoxShowPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// checkbox status is changed from uncheck to checked.
if (!isChecked) {
// show password
Ed_Password.setTransformationMethod(PasswordTransformationMethod.getInstance());
Ed_ConfirmPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
} else {
// hide password
Ed_Password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
Ed_ConfirmPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}
}
});
Ed_birthDay_register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(RegisterActivity.this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
Ed_birthDay_register.setText(dayOfMonth + "/" + (monthOfYear+1) + "/" + year);
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
}
});
Tv_Regiseter_Login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(RegisterActivity.this,LoginActivity.class);
startActivity(intent);
}
});
Btn_Register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
}
| [
"[email protected]"
]
| |
be0d8ad9eeefc6a7d1601c98095c886e9a4cdfe4 | 75407caec38301f2bfd4ec60c975ae2366c6fe81 | /src/main/java/com/apitest/exception/ApiErrorCode.java | 6b329329bf8a8bfc8ba3ba0a9580f4ae62b53f09 | []
| no_license | shariqmvc/EmployeeApi | 50305c05881a0d1109426180f7c8c96fd77f6695 | d8fc46c9bafce123fd1af57281b5b4c542321814 | refs/heads/main | 2023-05-04T03:37:46.448108 | 2021-05-17T17:17:33 | 2021-05-17T17:17:33 | 367,675,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package com.apitest.exception;
public enum ApiErrorCode {
ACCESS_DENIED, MISSING_QUERY_PARAM, INCORRECT_CREDENTIALS, INVALID_INPUT, RESOURCE_NOT_FOUND, EMP_EMAIL_NOT_VERIFIED, RESOURCE_INACTIVE,
NO_ACTIVE_SUBSCRIPTION, EMPNO_ALREADY_EXIST, TRIAL_EXPIRED, INVALID_PASSWORD,INTERNAL_ERROR
}
| [
"[email protected]"
]
| |
6bb695dbe3a9c579b44f1e2d9b68cb0efb114c32 | b43b873aa56b1965d08d5ba18be2aed2a41f7d18 | /livraison/src/game/IA.java | 71a2b817306230fb84481cceef0fdcef5a7d9c10 | []
| no_license | ValentinLe/Mystic_Robot | 003f056244b4c29d93a2fbbebabea6fb83e3a4f7 | af9f02b0b67b2e296b363fdf35cceed9a09625d9 | refs/heads/master | 2021-07-08T12:47:56.096724 | 2019-12-17T14:34:06 | 2019-12-17T14:34:06 | 159,157,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package game;
public interface IA {
/**
* Fais jouer un robot avec comme priorité d'attaquer un autre robot si celui
* ci est à ça portée sinon il choisit une action aléatoirement
* @param player la position de départ
*/
public void execute(Player player);
}
| [
"[email protected]"
]
| |
2c31b58b72b64edc4a3e71e3802ae30f02328549 | a98ca94bb43256fd622f152db5673f3e285904b0 | /jxProvider/src/main/java/com/smartcampus/provider/db1/service/TreeDataService.java | 1dbdd29427f4f4cf8368336b1da5c4ac3d9008a9 | []
| no_license | wangweiccmo/qilongkjhome | 62ea3a9fe1ee206e532a0807ea00692fe784737d | 17532864ec4393d9d2343333dae13c9290d2e5db | refs/heads/master | 2022-07-19T18:26:56.472281 | 2019-05-25T02:14:42 | 2019-05-25T02:14:42 | 174,659,730 | 1 | 0 | null | 2022-06-29T17:14:55 | 2019-03-09T06:55:49 | Vue | UTF-8 | Java | false | false | 2,084 | java | package com.smartcampus.provider.db1.service;
import com.smartcampus.provider.db1.dao.TreeDataMapper;
import com.smartcampus.provider.db1.dao.TreeMapper;
import com.smartcampus.provider.entity.TreeDataEntity;
import com.smartcampus.provider.entity.TreeEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class TreeDataService {
@Autowired
private TreeDataMapper treeDataMapper;
public List<TreeDataEntity> selectNodes(int pid) {
List<TreeDataEntity> nodes = treeDataMapper.selectNodes(pid);
for(int i =0;i<nodes.size();i++){
TreeDataEntity node = nodes.get(i);
// 如果存在clid
if(node.getHasCld() == 1){
node.setChildren(selectNodes(node.getId()));
}
}
return nodes;
}
public List<TreeDataEntity> selectTree(int bindId) {
List<TreeDataEntity> rootNodes = treeDataMapper.selectRoot(bindId);
for(int i =0;i<rootNodes.size();i++){
TreeDataEntity rootNode = rootNodes.get(i);
// 如果存在clid
if(rootNode.getHasCld() == 1){
rootNode.setChildren(selectNodes(rootNode.getId()));
}
}
return rootNodes;
}
public TreeDataEntity addNode(TreeDataEntity treeDataEntity) {
// 查询父节点
TreeDataEntity pNode = treeDataMapper.selectById(treeDataEntity.getPid());
if(pNode != null && pNode.getHasCld() != 1){
pNode.setHasCld(1);
// 更新父节点
treeDataMapper.upNode(pNode);
}
// 插入子节点,返回id
treeDataMapper.addNode(treeDataEntity);
return treeDataEntity;
}
public Integer upNode(TreeDataEntity treeDataEntity) {
return treeDataMapper.upNode(treeDataEntity);
}
public Integer delNode(Integer id) {
return treeDataMapper.delNode(id);
}
}
| [
"wangwei123"
]
| wangwei123 |
1328af0a7595126db218afc01e014dc11d60240e | 5128d9255e602f03c1e91eaa336c72fb7eebff96 | /Spring/SpringModules/src/main/java/com/mx/Rest/ClienteRest.java | 219976aa3ee151236b2a2cf597733fc298de04e3 | []
| no_license | Mario-Developer/Capacitacion-Octubre-2020 | 3bf20ece3c577db4bd09b5006fbc3fab12b2110a | a526207c9bc942376f43411fbccb75df9d4b803c | refs/heads/master | 2023-01-23T09:24:50.489122 | 2020-11-29T15:47:46 | 2020-11-29T15:47:46 | 307,867,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 601 | java | package com.mx.Rest;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mx.Entity.Cliente;
import com.mx.Interfaces.JPAInterface;
import com.mx.dao.ClienteDAO;
@RestController
@RequestMapping ("/cliente")
public class ClienteRest {
@Autowired
private JPAInterface inter;
@GetMapping("/mostrar")
public List<Cliente> mostrar(){
return inter.findAll();
}
}
| [
"[email protected]"
]
| |
b3005dca7ed0f5fac1210872a67c67c7bdc9ae8f | 24d730f5cbfe9b03538c754f2a76c84732ce7f41 | /src/esocial-esquemas/src/main/java/br/jus/tst/esocial/esquemas/eventos/exclusao/TIdeEventoEvtTab.java | acb6c99cef110b67f96755c9e113bf90351cc76b | []
| no_license | josemoreiraneto/esocial | 3b3e92377f28907d056c16e6b8090498f3b30fb7 | dc127b2bb6f9bc234037bdd48889f24051084f9f | refs/heads/master | 2023-07-21T08:39:13.732097 | 2021-08-27T20:47:49 | 2021-08-27T20:47:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,773 | java | //
// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802
// Consulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem.
// Gerado em: 2021.03.05 às 03:21:10 PM BRT
//
package br.jus.tst.esocial.esquemas.eventos.exclusao;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* Informações de identificação do evento.
*
* <p>Classe Java de T_ideEvento_evtTab complex type.
*
* <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe.
*
* <pre>
* <complexType name="T_ideEvento_evtTab">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="tpAmb" type="{http://www.esocial.gov.br/schema/evt/evtExclusao/v_S_01_00_00}TS_tpAmb"/>
* <element name="procEmi" type="{http://www.esocial.gov.br/schema/evt/evtExclusao/v_S_01_00_00}TS_procEmi"/>
* <element name="verProc" type="{http://www.esocial.gov.br/schema/evt/evtExclusao/v_S_01_00_00}TS_verProc"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "T_ideEvento_evtTab", propOrder = {
"tpAmb",
"procEmi",
"verProc"
})
public class TIdeEventoEvtTab {
protected byte tpAmb;
protected byte procEmi;
@XmlElement(required = true)
protected String verProc;
/**
* Obtém o valor da propriedade tpAmb.
*
*/
public byte getTpAmb() {
return tpAmb;
}
/**
* Define o valor da propriedade tpAmb.
*
*/
public void setTpAmb(byte value) {
this.tpAmb = value;
}
/**
* Obtém o valor da propriedade procEmi.
*
*/
public byte getProcEmi() {
return procEmi;
}
/**
* Define o valor da propriedade procEmi.
*
*/
public void setProcEmi(byte value) {
this.procEmi = value;
}
/**
* Obtém o valor da propriedade verProc.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVerProc() {
return verProc;
}
/**
* Define o valor da propriedade verProc.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVerProc(String value) {
this.verProc = value;
}
}
| [
"[email protected]"
]
| |
be85ec349d891ae4b1c06c53a23133ad27cd7259 | 6f1772cb9071b98e8314bb7a6bd86a2af17584ef | /src/main/java/models/ChildItem.java | 4a7825646e984be869c9717a6663bbf2f7a33a53 | []
| no_license | BrentonPoke/email-prompt | 18a3e6c2d44806d0e5ec3f661da3f4ceb9b946e0 | 392a0557f265ae1adc21f74046062ce30a93ada5 | refs/heads/main | 2023-03-12T00:17:10.053038 | 2021-03-04T23:19:18 | 2021-03-04T23:19:18 | 344,502,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | package models;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ChildItem{
@JsonProperty("children")
public ArrayList<ChildItem> children;
@JsonProperty("type")
public String type;
@JsonProperty("content")
public String content;
} | [
"[email protected]"
]
| |
448b5ffd7ed00f998f415143d58e49e3b0481ecf | ce0f733bf2924a060a8a669c33cb54bfe9717f95 | /constructions/src/main/java/com/purplefrog/minecraftExplorer/tree/CompoundLimb.java | e54c1d6828a2ab83078a1c652eec8eb1a4154aa2 | []
| no_license | mutantbob/minecraft-block-hack | 2648d8352f56fc057ec0218f008114c9957c9b3e | a4579761cef6138bbefecec345b6caf6db63c113 | refs/heads/master | 2021-01-23T16:35:15.313574 | 2014-12-05T17:13:53 | 2014-12-05T17:13:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,479 | java | package com.purplefrog.minecraftExplorer.tree;
import com.purplefrog.jwavefrontobj.*;
import com.purplefrog.minecraftExplorer.*;
import com.purplefrog.minecraftExplorer.landscape.*;
import java.util.*;
/**
* Created with IntelliJ IDEA.
* User: thoth
* Date: 10/22/13
* Time: 6:33 PM
* To change this template use File | Settings | File Templates.
*/
public class CompoundLimb
implements F3
{
private final LineMath[] segments;
private final double r5;
private final Joint[] joints;
public Point3D origin, axis;
public double r1, r9;
public double a1, a9;
public double inflation;
public double sigma = 0.8;
protected final double giraffe;
public CompoundLimb(Point3D origin, Point3D axis, double r1, double r9, double a1, double a9, double inflation, Random rand)
{
this.origin = origin;
this.axis = axis;
this.r1 = r1;
this.r9 = r9;
this.a1 = a1;
this.a9 = a9;
this.inflation = inflation;
double axisL = Math2.L2(axis.x, axis.y, axis.z);
giraffe = 0.6;
this.r5 = mix(r1, r9, giraffe);
Point3D p1 = Math2.scaledSum(origin, 1.0, axis, a1 / axisL);
Point3D midpoint = Math2.scaledSum(origin, 1.0, axis, mix(a1, a9, giraffe) / axisL);
Point3D p3 = Math2.scaledSum(origin, 1.0, axis, a9 / axisL);
double d = 0.1* axisL;
Point3D peturbed =
new Point3D(midpoint.x+rand.nextDouble()*d,
midpoint.y+rand.nextDouble()*d,
midpoint.z+rand.nextDouble()*d);
joints = new Joint[3];
joints[0] = new Joint(p1, r1);
joints[1] = new Joint(peturbed, r5);
joints[2] = new Joint(p3, r9);
segments = new LineMath[joints.length-1];
for (int i=0; i<segments.length; i++) {
segments[i] = LineMath.fromEndpoints(joints[i].p, joints[i+1].p);
}
}
public List<F3> lumpCloud(double radius, Random rand)
{
List<F3> nodes = new ArrayList<F3>();
for (int j = 0; j < segments.length; j++) {
LineMath segment = segments[j];
for (int i = 0; i < segment.axisL2; i++) {
Point3D p1 = segment.interpolate(rand.nextDouble());
Point3D p2 = new Point3D(p1.x + randPlusMinus(rand, joints[j].r),
p1.y + randPlusMinus(rand, joints[j].r),
p1.z + randPlusMinus(rand, joints[j].r));
nodes.add(new GaussNode(p2, 1));
}
}
return nodes;
}
private double randPlusMinus(Random rand, double magnitude)
{
return (rand.nextDouble() - 0.5) * 2 * magnitude;
}
public double mix(double zero, double one, double t)
{
return ((1- t)*zero+ t *one);
}
public static double partial(double x,double y,double z, LineMath segment, double r1, double r9)
{
LineMath.Squares sq = segment.getSquares(x, y, z);
if (sq.a < 0 || sq.a > segment.axisL2)
return 999;
double r = BLI(0, sq.a, segment.axisL2, r1, r9);
return sq.b2 / (r * r);
}
@Override
public double eval(double x, double y, double z)
{
double minXsq = 999;
for (int i=0; i<joints.length; i++) {
Joint j = joints[i];
{
double xsq = Math2.L22(x- j.p.x, y - j.p.y, z - j.p.z) / (j.r*j.r);
if (xsq < minXsq)
minXsq = xsq;
}
if (i+1<joints.length) {
double xsq = partial(x,y,z, segments[i], j.r, joints[i+1].r);
if (xsq<minXsq)
minXsq = xsq;
}
}
return inflation * GaussLumps.gauss(minXsq, sigma);
}
public static double BLI(double a1, double a, double a9, double r1, double r9)
{
return SimpleLimb.BLI(a1, a, a9, r1, r9);
}
public Point3D interpolatePoint(double a)
{
double a_ = (a-a1)/(a9-a1);
if (a_<giraffe) {
return Math2.mix(joints[0].p, joints[1].p, a_ / giraffe);
} else {
double b = a_-giraffe;
double g2 = 1-giraffe;
return Math2.mix(joints[1].p, joints[2].p, b / g2);
}
}
public static class Joint
{
public Point3D p;
public double r;
public Joint(Point3D p, double r)
{
this.p = p;
this.r = r;
}
}
}
| [
"[email protected]"
]
| |
c20a25ab5011011f3316ef81adb07e22074012d1 | 60cd70223daf75973672bede0febbc6227fba09b | /app/src/main/java/com/gx/fileexplorer/activity/AppCompatPreferenceActivity.java | a5b4425775a1c0c8e1843fab6c1ebd3feede5eaa | []
| no_license | aartisoft/FileExplorer | 2ca6bf1dbb59cdfb5405108bdc29eb1c9ffa9f8d | e91c162593354f84016e1d009d9c0ce622a4ed69 | refs/heads/master | 2022-01-21T11:46:47.927482 | 2019-08-05T15:01:27 | 2019-08-05T15:01:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,002 | java | package com.gx.fileexplorer.activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.Toolbar;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
* to be used with AppCompat.
*/
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
private AppCompatDelegate mDelegate;
@Override
protected void onCreate(Bundle savedInstanceState) {
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
getDelegate().onPostCreate(savedInstanceState);
}
public ActionBar getSupportActionBar() {
return getDelegate().getSupportActionBar();
}
public void setSupportActionBar(@Nullable Toolbar toolbar) {
getDelegate().setSupportActionBar(toolbar);
}
@Override
public MenuInflater getMenuInflater() {
return getDelegate().getMenuInflater();
}
@Override
public void setContentView(@LayoutRes int layoutResID) {
getDelegate().setContentView(layoutResID);
}
@Override
public void setContentView(View view) {
getDelegate().setContentView(view);
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().setContentView(view, params);
}
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().addContentView(view, params);
}
@Override
protected void onPostResume() {
super.onPostResume();
getDelegate().onPostResume();
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
super.onTitleChanged(title, color);
getDelegate().setTitle(title);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getDelegate().onConfigurationChanged(newConfig);
}
@Override
protected void onStop() {
super.onStop();
getDelegate().onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
getDelegate().onDestroy();
}
public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu();
}
private AppCompatDelegate getDelegate() {
if (mDelegate == null) {
mDelegate = AppCompatDelegate.create(this, null);
}
return mDelegate;
}
}
| [
"[email protected]"
]
| |
22d3982d44c5166c72ef90afac624177bf135a36 | b765203b3bd4a591386dbc3170c266b037a5afbd | /app/src/main/java/com/example/rifat/realtimechat/Chat_Room.java | 2421351109dad39adf4252a00b81ac80714904a8 | []
| no_license | Rifat007/Real-Time-Chat | 3fe7493059c22735349092f27e1c94776e9eb8fc | 9b74fbd2b53fe54bf94efe4056f4ecdb84671356 | refs/heads/master | 2020-05-27T17:20:27.073947 | 2019-05-26T18:32:39 | 2019-05-26T18:32:39 | 188,718,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,392 | java | package com.example.rifat.realtimechat;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* Created by filipp on 6/28/2016.
*/
public class Chat_Room extends AppCompatActivity{
private Button btn_send_msg;
private EditText input_msg;
private TextView chat_conversation;
private String user_name,room_name;
private DatabaseReference root ;
private String temp_key;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chat__room);
btn_send_msg = (Button) findViewById(R.id.btn_send);
input_msg = (EditText) findViewById(R.id.msg_input);
chat_conversation = (TextView) findViewById(R.id.textView);
user_name = getIntent().getExtras().get("user_name").toString();
room_name = getIntent().getExtras().get("room_name").toString();
setTitle(" Room - "+room_name);
root = FirebaseDatabase.getInstance().getReference().child(room_name);
btn_send_msg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Map<String,Object> map = new HashMap<String, Object>();
temp_key = root.push().getKey();
root.updateChildren(map);
DatabaseReference message_root = root.child(temp_key);
Map<String,Object> map2 = new HashMap<String, Object>();
map2.put("name",user_name);
map2.put("msg",input_msg.getText().toString());
message_root.updateChildren(map2);
}
});
root.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
append_chat_conversation(dataSnapshot);
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
append_chat_conversation(dataSnapshot);
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private String chat_msg,chat_user_name;
private void append_chat_conversation(DataSnapshot dataSnapshot) {
Iterator i = dataSnapshot.getChildren().iterator();
while (i.hasNext()){
chat_msg = (String) ((DataSnapshot)i.next()).getValue();
chat_user_name = (String) ((DataSnapshot)i.next()).getValue();
chat_conversation.append(chat_user_name +" : "+chat_msg +" \n");
}
}
}
| [
"[email protected]"
]
| |
ec47c940ba6cd2629a4f2609623c61d92cc3a2e6 | abd60744a8d04a1182037a5d92779bb96b30a90d | /imagerank/src/main/java/br/ufmg/dcc/imagerank/eval/converter/EvalFileConverter.java | fa2c195c5e90be70b0b7959700e2cdc8132d1d04 | []
| no_license | wandersonfdias/imagerank | 60a265773c04b8e6c9a544030c525ac78d9fa6dd | 6c9cb9dda2c96121fc0e95d2d35cf0393659a703 | refs/heads/master | 2021-01-09T21:54:40.822770 | 2016-10-05T19:05:55 | 2016-10-05T19:05:55 | 45,751,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,276 | java | package br.ufmg.dcc.imagerank.eval.converter;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import br.ufmg.dcc.imagerank.constants.ImageRankConstants;
import br.ufmg.dcc.imagerank.exception.ProcessorException;
/**
* Converte arquivos de saída do LAC em arquivos de entrada (prediction e feature) para uso pelo EvalScore.
* @author Wanderson Ferreira Dias - <code>[email protected]</code>
*/
public class EvalFileConverter
{
private static final String PREDICTION_FILE_PREFIX = "prediction";
private static final String FEATURE_FILE_PREFIX = "feature";
/**
* Arquivo de saída do LAC
*/
private String arquivoSaidaLAC;
/**
* Arquivo de teste utilizado na entrada do LAC
*/
private String arquivoEntradaTesteLAC;
/**
* Diretório dos arquivos de saída
*/
private String diretorioSaida;
/**
* Diretório base para processamento das imagens
*/
private String diretorioBase;
/**
* Construtor
*/
public EvalFileConverter(String diretorioBase, String diretorioSaida, String arquivoSaidaLAC, String arquivoEntradaTesteLAC)
{
this.diretorioBase = diretorioBase;
this.diretorioSaida = diretorioSaida;
this.arquivoSaidaLAC = arquivoSaidaLAC;
this.arquivoEntradaTesteLAC = arquivoEntradaTesteLAC;
}
/**
* Converte o arquivo do WEKA em arquivos de treino/teste do LAC
* @throws ProcessorException
*/
public void convert() throws ProcessorException
{
try
{
// cria o diretório de saída
this.createOutputDir();
// gera o arquivo de prediction
this.convertPredictionFile();
// gera o arquivo de feature
this.convertFeatureFile();
}
catch (IOException e)
{
throw new ProcessorException(e.getMessage(), e);
}
}
/**
* Gera o arquivo de feature
* @throws IOException
* @throws ProcessorException
*/
private void convertFeatureFile() throws IOException, ProcessorException
{
// lê o arquivo original e adiciona o attributo que identifica o par de imagens às instâncias do dataset
List<String> linhasArquivo = FileUtils.readLines(new File(this.arquivoEntradaTesteLAC));
// cria o arquivo de saída
File file = this.createOutputFile(this.getFeatureFileName());
for (String linhaArquivo : linhasArquivo)
{
// exemplo da linha: accordion.image_0001|cannon.image_0008 CLASS=0 w[1]='\'(0.1-0.2]\''
String[] dadosLinha = StringUtils.split(linhaArquivo.trim(), ' ');
// obtém ids da query e document
String[] pairId = StringUtils.split(dadosLinha[0], ImageRankConstants.PAIR_ID_SEPARATOR);
String queryId = pairId[0];
String documentId = pairId[1];
// obtém o valor da classe
String classValue = null;
String classPrefix = "CLASS=";
for (String dadoLinha : dadosLinha)
{
if (StringUtils.containsIgnoreCase(dadoLinha, classPrefix))
{
String dados[] = StringUtils.split(dadoLinha, '=');
classValue = dados[1];
break;
}
}
// grava a linha no arquivo de saída
// exemplo da linha de saída: 0 qid:1 #docid = 1
StringBuilder linhaSaida = new StringBuilder();
linhaSaida.append(classValue);
linhaSaida.append(StringUtils.SPACE);
linhaSaida.append("qid:");
linhaSaida.append(queryId);
linhaSaida.append(StringUtils.SPACE);
linhaSaida.append("#docid = ");
linhaSaida.append(documentId);
this.writeLine(file, linhaSaida.toString());
}
}
/**
* Gera o arquivo de prediction
* @throws IOException
* @throws ProcessorException
*/
private void convertPredictionFile() throws IOException, ProcessorException
{
// lê o arquivo original e adiciona o attributo que identifica o par de imagens às instâncias do dataset
List<String> linhasArquivo = FileUtils.readLines(new File(this.arquivoSaidaLAC));
// cria o arquivo de saída
File file = this.createOutputFile(this.getPredictionFileName());
final String SCORE_PREFIX = "Score[1]=";
for (String linhaArquivo : linhasArquivo)
{
if (StringUtils.isNotBlank(linhaArquivo) && StringUtils.containsIgnoreCase(linhaArquivo, SCORE_PREFIX))
{
String scoreValue = null;
linhaArquivo = linhaArquivo.replace("= ", "=").trim();
String[] dados = StringUtils.split(linhaArquivo, ' ');
for (String dado : dados)
{
if (StringUtils.containsIgnoreCase(dado, SCORE_PREFIX))
{
String[] dadosScore = StringUtils.split(dado, '=');
scoreValue = dadosScore[1];
break;
}
}
if (scoreValue != null)
{
// grava o valor do score no arquivo de saída
this.writeLine(file, scoreValue);
}
}
}
}
private void writeLine(File file, String line) throws IOException
{
List<String> data = new ArrayList<String>();
data.add(line);
FileUtils.writeLines(file, data, ImageRankConstants.LINE_SEPARATOR, true);
}
private void createOutputDir() throws ProcessorException
{
String path = this.getFullPathSaida();
File dir = new File(path);
if (dir.exists())
{
try
{
// remove o diretório recursivamente
FileUtils.deleteDirectory(dir);
}
catch (IOException e)
{
throw new ProcessorException(String.format("Ocorreu um erro ao excluir o diretório de saída '%s'.", path), e);
}
}
// cria o diretório
boolean dirCreated = dir.mkdir();
if (!dirCreated)
{
throw new ProcessorException(String.format("Não foi possível criar o diretório de saída '%s'.", path));
}
}
/**
* Cria o arquivo de sáida
* @return
* @throws ProcessorException
*/
private File createOutputFile(String fileName) throws ProcessorException
{
String path = this.getFullPathSaida();
String arquivo = new StringBuilder(path).append(fileName).toString();
File file = new File(arquivo);
file.setWritable(true);
file.setReadable(true);
try
{
boolean created = file.createNewFile();
if (!created)
{
throw new ProcessorException(String.format("Não foi possível criar o arquivo de saída '%s'.", arquivo));
}
}
catch (IOException e)
{
throw new ProcessorException(String.format("Não foi possível criar o arquivo de saída '%s'.", arquivo), e);
}
return file;
}
private String getPredictionFileName()
{
String[] data = StringUtils.split(this.arquivoSaidaLAC, '/');
StringBuilder sb = new StringBuilder();
sb.append(PREDICTION_FILE_PREFIX);
sb.append('_');
String name = data[data.length-1];
sb.append(name.substring(0, name.indexOf('.')));
return sb.toString();
}
private String getFeatureFileName()
{
String[] data = StringUtils.split(this.arquivoSaidaLAC, '/');
StringBuilder sb = new StringBuilder();
sb.append(FEATURE_FILE_PREFIX);
sb.append('_');
String name = data[data.length-1];
sb.append(name.substring(0, name.indexOf('.')));
return sb.toString();
}
/**
* Obtém o path completo referente ao diretório de saída
* @return
*/
private String getFullPathSaida()
{
return this.getFullPath(this.diretorioSaida);
}
/**
* Obtém o path base para processamento
* @param dir
* @return
*/
private String getFullPath(String dir)
{
return new StringBuilder(this.diretorioBase).append(File.separator).append(dir).append(File.separator).toString();
}
}
| [
"[email protected]"
]
| |
641f2f54dd87d452137141abdc21c4c54dfd05fd | fe4cb27db6bbba7ea81da9c6a16032ae28acaf8f | /OldFrame_Week2Demo/src/main/java/com/example/oldframe_week2demo/base/BaseMvpActivity.java | 4c63abb465965a0a8602e5745ac76345deb70498 | []
| no_license | 1657895829/Fresco-MVP-RecyclerView_NewOrOldFrame | 3db8d7fc621e833fcddad9c9d2ea53595e920ade | 94427d12d5c031ce73b54e54c7b63e71609e9892 | refs/heads/master | 2020-03-18T03:20:28.943928 | 2018-05-22T07:36:53 | 2018-05-22T07:36:53 | 134,235,764 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java | package com.example.oldframe_week2demo.base;
import android.app.Activity;
import android.os.Bundle;
/**
* Activity抽象类,持有View层和Presenter层
* @param <V> 表示持有的View层
* @param <T> 表示持有的Presenter层
*/
public abstract class BaseMvpActivity<V,T extends BasePresenter<V>> extends Activity {
//声明持有的p层
public T p;
public abstract T initPresenter();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
p = initPresenter();
}
//视图运行获取焦点时,连接view层
@Override
protected void onResume() {
super.onResume();
p.attach((V) this);
}
//试图销毁时释放内存
@Override
protected void onDestroy() {
super.onDestroy();
p.detach();
}
} | [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.