blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e158b407e436a1ea88c7a88caed11d3d8e7445e1 | 82d12e007d5372a696eb508ecd35cf2153f70c73 | /src/main/java/com/example/booking/model/Bookable.java | cc5f68614930142c41dace9498c5d116199ce986 | []
| no_license | qianxiaofeng/booking-example | cd7b2fe73d9ef5ec93b83c25a162bfa92837b730 | 685e566978abb7cc7787194ec2303a31e62361c4 | refs/heads/master | 2021-06-12T08:00:26.173055 | 2017-02-16T08:54:39 | 2017-02-16T08:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 767 | java | package com.example.booking.model;
import com.example.booking.model.exception.BookingException;
import java.util.List;
/**
* Created by deadlock on 7/2/17.
*/
public interface Bookable {
Integer getBookableId();
String getBookableName();
Reservation book(ReservationRequest reservationRequest) throws BookingException;
Reservation updateReservation(ReservationRequest reservationRequest) throws BookingException;
void deleteReservation(ReservationRequest reservationRequest) throws BookingException;
Reservation getReservation(ReservationRequest reservationRequest) throws BookingException;
List<Reservation> getAllReservations() throws BookingException;
boolean checkAvailability(ReservationRequest reservationRequest);
}
| [
"[email protected]"
]
| |
54654b471725a11098321532729d59c346922087 | 436c87401b0c4f839817f0b712b1698c74336ce4 | /Survay/src/main/java/co/micol/prj/research/serviceImpl/ResearchServiceImpl.java | 9c4b2ee63562b4ca49eba95fadcb3b5a3a5f21fd | []
| no_license | micai-vanny/springLesson | 458007b6c42dbe095736a09dadb91029fb59e0bb | 63340199919809ae95e5436e98e13b4d41c48355 | refs/heads/master | 2023-06-02T10:28:42.080072 | 2021-06-29T00:13:13 | 2021-06-29T00:13:13 | 374,942,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 923 | java | package co.micol.prj.research.serviceImpl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import co.micol.prj.research.map.ResearchMap;
import co.micol.prj.research.service.ResearchServie;
import co.micol.prj.research.vo.ResearchVO;
@Repository("researchDao")
public class ResearchServiceImpl implements ResearchServie {
@Autowired
private ResearchMap map;
@Override
public List<ResearchVO> researchSelectList() {
return map.researchSelectList();
}
@Override
public ResearchVO researchSelect(ResearchVO vo) {
return map.researchSelect(vo);
}
@Override
public int resarchInsert(ResearchVO vo) {
return map.resarchInsert(vo);
}
@Override
public int resarchUpdate(ResearchVO vo) {
return map.resarchUpdate(vo);
}
@Override
public int resarchDelect(ResearchVO vo) {
return map.resarchDelect(vo);
}
}
| [
"admin@YD02-15"
]
| admin@YD02-15 |
812db5a07c61328eb2a70c0ef3ae1c6b061aa4aa | ec81b1224434eb353d610c15d16485c104507397 | /src/main/java/Applications/Messenger/Controllers/ConversationController.java | 2e7351ec755f444035900f4f52c2cab20651c2ca | []
| no_license | amirsalarsafaei/Haghgeram2.0-Client | 9f88673e4b68c0743082fd23df23c4a749129e2f | d1ab5a735342f51b978a13688722fd5fe20dd389 | refs/heads/master | 2023-07-15T04:41:25.182853 | 2021-08-24T23:08:42 | 2021-08-24T23:08:42 | 399,628,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,056 | java | package Applications.Messenger.Controllers;
import Applications.Messenger.Listeners.ConversationListener;
import Applications.Messenger.Views.ConversationView;
import DataBase.OfflineConversation;
import FileHandling.ImageHandler;
import FileHandling.Properties;
import GraphicComponents.GraphicTweet;
import Holder.TokenHolder;
import Models.Events.*;
import Models.Networking.Request;
import Models.Networking.RequestType;
import Models.Networking.Response;
import Models.Networking.ResponseType;
import Models.OfflineRequests;
import Models.Responses.ConversationResponse;
import Models.Responses.HyperLinkResponse;
import Models.Responses.MessageResponse;
import Models.UnsentMessages;
import StreamHandler.StreamHandler;
import Utils.AutoUpdatingController;
import Utils.GsonHandler;
import javafx.concurrent.Task;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.*;
import static java.lang.Thread.sleep;
public class ConversationController implements AutoUpdatingController {
private ConversationListController conversationListController;
private ShowConversationEvent e;
private Response updateResponse, hyperLinkResponse;
private Request updateRequest;
private ConversationView view;
private boolean done = false;
private int id;
public ConversationController(ConversationListController conversationListController, ShowConversationEvent e,
BorderPane conversationBox, StackPane stackPane, boolean isGroup) {
this.conversationListController = conversationListController;
this.e = e;
id = e.getId();
this.updateRequest = new Request(RequestType.Conversation, GsonHandler.getGson().toJson(e), TokenHolder.token);
this.view = new ConversationView(conversationBox, new ConversationListener(this), stackPane, e.getId(), isGroup);
getData(true);
}
public ConversationController(ConversationListController conversationListController,
ConversationResponse conversationResponse, BorderPane conversationVBox, StackPane stackPane) {
this.conversationListController = conversationListController;
this.e = new ShowConversationEvent(conversationResponse.getId());
id = e.getId();
this.updateRequest = new Request(RequestType.Conversation, GsonHandler.getGson().toJson(e), TokenHolder.token);
this.view = new ConversationView(conversationVBox, new ConversationListener(this), stackPane, e.getId(),
conversationResponse.isGroup());
getData(true);
}
@Override
public void getData(boolean repeat) {
if (!StreamHandler.isConnected()) {
ConversationResponse conversationResponse = OfflineConversation.loadLast(id);
if (conversationResponse != null) {
for (SendMessageToConversationEvent event: UnsentMessages.holder.getSendMessageToConversationEvents()) {
if (event.getId() == id) {
conversationResponse.getMessages().add(new MessageResponse(event));
}
}
show(false, conversationResponse);
}
return;
}
if (done)
return;
Task task = new Task() {
@Override
protected Object call() throws Exception {
updateResponse = StreamHandler.sendReqGetResp(updateRequest);
System.out.println(updateResponse.data);
return null;
}
};
task.setOnSucceeded(event -> {
show(repeat, GsonHandler.getGson().fromJson(updateResponse.data, ConversationResponse.class));
});
Thread thread = new Thread(task);
thread.start();
}
public void show(boolean repeat, ConversationResponse conversationResponse) {
OfflineConversation.Save(conversationResponse);
if (done)
return;
view.refresh(conversationResponse);
if (repeat) {
Task task = new Task() {
@Override
protected Object call() throws Exception {
sleep(Properties.loadNumbers("refresh"));
return null;
}
};
task.setOnSucceeded(event -> getData(true));
Thread thread = new Thread(task);
thread.start();
}
}
@Override
public void setDoneTrue() {
done = true;
}
@Override
public void setDoneFalse() {
done = false;
}
public void refreshSide() {
conversationListController.getData(false);
}
public void sendMessage(SendMessageToConversationEvent e) {
Request request = new Request(RequestType.SendMessageToConversation,
GsonHandler.getGson().toJson(e), TokenHolder.token);
if (!StreamHandler.isConnected()) {
OfflineRequests.offlineRequests.addRequest(request);
UnsentMessages.holder.addMessage(e);
getData(false);
return;
}
Task task = new Task() {
@Override
protected Object call() throws Exception {
StreamHandler.sendReqGetResp(request);
return null;
}
};
task.setOnSucceeded(event -> refresh());
Thread thread = new Thread(task);
thread.start();
}
public void refresh() {
getData(false);
refreshSide();
}
public void hyperLinkAction(HyperLinkEvent e) {
if (!StreamHandler.isConnected())
return;
Task task = new Task() {
@Override
protected Object call() throws Exception {
hyperLinkResponse = StreamHandler.sendReqGetResp(
new Request(RequestType.HyperLink, GsonHandler.getGson().toJson(e), TokenHolder.token));
return null;
}
};
task.setOnSucceeded(event -> {
if (hyperLinkResponse.responseType == ResponseType.Accepted) {
HyperLinkResponse response = GsonHandler.getGson().fromJson(hyperLinkResponse.data, HyperLinkResponse.class);
switch (response.getHyperLinkType()) {
case Tweet:
GraphicTweet.singleTweet(view.getStackPane(), 800, view, response.getTweetResponse());
break;
case Bot:
break;
case Conversation:
stop();
conversationListController.showConversation(response.getConversationResponse());
break;
case GroupInvite:
break;
}
}
else {
StackPane stackPane = view.getStackPane();
BorderPane whitePane = new BorderPane();
whitePane.setId("white-fade");
stackPane.getChildren().add(whitePane);
Pane pane = new Pane(new VBox(new Label(hyperLinkResponse.data)));
pane.setPadding(new Insets(Properties.loadSize("medium-indent")));
VBox vBox = new VBox(pane);
vBox.setAlignment(Pos.CENTER);
HBox hBox = new HBox(pane);
hBox.setAlignment(Pos.CENTER);
stackPane.getChildren().add(hBox);
ImageView x_icon = ImageHandler.getImage("x_icon");
stackPane.getChildren().add(x_icon);
StackPane.setAlignment(hBox, Pos.CENTER);
StackPane.setAlignment(x_icon, Pos.TOP_RIGHT);
x_icon.setOnMouseClicked(event1 -> {
whitePane.setVisible(false);
hBox.setVisible(false);
x_icon.setVisible(false);
});
}
});
Thread thread = new Thread(task);
thread.start();
}
public void addMemberToGroup(AddMemberToGroupViewEvent addMemberToGroupViewEvent) {
EventHandler<AddMembersToGroupEvent> eventHandler = new EventHandler<AddMembersToGroupEvent>() {
@Override
public void handle(AddMembersToGroupEvent event) {
Task task = new Task() {
@Override
protected Object call() throws Exception {
event.setGroupId(addMemberToGroupViewEvent.getGroup_id());
StreamHandler.sendReqGetResp(
new Request(RequestType.AddMemberToGroup,
GsonHandler.getGson().toJson(new AddMembersToGroupSendableEvent(event)),
TokenHolder.token));
return null;
}
};
task.setOnSucceeded((e) -> refresh());
Thread thread = new Thread(task);
thread.start();
}
};
new AddMembersToGroupController(view.getStackPane(), eventHandler, false);
}
public void leaveGroup(LeaveGroupEvent leaveGroupEvent) {
Task task = new Task() {
@Override
protected Object call() throws Exception {
StreamHandler.sendReqGetResp(
new Request(RequestType.LeaveGroup, GsonHandler.getGson().toJson(leaveGroupEvent),
TokenHolder.token));
return null;
}
};
task.setOnSucceeded(event -> {
new ConversationListController();
});
Thread thread = new Thread(task);
thread.start();
}
public void deleteMessage(DeleteMessageEvent deleteMessageEvent) {
final Response[] response = new Response[1];
Task task = new Task() {
@Override
protected Object call() throws Exception {
response[0] = StreamHandler.sendReqGetResp(new Request(RequestType.DeleteMessage,
GsonHandler.getGson().toJson(deleteMessageEvent), TokenHolder.token));
return null;
}
};
task.setOnSucceeded(event -> refresh());
Thread thread = new Thread(task);
thread.start();
}
public void editMessage(EditMessageEvent editMessageEvent) {
final Response[] response = new Response[1];
Task task = new Task() {
@Override
protected Object call() throws Exception {
response[0] = StreamHandler.sendReqGetResp(new Request(RequestType.EditMessage,
GsonHandler.getGson().toJson(editMessageEvent), TokenHolder.token));
return null;
}
};
task.setOnSucceeded(event ->refresh());
Thread thread = new Thread(task);
thread.start();
}
}
| [
"[email protected]"
]
| |
383716e91676fb4b5728c7872b4802f447df387a | 3bd909f5587961a3b915c70fe4db680da0e5dd98 | /org.muml.pim.edit/src/org/muml/pim/instance/provider/AtomicComponentInstanceItemProvider.java | ac0ca791be7311a088d4bca02a683ad815b943ca | []
| no_license | fraunhofer-iem/mechatronicuml-pim | 00f38c53503629f21b002da7a16f00562f78d121 | ec9bed1f82447ada20686fc78ad26500b0f0c458 | refs/heads/origin/master | 2022-12-19T19:02:26.971811 | 2018-10-19T14:52:16 | 2018-10-19T14:52:16 | 269,042,510 | 0 | 0 | null | 2020-10-13T22:32:01 | 2020-06-03T09:14:16 | Java | UTF-8 | Java | false | false | 4,041 | java | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.muml.pim.instance.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.muml.pim.instance.AtomicComponentInstance;
/**
* This is the item provider adapter for a {@link org.muml.pim.instance.AtomicComponentInstance} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class AtomicComponentInstanceItemProvider
extends ComponentInstanceItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AtomicComponentInstanceItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
}
return itemPropertyDescriptors;
}
/**
* This returns AtomicComponentInstance.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/AtomicComponentInstance"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((AtomicComponentInstance)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_AtomicComponentInstance_type") :
getString("_UI_AtomicComponentInstance_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
/**
* This enables OCL property filtering.
* @generated OCL
*/
protected org.eclipse.emf.edit.provider.ItemPropertyDescriptor createItemPropertyDescriptor(org.eclipse.emf.common.notify.AdapterFactory adapterFactory, org.eclipse.emf.common.util.ResourceLocator resourceLocator,String displayName,String description,org.eclipse.emf.ecore.EStructuralFeature feature,boolean isSettable,Object staticImage,String category,String[] filterFlags) {
return new ocl.OCLItemPropertyDescriptor(adapterFactory,resourceLocator,displayName,description,feature,isSettable,false,false,staticImage,category,filterFlags);
}
/**
* This enables OCL property filtering.
* @generated OCL
*/
protected org.eclipse.emf.edit.provider.ItemPropertyDescriptor createItemPropertyDescriptor(org.eclipse.emf.common.notify.AdapterFactory adapterFactory, org.eclipse.emf.common.util.ResourceLocator resourceLocator, String displayName, String description, org.eclipse.emf.ecore.EStructuralFeature feature, boolean isSettable, boolean multiLine, boolean sortChoices, Object staticImage,String category, String[] filterFlags) {
return new ocl.OCLItemPropertyDescriptor(adapterFactory, resourceLocator, displayName,description,feature,isSettable,multiLine,sortChoices, staticImage, category,filterFlags);
}
}
| [
"[email protected]"
]
| |
af7d803c77453fe31b1263af946e54646c4f9c5c | 4e56f56a1762e00a63c80cf59a57bfd014fed609 | /time-tracking-backend/data/src/main/java/cz/cvut/fit/timetracking/data/entity/User.java | cd236381fc0ce40eb1c1f40606b7cc9493fa33b2 | []
| no_license | raestio/time-tracking | 661b56024b7e0389e66d5e69ebfd36a5dc1c4e85 | 163401ab739285ad627a4ff88de58c65ed3c31a5 | refs/heads/master | 2020-05-01T10:40:56.887336 | 2020-01-22T21:25:11 | 2020-01-22T21:25:23 | 177,425,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,981 | java | package cz.cvut.fit.timetracking.data.entity;
import cz.cvut.fit.timetracking.data.entity.enums.AuthProviderEnum;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedAttributeNode;
import javax.persistence.NamedEntityGraph;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@NamedEntityGraph(name = "User.userRoles", attributeNodes = @NamedAttributeNode("userRoles"))
@Entity
@Table(name = "user", schema = "time_tracking_schema")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@NotEmpty
@Column(name = "name")
private String name;
@NotEmpty
@Column(name = "surname")
private String surname;
@NotEmpty
@Email
@Column(name = "email", unique = true)
private String email;
@Column(name = "picture_url")
private String pictureUrl;
@NotNull
@Column(name = "auth_provider")
@Enumerated(EnumType.STRING)
private AuthProviderEnum authProvider;
@OneToMany(mappedBy = "user")
private Set<ProjectAssignment> projectAssignments = new HashSet<>();
@OneToMany(mappedBy = "user")
private Set<WorkRecord> workRecords = new HashSet<>();
@ManyToMany
@JoinTable(name = "user_roles_assignment", schema = "time_tracking_schema",
joinColumns = @JoinColumn(name = "id_user"), inverseJoinColumns = @JoinColumn(name = "id_user_role"))
private Set<UserRole> userRoles = new HashSet<>();
public User(Integer id) {
this.id = id;
}
public User() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Set<ProjectAssignment> getProjectAssignments() {
return projectAssignments;
}
public void setProjectAssignments(Set<ProjectAssignment> projectAssignments) {
this.projectAssignments = projectAssignments;
}
public Set<UserRole> getUserRoles() {
return userRoles;
}
public void setUserRoles(Set<UserRole> userRoles) {
this.userRoles = userRoles;
}
public Set<WorkRecord> getWorkRecords() {
return workRecords;
}
public void setWorkRecords(Set<WorkRecord> workRecords) {
this.workRecords = workRecords;
}
public String getPictureUrl() {
return pictureUrl;
}
public void setPictureUrl(String pictureUrl) {
this.pictureUrl = pictureUrl;
}
public AuthProviderEnum getAuthProvider() {
return authProvider;
}
public void setAuthProvider(AuthProviderEnum authProvider) {
this.authProvider = authProvider;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return Objects.equals(id, user.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}
| [
"[email protected]"
]
| |
b09091586c21c6d073190190b51b1b4d2c15c480 | 94ce46feeb59950eebdf7a8b36defa561ee0ab5b | /test/com/carlsenbot/table/CheckSystemTest.java | 630fe161d65897e2eb3d03bb2afed937d511ae3a | [
"MIT"
]
| permissive | vladmosessohn/CarlsenBot | ac3cef26d443704e8e73fbcec2eccd4b12319f30 | 66a1bbef102d036a6ec30409eefccc6eeaa6a9da | refs/heads/master | 2022-07-19T18:36:58.954962 | 2020-05-19T18:14:37 | 2020-05-19T18:14:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,311 | java | /*
* © 2020 Grama Nicolae, Ioniță Radu , Mosessohn Vlad, 322CA
*/
package com.carlsenbot.table;
import com.carlsenbot.pieces.*;
import com.carlsenbot.position.Move;
import com.carlsenbot.position.Position;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
class CheckSystemTest {
Table table;
@Test
void kingIsInCheck() {
Table table = new Table();
King king = new King(PieceColor.White, new Position("e1"));
Pawn pawn1 = new Pawn(PieceColor.White, new Position("d2"));
Pawn pawn2 = new Pawn(PieceColor.White, new Position("e2"));
Rook rook = new Rook(PieceColor.White, new Position("f2"));
table.addPiece(king);
table.addPiece(pawn1);
table.addPiece(pawn2);
table.addPiece(rook);
Queen eQueen = new Queen(PieceColor.Black, new Position("h1"));
table.addPiece(eQueen);
assertTrue(table.getCheckSystem().kingIsInCheck(PieceColor.White), "The king should be in check.");
ArrayList<Move> possibleMoves = table.getAllPossibleMoves(PieceColor.White);
assertEquals(possibleMoves.size(), 1, "The rook should be moved to eliminate check.");
}
} | [
"[email protected]"
]
| |
c971be80701e4fc9f7bd28dce3e77e5bf90bd5ab | e3cbe36dbcd47209f9b2bc49011b43b1a6336b48 | /src/main/java/edgar/leetcode/Solution0074_SearchA2DMatrix.java | 6a4aaa4fd8712416856c20b12eeba9fcd1465e2b | [
"Apache-2.0"
]
| permissive | EdgarLiu2/java_leetcode | 48dfdd37758088dff295d1b61ffa9ff061f2b4a1 | cc72305e6c5a8861980611f58cfb3ef5c777ce37 | refs/heads/master | 2023-08-08T08:10:10.395014 | 2023-06-12T03:38:46 | 2023-06-12T03:38:46 | 225,541,894 | 0 | 0 | Apache-2.0 | 2023-06-14T22:51:21 | 2019-12-03T05:54:16 | Java | UTF-8 | Java | false | false | 1,766 | java | package edgar.leetcode;
/**
* 74. 搜索二维矩阵
* https://leetcode-cn.com/problems/search-a-2d-matrix/
*
* @author liuzhao
*
*/
public class Solution0074_SearchA2DMatrix {
public static boolean searchMatrix(int[][] matrix, int target) {
int rows = matrix.length;
int cols = matrix[0].length;
// 跟第一个数比较
if (matrix[0][0] == target) {
return true;
} else if (matrix[0][0] > target) {
return false;
}
// 跟最后一个数比较
if (matrix[rows-1][cols-1] == target) {
return true;
} else if (matrix[rows-1][cols-1] < target) {
return false;
}
// 初步判断在第几行
int rowNum = rows - 1;
while(rowNum > 0) {
// 如果target比当前行第一个小,就继续向上
if (matrix[rowNum][0] > target) {
rowNum--;
} else {
// 就在当前行
break;
}
}
// 利用二分查找在第rowNum行寻找
int left = 0;
int right = cols - 1;
while (left <= right) {
int mid = (left + right) / 2;
if (matrix[rowNum][mid] == target) {
return true;
} else if (matrix[rowNum][mid] < target) {
left = mid + 1;
} else {
right = mid - 1;
}
}
return false;
}
public static void main(String[] args) {
int[][] matrix;
/*
* 输入:matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3
* 输出:true
*/
matrix = new int[][] {{1,3,5,7},{10,11,16,20},{23,30,34,60}};
assert searchMatrix(matrix, 3);
/*
* 输入:matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13
* 输出:false
*/
assert !searchMatrix(matrix, 13);
/*
* 输入:matrix = [[1],[3]], target = 2
* 输出:false
*/
matrix = new int[][] {{1},{3}};
assert !searchMatrix(matrix, 2);
}
}
| [
"[email protected]"
]
| |
39757b68f1fe8f4bfe25abf7d1e5d54cd328d6ce | 2df4fb9b7b9488e9f32d7e0a366a670b0a405d71 | /aicloud-boot-starter/aicloud-rabbitmq-demo/src/main/java/com/aicloud/sender/MessageSender.java | 3161e65caf5c202b8a48c97581310e0717fcf26a | []
| no_license | mk5878125/aicloud-boot-starter | a85c9c61f2541dec6e41b190705fe05fd8ee0d91 | 293b8f87cf850a32f83e42731b2c78c8e37bfe30 | refs/heads/master | 2021-03-11T05:02:24.859648 | 2018-11-17T03:39:53 | 2018-11-17T03:39:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,140 | java | package com.aicloud.sender;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.amqp.rabbit.core.RabbitMessagingTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.aicloud.entity.AicloudMessage;
@Component
public class MessageSender implements RabbitTemplate.ConfirmCallback{
/**
* @author zhoutianqi
* @className MessageSender.java
* @date 2017年6月2日 下午3:37:04
* @description
*/
//默认已支持对复杂对象的操作
@Autowired
private RabbitMessagingTemplate rabbitMessagingTemplate;
public void sendToRabbitmq(AicloudMessage host, String extraContent){
Map<String, Object> header = new HashMap<>();
header.put("extraContent", extraContent);
this.rabbitMessagingTemplate.convertAndSend("A", "queue.A.bind", host, header);
System.out.println("Send a customized object message to [queue.A] by RabbitMessagingTemplate");
String a = this.rabbitMessagingTemplate.convertSendAndReceive("A", "queue.A.bind", host, String.class);
System.out.println("Send a customized object message to [queue.A] by RabbitMessagingTemplate");
}
public void sendListToRabbitmq(List<AicloudMessage> listHost, String extraContent){
Map<String, Object> header = new HashMap<>();
header.put("extraContent", extraContent);
this.rabbitMessagingTemplate.convertAndSend("B", "queue.B.bind", listHost, header);
System.out.println("Send a customized object list message to [queue.B] by RabbitMessagingTemplate");
}
//需要开启spring.rabbitmq.publisher-confirms=true 默认是false
@Override
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
// TODO Auto-generated method stub
System.out.println(" 回调id:" + correlationData);
if (ack) {
System.out.println("消息成功消费");
} else {
System.out.println("消息消费失败:" + cause+"\n重新发送");
}
}
}
| [
"[email protected]"
]
| |
733f05be637bc523e0888300d72146f13be82a19 | cf00ac78ef0460ba07292a04fe88712af890ca12 | /src/main/java/net/mcreator/moreroad/block/A1bBlock.java | c6792ab48235a1a4195824b8d1887c36ea46a970 | []
| no_license | XelpyMusic/More-Road | 1d10f7b5c0f8241859f5bcd7d1fb83c26a7bc1d9 | 5b8a5db77ede1fd5f47ef5470574c595e8203846 | refs/heads/master | 2023-08-13T19:13:44.957429 | 2021-10-14T18:34:39 | 2021-10-14T18:34:39 | 417,445,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,571 | java |
package net.mcreator.moreroad.block;
import net.minecraftforge.registries.ObjectHolder;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.Rotation;
import net.minecraft.util.Mirror;
import net.minecraft.util.Direction;
import net.minecraft.state.StateContainer;
import net.minecraft.state.DirectionProperty;
import net.minecraft.loot.LootContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.BlockItem;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.block.material.Material;
import net.minecraft.block.SoundType;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.Block;
import net.mcreator.moreroad.itemgroup.MoreRoadItemGroup;
import net.mcreator.moreroad.MoreRoadModElements;
import java.util.List;
import java.util.Collections;
@MoreRoadModElements.ModElement.Tag
public class A1bBlock extends MoreRoadModElements.ModElement {
@ObjectHolder("more_road:a_1b")
public static final Block block = null;
public A1bBlock(MoreRoadModElements instance) {
super(instance, 23);
}
@Override
public void initElements() {
elements.blocks.add(() -> new CustomBlock());
elements.items.add(() -> new BlockItem(block, new Item.Properties().group(MoreRoadItemGroup.tab)).setRegistryName(block.getRegistryName()));
}
@Override
@OnlyIn(Dist.CLIENT)
public void clientLoad(FMLClientSetupEvent event) {
RenderTypeLookup.setRenderLayer(block, RenderType.getCutout());
}
public static class CustomBlock extends Block {
public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING;
public CustomBlock() {
super(Block.Properties.create(Material.IRON).sound(SoundType.METAL).hardnessAndResistance(1f, 10f).setLightLevel(s -> 0).harvestLevel(2)
.harvestTool(ToolType.PICKAXE).setRequiresTool().notSolid().setOpaque((bs, br, bp) -> false));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH));
setRegistryName("a_1b");
}
@Override
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) {
return true;
}
@Override
public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
return 0;
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) {
Vector3d offset = state.getOffset(world, pos);
switch ((Direction) state.get(FACING)) {
case SOUTH :
default :
return VoxelShapes.or(makeCuboidShape(16, 0, 9, 0, 16, 6)).withOffset(offset.x, offset.y, offset.z);
case NORTH :
return VoxelShapes.or(makeCuboidShape(0, 0, 7, 16, 16, 10)).withOffset(offset.x, offset.y, offset.z);
case EAST :
return VoxelShapes.or(makeCuboidShape(9, 0, 0, 6, 16, 16)).withOffset(offset.x, offset.y, offset.z);
case WEST :
return VoxelShapes.or(makeCuboidShape(7, 0, 16, 10, 16, 0)).withOffset(offset.x, offset.y, offset.z);
}
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
public BlockState rotate(BlockState state, Rotation rot) {
return state.with(FACING, rot.rotate(state.get(FACING)));
}
public BlockState mirror(BlockState state, Mirror mirrorIn) {
return state.rotate(mirrorIn.toRotation(state.get(FACING)));
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
;
return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
List<ItemStack> dropsOriginal = super.getDrops(state, builder);
if (!dropsOriginal.isEmpty())
return dropsOriginal;
return Collections.singletonList(new ItemStack(this, 1));
}
}
}
| [
"Lucas@DESKTOP-CIFVV1C"
]
| Lucas@DESKTOP-CIFVV1C |
808f440426b82ebd1906b464cca7a2e75a7c417f | 9c2b23a2d6da1e762400ae963c1f787c3121eb89 | /core/com.hundsun.ares.studio.jres.script.api/src/com/hundsun/ares/studio/jres/script/api/model/IJSONModel.java | 28c34f02768f3d8d567fa3e4d2f906cf088bd519 | [
"MIT"
]
| permissive | zhuyf03516/ares-studio | 5d67757283a52e51100666c9ce35227a63656f0e | 5648b0f606cb061d06c39ac25b7b206f3307882f | refs/heads/master | 2021-01-11T11:31:51.436304 | 2016-08-11T10:56:31 | 2016-08-11T10:56:31 | 65,444,199 | 0 | 0 | null | 2016-08-11T06:24:33 | 2016-08-11T06:24:32 | null | GB18030 | Java | false | false | 285 | java | /**
* <p>Copyright: Copyright (c) 2012</p>
* <p>Company: 恒生电子股份有限公司</p>
*/
package com.hundsun.ares.studio.jres.script.api.model;
/**
* @author lvgao
*
*/
public interface IJSONModel {
/**
* 转换为JSON数据
* @return
*/
public String toJSON();
}
| [
"[email protected]"
]
| |
4bc60f3536c1b4a8fe36588531e60ebeaf64d376 | f8d76b06b117611ba8a85a93739005392f2ce5c9 | /hybrisfulfilmentprocess/src/com/nagarro/fulfilmentprocess/actions/order/CheckTransactionReviewStatusAction.java | c251fb2f9259026fe1eff3fa9e8222a77f138c7e | []
| no_license | vikrantghai/hybris | a2c95b1558a4b64326af424c7d374207726c4872 | 7817b8eeb22e8323ee55db70066582de613f1b36 | refs/heads/master | 2021-01-01T04:56:29.496048 | 2016-04-12T11:12:46 | 2016-04-12T11:12:46 | 56,015,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,595 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2015 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package com.nagarro.fulfilmentprocess.actions.order;
import de.hybris.platform.core.enums.OrderStatus;
import de.hybris.platform.core.model.order.OrderModel;
import de.hybris.platform.orderprocessing.model.OrderProcessModel;
import de.hybris.platform.payment.dto.TransactionStatus;
import de.hybris.platform.payment.enums.PaymentTransactionType;
import de.hybris.platform.payment.model.PaymentTransactionEntryModel;
import de.hybris.platform.payment.model.PaymentTransactionModel;
import de.hybris.platform.processengine.action.AbstractAction;
import de.hybris.platform.task.RetryLaterException;
import de.hybris.platform.ticket.enums.CsTicketCategory;
import de.hybris.platform.ticket.enums.CsTicketPriority;
import de.hybris.platform.ticket.events.model.CsCustomerEventModel;
import de.hybris.platform.ticket.model.CsTicketModel;
import de.hybris.platform.ticket.service.TicketBusinessService;
import de.hybris.platform.util.localization.Localization;
import org.springframework.beans.factory.annotation.Required;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* This action check if authorization has review status
*/
public class CheckTransactionReviewStatusAction extends AbstractAction<OrderProcessModel>
{
private TicketBusinessService ticketBusinessService;
public enum Transition
{
OK, NOK, WAIT;
public static Set<String> getStringValues()
{
final Set<String> res = new HashSet<String>();
for (final Transition transitions : Transition.values())
{
res.add(transitions.toString());
}
return res;
}
}
@Override
public Set<String> getTransitions()
{
return Transition.getStringValues();
}
@Override
public final String execute(final OrderProcessModel process) throws RetryLaterException, Exception
{
return executeAction(process).toString();
}
protected Transition executeAction(final OrderProcessModel process)
{
Transition result;
final OrderModel order = process.getOrder();
if (order != null)
{
for (final PaymentTransactionModel transaction : order.getPaymentTransactions())
{
result = checkPaymentTransaction(transaction, order);
if (!Transition.OK.equals(result))
{
return result;
}
}
}
return Transition.OK;
}
protected Transition checkPaymentTransaction(final PaymentTransactionModel transaction, final OrderModel orderModel)
{
final List<PaymentTransactionEntryModel> transactionEntries = transaction.getEntries();
for (int index = transactionEntries.size() - 1; index >= 0; index--)
{
final PaymentTransactionEntryModel entry = transactionEntries.get(index);
if (isReviewDecision(entry))
{
if (isReviewAccepted(entry))
{
orderModel.setStatus(OrderStatus.PAYMENT_AUTHORIZED);
getModelService().save(orderModel);
return Transition.OK;
}
else
{
orderModel.setStatus(OrderStatus.PAYMENT_NOT_AUTHORIZED);
getModelService().save(orderModel);
return Transition.NOK;
}
}
else if (isAuthorization(entry))
{
if (isAuthorizationInReview(entry))
{
final String ticketTitle = Localization.getLocalizedString("message.ticket.orderinreview.title");
final String ticketMessage = Localization.getLocalizedString("message.ticket.orderinreview.content",
new Object[] { orderModel.getCode() });
createTicket(ticketTitle, ticketMessage, orderModel, CsTicketCategory.FRAUD, CsTicketPriority.HIGH);
orderModel.setStatus(OrderStatus.SUSPENDED);
getModelService().save(orderModel);
return Transition.WAIT;
}
else
{
return Transition.OK;
}
}
// Continue onto next entry
}
return Transition.OK;
}
protected CsTicketModel createTicket(final String subject, final String description, final OrderModel order,
final CsTicketCategory category, final CsTicketPriority priority)
{
final CsTicketModel newTicket = modelService.create(CsTicketModel.class);
newTicket.setHeadline(subject);
newTicket.setCategory(category);
newTicket.setPriority(priority);
newTicket.setOrder(order);
newTicket.setCustomer(order.getUser());
final CsCustomerEventModel newTicketEvent = new CsCustomerEventModel();
newTicketEvent.setText(description);
return getTicketBusinessService().createTicket(newTicket, newTicketEvent);
}
protected boolean isReviewDecision(final PaymentTransactionEntryModel entry)
{
return PaymentTransactionType.REVIEW_DECISION.equals(entry.getType());
}
protected boolean isReviewAccepted(final PaymentTransactionEntryModel entry)
{
return TransactionStatus.ACCEPTED.name().equals(entry.getTransactionStatus());
}
protected boolean isAuthorization(final PaymentTransactionEntryModel entry)
{
return PaymentTransactionType.AUTHORIZATION.equals(entry.getType());
}
protected boolean isAuthorizationInReview(final PaymentTransactionEntryModel entry)
{
return TransactionStatus.REVIEW.name().equals(entry.getTransactionStatus());
}
protected TicketBusinessService getTicketBusinessService()
{
return ticketBusinessService;
}
@Required
public void setTicketBusinessService(final TicketBusinessService ticketBusinessService)
{
this.ticketBusinessService = ticketBusinessService;
}
}
| [
"[email protected]"
]
| |
888d9ba1c15008786d8a6f6f023f907b7ef3889f | c25cbefa92e5fa51a2424f55ec9e1d1bd1bfff6b | /src/com/sotas/Main.java | c79e44eeb5ac7e6190025c0f49225f4a2d8776bc | []
| no_license | qwe522y/2side | c2a9279860a70b6b5768a282ac39da33c53af758 | 32ad47efdeace78914e8b3acc1effe4d5cb0b252 | refs/heads/master | 2021-01-04T02:41:56.262341 | 2017-03-31T14:24:48 | 2017-03-31T14:24:48 | 76,113,869 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,323 | java | package com.sotas;
import com.alee.laf.WebLookAndFeel;
import org.apache.log4j.Logger;
import javax.swing.*;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
public class Main {
private static final Logger log = Logger.getLogger(MainFrame.class);
public static void main(String[] args) throws InvocationTargetException, InterruptedException, UnsupportedLookAndFeelException {
try {
UIManager.setLookAndFeel(new WebLookAndFeel());
Resource.getInstance();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
/*
new MainFrame().setVisible(true);
if(true) return;
*/
LoginFrame f = new LoginFrame();
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
int x = (int) ((dimension.getWidth() - f.getWidth()) / 2);
int y = (int) ((dimension.getHeight() - f.getHeight()) / 2);
f.setLocation(x, y);
f.setVisible(true);
}
});
} catch (Exception ex) {
log.fatal(ex.getMessage(), ex);
Utils.showException(ex);
}
}
}
| [
"[email protected]"
]
| |
6a0ef8f4525b00838f6455227b11fc586319a95a | 1b67b1aff215f4d89664a756d8a18379ac5a9f49 | /src/com/spanish/english/dao/CoinsNameDaoImpl.java | eddd74675e07b8145dbb5f88fbf37fa478e05dc0 | []
| no_license | aniketsanjaydeshmukh/WebMillenniumSystem | b111d4932d769abe60826091781465455fd930f8 | 94c7a3b69ce30185f8c31fd1aef2461952034e68 | refs/heads/master | 2020-09-14T06:54:25.480331 | 2016-09-23T05:23:07 | 2016-09-23T05:23:07 | 66,752,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,789 | java | package com.spanish.english.dao;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.spanish.english.form.BillsName;
import com.spanish.english.form.CoinsName;
import com.spanish.english.form.CoinsValue;
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class CoinsNameDaoImpl implements CoinsNameDao {
@Autowired
SessionFactory sessionFactory;
Session session = null;
Transaction tx = null;
@Override
public boolean addOrUpdateCoinsName(CoinsName coinsName) {
boolean flag = false;
try{
session = sessionFactory.openSession();
tx = session.beginTransaction();
session.saveOrUpdate(coinsName);
tx.commit();
session.close();
flag = true;
}catch(Exception e){
e.printStackTrace();
}
return flag;
}
@Override
public Set<CoinsName> getCoinsNameList() {
session = sessionFactory.openSession();
tx = session.beginTransaction();
Criteria c = session.createCriteria(CoinsName.class);
List<CoinsName> list = c.list();
Set<CoinsName> billsNameList = new HashSet<CoinsName>(list);
tx.commit();
session.close();
return billsNameList;
}
@Override
public CoinsName getCoinsNameById(long id) {
Session session;
CoinsName billsName = null;
try{
session = sessionFactory.openSession();
Criteria criteria = session.createCriteria(CoinsName.class);
criteria.add(Restrictions.eq("id", id));
Object result=criteria.uniqueResult();
billsName = (CoinsName)result;
session.close();
}
catch(Exception e){
e.printStackTrace();
}
return billsName;
}
@Override
public boolean deleteCoinsName(long Id) {
boolean flag = true;
try{
session = sessionFactory.openSession();
Object o = session.load(CoinsName.class, Id);
tx = session.getTransaction();
session.beginTransaction();
session.delete(o);
tx.commit();
}catch(Exception e){
flag = false;
e.printStackTrace();
}
return flag;
}
@Override
public Set<CoinsName> getCoinsNameByCountry(long cID) {
session = sessionFactory.openSession();
tx = session.beginTransaction();
Criteria c = session.createCriteria(CoinsName.class);
c.createAlias("country", "c");
c.add(Restrictions.eq("c.id", cID));
List<CoinsName> list = c.list();
Set<CoinsName> coinsValueList = new HashSet<CoinsName>(list);
tx.commit();
session.close();
return coinsValueList;
}
}
| [
"kr7040211412"
]
| kr7040211412 |
a317deb234f1748ed348e6ee839453c2f080ea0e | c508e0588e38c9c5a0da6b45d2c3d3e80d9878ac | /src/LRU.java | 735e826af9141111bb519ee192c7c1a9e52fd482 | []
| no_license | viniciosbastos/SimuladorSwap | 658aa030f041c7d2d1ff78acb448660b70dcccca | 9e2acde86bb70f3ce8fd08f36ef05883e650dd88 | refs/heads/master | 2020-12-02T22:43:04.819247 | 2017-07-04T03:19:02 | 2017-07-04T03:19:02 | 96,170,792 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,361 | java |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
* 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.
*/
/**
*
* @author Vinicios
*/
public class LRU {
public static int[] nums = {3,6,2,7,5,5,3,5,6,8,9,8,7,6,8,3,0,0,3,2,5,5,6,4,0,6,4,4,6,2,7,7,8,7,3,4,7,9,6,1,6,8,0,8,7,3,6,3,8,1,6,6,6,0,2,7,5,2,2,5,4,2,2,2,3,1,6,2,0,7,9,5,4,0,4,9,3,9,9,6,9,5,9,1,9,7,7,3,8,2,1,5,2,1,1,4,7,3,7,5};
public static void main(String[] args) throws IOException
{
bla(5, 100);
bla(6, 100);
bla(7, 100);
bla(8, 100);
}
public static void bla(int frame, int len) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int frames,pointer = 0, hit = 0, fault = 0,ref_len;
Boolean isFull = false;
int buffer[];
ArrayList<Integer> stack = new ArrayList<Integer>();
int reference[];
int mem_layout[][];
frames = frame;
ref_len = len;
reference = new int[ref_len];
mem_layout = new int[ref_len][frames];
buffer = new int[frames];
for(int j = 0; j < frames; j++)
buffer[j] = -1;
System.out.println("Please enter the reference string: ");
reference = nums;
System.out.println();
for(int i = 0; i < ref_len; i++)
{
if(stack.contains(reference[i]))
{
stack.remove(stack.indexOf(reference[i]));
}
stack.add(reference[i]);
int search = -1;
for(int j = 0; j < frames; j++)
{
if(buffer[j] == reference[i])
{
search = j;
hit++;
break;
}
}
if(search == -1)
{
if(isFull)
{
int min_loc = ref_len;
for(int j = 0; j < frames; j++)
{
if(stack.contains(buffer[j]))
{
int temp = stack.indexOf(buffer[j]);
if(temp < min_loc)
{
min_loc = temp;
pointer = j;
}
}
}
}
buffer[pointer] = reference[i];
fault++;
pointer++;
if(pointer == frames)
{
pointer = 0;
isFull = true;
}
}
for(int j = 0; j < frames; j++)
mem_layout[i][j] = buffer[j];
}
for(int i = 0; i < frames; i++)
{
for(int j = 0; j < ref_len; j++)
System.out.printf("%3d ",mem_layout[j][i]);
System.out.println();
}
System.out.println("The number of Hits: " + hit);
System.out.println("Hit Ratio: " + (float)((float)hit/ref_len));
System.out.println("The number of Faults: " + fault);
}
} | [
"[email protected]"
]
| |
a7b36970f94fc50cb342634788edb2f5d8e09893 | 9ae5965121f143fa5a5781b413d686311b734a2c | /src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAElement.java | b6cee68102c3985241680b62b0982c96df08ceac | [
"EPL-2.0",
"MIT",
"EPL-1.0",
"LGPL-2.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"MPL-2.0",
"CDDL-1.1",
"Apache-2.0",
"BSD-3-Clause",
"BSD-2-Clause"
]
| permissive | andre-becker/XLT | 41395ec5b673193412b26df35cc64e05ac55c9b4 | 174f9f467ab3094bcdbf80bcea818134a9d1180a | refs/heads/master | 2022-04-21T09:20:03.443914 | 2020-03-12T09:48:41 | 2020-03-12T09:48:41 | 257,584,910 | 0 | 0 | Apache-2.0 | 2020-04-21T12:14:39 | 2020-04-21T12:14:38 | null | UTF-8 | Java | false | false | 1,345 | java | /*
* Copyright (c) 2002-2020 Gargoyle Software 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.gargoylesoftware.htmlunit.javascript.host.svg;
import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.CHROME;
import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor;
import com.gargoylesoftware.htmlunit.svg.SvgAnchor;
/**
* A JavaScript object for {@code SVGAElement}.
*
* @author Ahmed Ashour
*/
@JsxClass(domClass = SvgAnchor.class)
public class SVGAElement extends SVGGraphicsElement {
/**
* Creates an instance.
*/
@JsxConstructor({CHROME, FF})
public SVGAElement() {
}
}
| [
"[email protected]"
]
| |
4eb74289f549e80c7dac4f4978ec18e36023fc27 | 3044fb0d307069e5b0195d07cbabeb6cdb122cd9 | /src/test/java/br/com/example/pom/methods/SeleniumMethods.java | 54c3e7a0de3aa10da26bdb9963265b3d34b59cb0 | [
"Apache-2.0"
]
| permissive | guirosset/POM-Example | dee319d3f5d7c595d145c8f62a005c5eec3869cd | ce532ac881f84eb2b25c3b69520fd49bb5882280 | refs/heads/master | 2022-12-20T10:28:37.331284 | 2020-09-22T03:19:52 | 2020-09-22T03:19:52 | 250,409,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package br.com.example.pom.methods;
import br.com.example.pom.steps.AbstractWebPage;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.springframework.beans.factory.annotation.Autowired;
public class SeleniumMethods {
@Autowired
private WebDriver driver;
public void waituntil(WebElement elementToAppear) {
WebDriverWait wait = new WebDriverWait(driver, 75000);
wait.until( ExpectedConditions.visibilityOf(elementToAppear));
}
public void scrollToElement(WebElement element) {
try {
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].scrollIntoView();", element);
} catch (Exception e) {
}
}
} | [
"[email protected]"
]
| |
31fe499531165c6c5a0261466805408570431bc6 | ebf621c6ca301dd814e65346f0a7705f2efe3113 | /ClothWholesale/clothwholesale2/src/main/java/com/ncu/clothwholesale/service/SupplierService.java | 43d20c2bedcd5ae879badd4591b636980f359b57 | []
| no_license | zhouhanyuxi/Java-projects | 5c50e9768f5aa04214e70c2ad166eee572177211 | c6bee518b739c104b2cbb66d3fe924363465749c | refs/heads/master | 2022-12-21T11:55:05.097846 | 2020-09-25T14:39:08 | 2020-09-25T14:39:08 | 298,224,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package com.ncu.clothwholesale.service;
import java.util.Map;
import com.ncu.clothwholesale.pojo.Supplier;
public interface SupplierService {
public Object listByCondition(Map<String, Object> args);
public Supplier findSupplierById(String supplierCode) throws Exception;
}
| [
"[email protected]"
]
| |
820d407eeb0f96a6c0525a6304d2eeba2a58b86e | 444c87407a272f40291ae57f62c9fd3cf4912a06 | /src/com/SCGEOrientaIA/util/Assunto.java | b581ebfbeaa60512ea2d832f770dd1546f55b73b | []
| no_license | rsarai/immunological-characteristics-detector | 8764bd0b5055c6a6422b2f47b06091a3a8bb2e08 | 498a970ec3caf8fbf0253418d596d9af5a60c971 | refs/heads/master | 2021-01-13T13:57:34.740062 | 2017-03-11T17:20:43 | 2017-03-11T17:20:43 | 72,928,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package com.SCGEOrientaIA.util;
public class Assunto {
private int id;
private String assunto;
public Assunto(){}
public Assunto(int id, String assunto){
this.id = id; this.assunto = assunto;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getAssunto() {
return assunto;
}
public void setAssunto(String assunto) {
this.assunto = assunto;
}
}
| [
"[email protected]"
]
| |
dff094737a53d203092bbdae821bffe7738dd5f0 | f3a06e6cebb7728f24e9d8d9c47e2dbf23127edf | /server/src/main/java/server/demo/ServerApplication.java | 42477fb9b8b89f8b9a9ff17673edd51b9c412391 | []
| no_license | Artanis-Wang/Class-JavaEE | a0293aad850dd617a6ae2084f557fb59f673657a | fc9233793f7abc74b52cddb81900e6ea5b615ad1 | refs/heads/master | 2023-09-01T16:31:58.950643 | 2021-10-26T15:47:04 | 2021-10-26T15:47:04 | 407,566,489 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 445 | java | package server.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import static server.demo.domain.User.admin;
import static server.demo.domain.User.userMap;
@SpringBootApplication
public class ServerApplication {
public static void main(String[] args) {
userMap.put("admin",admin);
SpringApplication.run(ServerApplication.class, args);
}
}
| [
"[email protected]"
]
| |
ecabad307c2575f284c7c12df4535e5c30b6a6bb | f4f203afb8ed25dccb3891db4eea923f4d7a752d | /app/src/main/java/makdroid/servicesproject/utils/NetworkUtils.java | 3e6da9df92266a1892adfd037ecca7e74de8b77e | []
| no_license | gylopl/servicedowloadproject | 57acc2260d4ecd2a8d296eb9a76e9cbb969b317f | 88465e8ae961ca85d0651e9f5ea342d3d0d08b09 | refs/heads/master | 2021-01-16T21:44:30.817005 | 2016-06-11T12:16:09 | 2016-06-11T12:16:09 | 60,759,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | package makdroid.servicesproject.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Created by Grzecho on 16.11.2015.
*/
public class NetworkUtils {
public static boolean checkNetworkConnection(Context ctx) {
ConnectivityManager connMgr = (ConnectivityManager)
ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
return (networkInfo != null && networkInfo.isConnected());
}
}
| [
"[email protected]"
]
| |
a1256cb26d80d32331c634509f1e30a7c3571787 | 8c1ebcf2aabda6315cbaad3c6f9f9e72b609ca54 | /kubernetes-model-generator/kubernetes-model-gatewayapi/src/generated/java/io/fabric8/kubernetes/api/model/gatewayapi/v1beta1/ReferenceGrantTo.java | 177dc5848b2ecad1a8252b63b65d49b782a73dec | [
"Apache-2.0"
]
| permissive | akram/kubernetes-client | 154969ce0aee87223bb3d5f6fb89f5e7d5f4d163 | 449d06bc447f2b621149b20312235d2d28460873 | refs/heads/master | 2023-08-08T20:59:09.663361 | 2023-06-22T11:58:02 | 2023-06-22T13:46:14 | 197,317,669 | 0 | 3 | Apache-2.0 | 2023-07-03T08:10:43 | 2019-07-17T04:54:52 | Java | UTF-8 | Java | false | false | 3,733 | java |
package io.fabric8.kubernetes.api.model.gatewayapi.v1beta1;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.fabric8.kubernetes.api.model.Container;
import io.fabric8.kubernetes.api.model.IntOrString;
import io.fabric8.kubernetes.api.model.KubernetesResource;
import io.fabric8.kubernetes.api.model.LabelSelector;
import io.fabric8.kubernetes.api.model.LocalObjectReference;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.ObjectReference;
import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.fabric8.kubernetes.api.model.PodTemplateSpec;
import io.fabric8.kubernetes.api.model.ResourceRequirements;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import lombok.EqualsAndHashCode;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
@JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"apiVersion",
"kind",
"metadata",
"group",
"name"
})
@ToString
@EqualsAndHashCode
@Setter
@Accessors(prefix = {
"_",
""
})
@Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = {
@BuildableReference(ObjectMeta.class),
@BuildableReference(LabelSelector.class),
@BuildableReference(Container.class),
@BuildableReference(PodTemplateSpec.class),
@BuildableReference(ResourceRequirements.class),
@BuildableReference(IntOrString.class),
@BuildableReference(ObjectReference.class),
@BuildableReference(LocalObjectReference.class),
@BuildableReference(PersistentVolumeClaim.class)
})
public class ReferenceGrantTo implements KubernetesResource
{
@JsonProperty("group")
private String group;
@JsonProperty("kind")
private String kind;
@JsonProperty("name")
private String name;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
/**
* No args constructor for use in serialization
*
*/
public ReferenceGrantTo() {
}
/**
*
* @param kind
* @param name
* @param group
*/
public ReferenceGrantTo(String group, String kind, String name) {
super();
this.group = group;
this.kind = kind;
this.name = name;
}
@JsonProperty("group")
public String getGroup() {
return group;
}
@JsonProperty("group")
public void setGroup(String group) {
this.group = group;
}
@JsonProperty("kind")
public String getKind() {
return kind;
}
@JsonProperty("kind")
public void setKind(String kind) {
this.kind = kind;
}
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"[email protected]"
]
| |
004b3f1605aa573c1a1d3fc2528f5c996286c6d8 | ef0c1514e9af6de3ba4a20e0d01de7cc3a915188 | /sdk/spring/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/exception/DatabaseCreationException.java | 6b42de838600d7fc2647a62b516958538e4abf66 | [
"LicenseRef-scancode-generic-cla",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"CC0-1.0",
"BSD-3-Clause",
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
]
| permissive | Azure/azure-sdk-for-java | 0902d584b42d3654b4ce65b1dad8409f18ddf4bc | 789bdc6c065dc44ce9b8b630e2f2e5896b2a7616 | refs/heads/main | 2023-09-04T09:36:35.821969 | 2023-09-02T01:53:56 | 2023-09-02T01:53:56 | 2,928,948 | 2,027 | 2,084 | MIT | 2023-09-14T21:37:15 | 2011-12-06T23:33:56 | Java | UTF-8 | Java | false | false | 924 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.spring.data.cosmos.exception;
import org.springframework.dao.DataAccessException;
import org.springframework.lang.Nullable;
/**
* General exception for illegal creation of cosmos db
*/
public class DatabaseCreationException extends DataAccessException {
/**
* Construct a {@code IllegalQueryException} with the specified detail message.
* @param msg the detail message
*/
public DatabaseCreationException(String msg) {
super(msg);
}
/**
* Construct a {@code IllegalQueryException} with the specified detail message
* and nested exception.
*
* @param msg the detail message
* @param cause the nested exception
*/
public DatabaseCreationException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}
}
| [
"[email protected]"
]
| |
318f99e59022c211521f0addb503f7aba0636506 | e2a851af459e322f55caefd943820c4246608983 | /ps-admin/src/main/java/org/ps/PsAdminApp.java | 69bb04d345731f72b80ab887399f52c62946d5b1 | []
| no_license | zhoufn/ps-job | c59d1cf786577b7d8893f3d6470fc4041779e86b | 89eda8172063d5c475761a2ea14a6649de4f61e5 | refs/heads/master | 2021-03-22T05:14:03.165791 | 2018-01-22T08:14:38 | 2018-01-22T08:14:38 | 110,495,347 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package org.ps;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Hello world!
*
*/
@SpringBootApplication
public class PsAdminApp
{
public static void main( String[] args ){
SpringApplication.run(PsAdminApp.class,args);
}
}
| [
"[email protected]"
]
| |
f862347f394c76f4b3a72a393aa9fb223be6f0cf | 2bef412543ab92fbb0fe32dad2cce6677b6663df | /src/com/sshd/model/StuCourse.java | bc95511a54e287919d45a85f53845c9810541fc7 | []
| no_license | wjkiddo/SSHD | 559532cfde3a70b5147e7291c541c0c30897abbe | 763acf568fcaca12d79433922d1916d6f76534fe | refs/heads/master | 2021-01-10T02:22:33.776804 | 2015-06-03T14:36:07 | 2015-06-03T14:36:07 | 36,803,480 | 0 | 2 | null | 2015-06-03T14:36:10 | 2015-06-03T12:55:34 | Java | UTF-8 | Java | false | false | 512 | java | package com.sshd.model;
import java.io.Serializable;
public class StuCourse implements Serializable{
private int id;
private int stuId;
private int courseId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getStuId() {
return stuId;
}
public void setStuId(int stuId) {
this.stuId = stuId;
}
public int getCourseId() {
return courseId;
}
public void setCourseId(int courseId) {
this.courseId = courseId;
}
}
| [
"[email protected]"
]
| |
ba7393acb9f90904441369cb98a97e318ffa4a11 | 374dfc4258a163a2d9a5c312f97dbb7cf34b1d8a | /cs-oracle-cloud-databases/src/main/java/io/cloudslang/content/database/entities/OracleCloudInputs.java | 80590522ecf84a52bd6711502df612459d1fe874 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
]
| permissive | CloudSlang/cs-actions | b90a72b2caa195886a748715c708a7dacbbd603e | 3c0f92f890a80241437dade2fa8a189723bd5c77 | refs/heads/master | 2023-08-16T17:25:49.102151 | 2023-08-11T04:55:18 | 2023-08-11T04:55:18 | 28,305,374 | 18 | 37 | Apache-2.0 | 2023-09-14T05:17:05 | 2014-12-21T16:30:37 | Java | UTF-8 | Java | false | false | 10,817 | java | /*
* Copyright 2022-2023 Open Text
* This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
* The Apache License is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.cloudslang.content.database.entities;
import io.cloudslang.content.database.utils.SQLUtils;
import io.cloudslang.content.utils.CollectionUtilities;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static org.apache.commons.lang3.StringUtils.isNoneEmpty;
public class OracleCloudInputs {
//Inputs
private String connectionString;
private String username;
private String password;
private String walletPath;
private String sqlCommand;
private List<String> sqlCommands = new ArrayList<>();
private String delimiter;
private String colDelimiter;
private String rowDelimiter;
private String trustStore;
private String trustStorePassword;
private String keyStore;
private String keyStorePassword;
private int executionTimeout;
private boolean overwrite;
private int resultSetType;
private int resultSetConcurrency;
private String key;
private int iUpdateCount;
private String dbType;
//Outputs
private String columnNames;
private List<String> rowsLeft = new ArrayList<>();
@java.beans.ConstructorProperties({"connectionString", "username", "password", "walletPath", "sqlCommand", "sqlCommands",
"delimiter", "colDelimiter", "rowDelimiter", "overwrite", "trustStore", "trustStorePassword", "keyStore", "keyStorePassword",
"executionTimeout", "resultSetType", "resultSetConcurrency", "key"})
public OracleCloudInputs(String connectionString,
String username,
String password,
String walletPath,
String sqlCommand,
List<String> sqlCommands,
String delimiter,
String colDelimiter,
String rowDelimiter,
boolean overwrite,
String trustStore,
String trustStorePassword,
String keyStore,
String keyStorePassword,
int executionTimeout,
int resultSetType,
int resultSetConcurrency,
String key
) {
this.connectionString = connectionString;
this.username = username;
this.password = password;
this.walletPath = walletPath;
this.sqlCommand = sqlCommand;
this.sqlCommands = sqlCommands;
this.delimiter = delimiter;
this.colDelimiter = colDelimiter;
this.rowDelimiter = rowDelimiter;
this.overwrite = overwrite;
this.trustStore = trustStore;
this.trustStorePassword = trustStorePassword;
this.keyStore = keyStore;
this.keyStorePassword = keyStorePassword;
this.executionTimeout = executionTimeout;
this.resultSetType = resultSetType;
this.resultSetConcurrency = resultSetConcurrency;
this.key = key;
}
public static OracleCloudInputsBuilder builder() {
return new OracleCloudInputsBuilder();
}
public String getSqlCommand() {
return sqlCommand;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getWalletPath() {
return walletPath;
}
public boolean getOverwrite() {
return overwrite;
}
public String getTrustStore() {
return trustStore;
}
public String getTrustStorePassword() {
return trustStorePassword;
}
public String getKeyStore() {
return keyStore;
}
public String getKeyStorePassword() {
return keyStorePassword;
}
public int getExecutionTimeout() {
return executionTimeout;
}
public String getConnectionString() {
return connectionString;
}
public String getDelimiter() {
return delimiter;
}
public String getColumnNames() {
return columnNames;
}
public void setColumnNames(String columnNames) {
this.columnNames = columnNames;
}
public List<String> getRowsLeft() {
return rowsLeft;
}
public void setRowsLeft(List<String> rowsLeft) {
this.rowsLeft = rowsLeft;
}
public int getResultSetType() {
return resultSetType;
}
public int getResultSetConcurrency() {
return resultSetConcurrency;
}
public String getKey() {
return key;
}
public String getColDelimiter() {
return colDelimiter;
}
public void setColDelimiter(String colDelimiter) {
this.colDelimiter = colDelimiter;
}
public String getRowDelimiter() {
return rowDelimiter;
}
public void setRowDelimiter(String rowDelimiter) {
this.rowDelimiter = rowDelimiter;
}
public List<String> getSqlCommands() {
return sqlCommands;
}
public static List<String> getSqlCommands(final String sqlCommandsStr, final String scriptFileName, final String commandsDelimiter) {
if (isNoneEmpty(sqlCommandsStr)) {
return CollectionUtilities.toList(sqlCommandsStr, commandsDelimiter);
}
if (isNoneEmpty(scriptFileName)) {
return SQLUtils.readFromFile(scriptFileName);
}
return Collections.emptyList();
}
public void setSqlCommands(List<String> sqlCommands) {
this.sqlCommands = sqlCommands;
}
public int getIUpdateCount() {
return iUpdateCount;
}
public void setIUpdateCount(int iUpdateCount) {
this.iUpdateCount = iUpdateCount;
}
public String getDbType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
public static class OracleCloudInputsBuilder {
private String connectionString;
private String username;
private String password;
private String walletPath;
private String sqlCommand;
private List<String> sqlCommands;
private String delimiter;
private String colDelimiter;
private String rowDelimiter;
private String trustStore;
private String trustStorePassword;
private String keyStore;
private String keyStorePassword;
private int executionTimeout;
private int resultSetType;
private int resultSetConcurrency;
private boolean overwrite;
private String key;
public OracleCloudInputsBuilder() {
}
public OracleCloudInputsBuilder connectionString(String connectionString) {
this.connectionString = connectionString;
return this;
}
public OracleCloudInputsBuilder sqlCommand(String sqlCommand) {
this.sqlCommand = sqlCommand;
return this;
}
public OracleCloudInputsBuilder sqlCommands(List<String> sqlCommands) {
this.sqlCommands = sqlCommands;
return this;
}
public OracleCloudInputsBuilder delimiter(String delimiter) {
this.delimiter = delimiter;
return this;
}
public OracleCloudInputsBuilder colDelimiter(String colDelimiter) {
this.colDelimiter = colDelimiter;
return this;
}
public OracleCloudInputsBuilder rowDelimiter(String rowDelimiter) {
this.rowDelimiter = rowDelimiter;
return this;
}
public OracleCloudInputsBuilder overwrite(boolean overwrite) {
this.overwrite = overwrite;
return this;
}
public OracleCloudInputsBuilder walletPath(String walletPath) {
this.walletPath = walletPath;
return this;
}
public OracleCloudInputsBuilder username(String username) {
this.username = username;
return this;
}
public OracleCloudInputsBuilder password(String password) {
this.password = password;
return this;
}
public OracleCloudInputsBuilder trustStore(String trustStore) {
this.trustStore = trustStore;
return this;
}
public OracleCloudInputsBuilder trustStorePassword(String trustStorePassword) {
this.trustStorePassword = trustStorePassword;
return this;
}
public OracleCloudInputsBuilder keyStore(String keyStore) {
this.keyStore = keyStore;
return this;
}
public OracleCloudInputsBuilder keyStorePassword(String keyStorePassword) {
this.keyStorePassword = keyStorePassword;
return this;
}
public OracleCloudInputsBuilder executionTimeout(int executionTimeout) {
this.executionTimeout = executionTimeout;
return this;
}
public OracleCloudInputsBuilder resultSetType(int resultSetType) {
this.resultSetType = resultSetType;
return this;
}
public OracleCloudInputsBuilder resultSetConcurrency(int resultSetConcurrency) {
this.resultSetConcurrency = resultSetConcurrency;
return this;
}
public OracleCloudInputsBuilder key(String key) {
this.key = key;
return this;
}
public OracleCloudInputs build() {
return new OracleCloudInputs(connectionString,
username,
password,
walletPath,
sqlCommand,
sqlCommands,
delimiter,
colDelimiter,
rowDelimiter,
overwrite,
trustStore,
trustStorePassword,
keyStore,
keyStorePassword,
executionTimeout,
resultSetType,
resultSetConcurrency,
key
);
}
}
}
| [
"[email protected]"
]
| |
06ba3003deb6a85582e952c6598f064ba2677aeb | 0670c9fd7823cbf16aada780c01e2764a1a1b6f5 | /Listas Enlazadas/Lista Circular Simple Enlazada/src/Main.java | c864977884fef45637798113ca9593ad37284ba9 | []
| no_license | michaeldanielm/Estructura-de-Datos | 4c97dd7450beed4ff3c6eceedb3a60ce54fb1db4 | bb8307c1b4e81a7286f2a8aa21301541a91b03fc | refs/heads/master | 2021-06-23T11:28:22.511154 | 2017-08-20T15:54:47 | 2017-08-20T15:54:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,308 | java |
public class Main{
public static void main( String args[] )
{
ListaCircularDE lista = new ListaCircularDE();
Boolean booleano = Boolean.TRUE;
Character caracter = new Character( '$' );
Integer entero = new Integer( 34567 );
String cadena = "hola";
lista.insertar( booleano );
lista.imprimir();
lista.insertar( caracter );
lista.imprimir();
lista.insertar( entero );
lista.imprimir();
lista.insertar( cadena );
lista.imprimir();
Object objetoRemovido;
try {
objetoRemovido = lista.remover();
System.out.println(
objetoRemovido.toString() + " removido" );
lista.imprimir();
objetoRemovido = lista.remover();
System.out.println(
objetoRemovido.toString() + " removido" );
lista.imprimir();
objetoRemovido = lista.remover();
System.out.println(
objetoRemovido.toString() + " removido" );
lista.imprimir();
objetoRemovido = lista.remover();
System.out.println(
objetoRemovido.toString() + " removido" );
lista.imprimir();
}
catch ( ExcepcionListaVacia excepcionListaVacia ) {
excepcionListaVacia.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
ae5f0af3a0f1a5db0353f82108fbaf25a045c6fa | fe43709fa51a3faca47f0f39b6f97da16b86bc55 | /BingoBox/code/Product/product-dao/src/test/java/com/bingobox/product/dao/ProductClassificationDaoTest.java | 71a08ca7ab221ef393b572f00d7d4138b7c91f07 | [
"MIT"
]
| permissive | lbjfish/projects | d857e0b23ab5e5a904d6f00685715072df893cc5 | 9ea62cbb6f8e0c7906bbee6642ce98770bf0bb2c | refs/heads/master | 2021-01-20T00:13:13.609936 | 2017-08-24T10:59:03 | 2017-08-24T10:59:03 | 101,272,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,595 | java | package com.bingobox.product.dao;
import com.bingobox.product.po.ProductClassificationPO;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* Created by zhangfubin on 2017/7/6.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:spring/spring-dao.xml"})
public class ProductClassificationDaoTest {
@Resource
private ProductClassificationDao productClassificationDao;
@Test
public void getById() throws Exception{
ProductClassificationPO productClassificationPO = productClassificationDao.getProductClassificationById(1L);
System.out.println(productClassificationPO.getClassificationCode());
}
@Test
public void getByParam() throws Exception{
ProductClassificationPO productClassificationPO = new ProductClassificationPO();
/*productClassificationPO.setProductClassificationId(1L);
productClassificationPO.setClassificationCode("123456");
productClassificationPO.setClassificationName("水果");
productClassificationPO.setParentClassificationId(1L);
productClassificationPO.setCreateUserId(1L);
productClassificationPO.setLastUpdateUserId(1L);*/
productClassificationPO.setIsDelete(0);
List<ProductClassificationPO> results = productClassificationDao.listProductClassificationByParam(productClassificationPO);
for(int i=0; i<results.size(); i++){
System.out.println(results.get(i).getClassificationCode());
}
}
@Test
public void insertProductClassification() throws Exception{
ProductClassificationPO productClassificationPO = new ProductClassificationPO();
productClassificationPO.setClassificationCode("123456");
productClassificationPO.setClassificationName("水果");
productClassificationPO.setParentClassificationId(1L);
productClassificationPO.setCreateUserId(1L);
productClassificationPO.setLastUpdateUserId(1L);
productClassificationPO.setIsDelete(0);
productClassificationPO.setCreateTime(new Date());
productClassificationPO.setLastUpdateTime(new Date());
System.out.println("插入前id=" + productClassificationPO.getProductClassificationId());
productClassificationDao.saveProductClassification(productClassificationPO);
System.out.println("插入后id=" + productClassificationPO.getProductClassificationId());
}
@Test
public void updateProductClassification() throws Exception{
ProductClassificationPO productClassificationPO = new ProductClassificationPO();
productClassificationPO.setProductClassificationId(3L);
productClassificationPO.setClassificationCode("123456");
productClassificationPO.setClassificationName("饮料");
productClassificationPO.setParentClassificationId(1L);
productClassificationPO.setCreateUserId(1L);
productClassificationPO.setLastUpdateUserId(1L);
productClassificationPO.setIsDelete(0);
productClassificationPO.setCreateTime(new Date());
productClassificationPO.setLastUpdateTime(new Date());
productClassificationDao.updateProductClassification(productClassificationPO);
}
@Test
public void deleteProductClassification() throws Exception{
productClassificationDao.deleteProductClassification(3L);
}
}
| [
"[email protected]"
]
| |
43bd238997bee0a47338a0736ad1220218481086 | 5994f51013a59748b1f4070f20a0fc5ba6b6e3c9 | /src/main/java/com/soecode/lyf/util/exception/BizException.java | da10655729094ed853a1bfcf7673bf83138285ea | [
"MIT"
]
| permissive | zhangxinfei/flea-java | a21da9b0ebb54c38ca83fdd3b343b3797e179d1b | 8d4e796e8db2c5652586ff40fe0c590030efb296 | refs/heads/master | 2020-04-28T00:40:28.269297 | 2019-03-10T13:11:56 | 2019-03-10T13:11:56 | 174,824,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,666 | java | package com.soecode.lyf.util.exception;
/**
* 自定义异常类(继承运行时异常)
* @author AlanLee
* @version 2016/11/26
*/
public class BizException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* 错误编码
*/
private String errorCode;
/**
* 消息是否为属性文件中的Key
*/
private boolean propertiesKey = true;
/**
* 构造一个基本异常.
*
* @param message
* 信息描述
*/
public BizException(String message)
{
super(message);
}
/**
* 构造一个基本异常.
*
* @param errorCode
* 错误编码
* @param message
* 信息描述
*/
public BizException(String errorCode, String message)
{
this(errorCode, message, true);
}
/**
* 构造一个基本异常.
*
* @param errorCode
* 错误编码
* @param message
* 信息描述
*/
public BizException(String errorCode, String message, Throwable cause)
{
this(errorCode, message, cause, true);
}
/**
* 构造一个基本异常.
*
* @param errorCode
* 错误编码
* @param message
* 信息描述
* @param propertiesKey
* 消息是否为属性文件中的Key
*/
public BizException(String errorCode, String message, boolean propertiesKey)
{
super(message);
this.setErrorCode(errorCode);
this.setPropertiesKey(propertiesKey);
}
/**
* 构造一个基本异常.
*
* @param errorCode
* 错误编码
* @param message
* 信息描述
*/
public BizException(String errorCode, String message, Throwable cause, boolean propertiesKey)
{
super(message, cause);
this.setErrorCode(errorCode);
this.setPropertiesKey(propertiesKey);
}
/**
* 构造一个基本异常.
*
* @param message
* 信息描述
* @param cause
* 根异常类(可以存入任何异常)
*/
public BizException(String message, Throwable cause)
{
super(message, cause);
}
public String getErrorCode()
{
return errorCode;
}
public void setErrorCode(String errorCode)
{
this.errorCode = errorCode;
}
public boolean isPropertiesKey()
{
return propertiesKey;
}
public void setPropertiesKey(boolean propertiesKey)
{
this.propertiesKey = propertiesKey;
}
} | [
"[email protected]"
]
| |
bb65d395d154b604bd6b222472ba3f34aa3fa16e | 71ebfd950e94ebae91837241d0f68c612709ee05 | /src/main/java/com/example/security/config/auth/PrincipalDetails.java | 337070dc7a93267eb726925fc12a2eb3290b1583 | []
| no_license | kcj3054/security | 456b140f4ea0afb056d14fe8662ca8091cb18227 | c4fd717e9d07f120481cc2c4e6140b449dae6d25 | refs/heads/master | 2023-08-16T00:01:49.751128 | 2021-09-09T11:17:27 | 2021-09-09T11:17:27 | 404,300,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,924 | java | package com.example.security.config.auth;
import com.example.security.model.User;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.ArrayList;
import java.util.Collection;
// 시큐리티가 /login 주소 요청이 오면 낚아채서ㅓ 로그인을 진행시킨다.
// 로그인 진행이 완료가 되면 시큐리티 session을 만들어줍니다.
// Authentication 안에 User정보가 있어야함
// User오브젝트 타입 => UserDetails 타입객체
//security Session => Authentication => UserDetails(PrincipalDetails)
public class PrincipalDetails implements UserDetails {
private User user;
public PrincipalDetails(User user) {
this.user = user;
}
//해당 user의 권한을 리턴하는 곳
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
Collection<GrantedAuthority> collect = new ArrayList<>();
collect.add(new GrantedAuthority() {
@Override
public String getAuthority() {
return user.getRole();
}
});
return collect;
}
@Override
public String getPassword() {
return user.getPassword();
}
@Override
public String getUsername() {
return user.getUsername();
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
//우리 사이트!! 1년동안 회원이 로그인을 안하면
// 휴면 계정으로 하기로함
// 현재시간 - 로그인시간 -> 1년 초과하면 return false;
//user.getloginDate();
return true;
}
}
| [
"[email protected]"
]
| |
b5042cdecc6213a2996f0bc5238b81965a18f7f3 | 361363bcddab9964df46f40eaa2f3a11d9523fbf | /_32_63/_061_CyclicalFigurateNumbers.java | 01dd4ba5b94bae6fe6d8bcb3630a16fa36521253 | []
| no_license | glagolef/Project-Euler-Solutions-in-Java | 3c59a31c1e9e472892ebc9a78ad93a6154c424cf | 651e577c1c481bc0f8f5cacdf52c0df71651bb67 | refs/heads/master | 2020-12-10T14:44:44.199093 | 2019-04-08T16:09:46 | 2019-04-08T16:09:46 | 51,551,683 | 0 | 0 | null | 2019-04-08T16:09:47 | 2016-02-11T22:26:28 | Java | UTF-8 | Java | false | false | 4,741 | java | package Project_Euler_Solutions_in_Java._32_63;
import Project_Euler_Solutions_in_Java.Utils.Util;
import java.util.*;
/**
* Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers
* are all figurate (polygonal) numbers and are generated by the following formulae:
*
* Triangle P3,n=n(n+1)/2 1, 3, 6, 10, 15, ...
* Square P4,n=n^2 1, 4, 9, 16, 25, ...
* Pentagonal P5,n=n(3n−1)/2 1, 5, 12, 22, 35, ...
* Hexagonal P6,n=n(2n−1) 1, 6, 15, 28, 45, ...
* Heptagonal P7,n=n(5n−3)/2 1, 7, 18, 34, 55, ...
* Octagonal P8,n=n(3n−2) 1, 8, 21, 40, 65, ...
* The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties.
*
* The set is cyclic, in that the last two digits of each number
* is the first two digits of the next number (including the last number with the first).
* Each polygonal type: triangle (P3,127=8128), square (P4,91=8281), and pentagonal (P5,44=2882),
* is represented by a different number in the set.
* This is the only set of 4-digit numbers with this property.
* Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type:
* triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set.
*/
public class _061_CyclicalFigurateNumbers {
HashMap<String, List<String>> triangles = new HashMap<>();
HashMap<String, List<String>> squares = new HashMap<>();
HashMap<String, List<String>> pentagones = new HashMap<>();
HashMap<String, List<String>> hexagons = new HashMap<>();
HashMap<String, List<String>> heptagons = new HashMap<>();
HashMap<String, List<String>> octagons = new HashMap<>();
public static void main(String[] args) {
long start = System.currentTimeMillis();
Util.println("Result = " + new _061_CyclicalFigurateNumbers().run());
long end = System.currentTimeMillis();
Util.println("Total time: " + (end - start) * 0.001 + " s");
}
public int run() {
generateFigurate(calculateTriangle, triangles);
generateFigurate(calculateSquare, squares);
generateFigurate(calculatePentagon, pentagones);
generateFigurate(calculateHexagon, hexagons);
generateFigurate(calculateHeptagon, heptagons);
generateFigurate(calculateOctagon, octagons);
// for (int o : octagons)
// for (int hp : heptagons)
// for (int hx : hexagons)
// for(int p : pentagones)
// for(int s : squares)
// for(int t : triangles)
// if (isComboCyclical(Arrays.asList(t, s, p, hx, hp, o))) {
// return t + s + p + hx + hp + o;
// }
return 0;
}
private boolean isComboCyclical(List<Integer> al){
String remainder = String.valueOf(al.get(0)).substring(2);
HashMap<String, String> hm = new HashMap<>();
for(int element : al){
splitNumberDownTheMiddle(element, hm);
}
for(int i = 0; i <= al.size(); i ++){
if(hm.containsKey(remainder)){
String tmp = remainder;
remainder = hm.get(remainder);
hm.replace(tmp, null);
} else{
return false;
}
}
return true;
}
private void splitNumberDownTheMiddle(int n, HashMap<String,String> hm){
String number = String.valueOf(n);
hm.put(number.substring(0,2), number.substring(2));
}
private void generateFigurate(Calculation calc, HashMap<String, List<String>> hs){
int i;
for(i = 1; calc.evaluate(i) < 1000; i++){}
for(;calc.evaluate(i) < 10000; i++){
int eval = calc.evaluate(i);
String evalString = String.valueOf(eval);
String key = evalString.substring(0,2);
String value = evalString.substring(2);
if(value.charAt(0) == '0')
continue;
if(hs.containsKey(key)){
hs.get(key).add(value);
} else {
hs.put(key, Arrays.asList(value));
}
}
}
private Calculation calculateTriangle = (n -> n * (n + 1) / 2);
private Calculation calculateSquare = (n -> n * n);
private Calculation calculatePentagon = (n -> n * (3 * n - 1) / 2);
private Calculation calculateHexagon = (n -> n * (2*n - 1));
private Calculation calculateHeptagon = (n -> n * (5*n - 3) / 2);
private Calculation calculateOctagon = (n -> n * (3 * n - 2));
public interface Calculation {
int evaluate(int param);
}
}
| [
"[email protected]"
]
| |
3278d29a7b95b783a34529a41f091f227242143e | 6235c05a6c8a6aef5a147497ae7ac4b9f2e4100b | /microservicecloud-zuul-gateway-9527/src/main/java/com/arch/springcloud/Zuul_9527_StartSpringCloudApp.java | d61ac406ba92fda9bf48fa0c05a96c1ce97b023b | []
| no_license | wecSingle/springcloud | a20203efe5587fc8da717d312fd3c3c5a99af2bb | 4e4c439c5683c9b68341dfcf3522fde5bd6b2c98 | refs/heads/master | 2022-07-13T03:17:06.038587 | 2020-03-14T05:23:08 | 2020-03-14T05:23:08 | 233,514,402 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package com.arch.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
@SpringBootApplication
@EnableZuulProxy
public class Zuul_9527_StartSpringCloudApp {
public static void main(String[] args) {
SpringApplication.run(Zuul_9527_StartSpringCloudApp.class,args);
}
}
| [
"[email protected]"
]
| |
66c0b88e32ef9ee64ad94d1279bf2795144faf22 | 901fc3afaeb8f84b5c61303717f76ef92a177c0a | /src/Collections/Flower.java | d2f8fa8971786dc192de72ce8020248cf5e16698 | []
| no_license | YaseminUs/zerotohero | 17665b9b03596ccd740ee08d9173259e31aeb21f | 9a4092d0cc5f8e05434081975e17d8cf9a2e9daa | refs/heads/master | 2020-11-24T11:21:24.792296 | 2019-12-15T03:34:05 | 2019-12-15T03:34:05 | 228,123,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,139 | java | package Collections;
import java.util.ArrayList;
import java.util.HashSet;
public class Flower {
//Create the program that implements flowerlist according to their species
//Create the Flower class that having instance variables name, barcodeNumber and Set as a flowers
//Create one constructor with two argument constructor
//Create one method to add the flowers to Set collection with flowers name and barcodeNumber
//Create one method to find the flowers from the Set. this method will take one parameter as a name of the flower and it will return the barcodeNumber of the flower
//Create one method to find the flowers from the set. This method will take one parameter as a barcode number of the flower and it will return the name of the flower
//Create one method to remove the flower from the set and with flower name.
//Create one method to print all the flower name from the Set.
//Create FlowerTest to test your application, create one object from the Flower class and store the ten flowers to your list.
//Create the Flower class that having instance variables name, barcodeNumber and Set as a flowers
String names;
int barcodeNumber;
HashSet<Flower> flowerList;
//Create one constructor with two argument constructor
public Flower(String names, int barcodeNumber) {
this.names = names;
this.barcodeNumber = barcodeNumber;
flowerList = new HashSet<>();
}
//Create one method to add the flowers to Set collection with flowers name and barcodeNumber
public void addFlower(String name, int barcodeNumber) {
flowerList.add(new Flower(name, barcodeNumber));
}
//Create one method to find the flowers from the Set.
// this method will take one parameter as a name of the
// flower and it will return the barcodeNumber of the flower
//and it will return the barcodeNumber of the flower
//pink flower
public int findFlower(String name) {
for (Flower fl : flowerList) {
if (fl.names.equalsIgnoreCase(name)) {
return fl.barcodeNumber;
}
}
System.out.println("this flower is not available ");
return 0;
}
public String findFlower(int barcodeNumber){
for(Flower fl: flowerList){
if(fl.barcodeNumber==barcodeNumber){
return fl.names;
}
}
System.out.println("this flower is not available ");
return null;
}
//Create one method to remove the flower from the set and with flower name.
public void removeFlower(String name){
ArrayList<Flower>flowersList = new ArrayList<>(flowerList);
for(int i=0;i<flowerList.size();i++){
if(flowersList.get(i).names.equalsIgnoreCase(name)){
flowersList.remove(flowersList.get(i));
}
}
flowerList=new HashSet<>(flowersList);
}
//Create one method to print all the flower name from the Set.
public void printAllFlower(){
for(Flower fl: flowerList){
System.out.println(fl.names);
}
}
}
| [
"[email protected]"
]
| |
8f59eac4bf3bbeea7e68fa27f48b63b5481264c8 | 2e3633e680665f3eb4ca5c7669b5ecdafb3a1cce | /src/main/java/cn/mifan123/refill/common/constant/Constants.java | 82706335cf98e24db34dcb859ed78acc59b41b04 | []
| no_license | qqabcv520/refill-api | 615c355dbd6b3b268b3b04913bae65fb812b4f9e | c2a37ecaeee2cf582800716952d78c8510f44782 | refs/heads/master | 2021-05-06T10:28:30.762808 | 2018-01-17T01:06:03 | 2018-01-17T01:06:03 | 114,132,091 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package cn.mifan123.refill.common.constant;
public interface Constants {
String TOKEN_HEADER_NAME = "Authorization";
String REQUEST_USER_KEY = "REQUEST_USER_KEY";
String TOKEN_CACHE_NAME = "token";
}
| [
"[email protected]"
]
| |
ece85ce5ac5119b9b3b31940363c0beb3dee482f | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /drjava_cluster/15883/tar_1.java | 9c6e57cc09ee255025921b4927ae7dcc55a6ac1f | []
| 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 | 3,451 | java | /*BEGIN_COPYRIGHT_BLOCK
*
* Copyright (c) 2001-2010, JavaPLT group at Rice University ([email protected])
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the names of DrJava, the JavaPLT group, Rice University, nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software is Open Source Initiative approved Open Source Software.
* Open Source Initative Approved is a trademark of the Open Source Initiative.
*
* This file is part of DrJava. Download the current version of this project
* from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/
*
* END_COPYRIGHT_BLOCK*/
package edu.rice.cs.javalanglevels;
import edu.rice.cs.javalanglevels.tree.*;
import edu.rice.cs.javalanglevels.parser.JExprParser;
import java.util.*;
import junit.framework.TestCase;
/** Represents the data for an instantiation of a class. When you actually create an object of some type,
* an InstanceData represents what you have created. Each InstanceData has a pointer to the SymbolData of its
* class type.
*/
public class InstanceData extends TypeData {
/**The class corresponding to this InstanceData*/
private SymbolData _classSymbolData;
/*@param classSD The SymbolData this is an instance of*/
public InstanceData(SymbolData classSD) {
super(null);
_classSymbolData = classSD;
_name = classSD.getName();
}
/**@return true since this is an InstanceData.*/
public boolean isInstanceType() { return true; }
/**@return The class SymbolData corresponding to the class of this InstanceData.*/
public SymbolData getSymbolData() { return _classSymbolData; }
/**@return this InstanceData.*/
public InstanceData getInstanceData() { return this; }
public String toString() { return "An instance of type '" + _classSymbolData +"'"; }
public boolean equals(Object o) {
return o != null && o.getClass() == getClass() && ((InstanceData)o)._classSymbolData.equals(_classSymbolData);
}
public int hashCode() { return _classSymbolData.hashCode(); }
}
| [
"[email protected]"
]
| |
35a7f83e8379bee6400dd8c0c7ccca1df0a2b11e | ca11669c4bf392de2e1391ea33711b1985f24313 | /src/main/java/com/topie/zhongkexie/publicity/api/PublicityController.java | 7a2ad5664ffed36280ca088431aa64a592af3992 | []
| no_license | topie/zhongkexie-server | fd41db299875a8da10a52fd0339272847248504e | b2a875c26b96a8f81c4434e755ce1aa72c10598b | refs/heads/master | 2021-07-25T19:57:10.707882 | 2018-11-07T15:04:38 | 2018-11-07T15:04:38 | 113,940,927 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,792 | java | package com.topie.zhongkexie.publicity.api;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.github.pagehelper.PageInfo;
import com.topie.zhongkexie.common.utils.PageConvertUtil;
import com.topie.zhongkexie.common.utils.ResponseUtil;
import com.topie.zhongkexie.common.utils.Result;
import com.topie.zhongkexie.database.publicity.model.Publicity;
import com.topie.zhongkexie.publicity.service.IPublicityService;
@Controller
@RequestMapping("/api/publicity/info")
public class PublicityController {
@Autowired
private IPublicityService iPublicityService;
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Result list(Publicity publicity,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "15") int pageSize) {
PageInfo<Publicity> pageInfo = iPublicityService.selectByFilterAndPage(publicity, pageNum, pageSize);
return ResponseUtil.success(PageConvertUtil.grid(pageInfo));
}
@RequestMapping(value = "/getPaperOptions", method = RequestMethod.GET)
@ResponseBody
public Object getPaperOptions(Publicity publicity) {
publicity.setPublicity(1);
List<Publicity> pageInfo = iPublicityService.selectByFilter(publicity);
List<Map> list = new ArrayList<Map>();
for(Publicity c:pageInfo){
Map map = new HashMap();
map.put("text", c.getTitle());
map.put("value",c.getPaperId());
list.add(map);
}
return list;
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Result update(Publicity publicity) {
Publicity p = iPublicityService.selectByKey(publicity.getId());
if(p!=null){
iPublicityService.updateNotNull(publicity);
}else{
iPublicityService.save(publicity);
}
return ResponseUtil.success();
}
@RequestMapping(value = "/load/{id}", method = RequestMethod.GET)
@ResponseBody
public Result load(@PathVariable(value = "id") Integer id) {
Publicity publicity = iPublicityService.selectByKey(id);
return ResponseUtil.success(publicity);
}
}
| [
"[email protected]"
]
| |
3e7331a2317282a435d6d4a8623c608598bdf0af | f5329b59547e7faf602f3f9c8e30a5b258a9c298 | /app/src/main/java/com/lx/hd/bean/MoRenQiDianAddressEntity.java | 4d5e39769b8e6018b6d10773b896a3b3199b11ae | [
"Apache-2.0"
]
| permissive | zyhchinese/huodi_huzhu | 009139e0694e029cb818bfe7fcd2915e8b7e94b8 | 334ea5ff558b47b81f8b4689bce1311c5c4f068e | refs/heads/master | 2020-03-26T10:17:05.402625 | 2018-09-04T01:23:28 | 2018-09-04T01:23:28 | 144,789,869 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,806 | java | package com.lx.hd.bean;
import java.util.List;
/**
* Created by 赵英辉 on 2018/6/13.
*/
public class MoRenQiDianAddressEntity {
/**
* flag : 200
* msg : 查询成功
* response : [{"custinfo":[{"id":61,"name":"送给","call":"17606401400","isdefault":0}],"saddlist":[{"id":62,"slongitude":"117.22173392772675","slatitude":"36.669316052970146","saddress":"山东省济南市历城区港沟街道济南药谷济南综合保税区(港兴一路)","sprovince":"山东省","scity":"济南市","scounty":"历城区","isdefault":0}],"eaddlist":[{"id":63,"elongitude":"117.20937967300415","elatitude":"36.66130386704049","eaddress":"山东省济南市历城区港沟街道G2京沪高速济南综合保税区(港兴一路)","eprovince":"山东省","ecity":"济南市","ecounty":"历城区","isdefault":0}]}]
*/
private int flag;
private String msg;
private List<ResponseBean> response;
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public List<ResponseBean> getResponse() {
return response;
}
public void setResponse(List<ResponseBean> response) {
this.response = response;
}
public static class ResponseBean {
private List<CustinfoBean> custinfo;
private List<SaddlistBean> saddlist;
private List<EaddlistBean> eaddlist;
public List<CustinfoBean> getCustinfo() {
return custinfo;
}
public void setCustinfo(List<CustinfoBean> custinfo) {
this.custinfo = custinfo;
}
public List<SaddlistBean> getSaddlist() {
return saddlist;
}
public void setSaddlist(List<SaddlistBean> saddlist) {
this.saddlist = saddlist;
}
public List<EaddlistBean> getEaddlist() {
return eaddlist;
}
public void setEaddlist(List<EaddlistBean> eaddlist) {
this.eaddlist = eaddlist;
}
public static class CustinfoBean {
/**
* id : 61
* name : 送给
* call : 17606401400
* isdefault : 0
*/
private int id;
private String name;
private String call;
private int isdefault;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCall() {
return call;
}
public void setCall(String call) {
this.call = call;
}
public int getIsdefault() {
return isdefault;
}
public void setIsdefault(int isdefault) {
this.isdefault = isdefault;
}
}
public static class SaddlistBean {
/**
* id : 62
* slongitude : 117.22173392772675
* slatitude : 36.669316052970146
* saddress : 山东省济南市历城区港沟街道济南药谷济南综合保税区(港兴一路)
* sprovince : 山东省
* scity : 济南市
* scounty : 历城区
* isdefault : 0
*/
private int id;
private String slongitude;
private String slatitude;
private String saddress;
private String sprovince;
private String scity;
private String scounty;
private int isdefault;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSlongitude() {
return slongitude;
}
public void setSlongitude(String slongitude) {
this.slongitude = slongitude;
}
public String getSlatitude() {
return slatitude;
}
public void setSlatitude(String slatitude) {
this.slatitude = slatitude;
}
public String getSaddress() {
return saddress;
}
public void setSaddress(String saddress) {
this.saddress = saddress;
}
public String getSprovince() {
return sprovince;
}
public void setSprovince(String sprovince) {
this.sprovince = sprovince;
}
public String getScity() {
return scity;
}
public void setScity(String scity) {
this.scity = scity;
}
public String getScounty() {
return scounty;
}
public void setScounty(String scounty) {
this.scounty = scounty;
}
public int getIsdefault() {
return isdefault;
}
public void setIsdefault(int isdefault) {
this.isdefault = isdefault;
}
}
public static class EaddlistBean {
/**
* id : 63
* elongitude : 117.20937967300415
* elatitude : 36.66130386704049
* eaddress : 山东省济南市历城区港沟街道G2京沪高速济南综合保税区(港兴一路)
* eprovince : 山东省
* ecity : 济南市
* ecounty : 历城区
* isdefault : 0
*/
private int id;
private String elongitude;
private String elatitude;
private String eaddress;
private String eprovince;
private String ecity;
private String ecounty;
private int isdefault;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getElongitude() {
return elongitude;
}
public void setElongitude(String elongitude) {
this.elongitude = elongitude;
}
public String getElatitude() {
return elatitude;
}
public void setElatitude(String elatitude) {
this.elatitude = elatitude;
}
public String getEaddress() {
return eaddress;
}
public void setEaddress(String eaddress) {
this.eaddress = eaddress;
}
public String getEprovince() {
return eprovince;
}
public void setEprovince(String eprovince) {
this.eprovince = eprovince;
}
public String getEcity() {
return ecity;
}
public void setEcity(String ecity) {
this.ecity = ecity;
}
public String getEcounty() {
return ecounty;
}
public void setEcounty(String ecounty) {
this.ecounty = ecounty;
}
public int getIsdefault() {
return isdefault;
}
public void setIsdefault(int isdefault) {
this.isdefault = isdefault;
}
}
}
}
| [
"[email protected]"
]
| |
3bbabbaf0dd46cca000b0d3dc1e0c117caa1539b | 20cdb1e6397d5bda51fac23d51cfbaa098345f56 | /reto2.java | 5dd5def14778a9f73b3e7a096636cb99327347b5 | []
| no_license | roxor97/retos_java | d2c8dd17a66fc547a12126915cca9b6817d0e5c9 | 6c38661d78e52a9ba1f1a4b908d3b98938058ca5 | refs/heads/main | 2023-06-29T00:40:52.464701 | 2021-08-06T22:49:16 | 2021-08-06T22:49:16 | 388,154,968 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,646 | java | import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Scanner;
public class reto2 {
public static void main(String[] args) throws Exception {
int n;
int cont = 0;
float menor = 10000;
DecimalFormatSymbols separador = new DecimalFormatSymbols();
separador.setDecimalSeparator('.');
DecimalFormat formato = new DecimalFormat("0.00", separador);
Scanner lector = new Scanner(System.in);
// lee la cantidad de cuerpos de agua y la valida
n = Integer.parseInt(lector.nextLine().strip());
// ingresa los valores de los cuerpos de agua.
CuerpoDeAgua[] cuerpos = new CuerpoDeAgua[n];
for (int i = 0; i < n; i++) {
String[] data = lector.nextLine().strip().split(" ");
// [0] --> cuer;podeagua : String
// [1] --> id : int
// [2] --> municipio : string
// [3] --> clasificacion : float
CuerpoDeAgua c01 = new CuerpoDeAgua();
c01.setNombre(data[0]);
c01.setId(Integer.parseInt(data[1]));
c01.setMunicipio(data[2]);
c01.setClasificacion(Float.parseFloat(data[3]));
cuerpos[i] = c01;
}
lector.close();
for (int i = 0; i < n; i++) {
System.out.println(cuerpos[i].nivel() + " " + formato.format(cuerpos[i].getId()));
}
// indica cuales son los cuerpos de agua que necesitan intervencion de la
// alcaldia o la gobernacion
String[] cmedios = new String[cuerpos.length];
for (int i = 0; i < cuerpos.length; i++) {
if (cuerpos[i].getClasificacion() > 35) {
cont++;
}
if (cuerpos[i].getClasificacion() > 14 && cuerpos[i].getClasificacion() < 35) {
cmedios[0] = cuerpos[i].getNombre();
}
}
System.out.println(formato.format(cont));
for (int i = 0; i < cuerpos.length; i++) {
if (cuerpos[i].getClasificacion() > 14 && cuerpos[i].getClasificacion() <= 35) {
System.out.println(formato.format(cuerpos[i].getClasificacion()));
}
}
if (cmedios[0] == null) {
System.out.println("NA");
}
for (int i = 0; i < cuerpos.length; i++) {
if (cuerpos[i].getClasificacion() < menor) {
menor = cuerpos[i].getClasificacion();
}
}
System.out.println(formato.format(menor));
}
}
| [
"[email protected]"
]
| |
edbb7cf2c15711d961a1bf2d193b9b88bcfdebad | 3973a50e8ab56d7f0ca24a380079f798b8b48b78 | /ColorGame/src/application/NewTile.java | 6ec834dee2f210ecdb995de348f20b5ac0895763 | []
| no_license | grzegorzCieslik95/MyGame | bc80bbbb46cba1e4c344a308ef7ff562c6517571 | 7b5645e99d20c6412dac808963512a2a820c571d | refs/heads/master | 2021-01-11T02:40:19.455615 | 2016-10-15T17:22:05 | 2016-10-15T17:22:05 | 70,901,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,726 | java | package application;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
public class NewTile {
private static NewTile instance = null;
Label labelColor,labelComment,labelPoint,labelPointComment,clock;
//do sterowania
int i,j;
public int sek;
public int size;
int randi,randj;
boolean timeOver;
public boolean ifActive,buttonActive ;
Button button;
Tile[][] board;
private NewTile(){
}
public Parent createContent() {
Pane root = new Pane();
button = new Button("Rozpoczynamy!!");
labelComment = new Label("Naciśnij taki kolor");
labelComment.setLayoutX(630);
labelComment.setTranslateY(110);
labelComment.setVisible(false);
labelColor = new Label("");
labelColor.setMinSize(100, 30);
labelColor.setLayoutX(640);
labelColor.setTranslateY(150);
labelPoint = new Label("0");
labelPoint.setLayoutX(755);
labelPoint.setTranslateY(190);
labelPoint.setVisible(false);
labelPointComment = new Label("Twój wynik to: ");
labelPointComment.setLayoutX(630);
labelPointComment.setTranslateY(190);
labelPointComment.setVisible(false);
clock = new Label("Start");
clock.setLayoutX(630);
clock.setTranslateY(220);
clock.setVisible(false);
button.setTranslateX(620);
button.setTranslateY(100);
root.setPrefSize(800, 600);
board = new Tile[size][size];
for (i = 0; i < size; i++) {
for (j = 0; j < size; j++) {
board[i][j] = new Tile();
board[i][j].setTranslateX(j * (600/size));
board[i][j].setTranslateY(i * (600/size));
root.getChildren().add(board[i][j]);
board[i][j].x=i;
board[i][j].y=j;
}
}
button.setOnMouseClicked(event -> {
ChangeColor();
timeOver = false;
ifActive=true;
button.setVisible(false);
labelComment.setVisible(true);
labelPoint.setVisible(true);
labelPointComment.setVisible(true);
labelColor.setVisible(true);
clock.setVisible(true);
labelPoint.setText("0");
clock.setText("Start");
clock.setTextFill(Color.BLACK);
buttonActive = true;
MyClock(sek);
});
root.getChildren().add(button);
root.getChildren().add(labelColor);
root.getChildren().add(labelComment);
root.getChildren().add(labelPoint);
root.getChildren().add(labelPointComment);
root.getChildren().add(clock);
return root;
}
public void CheckCorrectCollor(Tile tile) {
int r = (int) (Math.random() * 256);
int g = (int) (Math.random() * 256);
int b = (int) (Math.random() * 256);
Color color = Color.rgb(r, g, b);
Background background = new Background(
new BackgroundFill(color, CornerRadii.EMPTY, javafx.geometry.Insets.EMPTY));
tile.setBackground(background);
}
public void ChangeColor() {
randi = (int) (Math.random()*size);
randj = (int) (Math.random()*size);
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
int r = (int) (Math.random() * 256);
int g = (int) (Math.random() * 256);
int b = (int) (Math.random() * 256);
Color color = Color.rgb(r, g, b);
Background background = new Background(
new BackgroundFill(color, CornerRadii.EMPTY, javafx.geometry.Insets.EMPTY));
board[j][i].setBackground(background);
if(randi==i && randj==j)
labelColor.setBackground(background);
}
}
}
public void MyClock(int sek){
ClockMy my = new ClockMy();
my.secondsPassed=0;
my.time=sek;
my.start();
}
public static synchronized NewTile getInstance(){
if(instance == null)
instance = new NewTile();
return instance;
}
}
| [
"[email protected]"
]
| |
2581e8130fa9503fbaa98fecec2763a8bbfe736f | df350c55817b70356488e78f5a17ee29fbea363c | /02BusinessLayer/demoproject/src/main/java/com/example/demoproject/Customer.java | 55eb6bb982d13fa10cf4b11cafa3b7ef7215e593 | []
| no_license | puneetvashisht/fsdcapsule_java | 9897204dfa6e0ebcdc43a7c92f9fc623a53a5b03 | ee7371aa0ef369f4b6e42c47b99af88da6dae580 | refs/heads/master | 2020-03-19T07:18:16.719741 | 2018-06-20T01:36:47 | 2018-06-20T01:36:47 | 136,103,290 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package com.example.demoproject;
import org.springframework.data.annotation.Id;
public class Customer {
@Id
public String id;
public String firstName;
public String lastName;
public Customer() {}
public Customer(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
@Override
public String toString() {
return String.format(
"Customer[id=%s, firstName='%s', lastName='%s']",
id, firstName, lastName);
}
}
| [
"[email protected]"
]
| |
9a3a5d59428a13bb468b03fc549e19c58b93ad65 | b0d5277a158c305dde37649d6cfc720a2e77b4cf | /src/test/java/com/myactivemq/demo/DemoApplicationTests.java | f20e6486ce209c07170889b34f7287ee5bf97bb7 | []
| no_license | 2244835800/activemqdemo | d8fd6c16caadd716541ad647ca2d01ed38454c39 | 987dea52213cba9cf6fc3b31e0c69f6021eb2f95 | refs/heads/master | 2020-04-26T05:27:04.422757 | 2018-12-12T07:39:45 | 2018-12-12T07:39:45 | 173,334,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.myactivemq.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class DemoApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
]
| |
54d02677f084a6d29826e24db625e4b1c96ad3a6 | 550e718f59148ef115f12a011f4a2e19aaecc0ba | /chc-tran-lcn/chc-tran-lcn-third/src/main/java/com/chc/controller/LcnHttpController.java | 721e53fdeebd6271a7a232a155af1c979e59e807 | []
| no_license | txrGithub/chc-trans | 777199e78bc996b86b6b361db40728ef881c6a75 | 515e7ae0570c359d7c7421fc22d5ed3dabb020f9 | refs/heads/master | 2020-12-03T07:03:51.347380 | 2019-12-19T08:11:36 | 2019-12-19T08:11:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package com.chc.controller;
import com.chc.api.AccountApi;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* Description:
*
* @author cuihaochong
* @date 2019/12/13
*/
@RestController
@RequestMapping("/lcn/http")
public class LcnHttpController {
@Resource(name = "lcnThirdService")
AccountApi accountApi;
@GetMapping("transfer")
public void transfer(@RequestParam("money") int money) {
accountApi.transfer(money);
}
}
| [
"[email protected]"
]
| |
809be764ab3f716ae75676bb8e9cb2c72306ac42 | 182085bb2739009f758423156b48c0c49baf42e2 | /PDFGenerator/src/main/java/snowy_tales/tasks/Worker.java | d32fd945cb30ea116b5b64f817b25994ae076ef7 | []
| no_license | takashi-osako/snowy_tales | d1fb5ce2322688d150cf7f9e0990c869a0060c02 | b51f29f47b339e2bcdd3cfe8148cf8ce9bcac94f | refs/heads/master | 2021-01-23T20:50:19.667279 | 2013-05-27T01:46:43 | 2013-05-27T01:46:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,041 | java | package snowy_tales.tasks;
import snowy_tales.App;
import com.rabbitmq.client.AMQP.BasicProperties;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.QueueingConsumer;
/**
* Worker node to rabbitmq
*
* @author dorisip
*
*/
public class Worker {
private final static String QUEUE_NAME = "pdf";
private final static String HOST = "localhost";
private final static Boolean DURABLE = true;
private final static Boolean EXCLUSIVE = false;
private final static Boolean AUTO_DELETE = false;
private final static Boolean AUTO_ACK = false;
private final static Boolean MULTIPLE_ACK = false;
// One task at a time per worker
private final static int PREFETCH_COUNT = 1;
public static void main(String[] argv) throws java.io.IOException,
java.lang.InterruptedException {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(HOST);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.queueDeclare(QUEUE_NAME, DURABLE, EXCLUSIVE, AUTO_DELETE, null);
System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
channel.basicQos(PREFETCH_COUNT);
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(QUEUE_NAME, AUTO_ACK, consumer);
while (true) {
// Blocks until next message is received
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
// newbie
BasicProperties props = delivery.getProperties();
BasicProperties replyProps = new BasicProperties.Builder()
.correlationId(props.getCorrelationId()).build();
String message = new String(delivery.getBody());
System.out.println(" [x] Received '");
// Call generate PDF
byte [] pdfContent = App.createPdf(message);
// Acknowledge
// newbie
channel.basicPublish( "", props.getReplyTo(), replyProps, pdfContent);
channel.basicAck(delivery.getEnvelope().getDeliveryTag(),
MULTIPLE_ACK);
}
}
}
| [
"[email protected]"
]
| |
770be2fc2c29f977c91a7805e9feb728fb3bed0c | efcdb8fcdb1a1c2b2784b9ddb19c9c3ee4c2b241 | /src/com/google/code/apps2orgLauncher/dialogs/ExpandableListActivityWithDialog.java | ace7f1958b011355deb97cb8189c77f4f7dfda4b | []
| no_license | rafaelct/apps2org-Launcher | 697242670d3167bdc4a15f2252e316c4aaab01be | 71238dfb3d6baad851ee082c51e2622eb1fbbc2c | refs/heads/master | 2021-01-19T18:53:27.372034 | 2017-04-16T17:52:26 | 2017-04-16T17:52:26 | 88,385,321 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,142 | java | /*
* Copyright (C) 2009 Apps Organizer
*
* This file is part of Apps Organizer
*
* Apps Organizer 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 3 of the License, or
* (at your option) any later version.
*
* Apps Organizer 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 Apps Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
package com.google.code.apps2orgLauncher.dialogs;
import android.app.Dialog;
import android.app.ExpandableListActivity;
import android.os.Bundle;
/**
* @author fabio
*
*/
public class ExpandableListActivityWithDialog extends ExpandableListActivity implements GenericDialogManagerActivity {
private GenericDialogManager dialogManager;
public GenericDialogManager getGenericDialogManager() {
if (dialogManager == null) {
dialogManager = new GenericDialogManager(this);
}
return dialogManager;
}
@Override
protected void onResume() {
super.onResume();
getGenericDialogManager().onResume();
}
@Override
protected void onPrepareDialog(int id, Dialog dialog) {
getGenericDialogManager().onPrepareDialog(id, dialog);
}
@Override
protected Dialog onCreateDialog(int id) {
return getGenericDialogManager().onCreateDialog(id);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getGenericDialogManager().onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state);
getGenericDialogManager().onRestoreInstanceState(state);
}
public void showDialog(GenericDialogCreator d) {
getGenericDialogManager().showDialog(d);
}
@Override
protected void onDestroy() {
super.onDestroy();
getGenericDialogManager().onDestroy();
}
}
| [
"[email protected]"
]
| |
4573d6eb7e0f798e564adac7a6128e8e3cacb123 | a93325b6720b18c942730304113a7cba2c85c934 | /src/main/java/tree/二叉搜索树的区间和_938/Solution.java | 08818b59d87ca4846d4216cfa371329a1246b339 | []
| no_license | zxlearn1109/algorithm | 3bb47d78df4250e8140dab8d320e547203d6087b | 385784f9e5699633614b7b9952809b22717b1977 | refs/heads/master | 2023-01-15T12:53:07.679133 | 2020-11-28T16:03:29 | 2020-11-28T16:03:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 972 | java | package tree.二叉搜索树的区间和_938;
import tree.structure.TreeNode;
//给定二叉搜索树的根结点 root,返回 L 和 R(含)之间的所有结点的值的和。
//
// 二叉搜索树保证具有唯一的值。
//
//
//
// 示例 1:
//
// 输入:root = [10,5,15,3,7,null,18], L = 7, R = 15
//输出:32
//
//
// 示例 2:
//
// 输入:root = [10,5,15,3,7,13,18,1,null,6], L = 6, R = 10
//输出:23
//
//
//
//
// 提示:
//
//
// 树中的结点数量最多为 10000 个。
// 最终的答案保证小于 2^31。
//
// Related Topics 树 递归
// 👍 136 👎 0
public class Solution {
public int rangeSumBST(TreeNode root, int L, int R) {
if (root == null || L > R) return 0;
if (root.val < L) return rangeSumBST(root.right, L, R);
if (root.val > R) return rangeSumBST(root.left, L, R);
return root.val + rangeSumBST(root.left, L, root.val - 1) + rangeSumBST(root.right, root.val + 1, R);
}
}
| [
"[email protected]"
]
| |
cd15ce10296e3ade7a34e66c729cfdbc3c209242 | 73c336a65c8f6f30097bcfa6349a99e75ab050d3 | /src/main/java/org/mcstats/db/MySQLDatabase.java | 878a1abb6a8bb4b4ab7ebbe395bfb0ab21958630 | [
"BSD-2-Clause"
]
| permissive | jamierocks/MCStats | b68b50e2faf3da2db2787b1618ab3ec5f285a43f | 63ac9ec232f5a4fc73f65e0307a7298a4d1bca63 | refs/heads/master | 2020-12-26T18:45:24.807580 | 2014-11-23T18:25:55 | 2014-11-23T18:25:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,261 | java | package org.mcstats.db;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.log4j.Logger;
import org.mcstats.MCStats;
import org.mcstats.model.Column;
import org.mcstats.model.Graph;
import org.mcstats.model.Plugin;
import org.mcstats.model.PluginVersion;
import org.mcstats.model.Server;
import org.mcstats.model.ServerPlugin;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MySQLDatabase implements Database {
private Logger logger = Logger.getLogger("Database");
public static long QUERIES = 0;
/**
* The mcstats object
*/
private final MCStats mcstats;
/**
* A map of the already prepared statements
*/
private final Map<String, PreparedStatement> statementCache = new HashMap<String, PreparedStatement>();
/**
* The dataSource.getConnectionion() data source
*/
private BasicDataSource ds;
public MySQLDatabase(MCStats mcstats, String hostname, String databaseName, String username, String password) {
if (hostname == null || databaseName == null || username == null || password == null) {
throw new IllegalArgumentException("All arguments must not be null");
}
this.mcstats = mcstats;
// Create the mysql data dataSource.getConnectionion() pool
ds = new BasicDataSource();
ds.setDriverClassName("com.mysql.jdbc.Driver");
ds.setUsername(username);
ds.setPassword(password);
ds.setUrl("jdbc:mysql://" + hostname + "/" + databaseName);
ds.setInitialSize(50);
ds.setMaxActive(50);
}
public void executeUpdate(String query) throws SQLException {
Statement statement = null;
Connection connection = null;
try {
connection = ds.getConnection();
statement = connection.createStatement();
statement.executeUpdate(query);
QUERIES++;
} finally {
if (statement != null) {
statement.close();
}
safeClose(connection);
}
}
public Map<String, String> loadCountries() {
Map<String, String> countries = new HashMap<String, String>();
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ShortCode, FullName FROM Country");
ResultSet set = statement.executeQuery();
while (set.next()) {
countries.put(set.getString("ShortCode"), set.getString("FullName"));
}
safeClose(connection);
} catch (SQLException e) {
}
return countries;
}
public Plugin createPlugin(String name) {
Connection connection = null;
try {
connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO Plugin (Name, Author, Hidden, GlobalHits, Created) VALUES (?, '', 0, 0, UNIX_TIMESTAMP())");
statement.setString(1, name);
statement.executeUpdate();
QUERIES++;
} catch (SQLException e) {
e.printStackTrace();
} finally {
safeClose(connection);
}
// re-load the plugin
return loadPlugin(name);
}
public List<Plugin> loadPlugins() {
List<Plugin> plugins = new ArrayList<Plugin>();
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, Parent, Name, Author, Hidden, GlobalHits, Rank, LastRank, LastRankChange, Created, LastUpdated, ServerCount30 FROM Plugin WHERE Parent = -1");
ResultSet set = statement.executeQuery();
while (set.next()) {
plugins.add(resolvePlugin(set));
}
set.close();
safeClose(connection);
return plugins;
} catch (SQLException e) {
e.printStackTrace();
}
return plugins;
}
public Plugin loadPlugin(int id) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, Parent, Name, Author, Hidden, GlobalHits, Rank, LastRank, LastRankChange, Created, LastUpdated, ServerCount30 FROM Plugin WHERE ID = ?");
statement.setInt(1, id);
ResultSet set = statement.executeQuery();
if (set.next()) {
Plugin plugin = resolvePlugin(set);
set.close();
safeClose(connection);
return plugin;
}
safeClose(connection);
return null;
} catch (SQLException e) {
return null;
}
}
public Plugin loadPlugin(String name) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, Parent, Name, Author, Hidden, GlobalHits, Rank, LastRank, LastRankChange, Created, LastUpdated, ServerCount30 FROM Plugin WHERE Name = ?");
statement.setString(1, name);
ResultSet set = statement.executeQuery();
if (set.next()) {
Plugin plugin = resolvePlugin(set);
set.close();
safeClose(connection);
return plugin;
}
safeClose(connection);
return null;
} catch (SQLException e) {
return null;
}
}
public void savePlugin(Plugin plugin) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("UPDATE Plugin SET Name = ?, Hidden = ?, GlobalHits = ?, Rank = ?, LastRank = ?, LastRankChange = ?, Created = ?, LastUpdated = ?, ServerCount30 = ? WHERE ID = ?");
statement.setString(1, plugin.getName());
statement.setInt(2, plugin.getHidden());
statement.setInt(3, plugin.getGlobalHits());
statement.setInt(4, plugin.getRank());
statement.setInt(5, plugin.getLastRank());
statement.setInt(6, plugin.getLastRankChange());
statement.setInt(7, plugin.getCreated());
statement.setInt(8, plugin.getLastUpdated());
statement.setInt(9, plugin.getServerCount30());
statement.setInt(10, plugin.getId());
statement.executeUpdate();
safeClose(connection);
QUERIES++;
} catch (SQLException e) {
e.printStackTrace();
}
}
public PluginVersion createPluginVersion(Plugin plugin, String version) {
Connection connection = null;
try {
connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO Versions (Plugin, Version, Created) VALUES (?, ?, UNIX_TIMESTAMP())");
statement.setInt(1, plugin.getId());
statement.setString(2, version);
statement.executeUpdate();
QUERIES++;
} catch (SQLException e) {
e.printStackTrace();
} finally {
safeClose(connection);
}
return loadPluginVersion(plugin, version);
}
public List<PluginVersion> loadPluginVersions(Plugin plugin) {
List<PluginVersion> versions = new ArrayList<PluginVersion>();
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, Version, Created FROM Versions WHERE Plugin = ?");
statement.setInt(1, plugin.getId());
ResultSet set = statement.executeQuery();
while (set.next()) {
versions.add(resolvePluginVersion(plugin, set));
}
set.close();
safeClose(connection);
QUERIES++;
} catch (SQLException e) {
e.printStackTrace();
}
return versions;
}
public PluginVersion loadPluginVersion(Plugin plugin, String version) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, Version, Created FROM Versions WHERE Plugin = ? AND Version = ?");
statement.setInt(1, plugin.getId());
statement.setString(2, version);
ResultSet set = statement.executeQuery();
if (set.next()) {
PluginVersion pluginVersion = resolvePluginVersion(plugin, set);
set.close();
safeClose(connection);
return pluginVersion;
}
safeClose(connection);
QUERIES++;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
public ServerPlugin createServerPlugin(Server server, Plugin plugin, String version) {
// make sure there's a Versions row for that version
PluginVersion pluginVersion = plugin.getVersionByName(version);
if (pluginVersion == null) {
pluginVersion = loadPluginVersion(plugin, version);
}
// version still does not exist, so create it
if (pluginVersion == null) {
pluginVersion = createPluginVersion(plugin, version);
plugin.addVersion(pluginVersion);
}
Connection connection = null;
try {
connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO ServerPlugin (Server, Plugin, Version, Updated) VALUES (?, ?, ?, UNIX_TIMESTAMP())");
statement.setInt(1, server.getId());
statement.setInt(2, plugin.getId());
statement.setString(3, version);
statement.executeUpdate();
} catch (SQLException e) {
logger.info("createServerPlugin() => " + e.getMessage());
} finally {
safeClose(connection);
}
QUERIES++;
return loadServerPlugin(server, plugin);
}
public ServerPlugin loadServerPlugin(Server server, Plugin plugin) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT Version, Revision, Updated FROM ServerPlugin WHERE Server = ? AND Plugin = ?");
statement.setInt(1, server.getId());
statement.setInt(2, plugin.getId());
ResultSet set = statement.executeQuery();
QUERIES++;
if (set.next()) {
String version = set.getString("Version");
int revision = set.getInt("Revision");
int updated = set.getInt("Updated");
ServerPlugin serverPlugin = new ServerPlugin(this.mcstats, server, plugin);
serverPlugin.setVersion(version);
serverPlugin.setUpdated(updated);
serverPlugin.setRevision(revision);
serverPlugin.setModified(false);
set.close();
safeClose(connection);
return serverPlugin;
}
safeClose(connection);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
public List<ServerPlugin> loadServerPlugins(Server server) {
List<ServerPlugin> plugins = new ArrayList<ServerPlugin>();
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT Plugin, Version, Revision, Updated FROM ServerPlugin WHERE Server = ?");
statement.setInt(1, server.getId());
ResultSet set = statement.executeQuery();
QUERIES++;
while (set.next()) {
int pluginId = set.getInt("Plugin");
String version = set.getString("Version");
int revision = set.getInt("Revision");
int updated = set.getInt("Updated");
Plugin plugin = this.mcstats.loadPlugin(pluginId);
if (plugin != null) {
ServerPlugin serverPlugin = new ServerPlugin(this.mcstats, server, plugin);
serverPlugin.setVersion(version);
serverPlugin.setRevision(revision);
serverPlugin.setUpdated(updated);
serverPlugin.setModified(false);
plugins.add(serverPlugin);
}
}
set.close();
safeClose(connection);
} catch (SQLException e) {
e.printStackTrace();
}
return plugins;
}
public void saveServerPlugin(ServerPlugin serverPlugin) {
Connection connection = null;
try {
connection = ds.getConnection();
PreparedStatement statement;
if (serverPlugin.isVersionModified()) {
statement = connection.prepareStatement("UPDATE ServerPlugin SET Version = ? , Revision = ?, Updated = UNIX_TIMESTAMP() WHERE Server = ? AND Plugin = ?");
statement.setString(1, serverPlugin.getVersion());
statement.setInt(2, serverPlugin.getRevision());
statement.setInt(3, serverPlugin.getServer().getId());
statement.setInt(4, serverPlugin.getPlugin().getId());
} else {
statement = connection.prepareStatement("UPDATE ServerPlugin SET Updated = UNIX_TIMESTAMP() , Revision = ? WHERE Server = ? AND Plugin = ?");
statement.setInt(1, serverPlugin.getRevision());
statement.setInt(2, serverPlugin.getServer().getId());
statement.setInt(3, serverPlugin.getPlugin().getId());
}
statement.executeUpdate();
QUERIES++;
} catch (SQLException e) {
e.printStackTrace();
} finally {
safeClose(connection);
}
}
public void addPluginVersionHistory(Server server, PluginVersion version) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO VersionHistory (Plugin, Server, Version, Created) VALUES (?, ?, ?, UNIX_TIMESTAMP())");
statement.setInt(1, version.getPlugin().getId());
statement.setInt(2, server.getId());
statement.setInt(3, version.getId());
statement.executeUpdate();
safeClose(connection);
} catch (SQLException e) {
e.printStackTrace();
}
}
public Server createServer(String guid) {
Connection connection = null;
try {
connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO Server (GUID, Players, Country, ServerVersion, Created) VALUES (?, 0, 'ZZ', '', UNIX_TIMESTAMP())");
statement.setString(1, guid);
statement.executeUpdate();
QUERIES++;
} catch (SQLException e) {
logger.info("createServer() => " + e.getMessage());
return loadServer(guid);
} finally {
safeClose(connection);
}
// re-load the plugin
return loadServer(guid);
}
public Server loadServer(String guid) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, GUID, Players, Country, ServerVersion, Created, ServerSoftware, MinecraftVersion, osname, osarch, osversion, cores, online_mode, java_name, java_version FROM Server WHERE GUID = ?");
statement.setString(1, guid);
ResultSet set = statement.executeQuery();
QUERIES++;
if (set.next()) {
Server server = resolveServer(set);
set.close();
safeClose(connection);
return server;
}
safeClose(connection);
} catch (SQLException e) {
return null;
}
return null;
}
public void saveServer(Server server) {
Connection connection = null;
try {
connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("UPDATE Server SET GUID = ?, ServerVersion = ?, Players = ?, Country = ?, Created = ?, ServerSoftware = ?, MinecraftVersion = ?, osname = ?, osarch = ?, osversion = ?, cores = ?, online_mode = ?, java_name = ?, java_version = ? WHERE ID = ?");
statement.setString(1, server.getGUID());
statement.setString(2, server.getServerVersion());
statement.setInt(3, server.getPlayers());
statement.setString(4, server.getCountry());
statement.setInt(5, server.getCreated());
statement.setString(6, server.getServerSoftware());
statement.setString(7, server.getMinecraftVersion());
statement.setString(8, server.getOSName());
statement.setString(9, server.getOSArch());
statement.setString(10, server.getOSVersion());
statement.setInt(11, server.getCores());
statement.setInt(12, server.getOnlineMode());
statement.setString(13, server.getJavaName());
statement.setString(14, server.getJavaVersion());
statement.setInt(15, server.getId());
statement.executeUpdate();
QUERIES++;
} catch (SQLException e) {
e.printStackTrace();
} finally {
safeClose(connection);
}
}
public Graph createGraph(Plugin plugin, String name) {
Connection connection = null;
try {
connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO Graph (Plugin, Type, Active, Name, DisplayName, Scale) VALUES (?, ?, ?, ?, ?, ?)");
statement.setInt(1, plugin.getId());
statement.setInt(2, 0); // line
statement.setInt(3, 0); // active
statement.setString(4, name);
statement.setString(5, name);
statement.setString(6, "linear");
statement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
safeClose(connection);
}
return loadGraph(plugin, name);
}
public Graph loadGraph(Plugin plugin, String name) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, Type, Position, Active, Name, DisplayName, Scale FROM Graph WHERE Plugin = ? AND Name = ?");
statement.setInt(1, plugin.getId());
statement.setString(2, name);
ResultSet set = statement.executeQuery();
if (set.next()) {
Graph graph = resolveGraph(plugin, set);
set.close();
safeClose(connection);
return graph;
}
safeClose(connection);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
public List<Graph> loadGraphs(Plugin plugin) {
List<Graph> graphs = new ArrayList<Graph>();
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, Type, Position, Active, Name, DisplayName, Scale FROM Graph WHERE Plugin = ?");
statement.setInt(1, plugin.getId());
ResultSet set = statement.executeQuery();
while (set.next()) {
Graph graph = resolveGraph(plugin, set);
graphs.add(graph);
}
set.close();
safeClose(connection);
} catch (SQLException e) {
e.printStackTrace();
}
return graphs;
}
public Column createColumn(Graph graph, String name) {
if (name.length() > 100) {
return null;
}
Connection connection = null;
try {
connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO CustomColumn (Plugin, Graph, Name) VALUES (?, ?, ?)");
statement.setInt(1, graph.getPlugin().getId());
statement.setInt(2, graph.getId());
statement.setString(3, name);
statement.executeUpdate();
QUERIES++;
} catch (SQLException e) {
} finally {
safeClose(connection);
}
return loadColumn(graph, name);
}
public Column loadColumn(Graph graph, String name) {
if (name.length() > 100) {
return null;
}
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, Name FROM CustomColumn WHERE Graph = ? AND Name = ?");
statement.setInt(1, graph.getId());
statement.setString(2, name);
ResultSet set = statement.executeQuery();
QUERIES++;
if (set.next()) {
Column column = resolveColumn(graph.getPlugin(), graph, set);
set.close();
safeClose(connection);
return column;
}
safeClose(connection);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
public List<Column> loadColumns(Graph graph) {
List<Column> columns = new ArrayList<Column>();
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT ID, Name FROM CustomColumn WHERE Graph = ?");
statement.setInt(1, graph.getId());
ResultSet set = statement.executeQuery();
QUERIES++;
while (set.next()) {
Column column = resolveColumn(graph.getPlugin(), graph, set);
columns.add(column);
}
set.close();
safeClose(connection);
} catch (SQLException e) {
e.printStackTrace();
}
return columns;
}
public void blacklistServer(Server server) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO ServerBlacklist (Server, Violations) VALUES (?, ?)");
statement.setInt(1, server.getId());
statement.setInt(2, server.getViolationCount());
statement.executeUpdate();
QUERIES++;
// Now remove any version history
statement = connection.prepareStatement("DELETE FROM VersionHistory WHERE Server = ?");
statement.setInt(1, server.getId());
// all good !
safeClose(connection);
} catch (SQLException e) {
e.printStackTrace();
}
}
public boolean isServerBlacklisted(Server server) {
try {
Connection connection = ds.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT Violations FROM ServerBlacklist WHERE Server = ?");
statement.setInt(1, server.getId());
QUERIES++;
ResultSet set = statement.executeQuery();
int violations = -1;
if (set.next()) {
violations = set.getInt("Violations");
}
set.close();
safeClose(connection);
return violations >= 0;
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}
/**
* Close a connection
*
* @param connection
*/
private void safeClose(Connection connection) {
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
/**
* Resolve a graph from a ResultSet. Does not close the result set.
*
* @param set
* @return
* @throws SQLException
*/
private Graph resolveGraph(Plugin plugin, ResultSet set) throws SQLException {
Graph graph = new Graph(mcstats, plugin);
graph.setId(set.getInt("ID"));
graph.setType(set.getInt("Type"));
graph.setPosition(set.getInt("Position"));
graph.setActive(set.getInt("Active"));
graph.setName(set.getString("Name"));
graph.setDisplayName(set.getString("DisplayName"));
graph.setScale(set.getString("Scale"));
return graph;
}
/**
* Resolve a column from a REsultSet. Does not close the result set.
*
* @param plugin
* @param graph
* @param set
* @return
* @throws SQLException
*/
private Column resolveColumn(Plugin plugin, Graph graph, ResultSet set) throws SQLException {
Column column = new Column(mcstats, graph, plugin);
column.setId(set.getInt("ID"));
column.setName(set.getString("Name"));
return column;
}
/**
* Resolve a server from a ResultSet. Does not close the result set.
*
* @param set
* @return
* @throws SQLException
*/
private Server resolveServer(ResultSet set) throws SQLException {
Server server = new Server(this.mcstats);
server.setId(set.getInt("ID"));
server.setGUID(set.getString("GUID"));
server.setPlayers(set.getInt("Players"));
server.setCountry(set.getString("Country"));
server.setServerVersion(set.getString("ServerVersion"));
server.setCreated(set.getInt("Created"));
server.setServerSoftware(set.getString("ServerSoftware"));
server.setMinecraftVersion(set.getString("MinecraftVersion"));
server.setOSName(set.getString("osname"));
server.setOSArch(set.getString("osarch"));
server.setOSVersion(set.getString("osversion"));
server.setCores(set.getInt("cores"));
server.setOnlineMode(set.getInt("online_mode"));
server.setJavaName(set.getString("java_name"));
server.setJavaVersion(set.getString("java_version"));
server.setModified(false);
return server;
}
/**
* Resolve a plugin version from a ResultSet. Does not close the result set.
*
* @param set
* @return
* @throws SQLException
*/
private PluginVersion resolvePluginVersion(Plugin plugin, ResultSet set) throws SQLException {
PluginVersion version = new PluginVersion(mcstats, plugin);
version.setId(set.getInt("ID"));
version.setVersion(set.getString("Version"));
version.setCreated(set.getInt("Created"));
return version;
}
/**
* Resolve a plugin from a ResultSet. Does not close the result set.
*
* @param set
* @return
*/
private Plugin resolvePlugin(ResultSet set) throws SQLException {
Plugin plugin = new Plugin(mcstats);
plugin.setId(set.getInt("ID"));
plugin.setParent(set.getInt("Parent"));
plugin.setName(set.getString("Name"));
plugin.setAuthors(set.getString("Author"));
plugin.setHidden(set.getInt("Hidden"));
plugin.setGlobalHits(set.getInt("GlobalHits"));
plugin.setRank(set.getInt("Rank"));
plugin.setLastRank(set.getInt("LastRank"));
plugin.setLastRankChange(set.getInt("LastRankChange"));
plugin.setCreated(set.getInt("Created"));
plugin.setLastUpdated(set.getInt("LastUpdated"));
plugin.setServerCount30(set.getInt("ServerCount30"));
plugin.setModified(false);
return plugin;
}
}
| [
"[email protected]"
]
| |
d1cb6f109b5629e512c4c31bcc1c30ce549277cc | 4fe2c3fb6be7d49fb2c21b9d4b5b0fc286b25035 | /MyCat2/app/src/main/java/com/example/mycat/adopteCats_inside.java | 2cff8e32aaf5f693abfe0da92aaf49c418c8eb3e | []
| no_license | AsmaaAlazmi/MyCat | 405c46dd6bf7e1a116ac8d74d98ed5a903e38496 | c9b3b70141c69b1f88fb7b22511e4177d0025aeb | refs/heads/master | 2022-11-17T04:16:48.621866 | 2020-07-18T23:15:24 | 2020-07-18T23:15:24 | 280,754,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,315 | java | package com.example.mycat;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.Manifest;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.mikepenz.materialdrawer.AccountHeader;
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.ProfileDrawerItem;
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import de.hdodenhof.circleimageview.CircleImageView;
public class adopteCats_inside extends AppCompatActivity {
private TextView done1_inside2;
private TextView done2_inside2;
private TextView reason_inside2;
private TextView rules_inside2;
private TextView health_inside2;
private TextView phone_inside2;
private TextView name_inside2;
//phone call
private static final int REQUEST_CALL = 1;
//////////////////////////////////////////////////////////////////
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_adopte_cats_inside);
////////////////toolBar////////////////////
Toolbar tool = findViewById (R.id.toolbar2);
AccountHeader hr = new AccountHeaderBuilder ()
.withActivity (this)
.withHeaderBackground (R.color.weak)
.addProfiles (new ProfileDrawerItem ().withName ("MyCat").withEmail ("your Gateway to a Purr-fect frienship").withIcon (R.drawable.logo_final))
.build ();
PrimaryDrawerItem item1 = new PrimaryDrawerItem ().withIdentifier(1).withName ("الصفحة الرئيسية ").withIcon (R.drawable.home);
PrimaryDrawerItem item2 = new PrimaryDrawerItem ().withIdentifier (2).withName ("اضافة قط للتبني").withIcon (R.drawable.add);
PrimaryDrawerItem item3 = new PrimaryDrawerItem ().withIdentifier (3).withName ("اضافة قط مفقود").withIcon (R.drawable.add);
SecondaryDrawerItem item4 = new SecondaryDrawerItem ().withIdentifier (4).withName ("معلومات الحساب").withIcon (R.drawable.account);
new DrawerBuilder ().withActivity (this)
.withToolbar (tool)
.withAccountHeader (hr)
.addDrawerItems (item1)
.addDrawerItems (new DividerDrawerItem ())
.addDrawerItems (item2)
.addDrawerItems (item3)
.addDrawerItems (new DividerDrawerItem ())
.addDrawerItems (item4)
.withOnDrawerItemClickListener (new Drawer.OnDrawerItemClickListener () {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
if(drawerItem.getIdentifier ()==1){
Intent i = new Intent (adopteCats_inside.this,selection_A.class);
startActivity (i);
}
if(drawerItem.getIdentifier ()==2){
Intent i = new Intent (adopteCats_inside.this,adopte_add3.class);
startActivity (i);
}
if(drawerItem.getIdentifier ()==3){
Intent i = new Intent (adopteCats_inside.this,add_lostCats.class);
startActivity (i);
}
if(drawerItem.getIdentifier ()==4) {
Intent i = new Intent (adopteCats_inside.this, profile.class);
startActivity (i);
}
return false;
}
})
.build ();
/////////////////////////////////////////////
done1_inside2 = findViewById (R.id.resultsDone1_inside2);
done2_inside2 = findViewById (R.id.resultsDone2_inside2);
phone_inside2 = findViewById (R.id.phone_inside2);
rules_inside2 = findViewById (R.id.rules_inside2);
reason_inside2 = findViewById (R.id.reason_inside2);
health_inside2 = findViewById (R.id.health_inside2);
name_inside2 = findViewById (R.id.name_inside2);
CircleImageView image_inside2 = findViewById (R.id.image_inside2);
Bundle b2 = getIntent().getExtras();
Cats2 p2 = (Cats2) b2.getSerializable ("Cats2");
done1_inside2.setText (p2.getCheck1 ()+"");
done2_inside2.setText (p2.getCheck2 ()+"");
health_inside2.setText (p2.getHealth ()+"");
rules_inside2.setText (p2.getRules ()+"");
reason_inside2.setText (p2.getReason ()+"");
phone_inside2.setText (p2.getNumber2 ()+"");
name_inside2.setText (p2.getName2 ()+"");
image_inside2.setImageResource (p2.getImage2 ());
////////////////////////////// phone call //////////////////////////////////////////////////////
ImageView imageCall2 = findViewById(R.id.call_btn2);
imageCall2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
makePhoneCall();
}
});
}
private void makePhoneCall() {
String number = phone_inside2.getText().toString();
if (number.trim().length() > 0) {
if (ContextCompat.checkSelfPermission(adopteCats_inside.this,
Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(adopteCats_inside.this,
new String[]{Manifest.permission.CALL_PHONE}, REQUEST_CALL);
} else {
String dial = "tel:" + number;
startActivity(new Intent(Intent.ACTION_CALL, Uri.parse(dial)));
}
} else {
Toast.makeText(adopteCats_inside.this, "Enter Phone Number", Toast.LENGTH_SHORT).show();
}
//////////////////////////////////////////////////////////////////////////////////////////
}
///////////////// phone call 2 //////////////
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == REQUEST_CALL) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
makePhoneCall();
} else {
Toast.makeText(this, "Permission DENIED", Toast.LENGTH_SHORT).show();
}
}
}
///////////////////////////////////////////////////////
} | [
"[email protected]"
]
| |
3c0e071cbc5acf061c376f6e20b14d7de7e78328 | 35a6c254cbf8e554990f6af9340b4bf944fab8b2 | /src/main/java/cn/jeeweb/modules/gencode/service/IEntityInfoService.java | eaf824de4dbd0225a6853b115c499a842d3ca1bb | []
| no_license | ls909074489/lsweb | 789a7fdbbd36b1d9990f2c74ae39d54e2dcdb003 | 4645542c089943bd1617696c1756dda3b03abae7 | refs/heads/master | 2021-09-16T21:02:04.977185 | 2018-06-25T03:58:02 | 2018-06-25T03:58:02 | 115,416,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package cn.jeeweb.modules.gencode.service;
import java.util.List;
import cn.jeeweb.core.common.service.ICommonService;
import cn.jeeweb.core.model.AjaxJson;
import cn.jeeweb.modules.gencode.entity.ColInfo;
import cn.jeeweb.modules.gencode.entity.EntityInfo;
public interface IEntityInfoService extends ICommonService<EntityInfo> {
public AjaxJson createCode(EntityInfo info, List<ColInfo> subList);
}
| [
"[email protected]"
]
| |
d1a2b371cd532cde113b063f2b4ebc7834b9a4a8 | de7fa00078bd8f64a03f61d15bc89a8063a4477f | /outbound/src/main/java/com/sun/mdm/index/webservice/ExecuteCustomLogic.java | cd37e1e424d647a9be73d45aa0bcb59235c61a74 | []
| no_license | ameleito/Assignment_Lab | 1bf5bc9a02a668b652ff49e6b01920e5c9a19043 | d75d12a11985a9d0458d2415de81f4cfce28a000 | refs/heads/master | 2020-05-24T22:39:08.252830 | 2019-05-24T16:26:19 | 2019-05-24T16:26:19 | 187,499,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,176 | java |
package com.sun.mdm.index.webservice;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for executeCustomLogic complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="executeCustomLogic">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="callerInfo" type="{http://webservice.index.mdm.sun.com/}callerInfo" minOccurs="0"/>
* <element name="script" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="parameters" type="{http://webservice.index.mdm.sun.com/}customLogicParameter" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "executeCustomLogic", propOrder = {
"callerInfo",
"script",
"parameters"
})
public class ExecuteCustomLogic {
protected CallerInfo callerInfo;
protected String script;
protected List<CustomLogicParameter> parameters;
/**
* Gets the value of the callerInfo property.
*
* @return
* possible object is
* {@link CallerInfo }
*
*/
public CallerInfo getCallerInfo() {
return callerInfo;
}
/**
* Sets the value of the callerInfo property.
*
* @param value
* allowed object is
* {@link CallerInfo }
*
*/
public void setCallerInfo(CallerInfo value) {
this.callerInfo = value;
}
/**
* Gets the value of the script property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getScript() {
return script;
}
/**
* Sets the value of the script property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setScript(String value) {
this.script = value;
}
/**
* Gets the value of the parameters property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the parameters property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getParameters().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link CustomLogicParameter }
*
*
*/
public List<CustomLogicParameter> getParameters() {
if (parameters == null) {
parameters = new ArrayList<CustomLogicParameter>();
}
return this.parameters;
}
}
| [
"[email protected]"
]
| |
3fa8a51691b7feb6271c391d469148e73469cffa | b3a694913d943bdb565fbf828d6ab8a08dd7dd12 | /sources/com/google/crypto/tink/proto/EllipticCurveType.java | aa9c710ed90e32f5d21f619134d86edccbd00847 | []
| no_license | v1ckxy/radar-covid | feea41283bde8a0b37fbc9132c9fa5df40d76cc4 | 8acb96f8ccd979f03db3c6dbfdf162d66ad6ac5a | refs/heads/master | 2022-12-06T11:29:19.567919 | 2020-08-29T08:00:19 | 2020-08-29T08:00:19 | 294,198,796 | 1 | 0 | null | 2020-09-09T18:39:43 | 2020-09-09T18:39:43 | null | UTF-8 | Java | false | false | 2,392 | java | package com.google.crypto.tink.proto;
import p213q.p217b.p301c.p302a.p311j0.p312a.C3594b0.C3597c;
import p213q.p217b.p301c.p302a.p311j0.p312a.C3594b0.C3598d;
import p213q.p217b.p301c.p302a.p311j0.p312a.C3594b0.C3599e;
public enum EllipticCurveType implements C3597c {
UNKNOWN_CURVE(0),
NIST_P256(2),
NIST_P384(3),
NIST_P521(4),
CURVE25519(5),
UNRECOGNIZED(-1);
public static final int CURVE25519_VALUE = 5;
public static final int NIST_P256_VALUE = 2;
public static final int NIST_P384_VALUE = 3;
public static final int NIST_P521_VALUE = 4;
public static final int UNKNOWN_CURVE_VALUE = 0;
public static final C3598d<EllipticCurveType> internalValueMap = null;
public final int value;
public static final class EllipticCurveTypeVerifier implements C3599e {
public static final C3599e INSTANCE = null;
static {
INSTANCE = new EllipticCurveTypeVerifier();
}
public boolean isInRange(int i) {
return EllipticCurveType.forNumber(i) != null;
}
}
/* access modifiers changed from: public */
static {
internalValueMap = new C3598d<EllipticCurveType>() {
public EllipticCurveType findValueByNumber(int i) {
return EllipticCurveType.forNumber(i);
}
};
}
/* access modifiers changed from: public */
EllipticCurveType(int i) {
this.value = i;
}
public static EllipticCurveType forNumber(int i) {
if (i == 0) {
return UNKNOWN_CURVE;
}
if (i == 2) {
return NIST_P256;
}
if (i == 3) {
return NIST_P384;
}
if (i == 4) {
return NIST_P521;
}
if (i != 5) {
return null;
}
return CURVE25519;
}
public static C3598d<EllipticCurveType> internalGetValueMap() {
return internalValueMap;
}
public static C3599e internalGetVerifier() {
return EllipticCurveTypeVerifier.INSTANCE;
}
@Deprecated
public static EllipticCurveType valueOf(int i) {
return forNumber(i);
}
public final int getNumber() {
if (this != UNRECOGNIZED) {
return this.value;
}
throw new IllegalArgumentException("Can't get the number of an unknown enum value.");
}
}
| [
"[email protected]"
]
| |
359e3c6c48400db33c2de5780ce117dff37497e4 | 3158e591148f12432b27231255e4879fc6527aba | /src/com/google/zxing/client/android/result/SMSResultHandler.java | 1b4790773b98045b8fcc2192d34c649762fb206e | []
| no_license | OpenJunction/Playlist | 8ce626f970c4e6faddcd71cac421b18a1534dd13 | a74a036265969bf489cb40cb5a7c136b64c88437 | refs/heads/master | 2020-04-15T22:50:07.000841 | 2011-08-06T17:14:08 | 2011-08-06T17:14:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,620 | java | /*
* Copyright (C) 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.client.android.result;
import edu.stanford.junction.sample.partyware.playlist.R;
import com.google.zxing.client.result.ParsedResult;
import com.google.zxing.client.result.SMSParsedResult;
import android.app.Activity;
import android.telephony.PhoneNumberUtils;
/**
* Handles SMS addresses, offering a choice of composing a new SMS or MMS message.
*
* @author [email protected] (Daniel Switkin)
*/
public final class SMSResultHandler extends ResultHandler {
private static final int[] buttons = {
R.string.button_sms,
R.string.button_mms
};
public SMSResultHandler(Activity activity, ParsedResult result) {
super(activity, result);
}
@Override
public int getButtonCount() {
return buttons.length;
}
@Override
public int getButtonText(int index) {
return buttons[index];
}
@Override
public void handleButtonPress(int index) {
SMSParsedResult smsResult = (SMSParsedResult) getResult();
switch (index) {
case 0:
// Don't know of a way yet to express a SENDTO intent with multiple recipients
sendSMS(smsResult.getNumbers()[0], smsResult.getBody());
break;
case 1:
sendMMS(smsResult.getNumbers()[0], smsResult.getSubject(), smsResult.getBody());
break;
}
}
@Override
public CharSequence getDisplayContents() {
SMSParsedResult smsResult = (SMSParsedResult) getResult();
StringBuffer contents = new StringBuffer();
String[] rawNumbers = smsResult.getNumbers();
String[] formattedNumbers = new String[rawNumbers.length];
for (int i = 0; i < rawNumbers.length; i++) {
formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
}
ParsedResult.maybeAppend(formattedNumbers, contents);
ParsedResult.maybeAppend(smsResult.getSubject(), contents);
ParsedResult.maybeAppend(smsResult.getBody(), contents);
return contents.toString();
}
@Override
public int getDisplayTitle() {
return R.string.result_sms;
}
}
| [
"bjdodson@handdog.(none)"
]
| bjdodson@handdog.(none) |
718772b0c785f223230d9a8246169867c0415ec3 | f25ad2218bf2532c4cca8c8a5d543684be239689 | /src/javafxapplication1/ViewEController.java | 9df7a7cbdc7f04500ee925f2215f88bcc4b171bf | []
| no_license | Jahanzaib523/Restaurant-Management-in-GUI | 55fa4a44ea8307dce423fb3559996fb6b1cfdabf | 2664028fea4738217ad5911fdc034f303b8bd109 | refs/heads/master | 2022-11-24T00:09:55.590484 | 2020-07-25T12:13:27 | 2020-07-25T12:13:27 | 282,436,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,581 | 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 javafxapplication1;
//import order
import java.net.URL;
import java.sql.*;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
//import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane;
public class ViewEController implements Initializable {
@FXML
private Button EattendanceButton;
@FXML
private Button EvInventoryButton;
@FXML
private Button EhOrderButton;
@FXML
private TabPane EinventoryTPane;
@FXML
private Tab EinventoryTab;
@FXML
private TabPane EorderTPane;
@FXML
private Tab EorderTab;
//private AnchorPane EorderAnchorPane;
@FXML
private TextField EorderTextfeild;
@FXML
private TableView<OrderHandle> EordersTabelview;
@FXML
private TableColumn<OrderHandle, String> EoidTablecol;
@FXML
private TableColumn<OrderHandle, Timestamp> EotTablecol;
@FXML
private TabPane EAttendanceTPane;
// @FXML
// private Tab EvAttendanceTab;
@FXML
private Tab EmAttendanceTab;
@FXML
private TextArea EiconsoleTextarea;
@FXML
private AnchorPane EinventoryAnchor;
// @FXML
// private AnchorPane EvAttendanceAnchor;
@FXML
private AnchorPane EorderAnchor;
@FXML
private AnchorPane EmAttendanceAnchor;
@FXML
private TextField EentertTextfeild;
@FXML
private TextField EexittTextfeild;
@FXML
private Button EentertButton;
@FXML
private Button EexittButton;
@FXML
private Tab EvAttendanceTab;
@FXML
private AnchorPane EvAttendanceAnchor;
@FXML
private TableView<?> EvAttendanceTable;
@FXML
private TableColumn<?, ?> EmonthaCol;
@FXML
private TableColumn<?, ?> EentertaColumn;
@FXML
private TableColumn<?, ?> EexittaColumn;
/**
* Initializes the controller class.
*/
@FXML
private void handleButtonAction(Event event){
if (event.getSource() == EattendanceButton){
hidetabAnchorAll();
EAttendanceTPane.toFront();
EAttendanceTPane.getSelectionModel().select(EmAttendanceTab);
EmAttendanceAnchor.setVisible(true);
}
else
if (event.getSource() == EhOrderButton){
hidetabAnchorAll();
EorderTPane.toFront();
EorderAnchor.setVisible(true);
}
else
if (event.getSource() == EvInventoryButton){
hidetabAnchorAll();
EinventoryTPane.toFront();
}
else
if (event.getSource() == EvAttendanceTab){
EvAttendanceAnchor.setVisible(true);
}
}
// @FXML
// private void handleButtonAction(Event event) {
// }
@Override
public void initialize(URL url, ResourceBundle rb) {
try {
// TODO
hidetabAnchorAll();
//Order table
EoidTablecol.setCellValueFactory(new PropertyValueFactory<>("orderid"));
// EotTablecol.setCellValueFactory(new PropertyValueFactory<>("ordertime"));
EordersTabelview.setItems(getOrders());
} catch (SQLException ex) {
Logger.getLogger(ViewEController.class.getName()).log(Level.SEVERE, null, ex);
}
// try {
// // order end here
//// getAttendance("sdg");
// //Attendance table
// } catch (SQLException ex) {
// Logger.getLogger(ViewEController.class.getName()).log(Level.SEVERE, null, ex);
// }
}
// Table getters
public ObservableList<OrderHandle> getOrders() throws SQLException{
ObservableList<OrderHandle> orders = FXCollections.observableArrayList();
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@Zack-v049tx:1521:faiz","restaurant","re");
Statement stmtcon=con.createStatement();
ResultSet rs=stmtcon.executeQuery("Select order_id,order_time from orders where status = 'processing'");
while(rs.next()){
orders.add(new OrderHandle(rs.getString(1) , rs.getTimestamp(2)));
}
} catch (ClassNotFoundException ex) {
Logger.getLogger(ViewEController.class.getName()).log(Level.SEVERE, null, ex);
}
return orders;
}
public ObservableList<AttendanceHandle> getAttendance(String e_id) throws SQLException{
ObservableList<AttendanceHandle> attendance = FXCollections.observableArrayList();
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@Zack-v049tx:1521:faiz","restaurant","re");
Statement stmtcon=con.createStatement();
String query;
query = "Select to_char(entry_time,'Month'),to_char(entry_time,'HH24:MI:SS'),to_char(exit_time,'HH24:MI:SS') from attendance where employee_id="+e_id;
ResultSet rs=stmtcon.executeQuery("Select month,entry,exit from attendanceemp where employee_id=15");
while(rs.next()){
attendance.add(new AttendanceHandle(rs.getString(1) , rs.getTimestamp(2),rs.getTimestamp(3)));
System.out.println(rs.getString(1));
}
} catch (ClassNotFoundException ex) {
Logger.getLogger(ViewEController.class.getName()).log(Level.SEVERE, null, ex);
}
return attendance;
}
// Table getters enders
//
private void hidetabAnchorAll(){
EinventoryAnchor.setVisible(false);
EmAttendanceAnchor.setVisible(false);
EorderAnchor.setVisible(false);
EvAttendanceAnchor.setVisible(false);
}
}
| [
"[email protected]"
]
| |
d8b32642261b406605f9fbfcf91cec4233b12f27 | 8e547e875f44db8adf4a07aedbb7a0f5e7eb4a16 | /src/test/java/com/gzeliga/playground/algorithms/amazon/TestOtherAmazonStuff.java | 7111226084344a52db20399418f9aa1e160fbae5 | []
| no_license | singletrips/algorithms-and-more | 94ed295c54e266a6cb66979d950b65f850c8f566 | 92d510e7799323466fdbd3bc8cb9ee4b11750ac1 | refs/heads/master | 2020-07-04T20:00:12.267489 | 2016-07-29T10:42:48 | 2016-07-29T10:42:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package com.gzeliga.playground.algorithms.amazon;
import org.junit.Test;
import java.io.IOException;
import static com.gzeliga.playground.algorithms.amazon.OtherAmazonStuff.tokenizable;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class TestOtherAmazonStuff {
@Test
public void shouldDetectTokenizableString() throws IOException {
assertTrue(tokenizable("bedbathandbreakfast", asList("bed", "bath", "breakfast","and")));
}
@Test
public void shouldDetectNonTokenizableString() throws IOException {
assertFalse(tokenizable("sandwichasdf", asList("bed", "bath", "breakfast", "and", "sandwich")));
}
} | [
"[email protected]"
]
| |
da40fc0721e593951bf046b556188850a7a150cf | 971fd5106123c73e53e3e264ead2340dfa7ebaa5 | /src/accepted/Q201_Q300/Q231_Q240/Q237.java | f732bceefba0feb8112e5c5a81784476b2f43f89 | []
| no_license | ttyrueiwoqp/LeetCode | 038ab33087e7974461caac9a514b5e24048046f5 | b03d1b914adf1af9b38c7668415726095cf6e343 | refs/heads/master | 2021-04-19T00:14:11.003754 | 2018-03-01T05:31:42 | 2018-03-01T05:31:42 | 28,955,063 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package accepted.Q201_Q300.Q231_Q240;
import util.ListNode;
/**
* Created by LU-PC on 10/9/2015.
* <p>
* Write a function to delete a node (except the tail) in a singly linked list,
* given only access to that node.
* <p>
* Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3,
* the linked list should become 1 -> 2 -> 4 after calling your function.
*/
public class Q237 {
public void deleteNode(ListNode node) {
node.val = node.next.val;
node.next = node.next.next;
}
}
| [
"[email protected]"
]
| |
caf47616f891c43b98efbe8298a741187c634780 | 0054aeff9376ceffae886984e22262473e21d701 | /src/main/java/MinimumNumberOfArrowsToBurstBalloons.java | 57cb6cb1872738cc722261c157f1e51c8349907c | []
| no_license | rohandalvi/algorithms | 0ded8f42d2761ab966db1b6e9e4552f8b75251ce | 39be16a1fa54ab6724c88ca5d8c40b49ce6f7c22 | refs/heads/master | 2021-03-19T15:17:29.857709 | 2017-05-10T03:52:49 | 2017-05-10T03:52:49 | 27,740,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,158 | java | package algorithms;
import java.util.Comparator;
import java.util.PriorityQueue;
/**
* https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/#/description
*
* @author rohan.dalvi
*
*/
public class MinimumNumberOfArrowsToBurstBalloons {
public int minArrowsRequired(int[][] points) {
if (points == null || points.length == 0)
return 0;
PriorityQueue<Interval> pq = new PriorityQueue<>(new Comparator<Interval>() {
public int compare(Interval a, Interval b) {
if (a.start == b.start)
return a.end - b.end;
else
return a.start - b.start;
}
});
for (int i = 0; i < points.length; i++) {
pq.add(new Interval(points[i][0], points[i][1]));
}
int minArrows = 1;
Interval temp = pq.poll();
int end = temp.end;
while (!pq.isEmpty()) {
Interval curr = pq.poll();
if (curr.start <= end) {
// if they are merging
end = Math.min(end, curr.end);
} else {
// if they aren't merging, you need another arrow here buddy
minArrows++;
end = curr.end;
}
}
return minArrows;
}
}
| [
"[email protected]"
]
| |
a7088a1733d4653d927f4a79334984bb6df11f20 | 3da8608ad11cfc25c57d87cd0bcf4f5dd0147283 | /src/main/creation/singleton/Singleton.java | 434f74eb41b8a48b562f1af37bfde45132a01ebd | []
| no_license | GreatlightSaber/DESIGN_PATTERN | 3b4eeacbae1a8b1b69669f28219e00922416d67e | 46ea25f09a22c331e08b81aab5578993ce043b3f | refs/heads/master | 2021-01-03T02:52:32.435838 | 2020-11-01T16:04:20 | 2020-11-01T16:04:20 | 239,890,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,048 | java | package main.creation.singleton;
/*
* 싱글톤 패턴 (singleton pattern)
* 자원이 단지 하나만 필요한 개체들이 있다.
* 그 객체는 다양한 클래스와 쓰레드 컨택스트 내에서 공유되어 사용 될 수 있어야 한다.
* 이러한 경우 싱글톤 패턴을 고려한다
*
* * 장점
* 객체가 단일하게 생성되므로 메모리가 절약된다.
* new 를 사용하는 과정을 줄이므로 라인이 몇줄 이나마 절약된다.
* 메모리를 공유하는 좋은 방법
*
* * 단점
* 일단 메모리를 잡아먹게 되어잇고, 한번 사용하면 언제 해제될지 모른다.
* oop의 컨셈셉과 맞지 않는 면이 있다. oop에서는 모든 객체를 생명주기가 존재하는것으로 인식하는 경향이 있다
*
*
* * JDK안의 싱글톤들
* java.lang.Runtime#getRuntime()
* : jvm 외부의 명령행을 수행하고 싶을 때, 메모리등을 확인하고 싶을 때
*
* java.awt.Dsktop#getDesktop()
* : 스크린 사이즈등을 알고 싶을때
*
* java.lang.System#getSecurity Message()
* : jvm의 securityMnanger정보를 가지고 오고 싶을때
*
*
* */
public class Singleton {
// 실제 싱글톤의 구현은 생각보다 까다롭다 -> 싱글톤을 사용하는 여러 쓰레들간의 race condition 이 발생하기 때문
static private Singleton singleton = null;
static public Singleton getInstance() {
/* if(singleton == null)을 거쳐 singleton = new Singleton(); 이 완료된 시점(singleton에 할당이 되기 전)에 다른 쓰레드가 if(singleton == null)안으로 또 들어와
* 두개 이상의 Singleton 객체가 생성되고, 원하는 의도대로 데이터가 공유되지 않을 수 있다.
*/
if(singleton == null) {
singleton = new Singleton();
}
return singleton;
}
public void putInfo(String info) {
// ... 생략
}
}
//void test() {
// Singleton.getInstance().putInfo("info1");
//}
| [
"[email protected]"
]
| |
7f89e10b17a07110c8ecaa6fe70b562fe529b405 | 0129daa3c4062a7764f36e984571c09a9824a6db | /app/src/main/java/com/ljmu/educationalphishingtool/Pretest.java | 9c05f228608bbcbd18788909446de419c498daed | []
| no_license | JayC1999/Educational-Phishing-Tool | 5d704043d703887e8efa15a4f7f2cb41e9115de7 | d1067de819b5d97d430e9b42d6588e7b7f3f4a58 | refs/heads/master | 2023-04-11T09:02:53.865183 | 2021-04-22T18:27:10 | 2021-04-22T18:27:10 | 360,638,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,234 | java | package com.ljmu.educationalphishingtool;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.github.chrisbanes.photoview.PhotoView;
public class Pretest extends AppCompatActivity {
private TextView preScoreView, preQuestion;
private PhotoView preImageView;
private Button preTrueButton, preFalseButton;
private boolean preAnswer;
private int preScore = 0;
private int preQuestionNumber = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pretest);
preScoreView = (TextView)findViewById(R.id.PretestPoints);
preImageView = (PhotoView)findViewById(R.id.PretestImageView);
preQuestion = (TextView)findViewById(R.id.PretestQuestion);
preTrueButton = (Button)findViewById(R.id.PretestTrueButton);
preFalseButton = (Button)findViewById(R.id.PretestFalseButton);
updateQuestion();
preTrueButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (preAnswer == true) {
preScore++;
updateScore(preScore);
if (preQuestionNumber == QuizContents.preQuestions.length) {
Intent i = new Intent(Pretest.this, PretestResults.class);
Bundle bundle = new Bundle();
bundle.putInt("preFinalScore", preScore);
i.putExtras(bundle);
Pretest.this.finish();
startActivity(i);
}else {
updateQuestion();
}
}
else {
if (preQuestionNumber == QuizContents.preQuestions.length) {
Intent i = new Intent(Pretest.this, PretestResults.class);
Bundle bundle = new Bundle();
bundle.putInt("preFinalScore", preScore);
i.putExtras(bundle);
Pretest.this.finish();
startActivity(i);
}else {
updateQuestion();
}
}
}
});
preFalseButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (preAnswer == false) {
preScore++;
updateScore(preScore);
if (preQuestionNumber == QuizContents.preQuestions.length) {
Intent i = new Intent(Pretest.this, PretestResults.class);
Bundle bundle = new Bundle();
bundle.putInt("preFinalScore", preScore);
i.putExtras(bundle);
Pretest.this.finish();
startActivity(i);
}else {
updateQuestion();
}
}
else {
if (preQuestionNumber == QuizContents.preQuestions.length) {
Intent i = new Intent(Pretest.this, PretestResults.class);
Bundle bundle = new Bundle();
bundle.putInt("preFinalScore", preScore);
i.putExtras(bundle);
Pretest.this.finish();
startActivity(i);
}else {
updateQuestion();
}
}
}
});
}
private void updateQuestion() {
preImageView.setImageResource(QuizContents.preImages[preQuestionNumber]);
preQuestion.setText(QuizContents.preQuestions[preQuestionNumber]);
preAnswer = QuizContents.preAnswers[preQuestionNumber];
preQuestionNumber++;
}
public void updateScore(int point) {
preScoreView.setText("" + preScore);
}
}
| [
"[email protected]"
]
| |
177ce2972b33b68af313a6c57781f5e6d86e8507 | 1fbc7b819ded0824d28f4e24465b023e30c1f421 | /core/src/main/java/org/mini2Dx/core/font/MonospaceGameFontCache.java | c6d1bd45f16c884b267a99bc95d37f3c3a348da7 | [
"BSD-3-Clause",
"Apache-2.0"
]
| permissive | mini2Dx/mini2Dx | 959bfce4690f54cce68c9e8bb68328d2d48eaeaa | 93a5c6cb59ff186926ca7005604aad5e707a7656 | refs/heads/master | 2023-09-03T14:37:58.044965 | 2023-08-19T18:47:09 | 2023-08-19T18:47:09 | 8,236,056 | 543 | 76 | Apache-2.0 | 2022-12-05T21:53:34 | 2013-02-16T13:27:08 | Java | UTF-8 | Java | false | false | 3,191 | java | /*******************************************************************************
* Copyright 2019 See AUTHORS file
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package org.mini2Dx.core.font;
import org.mini2Dx.core.Graphics;
import org.mini2Dx.core.Mdx;
import org.mini2Dx.core.graphics.Color;
import org.mini2Dx.core.util.Align;
import org.mini2Dx.gdx.utils.Array;
public class MonospaceGameFontCache implements GameFontCache {
private final Array<MonospaceGlyph> glyphs = new Array<MonospaceGlyph>();
private final MonospaceGameFont monospaceFont;
private final MonospaceFontGlyphLayout glyphLayout;
private final Color color = Mdx.graphics.newColor(0f, 0f, 0f, 1f);
private float x, y;
public MonospaceGameFontCache(MonospaceGameFont monospaceFont) {
super();
this.monospaceFont = monospaceFont;
glyphLayout = new MonospaceFontGlyphLayout(monospaceFont);
}
@Override
public void addText(CharSequence str, float x, float y) {
glyphLayout.setText(str, color, -1f, Align.LEFT, true);
glyphLayout.transferGlyphsTo(glyphs, x, y);
}
@Override
public void addText(CharSequence str, float x, float y, float targetWidth, int halign, boolean wrap) {
glyphLayout.setText(str, color, targetWidth, halign, wrap);
glyphLayout.transferGlyphsTo(glyphs, x, y);
}
@Override
public void clear() {
while(glyphs.size > 0) {
final MonospaceGlyph glyph = glyphs.removeIndex(0);
glyph.release();
}
}
@Override
public void draw(Graphics g) {
monospaceFont.draw(g, glyphs, x, y, null);
}
@Override
public Color getColor() {
return color;
}
@Override
public void setColor(Color color) {
this.color.set(color);
}
@Override
public void setAllColors(Color color) {
for(int i = 0; i < glyphs.size; i++) {
glyphs.get(i).color.set(color);
}
}
@Override
public void setAllAlphas(float alpha) {
for(int i = 0; i < glyphs.size; i++) {
glyphs.get(i).color.setA(alpha);
}
}
@Override
public void setText(CharSequence str, float x, float y) {
clear();
glyphLayout.setText(str, color, -1f, Align.LEFT, true);
glyphLayout.transferGlyphsTo(glyphs, x, y);
}
@Override
public void setText(CharSequence str, float x, float y, float targetWidth, int halign, boolean wrap) {
clear();
glyphLayout.setText(str, color, targetWidth, halign, wrap);
glyphLayout.transferGlyphsTo(glyphs, x, y);
}
@Override
public void translate(float x, float y) {
this.x += x;
this.y += y;
}
@Override
public void setPosition(float x, float y) {
this.x = x;
this.y = y;
}
@Override
public GameFont getFont() {
return monospaceFont;
}
} | [
"[email protected]"
]
| |
9abe4e3ba246c568f8a6c93fcb135ba9fc0ec611 | ba0e7aa48e707e160f2c6251569524477dde1681 | /src/br/trainee/aline/interfaces/Teste.java | 7bfbf4acb135d6587b4b65a9361fc412f1241766 | []
| no_license | alinedavanse/Interfaces | 125f02117c4cb1f58143fcdcad83bef6eef6be98 | 4cae3e5ae817c8dc64a15b1a19287c2eab3a75d8 | refs/heads/master | 2020-12-06T18:47:50.572306 | 2016-09-02T00:26:39 | 2016-09-02T00:26:39 | 67,176,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package br.trainee.aline.interfaces;
public class Teste {
public static void main(String[] args) {
AreaCalculavel a = new Retangulo(3, 2);
System.out.println(a.calculaArea());
AreaCalculavel b = new Quadrado(3);
System.out.println(b.calculaArea());
AreaCalculavel c = new Circulo(2, 3.1456);
System.out.println(c.calculaArea());
}
}
| [
"[email protected]"
]
| |
9883dd7010a1e39533da8b18a3f0bd686c3c39e9 | bc3a4e769337f33481785bcb7129a668fd475793 | /app/src/main/java/com/example/cnsa_6th_council/PetitionShow.java | 85ec22425a2f044f97a7f3cf70c42b243f8efaf5 | []
| no_license | Limsehwan/CNSA_6th_Council | 78aea79921a28599cfb4879c483ee08c85d398ed | b3e08015b073092a75f0199183c3d78b4ebc1094 | refs/heads/master | 2020-07-28T02:57:05.440517 | 2019-09-18T11:37:05 | 2019-09-18T11:37:05 | 209,286,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package com.example.cnsa_6th_council;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class PetitionShow extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.petition_show);
}
}
| [
"[email protected]"
]
| |
a6200374317cbe3a4eca656525cd1171582e81f5 | dd3175dc9c283bd2fc3620defa7a82fb54aa0325 | /dpd-integration-test/src/test/java/nl/ou/dpd/domain/matching/StrategyAbstractMatchingTest.java | 24fa055f58629e4b73ba0c40be8bf40b8349f803 | []
| no_license | cuidi34/DesignPatternDetector | 7e8dfd2f399f9138b7dc5162ff005e9576cde779 | cf61f9d3022c85fbd7075bd63fcfd37c637aa49a | refs/heads/master | 2020-06-14T01:16:40.204705 | 2017-09-18T21:08:59 | 2017-09-18T21:08:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,742 | java | package nl.ou.dpd.domain.matching;
import nl.ou.dpd.IntegrationTest;
import nl.ou.dpd.domain.DesignPattern;
import nl.ou.dpd.parsing.ParserFactory;
import nl.ou.dpd.parsing.PatternsParser;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.util.List;
import static org.junit.Assert.assertEquals;
/**
* Test the matching process for a Strategy pattern with an abstract class for the Strategy node.
*
* @author Martin de Boer
*/
@Category(IntegrationTest.class)
public class StrategyAbstractMatchingTest extends AbstractMatchingTest {
private static final String PATTERN_NAME = "Strategy";
private static final String MATCHING_SYSTEM_XMI = "/systems/MyStrategyAbstract.xmi";
private static final String MISMATCHING_SYSTEM_XMI = "/systems/MyBuilder.xmi";
private static final String NOT_ANALYSED_SYSTEM_XMI = "/systems/MyClassAdapter.xmi";
private static final String[] EXPECTED_NOTES = {
"The structure of the Strategy pattern is rather straightforward. " +
"Bear in mind the context and the semantics to decide if the Strategy pattern is genuine.",
"According the patttern, at least three different concrete strategies must be defined."
};
private DesignPattern designPattern;
@Before
public void initTests() {
final PatternsParser patternsParser = ParserFactory.createPatternParser();
final String patternsXmlFile = StrategyAbstractMatchingTest.class.getResource(TEMPLATES_XML).getFile();
designPattern = getDesignPatternByName(patternsParser.parse(patternsXmlFile), PATTERN_NAME);
}
@Test
public void testMatchingStrategyAbstract() {
assertMatchingPattern(MATCHING_SYSTEM_XMI, designPattern, EXPECTED_NOTES);
}
@Test
public void testMismatchingStrategyAbstract() {
assertMismatchingPattern(MISMATCHING_SYSTEM_XMI, designPattern);
}
@Test
public void testMismatchingStrategyAbstractWithoutAnalysingNodesAndRelations() {
assertMismatchingPatternWithoutAnalysingNodesAndRelations(NOT_ANALYSED_SYSTEM_XMI, designPattern);
}
protected void assertMatchingSolutions(PatternInspector.MatchingResult matchingResult) {
final List<Solution> solutions = matchingResult.getSolutions();
assertEquals(1, solutions.size());
assertMatchingNodes(solutions, "Taxi", "ConcreteStrategyA");
assertMatchingNodes(solutions, "Vehicle", "Strategy");
assertMatchingNodes(solutions, "CityBus", "ConcreteStrategyC");
assertMatchingNodes(solutions, "PersonalCar", "ConcreteStrategyB");
assertMatchingNodes(solutions, "TransportationToAirport", "Context");
}
}
| [
"[email protected]"
]
| |
2690ba0bbbe16132ed495b9d8300a8270b7646d2 | f0d8026a797d0974241780eb53311bfa55e918e1 | /tech_website/src/com/alipay/api/response/AlipayMobilePublicLabelQueryResponse.java | e6674540fb252781205d6afbd58261db0254f83c | []
| no_license | boberhu/1yuango | 19762c1dc556337ad74f64e4704bbb30050a7757 | 2b5c8e6a8c2c888e7b81fe793b7e4cd541b0a244 | refs/heads/master | 2020-04-17T11:18:27.293198 | 2016-08-29T14:14:12 | 2016-08-29T14:14:12 | 66,846,025 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package com.alipay.api.response;
import com.alipay.api.AlipayResponse;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import java.util.List;
public class AlipayMobilePublicLabelQueryResponse
extends AlipayResponse
{
private static final long serialVersionUID = 5763325959436892126L;
@ApiField("code")
private String code;
@ApiListField("labels")
@ApiField("string")
private List<String> labels;
@ApiField("msg")
private String msg;
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setLabels(List<String> labels)
{
this.labels = labels;
}
public List<String> getLabels()
{
return labels;
}
public void setMsg(String msg)
{
this.msg = msg;
}
public String getMsg()
{
return msg;
}
}
| [
"[email protected]"
]
| |
bca05b518710e1686c6990a2fa24663951345454 | 5b12fdfcfe0de39086993f43c12f12dc69b5120a | /profile-service/src/test/java/com/improveme/profileservice/ProfileServiceApplicationTests.java | 903b3e50ffdf240605e8b625c4c592d1ee5cea5b | []
| no_license | bayramfradj/improveMe | 7d34f9deda47e3832896a209cce50927e10d09e2 | d1e8301196ffcea31241082884ab8bfbe981e23e | refs/heads/main | 2023-06-19T07:02:56.379023 | 2021-07-16T22:02:37 | 2021-07-16T22:02:37 | 359,609,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 237 | java | package com.improveme.profileservice;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ProfileServiceApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
]
| |
bf31747927032458904dcea759ec3120c1c84da7 | 1d02c00d97dd15db5ed54b856696016f6be490d1 | /AutoManager/src/View/EditaAgenda.java | 0fe12e33933b923a98277b1000d56a4b0460f1d8 | []
| no_license | marciomanfre/ESOF | 8e22b029ad4b384ea939337347a59b043fd6c31b | 88eed961e35f842418460f9efb70a80e463ef7c0 | refs/heads/master | 2021-01-19T05:08:20.854714 | 2013-07-19T00:33:06 | 2013-07-19T00:33:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,813 | java |
package View;
public class EditaAgenda extends javax.swing.JFrame {
public EditaAgenda() {
this.setLocationRelativeTo(null);
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
jRadioButton5 = new javax.swing.JRadioButton();
jRadioButton4 = new javax.swing.JRadioButton();
jRadioButton6 = new javax.swing.JRadioButton();
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jTextField6 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jSeparator1 = new javax.swing.JSeparator();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Digite o ID do evento a ser editado:");
jLabel5.setText("ID:");
jLabel2.setText("Hora:");
jLabel3.setText("Local:");
jLabel8.setText("Assunto:");
jLabel7.setText("Nome aniversariante:");
jLabel9.setText("Nome:");
jLabel4.setText("Descrição:");
jButton2.setText("Salvar");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel6.setText("Importância:");
buttonGroup1.add(jRadioButton5);
jRadioButton5.setText("Moderado");
buttonGroup1.add(jRadioButton4);
jRadioButton4.setText("Urgente");
buttonGroup1.add(jRadioButton6);
jRadioButton6.setText("Não Urgente");
jButton1.setText("Cancela");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
jButton3.setText("Buscar");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(39, 39, 39)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton3)
.addGap(332, 332, 332))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 632, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(jLabel2))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField3)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 97, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addComponent(jLabel7)
.addComponent(jLabel9)
.addComponent(jLabel4)
.addComponent(jButton2)))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jRadioButton5)
.addComponent(jRadioButton4)
.addComponent(jRadioButton6))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1)
.addGap(145, 145, 145)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField6)
.addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE)
.addComponent(jTextField7)))))
.addGap(50, 50, 50))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jLabel7)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel8)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel9)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jRadioButton4)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jRadioButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jRadioButton6)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2)))
.addGroup(layout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Agenda agenda = new Agenda();
String[] args = null;
dispose();
agenda.main(args);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
Agenda agenda = new Agenda();
String[] args = null;
dispose();
agenda.main(args);
}//GEN-LAST:event_jButton1ActionPerformed
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
EditaAgenda ea = new EditaAgenda();
ea.setVisible(true);
ea.setLocationRelativeTo(null);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JRadioButton jRadioButton4;
private javax.swing.JRadioButton jRadioButton5;
private javax.swing.JRadioButton jRadioButton6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
f31e533cce9023dbedb8ca70a681919c751e01d1 | 8071b91a15205c8404e2f5862a5b63bf53543cc9 | /gameStore/src/Concrate/CustomerManager.java | 4466e814b734eb5d5ad4e42d7af72d51bc81d95b | []
| no_license | Marulov/GameStore | 65061042ec5c848766aefa5809edb9849971d6e3 | 079ef9b7194e59b0d9072c058b3de041654641ff | refs/heads/master | 2023-05-29T11:41:37.384911 | 2021-06-17T14:37:45 | 2021-06-17T14:37:45 | 377,852,829 | 11 | 0 | null | null | null | null | ISO-8859-9 | Java | false | false | 1,215 | java | package Concrate;
import Abstract.CustomerCheckService;
import Abstract.CustomerService;
import Entities.Gamer;
public class CustomerManager implements CustomerService {
private CustomerCheckService customerCheckService;
public CustomerManager(CustomerCheckService customerCheckService) {
super();
this.customerCheckService = customerCheckService;
}
@Override
public void add(Gamer gamer) {
if (this.customerCheckService.checkIfRealPerson(gamer)) {
System.out.println(gamer.getUserName() + " adlı kullanıcı sisteme üye oldu.");
} else {
System.out.println("Not a valid person");
}
}
@Override
public void delete(Gamer gamer) {
if (this.customerCheckService.checkIfRealPerson(gamer)) {
System.out.println(gamer.getUserName() + " adlı kullancının üyeliği iptal edildi.");
} else {
System.out.println("Not a valid person");
}
}
@Override
public void update(Gamer gamer) {
if (this.customerCheckService.checkIfRealPerson(gamer)) {
System.out.println(gamer.getUserName() + " adlı kullanıcının userName i değiştirildi.");
} else {
System.out.println("Not a valid person");
}
}
}
| [
"[email protected]"
]
| |
095058d7230583edbca24bb4654b6814c9141153 | 77665613583ce6ee9db81cca4c3d77cfc5354ec1 | /src/main/java/com/gen4j/fitness/FitnessCache.java | f06e1271d708dd8a738331b455a068d21f7ce715 | []
| no_license | RenanSFreitas/Gen4j | 425b1aa61665215781affd9932d59f798970e531 | 418e3fdc77f248fba018ecb791e0d5b280a8042e | refs/heads/master | 2021-01-15T10:26:29.118811 | 2016-06-13T01:48:44 | 2016-06-13T01:48:44 | 53,907,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 785 | java | package com.gen4j.fitness;
import com.gen4j.phenotype.Phenotype;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
public final class FitnessCache implements FitnessFunction {
private LoadingCache<Phenotype, Double> cache;
public FitnessCache(final FitnessFunction function) {
cache = CacheBuilder.newBuilder().build(new CacheLoader<Phenotype, Double>() {
@Override
public Double load(final Phenotype phenotype) throws Exception {
return function.evaluate(phenotype);
}
});
}
@Override
public double evaluate(final Phenotype phenotype) {
return cache.getUnchecked(phenotype).doubleValue();
}
}
| [
"[email protected]"
]
| |
b10b95debcd0fad3368b0bd71da0ce24b166ed26 | 692a7b9325014682d72bd41ad0af2921a86cf12e | /iZhejiang/src/org/jivesoftware/smack/packet/RosterPacket$Item.java | dea680db098a6aa2fd26e85deeb289497293af24 | []
| no_license | syanle/WiFi | f76fbd9086236f8a005762c1c65001951affefb6 | d58fb3d9ae4143cbe92f6f893248e7ad788d3856 | refs/heads/master | 2021-01-20T18:39:13.181843 | 2015-10-29T12:38:57 | 2015-10-29T12:38:57 | 45,156,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,610 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package org.jivesoftware.smack.packet;
import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import org.jivesoftware.smack.util.StringUtils;
// Referenced classes of package org.jivesoftware.smack.packet:
// RosterPacket
public static class itemStatus
{
private final Set groupNames = new CopyOnWriteArraySet();
private tatus itemStatus;
private ype itemType;
private String name;
private String user;
public void addGroupName(String s)
{
groupNames.add(s);
}
public Set getGroupNames()
{
return Collections.unmodifiableSet(groupNames);
}
public tatus getItemStatus()
{
return itemStatus;
}
public ype getItemType()
{
return itemType;
}
public String getName()
{
return name;
}
public String getUser()
{
return user;
}
public void removeGroupName(String s)
{
groupNames.remove(s);
}
public void setItemStatus(tatus tatus)
{
itemStatus = tatus;
}
public void setItemType(ype ype)
{
itemType = ype;
}
public void setName(String s)
{
name = s;
}
public String toXML()
{
StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append("<item jid=\"").append(user).append("\"");
if (name != null)
{
stringbuilder.append(" name=\"").append(StringUtils.escapeForXML(name)).append("\"");
}
if (itemType != null)
{
stringbuilder.append(" subscription=\"").append(itemType).append("\"");
}
if (itemStatus != null)
{
stringbuilder.append(" ask=\"").append(itemStatus).append("\"");
}
stringbuilder.append(">");
Iterator iterator = groupNames.iterator();
do
{
if (!iterator.hasNext())
{
stringbuilder.append("</item>");
return stringbuilder.toString();
}
String s = (String)iterator.next();
stringbuilder.append("<group>").append(StringUtils.escapeForXML(s)).append("</group>");
} while (true);
}
public ype(String s, String s1)
{
user = s.toLowerCase();
name = s1;
itemType = null;
itemStatus = null;
}
}
| [
"[email protected]"
]
| |
b6545947abb935f3bc0594f236ae38293f03d937 | a677b8af4fbb436337fba4e138a9dcae5f625eaa | /MyMain.java | 971895864929a563f5e4dd9b9826f294f79e0164 | []
| no_license | leo25599/213FirstAss | a0afd1ee5af0c188e948b54b357e1a0b175e5318 | 494cc25247b7b35430219cc37190e997a6da2430 | refs/heads/master | 2020-12-11T21:34:22.743819 | 2020-01-15T00:47:47 | 2020-01-15T00:47:47 | 233,964,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,431 | java | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class MyMain {
public static void main(String args[]){
// Minion Bob = new Minion("Bob", 3.2, 3);
// System.out.println(Bob.getMinionName());
//
// System.out.println(Bob.getMinionHeight());
//
// System.out.println(Bob.getNumEvilDeedsComp());
//
// System.out.println(Bob.toString());
List<Minion> minionList = new ArrayList<>();
Scanner input = new Scanner(System.in);
boolean canContinue = true;
while(canContinue){
int choice = input.nextInt();
String inputName;
double inputHeight;
switch(choice){
case 1:
System.out.println("List of minions");
System.out.println(("*"));
for(int i=1; i<=minionList.size(); i++){
System.out.println(i + ". " + minionList.get(i-1).getMinionName()
+ ", " + minionList.get(i-1).getMinionHeight() + ", "
+ minionList.get(i-1).getNumEvilDeedsComp() + "evil deed(s)");
}
// case 2:
// System.out.println("Enter minion's name: ");
//// inputName = input.next();
//
// System.out.println("Enter minion's height");
}
}
}
}
| [
"[email protected]"
]
| |
070664518cff2fcbee68bcdc1432ab5db4621643 | 2fc166bb93cdacb34024afacb18bb0722358abb4 | /Mohammadreza_assignment/app/src/main/java/com/example/mohammadreza_assignment/PersonActivity.java | 144a08e3839e5bd7ba0d05442f82322b5c220896 | []
| no_license | rezasaleh/android | 1c6860328e1884ec680910271117b6fad04855c9 | 19f5685c5575a99e4811407c246b8284da4384e8 | refs/heads/master | 2020-06-17T07:50:16.601587 | 2019-07-08T16:51:47 | 2019-07-08T16:51:47 | 195,851,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,964 | java | package com.example.mohammadreza_assignment;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.example.mohammadreza_assignment.model.Person;
import com.example.mohammadreza_assignment.model.Personcollection;
import java.util.Optional;
public class PersonActivity extends AppCompatActivity implements View.OnClickListener{
EditText editTextLastName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_person);
initialize();
}
private void initialize() {
// add click listener for buttons
findViewById(R.id.buttonAddPerson).setOnClickListener(this);
findViewById(R.id.buttonRemovePerson).setOnClickListener(this);
findViewById(R.id.buttonFindPerson).setOnClickListener(this);
// if last name is not empty, remove button and find button are enabled.
editTextLastName = findViewById(R.id.editTextLastName);
editTextLastName.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
@Override
public void afterTextChanged(Editable editable) {
if (editTextLastName.getText().length() > 0) {
findViewById(R.id.buttonRemovePerson).setEnabled(true);
findViewById(R.id.buttonFindPerson).setEnabled(true);
} else {
findViewById(R.id.buttonRemovePerson).setEnabled(false);
findViewById(R.id.buttonFindPerson).setEnabled(false);
}
}
});
}
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.buttonAddPerson:
addNewPerson();
break;
case R.id.buttonRemovePerson:
if (editTextLastName.getText().length() > 0) {
Person foundPerson = findPersonByLastName(editTextLastName.getText().toString());
if (foundPerson != null) {
removePerson(foundPerson);
}
}
break;
case R.id.buttonFindPerson:
if (editTextLastName.getText().length() > 0) {
Person foundPerson = findPersonByLastName(editTextLastName.getText().toString());
if (foundPerson != null) {
findPerson(foundPerson);
}
}
break;
}
}
private void addNewPerson() {
Intent intent = new Intent(PersonActivity.this, NewActivity.class);
startActivity(intent);
}
@RequiresApi(api = Build.VERSION_CODES.N)
private Person findPersonByLastName(String lastName) {
Optional<Person> foundPerson = Personcollection.getPersonList().stream()
.filter(person -> person.getLastName().equals(lastName))
.findFirst();
if (foundPerson.isPresent()) {
return foundPerson.get();
}
// not found person
Toast.makeText(PersonActivity.this, "No user found!", Toast.LENGTH_LONG).show();
return null;
}
private void removePerson(Person person) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Remove a person")
.setMessage("Do you want to delete this person ?\n\n" + person)
.setCancelable(false)
.setIcon(android.R.drawable.ic_delete)
.setPositiveButton("Yes", (dialog, i) -> {
Personcollection.getPersonList().remove(person);
Toast.makeText(PersonActivity.this, "Deleted successfully!", Toast.LENGTH_LONG).show();
})
.setNegativeButton("No", null);
builder.show();
}
private void findPerson(Person person) {
// get selected index from person list
int selectedPersonId = Personcollection.getPersonList().indexOf(person);
Toast.makeText(PersonActivity.this, "Success to find a person!", Toast.LENGTH_LONG).show();
// Pass the person id on to DetailActivity
Intent intent = new Intent(PersonActivity.this, DetailActivity.class);
intent.putExtra(DetailActivity.EXTRA_PERSON_ID, selectedPersonId);
startActivity(intent);
}
}
| [
"[email protected]"
]
| |
9fe5a76a9848343014ae3bfe0100b64ea6b6c797 | 6241551f141e5e825d6117e439a70eda7d9a5452 | /eigthNavigation.java | 8579cec4115776cd6c0f5f57bbbfa7e901a99e29 | []
| no_license | BifschTechs/SeleniumLessonGeneral | 3a853138551d903b89f6faa449e64f4cd0b3a9e3 | 458ad1ce9dec046b66dbffd9257c5cdfc539a39d | refs/heads/master | 2020-06-02T17:32:37.618169 | 2019-06-10T21:46:30 | 2019-06-10T21:46:30 | 191,249,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package seleniumm;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class eigthNavigation {
static WebDriver eigthNavigatior;
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
eigthNavigatior = new ChromeDriver();
eigthNavigatior.get("https://www.facebook.com");
eigthNavigatior.manage().window().maximize();
eigthNavigatior.quit();
}
}
| [
"[email protected]"
]
| |
3adcdef7e629763dd38829dab9cbdb49e97f8f43 | 89384863d500fea92ead8c4b3a07442e3f56aa67 | /App00OrjinalDersKodları/A11 - Ders_12_FragmentApplication/java/MainActivity.java | 09399ec4c1db1cbca1ab28fce49171422e7f744d | []
| no_license | SudeDalyan/AnroidNotlari | 0d9ba5e547c748714d07d573726d71b618b31bed | 95e14b629d30e4df77779a8b4a4f88c247be47bc | refs/heads/main | 2023-03-16T13:03:08.471107 | 2021-01-15T12:02:08 | 2021-01-15T12:02:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package ders.yasin.fragmentapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
} | [
"[email protected]"
]
| |
1a2770f4ac0592243b0666547007e59c45d1cbff | e733277f3337e6cd30ddceca56153f3f7bd9a410 | /src/wr3/html/Tag.java | cb440575e95d7b4602b60d8e87bdfdb37ee35f4e | []
| no_license | jamesqiu/wr3 | 29e3d9d91004912a9c78afa309678e2245667cd5 | 85b5a39f4ebd7021291b05d231a22f2505b6137b | refs/heads/master | 2021-01-10T18:40:42.641460 | 2013-04-03T09:09:16 | 2013-04-03T09:09:16 | 297,553 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 364 | java | package wr3.html;
public interface Tag {
/**
* tag id <tag id=".." ...>...</tag>
*/
String id = null;
/**
* 设置<tag>的id
* @param id
* @return
*/
public Tag id(String id);
/**
* <pre>
* 得到html安全的<tag ...>...</tag>字符串.
* </pre>
* @return
*/
public String html();
}
| [
"[email protected]"
]
| |
4670e4d25971725658066168b381ed9656e81191 | 26800d0c574233dd89d63ffeb80a8e4bf524ffb2 | /EchoClient/src/MainProgram.java | 854206574683a04f6df94b021393a6f2a71e597d | []
| no_license | macbogdan/Java | b1db5d7658ae6a6cf4c162f59acb1d01cd00c6d9 | f5f2fd07d214e69a33127844d9be3423ab9c4792 | refs/heads/master | 2020-12-11T03:52:28.193497 | 2013-11-09T22:07:55 | 2013-11-09T22:07:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | import Settings.UserData;
import Connection.*;
import Communication.*;
public class MainProgram {
/**
* @param args
*/
public static void main(String[] args) {
int port = 8000;
final UserData user = new UserData();
final MessageFactory factory = new MessageFactory();
final UserInterface ui = new UserInterface(factory, user);
final ComProtocol protocol = new ComProtocol(factory, user);
final ClientConnection client = new ClientConnection("localhost", port, protocol);
// Starts the client's independent thread
client.start();
ui.start();
try {
// Wait for the server to shutdown
client.join();
System.out.println("Completed shutdown.");
} catch (InterruptedException e) {
// Exit with an error condition
System.err.println("Interrupted before accept thread completed.");
System.exit(1);
}
}
}
| [
"[email protected]"
]
| |
28dbffe1afe81e040a3c2a86a01067cd9ec8b537 | de2b31e37e9525785b6381c886fed76fd50c55f2 | /Sentence.java | d690284584e24fb24ebb06415e7254c13f190780 | [
"MIT"
]
| permissive | nishijjain/text-summarizer | 9d0483ff71138e18d4220512b32257139b383852 | ef6552b0b8eba0ff0322834651d5682cc65861dd | refs/heads/main | 2023-01-06T12:03:31.246984 | 2020-11-03T12:38:14 | 2020-11-03T12:38:14 | 309,677,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 816 | java | // In this class, entire text is divided into a no. of paragraphs & each paragraph into a no. of sentences
class Sentence{
// 2 numbers given to each sentence.
int paragraphNumber; // Indicates which paragraph the sentence is a part of.
int number; // Sentence number w.r.t the entire text.
int stringLength; // No. of characters in the sentence.
double score;
int noOfWords;
String value; // Actual string
Sentence(int number, String value, int stringLength, int paragraphNumber){
this.number = number;
this.value = new String(value);
this.stringLength = stringLength;
noOfWords = value.split("\\s+").length; // Computed manually by Word Tokenizing a sentence.
score = 0.0; // Score indicates importance/ how frequently it appears, initialized to 0.
this.paragraphNumber=paragraphNumber;
}
} | [
"[email protected]"
]
| |
0964519202920985a24dc1d8fc0811f688370e2f | 19429b7d85667f3c4234a1ed7857b4e398e257fb | /src/com/tennis/reservation/notification/PersonalNotification.java | 0714ab7418ba59276f3b3136f74b54fc9f11bd82 | []
| no_license | shanuraj17/TennisCourtReservation | fdbaf78d443f09f4f60a32c1ebf8fe9e0655a07a | 11ba9891695b4f8ca92882f96421c3f2e8f69f5a | refs/heads/master | 2022-11-15T16:04:38.508315 | 2020-07-12T12:34:30 | 2020-07-12T12:34:30 | 279,060,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 85 | java | package com.tennis.reservation.notification;
public class PersonalNotification {
}
| [
"[email protected]"
]
| |
9a4cdaa5406e67c1f6700033d5bff5adbd75c018 | 968efd929c527719e59afa65aaf2cf00d088e94f | /zinc/src/sbt-test/apiinfo/main-discovery/src/main/java/runjava/MainJava.java | 4f2abb5dafee89244f74d35baab86e3c52ad2ac0 | [
"Apache-2.0",
"BSD-3-Clause",
"LGPL-2.1-or-later",
"MIT"
]
| permissive | sbt/zinc | 8ac12979c1d3d1cd553ca6d6a6374a662d44644f | a03b3c1e6fab22cec015cbf27ff84a2badce6982 | refs/heads/develop | 2023-08-31T12:01:02.262479 | 2023-08-27T21:46:43 | 2023-08-28T04:09:29 | 40,210,247 | 326 | 128 | Apache-2.0 | 2023-09-14T02:06:53 | 2015-08-04T21:32:58 | Scala | UTF-8 | Java | false | false | 176 | java | package runjava;
class MainJava {
public static void main(String args[]) {
}
static public class StaticInner {
public static void main(String args[]) {
}
}
}
| [
"[email protected]"
]
| |
0db2fb9f3522eb6fc17a15e3de13a877507d27cd | 053c9dfa6fdd77123a5222edce1d9d667e575b95 | /src/java/cn/lucene/lorc/OrcConf.java | ad0023f6a4dea6b7b4404e1ccd567a341922da60 | []
| no_license | lucene-cn/lxorc | cf57876da61e921ff3744a413beabaaa19b32e20 | 1b4298f4a10983862485e7b4df005a2060a60dc0 | refs/heads/main | 2023-03-29T07:43:50.123044 | 2021-03-21T15:04:04 | 2021-03-21T15:04:04 | 347,018,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,562 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.lucene.lorc;
import java.util.Properties;
import org.apache.hadoop.conf.Configuration;
/**
* Define the configuration properties that Orc understands.
*/
public enum OrcConf {
STRIPE_SIZE("orc.stripe.size", "hive.exec.orc.default.stripe.size",
64L * 1024 * 1024,
"Define the default ORC stripe size, in bytes."),
BLOCK_SIZE("orc.block.size", "hive.exec.orc.default.block.size",
256L * 1024 * 1024,
"Define the default file system block size for ORC files."),
ENABLE_INDEXES("orc.create.index", "orc.create.index", true,
"Should the ORC writer create indexes as part of the file."),
ROW_INDEX_STRIDE("orc.row.index.stride",
"hive.exec.orc.default.row.index.stride", 10000,
"Define the default ORC index stride in number of rows. (Stride is the\n"+
" number of rows n index entry represents.)"),
BUFFER_SIZE("orc.compress.size", "hive.exec.orc.default.buffer.size",
256 * 1024, "Define the default ORC buffer size, in bytes."),
BASE_DELTA_RATIO("orc.base.delta.ratio", "hive.exec.orc.base.delta.ratio", 8,
"The ratio of base writer and delta writer in terms of STRIPE_SIZE and BUFFER_SIZE."),
BLOCK_PADDING("orc.block.padding", "hive.exec.orc.default.block.padding",
true,
"Define whether stripes should be padded to the HDFS block boundaries."),
COMPRESS("orc.compress", "hive.exec.orc.default.compress", "ZLIB",
"Define the default compression codec for ORC file"),
WRITE_FORMAT("orc.write.format", "hive.exec.orc.write.format", "0.12",
"Define the version of the file to write. Possible values are 0.11 and\n"+
" 0.12. If this parameter is not defined, ORC will use the run\n" +
" length encoding (RLE) introduced in Hive 0.12."),
ENFORCE_COMPRESSION_BUFFER_SIZE("orc.buffer.size.enforce", "hive.exec.orc.buffer.size.enforce", false,
"Defines whether to enforce ORC compression buffer size."),
ENCODING_STRATEGY("orc.encoding.strategy", "hive.exec.orc.encoding.strategy",
"SPEED",
"Define the encoding strategy to use while writing data. Changing this\n"+
"will only affect the light weight encoding for integers. This\n" +
"flag will not change the compression level of higher level\n" +
"compression codec (like ZLIB)."),
COMPRESSION_STRATEGY("orc.compression.strategy",
"hive.exec.orc.compression.strategy", "SPEED",
"Define the compression strategy to use while writing data.\n" +
"This changes the compression level of higher level compression\n" +
"codec (like ZLIB)."),
BLOCK_PADDING_TOLERANCE("orc.block.padding.tolerance",
"hive.exec.orc.block.padding.tolerance", 0.05,
"Define the tolerance for block padding as a decimal fraction of\n" +
"stripe size (for example, the default value 0.05 is 5% of the\n" +
"stripe size). For the defaults of 64Mb ORC stripe and 256Mb HDFS\n" +
"blocks, the default block padding tolerance of 5% will\n" +
"reserve a maximum of 3.2Mb for padding within the 256Mb block.\n" +
"In that case, if the available size within the block is more than\n"+
"3.2Mb, a new smaller stripe will be inserted to fit within that\n" +
"space. This will make sure that no stripe written will block\n" +
" boundaries and cause remote reads within a node local task."),
BLOOM_FILTER_FPP("orc.bloom.filter.fpp", "orc.default.bloom.fpp", 0.05,
"Define the default false positive probability for bloom filters."),
USE_ZEROCOPY("orc.use.zerocopy", "hive.exec.orc.zerocopy", false,
"Use zerocopy reads with ORC. (This requires Hadoop 2.3 or later.)"),
SKIP_CORRUPT_DATA("orc.skip.corrupt.data", "hive.exec.orc.skip.corrupt.data",
false,
"If ORC reader encounters corrupt data, this value will be used to\n" +
"determine whether to skip the corrupt data or throw exception.\n" +
"The default behavior is to throw exception."),
TOLERATE_MISSING_SCHEMA("orc.tolerate.missing.schema",
"hive.exec.orc.tolerate.missing.schema",
true,
"Writers earlier than HIVE-4243 may have inaccurate schema metadata.\n"
+ "This setting will enable best effort schema evolution rather\n"
+ "than rejecting mismatched schemas"),
MEMORY_POOL("orc.memory.pool", "hive.exec.orc.memory.pool", 0.5,
"Maximum fraction of heap that can be used by ORC file writers"),
DICTIONARY_KEY_SIZE_THRESHOLD("orc.dictionary.key.threshold",
"hive.exec.orc.dictionary.key.size.threshold",
0.8,
"If the number of distinct keys in a dictionary is greater than this\n" +
"fraction of the total number of non-null rows, turn off \n" +
"dictionary encoding. Use 1 to always use dictionary encoding."),
ROW_INDEX_STRIDE_DICTIONARY_CHECK("orc.dictionary.early.check",
"hive.orc.row.index.stride.dictionary.check",
true,
"If enabled dictionary check will happen after first row index stride\n" +
"(default 10000 rows) else dictionary check will happen before\n" +
"writing first stripe. In both cases, the decision to use\n" +
"dictionary or not will be retained thereafter."),
BLOOM_FILTER_COLUMNS("orc.bloom.filter.columns", "orc.bloom.filter.columns",
"", "List of columns to create bloom filters for when writing."),
BLOOM_FILTER_WRITE_VERSION("orc.bloom.filter.write.version",
"orc.bloom.filter.write.version", OrcFile.BloomFilterVersion.UTF8.toString(),
"Which version of the bloom filters should we write.\n" +
"The choices are:\n" +
" original - writes two versions of the bloom filters for use by\n" +
" both old and new readers.\n" +
" utf8 - writes just the new bloom filters."),
IGNORE_NON_UTF8_BLOOM_FILTERS("orc.bloom.filter.ignore.non-utf8",
"orc.bloom.filter.ignore.non-utf8", false,
"Should the reader ignore the obsolete non-UTF8 bloom filters."),
MAX_FILE_LENGTH("orc.max.file.length", "orc.max.file.length", Long.MAX_VALUE,
"The maximum size of the file to read for finding the file tail. This\n" +
"is primarily used for streaming ingest to read intermediate\n" +
"footers while the file is still open"),
MAPRED_INPUT_SCHEMA("orc.mapred.input.schema", null, null,
"The schema that the user desires to read. The values are\n" +
"interpreted using TypeDescription.fromString."),
MAPRED_SHUFFLE_KEY_SCHEMA("orc.mapred.map.output.key.schema", null, null,
"The schema of the MapReduce shuffle key. The values are\n" +
"interpreted using TypeDescription.fromString."),
MAPRED_SHUFFLE_VALUE_SCHEMA("orc.mapred.map.output.value.schema", null, null,
"The schema of the MapReduce shuffle value. The values are\n" +
"interpreted using TypeDescription.fromString."),
MAPRED_OUTPUT_SCHEMA("orc.mapred.output.schema", null, null,
"The schema that the user desires to write. The values are\n" +
"interpreted using TypeDescription.fromString."),
INCLUDE_COLUMNS("orc.include.columns", "hive.io.file.readcolumn.ids", null,
"The list of comma separated column ids that should be read with 0\n" +
"being the first column, 1 being the next, and so on. ."),
KRYO_SARG("orc.kryo.sarg", "orc.kryo.sarg", null,
"The kryo and base64 encoded SearchArgument for predicate pushdown."),
KRYO_SARG_BUFFER("orc.kryo.sarg.buffer", null, 8192,
"The kryo buffer size for SearchArgument for predicate pushdown."),
SARG_COLUMNS("orc.sarg.column.names", "org.sarg.column.names", null,
"The list of column names for the SearchArgument."),
FORCE_POSITIONAL_EVOLUTION("orc.force.positional.evolution",
"orc.force.positional.evolution", false,
"Require schema evolution to match the top level columns using position\n" +
"rather than column names. This provides backwards compatibility with\n" +
"Hive 2.1."),
FORCE_POSITIONAL_EVOLUTION_LEVEL("orc.force.positional.evolution.level",
"orc.force.positional.evolution.level", 1,
"Require schema evolution to match the the defined no. of level columns using position\n" +
"rather than column names. This provides backwards compatibility with Hive 2.1."),
ROWS_BETWEEN_CHECKS("orc.rows.between.memory.checks", "orc.rows.between.memory.checks", 5000,
"How often should MemoryManager check the memory sizes? Measured in rows\n" +
"added to all of the writers. Valid range is [1,10000] and is primarily meant for" +
"n\testing. Setting this too low may negatively affect performance."),
OVERWRITE_OUTPUT_FILE("orc.overwrite.output.file", "orc.overwrite.output.file", false,
"A boolean flag to enable overwriting of the output file if it already exists.\n"),
IS_SCHEMA_EVOLUTION_CASE_SENSITIVE("orc.schema.evolution.case.sensitive", "orc.schema.evolution.case.sensitive", true,
"A boolean flag to determine if the comparision of field names in schema evolution is case sensitive .\n"),
WRITE_VARIABLE_LENGTH_BLOCKS("orc.write.variable.length.blocks", null, false,
"A boolean flag as to whether the ORC writer should write variable length\n"
+ "HDFS blocks."),
DIRECT_ENCODING_COLUMNS("orc.column.encoding.direct", "orc.column.encoding.direct", "",
"Comma-separated list of columns for which dictionary encoding is to be skipped."),
// some JVM doesn't allow array creation of size Integer.MAX_VALUE, so chunk size is slightly less than max int
ORC_MAX_DISK_RANGE_CHUNK_LIMIT("orc.max.disk.range.chunk.limit", "hive.exec.orc.max.disk.range.chunk.limit",
Integer.MAX_VALUE - 1024, "When reading stripes >2GB, specify max limit for the chunk size."),
ENCRYPTION("orc.encrypt", "orc.encrypt", null, "The list of keys and columns to encrypt with"),
DATA_MASK("orc.mask", "orc.mask", null, "The masks to apply to the encrypted columns"),
KEY_PROVIDER("orc.key.provider", "orc.key.provider", "hadoop", "The kind of KeyProvider to use for encryption."),
PROLEPTIC_GREGORIAN("orc.proleptic.gregorian", "orc.proleptic.gregorian", false,
"Should we read and write dates & times using the proleptic Gregorian calendar\n" +
"instead of the hybrid Julian Gregorian? Hive before 3.1 and Spark before 3.0\n" +
"used hybrid."),
PROLEPTIC_GREGORIAN_DEFAULT("orc.proleptic.gregorian.default",
"orc.proleptic.gregorian.default", false,
"This value controls whether pre-ORC 27 files are using the hybrid or proleptic\n" +
"calendar. Only Hive 3.1 and the C++ library wrote using the proleptic, so hybrid\n" +
"is the default.")
;
private final String attribute;
private final String hiveConfName;
private final Object defaultValue;
private final String description;
OrcConf(String attribute,
String hiveConfName,
Object defaultValue,
String description) {
this.attribute = attribute;
this.hiveConfName = hiveConfName;
this.defaultValue = defaultValue;
this.description = description;
}
public String getAttribute() {
return attribute;
}
public String getHiveConfName() {
return hiveConfName;
}
public Object getDefaultValue() {
return defaultValue;
}
public String getDescription() {
return description;
}
private String lookupValue(Properties tbl, Configuration conf) {
String result = null;
if (tbl != null) {
result = tbl.getProperty(attribute);
}
if (result == null && conf != null) {
result = conf.get(attribute);
if (result == null && hiveConfName != null) {
result = conf.get(hiveConfName);
}
}
return result;
}
public int getInt(Properties tbl, Configuration conf) {
String value = lookupValue(tbl, conf);
if (value != null) {
return Integer.parseInt(value);
}
return ((Number) defaultValue).intValue();
}
public int getInt(Configuration conf) {
return getInt(null, conf);
}
public void getInt(Configuration conf, int value) {
conf.setInt(attribute, value);
}
public long getLong(Properties tbl, Configuration conf) {
String value = lookupValue(tbl, conf);
if (value != null) {
return Long.parseLong(value);
}
return ((Number) defaultValue).longValue();
}
public long getLong(Configuration conf) {
return getLong(null, conf);
}
public void setLong(Configuration conf, long value) {
conf.setLong(attribute, value);
}
public String getString(Properties tbl, Configuration conf) {
String value = lookupValue(tbl, conf);
return value == null ? (String) defaultValue : value;
}
public String getString(Configuration conf) {
return getString(null, conf);
}
public void setString(Configuration conf, String value) {
conf.set(attribute, value);
}
public boolean getBoolean(Properties tbl, Configuration conf) {
String value = lookupValue(tbl, conf);
if (value != null) {
return Boolean.parseBoolean(value);
}
return (Boolean) defaultValue;
}
public boolean getBoolean(Configuration conf) {
return getBoolean(null, conf);
}
public void setBoolean(Configuration conf, boolean value) {
conf.setBoolean(attribute, value);
}
public double getDouble(Properties tbl, Configuration conf) {
String value = lookupValue(tbl, conf);
if (value != null) {
return Double.parseDouble(value);
}
return ((Number) defaultValue).doubleValue();
}
public double getDouble(Configuration conf) {
return getDouble(null, conf);
}
public void setDouble(Configuration conf, double value) {
conf.setDouble(attribute, value);
}
}
| [
"[email protected]"
]
| |
df2af382af3a1fea04a27e3256a66f7794267d99 | 8961f64b3ca81a01bd04f69a44378cd7a25ebe94 | /GoodsCenter/src/test/java/com/kotlin/goods/ExampleUnitTest.java | 18a1f6ab224df41ed65a80e3cc13aeb23da52984 | []
| no_license | teddy0710/MyKotlinMall | d95a2b82f300a865c5a64e84dea9fdb7006b8167 | 522fa5bc83b8812bbd7286ec7f3592f2c9a2bff4 | refs/heads/master | 2021-01-25T13:11:06.899197 | 2018-03-15T09:34:44 | 2018-03-15T09:34:44 | 123,535,915 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.kotlin.goods;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"fq39542099"
]
| fq39542099 |
38f445717e677001c8454a28d9735d4587a84892 | 274a16a64a269d44579fd2a8ce1c8dd3ac15d820 | /dataweb/src/main/java/com/hc360/dataweb/controller/P4PDataController.java | c95a82112535b1e0f5991e647c302b670be3f263 | []
| no_license | beisir/ThreeMagicNumber | a2dddbd6ef476a71ca779cf66e5336ea15191c3c | e5acc57e3195108cce7aa5796df35409d750e877 | refs/heads/master | 2021-04-15T07:25:32.767919 | 2019-01-14T01:44:09 | 2019-01-14T01:44:09 | 126,265,335 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,417 | java | package com.hc360.dataweb.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hc360.dataweb.service.RealTimeStaticDayService;
import com.hc360.dataweb.service.RealTimeStaticHourService;
import com.hc360.dataweb.util.EmailUtil;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
@Controller
public class P4PDataController {
private Logger logger = Logger.getLogger(P4PDataController.class);
@Autowired
private RealTimeStaticDayService realTimeStaticDayService;
@Autowired
private RealTimeStaticHourService realTimeStaticHourService;
/**
* 顶部各种颜色的图块的数据
*
* @param response
*/
@RequestMapping(value = "/realtimepfpdata/", method = RequestMethod.GET, produces = {"application/xml", "application/json"})
public void findP4PTopDataByDay(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType("application/json; charset=UTF-8");
//数据
Map<String, Object> dataList = new HashMap<String, Object>();
Map<String, Object> dataTotal = new HashMap<String, Object>();//P4P消耗
Map _dataMap = new HashMap();
Map dataMap = new HashMap();
try {
//橙色顶部 p4p消耗
realTimeStaticDayService.initP4PDataList(dataTotal,0);
//添加P4P的数据,从小时表中添加数据
realTimeStaticDayService.initP4PDataList(dataList,1);
dataMap.put("dataTotal", dataTotal);
dataMap.put("dataList", dataList);
_dataMap.put("errno", 0);
_dataMap.put("data", dataMap);
} catch (Exception e) {
EmailUtil.warnEveryOne("P4PDataController.findP4PTopDataByDay has error," + "," + e.getMessage());
logger.error("findP4PTopDataByDay has error,", e);
}
ObjectMapper objectMapper = new ObjectMapper();
try {
response.getWriter().print(objectMapper.writeValueAsString(_dataMap));
response.getWriter().flush();
response.getWriter().close();
} catch (Exception e) {
logger.error("LiveDataController.realtimedata:", e);
}
}
}
| [
"[email protected]"
]
| |
ff5d29414eec46b6ac41c1f10a34350305fe7b96 | 92dcdfe57002e8022ee566e9608c7f6a3f2c5488 | /src/Practice1/EchoClient.java | 424c7046f38013e697bc8da92f3bfe4a59bdc80f | []
| no_license | ParkYeoungJun/Java_Socket | 83c52913567ddae46849bcaff2a41b796d8e65d5 | 6c08598301b1fd4ee3df4e613efccd9c63365d21 | refs/heads/master | 2020-06-03T02:08:26.933673 | 2017-06-12T15:43:23 | 2017-06-12T15:43:23 | 94,112,318 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,823 | java | package Practice1;
import java.io.*;
import java.net.*;
public class EchoClient
{
public static void main(String args[]){
Socket theSocket = null;
String host;
InputStream is;
BufferedReader reader, userInput;
OutputStream os;
BufferedWriter writer;
String theLine;
if(args.length>0){
host=args[0]; // 입력받은 호스트를 사용
}else{
host="localhost"; // 로컬 호스트를 사용
}
try{
theSocket = new Socket(host, 6); // echo 서버에 접속한다.
is = theSocket.getInputStream();
reader = new BufferedReader(new InputStreamReader(is));
userInput = new BufferedReader(new InputStreamReader(System.in));
os = theSocket.getOutputStream();
writer = new BufferedWriter(new OutputStreamWriter(os));
System.out.println("전송할 문장을 입력하십시오.");
while(true){
theLine = userInput.readLine(); // 데이터를 입력한다.
if(theLine.equals("quit")) break; // 프로그램 종료
writer.write(theLine+'\r'+'\n');
writer.flush(); // 서버에 데이터 전송
System.out.println(reader.readLine()); //되돌려 받고, 화면에 출력한다.
}
}catch(UnknownHostException e){
System.err.println(args[0]+" 호스트를 찾을 수 없습니다.");
}catch(IOException e){
System.err.println(e);
}finally{
try{
theSocket.close(); // 소켓을 닫는다.
}catch(IOException e){
System.out.println(e);
}
}
}
} | [
"YeoungJun Park"
]
| YeoungJun Park |
32588685c9b3f07c2c517da0914a686f413509b6 | 7cced9c87224118213299bb33e96efd76aad48c6 | /src/HelloWorld.java | f667a844dd9842e092e220d2db3cf5caea21946d | []
| no_license | trungquangphan/codegym-hello-git | 18d7c8352b3847bb58dc217ff02c0bea2423700f | 795a718030fb9954437a5af61233e4bb26a8be3c | refs/heads/master | 2020-03-20T20:52:40.609490 | 2018-06-20T08:55:11 | 2018-06-20T08:55:11 | 137,712,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java | public class HelloWorld {
public static void main(String[] args){
System.out.println("Hellow Codegym!, Java and Git");
}
}
| [
"[email protected]"
]
| |
e7d2c9a5006fef82f6c7f85a8f6df0e264506407 | f033c8770ebe13f61156fbd8342df8e2f8258ab0 | /pro/V1/src/java/bean/shoppingCart.java | a846b387203627cfb5f913f1d6f5ee1adea53559 | []
| no_license | TranThachTran1801/2017S2 | 017f2bae98fe5312181baa3f5f29653c1c03eabc | 405540a3414d463a58659a50be0f6fa9e9098e82 | refs/heads/master | 2021-01-20T05:19:19.870769 | 2017-06-02T05:46:52 | 2017-06-02T05:46:52 | 86,038,383 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 277 | 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 bean;
/**
*
* @author trung
*/
public class shoppingCart {
}
| [
"[email protected]"
]
| |
baad30512a46f95c31ebae34ceed714cec24f0a4 | 1eb747214f570c45cd307fefca7d3cd31f2b4fdc | /app/src/main/java/com/example/berlian/si_rt/kegiatan/AdapterKegiatan.java | ae103812a7f2f44ed93d753fe7bd30b7f4bcf32b | []
| no_license | berlian1/si-rt | 97b35e560dccb744076d620151ee65e45f9cbf32 | 0dd0a73edc5fc5b6219025ef79e1bd9579973d5a | refs/heads/master | 2020-12-02T21:11:35.490596 | 2017-07-09T14:43:33 | 2017-07-09T14:43:33 | 96,269,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,121 | java | package com.example.berlian.si_rt.kegiatan;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.berlian.si_rt.R;
import java.util.List;
/**
* Created by berlian on 6/16/2017.
*/
public class AdapterKegiatan extends RecyclerView.Adapter<AdapterKegiatan.ViewHolder> {
private static final String TAG = "CustomAdapter";
public static class ViewHolder extends RecyclerView.ViewHolder {
private TextView textView,kategori,nama,subKat,judul,tanggal,teks;
public ViewHolder(View v) {
super(v);
// Define click listener for the ViewHolder's View.
nama =(TextView)v.findViewById(R.id.nama);
kategori = (TextView)v.findViewById(R.id.kategori);
subKat = (TextView)v.findViewById(R.id.subKat);
judul = (TextView)v.findViewById(R.id.judul);
tanggal = (TextView)v.findViewById(R.id.tanggal);
teks = (TextView)v.findViewById(R.id.teks);
}
public TextView getTextView() {
return textView;
}
}
private List<resKegiatan> list;
public AdapterKegiatan(List<resKegiatan> list){
this.list = list;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycle_row, null);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.tanggal.setText(list.get(position).getTanggal());
holder.judul.setText(list.get(position).getJudul());
holder.nama.setText(list.get(position).getNama());
holder.kategori.setText(list.get(position).getKategori());
holder.subKat.setText(list.get(position).getSubkategori());
holder.teks.setText(list.get(position).getTeks());}
@Override
public int getItemCount() {
return this.list.size();
}
}
| [
"[email protected]"
]
| |
7c2746300e0dc34e82bd24341135b4a27c77e886 | 12f3ac730c53727f2841fb4a687aae6e4121781d | /skinnyrest/src/main/java/org/zygno/config/WebConfigurer.java | 1dc517b10d73fc55a05934f96c8d4fe93748302c | []
| no_license | wdmulert/doclib | b642c0412dc38447bec0cec1c461c1e5c2843dac | 03a8f83f3148f7028188c17f3866530afc7c4d0a | refs/heads/master | 2021-09-10T17:54:42.139196 | 2018-01-11T02:16:12 | 2018-01-11T02:16:12 | 107,179,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,157 | java | package org.zygno.config;
import io.github.jhipster.config.JHipsterConstants;
import io.github.jhipster.config.JHipsterProperties;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.servlet.InstrumentedFilter;
import com.codahale.metrics.servlets.MetricsServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.*;
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
import io.undertow.UndertowOptions;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import java.util.*;
import javax.servlet.*;
/**
* Configuration of web application with Servlet 3.0 APIs.
*/
@Configuration
public class WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer {
private final Logger log = LoggerFactory.getLogger(WebConfigurer.class);
private final Environment env;
private final JHipsterProperties jHipsterProperties;
private MetricRegistry metricRegistry;
public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) {
this.env = env;
this.jHipsterProperties = jHipsterProperties;
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
if (env.getActiveProfiles().length != 0) {
log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles());
}
EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC);
initMetrics(servletContext, disps);
log.info("Web application fully configured");
}
/**
* Customize the Servlet engine: Mime types, the document root, the cache.
*/
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
// IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
mappings.add("html", "text/html;charset=utf-8");
// CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
mappings.add("json", "text/html;charset=utf-8");
container.setMimeMappings(mappings);
/*
* Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
* HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
* See the JHipsterProperties class and your application-*.yml configuration files
* for more information.
*/
if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
container instanceof UndertowEmbeddedServletContainerFactory) {
((UndertowEmbeddedServletContainerFactory) container)
.addBuilderCustomizers(builder ->
builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
}
}
/**
* Initializes Metrics.
*/
private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType> disps) {
log.debug("Initializing Metrics registries");
servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE,
metricRegistry);
servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY,
metricRegistry);
log.debug("Registering Metrics Filter");
FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter",
new InstrumentedFilter());
metricsFilter.addMappingForUrlPatterns(disps, true, "/*");
metricsFilter.setAsyncSupported(true);
log.debug("Registering Metrics Servlet");
ServletRegistration.Dynamic metricsAdminServlet =
servletContext.addServlet("metricsServlet", new MetricsServlet());
metricsAdminServlet.addMapping("/management/metrics/*");
metricsAdminServlet.setAsyncSupported(true);
metricsAdminServlet.setLoadOnStartup(2);
}
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = jHipsterProperties.getCors();
if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) {
log.debug("Registering CORS filter");
source.registerCorsConfiguration("/api/**", config);
source.registerCorsConfiguration("/v2/api-docs", config);
}
return new CorsFilter(source);
}
@Autowired(required = false)
public void setMetricRegistry(MetricRegistry metricRegistry) {
this.metricRegistry = metricRegistry;
}
}
| [
"[email protected]"
]
| |
a3611966816eac518580ed997652b3fa64fa9285 | 72c1dc276f7d1db59c5a3c68f364543b1f27f218 | /src/test/java/template/RealTest.java | 0073c6f02d05bae4c7bb3c0b1f0ee186b902ae2e | []
| no_license | vojtechhabarta/rest-template | ffdff099f2815674459fe3884cc0152ec3d45f73 | 83eb78f9047ed5993d27a5b546020ce64d778857 | refs/heads/master | 2022-07-16T07:05:01.647178 | 2020-10-24T08:43:16 | 2020-10-24T08:43:16 | 15,250,705 | 1 | 1 | null | 2022-06-29T19:21:39 | 2013-12-17T09:47:43 | Java | UTF-8 | Java | false | false | 106 | java |
package template;
/**
* Marker interface for Arquillian real tests.
*/
public interface RealTest {
}
| [
"[email protected]"
]
| |
d54263bebd893a38694839f2f053af99c283b7ef | 1f25606e5ed5fb5fcf185d188554b3f0b1584288 | /src/main/java/org/xm/xmnlp/seg/ViterbiSegment.java | fd2b4940be97c1e6595c5139619f04a8665ddd32 | [
"Apache-2.0"
]
| permissive | shook2012/atconlp | 57995f6bf49fce03f19095abe763797e6713190a | f603eabdcd88531a97e04ce61b33872bf7e2af5b | refs/heads/master | 2021-06-12T06:19:47.639380 | 2017-01-16T03:49:22 | 2017-01-16T03:49:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,417 | java | package org.xm.xmnlp.seg;
import java.util.LinkedList;
import java.util.List;
import org.xm.xmnlp.Xmnlp;
import org.xm.xmnlp.recognition.organ.OrganizationRecognition;
import org.xm.xmnlp.recognition.person.JapanesePersonRecognition;
import org.xm.xmnlp.recognition.person.PersonRecognition;
import org.xm.xmnlp.recognition.person.TranslatedPersonRecognition;
import org.xm.xmnlp.recognition.place.PlaceRecognition;
import org.xm.xmnlp.seg.domain.Term;
import org.xm.xmnlp.seg.domain.Vertex;
import org.xm.xmnlp.seg.domain.WordNet;
/**
* Viterbi分词器<br>
* 也是最短路分词,最短路求解采用Viterbi算法
* Created by mingzai on 2016/7/23.
*/
public class ViterbiSegment extends WordBasedModelSegment {
@Override
protected List<Term> segSentence(char[] sentence) {
WordNet wordNetAll = new WordNet(sentence);
GenerateWordNet(wordNetAll);//生成词网
if (Xmnlp.Config.DEBUG) {
System.out.printf("粗粉词网:\n%s \n", wordNetAll);
}
List<Vertex> vertexList = viterbi(wordNetAll);
if (config.useCustomDictionary) {
combineByCustomDictionary(vertexList);
}
if (Xmnlp.Config.DEBUG) {
System.out.println("粗分结果" + convert(vertexList, false));
}
// 数字识别
if (config.numberQuantifierRecognize) {
mergeNumberQuantifier(vertexList, wordNetAll, config);
}
// 实体命名识别
if (config.ner) {
WordNet wordNetOptimum = new WordNet(sentence, vertexList);
int preSize = wordNetOptimum.size();
if (config.nameRecognize) {
PersonRecognition.recognition(vertexList, wordNetOptimum, wordNetAll);
}
if (config.translatedNameRecognize) {
TranslatedPersonRecognition.recognition(vertexList, wordNetOptimum, wordNetAll);
}
if (config.japaneseNameRecognize) {
JapanesePersonRecognition.recognition(vertexList, wordNetOptimum, wordNetAll);
}
if (config.placeRecognize) {
PlaceRecognition.recognition(vertexList, wordNetOptimum, wordNetAll);
}
if (config.organizationRecognize) {
// 层叠隐马模型——生成输出作为下一级隐马输入
vertexList = viterbi(wordNetOptimum);
wordNetOptimum.clear();
wordNetOptimum.addAll(vertexList);
preSize = wordNetOptimum.size();
OrganizationRecognition.recognition(vertexList, wordNetOptimum, wordNetAll);
}
if (wordNetOptimum.size() != preSize) {
vertexList = viterbi(wordNetOptimum);
if (Xmnlp.Config.DEBUG) {
System.out.printf("细分词网:\n%s\n", wordNetOptimum);
}
}
}
// 如果是索引模式则全切分
if (config.indexMode) {
return decorateResultForIndexMode(vertexList, wordNetAll);
}
// 是否标注词性
if (config.speechTagging) {
speechTagging(vertexList);
}
return convert(vertexList, config.offset);
}
private static List<Vertex> viterbi(WordNet wordNet) {
// 避免生成对象,优化速度
LinkedList<Vertex> nodes[] = wordNet.getVertexes();
LinkedList<Vertex> vertexList = new LinkedList<Vertex>();
for (Vertex node : nodes[1]) {
node.updateFrom(nodes[0].getFirst());
}
for (int i = 1; i < nodes.length - 1; ++i) {// 三层循环,你也不怕噎着
LinkedList<Vertex> nodeArray = nodes[i];
if (nodeArray == null) continue;
for (Vertex node : nodeArray) { // 前缀词典的内部node结果比较选一个
if (node.from == null) continue;
for (Vertex to : nodes[i + node.realWord.length()]) {
to.updateFrom(node);// 根据前后词的联系判断
}
}
}
Vertex from = nodes[nodes.length - 1].getFirst();
while (from != null) {
vertexList.addFirst(from);
from = from.from;
}
return vertexList;
}
}
| [
"[email protected]"
]
| |
23e78f34dd37bd0078875d5501e3834d78a19b46 | 0a60ea1cc26965dbf0318f7795871dd31de39b95 | /src/main/java/meli/springchallenge/dtos/CountPromoDTO.java | 6e7e70af86b96c24e2835b884af59789f178274d | []
| no_license | mstefa/SpringChallenge | 970e7e7451b506607c7c770c89fcb3d591a60360 | 83200b058fab181c81647770ec7ed42975ee0e0a | refs/heads/main | 2023-05-26T19:47:17.034415 | 2021-06-10T18:34:10 | 2021-06-10T18:34:10 | 375,788,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package meli.springchallenge.dtos;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CountPromoDTO {
private int userId;
private String UserName;
private int promoProductsCount;
}
| [
"[email protected]"
]
| |
3da9e43cd7ad0a424bf4761f199ceca6b272ae4c | eb31160e5915c422860267acbd1dcb3c3743c09c | /jOOQ/src/main/java/org/jooq/Adapter.java | 41ef0b68495ff40f78cd4e2878cd6ce5f83e3aa6 | [
"BSD-3-Clause",
"Apache-2.0"
]
| permissive | digulla/jOOQ | b75b43c2e15b4e46d3412aca9d08d65c240c94f3 | 6c3334d5b73749a2045ae038e71a0003ba5f6139 | refs/heads/master | 2022-06-20T17:34:48.041188 | 2022-06-04T21:52:39 | 2022-06-04T21:52:39 | 4,752,073 | 0 | 0 | NOASSERTION | 2022-06-04T21:52:40 | 2012-06-22T14:36:17 | Java | UTF-8 | Java | false | false | 2,856 | java | /**
* Copyright (c) 2009-2012, Lukas Eder, [email protected]
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq;
/**
* A type that can dynamically implement another interface.
* <p>
* This interface is for JOOQ INTERNAL USE only. Do not reference directly
*
* @author Lukas Eder
*/
public interface Adapter {
/**
* Adapt to an internal type assuming its functionality
* <p>
* This is for JOOQ INTERNAL USE only. If you need to access the internal
* API, these are the known possible interfaces:
* <ul>
* <li> {@link QueryPartInternal}: The internal API for {@link QueryPart}</li>
* </ul>
* Be aware though, that the internal API may change even between minor
* releases.
*
* @param <I> The internal type's generic type parameter.
* @param internalType The internal type
* @return This object wrapped by or cast to an internal type
* @throws ClassCastException If this object cannot be wrapped by or cast to
* the given internal type
*/
<I> I internalAPI(Class<I> internalType) throws ClassCastException;
}
| [
"[email protected]"
]
| |
052afe5b7a29714dcf8c095e17fefbce0c484626 | 22ed4dde01f723ffc9092d0d1a996f21966c130e | /src/main/java/su/comm/model/commDAOImple.java | bbc14dbfabe06d0cd15b5a7b2317eb7d94037e00 | []
| no_license | rnans/carpoolparty | c2128058f143f48a9d95e340b5a87af3bf704ae2 | 8cefab19b45c3254eefe19cc2294ce81f10159e3 | refs/heads/master | 2020-09-13T08:57:31.927817 | 2016-06-14T20:54:06 | 2016-06-14T20:54:06 | 67,114,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,010 | java | package su.comm.model;
import java.util.HashMap;
import java.util.List;
import org.mybatis.spring.SqlSessionTemplate;
import su.pool.model.PoolDTO;
import su.upload.model.UploadDTO;
public class commDAOImple implements commDAO {
private SqlSessionTemplate sqlMap;
private int arr[];
public commDAOImple(SqlSessionTemplate sqlMap) {
super();
this.sqlMap = sqlMap;
}
//comm 글쓰기
public int commWrite(commBBSDTO dto) {
int count =sqlMap.insert("commWrite",dto);
return count;
}
//글 띄우기
public List<commBBSDTO> bbsList(String poolname){
List<commBBSDTO> list=sqlMap.selectList("bbsList", poolname);
return list;
}
//search
public List<commBBSDTO> bbsserch(String search, String poolname){
HashMap map=new HashMap();
map.put("search", search);
map.put("poolname", poolname);
List<commBBSDTO> list= sqlMap.selectList("bbssearch", map);
return list;
}
public int scheWrite(scheDTO dto) {
System.out.println(dto.getStartday());
int count =sqlMap.insert("scheWrite", dto);
return count;
}
//reply
public int reWrite(CommBBSreDTO dto){
int count=sqlMap.insert("reWrite", dto);
return count;
}
public List<CommBBSreDTO> reList(String commid){
List<CommBBSreDTO> list=sqlMap.selectList("reList", commid);
return list;
}
public int redel(String idx){
int count = sqlMap.delete("redel", idx);
return count;
}
//스케쥴글 띄우기
public List<scheDTO> scheList(String poolname){
List<scheDTO> list=sqlMap.selectList("scheList", poolname);
return list;
}
//커뮤니티 member
public List<carpoolinfoDTO> commMemberList(String poolname) {
List<carpoolinfoDTO> list = sqlMap.selectList("commmember", poolname);
return list;
}
public int bbsdel(String idx){
int count = sqlMap.delete("commbbsdel", idx);
return count;
}
public int bbsupdate(String idx){
System.out.println(idx);
int count = sqlMap.update("bbsupdate", idx);
return count;
}
public int bbsupdate2(String idx){
System.out.println(idx);
int count = sqlMap.update("bbsupdate2", idx);
return count;
}
public int upload(UploadDTO dto) {
int count=sqlMap.insert("imguploadcomm",dto);
return count;
}
public List<UploadDTO> imgList(String poolname){
List<UploadDTO> list=sqlMap.selectList("commimgList", poolname);
return list;
}
public List<UploadDTO> imgList2(){
List<UploadDTO> list=sqlMap.selectList("profileList");
return list;
}
public List<carpoolinfoDTO> poollist(String id){
List<carpoolinfoDTO> list=sqlMap.selectList("poollist", id);
return list;
}
public List<PoolDTO> carlist(String poolname){
List<PoolDTO> list=sqlMap.selectList("carlist", poolname);
return list;
}
public String carimg2(int caridx){
String carimg=sqlMap.selectOne("carimg2", caridx);
return carimg;
}
}
| [
"rnans13@45730098-6432-0510-a106-c033c7f6614a"
]
| rnans13@45730098-6432-0510-a106-c033c7f6614a |
faebcd6d2fb595dfd6b65eff8b4b92861c65aa7a | a86cddf19affdf3c3c697fda857f5694a0dd8e70 | /app/src/main/java/com/zeroami/youliao/presenter/activity/SplashPresenter.java | 60d7633c888efea0f62bf5b86cc643f287e95531 | [
"Apache-2.0"
]
| permissive | zerozblin/YouLiao | f010f92fd693840fda4120016b50c9600485758a | 242200a2d23229d8e2c6ff1831f705ed23b9028d | refs/heads/master | 2022-04-26T13:55:03.044859 | 2017-06-08T08:09:30 | 2017-06-08T08:09:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,515 | java | package com.zeroami.youliao.presenter.activity;
import com.zeroami.commonlib.mvp.LBasePresenter;
import com.zeroami.commonlib.utils.LAppUtils;
import com.zeroami.commonlib.utils.LRUtils;
import com.zeroami.youliao.R;
import com.zeroami.youliao.contract.activity.SplashContract;
import com.zeroami.youliao.model.IUserModel;
import com.zeroami.youliao.model.real.UserModel;
/**
* <p>作者:Zeroami</p>
* <p>邮箱:[email protected]</p>
* <p>描述:闪屏页Presenter</p>
*/
public class SplashPresenter extends LBasePresenter<SplashContract.View,IUserModel> implements SplashContract.Presenter{
public SplashPresenter(SplashContract.View view) {
super(view);
}
@Override
protected IUserModel createRealModel() {
return new UserModel();
}
@Override
protected IUserModel createTestModel() {
return null;
}
@Override
public void doViewInitialized() {
if (getMvpModel().getExitAppStatus()){ // 当前为退出状态,显示闪屏页
String versionName = String.format(LRUtils.getString(R.string.format_version_name), LAppUtils.getVerionName());
getMvpView().setVersionName(versionName);
getMvpView().startAnimation();
}else{
doGoto();
}
}
@Override
public void doGoto() {
// 判断是否登陆
if (getMvpModel().getLoginStatus()){
getMvpView().gotoMain();
}else{
getMvpView().gotoLogin();
}
}
}
| [
"[email protected]"
]
| |
afac28a784402ad18ae087606f08a75b94fe5794 | d3e92f8d99b794c277752aaebac949397e27a039 | /src/main/java/br/com/eluminum/repository/PlanetRepository.java | 563d98b4afac6654eb62f3b31761f56cdb74dd59 | []
| no_license | leonardogloria/api-starwars | 2f50e9667bbfd46cd2139c1673058e470c5a92d6 | 7585030698868a36e33a8c2d32f53c467c2baf20 | refs/heads/master | 2020-04-03T23:46:22.479143 | 2018-10-31T22:18:05 | 2018-10-31T22:18:05 | 155,630,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package br.com.eluminum.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import br.com.eluminum.model.Planet;
@Repository
public interface PlanetRepository extends CrudRepository<Planet, Long> {
}
| [
"A5B7alfazulu"
]
| A5B7alfazulu |
f8af24a42f7518329a942e999a372fb55a61c3e8 | 2f49e2f63dea85d62aa1a56b12d103d8bab0bee3 | /EasyMPermission/test/transform/resource/after-ecj/GenerateSuppressFBWarnings.java | 407d41b67e84d1b4cfb3dbb5b733a91ffe3d7c69 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | mobmead/EasyMPermission | 9837a0bbb1c6f6b33a6905fd7e60ffb921484b27 | e373737c4c9d9494a25f3700654022c155d027fc | refs/heads/master | 2021-01-18T20:30:06.222457 | 2015-11-12T17:45:18 | 2015-11-12T17:45:18 | 39,174,977 | 62 | 12 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | class GenerateSuppressFBWarnings {
@lombok.Getter int y;
GenerateSuppressFBWarnings() {
super();
}
public @java.lang.SuppressWarnings("all") @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(justification = "generated code") @javax.annotation.Generated("lombok") int getY() {
return this.y;
}
} | [
"[email protected]"
]
| |
ecb0016b6b01e5ceb73630843cb45e317e1c13ce | 29ec18aaf1fc9fca5e35848f2f0e89bc11361193 | /bdms-root/.svn/pristine/f1/f1f936659e3c9ebb5ced27fdf1323045f01eb49c.svn-base | c534e4f4fd8fdb11e0dd149161b4a5ed45c80193 | []
| no_license | ichoukou/bdms-root | 847417eb2950a11f39e5b85d9f22755d1d1bb5f3 | e64302419f4f51bf4fdf372ec340776c859755aa | refs/heads/master | 2020-04-19T18:37:02.777154 | 2018-02-27T06:22:34 | 2018-02-27T06:22:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,074 | package com.bdms.dams.wifi.service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import com.bdms.hbase.service.HbaseService;
import com.bdms.hbse.enums.ResultType;
import com.bdms.hbse.enums.Wifi2Meta;
import com.bdms.dams.criterion.service.CriterionService;
import com.bdms.dams.util.AxisUtil;
import com.bdms.dams.wifi.dao.WifiDataDao;
import com.bdms.entity.dams.Criterion;
import com.bdms.entity.dams.WifiData;
@Service("wifiDataService")
public class WifiDataServiceImpl implements WifiDataService{
private static final Logger LOG = LoggerFactory.getLogger(WifiDataServiceImpl.class);
@PersistenceContext
private EntityManager entityManager;
@Autowired
private WifiDataDao wifiDataDao;
@Autowired
private HbaseService hbaseService;
@Autowired
private CriterionService criterionService;
private final static String wifiMysqlConfigPropertiesPath = "system/wifimysql-config.properties";
static PropertiesConfiguration propertiesConfig=null;
@Override
public List<WifiData> getStations() {
// TODO Auto-generated method stub
return wifiDataDao.findAll();
}
public Map<String, Object> getWifi2DayDataForHighchart(String apNameAndTimeStr)
{
Map<String,Object> result = new HashMap<String,Object>();
List<Map<String, Object>> dayData = hbaseService.getWifi2DayData(apNameAndTimeStr, Arrays.asList(Wifi2Meta.TIME,Wifi2Meta.MACOUNT,Wifi2Meta.NUM));
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
try {
propertiesConfig=new PropertiesConfiguration(wifiMysqlConfigPropertiesPath);
} catch (ConfigurationException e1) {
e1.printStackTrace();
}
String multFactor=propertiesConfig.getString("wifi.data.multiple");
if( !dayData.isEmpty() ){
List<long[]> data = new ArrayList<long[]>();
long[] point = null;
String time = null;
String count = null;
String num = null;
long c = 0;
for(Map<String,Object> map : dayData )
{
point = new long[2];
time = (String) map.get(Wifi2Meta.TIME.getName());
count = (String) map.get(Wifi2Meta.MACOUNT.getName());
num = (String) map.get(Wifi2Meta.NUM.getName());
if( time != null)
{
try
{
point[0] = format.parse(time).getTime();
if(count == null || null == num)
{
c=0;
}
else
{
c = (Long.parseLong(count))/(Long.parseLong(num))*Long.parseLong(multFactor);
}
point[1] = c;
data.add(point);
}
catch (ParseException e)
{
LOG.error( "时间字串 " +time + " 转成 日期失败。", e);
}
}
}
result.put("data", data);
}
setYAxis(result,apNameAndTimeStr.split("-")[0].toString(),ResultType.WIFIDATA);
return result;
}
private void setYAxis( Map<String, Object> data,String station_id,ResultType rt){
String type = null;
boolean isStation = true;
if(station_id.contains("631422656")){
switch (rt) {
case WIFIDATA:
type = "wifiData";
break;
default:
type = "wifiData";
break;
}
}
Criterion criter = criterionService.findByCodeAndType(station_id, type);
String level = criter.getLevel();
if(level == null ){
LOG.error("数据库中 station_id为" + station_id + "的level字段为空");
}
String[] split = level.split(",");
int begin = 0;
String yAxis = "";
//wifi
yAxis = AxisUtil.getYAxis(String.valueOf(begin),split[0],split[0],split[1],split[1],split[2],split[2],String.valueOf(Integer.MAX_VALUE));
data.put("yAxis", yAxis);
}
/**
*
按照apname获取wifiData表的全部数据
*/
@Override
public List<WifiData> getwifiDataTotal(final String apname) {
Specification<WifiData> specification = new Specification<WifiData>()
{
@Override
public Predicate toPredicate(Root<WifiData> root,
CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> predicate = new ArrayList<>();
if(apname!=" ")
{
predicate.add(cb.equal(
root.get("apname").as(String.class),
apname));
}
Predicate[] pre = new Predicate[predicate.size()];
return query.where(predicate.toArray(pre)).getRestriction();
}
};
return wifiDataDao.findAll(specification);
}
}
| [
"[email protected]"
]
| ||
c27c118aface87ad64cbb3aa6be16bc4465c9188 | 3c49f0766779f1c4b5865b0a70f82ab790d9866a | /02branches/kxoa/src/main/java/com/centit/oa/dao/OaSurveyDao.java | 9a65b6e638bce9ec4a7710dc2bfe44c8cc782fa8 | []
| no_license | laoqianlaile/xwoa | bfa9e64ca01e9333efbc5602b41c1816f1fa746e | fe8a618ff9c0ddfcb8b51bc9d6786e2658b62fa1 | refs/heads/master | 2022-01-09T23:27:17.273124 | 2019-05-21T08:35:34 | 2019-05-21T08:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,426 | java | package com.centit.oa.dao;
import java.util.HashMap;
import java.util.Map;
import com.centit.core.dao.CodeBook;
import com.centit.core.dao.BaseDaoImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.centit.oa.po.OaSurvey;
public class OaSurveyDao extends BaseDaoImpl<OaSurvey> {
private static final long serialVersionUID = 1L;
public static final Log log = LogFactory.getLog(OaSurveyDao.class);
public Map<String, String> getFilterField() {
if (filterField == null) {
filterField = new HashMap<String, String>();
filterField.put("djid", CodeBook.EQUAL_HQL_ID);
filterField.put("title", CodeBook.LIKE_HQL_ID);
filterField.put("reType", CodeBook.EQUAL_HQL_ID);
filterField.put("remark", CodeBook.LIKE_HQL_ID);
filterField.put("begtime", CodeBook.LIKE_HQL_ID);
filterField.put("endtime", CodeBook.LIKE_HQL_ID);
filterField.put("creater", CodeBook.LIKE_HQL_ID);
filterField.put("createtime", CodeBook.LIKE_HQL_ID);
filterField.put("createRemark", CodeBook.LIKE_HQL_ID);
filterField.put("createDepno", CodeBook.LIKE_HQL_ID);
filterField.put("thesign", CodeBook.EQUAL_HQL_ID);
filterField.put("sendusers", CodeBook.LIKE_HQL_ID);
filterField.put("isautoend", CodeBook.EQUAL_HQL_ID);
filterField.put("isviewresult", CodeBook.EQUAL_HQL_ID);
filterField.put("isbookn", CodeBook.EQUAL_HQL_ID);
// 调查开始时间
filterField.put("begtimeBegin",
" begtime >= to_date(?,'yyyy-MM-dd hh24:mi:ss')");
filterField.put("begtimeEnd",
" begtime <= to_date(?,'yyyy-MM-dd hh24:mi:ss')");
// 调查结束时间
filterField.put("endtimeBegin",
" endtime >= to_date(?,'yyyy-MM-dd hh24:mi:ss')");
filterField.put("endtimeEnd",
" endtime <= to_date(?,'yyyy-MM-dd hh24:mi:ss')");
filterField.put("NP_thesign", " thesign != '4' ");
}
return filterField;
}
/**
* 系統自動結束調查
*/
public void autoEnd() {
doExecuteHql("update OaSurvey t set t.thesign='3' where t.isautoend ='Y' and t.thesign not in ('3','4') and t.endtime<=sysdate ");
}
}
| [
"[email protected]"
]
| |
c0be5971a95c4204d730d72c00f03f1c6b835087 | 01db70801023dbd4f5079135fd58c07148862636 | /DawnLightTube/src/zang/liguang/tube/activity/ChannelActivity.java | 49e84fb959be4a710cd4ce61c852821043611e9b | []
| no_license | zangliguang/DawnLightTube | 0a1cb77a1164168c4d5a74091ef095faceaf51f4 | 05f697c757e32335ad7215e732c82df219e3b5c4 | refs/heads/master | 2021-01-10T00:57:54.563362 | 2015-10-12T09:39:07 | 2015-10-12T09:39:07 | 44,094,848 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 12,806 | java | package zang.liguang.tube.activity;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.UiThread;
import org.androidannotations.annotations.ViewById;
import org.json.JSONObject;
import zang.liguang.tube.LiGuangApplication;
import zang.liguang.tube.R;
import zang.liguang.tube.adapter.DragAdapter;
import zang.liguang.tube.adapter.OtherAdapter;
import zang.liguang.tube.bean.YouTubeVideoCatgoryModle;
import zang.liguang.tube.bean.ChannelManage;
import zang.liguang.tube.http.WebConstant;
import zang.liguang.tube.utils.LocalConstant;
import zang.liguang.tube.utils.Utils;
import zang.liguang.tube.wedget.DragGrid;
import zang.liguang.tube.wedget.OtherGridView;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
/**
* 频道管理
*/
@EActivity(R.layout.channel)
public class ChannelActivity extends BaseActivity implements OnItemClickListener
{
public static String TAG = "ChannelActivity";
/** 用户栏目的GRIDVIEW */
private DragGrid userGridView;
/** 其它栏目的GRIDVIEW */
private OtherGridView otherGridView;
/** 用户栏目对应的适配器,可以拖动 */
DragAdapter userAdapter;
/** 其它栏目对应的适配器 */
OtherAdapter otherAdapter;
/** 其它栏目列表 */
List<YouTubeVideoCatgoryModle> otherChannelList = new ArrayList<YouTubeVideoCatgoryModle>();
/** 用户栏目列表 */
List<YouTubeVideoCatgoryModle> userChannelList = new ArrayList<YouTubeVideoCatgoryModle>();
/** 是否在移动,由于这边是动画结束后才进行的数据更替,设置这个限制为了避免操作太频繁造成的数据错乱。 */
boolean isMove = false;
@ViewById(R.id.local_chanel_edit)
EditText localChanelEditText;
@ViewById(R.id.add_local_chanel_btn)
Button addLocalChanelBtn;
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.channel);
// try {
// initView();
// initData();
// } catch (Exception e) {ss
// e.printStackTrace();
// }
// }
@Click(R.id.add_local_chanel_btn)
public void AddLocalChanel(View view) {
if(!TextUtils.isEmpty(localChanelEditText.getText().toString())){
YouTubeVideoCatgoryModle channel=new YouTubeVideoCatgoryModle();
channel.setChannelId(LocalConstant.local);
channel.setAssignable(false);
channel.setTitle(localChanelEditText.getText().toString());
channel.setHl(Utils.GetLanguage(this).toString());
channel.setOrderid(userAdapter.getCount());
channel.setSelected(true);
channel.setVideoCategoryId(localChanelEditText.getText().toString());
try
{
LiGuangApplication.getApp().getDatabaseHelper().getYouTubeVideoCatgoryModleDao().createOrUpdate(channel);
userAdapter.addItem(channel);
userAdapter.notifyDataSetChanged();
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
Toast.makeText(this, "请填写自定义频道名称", Toast.LENGTH_SHORT).show();
}
}
/** 初始化布局 */
@AfterViews
void initView()
{
userGridView = (DragGrid) findViewById(R.id.userGridView);
otherGridView = (OtherGridView) findViewById(R.id.otherGridView);
initData();
}
/** 初始化数据 */
@Background
void initData()
{
try
{
userChannelList = LiGuangApplication.getApp().getDatabaseHelper().getYouTubeVideoCatgoryModleDao().queryBuilder().orderBy("orderid", true).where()
.eq("selected", true).query();
otherChannelList = LiGuangApplication.getApp().getDatabaseHelper().getYouTubeVideoCatgoryModleDao().queryBuilder().orderBy("orderid", true).where()
.eq("selected", false).query();
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
setData();
}
@UiThread
void setData()
{
userAdapter = new DragAdapter(this, userChannelList);
userGridView.setAdapter(userAdapter);
otherAdapter = new OtherAdapter(this, otherChannelList);
otherGridView.setAdapter(otherAdapter);
// 设置GRIDVIEW的ITEM的点击监听
otherGridView.setOnItemClickListener(this);
userGridView.setOnItemClickListener(this);
}
/** GRIDVIEW对应的ITEM点击监听接口 */
@Override
public void onItemClick(AdapterView<?> parent, final View view, final int position, long id)
{
// 如果点击的时候,之前动画还没结束,那么就让点击事件无效
if (isMove)
{
return;
}
switch (parent.getId())
{
case R.id.userGridView:
// position为 0,1 的不可以进行任何操作
final ImageView moveImageView = getView(view);
if (moveImageView != null)
{
TextView newTextView = (TextView) view.findViewById(R.id.text_item);
final int[] startLocation = new int[2];
newTextView.getLocationInWindow(startLocation);
final YouTubeVideoCatgoryModle channel = ((DragAdapter) parent.getAdapter()).getItem(position);// 获取点击的频道内容
if(channel.getChannelId().equals(LocalConstant.local)){
try
{
LiGuangApplication.getApp().getDatabaseHelper().getYouTubeVideoCatgoryModleDao().delete(channel);
userAdapter.setRemove(position);
userAdapter.remove();
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
{
otherAdapter.setVisible(false);
// 添加到最后一个
channel.setSelected(false);
otherAdapter.addItem(channel);
new Handler().postDelayed(new Runnable()
{
@Override
public void run()
{
try
{
int[] endLocation = new int[2];
// 获取终点的坐标
otherGridView.getChildAt(otherGridView.getLastVisiblePosition()).getLocationInWindow(endLocation);
moveAnim(moveImageView, startLocation, endLocation, channel, userGridView);
userAdapter.setRemove(position);
LiGuangApplication.getApp().getDatabaseHelper().getYouTubeVideoCatgoryModleDao().update(channel);
// ChannelManage.getManage(LiGuangApplication.getApp().getSQLHelper())
// .updateChannel(
// channel, "0");
}
catch (Exception localException)
{
}
}
}, 50L);
}
}
break;
case R.id.otherGridView:
final ImageView moveImageView2 = getView(view);
if (moveImageView2 != null)
{
TextView newTextView = (TextView) view.findViewById(R.id.text_item);
final int[] startLocation = new int[2];
newTextView.getLocationInWindow(startLocation);
final YouTubeVideoCatgoryModle channel = ((OtherAdapter) parent.getAdapter()).getItem(position);
userAdapter.setVisible(false);
// 添加到最后一个
channel.setSelected(true);
userAdapter.addItem(channel);
new Handler().postDelayed(new Runnable()
{
@Override
public void run()
{
try
{
int[] endLocation = new int[2];
// 获取终点的坐标
userGridView.getChildAt(userGridView.getLastVisiblePosition()).getLocationInWindow(endLocation);
moveAnim(moveImageView2, startLocation, endLocation, channel, otherGridView);
otherAdapter.setRemove(position);
LiGuangApplication.getApp().getDatabaseHelper().getYouTubeVideoCatgoryModleDao().update(channel);
}
catch (Exception localException)
{
}
}
}, 50L);
}
break;
default:
break;
}
}
/**
* 点击ITEM移动动画
*
* @param moveView
* @param startLocation
* @param endLocation
* @param moveChannel
* @param clickGridView
*/
private void moveAnim(View moveView, int[] startLocation, int[] endLocation, final YouTubeVideoCatgoryModle moveChannel, final GridView clickGridView)
{
// 将当前栏目增加到改变过的listview中 若栏目已经存在删除点,不存在添加进去
int[] initLocation = new int[2];
// 获取传递过来的VIEW的坐标
moveView.getLocationInWindow(initLocation);
// 得到要移动的VIEW,并放入对应的容器中
final ViewGroup moveViewGroup = getMoveViewGroup();
final View mMoveView = getMoveView(moveViewGroup, moveView, initLocation);
// 创建移动动画
TranslateAnimation moveAnimation = new TranslateAnimation(startLocation[0], endLocation[0], startLocation[1], endLocation[1]);
moveAnimation.setDuration(300L);// 动画时间
// 动画配置
AnimationSet moveAnimationSet = new AnimationSet(true);
moveAnimationSet.setFillAfter(false);// 动画效果执行完毕后,View对象不保留在终止的位置
moveAnimationSet.addAnimation(moveAnimation);
mMoveView.startAnimation(moveAnimationSet);
moveAnimationSet.setAnimationListener(new AnimationListener()
{
@Override
public void onAnimationStart(Animation animation)
{
isMove = true;
}
@Override
public void onAnimationRepeat(Animation animation)
{
}
@Override
public void onAnimationEnd(Animation animation)
{
moveViewGroup.removeView(mMoveView);
// instanceof 方法判断2边实例是不是一样,判断点击的是DragGrid还是OtherGridView
if (clickGridView instanceof DragGrid)
{
otherAdapter.setVisible(true);
otherAdapter.notifyDataSetChanged();
userAdapter.remove();
}
else
{
userAdapter.setVisible(true);
userAdapter.notifyDataSetChanged();
otherAdapter.remove();
}
isMove = false;
}
});
}
/**
* 获取移动的VIEW,放入对应ViewGroup布局容器
*
* @param viewGroup
* @param view
* @param initLocation
* @return
*/
private View getMoveView(ViewGroup viewGroup, View view, int[] initLocation)
{
int x = initLocation[0];
int y = initLocation[1];
viewGroup.addView(view);
LinearLayout.LayoutParams mLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
mLayoutParams.leftMargin = x;
mLayoutParams.topMargin = y;
view.setLayoutParams(mLayoutParams);
return view;
}
/**
* 创建移动的ITEM对应的ViewGroup布局容器
*/
private ViewGroup getMoveViewGroup()
{
ViewGroup moveViewGroup = (ViewGroup) getWindow().getDecorView();
LinearLayout moveLinearLayout = new LinearLayout(this);
moveLinearLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
moveViewGroup.addView(moveLinearLayout);
return moveLinearLayout;
}
/**
* 获取点击的Item的对应View,
*
* @param view
* @return
*/
private ImageView getView(View view)
{
view.destroyDrawingCache();
view.setDrawingCacheEnabled(true);
Bitmap cache = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);
ImageView iv = new ImageView(this);
iv.setImageBitmap(cache);
return iv;
}
/** 退出时候保存选择后数据库的设置 */
void saveChannel()
{
ChannelManage.getManage(LiGuangApplication.getApp().getSQLHelper()).deleteAllChannel();
// ChannelManage.getManage(LiGuangApplication.getApp().getSQLHelper()).saveUserChannel(
// userAdapter.getChannnelLst());
// ChannelManage.getManage(LiGuangApplication.getApp().getSQLHelper()).saveOtherChannel(
// otherAdapter.getChannnelLst());
}
@Override
public void onResume()
{
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void finish()
{
super.finish();
if (userAdapter.isListChanged())
{
YouTubeVideoCatgoryModle ycm;
for (int i = 0; i < userAdapter.getChannnelLst().size(); i++)
{
ycm = userAdapter.getChannnelLst().get(i);
ycm.setOrderid(i);
try
{
LiGuangApplication.getApp().getDatabaseHelper().getYouTubeVideoCatgoryModleDao().update(ycm);
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
MainActivity_.isChange = true;
// saveChannel();
Log.d(TAG, "数据发生改变");
}
}
}
| [
"[email protected]"
]
| |
8ab5530aab813d233a6c9e894a585991c62ebc12 | 3d70d731345a9fe3f5fb8ff0f8ab1a2eff4168a0 | /src/main/java/com/contafood/util/enumeration/Mese.java | 4beaec597c2cf70996405b1ff3dbc093a055629d | []
| no_license | fabiosantambrogio84/contafood | 798913dfbe22a6d59de2e15e5a01793b05053f5c | 71ac744194ec2ad56c64a22c46d9b71cf68619a5 | refs/heads/master | 2023-08-05T22:59:51.744185 | 2023-07-21T11:42:53 | 2023-07-21T11:42:53 | 194,842,660 | 0 | 0 | null | 2023-06-14T22:37:31 | 2019-07-02T10:33:29 | Java | UTF-8 | Java | false | false | 626 | java | package com.contafood.util.enumeration;
import java.util.Arrays;
public enum Mese {
M_0("Gennaio"),
M_1("Febbraio"),
M_2("Marzo"),
M_3("Aprile"),
M_4("Maggio"),
M_5("Giugno"),
M_6("Luglio"),
M_7("Agosto"),
M_8("Settembre"),
M_9("Ottobre"),
M_10("Novembre"),
M_11("Dicembre");
private String label;
Mese(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
public static Mese get(int month){
return Arrays.stream(Mese.values()).filter(m -> m.name().equals("M_"+month)).findFirst().get();
}
}
| [
"[email protected]"
]
| |
38b7e7b102dbbfaa2d3a4dd6dd06296935cbe657 | d24544cd4e238884a6675d4550c0c98a94dfff2e | /vertx-auth-htpasswd/src/main/java/examples/AuthHtpasswdExamples.java | e404c1b34e560b25a78181b5141d58b275129261 | [
"Apache-2.0"
]
| permissive | jcasbin/vertx-auth | 2ddc5ff8fab808efd1406b511e2726c1134b4c5c | afc956502e78e619d83964e43d7d235c966565e5 | refs/heads/master | 2021-06-13T10:57:27.217507 | 2021-03-07T11:36:50 | 2021-03-07T11:36:50 | 133,805,583 | 1 | 1 | Apache-2.0 | 2021-03-07T11:36:51 | 2018-05-17T11:45:55 | Java | UTF-8 | Java | false | false | 1,836 | java | /*
* Copyright 2014 Red Hat, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package examples;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.auth.User;
import io.vertx.ext.auth.htpasswd.HtpasswdAuth;
import io.vertx.ext.auth.htpasswd.HtpasswdAuthOptions;
/**
* @author Neven Radovanović
*/
public class AuthHtpasswdExamples {
public void example1(Vertx vertx) {
HtpasswdAuth authProvider = HtpasswdAuth.create(vertx, new HtpasswdAuthOptions());
}
public void example2(HtpasswdAuth authProvider) {
JsonObject authInfo = new JsonObject()
.put("username", "someUser")
.put("password", "somePassword");
authProvider.authenticate(authInfo, res -> {
if (res.succeeded()) {
User user = res.result();
} else {
// Failed!
}
});
}
public void example3(Vertx vertx) {
HtpasswdAuth authProviderUsersAuthorizedForNothing = HtpasswdAuth.create(vertx, new HtpasswdAuthOptions().setUsersAuthorizedForEverything(false));
HtpasswdAuth authProviderUsersAuthorizedForEverything = HtpasswdAuth.create(vertx, new HtpasswdAuthOptions().setUsersAuthorizedForEverything(true));
}
public void example4(User user) {
user.isAuthorised("anyAuthority", res -> {
if (res.succeeded()) {
boolean hasRole = res.result();
} else {
// Failed
}
});
}
}
| [
"[email protected]"
]
| |
9a95146de64809f5248e1e352ac465bb9567dc9d | 1c1d4ae86a6daa85eb13cc9f918602e93f1a7cfe | /Assignment 3/G7_Assignment3/PROJECT/G7_Assignment3-Project/G7_Assignment3-Project_Server/src/server/ClientDB.java | abb9d3a0ae10d82be88e65365c1586ab79b9c02f | []
| no_license | oreliyahu1/GCM-Global-City-Map | 85f39949b6a9219f406cc0ca2a9c6387899d1fa7 | 742671901eba35e4b4c4c4bb0a3d051624497606 | refs/heads/master | 2022-01-15T03:34:25.341829 | 2022-01-13T03:01:31 | 2022-01-13T03:01:31 | 200,386,387 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,838 | java |
package server;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicReference;
import entities.Database;
import entities.Packet;
import javafx.util.Pair;
import server.database.MySQLConnection;
import server.database.ResponseException;
import server.database.requestHandler.*;
// TODO: Auto-generated Javadoc
/**
* The Class ClientDB.
* Extends MySQLConnection
* Singleton class
*/
public class ClientDB extends MySQLConnection {
//Mysql jdbc error codes
//https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-error-sqlstates.html
/** The instance. */
private static ClientDB instance;
/** The request handler. */
private HashMap<String, AbstractRequest> requestHandler;
/**
* Instantiates a new client DB.
*
* @param dbConfig the db config
*/
private ClientDB(Database dbConfig) {
super(dbConfig);
this.requestHandler = new HashMap<String, AbstractRequest>();
requestHandler.put(config.packetTransfer.actions.Home.WINDOW, new Home(config.packetTransfer.actions.Home.WINDOW, this));
requestHandler.put(config.packetTransfer.actions.Catalog.WINDOW, new Catalog(config.packetTransfer.actions.Catalog.WINDOW, this));
requestHandler.put(config.packetTransfer.actions.EditCatalog.WINDOW, new EditCatalog(config.packetTransfer.actions.EditCatalog.WINDOW, this));
requestHandler.put(config.packetTransfer.actions.Notification.WINDOW, new Notification(config.packetTransfer.actions.Notification.WINDOW, this));
requestHandler.put(config.packetTransfer.actions.ManageRequests.WINDOW, new ManageRequests(config.packetTransfer.actions.ManageRequests.WINDOW, this));
requestHandler.put(config.packetTransfer.actions.Rate.WINDOW, new Rate(config.packetTransfer.actions.Rate.WINDOW, this));
requestHandler.put(config.packetTransfer.actions.Profile.WINDOW, new Profile(config.packetTransfer.actions.Profile.WINDOW, this));
requestHandler.put(config.packetTransfer.actions.ManageUsers.WINDOW, new ManageUsers(config.packetTransfer.actions.ManageUsers.WINDOW, this));
requestHandler.put(config.packetTransfer.actions.Activity.WINDOW, new Activity(config.packetTransfer.actions.Activity.WINDOW, this));
requestHandler.put(config.packetTransfer.actions.Purchase.WINDOW, new Purchase(config.packetTransfer.actions.Purchase.WINDOW,this));
requestHandler.put(config.packetTransfer.actions.Download.WINDOW, new Download(config.packetTransfer.actions.Download.WINDOW,this));
requestHandler.put(config.packetTransfer.actions.ExternalMap.WINDOW, new Download(config.packetTransfer.actions.ExternalMap.WINDOW,this)); //FOR EXTERNAL MAP
requestHandler.put(config.packetTransfer.actions.DailyReport.WINDOW, new DailyReport(config.packetTransfer.actions.DailyReport.WINDOW,this)); //FOR EXTERNAL MAP
requestHandler.put(config.packetTransfer.actions.Search.WINDOW, new Search(config.packetTransfer.actions.Search.WINDOW,this)); //FOR EXTERNAL MAP
}
/**
* Gets the client DB.
* Singleton creator
* @param dbConfig the db config
* @return the client DB
*/
public static ClientDB getClientDB(Database dbConfig) {
if(ClientDB.instance == null)
ClientDB.instance = new ClientDB(dbConfig);
return ClientDB.instance;
}
/* (non-Javadoc)
* @see server.database.MySQLConnection#Connect()
*/
@Override
public boolean Connect() {
System.out.println("ClientDB: Trying to connect mysql");
try {
super.ConnectSchema();
initializationSchemaTables();
System.out.println("ClientDB: Connect successful");
return true;
} catch (SQLException ex) {/* handle any errors*/
System.out.println("ClientDB: SQLException " + ex.getMessage());
System.out.println("ClientDB: SQLState " + ex.getSQLState());
System.out.println("ClientDB: VendorError " + ex.getErrorCode());
//ER_BAD_DB_ERROR 1049
if(ex.getErrorCode() == 1049) {
if(createSchema())
if(Connect()) return true; //prevents recursion (return Connect())
}
} catch (Exception ex) {
System.out.println("ClientDB: Error " + ex);
}
return false;
}
/* (non-Javadoc)
* @see server.database.MySQLConnection#CloseConnection()
*/
@Override
public boolean CloseConnection() {
System.out.println("ClientDB: Trying close mysql connection");
try {
ClientDB.instance = null;
if(super.CloseConnection()) {
System.out.println("ClientDB: Close successful");
return true;
}
return true;
} catch (SQLException ex) {/* handle any errors*/
System.out.println("ClientDB: SQLException " + ex.getMessage());
System.out.println("ClientDB: SQLState " + ex.getSQLState());
System.out.println("ClientDB: VendorError " + ex.getErrorCode());
} catch (Exception ex) {
System.out.println("ClientDB: Error " + ex);
}
return false;
}
/**
* Insert from CSV.
* insert the data into sql tables
*
* @param csvFile the csv file
*/
private void insertFromCSV(String csvFile) {
ArrayList<String> columns = new ArrayList<String>();
ArrayList<String> list = new ArrayList<String>();
try (Scanner scanner = new Scanner(new File(csvFile), "UTF-8");) {
while (scanner.hasNextLine()) {
list.add(scanner.nextLine());
}
if(list.isEmpty())
return;
String[] vals = list.get(0).split(",");
for(int i = 0; i<vals.length; i++)
columns.add(vals[i]);
String query = String.format("INSERT INTO `%s`(%s) values (%s)", csvFile.substring(csvFile.lastIndexOf('\\') + 1,csvFile.lastIndexOf('.')),
String.format("`%s`", String.join("`, `", columns)),
String.join(", ", Collections.nCopies(columns.size(), "?")));
list.remove(0);
ArrayList<String> Wvals = new ArrayList<String>();
for(String row : list) {
String[] tvals = row.split(",");
for(int i = 0; i<tvals.length; i++)
Wvals.add(tvals[i]);
for(int i=0; i<columns.size()-tvals.length; i++)
Wvals.add("");
try {
super.executeQuery(query, Wvals);
} catch (SQLException ex) {/* handle any errors*/
System.out.println("ClientDB: SQLException " + ex.getMessage());
System.out.println("ClientDB: SQLState " + ex.getSQLState());
System.out.println("ClientDB: VendorError " + ex.getErrorCode());
}
Wvals.clear();
}
}catch(Exception ex) {
System.out.println("ClientDB: Error read " + csvFile);
}
}
/**
* Initialization schema tables.
*/
private void initializationSchemaTables() {
System.out.println("ClientDB: create db tables");
for(String tableQuery : config.database.Schema.createTableQuery()) {
try {
super.executeQuery(tableQuery);
} catch (SQLException ex) {/* handle any errors*/
System.out.println("ClientDB: cannot connect create tables");
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
} catch (Exception ex) {
System.out.println("ClientDB: Error" + ex.getMessage());
}
}
}
/**
* Initialization DB tables.
*
* @param initFolder the init folder
*/
public void initializationDBTables(File initFolder) {
System.out.println("ClientDB: load db tables from " + initFolder);
for(Pair<String, Map<String, String>> table : config.database.Schema.TABLES) {
File tablecsv = new File(initFolder.getAbsolutePath() + String.format("/%s.csv", table.getKey()));
if(tablecsv.exists()) {
System.out.println("ClientDB: insert csv file: " + tablecsv.getPath());
insertFromCSV(tablecsv.getPath());
}else
System.out.println("ClientDB: error csv file not found: " + tablecsv.getPath());
}
}
/**
* Creates the schema.
*
* @return true, if create scheme successfully
*/
public boolean createSchema() {
System.out.println("ClientDB: Trying to create schema");
try {
super.Connect();
super.executeQuery(String.format("CREATE SCHEMA %s", config.database.Schema.DB_SCHEMA_NAME));
System.out.println("ClientDB: Schema created successfully");
super.CloseConnection();
return true;
} catch (SQLException ex) {/* handle any errors*/
System.out.println("ClientDB: SQLException " + ex.getMessage());
System.out.println("ClientDB: SQLState " + ex.getSQLState());
System.out.println("ClientDB: VendorError " + ex.getErrorCode());
} catch (Exception ex) {
System.out.println("ClientDB: Error " + ex);
}
return false;
}
/**
* Execute SQL query.
*
* Get packet and send it to sub-request handler to continue execute according to packet window value
*
* @param refPackeet the ref packeet
* @return the response packet
* @throws IOException Signals that an I/O exception has occurred.
*/
public Packet.ACTION_TYPE executeSQLQuery(AtomicReference<Packet<?>> refPackeet) throws IOException{
try {
AbstractRequest reqHandler = requestHandler.get(refPackeet.get().getWindow());
if(reqHandler == null)
throw new IOException();
refPackeet.set(reqHandler.execute(refPackeet.get()));
return Packet.ACTION_TYPE.RESPONSE_SUCCESS;
} catch(IOException ioe){
return Packet.ACTION_TYPE.FATAL_ERROR;
}
catch(SQLException ex) {
System.out.println("ClientDB SQLException: " + ex.getMessage());
System.out.println("ClientDB SQLState: " + ex.getSQLState());
return Packet.ACTION_TYPE.RESPONSE_ERROR;
} catch (ResponseException e) {
return Packet.ACTION_TYPE.RESPONSE_ERROR;
}
}
}
| [
"[email protected]"
]
| |
c701d4d4c686656b537ab74533888fcbc81f4d31 | 6b2704e84a28ad04267d925019b8614a235ffbf8 | /zabbix-probes/zabbix-probes-common/src/main/java/com/indigo/zabbix/utils/beans/CmdbResponse.java | f34957356d76cc6b2473faa2cddb50ee07630a7d | [
"Apache-2.0"
]
| permissive | indigo-dc/Monitoring | 6edf4185ab476777a1d194ef458de9b2ad1682ea | b55f9db97e9ba0fa1d6d5c81bb6440f41ea4e0e4 | refs/heads/master | 2022-10-15T13:02:46.563058 | 2020-05-11T13:35:34 | 2020-05-11T13:35:34 | 59,824,167 | 5 | 3 | Apache-2.0 | 2022-10-05T18:47:09 | 2016-05-27T09:49:55 | Java | UTF-8 | Java | false | false | 666 | java | package com.indigo.zabbix.utils.beans;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by jose on 8/02/17.
*/
public class CmdbResponse<T> {
@SerializedName("total_rows")
Integer totalRows;
Integer offset;
List<T> rows;
public Integer getTotalRows() {
return totalRows;
}
public void setTotalRows(Integer totalRows) {
this.totalRows = totalRows;
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public List<T> getRows() {
return rows;
}
public void setRows(List<T> rows) {
this.rows = rows;
}
}
| [
"[email protected]"
]
| |
fd84e8e81f09ef4f9fec9fd302c9667cf286fa32 | 64bd2e15862a9754baf970dc0dda09bedd528462 | /core/vegvisirCore/src/main/java/com/vegvisir/core/blockdag/ReconciliationEndListener.java | 869c0bf54d85764c7df59e08ca0ec09e89377595 | []
| no_license | Vegvisir-IoT/vegvisir-android | ef0295220a1b9d9d6a90a31e850d15d51c8a3c6a | 5cecc63380c3f37db1f8bc0dd9d6992855210a60 | refs/heads/master | 2022-12-05T11:01:01.089903 | 2020-05-20T16:49:43 | 2020-05-20T16:49:43 | 290,855,057 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 117 | java | package com.vegvisir.core.blockdag;
public interface ReconciliationEndListener {
void onReconciliationEnd();
}
| [
"[email protected]"
]
| |
ecc20fa091e34dda9e72ebfb441ea7c7f62aec8c | 6633aa07a19003c80b9a4c4c32783d6f6ade71d6 | /HTML/src/com/jdbc/util/DatabaseTools.java | f20be9e863fefdf5ab0f92c4db8bb699f925fd89 | []
| no_license | SuspectCat/day-075-servlet | 86b56d515f8315479e212210ed1779bd5bc249d4 | 5098740eee5d5b99905cbd91f77128a8e12839e8 | refs/heads/main | 2023-09-01T19:56:41.825005 | 2021-10-08T11:59:07 | 2021-10-08T11:59:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,292 | java | package com.jdbc.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DatabaseTools {
static {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static Connection getConnection() {
Connection connection = null;
try {
connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/day_41", "root", "rootroot");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return connection;
}
public static Statement getStatement(Connection connection) {
Statement statement = null;
try {
statement = connection.createStatement();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return statement;
}
public static void close(Connection connection, Statement statement, ResultSet resultSet) {
try {
if (null != resultSet) resultSet.close();
if (null != statement) statement.close();
if (null != connection) connection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.