blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
920b5363d06f884c8b1831c7cc1feb508833742b | f0785bdab94bb06534bc7f3780907b7068ec498a | /EnTrAgOsCR2/ClashRoyale1/src/main/java/com/example/demo/models/entity/Role.java | 596ccfae229ced29158bd41145fff5a8917ffd10 | [] | no_license | Noodle96/ECOMMERCE_ENTRAGOS | fd7d2a9c2b18d606fe3c6cca29b5b013112b3c58 | 70ce75fdf8532bed18582e1bcc7c132c4a41f6d3 | refs/heads/master | 2022-12-22T21:15:51.337950 | 2020-09-29T21:20:07 | 2020-09-29T21:20:07 | 288,248,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | package com.example.demo.models.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
@Entity
@Table(name = "authorities", uniqueConstraints= {@UniqueConstraint(columnNames= {"user_id", "authority"})})
public class Role implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String authority;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAuthority() {
return authority;
}
public void setAuthority(String authority) {
this.authority = authority;
}
/**
*
*/
private static final long serialVersionUID = 1L;
} | [
"jorgealfredomarino2@gmail.com"
] | jorgealfredomarino2@gmail.com |
dc75c2ca791efc0ba968c9f30d794f67d956b296 | 8a1cd8112689c465a2b2f36de64be19f19d4c8cf | /src/gromecode/lesson26/hw/Order.java | 603b5ee8770495dcb3ba70e983a09e5af53cf66e | [] | no_license | Sedzay/java-core-grom | 2f22cb70775318d85ad0e2f0b16e49f33c6a3331 | e592ce7bd548dc16df9d105f25f55f14f6a547fa | refs/heads/master | 2020-04-23T17:50:07.785367 | 2019-05-10T19:27:53 | 2019-05-10T19:27:53 | 171,098,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,139 | java | package gromecode.lesson26.hw;
public class Order {
private long id;
private int price;
private String currency;
private String itemName;
private String shopIdentificator;
public Order(long id, int price, String currency, String itemName, String shopIdentificator) {
this.id = id;
this.price = price;
this.currency = currency;
this.itemName = itemName;
this.shopIdentificator = shopIdentificator;
}
public long getId() {
return id;
}
public int getPrice() {
return price;
}
public String getCurrency() {
return currency;
}
public String getItemName() {
return itemName;
}
public String getShopIdentificator() {
return shopIdentificator;
}
@Override
public String toString() {
return "Order{" +
"id=" + id +
", price=" + price +
// ", currency='" + currency + '\'' +
// ", itemName='" + itemName + '\'' +
// ", shopIdentificator='" + shopIdentificator + '\'' +
'}';
}
}
| [
"es281082@ukr.net"
] | es281082@ukr.net |
90d68e4b382f5c7d5a829eee9028aaa42bf281b2 | 46f325eb2a570aaaf4e051e23890168900db86c9 | /src/main/java/com/example/wbdvf20serverjava/services/HelloWorldService.java | d5c8288be2c411d61d9347777ee5ad2e2dd2e8a3 | [
"CC0-1.0"
] | permissive | cfreifeld/wbdv-f20-server-java | 0e3b500c15bb07d4938c8f6e275a6b2e08346554 | e5cec17485e1251615ccbb598317460ecc8b0970 | refs/heads/master | 2023-01-10T16:31:06.858789 | 2020-11-06T14:26:33 | 2020-11-06T14:26:33 | 295,821,562 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,457 | java | package com.example.wbdvf20serverjava.services;
import com.example.wbdvf20serverjava.models.Message;
import com.example.wbdvf20serverjava.models.MessageRepository;
import com.example.wbdvf20serverjava.models.User;
import com.example.wbdvf20serverjava.models.UserRepository;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@CrossOrigin(origins = {"http://localhost:3000", "https://slovenly-panda-123456.herokuapp.com"})
public class HelloWorldService {
List<Message> messages = new ArrayList<>();
private MessageRepository messageRepository;
private UserRepository userRepository;
@Autowired // "inversion of control"
public HelloWorldService(MessageRepository rep, UserRepository ur) {
this.messageRepository = rep;
this.userRepository = ur;
}
@GetMapping("/hello") // this is a "route"
public String hello() {
return "Hello, world.";
}
@GetMapping("/hello/{name}")
public String sayHello(@RequestParam("message") String msg,
@PathVariable("name") String name) {
return "Hello, " + name + ": " + msg;
}
@GetMapping("/api/messages")
public List<Message> getMessages() {
//return messages;
//return (List<Message>) repository.findAll();
return messageRepository.findAllMessages();
}
@GetMapping("/api/messages/{messageId}")
public Message getMessages(@PathVariable("messageId") Integer messageId) {
//return messages;
//Optional<Message> msg = repository.findById(messageId);
//return msg.orElse(null);
return messageRepository.findMessageById(messageId);
}
@PostMapping("/api/messages")
public @ResponseBody Message createMessage(@RequestBody Message newMessage) {
newMessage.setDate(new Date());
//messages.add(newMessage);
User u = userRepository.findUserById(newMessage.getUser().getId());
if (u != null) {
newMessage.setUser(u);
}
messageRepository.save(newMessage);
return newMessage;
}
@DeleteMapping("/api/messages/{messageId}")
public Integer deleteMessage(@PathVariable("messageId") Integer messageId) {
//messageRepository.delete(messageId);
messageRepository.deleteById(messageId);
return messageId;
}
@GetMapping("/api/users")
public List<User> getUsers() {
return userRepository.findAllUsers();
}
@GetMapping("/api/session/set/{attr}/{value}")
public String setSessionAttribute(
@PathVariable("attr") String attr,
@PathVariable("value") String value,
HttpSession session) {
session.setAttribute(attr, value);
return attr + " = " + value;
}
@GetMapping("/api/session/set/{attr}")
public String getSessionAttribute(
@PathVariable("attr") String attr,
HttpSession session) {
return String.valueOf(session.getAttribute(attr));
}
}
| [
"ccf@ccs.neu.edu"
] | ccf@ccs.neu.edu |
55666f0f791e0949e37dd3f39d681e9e4e7b26a4 | 51e007eb29a50269f26cc2e9c0a2e5296885cadf | /app/src/main/java/com/example/animalscheltersapp/Animal.java | 47cb99581d817a5bb1ca43cdf3bb9b2da754fc07 | [] | no_license | Vrezer/AnimalScheltersApp | 194e8f9c581092f7c337932c52977d80276fd12c | afff7f916e6948ac64093774d7cc357a225a14c2 | refs/heads/master | 2023-02-21T16:43:29.556638 | 2021-01-21T15:27:48 | 2021-01-21T15:27:48 | 259,651,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,642 | java | package com.example.animalscheltersapp;
public class Animal {
private String Name;
private String Age;
private String Breed;
private String Sex;
private String Description;
private String UrlPicture;
private String id;
private String date;
public String getUrlPicture() {
return UrlPicture;
}
public void setUrlPicture(String urlPicture) {
UrlPicture = urlPicture;
}
public Animal(String name, String age, String breed, String sex, String description, String urlPicture, String id, String date) {
Name = name;
Age = age;
Breed = breed;
Sex = sex;
Description = description;
UrlPicture = urlPicture;
this.id = id;
this.date = date;
}
public String getDate() {
return date;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getAge() {
return Age;
}
public void setAge(String age) {
Age = age;
}
public String getBreed() {
return Breed;
}
public void setBreed(String breed) {
Breed = breed;
}
public String getSex() {
return Sex;
}
public void setSex(String sex) {
Sex = sex;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
public Animal()
{}
}
| [
"44469941+Vrezer@users.noreply.github.com"
] | 44469941+Vrezer@users.noreply.github.com |
c05b351b2b9bb9bfd5a07e40b69c954518f6377c | f1a18df84420f0a9232b59c743e025a99045cef3 | /src/main/java/au/com/tyo/io/Indexable.java | 86637e81a82834d29be5eb59f8a2c01e30e4d7a9 | [] | no_license | tyolab/CommonUtils | 5a9e8c3ed76a578f036a33fddbfe241324210fe6 | 382a361a0eadde513e91f2bbea6b6d39c38d2bc9 | refs/heads/master | 2022-03-05T13:00:56.284819 | 2022-02-23T02:43:45 | 2022-02-23T02:43:45 | 44,956,627 | 1 | 1 | null | 2018-04-05T02:49:24 | 2015-10-26T08:54:09 | Java | UTF-8 | Java | false | false | 175 | java | package au.com.tyo.io;
/**
* Created by Eric Tang (eric.tang@tyo.com.au) on 23/8/17.
*/
public interface Indexable {
int getIndex();
void setIndex(int index);
}
| [
"deve@tyo.com.au"
] | deve@tyo.com.au |
10e3524f54e305b626b3bb681249ed474b54d713 | 8e07781c81a2f4ff86007e719001460cbac437ec | /src/RDPCrystalEDILibrary/UI/Winforms/Controls/ValidationUnit.java | 70d4b158522065897af0fa7b49b575e80c7241a9 | [] | no_license | Javonet-io-user/5994062e-dae1-428d-958c-d47924bf8e91 | e6c06ceadb6a18bb128bf98ec7bebd900a85b07f | 10d1ed8e34c3fc7e42362e691f173a788896a25d | refs/heads/master | 2020-04-07T21:54:46.900678 | 2018-11-22T20:11:26 | 2018-11-22T20:11:26 | 158,746,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,518 | java | package RDPCrystalEDILibrary.UI.Winforms.Controls;
import Common.Activation;
import static Common.Helper.Convert;
import static Common.Helper.getGetObjectName;
import static Common.Helper.getReturnObjectName;
import static Common.Helper.ConvertToConcreteInterfaceImplementation;
import Common.Helper;
import com.javonet.Javonet;
import com.javonet.JavonetException;
import com.javonet.JavonetFramework;
import com.javonet.api.NObject;
import com.javonet.api.NEnum;
import com.javonet.api.keywords.NRef;
import com.javonet.api.keywords.NOut;
import com.javonet.api.NControlContainer;
import java.util.concurrent.atomic.AtomicReference;
import java.lang.*;
import jio.System.Windows.Forms.*;
import RDPCrystalEDILibrary.UI.Winforms.Controls.*;
import jio.System.Drawing.*;
import RDPCrystalEDILibrary.*;
import jio.System.*;
public class ValidationUnit extends UserControl {
protected NObject javonetHandle;
/** SetProperty */
public void setPreventInfiniteLoopWhileSearching(java.lang.Boolean value) {
try {
javonetHandle.set("PreventInfiniteLoopWhileSearching", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getPreventInfiniteLoopWhileSearching() {
try {
return javonetHandle.get("PreventInfiniteLoopWhileSearching");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setTrackDownUnrecognizedLoops(java.lang.Boolean value) {
try {
javonetHandle.set("TrackDownUnrecognizedLoops", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getTrackDownUnrecognizedLoops() {
try {
return javonetHandle.get("TrackDownUnrecognizedLoops");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setTrimString(java.lang.String value) {
try {
javonetHandle.set("TrimString", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.String getTrimString() {
try {
return (java.lang.String) javonetHandle.get("TrimString");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return "";
}
}
/** SetProperty */
public void setAutoDetectDelimiters(java.lang.Boolean value) {
try {
javonetHandle.set("AutoDetectDelimiters", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getAutoDetectDelimiters() {
try {
return javonetHandle.get("AutoDetectDelimiters");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setEDIRuleFile(java.lang.String value) {
try {
javonetHandle.set("EDIRuleFile", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.String getEDIRuleFile() {
try {
return (java.lang.String) javonetHandle.get("EDIRuleFile");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return "";
}
}
/** SetProperty */
public void setEDIFile(java.lang.String value) {
try {
javonetHandle.set("EDIFile", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.String getEDIFile() {
try {
return (java.lang.String) javonetHandle.get("EDIFile");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return "";
}
}
/** SetProperty */
public void setShowFileGridLines(java.lang.Boolean value) {
try {
javonetHandle.set("ShowFileGridLines", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getShowFileGridLines() {
try {
return javonetHandle.get("ShowFileGridLines");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setShowErrorGridLines(java.lang.Boolean value) {
try {
javonetHandle.set("ShowErrorGridLines", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getShowErrorGridLines() {
try {
return javonetHandle.get("ShowErrorGridLines");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setShowWarningGridLines(java.lang.Boolean value) {
try {
javonetHandle.set("ShowWarningGridLines", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getShowWarningGridLines() {
try {
return javonetHandle.get("ShowWarningGridLines");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setCheckDataTypeRequirements(java.lang.Boolean value) {
try {
javonetHandle.set("CheckDataTypeRequirements", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getCheckDataTypeRequirements() {
try {
return javonetHandle.get("CheckDataTypeRequirements");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setEDIFileBackColor(Color value) {
try {
javonetHandle.set("EDIFileBackColor", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public Color getEDIFileBackColor() {
try {
return new Color((NObject) javonetHandle.<NObject>get("EDIFileBackColor"));
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return null;
}
}
/** SetProperty */
public void setEDIFileForeColor(Color value) {
try {
javonetHandle.set("EDIFileForeColor", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public Color getEDIFileForeColor() {
try {
return new Color((NObject) javonetHandle.<NObject>get("EDIFileForeColor"));
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return null;
}
}
/** SetProperty */
public void setErrorTableBackColor(Color value) {
try {
javonetHandle.set("ErrorTableBackColor", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public Color getErrorTableBackColor() {
try {
return new Color((NObject) javonetHandle.<NObject>get("ErrorTableBackColor"));
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return null;
}
}
/** SetProperty */
public void setErrorTableForeColor(Color value) {
try {
javonetHandle.set("ErrorTableForeColor", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public Color getErrorTableForeColor() {
try {
return new Color((NObject) javonetHandle.<NObject>get("ErrorTableForeColor"));
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return null;
}
}
/** SetProperty */
public void setWarningTableBackColor(Color value) {
try {
javonetHandle.set("WarningTableBackColor", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public Color getWarningTableBackColor() {
try {
return new Color((NObject) javonetHandle.<NObject>get("WarningTableBackColor"));
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return null;
}
}
/** SetProperty */
public void setWarningTableForeColor(Color value) {
try {
javonetHandle.set("WarningTableForeColor", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public Color getWarningTableForeColor() {
try {
return new Color((NObject) javonetHandle.<NObject>get("WarningTableForeColor"));
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return null;
}
}
/** SetProperty */
public void setSuppressValidationCompleteMessage(java.lang.Boolean value) {
try {
javonetHandle.set("SuppressValidationCompleteMessage", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getSuppressValidationCompleteMessage() {
try {
return javonetHandle.get("SuppressValidationCompleteMessage");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setDelimiters(Delimiters value) {
try {
javonetHandle.set("Delimiters", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public Delimiters getDelimiters() {
try {
return new Delimiters((NObject) javonetHandle.<NObject>get("Delimiters"));
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return null;
}
}
/** SetProperty */
public void setEDIFileType(FileType value) {
try {
javonetHandle.set("EDIFileType", NEnum.fromJavaEnum(value));
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public FileType getEDIFileType() {
try {
return FileType.valueOf(((NEnum) javonetHandle.<NEnum>get("EDIFileType")).getValueName());
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return null;
}
}
/** SetProperty */
public void setLoadFile(java.lang.Boolean value) {
try {
javonetHandle.set("LoadFile", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getLoadFile() {
try {
return javonetHandle.get("LoadFile");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** GetProperty */
public java.lang.Integer getNumberOfErrors() {
try {
return javonetHandle.get("NumberOfErrors");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return 0;
}
}
/** GetProperty */
public java.lang.Integer getNumberOfWarnings() {
try {
return javonetHandle.get("NumberOfWarnings");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return 0;
}
}
/** SetProperty */
public void setHideLoadDataSection(java.lang.Boolean value) {
try {
javonetHandle.set("HideLoadDataSection", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getHideLoadDataSection() {
try {
return javonetHandle.get("HideLoadDataSection");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setShowProgressSection(java.lang.Boolean value) {
try {
javonetHandle.set("ShowProgressSection", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getShowProgressSection() {
try {
return javonetHandle.get("ShowProgressSection");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setShowFileInputSection(java.lang.Boolean value) {
try {
javonetHandle.set("ShowFileInputSection", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getShowFileInputSection() {
try {
return javonetHandle.get("ShowFileInputSection");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
/** SetProperty */
public void setHideEDIFIleSection(java.lang.Boolean value) {
try {
javonetHandle.set("HideEDIFIleSection", value);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** GetProperty */
public java.lang.Boolean getHideEDIFIleSection() {
try {
return javonetHandle.get("HideEDIFIleSection");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
return false;
}
}
public ValidationUnit() {
super((NObject) null);
try {
javonetHandle = Javonet.New("RDPCrystalEDILibrary.UI.Winforms.Controls.ValidationUnit");
super.setJavonetHandle(javonetHandle);
javonetHandle.addEventListener(
"ErrorOccurred",
new com.javonet.api.INEventListener() {
@Override
public void eventOccurred(Object[] objects) {
for (ErrorEvent handler : _ErrorOccurredListeners) {
handler.Invoke(
Convert(objects[0], Object.class), Convert(objects[1], GeneralEventArgs.class));
}
}
});
javonetHandle.addEventListener(
"ValidationButtonClicked",
new com.javonet.api.INEventListener() {
@Override
public void eventOccurred(Object[] objects) {
for (ValidationButtonClickedEvent handler : _ValidationButtonClickedListeners) {
handler.Invoke(Convert(objects[0], Object.class));
}
}
});
javonetHandle.addEventListener(
"ValidationCompleted",
new com.javonet.api.INEventListener() {
@Override
public void eventOccurred(Object[] objects) {
for (ValidationCompletedEvent handler : _ValidationCompletedListeners) {
handler.Invoke(
Convert(objects[0], Object.class),
Convert(objects[1], ValidationEventsArgs.class));
}
}
});
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
public ValidationUnit(NObject handle) {
super(handle);
this.javonetHandle = handle;
}
public void setJavonetHandle(NObject handle) {
this.javonetHandle = handle;
}
/** Method */
public void ValidateFile() {
try {
javonetHandle.invoke("ValidateFile");
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** Method */
public void ExportToCSV(java.lang.String filePath) {
try {
javonetHandle.invoke("ExportToCSV", filePath);
} catch (JavonetException _javonetException) {
_javonetException.printStackTrace();
}
}
/** Event */
private java.util.ArrayList<ErrorEvent> _ErrorOccurredListeners =
new java.util.ArrayList<ErrorEvent>();
public void addErrorOccurred(ErrorEvent toAdd) {
_ErrorOccurredListeners.add(toAdd);
}
public void removeErrorOccurred(ErrorEvent toRemove) {
_ErrorOccurredListeners.remove(toRemove);
}
/** Event */
private java.util.ArrayList<ValidationButtonClickedEvent> _ValidationButtonClickedListeners =
new java.util.ArrayList<ValidationButtonClickedEvent>();
public void addValidationButtonClicked(ValidationButtonClickedEvent toAdd) {
_ValidationButtonClickedListeners.add(toAdd);
}
public void removeValidationButtonClicked(ValidationButtonClickedEvent toRemove) {
_ValidationButtonClickedListeners.remove(toRemove);
}
/** Event */
private java.util.ArrayList<ValidationCompletedEvent> _ValidationCompletedListeners =
new java.util.ArrayList<ValidationCompletedEvent>();
public void addValidationCompleted(ValidationCompletedEvent toAdd) {
_ValidationCompletedListeners.add(toAdd);
}
public void removeValidationCompleted(ValidationCompletedEvent toRemove) {
_ValidationCompletedListeners.remove(toRemove);
}
public interface ValidationButtonClickedEvent {
public void Invoke(Object sender);
}
public interface ValidationCompletedEvent {
public void Invoke(Object sender, ValidationEventsArgs e);
}
public interface ErrorEvent {
public void Invoke(Object sender, GeneralEventArgs e);
}
static {
try {
Activation.initializeJavonet();
} catch (java.lang.Exception e) {
e.printStackTrace();
}
}
}
| [
"support@javonet.com"
] | support@javonet.com |
2ed5e6d7d6938d50d2642693c371f0d68cf67f86 | 298f0760d324e23ddf19ae61aadde6bd7f8e8cb1 | /commerceshopesystem-user/src/main/java/com/koalin/commerceshopesystem/user/mapper/UmsMemberReceiveAddressMapper.java | b4f692d9fe980ea0c3b3d49b0faf780ab1de09ba | [] | no_license | GaoLinHuang/commerceshopesystem | ddac038259628d0bec0584b77f186ac09f5f2246 | 28ca3c8a0e99a91e233cc4e1cf7eb5efb6863d61 | refs/heads/master | 2022-09-13T12:43:51.263700 | 2020-02-15T11:37:03 | 2020-02-15T11:37:03 | 240,174,549 | 0 | 0 | null | 2022-09-01T23:20:19 | 2020-02-13T04:12:26 | Java | UTF-8 | Java | false | false | 535 | java | package com.koalin.commerceshopesystem.user.mapper;
import com.koalin.commerceshopesystem.bean.UmsMemberReceiveAddress;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* @version 1.0
* @IinterfaceName UmsMemberReceiveAddressMapper
* @Author koalin
* @Description //TODO UmsMemberReceiveAddressMapper的描述
* @Date 2020/2/13 23:49
*/
public interface UmsMemberReceiveAddressMapper extends Mapper<UmsMemberReceiveAddress> {
List<UmsMemberReceiveAddress> getReciveAddressByMemverId(String memberId);
}
| [
"1037000546@qq.com"
] | 1037000546@qq.com |
03832c39b2f646b6d3f598dd3c2df78453fa3a23 | cffdb47f2d727d7ef339e1aab97b8b8ff993bb05 | /app/src/main/java/com/bojansovtic/flickrviewer/GetRawData.java | 737bd7f035c532970e81450e4938024fafc695e2 | [] | no_license | BojanSovtic/Flickr-Viewer | f62b90dddf9632adb091dbd05f2f27db6ec3548d | 91a6b638b02ea018b87eb31a9b71d2270c65668c | refs/heads/master | 2022-12-10T07:40:45.972525 | 2020-09-05T02:09:02 | 2020-09-05T02:09:02 | 292,983,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,990 | java | package com.bojansovtic.flickrviewer;
import android.os.AsyncTask;
import android.util.Log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
enum DownloadStatus { IDLE, PROCESSING, NOT_INITIALISED, FAILED_OR_EMPTY, OK }
class GetRawData extends AsyncTask<String, Void, String> {
private static final String TAG = "GetRawData";
private DownloadStatus downloadStatus;
private final OnDownloadComplete callback;
interface OnDownloadComplete {
void onDownloadComplete(String data, DownloadStatus status);
}
public GetRawData(OnDownloadComplete callback) {
this.downloadStatus = DownloadStatus.IDLE;
this.callback = callback;
}
void runInSameThread(String s) {
if (callback != null) {
callback.onDownloadComplete(doInBackground(s), downloadStatus);
}
}
@Override
protected void onPostExecute(String s) {
if (callback != null) {
callback.onDownloadComplete(s, downloadStatus);
}
}
@Override
protected String doInBackground(String... strings) {
HttpURLConnection connection = null;
BufferedReader reader = null;
if(strings == null) {
downloadStatus = DownloadStatus.NOT_INITIALISED;
return null;
}
try {
downloadStatus = DownloadStatus.PROCESSING;
URL url = new URL(strings[0]);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
int response = connection.getResponseCode();
StringBuilder result = new StringBuilder();
reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
result.append(line).append("\n");
}
downloadStatus = DownloadStatus.OK;
return result.toString();
} catch(MalformedURLException e) {
Log.e(TAG, "doInBackground: Ivnvalid URL " + e.getMessage());
} catch(IOException e) {
Log.e(TAG, "doInBackground: IO Exception reading data " + e.getMessage());
} catch(SecurityException e) {
Log.e(TAG, "doInBackground: Security Exception. Needs permission? " + e.getMessage());
} finally {
if(connection != null) {
connection.disconnect();
}
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
Log.e(TAG, "doInBackground: Error closing stream " + e.getMessage());
}
}
}
downloadStatus = DownloadStatus.FAILED_OR_EMPTY;
return null;
}
}
| [
"bojansovtic92@gmail.com"
] | bojansovtic92@gmail.com |
579011061985a0308b8ad49751230efd30a353d3 | 2e3870ec74be3d5284130e60a0852a7d4479d296 | /app/src/main/java/com/ming/androblog/utils/NewsUtil.java | 0fb1e6b7f18f56fd3ffb6af05abd1c7df1be1bb6 | [] | no_license | markhuang0521/AndroBlog | ebc89d1e659f953f2e6e3d06a3c0fea413dbc2d0 | 3ab8298eea0ce2edbd5374d6928716868ac6ae55 | refs/heads/master | 2022-12-22T21:41:24.837176 | 2020-10-04T02:15:11 | 2020-10-04T02:15:11 | 301,022,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,496 | java | package com.ming.androblog.utils;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import org.ocpsoft.prettytime.PrettyTime;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Random;
public class NewsUtil {
public static ColorDrawable[] vibrantLightColorList =
{
new ColorDrawable(Color.parseColor("#ffeead")),
new ColorDrawable(Color.parseColor("#93cfb3")),
new ColorDrawable(Color.parseColor("#fd7a7a")),
new ColorDrawable(Color.parseColor("#faca5f")),
new ColorDrawable(Color.parseColor("#1ba798")),
new ColorDrawable(Color.parseColor("#6aa9ae")),
new ColorDrawable(Color.parseColor("#ffbf27")),
new ColorDrawable(Color.parseColor("#d93947"))
};
public static ColorDrawable getRandomDrawbleColor() {
int idx = new Random().nextInt(vibrantLightColorList.length);
return vibrantLightColorList[idx];
}
public static String DateToTimeFormat(String oldstringDate) {
PrettyTime p = new PrettyTime(new Locale(getCountry()));
String isTime = null;
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'",
Locale.ENGLISH);
Date date = sdf.parse(oldstringDate);
isTime = p.format(date);
} catch (ParseException e) {
e.printStackTrace();
}
return isTime;
}
public static String DateFormat(String oldstringDate) {
String newDate;
SimpleDateFormat dateFormat = new SimpleDateFormat("E, d MMM yyyy", new Locale(getCountry()));
try {
Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(oldstringDate);
newDate = dateFormat.format(date);
} catch (ParseException e) {
e.printStackTrace();
newDate = oldstringDate;
}
return newDate;
}
public static String getCountry() {
Locale locale = Locale.getDefault();
String country = String.valueOf(locale.getCountry());
return country.toLowerCase();
}
public static String getLanguage() {
Locale locale = Locale.getDefault();
String language = String.valueOf(locale.getLanguage());
return language;
}
}
| [
"markhuang286@gmail.com"
] | markhuang286@gmail.com |
c301a6d25103318eb66ad1974ed5730e223be8ce | 206d8141cef2532abc5d8afab3d13615924a3701 | /src/test/java/guru/springframwork/blog/BlogApplicationTests.java | e55ef1058855466c5f795649d11075bbbb45c3a0 | [] | no_license | JunweiZ/springbatch-mairaDB-demo | b6079e17cac04ba2b58c456fe6b9dcbdc41802a4 | 12d3e470f7fb026495584b41eca0241f85bc704a | refs/heads/master | 2022-11-29T00:25:22.571669 | 2020-08-12T23:39:39 | 2020-08-12T23:39:39 | 287,136,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package guru.springframwork.blog;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BlogApplicationTests {
@Test
void contextLoads() {
}
}
| [
"Junwei.Zhou@zetes.com"
] | Junwei.Zhou@zetes.com |
5e02134a5d49c635ea92890517d3236e3d567b09 | dad1b8a22509967eed6f194b8e32bbe141020fe5 | /Legist-master/src/main/java/com/legist/myapp/service/FileService.java | 835e83ca76b07c6f35109ee13efea6a61c08210d | [] | no_license | Vakatr/LegistCP | 1e09b3eb52f30a070ec90fd730d4673da6e1ecca | 6aabdc2a306f6e045ea46fa0262773f593258264 | refs/heads/main | 2023-05-03T06:36:54.201865 | 2021-06-02T12:03:13 | 2021-06-02T12:03:13 | 337,154,573 | 2 | 1 | null | 2021-03-20T12:37:40 | 2021-02-08T17:27:51 | Java | UTF-8 | Java | false | false | 429 | java | package com.legist.myapp.service;
import com.legist.myapp.model.FileInfo;
import org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
public interface FileService {
FileInfo upload(MultipartFile resource) throws IOException;
Resource download(String key) throws IOException;
FileInfo findByKey(String key);
FileInfo findById(Long fileId);
}
| [
"40803132+Vakatr@users.noreply.github.com"
] | 40803132+Vakatr@users.noreply.github.com |
ded4e11b4f691a91cac3ec965de25fd898fe43a5 | 8eb73462cab1d2835a498d5ce55469404ef43aab | /src/main/java/ru/itpark/Main.java | 992714c4608bc1c228a6220ec62a9a55c0a244ec | [] | no_license | dilyarakhabibullina/houses | 67afb65891aed14b84e4dcc59a01dbbd4446e440 | e70f8daff7e02b6144244d33a63194d2b4111f04 | refs/heads/master | 2020-08-21T05:11:01.163324 | 2019-11-04T05:13:47 | 2019-11-04T05:13:47 | 216,100,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 956 | java | package ru.itpark;
import ru.itpark.domain.House;
import ru.itpark.service.HouseService;
public class Main {
public static void main(String[] args) {
HouseService houseService = new HouseService();
houseService.add(new House(1, 3, "Новосавиновский", "прекрасная квартира", 4_000_000));
houseService.add(new House(2, 100, "Новосавиновский", "ужасная квартира", 10_000_000));
houseService.add(new House(3, 5, "Вахитовский", "лучшее место на земле", 12_000_000));
houseService.add(new House(4, 1, "Голливуд", "неплохое местечко", 15_000_000));
houseService.add(new House(5, 4, "Беверли-Хиллз", "великолепное место", 1_500_000_000));
System.out.println(houseService.searchByDistrict());
System.out.println(houseService.searchByPrice());
}
}
| [
"khdilyara@rambler.ru"
] | khdilyara@rambler.ru |
d229dbc464dee9df3ef83bea6d89a4c6e05f5339 | 3a61c3c8ea3e8a347cac7519fe678bcd280ad3e8 | /app/src/main/java/org/thakur/ayush/notes/RecyclerTouchListener.java | 6e3028293d651eeae661512aa80c6c3800a87e93 | [] | no_license | ayush1266/Notes | cacbd2569d9544289d753e7c921d86651e900089 | 61b455958af50ae934bc39825c6272d6a989eb3c | refs/heads/master | 2020-03-22T00:47:40.180055 | 2018-06-30T17:03:56 | 2018-06-30T17:03:56 | 139,265,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,869 | java | package org.thakur.ayush.notes;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
/**
* Created by win on 13-06-2018.
*/
public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener {
private ClickListener clicklistener;
private GestureDetector gestureDetector;
public RecyclerTouchListener(Context context, final RecyclerView recycleView, final ClickListener clicklistener) {
this.clicklistener = clicklistener;
gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapUp(MotionEvent e) {
return true;
}
@Override
public void onLongPress(MotionEvent e) {
View child = recycleView.findChildViewUnder(e.getX(), e.getY());
if (child != null && clicklistener != null) {
clicklistener.onLongClick(child, recycleView.getChildAdapterPosition(child));
}
}
});
}
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
View child = rv.findChildViewUnder(e.getX(), e.getY());
if (child != null && clicklistener != null && gestureDetector.onTouchEvent(e)) {
clicklistener.onClick(child, rv.getChildAdapterPosition(child));
}
return false;
}
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
public interface ClickListener {
void onClick(View view, int position);
void onLongClick(View view, int position);
}
} | [
"ayushthakurcool10@gmail.com"
] | ayushthakurcool10@gmail.com |
ccbbfd003641b774398c0484503bc681c080608e | 5305982331c6dc136cbb78d4a615126efcb28616 | /src/forestalreportes/nombreCientifico.java | a119fd6e10e455163d12e2bac1af2000eadcba17 | [] | no_license | jacabaji/forestalReports | ece72b253ef24cf630ab9b322f2e80cb99f7a8f3 | 110b5631d1578d0eb61696060fb74aee9e6f792a | refs/heads/master | 2021-01-25T08:49:35.072356 | 2014-04-07T23:41:38 | 2014-04-07T23:41:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package forestalreportes;
/*
* 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 JBarajas
*/
public class nombreCientifico {
public String nombreCien;
public String nombreVulgar;
}
| [
"jacabaji@gmail.com"
] | jacabaji@gmail.com |
7cf10a1e10a19e47b1b575bd75a5e3c93398929b | 09810fc60b0d6e68df6bfa49652be078e5bfefd9 | /module3/src/demo2/CodeGym/Module2/modu/src/VongLapJava/bai_tap/HienThiCacLoaiHinh.java | 3faa11d90708fa9f4a74d2727bed99138fcf7124 | [] | no_license | C0920G1-NguyenQuangHoaiLinh/C0920G1-NguyenQuangHoaiLinh | 18323fe752648daa7acaad0aa567c16d5ca30804 | 21f2061dc0e5df53dfdec73381b3b65a5e81e841 | refs/heads/master | 2023-03-29T21:22:50.560687 | 2021-04-07T04:43:15 | 2021-04-07T04:43:15 | 297,220,239 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,422 | java | package VongLapJava.bai_tap;
import java.util.Scanner;
public class HienThiCacLoaiHinh {
public static void main(String[] args){
int height ;
Scanner sc = new Scanner(System.in);
//Hình chữ nhật
do {
System.out.println("height = ");
height = sc.nextInt();
}while(height <= 0);
for (int i = 0; i < height; i++){
for(int j = 0; j < 5; j++){
System.out.print(" * ");
}
System.out.println(" ");
}
//Hình tam giác vuông, có cạnh góc vuông ở botton-left
System.out.println(" ");
for(int i=1; i<=5; i++){
for(int j=1; j<i; j++){
System.out.print(" * ");
}
System.out.println(" ");
}
//Hình tam giác vuông, có cạnh góc vuông ở top-left
System.out.println(" ");
for(int i=7;i>=1;i--){
for(int j=1;j<=i;j++){
System.out.print(" * ");
}
System.out.println(" ");
}
//Hình tam giác cân
for(int i=1; i<=height; i++ ){
for(int j=1; j<=height-i; j++){
System.out.print(" ");
}
for(int k=1; k <= 2*i-1; k++){
System.out.print("* ");
}
System.out.println(" ");
}
}
}
| [
"you@example.com"
] | you@example.com |
85a3d4560df3857e3b1cbed26ded966f3bcaec9c | cec628def1aad94ccbefa814d2a0dbd51588e9bd | /profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/details/netbeans/JavaDetailsProvider.java | 7e89dbc0abe94db2fe94505a231bf5b5e35f49a6 | [] | no_license | emilianbold/netbeans-releases | ad6e6e52a896212cb628d4522a4f8ae685d84d90 | 2fd6dc84c187e3c79a959b3ddb4da1a9703659c7 | refs/heads/master | 2021-01-12T04:58:24.877580 | 2017-10-17T14:38:27 | 2017-10-17T14:38:27 | 78,269,363 | 30 | 15 | null | 2020-10-13T08:36:08 | 2017-01-07T09:07:28 | null | UTF-8 | Java | false | false | 4,202 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2013 Oracle and/or its affiliates. All rights reserved.
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common
* Development and Distribution License("CDDL") (collectively, the
* "License"). You may not use this file except in compliance with the
* License. You can obtain a copy of the License at
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
* specific language governing permissions and limitations under the
* License. When distributing the software, include this License Header
* Notice in each file and include the License file at
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the
* License Header, with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* If you wish your version of this file to be governed by only the CDDL
* or only the GPL Version 2, indicate your decision by adding
* "[Contributor] elects to include this software in this distribution
* under the [CDDL or GPL Version 2] license." If you do not indicate a
* single choice of license, a recipient has the option to distribute
* your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above.
* However, if you add GPL Version 2 code and therefore, elected the GPL
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
*
* Contributor(s):
*
* Portions Copyrighted 2013 Sun Microsystems, Inc.
*/
package org.netbeans.modules.profiler.heapwalk.details.netbeans;
import org.netbeans.lib.profiler.heap.Heap;
import org.netbeans.lib.profiler.heap.Instance;
import org.netbeans.modules.profiler.heapwalk.details.spi.DetailsProvider;
import org.netbeans.modules.profiler.heapwalk.details.spi.DetailsUtils;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author Tomas Hurka
*/
@ServiceProvider(service=DetailsProvider.class)
public class JavaDetailsProvider extends DetailsProvider.Basic {
private static final String FO_INDEXABLE = "org.netbeans.modules.parsing.impl.indexing.FileObjectIndexable"; // NOI18N
private static final String INDEXABLE = "org.netbeans.modules.parsing.spi.indexing.Indexable"; // NOI18N
private static final String CLASSPATH_ENTRY = "org.netbeans.api.java.classpath.ClassPath$Entry"; // NOI18N
long lastHeapId;
String lastSeparator;
public JavaDetailsProvider() {
super(FO_INDEXABLE,INDEXABLE,CLASSPATH_ENTRY);
}
@Override
public String getDetailsString(String className, Instance instance, Heap heap) {
if (FO_INDEXABLE.equals(className)) {
String root = DetailsUtils.getInstanceFieldString(instance, "root", heap); // NOI18N
String relpath = DetailsUtils.getInstanceFieldString(instance, "relativePath", heap); // NOI18N
if (root != null && relpath != null) {
return root.concat(getFileSeparator(heap)).concat(relpath);
}
} else if (INDEXABLE.equals(className)) {
return DetailsUtils.getInstanceFieldString(instance, "delegate", heap); // NOI18N
} else if (CLASSPATH_ENTRY.equals(className)) {
return DetailsUtils.getInstanceFieldString(instance, "url", heap); // NOI18N
}
return null;
}
private String getFileSeparator(Heap heap) {
if (lastHeapId != System.identityHashCode(heap)) {
lastSeparator = heap.getSystemProperties().getProperty("file.separator","/"); // NOI18N
}
return lastSeparator;
}
}
| [
"thurka@netbeans.org"
] | thurka@netbeans.org |
dc611869415d5f3a0455fb0afcb6661e39f770e4 | 6ea3624e4e4df5acb397d59464af22193b7b6f1c | /src/main/java/io/github/fattydelivery/bilibilicommentsanalysis/properties/TempFileProperties.java | 3a79a138082cbaac23487a5e899068cd4eccb8f7 | [] | no_license | kaizhiyu/bilibili-comments-analysis | fa935437d78e49b2599d87b781b04439cc7be8c0 | 0fe6dcc377c618d39336241b8b56564913419d85 | refs/heads/main | 2023-02-13T05:36:43.356511 | 2021-01-22T06:24:27 | 2021-01-22T06:24:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | package io.github.fattydelivery.bilibilicommentsanalysis.properties;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* @program:bilibili-comments-analysis
* @description
* @author: Jayce(Bingjie Yan)
* @create: 2020-12-24-17:28
**/
public class TempFileProperties {
private String xmlPath, csvPath;
private String filePath = "/tempfile.properties";
public TempFileProperties() {
Properties properties = new Properties();
try {
InputStream in = TempFileProperties.class.getClass().getResourceAsStream(this.filePath);
properties.load(in);
this.csvPath = properties.getProperty("path.temp.csv");
this.xmlPath = properties.getProperty("path.temp.xml");
} catch (IOException e) {
e.printStackTrace();
}
}
public String getXmlPath() {
return xmlPath;
}
public void setXmlPath(String xmlPath) {
this.xmlPath = xmlPath;
}
public String getCsvPath() {
return csvPath;
}
public void setCsvPath(String csvPath) {
this.csvPath = csvPath;
}
}
| [
"beiyu233@gmail.com"
] | beiyu233@gmail.com |
e1e65df1ce24e12e3adcac630c7968476aa4d1b0 | 981b6b959e6db9cc30202ff8a8687e078a7d524f | /exerciciosifc/src/br/com/ifc/Exercicio1.java | b73c0c50226acb360293c8165c735d52464c4ae8 | [] | no_license | NicoleGDietrich/curso-java | 1bb7c68100569280c7003cfaa6c19d001679abdf | 954bb665b2f5981ad58a8d9ec3644d9fd46c5b8f | refs/heads/master | 2020-03-28T14:56:49.126279 | 2018-11-12T19:31:44 | 2018-11-12T19:31:44 | 148,538,723 | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 601 | java | package br.com.ifc;
import java.util.Scanner;
public class Exercicio1 {
//1. Faša um programa que converta uma temperatura em graus Celcius para graus Fahrenheit.
public static void main (String[]args){
Scanner teclado = new Scanner(System.in);
System.out.println("Digite uma temperatura em graus Celcius para converter em Fahrenheit");
double celsius = Double.parseDouble(teclado.nextLine());
double fahrenheit= 1.8 * celsius + 32;
System.out.printf("A temperatura em Fahrenheit Ú %.2f ", fahrenheit);
teclado.close();
}
}
| [
"nicole.gianisini.dietrich@gmail.com"
] | nicole.gianisini.dietrich@gmail.com |
48ab7b067e08cb092e20395160c5e48e4e9c113f | 81cd9ed33e5bad7e457a13fef08142ae0629d781 | /src/main/java/hung/com/test/CRUD/update/App5_updateDocument.java | 10d8678e72911378b0ccd01d41e9bbc064a4fffa | [] | no_license | hungnguyenmanh82/JavaCore_MongoDBTest | 884634c735ab6d9b5d2af83045f9607d60a5f27f | 926cd2c12c025e0b6ce4e60af8a8de83ba182692 | refs/heads/master | 2020-03-15T09:43:15.819820 | 2018-08-31T10:09:54 | 2018-08-31T10:09:54 | 132,081,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,004 | java | package hung.com.test.CRUD.update;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.bson.Document;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential;
import com.mongodb.MongoException;
import com.mongodb.ServerAddress;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Filters;
import com.mongodb.client.model.Updates;
import com.mongodb.event.ServerClosedEvent;
import com.mongodb.event.ServerDescriptionChangedEvent;
import com.mongodb.event.ServerListener;
import com.mongodb.event.ServerOpeningEvent;
/**
* create an MongoDB user with root:
*
use Mydb
db.createUser({user:"MydbUser",pwd:"123",roles:[{role:"readWrite",db:"Mydb"}]})
*/
public class App5_updateDocument {
private static final String address = "localhost";
private static final int port = 27017;
//
private static final String user = "MydbUser";
private static final String password = "123";
private static final String databaseName = "Mydb";
public static void main(String[] args) {
// http://mongodb.github.io/mongo-java-driver/3.4/driver/tutorials/authentication/
try {
MongoCredential credential = MongoCredential.createCredential(user,databaseName,password.toCharArray());
MongoClientOptions options = MongoClientOptions.builder()
.addServerListener(serverListener)
.build();
MongoClient mongo = new MongoClient(new ServerAddress(address,port),credential, options);
MongoDatabase database = mongo.getDatabase(databaseName);
//====================================================================
MongoCollection<Document> collection = database.getCollection("sampleCollection");
/**
{
_id=5aeadf6432ff4031fcc89550,
title=MongoDB,
id=1,
description=database,
likes=100,
url=http://www.tutorialspoint.com/mongodb/,
by=tutorials point
}
*/
//Filters.eq() = equal()
//Filters.lt() = less than
collection.updateOne(Filters.eq("id", 1), Updates.set("likes", 150));
// collection.updateMany(Filters.eq("id", 1), Updates.set("likes", 110));
System.out.println("Document update successfully...");
//====================================================================
mongo.close();
} catch (MongoException e) {
System.out.println("=========================================");
e.printStackTrace();
}
}
private static ServerListener serverListener = new ServerListener() {
public void serverOpening(ServerOpeningEvent event) {
// System.out.println("*****************"+ event);
}
public void serverDescriptionChanged(ServerDescriptionChangedEvent event) {
// System.out.println("++++++"+ event);
}
public void serverClosed(ServerClosedEvent event) {
// System.out.println("----------------"+ event);
}
};
}
| [
"hung.nguyen@netvisiontel.com"
] | hung.nguyen@netvisiontel.com |
12b6f027f92f11339f67f9835519a7f9b4d926b2 | 7961a9bbbe173fa90492b36212f74dc07d99a3b9 | /events/HighwayEventBuilder.java | 3725ca6d19aa9d91b41b4aa3b48fcfdf907a3d87 | [] | no_license | DanielPinaM/Practica-TP-Java | 2a3c6f8d0d6a1b09b0b9da15280aaf7f7fccec0b | e1c9c5eea33028ebc57c53b5248efc1dd035306e | refs/heads/master | 2022-01-19T13:16:02.483170 | 2019-07-10T10:35:30 | 2019-07-10T10:35:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | package es.ucm.fdi.events;
import es.ucm.fdi.Objects.RoadType;
import es.ucm.fdi.ini.IniSection;
public class HighwayEventBuilder extends RoadEventBuilder {
HighwayEventBuilder(){
super();
this.etiqueta = "new_road";
this.claves = new String [] {"time" , "id", "src", "dest", "max_speed", "length", "lanes"};
this.defaultValues = new String [] {"", "", "", "", "", "", ""};
}
public Event parser(IniSection section) {
if (section.getKeys().size() != 8 || !section.getTag().equals(this.etiqueta) || section.getValue("type") == RoadType.LANES.toString().toLowerCase())
return null;
else
return new HighwayEvent(EventsBuilder.parserNoNegInt(section, "time", 0),
EventsBuilder.isValidId(section, "id"),
EventsBuilder.isValidId(section, "src"),
EventsBuilder.isValidId(section, "dest"),
EventsBuilder.parseaInt(section, "max_speed"),
EventsBuilder.parseaInt(section, "length"),
EventsBuilder.parseaInt(section, "lanes"));
}
}
| [
"noreply@github.com"
] | noreply@github.com |
0391480610a078ec0344b55a6744ccf3bc7bcc8c | 44c345e7041b0669d6ee50a7bf967d7e08481faa | /Week_09/megetood-rpc/mrpc-core/src/main/java/com/megetood/mrpc/autoconfigure/EnableMrpc.java | 0ca3c6955faa44cd7d445307fab0c185a95ed60f | [] | no_license | Beaelf/JAVA-000 | 64d046f9eea1982472ca72cd4379e3ee7953d430 | 3a91959d74e741fa918e228dcb7cb934fddea5b5 | refs/heads/main | 2023-03-01T01:11:35.140316 | 2021-02-07T00:23:53 | 2021-02-07T00:23:53 | 305,736,610 | 0 | 0 | null | 2020-10-20T14:33:59 | 2020-10-20T14:33:58 | null | UTF-8 | Java | false | false | 538 | java | package com.megetood.mrpc.autoconfigure;
import org.springframework.context.annotation.Import;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Mrpc启动注解,启动类上使用
*
* @author Lei Chengdong
* @date 2020/12/16
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Documented
@Import(MrpcConfiguration.class)
public @interface EnableMrpc {
}
| [
"="
] | = |
e5387f78e937a735584331e6958ff6a7c63c7098 | 18d62447d1ea5f5215e77d48a58fb838b7c3c9af | /mybatis_cache/src/main/java/com/lgstudy/dao/IUserDao.java | 632bc47da2773fa77cb7041acfdaea4597163268 | [] | no_license | wangyaj123/lgstudy | b7b5ed944c171d5b96e9c90672abc439124afcca | 7c8429dac0fb1d595f321fa39e7dfca0dbe88bf7 | refs/heads/main | 2023-06-11T21:56:23.063186 | 2021-07-14T09:50:36 | 2021-07-14T09:50:36 | 384,103,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,751 | java | package com.lgstudy.dao;
import com.lgstudy.pojo.User;
import org.apache.ibatis.annotations.*;
import org.mybatis.caches.redis.RedisCache;
import java.util.List;
@CacheNamespace(implementation = RedisCache.class)
public interface IUserDao {
//查询所有用户、同时查询每个用户关联的订单信息
@Select("select * from user")
@Results({
@Result(property = "id",column = "id"),
@Result(property = "username",column = "username"),
@Result(property = "orderList",column = "id",javaType = List.class,
many=@Many(select = "com.lagou.mapper.IOrderMapper.findOrderByUid"))
})
public List<User> findAll();
//查询所有用户、同时查询每个用户关联的角色信息
@Select("select * from user")
@Results({
@Result(property = "id",column = "id"),
@Result(property = "username",column = "username"),
@Result(property = "roleList",column = "id",javaType = List.class,
many = @Many(select = "com.lagou.mapper.IRoleMapper.findRoleByUid"))
})
public List<User> findAllUserAndRole();
//添加用户
@Insert("insert into user values(#{id},#{username})")
public void addUser(User user);
//更新用户
@Update("update user set username = #{username} where id = #{id}")
public void updateUser(User user);
//查询用户
@Select("select * from user")
public List<User> selectUser();
//删除用户
@Delete("delete from user where id = #{id}")
public void deleteUser(Integer id);
//根据id查询用户
@Options(useCache = true)
@Select({"select * from user where id = #{id}"})
public User findUserById(Integer id);
}
| [
"1539291148@qq.com"
] | 1539291148@qq.com |
051ad819928f84fab714b91c7c2838f2ffef1399 | 69929c82bd8f0db4cf879db9e2f97a890e6e6d21 | /app/src/main/java/xyz/koiduste/kalkar/Stats.java | 8ebc41e48b27f3b27432b1b4724ca2b19fb95d6c | [] | no_license | climerman/kalkar | bda4c713593ffa1237f61737f6a2c0c815631528 | 1107e051a7ff15903cb4df0c1fe8de86bc6fdfd6 | refs/heads/master | 2016-09-14T11:26:48.761273 | 2016-04-17T19:50:28 | 2016-04-17T19:50:28 | 56,382,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,176 | java | package xyz.koiduste.kalkar;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by marko on 4/16/16.
*/
public class Stats implements Entity {
private int id;
private int daystamp;
private int operandId;
private int dayCounter;
@Override
public int getId() {
return id;
}
@Override
public void setId(int id) {
this.id = id;
}
public int getDaystamp() {
return daystamp;
}
public void setDaystamp(int daystamp) {
this.daystamp = daystamp;
}
public int getOperandId() {
return operandId;
}
public void setOperandId(int operandId) {
this.operandId = operandId;
}
public int getDayCounter() {
return dayCounter;
}
public void setDayCounter(int dayCounter) {
this.dayCounter = dayCounter;
}
private String intToDateString(int i) {
Date date = new Date(i);
SimpleDateFormat format = new SimpleDateFormat("d-MMM-yyyy");
return format.format(date);
}
@Override
public String toString() {
return String.format("[%s] Tehe: %s | Kogus: %d");
}
}
| [
"mkoiduste@gmail.com"
] | mkoiduste@gmail.com |
ce3a0668be921c5fc86a33888a02759949060c17 | 72ec52530a43608ce6a26f8917cf36b73fed6980 | /pre-cu/src/main/java/com/ocdsoft/bacta/swg/server/PreCuGameServerState.java | 5df0ea1388ef6a15a9cb093ce0fe9e6ba3dcd223 | [
"MIT"
] | permissive | PlaySWG/swg | b40179eb76e994cbca7023ead9382d49de182796 | cab7a0f9592e1009fe5f1621052afb0e04d4c49c | refs/heads/master | 2021-01-13T09:42:21.028249 | 2016-06-04T08:08:51 | 2016-06-04T08:08:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,015 | java | package com.ocdsoft.bacta.swg.server;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.ocdsoft.bacta.engine.conf.BactaConfiguration;
import com.ocdsoft.bacta.engine.network.client.ServerStatus;
import com.ocdsoft.bacta.soe.ServerType;
import com.ocdsoft.bacta.soe.io.udp.GameNetworkConfiguration;
import com.ocdsoft.bacta.swg.server.game.GameServerState;
import com.ocdsoft.bacta.swg.server.login.object.ClusterServer;
import lombok.Getter;
import java.util.ResourceBundle;
/**
* Created by kyle on 4/11/2016.
*/
@Singleton
@Getter
public final class PreCuGameServerState implements GameServerState {
private final int clusterId;
private final ServerType serverType;
private ServerStatus serverStatus;
private final ClusterServer clusterServer;
private final String branch;
private final int version;
private final String networkVersion;
@Inject
public PreCuGameServerState(final BactaConfiguration configuration,
final GameNetworkConfiguration networkConfiguration) {
this.serverStatus = ServerStatus.LOADING;
this.serverType = ServerType.GAME;
this.clusterId = networkConfiguration.getClusterId();
final ResourceBundle swgBundle = ResourceBundle.getBundle("git-swg");
final ResourceBundle soeBundle = ResourceBundle.getBundle("git-soe");
branch = swgBundle.getString("git.commit.id");
version = Integer.parseInt(swgBundle.getString("git.commit.id.abbrev"), 16);
networkVersion = swgBundle.getString("git.commit.id");
clusterServer = new ClusterServer(configuration, networkConfiguration, this);
}
public void setServerStatus(ServerStatus serverStatus) {
this.serverStatus = serverStatus;
clusterServer.getStatusClusterData().setStatus(serverStatus);
}
@Override
public void setOnlineUsers(int onlineUsers) {
clusterServer.getStatusClusterData().setPopulationOnline(onlineUsers);
}
}
| [
"mustangcoupe69@gmail.com"
] | mustangcoupe69@gmail.com |
48c328d20dda363e80fa5b679d6de1b2004df764 | 590fad42ca47a6569aba3dcba1d6e8f13fa01a37 | /src/db/DbIntegrityException.java | 6912233dbe12551302de629aa07dcba38fb83736 | [] | no_license | leandroneis/java-demo-dao-jdbc | 51c20979965b2cc6119f71e8705e497358909a24 | e77d3f45511dc182960da716b02c15c7518d5492 | refs/heads/master | 2023-03-17T19:04:44.371994 | 2021-03-05T03:56:57 | 2021-03-05T03:56:57 | 344,277,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package db;
public class DbIntegrityException extends RuntimeException{
public DbIntegrityException(String msg){
super(msg);
}
}
| [
"lgn200@gmail.com"
] | lgn200@gmail.com |
4970f522f711dd8db1cd8f8851c8c3a76e7b96d9 | f3bbb4f7290be7e7111c502975f7a4d8ad6eb80a | /server/src/main/java/jcoinch/server/Player.java | f84106bb3f88a7e0ad5fbae8d043a8e6f0a4cf0a | [] | no_license | pierre-rebut/Coinche | 3add98def1610bf9181e4d92912779d45437a072 | 3aa5cd5c226620e8eabc2e3641a0f6595c158372 | refs/heads/master | 2021-01-20T13:17:23.893141 | 2017-02-27T16:31:08 | 2017-02-27T16:31:08 | 82,685,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,497 | java | package jcoinch.server;
import java.util.ArrayList;
import com.google.gson.Gson;
import io.netty.channel.Channel;
import jcoinch.utils.Card;
import jcoinch.utils.Transmition;
public class Player {
private final int m_id;
private String m_name;
private final Channel m_channel;
private final Team m_team;
private ArrayList<Card> m_hand;
private int m_score;
private Integer m_belote;
public Player(String name, int id, Channel ch, Team tm)
{
m_id = id;
m_score = 0;
m_name = name;
m_channel = ch;
m_team = tm;
m_belote = 0;
}
public void reset()
{
m_score = 0;
m_belote = 0;
}
public int getBellote()
{
return m_belote;
}
public void addScore(int score)
{
m_score += score;
}
public int getScore()
{
return m_score;
}
public void setName(String name)
{
m_name = name;
}
public int getId()
{
return m_id;
}
public String getName()
{
return m_name;
}
public ArrayList<Card> getHand()
{
return m_hand;
}
public void setDeck(ArrayList<Card> lstCard)
{
m_hand = lstCard;
}
public void send(Transmition msg)
{
m_channel.writeAndFlush(new Gson().toJson(msg, Transmition.class) + "\n");
}
public Team getTeam()
{
return m_team;
}
public Channel getChannel()
{
return m_channel;
}
public void exit()
{
send(new Transmition("INFO", "Exit game !! bye"));
m_channel.close();
}
public void showHand()
{
send(new Transmition("SHOW", "HAND", m_hand));
}
public Card getCard(int idx)
{
Card tmp;
tmp = m_hand.get(idx);
return tmp;
}
public void removeCard(int idx)
{
m_hand.remove(idx);
}
public void showBoard(ArrayList<Card> board)
{
send(new Transmition("SHOW", "BOARD", board));
}
public int getNbCard()
{
return m_hand.size();
}
public void getBelote(Card.Color color)
{
int i = 0;
for (Card card : m_hand)
if (card.color == color && (card.value == Card.Value.QUEEN || card.value == Card.Value.KING))
i++;
if (i == 2)
m_belote += 20;
}
public void checkBelote(Mode trump)
{
switch(trump)
{
case CLUB:
getBelote(Card.Color.CLUB);
break;
case DIAMOND:
getBelote(Card.Color.DIAMOND);
break;
case HEART:
getBelote(Card.Color.HEART);
break;
case SPADE:
getBelote(Card.Color.SPADE);
break;
case ALLTRUMP:
getBelote(Card.Color.CLUB);
getBelote(Card.Color.DIAMOND);
getBelote(Card.Color.HEART);
getBelote(Card.Color.SPADE);
break;
default:
;
};
}
}
| [
"pierre.rebut@epitech.eu"
] | pierre.rebut@epitech.eu |
29a8536c2d4a9deae155480266777840f15d8a77 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/JetBrains--intellij-community/14bdd1b060e8684c0ebe7c4e0f705bfd0277f4db/after/CustomFoldingSettingsPanel.java | 75116a3ea007d5b0a7005c5ec5f87f11a0bacbdb | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,970 | java | package com.intellij.lang.customFolding;
import com.intellij.ui.components.JBCheckBox;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Rustam Vishnyakov
*/
public class CustomFoldingSettingsPanel {
private JPanel mySettingsPanel;
private JTextField myFoldingStartField;
private JTextField myFoldingEndField;
private JBCheckBox myEnabledBox;
private JTextField myCollapsedStateField;
private JRadioButton myVisualStudioRadioButton;
private JRadioButton myNetBeansRadioButton;
private JPanel myPredefinedPatternsPanel;
public CustomFoldingSettingsPanel() {
myEnabledBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean isEnabled = myEnabledBox.isSelected();
setFieldsEnabled(isEnabled);
}
});
ButtonGroup predefinedSettingsGroup = new ButtonGroup();
predefinedSettingsGroup.add(myNetBeansRadioButton);
predefinedSettingsGroup.add(myVisualStudioRadioButton);
myVisualStudioRadioButton.setSelected(false);
myNetBeansRadioButton.setSelected(false);
myNetBeansRadioButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
myFoldingStartField.setText(".*<editor-fold .*desc=\"(.*)\".*$");
myFoldingEndField.setText(".*</editor-fold>");
myCollapsedStateField.setText("defaultstate=\"collapsed\"");
}
});
myVisualStudioRadioButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
myFoldingStartField.setText(".*region (.*)$");
myFoldingEndField.setText(".*endregion");
myCollapsedStateField.setText("");
}
});
}
public JComponent getComponent() {
return mySettingsPanel;
}
public String getStartPattern() {
return myFoldingStartField.getText();
}
public String getEndPattern() {
return myFoldingEndField.getText();
}
public void setStartPattern(String startPattern) {
myFoldingStartField.setText(startPattern);
}
public void setEndPattern(String endPattern) {
myFoldingEndField.setText(endPattern);
}
public void setEnabled(boolean enabled) {
myEnabledBox.setSelected(enabled);
setFieldsEnabled(enabled);
}
public boolean isEnabled() {
return myEnabledBox.isSelected();
}
public void setCollapsedStatePattern(String pattern) {
myCollapsedStateField.setText(pattern);
}
public String getCollapsedStatePattern() {
return myCollapsedStateField.getText();
}
private void setFieldsEnabled(boolean enabled) {
myFoldingStartField.setEnabled(enabled);
myFoldingEndField.setEnabled(enabled);
myCollapsedStateField.setEnabled(enabled);
myPredefinedPatternsPanel.setEnabled(enabled);
myNetBeansRadioButton.setEnabled(enabled);
myVisualStudioRadioButton.setEnabled(enabled);
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
203df5a2ca2c60790cebc0c3c99ec085a1417c7d | f8d4ee0b7e4ad8c87759557a654ca894150d1329 | /src/main/java/org/concurrency/demo/chapter4/threadPool/ThreadPoolTest.java | ce0d4e2c45293b7b3c1935cbe413b54694bc5232 | [] | no_license | JMCuixy/concurrency | 47d822f76dc265ce6b3f65e8344179c04554acf4 | c4b58a21dffdf5faba2302bd3df8c3d7c2aa3857 | refs/heads/master | 2022-01-31T05:50:29.046242 | 2021-12-27T03:08:51 | 2021-12-27T03:08:51 | 173,305,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package org.concurrency.demo.chapter4.threadPool;
/**
* @author : cuixiuyin
* @date : 2019/8/21
*/
public class ThreadPoolTest {
public static void main(String[] args) {
// 1、新建一个线程池
ThreadPool threadPool = new DefaultThreadPool();
threadPool.addWorkers(3);
threadPool.execute(() -> System.out.println("Hello Job"));
threadPool.shutdown();
}
}
| [
"1099442418@qq.com"
] | 1099442418@qq.com |
496a37f6d64e99374393c5b85d43400cd2e086d9 | e1d37a93bd87f8e1510187873d326b6aab4fe740 | /projects/mssc-ssm/src/main/java/com/springframework/msscssm/config/actions/AuthAction.java | 5446e82486e878c16e7ac4e310f814899a758ac9 | [] | no_license | ozzman02/Spring-Boot-Microservices-Spring-Cloud | 0406ba1cbb14694433f0908904faeeec4338cec7 | 2a130aa3c5dd977558cad032499cebc8306a1eba | refs/heads/master | 2020-09-16T17:52:04.814424 | 2020-09-15T05:01:51 | 2020-09-15T05:01:51 | 223,846,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,344 | java | package com.springframework.msscssm.config.actions;
import java.util.Random;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.action.Action;
import org.springframework.stereotype.Component;
import com.springframework.msscssm.domain.PaymentEvent;
import com.springframework.msscssm.domain.PaymentState;
import com.springframework.msscssm.services.PaymentServiceImpl;
@Component
public class AuthAction implements Action<PaymentState, PaymentEvent> {
@Override
public void execute(StateContext<PaymentState, PaymentEvent> context) {
System.out.println("Auth was called!!!");
if (new Random().nextInt(10) < 8) {
System.out.println("Auth Approved");
context.getStateMachine()
.sendEvent(MessageBuilder.withPayload(PaymentEvent.AUTH_APPROVED)
.setHeader(PaymentServiceImpl.PAYMENT_ID_HEADER,
context.getMessageHeader(PaymentServiceImpl.PAYMENT_ID_HEADER))
.build());
} else {
System.out.println("Auth Declined! No Credit!!!!!!");
context.getStateMachine()
.sendEvent(MessageBuilder.withPayload(PaymentEvent.AUTH_DECLINED)
.setHeader(PaymentServiceImpl.PAYMENT_ID_HEADER,
context.getMessageHeader(PaymentServiceImpl.PAYMENT_ID_HEADER))
.build());
}
}
}
| [
"osantamaria@gmail.com"
] | osantamaria@gmail.com |
622da5fb28bab8fc142ecf3dbb0812ca4071ced3 | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-lexruntimev2/src/main/java/com/amazonaws/services/lexruntimev2/model/ActiveContext.java | 60829b2737af1437c44d5309e4ec8059f62e0317 | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 11,734 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.lexruntimev2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* Contains information about the contexts that a user is using in a session. You can configure Amazon Lex V2 to set a
* context when an intent is fulfilled, or you can set a context using the , , or operations.
* </p>
* <p>
* Use a context to indicate to Amazon Lex V2 intents that should be used as follow-up intents. For example, if the
* active context is <code>order-fulfilled</code>, only intents that have <code>order-fulfilled</code> configured as a
* trigger are considered for follow up.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/runtime.lex.v2-2020-08-07/ActiveContext" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ActiveContext implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The name of the context.
* </p>
*/
private String name;
/**
* <p>
* Indicates the number of turns or seconds that the context is active. Once the time to live expires, the context
* is no longer returned in a response.
* </p>
*/
private ActiveContextTimeToLive timeToLive;
/**
* <p>
* A lis tof contexts active for the request. A context can be activated when a previous intent is fulfilled, or by
* including the context in the request.
* </p>
* <p>
* If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you
* specify an empty list, all contexts for the session are cleared.
* </p>
*/
private java.util.Map<String, String> contextAttributes;
/**
* <p>
* The name of the context.
* </p>
*
* @param name
* The name of the context.
*/
public void setName(String name) {
this.name = name;
}
/**
* <p>
* The name of the context.
* </p>
*
* @return The name of the context.
*/
public String getName() {
return this.name;
}
/**
* <p>
* The name of the context.
* </p>
*
* @param name
* The name of the context.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ActiveContext withName(String name) {
setName(name);
return this;
}
/**
* <p>
* Indicates the number of turns or seconds that the context is active. Once the time to live expires, the context
* is no longer returned in a response.
* </p>
*
* @param timeToLive
* Indicates the number of turns or seconds that the context is active. Once the time to live expires, the
* context is no longer returned in a response.
*/
public void setTimeToLive(ActiveContextTimeToLive timeToLive) {
this.timeToLive = timeToLive;
}
/**
* <p>
* Indicates the number of turns or seconds that the context is active. Once the time to live expires, the context
* is no longer returned in a response.
* </p>
*
* @return Indicates the number of turns or seconds that the context is active. Once the time to live expires, the
* context is no longer returned in a response.
*/
public ActiveContextTimeToLive getTimeToLive() {
return this.timeToLive;
}
/**
* <p>
* Indicates the number of turns or seconds that the context is active. Once the time to live expires, the context
* is no longer returned in a response.
* </p>
*
* @param timeToLive
* Indicates the number of turns or seconds that the context is active. Once the time to live expires, the
* context is no longer returned in a response.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ActiveContext withTimeToLive(ActiveContextTimeToLive timeToLive) {
setTimeToLive(timeToLive);
return this;
}
/**
* <p>
* A lis tof contexts active for the request. A context can be activated when a previous intent is fulfilled, or by
* including the context in the request.
* </p>
* <p>
* If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you
* specify an empty list, all contexts for the session are cleared.
* </p>
*
* @return A lis tof contexts active for the request. A context can be activated when a previous intent is
* fulfilled, or by including the context in the request.</p>
* <p>
* If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the
* session. If you specify an empty list, all contexts for the session are cleared.
*/
public java.util.Map<String, String> getContextAttributes() {
return contextAttributes;
}
/**
* <p>
* A lis tof contexts active for the request. A context can be activated when a previous intent is fulfilled, or by
* including the context in the request.
* </p>
* <p>
* If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you
* specify an empty list, all contexts for the session are cleared.
* </p>
*
* @param contextAttributes
* A lis tof contexts active for the request. A context can be activated when a previous intent is fulfilled,
* or by including the context in the request.</p>
* <p>
* If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session.
* If you specify an empty list, all contexts for the session are cleared.
*/
public void setContextAttributes(java.util.Map<String, String> contextAttributes) {
this.contextAttributes = contextAttributes;
}
/**
* <p>
* A lis tof contexts active for the request. A context can be activated when a previous intent is fulfilled, or by
* including the context in the request.
* </p>
* <p>
* If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you
* specify an empty list, all contexts for the session are cleared.
* </p>
*
* @param contextAttributes
* A lis tof contexts active for the request. A context can be activated when a previous intent is fulfilled,
* or by including the context in the request.</p>
* <p>
* If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session.
* If you specify an empty list, all contexts for the session are cleared.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ActiveContext withContextAttributes(java.util.Map<String, String> contextAttributes) {
setContextAttributes(contextAttributes);
return this;
}
/**
* Add a single ContextAttributes entry
*
* @see ActiveContext#withContextAttributes
* @returns a reference to this object so that method calls can be chained together.
*/
public ActiveContext addContextAttributesEntry(String key, String value) {
if (null == this.contextAttributes) {
this.contextAttributes = new java.util.HashMap<String, String>();
}
if (this.contextAttributes.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.contextAttributes.put(key, value);
return this;
}
/**
* Removes all the entries added into ContextAttributes.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ActiveContext clearContextAttributesEntries() {
this.contextAttributes = null;
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getName() != null)
sb.append("Name: ").append(getName()).append(",");
if (getTimeToLive() != null)
sb.append("TimeToLive: ").append(getTimeToLive()).append(",");
if (getContextAttributes() != null)
sb.append("ContextAttributes: ").append("***Sensitive Data Redacted***");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ActiveContext == false)
return false;
ActiveContext other = (ActiveContext) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
if (other.getTimeToLive() == null ^ this.getTimeToLive() == null)
return false;
if (other.getTimeToLive() != null && other.getTimeToLive().equals(this.getTimeToLive()) == false)
return false;
if (other.getContextAttributes() == null ^ this.getContextAttributes() == null)
return false;
if (other.getContextAttributes() != null && other.getContextAttributes().equals(this.getContextAttributes()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime * hashCode + ((getTimeToLive() == null) ? 0 : getTimeToLive().hashCode());
hashCode = prime * hashCode + ((getContextAttributes() == null) ? 0 : getContextAttributes().hashCode());
return hashCode;
}
@Override
public ActiveContext clone() {
try {
return (ActiveContext) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.lexruntimev2.model.transform.ActiveContextMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
6f012b76a8686c121bcf8d7660242da35dc16de4 | 257f03a4b0bd2dfa6020d1046da74f886aca1412 | /PathwayLoom/src/org/pathwayloom/extensions/PathwayCommonsPppPlugin.java | 9836ab29f609a09eedcce27cc1cd2ec4b33f5c98 | [] | no_license | mkutmon/SemanticPathwayLoom | 09f852abd1ae01eeebf9aff46fde4fd6a071f2ae | 71a361b5780282a1f8d95872f3780934da4a005a | refs/heads/master | 2020-12-25T05:16:34.267162 | 2014-07-08T18:15:36 | 2014-07-08T18:15:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,496 | java | // PathVisio,
// a tool for data visualization and analysis using Biological Pathways
// Copyright 2006-2009 BiGCaT Bioinformatics
//
// 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.pathwayloom.extensions;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Category;
//import org.blueprint.webservices.bind.soap.client.BINDSOAPDemo;
import org.bridgedb.bio.BioDataSource;
import org.pathvisio.core.data.GdbManager;
import org.pathvisio.core.model.ConverterException;
import org.pathvisio.core.model.DataNodeType;
import org.pathvisio.core.model.ObjectType;
import org.pathvisio.core.model.Pathway;
import org.pathvisio.core.model.PathwayElement;
import org.pathwayloom.PathwayBuilder;
import org.pathwayloom.PppPlugin;
import org.pathwayloom.Suggestion;
import org.pathwayloom.Suggestion.SuggestionException;
import org.xml.sax.helpers.DefaultHandler;
/**
* Generates Putative Pathway Parts based on a
* HMDB metabolic network parsed and stored in MySQL by Andra.
*/
public class PathwayCommonsPppPlugin implements Suggestion
{
public static final String SOURCE_ALL = "ALL";
// static Category cat = Category.getInstance(BINDSOAPDemo.class.getName());
String sourceParameter;
public PathwayCommonsPppPlugin (GdbManager gdbManager, String source)
{
this.sourceParameter = source;
}
static class MyHandler extends DefaultHandler {
}
public Pathway doSuggestion(PathwayElement input) throws SuggestionException
{
try{
PathwayElement pelt = PathwayElement.createPathwayElement(ObjectType.DATANODE);
pelt.setMWidth (PppPlugin.DATANODE_MWIDTH);
pelt.setMHeight (PppPlugin.DATANODE_MHEIGHT);
pelt.setTextLabel(input.getTextLabel());
pelt.setDataSource(input.getDataSource());
pelt.setGeneID(input.getGeneID());
pelt.setCopyright("Pathway Commons (http://www.pathwaycommons.org)");
pelt.setDataNodeType(input.getDataNodeType());
List<PathwayElement> spokes = new ArrayList<PathwayElement>();
String aLine;
String inputSource = "";
if (input.getDataSource().equals(BioDataSource.UNIPROT)) {
inputSource = "UNIPROT";
}
if (input.getDataSource().equals(BioDataSource.ENTREZ_GENE)) {
inputSource = "ENTREZ_GENE";
}
String urlString = "http://www.pathwaycommons.org/pc/webservice.do?version=3.0&cmd=get_neighbors&q="
+input.getGeneID()+
"&input_id_type="+
inputSource+
"&output_id_type="+
inputSource+
"&output=id_list";
if (!SOURCE_ALL.equals(sourceParameter)){
urlString += "&data_source="+sourceParameter;
}
URL url = new URL(urlString);
int row = 0;
InputStream in2 = url.openStream();
BufferedReader br2 = new BufferedReader(new InputStreamReader(in2));
while ((aLine = br2.readLine()) != null ) {
String[] velden = null;
//System.out.println(urlString);
//System.out.println(aLine);
velden = aLine.split("\t");
//System.out.println(velden[0]+" -- "+ velden[2]);
if ((row >0) && (velden.length == 3)) { //Each row except the header
PathwayElement pchildElt = PathwayElement.createPathwayElement(ObjectType.DATANODE);
pchildElt.setDataNodeType (DataNodeType.PROTEIN);
pchildElt.setTextLabel(velden[0]);
if (!(velden[2].contains("EXTERNAL_ID_NOT_FOUND") || velden[2].contains("N/A"))){
pchildElt.setDataSource (input.getDataSource());
pchildElt.setGeneID(velden[2].substring(velden[2].indexOf(":")+1));
}
pchildElt.setMWidth (PppPlugin.DATANODE_MWIDTH);
pchildElt.setMHeight (PppPlugin.DATANODE_MHEIGHT);
spokes.add (pchildElt);
}
row++; //exclude row with headings
}
Pathway result = PathwayBuilder.radialLayout(pelt, spokes);
return result;
}
catch (IOException ex)
{
throw new SuggestionException(ex);
}
}
/**
* @param args
* @throws ConverterException
*/
public static void main(String[] args) throws SuggestionException, IOException, ConverterException
{
PathwayCommonsPppPlugin pwcPpp = new PathwayCommonsPppPlugin(null, SOURCE_ALL);
PathwayElement test = PathwayElement.createPathwayElement(ObjectType.DATANODE);
test.setDataNodeType(DataNodeType.PROTEIN);
test.setTextLabel("LAT");
test.setGeneID("27040");
test.setDataSource(BioDataSource.ENTREZ_GENE);
Pathway p = pwcPpp.doSuggestion(test);
File tmp = File.createTempFile("pwcppp", ".gpml");
p.writeToXml(tmp, true);
BufferedReader br = new BufferedReader(new FileReader(tmp));
String line;
while ((line = br.readLine()) != null)
{
System.out.println (line);
}
}
public boolean canSuggest(PathwayElement input)
{
String type = input.getDataNodeType();
return !(type.equals ("Metabolite"));
}
}
| [
"mkutmon@gmail.com"
] | mkutmon@gmail.com |
009679da8eec9e208389d56363446b39ad96e477 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/20/20_23eafb0964132d09e932e302c96e888557944d23/MavenEnvInjectController/20_23eafb0964132d09e932e302c96e888557944d23_MavenEnvInjectController_t.java | ffd8a711bc06136212743823c8c0ffd850794707 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,867 | java | package com.kik.inject.json;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.naming.NameNotFoundException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.json.simple.JSONObject;
import com.kik.inject.iface.ParamProcessor;
public class MavenEnvInjectController implements ParamProcessor {
private final Map<String, String> systemProperties;
private final Log _log;
public MavenEnvInjectController(MavenProject project,Log log)
{
_log = log;
_log.debug("LOG!");
systemProperties = addPropertiesFromProperties(project.getProperties());
}
protected Map<String, String> addPropertiesFromProperties(
Properties properties)
{
final Map<String, String> systemParams = new HashMap<String, String>();
Set<Object> propertyKeys = properties.keySet();
for (Object propertyKey : propertyKeys) {
if ( propertyKey instanceof String ){
String propertyKeyString = (String) propertyKey;
if (propertyKeyString != null ) {
String value = properties.getProperty(propertyKeyString,"");
_log.debug("KEY: " + propertyKeyString);
_log.debug("VALUE: "+value);
systemParams.put(propertyKeyString,value);
}
}
}
return systemParams;
}
@Override
public boolean outputVarContentsToStream(OutputStream os, String varName)
throws NameNotFoundException, IOException {
boolean isBase64 = false;
boolean isEscaped = false;
boolean canHandle = false;
final String cleanParamName;
if ( varName.contains("|") ) {
int index = varName.lastIndexOf("|");
String options = varName.substring(index,varName.length());
cleanParamName = varName.substring(0, index);
if ( options.contains("b") ) {
isBase64 = true;
}
if ( options.contains("e") ) {
isEscaped = true;
}
} else {
cleanParamName = varName;
}
if ( systemProperties.containsKey(cleanParamName)) {
if ( isEscaped ) {
writeJSONEscapedStringToStream(os, systemProperties.get(cleanParamName).trim());
} else {
os.write(systemProperties.get(cleanParamName).getBytes(Charset.forName("UTF-8")));
}
canHandle = true;
}
return canHandle;
}
protected void writeJSONEscapedStringToStream(OutputStream os,
String toWrite) throws IOException {
String tmpString = JSONObject.escape(toWrite.trim());
os.write(tmpString.getBytes(Charset.forName("UTF-8")));
}
@Override
public Set<String> getKeySet() {
Set<String> mavenEnvVars = new HashSet<String>();
mavenEnvVars.addAll(systemProperties.keySet());
return mavenEnvVars;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
6187f503c8fced68532c9183ed4f217bf0c4500a | 6534b90eee0d5c81b522187975f0aef7dbe7b96f | /org.saferobots.ssml.graphicaleditors/src/org/saferobots/ssml/graphicaleditors/features/GateCreateFeature.java | 66efe590acefa3876dfa33ca1b1236cf925864cd | [] | no_license | arunkumar-ramaswamy/SafeRobotV1 | 3caeb67af2cda4993c1e3f7007bf6d7b7113af11 | 813134c20088d4be4b813b8cefb7e982daff00b7 | refs/heads/master | 2021-01-19T07:41:17.703509 | 2014-04-14T18:17:57 | 2014-04-14T18:17:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,360 | java | package org.saferobots.ssml.graphicaleditors.features;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.ICreateContext;
import org.eclipse.graphiti.features.impl.AbstractCreateFeature;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.saferobots.ssml.graphicaleditors.utilities.GraphicalEditorConfig;
import org.saferobots.ssml.graphicaleditors.utilities.Utilities;
import org.saferobots.ssml.metamodel.ssml.Dispatch_Gate;
import org.saferobots.ssml.metamodel.ssml.Port;
import org.saferobots.ssml.metamodel.ssml.SsmlFactory;
import org.saferobots.ssml.metamodel.ssml.System;
import org.saferobots.ssml.metamodel.ssml.gate_type;
import org.saferobots.ssml.metamodel.ssml.port_type;
public class GateCreateFeature extends AbstractCreateFeature {
String g_type;
public GateCreateFeature(IFeatureProvider fp, String name, String description) {
super(fp,name,description);
g_type = name;
}
@Override
public boolean canCreate(ICreateContext context) {
// TODO Auto-generated method stub
return context.getTargetContainer() instanceof Diagram;
}
@Override
public Object[] create(ICreateContext context) {
gate_type gtype;
//setting the default no. of in and out ports
int no_in_port=0,no_out_port=0;
switch (g_type) {
case "Splitter":
gtype = gate_type.SPLITTER;
no_in_port = GraphicalEditorConfig.SPLITTER_IN;
no_out_port = GraphicalEditorConfig.SPLITTER_OUT;
break;
case "Merger":
gtype = gate_type.MERGER;
no_in_port = GraphicalEditorConfig.MERGER_IN;
no_out_port = GraphicalEditorConfig.MERGER_OUT;
break;
case "Selector":
gtype = gate_type.SELECTOR;
no_in_port = GraphicalEditorConfig.SELECTOR_IN;
no_out_port = GraphicalEditorConfig.SELECTOR_OUT;
break;
case "Synchronizer":
gtype = gate_type.SYNCHRONIZER;
no_in_port = GraphicalEditorConfig.SYNCHRONIZER_IN;
no_out_port = GraphicalEditorConfig.SYNCHRONIZER_OUT;
break;
case "Delay":
gtype = gate_type.DELAY;
no_in_port = GraphicalEditorConfig.DELAY_IN;
no_out_port = GraphicalEditorConfig.DELAY_OUT;
break;
case "User_Defined":
gtype = gate_type.USER_DEFINED;
no_in_port = GraphicalEditorConfig.USERDEFINED_IN;
no_out_port = GraphicalEditorConfig.USERDEFINED_OUT;
break;
default:
gtype = gate_type.USER_DEFINED;
no_in_port = GraphicalEditorConfig.USERDEFINED_IN;
no_out_port = GraphicalEditorConfig.USERDEFINED_OUT;
break;
}
//creating a gate
Dispatch_Gate newGate = SsmlFactory.eINSTANCE.createDispatch_Gate();
newGate.setType(gtype);
newGate.setName(g_type);
//creating in ports
Port inport;
for (int i = 0; i < no_in_port; i++) {
inport = SsmlFactory.eINSTANCE.createPort();
inport.setType(port_type.IN);
newGate.getPorts().add(inport);
}
//creating out ports
Port outport;
for (int i = 0; i < no_out_port; i++) {
outport = SsmlFactory.eINSTANCE.createPort();
outport.setType(port_type.OUT);
newGate.getPorts().add(outport);
}
//getting the root element
org.saferobots.ssml.metamodel.ssml.System system = (System) Utilities.getRootDomainObject(getDiagram());
//adding the gate
system.getGates().add(newGate);
addGraphicalRepresentation(context,newGate);
return new Object[] {newGate};
}
}
| [
"arun@arunkumarr.co.in"
] | arun@arunkumarr.co.in |
62452fd2c4c1a32c6d2ecae37fd58cd4c289c4de | 022dcd823070ce24fb43b628e4533b37c87ed593 | /app/src/main/java/databean/ProjectBean.java | e63cf61979ed984d9157700fc5775a0b7fd41c5e | [] | no_license | nineriver22/RongTouDai | 8c944629e3c85cc344f89c78f6e5931ef96d7acd | 9815a8cb1071324e1dab2536df62a49e34461eb4 | refs/heads/master | 2021-01-10T06:24:25.137368 | 2015-12-08T09:05:14 | 2015-12-08T09:05:14 | 47,610,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package databean;
import java.io.Serializable;
import java.util.List;
/**
* Created by caixiao on 2015/8/1 0001.
*/
public class ProjectBean implements Serializable {
public List<VarlistEntity> varlist;
public String imgPath;
public int sum;
public static class VarlistEntity {
public int id;
public String title;
public int hits;
public String keywords;
public int status;
public int stage;
public int extend;
public String attachment;
public String thumb;
public String endtime;
}
}
| [
"ciiking99@gmail.com"
] | ciiking99@gmail.com |
58bb66963ddcd0d6ae50579dc4d129ab74346300 | 6075c6c97e4533bef7b54b19f8c6a84f9143a872 | /src/main/java/com/draper/dboot/common/config/MybatisPlusConfig.java | 829404d75d35df0b41d014171f476d3ea2d2d78d | [] | no_license | DraperHXY/Dboot | a1fd7c9320cf739dcab5b17faf91f15c5b81e83a | 783a223891e1f54c0651173c952f951d7eb89c31 | refs/heads/master | 2022-07-31T18:26:09.790635 | 2019-09-22T08:52:01 | 2019-09-22T08:52:01 | 197,501,879 | 0 | 0 | null | 2022-07-06T20:39:07 | 2019-07-18T03:08:21 | Java | UTF-8 | Java | false | false | 536 | java | package com.draper.dboot.common.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author draper_hxy
*/
@EnableTransactionManagement
@Configuration
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
| [
"draper.hxy@gmail.com"
] | draper.hxy@gmail.com |
2320781b1ae47e5e60df13b315da7689077c9fd2 | 6d943c9f546854a99ae27784d582955830993cee | /modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201911/ConversionEvent.java | c47c5629cb92b3e6d4a98371e52322797b79488e | [
"Apache-2.0"
] | permissive | MinYoungKim1997/googleads-java-lib | 02da3d3f1de3edf388a3f2d3669a86fe1087231c | 16968056a0c2a9ea1676b378ab7cbfe1395de71b | refs/heads/master | 2021-03-25T15:24:24.446692 | 2020-03-16T06:36:10 | 2020-03-16T06:36:10 | 247,628,741 | 0 | 0 | Apache-2.0 | 2020-03-16T06:36:35 | 2020-03-16T06:36:34 | null | UTF-8 | Java | false | false | 7,387 | java | // Copyright 2019 Google LLC
//
// 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.
/**
* ConversionEvent.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.admanager.axis.v201911;
public class ConversionEvent implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected ConversionEvent(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _UNKNOWN = "UNKNOWN";
public static final java.lang.String _CREATIVE_VIEW = "CREATIVE_VIEW";
public static final java.lang.String _START = "START";
public static final java.lang.String _SKIP_SHOWN = "SKIP_SHOWN";
public static final java.lang.String _FIRST_QUARTILE = "FIRST_QUARTILE";
public static final java.lang.String _MIDPOINT = "MIDPOINT";
public static final java.lang.String _THIRD_QUARTILE = "THIRD_QUARTILE";
public static final java.lang.String _ENGAGED_VIEW = "ENGAGED_VIEW";
public static final java.lang.String _COMPLETE = "COMPLETE";
public static final java.lang.String _MUTE = "MUTE";
public static final java.lang.String _UNMUTE = "UNMUTE";
public static final java.lang.String _PAUSE = "PAUSE";
public static final java.lang.String _REWIND = "REWIND";
public static final java.lang.String _RESUME = "RESUME";
public static final java.lang.String _SKIPPED = "SKIPPED";
public static final java.lang.String _FULLSCREEN = "FULLSCREEN";
public static final java.lang.String _EXPAND = "EXPAND";
public static final java.lang.String _COLLAPSE = "COLLAPSE";
public static final java.lang.String _ACCEPT_INVITATION = "ACCEPT_INVITATION";
public static final java.lang.String _CLOSE = "CLOSE";
public static final java.lang.String _CLICK_TRACKING = "CLICK_TRACKING";
public static final java.lang.String _SURVEY = "SURVEY";
public static final java.lang.String _CUSTOM_CLICK = "CUSTOM_CLICK";
public static final java.lang.String _MEASURABLE_IMPRESSION = "MEASURABLE_IMPRESSION";
public static final java.lang.String _VIEWABLE_IMPRESSION = "VIEWABLE_IMPRESSION";
public static final java.lang.String _VIDEO_ABANDON = "VIDEO_ABANDON";
public static final java.lang.String _FULLY_VIEWABLE_AUDIBLE_HALF_DURATION_IMPRESSION = "FULLY_VIEWABLE_AUDIBLE_HALF_DURATION_IMPRESSION";
public static final ConversionEvent UNKNOWN = new ConversionEvent(_UNKNOWN);
public static final ConversionEvent CREATIVE_VIEW = new ConversionEvent(_CREATIVE_VIEW);
public static final ConversionEvent START = new ConversionEvent(_START);
public static final ConversionEvent SKIP_SHOWN = new ConversionEvent(_SKIP_SHOWN);
public static final ConversionEvent FIRST_QUARTILE = new ConversionEvent(_FIRST_QUARTILE);
public static final ConversionEvent MIDPOINT = new ConversionEvent(_MIDPOINT);
public static final ConversionEvent THIRD_QUARTILE = new ConversionEvent(_THIRD_QUARTILE);
public static final ConversionEvent ENGAGED_VIEW = new ConversionEvent(_ENGAGED_VIEW);
public static final ConversionEvent COMPLETE = new ConversionEvent(_COMPLETE);
public static final ConversionEvent MUTE = new ConversionEvent(_MUTE);
public static final ConversionEvent UNMUTE = new ConversionEvent(_UNMUTE);
public static final ConversionEvent PAUSE = new ConversionEvent(_PAUSE);
public static final ConversionEvent REWIND = new ConversionEvent(_REWIND);
public static final ConversionEvent RESUME = new ConversionEvent(_RESUME);
public static final ConversionEvent SKIPPED = new ConversionEvent(_SKIPPED);
public static final ConversionEvent FULLSCREEN = new ConversionEvent(_FULLSCREEN);
public static final ConversionEvent EXPAND = new ConversionEvent(_EXPAND);
public static final ConversionEvent COLLAPSE = new ConversionEvent(_COLLAPSE);
public static final ConversionEvent ACCEPT_INVITATION = new ConversionEvent(_ACCEPT_INVITATION);
public static final ConversionEvent CLOSE = new ConversionEvent(_CLOSE);
public static final ConversionEvent CLICK_TRACKING = new ConversionEvent(_CLICK_TRACKING);
public static final ConversionEvent SURVEY = new ConversionEvent(_SURVEY);
public static final ConversionEvent CUSTOM_CLICK = new ConversionEvent(_CUSTOM_CLICK);
public static final ConversionEvent MEASURABLE_IMPRESSION = new ConversionEvent(_MEASURABLE_IMPRESSION);
public static final ConversionEvent VIEWABLE_IMPRESSION = new ConversionEvent(_VIEWABLE_IMPRESSION);
public static final ConversionEvent VIDEO_ABANDON = new ConversionEvent(_VIDEO_ABANDON);
public static final ConversionEvent FULLY_VIEWABLE_AUDIBLE_HALF_DURATION_IMPRESSION = new ConversionEvent(_FULLY_VIEWABLE_AUDIBLE_HALF_DURATION_IMPRESSION);
public java.lang.String getValue() { return _value_;}
public static ConversionEvent fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
ConversionEvent enumeration = (ConversionEvent)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static ConversionEvent fromString(java.lang.String value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(ConversionEvent.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201911", "ConversionEvent"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}
| [
"christopherseeley@users.noreply.github.com"
] | christopherseeley@users.noreply.github.com |
cfeab94e16c50d630a5555540df97e1806826d5c | fdf10d4e0713ca3080b9c464343f59f8c0473c17 | /websocket/src/main/java/com/pcz/websocket/payload/server/JvmVo.java | d49369c9af579117a4600f4a88556665dd96cbdc | [
"MIT"
] | permissive | picongzhi/spring-boot-demo | 4a4b3b5fdf1c8155961df272915ae9b7dfc86a21 | 4ec79dc5df9163564c32dbbc7accece7f1b83bdf | refs/heads/master | 2021-07-12T04:06:21.773857 | 2020-10-20T09:03:18 | 2020-10-20T09:03:18 | 207,985,328 | 0 | 1 | MIT | 2020-07-02T00:39:41 | 2019-09-12T06:58:07 | Java | UTF-8 | Java | false | false | 1,000 | java | package com.pcz.websocket.payload.server;
import com.google.common.collect.Lists;
import com.pcz.websocket.model.server.Jvm;
import com.pcz.websocket.payload.KV;
import lombok.Data;
import java.util.List;
/**
* @author picongzhi
*/
@Data
public class JvmVo {
List<KV> data = Lists.newArrayList();
public static JvmVo create(Jvm jvm) {
JvmVo jvmVo = new JvmVo();
jvmVo.data.add(new KV("当前JVM占用的内存总数(M)", jvm.getTotal() + "M"));
jvmVo.data.add(new KV("JVM最大可用内存总数(M)", jvm.getMax() + "M"));
jvmVo.data.add(new KV("JVM空闲内存(M)", jvm.getFree() + "M"));
jvmVo.data.add(new KV("JVM使用率", jvm.getUsage() + "%"));
jvmVo.data.add(new KV("JDK版本", jvm.getVersion()));
jvmVo.data.add(new KV("JDK路径", jvm.getHome()));
jvmVo.data.add(new KV("JDK启动时间", jvm.getStartTime()));
jvmVo.data.add(new KV("JDK运行时间", jvm.getRunTime()));
return jvmVo;
}
}
| [
"picongzhi@meituan.com"
] | picongzhi@meituan.com |
7e49531c6514e95e87b4c276a2f34c6794767549 | 7a237f017ddb69bb253ab8a54e24c6be509a6e41 | /web01crud/src/main/java/com/raiuny/web01crud/servlet/MyRegistConfig.java | 3ebaa856d10e9aa29b167ed6b0dcf1af8897cdba | [] | no_license | raiuny/spring_boot_notes | 9c260bf579923755cd0f354754f6fe763c993453 | 498f95605d0043c39521a0aa819dc90dece009af | refs/heads/master | 2023-06-29T04:23:16.423077 | 2021-08-03T08:18:37 | 2021-08-03T08:18:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package com.raiuny.web01crud.servlet;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
@Configuration
public class MyRegistConfig {
@Bean //添加注解,并注册组件
public ServletRegistrationBean myServlet() {
MyServlet myServlet = new MyServlet();
return new ServletRegistrationBean(myServlet, "/my","/my01");
}
@Bean
public FilterRegistrationBean myFilter() {
MyFilter myFilter = new MyFilter();
FilterRegistrationBean filtbean = new FilterRegistrationBean(myFilter);
filtbean.setUrlPatterns(Arrays.asList("/my"));
return filtbean;
}
}
| [
"793872973@qq.com"
] | 793872973@qq.com |
980d1aa813fb1dec6750b405f1ceb0aadde4f80d | 624117c40c6032a9a12c223d176518b7aec46f49 | /src/com/nationwide/chapter14/walker/SelectionSortDemo.java | cacf91a78b5ebaf2174063ffe032f5064c0c5515 | [] | no_license | Bravo2017/JavaForEveryone | dd8de35419e815334d0c7d857d7349f97b3b9f39 | aee14a0ce520f5e89084e2bad971811ec2448bf8 | refs/heads/master | 2021-05-05T23:08:38.393675 | 2016-08-05T01:09:03 | 2016-08-05T01:09:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package com.nationwide.chapter14.walker;
import java.util.Arrays;
public class SelectionSortDemo {
public static void main(String[] args) {
double[] a = ArrayUtil.randomCoinArray(10);
System.out.println(Arrays.toString(a));
SelectionSorter.sort(a);
System.out.println(Arrays.toString(a));
}
}
| [
"cwalker@ntegrityc.com"
] | cwalker@ntegrityc.com |
77682d575538d725cd42abd88ffdf65c77f31965 | 96bbcca96d231fafc3fc2eb01fe01d2524295dc8 | /src/main/java/io/temporal/samples/getresultsasync/Starter.java | 573cc7e905b289ecfff953de27a38959a371e4ca | [
"Apache-2.0"
] | permissive | mfateev/temporal-java-samples | 24e823960535529c9025406a437b8b68f98e0e55 | 38784154a8c106ae17b99f7a068fb385bc76d308 | refs/heads/master | 2023-05-08T05:58:53.928135 | 2022-10-25T23:26:30 | 2022-10-25T23:26:30 | 250,126,175 | 0 | 1 | null | 2020-03-26T00:51:37 | 2020-03-26T00:51:36 | null | UTF-8 | Java | false | false | 3,009 | java | /*
* Copyright (c) 2020 Temporal Technologies, Inc. All Rights Reserved
*
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package io.temporal.samples.getresultsasync;
import io.temporal.client.WorkflowClient;
import io.temporal.client.WorkflowOptions;
import io.temporal.client.WorkflowStub;
import java.util.concurrent.TimeUnit;
public class Starter {
/**
* Show the use and difference between getResult and getResultAsync for waiting on workflow
* results.
*/
@SuppressWarnings("FutureReturnValueIgnored")
public static void main(String[] args) {
MyWorkflow workflowStub1 =
Worker.client.newWorkflowStub(
MyWorkflow.class,
WorkflowOptions.newBuilder().setTaskQueue(Worker.TASK_QUEUE_NAME).build());
MyWorkflow workflowStub2 =
Worker.client.newWorkflowStub(
MyWorkflow.class,
WorkflowOptions.newBuilder().setTaskQueue(Worker.TASK_QUEUE_NAME).build());
// Start workflow async (not blocking thread)
WorkflowClient.start(workflowStub1::justSleep, 3);
WorkflowStub untypedStub1 = WorkflowStub.fromTyped(workflowStub1);
// Get the results, waiting for workflow to complete
String result1 = untypedStub1.getResult(String.class); // blocking call, waiting to complete
System.out.println("Result1: " + result1);
// Start the workflow again (async)
WorkflowClient.start(workflowStub2::justSleep, 5);
WorkflowStub untypedStub2 = WorkflowStub.fromTyped(workflowStub2);
// getResultAsync returns a CompletableFuture
// It is not a blocking call like getResult(...)
untypedStub2
.getResultAsync(String.class)
.thenApply(
result2 -> {
System.out.println("Result2: " + result2);
return result2;
});
System.out.println("Waiting on result2...");
// Our workflow sleeps for 5 seconds (async)
// Here we block the thread (Thread.sleep) for 7 (2 more than the workflow exec time)
// To show that getResultsAsync completion happens during this time (async)
sleep(7);
System.out.println("Done waiting on result2...");
System.exit(0);
}
private static void sleep(int seconds) {
try {
Thread.sleep(TimeUnit.SECONDS.toMillis(seconds));
} catch (InterruptedException e) {
System.out.println("Exception: " + e.getMessage());
System.exit(0);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c8efc0fe64a0ed18b9f5726d5d070bd521cad509 | ce259e27ed633e4d7ede2fdd5d7963987bd56ddf | /DoubleLinkedList/Node(3).java | ba7b6a179398e81fdfc07af1fc57541c2dfcb177 | [] | no_license | jeewanMgr/DataStructure | 68d8626dc2299ac065caa8cbb656653c4c6843ba | 313e560d5d4257821e5ab658f7fe20d9b54c4f2b | refs/heads/master | 2020-09-30T03:34:14.605573 | 2019-12-10T19:12:25 | 2019-12-10T19:12:25 | 227,192,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 680 | java |
public class Node<T> {
private T data;
private Node next;
private Node previous;
//default constructor
public Node() {
data = null;
next = null;
previous = null;
}
//with the data
public Node(T d) {
data = d;
next = null;
previous = null;
}
//getters
public T Data() {
return data;
}
public Node<T> Next() {
return next;
}
public Node<T> Previous() {
return previous;
}
//setters
public void setData(T d) {
data = d;
}
public void setNext(Node n) {
next = n;
}
public void setPrevious(Node n) {
previous = n;
}
public String toString() {
String s = "" + data;
return s;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6ceb22dff28724a2ddd9fd743675c39345ecebe4 | 3f2ee7cfb45631832f39975ca92f4975377a3f98 | /java/CommonFundamental/src/string/StringDemo2.java | 333b431050dff688076c002bf5324c2781ca4852 | [] | no_license | avinash047/java-cloud | b216ff34018109afd9c55b32c096dd4d2b6706d0 | 9e5bcfef2dc8a9f20e360dcbabd58b87b2c50a4a | refs/heads/master | 2021-02-22T03:18:05.070040 | 2020-03-06T08:45:04 | 2020-03-06T08:45:04 | 245,368,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package string;
public class StringDemo2 {
public static void main(String[] args) {
String str1 = "Capgemini"; //object1
//String str2 = "capgemini"; //object2
str1 = str1.substring(3); //object3
System.gc();
System.out.println(str1);
}
}
| [
"avinashlondhe047@gmail.com"
] | avinashlondhe047@gmail.com |
b15ff2e834d4063b9d2b4c4794e49f798a4fe84c | 133ae4b49074e8535b4f2d01ed00cd6fd6b22de8 | /src/main/java/com/ngdb/entities/WishBox.java | a9558b2ae84c6ab241f2f0963cc0380e27fcdb48 | [] | no_license | takou/ngdb.com | 5f4a387411f559ea504a268391406768950d76f9 | b730408aa60f0381a9ce3ffed84dd5728b0954ba | refs/heads/master | 2021-01-18T12:14:24.687630 | 2012-07-01T18:37:36 | 2012-07-01T18:37:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,139 | java | package com.ngdb.entities;
import static org.hibernate.criterion.Order.desc;
import static org.hibernate.criterion.Projections.countDistinct;
import java.math.BigInteger;
import java.util.List;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;
import com.ngdb.entities.article.Article;
import com.ngdb.entities.shop.Wish;
public class WishBox {
@Inject
private Session session;
public Long getNumWishes() {
return (Long) session.createCriteria(Wish.class).setProjection(countDistinct("article")).setCacheable(true).setCacheRegion("cacheCount").uniqueResult();
}
public int getRankOf(Article article) {
List<Object[]> list = session.createSQLQuery("SELECT article_id,COUNT(*) FROM Wish GROUP BY article_id ORDER BY COUNT(*) DESC").list();
int rank = 1;
for (Object[] o : list) {
BigInteger articleId = (BigInteger) o[0];
if (article.getId().equals(articleId.longValue())) {
return rank;
}
}
return Integer.MAX_VALUE;
}
public List<Wish> findAllWishes() {
return session.createCriteria(Wish.class).addOrder(desc("modificationDate")).setCacheable(true).list();
}
}
| [
"jsmadja@financeactive.com"
] | jsmadja@financeactive.com |
5321ac47bfd9d8814fd098749c1e53d28ee5af13 | cd60154ca31b057312886c01dec9e29053e6959a | /rpc-example/src/main/java/com/myself/rpc/example/Client.java | 61129fac3d685766f4b93e6278bf47aff983a19e | [] | no_license | wanghailin163/rpc | 76b557bfcc9686e77fa0fb9f4b6930a9702c59e8 | 9fe7fb89e91f8461cd6fee6f69fe5ee4185d9d78 | refs/heads/master | 2022-07-07T10:18:37.091272 | 2020-02-16T14:50:34 | 2020-02-16T14:50:34 | 240,908,526 | 0 | 0 | null | 2022-06-17T02:54:28 | 2020-02-16T14:46:51 | Java | UTF-8 | Java | false | false | 492 | java | package com.myself.rpc.example;
import com.myself.rpc.client.RpcClient;
/**
* @Description TODO
* @Author wanghailin
* @Date 2020/02/16
* @Version 1.0
*/
public class Client {
public static void main(String[] args) {
RpcClient rpcClient = new RpcClient();
CalcService service = rpcClient.getProxy(CalcService.class);
int r1 = service.add(1,2);
int r2 = service.minus(10,8);
System.out.println(r1);
System.out.println(r2);
}
}
| [
"wanghailin_cd@163.com"
] | wanghailin_cd@163.com |
569d04ecb43fa6cb20cc26a5f40f8418bdd83ea7 | 769092779e59c0778e3a961d706592075d5ae937 | /librarymgt_bootconsole/src/main/java/com/dxctraining/bootconsoleapp/author/entities/Author.java | 22252dfe3993b87c412f7cfe05a0cf72fd43ad9f | [] | no_license | amalpradeep-mv/librarymgt-boot | c117045e24fcb828573512ae55bbe317e5f0eaf0 | fd610676c94c0717529d5ab63a67473f9ab7ff7a | refs/heads/master | 2022-12-01T22:19:09.926901 | 2020-08-16T14:35:26 | 2020-08-16T14:35:26 | 287,953,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 896 | java | package com.dxctraining.bootconsoleapp.author.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="author_details")
public class Author {
@Id
@GeneratedValue
private int id;
private String name;
public Author() {}
public Author(String name) {
this.setName(name);
this.setId(id);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int hashCode() {
return id;
}
public boolean equals(Object arg) {
if (this == arg) {
return true;
} else if ((null == arg) || !(arg instanceof Author)) {
return false;
}
Author that = (Author) arg;
boolean isequals = this.id == that.id;
return isequals;
}
}
| [
"amalpradeepmv@gmail.com"
] | amalpradeepmv@gmail.com |
6dcf68a7b887ef60a776935211a3b243cda206ec | 9ba4a2cbe795b49cf2bfb45beb40ca55cc5a4925 | /loans-core/src/main/java/org/kelex/loans/core/util/TransactionUtils.java | b19e207cd99351444968d76e296c3dbcb19be3d9 | [] | no_license | tmacliang/loans | c0660288df547e73f9c4024c571463fb63f5280c | 93cf7c5b4855c3e3e1ccdf2a0a08edb4ce3fe2c4 | refs/heads/master | 2021-05-08T00:55:10.685671 | 2017-11-08T03:43:10 | 2017-11-08T03:43:10 | 107,830,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,010 | java | package org.kelex.loans.core.util;
import org.kelex.loans.core.entity.*;
import org.kelex.loans.core.enumeration.FeePayMethod;
import org.kelex.loans.core.enumeration.FeeRateType;
import org.kelex.loans.core.enumeration.RemAdjustMethod;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.*;
/**
* Created by hechao on 2017/9/21.
*/
public abstract class TransactionUtils {
private static final Integer MAX_TERMS = 99;
public static String toRetailPlanId(int totalTerms) {
if (totalTerms < 0 || totalTerms > MAX_TERMS) {
throw new IllegalArgumentException("0 < totalTerms < 99");
}
return "RIP" + (totalTerms < 10 ? "0" : "") + Integer.toString(totalTerms);
}
public final static InstalmentSample getInstalmentSample(
BigDecimal amount
, AccountEntity account
, PlanProfileEntity planProfile
, PlanProcessCtrlEntity planCtrl
, TxnProcessCtrlEntity txnCtrl
, CurrProcessCtrlEntity currCtrl
, LocalDate businessDate) {
if (amount.compareTo(BigDecimal.TEN) < 0) {
throw new IllegalArgumentException("instalment amount < 10");
}
PlanProcessCtrlId planCtrlId = planCtrl.getId();
if (!Objects.equals(planProfile.getPlanId(), planCtrlId.getPlanId())) {
throw new IllegalArgumentException("planProfile.planId != planCtrl.planId");
}
if (!Objects.equals(account.getProductId(), planCtrlId.getProductId())
|| !Objects.equals(account.getActTypeId(), planCtrlId.getActTypeId())) {
throw new IllegalArgumentException("account.project != planCtrl.project");
}
if (!Objects.equals(account.getProductId(), txnCtrl.getId().getProductId())
|| !Objects.equals(account.getActTypeId(), txnCtrl.getId().getActTypeId())) {
throw new IllegalArgumentException("account.project != txnCtrl.project");
}
Integer planTerms = planProfile.getPlanTerms();
if (planTerms < 1) {
throw new IllegalArgumentException("terms > 0");
}
int precision = Math.abs(currCtrl.getPower());
//计算分期金额
InstalmentSample sample = new InstalmentSample();
BigDecimal terms = new BigDecimal(planTerms);
BigDecimal fixedAmt = amount.divide(terms, precision, BigDecimal.ROUND_DOWN);
BigDecimal remAmt = amount.subtract(fixedAmt.multiply(terms)).add(fixedAmt);
if (remAmt.compareTo(amount) == 0) {
fixedAmt = BigDecimal.ZERO;
}
//设置样例
RemAdjustMethod remMethod = planCtrl.getRemAdjustMethod();
sample.setFixedTermAmt(fixedAmt);
if (remMethod.equals(RemAdjustMethod.FRST)) {
sample.setFirstTermAmt(remAmt);
sample.setLastTermAmt(fixedAmt);
} else if (remMethod.equals(RemAdjustMethod.LAST)) {
sample.setFirstTermAmt(fixedAmt);
sample.setLastTermAmt(remAmt);
} else {
throw new RuntimeException(remMethod.name() + " rem adjust method is no such");
}
//计算分期手续费率
if (isFreeTxnFee(account, txnCtrl, businessDate)) {
sample.setFeeRate(BigDecimal.ZERO);
} else {
FeeRateType rateType = account.getTxnFeeRateType();
if (rateType == FeeRateType.NORM) {
sample.setFeeRate(account.getTxnFeeRate());
sample.setFeeRateTimes(terms);
} else if (rateType == FeeRateType.FIX) {
sample.setFeeRate(planCtrl.getTxnFeeRate());
sample.setFeeRateTimes(BigDecimal.ONE);
} else if (rateType == FeeRateType.LVL) {
throw new RuntimeException("LVL method building...");
} else {
throw new RuntimeException(rateType.name() + " fee rate type is no such.");
}
}
//计算分期手续费
BigDecimal realFeeRate = sample.getFeeRateTimes().multiply(sample.getFeeRate());
BigDecimal totalFee = amount.multiply(realFeeRate).setScale(precision, BigDecimal.ROUND_DOWN);
BigDecimal fixedFee;
BigDecimal firstFee;
FeePayMethod payMethod = planCtrl.getFeePayMethod();
if (payMethod == FeePayMethod.TERM) {
fixedFee = totalFee.divide(terms, precision, BigDecimal.ROUND_DOWN);
firstFee = totalFee.subtract(fixedFee.multiply(terms)).add(fixedFee);
} else {
firstFee = totalFee;
fixedFee = BigDecimal.ZERO;
}
sample.setFirstTermFeeAmt(firstFee);
sample.setFixedTermFeeAmt(fixedFee);
sample.setLastTermFeeAmt(fixedFee);
return sample;
}
/**
* 是否免除账户的交易手续费
*
* @param account 账户
* @param txnCtrl 交易控制
* @param businessDate 交易时间
* @return
*/
public static boolean isFreeTxnFee(AccountEntity account, TxnProcessCtrlEntity txnCtrl, LocalDate businessDate) {
TxnProcessCtrlId ctrlId = txnCtrl.getId();
if (!Objects.equals(account.getProductId(), ctrlId.getProductId())
|| !Objects.equals(account.getActTypeId(), ctrlId.getActTypeId())) {
throw new IllegalArgumentException("account and txnProcessCtrl not in a project");
}
if (account.getWaiveTxnFeeFlag()) {
if (businessDate.isBefore(account.getWaiveTxnFeeEndDate()) && businessDate.isAfter(account.getWaiveTxnFeeStartDate())) {
return true;
}
}
return txnCtrl.getFeeCode() == null;
}
public static Map<String, BalCompValEntity> toMap(Collection<BalCompValEntity> collection) {
Map<String, BalCompValEntity> map = new HashMap<>();
for (BalCompValEntity entity : collection) {
map.put(entity.getId().getBcpId(), entity);
}
return map;
}
}
| [
"lcltamc@163.com"
] | lcltamc@163.com |
57029d2d7ff10c4cba5ebb01250b0040604cc561 | 4bf0e39cfc141055fe11efba66c010b8535c37bf | /producto/src/main/java/dan/tp2021/productos/exception/ProductoCannotSearchedException.java | cdf40bc5204d91517df2d3fa77609f6d293072a7 | [] | no_license | Belen012/tp6nube | 65755be7eb16cdfadbb1cbc96e8dd2abcb2c58e4 | a6d75bd00da9a1545c42519007820ce0699c8e02 | refs/heads/main | 2023-07-19T18:48:39.005199 | 2021-08-16T22:03:38 | 2021-08-16T22:03:38 | 370,508,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package dan.tp2021.productos.exception;
import dan.tp2021.productos.domain.dto.ErrorDTO;
import org.springframework.http.HttpStatus;
public class ProductoCannotSearchedException extends ProductoException {
public ProductoCannotSearchedException(){
super(new ErrorDTO("Error Producto", "No se puede buscar el producto "), HttpStatus.BAD_REQUEST);
}
}
| [
"belen.eceiza@mercadolibre.com"
] | belen.eceiza@mercadolibre.com |
ef1d25b9d8338123e7ccd58196651cffae4c6e8a | dc1d52e0b31c5eb525451a402658966d00b57c1b | /prompt/veryhard/ApartmentHunting.java | 4850b451a7f167b02fb0f8002875627ac95d7588 | [] | no_license | JosephLimWeiJie/algoExpert | 6c0b9b4854d517a27ab8d93b83480b7370f89fe0 | 6c42631174dc99eb50b0bc63fc34b3e73ec12140 | refs/heads/main | 2023-06-08T14:17:56.904202 | 2021-06-24T14:58:29 | 2021-06-24T14:58:29 | 302,695,940 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,779 | java | package prompt.veryhard;
import java.util.*;
public class ApartmentHunting {
public static int apartmentHunting(List<Map<String, Boolean>> blocks, String[] reqs) {
int[][] data = new int[reqs.length][blocks.size()];
Map<Integer, String> facilitiesToId = new HashMap<>();
Map<String, Integer> reqsMap = new HashMap<>();
for (int i = 0; i < reqs.length; i++) {
reqsMap.put(reqs[i], 0);
}
int id = 0;
for (Map.Entry<String, Boolean> entry : blocks.get(0).entrySet()) {
if (reqsMap.containsKey(entry.getKey())) {
facilitiesToId.put(id, entry.getKey());
id++;
}
}
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
boolean isFacilityThere = blocks.get(j).get(facilitiesToId.get(i));
if (isFacilityThere) {
data[i][j] = 1;
}
}
}
int[][] distanceFromLeft = getDistanceFromLeft(data);
int[][] distanceFromRight = getDistanceFromRight(data);
int[][] maxDistanceLeftRight = getMaxDistanceFromLeftRight(distanceFromLeft, distanceFromRight);
int[] maxDistanceOfEachBlock = runningMaxDistance(maxDistanceLeftRight);
return getBlockIndex(maxDistanceOfEachBlock);
}
public static int getBlockIndex(int[] maxDistanceOfEachBlock) {
int index = -1;
int minDist = Integer.MAX_VALUE;
for (int i = 0; i < maxDistanceOfEachBlock.length; i++) {
if (maxDistanceOfEachBlock[i] < minDist) {
minDist = maxDistanceOfEachBlock[i];
index = i;
}
}
return index;
}
public static int[] runningMaxDistance(int[][] data) {
int[] maxDistanceOfEachBlock = new int[data[0].length];
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
maxDistanceOfEachBlock[j] = Math.max(data[i][j], maxDistanceOfEachBlock[j]);
}
}
return maxDistanceOfEachBlock;
}
public static int[][] getMaxDistanceFromLeftRight(int[][] leftData, int[][] rightData) {
int[][] newData = new int[leftData.length][rightData[0].length];
for (int i = 0; i < leftData.length; i++) {
for (int j = 0; j < leftData[i].length; j++) {
if (leftData[i][j] == 0) {
newData[i][j] = rightData[i][j];
} else if (rightData[i][j] == 0) {
newData[i][j] = leftData[i][j];
} else {
newData[i][j] = Math.min(leftData[i][j], rightData[i][j]);
}
}
}
return newData;
}
public static int[][] getDistanceFromLeft(int[][] data) {
int[][] newData = new int[data.length][data[0].length];
for (int i = 0; i < data.length; i++) {
int runningLeftIdx = -1;
for (int j = 0; j < data[i].length; j++) {
if (data[i][j] == 1) {
newData[i][j] = 0;
runningLeftIdx = j;
} else {
if (runningLeftIdx == -1) {
newData[i][j] = 0;
} else {
newData[i][j] = Math.abs(j - runningLeftIdx);
}
}
}
}
return newData;
}
public static int[][] getDistanceFromRight(int[][] data) {
int[][] newData = new int[data.length][data[0].length];
for (int i = data.length - 1; i >= 0; i--) {
int runningRightIdx = -1;
for (int j = data[i].length - 1; j >= 0; j--) {
if (data[i][j] == 1) {
newData[i][j] = 0;
runningRightIdx = j;
} else {
if (runningRightIdx == -1) {
newData[i][j] = 0;
} else {
newData[i][j] = Math.abs(j - runningRightIdx);
}
}
}
}
return newData;
}
public static void printData(int[][] data) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
sb.append(data[i][j] + ",");
}
sb.append("\n");
}
System.out.println(sb.toString());
}
public static void main(String[] args) {
List<Map<String, Boolean>> blocks = new ArrayList<Map<String, Boolean>>();
blocks.add(0, new HashMap<String, Boolean>());
blocks.get(0).put("gym", false);
blocks.get(0).put("school", true);
blocks.get(0).put("store", false);
blocks.add(1, new HashMap<String, Boolean>());
blocks.get(1).put("gym", true);
blocks.get(1).put("school", false);
blocks.get(1).put("store", false);
blocks.add(2, new HashMap<String, Boolean>());
blocks.get(2).put("gym", true);
blocks.get(2).put("school", true);
blocks.get(2).put("store", false);
blocks.add(3, new HashMap<String, Boolean>());
blocks.get(3).put("gym", false);
blocks.get(3).put("school", true);
blocks.get(3).put("store", false);
blocks.add(4, new HashMap<String, Boolean>());
blocks.get(4).put("gym", false);
blocks.get(4).put("school", true);
blocks.get(4).put("store", true);
String[] reqs = new String[] {"gym", "school", "store"};
System.out.println(apartmentHunting(blocks, reqs));
}
}
| [
"59989652+JosephLimWeiJie@users.noreply.github.com"
] | 59989652+JosephLimWeiJie@users.noreply.github.com |
cdba673544e2b61e09e12a760130b5be17ffe0be | 397c899e18d26c5c12df07eab4d27f4125915c4a | /video-api/src/main/java/top/yinjinbiao/video/sso/server/config/AuthorizationServerConfiguration.java | 64c35dd8849b50cf8bae64a9f8165fc644087056 | [
"Apache-2.0"
] | permissive | JinbiaoYin/video | a18f29530632990d14a50c3f384ca00e04355a20 | 925e504517e7fea6cbafc236b45c0d3a27b8e88b | refs/heads/master | 2022-07-15T10:01:48.062568 | 2021-03-28T05:54:02 | 2021-03-28T05:54:02 | 245,750,916 | 0 | 1 | Apache-2.0 | 2020-03-20T07:03:30 | 2020-03-08T04:21:17 | JavaScript | UTF-8 | Java | false | false | 3,537 | java | package top.yinjinbiao.video.sso.server.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import javax.sql.DataSource;
/**
* 配置授权服务器
*
* @author yin.jinbiao
*
*/
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {
@Autowired
private RedisConnectionFactory connectionFactory;
@Autowired
private AuthenticationManager authenticationManager;
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
security.allowFormAuthenticationForClients().tokenKeyAccess("permitAll()").checkTokenAccess("permitAll()").allowFormAuthenticationForClients();
}
/**
* token 的存储方式
* @return
*/
@Bean
public TokenStore tokenStore(){
return new JdbcTokenStore(dataSource());
}
/**
* 使用 jdbc 的方式查询客户端信息
* @return
*/
@Bean
public JdbcClientDetailsService jdbcClientDetailsService(){
return new JdbcClientDetailsService(dataSource());
}
/**
* 配置ClientDetailsService
* 注意,除非你在下面的configure(AuthorizationServerEndpointsConfigurer)
* 中指定了一个AuthenticationManager,否则密码授权方式不可用。 至少配置一个client,否则服务器将不会启动。
*/
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
//jdbc模式
clients.withClientDetails(jdbcClientDetailsService());
}
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
// 密码模式需要开启
endpoints.allowedTokenEndpointRequestMethods(HttpMethod.GET, HttpMethod.POST);// add get method
endpoints.authenticationManager(authenticationManager);
// 存储token
endpoints.tokenStore(tokenStore());
}
}
| [
"731509863@qq.com"
] | 731509863@qq.com |
6f68598b854c1b7bce65e4de65bf0193d67f704f | ef9cb1750e0248d15d84606fb9329d53f5a994f9 | /app/src/main/java/kamilzemczak/runny/activity/activity_menu/FriendsActivity.java | 7af1a8cdd0c1c9f88be88467eb5def4339d91912 | [] | no_license | KamilZemczak/RunnyClient | 89539fb0df0c14eb15d34cd050624902ef99a03e | 88c00b103f4a79c752132588bb17bcf66b0d5780 | refs/heads/master | 2021-10-09T03:57:49.421937 | 2018-12-20T20:07:28 | 2018-12-20T20:07:28 | 111,596,319 | 0 | 0 | null | 2017-11-26T09:30:56 | 2017-11-21T20:12:04 | Java | UTF-8 | Java | false | false | 5,203 | java | /**
* ***********************************************************
* Autorskie Prawa Majątkowe Kamil Zemczak
*
* Copyright 2017 Kamil Zemczak
* ************************************************************
* Utworzono 26-10-2017, Kamil Zemczak
* ************************************************************
*/
package kamilzemczak.runny.activity.activity_menu;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.widget.Toast;
import kamilzemczak.runny.R;
import kamilzemczak.runny.activity.activity_entry.LoginActivity;
import kamilzemczak.runny.activity.activity_user.SearchFriendsActivity;
import kamilzemczak.runny.activity.activity_user.SearchUserFriendsActivity;
/**
* TODO
*/
public class FriendsActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_friends);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
/**
* TODO
*/
public void openFriendsList(View view) {
startActivity(new Intent(this, SearchUserFriendsActivity.class));
}
/**
* TODO
*/
public void openSearchFriends(View view) {
startActivity(new Intent(this, SearchFriendsActivity.class));
}
public void showProfile(View view) {
startActivity(new Intent(this, ProfileActivity.class));
}
public void logout(MenuItem menu) {
startActivity(new Intent(this, LoginActivity.class));
Toast.makeText(getBaseContext(), "Wylogowanie powiodło się!", Toast.LENGTH_LONG).show();
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.friends, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_home) {
startActivity(new Intent(this, WelcomeActivity.class));
// Handle the camera action
} else if (id == R.id.nav_profile) {
startActivity(new Intent(this, ProfileActivity.class));
} else if (id == R.id.nav_training) {
startActivity(new Intent(this, TrainingActivity.class));
} else if (id == R.id.nav_friend) {
startActivity(new Intent(this, FriendsActivity.class));
} else if (id == R.id.nav_history) {
startActivity(new Intent(this, HistoryActivity.class));
} else if (id == R.id.nav_decision) {
startActivity(new Intent(this, ObjectivesActivity.class));
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
| [
"kamilzemb@gmail.com"
] | kamilzemb@gmail.com |
5eaf6a94b6ce0baf7cfc424b75dd57b0f0f84167 | 27ae2191c9b3a11899a5f7918fc407f7b180ef81 | /fluentlenium-cucumber/src/test/java/org/fluentlenium/adapter/cucumber/integration/noinheritance/java8/steps/Java8Steps.java | a9ef48c7a0c1bc054ef5e772d6ae739dc0807a16 | [
"Apache-2.0"
] | permissive | akhileshkumarverma/FluentLenium | bb97ac6a4b8ab17008f997982caa81b23830f322 | a0c872870decf3a8a9d1c3375f8bfe3b8c23c8d7 | refs/heads/master | 2020-04-26T04:15:00.518358 | 2019-01-29T19:28:58 | 2019-01-29T19:28:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | package org.fluentlenium.adapter.cucumber.integration.noinheritance.java8.steps;
import cucumber.api.java8.En;
import org.fluentlenium.adapter.cucumber.integration.page.LocalPage;
import org.fluentlenium.core.annotation.Page;
public class Java8Steps implements En {
@Page
protected LocalPage page;
@Page
protected LocalPage page2;
public Java8Steps() {
Given("scenario I am on the first page", () -> page.go());
When("scenario I click on next page", () -> page.clickLink());
Then("scenario I am on the second page", () -> page2.isAt());
}
}
| [
"adrian.koryl@gmail.com"
] | adrian.koryl@gmail.com |
fd7cd4273471589dcea7a527df2f5922c69c78bc | 47151cbbba224be6acfc83b73d217584da2042e0 | /demo/src/main/java/com/sda/demo/service/CategoryService.java | 2aab67b6850ea410c65e81a0c77e688ca565b19e | [] | no_license | taviJava/Online-store | 85f7a87cfa84ad4a422cd7e2e4db51afdb641f52 | 31cc72296f126f45052855ed31788fa347b11642 | refs/heads/main | 2023-02-03T10:26:34.687106 | 2020-12-11T14:18:03 | 2020-12-11T14:18:03 | 302,830,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,085 | java | package com.sda.demo.service;
import com.sda.demo.persitance.dto.CategoryDto;
import com.sda.demo.persitance.model.CategoryModel;
import com.sda.demo.repository.CategoryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class CategoryService {
@Autowired
private CategoryRepository categoryRepository;
public List<CategoryDto> getAllCategories(){
List<CategoryModel> categories = categoryRepository.findAll();
List<CategoryDto> categoriesDto = new ArrayList<>();
for (CategoryModel categoryModel: categories){
CategoryDto categoryDto = new CategoryDto();
categoryDto.setId(categoryModel.getId());
categoryDto.setName(categoryModel.getName());
if (categoryModel.getParent()!= null){
CategoryModel paternM = categoryModel.getParent();
CategoryDto paternD = new CategoryDto();
paternD.setId(paternM.getId());
paternD.setName(paternM.getName());
categoryDto.setParent(paternD);
}
categoriesDto.add(categoryDto);
}
return categoriesDto;
}
public List<CategoryDto> findCategoriesByParent(long id){
List<CategoryModel> categories = categoryRepository.findByParent_Id(id);
List<CategoryDto> categoriesDto = new ArrayList<>();
for (CategoryModel categoryModel: categories){
CategoryDto categoryDto = new CategoryDto();
categoryDto.setId(categoryModel.getId());
categoryDto.setName(categoryModel.getName());
if (categoryModel.getParent()!= null){
CategoryModel paternM = categoryModel.getParent();
CategoryDto paternD = new CategoryDto();
paternD.setId(paternM.getId());
paternD.setName(paternM.getName());
categoryDto.setParent(paternD);
}
categoriesDto.add(categoryDto);
}
return categoriesDto;
}
public List<CategoryDto> getCategories(){
List <CategoryDto> categoriesAll = getAllCategories();
List <CategoryDto> categories = new ArrayList<>();
for (CategoryDto categoryDto: categoriesAll){
if (categoryDto.getParent()==null){
categories.add(categoryDto);
}
}
List<CategoryDto> subCategories = getSubCategories();
for (CategoryDto subCat: subCategories){
for (CategoryDto cat: categories){
if (subCat.getParent().getId()==cat.getId()){
cat.getSubcategories().add(subCat);
}
}
}
return categories;
}
public List<CategoryDto> getSubCategories(){
List <CategoryDto> categoriesAll = getAllCategories();
List <CategoryDto> subCategories = new ArrayList<>();
for (CategoryDto categoryDto: categoriesAll){
if (categoryDto.getParent()!=null){
subCategories.add(categoryDto);
}
}
return subCategories;
}
public void add(CategoryDto categoryDto){
CategoryModel categoryModel = new CategoryModel();
categoryModel.setName(categoryDto.getName());
CategoryDto parentCategory= categoryDto.getParent();
if (parentCategory != null){
CategoryModel parentCategoryModel = categoryRepository.findById(parentCategory.getId()).orElse(null);
categoryModel.setParent(parentCategoryModel);
}
categoryRepository.save(categoryModel);
}
public CategoryDto getCategory(long id){
CategoryModel categoryModel = categoryRepository.findById(id).orElse(null);
CategoryDto categoryDto = new CategoryDto();
categoryDto.setId(categoryModel.getId());
categoryDto.setName(categoryModel.getName());
List<CategoryModel> subCategories = categoryModel.getSubcategories();
List<CategoryDto> subCategoryDtos = new ArrayList<>();
for (CategoryModel subCategory: subCategories){
CategoryDto subCategoryDto = new CategoryDto();
subCategoryDto.setId(subCategory.getId());
subCategoryDto.setName(subCategory.getName());
subCategoryDtos.add(subCategoryDto);
}
categoryDto.setSubcategories(subCategoryDtos);
return categoryDto;
}
public void delete(long id){
categoryRepository.deleteById(id);
}
public void update(CategoryDto categoryDto){
CategoryModel categoryModel = categoryRepository.findById(categoryDto.getId()).orElse(null);
categoryModel.setName(categoryDto.getName());
CategoryDto parentCategory= categoryDto.getParent();
if (parentCategory != null){
CategoryModel parentCategoryModel = categoryRepository.findById(parentCategory.getId()).orElse(null);
categoryModel.setParent(parentCategoryModel);
}
categoryRepository.save(categoryModel);
}
}
| [
"tavi.zorila@gmail.com"
] | tavi.zorila@gmail.com |
461cad53a6cda79187d00b736ff57d47a95c619d | a81522e25ea3fc88004ccebc3b66dd65a5c2e816 | /src/main/java/ca/tourism/platform/sdk/entity/claim/ClaimStatus.java | df88f9bf8ac0ff9442b3f24640eac29d1cdccc78 | [] | no_license | arawakcaribbean/arawak-java-sdk | 1428475bd861ef36ea78752cba9e6ee02d982407 | f93dfc0a7dbc2ceb89be546b4ad31e62af162bf3 | refs/heads/master | 2020-05-23T08:38:04.443373 | 2019-05-16T16:57:34 | 2019-05-16T16:57:34 | 186,692,437 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 234 | java | package ca.tourism.platform.sdk.entity.claim ;
public enum ClaimStatus {
CLAIMED,
REPORTED_BY_MAIL,
WIZARD_COMPLETED_BY_CLAIMER,
IN_VERIFICATION,
ACEPTED,
REJECTED_BY_CLAIMER,
REJECTED_BY_TIME,
REJECTED_BY_ADMIN,
STOPPED
}
| [
"ups@gmail.com"
] | ups@gmail.com |
f9c86201d21225daba03dfaa4f069b0b5c3da32b | a5bcbc7ed5f50cde2ccb862aa3450a0aa6cfbde8 | /01-algorithm/src/main/java/org/sprintdragon/algorithm/tiku50/T25HuiWenShu.java | 84c84c5b3dc79bded210545899c0a53e07285410 | [] | no_license | psiitoy/accumulate | f733b35929864658e8eeb342792521afaf2f1aac | 1059cf22d1b2d3cc7919e185ae94d380e045bf8f | refs/heads/master | 2022-05-04T05:35:14.261835 | 2022-04-09T12:26:21 | 2022-04-09T12:26:21 | 100,947,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 543 | java | package org.sprintdragon.algorithm.tiku50;
/**
* 题目:一个5位数,判断它是不是回文数。即12321是回文数,个位与万位相同,十位与千位相同。
* Created by wangdi on 17-4-25.
*/
public class T25HuiWenShu {
public static void main(String[] args) {
System.out.println(huiwen(23432));
}
public static boolean huiwen(int n) {
if (n / 10000 == n % 10 && (n % 10000) / 1000 == (n % 100) / 10) {
return true;
} else {
return false;
}
}
}
| [
"psiitoy@126.com"
] | psiitoy@126.com |
990c74ee369721a4789cfc3b7d41aabeb3d474a7 | 3090b8ea3bf321a143669aaabb4f85b4cc5df534 | /src/main/java/com/sg/vendingmachine/service/InsufficientFundsException.java | 181b055985f84cc9c586ea531b6af69131e4b94f | [] | no_license | mcmu0040/VendingMachineConsoleApp | cbc9f5d25e222c559555c4a23c0cffb39f2d509a | b1d597e57cf659651f3ec0d9b35dd1ec0c35f448 | refs/heads/master | 2020-03-21T04:28:52.926412 | 2018-06-21T02:43:15 | 2018-06-21T02:43:15 | 138,110,295 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 516 | 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 com.sg.vendingmachine.service;
/**
*
* @author mcmu0
*/
public class InsufficientFundsException extends Exception {
public InsufficientFundsException(String string) {
super(string);
}
public InsufficientFundsException(String string, Throwable thrwbl) {
super(string, thrwbl);
}
}
| [
"mcmu0040@gmail.com"
] | mcmu0040@gmail.com |
04b00381919f2a67fd7b106886eaaf2bcbcadbe5 | f3ffe3c8d3ca7d46451198fdcff7124ac9d27e51 | /sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/implementation/models/ComposeRequest.java | 0bef497fd2da5d656c6c83fa8fac5896cd18fda8 | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-generic-cla"
] | permissive | pmakani/azure-sdk-for-java | 7f0a0e3832a66f53eeb3ee09a4fe08a0033c9faf | 6b259d1ea07342ceeccd89615348f8e0db02d4c6 | refs/heads/master | 2022-12-24T05:44:30.317176 | 2020-09-29T07:53:49 | 2020-09-29T07:53:49 | 299,564,055 | 1 | 0 | MIT | 2020-09-29T09:12:59 | 2020-09-29T09:12:58 | null | UTF-8 | Java | false | false | 1,784 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.ai.formrecognizer.implementation.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.UUID;
/** The ComposeRequest model. */
@Fluent
public final class ComposeRequest {
/*
* List of model ids to compose.
*/
@JsonProperty(value = "modelIds", required = true)
private List<UUID> modelIds;
/*
* Optional user defined model name (max length: 1024).
*/
@JsonProperty(value = "modelName")
private String modelName;
/**
* Get the modelIds property: List of model ids to compose.
*
* @return the modelIds value.
*/
public List<UUID> getModelIds() {
return this.modelIds;
}
/**
* Set the modelIds property: List of model ids to compose.
*
* @param modelIds the modelIds value to set.
* @return the ComposeRequest object itself.
*/
public ComposeRequest setModelIds(List<UUID> modelIds) {
this.modelIds = modelIds;
return this;
}
/**
* Get the modelName property: Optional user defined model name (max length: 1024).
*
* @return the modelName value.
*/
public String getModelName() {
return this.modelName;
}
/**
* Set the modelName property: Optional user defined model name (max length: 1024).
*
* @param modelName the modelName value to set.
* @return the ComposeRequest object itself.
*/
public ComposeRequest setModelName(String modelName) {
this.modelName = modelName;
return this;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f4d65ca77a2c684305a4e70bdd8674b8ec5dd505 | f1e36e4786f3d046588931edaba33cb2333d82ac | /CS3340 Asn1/src/asn2_3340/Pixel.java | 270d4550d584a1a904afaf2883746016793c2858 | [] | no_license | robinsone/Homeworks | da2b77992d8b8fc2703856054d327ce2424d0ad3 | 5af138d8055a77ac1b5e0e410ee427cc84ab1e24 | refs/heads/master | 2020-05-18T04:54:11.214127 | 2015-02-01T23:47:23 | 2015-02-01T23:47:23 | 13,656,575 | 3 | 9 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package asn2_3340;
/**
*
* @author ericrobinson
*/
public class Pixel {
private int x;//column
private int y;//row
private char value;//character
public Pixel() {
this.x = 0;
this.y = 0;
this.value = ' ';
}
public Pixel(int x, int y, char value){
this.x = x;
this.y = y;
this.value = value;
}
public char getValue() {
return value;
}
public void setValue(char value) {
this.value = value;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}
| [
"eric.z.robinson@gmail.com"
] | eric.z.robinson@gmail.com |
2590ee6075e0e056013158baa49f71b34eb93a4d | d76c402c2f3668a5d76db6d6cf3a5c22a04299ae | /src/com/thalesgroup/optet/devenv/compilation/ShellBuilder.java | d48714f41fa1161a8cffe575d77cd37e27b903d9 | [] | no_license | TrustworthyFactory/DevenvFactory | e108fed09308389fbf37cc7a54e457aa9faa4600 | 01c859bd7b75f6c644a429a6ed3ae42c782abd1d | refs/heads/master | 2021-01-23T19:34:43.864397 | 2015-09-28T14:23:33 | 2015-09-28T14:23:33 | 41,912,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,331 | java | package com.thalesgroup.optet.devenv.compilation;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/*
* OPTET Factory
*
* Class ShellBuilder 1.0 1 sept. 2014
*
* Copyright (c) 2013 Thales Communications & Security SAS
* 4, Avenue des Louvresses - 92230 Gennevilliers
* All rights reserved
*
*/
/**
* @author F. Motte
*
*/
public class ShellBuilder {
class AfficheurFlux implements Runnable {
private final InputStream inputStream;
private String type;
AfficheurFlux(InputStream inputStream, String type) {
this.inputStream = inputStream;
this.type = type;
}
private BufferedReader getBufferedReader(InputStream is) {
return new BufferedReader(new InputStreamReader(is));
}
@Override
public void run() {
BufferedReader br = getBufferedReader(inputStream);
String ligne = "";
try {
while ((ligne = br.readLine()) != null) {
System.out.println("ligne " + type+ " " + ligne);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void build (IProject project, File launcher, String option){
System.out.println(executeCommand(project, launcher.getAbsolutePath(), option, null, null));
}
public void build (IProject project, String launcher, String option, File output){
System.out.println(executeCommand(project, launcher, option, output,null));
}
public void build (IProject project, String launcher, String option, File output, Map<String, String> env){
System.out.println(executeCommand(project, launcher, option, output,env));
}
private String executeCommand(IProject project, String file, String command, File output, Map<String, String> env) {
try {
//System.out.println(project.getRawLocation().toOSString());
//System.out.println("path " + new File(project.getRawLocation().toOSString()));
List<String> args = new ArrayList<String>();
args.add (file); // command name
String[] commandArray = command.split(" ");
for (int i = 0; i < commandArray.length; i++) {
System.out.println("add " + commandArray[i]);
args.add (commandArray[i]); // optional args added as separate list items
}
ProcessBuilder pb = new ProcessBuilder(args);
if (env!=null){
for (Map.Entry<String, String> entry : env.entrySet())
{
System.out.println(entry.getKey() + "/" + entry.getValue());
pb.environment().put(entry.getKey(), entry.getValue());
}
}
System.out.println(project.getLocationURI());
//pb.directory(new File(project.getRawLocation().toOSString()));
pb.directory(new File(project.getLocationURI()));
pb.redirectOutput(output);
Process p = pb.start();
AfficheurFlux fluxSortie = new AfficheurFlux(p.getInputStream(), "output");
AfficheurFlux fluxErreur = new AfficheurFlux(p.getErrorStream(), "error");
new Thread(fluxSortie).start();
new Thread(fluxErreur).start();
p.waitFor();
System.out.println("it's the end");
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return "";
}
}
| [
"frederic.motte@fr.thalesgroup.com"
] | frederic.motte@fr.thalesgroup.com |
d0fd8fc78c2d145beed169b01c9a39a327887574 | c7483680b836b784e8e3c32455170e1de1f66600 | /solid2021/src/main/java/pl/zzpj2021/solid/ocp/greeter/solution/CasualPersonality.java | 6d28ff8ebf8190595f0afbe354ed2a55762b7896 | [] | no_license | Xarria/ZZPJ2021Team | d8959fb0a2e201330bae17ebbd9a830e51fe780e | d4ca251e4d1261609e2c116aa4968acc4b6681cb | refs/heads/main | 2023-04-05T02:46:47.580383 | 2021-05-03T16:02:11 | 2021-05-03T16:02:11 | 345,940,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | package pl.zzpj2021.solid.ocp.greeter.solution;
public class CasualPersonality implements Personality {
public String greet() {
return "Sup bro?";
}
}
| [
"224360@edu.p.lodz.pl"
] | 224360@edu.p.lodz.pl |
a4ac13b4812b053cf1a2b5fa62ee77986ab54d48 | bcc097f0d0205e383fdf1c8748f00b7bfa6ce9a7 | /library/src/androidTest/java/com/tom_roush/pdfbox/pdmodel/graphics/image/PDImageXObjectTest.java | 6d6b0bcc77829e6acf7b66961b1cdf41d71aab92 | [] | permissive | ngochai84/PdfBox-Android | 78e6bb7dd7665fe6cf009aa68655e0dc3f470f5c | 46825f49c1abe9caf29a0facd7ad31362e7d877c | refs/heads/master | 2023-08-08T20:36:00.675757 | 2023-07-21T01:16:01 | 2023-07-21T01:16:01 | 223,908,424 | 0 | 0 | Apache-2.0 | 2023-02-28T00:10:02 | 2019-11-25T09:19:46 | Java | UTF-8 | Java | false | false | 14,394 | 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 com.tom_roush.pdfbox.pdmodel.graphics.image;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import androidx.test.platform.app.InstrumentationRegistry;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import com.tom_roush.pdfbox.android.PDFBoxResourceLoader;
import com.tom_roush.pdfbox.android.TestResourceGenerator;
import com.tom_roush.pdfbox.io.IOUtils;
import com.tom_roush.pdfbox.pdmodel.PDDocument;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
* Test that the convenience methods are really doing what's expected, and having the same as
* the more focused factory methods.
*
* @author Tilman Hausherr
*/
public class PDImageXObjectTest
{
private Context testContext;
private String inPath = "pdfbox/com/tom_roush/pdfbox/pdmodel/graphics/image/";
private File CACHE_DIR;
@Before
public void setUp() throws Exception
{
testContext = InstrumentationRegistry.getInstrumentation().getContext();
PDFBoxResourceLoader.init(testContext);
CACHE_DIR = new File(testContext.getCacheDir(), "assets");
CACHE_DIR.mkdirs();
}
public PDImageXObjectTest()
{
}
/**
* Test of createFromFileByExtension method, of class PDImageXObject.
*/
@Test
public void testCreateFromFileByExtension() throws Exception
{
testCompareCreatedFileByExtensionWithCreatedByCCITTFactory("ccittg4.tif");
testCompareCreatedFileByExtensionWithCreatedByJPEGFactory("jpeg.jpg");
testCompareCreatedFileByExtensionWithCreatedByJPEGFactory("jpegcmyk.jpg");
testCompareCreatedFileByExtensionWithCreatedByLosslessFactory("gif.gif");
// testCompareCreatedFileByExtensionWithCreatedByLosslessFactory("gif-1bit-transparent.gif");
// testCompareCreatedFileByExtensionWithCreatedByLosslessFactory("png_indexed_8bit_alpha.png");
testCompareCreatedFileByExtensionWithCreatedByLosslessFactory("png.png");
// testCompareCreatedFileByExtensionWithCreatedByLosslessFactory("lzw.tif");
}
/**
* Test of createFromFile method, of class PDImageXObject.
*/
@Test
public void testCreateFromFile() throws Exception
{
testCompareCreatedFileWithCreatedByCCITTFactory("ccittg4.tif");
testCompareCreatedFileWithCreatedByJPEGFactory("jpeg.jpg");
testCompareCreatedFileWithCreatedByJPEGFactory("jpegcmyk.jpg");
testCompareCreatedFileWithCreatedByLosslessFactory("gif.gif");
// testCompareCreatedFileWithCreatedByLosslessFactory("gif-1bit-transparent.gif");
// testCompareCreatedFileWithCreatedByLosslessFactory("png_indexed_8bit_alpha.png");
testCompareCreatedFileWithCreatedByLosslessFactory("png.png");
// testCompareCreatedFileWithCreatedByLosslessFactory("lzw.tif");
}
/**
* Test of createFromFileByContent method, of class PDImageXObject.
*/
@Test
public void testCreateFromFileByContent() throws Exception
{
testCompareCreateByContentWithCreatedByCCITTFactory("ccittg4.tif");
testCompareCreatedByContentWithCreatedByJPEGFactory("jpeg.jpg");
testCompareCreatedByContentWithCreatedByJPEGFactory("jpegcmyk.jpg");
testCompareCreatedByContentWithCreatedByLosslessFactory("gif.gif");
// testCompareCreatedByContentWithCreatedByLosslessFactory("gif-1bit-transparent.gif");
// testCompareCreatedByContentWithCreatedByLosslessFactory("png_indexed_8bit_alpha.png");
testCompareCreatedByContentWithCreatedByLosslessFactory("png.png");
// testCompareCreatedByContentWithCreatedByLosslessFactory("lzw.tif");
}
/**
* Test of createFromByteArray method, of class PDImageXObject.
*/
@Test
public void testCreateFromByteArray() throws Exception
{
testCompareCreatedFromByteArrayWithCreatedByCCITTFactory("ccittg4.tif");
testCompareCreatedFromByteArrayWithCreatedByJPEGFactory("jpeg.jpg");
testCompareCreatedFromByteArrayWithCreatedByJPEGFactory("jpegcmyk.jpg");
testCompareCreatedFromByteArrayWithCreatedByLosslessFactory("gif.gif");
// testCompareCreatedFromByteArrayWithCreatedByLosslessFactory("gif-1bit-transparent.gif");
// testCompareCreatedFromByteArrayWithCreatedByLosslessFactory("png_indexed_8bit_alpha.png");
testCompareCreatedFromByteArrayWithCreatedByLosslessFactory("png.png");
// testCompareCreatedFromByteArrayWithCreatedByLosslessFactory("lzw.tif");
}
private void testCompareCreatedFileByExtensionWithCreatedByLosslessFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
PDImageXObject image = PDImageXObject.createFromFileByExtension(file, doc);
Bitmap bim = BitmapFactory.decodeStream(testContext.getAssets().open(inPath + filename));
PDImageXObject expectedImage = LosslessFactory.createFromImage(doc, bim);
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedFileByExtensionWithCreatedByCCITTFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
PDImageXObject image = PDImageXObject.createFromFileByExtension(file, doc);
PDImageXObject expectedImage = CCITTFactory.createFromFile(doc, file);
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedFileByExtensionWithCreatedByJPEGFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
PDImageXObject image = PDImageXObject.createFromFileByExtension(file, doc);
PDImageXObject expectedImage = JPEGFactory.createFromStream(doc, new FileInputStream(file));
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedFileWithCreatedByLosslessFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
PDImageXObject image = PDImageXObject.createFromFile(file.getAbsolutePath(), doc);
Bitmap bim = BitmapFactory.decodeStream(testContext.getAssets().open(inPath + filename));
PDImageXObject expectedImage = LosslessFactory.createFromImage(doc, bim);
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedFileWithCreatedByCCITTFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
PDImageXObject image = PDImageXObject.createFromFile(file.getAbsolutePath(), doc);
PDImageXObject expectedImage = CCITTFactory.createFromFile(doc, file);
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedFileWithCreatedByJPEGFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
PDImageXObject image = PDImageXObject.createFromFile(file.getAbsolutePath(), doc);
PDImageXObject expectedImage = JPEGFactory.createFromStream(doc, new FileInputStream(file));
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedByContentWithCreatedByLosslessFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
PDImageXObject image = PDImageXObject.createFromFileByContent(file, doc);
Bitmap bim = BitmapFactory.decodeStream(testContext.getAssets().open(inPath + filename));
PDImageXObject expectedImage = LosslessFactory.createFromImage(doc, bim);
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreateByContentWithCreatedByCCITTFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
PDImageXObject image = PDImageXObject.createFromFileByContent(file, doc);
PDImageXObject expectedImage = CCITTFactory.createFromFile(doc, file);
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedByContentWithCreatedByJPEGFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
PDImageXObject image = PDImageXObject.createFromFileByContent(file, doc);
PDImageXObject expectedImage = JPEGFactory.createFromStream(doc, new FileInputStream(file));
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedFromByteArrayWithCreatedByLosslessFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
byte[] byteArray = IOUtils.toByteArray(new FileInputStream(file));
PDImageXObject image = PDImageXObject.createFromByteArray(doc, byteArray, null);
Bitmap bim = BitmapFactory.decodeStream(testContext.getAssets().open(inPath + filename));
PDImageXObject expectedImage = LosslessFactory.createFromImage(doc, bim);
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedFromByteArrayWithCreatedByCCITTFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
byte[] byteArray = IOUtils.toByteArray(new FileInputStream(file));
PDImageXObject image = PDImageXObject.createFromByteArray(doc, byteArray, null);
PDImageXObject expectedImage = CCITTFactory.createFromFile(doc, file);
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void testCompareCreatedFromByteArrayWithCreatedByJPEGFactory(String filename)
throws IOException, URISyntaxException
{
PDDocument doc = new PDDocument();
File file = TestResourceGenerator.copyStreamToFile(CACHE_DIR, filename, testContext.getAssets().open(inPath + filename));
byte[] byteArray = IOUtils.toByteArray(new FileInputStream(file));
PDImageXObject image = PDImageXObject.createFromByteArray(doc, byteArray, null);
PDImageXObject expectedImage = JPEGFactory.createFromStream(doc, new FileInputStream(file));
Assert.assertEquals(expectedImage.getSuffix(), image.getSuffix());
checkIdentARGB(image.getImage(), expectedImage.getImage());
doc.close();
}
private void checkIdentARGB(Bitmap expectedImage, Bitmap actualImage)
{
String errMsg = "";
int w = expectedImage.getWidth();
int h = expectedImage.getHeight();
Assert.assertEquals(w, actualImage.getWidth());
Assert.assertEquals(h, actualImage.getHeight());
for (int y = 0; y < h; ++y)
{
for (int x = 0; x < w; ++x)
{
if (expectedImage.getPixel(x, y) != actualImage.getPixel(x, y))
{
errMsg = String.format("(%d,%d) %06X != %06X", x, y, expectedImage.getPixel(x, y), actualImage.getPixel(x, y));
}
Assert.assertEquals(errMsg, expectedImage.getPixel(x, y), actualImage.getPixel(x, y));
}
}
}
}
| [
"ngochai84@gmail.com"
] | ngochai84@gmail.com |
c8fca4184ddb626d40f4cc622a7f0665c9e1b678 | 991e31e7d31e3ff03d0e6eab7e2b3e8987fd853d | /rest-framework-example/rest-framework-build/src/main/java/com/young/example/rest/framework/build/plugin/ExecuteCostPlugin.java | f9ba734a0ced02a336236e0b9b60e5300a5a9955 | [] | no_license | yangwx1402/young-examples | 0850ffbeff032d0247814df3422f72fd695f1983 | ae28b922a870c524ce3eae102a7229646c42511a | refs/heads/master | 2021-04-12T03:40:40.944129 | 2018-07-07T09:09:45 | 2018-07-07T09:09:45 | 53,644,263 | 27 | 11 | null | 2017-08-11T10:15:04 | 2016-03-11T06:12:49 | JavaScript | UTF-8 | Java | false | false | 1,028 | java | package com.young.example.rest.framework.build.plugin;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by Administrator on 2016/5/17.
*/
public class ExecuteCostPlugin extends OncePerRequestFilter {
private static Log log = LogFactory.getLog(ExecuteCostPlugin.class);
@Override
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {
long start = System.currentTimeMillis();
filterChain.doFilter(httpServletRequest,httpServletResponse);
log.info(httpServletRequest.getSession()+" execute request cost time -["+(System.currentTimeMillis()-start)+"]");
}
}
| [
"398901650@qq.com"
] | 398901650@qq.com |
30f696ec4850739b1b6b919620086d3422bc41f3 | 2d77de530602b7267157a8496fc7bb213e0ea47c | /TemptProject/phbaselib/src/main/java/com/heterpu/phbaselib/utils/ViewFindUtils.java | e1a8b8299822e02af2d47e6ef60b331af05bdc51 | [
"MIT"
] | permissive | HeterPu/BaseLibsForAndroid | 334e00f4394dc237416b7579953a9986f688d971 | 63377ea9c17b9e962f3e35e355f3987eafb2732a | refs/heads/master | 2020-03-27T22:00:07.525350 | 2019-09-10T04:33:17 | 2019-09-10T04:33:17 | 147,195,884 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,089 | java | package com.heterpu.phbaselib.utils;
import android.util.SparseArray;
import android.view.View;
@SuppressWarnings({ "unchecked" })
public class ViewFindUtils
{
/**
* ViewHolder简洁写法,避免适配器中重复定义ViewHolder,减少代码量 用法:
*
* <pre>
* if (convertView == null)
* {
* convertView = View.inflate(context, R.layout.ad_demo, null);
* }
* TextView tv_demo = ViewHolderUtils.get(convertView, R.id.tv_demo);
* ImageView iv_demo = ViewHolderUtils.get(convertView, R.id.iv_demo);
* </pre>
*/
public static <T extends View> T hold(View view, int id)
{
SparseArray<View> viewHolder = (SparseArray<View>) view.getTag();
if (viewHolder == null)
{
viewHolder = new SparseArray<View>();
view.setTag(viewHolder);
}
View childView = viewHolder.get(id);
if (childView == null)
{
childView = view.findViewById(id);
viewHolder.put(id, childView);
}
return (T) childView;
}
/**
* 替代findviewById方法
*/
public static <T extends View> T find(View view, int id)
{
return (T) view.findViewById(id);
}
}
| [
"wycgpeterhu@sina.com"
] | wycgpeterhu@sina.com |
58f5a2b5ce2be0014e33decb0541e7a7b3bc3cf9 | 5dc172b057bf846146e326b9dc2b62c7834c871b | /org.eclipsercp.integration/src/org/eclipsercp/integration/wizard/AddSystemModelPage.java | 4ecbc8674b00b7e920362277585596fb937a803d | [] | no_license | shengwangtai/MISDT | 1dd7ce41306ae15d90c871d5cbb0c05e450339bf | c70bffd5e86ee10026a99a144f6601357919fb78 | refs/heads/master | 2020-12-25T19:14:48.349351 | 2013-09-22T01:09:52 | 2013-09-22T01:09:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,077 | java | package org.eclipsercp.integration.wizard;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.layout.GridData;
public class AddSystemModelPage extends WizardPage {
private Text text;
private Text text_1;
private String projectName;
private IFolder storeFolder;
private IFolder srcFolder;
/**
* Create the wizard.
*/
public AddSystemModelPage(String projectName) {
super("add system model");
setTitle("add system model");
setDescription("add system model.");
this.projectName = projectName;
srcFolder = ResourcesPlugin.getWorkspace().getRoot()
.getProject(projectName).getFolder("src");
storeFolder = ResourcesPlugin.getWorkspace().getRoot()
.getProject(projectName)
.getFolder(projectName + "_systemModel");
}
/**
* Create contents of the wizard.
*
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
container.setLayout(new GridLayout(2, false));
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
Label label = new Label(container, SWT.NONE);
label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false,
1, 1));
label.setText("system Name:");
text = new Text(container, SWT.BORDER);
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
Label label_1 = new Label(container, SWT.NONE);
label_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false,
1, 1));
label_1.setText("description:");
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
text_1 = new Text(container, SWT.BORDER);
GridData gd_text_1 = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,
1);
gd_text_1.heightHint = 155;
text_1.setLayoutData(gd_text_1);
}
public boolean finsh() {
boolean result = false;
if (storeFolder != null) {
try {
IFile SystemodelFile = storeFolder.getFile(text.getText()
+ ".systemModel");
String contents = "";
InputStream systemModelsource = new ByteArrayInputStream(
contents.getBytes());
SystemodelFile.create(systemModelsource, false, null);
IFile SystemmodelXml = srcFolder.getFile("App_systemModel/"
+ text.getText() + ".xml");
String xmlcontents = "";
InputStream SystemmodelXmlStream = new ByteArrayInputStream(
xmlcontents.getBytes());
SystemmodelXml.create(SystemmodelXmlStream, false, null);
result = true;
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
result = false;
}
}
return result;
}
}
| [
"hestia411@gmail.com"
] | hestia411@gmail.com |
0f889a74035596988e91362e64c2e2cdf2143fef | a7a2ca50630825d428370a3f219ceb1c05ac90d6 | /app/src/main/java/com/example/easyzhihu/gson/ShortComments.java | 032987161d180606cf6380c59ad1832016e15ff3 | [] | no_license | TakeItEasyJQ/EasyZhihu | 93497c95d9b49f3ade96358cc06f79e84afa1002 | 7ff4757d369451ccf04d4c2ee4afa39cf7c9fd28 | refs/heads/master | 2021-05-11T03:51:20.535697 | 2018-03-09T07:48:29 | 2018-03-09T07:48:29 | 117,925,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package com.example.easyzhihu.gson;
import java.util.List;
/**
* Created by My Computer on 2017/12/14.
*/
public class ShortComments { //短评论
public List<Comment> comments;
public class Comment{
public String author;
public String content;
public int id;
public int likes;
public int time;
public String avatar;
public Reply reply_to;
public class Reply{
public String content;
public int id;
public int status;
public String author;
public String err_msg; //status非0时出现
}
}
}
| [
"289736033@qq.com"
] | 289736033@qq.com |
25723018c936baecf311aafba26f26d3908ec604 | 6797eba9fc585bd5e8936183cabd756343a49804 | /s4/B183341/TestCase.java | ed730f209c0cf0ecfe9f65b408a1ae7514d628c5 | [] | no_license | tut193318/2019informationQuantity | e96a1e2505e7164ec3d18c53e560888d3d55c591 | 42f25e08c7f84a6a042c063e775a3c6367eac609 | refs/heads/master | 2020-11-25T07:24:43.997619 | 2020-02-18T06:57:35 | 2020-02-18T06:57:35 | 228,555,709 | 1 | 0 | null | 2019-12-17T07:12:16 | 2019-12-17T07:12:15 | null | UTF-8 | Java | false | false | 8,391 | java | package s4.B183341; // Please modify to s4.Bnnnnnn, where nnnnnn is your student ID.
import java.lang.*;
import s4.specification.*;
/*
interface FrequencerInterface { // This interface provides the design for frequency counter.
void setTarget(byte[] target); // set the data to search.
void setSpace(byte[] space); // set the data to be searched target from.
int frequency(); //It return -1, when TARGET is not set or TARGET's length is zero
//Otherwise, it return 0, when SPACE is not set or Space's length is zero
//Otherwise, get the frequency of TAGET in SPACE
int subByteFrequency(int start, int end);
// get the frequency of subByte of taget, i.e target[start], taget[start+1], ... , target[end-1].
// For the incorrect value of START or END, the behavior is undefined.
}
*/
/*
package s4.specification;
public interface InformationEstimatorInterface{
void setTarget(byte target[]); // set the data for computing the information quantities
void setSpace(byte space[]); // set data for sample space to computer probability
double estimation(); // It returns 0.0 when the target is not set or Target's length is zero;
// It returns Double.MAX_VALUE, when the true value is infinite, or space is not set.
// The behavior is undefined, if the true value is finete but larger than Double.MAX_VALUE.
// Note that this happens only when the space is unreasonably large. We will encounter other problem anyway.
// Otherwise, estimation of information quantity,
}
*/
public class TestCase {
public static void main(String[] args) {
try {
FrequencerInterface myObject;
int freq;
System.out.println("checking s4.B183341.Frequencer");
myObject = new s4.B183341.Frequencer();
//SPACEを設定しない場合
try{
System.out.print("SPACEを設定しない場合:");
myObject.setTarget("H".getBytes());
freq = myObject.frequency();
if(freq == 0) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//SPACEの長さがゼロの場合
try{
System.out.print("SPACEの長さがゼロの場合:");
myObject.setSpace("".getBytes());
myObject.setTarget("H".getBytes());
freq = myObject.frequency();
if(freq == 0) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//TARGETを設定しない場合
try{
System.out.print("TARGETを設定しない場合:");
myObject = new s4.B183341.Frequencer(); //上記のテストの際TARGETを設定しているため,newで初期化
myObject.setSpace("Hi Ho Hi Ho".getBytes());
freq = myObject.frequency();
if(freq == -1) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//TARGETの長さがゼロの場合
try{
System.out.print("TARGETの長さがゼロの場合:");
myObject.setSpace("Hi Ho Hi Ho".getBytes());
myObject.setTarget("".getBytes());
freq = myObject.frequency();
if(freq == -1) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//通常テストケース1
try{
System.out.print("通常テスト1:");
myObject.setSpace("Bo Bo Bi Be Bo".getBytes());
myObject.setTarget("B".getBytes());
freq = myObject.frequency();
System.out.print("\"B\" in \"Bo Bo Bi Be Bo\" appears "+freq+" times. ");
if(freq == 5) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//通常テストケース2
try{
System.out.print("通常テスト2:");
myObject.setSpace(" a aa a".getBytes());
myObject.setTarget(" ".getBytes());
freq = myObject.frequency();
System.out.print("\" \" in \" a aa a\" appears "+freq+" times. ");
if(freq == 6) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//通常テストケース3
try{
System.out.print("通常テスト3:");
myObject.setSpace("Bsfs332fkao00aaaPPa".getBytes());
myObject.setTarget("a".getBytes());
freq = myObject.frequency();
System.out.print("\"a\" in \"Bsfs332fkao00aaaPPa\" appears "+freq+" times. ");
if(freq == 5) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
}
catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
try {
InformationEstimatorInterface myObject;
double value;
System.out.println("checking s4.B183341.InformationEstimator");
myObject = new s4.B183341.InformationEstimator();
//SPACEを設定しない場合
try{
System.out.print("SPACEを設定しない場合:");
myObject.setTarget("0".getBytes());
value = myObject.estimation();
if(value == Double.MAX_VALUE) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//SPACEの長さがゼロの場合
try{
System.out.print("SPACEの長さがゼロの場合:");
myObject.setSpace("".getBytes());
myObject.setTarget("0".getBytes());
value = myObject.estimation();
if(value == Double.MAX_VALUE) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//TARGETを設定しない場合
try{
System.out.print("TARGETを設定しない場合:");
myObject = new s4.B183341.InformationEstimator(); //上記のテストの際TARGETを設定しているため,newで初期化
myObject.setSpace("3210321001230123".getBytes());
value = myObject.estimation();
if(value == 0.0) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//TARGETの長さがゼロの場合
try{
System.out.print("TARGETの長さがゼロの場合:");
myObject.setSpace("3210321001230123".getBytes());
myObject.setTarget("".getBytes());
value = myObject.estimation();
if(value == 0.0) { System.out.println("OK"); } else {System.out.println("WRONG"); }
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
//通常テストケース
try{
myObject.setSpace("3210321001230123".getBytes());
myObject.setTarget("0".getBytes());
value = myObject.estimation();
System.out.println(">0 "+value);
myObject.setTarget("01".getBytes());
value = myObject.estimation();
System.out.println(">01 "+value);
myObject.setTarget("0123".getBytes());
value = myObject.estimation();
System.out.println(">0123 "+value);
myObject.setTarget("00".getBytes());
value = myObject.estimation();
System.out.println(">00 "+value);
}catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
}
catch(Exception e) {
System.out.println("Exception occurred: STOP");
}
}
}
| [
"tut.umemura.lab@gmail.com"
] | tut.umemura.lab@gmail.com |
5e9ca15ec9fd39684944669ba60c11f1483cd180 | 0e9d5ab16832f4763ec1ff21435962614fc7298e | /src/users/Users.java | 5cbb31ecfe651f1b6a817a47d269d4778779bcb8 | [] | no_license | harshal-choudhary7/last | 7e192ae8dd6d8cd06ad51942e1726a7628d9a00e | 1777a24ad5c268e2b66ab84d26e2829e9d845185 | refs/heads/master | 2020-09-21T18:33:04.900714 | 2019-11-29T16:01:50 | 2019-11-29T16:01:50 | 224,883,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,054 | java | package users;
public class Users
{
private int id;
private String name;
private String email;
private String phone;
private String password;
private String role;
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 Users(int id, String name, String email, String phone, String password, String role) {
super();
this.id = id;
this.name = name;
this.email = email;
this.phone = phone;
this.password = password;
this.role = role;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
}
| [
"harshalchoudhary7@gmail.com"
] | harshalchoudhary7@gmail.com |
b37da5ad8e30340423fbeff28383afed59d4f6f8 | 767fe0598bc14606d345b8b8e1659a8884b0f776 | /springbootuserwebservice/src/test/java/com/sb/SpringbootuserwebserviceApplicationTests.java | 0405e4588a55e4e1834399348be22b215ef9bcbf | [] | no_license | bhanu-git/springlearning | eeb6eb0b090c2049f1e642bba5e207ed9e1722b5 | 03f1bbcac0878676ba5c7739a9b12bd0c5ff0bc6 | refs/heads/master | 2020-09-05T23:17:47.800602 | 2020-03-02T12:13:31 | 2020-03-02T12:13:31 | 220,240,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package com.sb;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringbootuserwebserviceApplicationTests {
@Test
void contextLoads() {
}
}
| [
"bhkolli@BHKOLLI-LCHMG.partnet.cisco.com"
] | bhkolli@BHKOLLI-LCHMG.partnet.cisco.com |
58f4174e145592b3b5b522589173d9daa377fee2 | 9e1e266a223480f18430c4734a143cd6ebbd53da | /marylib/src/main/java/mf/org/apache/xerces/xni/Augmentations.java | 83e1e7f95317e79c3e2948a5a20b27a5590d220c | [] | no_license | farizaghayev/AndroidMaryTTS | 5e7bc3e9a2a4db9ff1e93877804b515fb197d880 | 9ffd7b831c4298e0c60644fb6e3f819651711330 | refs/heads/master | 2021-01-12T03:18:10.898257 | 2019-05-24T07:08:32 | 2019-05-24T07:08:32 | 78,184,107 | 0 | 0 | null | 2017-01-06T07:20:01 | 2017-01-06T07:20:01 | null | UTF-8 | Java | false | false | 2,943 | 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 mf.org.apache.xerces.xni;
import java.util.Enumeration;
/**
* The Augmentations interface defines a table of additional data that may
* be passed along the document pipeline. The information can contain extra
* arguments or infoset augmentations, for example PSVI. This additional
* information is identified by a String key.
* <p/>
* <strong>Note:</strong>
* Methods that receive Augmentations are required to copy the information
* if it is to be saved for use beyond the scope of the method.
* The Augmentations content is volatile, and maybe modified by any method in
* any component in the pipeline. Therefore, methods passed this structure
* should not save any reference to the structure.
*
* @author Elena Litani, IBM
* @version $Id: Augmentations.java 447247 2006-09-18 05:23:52Z mrglavas $
*/
public interface Augmentations {
/**
* Add additional information identified by a key to the Augmentations structure.
*
* @param key Identifier, can't be <code>null</code>
* @param item Additional information
* @return the previous value of the specified key in the Augmentations structure,
* or <code>null</code> if it did not have one.
*/
Object putItem(String key, Object item);
/**
* Get information identified by a key from the Augmentations structure
*
* @param key Identifier, can't be <code>null</code>
* @return the value to which the key is mapped in the Augmentations structure;
* <code>null</code> if the key is not mapped to any value.
*/
Object getItem(String key);
/**
* Remove additional info from the Augmentations structure
*
* @param key Identifier, can't be <code>null</code>
* @return the previous value of the specified key in the Augmentations structure,
* or <code>null</code> if it did not have one.
*/
Object removeItem(String key);
/**
* Returns an enumeration of the keys in the Augmentations structure
*/
Enumeration keys();
/**
* Remove all objects from the Augmentations structure.
*/
void removeAllItems();
}
| [
"fariz.aghayev@gmail.com"
] | fariz.aghayev@gmail.com |
e86b97015ec5e9778d745582e33736e2e30badd0 | 6252c165657baa6aa605337ebc38dd44b3f694e2 | /org.eclipse.epsilon.egl.sync/Scalability-Tests/boiler-To-Generate-400-Files/boiler-To-Generate-400-Files/syncregions-400Files/TemperatureController843.java | 661636fdb0449e635c5825bc98f7044a4dda28c2 | [] | no_license | soha500/EglSync | 00fc49bcc73f7f7f7fb7641d0561ca2b9a8ea638 | 55101bc781349bb14fefc178bf3486e2b778aed6 | refs/heads/master | 2021-06-23T02:55:13.464889 | 2020-12-11T19:10:01 | 2020-12-11T19:10:01 | 139,832,721 | 0 | 1 | null | 2019-05-31T11:34:02 | 2018-07-05T10:20:00 | Java | UTF-8 | Java | false | false | 364 | java | package syncregions;
public class TemperatureController843 {
public execute(int temperature843, int targetTemperature843) {
//sync _bfpnFUbFEeqXnfGWlV2843, behaviour
1-if(temperatureDifference > 0 && boilerStatus == true) { return 1; } else if (temperatureDifference < 0 && boilerStatus == false) { return 2; } else return 0;
//endSync
}
}
| [
"sultanalmutairi@172.20.10.2"
] | sultanalmutairi@172.20.10.2 |
8235c184a55cad8324f6df07e724a7dc7af8a00d | e1267cf0a1970eabfcb5411737b1fa3b292fd68f | /src/com/step/assignments/TeenNumberChecker.java | 75075b91c742d4f0bf030b58baf6704162410437 | [] | no_license | wittybones/java-Assignments | f203e28c84f2ae0524e613c1b8acebddc88a24c3 | 26900864a4b57c4ac251ec41f3f90e64c2250c2a | refs/heads/master | 2022-06-26T22:25:43.135641 | 2019-04-15T03:54:05 | 2019-04-15T03:54:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.step.assignments;
public class TeenNumberChecker {
public static void main(String[] args) {
System.out.println(hasTeen(10,13,20));
}
public static boolean hasTeen(int num1, int num2, int num3) {
if (isTeen(num1) || isTeen(num2) || isTeen(num3)) {
return true;
}
return false;
}
public static boolean isTeen(int number) {
if (number < 13 || number > 19) {
return false;
}
return true;
}
}
| [
"44019471+maheshsovani@users.noreply.github.com"
] | 44019471+maheshsovani@users.noreply.github.com |
13f6d08ec0f98d139cf58c0d4ccb317aa01733eb | dc5c66f54543ba500f7f2862e293cac8a032ac4c | /a-m/src/main/java/m/d/a/m/p/ru/algoprog/p1435.java | e839b9128f19580de03fd0bcaeabd257f5be834b | [] | no_license | kartzum/d-space | 1026318ccaf7e6fe4cfb54b1057b948dfcd2d97d | 7a90be0443a6298178494ac2de3d940697bca164 | refs/heads/master | 2023-01-28T00:35:39.105549 | 2023-01-18T19:45:41 | 2023-01-18T19:45:41 | 92,382,730 | 1 | 0 | null | 2020-08-14T17:30:37 | 2017-05-25T08:35:58 | Java | UTF-8 | Java | false | false | 1,674 | java | // https://algoprog.ru/material/p1435
package m.d.a.m.p.ru.algoprog;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class p1435 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String s = input.nextLine();
System.out.println(calc(s));
// System.out.println(calc("127.0.0.1"));
// System.out.println(calc("12...34"));
// System.out.println(calc("0.256.21.123"));
}
static String calc(String s) {
if (s == null || s.length() == 0) {
return "0";
}
List<String> parts = new ArrayList<>();
int i = 0;
StringBuilder buffer = new StringBuilder();
while (i < s.length()) {
char c = s.charAt(i);
if (c == '.') {
parts.add(buffer.toString());
buffer.delete(0, buffer.length());
}
if (c != '.') {
buffer.append(c);
}
i++;
}
if (buffer.length() > 0) {
parts.add(buffer.toString());
buffer.delete(0, buffer.length());
}
if (parts.size() != 4) {
return "0";
}
for (String p : parts) {
if (p.length() == 0) {
return "0";
}
for (int j = 0; j < p.length(); j++) {
if (!Character.isDigit(p.charAt(j))) {
return "0";
}
}
int v = Integer.parseInt(p);
if (v > 255 || v < 0) {
return "0";
}
}
return "1";
}
}
| [
"kartzum@gmail.com"
] | kartzum@gmail.com |
26e34c3d4924001b4313c392be0c23885588d59f | 983c58b3405200bda6614968b7a2ab4a6f05f611 | /app/src/main/java/com/ejoy/tool/ui/douyin/fragment/DouyinMainFragment.java | a7ab0200f85bd87879df671d4e5393a37c74b135 | [
"MIT",
"Apache-2.0"
] | permissive | maiduoduo/EJoy | cf501ffb8c942e487fd7ccb5d4717d6bbe584d59 | 5bd9423df0708592a734257013247077eab2a9d5 | refs/heads/master | 2023-06-21T19:59:38.468579 | 2023-06-11T14:47:15 | 2023-06-11T14:47:15 | 224,116,446 | 6 | 3 | null | 2021-04-01T06:12:07 | 2019-11-26T06:14:18 | Java | UTF-8 | Java | false | false | 3,455 | java | package com.ejoy.tool.ui.douyin.fragment;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import com.androidkun.xtablayout.XTabLayout;
import com.ejoy.tool.R;
import com.ejoy.tool.ui.base.base_fragment.BaseFragment;
import com.ejoy.tool.ui.douyin.bean.DouyinPauseVideoEvent;
import com.ejoy.tool.ui.douyin.data.adapter.DouyinCommPagerAdapter;
import com.ejoy.tool.ui.douyin.utils.RxBus;
import java.util.ArrayList;
import butterknife.BindView;
/**
* @ClassName: DouyinMainFragment
* @Author: maiduoduo
* @BLOG: https://blog.csdn.net/Maiduoudo
* @Date: 2021/2/2
* @des: 主页fragment
*/
public class DouyinMainFragment extends BaseFragment {
private DouyinCurrentLocationFragment currentLocationFragment;
private DouyinRecommendFragment recommendFragment;
@BindView(R.id.viewpager)
ViewPager viewPager;
@BindView(R.id.tab_title)
XTabLayout tabTitle;
@BindView(R.id.tab_mainmenu)
XTabLayout tabMainMenu;
private ArrayList<Fragment> fragments = new ArrayList<>();
private DouyinCommPagerAdapter pagerAdapter;
/** 默认显示第一页推荐页 */
public static int curPage = 1;
@Override
protected int getLayoutResource() {
return R.layout.fragment_douyin_main;
}
@Override
public void intBase() {
}
@Override
public void initPresenter() {
}
@Override
protected void initView(View rootView) {
setFragments();
setMainMenu();
}
@Override
protected void initData() {
}
@Override
protected void initListener() {
}
private void setFragments() {
currentLocationFragment = new DouyinCurrentLocationFragment();
recommendFragment = new DouyinRecommendFragment();
fragments.add(currentLocationFragment);
fragments.add(recommendFragment);
tabTitle.addTab(tabTitle.newTab().setText("杭州"));
tabTitle.addTab(tabTitle.newTab().setText("推荐"));
pagerAdapter = new DouyinCommPagerAdapter(getChildFragmentManager(), fragments, new String[] {"杭州", "推荐"});
viewPager.setAdapter(pagerAdapter);
tabTitle.setupWithViewPager(viewPager);
tabTitle.getTabAt(1).select();
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
curPage = position;
if (position == 1) {
//继续播放
RxBus.getDefault().post(new DouyinPauseVideoEvent(true));
} else {
//切换到其他页面,需要暂停视频
RxBus.getDefault().post(new DouyinPauseVideoEvent(false));
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
private void setMainMenu() {
tabMainMenu.addTab(tabMainMenu.newTab().setText("首页"));
tabMainMenu.addTab(tabMainMenu.newTab().setText("好友"));
tabMainMenu.addTab(tabMainMenu.newTab().setText(""));
tabMainMenu.addTab(tabMainMenu.newTab().setText("消息"));
tabMainMenu.addTab(tabMainMenu.newTab().setText("我"));
}
}
| [
"jfox.zxj@gmail.com"
] | jfox.zxj@gmail.com |
c866b5a5640ea84d324ee7ac54c2e2ce47fde430 | bd5ea60d109725fc10f6cc864895c012cff379aa | /spring-security-oauth/src/main/java/com/hua/modules/sys/entity/SysCaptchaEntity.java | ecc986e39dd3f4f91d6e7574b7124af7ae48268f | [
"Apache-2.0"
] | permissive | dearcode2018/auth-entire | cb9b7178112bf476daedc8b4d18bc1d560e0675a | b0988c6e924c790108c6f6ca8b418220bf0500bb | refs/heads/main | 2023-02-19T20:03:48.346592 | 2021-01-26T06:46:44 | 2021-01-26T06:46:44 | 319,167,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 690 | java | /**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.hua.modules.sys.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* 系统验证码
*
* @author Mark sunlightcs@gmail.com
*/
@Data
@TableName("sys_captcha")
public class SysCaptchaEntity {
@TableId(type = IdType.INPUT)
private String uuid;
/**
* 验证码
*/
private String code;
/**
* 过期时间
*/
private Date expireTime;
}
| [
""
] | |
5dfd11d9b28512b331681a9546cc958c461a9560 | 39b9eb9d37b1d7f2cde34c9a538afcf0946d25cd | /src/main/java/poi/dataImport/DataImportService.java | b48af558cc8db34131a3d1c9392d08a55ad8b297 | [] | no_license | mujicajuancarlos/G45 | e839c3e0077abb6f4cd0f913241c388619c6fe02 | 3b6e8b44fa69966127a85d53d7d36faf9a53fb28 | refs/heads/master | 2021-01-19T13:30:27.964794 | 2016-11-25T22:14:47 | 2016-11-25T22:14:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,847 | java | package poi.dataImport;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import poi.modelo.puntoDeInteres.POI;
import poi.repositorios.RepositorioPOI;
public abstract class DataImportService {
String keyApi = "AIzaSyC4l-KP4pCaBZ6DZSxEQkQD6kwGzhjM6ag";
public void importData() {
String uri = this.getRadarSearchUri();
String context = this.getRequestContext(uri);
try {
JSONObject json = new JSONObject(context);
if ( json.get("status").toString().equals("OK") ){
JSONArray results = json.getJSONArray("results");
for (int i = 0; i < results.length(); i++) {
JSONObject poiJson = results.getJSONObject(i);
this.processData(poiJson);
}
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
protected String keyGoogleApi() {
return keyApi;
}
protected JSONObject getPlaceData(String placeID) {
String uri = this.getPlaceDetailsUri(placeID);
String context = this.getRequestContext(uri);
try {
JSONObject json = new JSONObject(context);
if ( json.get("status").toString().equals("OK") ){
return json.getJSONObject("result");
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
private String getRequestContext(String uri) {
try {
HttpClient client = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(uri);
HttpResponse response;
response = client.execute(request);
BufferedReader buffer = new BufferedReader (new InputStreamReader(response.getEntity().getContent()));
StringBuilder stringBuilder = new StringBuilder();
String line="";
while ((line = buffer.readLine()) != null) {
stringBuilder.append(line);
}
return stringBuilder.toString();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return null;
}
private String getPlaceDetailsUri(String placeID) {
return "https://maps.googleapis.com/maps/api/place/details/json?" +
"placeid=" + placeID + "&" +
"key=" + this.keyGoogleApi();
}
protected void persistPoi(POI banco) {
// por ahora solo lo agrega al repo
RepositorioPOI.getInstance().agregarRegistro(banco);
System.out.println("create: "+ banco.toString());
}
abstract String getRadarSearchUri();
abstract void processData(JSONObject poi) throws JSONException;
}
| [
"mujicajuancarlos"
] | mujicajuancarlos |
c78513bd749d76482f13ea97b3a4680e25a6a706 | 4caeafabb3c8009fa930d1a6a5b500d1d925e308 | /src/ma/tcollection/yongLinkedList.java | f7944bef4c0c70bc6964b14eb9269d50af2a28e5 | [] | no_license | machenxing/practice-code | ef8edd399fe6f4279cfc17c884ceb97e11032cf4 | 18bbad4f63fe626c19671ebdb6fc79ea8384ae5d | refs/heads/master | 2020-03-16T18:15:00.220885 | 2018-05-16T12:17:24 | 2018-05-16T12:17:24 | 132,865,567 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 644 | java | package ma.tcollection;
import java.util.*;
public class yongLinkedList {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
LinkedList books=new LinkedList();
books.offer("Android江湖");
books.push("会当凌绝顶");
books.offerFirst("一览众山小");
for(int i=0;i<books.size();i++){
System.out.println(books.get(i));
}
System.out.println(books.peekFirst());
System.out.println(books.peekLast());
System.out.println(books.pop());
System.out.println(books);
System.out.println(books.pollLast());
System.out.println(books);
}
}
| [
"machenxing@139.com"
] | machenxing@139.com |
6e1ea93d28f98b05c54ac0fe7062ea2f2caf26b4 | 5741045375dcbbafcf7288d65a11c44de2e56484 | /reddit-decompilada/com/googlecode/mp4parser/h264/model/BitstreamElement.java | b337160680cc92452caae348d31a76e72371a42f | [] | no_license | miarevalo10/ReporteReddit | 18dd19bcec46c42ff933bb330ba65280615c281c | a0db5538e85e9a081bf268cb1590f0eeb113ed77 | refs/heads/master | 2020-03-16T17:42:34.840154 | 2018-05-11T10:16:04 | 2018-05-11T10:16:04 | 132,843,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 89 | java | package com.googlecode.mp4parser.h264.model;
public abstract class BitstreamElement {
}
| [
"mi.arevalo10@uniandes.edu.co"
] | mi.arevalo10@uniandes.edu.co |
2c4f2e22781896c63470073f8f1ffa5c512d1d29 | bd01068435d05f73fa321bbc2c8a33c4462fcbb2 | /health_parent/health_interface/src/main/java/com/xqx/eight/group/service/SetmealService.java | 6007e7f4164dedc20976d473527cd54b95c0d1f9 | [] | no_license | xqx1998/health | f0e0e37dfc26ee0195f202049337af1f6ab219c5 | 182ef114f9c663c4005935b22dae2f13b9e590c1 | refs/heads/master | 2022-12-22T14:53:45.820956 | 2019-11-18T00:38:51 | 2019-11-18T00:38:51 | 221,110,367 | 0 | 0 | null | 2022-12-16T04:29:35 | 2019-11-12T02:15:25 | JavaScript | UTF-8 | Java | false | false | 1,402 | java | package com.xqx.eight.group.service;
import com.eight.group.entity.PageResult;
import com.eight.group.entity.QueryPageBean;
import com.eight.group.pojo.Setmeal;
import com.eight.group.vo.SetmealReportVO;
import java.util.List;
/**
* @author: xingquanxiang
* createTime:2019/11/8 11:15
* description:
*/
public interface SetmealService {
/**
* 新增套餐
* @param setmeal 套餐信息
* @param checkgroupIds 所属检查组id们
*/
void add(Setmeal setmeal, Integer[] checkgroupIds);
/**
* 套餐分页查询
* @param queryPageBean
* @return PageResult
*/
PageResult findPage(QueryPageBean queryPageBean);
/**
* 根据id查询套餐数据
* @param id
* @return Setmeal
*/
Setmeal findById(Integer id);
/**
* 编辑套餐
* @param setmeal 套餐对象
* @param checkgroupIds 关联检查组id们
*/
void edit(Setmeal setmeal, Integer[] checkgroupIds);
/**
* 根据id删除套餐
* @param id 套餐id
*/
void delete(Integer id);
/**
* 查询所有套餐
* @return
*/
List<Setmeal> findAll();
/**
* 根据套餐id查询套餐详情(套餐基本详情, 套餐对应的检查组信息, 检查组对应的检查项信息)
* @param id
* @return Setmeal
*/
Setmeal findByIdDetail(Integer id);
}
| [
"2515658674@qq.com"
] | 2515658674@qq.com |
13b10ce3d37aed1c52d796a5311ed490c06182af | 481410cb36136cb362227740ecb4b2a19a26c4e0 | /DominoServer/src/dominoserver/ServerGame.java | 418bcbf55f9b82deb3135c2bbfaf8343d30167f5 | [] | no_license | MTACR/2021-REDES-DominoMultiplayer | 22f0187c8312281463cfa65655edab09dc5b2465 | bbc0dd62e5c084f73b9b6998c1163486de9bee39 | refs/heads/main | 2023-08-18T01:20:25.198259 | 2021-09-29T19:13:03 | 2021-09-29T19:13:03 | 411,797,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,293 | java | package dominoserver;
import dominoMultiplayer.classes.Domino;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author EmersonPL
*/
public class ServerGame implements Runnable {
private Domino game;
private int playerTurn;
private LinkedList<ServerClientHandler> clients;
private boolean gameover = false;
private int passes = 0;
public ServerGame(LinkedList<ServerClientHandler> clients, Domino game) {
this.clients = clients;
this.game = game;
this.playerTurn = 0;
}
public void setGame(Domino game) {
this.game = game;
}
public void setTurn(int turn) {
this.playerTurn = turn;
}
private DataInputStream getDISCurrentTurn() {
return clients.get(playerTurn).dis;
}
public void run() {
System.out.println("Starting game ...");
try {
for (ServerClientHandler client : clients) {
System.out.println("network.ServerGame.run() " + clients.size());
int hash = client.getPlayerHash();
System.out.println("network.ServerGame.run() " + clients.size() + " " + hash);
// Começa partida
client.sendToClient("START {"
+ "\n" + (clientTurn() == hash)
+ "\n}");
// COMANDO INICIAL
client.sendToClient("SETUP {"
+ "\n" + hash
+ "\n" + game.getPlayerHand(client.getPlayerHash())
+ "\n}");
}
System.out.println("Game started!");
updateGame();
while (!gameover) {
// Comandos vindo dos clientes
for (ServerClientHandler client : clients) {
int winnerHash = game.checkEnd();
if (winnerHash != -1) {
closeGame(winnerHash);
return;
}
if (client.getPlayerHash() == clientTurn()) {
boolean done;
do {
String clientCommand = client.dis.readUTF();
System.out.println("Client " + client.getPlayerHash() + ": " + clientCommand);
done = processCommand(clientCommand, client);
if (passes >= clients.size() * 2) {
closeGame(-1);
return;
}
} while (!done);
passTurn();
updateGame();
}
winnerHash = game.checkEnd();
if (winnerHash != -1) {
closeGame(winnerHash);
return;
}
}
}
} catch (IOException ex) {
System.err.println("Erro em ServerGame.run()");
System.err.println(ex);
}
}
private int getPlayerHash(int turn) {
return clients.get(turn).getPlayerHash();
}
private void passTurn() {
playerTurn = (playerTurn + 1) % clients.size();
}
private int clientTurn() {
return clients.get(playerTurn).getPlayerHash();
}
// retorna true se acaba rodada do jogador
private boolean processCommand(String command, ServerClientHandler cl) {
Scanner scanner = new Scanner(command);
String line = getNextLine(scanner);
boolean myTurn = false;
if (line.equals("PASS {")) {
passes++;
int hash = Integer.parseInt(getNextLine(scanner));
return true;
}
if (line.equals("BUY {")) {
int hash = Integer.parseInt(getNextLine(scanner));
boolean sucess = game.buyPiece(hash);
updatePlayerHand(cl, sucess);
passes = 0;
return false;
}
if (line.equals("ADD {")) {
try {
int hash = Integer.parseInt(getNextLine(scanner));
int index = Integer.parseInt(getNextLine(scanner));
int side = Integer.parseInt(getNextLine(scanner));
boolean result = game.addPiece(side, hash, index);
if (!result) {
cl.sendToClient("ADDFAIL {\n}");
} else {
passes = 0;
}
return result;
} catch (IOException ex) {
Logger.getLogger(ServerGame.class.getName()).log(Level.SEVERE, null, ex);
}
}
return false;
}
private String getNextLine(Scanner scanner) {
if (scanner.hasNextLine()) {
return scanner.nextLine();
}
return null;
}
private void updateGame() {
for (ServerClientHandler cl : clients) {
try {
String command = "UPDATE {"
+ "\n" + game.getStartPiece()
+ "\n" + game.getLeftSide()
+ "\n" + game.getRightSide()
+ "\n" + game.getPlayerHand(cl.getPlayerHash())
+ "\n" + (clientTurn() == cl.getPlayerHash())
+ "\n" + game.getPlayerNumString(cl.getPlayerHash())
+ "\n}";
System.out.println("Update to " + cl.getPlayerHash() + ":\n" + command);
cl.sendToClient(command);
} catch (IOException ex) {
Logger.getLogger(ServerGame.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
private void updatePlayerHand(ServerClientHandler cl, boolean sucess) {
try {
String command = "UPDATEHAND {"
+ "\n" + sucess
+ "\n" + (sucess ? game.getPlayerHand(cl.getPlayerHash()) + "\n}" : "\n}");
System.out.println("UpdateHand to " + cl.getPlayerHash() + ":\n" + command);
cl.sendToClient(command);
} catch (IOException ex) {
Logger.getLogger(ServerGame.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void endGame(int winnerHash) {
for (ServerClientHandler cl : clients) {
try {
String command = "GAMEOVER {"
+ "\n" + (cl.getPlayerHash() == winnerHash)
+ "\n}";
System.out.println("Update to " + cl.getPlayerHash() + ":\n" + command);
cl.sendToClient(command);
} catch (IOException ex) {
Logger.getLogger(ServerGame.class.getName()).log(Level.SEVERE, null, ex);
}
}
gameover = true;
}
private void closeGame(int winnerHash) {
try {
endGame(winnerHash);
for (ServerClientHandler cl2 : clients) {
cl2.socket.close();
}
} catch (IOException ex) {
Logger.getLogger(ServerGame.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| [
"34004020+gustavohubner@users.noreply.github.com"
] | 34004020+gustavohubner@users.noreply.github.com |
220ab67b5c51957a106cd92fbd6c93f2535a5050 | 7359336a174b7521c75820a40af22f25b758c69b | /src/main/java/com/tutorialspoint/service_locator/Service1.java | 33eb2d0b266a7de50d6614f502da314ea5651db3 | [] | no_license | johns-hub/design_pattern | 359e7df82bd51b081b6a3571d72ba6eabe8636cb | 0f61727b754ddf21c5cdcfd74da2f182c540c008 | refs/heads/master | 2023-03-21T21:36:20.741326 | 2021-03-09T01:05:32 | 2021-03-09T01:05:32 | 259,588,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 250 | java | package com.tutorialspoint.service_locator;
public class Service1 implements Service {
public void execute(){
System.out.println("Executing Service1");
}
@Override
public String getName() {
return "Service1";
}
} | [
"xuan.xing1@corp.elong.com"
] | xuan.xing1@corp.elong.com |
9716dee20b0bdf644d8a79f0cacdf84ee54d1fa3 | 20453b4009e8c0d54fcac344e93345fb12187ef3 | /RegisterDescriptor.java | ffcdf19702d617b16e49f193bda97d551693269b | [] | no_license | zeyuhao/SIMPLEcompiler | ab422f721aae333cf3f7645217188e9ae1c671a2 | 3ce86e1e72694460c04b0b90cb51578ed2eed079 | refs/heads/master | 2020-12-29T02:42:31.352993 | 2017-06-17T17:25:23 | 2017-06-17T17:25:23 | 55,666,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,807 | java | /*
Zeyu Hao
zhao7@jhu.edu
*/
import java.lang.Integer;
public class RegisterDescriptor {
// Array to keep track of used register
private boolean[] registers;
// Array to keep track of which registers are pushed onto the stack
private boolean[] stack;
// index of most recent available register
private int current;
// index to create unique branch labels for If, Repeat, While instructions
private int branch_index;
// index to create unique format labels for error messages
private int error_index;
// boolean to keep track of whether or there are registers pushed onto the
// stack becaused pushUsed() was called (registers were full at some point)
private boolean full;
private RegisterDescriptor parent;
public RegisterDescriptor() {
// r0 - r12 can be used freely
this.registers = new boolean[13];
this.stack = new boolean[15];
this.current = 0;
this.branch_index = 0;
this.error_index = 0;
this.full = false;
this.parent = null;
this.reset(); //safety measure, not really needed
}
public void setParent(RegisterDescriptor parent) {
this.parent = parent;
}
public RegisterDescriptor getParent() {
return this.parent;
}
public int getCurrent() {
return this.current;
}
// Reset all registers
public void reset() {
for (int i = 0; i < this.registers.length; i++) {
this.registers[i] = false; // reset all to false for 'unused'
}
}
/** Overloaded function.
* Reset the specified register(s)
*/
public void reset(String[] regs) {
for (String reg : regs) {
int saved = Integer.parseInt(reg.substring(1, reg.length()));
this.registers[saved] = false;
}
}
/** Overloaded function.
* Reset the specified register
*/
public void reset(String reg) {
int saved = Integer.parseInt(reg.substring(1, reg.length()));
this.registers[saved] = false;
}
// Reset all registers except r0 and r1
public void preserve() {
for (int i = 2; i < this.registers.length; i++) {
this.registers[i] = false; // reset all to false for 'unused'
}
}
public void setInUse() {
this.registers[this.current] = true;
}
public String available() {
for (int i = 0; i < this.registers.length; i++) {
if (!this.registers[i]) {
this.current = i;
return "r" + i;
}
}
return "full";
}
public int getBranchIndex() {
return this.branch_index;
}
public void incBranchIndex() {
this.branch_index++;
}
public int getErrorIndex() {
return this.error_index;
}
public void incErrorIndex() {
this.error_index++;
}
/* Checks if the specified register is currently pushed onto the stack
*/
public boolean isPushed(String reg_name) {
int reg = Integer.parseInt(reg_name.substring(1, reg_name.length()));
return this.stack[reg];
}
/* Do we currently have registers pushed onto the stack because at some
* point all registers were full?
*/
public boolean isFull() {
return this.full;
}
public void setFull() {
this.full = true;
}
/* Push the specified register onto the stack
*/
public String push(String reg_name) {
int reg = Integer.parseInt(reg_name.substring(1, reg_name.length()));
this.stack[reg] = true;
return "\tpush {" + reg_name + "}\n";
}
/* Push all used registers onto the stack. This method is used when all
* registers will be full, and we need to free up space.
*/
public String pushUsed() {
for (int reg = 1; reg <= this.current; reg++) {
this.stack[reg] = true;
}
return "\tpush {r1-r" + this.current + "}\n";
}
/* Pop the specified register off of the stack
*/
public String pop(String reg_name) {
int reg = Integer.parseInt(reg_name.substring(1, reg_name.length()));
this.stack[reg] = false;
return "\tpop {" + reg_name + "}\n";
}
/* Restore all registers from the stack except for the one specified
* by 'keep'.
*/
public String popAll(String keep) {
String code = "";
String reg_name = "";
int reg = Integer.parseInt(keep.substring(1, keep.length()));
for (int i = 0; i < this.stack.length; i++) {
if (this.stack[i] && i != reg) {
this.stack[i] = false;
reg_name = "r" + i;
code += "\tpop {" + reg_name + "}\n";
}
}
return code;
}
/* Overloaded function.
* Restore all registers from the stack. This is only used for
* restoring registers when an error is detected and we need to exit.
*/
public String popAll() {
String code = "";
String reg_name = "";
for (int i = 0; i < this.stack.length; i++) {
if (this.stack[i]) {
reg_name = "r" + i;
code += "\tpop {" + reg_name + "}\n";
}
}
return code;
}
}
| [
"zeyu.md@hotmail.com"
] | zeyu.md@hotmail.com |
5c05a3cbcfae875a332f16d8304d908a2ae22e69 | ff3c2380a51a735e4ac49d66558c3298ff83842a | /shop_web/src/main/java/com/peng/action/CartItemAction.java | 7d335d03ed9d239bd718b7fab1b6e759325bbf30 | [] | no_license | lqaiypp/shopCart | 3deafa1264eb0401677c5b9a8a278fddc667002f | 81a49a653e18da722054d6b5048594a094080b92 | refs/heads/master | 2022-05-04T15:17:36.131033 | 2020-02-23T12:57:55 | 2020-02-23T12:57:55 | 242,515,452 | 0 | 0 | null | 2022-04-22T21:51:36 | 2020-02-23T12:46:07 | Java | UTF-8 | Java | false | false | 3,965 | java | package com.peng.action;
import com.peng.entity.CartItem;
import com.peng.entity.Product;
import com.peng.service.ShoppingService;
import com.peng.service.ShoppingServiceImpl;
import org.apache.struts2.ServletActionContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class CartItemAction {
private Integer productId;
private Integer[] pIds;
private Integer[] pAmounts;
public CartItemAction() {
super();
// TODO Auto-generated constructor stub
}
public CartItemAction(Integer productId, Integer[] pIds, Integer[] pAmounts) {
super();
this.productId = productId;
this.pIds = pIds;
this.pAmounts = pAmounts;
}
@Override
public String toString() {
return "CartItemAction [productId=" + productId + ", pIds="
+ Arrays.toString(pIds) + ", pAmounts="
+ Arrays.toString(pAmounts) + "]";
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer[] getpIds() {
return pIds;
}
public void setpIds(Integer[] pIds) {
this.pIds = pIds;
}
public Integer[] getpAmounts() {
return pAmounts;
}
public void setpAmounts(Integer[] pAmounts) {
this.pAmounts = pAmounts;
}
public String AddCart() {
//调用Service
ShoppingService sp = new ShoppingServiceImpl();
Product p = sp.queryById(productId);
//获取request和session
HttpServletRequest req = ServletActionContext.getRequest();
HttpSession session = req.getSession();
Map<Integer, CartItem> cart = (Map<Integer, CartItem>) session.getAttribute("cart");
CartItem cartItem = null;
if (cart == null) {
cart = new HashMap<Integer, CartItem>();
cartItem = new CartItem(p, 1, p.getPrice() * 1);
cart.put(productId, cartItem);
session.setAttribute("cart", cart);
} else {
//判断该商品是否以前添加过
if (cart.containsKey(productId)) {
//找到该购物车对象
cartItem = cart.get(productId);
//更新该商品在购物车中的信息
cartItem.setMount(cartItem.getMount() + 1);
cartItem.setTotlePrice(cartItem.getTotlePrice() * 2);
} else {
cartItem = new CartItem(p, 1, p.getPrice() * 1);
cart.put(productId, cartItem);
}
session.setAttribute("prod", p);
}
return "addCart";
}
public String DeleteOne() {
//获得request和session
HttpServletRequest req = ServletActionContext.getRequest();
HttpSession session = req.getSession();
Map<Integer, CartItem> cart = (Map<Integer, CartItem>) session.getAttribute("cart");
cart.remove(productId);
return "DeleteOne";
}
public String UpdateMount() {
//获得request和session
HttpServletRequest req = ServletActionContext.getRequest();
HttpSession session = req.getSession();
Map<Integer, CartItem> cart = (Map<Integer, CartItem>) session.getAttribute("cart");
CartItem cartItem = null;
if (pIds != null) {
for (int i = 0; i < pIds.length; i++) {
if (cart.containsKey(pIds[i])) {
cart.remove(pIds[i]);
for (int j = 0; j < pAmounts.length; j++) {
cartItem = cart.get(pIds[i]);
cartItem.setMount(pAmounts[i]);
}
session.setAttribute("cart", cart);
}
}
}
return "UpdateMount";
}
}
| [
"598574975@qq.com"
] | 598574975@qq.com |
68c95be651d90b3cde5746e31f6da3a33b504ca8 | 064cbbf41d0abcbd463e89f8f824359c6ebb67f5 | /bridge/src/main/java/me/yoryor/dp/bridge/App.java | 220a2f13a6eb371eea28c508579cd7819766f0de | [] | no_license | michalyao/javame | 1c8bd19ee452659de7ab8ac8a62ed9d960a7a26a | 1715d3055fa16db71ee392f3151530d822355421 | refs/heads/master | 2021-01-18T03:13:07.958072 | 2017-05-22T13:40:27 | 2017-05-22T13:40:27 | 85,839,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package me.yoryor.dp.bridge;
public class App {
public static void main(String[] args) {
FlyingCar flyingCar = new FlyingCar(new Pegasus());
flyingCar.move();
flyingCar.stop();
flyingCar.fly();
SwimmingCar swimmingCar = new SwimmingCar(new Dolphin());
swimmingCar.move();
swimmingCar.stop();
swimmingCar.swim();
}
}
| [
"yaoyao@uyunsoft.cn"
] | yaoyao@uyunsoft.cn |
ad68d0fdf66b70ecefc0e4e0dd1c99362704abd8 | dd6d10099dd3ae6a20cef97fe4cfbdc7416449fa | /app/src/main/java/com/xidian/bynadsdk/activity/BYNAdSDKSearchResultActivity.java | afb51f8267be0f9ad4a86f5fc7b595b724932736 | [] | no_license | xdkj2019/Android-BYNSDK | 4cfd8529f957fe4093bba8ec7a84edbec4350a2c | 5339915e1fbbd3069507110f5a25e33dd201e286 | refs/heads/master | 2020-09-12T13:01:11.978482 | 2019-11-18T11:31:52 | 2019-11-18T11:31:52 | 222,433,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,975 | java | package com.xidian.bynadsdk.activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.jude.easyrecyclerview.EasyRecyclerView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.jude.easyrecyclerview.decoration.DividerDecoration;
import com.xidian.bynadsdk.BYNAdSDK;
import com.xidian.bynadsdk.BYNBaseActivity;
import com.xidian.bynadsdk.R;
import com.xidian.bynadsdk.utils.FinishActivityManager;
import com.xidian.bynadsdk.utils.PullListener;
import com.xidian.bynadsdk.utils.StatusBarUtil;
import com.xidian.bynadsdk.utils.Utils;
import com.xidian.bynadsdk.adapterholder.BYNAdSDKSearchResultGoodsAdapter;
import com.xidian.bynadsdk.bean.GoodsDetailBean;
import com.xidian.bynadsdk.bean.GoodsTopBean;
import com.xidian.bynadsdk.network.NetWorkManager;
import com.xidian.bynadsdk.network.response.ResponseTransformer;
import com.xidian.bynadsdk.network.schedulers.SchedulerProvider;
import java.util.HashMap;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
public class BYNAdSDKSearchResultActivity extends BYNBaseActivity implements View.OnClickListener {
private String key;
private TextView keyTV, finishTV, comprehensiveTV, salesTV, priceTV, screeningTV;
private ImageView cleanIV, searchButtonIV, salesIV, priceIV, screeningIV;
private LinearLayout comprehensiveLayout, salesLayout, priceLayout, screeningLayout;
private CheckBox preferentialCB;
private EasyRecyclerView recyclerView;
private View mask;
private int num = 1;
private String sort = "";//排序
private boolean has_coupon = false;//是都查询有权
private String start_price = "";
private String end_price = "";
public RecyclerArrayAdapter goodsAdapter = new RecyclerArrayAdapter(this) {
@Override
public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
return new BYNAdSDKSearchResultGoodsAdapter(parent);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bynad_sdksearch_result);
StatusBarUtil.setStatusBarFullTransparent(this);
Intent intent = getIntent();
key = intent.getStringExtra("key");
initView();
initProduct();
initClick();
}
private void initProduct() {
Utils.initListView(this, recyclerView, new DividerDecoration(Color.parseColor("#ffffff"), 10), goodsAdapter, new PullListener() {
@Override
public void onRefresh() {
num = 1;
getData();
}
@Override
public void onLoadMore() {
recyclerView.setRefreshing(false);
if (num == 1) {
return;
}
getData();
}
}, new RecyclerArrayAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
GoodsDetailBean goodsDetailBean= (GoodsDetailBean) goodsAdapter.getItem(position);
startActivity(new Intent(BYNAdSDKSearchResultActivity.this,BYNAdSDKProductActivity.class)
.putExtra("item_id",goodsDetailBean.getItem_id())
.putExtra("activity_id",goodsDetailBean.getActivity_id())); }
});
}
public void getData() {
long l = System.currentTimeMillis() / 1000;
CompositeDisposable mDisposable = new CompositeDisposable();
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("t", l + "");
hashMap.put("sign", Utils.md5Decode32(Utils.getVersion() + BYNAdSDK.getInstance().appSecret + l + BYNAdSDK.getInstance().appSecret));
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("page", num);
map.put("page_size", "20");
if (!TextUtils.isEmpty(sort)) {
map.put("sort", sort);
}
if (!TextUtils.isEmpty(start_price)) {
map.put("start_price", start_price);
}
if (!TextUtils.isEmpty(end_price)) {
map.put("end_price", end_price);
}
map.put("has_coupon", has_coupon);
Disposable subscribe = NetWorkManager.getRequest().goodssearch(hashMap, map)
.compose(ResponseTransformer.handleResult())
.compose(SchedulerProvider.getInstance().applySchedulers())
.subscribe(new Consumer<GoodsTopBean>() {
@Override
public void accept(GoodsTopBean goodsTopBean) throws Exception {
if (num == 1) {
if (goodsAdapter != null) {
goodsAdapter.clear();
}
}
if(goodsTopBean.getItems()==null||goodsTopBean.getItems().size()==0){
goodsAdapter.stopMore();
}else{
num=num+1;
goodsAdapter.addAll(goodsTopBean.getItems());
goodsAdapter.notifyDataSetChanged();
if(!goodsTopBean.isHas_next()){
goodsAdapter.stopMore();
}
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Utils.toast(throwable.getMessage());
}
});
mDisposable.add(subscribe);
}
private void initClick() {
preferentialCB.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
has_coupon=isChecked;
num=1;
getData();
}
});
}
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.activity_bynad_sdksearch_result_finish_tv) {
FinishActivityManager.getsManager().finishActivity();
FinishActivityManager.getsManager().finishActivity(BYNAdSDKSearchActivity.class);
} else if (i == R.id.activity_bynad_sdksearch_result_edittext_clean_iv) {
FinishActivityManager.getsManager().finishActivity();
} else if (i == R.id.activity_bynad_sdksearch_result_comprehensive_layout) {
num = 1;
sort="";
comprehensiveTV.setTextColor(0xffF53C25);
salesTV.setTextColor(0xff666666);
priceTV.setTextColor(0xff666666);
salesIV.setImageResource(R.mipmap.bynad_sdk_check);
priceIV.setImageResource(R.mipmap.bynad_sdk_check);
getData();
} else if (i == R.id.activity_bynad_sdksearch_result_sales_layout) {
num=1;
comprehensiveTV.setTextColor(0xff666666);
salesTV.setTextColor(0xffF53C25);
priceTV.setTextColor(0xff666666);
priceIV.setImageResource(R.mipmap.bynad_sdk_check);
if(sort.equals("month_sales_des")){
sort="month_sales_asc";
salesIV.setImageResource(R.mipmap.bynad_sdk_checked);
}else{
sort="month_sales_des";
salesIV.setImageResource(R.mipmap.bynad_sdk_checked_des);
}
getData();
} else if (i == R.id.activity_bynad_sdksearch_result_price_layout) {
num=1;
comprehensiveTV.setTextColor(0xff666666);
salesTV.setTextColor(0xff666666);
priceTV.setTextColor(0xffF53C25);
salesIV.setImageResource(R.mipmap.bynad_sdk_check);
if(sort.equals("month_sales_des")){
sort="month_sales_asc";
priceIV.setImageResource(R.mipmap.bynad_sdk_checked);
}else{
sort="month_sales_des";
priceIV.setImageResource(R.mipmap.bynad_sdk_checked_des);
}
getData();
} else if (i == R.id.activity_bynad_sdksearch_result_screening_layout) {
openPopup();
screeningTV.setTextColor(0xffF53C25);
screeningIV.setImageResource(R.mipmap.bynad_sdk_check_shaixuan);
}
}
private void initView() {
keyTV = (TextView) findViewById(R.id.activity_bynad_sdksearch_result_search_key_et);
finishTV = (TextView) findViewById(R.id.activity_bynad_sdksearch_result_finish_tv);
comprehensiveTV = (TextView) findViewById(R.id.activity_bynad_sdksearch_result_comprehensive_tv);
salesTV = (TextView) findViewById(R.id.activity_bynad_sdksearch_result_sales_tv);
priceTV = (TextView) findViewById(R.id.activity_bynad_sdksearch_result_price_tv);
screeningTV = (TextView) findViewById(R.id.activity_bynad_sdksearch_result_screening_tv);
searchButtonIV = (ImageView) findViewById(R.id.activity_bynad_sdksearch_search_result_button_iv);
cleanIV = (ImageView) findViewById(R.id.activity_bynad_sdksearch_result_edittext_clean_iv);
salesIV = (ImageView) findViewById(R.id.activity_bynad_sdksearch_result_sales_iv);
priceIV = (ImageView) findViewById(R.id.activity_bynad_sdksearch_result_price_iv);
screeningIV = (ImageView) findViewById(R.id.activity_bynad_sdksearch_result_screening_iv);
comprehensiveLayout = (LinearLayout) findViewById(R.id.activity_bynad_sdksearch_result_comprehensive_layout);
salesLayout = (LinearLayout) findViewById(R.id.activity_bynad_sdksearch_result_sales_layout);
priceLayout = (LinearLayout) findViewById(R.id.activity_bynad_sdksearch_result_price_layout);
screeningLayout = (LinearLayout) findViewById(R.id.activity_bynad_sdksearch_result_screening_layout);
preferentialCB = (CheckBox) findViewById(R.id.activity_bynad_sdksearch_result_preferential_cb);
recyclerView = (EasyRecyclerView) findViewById(R.id.activity_bynad_sdksearch_result_recycler);
mask = findViewById(R.id.activity_bynad_sdksearch_result_mask);
mask.setVisibility(View.GONE);
keyTV.setText(key);
finishTV.setOnClickListener(this);
cleanIV.setOnClickListener(this);
comprehensiveLayout.setOnClickListener(this);
salesLayout.setOnClickListener(this);
priceLayout.setOnClickListener(this);
screeningLayout.setOnClickListener(this);
}
public void openPopup() {
View contentView = LayoutInflater.from(this).inflate(
R.layout.bynad_sdk_search_result_popup_layout, null);
final PopupWindow popupWindow = new PopupWindow(contentView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
EditText lowse = (EditText) contentView.findViewById(R.id.bynad_sdk_search_result_popup_price_lowse_edittext);
EditText highest = (EditText) contentView.findViewById(R.id.bynad_sdk_search_result_popup_price_highest_edittext);
TextView reset = (TextView) contentView.findViewById(R.id.bynad_sdk_search_result_popup_price_reset_tv);
TextView sure = (TextView) contentView.findViewById(R.id.bynad_sdk_search_result_popup_price_sure_tv);
// View alpha = contentView.findViewById(R.id.bynad_sdk_search_result_popup_price_button_layout);
popupWindow.setBackgroundDrawable(new ColorDrawable(0x00000000));
if(!TextUtils.isEmpty(start_price)){
lowse.setText(start_price);
}
if(!TextUtils.isEmpty(end_price)){
highest.setText(end_price);
}
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
popupWindow.setFocusable(true);
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
mask.setVisibility(View.GONE);
screeningTV.setTextColor(0xff666666);
screeningIV.setImageResource(R.mipmap.bynad_sdk_checked_shaixuan);
}
});
reset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
start_price="";
end_price="";
lowse.setText("");
highest.setText("");
}
});
sure.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!TextUtils.isEmpty(lowse.getText().toString())){
start_price=lowse.getText().toString();
}else{
start_price="";
}
if(!TextUtils.isEmpty(highest.getText().toString())){
end_price=highest.getText().toString();
}else {
end_price="";
}
num=1;
getData();
popupWindow.dismiss();
}
});
mask.setVisibility(View.VISIBLE);
popupWindow.showAsDropDown(screeningLayout);
}
}
| [
"15157168891@163.com"
] | 15157168891@163.com |
f0d22f7c90a3b83e0b77da1491726a48cd4769cd | 6c396b645738c39d2605eb35017b55638e97865d | /wiser/src/com/java/wise/ticketsolver/Main.java | f87912f29a2176757f0b006f1ccc04f413a3bb17 | [] | no_license | dovikn/wiser | 10a027436873507711fa08b18accb293512a6956 | 35170aef6e489cc0b2558ded95d137ad9ffd1832 | refs/heads/master | 2021-07-08T05:08:00.917996 | 2017-01-10T05:30:24 | 2017-01-10T05:30:24 | 38,004,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,734 | java | package com.java.wise.ticketsolver;
import java.util.Iterator;
import java.util.List;
import org.zendesk.client.v2.Zendesk;
import org.zendesk.client.v2.model.Comment;
import org.zendesk.client.v2.model.Status;
import org.zendesk.client.v2.model.Ticket;
import com.java.wise.ticketsolver.client.Client;
import com.java.wise.ticketsolver.client.DBClient;
import com.java.wise.ticketsolver.processor.TicketProcessor;
import com.java.wise.ticketsolver.scan.TicketScanner;
import com.java.wise.ticketsolver.triggers.Trigger;
public class Main {
public static void main(String[] args) {
System.out.println("[INFO] **********************");
System.out.println("[INFO] **** Started Wise ****");
System.out.println("[INFO] **********************");
TicketScanner scanner = new TicketScanner();
List<Ticket> tickets = scanner.scan();
Iterator<Ticket> ticketsIt = tickets.iterator();
System.out.println("[INFO] Found " + tickets.size() + " tickets in the queue...");
List<Trigger> triggers = DBClient.loadAllTriggers();
System.out.println("[INFO] Loaded " + triggers.size() + " triggers from the database...");
while(ticketsIt != null && ticketsIt.hasNext()) {
Ticket t = (Ticket) ticketsIt.next();
// Skip the closed tickets.
if (t.getStatus().toString().equals(Status.CLOSED.toString())) {
continue;
}
Iterator<Trigger> triggersIt = triggers.iterator();
while(triggersIt != null && triggersIt.hasNext()) {
Trigger trigger = triggersIt.next();
boolean result = trigger.match(t);
if (result) {
System.out.println("[INFO] Ticket " + t.getId() + " matched trigger " + trigger.getName() + ".");
TicketProcessor.process(trigger, t);
}
}
}
}
}
| [
"dovik@dovik-macbookpro.roam.corp.google.com"
] | dovik@dovik-macbookpro.roam.corp.google.com |
4466f45697f8e4ae0c21792a55ee72db246d6022 | 57d66ae73ba7977cb95999c6e0bfee7ee71f59dd | /services/test-service/src/main/java/rsoi/lab2/testservice/conf/WebConfig.java | 858790c5967e477ac7ce94e9671ca89e2a2ae6b3 | [] | no_license | ovchinnikov-vladislav/student-program-testing-system | e50f25526125cf7751e4d9648a209971bdc702e5 | f01fdef1d7b8a4c8b00ca86b3d6068ec985b4108 | refs/heads/master | 2023-06-30T08:25:08.429861 | 2021-07-24T09:23:53 | 2021-07-24T09:23:53 | 221,050,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,936 | java | package rsoi.lab2.testservice.conf;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.UUID;
@Configuration
@ComponentScan(basePackages = "rsoi.lab2.testservice.controller")
public class WebConfig {
private static final String gatewayKey = "be5e18ad-f14a-46c4-ac7f-5e76fd959647";
private static final String gatewaySecret = "ac222aad-52e1-4773-86ef-20a1efd80d32";
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(Predicates.not(PathSelectors.regex("/error.*")))
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfo(
"TESTS REST API",
null,
"API 1.0.0",
null,
new Contact("Vladislav Ovchinnikov", null, "vladovchinnikov950@gmail.com"),
"Apache License Version 2.0",
"https://www.apache.org/licenses/LICENSE-2.0", new ArrayList<>());
}
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
mappingJackson2HttpMessageConverter.setObjectMapper(objectMapper());
return mappingJackson2HttpMessageConverter;
}
@Bean
public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
objectMapper.setDateFormat(df);
return objectMapper;
}
public static String getGatewayKey() {
return gatewayKey;
}
public static String getGatewaySecret() {
return gatewaySecret;
}
}
| [
"vladovchinnikov950@gmail.com"
] | vladovchinnikov950@gmail.com |
0f3d49495b1d7b5de0bc7219dfe6bcf37e58f649 | 8264cce3fac456543351b598b716b153a0855ab3 | /target/classes/cn/youfull/trimhelp/entity/Decoratestyle.java | 69b0bab49b59ef6155b21b9a152013329aef9528 | [
"Apache-2.0"
] | permissive | yousiri6677/trimhelp-springboot | 6f12456368ef1c0d3595ad740c7f40da7aead0ce | 8a71d7d0a597ed41fe9aa73c0e8a94fa5a9ef64b | refs/heads/master | 2022-06-23T07:11:36.125237 | 2020-08-12T07:18:34 | 2020-08-12T07:18:34 | 248,176,802 | 2 | 0 | Apache-2.0 | 2022-06-17T03:04:14 | 2020-03-18T08:30:19 | CSS | UTF-8 | Java | false | false | 443 | java | package cn.youfull.trimhelp.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("decoratestyle")
public class Decoratestyle {
//裝修風格表
@TableId
private long decorateStyleid;
private String decorateStyleName;
}
| [
"you15738790496@163.com"
] | you15738790496@163.com |
c139ee305f82ba702fbad637fc87881c6622998a | 677aaa5f4626b8c23e0bee07fb3ae80972386ad6 | /src/main/java/com/reign/framework/jdbc/RowProcessor.java | cad73e5a9cdf439e40408f9a8515933e787c2740 | [] | no_license | WenXiangWu/reign_framework | faa9029c5adcde9bcfd4135545bae6ffa61b9dd7 | 7e28931d511002594e3b74250091c4d93f3bc2f5 | refs/heads/master | 2023-04-16T05:16:37.971872 | 2021-04-29T12:37:59 | 2021-04-29T12:37:59 | 355,860,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,195 | java | package com.reign.framework.jdbc;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
/**
* @ClassName: RowProcessor
* @Description: 行处理器
* @Author: wuwx
* @Date: 2021-04-02 10:41
**/
public interface RowProcessor {
/**
* 返回一个数组
* @param rs
* @return
* @throws SQLException
*/
public Object[] toArray(ResultSet rs) throws SQLException;
/**
* 返回一个javaBean
* @param rs 结果集
* @param type bean类型
* @param <T> 指定类型
* @return
* @throws SQLException
*/
public <T> T toBean(ResultSet rs,Class<T> type) throws SQLException;
/**
* 返回一个BeanList
* @param rs 结果集
* @param type bean类型
* @param <T> 指定类型
* @return
* @throws SQLException
*/
public <T> List<T> toBeanList(ResultSet rs, Class<T> type) throws SQLException;
/**
* 返回一个map
* @param rs 结果集
* @return
* @throws SQLException
*/
public Map<String,Object> toMap(ResultSet rs) throws SQLException;
}
| [
"280971337@qq.com"
] | 280971337@qq.com |
2dfd7a3e1770808709549acb041dcf99df21cf7b | fd1223383a568a524bf9f83e366b346ab3c4e7f2 | /src/Panels/PanelEstatistica.java | 138dde545a56bab59a034db8f4907f93337d0a88 | [] | no_license | AppSecAI-TEST/lojaRoupas | 85a03e0f2cd44afb454d677f481f47f4706c430a | f8093e5be2c3c9318bb3e19d96b1b79bccffe83b | refs/heads/master | 2021-01-16T11:39:42.898275 | 2017-08-11T06:30:14 | 2017-08-11T06:30:14 | 100,000,873 | 0 | 0 | null | 2017-08-11T06:50:51 | 2017-08-11T06:50:50 | null | UTF-8 | Java | false | false | 17,230 | 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 Panels;
import Main.Main;
import auxClasses.AuxFieldCreditDevol;
import auxClasses.PopClickListener;
import java.awt.event.MouseEvent;
import java.sql.ResultSet;
import javax.swing.BoxLayout;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Soraya
*/
public class PanelEstatistica extends javax.swing.JPanel {
/**
* Creates new form PanelEstatistica
*/
JTable tableEstat;
Main lojaDB;
public PanelEstatistica(Main lojaDB) {
this.lojaDB = lojaDB;
initComponents();
createTable(new String[]{"ID do Caixa","Tipo de Transacao", "ID da transacao", "Descricao", "Valor total"});
JScrollPane scrollTable=new JScrollPane(tableEstat);
tableEstatisticaPanel.removeAll();
tableEstatisticaPanel.add(scrollTable);
diaOption.setSelected(true);
orderDataOption.setSelected(true);
AuxFieldCreditDevol documentListener = new AuxFieldCreditDevol(this);
searchField.getDocument().addDocumentListener(documentListener);
update();
}
public void clean(){
Main.cleanTable(tableEstat);
}
private void createTable(String[] columnNames){
DefaultTableModel model;
model = new DefaultTableModel(columnNames,0);
tableEstat = new JTable(model);
tableEstatisticaPanel.setLayout(new BoxLayout(tableEstatisticaPanel, BoxLayout.PAGE_AXIS));
tableEstat.setDefaultEditor(Object.class, null);
tableEstat.addMouseListener(new PopClickListener(this, tableEstat));
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
tableEstatisticaPanel = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
diaOption = new javax.swing.JRadioButton();
mesOption = new javax.swing.JRadioButton();
anoOption = new javax.swing.JRadioButton();
jLabel1 = new javax.swing.JLabel();
orderDataOption = new javax.swing.JRadioButton();
orderValorOption = new javax.swing.JRadioButton();
searchField = new javax.swing.JTextField();
somarButton = new javax.swing.JButton();
javax.swing.GroupLayout tableEstatisticaPanelLayout = new javax.swing.GroupLayout(tableEstatisticaPanel);
tableEstatisticaPanel.setLayout(tableEstatisticaPanelLayout);
tableEstatisticaPanelLayout.setHorizontalGroup(
tableEstatisticaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
tableEstatisticaPanelLayout.setVerticalGroup(
tableEstatisticaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 196, Short.MAX_VALUE)
);
jLabel3.setText("Resultados: ");
jLabel4.setText("Vendas por: ");
jLabel4.setToolTipText("Procura vendas pela data de abertura do caixa");
buttonGroup1.add(diaOption);
diaOption.setText("dia");
diaOption.setToolTipText("digite o dia no formato DD ou DD/MM ou DD/MM/AA");
diaOption.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
diaOptionActionPerformed(evt);
}
});
buttonGroup1.add(mesOption);
mesOption.setText("mês");
mesOption.setToolTipText("Digite o mês no formato MM ou MM/AA");
mesOption.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mesOptionActionPerformed(evt);
}
});
buttonGroup1.add(anoOption);
anoOption.setText("ano");
anoOption.setToolTipText("Digite o ano no formato AA");
anoOption.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
anoOptionActionPerformed(evt);
}
});
jLabel1.setText("Ordenar por: ");
buttonGroup2.add(orderDataOption);
orderDataOption.setText("data");
orderDataOption.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
orderDataOptionActionPerformed(evt);
}
});
buttonGroup2.add(orderValorOption);
orderValorOption.setText("valor");
orderValorOption.setToolTipText("ordena por valor vendido");
orderValorOption.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
orderValorOptionActionPerformed(evt);
}
});
searchField.setToolTipText("digite o dia, mês ou ano");
searchField.setMinimumSize(new java.awt.Dimension(30, 20));
searchField.setPreferredSize(new java.awt.Dimension(30, 20));
searchField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchFieldActionPerformed(evt);
}
});
somarButton.setText("somar");
somarButton.setToolTipText("soma os valores abaixo");
somarButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
somarButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tableEstatisticaPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(somarButton))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(diaOption)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mesOption)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(anoOption)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(searchField, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(orderDataOption)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(orderValorOption)))
.addGap(0, 89, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(diaOption)
.addComponent(mesOption)
.addComponent(anoOption)
.addComponent(searchField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(orderDataOption)
.addComponent(orderValorOption))
.addGap(8, 8, 8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(somarButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tableEstatisticaPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void searchFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchFieldActionPerformed
update();
}//GEN-LAST:event_searchFieldActionPerformed
public void verEvent(MouseEvent evt){
int row = tableEstat.rowAtPoint(evt.getPoint());
int col = tableEstat.columnAtPoint(evt.getPoint());
Main.verEvent(tableEstat, row, col);
}
private void diaOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_diaOptionActionPerformed
update();
}//GEN-LAST:event_diaOptionActionPerformed
private void mesOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mesOptionActionPerformed
update();
}//GEN-LAST:event_mesOptionActionPerformed
private void anoOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_anoOptionActionPerformed
update();
}//GEN-LAST:event_anoOptionActionPerformed
private void orderDataOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderDataOptionActionPerformed
update();
}//GEN-LAST:event_orderDataOptionActionPerformed
private void orderValorOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderValorOptionActionPerformed
update();
}//GEN-LAST:event_orderValorOptionActionPerformed
private void somarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_somarButtonActionPerformed
if(lojaDB.askPassword(null, true)==false)
return;
int len = tableEstat.getRowCount();
if(len==0){
JOptionPane.showMessageDialog(somarButton, "Tabela vazia! Procure uma data válida", "Aviso", JOptionPane.WARNING_MESSAGE);
return;
}
double vendasDevol=0;
double quebraDeCaixa=0;
int colOfVendasDevol = Main.getIndexColumnWithColumnName(tableEstat, "VendasDevolucoes");
int colOfQuebraDeCaixa = Main.getIndexColumnWithColumnName(tableEstat, "QuebraDeCaixa");
for(int i=0;i<len;i++){
vendasDevol+=Main.formatDoubleString(Main.elemOfTable(tableEstat, i, colOfVendasDevol));
quebraDeCaixa+=Main.formatDoubleString(Main.elemOfTable(tableEstat, i, colOfQuebraDeCaixa));
}
String message = "Valor total com vendas e devoluções dos resultados abaixo: "+Main.twoDig(vendasDevol);
message += "\nValor total das quebras de caixa dos resultados abaixo: "+Main.twoDig(quebraDeCaixa);
message += "\nNúmero de resultados encontrados: "+len;
Main.formattedMessage(somarButton, message, "Informações relativas aos resultados abaixo", JOptionPane.INFORMATION_MESSAGE);
}//GEN-LAST:event_somarButtonActionPerformed
public void update(){
if(isValidKey()==false){
Main.cleanTable(tableEstat);
return;
}
String query= getQuery();
ResultSet results=null;
try{
results = lojaDB.executeQuery(query);
lojaDB.updateTable(tableEstat, tableEstatisticaPanel, "Caixa", true, results);
}
catch(Exception e){
e.printStackTrace();
}
}
private boolean isValidKey(){
String keyOfSearch=searchField.getText().trim();
int numberOfBars = Main.numberOfChars(keyOfSearch,'/');
if(keyOfSearch.contains("//"))
return false;
if(numberOfBars==0)
return Main.isIntegerValid(keyOfSearch);
if(numberOfBars==1 && anoOption.isSelected()==false)
if(numberOfEntries(keyOfSearch)==2 && Main.isIntegerValid(keyOfSearch.split("/")))
return true;
if(numberOfBars==2 && diaOption.isSelected())
if(numberOfEntries(keyOfSearch)==3 && Main.isIntegerValid(keyOfSearch.split("/")))
return true;
return false;
}
private String getQuery(){
String query= "SELECT * FROM Caixa ";
String keyOfSearch=searchField.getText().trim();
try{
if(numberOfEntries(keyOfSearch)==1){
if(diaOption.isSelected())
query+="WHERE DAY(Data_Abertura) = "+keyOfSearch;
if(mesOption.isSelected())
query+="WHERE MONTH(Data_Abertura) = "+keyOfSearch;
if(anoOption.isSelected()){
if(keyOfSearch.length()==2)
keyOfSearch="20"+keyOfSearch;
query+="WHERE YEAR(Data_Abertura) = "+keyOfSearch;
}
}
else if(numberOfEntries(keyOfSearch)==2){
String split[]=keyOfSearch.split("/");
String key1=split[0];
String key2=split[1];
if(diaOption.isSelected())
query+="WHERE DAY(Data_Abertura) = "+key1+" AND MONTH(Data_Abertura) = "+key2;
if(mesOption.isSelected()){
if(key2.length()==2)
key2="20"+key2;
query+="WHERE MONTH(Data_Abertura) = "+key1+" AND YEAR(Data_Abertura) = "+key2;
}
}
else if(numberOfEntries(keyOfSearch)==3){
String split[]=keyOfSearch.split("/");
String key1=split[0];
String key2=split[1];
String key3=split[2];
if(key3.length()==2)
key3="20"+key3;
if(diaOption.isSelected())
query+="WHERE DAY(Data_Abertura) = "+key1+" AND MONTH(Data_Abertura) = "+key2+
" AND YEAR(Data_Abertura) = "+key3;
}
}
catch(Exception e){
e.printStackTrace();
}
if(orderDataOption.isSelected())
query+=" ORDER BY ID_Caixa DESC, Data_Abertura DESC";
if(orderValorOption.isSelected())
query+=" ORDER BY VendasDevolucoes DESC";
return query;
}
private int numberOfEntries(String key){
if(key.isEmpty())
return 0;
return key.split("/").length;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JRadioButton anoOption;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.JRadioButton diaOption;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JRadioButton mesOption;
private javax.swing.JRadioButton orderDataOption;
private javax.swing.JRadioButton orderValorOption;
private javax.swing.JTextField searchField;
private javax.swing.JButton somarButton;
private javax.swing.JPanel tableEstatisticaPanel;
// End of variables declaration//GEN-END:variables
}
| [
"andregsimao"
] | andregsimao |
9119850ffc952c2bcdac05bf1ada25fcbc37ce9d | 876559bbc61da26af8efa607d810d11eb6df9c4e | /src/main/java/org/jvesuvius/core/ProductListView.java | c3461cb9af4a09f8f3fd52d3c5b2175b7cba775f | [] | no_license | developer73/jvesuvius | 3fb163e1f6b34506087da68eff61724cd4405086 | a1936e1da73575e5392593a7c5ddc8ce835eb779 | refs/heads/master | 2016-09-02T02:57:50.485358 | 2014-01-27T06:10:17 | 2014-01-27T06:10:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 608 | java | package org.jvesuvius.core;
import java.util.ArrayList;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.jvesuvius.core.Product;
import org.jvesuvius.core.ProductContainer;
import org.jvesuvius.core.ToJsonConverter;
@Path("list")
public class ProductListView {
@GET
@Produces("application/json")
public String getMessage() {
ProductContainer pc = new ProductContainer();
ArrayList<Product> products = pc.getAll();
ToJsonConverter conv = new ToJsonConverter();
return conv.convert(products);
}
}
| [
"developer73@"
] | developer73@ |
03fb87db7a5e715e31caed68e550ebb6444180bb | 699be59d7fed5c8f17ce711cfc325a6c27cfcaa7 | /app/src/main/java/com/example/alarmclock/util/Util.java | df5be73e14b85e754316cd68e105792977292e7c | [] | no_license | hiroki777/AlarmClock | 21402b463fc46d6992a22c3f409e2c17d77d5cc4 | e4d38b17dd71b1f55851c479777baffa5d41ec13 | refs/heads/master | 2020-09-16T19:12:37.400380 | 2019-11-25T05:09:58 | 2019-11-25T05:09:58 | 223,864,060 | 6 | 4 | null | null | null | null | UTF-8 | Java | false | false | 2,823 | java | package com.example.alarmclock.util;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;
import android.os.Build;
import com.example.alarmclock.listcomponent.ListItem;
import com.example.alarmclock.receiver.AlarmReceiver;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
public class Util {
// アラームのデータを取得
public static ListItem getAlarmsByID(int alarmID, SQLiteOpenHelper helper){
ArrayList<ListItem> data = new ArrayList<>();
ListItem item = null;
try(SQLiteDatabase db = helper.getReadableDatabase()) {
String[] cols ={"alarmid","name","alarttime"};
String[] params = {String.valueOf(alarmID)};
Cursor cs = db.query("alarms",cols,"alarmid = ?",params,
null,null,"alarmid",null);
cs.moveToFirst();
item = new ListItem();
item.setAlarmID(cs.getInt(0));
item.setAlarmName(cs.getString(1));
item.setTime(cs.getString(2));
}
return item;
}
// アラームをセット
public static void setAlarm(Context context, ListItem item){
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(item.getHour()));
calendar.set(Calendar.MINUTE, Integer.parseInt(item.getMinitsu()));
calendar.set(Calendar.SECOND, 0);
// 現在時刻を取得
Calendar nowCalendar = Calendar.getInstance();
nowCalendar.setTimeInMillis(System.currentTimeMillis());
// 比較
int diff = calendar.compareTo(nowCalendar);
// 日付を設定
if(diff <= 0){
calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) + 1);
}
AlarmManager alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, AlarmReceiver.class);
intent.setData(Uri.parse(String.valueOf(item.getAlarmID())));
PendingIntent alarmIntent = PendingIntent.getBroadcast(context, item.getAlarmID(), intent, 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
alarmMgr.setAlarmClock(new AlarmManager.AlarmClockInfo(calendar.getTimeInMillis(), null), alarmIntent);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
alarmMgr.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
} else {
alarmMgr.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent);
}
}
}
| [
"murahiro987@gmail.com"
] | murahiro987@gmail.com |
8834b3eadd50c55cf63198d24f467efbd724dc37 | b71b5883fb2155424a79c6b0f679f9c2f99b9ffb | /src/main/java/io/github/talelin/latticy/service/TestSleeveService.java | f324416475d1985136d5b8bbed4a210e2185d8f1 | [
"MIT"
] | permissive | xuejiqiuli69/cms | b1457ef95ec283c44065c75fbe269aeaaf8b7f1b | 855fdbd62d1a418bee6e770e8015dc3d43139004 | refs/heads/master | 2022-12-06T06:52:52.059803 | 2020-08-30T13:44:27 | 2020-08-30T13:44:27 | 291,478,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | /**
* @作者 leokkzhang
* @创建时间 2020/8/16 0:34
*/
package io.github.talelin.latticy.service;
import io.github.talelin.latticy.mapper.BannerMapper;
import io.github.talelin.latticy.model.BannerDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TestSleeveService {
@Autowired
private BannerMapper bannerMapper;
public List<BannerDO> getBanners(){
return bannerMapper.getAllBanner();
}
public Long insertBanner(){
BannerDO bannerDO = new BannerDO();
bannerDO.setName("NewBanner");
bannerDO.setTitle("NewBannerTitle");
bannerMapper.insertBanner(bannerDO);
return bannerDO.getId();
}
}
| [
"zk_nju@163.com"
] | zk_nju@163.com |
0372a36e12a21f39fd3aa9a8d0d583137275bb4b | 7b5ada9c522330a8696e4c760fcf7a1e5188e423 | /src/main/java/com/proptiger/userservice/config/security/social/CustomSocialAuthFilter.java | ba7cf7a111eb66cd7b7b9063e2604b36355fc36d | [] | no_license | rajatAgarwal25/userservice | 07441defcdf169184b6c1c650c36f0fb8d50fefe | 13ba7f1df781d6999ce6c08108c95ae89256caa4 | refs/heads/master | 2020-12-28T20:30:59.919199 | 2015-01-09T07:07:48 | 2015-01-09T07:07:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,386 | java | package com.proptiger.userservice.config.security.social;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.social.UserIdSource;
import org.springframework.social.connect.Connection;
import org.springframework.social.connect.UsersConnectionRepository;
import org.springframework.social.connect.support.OAuth2ConnectionFactory;
import org.springframework.social.oauth2.AccessGrant;
import org.springframework.social.security.SocialAuthenticationFilter;
import org.springframework.social.security.SocialAuthenticationServiceLocator;
import org.springframework.social.security.SocialAuthenticationToken;
import org.springframework.social.security.SocialUserDetails;
import org.springframework.social.security.provider.SocialAuthenticationService;
import org.springframework.util.Assert;
import com.proptiger.core.util.Constants;
import com.proptiger.core.util.DateUtil;
import com.proptiger.core.util.PropertyReader;
import com.proptiger.core.util.SecurityContextUtils;
import com.proptiger.userservice.config.security.ModifiableHttpServletRequest;
/**
* Custom social authentication filter hack request to change for service
* provider.
*
* @author Rajeev Pandey
*
*/
public class CustomSocialAuthFilter extends SocialAuthenticationFilter {
private static Logger logger = LoggerFactory.getLogger(CustomSocialAuthFilter.class);
private static final String SCOPE = "scope";
private PropertyReader propertyReader;
private UsersConnectionRepository connectionRepository;
private CustomJdbcUsersConnectionRepository customJdbcUsersConnectionRepository;
public CustomSocialAuthFilter(
PropertyReader propertyReader,
AuthenticationManager authManager,
UserIdSource userIdSource,
UsersConnectionRepository usersConnectionRepository,
SocialAuthenticationServiceLocator authServiceLocator) {
super(authManager, userIdSource, usersConnectionRepository, authServiceLocator);
this.propertyReader = propertyReader;
this.connectionRepository = usersConnectionRepository;
if (connectionRepository instanceof CustomJdbcUsersConnectionRepository) {
customJdbcUsersConnectionRepository = (CustomJdbcUsersConnectionRepository) connectionRepository;
}
}
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws AuthenticationException {
/*
* this code ensures to login in spring social if user have already
* logged using oauth sdk on mobile device or on website. So once logged
* in using SDK client will pass the access token and this block of code
* will validate the same, and make user logged in SecurityContext.
*/
String accessToken = request.getParameter(Constants.Security.ACCESS_TOKEN);
if (accessToken != null && !accessToken.isEmpty()) {
return attemptAuthUsingAccessToken(request, accessToken);
}
/*
* this flow is to make website or other client work even without
* posting on our app/v1/login/{provider} api. So if authentication
* created then return it other wise normal flow should execute.
*/
String provider = request.getParameter("provider");
String providerUserId = request.getParameter("providerUserId");
if (provider != null && !provider.isEmpty() && providerUserId != null && !providerUserId.isEmpty()) {
return attemptAuthUsingProviderAndProviderId(provider, providerUserId, request);
}
HttpServletRequest wrappedRequest = addScopeInRequestParameter(request);
return super.attemptAuthentication(wrappedRequest, response);
}
/**
* Attempt authentication using access_token passed in request
*
* @param request
* @param accessToken
* @return
*/
private Authentication attemptAuthUsingAccessToken(HttpServletRequest request, String accessToken) {
Set<String> authProviders = getAuthServiceLocator().registeredAuthenticationProviderIds();
String authProviderId = getProviderId(request);
if (!authProviders.isEmpty() && authProviderId != null && authProviders.contains(authProviderId)) {
SocialAuthenticationService<?> authService = getAuthServiceLocator().getAuthenticationService(
authProviderId);
try {
OAuth2ConnectionFactory<?> factory = (OAuth2ConnectionFactory<?>) authService.getConnectionFactory();
Connection<?> connection = factory.createConnection(new AccessGrant(accessToken, null, null, DateUtil
.addDays(new Date(), Constants.Security.ACCESS_TOKEN_VALIDITY_DAYS).getTime()));
final SocialAuthenticationToken token = new SocialAuthenticationToken(connection, null);
Assert.notNull(token.getConnection());
Authentication auth = SecurityContextUtils.getAuthentication();
if (auth == null || !auth.isAuthenticated()) {
return authenticateTokenByAuthManager(token);
}
return auth;
}
catch (Exception e) {
logger.error("Invalid access token {} {}", accessToken, e);
throw new AuthenticationServiceException("invalid access token");
}
}
throw new AuthenticationServiceException("could not determine auth service provider");
}
private Authentication authenticateTokenByAuthManager(SocialAuthenticationToken token) {
Authentication success = getAuthenticationManager().authenticate(token);
Assert.isInstanceOf(SocialUserDetails.class, success.getPrincipal(), "unexpected principle type");
return success;
}
private Authentication attemptAuthUsingProviderAndProviderId(
String provider,
String providerUserId,
HttpServletRequest request) {
// these string constants are as per defined in checkuser.php
logger.debug("login attempt using provider and provideruserid {},{}", provider, providerUserId);
String userName = request.getParameter("userName");
String email = request.getParameter("email");
String profileImageUrl = request.getParameter("profileImageUrl");
if (email != null && !email.isEmpty()) {
if (customJdbcUsersConnectionRepository != null) {
return customJdbcUsersConnectionRepository.createAuthenicationByProviderAndProviderUserId(
provider,
providerUserId,
userName,
email,
profileImageUrl);
}
}
logger.error(
"invlid data for login using provider and provider id {},{},{},{},{}",
provider,
providerUserId,
userName,
email,
profileImageUrl);
return null;
}
/**
* Adding scope varibale in request parameter as that is mandatory for
* google auth, for rest like facebook it may be empty
*
* @param request
* @return
*/
private HttpServletRequest addScopeInRequestParameter(HttpServletRequest request) {
String providerId = getProviderId(request);
String scopeKey = providerId + "." + SCOPE;
Map<String, String[]> extraParams = new TreeMap<String, String[]>();
String[] values = { propertyReader.getRequiredProperty(scopeKey) };
extraParams.put(SCOPE, values);
HttpServletRequest wrappedRequest = new ModifiableHttpServletRequest(request, extraParams);
return wrappedRequest;
}
/**
* Default implementation copied from super class.
*
* @param request
* @return
*/
@SuppressWarnings("deprecation")
private String getProviderId(HttpServletRequest request) {
String uri = request.getRequestURI();
int pathParamIndex = uri.indexOf(';');
if (pathParamIndex > 0) {
// strip everything after the first semi-colon
uri = uri.substring(0, pathParamIndex);
}
// uri must start with context path
uri = uri.substring(request.getContextPath().length());
// remaining uri must start with filterProcessesUrl
if (!uri.startsWith(getFilterProcessesUrl())) {
return null;
}
uri = uri.substring(getFilterProcessesUrl().length());
// expect /filterprocessesurl/provider, not /filterprocessesurlproviderr
if (uri.startsWith("/")) {
return uri.substring(1);
}
else {
return null;
}
}
}
| [
"rajeev.pandey@proptiger.com"
] | rajeev.pandey@proptiger.com |
65753c0c09f238ae22416eb70a17e0ed148d8301 | ce654d813cd148bb10223ebcbb95db4e39ae5f23 | /COMP2603-A2-Test-Student/src/StandingFan.java | fa75dd648df518741ba16788ec55e2669df6598a | [] | no_license | justkrismanohar/TA_Tools | e3fc8c75f3a5f07604a87ac4033ace82a5a9fe9a | bc08da4378e5038cef8710d2792c370606ea3102 | refs/heads/master | 2022-05-26T19:40:35.501672 | 2022-05-05T01:33:40 | 2022-05-05T01:33:40 | 179,185,808 | 1 | 0 | null | 2022-05-05T02:26:57 | 2019-04-03T01:21:37 | HTML | UTF-8 | Java | false | false | 327 | java |
public final class StandingFan extends Fan implements PortableDevice{
public StandingFan(){
super(2);
}
public String getID(){
return "SFAN"+id;
}
public boolean isNoisy(){
return true;
}
public int coolsBy(){
return 1;
}
}
| [
"justkrismanohar@gmail.com"
] | justkrismanohar@gmail.com |
1eba3d9afa621cca8c3a5ad4c28fcaa926f25766 | 4df700e9431c1524e9494890d544a488517741ea | /src/main/java/datastructures/stacks/SimpleTextEditor.java | 61a8d1d1625c7845d0954306b9be1ee8282c9a58 | [] | no_license | murugesan-narayan/hr_solutions | d634413e164fd0a882d407212a527ba8f32b3c76 | 8b82f0cce7cf71ac4e0a0971b56237dd6edddfee | refs/heads/master | 2023-09-03T09:59:44.123099 | 2021-10-18T13:14:05 | 2021-10-18T13:14:05 | 240,828,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,215 | java | package datastructures.stacks;
/*import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;*/
import java.util.Scanner;
import java.util.Stack;
public class SimpleTextEditor {
/* static class Command {
int type;
String value;
int length;
Command(int t, String val, int len) {
this.type = t;
this.value = val;
this.length = len;
}
}*/
/* public static void main1(String[] args) {
StringBuilder str = new StringBuilder("123");
str.delete(0, 3);
System.out.println("str = " + str);
//Command pc = new Command(1, "",1);
}*/
public static void main(String[] args) {
Stack<String> st = new Stack<>();
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String str;
st.push("");
sc.nextLine();
for (int i = 0; i < n; i++) {
int op = sc.nextInt();
switch (op) {
case 1:
str = st.peek() + sc.next();
st.push(str);
break;
case 2:
if (!st.isEmpty()) {
str = st.peek().substring(0, st.peek().length() - sc.nextInt());
st.push(str);
}
break;
case 3:
if (!st.isEmpty()) {
str = st.peek();
char c = str.charAt(sc.nextInt() - 1);
System.out.println(c);
}
break;
case 4:
if (!st.isEmpty()) {
st.pop();
}
break;
}
}
sc.close();
}
/* public static void main12(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String outputString = "";
Stack<String> stack = new Stack<>();
stack.push(outputString);
List<Character> result = new ArrayList<>();
for (int i = 0; i < n; i++) {
String arr[] = br.readLine().split(" ");
int opt = Integer.parseInt(arr[0]);
switch (opt) {
case 1:
outputString += arr[1];
stack.push(outputString);
break;
case 2:
int del = Integer.parseInt(arr[1]);
outputString = outputString.substring(0,
outputString.length() - del);
stack.push(outputString);
break;
case 3:
int show = Integer.parseInt(arr[1]);
result.add(outputString.charAt(show - 1));
break;
case 4:
stack.pop();
outputString = stack.peek();
}
}
for (Character j : result) System.out.println(j);
}*/
}
| [
"murugesan.narayan@gmail.com"
] | murugesan.narayan@gmail.com |
7290b2c764c7ba413f07522bcbf612caa419c4b1 | 620c75f522d8650e87bf64b878ca0a7367623dda | /org.jebtk.modern/src/main/java/org/jebtk/modern/ribbon/RibbonBarButton.java | bc58c7e49ab293d40345a6f23b614c2fffe6e04d | [] | no_license | antonybholmes/jebtk-modern | 539750965fcd0bcc9ee5ec3c371271c4dd2d4c08 | 04dcf905082052dd57890a056e647548e1222dff | refs/heads/master | 2021-08-02T18:05:05.895223 | 2021-07-24T21:59:26 | 2021-07-24T21:59:26 | 100,538,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,920 | java | /**
* Copyright (C) 2016, Antony Holmes
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of copyright holder 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 HOLDER 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.jebtk.modern.ribbon;
import java.awt.Graphics2D;
import org.jebtk.modern.button.ModernButton;
import org.jebtk.modern.graphics.icons.ModernIcon;
// TODO: Auto-generated Javadoc
/**
* Low height button for small form factor toolbar buttons.
*
* @author Antony Holmes
*/
public class RibbonBarButton extends ModernButton {
/**
* The constant serialVersionUID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new ribbon bar button.
*
* @param text1 the text1
*/
public RibbonBarButton(String text1) {
super(text1);
}
/**
* Instantiates a new ribbon bar button.
*
* @param icon the icon
*/
public RibbonBarButton(ModernIcon icon) {
super(icon);
}
/**
* Instantiates a new ribbon bar button.
*
* @param text1 the text1
* @param icon the icon
*/
public RibbonBarButton(String text1, ModernIcon icon) {
super(text1, icon);
}
/*
* (non-Javadoc)
*
* @see org.abh.lib.ui.modern.button.ModernButtonWidget#drawBackground(java.awt.
* Graphics2D)
*/
@Override
public void drawBackground(Graphics2D g2) {
if (isSelected() || mHighlight) {
paintHighlightedOutlined(g2, getRect());
}
}
}
| [
"antony.b.holmes@gmail.com"
] | antony.b.holmes@gmail.com |
e6a0cf3da088bd39c68f64c49da5fb10d949ad64 | 4acedfb0cc3d3d6b1b5450efcf4d5c74083e9681 | /DS_Algo/Week_2/Stack/Exclusive_Time_Function.java | 077d567ba596ba8419974169918eb6fbd2f01e43 | [] | no_license | HiteshBucky/AddSkill | 40521cbae4508195da34ec2740782348b09eeee2 | 52f84cdcf01ce0c7f3008ff9b7621a9e0984fb7b | refs/heads/main | 2023-01-30T01:53:52.684595 | 2020-12-15T15:01:12 | 2020-12-15T15:01:12 | 303,119,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | class Solution {
public int[] exclusiveTime(int n, List<String> logs) {
int[] output = new int[n];
Deque<Integer> stack = new LinkedList<>();
int prevTime = 0;
for (String log : logs) {
String[] split = log.split(":");
//Extracting all the data from the string
int Id = Integer.parseInt(split[0]);
boolean isStart = split[1].equals("start");
int time = Integer.parseInt(split[2]);
if (!isStart) time++;
if (!stack.isEmpty()) output[stack.peek()] += time - prevTime;
if (isStart) stack.push(Id);
else stack.pop();
prevTime = time;
}
return output;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
bc92d05bd30eb6711e36916b5b138b369d17912c | 4643e89f5d508764afc56bb9f6d40c867bf0629a | /src/main/java/com/only/entity/ProductCategory.java | f1075157a373d96fd479acf13cf22008de87d296 | [] | no_license | lvlinguang/only | 3becd0c2ab25fd8a78ddf7d1650616fa9ca4b410 | d5f482e47e56cf3299b1a2b477bd6eba8ff7f17e | refs/heads/master | 2020-06-01T06:33:38.227775 | 2017-08-04T09:56:58 | 2017-08-04T09:56:58 | 94,065,567 | 0 | 1 | null | 2017-06-13T06:19:11 | 2017-06-12T07:03:44 | HTML | UTF-8 | Java | false | false | 2,024 | java | package com.only.entity;
import java.util.Date;
/**
* 商品分类(电脑办公、数码影音)
*
* @author lvlinguang
*
*/
public class ProductCategory {
private Integer id;
private Integer parentId;
private String name;
private Integer level;
private Boolean canshow;
private String icon;
private Integer sequence;
private String description;
private Boolean enable;
private Date createDate;
private Date updateDate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Boolean getCanshow() {
return canshow;
}
public void setCanshow(Boolean canshow) {
this.canshow = canshow;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon == null ? null : icon.trim();
}
public Integer getSequence() {
return sequence;
}
public void setSequence(Integer sequence) {
this.sequence = sequence;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public Boolean getEnable() {
return enable;
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
} | [
"635074566@qq.com"
] | 635074566@qq.com |
7cd2ab858061d3f02af30c1d46d69b426848a56d | b7d5a0595cfb23d16b8e495f7afbd03191543ec5 | /branches/V1.01/android/zhdj/src/com/do1/zhdj/activity/mine/PersonInfoActivity.java | eda75ffc242f49473c147accf9dcfdd7db94d1c8 | [] | no_license | github188/Dangjian | a2a4aa6b875c5fa90c379fcb964ac1cdf25980fc | b510eb89c3b2edff9998105e043c4a56dbbe1106 | refs/heads/master | 2021-05-27T08:51:16.381332 | 2014-05-20T15:46:20 | 2014-05-20T15:46:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,646 | java | package com.do1.zhdj.activity.mine;
import java.io.File;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import cn.com.do1.component.parse.ResultObject;
import cn.com.do1.component.util.ListenerHelper;
import cn.com.do1.component.util.ToastUtil;
import cn.com.do1.component.util.ViewUtil;
import com.androidquery.AQuery;
import com.do1.zhdj.R;
import com.do1.zhdj.activity.mine.user.LoginActivity;
import com.do1.zhdj.activity.parent.AppManager;
import com.do1.zhdj.activity.parent.BaseActivity;
import com.do1.zhdj.util.Constants;
import com.do1.zhdj.util.ImageBase64Util;
import com.do1.zhdj.util.ImageViewTool;
import com.do1.zhdj.util.Listenertool;
import com.do1.zhdj.util.SDCardUtil;
import com.do1.zhdj.util.StringUtil;
import com.do1.zhdj.util.ValidUtil;
/**
* 个人信息页面;当用户为群众,为我的页面,党员,为个人信息页面
* auth:YanFangqin
* data:2013-4-22
* thzhd
*/
public class PersonInfoActivity extends BaseActivity{
private Context context;
private AQuery aq;
//照片
private String piccontent = ""; // 图片内容
private static final int CAMERA_WITH_DATA = 3021; //拍照标识符
private static final int LOCAL_WITH_DATA = 3023; //本地图片标识符
private String picPhotoPath = "";//拍照图片路径
private ImageView photo;
private boolean isChangeLogo = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
aq = new AQuery(this);
if("2".equals(constants.userInfo.getUser_type()))
setContentView(R.layout.mine_fragment_for_public);
else
setContentView(R.layout.mine_fragment_for_dang);
context = this;
aq = new AQuery(this);
setHeadView(findViewById(R.id.headLayout), R.drawable.btn_back_thzhd,"", "2".equals(constants.userInfo.getUser_type()) ? "我的主页" : "个人信息", R.drawable.btn_head_2,"编辑", this, this);
photo = aq.id(R.id.personLogo).getImageView();
if("2".equals(constants.userInfo.getUser_type())){
findViewById(R.id.leftImage).setVisibility(View.GONE);
fillDataPublic();
}else
initDang();
}
public void fillDataPublic(){
new Thread(){
public void run() {
String url = SERVER_URL + getString(R.string.mine);
Map<String, String> map = new HashMap<String, String>();
map.put("user_id", constants.userInfo.getUserId());
doRequest(1, url, map);
};
}.start();
}
/**
* 用户身份为党员
*/
public void initDang(){
aq.id(R.id.yonghuming).text(Constants.sharedProxy.getString("userId","")+"");
aq.id(R.id.shoujihaoma).text(constants.userInfo.getMobile());
// aq.id(R.id.dianziyouxiang_).text(constants.userInfo.getEmail());
// aq.id(R.id.qq_).text(constants.userInfo.getQq());
// aq.id(R.id.lianxidizhi_).text(constants.userInfo.getContactAddr());
System.out.println("name: "+ Constants.sharedProxy.getString("userId",""));
aq.id(R.id.yonghuming_).text(Constants.sharedProxy.getString("userId","")+"");
aq.id(R.id.personName).text(constants.userInfo.getUserName());
// aq.id(R.id.xingming).text(constants.userInfo.getName());
// aq.id(R.id.shenfenzhenghao).text(constants.userInfo.getIDcard());
// System.out.println("mobile: " + );
((TextView)findViewById(R.id.shoujihaoma)).setText(constants.userInfo.getMobile());
aq.id(R.id.shoujihaoma_).text(constants.userInfo.getMobile());
aq.id(R.id.zhiwu).text(constants.userInfo.getJob());
String joinTime = "";
// if(!ValidUtil.isNullOrEmpty(constants.userInfo.getJoinTime())){
// try {
// joinTime = constants.sdfDate.format(constants.sdfReturn.parse(constants.userInfo.getJoinTime()));
// joinTime = joinTime.replace("-", "月").replaceFirst("月", "年")+"日";
// } catch (ParseException e) {
// e.printStackTrace();
// }
// }
aq.id(R.id.rudangshijian).text(constants.userInfo.getJoinTime());
aq.id(R.id.dangling).text(constants.userInfo.getPartAge()+"年");
aq.id(R.id.suoshuzuzhi).text(constants.userInfo.getCheckDept());
// aq.id(R.id.zhucezuzhi).text(constants.userInfo.getRegDept());
// aq.id(R.id.dianziyouxiang).text(constants.userInfo.getEmail());
// aq.id(R.id.qq).text(constants.userInfo.getQq());
// aq.id(R.id.lianxidizhi).text(constants.userInfo.getContactAddr());ImageViewTool.getAsyncImageBg(map.get("portraitPic") + "",
ImageViewTool.getAsyncImageBg(constants.userInfo.getHeadImg() + "", aq.id(R.id.personLogo).getImageView(), 0);
}
/**
* 用户身份为群众
*/
public void initPublic(){
aq.id(R.id.yonghuming_).text(constants.userInfo.getUserName());
aq.id(R.id.shoujihaoma_).text(constants.userInfo.getMobile());
aq.id(R.id.dianziyouxiang_).text(constants.userInfo.getEmail());
aq.id(R.id.qq_).text(constants.userInfo.getQq());
aq.id(R.id.lianxidizhi_).text(constants.userInfo.getContactAddr());
aq.id(R.id.personName).text(constants.userInfo.getName());
aq.id(R.id.yonghuming).text(constants.userInfo.getUserName());
aq.id(R.id.xingming).text(constants.userInfo.getName());
aq.id(R.id.shenfenzhenghao).text(constants.userInfo.getIDcard().substring(0, 6%constants.userInfo.getIDcard().length()) + "************");
aq.id(R.id.shoujihaoma).text(constants.userInfo.getMobile());
aq.id(R.id.dianziyouxiang).text(constants.userInfo.getEmail());
aq.id(R.id.qq).text(constants.userInfo.getQq());
aq.id(R.id.lianxidizhi).text(constants.userInfo.getContactAddr());
ImageViewTool.getAsyncImageBg(constants.userInfo.getHeadImg() + "", aq.id(R.id.personLogo).getImageView(), 0);
int[] onclickListenerIds = { R.id.xiugaimimaLayout,R.id.loginOut,R.id.wuxianshenghuoLayout };
Listenertool.bindOnCLickListener(this, this, onclickListenerIds);
}
/**
* 将能够修改的字段设置成Edit状态
* @param editTexts
*/
public void setEditView(int show,EditText...editTexts){
for(EditText e : editTexts){
e.setVisibility(show);
}
if(View.VISIBLE == show){
aq.id(R.id.editImg).visible();
aq.id(R.id.yonghuming).visible();
aq.id(R.id.shoujihaoma).visible();
if("2".equals(constants.userInfo.getUser_type())){
aq.id(R.id.dianziyouxiang).visible();
aq.id(R.id.qq).visible();
aq.id(R.id.lianxidizhi).visible();
}
aq.id(R.id.yonghuming_).gone();
aq.id(R.id.shoujihaoma_).gone();
if("2".equals(constants.userInfo.getUser_type())){
aq.id(R.id.dianziyouxiang_).gone();
aq.id(R.id.qq_).gone();
aq.id(R.id.lianxidizhi_).gone();
}
}else{
aq.id(R.id.yonghuming_).visible();
aq.id(R.id.shoujihaoma_).visible();
if("2".equals(constants.userInfo.getUser_type())){
aq.id(R.id.dianziyouxiang_).visible();
aq.id(R.id.qq_).visible();
aq.id(R.id.lianxidizhi_).visible();
}
aq.id(R.id.editImg).gone();
aq.id(R.id.yonghuming).gone();
aq.id(R.id.shoujihaoma).gone();
if("2".equals(constants.userInfo.getUser_type())){
aq.id(R.id.dianziyouxiang).gone();
aq.id(R.id.qq).gone();
aq.id(R.id.lianxidizhi).gone();
}
}
}
@Override
public void onClick(View v) {
Intent intent;
switch (v.getId()) {
case R.id.leftImage:
if("2".equals(constants.userInfo.getUser_type())){
setEditView(View.GONE,
aq.id(R.id.yonghuming).getEditText(),
aq.id(R.id.shoujihaoma).getEditText(),
aq.id(R.id.dianziyouxiang).getEditText(),
aq.id(R.id.qq).getEditText(),
aq.id(R.id.lianxidizhi).getEditText());
aq.id(R.id.rightImage).text("编辑");
ListenerHelper.bindOnCLickListener(PersonInfoActivity.this, null, R.id.personLogo);
}else{
finish();
}
break;
case R.id.rightImage:
if("保存".equals(aq.id(R.id.rightImage).getText().toString())){
saveUserInfo();
}else{
setEditView(View.VISIBLE,
aq.id(R.id.yonghuming).getEditText(),
aq.id(R.id.shoujihaoma).getEditText(),
aq.id(R.id.dianziyouxiang).getEditText(),
aq.id(R.id.qq).getEditText(),
aq.id(R.id.lianxidizhi).getEditText());
findViewById(R.id.leftImage).setVisibility(View.VISIBLE);
aq.id(R.id.rightImage).text("保存");
ListenerHelper.bindOnCLickListener(PersonInfoActivity.this, photoClick, R.id.personLogo);
}
break;
case R.id.xiugaimimaLayout:
intent = new Intent(context, ChangePasswordActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
break;
case R.id.wuxianshenghuoLayout:
intent = new Intent(context, FreeLifeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
break;
case R.id.loginOut:
Dialog dialog = new AlertDialog.Builder(context).setTitle("温馨提示")
.setMessage("确定退出登录吗?").setPositiveButton("是",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
register();
constants.userInfo = null;
Constants.loginInfo.setLogin(false);
Constants.sharedProxy.putBoolean("isFirst", false);
Constants.sharedProxy.commit();
Intent intent = new Intent(context, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
constants.exit(context);
finish();
}
}).setNegativeButton("否",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
dialog.dismiss();
}
}).create();
dialog.show();
break;
}
}
/**
* 验证个人信息保存
*/
public boolean valid(){
if(ValidUtil.isNullOrEmpty(aq.id(R.id.yonghuming).getText().toString())){
ToastUtil.showShortMsg(context, "请填写用户名");
return false;
}
if(ValidUtil.isNullOrEmpty(aq.id(R.id.shoujihaoma).getText().toString())){
ToastUtil.showShortMsg(context, "请填写手机号码");
return false;
}
if(!ValidUtil.isMoble(aq.id(R.id.shoujihaoma).getText().toString())){
ToastUtil.showShortMsg(context, "请输入正确的手机号码");
return false;
}
// if(ValidUtil.isNullOrEmpty(aq.id(R.id.dianziyouxiang).getText().toString())){
// ToastUtil.showShortMsg(context, "请填写电子邮箱");
// return false;
// }
// if(ValidUtil.isNullOrEmpty(aq.id(R.id.qq).getText().toString())){
// ToastUtil.showShortMsg(context, "请填写QQ");
// return false;
// }
// if(ValidUtil.isNullOrEmpty(aq.id(R.id.lianxidizhi).getText().toString())){
// ToastUtil.showShortMsg(context, "请填写联系地址");
// return false;
// }
if (isChangeLogo && photo.getDrawable() != null) {
isChangeLogo = false;
piccontent = new ImageBase64Util().getBitmapStrBase64(new ImageBase64Util().drawableToBitmap(photo.getDrawable()));
System.out.println("piccontent:" + piccontent);
}
return true;
}
/**
* 保存用户信息编辑
*/
public void saveUserInfo(){
ViewUtil.hideKeyboard(this);
if(valid()){
Map<String, Object> map = new LinkedHashMap<String, Object>();
String usertype=constants.userInfo.getUser_type();
String userid=constants.userInfo.getUserId();
String username=aq.id(R.id.yonghuming).getText().toString();
// String portraitPic="";
String mobile=aq.id(R.id.shoujihaoma).getText().toString();
String email="";
map.put("userType", usertype);
map.put("userId", userid);
map.put("userName", username);
// map.put("head_filename", UUID.randomUUID().toString()+".jpg");
// map.put("head_img", piccontent);// 头像
map.put("portraitPic", piccontent); // 图片内容
map.put("mobile", mobile);
// map.put("email", aq.id(R.id.dianziyouxiang).getText().toString());
// map.put("qq", aq.id(R.id.qq).getText().toString());
// map.put("contact_addr", aq.id(R.id.lianxidizhi).getText().toString());
map.put("email", email);
// String digest=usertype + userid + username+portraitPic+mobile+email;
// map.put("digest", SecurityUtil.encryptToMD5(digest.toLowerCase()));
// Map<String, String> map2 = new HashMap<String, String>();
// map2.put("requestJson", StringUtil.toJsonString(map));
String url = Constants.SERVER_RUL2 + getString(R.string.save_person_info);
doRequest(2, url, StringUtil.jiami(map));
// String key = Entryption.getJsonKey2(map);
// Log.e(key);
// doRequestPostString(2, url, key);
}
}
@Override
public void onExecuteSuccess(int requestId, ResultObject resultObject) {
if(requestId == 1){ // 我的用户信息
Map<String, Object> map = resultObject.getDataMap();
constants.userInfo.setHeadImg(map.get("head_img")+"");
constants.userInfo.setBranchId(map.get("branch_id")+"");
constants.userInfo.setBranchInt(map.get("branch_int")+"");
constants.userInfo.setBranchPeoples(map.get("branch_peoples")+"");
constants.userInfo.setBranchRank(map.get("branch_rank")+"");
constants.userInfo.setBranchSec(map.get("branch_sec")+"");
constants.userInfo.setCheckDept(map.get("check_dept")+"");
constants.userInfo.setContactAddr(map.get("contact_addr")+"");
constants.userInfo.setEmail(map.get("email")+"");
constants.userInfo.setIDcard(map.get("idcard")+"");
constants.userInfo.setIntegralRank(map.get("integral_rank")+"");
constants.userInfo.setIs_can_test(map.get("is_can_test")+"");
constants.userInfo.setIsCanTest(map.get("is_can_test")+"");
constants.userInfo.setIsPartyWorkers(map.get("is_party_workers")+"");
constants.userInfo.setJob(map.get("job")+"");
constants.userInfo.setJoinTime(map.get("join_time")+"");
constants.userInfo.setMobile(map.get("mobile")+"");
constants.userInfo.setName(map.get("cname")+"");
constants.userInfo.setPartAge(map.get("part_age")+"");
constants.userInfo.setPartyStuUrl(map.get("party_stu_url")+"");
constants.userInfo.setQq(map.get("qq")+"");
constants.userInfo.setRegDept(map.get("reg_dept")+"");
constants.userInfo.setUserName(map.get("user_name")+"");
constants.userInfo.setTodos(map.get("todos")+"");
constants.userInfo.setMettingSigns(map.get("metting_signs")+"");
constants.userInfo.setAnalysisReports(map.get("analysis_reports")+"");
constants.userInfo.setBranchImg(map.get("branch_img")+"");
constants.userInfo.setBranchName(map.get("branch_name")+"");
initPublic();
}else{ // 保存用户信息
ToastUtil.showLongMsg(this, resultObject.getDesc());
if(!"2".equals(constants.userInfo.getUser_type())){
if(!ValidUtil.isNullOrEmpty(piccontent)){
AppManager.needFlesh = true;
}
// aq.id(R.id.personName).text(constants.userInfo.getUserName());
// constants.userInfo.setUserId(aq.id(R.id.yonghuming_).getText().toString());
Constants.sharedProxy.putString("userId", aq.id(R.id.yonghuming).getText().toString()); // 用户id
Constants.sharedProxy.commit();
constants.userInfo.setMobile(aq.id(R.id.shoujihaoma).getText().toString());
finish();
}else{
constants.userInfo.setUserName(aq.id(R.id.yonghuming).getText().toString());
setEditView(View.GONE,
aq.id(R.id.yonghuming).getEditText(),
aq.id(R.id.shoujihaoma).getEditText(),
aq.id(R.id.dianziyouxiang).getEditText(),
aq.id(R.id.qq).getEditText(),
aq.id(R.id.lianxidizhi).getEditText());
aq.id(R.id.rightImage).text("编辑");
aq.id(R.id.leftImage).gone();
ListenerHelper.bindOnCLickListener(PersonInfoActivity.this, null, R.id.personLogo);
fillDataPublic();
}
}
}
private OnClickListener photoClick = new OnClickListener() {
@Override
public void onClick(View v) {
Builder imageialog = new AlertDialog.Builder(context);
String[] items = {"从本地获取","照相"};
imageialog.setTitle("请选择操作").setSingleChoiceItems(items, -1, new android.content.DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0){//从本地获取
Intent intent=new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(intent,LOCAL_WITH_DATA);
}else{//照相
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);
String sdpath = SDCardUtil.getTakingPhotoDir() + File.separator + SDCardUtil.getPhotoFileName();
File file = new File(SDCardUtil.getTakingPhotoDir(),SDCardUtil.getPhotoFileName());
intent.putExtra("imagePath", sdpath);
picPhotoPath = sdpath;
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));//输出文件位置
startActivityForResult(intent, CAMERA_WITH_DATA);
}
dialog.dismiss();
}
}).create().show();
}
};
public void startPhotoZoom(Uri uri) {
/*
* 至于下面这个Intent的ACTION是怎么知道的,大家可以看下自己路径下的如下网页
* yourself_sdk_path/docs/reference/android/content/Intent.html
* 直接在里面Ctrl+F搜:CROP ,之前没仔细看过,其实安卓系统早已经有自带图片裁剪功能, 是直接调本地库的
*/
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*");
// 下面这个crop=true是设置在开启的Intent中设置显示的VIEW可裁剪
intent.putExtra("crop", "true");
// aspectX aspectY 是宽高的比例
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
// outputX outputY 是裁剪图片宽高
intent.putExtra("outputX", 150);
intent.putExtra("outputY", 150);
intent.putExtra("return-data", true);
startActivityForResult(intent, 1);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case 1:
if (data != null) {
ImageView editImg = (ImageView) findViewById(R.id.personLogo);
Bundle extras = data.getExtras();
if (extras != null) {
Bitmap photo = extras.getParcelable("data");
Drawable drawable = new BitmapDrawable(photo);
editImg.setImageDrawable(drawable);
isChangeLogo = true;
}
}
break;
case CAMERA_WITH_DATA:
if (resultCode == RESULT_OK) {
if(!ValidUtil.isNullOrEmpty(picPhotoPath)){
File file = new File(picPhotoPath);
if(file != null){
startPhotoZoom(Uri.fromFile(file));
}
picPhotoPath = "";
}
}
break;
case LOCAL_WITH_DATA:
if (resultCode == RESULT_OK){
startPhotoZoom(data.getData());
}
break;
}
}
}
| [
"mac@mactekiMacBook-Pro.local"
] | mac@mactekiMacBook-Pro.local |
f9f299a02cfbf206ea8e0fd736e97f61f6574c8a | 854fcca633a523eefb9b6d6536752490224da76e | /app/src/main/java/com/wnw/lovebabyadmin/util/OrderTypeConvert.java | 4a7acd966b66f042c1755083fc081b759bffe790 | [] | no_license | wangnaiwen/LoveBabyAdmin | 2e18e8c0bc767731908cc672e2896dc249d48869 | debc280a7177ee1b8e11fa6b5c24941142fd4007 | refs/heads/master | 2021-01-20T14:59:00.360810 | 2017-06-05T11:55:14 | 2017-06-05T11:55:14 | 90,698,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package com.wnw.lovebabyadmin.util;
/**
* Created by wnw on 2017/4/17.
*/
public class OrderTypeConvert {
public static String getStringType(int type){
String stringType = "";
if(type == 0){
stringType = "无效订单";
}else if(type == 1){
stringType = "待支付";
}else if(type == 2){
stringType = "待发货";
}else if(type == 3){
stringType = "待收货";
}else if(type == 4){
stringType = "待评价";
}
else if(type == 5){
stringType = "已完成";
}
return stringType;
}
}
| [
"1464524269@qq.com"
] | 1464524269@qq.com |
e1116137a53db8af1580fb62dfd311184f7f2cc4 | 40d3ad2035d28f1be96b05885ca9d37e635ab231 | /src/com/dao/impl/PurchaseDaoImpl.java | 9dd20ddb72a2264eba18c928a736700b1dd166b7 | [] | no_license | Mosand/wechat_marketing | 6c6177d3caf6046024b5e921feb57d74839d416f | e199c0af69da08bcd9be2dd45fbdcf8d8d93d34c | refs/heads/master | 2020-05-25T23:06:01.924588 | 2019-07-08T11:28:51 | 2019-07-08T11:28:51 | 188,028,387 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 23,441 | java | package com.dao.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.dao.PurchaseDao;
import com.entity.GoodsInfo;
import com.entity.ExpenseIncome;
import com.entity.Pager;
import com.entity.Purchase;
import com.entity.UserInfo;
import com.google.gson.Gson;
public class PurchaseDaoImpl extends HibernateDaoSupport implements PurchaseDao{
@Override
public String makeDeal(String id1,String time,String deal_num){
time = time.trim();
time = time.replace("-", "");
time = time.replace(":", "");
time = time.replace(" ", "");
deal_num = id1 + time ;
return deal_num;
}
public List<GoodsInfo> findPriceandGoodsImage(int goods_id){
String hql="";
hql = "from goods_info g where g.goods_id = ? ";
List<GoodsInfo> goodslist=this.getHibernateTemplate().find(hql,goods_id);
if(goodslist.size()!=0){
System.out.println("查询成功");
//System.out.println("单价 is "+ goodslist.get(0).getPrice());
return goodslist;
}else if(goodslist.size()==0){
return null;
}
return null;
}
public List<UserInfo> findUsernameandAvatar(String id1){
String hql="";
hql = "from user_info u where u.id1 = ? ";
List<UserInfo> userlist=this.getHibernateTemplate().find(hql,id1);
if(userlist.size()!=0){
System.out.println("查询成功");
//System.out.println("单价 is "+ goodslist.get(0).getPrice());
return userlist;
}else if(userlist.size()==0){
return null;
}
return null;
}
@Override
public String saveDeal(String id1,String username,int goods_id,String goods_name,int buy_num,float spend,String time,int state,String avatar_url,String imgFormat,String deal_num,int addressID){
deal_num = this.makeDeal(id1, time, deal_num);
Session se =this.getSession();
String hql="";
spend = this.findPriceandGoodsImage(goods_id).get(0).getPrice() * buy_num;
username = this.findUsernameandAvatar(id1).get(0).getUsername();
avatar_url = this.findUsernameandAvatar(id1).get(0).getAvatar_url();
goods_name = this.findPriceandGoodsImage(goods_id).get(0).getGoods_name();
imgFormat = this.findPriceandGoodsImage(goods_id).get(0).getImgFormat();
hql = "insert into purchase(id1, username,goods_id, goods_name,buy_num, spend, time, state, avatar_url, imgFormat, deal_num,addressID) values(?,?,?,?,?,?,?,?,?,?,?,?)";
Query query= se.createSQLQuery(hql);
query.setString(0, id1);
query.setString(1, username);
query.setInteger(2, goods_id);
query.setString(3, goods_name);
query.setInteger(4, buy_num);
query.setFloat(5, spend);
query.setString(6, time);
query.setInteger(7, state);
query.setString(8, avatar_url);
query.setString(9, imgFormat);
query.setString(10, deal_num);
query.setInteger(11, addressID);
if(query.executeUpdate() == 1){
return "success";
}else
return "fail";
}
@SuppressWarnings("unchecked")
@Override
public List<Purchase> findOneDeal(String id1){//一个顾客全部的购买记录
String hql="";
if(id1==null||id1.equals(""))
return null;
hql = "from purchase p where p.id1 = ? ";
List<Purchase> purchaselist=this.getHibernateTemplate().find(hql,id1);
if(purchaselist.size()!=0){
System.out.println("查询成功");
System.out.println("id1 is "+ id1);
return purchaselist;
}else if(purchaselist.size()==0){
return null;
}
return null;
}
@Override
public String change(int state,String deal_num){//改变订单状态
Session se =this.getSession();
String hql="";
state = 1;
hql = "update purchase p set p.state = ? where p.deal_num = ?";
Query query= se.createSQLQuery(hql);
query.setInteger(0, state);
query.setString(1, deal_num);
if(query.executeUpdate() == 1){
return "success";
}else
return "fail";
}
@Override
public int findCount() {
// TODO Auto-generated method stub
String hql = "select count(*) from purchase";
@SuppressWarnings("unchecked")
List<Long> list = this.getHibernateTemplate().find(hql);
if(list.size()>0){
return list.get(0).intValue();
}
return 0;
}
@SuppressWarnings("null")
@Override
public int findCount(Purchase searchModel) {
// TODO Auto-generated method stub
String username = searchModel.getUsername();
String time = searchModel.getTime();
if((time == null || time.equals("")) && (username ==null || username.equals(""))){
String hql = "select count(*) from purchase";
@SuppressWarnings("unchecked")
List<Long> list = this.getHibernateTemplate().find(hql);
if(list.size()>0){
return list.get(0).intValue();
}
}
if((time == null || time.equals("")) && (username!=null || !username.equals(""))){
String hql = "select count(*) from purchase where username = ?";
@SuppressWarnings("unchecked")
List<Long> list = this.getHibernateTemplate().find(hql,username);
if(list.size()>0){
return list.get(0).intValue();
}
}
if((username == null || username.equals("")) && (time != null || !time.equals(""))){
//Session session = this.getSession();
String hql = "select count(*) from purchase where time like '"+time+"%' ";
@SuppressWarnings("unchecked")
List<Long> list = this.getHibernateTemplate().find(hql);
if(list.size()>0){
return list.get(0).intValue();
}
}
if (time != null && !time.equals("") && username != null && !username.equals("")) {
String hql = "select count(*) from purchase where time like '"+time+"%' "+"and username ='"+username+"'";
@SuppressWarnings("unchecked")
List<Long> list = this.getHibernateTemplate().find(hql);
if(list.size()>0){
return list.get(0).intValue();
}
}
return 0;
}
@SuppressWarnings("unchecked")
@Override
public List<Purchase> findByPage(int begin, int pageSize) {
// TODO Auto-generated method stub
DetachedCriteria criteria = DetachedCriteria.forClass(Purchase.class);
// 查询分页数据
criteria.addOrder(Order.desc("time"));
List<Purchase> list = this.getHibernateTemplate().findByCriteria(criteria,begin,pageSize);
this.findCount();
//System.out.println("list"+list.size());
return list;
}
@SuppressWarnings({ "unchecked", "null" })
@Override
public List<Purchase> findByPage(Purchase searchModel,int begin, int pageSize) {
// TODO Auto-generated method stub
DetachedCriteria criteria = DetachedCriteria.forClass(Purchase.class);
String username = searchModel.getUsername();
String time = searchModel.getTime();
System.out.println("username: "+username);
System.out.println("time: "+time);
if((time == null || time.equals("")) && (username ==null || username.equals(""))){
return this.findByPage(begin, pageSize);
}
// 查询分页数据
List<Purchase> list = new ArrayList<>();
if((time == null || time.equals("")) && (username!=null || !username.equals(""))){
criteria.add(Restrictions.eq("username", username));
criteria.addOrder(Order.desc("time"));
list = this.getHibernateTemplate().findByCriteria(criteria,begin,pageSize);
System.out.println("list: "+list.size());
}
if((username == null || username.equals("")) && (time != null || !time.equals(""))){
criteria.add(Restrictions.like("time",time+"%"));
criteria.addOrder(Order.desc("time"));
list = this.getHibernateTemplate().findByCriteria(criteria,begin,pageSize);
System.out.println("list: "+list.size());
}
if (time != null && !time.equals("") && username != null && !username.equals("")) {
criteria.add(Restrictions.like("time",time+"%"));
criteria.add(Restrictions.eq("username", username));
criteria.addOrder(Order.desc("time"));
list = this.getHibernateTemplate().findByCriteria(criteria,begin,pageSize);
System.out.println("list: "+list.size());
}
return list;
}
@Override
public List<ExpenseIncome> getSumByMonth() {
// TODO Auto-generated method stub
System.out.println("Dao层运行");
Session session =this.getSession();
String hql="";
hql="SELECT CONCAT(YEAR(time),'-',MONTH(time)) as '月',YEAR(time) as YEAR,MONTH(time) as MONTH,IFNULL(b.income,0) as 'expense'"
+" FROM(SELECT STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d') as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 1 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 2 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 3 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 4 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 5 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 6 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 7 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 8 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 9 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 10 MONTH) as time UNION ALL "
+"SELECT DATE_ADD(STR_TO_DATE(CONCAT(YEAR(CURDATE()),'-',1,'-',1) , '%Y-%m-%d'),INTERVAL 11 MONTH) as time) a "
+"LEFT JOIN(SELECT sum(spend) as income , CONCAT(YEAR(time),'-',MONTH(time)) as mon "
+"FROM purchase GROUP BY mon) b ON CONCAT(YEAR(time),'-',MONTH(time))=b.mon order by year desc,month asc ";
Query query = session.createSQLQuery(hql);
List<ExpenseIncome> list = new ArrayList<>();
list = query.list();
Gson gson = new Gson();
System.out.println("list:"+gson.toJson(list));
return list;
}
// public PageBean<Purchase> findByPage(Purchase searchModel, int pageNum, int pageSize) {
// System.out.println("dao层方法启动");
// // 声明结果集
// PageBean<Purchase> result = null;
//
// // 存放查询参数
// Map<String, Object> paramMap = new HashMap<String, Object>();
//
// String username = searchModel.getUsername();
// String time = searchModel.getTime();
// StringBuilder hql = new StringBuilder();
// StringBuilder countHql = new StringBuilder();
// if(time == null && username == null){
// return (PageBean<Purchase>) this.findByPage(pageNum, pageSize);
// }
// if((time == null || time.equals("")) && (username!=null || !username.equals(""))){
// hql = new StringBuilder("from purchase where username =:username ");
// countHql = new StringBuilder("select count(*) from purchase where username =:username");
// paramMap.put("username", username);
// // 起始索引
// int fromIndex = pageSize * (pageNum - 1);
//
// // 存放所有查询出的商品对象
// List<Purchase> purchaseList = new ArrayList<Purchase>();
//
// Session session = null;
//
// // 获取被Spring托管的session
//
// session = this.getSession();
//
// // 获取query对象
// Query hqlQuery = session.createQuery(hql.toString());
// Query countHqlQuery = session.createQuery(countHql.toString());
//
// // 设置查询参数
// setQueryParams(hqlQuery, paramMap);
// setQueryParams(countHqlQuery, paramMap);
//
// // 从第几条记录开始查询
// hqlQuery.setFirstResult(fromIndex);
//
// // 一共查询多少条记录
// hqlQuery.setMaxResults(pageSize);
//
// // 获取查询的结果
// purchaseList = hqlQuery.list();
//
// // 获取总记录数
// List<?> countResult = countHqlQuery.list();
// int totalRecord = ((Number) countResult.get(0)).intValue();
//
// // 获取总页数
// int totalPage = totalRecord / pageSize;
// if (totalRecord % pageSize != 0) {
// totalPage++;
// }
//
// // 组装pager对象
// result = new PageBean<Purchase>(pageSize, pageNum, totalRecord, totalPage, purchaseList);
// System.out.println("dao层方法运行结束");
// return result;
//
// }
// if((username == null || username.equals("")) && (time != null || !time.equals(""))){
// hql = new StringBuilder("from purchase where time like :time");
// countHql = new StringBuilder("select count(*) from purchase where time like :time");
// paramMap.put("time", time + "%");
// // 起始索引
// int fromIndex = pageSize * (pageNum - 1);
//
// // 存放所有查询出的商品对象
// List<Purchase> purchaseList = new ArrayList<Purchase>();
//
// Session session = null;
//
// // 获取被Spring托管的session
//
// session = this.getSession();
//
// // 获取query对象
// Query hqlQuery = session.createQuery(hql.toString());
// Query countHqlQuery = session.createQuery(countHql.toString());
//
// // 设置查询参数
// setQueryParams(hqlQuery, paramMap);
// setQueryParams(countHqlQuery, paramMap);
//
// // 从第几条记录开始查询
// hqlQuery.setFirstResult(fromIndex);
//
// // 一共查询多少条记录
// hqlQuery.setMaxResults(pageSize);
//
// // 获取查询的结果
// purchaseList = hqlQuery.list();
//
// // 获取总记录数
// List<?> countResult = countHqlQuery.list();
// int totalRecord = ((Number) countResult.get(0)).intValue();
//
// // 获取总页数
// int totalPage = totalRecord / pageSize;
// if (totalRecord % pageSize != 0) {
// totalPage++;
// }
//
// // 组装pager对象
// result = new PageBean<Purchase>(pageSize, pageNum, totalRecord, totalPage, purchaseList);
// System.out.println("dao层方法运行结束");
// return result;
// }
// else if (time != null && !time.equals("") && username != null && !username.equals("")) {
// hql = new StringBuilder("from purchase where time like :time and username =:username ");
// countHql = new StringBuilder("select count(*) from purchase where time like :time and username =:username");
// paramMap.put("time", time + "%");
// paramMap.put("username",username);
// // 起始索引
// int fromIndex = pageSize * (pageNum - 1);
//
// // 存放所有查询出的商品对象
// List<Purchase> purchaseList = new ArrayList<Purchase>();
//
// Session session = null;
//
// // 获取被Spring托管的session
//
// session = this.getSession();
//
// // 获取query对象
// Query hqlQuery = session.createQuery(hql.toString());
// Query countHqlQuery = session.createQuery(countHql.toString());
//
// // 设置查询参数
// setQueryParams(hqlQuery, paramMap);
// setQueryParams(countHqlQuery, paramMap);
//
// // 从第几条记录开始查询
// hqlQuery.setFirstResult(fromIndex);
//
// // 一共查询多少条记录
// hqlQuery.setMaxResults(pageSize);
//
// // 获取查询的结果
// purchaseList = hqlQuery.list();
//
// // 获取总记录数
// List<?> countResult = countHqlQuery.list();
// int totalRecord = ((Number) countResult.get(0)).intValue();
//
// // 获取总页数
// int totalPage = totalRecord / pageSize;
// if (totalRecord % pageSize != 0) {
// totalPage++;
// }
//
// // 组装pager对象
// result = new PageBean<Purchase>(pageSize, pageNum, totalRecord, totalPage, purchaseList);
// System.out.println("dao层方法运行结束");
// return result;
// }
// return result;
//
//
// }
//
// /**
// * 设置查询的参数
// *
// * @param query
// * @param paramMap
// * @return
// */
// private Query setQueryParams(Query query, Map<String, Object> paramMap) {
// if (paramMap != null && !paramMap.isEmpty()) {
// for (Map.Entry<String, Object> param : paramMap.entrySet()) {
// query.setParameter(param.getKey(), param.getValue());
// }
// }
// return query;
// }
// @Override
// public List<Purchase> findByPage(Purchase searchModel,int begin, int pageSize) {
// // TODO Auto-generated method stub
// DetachedCriteria criteria = DetachedCriteria.forClass(Purchase.class);
// // 查询分页数据
// // 存放查询参数
//// Map<String, Object> paramMap = new HashMap<String, Object>();
////
//// String username = searchModel.getUsername();
//// String time = searchModel.getTime();
//// StringBuilder hql = new StringBuilder();
//// StringBuilder countHql = new StringBuilder();
// List<Purchase> list = this.getHibernateTemplate().findByCriteria(criteria,begin,pageSize);
// return list;
//}
public Pager<Purchase> findByPage2(Purchase searchModel, int pageNum, int pageSize) {
// 声明结果集
Pager<Purchase> result = null;
// 存放查询参数
Map<String, Object> paramMap = new HashMap<String, Object>();
String username = searchModel.getUsername();
String time = searchModel.getTime();
StringBuilder hql = new StringBuilder();
StringBuilder countHql = new StringBuilder();
if((time == null || time.equals("")) && (username ==null || username.equals(""))){
return this.findByPage3(pageNum, pageSize);
}
if((time == null || time.equals("")) && (username !=null || !username.equals(""))){
hql = new StringBuilder("from purchase where username =:username order by time desc");
countHql = new StringBuilder("select count(*) from purchase where username =:username");
paramMap.put("username", username);
// 起始索引
int fromIndex = pageSize * (pageNum - 1);
// 存放所有查询出的商品对象
List<Purchase> purchaseList = new ArrayList<Purchase>();
Session session = null;
// 获取被Spring托管的session
session = this.getSession();
// 获取query对象
Query hqlQuery = session.createQuery(hql.toString());
Query countHqlQuery = session.createQuery(countHql.toString());
// 设置查询参数
setQueryParams(hqlQuery, paramMap);
setQueryParams(countHqlQuery, paramMap);
// 从第几条记录开始查询
hqlQuery.setFirstResult(fromIndex);
// 一共查询多少条记录
hqlQuery.setMaxResults(pageSize);
// 获取查询的结果
purchaseList = hqlQuery.list();
// 获取总记录数
List<?> countResult = countHqlQuery.list();
int totalRecord = ((Number) countResult.get(0)).intValue();
// 获取总页数
int totalPage = totalRecord / pageSize;
if (totalRecord % pageSize != 0) {
totalPage++;
}
// 组装pager对象
result = new Pager<Purchase>(pageSize, pageNum, totalRecord, totalPage, purchaseList);
System.out.println("dao层方法运行结束");
return result;
}
if((username == null || username.equals("")) && (time != null || !time.equals(""))){
hql = new StringBuilder("from purchase where time like :time order by time desc");
countHql = new StringBuilder("select count(*) from purchase where time like :time");
paramMap.put("time", time + "%");
// 起始索引
int fromIndex = pageSize * (pageNum - 1);
// 存放所有查询出的商品对象
List<Purchase> purchaseList = new ArrayList<Purchase>();
Session session = null;
// 获取被Spring托管的session
session = this.getSession();
// 获取query对象
Query hqlQuery = session.createQuery(hql.toString());
Query countHqlQuery = session.createQuery(countHql.toString());
// 设置查询参数
setQueryParams(hqlQuery, paramMap);
setQueryParams(countHqlQuery, paramMap);
// 从第几条记录开始查询
hqlQuery.setFirstResult(fromIndex);
// 一共查询多少条记录
hqlQuery.setMaxResults(pageSize);
// 获取查询的结果
purchaseList = hqlQuery.list();
// 获取总记录数
List<?> countResult = countHqlQuery.list();
int totalRecord = ((Number) countResult.get(0)).intValue();
// 获取总页数
int totalPage = totalRecord / pageSize;
if (totalRecord % pageSize != 0) {
totalPage++;
}
// 组装pager对象
result = new Pager<Purchase>(pageSize, pageNum, totalRecord, totalPage, purchaseList);
System.out.println("dao层方法运行结束");
return result;
}
else if (time != null && !time.equals("") && username != null && !username.equals("")) {
hql = new StringBuilder("from purchase where time like :time and username =:username order by time desc");
countHql = new StringBuilder("select count(*) from purchase where time like :time and username =:username");
paramMap.put("time", time + "%");
paramMap.put("username",username);
// 起始索引
int fromIndex = pageSize * (pageNum - 1);
// 存放所有查询出的商品对象
List<Purchase> purchaseList = new ArrayList<Purchase>();
Session session = null;
// 获取被Spring托管的session
session = this.getSession();
// 获取query对象
Query hqlQuery = session.createQuery(hql.toString());
Query countHqlQuery = session.createQuery(countHql.toString());
// 设置查询参数
setQueryParams(hqlQuery, paramMap);
setQueryParams(countHqlQuery, paramMap);
// 从第几条记录开始查询
hqlQuery.setFirstResult(fromIndex);
// 一共查询多少条记录
hqlQuery.setMaxResults(pageSize);
// 获取查询的结果
purchaseList = hqlQuery.list();
// 获取总记录数
List<?> countResult = countHqlQuery.list();
int totalRecord = ((Number) countResult.get(0)).intValue();
// 获取总页数
int totalPage = totalRecord / pageSize;
if (totalRecord % pageSize != 0) {
totalPage++;
}
// 组装pager对象
result = new Pager<Purchase>(pageSize, pageNum, totalRecord, totalPage, purchaseList);
System.out.println("dao层方法运行结束");
return result;
}
return result;
}
/**
* 设置查询的参数
*
* @param query
* @param paramMap
* @return
*/
private Query setQueryParams(Query query, Map<String, Object> paramMap) {
if (paramMap != null && !paramMap.isEmpty()) {
for (Map.Entry<String, Object> param : paramMap.entrySet()) {
query.setParameter(param.getKey(), param.getValue());
}
}
return query;
}
// @Override
public Pager<Purchase> findByPage3(int pageNum, int pageSize) {
// TODO Auto-generated method stub
StringBuilder hql = new StringBuilder();
hql = new StringBuilder("from purchase order by time desc");
// 起始索引
int fromIndex = pageSize * (pageNum - 1);
// 存放所有查询出的商品对象
List<Purchase> purchaseList = new ArrayList<Purchase>();
Session session = null;
// 获取被Spring托管的session
session = this.getSession();
// 获取query对象
Query hqlQuery = session.createQuery(hql.toString());
hqlQuery.setFirstResult(fromIndex);
// 一共查询多少条记录
hqlQuery.setMaxResults(pageSize);
// 获取查询的结果
purchaseList = hqlQuery.list();
// 获取总记录数
int totalRecord = this.findCount();
// 获取总页数
int totalPage = totalRecord / pageSize;
if (totalRecord % pageSize != 0) {
totalPage++;
}
// 组装pager对象
Pager<Purchase> result = new Pager<Purchase>(pageSize, pageNum, totalRecord, totalPage, purchaseList);
System.out.println("result:"+result);
return result;
}
}
| [
"974386121@qq.com"
] | 974386121@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.