blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c1b65ab915e1619b10459787535df6791004e872
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/8/8_35e1fa868d39ef640903cb662c429578f538ddf2/MailUtility/8_35e1fa868d39ef640903cb662c429578f538ddf2_MailUtility_s.java
|
91e1bf87d5183103011da992ef0fce7459026b7e
|
[] |
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 | 27,781 |
java
|
/*******************************************************************************
* Copyright (c) 2010 BSI Business Systems Integration AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
******************************************************************************/
package org.eclipse.scout.commons;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.activation.CommandMap;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.activation.MailcapCommandMap;
import javax.activation.MimetypesFileTypeMap;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Part;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimePart;
import javax.mail.util.ByteArrayDataSource;
import org.eclipse.scout.commons.exception.ProcessingException;
import org.eclipse.scout.commons.logger.IScoutLogger;
import org.eclipse.scout.commons.logger.ScoutLogManager;
public final class MailUtility {
public static final IScoutLogger LOG = ScoutLogManager.getLogger(MailUtility.class);
private static final String CONTENT_TYPE_ID = "Content-Type";
public static final String CONTENT_TYPE_TEXT_HTML = "text/html; charset=\"UTF-8\"";
public static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain; charset=\"UTF-8\"";
public static final String CONTENT_TYPE_MESSAGE_RFC822 = "message/rfc822";
public static final String CONTENT_TYPE_MULTIPART = "alternative";
private static MailUtility instance = new MailUtility();
private MailUtility() {
}
public static Part[] getBodyParts(Part message) throws ProcessingException {
return instance.getBodyPartsImpl(message);
}
private Part[] getBodyPartsImpl(Part message) throws ProcessingException {
List<Part> bodyCollector = new ArrayList<Part>();
List<Part> attachementCollector = new ArrayList<Part>();
collectMailPartsReqImpl(message, bodyCollector, attachementCollector);
return bodyCollector.toArray(new Part[bodyCollector.size()]);
}
public static Part[] getAttachmentParts(Part message) throws ProcessingException {
return instance.getAttachmentPartsImpl(message);
}
private Part[] getAttachmentPartsImpl(Part message) throws ProcessingException {
List<Part> bodyCollector = new ArrayList<Part>();
List<Part> attachementCollector = new ArrayList<Part>();
collectMailPartsReqImpl(message, bodyCollector, attachementCollector);
return attachementCollector.toArray(new Part[attachementCollector.size()]);
}
public static void collectMailParts(Part message, List<Part> bodyCollector, List<Part> attachementCollector) throws ProcessingException {
instance.collectMailPartsReqImpl(message, bodyCollector, attachementCollector);
}
private void collectMailPartsReqImpl(Part part, List<Part> bodyCollector, List<Part> attachementCollector) throws ProcessingException {
if (part == null) {
return;
}
try {
String disp = part.getDisposition();
if (disp != null && disp.equalsIgnoreCase(Part.ATTACHMENT)) {
attachementCollector.add(part);
}
else if (part.getContent() instanceof Multipart) {
Multipart multiPart = (Multipart) part.getContent();
for (int i = 0; i < multiPart.getCount(); i++) {
collectMailPartsReqImpl(multiPart.getBodyPart(i), bodyCollector, attachementCollector);
}
}
else {
if (part.isMimeType(CONTENT_TYPE_TEXT_PLAIN)) {
bodyCollector.add(part);
}
else if (part.isMimeType(CONTENT_TYPE_TEXT_HTML)) {
bodyCollector.add(part);
}
else if (part.isMimeType(CONTENT_TYPE_MESSAGE_RFC822) && part.getContent() instanceof MimeMessage) {
// its a MIME message in rfc822 format as attachment therefore we have to set the filename for the attachment correctly.
MimeMessage msg = (MimeMessage) part.getContent();
String filteredSubjectText = StringUtility.filterText(msg.getSubject(), "a-zA-Z0-9_-", "");
String fileName = (StringUtility.hasText(filteredSubjectText) ? filteredSubjectText : "originalMessage") + ".eml";
RFCWrapperPart wrapperPart = new RFCWrapperPart(part, fileName);
attachementCollector.add(wrapperPart);
}
}
}
catch (ProcessingException e) {
throw e;
}
catch (Throwable t) {
throw new ProcessingException("Unexpected: ", t);
}
}
/**
* @param part
* @return the plainText part encoded with the encoding given in the MIME header or UTF-8 encoded or null if the
* plainText Part is not given
* @throws ProcessingException
*/
public static String getPlainText(Part part) throws ProcessingException {
return instance.getPlainTextImpl(part);
}
private String getPlainTextImpl(Part part) throws ProcessingException {
String text = null;
try {
Part[] bodyParts = getBodyPartsImpl(part);
Part plainTextPart = getPlainTextPart(bodyParts);
if (plainTextPart instanceof MimePart) {
MimePart mimePart = (MimePart) plainTextPart;
byte[] content = IOUtility.getContent(mimePart.getInputStream());
if (content != null) {
try {
text = new String(content, getCharacterEncodingOfMimePart(mimePart));
}
catch (UnsupportedEncodingException e) {
text = new String(content);
}
}
}
}
catch (ProcessingException e) {
throw e;
}
catch (Throwable t) {
throw new ProcessingException("Unexpected: ", t);
}
return text;
}
public static Part getHtmlPart(Part[] bodyParts) throws ProcessingException {
for (Part p : bodyParts) {
try {
if (p != null && p.isMimeType(CONTENT_TYPE_TEXT_HTML)) {
return p;
}
}
catch (Throwable t) {
throw new ProcessingException("Unexpected: ", t);
}
}
return null;
}
public static Part getPlainTextPart(Part[] bodyParts) throws ProcessingException {
for (Part p : bodyParts) {
try {
if (p != null && p.isMimeType(CONTENT_TYPE_TEXT_PLAIN)) {
return p;
}
}
catch (Throwable t) {
throw new ProcessingException("Unexpected: ", t);
}
}
return null;
}
public static DataSource createDataSource(File file) throws ProcessingException {
try {
int indexDot = file.getName().lastIndexOf(".");
if (indexDot > 0) {
String fileName = file.getName();
String ext = fileName.substring(indexDot + 1);
return instance.createDataSourceImpl(new FileInputStream(file), fileName, ext);
}
else {
return null;
}
}
catch (Throwable t) {
throw new ProcessingException("Unexpected: ", t);
}
}
public static DataSource createDataSource(InputStream inStream, String fileName, String fileExtension) throws ProcessingException {
return instance.createDataSourceImpl(inStream, fileName, fileExtension);
}
/**
* @param inStream
* @param fileName
* e.g. "file.txt"
* @param fileExtension
* e.g. "txt", "jpg"
* @return
* @throws ProcessingException
*/
private DataSource createDataSourceImpl(InputStream inStream, String fileName, String fileExtension) throws ProcessingException {
try {
ByteArrayDataSource item = new ByteArrayDataSource(inStream, getContentTypeForExtension(fileExtension));
item.setName(fileName);
return item;
}
catch (Throwable t) {
throw new ProcessingException("Unexpected: ", t);
}
}
public static String extractPlainTextFromWordArchive(File archiveFile) {
return instance.extractPlainTextFromWordArchiveInternal(archiveFile);
}
private String extractPlainTextFromWordArchiveInternal(File archiveFile) {
String plainText = null;
try {
File tempDir = IOUtility.createTempDirectory("");
FileUtility.extractArchive(archiveFile, tempDir);
String simpleName = archiveFile.getName();
if (archiveFile.getName().lastIndexOf('.') != -1) {
simpleName = archiveFile.getName().substring(0, archiveFile.getName().lastIndexOf('.'));
}
File plainTextFile = new File(tempDir, simpleName + ".txt");
if (plainTextFile.exists() && plainTextFile.canRead()) {
Reader reader = new FileReader(plainTextFile);
plainText = IOUtility.getContent(reader);
reader.close();
}
}
catch (Exception e) {
LOG.error("Error occured while trying to extract plain text file", e);
}
return plainText;
}
/**
* Create {@link MimeMessage} from plain text fields.
*
* @rn aho, 19.01.2009
*/
public static MimeMessage createMimeMessage(String[] toRecipients, String sender, String subject, String bodyTextPlain, DataSource[] attachements) throws ProcessingException {
return instance.createMimeMessageInternal(toRecipients, null, null, sender, subject, bodyTextPlain, attachements);
}
/**
* Create {@link MimeMessage} from plain text fields.
*
* @rn aho, 19.01.2009
*/
public static MimeMessage createMimeMessage(String[] toRecipients, String[] ccRecipients, String[] bccRecipients, String sender, String subject, String bodyTextPlain, DataSource[] attachements) throws ProcessingException {
return instance.createMimeMessageInternal(toRecipients, ccRecipients, bccRecipients, sender, subject, bodyTextPlain, attachements);
}
private MimeMessage createMimeMessageInternal(String[] toRecipients, String[] ccRecipients, String[] bccRecipients, String sender, String subject, String bodyTextPlain, DataSource[] attachements) throws ProcessingException {
try {
MimeMessage msg = MailUtility.createMimeMessage(bodyTextPlain, null, attachements);
if (sender != null) {
InternetAddress addrSender = new InternetAddress(sender);
msg.setFrom(addrSender);
msg.setSender(addrSender);
}
msg.setSentDate(new java.util.Date());
//
msg.setSubject(subject, "UTF-8");
//
msg.setRecipients(Message.RecipientType.TO, parseAddresses(toRecipients));
msg.setRecipients(Message.RecipientType.CC, parseAddresses(ccRecipients));
msg.setRecipients(Message.RecipientType.BCC, parseAddresses(bccRecipients));
return msg;
}
catch (ProcessingException pe) {
throw pe;
}
catch (Exception e) {
throw new ProcessingException("Failed to create MimeMessage.", e);
}
}
public static MimeMessage createMimeMessage(String messagePlain, String messageHtml, DataSource[] attachements) throws ProcessingException {
return instance.createMimeMessageInternal(messagePlain, messageHtml, attachements);
}
public static MimeMessage createMimeMessageFromWordArchiveDirectory(File archiveDir, String simpleName, File[] attachments, boolean markAsUnsent) throws ProcessingException {
return instance.createMimeMessageFromWordArchiveInternal(archiveDir, simpleName, attachments, markAsUnsent);
}
public static MimeMessage createMimeMessageFromWordArchive(File archiveFile, File[] attachments) throws ProcessingException {
return createMimeMessageFromWordArchive(archiveFile, attachments, false);
}
public static MimeMessage createMimeMessageFromWordArchive(File archiveFile, File[] attachments, boolean markAsUnsent) throws ProcessingException {
try {
File tempDir = IOUtility.createTempDirectory("");
FileUtility.extractArchive(archiveFile, tempDir);
String simpleName = archiveFile.getName();
if (archiveFile.getName().lastIndexOf('.') != -1) {
simpleName = archiveFile.getName().substring(0, archiveFile.getName().lastIndexOf('.'));
}
return instance.createMimeMessageFromWordArchiveInternal(tempDir, simpleName, attachments, markAsUnsent);
}
catch (ProcessingException pe) {
throw pe;
}
catch (IOException e) {
throw new ProcessingException("Error occured while accessing files", e);
}
}
private MimeMessage createMimeMessageFromWordArchiveInternal(File archiveDir, String simpleName, File[] attachments, boolean markAsUnsent) throws ProcessingException {
try {
File plainTextFile = new File(archiveDir, simpleName + ".txt");
String plainTextMessage = null;
boolean hasPlainText = false;
if (plainTextFile.exists()) {
Reader reader = new FileReader(plainTextFile);
plainTextMessage = IOUtility.getContent(reader);
reader.close();
hasPlainText = StringUtility.hasText(plainTextMessage);
}
String folderName = null;
List<DataSource> htmlDataSourceList = new ArrayList<DataSource>();
for (File filesFolder : archiveDir.listFiles()) {
// in this archive file, exactly one directory should exist
// word names this directory differently depending on the language
if (filesFolder.isDirectory() && filesFolder.getName().startsWith(simpleName)) {
// we accept the first directory that meets the constraint above
// add all auxiliary files as attachment
folderName = filesFolder.getName();
for (File file : filesFolder.listFiles()) {
// exclude Microsoft Word specific directory file. This is only used to edit HTML in Word.
String filename = file.getName();
if (!filename.equalsIgnoreCase("filelist.xml") &&
!filename.equalsIgnoreCase("colorschememapping.xml") &&
!filename.equalsIgnoreCase("themedata.thmx") &&
!filename.equalsIgnoreCase("header.html") &&
!filename.equalsIgnoreCase("editdata.mso") &&
!filename.matches("item\\d{4}\\.xml") &&
!filename.matches("props\\d{4}\\.xml")) {
FileDataSource fds = new FileDataSource(file);
htmlDataSourceList.add(fds);
}
}
break;
}
}
File htmlFile = new File(archiveDir, simpleName + ".html");
String htmlMessage = null;
boolean hasHtml = false;
if (htmlFile.exists()) {
Reader reader = new FileReader(htmlFile);
htmlMessage = IOUtility.getContent(reader);
reader.close();
// replace directory entry
// replace all paths to the 'files directory' with the root directory
htmlMessage = htmlMessage.replaceAll("\"" + folderName + "/", "\"cid:");
// remove special/unused files
htmlMessage = htmlMessage.replaceAll("<link rel=File-List href=\"cid:filelist.xml\">", "");
htmlMessage = htmlMessage.replaceAll("<link rel=colorSchemeMapping href=\"cid:colorschememapping.xml\">", "");
htmlMessage = htmlMessage.replaceAll("<link rel=themeData href=\"cid:themedata.thmx\">", "");
htmlMessage = htmlMessage.replaceAll("<link rel=Edit-Time-Data href=\"cid:editdata.mso\">", "");
// remove Microsoft Word tags
htmlMessage = htmlMessage.replaceAll("<!--\\[if gte mso(.*\\r?\\n)*?.*?endif\\]-->", "");
// remove any VML elements
htmlMessage = htmlMessage.replaceAll("<!--\\[if gte vml 1(.*\\r?\\n)*?.*?endif\\]-->", "");
// remove any VML elements part2
htmlMessage = Pattern.compile("<!\\[if !vml\\]>(.*?)<!\\[endif\\]>", Pattern.DOTALL).matcher(htmlMessage).replaceAll("$1");
// remove not referenced attachments
for (DataSource ds : htmlDataSourceList) {
if (!htmlMessage.contains("cid:" + ds.getName())) {
htmlDataSourceList.remove(ds);
}
}
hasHtml = StringUtility.hasText(htmlMessage);
}
if (!hasPlainText && !hasHtml) {
throw new ProcessingException("message has no body");
}
MimeMessage mimeMessage = new CharsetSafeMimeMessage();
MimePart bodyPart = null;
if (attachments != null && attachments.length > 0) {
MimeMultipart multiPart = new MimeMultipart(); //mixed
mimeMessage.setContent(multiPart);
//add a holder for the body text
MimeBodyPart multiPartBody = new MimeBodyPart();
multiPart.addBodyPart(multiPartBody);
bodyPart = multiPartBody;
//add the attachments
for (File attachment : attachments) {
MimeBodyPart part = new MimeBodyPart();
FileDataSource fds = new FileDataSource(attachment);
DataHandler handler = new DataHandler(fds);
part.setDataHandler(handler);
part.setFileName(attachment.getName());
multiPart.addBodyPart(part);
}
}
else {
//no attachments -> no need for multipart/mixed element
bodyPart = mimeMessage;
}
if (hasPlainText && hasHtml) {
MimeMultipart alternativePart = new MimeMultipart("alternative");
bodyPart.setContent(alternativePart);
MimeBodyPart plainBodyPart = new MimeBodyPart();
alternativePart.addBodyPart(plainBodyPart);
writePlainBody(plainBodyPart, plainTextMessage);
MimeBodyPart htmlBodyPart = new MimeBodyPart();
alternativePart.addBodyPart(htmlBodyPart);
writeHtmlBody(htmlBodyPart, htmlMessage, htmlDataSourceList);
}
else if (hasPlainText) { //plain text only
writePlainBody(bodyPart, plainTextMessage);
}
else { //html only
writeHtmlBody(bodyPart, htmlMessage, htmlDataSourceList);
}
if (markAsUnsent) {
mimeMessage.setHeader("X-Unsent", "1"); // only supported in Outlook 2010
}
return mimeMessage;
}
catch (IOException e) {
throw new ProcessingException("Error occured while accessing files", e);
}
catch (MessagingException e) {
throw new ProcessingException("Error occured while creating MIME-message", e);
}
}
private static void writeHtmlBody(MimePart htmlBodyPart, String htmlMessage, List<DataSource> htmlDataSourceList) throws MessagingException {
Multipart multiPartHtml = new MimeMultipart("related");
htmlBodyPart.setContent(multiPartHtml);
MimeBodyPart part = new MimeBodyPart();
part.setContent(htmlMessage, CONTENT_TYPE_TEXT_HTML);
part.setHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_HTML);
part.setHeader("Content-Transfer-Encoding", "quoted-printable");
multiPartHtml.addBodyPart(part);
for (DataSource source : htmlDataSourceList) {
part = new MimeBodyPart();
DataHandler handler = new DataHandler(source);
part.setDataHandler(handler);
part.setFileName(source.getName());
part.addHeader("Content-ID", "<" + source.getName() + ">");
multiPartHtml.addBodyPart(part);
}
}
private static void writePlainBody(MimePart plainBodyPart, String plainTextMessage) throws MessagingException {
plainBodyPart.setText(plainTextMessage, "UTF-8");
plainBodyPart.setHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_PLAIN);
plainBodyPart.setHeader("Content-Transfer-Encoding", "quoted-printable");
}
private MimeMessage createMimeMessageInternal(String bodyTextPlain, String bodyTextHtml, DataSource[] attachements) throws ProcessingException {
try {
CharsetSafeMimeMessage m = new CharsetSafeMimeMessage();
MimeMultipart multiPart = new MimeMultipart();
BodyPart bodyPart = createBodyPart(bodyTextPlain, bodyTextHtml);
if (bodyPart == null) {
return null;
}
multiPart.addBodyPart(bodyPart);
// attachements
if (attachements != null) {
for (DataSource source : attachements) {
MimeBodyPart part = new MimeBodyPart();
DataHandler handler = new DataHandler(source);
part.setDataHandler(handler);
part.setFileName(source.getName());
multiPart.addBodyPart(part);
}
}
m.setContent(multiPart);
return m;
}
catch (Throwable t) {
throw new ProcessingException("Failed to create MimeMessage.", t);
}
}
private BodyPart createBodyPart(String bodyTextPlain, String bodyTextHtml) throws MessagingException {
if (!StringUtility.isNullOrEmpty(bodyTextPlain) && !StringUtility.isNullOrEmpty(bodyTextHtml)) {
// multipart
MimeBodyPart plainPart = new MimeBodyPart();
plainPart.setText(bodyTextPlain, "UTF-8");
plainPart.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_PLAIN);
MimeBodyPart htmlPart = new MimeBodyPart();
htmlPart.setText(bodyTextHtml, "UTF-8");
htmlPart.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_HTML);
Multipart multiPart = new MimeMultipart("alternative");
multiPart.addBodyPart(plainPart);
multiPart.addBodyPart(htmlPart);
MimeBodyPart multiBodyPart = new MimeBodyPart();
multiBodyPart.setContent(multiPart);
return multiBodyPart;
}
else if (!StringUtility.isNullOrEmpty(bodyTextPlain)) {
MimeBodyPart part = new MimeBodyPart();
part.setText(bodyTextPlain, "UTF-8");
part.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_PLAIN);
return part;
}
else if (!StringUtility.isNullOrEmpty(bodyTextHtml)) {
MimeBodyPart part = new MimeBodyPart();
part.setText(bodyTextHtml, "UTF-8");
part.addHeader(CONTENT_TYPE_ID, CONTENT_TYPE_TEXT_HTML);
return part;
}
return null;
}
public static MimeMessage createMessageFromBytes(byte[] bytes) throws ProcessingException {
return instance.createMessageFromBytesImpl(bytes);
}
private MimeMessage createMessageFromBytesImpl(byte[] bytes) throws ProcessingException {
try {
ByteArrayInputStream st = new ByteArrayInputStream(bytes);
return new MimeMessage(null, st);
}
catch (Throwable t) {
throw new ProcessingException("Unexpected: ", t);
}
}
/**
* @since 2.7
*/
public static String getContentTypeForExtension(String ext) {
if (ext == null) {
return null;
}
if (ext.startsWith(".")) {
ext = ext.substring(1);
}
ext = ext.toLowerCase();
String type = FileUtility.getContentTypeForExtension(ext);
if (type == null) {
type = MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType("tmp." + ext);
}
return type;
}
/**
* Careful: this method returns null when the list of addresses is empty! This is a (stupid) default by
* javax.mime.Message
*/
private InternetAddress[] parseAddresses(String[] addresses) throws AddressException {
if (addresses == null) {
return null;
}
ArrayList<InternetAddress> addrList = new ArrayList<InternetAddress>();
for (int i = 0; i < Array.getLength(addresses); i++) {
addrList.add(new InternetAddress(addresses[i]));
}
if (addrList.size() == 0) {
return null;
}
else {
return addrList.toArray(new InternetAddress[addrList.size()]);
}
}
private String getCharacterEncodingOfMimePart(MimePart part) throws MessagingException {
Pattern pattern = Pattern.compile("charset=\".*\"", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
Matcher matcher = pattern.matcher(part.getContentType());
String characterEncoding = "UTF-8"; // default, a good guess in Europe
if (matcher.find()) {
if (matcher.group(0).split("\"").length >= 2) {
characterEncoding = matcher.group(0).split("\"")[1];
}
}
else {
if (part.getContentType().contains("charset=")) {
if (part.getContentType().split("charset=").length == 2) {
characterEncoding = part.getContentType().split("charset=")[1];
}
}
}
return characterEncoding;
}
static {
fixMailcapCommandMap();
}
/**
* jax-ws in jre 1.6.0 and priopr to 1.2.7 breaks support for "Umlaute" , , due to a bug in
* StringDataContentHandler.writeTo
* <p>
* This patch uses reflection to eliminate this buggy mapping from the command map and adds the default text_plain
* mapping (if available, e.g. sun jre)
*/
@SuppressWarnings("unchecked")
private static void fixMailcapCommandMap() {
try {
//set the com.sun.mail.handlers.text_plain to level 0 (programmatic) to prevent others from overriding in level 0
Class textPlainClass;
try {
textPlainClass = Class.forName("com.sun.mail.handlers.text_plain");
}
catch (Throwable t) {
//class not found, cancel
return;
}
CommandMap cmap = MailcapCommandMap.getDefaultCommandMap();
if (!(cmap instanceof MailcapCommandMap)) {
return;
}
((MailcapCommandMap) cmap).addMailcap("text/plain;;x-java-content-handler=" + textPlainClass.getName());
//use reflection to clear out all other mappings of text/plain in level 0
Field f = MailcapCommandMap.class.getDeclaredField("DB");
f.setAccessible(true);
Object[] dbArray = (Object[]) f.get(cmap);
f = Class.forName("com.sun.activation.registries.MailcapFile").getDeclaredField("type_hash");
f.setAccessible(true);
Map<Object, Object> db0 = (Map<Object, Object>) f.get(dbArray[0]);
Map<Object, Object> typeMap = (Map<Object, Object>) db0.get("text/plain");
List<String> handlerList = (List<String>) typeMap.get("content-handler");
//put text_plain in front
handlerList.remove("com.sun.mail.handlers.text_plain");
handlerList.add(0, "com.sun.mail.handlers.text_plain");
}
catch (Throwable t) {
ScoutLogManager.getLogger(MailUtility.class).warn("Failed fixing MailcapComandMap string handling: " + t);
}
}
}
|
[
"[email protected]"
] | |
d7bf8e3f7e767d19a2a1bffe5b3ba939689401d7
|
981f7ae13c9ffbc79f240a926e745f9f47a671b7
|
/src/main/java/me/study/jpa/chap03/RoleType.java
|
8eb836a105388486e5293329cfa32b9a539f1243
|
[] |
no_license
|
jsyang-dev/study-jpa
|
367229fbdabd2dff513b8670fad831bdab9954ab
|
9cc82573044484585336a3c0e4ffcd61af744a1c
|
refs/heads/master
| 2023-07-27T04:16:08.761169 | 2022-01-22T08:25:13 | 2022-01-22T08:25:13 | 248,248,065 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 71 |
java
|
package me.study.jpa.chap03;
public enum RoleType {
USER, ADMIN
}
|
[
"[email protected]"
] | |
f3b3a1ea60a03df22f24d91c0b76362d06880f64
|
c6c412b1b5260a9e049b9c5564cb6dd186df851c
|
/src/main/java/br/com/jsfweb/tx/GerenciadorDeTransacao.java
|
0644359089c4894513be76b0b8ca8fe7ce383f17
|
[] |
no_license
|
hugoan/jsfweb
|
b00202861b02226006a58692432dd5e054e4a063
|
044c967cdd72a7b4a2c2a1b3cee44710c68be03f
|
refs/heads/master
| 2021-01-20T05:37:37.086052 | 2017-04-13T02:27:54 | 2017-04-13T02:27:54 | 83,860,741 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 778 |
java
|
package br.com.jsfweb.tx;
import java.io.Serializable;
import javax.inject.Inject;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
import javax.persistence.EntityManager;
@Transacional
@Interceptor
public class GerenciadorDeTransacao implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
EntityManager manager;
@AroundInvoke
public Object executaTX(InvocationContext contexto) throws Exception {
// abre transacao
manager.getTransaction().begin();
//chama os DAOs que precisam de TX
Object resultado = contexto.proceed();
// commita a transacao
manager.getTransaction().commit();
return resultado;
}
}
|
[
"[email protected]"
] | |
cc7ff6ae49db8476ab43cf978cb43b74da842810
|
3588b0b904934b7fca493953da90120276d5c1e5
|
/src/medium/Exist79.java
|
dc0e82e112172d739d66d89dc05d2e11bd2b31fc
|
[] |
no_license
|
WXRain/Algorithms
|
223f50d3b9f5ff247194bebeaee5792acdcecbf7
|
a965bdfd3d2de02bc6ec70e7b162f9587e5d9b3f
|
refs/heads/master
| 2023-08-05T11:23:48.197865 | 2021-09-01T02:30:44 | 2021-09-01T02:30:44 | 99,637,642 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,818 |
java
|
package medium;
/**
* 给定一个二维网格和一个单词,找出该单词是否存在于网格中。
*
* 单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中“相邻”单元格是那些水平相邻或垂直相邻的单元格。同一个单元格内的字母不允许被重复使用。
*
*
*
* 示例:
*
* board =
* [
* ['A','B','C','E'],
* ['S','F','C','S'],
* ['A','D','E','E']
* ]
*
* 给定 word = "ABCCED", 返回 true
* 给定 word = "SEE", 返回 true
* 给定 word = "ABCB", 返回 false
*
*
* 提示:
*
* board 和 word 中只包含大写和小写英文字母。
* 1 <= board.length <= 200
* 1 <= board[i].length <= 200
* 1 <= word.length <= 10^3
*
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/word-search
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
public class Exist79 {
public boolean exist(char[][] board, String word) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (search(board, word, i, j, 0)) return true;
}
}
return false;
}
private boolean search(char[][] board, String word, int i, int j, int k) {
if (k >= word.length()) return true;
if (i < 0 || i >= board.length || j < 0 || j >= board[0].length ||
board[i][j] != word.charAt(k)) return false;
board[i][j] += 256;
boolean result = search(board, word, i + 1, j, k + 1) ||
search(board, word, i - 1, j, k + 1) ||
search(board, word, i, j + 1, k + 1) ||
search(board, word, i, j - 1, k + 1);
board[i][j] -= 256;
return result;
}
}
|
[
"[email protected]"
] | |
d33d62692cd3570944298ace424f43a98e5931b6
|
8e4ae58b2b45e2368a31761388acafd5992e423d
|
/src/main/java/de/draco/cbm/tool/crtcreator/EFSDirChip.java
|
d9077210068e440e6e0a7c0750f8cbb727b23f66
|
[] |
no_license
|
pmuconn/dcm
|
975e54786256d8a1cbe62eb68036585f03bd8a2d
|
2edc09fd49c7ad341f9c4dab384ce7b64a4da122
|
refs/heads/master
| 2021-02-13T06:53:27.898056 | 2020-03-03T15:58:34 | 2020-03-03T15:58:34 | 244,672,067 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,124 |
java
|
/*
* Decompiled with CFR 0.137.
*/
package de.draco.cbm.tool.crtcreator;
import java.io.IOException;
import java.io.InputStream;
import java.util.Vector;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class EFSDirChip
extends Chip
implements Constants {
public static int MAX_ITEMS = 254;
boolean m_oceanMode = false;
public EFSDirChip(int index, boolean oceanMode) {
super(index);
this.m_oceanMode = oceanMode;
this.setPos(8192);
}
public EFSDirChip(Vector<Chip> chips) {
super(1);
this.reconstructItems(chips);
}
@Override
public boolean readChip(InputStream is) {
boolean ret = super.readChip(is);
int offset = 0;
while (offset + EFItem.DIRENTRYSIZE <= 8192) {
EFItem item = EFItem.fromBytes(this.getBytes(), offset);
if (item.isEndMark()) break;
this.m_items.add(item);
offset += EFItem.DIRENTRYSIZE;
}
return ret;
}
private boolean reconstructItems(Vector<Chip> chips) {
boolean ret = true;
Chip p = chips.get(1);
this.m_bytes = p.getBytes();
int offset = 0;
while (offset + EFItem.DIRENTRYSIZE <= 8192) {
EFItem item = EFItem.fromBytes(this.m_bytes, offset);
if (item.isEndMark()) break;
item.updateDataFromChips(chips);
this.m_items.add(item);
offset += EFItem.DIRENTRYSIZE;
}
this.m_items = (Vector)this.getItems().clone();
for (EFItem item : this.m_items) {
int offsetInPage = item.getOffset() % 8192;
int nPages = (int)Math.ceil((double)(item.getSizeData() + offsetInPage) / 8192.0);
if (nPages < chips.size()) continue;
Logger.error(this.getClass(), "Error in directory structure. Number of Pages not supported. Item " + item);
System.exit(-1);
}
return ret;
}
public boolean addEntry(EFItem entry) {
boolean ret = false;
if (!this.m_items.contains(entry) && this.m_items.size() <= MAX_ITEMS) {
ret = true;
this.m_items.add(entry);
}
return ret;
}
public void removeEntry(EFItem entry) {
this.m_items.remove(entry);
}
@Override
public byte[] getBytes() {
try {
int destPos = 0;
for (EFItem entry : this.m_items) {
byte[] entryBytes = entry.getDirEntryBytes();
System.arraycopy(entryBytes, 0, this.m_bytes, destPos, entryBytes.length);
destPos += entryBytes.length;
}
String startupCodeFileName = this.m_oceanMode ? "easyloader_launcher_ocm.bin" : "easyloader_launcher_nrm.bin";
Logger.info(this.getClass(), "Using " + startupCodeFileName + " launchcode.");
InputStream is = this.getClass().getClassLoader().getResourceAsStream(startupCodeFileName);
int launcherLen = is.available();
is.read(this.m_bytes, 8192 - launcherLen, launcherLen);
}
catch (IOException e) {
Logger.error(this.getClass(), "Can't read easyloader_launcher_nrm.bin");
Logger.logStackTrace(e);
}
try {
Logger.info(this.getClass(), "Using eapi-am29f040-03 api.");
InputStream is = this.getClass().getClassLoader().getResourceAsStream("eapi-am29f040-03");
is.read();
is.read();
is.read(this.m_bytes, 6144, is.available());
}
catch (IOException e) {
Logger.error(this.getClass(), "Can't read easyloader_launcher_nrm.bin");
Logger.logStackTrace(e);
}
return this.m_bytes;
}
@Override
public String getDescription() {
return "Easyflash Directory";
}
@Override
public String toString() {
String ret = "";
for (EFItem entry : this.m_items) {
ret = String.valueOf(ret) + entry.toString() + "\n";
}
return ret;
}
}
|
[
"[email protected]"
] | |
d8ffa908f17f1ca40a635c9d90034ea1c7ff2223
|
32c86fd021f220be263d8f0a0ac1fdb9c22bf3e5
|
/voipms-sms/src/main/java/net/kourlas/voipms_sms/model/Message.java
|
a9ab12c4f7def6f9550ca29bfdf83e4dc9726780
|
[
"Apache-2.0",
"CC-BY-4.0"
] |
permissive
|
johnchia/voipms-sms-client
|
a1276beb3799eb60d0a1aab478b4c1cd1d43d5f9
|
8365e57bef30b2af97cd02421d6f08f1adb406e3
|
refs/heads/master
| 2021-01-18T19:42:10.122741 | 2016-09-10T21:03:35 | 2016-09-10T21:03:35 | 67,893,234 | 0 | 0 | null | 2016-09-10T20:36:47 | 2016-09-10T20:36:46 | null |
UTF-8
|
Java
| false | false | 16,348 |
java
|
/*
* VoIP.ms SMS
* Copyright (C) 2015 Michael Kourlas and other contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.kourlas.voipms_sms.model;
import android.support.annotation.NonNull;
import net.kourlas.voipms_sms.Database;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/**
* Represents a single SMS message.
*/
public class Message implements Comparable<Message> {
private static long uniqueObjectIdentifierCount = 0;
/**
* The database ID of the message.
*/
private final Long databaseId;
/**
* The ID assigned to the message by VoIP.ms.
*/
private final Long voipId;
/**
* The date of the message.
*/
private Date date;
/**
* The type of the message (incoming or outgoing).
*/
private final Type type;
/**
* The DID associated with the message.
*/
private final String did;
/**
* The contact associated with the message.
*/
private final String contact;
/**
* The text of the message.
*/
private final String text;
private final long uniqueObjectIdentifier;
/**
* Whether or not the message is unread.
*/
private boolean isUnread;
/**
* Whether or not the message is deleted.
*/
private boolean isDeleted;
/**
* Whether or not the message has been delivered.
*/
private boolean isDelivered;
/**
* Whether or not the message is currently in the process of being delivered.
*/
private boolean isDeliveryInProgress;
/**
* Initializes a new instance of the Message class. This constructor is intended for use when creating a Message
* object using information from the application database.
*
* @param databaseId The database ID of the message.
* @param voipId The ID assigned to the message by VoIP.ms.
* @param date The UNIX timestamp of the message.
* @param type The type of the message (1 for incoming, 0 for outgoing).
* @param did The DID associated with the message.
* @param contact The contact associated with the message.
* @param text The text of the message.
* @param isUnread Whether or not the message is unread (1 for true, 0 for false).
* @param isDeleted Whether or not the message has been deleted locally (1 for true, 0 for false).
* @param isDelivered Whether or not the message has been delivered (1 for true, 0 for false).
* @param isDeliveryInProgress Whether or not the message is currently in the process of being delivered (1 for
* true, 0 for false).
*/
public Message(long databaseId, Long voipId, long date, long type, String did, String contact, String text,
long isUnread, long isDeleted, long isDelivered, long isDeliveryInProgress) {
this.databaseId = databaseId;
this.voipId = voipId;
this.date = new Date(date * 1000);
if (type != 0 && type != 1) {
throw new IllegalArgumentException("type must be 0 or 1.");
}
this.type = type == 1 ? Type.INCOMING : Type.OUTGOING;
if (!did.replaceAll("[^0-9]", "").equals(did)) {
throw new IllegalArgumentException("did must consist only of numbers.");
}
this.did = did;
if (!contact.replaceAll("[^0-9]", "").equals(contact)) {
throw new IllegalArgumentException("contact must consist only of numbers.");
}
this.contact = contact;
this.text = text;
if (isUnread != 0 && isUnread != 1) {
throw new IllegalArgumentException("isUnread must be 0 or 1.");
}
this.isUnread = isUnread == 1;
if (isDeleted != 0 && isDeleted != 1) {
throw new IllegalArgumentException("isDeleted must be 0 or 1.");
}
this.isDeleted = isDeleted == 1;
if (isDelivered != 0 && isDelivered != 1) {
throw new IllegalArgumentException("isDelivered must be 0 or 1.");
}
this.isDelivered = isDelivered == 1;
if (isDeliveryInProgress != 0 && isDeliveryInProgress != 1) {
throw new IllegalArgumentException("isDeliveryInProgress must be 0 or 1.");
}
this.isDeliveryInProgress = isDeliveryInProgress == 1;
this.uniqueObjectIdentifier = uniqueObjectIdentifierCount++;
}
/**
* Initializes a new instance of the Message class. This constructor is intended for use when creating a Message
* object using information from the VoIP.ms API.
*
* @param voipId The ID assigned to the message by VoIP.ms.
* @param date The UNIX timestamp of the message.
* @param type The type of the message (1 for incoming, 0 for outgoing).
* @param did The DID associated with the message.
* @param contact The contact associated with the message.
* @param text The text of the message.
*/
public Message(String voipId, String date, String type, String did, String contact, String text)
throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("America/New_York"));
this.databaseId = null;
this.voipId = Long.parseLong(voipId);
this.date = sdf.parse(date);
if (!type.equals("0") && !type.equals("1")) {
throw new IllegalArgumentException("type must be 0 or 1.");
}
this.type = type.equals("1") ? Type.INCOMING : Type.OUTGOING;
if (!did.replaceAll("[^0-9]", "").equals(did)) {
throw new IllegalArgumentException("did must consist only of numbers.");
}
this.did = did;
if (!contact.replaceAll("[^0-9]", "").equals(contact)) {
throw new IllegalArgumentException("contact must consist only of numbers.");
}
this.contact = contact;
this.text = text;
this.isUnread = type.equals("1");
this.isDeleted = false;
this.isDelivered = true;
this.isDeliveryInProgress = false;
this.uniqueObjectIdentifier = uniqueObjectIdentifierCount++;
}
/**
* Initializes a new instance of the Message class. This constructor is intended for use when creating a new Message
* object that will be sent to another contact using the VoIP.ms API.
*
* @param did The DID associated with the message.
* @param contact The contact associated with the message.
* @param text The text of the message.
*/
public Message(String did, String contact, String text) {
this.databaseId = null;
this.voipId = null;
this.date = new Date();
this.type = Type.OUTGOING;
if (!did.replaceAll("[^0-9]", "").equals(did)) {
throw new IllegalArgumentException("did must consist only of numbers.");
}
this.did = did;
if (!contact.replaceAll("[^0-9]", "").equals(contact)) {
throw new IllegalArgumentException("contact must consist only of numbers.");
}
this.contact = contact;
this.text = text;
this.isUnread = false;
this.isDeleted = false;
this.isDelivered = true;
this.isDeliveryInProgress = true;
this.uniqueObjectIdentifier = uniqueObjectIdentifierCount++;
}
/**
* Gets the database ID of the message. This value may be null if no ID has been yet been assigned to the message
* (i.e. if the message has not yet been inserted into the database).
*
* @return The database ID of the message.
*/
public Long getDatabaseId() {
return databaseId;
}
/**
* Gets the ID assigned to the message by VoIP.ms. This value may be null if no ID has yet been assigned to the
* message (i.e. if the message has not yet been sent).
*
* @return The ID assigned to the message by VoIP.ms.
*/
public Long getVoipId() {
return voipId;
}
/**
* Gets the date of the message.
*
* @return The date of the message.
*/
public Date getDate() {
return date;
}
/**
* Sets the date of the message.
*
* @param date The date of the message.
*/
public void setDate(Date date) {
this.date = date;
}
/**
* Gets the date of the message in database format.
*
* @return The date of the message in database format.
*/
public long getDateInDatabaseFormat() {
return date.getTime() / 1000;
}
/**
* Gets the type of the message (incoming or outgoing).
*
* @return The type of the message (incoming or outgoing).
*/
public Type getType() {
return type;
}
/**
* Gets the type of the message in database format.
*
* @return The type of the message in database format.
*/
public long getTypeInDatabaseFormat() {
return type == Type.INCOMING ? 1 : 0;
}
/**
* Gets the DID associated with the message.
*
* @return The DID associated with the message.
*/
public String getDid() {
return did;
}
/**
* Gets the contact associated with the message.
*
* @return The contact associated with the message.
*/
public String getContact() {
return contact;
}
/**
* Gets the text of the message.
*
* @return The text of the message.
*/
public String getText() {
return text;
}
/**
* Gets whether or not the message is unread.
*
* @return Whether or not the message is unread.
*/
public boolean isUnread() {
return isUnread;
}
/**
* Sets whether or not the message is unread.
*
* @param unread Whether or not the message is unread.
*/
public void setUnread(boolean unread) {
isUnread = unread;
}
/**
* Gets whether or not the message is unread in database format.
*
* @return Whether or not the message is unread in database format.
*/
public int isUnreadInDatabaseFormat() {
return isUnread ? 1 : 0;
}
public boolean isDeleted() {
return isDeleted;
}
public void setDeleted(boolean isDeleted) {
this.isDeleted = isDeleted;
}
public int isDeletedInDatabaseFormat() {
return isDeleted ? 1 : 0;
}
public boolean isDelivered() {
return isDelivered;
}
public void setDelivered(boolean isDelivered) {
this.isDelivered = isDelivered;
}
public int isDeliveredInDatabaseFormat() {
return isDelivered ? 1 : 0;
}
public boolean isDeliveryInProgress() {
return isDeliveryInProgress;
}
public void setDeliveryInProgress(boolean isDeliveryInProgress) {
this.isDeliveryInProgress = isDeliveryInProgress;
}
public int isDeliveryInProgressInDatabaseFormat() {
return isDeliveryInProgress ? 1 : 0;
}
/**
* Returns whether or not the message is identical to another object.
*
* @param o The other object.
* @return Whether or not the message is identical to another object.
*/
@Override
public boolean equals(Object o) {
if (o instanceof Message) {
if (this == o) {
return true;
}
Message other = (Message) o;
boolean databaseIdEquals = (databaseId == null && other.databaseId == null) ||
(databaseId != null && other.databaseId != null && databaseId.equals(other.databaseId));
boolean voipIdEquals = (voipId == null && other.voipId == null) ||
(voipId != null && other.voipId != null && voipId.equals(other.voipId));
return databaseIdEquals && voipIdEquals && date.equals(other.date) && type == other.type &&
did.equals(other.did) && contact.equals(other.contact) && text.equals(other.text) &&
isUnread == other.isUnread && isDeleted == other.isDeleted && isDelivered == other.isDelivered &&
isDeliveryInProgress == other.isDeliveryInProgress;
}
else {
return super.equals(o);
}
}
/**
* Compares this message to another message.
*
* @param another The other message.
* @return 1 will be returned if this message's date is before the other message's date, and -1 will be returned if
* this message's date is after the other message's date.
* <p/>
* If the dates of the messages are identical, 1 will be returned if this message's text is alphabetically after
* the other message's date, and -1 will be returned if this message's text is alphabetically before the other
* message's date.
* <p/>
* If the texts of the messages are identical, 1 or -1 will be returned depending on the values of the objects'
* unique internal identifiers. These identifiers are generated at runtime and are constant for the duration of the
* application's execution, though they will not necessarily be constant between executions. They ensure that for
* the duration of the application's execution, messages will always have a deterministic sorting order.
*/
@Override
public int compareTo(@NonNull Message another) {
if (this.date.before(another.date)) {
return 1;
}
else if (this.date.after(another.date)) {
return -1;
}
int textCompare = this.text.compareTo(another.text);
if (textCompare == 1 || textCompare == -1) {
return textCompare;
}
if (this.uniqueObjectIdentifier > another.uniqueObjectIdentifier) {
return 1;
}
else {
return -1;
}
}
/**
* Returns a JSON version of this message.
*
* @return A JSON version of this message.
*/
public JSONObject toJSON() {
try {
JSONObject jsonObject = new JSONObject();
if (databaseId != null) {
jsonObject.put(Database.COLUMN_DATABASE_ID, getDatabaseId());
}
if (voipId != null) {
jsonObject.put(Database.COLUMN_VOIP_ID, getVoipId());
}
jsonObject.put(Database.COLUMN_DATE, getDateInDatabaseFormat());
jsonObject.put(Database.COLUMN_TYPE, getTypeInDatabaseFormat());
jsonObject.put(Database.COLUMN_DID, getDid());
jsonObject.put(Database.COLUMN_CONTACT, getContact());
jsonObject.put(Database.COLUMN_MESSAGE, getText());
jsonObject.put(Database.COLUMN_UNREAD, isUnreadInDatabaseFormat());
jsonObject.put(Database.COLUMN_DELETED, isDeletedInDatabaseFormat());
jsonObject.put(Database.COLUMN_DELIVERED, isDeliveredInDatabaseFormat());
jsonObject.put(Database.COLUMN_DELIVERY_IN_PROGRESS, isDeliveryInProgressInDatabaseFormat());
return jsonObject;
} catch (JSONException ex) {
// This should never happen
throw new Error();
}
}
/**
* Represents the type of the message.
*/
public enum Type {
/**
* Represents an incoming message (a message addressed to the DID).
*/
INCOMING,
/**
* Represents an outgoing message (a message coming from the DID).
*/
OUTGOING
}
}
|
[
"[email protected]"
] | |
bddf63ef525c533d1c8da5b09aed7a928ad308e4
|
3331db1f6cb5feb2dbea2f3af788d1977fce5eb6
|
/demo/src/main/java/com/trial/repository/StudentRepository.java
|
b6a6917b9f98d5ba88c6cbdd8270eb2c1e0c49d0
|
[] |
no_license
|
payaljoshid/LogRepository
|
9715c3ad32f796363d20605e94e7778c29095f83
|
0b6a5288bb30e6aa5bfb848bd1ce440be4e91e7c
|
refs/heads/master
| 2021-01-23T01:50:57.366284 | 2017-03-23T13:16:52 | 2017-03-23T13:16:52 | 85,937,703 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 499 |
java
|
package com.trial.repository;
import com.trial.model.Student;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by chaithra on 2/3/17.
*/
@Repository
public interface StudentRepository extends MongoRepository<Student,Integer>
{
public Student findById(String id);
//public List<Student> updateByID(Query query,String id);
}
|
[
"[email protected]"
] | |
09cedd15973fde7791532e69cd00ad82f28fc5f6
|
af7368fc3b8a98e0429ca2224a9a35944ae01c22
|
/projects/JavaLoad/src/com/etc/maths/MathD.java
|
cdf3bff5c2c09718fd43f4c9bfd618ef1916dc50
|
[] |
no_license
|
lxk1080/java-review
|
ebbe43844a4b31d31a056badded2b53171d04346
|
df9cb6d1773911aa7bcb26e2eb4cb7812950278b
|
refs/heads/master
| 2023-07-09T17:47:10.100997 | 2021-08-25T13:08:21 | 2021-08-25T13:08:21 | 188,590,532 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,604 |
java
|
package com.etc.maths;
/*
* Math:用于数学运算的类。
* 成员变量:
* public static final double PI
* public static final double E
* 成员方法:
* public static int abs(int a):绝对值
* public static double ceil(double a):向上取整
* public static double floor(double a):向下取整
* public static int max(int a,int b):最大值 (min自学)
* public static double pow(double a,double b):a的b次幂
* public static double random():随机数 [0.0,1.0)
* public static int round(float a) 四舍五入(参数为double的自学)
* public static double sqrt(double a):正平方根
*/
public class MathD {
public static void main(String[] args) {
// public static final double PI
System.out.println("PI:" + Math.PI);
// public static final double E
System.out.println("E:" + Math.E);
System.out.println("--------------");
// public static int abs(int a):绝对值
System.out.println("abs:" + Math.abs(10));
System.out.println("abs:" + Math.abs(-10));
System.out.println("--------------");
// public static double ceil(double a):向上取整
System.out.println("ceil:" + Math.ceil(12.34));
System.out.println("ceil:" + Math.ceil(12.56));
System.out.println("--------------");
// public static double floor(double a):向下取整
System.out.println("floor:" + Math.floor(12.34));
System.out.println("floor:" + Math.floor(12.56));
System.out.println("--------------");
// public static int max(int a,int b):最大值
System.out.println("max:" + Math.max(12, 23));
// 需求:我要获取三个数据中的最大值
// 方法的嵌套调用
System.out.println("max:" + Math.max(Math.max(12, 23), 18));
// 需求:我要获取四个数据中的最大值
System.out.println("max:"
+ Math.max(Math.max(12, 78), Math.max(34, 56)));
System.out.println("--------------");
// public static double pow(double a,double b):a的b次幂
System.out.println("pow:" + Math.pow(2, 3));
System.out.println("--------------");
// public static double random():随机数 [0.0,1.0)
System.out.println("random:" + Math.random());
// 获取一个1-100之间的随机数
System.out.println("random:" + ((int) (Math.random() * 100) + 1));
System.out.println("--------------");
// public static int round(float a) 四舍五入(参数为double的自学)
System.out.println("round:" + Math.round(12.34f));
System.out.println("round:" + Math.round(12.56f));
System.out.println("--------------");
//public static double sqrt(double a):正平方根
System.out.println("sqrt:"+Math.sqrt(4));
}
}
|
[
"[email protected]"
] | |
37b4778bcd274dd570b8072b16e2a1470a5d5b1e
|
ce8edec585e098144673dea60a1e79d14c3846c6
|
/src/com/sufurujhin/rpgdungeon/mobs/ZombieDrowned.java
|
5518d557f0e04e5db28b158de8b118f4de82c16e
|
[] |
no_license
|
sufurujhin/RPGDungeon
|
eeb1c818872fdae865ce5a78e14d95c72dfadb6a
|
0b7120f44a470e1b4595c09745687800be03b31d
|
refs/heads/main
| 2023-03-15T06:27:37.504204 | 2021-03-09T09:30:07 | 2021-03-09T09:30:07 | 345,953,527 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,659 |
java
|
package com.sufurujhin.rpgdungeon.mobs;
import org.bukkit.Location;
import org.bukkit.entity.Drowned;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import com.sufurujhin.rpgdungeon.RPGDungeon;
import com.sufurujhin.rpgdungeon.Utils.AttributeMobs;
import net.minecraft.server.v1_16_R3.World;
public class ZombieDrowned extends AttributeMobs {
private ItemStack[] items = new ItemStack[5];
private int[] slots = new int[5];
private double attack = 0.0;
private double speed = 0.0;
private float health = 0.0F;
private String displayName = "";
private boolean baby = false;
private boolean villager =false;
private boolean twoHand = false;
private int nv;
private Location loc;
public ZombieDrowned(RPGDungeon rpg,World world,Location loc, ItemStack[] items, double attack, double speed, float health, String displayName, boolean baby, boolean villager, int nv, int[] slots, boolean twoHand) {
super(rpg);
this.slots = slots;
this.nv = nv;
this.items = items;
this.attack = attack;
this.speed = speed;
this.health = health;
this.displayName = displayName;
this.villager = villager;
this.baby = baby;
this.loc = loc;
this.twoHand = twoHand;
}
public LivingEntity spawnZombie() {
Drowned craftZombie = (Drowned) loc.getWorld().spawnEntity(loc, EntityType.DROWNED);
setNivel(nv);
setEntity(craftZombie);
setSlots(slots);
setSpeed(speed);
craftZombie.setBaby(baby);
setTwoHand(twoHand);
setItems(items);
setGlowing(villager);
setDisplayName(displayName);
setAttack(attack);
setHealth(health);
return getEntity();
}
}
|
[
"[email protected]"
] | |
8de66c0f219e1978243ddaa282e6cf701fe89319
|
94f91fae532f86ef33b442bce9363cfe3973f2c4
|
/coffee-model/coffee-model-base/src/main/java/hu/icellmobilsoft/coffee/model/base/javatime/listener/TimestampsProvider.java
|
900925b25fe7b315a2b26d173dc164b501447b31
|
[
"Apache-2.0"
] |
permissive
|
speter555/coffee
|
296e2d8ebedfdb4e83614f64ed1bbd540a0d6f5a
|
910c1bd69b7e05b50a3a3790eccebb5b0c54f2da
|
refs/heads/master
| 2022-12-18T15:58:25.178282 | 2020-09-16T15:53:51 | 2020-09-16T15:53:51 | 290,177,747 | 0 | 0 | null | 2020-08-25T09:53:55 | 2020-08-25T09:53:54 | null |
UTF-8
|
Java
| false | false | 5,596 |
java
|
/*-
* #%L
* Coffee
* %%
* Copyright (C) 2020 i-Cell Mobilsoft Zrt.
* %%
* 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.
* #L%
*/
package hu.icellmobilsoft.coffee.model.base.javatime.listener;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.OffsetTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import org.apache.deltaspike.data.impl.audit.AuditPropertyException;
import org.apache.deltaspike.data.impl.audit.PrePersistAuditListener;
import org.apache.deltaspike.data.impl.audit.PreUpdateAuditListener;
import org.apache.deltaspike.data.impl.property.Property;
import org.apache.deltaspike.data.impl.property.query.AnnotatedPropertyCriteria;
import org.apache.deltaspike.data.impl.property.query.PropertyQueries;
import org.apache.deltaspike.data.impl.property.query.PropertyQuery;
import hu.icellmobilsoft.coffee.model.base.javatime.annotation.CreatedOn;
import hu.icellmobilsoft.coffee.model.base.javatime.annotation.ModifiedOn;
/**
* Set java 8 timestamps on marked properties.
*
* TimestampsProvider nem tehető alternative-ra illetve csak Calendar/Date típusokat tud kezelni:<br>
* https://issues.apache.org/jira/browse/DELTASPIKE-1229
*
* @author mark.petrenyi
* @see org.apache.deltaspike.data.impl.audit.TimestampsProvider
* @since 1.0.0
*/
public class TimestampsProvider implements PrePersistAuditListener, PreUpdateAuditListener {
/** {@inheritDoc} */
@Override
public void prePersist(Object entity) {
updateTimestamps(entity, true);
}
/** {@inheritDoc} */
@Override
public void preUpdate(Object entity) {
updateTimestamps(entity, false);
}
private void updateTimestamps(Object entity, boolean create) {
long systime = System.currentTimeMillis();
List<Property<Object>> properties = new LinkedList<Property<Object>>();
PropertyQuery<Object> query = PropertyQueries.<Object> createQuery(entity.getClass())
.addCriteria(new AnnotatedPropertyCriteria(ModifiedOn.class));
properties.addAll(query.getWritableResultList());
if (create) {
query = PropertyQueries.<Object> createQuery(entity.getClass()).addCriteria(new AnnotatedPropertyCriteria(CreatedOn.class));
properties.addAll(query.getWritableResultList());
}
for (Property<Object> property : properties) {
setProperty(entity, property, create, systime);
}
}
private void setProperty(Object entity, Property<Object> property, boolean create, long systime) {
Object value = systime;
try {
value = now(property.getJavaClass(), systime);
property.setValue(entity, value);
} catch (Exception e) {
throw new AuditPropertyException("Failed to write value [" + value + "] to property [" + property.getName() + "] on entity ["
+ entity.getClass() + "]: " + e.getLocalizedMessage(), e);
}
}
private Object now(Class<?> field, long systime) throws Exception {
if (isCalendarClass(field)) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(systime);
return cal;
} else if (isDateClass(field)) {
return field.getConstructor(Long.TYPE).newInstance(systime);
} else if (isOffsetDateTimeClass(field)) {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(systime), ZoneId.systemDefault());
} else if (isOffsetTimeClass(field)) {
return OffsetTime.ofInstant(Instant.ofEpochMilli(systime), ZoneId.systemDefault());
} else if (isLocalDateTimeClass(field)) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(systime), ZoneId.systemDefault());
} else if (isLocalDateClass(field)) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(systime), ZoneId.systemDefault()).toLocalDate();
} else if (isInstantClass(field)) {
return Instant.ofEpochMilli(systime);
}
throw new IllegalArgumentException("Annotated field is not a date class: " + field);
}
private boolean isCalendarClass(Class<?> field) {
return Calendar.class.isAssignableFrom(field);
}
private boolean isDateClass(Class<?> field) {
return Date.class.isAssignableFrom(field);
}
private boolean isOffsetDateTimeClass(Class<?> field) {
return OffsetDateTime.class.isAssignableFrom(field);
}
private boolean isOffsetTimeClass(Class<?> field) {
return OffsetTime.class.isAssignableFrom(field);
}
private boolean isLocalDateTimeClass(Class<?> field) {
return LocalDateTime.class.isAssignableFrom(field);
}
private boolean isLocalDateClass(Class<?> field) {
return LocalDate.class.isAssignableFrom(field);
}
private boolean isInstantClass(Class<?> field) {
return Instant.class.isAssignableFrom(field);
}
}
|
[
"[email protected]"
] | |
fe650d3c2a7afe40ebade28b9225a7cbab189282
|
4eb7047b25f6725b95f0f5caa5cd4bda4b8e1906
|
/src/main/java/mycart/dao/CategoryDao.java
|
87f7e4cfc3473a175c52a4972ea34fa40d34a9af
|
[] |
no_license
|
hrithik812/Ecommerce-Web-App
|
925ac328c762fb9890d539c0e166f1a3a780ad9f
|
e0368aeea7ace3313143bcd99a3b867d4d09c01e
|
refs/heads/master
| 2022-12-10T18:20:01.620100 | 2020-09-07T10:02:37 | 2020-09-07T10:02:37 | 291,290,364 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,464 |
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 mycart.dao;
import java.util.List;
import mycart.entities.Category;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
public class CategoryDao {
private SessionFactory factory;
public CategoryDao(SessionFactory factory) {
this.factory = factory;
}
//save category to db
public int saveCategory(Category cat)
{
Session session=this.factory.openSession();
Transaction tx= session.beginTransaction();
int catid=(int)session.save(cat);
tx.commit();
session.close();
return catid;
}
public List<Category> getCategories()
{
Session s=this.factory.openSession();
Query query=s.createQuery("from Category");
List<Category> list=query.list();
return list;
}
public Category getCategory(int cid){
Category cat=null;
try{
Session session=this.factory.openSession();
cat=session.get(Category.class, cid);
session.close();
}catch(Exception e)
{
e.printStackTrace();
}
return cat;
}
}
|
[
"[email protected]"
] | |
4b812a3316bfb2e88de8556b75e886b2ac0134a5
|
00ecceed9d2addd49e7d4c647e33b1ddcb232278
|
/java/edoc-web/src/main/java/br/com/jfive/edoc/annotations/Category.java
|
08c5e36246ca10e9f1cf216bb375d11b6a6ffb95
|
[] |
no_license
|
jfive/edoc
|
63bf9d2623549fb708fe4d4fbbb14d983e2a29d5
|
ef61d7e0ed2feb571b13850acd78a1e5cf3f05a7
|
refs/heads/master
| 2021-01-23T04:09:53.289313 | 2013-10-29T19:38:18 | 2013-10-29T19:38:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 329 |
java
|
package br.com.jfive.edoc.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Category {
String value() default "";
}
|
[
"[email protected]"
] | |
f3f2aded1610865deca86137c3d5866899fedba7
|
c38101de3741b172c38dfcbf4085b3777e89ddb4
|
/aloneStudy_chapter08/src/sec02/exam05/ImplementationC.java
|
41267f18b625c49b0334140ce2614e6273295ffa
|
[] |
no_license
|
CheolHo-0428/JAVA-Study1
|
fcb030835d6f00b6eca7481ee32b3d3d1742027b
|
a72fe5e2cc13702283346c06e6bb62e2edc4048f
|
refs/heads/main
| 2023-02-02T16:22:37.403267 | 2020-12-20T07:31:32 | 2020-12-20T07:31:32 | null | 0 | 0 | null | null | null | null |
UHC
|
Java
| false | false | 339 |
java
|
package sec02.exam05;
public class ImplementationC implements InterfaceC {
public void methodA() {
System.out.println("ImplementationC-methodA() 실행");
}
public void methodB() {
System.out.println("ImplementationC-methodB() 실행");
}
public void methodC() {
System.out.println("ImplementationC-methodC() 실행");
}
}
|
[
"[email protected]"
] | |
c2debc50f712ed39990bde6122e9410d30238ea1
|
316af620cbca854412fe5274fc709bc234bf5918
|
/app/src/main/java/com/kingja/ticketassistant/util/CountTimer.java
|
0fe143f4822356f50a99f9b54e381f6738522c15
|
[] |
no_license
|
KingJA/ticketassistant
|
3ae8add087143fea372c0468d8412a34a80f5fe9
|
8845f49b6fc6aa2f257b63018688cb1280169455
|
refs/heads/master
| 2020-04-07T21:23:57.604645 | 2018-11-28T14:02:10 | 2018-11-28T14:02:10 | 158,725,266 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 730 |
java
|
package com.kingja.ticketassistant.util;
import android.os.CountDownTimer;
import android.widget.TextView;
/**
* Description:TODO
* Create Time:2018/4/17 14:35
* Author:KingJA
* Email:[email protected]
*/
public class CountTimer extends CountDownTimer {
private final TextView textView;
public CountTimer(int count, TextView textView) {
super(count*1000+50, 1000);
this.textView = textView;
}
@Override
public void onTick(long millisUntilFinished) {
textView.setText(Math.round((double) millisUntilFinished / 1000) + " 秒后重发");
}
@Override
public void onFinish() {
textView.setText("获取验证码");
textView.setClickable(true);
}
}
|
[
"[email protected]"
] | |
f3ebde7527136a15a85a43a216b9571bde6194c1
|
3d8024778f6f9f1fb85084a054b432889109a6a1
|
/Chap3-StacksAndQueues/src/SortStack.java
|
bf2ed63493a63b311eaebbc0f6a2157eff250e28
|
[] |
no_license
|
SirichandanaSambatur/CrackingTheCodingInterview
|
6c3de4fd25ef251a187a814a0e927fee6c657568
|
e231c785844b92d49ff8d2dbe562186c55bf71cc
|
refs/heads/master
| 2021-05-08T07:14:38.080043 | 2019-12-14T00:55:23 | 2019-12-14T00:55:23 | 106,733,283 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,048 |
java
|
public class SortStack {
Stack sortedStack=new Stack();
Stack tempStack=new Stack();
void pushIntoSort(int d){
if(isEmpty()){
sortedStack.push(d);
return;
}
while(peekSort()>d)
{
tempStack.push(sortedStack.pop());
if(sortedStack.isEmpty())
break;
}
sortedStack.push(d);
while(!tempStack.isEmpty()){
sortedStack.push(tempStack.pop());
}
}
int popFromSort(){
if(isEmpty())
{
System.out.println("Stack empty");
return -1;
}
return sortedStack.pop();
}
int peekSort(){
if(isEmpty())
{
System.out.println("Stack empty");
return -1;
}
return sortedStack.top();
}
boolean isEmpty(){
return sortedStack.isEmpty();
}
void display(){
Stack tempD=sortedStack;
while(!tempD.isEmpty())
System.out.println(tempD.pop());
}
public static void main(String args[]){
SortStack ss=new SortStack();
ss.pushIntoSort(6);
ss.pushIntoSort(8);
ss.pushIntoSort(2);
ss.pushIntoSort(4);
System.out.println("Popped element= "+ss.popFromSort());
ss.display();
}
}
|
[
"[email protected]"
] | |
0298274882709713195f4306b721ee8befaa160b
|
411da07587c1b6fc698bc8ca5e530dbafc44dddb
|
/nyngw_final/src/main/java/com/nyngw/homeMain/basicUI/dao/BasicUIDaoImpl.java
|
2769de707db32ab7caf6f582c98487223c712bee
|
[] |
no_license
|
NYNS1/nyngwFinal
|
f5dec13cf5fff74b9a5b83940353b593268e35ac
|
962aeaceb45eaf823737767e200629fecb47c882
|
refs/heads/master
| 2020-06-25T03:19:18.968704 | 2017-08-02T03:43:31 | 2017-08-02T03:44:02 | 96,953,133 | 0 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 101 |
java
|
package com.nyngw.homeMain.basicUI.dao;
public class BasicUIDaoImpl implements BasicUIDao {
}
|
[
"[email protected]"
] | |
28ab132436b1706b73fb2860d179504a6d9d7a7c
|
9ae29c39e9c12e3e013aa5a06a18dd42dbce9ce2
|
/crm28/src/com/itheima/service/impl/BaseDictServiceImpl.java
|
7f1406d9ba2cbbfa8c113dc4cc6a70e0173d95ce
|
[] |
no_license
|
xuandxiaoandmo/timu01
|
d08f23ea883e126755fd7cd7f3fa7338d56d3839
|
c41e4c12c58246097b36e3fb9d9981f98c13562e
|
refs/heads/master
| 2021-04-03T09:41:37.635158 | 2018-03-10T06:44:50 | 2018-03-10T06:44:50 | 124,504,608 | 8 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 487 |
java
|
package com.itheima.service.impl;
import java.util.List;
import com.itheima.bean.BaseDict;
import com.itheima.dao.BaseDictDao;
import com.itheima.service.BaseDictService;
public class BaseDictServiceImpl implements BaseDictService{
private BaseDictDao baseDictDao;
public void setBaseDictDao(BaseDictDao baseDictDao) {
this.baseDictDao = baseDictDao;
}
@Override
public List<BaseDict> findByType(String dict_type_code) {
return baseDictDao.findByType(dict_type_code);
}
}
|
[
"[email protected]"
] | |
03e52fcd44b4f604f5cb0c45b9692dee7c5136ce
|
f6263e44b5a1d780caffab9530020915def5db05
|
/atta-ejb/src/main/java/org/inbio/ara/eao/identification/impl/IdentificationStatusEAOImpl.java
|
5dcdfaa6982e52640bd378614777977fe1322369
|
[] |
no_license
|
INBio/Capturador
|
9fa35b533342f69d3e33abedb3dc2b673c122b4e
|
8a64d9bad62460833f311fca4f32c4368e686e0e
|
refs/heads/master
| 2021-01-22T05:15:34.070411 | 2013-07-23T17:30:14 | 2013-07-23T17:30:14 | 5,074,159 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,212 |
java
|
/* Ara - capture species and specimen data
*
* Copyright (C) 2009 INBio ( Instituto Nacional de Biodiversidad )
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.inbio.ara.eao.identification.impl;
import org.inbio.ara.eao.identification.IdentificationStatusEAOLocal;
import javax.ejb.Stateless;
import org.inbio.ara.eao.BaseEAOImpl;
import org.inbio.ara.persistence.identification.IdentificationStatus;
/**
*
* @author asanabria
*/
@Stateless
public class IdentificationStatusEAOImpl extends BaseEAOImpl<IdentificationStatus,Long>
implements IdentificationStatusEAOLocal {
}
|
[
"esmata@3aa2e761-397d-4522-80f4-092673de1051"
] |
esmata@3aa2e761-397d-4522-80f4-092673de1051
|
a2f87ad7fc207bca3293ef3f100c8085869c128f
|
cc511ceb3194cfdd51f591e50e52385ba46a91b3
|
/example/source_code/jackrabbit/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/AuthContextProvider.java
|
17cca073403b8348aeca2cbc86637a9845f8f4ce
|
[] |
no_license
|
huox-lamda/testing_hw
|
a86cdce8d92983e31e653dd460abf38b94a647e4
|
d41642c1e3ffa298684ec6f0196f2094527793c3
|
refs/heads/master
| 2020-04-16T19:24:49.643149 | 2019-01-16T15:47:13 | 2019-01-16T15:47:13 | 165,858,365 | 3 | 3 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,225 |
java
|
org apach jackrabbit core secur authent
org apach jackrabbit core config login modul config loginmoduleconfig
org apach jackrabbit core secur princip princip provid registri principalproviderregistri
javax jcr credenti
javax jcr repositori except repositoryexcept
javax jcr session
javax secur auth subject
javax secur auth callback callback handler callbackhandl
javax secur auth login app configur entri appconfigurationentri
javax secur auth login configur
java util arrai list arraylist
java util list
java util map
java util properti
code authcontextprovid code defin current request login
handl default link org apach jackrabbit core config repositoryconfig
local repositori configur take preced jaa configur
local configur present jaa configur provid
link getauthcontext fail code repositoryexcept code
auth context provid authcontextprovid
initi
configur state jaa configur exist applic
jaa isjaa
configur option local loginmodul
login modul config loginmoduleconfig config
applic loginconfig entri
string app appnam
param appnam loginconfig applic instanc
param config option loginmodul configur jaa
auth context provid authcontextprovid string app appnam login modul config loginmoduleconfig config
app appnam app appnam
config config
param credenti
param subject
param session
param principalproviderregistri
param adminid
param anonymousid
return context authent log
throw repositoryexcept case code jaascontext code
code localcontext code successfulli creat
auth context authcontext auth context getauthcontext credenti credenti
subject subject
session session
princip provid registri principalproviderregistri princip provid registri principalproviderregistri
string admin adminid
string anonym anonymousid
repositori except repositoryexcept
callback handler callbackhandl handler cbhandler callback handler impl callbackhandlerimpl credenti session princip provid registri principalproviderregistri admin adminid anonym anonymousid
local isloc
local auth context localauthcontext config handler cbhandler subject
jaa isjaa
jaa auth context jaasauthcontext app appnam handler cbhandler subject
repositori except repositoryexcept login configur
return true applic entri jaa link configur
jaa isjaa
local isloc initi
app configur entri appconfigurationentri entri jaa config getjaasconfig
jaa isjaa entri entri length
initi
jaa isjaa
return true login modul configur
local isloc
config
return option configur loginmodul
properti modul config getmoduleconfig
properti prop properti
local isloc
prop properti config paramet getparamet
app configur entri appconfigurationentri entri jaa config getjaasconfig
entri
list properti tmp arrai list arraylist properti entri length
app configur entri appconfigurationentri entri entri
map opt entri option getopt
opt
properti prop properti
prop put putal opt
tmp add prop
prop tmp arrai toarrai properti tmp size
prop
return jaa login modul applic null
app configur entri appconfigurationentri jaa config getjaasconfig
check jaa loginmodul fallback configur
configur login
login configur configur getconfigur
except
mean jaa configur file permiss read
login
login app configur entri getappconfigurationentri app appnam
except
wlp throw illegalargumentexcept unknown appnam
|
[
"[email protected]"
] | |
1989bb25d9b12a1fa7a56e85f45a3ef903181775
|
bcbb3f384fece271ba1a54a4e8aefd1f8065502d
|
/robot/commands/Arcadedrive.java
|
e3f14259e0831b7a73580dd8dce225a11c1426b7
|
[] |
no_license
|
RSS-robotics/Code-for-CYLE
|
f23e4213705a35b2b38d195bbae70651b98391b6
|
f3dc45a3ffa79f50acb6f2abed1af074ac872ddb
|
refs/heads/master
| 2020-12-15T19:38:04.149159 | 2020-03-02T23:33:56 | 2020-03-02T23:33:56 | 235,232,507 | 0 | 1 | null | 2020-01-23T01:23:57 | 2020-01-21T01:34:00 |
Java
|
UTF-8
|
Java
| false | false | 584 |
java
|
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.commands.RoboArm;
/**
* Add your docs here.
*/
public class Arcadedrive {
}
|
[
"[email protected]"
] | |
9f0c2957e1a2dc3c12bb0353dd11695ff68b649f
|
284927832ddb3174636c2514592bbec9a1a93480
|
/src/main/java/com/example/analysis/datalock/DataLockApplication.java
|
c52bb0854ad7ad02e32d682eb099491882643a4e
|
[] |
no_license
|
YUSHIBUJUE/analysis-data-lock
|
432c2d84d4ea4bff15305da3e38d38dc3ab66575
|
d103171339c0c2f7da0cfe3369498b71753d5121
|
refs/heads/master
| 2020-10-02T09:00:03.800943 | 2019-12-12T10:22:57 | 2019-12-12T10:22:57 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 547 |
java
|
package com.example.analysis.datalock;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
@MapperScan("com.example.analysis.datalock.mapper")
@EnableTransactionManagement
public class DataLockApplication {
public static void main(String[] args) {
SpringApplication.run(DataLockApplication.class, args);
}
}
|
[
"[email protected]"
] | |
2cb53fb9ef8624c15e8f07bd8c1865e481c62fdc
|
2518f7becbd9667a24d7d1ab73a495a6b466c92b
|
/pastebin/src/java/edu/pucmm/pw/parcial2/servlets/UpdatePaste.java
|
970cac8a61b0feb7a5beaeb40d5409db4ee97459
|
[] |
no_license
|
YandriPuello/Pastebin
|
da1f7ae3d2ecc1634d6c5ea984e8e32aeee5ac99
|
15f2aa9cf8b75faa85ccbc05057ccac43e145376
|
refs/heads/master
| 2021-01-01T06:12:10.044297 | 2015-02-23T20:21:22 | 2015-02-23T20:21:22 | 31,227,564 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,577 |
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 edu.pucmm.pw.parcial2.servlets;
import edu.pucmm.pw.parcial2.ejb.JpaServiceEJB;
import edu.pucmm.pw.parcial2.entities.Codigo;
import edu.pucmm.pw.parcial2.entities.Expiracion;
import edu.pucmm.pw.parcial2.entities.Sintaxis;
import edu.pucmm.pw.parcial2.entities.Usuario;
import edu.pucmm.pw.parcial2.entities.Visibilidad;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author Yandri
*/
@WebServlet(name = "UpdatePaste", urlPatterns = {"/UpdatePaste"})
public class UpdatePaste extends HttpServlet {
@EJB
JpaServiceEJB jpaService;
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String url =request.getParameter("id");
Codigo codigo = ((List<Codigo>)jpaService.findObject("Codigo.findByUrl", Codigo.class, "url",url )).get(0);
int idSintaxis = Integer.parseInt(request.getParameter("paste_format"));
int idVisibilidad = Integer.parseInt(request.getParameter("paste_visibility"));
int idExpiracion = Integer.parseInt(request.getParameter("paste_expire_date"));
List<Sintaxis> sintaxis = (List<Sintaxis>)request.getServletContext().getAttribute("sintaxis");
List<Visibilidad> visibilidad = (List<Visibilidad>)request.getServletContext().getAttribute("visibilidad");
List<Expiracion> expiracion = (List<Expiracion>)request.getServletContext().getAttribute("expiracion");
for(Sintaxis s : sintaxis){
if(s.getIdsintaxis() == idSintaxis){
codigo.setIdsintaxis(s);
break;
}
}
for(Visibilidad v : visibilidad){
if(v.getIdvisibilidad() == idVisibilidad){
codigo.setIdvisibilidad(v);
break;
}
}
if(idExpiracion != -1){
for(Expiracion e : expiracion){
if(e.getTiempo() == idExpiracion){
codigo.setIdexpiracion(e);
break;
}
}
codigo.setFechaactualizacion(new Date());
}
codigo.setTitulo(request.getParameter("paste_name"));
codigo.setTexto(request.getParameter("code"));
jpaService.updateCodigo(codigo);
response.sendRedirect("./codigo.jsp?id=" + codigo.getUrl());
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
|
[
"[email protected]"
] | |
95b9f3fb7bd6223a657bda49d6159450f5d01cd3
|
969c29e92440ec2cfbdd01fa4fdfde3a51f56c66
|
/src/java/com/sun/genericra/inbound/sync/WObjectMessageIn.java
|
1c097b2e23cf2cb4617decb23359e2c07cda839d
|
[
"BSD-3-Clause"
] |
permissive
|
javaee/glassfish-genericjmsra
|
7bfabda92574cbdb6c72be9e08e5e0e77486fc7a
|
f47bdf2c953cc21af83fa107517d076f92765b05
|
refs/heads/master
| 2023-05-28T14:37:49.816502 | 2018-05-11T08:22:59 | 2018-05-11T08:22:59 | 89,197,458 | 2 | 2 |
Apache-2.0
| 2017-12-15T07:40:27 | 2017-04-24T04:22:58 |
Java
|
UTF-8
|
Java
| false | false | 2,692 |
java
|
/*
* Copyright (c) 2003-2017 Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.sun.genericra.inbound.sync;
import javax.jms.JMSException;
import javax.jms.ObjectMessage;
import java.io.Serializable;
/**
* See WMessage
*
* @author Frank Kieviet
* @version $Revision: 1.1 $
*/
public class WObjectMessageIn extends WMessageIn implements ObjectMessage {
private ObjectMessage mDelegate;
/**
* Constructor
*
* @param delegate real msg
* @param ackHandler callback to call when ack() or recover() is called
* @param ibatch index of this message in a batch; -1 for non-batched
*/
public WObjectMessageIn(ObjectMessage delegate, AckHandler ackHandler, int ibatch) {
super(delegate, ackHandler, ibatch);
mDelegate = delegate;
}
/**
* @see javax.jms.ObjectMessage#getObject()
*/
public Serializable getObject() throws JMSException {
return mDelegate.getObject();
}
/**
* @see javax.jms.ObjectMessage#setObject(java.io.Serializable)
*/
public void setObject(Serializable arg0) throws JMSException {
mDelegate.setObject(arg0);
}
}
|
[
"[email protected]"
] | |
b012cd40ff6ca9839be8765ea12f43b26bd20325
|
93c6fafb20d4f4357c8088bd980a693026183530
|
/HW5_TreeSets/TreeMapsCounter.java
|
086665e3861b33d815e6a0064874383e19decf90
|
[] |
no_license
|
emmagperez/Algorithms
|
658b822271041335bb7f55d4c94d901914902e7a
|
ecb81700c4bd479af3848be604ce9f9100390c63
|
refs/heads/master
| 2021-05-02T10:04:17.767687 | 2018-02-21T18:42:28 | 2018-02-21T18:42:28 | 120,789,437 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 848 |
java
|
import java.util.Scanner;
import java.util.TreeMap;
/**
* Emma Perez
*/
public class TreeMapsCounter {
public static void main (String [] args)
{
TreeMap<String , Integer > tm = new TreeMap<>();
Scanner scan = new Scanner(System.in);
String line;
while((line = scan.nextLine()).length() > 0){
Scanner ls = new Scanner(line);
while(ls.hasNext())
{
String word = ls.next();
if(tm.containsKey(word)){
tm.put(word, (tm.get(word))+1);
}
if(! tm.containsKey(word))
{
tm.put(word, 1);
}
}
}
for(String all: tm.keySet())
{
System.out.println(all + " : " + tm.get(all));
}
}
}
|
[
"[email protected]"
] | |
65990c18f172f546d0c0fa63aa699e622a0016ff
|
102dd03f1f13c83397dc229cfbec9cef91609685
|
/src/InkJetPrinter.java
|
c00bf1973bf1ea5cf546e74817535ec9bc4fe085
|
[] |
no_license
|
gallorob/ImmaginiVettoriali
|
86ec6f651fd3b9143896ddbfcf42df03ef09524b
|
792e2d50f59f0ef89ce75d437159d4367736ca29
|
refs/heads/master
| 2021-05-07T21:23:43.218043 | 2017-11-08T10:01:09 | 2017-11-08T10:01:09 | 109,010,611 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,115 |
java
|
public class InkJetPrinter {
private final int MAXLEVEL;
private int[] cartridge = new int[Colore.values().length];
public InkJetPrinter(int MAXLEVEL) {
this.MAXLEVEL = MAXLEVEL;
}
public void initCartridges() {
for (Colore col:Colore.values()) {
cartridge[col.ordinal()] = this.MAXLEVEL;
}
}
public void changeCartridge(Colore col) {
cartridge[col.ordinal()] = this.MAXLEVEL;
}
public boolean checkCartridgesLevel(ImgVect img) {
for(Colore col:Colore.values()) {
if (cartridge[col.ordinal()] < img.getAreaColore(col)) return false;
}
return true;
}
public void stampa(ImgVect img){
if(checkCartridgesLevel(img)) {
for (Colore col:Colore.values()) {
cartridge[col.ordinal()] -= img.getAreaColore(col);
}
}
}
public void showCartridgesLevel() {
for (Colore col:Colore.values()) {
System.out.println(col + ": " + cartridge[col.ordinal()]);
}
}
}
|
[
"[email protected]"
] | |
8ccc850157360a6400a9ac0e7e58416b98ed9122
|
ea2149988e0cefcdff849d2a8767b0d4e4dcc3b3
|
/vendor/haocheng/proprietary/3rd-party/apk_and_code/blackview/DK_AWCamera/common/src/com/mediatek/camera/common/setting/SettingManager.java
|
f8c17d4dba542d4e69e0434eb182adec3bc583b4
|
[
"ISC",
"Apache-2.0"
] |
permissive
|
sam1017/CameraFramework
|
28ac2d4f2d0d62185255bb2bea2eedb3aa190804
|
9391f3b1bfbeaa51000df8e2df6ff7086178dfbc
|
refs/heads/master
| 2023-06-16T10:48:29.520119 | 2021-07-06T03:15:13 | 2021-07-06T03:15:13 | 383,324,836 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 28,812 |
java
|
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensor. Without
* the prior written permission of MediaTek inc. and/or its licensor, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2016. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NON-INFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek
* Software") have been modified by MediaTek Inc. All revisions are subject to
* any receiver's applicable license agreements with MediaTek Inc.
*/
package com.mediatek.camera.common.setting;
import android.annotation.TargetApi;
import android.app.Activity;
import android.hardware.Camera.Parameters;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CaptureFailure;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureRequest.Builder;
import android.hardware.camera2.TotalCaptureResult;
import android.hardware.camera2.params.OutputConfiguration;
import android.os.Build;
import android.view.Surface;
import com.mediatek.camera.common.IAppUi;
import com.mediatek.camera.common.ICameraContext;
import com.mediatek.camera.common.app.IApp;
import com.mediatek.camera.common.debug.CameraSysTrace;
import com.mediatek.camera.common.debug.LogHelper;
import com.mediatek.camera.common.debug.LogUtil.Tag;
import com.mediatek.camera.common.debug.profiler.IPerformanceProfile;
import com.mediatek.camera.common.debug.profiler.PerformanceTracker;
import com.mediatek.camera.common.device.CameraDeviceManagerFactory.CameraApi;
import com.mediatek.camera.common.loader.FeatureProvider;
import com.mediatek.camera.common.mode.ICameraMode;
import com.mediatek.camera.common.relation.DataStore;
import com.mediatek.camera.common.relation.Relation;
import com.mediatek.camera.common.relation.RestrictionDispatcher;
import com.mediatek.camera.common.relation.StatusMonitor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.annotation.Nonnull;
/**
* <p>This class plays a service role, through it, feature can get other features' info
* and post restriction to change the entry values of other features.</p>
*
* <p>This class is bound to camera device, which means every camera device has one
* instance of this class.</p>
*/
public class SettingManager implements ISettingManager,
ISettingManager.SettingController,
ISettingManager.SettingDevice2Configurator {
private static final String MAIN_THREAD = "main";
private Tag mTag;
private final SettingTable mSettingTable = new SettingTable();
private final StatusMonitor mStatusMonitor = new StatusMonitor();
private final RestrictionDispatcher mRestrictionDispatcher
= new RestrictionDispatcher(mSettingTable);
private SettingDeviceRequesterProxy mSettingDeviceRequesterProxy;
private SettingDevice2RequesterProxy mSettingDevice2RequesterProxy;
private ICameraMode.ModeType mModeType;
private String mCameraId;
private ICameraContext mCameraContext;
private IApp mApp;
private IAppUi mAppUi;
private Activity mActivity;
private CameraApi mCameraApi;
private CameraCaptureSession.CaptureCallback mCaptureCallback;
private HashMap<String, ICameraMode.ModeType> mPendingBindModeEvents = new HashMap<>();
private Object mBindModeEventLock = new Object();
private SettingAccessManager mSettingAccessManager = new SettingAccessManager();
private boolean mInitialized = false;
/**
* Initialize SettingManager, this will be called before open camera.
*
* @param cameraId The id of camera that setting manager binds to.
* @param app the instance of IApp.
* @param cameraContext the CameraContext instance.
* @param currentCameraApi current camera api.
*/
public void init(String cameraId, IApp app,
ICameraContext cameraContext, CameraApi currentCameraApi) {
mTag = new Tag(SettingManager.class.getSimpleName() + "-" + cameraId);
LogHelper.i(mTag, "[init]+");
mCameraId = cameraId;
mApp = app;
mCameraContext = cameraContext;
mCameraApi = currentCameraApi;
mActivity = app.getActivity();
mAppUi = app.getAppUi();
if (CameraApi.API1 == currentCameraApi) {
mSettingDeviceRequesterProxy = new SettingDeviceRequesterProxy();
} else if (CameraApi.API2 == currentCameraApi) {
mSettingDevice2RequesterProxy = new SettingDevice2RequesterProxy();
}
mInitialized = true;
LogHelper.i(mTag, "[init]-");
}
@Override
public void createSettingsByStage(int stage) {
LogHelper.d(mTag, "[createSettingsByStage]+, stage:" + stage
+ ", mInitialized:" + mInitialized);
if (!mInitialized) {
return;
}
FeatureProvider provider = mCameraContext.getFeatureProvider();
List<ICameraSetting> settings =
(List<ICameraSetting>)
provider.getInstancesByStage(ICameraSetting.class, mCameraApi, stage);
String modeKey = null;
ICameraMode.ModeType modeType = null;
synchronized (mBindModeEventLock) {
if (mPendingBindModeEvents.size() > 0) {
modeKey = mPendingBindModeEvents.keySet().iterator().next();
modeType = mPendingBindModeEvents.get(modeKey);
}
}
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("createSettingsByStage" + stage + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if (!successful) {
LogHelper.d(mTag, "[createSettingsByStage], access active failed, return");
return;
}
if (!mInitialized) {
LogHelper.d(mTag, "[createSettingsByStage], setting is uninitialized, return");
mSettingAccessManager.recycleAccess(access);
return;
}
for (ICameraSetting setting : settings) {
CameraSysTrace.onEventSystrace("createSettingsByStage:" + setting, true);
if (!access.isValid()) {
break;
}
setting.init(mApp, mCameraContext, this);
mSettingTable.add(setting);
setting.setSettingDeviceRequester(mSettingDeviceRequesterProxy,
mSettingDevice2RequesterProxy);
if (modeKey != null && modeType != null) {
setting.onModeOpened(modeKey, modeType);
}
CameraSysTrace.onEventSystrace("createSettingsByStage:" + setting, false);
}
if (access.isValid()) {
mSettingTable.classify(mCameraApi);
}
mSettingAccessManager.recycleAccess(access);
LogHelper.d(mTag, "[createSettingsByStage]-");
}
@Override
public void createAllSettings() {
LogHelper.d(mTag, "[createAllSettings]+, mInitialized:" + mInitialized);
if (!mInitialized) {
return;
}
FeatureProvider provider = mCameraContext.getFeatureProvider();
List<ICameraSetting> settings =
(List<ICameraSetting>)
provider.getAllBuildInInstance(ICameraSetting.class, mCameraApi);
if (settings.size() == 0) {
LogHelper.d(mTag, "[createAllSettings], there is no setting created, so return");
return;
}
List<ICameraSetting> hasCreatedSettings = mSettingTable.getAllSettings();
if (hasCreatedSettings.size() > 0) {
for (int i = 0; i < hasCreatedSettings.size(); i++) {
for (int j = 0; j < settings.size(); j++) {
if (hasCreatedSettings.get(i).getKey()
.equals(settings.get(j).getKey())) {
settings.remove(j);
j--;
break;
}
}
}
}
if (settings.size() == 0) {
LogHelper.d(mTag, "[createAllSettings], setting has created, so return");
return;
}
String modeKey = null;
ICameraMode.ModeType modeType = null;
synchronized (mBindModeEventLock) {
if (mPendingBindModeEvents.size() > 0) {
modeKey = mPendingBindModeEvents.keySet().iterator().next();
modeType = mPendingBindModeEvents.get(modeKey);
}
}
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("createAllSettings" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if (!successful) {
LogHelper.d(mTag, "[createAllSettings], access active failed, return");
return;
}
if (!mInitialized) {
LogHelper.d(mTag, "[createAllSettings], setting is uninitialized, return");
mSettingAccessManager.recycleAccess(access);
return;
}
for (ICameraSetting setting : settings) {
CameraSysTrace.onEventSystrace("createAllSettings:" + setting, true);
if (!access.isValid()) {
break;
}
setting.init(mApp, mCameraContext, this);
mSettingTable.add(setting);
setting.setSettingDeviceRequester(mSettingDeviceRequesterProxy,
mSettingDevice2RequesterProxy);
if (modeKey != null && modeType != null) {
setting.onModeOpened(modeKey, modeType);
}
CameraSysTrace.onEventSystrace("createAllSettings:" + setting, false);
}
if (access.isValid()) {
mSettingTable.classify(mCameraApi);
}
mSettingAccessManager.recycleAccess(access);
LogHelper.d(mTag, "[createAllSettings]-");
}
/**
* Un-initialize SettingManager, this will be called before close camera.
*/
public void unInit() {
LogHelper.i(mTag, "[unInit]+, mInitialized:" + mInitialized);
mInitialized = false;
if (mSettingDeviceRequesterProxy != null) {
mSettingDeviceRequesterProxy.unInit();
}
mSettingAccessManager.startControl();
List<ICameraSetting> settings = mSettingTable.getAllSettings();
for (ICameraSetting setting : settings) {
setting.removeViewEntry();
setting.unInit();
}
mSettingTable.removeAll();
mSettingAccessManager.stopControl();
LogHelper.i(mTag, "[unInit]-");
}
/**
* This setting manager bind to one mode. This method should be called
* after mode get setting manager, like in mode initialization stage or
* after switching camera in mode.
*
* @param modeKey The key to indicator mode.
* @param modeType The type of mode.
*/
public void bindMode(String modeKey, ICameraMode.ModeType modeType) {
LogHelper.d(mTag, "[bindMode] modeKey:" + modeKey + ", modeType:" + modeType);
mModeType = modeType;
List<ICameraSetting> settings = mSettingTable.getAllSettings();
if (settings == null || settings.size() == 0) {
synchronized (mBindModeEventLock) {
mPendingBindModeEvents.put(modeKey, modeType);
}
return;
}
for (ICameraSetting setting : settings) {
setting.onModeOpened(modeKey, modeType);
}
}
/**
* This setting manager unbind to one mode, and in this method setting manager
* will clear the restriction of this mode. This method should be called in
* mode un-initialization stage.
*
* @param modeKey The key to indicator mode.
*/
public void unbindMode(String modeKey) {
LogHelper.d(mTag, "[unbindMode] modeKey:" + modeKey);
List<ICameraSetting> settings = mSettingTable.getAllSettings();
for (ICameraSetting setting : settings) {
setting.onModeClosed(modeKey);
}
synchronized (mBindModeEventLock) {
mPendingBindModeEvents.clear();
}
}
@Override
public String getCameraId() {
return mCameraId;
}
@Override
public String queryValue(String key) {
ICameraSetting cameraSetting = mSettingTable.get(key);
if (cameraSetting != null) {
return cameraSetting.getValue();
}
return null;
}
@Override
public List<String> querySupportedPlatformValues(String key) {
ICameraSetting cameraSetting = mSettingTable.get(key);
if (cameraSetting != null) {
return cameraSetting.getSupportedPlatformValues();
}
return null;
}
@Override
public void postRestriction(Relation relation) {
LogHelper.d(mTag, "[postRestriction], " + relation.getHeaderKey()
+ ":" + relation.getHeaderValue() + " post relation.");
if (!mInitialized) {
return;
}
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("postRestriction" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if (!successful) {
return;
}
mRestrictionDispatcher.dispatch(relation);
mSettingAccessManager.recycleAccess(access);
}
@Override
public void addViewEntry() {
LogHelper.d(mTag, "[addViewEntry], mInitialized:" + mInitialized);
if (!mInitialized) {
return;
}
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("addViewEntry" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if (!successful) {
return;
}
List<ICameraSetting> settingsRelatedToMode = getSettingByModeType(mModeType);
for (ICameraSetting setting : settingsRelatedToMode) {
if (!access.isValid()) {
break;
}
setting.addViewEntry();
}
List<ICameraSetting> settingsUnRelatedToMode = getSettingByModeType(
mModeType == ICameraMode.ModeType.PHOTO ? ICameraMode.ModeType.VIDEO
: ICameraMode.ModeType.PHOTO);
List<ICameraSetting> settingsForPhotoAndVideo
= mSettingTable.getSettingListByType(ICameraSetting.SettingType.PHOTO_AND_VIDEO);
settingsUnRelatedToMode.removeAll(settingsForPhotoAndVideo);
for (ICameraSetting setting : settingsUnRelatedToMode) {
if (!access.isValid()) {
break;
}
setting.removeViewEntry();
}
mSettingAccessManager.recycleAccess(access);
mAppUi.registerQuickIconDone();
mAppUi.attachEffectViewEntry();
}
@Override
public void removeViewEntry() {
LogHelper.d(mTag, "[removeViewEntry], mInitialized:" + mInitialized);
if (!mInitialized) {
return;
}
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("removeViewEntry" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if (!successful) {
return;
}
List<ICameraSetting> settings = getSettingByModeType(mModeType);
for (ICameraSetting setting : settings) {
if (!access.isValid()) {
break;
}
setting.removeViewEntry();
}
mSettingAccessManager.recycleAccess(access);
}
@Override
public void refreshViewEntry() {
LogHelper.d(mTag, "[refreshViewEntry], mInitialized:" + mInitialized);
if (!mInitialized) {
return;
}
final List<ICameraSetting> settings = getSettingByModeType(mModeType);
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("refreshViewEntry" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if(mInitialized && successful) {
for (ICameraSetting setting : settings) {
if (!access.isValid()) {
break;
}
setting.refreshViewEntry();
}
mAppUi.updateSettingIconVisibility();
}
mSettingAccessManager.recycleAccess(access);
}
});
}
@Override
public StatusMonitor getStatusMonitor() {
return mStatusMonitor;
}
@Override
public void registerSettingItem(ICameraSetting setting) {
mSettingTable.add(setting);
}
@Override
public void unRegisterSettingItem(ICameraSetting setting) {
mSettingTable.remove(setting);
}
@Override
public void updateModeDeviceRequester(@Nonnull SettingDeviceRequester settingDeviceRequester) {
mSettingDeviceRequesterProxy.updateModeDeviceRequester(settingDeviceRequester);
}
@Override
public void updateModeDevice2Requester(
@Nonnull SettingDevice2Requester settingDevice2Requester) {
mSettingDevice2RequesterProxy.updateModeDevice2Requester(settingDevice2Requester);
}
@Override
public void updateModeDeviceStateToSetting(String modeName, String newState) {
LogHelper.d(mTag,
"[updateModeDeviceStateToSetting] mode:" + modeName + ",state:" + newState);
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("updateModeDeviceState" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if (!successful) {
return;
}
List<ICameraSetting> settings = getSettingByModeType(mModeType);
for (ICameraSetting setting : settings) {
if (!access.isValid()) {
break;
}
setting.updateModeDeviceState(newState);
}
mSettingAccessManager.recycleAccess(access);
}
@Override
public SettingDevice2Configurator getSettingDevice2Configurator() {
return this;
}
@Override
public OutputConfiguration getRawOutputConfiguration() {
OutputConfiguration rawConfig = null;
ICameraSetting setting = mSettingTable.get("key_dng");
if (setting == null) {
return null;
}
Surface rawSurface = setting.getCaptureRequestConfigure().configRawSurface();
if (rawSurface != null) {
rawConfig = new OutputConfiguration(rawSurface);
}
return rawConfig;
}
@SuppressWarnings("deprecation")
@Override
public void setCameraCharacteristics(CameraCharacteristics characteristics) {
LogHelper.d(mTag, "[setCameraCharacteristics]+, mInitialized:" + mInitialized);
if (!mInitialized) {
return;
}
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("setCameraCharacteristics" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if (!successful) {
return;
}
List<ICameraSetting> settings = getSettingByModeType(mModeType);
settings.retainAll(mSettingTable.getAllCaptureRequestSettings());
for (ICameraSetting setting : settings) {
CameraSysTrace.onEventSystrace("setCameraCharacteristics:" + setting, true);
if (!access.isValid()) {
break;
}
ICameraSetting.ICaptureRequestConfigure requestConfigure =
setting.getCaptureRequestConfigure();
requestConfigure.setCameraCharacteristics(characteristics);
CameraSysTrace.onEventSystrace("setCameraCharacteristics:" + setting, false);
}
DataStore dataStore = mCameraContext.getDataStore();
List<String> keys = dataStore.getSettingsKeepSavingTime(Integer.parseInt(mCameraId));
for (int i = 0; i < keys.size(); i++) {
ICameraSetting setting = mSettingTable.get(keys.get(i));
boolean removed = settings.remove(setting);
if (removed) {
settings.add(setting);
}
}
for (ICameraSetting setting : settings) {
CameraSysTrace.onEventSystrace("setCameraCharacteristics.postRestriction:" + setting, false);
if (!access.isValid()) {
break;
}
setting.postRestrictionAfterInitialized();
CameraSysTrace.onEventSystrace("setCameraCharacteristics.postRestriction:" + setting, false);
}
mSettingAccessManager.recycleAccess(access);
LogHelper.d(mTag, "[setCameraCharacteristics]-");
}
@Override
public void configCaptureRequest(@Nonnull Builder captureBuilder) {
LogHelper.d(mTag, "[configCaptureRequest], mInitialized:" + mInitialized);
if (!mInitialized) {
return;
}
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("configCaptureRequest" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if (!successful) {
return;
}
List<ICameraSetting> settings = getSettingByModeType(mModeType);
settings.retainAll(mSettingTable.getAllCaptureRequestSettings());
for (ICameraSetting setting : settings) {
if (!access.isValid()) {
break;
}
ICameraSetting.ICaptureRequestConfigure requestConfigure =
setting.getCaptureRequestConfigure();
requestConfigure.configCaptureRequest(captureBuilder);
}
mSettingAccessManager.recycleAccess(access);
}
@Override
public void configSessionSurface(@Nonnull List<Surface> surfaceList) {
LogHelper.d(mTag, "[configSessionSurface], mInitialized:" + mInitialized);
if (!mInitialized) {
return;
}
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("configSessionSurface" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access);
if (!successful) {
return;
}
List<ICameraSetting> settings = getSettingByModeType(mModeType);
settings.retainAll(mSettingTable.getAllCaptureRequestSettings());
for (ICameraSetting setting : settings) {
if (!access.isValid()) {
break;
}
ICameraSetting.ICaptureRequestConfigure requestConfigure =
setting.getCaptureRequestConfigure();
requestConfigure.configSessionSurface(surfaceList);
}
mSettingAccessManager.recycleAccess(access);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public CameraCaptureSession.CaptureCallback getRepeatingCaptureCallback() {
if (mCaptureCallback == null) {
mCaptureCallback = new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureCompleted(CameraCaptureSession session,
CaptureRequest request,
TotalCaptureResult result) {
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("onCaptureCompleted" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access, false);
if (!successful) {
return;
}
final List<ICameraSetting> settings = getSettingByModeType(mModeType);
settings.retainAll(mSettingTable.getAllCaptureRequestSettings());
for (ICameraSetting setting : settings) {
if (!access.isValid()) {
break;
}
ICameraSetting.ICaptureRequestConfigure requestConfigure =
setting.getCaptureRequestConfigure();
if (requestConfigure.getRepeatingCaptureCallback() != null) {
requestConfigure.getRepeatingCaptureCallback()
.onCaptureCompleted(session, request, result);
}
}
mSettingAccessManager.recycleAccess(access, false);
}
@Override
public void onCaptureFailed(CameraCaptureSession session,
CaptureRequest request,
CaptureFailure failure) {
SettingAccessManager.Access access = mSettingAccessManager
.getAccess("onCaptureFailed" + this.hashCode());
boolean successful = mSettingAccessManager.activeAccess(access, false);
if (!successful) {
return;
}
final List<ICameraSetting> settings = getSettingByModeType(mModeType);
settings.retainAll(mSettingTable.getAllCaptureRequestSettings());
for (ICameraSetting setting : settings) {
if (!access.isValid()) {
break;
}
ICameraSetting.ICaptureRequestConfigure requestConfigure =
setting.getCaptureRequestConfigure();
if (requestConfigure.getRepeatingCaptureCallback() != null) {
requestConfigure.getRepeatingCaptureCallback()
.onCaptureFailed(session, request, failure);
}
}
mSettingAccessManager.recycleAccess(access, false);
}
};
}
return mCaptureCallback;
}
@Override
public SettingController getSettingController() {
return this;
}
private List<ICameraSetting> getSettingByModeType(ICameraMode.ModeType modeType) {
List<ICameraSetting> settings = new ArrayList<>();
switch (modeType) {
case PHOTO:
settings = mSettingTable.getSettingListByType(ICameraSetting.SettingType.PHOTO);
break;
case VIDEO:
settings = mSettingTable.getSettingListByType(ICameraSetting.SettingType.VIDEO);
break;
default:
break;
}
return settings;
}
}
|
[
"[email protected]"
] | |
c20233030102251c982f65391972d038fd6e3133
|
50d8f0061d2df7d89a3bdfd7c74db414f582e9db
|
/generatorSqlmapCustom2/src/org/delphy/timetask/pojo/DelphyMerkleExample.java
|
a786c613df0e18d4f6fd5edc7080fdcbc75ace2b
|
[] |
no_license
|
mutouji/newmall
|
b9536bd17cd51aa8c875b6351ec4a5563ac28144
|
1539789e4e814e4a9a42ebdb8aa689edac881b18
|
refs/heads/master
| 2021-09-05T00:21:57.551299 | 2018-01-23T02:40:37 | 2018-01-23T02:40:37 | 115,855,812 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 22,671 |
java
|
package org.delphy.timetask.pojo;
import java.util.ArrayList;
import java.util.List;
public class DelphyMerkleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public DelphyMerkleExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andRootHashIsNull() {
addCriterion("root_hash is null");
return (Criteria) this;
}
public Criteria andRootHashIsNotNull() {
addCriterion("root_hash is not null");
return (Criteria) this;
}
public Criteria andRootHashEqualTo(String value) {
addCriterion("root_hash =", value, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashNotEqualTo(String value) {
addCriterion("root_hash <>", value, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashGreaterThan(String value) {
addCriterion("root_hash >", value, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashGreaterThanOrEqualTo(String value) {
addCriterion("root_hash >=", value, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashLessThan(String value) {
addCriterion("root_hash <", value, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashLessThanOrEqualTo(String value) {
addCriterion("root_hash <=", value, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashLike(String value) {
addCriterion("root_hash like", value, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashNotLike(String value) {
addCriterion("root_hash not like", value, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashIn(List<String> values) {
addCriterion("root_hash in", values, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashNotIn(List<String> values) {
addCriterion("root_hash not in", values, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashBetween(String value1, String value2) {
addCriterion("root_hash between", value1, value2, "rootHash");
return (Criteria) this;
}
public Criteria andRootHashNotBetween(String value1, String value2) {
addCriterion("root_hash not between", value1, value2, "rootHash");
return (Criteria) this;
}
public Criteria andTxHashIsNull() {
addCriterion("tx_hash is null");
return (Criteria) this;
}
public Criteria andTxHashIsNotNull() {
addCriterion("tx_hash is not null");
return (Criteria) this;
}
public Criteria andTxHashEqualTo(String value) {
addCriterion("tx_hash =", value, "txHash");
return (Criteria) this;
}
public Criteria andTxHashNotEqualTo(String value) {
addCriterion("tx_hash <>", value, "txHash");
return (Criteria) this;
}
public Criteria andTxHashGreaterThan(String value) {
addCriterion("tx_hash >", value, "txHash");
return (Criteria) this;
}
public Criteria andTxHashGreaterThanOrEqualTo(String value) {
addCriterion("tx_hash >=", value, "txHash");
return (Criteria) this;
}
public Criteria andTxHashLessThan(String value) {
addCriterion("tx_hash <", value, "txHash");
return (Criteria) this;
}
public Criteria andTxHashLessThanOrEqualTo(String value) {
addCriterion("tx_hash <=", value, "txHash");
return (Criteria) this;
}
public Criteria andTxHashLike(String value) {
addCriterion("tx_hash like", value, "txHash");
return (Criteria) this;
}
public Criteria andTxHashNotLike(String value) {
addCriterion("tx_hash not like", value, "txHash");
return (Criteria) this;
}
public Criteria andTxHashIn(List<String> values) {
addCriterion("tx_hash in", values, "txHash");
return (Criteria) this;
}
public Criteria andTxHashNotIn(List<String> values) {
addCriterion("tx_hash not in", values, "txHash");
return (Criteria) this;
}
public Criteria andTxHashBetween(String value1, String value2) {
addCriterion("tx_hash between", value1, value2, "txHash");
return (Criteria) this;
}
public Criteria andTxHashNotBetween(String value1, String value2) {
addCriterion("tx_hash not between", value1, value2, "txHash");
return (Criteria) this;
}
public Criteria andReceiptsIsNull() {
addCriterion("receipts is null");
return (Criteria) this;
}
public Criteria andReceiptsIsNotNull() {
addCriterion("receipts is not null");
return (Criteria) this;
}
public Criteria andReceiptsEqualTo(String value) {
addCriterion("receipts =", value, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsNotEqualTo(String value) {
addCriterion("receipts <>", value, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsGreaterThan(String value) {
addCriterion("receipts >", value, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsGreaterThanOrEqualTo(String value) {
addCriterion("receipts >=", value, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsLessThan(String value) {
addCriterion("receipts <", value, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsLessThanOrEqualTo(String value) {
addCriterion("receipts <=", value, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsLike(String value) {
addCriterion("receipts like", value, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsNotLike(String value) {
addCriterion("receipts not like", value, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsIn(List<String> values) {
addCriterion("receipts in", values, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsNotIn(List<String> values) {
addCriterion("receipts not in", values, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsBetween(String value1, String value2) {
addCriterion("receipts between", value1, value2, "receipts");
return (Criteria) this;
}
public Criteria andReceiptsNotBetween(String value1, String value2) {
addCriterion("receipts not between", value1, value2, "receipts");
return (Criteria) this;
}
public Criteria andTxsIsNull() {
addCriterion("txs is null");
return (Criteria) this;
}
public Criteria andTxsIsNotNull() {
addCriterion("txs is not null");
return (Criteria) this;
}
public Criteria andTxsEqualTo(String value) {
addCriterion("txs =", value, "txs");
return (Criteria) this;
}
public Criteria andTxsNotEqualTo(String value) {
addCriterion("txs <>", value, "txs");
return (Criteria) this;
}
public Criteria andTxsGreaterThan(String value) {
addCriterion("txs >", value, "txs");
return (Criteria) this;
}
public Criteria andTxsGreaterThanOrEqualTo(String value) {
addCriterion("txs >=", value, "txs");
return (Criteria) this;
}
public Criteria andTxsLessThan(String value) {
addCriterion("txs <", value, "txs");
return (Criteria) this;
}
public Criteria andTxsLessThanOrEqualTo(String value) {
addCriterion("txs <=", value, "txs");
return (Criteria) this;
}
public Criteria andTxsLike(String value) {
addCriterion("txs like", value, "txs");
return (Criteria) this;
}
public Criteria andTxsNotLike(String value) {
addCriterion("txs not like", value, "txs");
return (Criteria) this;
}
public Criteria andTxsIn(List<String> values) {
addCriterion("txs in", values, "txs");
return (Criteria) this;
}
public Criteria andTxsNotIn(List<String> values) {
addCriterion("txs not in", values, "txs");
return (Criteria) this;
}
public Criteria andTxsBetween(String value1, String value2) {
addCriterion("txs between", value1, value2, "txs");
return (Criteria) this;
}
public Criteria andTxsNotBetween(String value1, String value2) {
addCriterion("txs not between", value1, value2, "txs");
return (Criteria) this;
}
public Criteria andTxCountIsNull() {
addCriterion("tx_count is null");
return (Criteria) this;
}
public Criteria andTxCountIsNotNull() {
addCriterion("tx_count is not null");
return (Criteria) this;
}
public Criteria andTxCountEqualTo(Integer value) {
addCriterion("tx_count =", value, "txCount");
return (Criteria) this;
}
public Criteria andTxCountNotEqualTo(Integer value) {
addCriterion("tx_count <>", value, "txCount");
return (Criteria) this;
}
public Criteria andTxCountGreaterThan(Integer value) {
addCriterion("tx_count >", value, "txCount");
return (Criteria) this;
}
public Criteria andTxCountGreaterThanOrEqualTo(Integer value) {
addCriterion("tx_count >=", value, "txCount");
return (Criteria) this;
}
public Criteria andTxCountLessThan(Integer value) {
addCriterion("tx_count <", value, "txCount");
return (Criteria) this;
}
public Criteria andTxCountLessThanOrEqualTo(Integer value) {
addCriterion("tx_count <=", value, "txCount");
return (Criteria) this;
}
public Criteria andTxCountIn(List<Integer> values) {
addCriterion("tx_count in", values, "txCount");
return (Criteria) this;
}
public Criteria andTxCountNotIn(List<Integer> values) {
addCriterion("tx_count not in", values, "txCount");
return (Criteria) this;
}
public Criteria andTxCountBetween(Integer value1, Integer value2) {
addCriterion("tx_count between", value1, value2, "txCount");
return (Criteria) this;
}
public Criteria andTxCountNotBetween(Integer value1, Integer value2) {
addCriterion("tx_count not between", value1, value2, "txCount");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Long value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Long value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Long value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Long value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Boolean value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Boolean value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Boolean value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Boolean value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Boolean value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Boolean value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Boolean> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Boolean> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Boolean value1, Boolean value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Boolean value1, Boolean value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
|
[
"[email protected]"
] | |
52a8a675c8073dc502aecd1bc90490ed99703262
|
ac72641cacd2d68bd2f48edfc511f483951dd9d6
|
/opscloud-manage/src/test/java/com/baiyi/opscloud/zabbix/ZabbixHandlerTest.java
|
ab8f86e643674c4c35e8501096ef2ac559a604ee
|
[] |
no_license
|
fx247562340/opscloud-demo
|
6afe8220ce6187ac4cc10602db9e14374cb14251
|
b608455cfa5270c8c021fbb2981cb8c456957ccb
|
refs/heads/main
| 2023-05-25T03:33:22.686217 | 2021-06-08T03:17:32 | 2021-06-08T03:17:32 | 373,446,042 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 480 |
java
|
package com.baiyi.opscloud.zabbix;
import com.baiyi.opscloud.BaseUnit;
import com.baiyi.opscloud.zabbix.handler.ZabbixHandler;
import org.junit.jupiter.api.Test;
import javax.annotation.Resource;
/**
* @Author baiyi
* @Date 2019/12/31 4:05 下午
* @Version 1.0
*/
public class ZabbixHandlerTest extends BaseUnit {
@Resource
private ZabbixHandler zabbixHandler;
@Test
void testZabbixLogin() {
System.err.println(zabbixHandler.login());
}
}
|
[
"[email protected]"
] | |
e0ccb6735f359df5c8e7227f5164741581b48420
|
b0162f59e42c8704d755e412021d35abd97d57f1
|
/src/main/java/com/example/demo/pojo/Employee.java
|
8e444cde6ca0b24368c81e8b7d698c2a9d7ea576
|
[] |
no_license
|
zhangxugi/Springboot-angular6
|
7985dfcdea9dd29533a25d327837cfa343138487
|
07c12220599c1f6efe5fedf3070697f15c12141f
|
refs/heads/master
| 2020-04-03T21:23:32.866650 | 2018-11-02T13:37:48 | 2018-11-02T13:37:48 | 155,573,030 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,810 |
java
|
package com.example.demo.pojo;
import javax.persistence.*;
@Entity
@Table(name = "employee")
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "empid")
private Long employeeId;
@Column(name = "firstname")
private String firstName;
@Column(name = "lastname")
private String lastName;
@Column(name = "gender")
private String gender;
@Column(name = "dob")
private String dob;
@Column(name = "department")
private String department;
public Long getEmployeeId() {
return employeeId;
}
public void setEmployeeId(Long employeeId) {
this.employeeId = employeeId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public Employee(Long employeeId, String firstName, String lastName, String gender, String dob, String department) {
this.employeeId = employeeId;
this.firstName = firstName;
this.lastName = lastName;
this.gender = gender;
this.dob = dob;
this.department = department;
}
public Employee() {
}
}
|
[
"[email protected]"
] | |
3e9a56249d449728831fb33a0b9489b71bd155e3
|
35029f02d7573415d6fc558cfeeb19c7bfa1e3cc
|
/gs-accessing-data-jpa-complete/src/main/java/hello/service/CustomerService2010.java
|
e481cc2344e749b4ea0743f465aa24e811890c4d
|
[] |
no_license
|
MirekSz/spring-boot-slow-startup
|
e06fe9d4f3831ee1e79cf3735f6ceb8c50340cbe
|
3b1e9e4ebd4a95218b142b7eb397d0eaa309e771
|
refs/heads/master
| 2021-06-25T22:50:21.329236 | 2017-02-19T19:08:24 | 2017-02-19T19:08:24 | 59,591,530 | 0 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 119 |
java
|
package hello.service;
import org.springframework.stereotype.Service;
@Service
public class CustomerService2010 {
}
|
[
"miro1994"
] |
miro1994
|
cac1e8a5d5978f40b89d05312306e5939a4d204c
|
b7936f9a99afb096bc6d68448c32631d7416e177
|
/build/tmp/recompileMc/sources/net/minecraft/world/gen/structure/StructureEndCityPieces.java
|
fecc3852e3cdfcaa24f4c6d59c4262775ee73a53
|
[] |
no_license
|
AlphaWolf21/JATMA
|
ff786893893879d1f158a549659bbf13a5e0763c
|
93cf49cca9e23fa1660099999b2b46ce26fb3bbb
|
refs/heads/master
| 2021-01-19T02:43:34.989869 | 2016-11-07T04:06:16 | 2016-11-07T04:06:16 | 73,483,501 | 2 | 0 | null | 2016-11-11T14:20:06 | 2016-11-11T14:20:05 | null |
UTF-8
|
Java
| false | false | 20,880 |
java
|
package net.minecraft.world.gen.structure;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.monster.EntityShulker;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Rotation;
import net.minecraft.util.Tuple;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.template.PlacementSettings;
import net.minecraft.world.gen.structure.template.Template;
import net.minecraft.world.gen.structure.template.TemplateManager;
import net.minecraft.world.storage.loot.LootTableList;
public class StructureEndCityPieces
{
public static final TemplateManager MANAGER = new TemplateManager("structures");
private static final PlacementSettings OVERWRITE = (new PlacementSettings()).setIgnoreEntities(true);
private static final PlacementSettings INSERT = (new PlacementSettings()).setIgnoreEntities(true).setReplacedBlock(Blocks.AIR);
private static final StructureEndCityPieces.IGenerator HOUSE_TOWER_GENERATOR = new StructureEndCityPieces.IGenerator()
{
public void init()
{
}
public boolean generate(int p_186185_1_, StructureEndCityPieces.CityTemplate p_186185_2_, BlockPos p_186185_3_, List<StructureComponent> p_186185_4_, Random rand)
{
if (p_186185_1_ > 8)
{
return false;
}
else
{
Rotation rotation = p_186185_2_.placeSettings.getRotation();
StructureEndCityPieces.CityTemplate structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(p_186185_2_, p_186185_3_, "base_floor", rotation, true));
int i = rand.nextInt(3);
if (i == 0)
{
StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 4, -1), "base_roof", rotation, true));
}
else if (i == 1)
{
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 0, -1), "second_floor_2", rotation, false));
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 8, -1), "second_roof", rotation, false));
StructureEndCityPieces.recursiveChildren(StructureEndCityPieces.TOWER_GENERATOR, p_186185_1_ + 1, structureendcitypieces$citytemplate, (BlockPos)null, p_186185_4_, rand);
}
else if (i == 2)
{
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 0, -1), "second_floor_2", rotation, false));
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 4, -1), "third_floor_c", rotation, false));
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 8, -1), "third_roof", rotation, true));
StructureEndCityPieces.recursiveChildren(StructureEndCityPieces.TOWER_GENERATOR, p_186185_1_ + 1, structureendcitypieces$citytemplate, (BlockPos)null, p_186185_4_, rand);
}
return true;
}
}
};
private static final List<Tuple<Rotation, BlockPos>> TOWER_BRIDGES = Lists.<Tuple<Rotation, BlockPos>>newArrayList(new Tuple[] {new Tuple(Rotation.NONE, new BlockPos(1, -1, 0)), new Tuple(Rotation.CLOCKWISE_90, new BlockPos(6, -1, 1)), new Tuple(Rotation.COUNTERCLOCKWISE_90, new BlockPos(0, -1, 5)), new Tuple(Rotation.CLOCKWISE_180, new BlockPos(5, -1, 6))});
private static final StructureEndCityPieces.IGenerator TOWER_GENERATOR = new StructureEndCityPieces.IGenerator()
{
public void init()
{
}
public boolean generate(int p_186185_1_, StructureEndCityPieces.CityTemplate p_186185_2_, BlockPos p_186185_3_, List<StructureComponent> p_186185_4_, Random rand)
{
Rotation rotation = p_186185_2_.placeSettings.getRotation();
StructureEndCityPieces.CityTemplate lvt_7_1_ = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(p_186185_2_, new BlockPos(3 + rand.nextInt(2), -3, 3 + rand.nextInt(2)), "tower_base", rotation, true));
lvt_7_1_ = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(lvt_7_1_, new BlockPos(0, 7, 0), "tower_piece", rotation, true));
StructureEndCityPieces.CityTemplate structureendcitypieces$citytemplate1 = rand.nextInt(3) == 0 ? lvt_7_1_ : null;
int i = 1 + rand.nextInt(3);
for (int j = 0; j < i; ++j)
{
lvt_7_1_ = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(lvt_7_1_, new BlockPos(0, 4, 0), "tower_piece", rotation, true));
if (j < i - 1 && rand.nextBoolean())
{
structureendcitypieces$citytemplate1 = lvt_7_1_;
}
}
if (structureendcitypieces$citytemplate1 != null)
{
for (Tuple<Rotation, BlockPos> tuple : StructureEndCityPieces.TOWER_BRIDGES)
{
if (rand.nextBoolean())
{
StructureEndCityPieces.CityTemplate structureendcitypieces$citytemplate2 = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate1, (BlockPos)tuple.getSecond(), "bridge_end", rotation.add((Rotation)tuple.getFirst()), true));
StructureEndCityPieces.recursiveChildren(StructureEndCityPieces.TOWER_BRIDGE_GENERATOR, p_186185_1_ + 1, structureendcitypieces$citytemplate2, (BlockPos)null, p_186185_4_, rand);
}
}
StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(lvt_7_1_, new BlockPos(-1, 4, -1), "tower_top", rotation, true));
}
else
{
if (p_186185_1_ != 7)
{
return StructureEndCityPieces.recursiveChildren(StructureEndCityPieces.FAT_TOWER_GENERATOR, p_186185_1_ + 1, lvt_7_1_, (BlockPos)null, p_186185_4_, rand);
}
StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(lvt_7_1_, new BlockPos(-1, 4, -1), "tower_top", rotation, true));
}
return true;
}
};
private static final StructureEndCityPieces.IGenerator TOWER_BRIDGE_GENERATOR = new StructureEndCityPieces.IGenerator()
{
public boolean shipCreated;
public void init()
{
this.shipCreated = false;
}
public boolean generate(int p_186185_1_, StructureEndCityPieces.CityTemplate p_186185_2_, BlockPos p_186185_3_, List<StructureComponent> p_186185_4_, Random rand)
{
Rotation rotation = p_186185_2_.placeSettings.getRotation();
int i = rand.nextInt(4) + 1;
StructureEndCityPieces.CityTemplate structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(p_186185_2_, new BlockPos(0, 0, -4), "bridge_piece", rotation, true));
structureendcitypieces$citytemplate.componentType = -1;
int j = 0;
for (int k = 0; k < i; ++k)
{
if (rand.nextBoolean())
{
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(0, j, -4), "bridge_piece", rotation, true));
j = 0;
}
else
{
if (rand.nextBoolean())
{
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(0, j, -4), "bridge_steep_stairs", rotation, true));
}
else
{
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(0, j, -8), "bridge_gentle_stairs", rotation, true));
}
j = 4;
}
}
if (!this.shipCreated && rand.nextInt(10 - p_186185_1_) == 0)
{
StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-8 + rand.nextInt(8), j, -70 + rand.nextInt(10)), "ship", rotation, true));
this.shipCreated = true;
}
else if (!StructureEndCityPieces.recursiveChildren(StructureEndCityPieces.HOUSE_TOWER_GENERATOR, p_186185_1_ + 1, structureendcitypieces$citytemplate, new BlockPos(-3, j + 1, -11), p_186185_4_, rand))
{
return false;
}
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(4, j, 0), "bridge_end", rotation.add(Rotation.CLOCKWISE_180), true));
structureendcitypieces$citytemplate.componentType = -1;
return true;
}
};
private static final List<Tuple<Rotation, BlockPos>> FAT_TOWER_BRIDGES = Lists.<Tuple<Rotation, BlockPos>>newArrayList(new Tuple[] {new Tuple(Rotation.NONE, new BlockPos(4, -1, 0)), new Tuple(Rotation.CLOCKWISE_90, new BlockPos(12, -1, 4)), new Tuple(Rotation.COUNTERCLOCKWISE_90, new BlockPos(0, -1, 8)), new Tuple(Rotation.CLOCKWISE_180, new BlockPos(8, -1, 12))});
private static final StructureEndCityPieces.IGenerator FAT_TOWER_GENERATOR = new StructureEndCityPieces.IGenerator()
{
public void init()
{
}
public boolean generate(int p_186185_1_, StructureEndCityPieces.CityTemplate p_186185_2_, BlockPos p_186185_3_, List<StructureComponent> p_186185_4_, Random rand)
{
Rotation rotation = p_186185_2_.placeSettings.getRotation();
StructureEndCityPieces.CityTemplate structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(p_186185_2_, new BlockPos(-3, 4, -3), "fat_tower_base", rotation, true));
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(0, 4, 0), "fat_tower_middle", rotation, true));
for (int i = 0; i < 2 && rand.nextInt(3) != 0; ++i)
{
structureendcitypieces$citytemplate = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(0, 8, 0), "fat_tower_middle", rotation, true));
for (Tuple<Rotation, BlockPos> tuple : StructureEndCityPieces.FAT_TOWER_BRIDGES)
{
if (rand.nextBoolean())
{
StructureEndCityPieces.CityTemplate structureendcitypieces$citytemplate1 = StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, (BlockPos)tuple.getSecond(), "bridge_end", rotation.add((Rotation)tuple.getFirst()), true));
StructureEndCityPieces.recursiveChildren(StructureEndCityPieces.TOWER_BRIDGE_GENERATOR, p_186185_1_ + 1, structureendcitypieces$citytemplate1, (BlockPos)null, p_186185_4_, rand);
}
}
}
StructureEndCityPieces.func_189935_b(p_186185_4_, StructureEndCityPieces.addPiece(structureendcitypieces$citytemplate, new BlockPos(-2, 8, -2), "fat_tower_top", rotation, true));
return true;
}
};
public static void registerPieces()
{
MapGenStructureIO.registerStructureComponent(StructureEndCityPieces.CityTemplate.class, "ECP");
}
private static StructureEndCityPieces.CityTemplate addPiece(StructureEndCityPieces.CityTemplate p_186189_0_, BlockPos p_186189_1_, String p_186189_2_, Rotation p_186189_3_, boolean p_186189_4_)
{
StructureEndCityPieces.CityTemplate structureendcitypieces$citytemplate = new StructureEndCityPieces.CityTemplate(p_186189_2_, p_186189_0_.templatePosition, p_186189_3_, p_186189_4_);
BlockPos blockpos = p_186189_0_.template.calculateConnectedPos(p_186189_0_.placeSettings, p_186189_1_, structureendcitypieces$citytemplate.placeSettings, BlockPos.ORIGIN);
structureendcitypieces$citytemplate.offset(blockpos.getX(), blockpos.getY(), blockpos.getZ());
return structureendcitypieces$citytemplate;
}
public static void beginHouseTower(BlockPos p_186190_0_, Rotation p_186190_1_, List<StructureComponent> p_186190_2_, Random p_186190_3_)
{
FAT_TOWER_GENERATOR.init();
HOUSE_TOWER_GENERATOR.init();
TOWER_BRIDGE_GENERATOR.init();
TOWER_GENERATOR.init();
StructureEndCityPieces.CityTemplate structureendcitypieces$citytemplate = func_189935_b(p_186190_2_, new StructureEndCityPieces.CityTemplate("base_floor", p_186190_0_, p_186190_1_, true));
structureendcitypieces$citytemplate = func_189935_b(p_186190_2_, addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 0, -1), "second_floor", p_186190_1_, false));
structureendcitypieces$citytemplate = func_189935_b(p_186190_2_, addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 4, -1), "third_floor", p_186190_1_, false));
structureendcitypieces$citytemplate = func_189935_b(p_186190_2_, addPiece(structureendcitypieces$citytemplate, new BlockPos(-1, 8, -1), "third_roof", p_186190_1_, true));
recursiveChildren(TOWER_GENERATOR, 1, structureendcitypieces$citytemplate, (BlockPos)null, p_186190_2_, p_186190_3_);
}
private static StructureEndCityPieces.CityTemplate func_189935_b(List<StructureComponent> p_189935_0_, StructureEndCityPieces.CityTemplate p_189935_1_)
{
p_189935_0_.add(p_189935_1_);
return p_189935_1_;
}
private static boolean recursiveChildren(StructureEndCityPieces.IGenerator generator, int p_186187_1_, StructureEndCityPieces.CityTemplate p_186187_2_, BlockPos p_186187_3_, List<StructureComponent> p_186187_4_, Random p_186187_5_)
{
if (p_186187_1_ > 8)
{
return false;
}
else
{
List<StructureComponent> list = Lists.<StructureComponent>newArrayList();
if (generator.generate(p_186187_1_, p_186187_2_, p_186187_3_, list, p_186187_5_))
{
boolean flag = false;
int i = p_186187_5_.nextInt();
for (StructureComponent structurecomponent : list)
{
structurecomponent.componentType = i;
StructureComponent structurecomponent1 = StructureComponent.findIntersecting(p_186187_4_, structurecomponent.getBoundingBox());
if (structurecomponent1 != null && structurecomponent1.componentType != p_186187_2_.componentType)
{
flag = true;
break;
}
}
if (!flag)
{
p_186187_4_.addAll(list);
return true;
}
}
return false;
}
}
public static class CityTemplate extends StructureComponentTemplate
{
private String pieceName;
private Rotation rotation;
private boolean overwrite;
public CityTemplate()
{
}
public CityTemplate(String pieceNameIn, BlockPos pos, Rotation rot, boolean p_i46634_4_)
{
super(0);
this.pieceName = pieceNameIn;
this.rotation = rot;
this.overwrite = p_i46634_4_;
this.loadAndSetup(pos);
}
private void loadAndSetup(BlockPos p_186180_1_)
{
Template template = StructureEndCityPieces.MANAGER.getTemplate((MinecraftServer)null, new ResourceLocation("endcity/" + this.pieceName));
PlacementSettings placementsettings;
if (this.overwrite)
{
placementsettings = StructureEndCityPieces.OVERWRITE.copy().setRotation(this.rotation);
}
else
{
placementsettings = StructureEndCityPieces.INSERT.copy().setRotation(this.rotation);
}
this.setup(template, p_186180_1_, placementsettings);
}
/**
* (abstract) Helper method to write subclass data to NBT
*/
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
super.writeStructureToNBT(tagCompound);
tagCompound.setString("Template", this.pieceName);
tagCompound.setString("Rot", this.rotation.name());
tagCompound.setBoolean("OW", this.overwrite);
}
/**
* (abstract) Helper method to read subclass data from NBT
*/
protected void readStructureFromNBT(NBTTagCompound tagCompound)
{
super.readStructureFromNBT(tagCompound);
this.pieceName = tagCompound.getString("Template");
this.rotation = Rotation.valueOf(tagCompound.getString("Rot"));
this.overwrite = tagCompound.getBoolean("OW");
this.loadAndSetup(this.templatePosition);
}
protected void handleDataMarker(String p_186175_1_, BlockPos p_186175_2_, World p_186175_3_, Random p_186175_4_, StructureBoundingBox p_186175_5_)
{
if (p_186175_1_.startsWith("Chest"))
{
BlockPos blockpos = p_186175_2_.down();
if (p_186175_5_.isVecInside(blockpos))
{
TileEntity tileentity = p_186175_3_.getTileEntity(blockpos);
if (tileentity instanceof TileEntityChest)
{
((TileEntityChest)tileentity).setLootTable(LootTableList.CHESTS_END_CITY_TREASURE, p_186175_4_.nextLong());
}
}
}
else if (p_186175_1_.startsWith("Sentry"))
{
EntityShulker entityshulker = new EntityShulker(p_186175_3_);
entityshulker.setPosition((double)p_186175_2_.getX() + 0.5D, (double)p_186175_2_.getY() + 0.5D, (double)p_186175_2_.getZ() + 0.5D);
entityshulker.setAttachmentPos(p_186175_2_);
p_186175_3_.spawnEntityInWorld(entityshulker);
}
else if (p_186175_1_.startsWith("Elytra"))
{
EntityItemFrame entityitemframe = new EntityItemFrame(p_186175_3_, p_186175_2_, this.rotation.rotate(EnumFacing.SOUTH));
entityitemframe.setDisplayedItem(new ItemStack(Items.ELYTRA));
p_186175_3_.spawnEntityInWorld(entityitemframe);
}
}
}
interface IGenerator
{
void init();
boolean generate(int p_186185_1_, StructureEndCityPieces.CityTemplate p_186185_2_, BlockPos p_186185_3_, List<StructureComponent> p_186185_4_, Random rand);
}
}
|
[
"[email protected]"
] | |
087ad3330ff056faf81d8f61aecf95766c8fa9c1
|
5d252274c7ceab8a7cdf045bf9bb705d3959c699
|
/src/main/java/com/heo/exam/vo/QuestionVO.java
|
c65daa75ec9122a6205ab5c7a45c2b0325bb4910
|
[] |
no_license
|
liuikanggit/exam
|
579386a6a8facc09bac81777be9169b2ac4e77dd
|
b73b471346ae99e5145c8838db7dceff7c9b8003
|
refs/heads/master
| 2022-07-24T05:58:38.396458 | 2019-06-05T09:05:20 | 2019-06-05T09:05:20 | 170,079,146 | 0 | 0 | null | 2021-01-14T20:05:52 | 2019-02-11T06:28:44 |
Java
|
UTF-8
|
Java
| false | false | 2,100 |
java
|
package com.heo.exam.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author 刘康
* @create 2019-04-16 16:09
* @desc 题目
**/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class QuestionVO {
private Integer id;
private Integer type;
private String title;
private String titleImage;
private String answer0;
private String answerImage0;
private String answer1;
private String answerImage1;
private String answer2;
private String answerImage2;
private String answer3;
private String answerImage3;
private String answer;
public QuestionVO(Integer id, Integer type, String title, String titleImage, String answer0, String answerImage0, String answer1, String answerImage1, String answer2, String answerImage2, String answer3, String answerImage3, String answer) {
this.id = id;
this.type = type;
this.title = title;
this.titleImage = titleImage;
this.answer = answer;
if (type == 0) {
List<String[]> list = new ArrayList<>();
list.add(new String[]{answer0, answerImage0});
list.add(new String[]{answer1, answerImage1});
list.add(new String[]{answer2, answerImage2});
list.add(new String[]{answer3, answerImage3});
Collections.shuffle(list);
this.answer0 = list.get(0)[0];
this.answerImage0 = list.get(0)[1];
this.answer1 = list.get(1)[0];
this.answerImage1 = list.get(1)[1];
this.answer2 = list.get(2)[0];
this.answerImage2 = list.get(2)[1];
this.answer3 = list.get(3)[0];
this.answerImage3 = list.get(3)[1];
} else if (type == 1) {
if (Math.random() <= 0.5) {
this.answer0 = "对";
this.answer1 = "错";
} else {
this.answer0 = "错";
this.answer1 = "对";
}
}
}
}
|
[
"307311256"
] |
307311256
|
9d31b34715c2b25e6f5cf9f584f477cf866fef6f
|
b1f71f34ff6f55fe178b011b86e91fbfe540a90d
|
/Assignment4/HangmanCanvas.java
|
3a177931d657d729bf1f584571a7c067ef29c924
|
[] |
no_license
|
Jerry6574/CS106A-Assignments
|
a5e6a18129c98bed9b2d316c823f1331b3860ded
|
392614181229145798ec1ebb7fd5c7db57c6a1eb
|
refs/heads/master
| 2020-04-19T07:34:30.690573 | 2019-04-07T16:33:04 | 2019-04-07T16:33:04 | 168,051,859 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,632 |
java
|
/*
* File: HangmanCanvas.java
* ------------------------
* This file keeps track of the Hangman display.
*/
import acm.graphics.*;
public class HangmanCanvas extends GCanvas {
/** Resets the display so that only the scaffold appears */
public void reset() {
removeAll();
double ropeX = canvasWidth / 2;
double ropeY0 = canvasHeight / 6;
double ropeY1 = ropeY0 + ROPE_LENGTH;
GLine rope = new GLine(ropeX, ropeY0, ropeX, ropeY1);
double beamX0 = ropeX - BEAM_LENGTH;
double beamX1 = ropeX;
double beamY = ropeY0;
GLine beam = new GLine(beamX0, beamY, beamX1, beamY);
double scaffoldX = beamX0;
double scaffoldY0 = ropeY0;
double scaffoldY1 = scaffoldY0 + SCAFFOLD_HEIGHT;
GLine scaffold = new GLine(scaffoldX, scaffoldY0, scaffoldX, scaffoldY1);
add(scaffold);
add(beam);
add(rope);
}
/**
* Updates the word on the screen to correspond to the current
* state of the game. The argument string shows what letters have
* been guessed so far; unguessed letters are indicated by hyphens.
*/
public void displayWord(String word) {
// remove previous wordLabel if any
if(wordLabel != null) {
remove(wordLabel);
}
wordLabel = new GLabel(word, 100, 580);
wordLabel.setFont("Times-36");
add(wordLabel);
}
/**
* Updates the display to correspond to an incorrect guess by the
* user. Calling this method causes the next body part to appear
* on the scaffold and adds the letter to the list of incorrect
* guesses that appears at the bottom of the window.
*/
public void noteIncorrectGuess(char letter) {
incorrectGuesses += letter;
if(incorrectGuessesLabel != null) {
remove(incorrectGuessesLabel);
}
incorrectGuessesLabel = new GLabel(incorrectGuesses, 100, 620);
incorrectGuessesLabel.setFont("Times-24");
add(incorrectGuessesLabel);
incorrectGuessCount++;
System.out.println(incorrectGuessCount);
// add body parts to hangman diagram
switch (incorrectGuessCount) {
case 1:
addHead();
break;
case 2:
addBody();
break;
case 3:
addLeftArm();
break;
case 4:
addRightArm();
break;
case 5:
addLeftLeg();
break;
case 6:
addRightLeg();
break;
case 7:
addLeftFoot();
break;
case 8:
addRightFoot();
break;
default:
break;
}
}
private void addHead() {
double headX = canvasWidth / 2 - HEAD_RADIUS;
double headY = canvasHeight / 6 + ROPE_LENGTH;
GOval head = new GOval(headX, headY, 2 * HEAD_RADIUS, 2 * HEAD_RADIUS);
add(head);
}
private void addBody() {
double bodyX = canvasWidth / 2;
double bodyY0 = canvasHeight / 6 + ROPE_LENGTH + 2 * HEAD_RADIUS;
double bodyY1 = bodyY0 + BODY_LENGTH;
GLine body = new GLine(bodyX, bodyY0, bodyX, bodyY1);
add(body);
}
private void addLeftArm() {
double leftUpperArmX0 = canvasWidth / 2;
double leftUpperArmX1 = leftUpperArmX0 - UPPER_ARM_LENGTH;
double leftUpperArmY = canvasHeight / 6 + ROPE_LENGTH + 2 * HEAD_RADIUS + ARM_OFFSET_FROM_HEAD;
GLine leftUpperArm = new GLine(leftUpperArmX0, leftUpperArmY, leftUpperArmX1, leftUpperArmY);
double leftLowerArmX = leftUpperArmX1;
double leftLowerArmY0 = leftUpperArmY;
double leftLowerArmY1 = leftLowerArmY0 + LOWER_ARM_LENGTH;
GLine leftLowerArm = new GLine(leftLowerArmX, leftLowerArmY0, leftLowerArmX, leftLowerArmY1);
add(leftUpperArm);
add(leftLowerArm);
}
private void addRightArm() {
double rightUpperArmX0 = canvasWidth / 2;
double rightUpperArmX1 = rightUpperArmX0 + UPPER_ARM_LENGTH;
double rightUpperArmY = canvasHeight / 6 + ROPE_LENGTH + 2 * HEAD_RADIUS + ARM_OFFSET_FROM_HEAD;
GLine rightUpperArm = new GLine(rightUpperArmX0, rightUpperArmY, rightUpperArmX1, rightUpperArmY);
double rightLowerArmX = rightUpperArmX1;
double rightLowerArmY0 = rightUpperArmY;
double rightLowerArmY1 = rightLowerArmY0 + LOWER_ARM_LENGTH;
GLine rightLowerArm = new GLine(rightLowerArmX, rightLowerArmY0, rightLowerArmX, rightLowerArmY1);
add(rightUpperArm);
add(rightLowerArm);
}
private void addLeftLeg() {
double leftHipX0 = canvasWidth / 2;
double leftHipX1 = leftHipX0 - HIP_WIDTH;
double leftHipY = canvasHeight / 6 + ROPE_LENGTH + 2 * HEAD_RADIUS + BODY_LENGTH;
GLine leftHip = new GLine(leftHipX0, leftHipY, leftHipX1, leftHipY);
double leftLegX = leftHipX1;
double leftLegY0 = leftHipY;
double leftLegY1 = leftLegY0 + LEG_LENGTH;
GLine leftLeg = new GLine(leftLegX, leftLegY0, leftLegX, leftLegY1);
add(leftHip);
add(leftLeg);
}
private void addRightLeg() {
double rightHipX0 = canvasWidth / 2;
double rightHipX1 = rightHipX0 + HIP_WIDTH;
double rightHipY = canvasHeight / 6 + ROPE_LENGTH + 2 * HEAD_RADIUS + BODY_LENGTH;
GLine lrightHip = new GLine(rightHipX0, rightHipY, rightHipX1, rightHipY);
double rightLegX = rightHipX1;
double rightLegY0 = rightHipY;
double rightLegY1 = rightLegY0 + LEG_LENGTH;
GLine rightLeg = new GLine(rightLegX, rightLegY0, rightLegX, rightLegY1);
add(lrightHip);
add(rightLeg);
}
private void addLeftFoot() {
double leftFootX0 = canvasWidth / 2 - HIP_WIDTH;
double leftFootX1 = leftFootX0 - FOOT_LENGTH;
double leftFootY = canvasHeight / 6 + ROPE_LENGTH + 2 * HEAD_RADIUS + BODY_LENGTH + LEG_LENGTH;
GLine leftFoot = new GLine(leftFootX0, leftFootY, leftFootX1, leftFootY);
add(leftFoot);
}
private void addRightFoot() {
double rightFootX0 = canvasWidth / 2 + HIP_WIDTH;
double rightFootX1 = rightFootX0 + FOOT_LENGTH;
double rightFootY = canvasHeight / 6 + ROPE_LENGTH + 2 * HEAD_RADIUS + BODY_LENGTH + LEG_LENGTH;
GLine rightFoot = new GLine(rightFootX0, rightFootY, rightFootX1, rightFootY);
add(rightFoot);
}
/* Constants for the simple version of the picture (in pixels) */
private static final int SCAFFOLD_HEIGHT = 360;
private static final int BEAM_LENGTH = 144;
private static final int ROPE_LENGTH = 18;
private static final int HEAD_RADIUS = 36;
private static final int BODY_LENGTH = 144;
private static final int ARM_OFFSET_FROM_HEAD = 28;
private static final int UPPER_ARM_LENGTH = 72;
private static final int LOWER_ARM_LENGTH = 44;
private static final int HIP_WIDTH = 36;
private static final int LEG_LENGTH = 108;
private static final int FOOT_LENGTH = 28;
// getWidth() and getHeight() return 0.0, cannot use
// Use following canvas width and height
// approximates getWidth() and getHeight() at max window size
private double canvasWidth = 640;
private double canvasHeight = 640;
private GLabel wordLabel;
private int incorrectGuessCount = 0;
private String incorrectGuesses = "";
private GLabel incorrectGuessesLabel;
}
|
[
"[email protected]"
] | |
347af5796655345664a94e278bbee780ba316447
|
f6479b08962887e547f4af409b4ffc5b20a97a8f
|
/streaming-management/src/main/java/com/weibo/dip/platform/mysql/AlertdbUtil.java
|
669764e5ec04daf1aced988ae622f5742e14b7d7
|
[] |
no_license
|
0Gz2bflQyU0hpW/portal
|
52f3cbd3f9ab078df34dcee2713ae64c78b5c041
|
96a71c84bbd550dfb09d97a35c51ec545ccb6d6a
|
refs/heads/master
| 2020-08-02T18:09:00.928703 | 2019-09-28T07:01:13 | 2019-09-28T07:01:13 | 211,459,081 | 0 | 2 | null | 2019-09-28T07:04:08 | 2019-09-28T07:04:07 | null |
UTF-8
|
Java
| false | false | 12,945 |
java
|
package com.weibo.dip.platform.mysql;
import com.weibo.dip.platform.model.Alert;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AlertdbUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(AlertdbUtil.class);
private static final String INSERT_SQL =
"insert into streaming_alert("
+ "app_name,"
+ "collection,"
+ "alert_alive,"
+ "alert_repetitive,"
+ "alert_repetitive_group,"
+ "alert_active,"
+ "alert_active_threshold,"
+ "alert_accumulation,"
+ "alert_accumulation_threshold,"
+ "alert_receive,"
+ "alert_receive_threshold,"
+ "alert_scheduling_delay,"
+ "alert_scheduling_delay_threshold,"
+ "alert_processing,"
+ "alert_processing_threshold,"
+ "alert_active_processing,"
+ "alert_active_processing_time_threshold,"
+ "alert_active_processing_num_threshold,"
+ "alert_inactive_receivers,"
+ "alert_inactive_receivers_threshold,"
+ "alert_inactive_executors,"
+ "alert_inactive_executors_threshold,"
+ "alert_error,"
+ "alert_error_threshold,"
+ "alert_interval,"
+ "alert_group) "
+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
private static final String UPDATE_SQL =
"update streaming_alert "
+ "set collection=?,"
+ "alert_alive=?,"
+ "alert_repetitive=?,"
+ "alert_repetitive_group=?,"
+ "alert_active=?,"
+ "alert_active_threshold=?,"
+ "alert_accumulation=?,"
+ "alert_accumulation_threshold=?,"
+ "alert_receive=?,"
+ "alert_receive_threshold=?,"
+ "alert_scheduling_delay=?,"
+ "alert_scheduling_delay_threshold=?,"
+ "alert_processing=?,"
+ "alert_processing_threshold=?,"
+ "alert_active_processing=?,"
+ "alert_active_processing_time_threshold=?,"
+ "alert_active_processing_num_threshold=?,"
+ "alert_inactive_receivers=?,"
+ "alert_inactive_receivers_threshold=?,"
+ "alert_inactive_executors=?,"
+ "alert_inactive_executors_threshold=?,"
+ "alert_error=?,"
+ "alert_error_threshold=?,"
+ "alert_interval=?,"
+ "alert_group=? "
+ "where app_name = ? ";
private static final String UPDATE_STATE_BY_APPNAME_SQL =
"update streaming_alert set state =? where app_name =?";
private static final String SELECT_SQL = "select * from streaming_alert where state=1";
private static final String DELETE_BY_NAME = "DELETE FROM streaming_alert WHERE app_name=?";
/**
* list all alert info.
*
* @return not null
*/
public List<Alert> getAlertInfos() {
List<Alert> alerts = new ArrayList<>();
Connection connection = DataBaseUtil.getInstance();
try {
PreparedStatement preparedStatement = connection.prepareStatement(SELECT_SQL);
ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
Alert alert = new Alert();
alert.setId(resultSet.getInt("id"));
alert.setAppName(resultSet.getString("app_name"));
alert.setCollection(resultSet.getInt("collection"));
alert.setAlertAlive(resultSet.getInt("alert_alive"));
alert.setRestartCmd(resultSet.getString("restart_cmd"));
alert.setAlertRepetitive(resultSet.getInt("alert_repetitive"));
alert.setAlertRepetitiveGroup(resultSet.getString("alert_repetitive_group"));
alert.setAlertActive(resultSet.getInt("alert_active"));
alert.setAlertActiveThreshold(resultSet.getInt("alert_active_threshold"));
alert.setAlertAccumulation(resultSet.getInt("alert_accumulation"));
alert.setAlertAccumulationThreshold(resultSet.getInt("alert_accumulation_threshold"));
alert.setAlertReceive(resultSet.getInt("alert_receive"));
alert.setAlertReceiveThreshold(resultSet.getFloat("alert_receive_threshold"));
alert.setAlertSchedulingDelay(resultSet.getInt("alert_scheduling_delay"));
alert.setAlertSchedulingDelayThreshold(
resultSet.getInt("alert_scheduling_delay_threshold"));
alert.setAlertProcessing(resultSet.getInt("alert_processing"));
alert.setAlertProcessingThreshold(resultSet.getInt("alert_processing_threshold"));
alert.setAlertActiveProcessing(resultSet.getInt("alert_active_processing"));
alert.setAlertActiveProcessingTimeThreshold(
resultSet.getInt("alert_active_processing_time_threshold"));
alert.setAlertActiveProcessingNumThreshold(
resultSet.getInt("alert_active_processing_num_threshold"));
alert.setAlertInactiveReceivers(resultSet.getInt("alert_inactive_receivers"));
alert.setAlertInactiveReceiversThreshold(
resultSet.getInt("alert_inactive_receivers_threshold"));
alert.setAlertInactiveExecutors(resultSet.getInt("alert_inactive_executors"));
alert.setAlertInactiveExecutorsThreshold(
resultSet.getInt("alert_inactive_executors_threshold"));
alert.setAlertError(resultSet.getInt("alert_error"));
alert.setAlertErrorThreshold(resultSet.getInt("alert_error_threshold"));
alert.setAlertInterval(resultSet.getInt("alert_interval"));
alert.setAlertGroup(resultSet.getString("alert_group"));
alert.setState(resultSet.getInt("state"));
alerts.add(alert);
}
resultSet.close();
preparedStatement.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
try {
connection.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
return alerts;
}
/**
* update state.
*
* @param appName appname
* @param state state
*/
public void updateStateByAppName(int state, String appName) {
Connection connection = DataBaseUtil.getInstance();
try {
PreparedStatement preStmt = connection.prepareStatement(UPDATE_STATE_BY_APPNAME_SQL);
preStmt.setInt(1, state);
preStmt.setString(2, appName);
preStmt.executeUpdate();
preStmt.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
try {
connection.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
}
/**
* .
* @param id .
* @param specifiedColumn .
* @param value .
*/
public void updateSpecifiedColumnById(int id, String specifiedColumn, int value) {
String sql = "update streaming_alert set " + specifiedColumn + " =? where id =?";
Connection connection = DataBaseUtil.getInstance();
try {
PreparedStatement preStmt = connection.prepareStatement(sql);
preStmt.setInt(1, value);
preStmt.setInt(2, id);
preStmt.executeUpdate();
preStmt.close();
} catch (Exception e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
try {
connection.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
}
/**
* delete .
*
* @param name name
*/
public int delete(String name) {
int resault = 0;
Connection connection = DataBaseUtil.getInstance();
try {
PreparedStatement preparedStatement = connection.prepareStatement(DELETE_BY_NAME);
preparedStatement.setString(1, name);
resault = preparedStatement.executeUpdate();
preparedStatement.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
try {
connection.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
return resault;
}
/**
* update.
*
* @param alert alert info
*/
public int update(Alert alert) {
int resault = 0;
Connection connection = DataBaseUtil.getInstance();
try {
PreparedStatement preparedStatement = connection.prepareStatement(UPDATE_SQL);
preparedStatement.setInt(1, alert.getCollection());
preparedStatement.setInt(2, alert.getAlertAlive());
preparedStatement.setInt(3, alert.getAlertRepetitive());
preparedStatement.setString(4, alert.getAlertRepetitiveGroup());
preparedStatement.setInt(5, alert.getAlertActive());
preparedStatement.setInt(6, alert.getAlertActiveThreshold());
preparedStatement.setInt(7, alert.getAlertAccumulation());
preparedStatement.setInt(8, alert.getAlertAccumulationThreshold());
preparedStatement.setInt(9, alert.getAlertReceive());
preparedStatement.setFloat(10, alert.getAlertReceiveThreshold());
preparedStatement.setInt(11, alert.getAlertSchedulingDelay());
preparedStatement.setInt(12, alert.getAlertSchedulingDelayThreshold());
preparedStatement.setInt(13, alert.getAlertProcessing());
preparedStatement.setInt(14, alert.getAlertProcessingThreshold());
preparedStatement.setInt(15, alert.getAlertActiveProcessing());
preparedStatement.setInt(16, alert.getAlertActiveProcessingTimeThreshold());
preparedStatement.setInt(17, alert.getAlertActiveProcessingNumThreshold());
preparedStatement.setInt(18, alert.getAlertInactiveReceivers());
preparedStatement.setInt(19, alert.getAlertInactiveReceiversThreshold());
preparedStatement.setInt(20, alert.getAlertInactiveExecutors());
preparedStatement.setInt(21, alert.getAlertInactiveExecutorsThreshold());
preparedStatement.setInt(22, alert.getAlertError());
preparedStatement.setInt(23, alert.getAlertErrorThreshold());
preparedStatement.setInt(24, alert.getAlertInterval());
preparedStatement.setString(25, alert.getAlertGroup());
preparedStatement.setString(26, alert.getAppName());
resault = preparedStatement.executeUpdate();
preparedStatement.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
try {
connection.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
return resault;
}
/**
* insert.
*
* @param alert alert info
*/
public int insert(Alert alert) {
int resault = 0;
Connection connection = DataBaseUtil.getInstance();
try {
PreparedStatement preparedStatement = connection.prepareStatement(INSERT_SQL);
preparedStatement.setString(1, alert.getAppName());
preparedStatement.setInt(2, alert.getCollection());
preparedStatement.setInt(3, alert.getAlertAlive());
preparedStatement.setInt(4, alert.getAlertRepetitive());
preparedStatement.setString(5, alert.getAlertRepetitiveGroup());
preparedStatement.setInt(6, alert.getAlertActive());
preparedStatement.setInt(7, alert.getAlertActiveThreshold());
preparedStatement.setInt(8, alert.getAlertAccumulation());
preparedStatement.setInt(9, alert.getAlertAccumulationThreshold());
preparedStatement.setInt(10, alert.getAlertReceive());
preparedStatement.setFloat(11, alert.getAlertReceiveThreshold());
preparedStatement.setInt(12, alert.getAlertSchedulingDelay());
preparedStatement.setInt(13, alert.getAlertSchedulingDelayThreshold());
preparedStatement.setInt(14, alert.getAlertProcessing());
preparedStatement.setInt(15, alert.getAlertProcessingThreshold());
preparedStatement.setInt(16, alert.getAlertActiveProcessing());
preparedStatement.setInt(17, alert.getAlertActiveProcessingTimeThreshold());
preparedStatement.setInt(18, alert.getAlertActiveProcessingNumThreshold());
preparedStatement.setInt(19, alert.getAlertInactiveReceivers());
preparedStatement.setInt(20, alert.getAlertInactiveReceiversThreshold());
preparedStatement.setInt(21, alert.getAlertInactiveExecutors());
preparedStatement.setInt(22, alert.getAlertInactiveExecutorsThreshold());
preparedStatement.setInt(23, alert.getAlertError());
preparedStatement.setInt(24, alert.getAlertErrorThreshold());
preparedStatement.setInt(25, alert.getAlertInterval());
preparedStatement.setString(26, alert.getAlertGroup());
resault = preparedStatement.executeUpdate();
preparedStatement.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
try {
connection.close();
} catch (SQLException e) {
LOGGER.error(ExceptionUtils.getFullStackTrace(e));
}
return resault;
}
}
|
[
"[email protected]"
] | |
22dd90a29eb8f233db8e8dd06ecbc1590e2e560c
|
2f0711b26e3e286386f5be037df37547a972ca71
|
/Clase034-Programacion-orientada-objetos-VIII-Construcción-objetos-III/Uso_Empleado/src/uso_empleado/Uso_Empleado.java
|
333827e3df56fc60fc9350d71f6fd587c9b55517
|
[] |
no_license
|
camilo1993/JAVA-8-Fundamentos
|
448c9d1133ae1ce629661db309b82759c40a8485
|
5ac1c413b72c83d3a75925c342c1664060832675
|
refs/heads/master
| 2021-01-25T14:45:35.785256 | 2019-03-02T01:11:37 | 2019-03-02T01:11:37 | 124,296,236 | 1 | 2 | null | 2018-11-13T12:29:40 | 2018-03-07T21:24:04 |
Java
|
UTF-8
|
Java
| false | false | 887 |
java
|
package uso_empleado;
import java.util.*;
public class Uso_Empleado {
public static void main(String[] args) {
}
}
class Empleado {
public Empleado(String nom, double sue, int agno, int mes, int dia) {
nombre = nom;
sueldo = sue;
GregorianCalendar calendario = new GregorianCalendar(agno, mes - 1, dia);
altaContrato = calendario.getTime();
}
public String dameNombre() { //GETTER
return nombre;
}
public double dameSueldo() { //GETTER
return sueldo;
}
public Date dameFechaContrato() { //GETTER
return altaContrato;
}
public void subeSueldo(double porcentaje){ //SETTER
double aumento=sueldo*porcentaje/100;
sueldo+=aumento;
}
private String nombre;
private double sueldo;
private Date altaContrato;
}
|
[
"[email protected]"
] | |
c8cb78255f7ca13a38c6618281cd2e7bc2a54355
|
79145a444140f3599fd437cd6db22f82dd5ef2a5
|
/src/main/java/cn/gdcp/core/po/Category.java
|
b6a831ec49f7fedc17f5bc0d14b642926cb7ca24
|
[] |
no_license
|
CodeLmm/SSMshopV1.0
|
328091f101d0bfda377f012e4784dd12e368330d
|
f361c75677aefef5d14df5a4e3753d3b8358cce0
|
refs/heads/master
| 2022-12-20T20:18:53.178457 | 2019-07-04T06:22:37 | 2019-07-04T06:22:37 | 194,887,754 | 0 | 0 | null | 2022-12-16T03:31:48 | 2019-07-02T15:14:45 |
CSS
|
UTF-8
|
Java
| false | false | 415 |
java
|
package cn.gdcp.core.po;
/**
* 类别
*/
public class Category implements java.io.Serializable{
private int cid;//编号
private String cname;//类别名
public Category(){}
public int getCid() {
return cid;
}
public void setCid(int cid) {
this.cid = cid;
}
public String getCname() {
return cname;
}
public void setCname(String cname) {
this.cname = cname;
}
}
|
[
"good@job"
] |
good@job
|
0124f5eb9d85342310b71411a8554ab6e1e92ad3
|
72e711892734af1a526e690a08a446cad23ae485
|
/Java8/src/thread/CallableDemo.java
|
897de1ce6c70e62032329e7f80da004f538fd2af
|
[] |
no_license
|
paulsagar1a/java-basic
|
6c9fb870a92af4a90bed2bde1899acef02526c63
|
539ea8acf5359a3d3d44cecf14844fcc82af9673
|
refs/heads/master
| 2023-09-04T23:17:41.944894 | 2021-09-25T17:32:05 | 2021-09-25T17:32:05 | 410,339,079 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 903 |
java
|
package thread;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class CallableDemo {
public static void main(String[] args) throws InterruptedException, ExecutionException {
System.out.println("Sumit ask Manik what is the vote percentage.");
ExecutorService executor = Executors.newSingleThreadExecutor();
Future<Integer> result = executor.submit(new CountVotes());
System.out.println("Manik responded with "+result.get());
executor.shutdown();
}
}
class CountVotes implements Callable<Integer> {
@Override
public Integer call() throws Exception {
System.out.println("Manik is counting the votes percentage...");
Thread.sleep(5000);
return (new Random().nextInt(1000)*100)/1000;
}
}
|
[
"[email protected]"
] | |
d16bd232bb6884e7f196369df816ba47ef65d4e3
|
8269936db3f10942537aeae909a45c3962b76f7a
|
/app/src/main/java/com/arao/footballmatches/presentation/view/widget/AdapterLinearLayout.java
|
2b6091c0412a62e1842a457b3ff2a12bf7a1090d
|
[] |
no_license
|
aromeroavila/football-matches
|
eea2fdb24030bfa7938cfc06f8fd86afdffdbb3c
|
60561643699c39205d03ebb08ff6da1524b63bb5
|
refs/heads/master
| 2021-01-10T22:22:40.189404 | 2016-08-13T22:25:15 | 2016-08-13T22:25:15 | 64,539,881 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,729 |
java
|
package com.arao.footballmatches.presentation.view.widget;
import android.content.Context;
import android.database.DataSetObserver;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Adapter;
import android.widget.LinearLayout;
/**
* A linear layout that will contain views taken from an adapter. It differs from the list view in
* the fact that it will not optimize anything and draw all the views from the adapter.
* It also does not provide scrolling.
* <p>
* Extracted from: http://stackoverflow.com/a/24905387
*/
public class AdapterLinearLayout extends LinearLayout {
private Adapter mAdapter;
private DataSetObserver mDataSetObserver = new DataSetObserver() {
@Override
public void onChanged() {
super.onChanged();
reloadChildViews();
}
};
public AdapterLinearLayout(Context context) {
super(context);
}
public AdapterLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public Adapter getAdapter() {
return mAdapter;
}
public void setAdapter(Adapter adapter) {
if (adapter != null) {
mAdapter = adapter;
mAdapter.registerDataSetObserver(mDataSetObserver);
}
reloadChildViews();
}
private void reloadChildViews() {
removeAllViews();
if (mAdapter == null) {
return;
}
int count = mAdapter.getCount();
for (int position = 0; position < count; position++) {
View v = mAdapter.getView(position, null, this);
if (v != null) {
addView(v);
}
}
requestLayout();
}
}
|
[
"[email protected]"
] | |
b08209bc3dba89ec62fab2c908239ba96f230c03
|
91bb18b8fa5f37612d11b8d501cee16323f7e0fc
|
/lametomp3/src/androidTest/java/com/jiangdg/lametomp3/ExampleInstrumentedTest.java
|
eab7d121057b2485d2e2629d6536083a0f2248a9
|
[] |
no_license
|
qinhaoxxx/Lame4Mp3
|
3d96d9f03a49219d27d46a4c797f4a053af5c8e7
|
a5da980ea17969f7b5661a4f4c854ad8006e4af6
|
refs/heads/master
| 2022-01-11T11:23:02.897604 | 2019-05-23T07:39:47 | 2019-05-23T07:39:47 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 751 |
java
|
package com.jiangdg.lametomp3;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.jiangdg.lametomp3.test", appContext.getPackageName());
}
}
|
[
"[email protected]"
] | |
86aed7cf495b9e389b149f646db300da216faa19
|
eef375a887d7473e878bc50e9ce5759bcf614dbc
|
/java/ethan/ethan-ejob/src/test/java/com/anders/ethan/ejob/JobDemo.java
|
679d3d0d5d38b0c1eb1fce88586e9ff66bdbcaf1
|
[] |
no_license
|
luyee/huapuyu
|
e8e0d6b250bb264f7a021c858a24e0b1961adf25
|
851fa0d9f689a7bc38f026b90e720cb3c50f2456
|
refs/heads/master
| 2021-08-29T15:55:23.359891 | 2017-12-14T07:12:24 | 2017-12-14T07:12:24 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,611 |
java
|
package com.anders.ethan.ejob;
import com.dangdang.ddframe.job.config.JobCoreConfiguration;
import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration;
import com.dangdang.ddframe.job.lite.api.JobScheduler;
import com.dangdang.ddframe.job.lite.config.LiteJobConfiguration;
import com.dangdang.ddframe.job.reg.base.CoordinatorRegistryCenter;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
public class JobDemo {
public static void main(String[] args) {
JobCoreConfiguration coreConfig = JobCoreConfiguration.newBuilder("javaSimpleJob", "0 0/1 * * * ?", 3).shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build();
SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(coreConfig, JavaSimpleJob.class.getCanonicalName());
// new JobScheduler(createRegistryCenter(), LiteJobConfiguration.newBuilder(simpleJobConfig).build(), jobEventConfig, new JavaSimpleListener(), new JavaSimpleDistributeListener(1000L, 2000L)).init();
new JobScheduler(createRegistryCenter(), LiteJobConfiguration.newBuilder(simpleJobConfig).build()).init();
// new JobScheduler(createRegistryCenter(), createJobConfiguration()).init();
}
private static CoordinatorRegistryCenter createRegistryCenter() {
CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(new ZookeeperConfiguration("192.168.56.121:2181", "elastic-job-demo"));
regCenter.init();
return regCenter;
}
}
|
[
"[email protected]"
] | |
3002379c21b45758b7d55da4f60713423fa1510b
|
4a0e565eeb06d2af61485234e183573de5808180
|
/src/main/java/br/com/muller/dio/heroesapi/config/HeroesData.java
|
ae6b01bc309105a7e04cd4613f8635a1c7dc8add
|
[] |
no_license
|
muller207/heroesapiwebflux
|
86b9593917fe789eddad61a28b1f1830d5a455fb
|
9a88b71be6b96f1bb8e63fb0d3355e08b7a8776f
|
refs/heads/master
| 2023-04-04T19:50:28.473239 | 2021-04-09T19:34:48 | 2021-04-09T19:34:48 | 344,592,802 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,306 |
java
|
package br.com.muller.dio.heroesapi.config;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
import com.amazonaws.services.dynamodbv2.document.DynamoDB;
import com.amazonaws.services.dynamodbv2.document.Item;
import com.amazonaws.services.dynamodbv2.document.PutItemOutcome;
import com.amazonaws.services.dynamodbv2.document.Table;
import static br.com.muller.dio.heroesapi.constants.HeroesConstants.ENDPOINT_DYNAMO;
import static br.com.muller.dio.heroesapi.constants.HeroesConstants.REGION_DYNAMO;
public class HeroesData {
public static void main(String[] args) {
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(ENDPOINT_DYNAMO, REGION_DYNAMO))
.build();
DynamoDB dynamoDB = new DynamoDB(client);
Table table = dynamoDB.getTable("Heroes_Table");
Item hero = new Item()
.withPrimaryKey("id", "1")
.withString("name","Wonder Woman")
.withString("universe","DC")
.withNumber("films",3);
PutItemOutcome outcome = table.putItem(hero);
}
}
|
[
"[email protected]"
] | |
c63b0cee4cf4f65951f88aa08ed6ecbb8853d210
|
528c376907b188101bc9d9ffc415f5a429d21592
|
/corp-core/src/main/java/net/corp/core/service/helper/OutboundNotification.java
|
7963f3e522dfce4691915b7cdcb9fc05fd077e21
|
[] |
no_license
|
ssj22/corp
|
0ac0f1f9e5aedd4d9a3a68b932aa645fb83a67db
|
89a99ef8d3452d250dca0b3375a10d2ceeabd4f5
|
refs/heads/master
| 2021-01-15T15:50:27.419457 | 2016-09-22T14:43:58 | 2016-09-22T14:43:58 | 22,206,418 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 506 |
java
|
package net.corp.core.service.helper;
import org.apache.log4j.Logger;
import org.smslib.AGateway;
import org.smslib.IOutboundMessageNotification;
import org.smslib.OutboundMessage;
public class OutboundNotification implements IOutboundMessageNotification
{
private static final Logger log = Logger.getLogger(OutboundNotification.class);
public void process(AGateway gateway, OutboundMessage msg)
{
log.debug("Outbound handler called from Gateway: " + gateway.getGatewayId());
log.debug(msg);
}
}
|
[
"[email protected]"
] | |
a610d0fd7654d4256e114334c221cd71523cbd46
|
57ab5ccfc179da80bed6dc6aa1407c2181cee926
|
/co.moviired:digitalContent/src/main/java/co/moviired/digitalcontent/business/src/main/java/co/moviired/digitalcontent/business/domain/src/main/java/co/moviired/digitalcontent/business/domain/repository/IPinHistoryRepository.java
|
e03066bb115b7b9f99463e12ea6444793dac036b
|
[] |
no_license
|
sandys/filtro
|
7190e8e8af7c7b138922c133a7a0ffe9b9b8efa7
|
9494d10444983577a218a2ab2e0bbce374c6484e
|
refs/heads/main
| 2022-12-08T20:46:08.611664 | 2020-09-11T09:26:22 | 2020-09-11T09:26:22 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 688 |
java
|
package co.moviired.digitalcontent.business.domain.repository;
import co.moviired.digitalcontent.business.domain.entity.PinHistory;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.io.Serializable;
import java.util.Optional;
@Repository
public interface IPinHistoryRepository extends CrudRepository<PinHistory, Integer>, Serializable {
@Query("SELECT p FROM PinHistory p WHERE (p.authorizationCode = ?1 OR p.transferId = ?2) AND (p.sendMail = true OR p.sendMail = true)")
Optional<PinHistory> findPin(String authorizationCode, String transferId);
}
|
[
"[email protected]"
] | |
e695d39d949ee62125873b02cc4cd990a61544cc
|
b2e045ec98bb0b23734ce75dfce75d11abdff44d
|
/Week14_TekproPrak/Monopoly/src/com/polban/tekpro/monopoly/gui/BuyHouseDialog.java
|
3bccdfdf9dece211ccb06782523ee833c3aef940
|
[
"MIT"
] |
permissive
|
zharmedia386/ListingJavaProjek
|
930f97c5e7c8d9071b40e0fc79d5722ffb89ff19
|
12bc9312c5a611dbb571708039bcd4bc4cecc9c5
|
refs/heads/main
| 2023-08-07T23:25:09.698083 | 2021-09-09T23:40:39 | 2021-09-09T23:40:39 | 354,790,040 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,869 |
java
|
package com.polban.tekpro.monopoly.gui;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import com.polban.tekpro.monopoly.Player;
public class BuyHouseDialog extends JDialog {
private JComboBox cboMonopoly;
private JComboBox cboNumber;
private Player player;
public BuyHouseDialog(Player player) {
this.player = player;
Container c = this.getContentPane();
c.setLayout(new GridLayout(3, 2));
c.add(new JLabel("Select monopoly"));
c.add(buildMonopolyComboBox());
c.add(new JLabel("Number of houses"));
c.add(buildNumberComboBox());
c.add(buildOKButton());
c.add(buildCancelButton());
c.doLayout();
this.pack();
}
private JButton buildCancelButton() {
JButton btn = new JButton("Cancel");
btn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
cancelClicked();
}
});
return btn;
}
private JComboBox buildMonopolyComboBox() {
cboMonopoly = new JComboBox(player.getMonopolies());
return cboMonopoly;
}
private JComboBox buildNumberComboBox() {
cboNumber = new JComboBox(new Integer[]{
new Integer(1),
new Integer(2),
new Integer(3),
new Integer(4),
new Integer(5)});
return cboNumber;
}
private JButton buildOKButton() {
JButton btn = new JButton("OK");
btn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
okClicked();
}
});
return btn;
}
private void cancelClicked() {
this.dispose();
}
private void okClicked() {
String monopoly = (String)cboMonopoly.getSelectedItem();
int number = cboNumber.getSelectedIndex() + 1;
player.purchaseHouse(monopoly, number);
this.dispose();
}
}
|
[
"[email protected]"
] | |
bcf9f1a0b66245e018851857c764f7db8200da7f
|
180e78725121de49801e34de358c32cf7148b0a2
|
/dataset/protocol1/kylin/learning/7490/ForbiddenException.java
|
08f356864ea9174ec5fcc28de0bff542b6a89cd7
|
[] |
no_license
|
ASSERT-KTH/synthetic-checkstyle-error-dataset
|
40e8d1e0a7ebe7f7711def96a390891a6922f7bd
|
40c057e1669584bfc6fecf789b5b2854660222f3
|
refs/heads/master
| 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,304 |
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kylin.rest .exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
* @author xduo
*
*/
@ResponseStatus(value = HttpStatus.FORBIDDEN)
public class ForbiddenException extends RuntimeException {
private static final long serialVersionUID = 2741885728370162194L;
public ForbiddenException() {
super();
}
public ForbiddenException(String message) {
super(message);
}
}
|
[
"[email protected]"
] | |
a2b4e4dd359f014a7060da4476698465948f073d
|
c47b8f2a65982602085d9943d1007a4120ec7595
|
/src/main/java/ocp/java_class_design/polimorfism/Main.java
|
b7db7bfeb7314df02a669b9156ac7eb8d1bc78ed
|
[] |
no_license
|
iancesar/ocp-8
|
11d3c4f221c5cff2e00f0344e5a5f9b9b00c9970
|
588158f4afcef86b5da5f1eea0d9af365b2b794a
|
refs/heads/master
| 2023-01-20T23:16:54.224017 | 2020-12-04T10:02:59 | 2020-12-04T10:02:59 | 259,385,221 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 306 |
java
|
package ocp.java_class_design.polimorfism;
import ocp.java_class_design.polimorfism.sub.AnotherSubType;
public class Main {
public static void main(String[] args) {
SuperType s1 = new SubType();
SuperType s2 = new AnotherSubType();
s1.print();
s2.print();
}
}
|
[
"[email protected]"
] | |
ccbc6f5d3b91f32a09febfce095978d7e2da737a
|
2bc7531416225214bc12642e3e23715c2f978463
|
/projetoIV/src/br/faccamp/oficina/teste/BarraProgressoController.java
|
36afbfe96fe2e76d4e401e6ee9c247e4ee46403b
|
[] |
no_license
|
renansds/projeto
|
eaa8605192a1e8a7a2ff4c1ab0ef5e59764511c5
|
f8703542157212cc1cc2904d6b2e5706439c6a0d
|
refs/heads/master
| 2021-07-13T07:27:02.269744 | 2017-10-16T23:29:15 | 2017-10-16T23:29:15 | 104,290,275 | 0 | 0 | null | null | null | null |
ISO-8859-1
|
Java
| false | false | 2,690 |
java
|
package br.faccamp.oficina.teste;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.TextField;
public class BarraProgressoController implements Initializable {
@FXML
private Label status;
@FXML
private ProgressBar barra;
@FXML
private ProgressIndicator indicador;
@FXML
private Button btnCarrega;
@Override
public void initialize(URL url, ResourceBundle bundle) {
btnCarrega.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Implementar logica para conectar ao banco ! ");
}
});
btnCarrega.setOnAction((ActionEvent acao) -> {
//criando um classe anônima Service que cria uma Task que também é anônima
//a classe Service serve para gerenciar threads em JavaFX
Service<Void> servico = new Service() {
@Override
protected Task createTask() {
return new Task() {
@Override
protected Void call() throws Exception {
//Task tem duas property interessantes para usar junto a um ProgressBar
//a messageProperty, que pode ser ligada a outra StringProperty
//para transmitir uma mensagem,
//e a progressProperty, que serve para mandar valores númericos a uma
//ProgressBar ou ProgressIndicator
Thread.sleep(300);
updateProgress(1, 10);
for (int i = 0; i <= 10; i++) {
updateProgress(i + 1, 10);
updateMessage(i * 10 + "%");
Thread.sleep(300);
}
return null;
}
};
}
};
//fazendo o bind (ligando) nas proprety
status.textProperty().bind(servico.messageProperty());
barra.progressProperty().bind(servico.progressProperty());
//precisa inicializar o Service
servico.restart();
});
}
}
|
[
"[email protected]"
] | |
995bac8c7f2f3d82cf124701ea234eb9b6b34f2a
|
f36a627feca575838d572c0660395cab40e634b4
|
/backend/src/main/java/crud/crud_core/datasource/UtilsSQLite.java
|
9148a0d2dbe6f4ca5fc80d53a15ea31077a5346d
|
[] |
no_license
|
fjblesa/PocMicro
|
4f3a13cb24cc99d1ffd53efb830e825484dbb33b
|
dccf7ffd0707d4b4475b5f78ff105db2a6b514c4
|
refs/heads/master
| 2020-09-21T12:44:31.082703 | 2016-08-31T08:59:06 | 2016-08-31T08:59:06 | 66,535,197 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,841 |
java
|
package crud.crud_core.datasource;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.UUID;
import org.sqlite.SQLiteConfig;
import crud.crud_core.exceptions.BusinessException;
import crud.crud_core.exceptions.PersistenceException;
import crud.crud_core.issues.DuplicatedKeyIssue;
import crud.crud_core.issues.ForeignKeyIssue;
import crud.crud_core.issues.GenericIssue;
import crud.crud_core.issues.Issue;
public class UtilsSQLite {
private static Connection connection;
public static Integer executeUpdateOrInsertOrDelete(String sql) {
init();
try {
Statement stmt = connection.createStatement();
return stmt.executeUpdate(sql);// devuelve las filas afectadas
} catch (SQLException e) {
if (e.getMessage().contains("UNIQUE")) {
String[] message = e.getMessage().split(":");
String entityField = message[1];
String field = entityField.split("\\.")[1];
List<Issue> issues = new ArrayList<Issue>();
Issue issue = new DuplicatedKeyIssue(field);
issues.add(issue);
throw new PersistenceException(issues);
}else if(e.getMessage().contains("FOREIGN KEY")){
List<Issue> issues = new ArrayList<Issue>();
Issue issue = new ForeignKeyIssue();
issues.add(issue);
throw new PersistenceException(issues);
}
List<Issue> issues = new ArrayList<Issue>();
Issue issue = new GenericIssue(null);
issues.add(issue);
throw new BusinessException(issues);
} finally {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
List<Issue> issues = new ArrayList<Issue>();
Issue issue = null;
issues.add(issue);
throw new PersistenceException(issues);
}
}
}
public static JsonArray executeQuery(String sql) {
init();
try {
Statement stmt = connection.createStatement();
ResultSet resultDB = stmt.executeQuery(sql);
JsonArray jsonDB = new JsonArray();
while (resultDB.next()) {
JsonObject jsonElement = new JsonObject();
for (int i = 1; i <= resultDB.getMetaData().getColumnCount(); i++) {
jsonElement.put(resultDB.getMetaData().getColumnName(i)
.toLowerCase(), resultDB.getObject(i));
}
jsonDB.add(jsonElement);
}
return jsonDB;
} catch (SQLException e) {
e.printStackTrace();
List<Issue> issues = new ArrayList<Issue>();
throw new PersistenceException(issues);
} finally {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
List<Issue> issues = new ArrayList<Issue>();
throw new PersistenceException(issues);
}
}
}
public static JsonArray executeQuery(String sql, Object... vars) {
init();
try {
PreparedStatement stmt = connection.prepareStatement(sql);
for (int i = 0; i < vars.length; i++) {
if (vars[i] instanceof String) {
stmt.setString(i + 1, (String) vars[i]);
} else if (vars[i] instanceof Integer) {
stmt.setInt(i + 1, (int) vars[i]);
} else if (vars[i] instanceof UUID) {
stmt.setString(i + 1, vars[i].toString());
} else if (vars[i] instanceof Boolean) {
stmt.setString(i + 1, String.valueOf(vars[i]));
} else {
stmt.setObject(i + 1, vars[i]);
}
}
ResultSet resultDB = stmt.executeQuery();
JsonArray jsonDB = new JsonArray();
while (resultDB.next()) {
JsonObject jsonElement = new JsonObject();
for (int i = 1; i <= resultDB.getMetaData().getColumnCount(); i++) {
jsonElement.put(resultDB.getMetaData().getColumnName(i)
.toLowerCase(), resultDB.getObject(i));
}
jsonDB.add(jsonElement);
}
return jsonDB;
} catch (SQLException e) {
e.printStackTrace();
List<Issue> issues = new ArrayList<Issue>();
throw new PersistenceException(issues);
} finally {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
List<Issue> issues = new ArrayList<Issue>();
throw new PersistenceException(issues);
}
}
}
private static void init() {
try {
Class.forName("org.sqlite.JDBC");
Properties connectionProperties = new Properties();
SQLiteConfig config = new SQLiteConfig();
config.enforceForeignKeys(true);
connectionProperties = config.toProperties();
connection = DriverManager.getConnection("jdbc:sqlite:test.db",
connectionProperties);
} catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
System.exit(0);
}
}
}
|
[
"[email protected]"
] | |
7fd1f30b646373bc0e1244a6e80eb8b56821a7c3
|
512eaec99ceba66eafd09ff21be2e17af2f37dc9
|
/Server/sdc2ch.root-prod/sdc-2ch-web/sdc-2ch-web-repository/src/main/java/com/sdc2ch/web/admin/repo/domain/T_MOBILE_APP_USE_INFO.java
|
15071b9dfe2e320bb8b1fc0038ea700191e3fe0d
|
[] |
no_license
|
VAIPfoundation/logis2ch
|
8ce48f90f928021c9c944b88b7a55c52d6e6fc67
|
2b0ce4e8d4edd28971d96fedcdbf219fcc276f03
|
refs/heads/master
| 2023-03-06T17:15:02.840903 | 2021-02-24T13:00:08 | 2021-02-24T13:00:08 | 341,898,312 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,739 |
java
|
package com.sdc2ch.web.admin.repo.domain;
import static com.sdc2ch.require.repo.schema.GTConfig.MIDDLE_CONTENTS_LNG_300;
import static com.sdc2ch.require.repo.schema.GTConfig.SHOT_CONTENTS_LNG_100;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import com.sdc2ch.repo.io.MobileApkInfoIO;
import com.sdc2ch.repo.io.MobileAppInfoIO;
import com.sdc2ch.repo.io.TosIO;
import com.sdc2ch.require.repo.T_ID;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Entity
@Getter
@Setter
@ToString
public class T_MOBILE_APP_USE_INFO extends T_ID implements MobileAppInfoIO {
@Column(name = "USER_DETAIL_FK")
private String userId;
@Column(name = "MOBILE_OS_NAME")
private String osName;
@Column(name = "MOBILE_OS_VER")
private String osVer;
@Column(name = "MOBILE_MODEL", columnDefinition = SHOT_CONTENTS_LNG_100)
private String model;
@Column(name = "MOBILE_TELCO", columnDefinition = SHOT_CONTENTS_LNG_100)
private String telCo;
@Column(name = "MOBILE_APP_TOKEN", columnDefinition = MIDDLE_CONTENTS_LNG_300)
private String appTkn;
@Column(name = "MOBILE_APP_TOKEN_VALID")
private boolean validTkn;
@ManyToOne(targetEntity = T_MOBILE_APK_INFO.class)
@JoinColumn(name = "APP_INFO_FK")
private MobileApkInfoIO apk;
@ManyToMany(cascade = {CascadeType.MERGE}, fetch = FetchType.EAGER, targetEntity = T_TOS.class)
@JoinTable(name = "T_MOBILE_APP_USE_INFO_TOS_MAP")
private List<TosIO> tosses = new ArrayList<>();
}
|
[
"[email protected]"
] | |
30d7c59da2be1b01e371058aac0d528054d8923a
|
fb75bddea59c77a0049f10f25e7d3c2a8e568dd7
|
/Simula15Loom/src/simulaTestBatch/simtst106$$simtst106$PBLK76$scan.java
|
518e7f8c6a686ba00cd13012149cc0f96015cdb4
|
[] |
no_license
|
MyhreAndersen/Simula15Loom
|
218d3eeb636efd9dbb7fb49da0e5b00a395f7a8b
|
b031c7a3db98b3368a05942bc0eb10bb0aec5442
|
refs/heads/master
| 2023-04-05T03:40:51.513771 | 2021-04-03T11:13:40 | 2021-04-03T11:13:40 | 250,255,246 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 953 |
java
|
package simulaTestBatch;
// Simula-2.0 Compiled at Sun Jan 31 10:26:03 CET 2021
import simula.runtime.*;
@SuppressWarnings("unchecked")
public final class simtst106$$simtst106$PBLK76$scan extends PROC$ {
public simtst106$$simtst106$PBLK76$scan(RTObject$ SL$) {
super(SL$);
BBLK();
STM$();
}
public simtst106$$simtst106$PBLK76$scan STM$() {
((simtst106$PBLK76)(CUR$.SL$)).ch$2=((simtst106$)(CUR$.SL$.SL$)).inspect$20$0.inchar();
while((((simtst106$PBLK76)(CUR$.SL$)).ch$2==(((char)32)))) {
;
((simtst106$PBLK76)(CUR$.SL$)).ch$2=((simtst106$)(CUR$.SL$.SL$)).inspect$20$0.inchar();
}
((simtst106$)(CUR$.SL$.SL$)).inspect$20$0.setpos(Math.subtractExact(((simtst106$)(CUR$.SL$.SL$)).inspect$20$0.pos(),1));
;
EBLK();
return(this);
}
public static PROGINFO$ INFO$=new PROGINFO$("simtst106.sim","Procedure scan",1,142,18,144,23,145);
}
|
[
"[email protected]"
] | |
eb87a114a9c4d0e73096ebf65a02287dc7d2cb64
|
ce7837761c0815bf54e43309a0bb2e9cedfec1d9
|
/src/caches/Simulator.java
|
f223006ae4721795a53c9f3663a048c2eebd1fa8
|
[] |
no_license
|
jayCool/CacheMiss-Simulation
|
a5022491da4e4a756a9afe73d0ddaf435b127ee0
|
afaba806e0817befea6bddfaaf96de357d89e9db
|
refs/heads/master
| 2020-04-25T14:13:28.970425 | 2019-03-05T03:11:40 | 2019-03-05T03:11:40 | 172,834,055 | 1 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 19,194 |
java
|
package caches;
/*
* 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.
*/
import caches.implementations.ARCCache;
import caches.implementations.FIFOCache;
import caches.implementations.HDDCache;
import caches.implementations.LRFUCache;
import caches.implementations.LRUCache;
import caches.implementations.RandomCache;
import caches.implementations.SSDCache;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
/**
*
* @author ZhangJiangwei
*/
public class Simulator {
Random rand = new Random();
public double expo_factor = 0.2;
public int nodeTransTime = 1;
int poolDelay = 10;
public long serial_id = 0;
int proc_time = 1;
public double[] misses;
int batchFrequency;
String outputDir;
String config = "";
ArrayList<HDDCache> hddCaches = new ArrayList<>();
/**
* Initialize the simulator with config file.
*
* @param config
*/
Simulator(String config) {
this.config = config;
}
public void run() {
HashMap<Integer, Queue<String>> workloads = new HashMap<>();
HashMap<Integer, Cache> cacheMaps = new HashMap<>();
HashMap<Integer, Cache> clientCaches = new HashMap<>();
loadConfiguration(config, workloads, cacheMaps, clientCaches);
HashMap<Integer, ReferencePattern> clientRequests = new HashMap<>();
Clock clock = new Clock();
while (nonEmptyWorkload(workloads.values()) || unResolvedRequests(clientRequests, clock)) {
retriveWorkLoads(cacheMaps, workloads, clock, clientCaches, clientRequests);
processRequest(cacheMaps, clock, clientRequests, clientCaches);
clock.forwardTime();
//System.out.println(clock.currentTime);
}
misses = new double[cacheMaps.size()];
System.out.println("Simulation result:");
for (Entry<Integer, Cache> cache : cacheMaps.entrySet()) {
misses[cache.getKey()] = 1.0 * cache.getValue().totalMissed / cache.getValue().totalReceived;
// System.out.println("cache: " + cache.getKey() + " : " + cache.getValue().totalReceived + " " + cache.getValue().cacheSize);
}
for (int i = 0; i < misses.length; i++){
System.out.println("cache " + i + " :" + misses[i]);
}
System.out.println();
}
/**
* Check if all workloads are consumed.
*
* @param workloads
* @return whether all workloads are consumed
*/
private boolean nonEmptyWorkload(Collection<Queue<String>> workloads) {
for (Queue queue : workloads) {
if (queue.size() > 0) {
return true;
}
}
return false;
}
int exponentialTime(double lambda) {
return (int) Math.round(Math.log(1 - rand.nextDouble()) / (-lambda));
}
/**
* Check if the eventlist for a cache is empty.
* @param cache
* @return whether the eventlist is empty
*/
private boolean isEmptyEvent(Cache cache) {
if (cache.eventList.isEmpty()) {
return true;
}
return false;
}
/**
* retrieve workload objects for each client cache.
*
* @param cacheMaps
* @param workLoads
* @param clock
* @param clientCaches
* @param client_requests
*/
private void retriveWorkLoads(HashMap<Integer, Cache> cacheMaps, HashMap<Integer, Queue<String>> workLoads,
Clock clock, HashMap<Integer, Cache> clientCaches, HashMap<Integer, ReferencePattern> client_requests) {
for (int cacheID : clientCaches.keySet()) {
Cache cache = cacheMaps.get(cacheID);
//System.out.println(client_requests.get(cacheID));
if (workLoads.get(cacheID).size() > 0 &&
(
(client_requests.get(cacheID) != null && client_requests.get(cacheID).getStatus() == CacheStatus.PROCESSED
&& clock.getCurrentTime() >= client_requests.get(cacheID).getTimestamp())
|| client_requests.get(cacheID) == null)) {
//calculate the detla time that the current object needs to wait
int deltaTime = this.exponentialTime(this.expo_factor) + 1;
String line = workLoads.get(cacheID).poll();
String[] splits = line.split("\\s+");
//calculate the object size, default 1
int objSize = 1;
if (splits.length > 1) {
objSize = Integer.parseInt(splits[1]);
}
ReferencePattern rp = new ReferencePattern(cacheID, clock.getCurrentTime() + deltaTime,
splits[0], this.serial_id, objSize);
//rp.setChildID(cacheID);
ReferencePattern client_rp = new ReferencePattern(cacheID, clock.getCurrentTime(),
rp.object, this.serial_id, objSize);
//client_rp.setChildID(cacheID);
client_requests.put(cacheID, client_rp);
this.serial_id++;
cache.eventList.add(rp);
//object in the cache queue might be process later than it was retrieved.
}
}
}
/**
* Process each request
* @param cacheMaps
* @param clock
* @param clientRequests
* @param clientCaches
*/
private void processRequest(HashMap<Integer, Cache> cacheMaps, Clock clock,
HashMap<Integer, ReferencePattern> clientRequests, HashMap<Integer, Cache> clientCaches) {
//check for batch updates for hdd caches
if (!this.hddCaches.isEmpty()) {
for (HDDCache cache : hddCaches) {
cache.calculateEvictedObjects();
ArrayList<String> evictedObjects = cache.getEvictedBatchObjectes();
ArrayList<Integer> evictedObjectSizes = cache.getEvictedBatchObjectSizes();
for (Iterator<Cache> it = clientCaches.values().iterator(); it.hasNext();) {
SSDCache clientCache = (SSDCache) it.next();
if (clientCache.getParent().getCacheID() == (cache.getCacheID())) {
clientCache.batchUpdateObjects(evictedObjects, evictedObjectSizes, clock.getCurrentTime());
}
}
}
}
for (Entry<Integer, Cache> entry : cacheMaps.entrySet()) {
Cache cache = entry.getValue();
//System.out.println(cache.eventList);
if (!isEmptyEvent(cache)) {
if (cache.eventList.peek().getTimestamp() <= clock.getCurrentTime()) {
ArrayList<ReferencePattern> processed = new ArrayList<>();
for (ReferencePattern rp : cache.eventList) {
if (rp.getTimestamp() <= clock.currentTime) {
switch (rp.getStatus()) {
case CacheStatus.NULL:
//System.out.println("processing request!");
nonProcessedPR(rp, clock, cache, cacheMaps, processed, clientRequests);
break;
case CacheStatus.PROCESSED:
processedRP(rp, clock, cache, cacheMaps, processed, clientRequests);
break;
default:
break;
}
}
}
for (ReferencePattern rp : processed) {
cache.eventList.remove(rp);
}
}
}
}
}
/**
* Process the rp when it is not cache yet.
* @param rp
* @param clock
* @param cache
* @param cacheMaps
* @param processed
* @param client_requests
*/
private void nonProcessedPR(ReferencePattern rp, Clock clock, Cache cache,
HashMap<Integer, Cache> cacheMaps, ArrayList<ReferencePattern> processed,
HashMap<Integer,ReferencePattern> client_requests) {
cache.addReceivedObject(rp.getObjSize());
//If the object is contained in the cache
if (cache.contains(rp.getObject())) {
rp.setHitNode(cache.getCacheID());
if (cache.getCacheStrategy() != CacheStrategy.MCD) {
cache.add(rp.getObject(), clock.currentTime, rp.getObjSize());
} else if (rp.getChildID() >= 0) {
cache.remove(rp.getObject());
}
passEventToChild(cacheMaps, rp, clock, client_requests);
processed.add(rp);
return;
}
// not containing the object, forward to the parent node
else if (cache.getParent() == null) {
requestFromPool(rp, clock, cache);
} else {
forwardRequestToParent(cache, rp, clock, CacheStatus.WAITING);
}
}
/**
* Pass the processed reference to the child cache.
* @param rp
* @param clock
* @param cache
* @param cacheMaps
* @param processed
* @param client_requests
*/
private void processedRP(ReferencePattern rp, Clock clock, Cache cache, HashMap<Integer, Cache> cacheMaps,
ArrayList<ReferencePattern> processed, HashMap<Integer, ReferencePattern> client_requests) {
//String evictionObject = "";
switch (cache.getCacheStrategy()){
case CacheStrategy.LCE:case CacheStrategy.SSDHDD:
cache.add(rp.getObject(), clock.currentTime, rp.getObjSize());
break;
case CacheStrategy.LCD : case CacheStrategy.MCD:
if (rp.getParent_id() == rp.getHitNode()){
cache.add(rp.getObject(), clock.currentTime, rp.getObjSize());
}
break;
}
passEventToChild(cacheMaps, rp, clock, client_requests);
processed.add(rp);
}
/**
* Pass the hit object event to the children cache.
* @param cacheMaps
* @param rp
* @param clock
* @param client_requests
*/
private void passEventToChild(HashMap<Integer, Cache> cacheMaps, ReferencePattern rp, Clock clock,
HashMap<Integer,ReferencePattern> client_requests) {
//if there is not child cache
if (rp.getChildID() < 0) {
int client_id = rp.getNode_id();
client_requests.get(client_id).setStatus(CacheStatus.PROCESSED);
client_requests.get(client_id).setTimestamp(clock.currentTime + this.proc_time + this.nodeTransTime);
return;
}
//move to the child cache, and update the status of the reference pattern.
for (ReferencePattern preRP : cacheMaps.get(rp.getChildID()).eventList) {
if (preRP.getObject_id() == rp.getObject_id()) {
preRP.setTimestamp(clock.currentTime + this.proc_time + this.nodeTransTime);
preRP.setStatus(CacheStatus.PROCESSED);
preRP.setParent_id(rp.getNode_id());
preRP.setHitNode(rp.getHitNode());
break;
}
}
}
/**
* Check if there are client caches that is not resolved yet.
*
* @param client_requests
* @param clock
* @return whether there are un-resolved requests
*/
private boolean unResolvedRequests(HashMap<Integer, ReferencePattern> client_requests, Clock clock) {
boolean unsolved = false;
for (ReferencePattern rp : client_requests.values()) {
if (rp != null && (rp.getStatus() != CacheStatus.PROCESSED || rp.getTimestamp() >= clock.currentTime)) {
unsolved = true;
}
}
return unsolved;
}
/**
* Request the object from the root (Pool).
* @param rp
* @param clock
* @param cache
*/
private void requestFromPool(ReferencePattern rp, Clock clock, Cache cache) {
rp.setTimestamp(clock.currentTime + this.proc_time + this.poolDelay);
rp.setStatus(CacheStatus.PROCESSED);
rp.setHitNode(-1);
rp.setParent_id(-1);
cache.addMissedCount(rp.getObjSize());
}
/**
* Forward the object to the parent for content retrieval
* @param cache
* @param rp
* @param clock
* @param status
*/
private void forwardRequestToParent(Cache cache, ReferencePattern rp, Clock clock, int status) {
Cache parentCache = cache.getParent();
ReferencePattern newRp = new ReferencePattern(parentCache.getCacheID(), clock.currentTime + this.proc_time + this.nodeTransTime, rp.getObject(), rp.getObject_id(), rp.getObjSize());
newRp.setChildID(cache.getCacheID());
parentCache.eventList.add(newRp);
rp.setStatus(status);
if (status == 1) {
cache.addMissedCount(newRp.getObjSize());
}
}
/**
* load cache and workload information.
*
* @param config
* @param workloads
* @param cacheMaps
* @param clientCaches
*/
private void loadConfiguration(String config, HashMap<Integer, Queue<String>> workloads, HashMap<Integer, Cache> cacheMaps, HashMap<Integer, Cache> clientCaches) {
HashMap<Integer, Integer> parentMap = new HashMap<>();
try {
JSONParser parser = new JSONParser();
Object obj = parser.parse(new FileReader(config));
JSONObject jsonObject = (JSONObject) obj;
JSONArray clients = (JSONArray) jsonObject.get("clients");
for (Object object : clients) {
JSONObject client = (JSONObject) object;
int id = Integer.parseInt((String) client.get("id"));
int cacheSize = Integer.parseInt((String) client.get("cacheSize"));
int cacheType = Integer.parseInt((String) client.get("cacheType"));
Cache newCache = initializeCache(cacheSize, id, cacheType);
if (cacheType == CacheType.HDD) {
HDDCache hddCache = (HDDCache) newCache;
hddCache.setBatchFrequency(this.batchFrequency);
hddCaches.add(hddCache);
}
if (client.get("cacheStrategy") != null) {
newCache.setCacheStrategy(Integer.parseInt((String) client.get("cacheStrategy")));
}
if (client.get("missRatioOption") != null) {
newCache.setMissRatioOption(Integer.parseInt((String) client.get("missRatioOption")));
}
if (client.get("warmingFile") != null) {
String objectAddress = (String) client.get("warmingFile");
warmingCache(newCache, objectAddress);
}
if (client.get("parent") != null) {
parentMap.put(id, Integer.parseInt((String) client.get("parent")));
}
if (client.get("inputWorkloadAddress") != null) {
workloads.put(id, (Queue<String>) loadWorkLoadFromFile((String) client.get("inputWorkloadAddress")));
clientCaches.put(id, newCache);
}
cacheMaps.put(id, newCache);
}
for (Entry<Integer, Integer> entry : parentMap.entrySet()) {
int childID = entry.getKey();
int parentID = entry.getValue();
cacheMaps.get(childID).addParent(cacheMaps.get(parentID));
cacheMaps.get(parentID).addChild(cacheMaps.get(childID));
}
} catch (IOException ex) {
Logger.getLogger(Simulator.class.getName()).log(Level.SEVERE, null, ex);
} catch (ParseException ex) {
Logger.getLogger(Simulator.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* Load the workload objects from file
*
* @param file
* @return queue of workload objects
*/
public Queue<String> loadWorkLoadFromFile(String file) {
Queue<String> result = new LinkedList<>();
try {
Scanner scanner = new Scanner(new File(file));
while (scanner.hasNext()) {
result.add(scanner.nextLine().trim());
}
scanner.close();
} catch (FileNotFoundException ex) {
}
return result;
}
/**
* Warming the cache by pre-loading objects.
*
* @param newCache
* @param objectAddress
*/
private void warmingCache(Cache newCache, String objectAddress) {
try {
Scanner scanner = new Scanner(new File(objectAddress));
while (scanner.hasNext()) {
String[] splits = scanner.nextLine().split("\\s+");
if (splits.length > 1) {
newCache.add(splits[0], 0, Integer.parseInt(splits[1]));
} else {
newCache.add(splits[0], 0, 1);
}
if (newCache.isCacheFull()) {
break;
}
}
scanner.close();
//newCache.setCacheFull(true);
} catch (FileNotFoundException ex) {
Logger.getLogger(Simulator.class.getName()).log(Level.SEVERE, null, ex);
}
}
private Cache initializeCache(int cacheSize, int id, int cacheType) {
switch (cacheType) {
case CacheType.ARC:
return new ARCCache(cacheSize, id, cacheType);
case CacheType.FIFO:
return new FIFOCache(cacheSize, id, cacheType);
case CacheType.HDD:
return new HDDCache(cacheSize, id, cacheType);
case CacheType.LRFU:
return new LRFUCache(cacheSize, id, cacheType);
case CacheType.LRU:
return new LRUCache(cacheSize, id, cacheType);
case CacheType.RANDOM:
return new RandomCache(cacheSize, id, cacheType);
case CacheType.SSD:
return new SSDCache(cacheSize, id, cacheType);
}
System.out.println("Invalid Cache Type Define!!!");
System.exit(-1);
return null;
}
}
|
[
"[email protected]"
] | |
55702779477953ce4e8ffd0c2ab55a46975d6fef
|
053ff5fca60d29d70d62d0ca58b1130a38b9dc66
|
/bundles/tools.vitruv.applications.pcmjava.linkingintegration.change2command/src-gen/mir/routines/packageMappingIntegration/CreateRequiredRoleRoutine.java
|
659c28445439e563a2e79e52558d1fcdc7f2b7f2
|
[] |
no_license
|
vitruv-tools/Vitruv-Applications-PCMJavaAdditionals
|
d616ac31fc3a65947ec5f65ace3bef67f7ef0cd1
|
9bb3453041222ce719dc4457813ad773eb755258
|
refs/heads/master
| 2023-02-18T22:25:37.872985 | 2021-01-21T07:57:33 | 2021-01-21T07:57:33 | 74,758,487 | 0 | 1 | null | 2020-12-04T15:47:23 | 2016-11-25T12:55:49 |
Java
|
UTF-8
|
Java
| false | false | 4,459 |
java
|
package mir.routines.packageMappingIntegration;
import java.io.IOException;
import mir.routines.packageMappingIntegration.RoutinesFacade;
import org.eclipse.emf.ecore.EObject;
import org.emftext.language.java.members.Field;
import org.palladiosimulator.pcm.repository.BasicComponent;
import org.palladiosimulator.pcm.repository.OperationInterface;
import org.palladiosimulator.pcm.repository.OperationRequiredRole;
import tools.vitruv.extensions.dslsruntime.reactions.AbstractRepairRoutineRealization;
import tools.vitruv.extensions.dslsruntime.reactions.ReactionExecutionState;
import tools.vitruv.extensions.dslsruntime.reactions.structure.CallHierarchyHaving;
import tools.vitruv.framework.userinteraction.UserInteractionOptions;
import tools.vitruv.framework.userinteraction.builder.NotificationInteractionBuilder;
@SuppressWarnings("all")
public class CreateRequiredRoleRoutine extends AbstractRepairRoutineRealization {
private CreateRequiredRoleRoutine.ActionUserExecution userExecution;
private static class ActionUserExecution extends AbstractRepairRoutineRealization.UserExecution {
public ActionUserExecution(final ReactionExecutionState reactionExecutionState, final CallHierarchyHaving calledBy) {
super(reactionExecutionState);
}
public EObject getElement1(final BasicComponent basicComponent, final OperationInterface opInterface, final Field field, final OperationRequiredRole opRequiredRole) {
return opRequiredRole;
}
public void update0Element(final BasicComponent basicComponent, final OperationInterface opInterface, final Field field, final OperationRequiredRole opRequiredRole) {
opRequiredRole.setRequiredInterface__OperationRequiredRole(opInterface);
opRequiredRole.setRequiringEntity_RequiredRole(basicComponent);
NotificationInteractionBuilder _notificationDialogBuilder = this.userInteractor.getNotificationDialogBuilder();
String _entityName = basicComponent.getEntityName();
String _plus = ("Create OperationRequiredRole between Component " + _entityName);
String _plus_1 = (_plus + " and Interface ");
String _entityName_1 = opInterface.getEntityName();
String _plus_2 = (_plus_1 + _entityName_1);
_notificationDialogBuilder.message(_plus_2).windowModality(UserInteractionOptions.WindowModality.MODAL).startInteraction();
}
public EObject getElement2(final BasicComponent basicComponent, final OperationInterface opInterface, final Field field, final OperationRequiredRole opRequiredRole) {
return field;
}
public EObject getElement3(final BasicComponent basicComponent, final OperationInterface opInterface, final Field field, final OperationRequiredRole opRequiredRole) {
return opRequiredRole;
}
}
public CreateRequiredRoleRoutine(final RoutinesFacade routinesFacade, final ReactionExecutionState reactionExecutionState, final CallHierarchyHaving calledBy, final BasicComponent basicComponent, final OperationInterface opInterface, final Field field) {
super(routinesFacade, reactionExecutionState, calledBy);
this.userExecution = new mir.routines.packageMappingIntegration.CreateRequiredRoleRoutine.ActionUserExecution(getExecutionState(), this);
this.basicComponent = basicComponent;this.opInterface = opInterface;this.field = field;
}
private BasicComponent basicComponent;
private OperationInterface opInterface;
private Field field;
protected boolean executeRoutine() throws IOException {
getLogger().debug("Called routine CreateRequiredRoleRoutine with input:");
getLogger().debug(" basicComponent: " + this.basicComponent);
getLogger().debug(" opInterface: " + this.opInterface);
getLogger().debug(" field: " + this.field);
org.palladiosimulator.pcm.repository.OperationRequiredRole opRequiredRole = org.palladiosimulator.pcm.repository.impl.RepositoryFactoryImpl.eINSTANCE.createOperationRequiredRole();
notifyObjectCreated(opRequiredRole);
addCorrespondenceBetween(userExecution.getElement1(basicComponent, opInterface, field, opRequiredRole), userExecution.getElement2(basicComponent, opInterface, field, opRequiredRole), "");
// val updatedElement userExecution.getElement3(basicComponent, opInterface, field, opRequiredRole);
userExecution.update0Element(basicComponent, opInterface, field, opRequiredRole);
postprocessElements();
return true;
}
}
|
[
"[email protected]"
] | |
ebf8be3f0fcd90c1f1213825815a0f4bb2c2eb99
|
501868d5166a9b22bbf9903224af49c7d6298724
|
/SearchService/src/main/java/com/revature/mapper/RoomNumberRowMapper.java
|
68d74d66c0cf1199a002ab271c3959e05afb194e
|
[] |
no_license
|
2102Mule-Nick/iyad_shobaki_p1
|
1bfcd5fe266e63e6fa60675a22676ca745ef11d3
|
c792a0a646f3d0e7e79da8922fd65988e6d16f19
|
refs/heads/main
| 2023-03-30T22:33:00.561800 | 2021-04-10T07:22:24 | 2021-04-10T07:22:24 | 349,142,712 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 656 |
java
|
package com.revature.mapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
@Component
public class RoomNumberRowMapper implements RowMapper<String> {
private RoomNumberExtractor roomNumberExtractor;
@Autowired
public void setRoomNumberExtractor(RoomNumberExtractor roomNumberExtractor) {
this.roomNumberExtractor = roomNumberExtractor;
}
@Override
public String mapRow(ResultSet rs, int rowNum) throws SQLException {
return roomNumberExtractor.extractData(rs);
}
}
|
[
"[email protected]"
] | |
37db0109c38dde767d69e14aaeea97aeed495f70
|
dc888b42a4b6e0db67bb5d2a779f32ad17f77ed3
|
/JPA with Hibernate Lab Book/JpaLab2/src/com/cg/iter/entities/Author.java
|
5216455eb444dfb72df56c68b85081420a461118
|
[] |
no_license
|
abhishekdas1000/LabBook
|
50450c4b0f9d9191af65dfadc76c678250ba2416
|
65d0577f0681beec4531090d6ca79b6c6cf61be1
|
refs/heads/master
| 2022-12-23T08:48:23.234230 | 2020-05-02T07:52:53 | 2020-05-02T07:52:53 | 241,570,922 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,270 |
java
|
package com.cg.iter.entities;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity
@Table(name="Author")
public class Author {
@Id
private long authorId;
private String authorName;
@ManyToMany(targetEntity=Book.class)
private List<Book> bookList = new ArrayList<>();
public Author() {
super();
}
public Author(long authorId, String authorName, List<Book> bookList) {
super();
this.authorId = authorId;
this.authorName = authorName;
this.bookList = bookList;
}
public long getAuthorId() {
return authorId;
}
public void setAuthorId(long authorId) {
this.authorId = authorId;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public List<Book> getBookList() {
return bookList;
}
public void setBookList(List<Book> bookList2) {
this.bookList=bookList2;
}
}
|
[
"[email protected]"
] | |
bb1d8c32b0d776f47b3aaa216ca6ea1c6f8677b4
|
2ac8292f94d939615de088fe178a3ce49f3a1569
|
/chap14_람다식/src/sec05_표준API의_함수적인터페이스/exam08_and_or_negate_isequal/PredicateIsEqualExample.java
|
22162a773e1b79a291098322a8082d338caece30
|
[] |
no_license
|
TASAKAKOKI/thisIsJava
|
085a3c6e8ad5342886c20902d276944635a36098
|
9db75f8fb9be66b05e328e93a7b52f4ef5537518
|
refs/heads/main
| 2023-02-21T14:04:30.162414 | 2021-02-01T13:51:34 | 2021-02-01T13:51:34 | 318,796,193 | 0 | 0 | null | null | null | null |
UHC
|
Java
| false | false | 1,059 |
java
|
package sec05_표준API의_함수적인터페이스.exam08_and_or_negate_isequal;
import java.util.function.Predicate;
public class PredicateIsEqualExample {
public static void main(String[] args) {
Predicate<String> predicate;
//Predicate를 만들어서 복잡하게 비교하는 이유:
//컬렉션 요소에서 어떤 값을 찾는 등 필터링 할때, 문자열이 포함된 혹은 동일한 문자열을 찾기 위해 비교를 수행할 시,
//걸러내기 위한 용도로 사용
predicate = Predicate.isEqual(null);
System.out.println("null - null: " + predicate.test(null));
predicate = Predicate.isEqual("Java 8");
System.out.println("Java 8 - null: " + predicate.test(null));
predicate = Predicate.isEqual(null);
System.out.println("null - Java 8: " + predicate.test("Java 8"));
predicate = Predicate.isEqual("Java 8");
System.out.println("Java 8 - Java 8: " + predicate.test("Java 8"));
predicate = Predicate.isEqual("Java 8");
System.out.println("Java8 - java 8: " + predicate.test("java 8"));
}
}
|
[
"[email protected]"
] | |
2f707a41b4d8755f43a1274ee9db2ba2c52d8a14
|
db3043ea4728125fd1d7a6a127daf0cc2caad626
|
/OCPay_admin/src/main/java/com/stormfives/ocpay/member/dao/entity/OcpayAddressBalanceDual.java
|
4d53ad2747aac301a355c73334d74d61ed180799
|
[] |
no_license
|
OdysseyOCN/OCPay
|
74f0b2ee9b2c847599118861ffa43b8c869b2e71
|
5f6c03c8eea53ea107ac6917f3d97a3c7fc86209
|
refs/heads/master
| 2022-07-25T07:49:12.120351 | 2019-03-29T03:14:46 | 2019-03-29T03:14:46 | 135,281,926 | 9 | 5 | null | 2022-07-15T21:06:38 | 2018-05-29T10:48:50 |
Java
|
UTF-8
|
Java
| false | false | 723 |
java
|
package com.stormfives.ocpay.member.dao.entity;
import java.math.BigDecimal;
import java.util.Date;
public class OcpayAddressBalanceDual {
private Integer id;
private BigDecimal addressesBalance;
private Date creatTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BigDecimal getAddressesBalance() {
return addressesBalance;
}
public void setAddressesBalance(BigDecimal addressesBalance) {
this.addressesBalance = addressesBalance;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
}
|
[
"[email protected]"
] | |
b1ce1f4da796515f40cd0212a657774d1f3b403f
|
518782d475cfdfe63de28efdb813bebb611b9d1b
|
/app/src/main/java/com/eladper/sudoku/Preferences.java
|
37afe58c68b9972199568b1932ced490535610c5
|
[] |
no_license
|
EladPeretz/MySudokuApp
|
ccc86977a15b92b19c1faddb09e2ba96767daae9
|
d23d756b19ec8933e358b2912d50567ed7c5daae
|
refs/heads/master
| 2020-12-09T10:01:47.126961 | 2020-09-22T15:46:38 | 2020-09-22T15:46:38 | 233,270,794 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,495 |
java
|
package com.eladper.sudoku;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
import android.support.annotation.Nullable;
import android.util.Log;
import android.widget.Toast;
public class Preferences extends PreferenceFragment {
private SharedPreferences.OnSharedPreferenceChangeListener prefChangeListener;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
prefChangeListener=new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
switch (s){
case "Vertical Guidelines":
if ((sharedPreferences).getBoolean("Vertical Guidelines",false))
Toast.makeText(getActivity().getApplicationContext(), "Vertical Guidelines will appear in the next tap", Toast.LENGTH_SHORT).show();
else
Toast.makeText(getActivity().getApplicationContext(), "Vertical Guidelines will disappear from the next tap", Toast.LENGTH_SHORT).show();
break;
case "Horizontal Guidelines":
if ((sharedPreferences).getBoolean("Horizontal Guidelines",false))
Toast.makeText(getActivity().getApplicationContext(), "Horizontal Guidelines will appear in the next tap", Toast.LENGTH_SHORT).show();
else
Toast.makeText(getActivity().getApplicationContext(), "Horizontal Guidelines will disappear from the next tap", Toast.LENGTH_SHORT).show();
break;
case "Block":
if ((sharedPreferences).getBoolean("Block",false))
Toast.makeText(getActivity().getApplicationContext(), "Blocks will be marked in the next tap", Toast.LENGTH_SHORT).show();
else
Toast.makeText(getActivity().getApplicationContext(), "Blocks will not be marked from the next tap", Toast.LENGTH_SHORT).show();
break;
case "Identical Number":
if ((sharedPreferences).getBoolean("Identical Number",false))
Toast.makeText(getActivity().getApplicationContext(), "Cells with identical numbers will be highlighted in the next tap", Toast.LENGTH_SHORT).show();
else
Toast.makeText(getActivity().getApplicationContext(), "Cells with identical numbers will not be highlighted from the next tap", Toast.LENGTH_SHORT).show();
break;
}
}
};
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
if (preference.getKey()!=null) {
if (preference.getKey().equals("Leave Feedback")) {
try {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id=com.eladper.sudoku")));
} catch (ActivityNotFoundException e) {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=com.eladper.sudoku")));
}
return true;
}
if (preference.getKey().equals("App Info")) {
startActivity(new Intent(getActivity(), AppInfoActivity.class));
return true;
}
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
@Override
public void onResume() {
super.onResume();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(prefChangeListener);
}
@Override
public void onPause() {
super.onPause();
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(prefChangeListener);
}
}
|
[
"[email protected]"
] | |
36101098aa76d8b7064448b0fc08cd2716501edb
|
0497e2da47d5da60f4007aea939463d01ba03601
|
/src/mainFrame/Laporan_Penerimaan.java
|
5a3203d354ca96c5d5abb08b8508c1c86664a29a
|
[] |
no_license
|
Lnyx00/CobaKary
|
e28e5e32ef0bee56dc6fd3b34aa3f7536c1f43b4
|
de376724f49ecdd649553a79f994177e6f9f700a
|
refs/heads/master
| 2020-08-04T07:53:51.282345 | 2019-10-01T13:21:58 | 2019-10-01T13:21:58 | 212,063,366 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 16,975 |
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 mainFrame;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.InputStream;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Random;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import koneksi.koneksi;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableRowSorter;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRTableModelDataSource;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.JasperViewer;
/**
*
* @author ilham
*/
public class Laporan_Penerimaan extends javax.swing.JFrame {
private Connection cn = new koneksi().connect();
private DefaultTableModel tabmode;
Statement st;
ResultSet rs;
PreparedStatement pst;
private int intjumdata;
/**
* Creates new form Laporan_Peminjaman
*/
public Laporan_Penerimaan() {
initComponents();
datatable();
}
protected void datatable() {
Object[] Baris = {"NIK", "Nama", "Jenis Kelamin", "Lulusan", "Jabatan", "Tgl Lamar", "No HP", "Tgl Test"};
tabmode = new DefaultTableModel(null, Baris);
jTable1.setModel(tabmode);
String sql = "select * from lap_pen_karyawan";
try {
java.sql.Statement stat = cn.createStatement();
ResultSet rs = stat.executeQuery(sql);
while (rs.next()) {
String NIK = rs.getString("NIK");
String Nama = rs.getString("Nama");
String jenisKelamin = rs.getString("jenisKelamin");
String lulusan = rs.getString("Lulusan");
String jabatan = rs.getString("Jabatan");
// String tglPengembalian = rs.getString("tglPengembalian");
String tglLamar = rs.getString("tgl_lamar");
String noHP = rs.getString("No_HP");
String test = rs.getString("tglTest");
// String qty = rs.getString("qty");
String[] data = {
NIK,
Nama,
jenisKelamin,
lulusan,
jabatan,
tglLamar,
noHP,
// tglPengembalian,
test};
tabmode.addRow(data);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}
private void print() {
try {
java.util.Date d = new java.util.Date();
SimpleDateFormat s = new SimpleDateFormat("EEEE dd-MMMM-yyyy");
String tgl = s.format(d);
HashMap parameter = new HashMap();
parameter.put("tabel", "tabel1");
// String path = "./src/print/Pengembalian.jasper";
InputStream path = getClass().getResourceAsStream("/print/lap_lamaran.jrxml");
JasperDesign jasperDesign = JRXmlLoader.load(path);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JRDataSource dataSource = new JRTableModelDataSource(jTable1.getModel());
parameter.put("tgl", tgl);
// parameter.put("Induk_Siswa", tIndukSiswa.getText());
// parameter.put("judul_buku", tJudulBuku.getText());
// parameter.put("tanggal_pinjam", tTanggalPinjam.getText());
// parameter.put("tanggal_Pengembalian", ((JTextField) tTanggalPengembalian.getDateEditor().getUiComponent()).getText());
// parameter.put("qty", tBanyakBuku.getText());
// parameter.put("nama",tNama.getText());
// parameter.put("kelas",jLabel32.getText());
JasperPrint print = JasperFillManager.fillReport(jasperReport, parameter, dataSource);
JasperViewer.viewReport(print, false);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}
public void removeTable() {
try {
for (int t = tabmode.getRowCount(); t > 0; t--) {
tabmode.removeRow(0);
}
} catch (Exception e) {
}
}
/**
* 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() {
jDateChooser1 = new com.toedter.calendar.JDateChooser();
jDateChooser2 = new com.toedter.calendar.JDateChooser();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jDateChooser1.setDateFormatString("yyyy-MM-dd");
jDateChooser2.setDateFormatString("yyyy-MM-dd");
jLabel14.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel14.setText("Tanggal Awal");
jLabel15.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel15.setText(":");
jLabel16.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel16.setText("Tanggal Akhir");
jLabel17.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jLabel17.setText(":");
jButton1.setText("Cari");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("CETAK");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2), "Laporan Penerimaan", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 18))); // NOI18N
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null}
},
new String [] {
"NIK", "Nama", "Jenis Kelamin", "Lulusan", "Jabatan", "Tanggal Lamar", "No Handphone", "Tanggal Test"
}
));
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1MouseClicked(evt);
}
});
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(109, 109, 109)
.addComponent(jLabel15))
.addComponent(jLabel14))
.addGap(18, 18, 18)
.addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel16)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel17)
.addGap(18, 18, 18)
.addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 359, Short.MAX_VALUE)
.addComponent(jButton2))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel17)
.addComponent(jLabel16))
.addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel14)
.addComponent(jLabel15))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
setSize(new java.awt.Dimension(1234, 602));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
}//GEN-LAST:event_jTable1MouseClicked
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String tglAwal = ((JTextField) jDateChooser1.getDateEditor().getUiComponent()).getText();
String tglAkhir = ((JTextField) jDateChooser2.getDateEditor().getUiComponent()).getText();
String sql = "SELECT * FROM lap_pen_karyawan where tgl_lamar >='" + tglAwal + "'AND tgl_lamar <='" + tglAkhir + "'";
try {
removeTable();
Statement stat = cn.createStatement();
// String sql = "SELECT * FROM simpanbuku where judulBuku like '%" + item + "%'or NIS like'%" + item + "%'order by kd_Buku asc";
ResultSet rs = stat.executeQuery(sql);
while (rs.next()) {
String NIK = rs.getString("NIK");
String Nama = rs.getString("Nama");
String jenisKelamin = rs.getString("jenisKelamin");
String lulusan = rs.getString("Lulusan");
String jabatan = rs.getString("Jabatan");
// String tglPengembalian = rs.getString("tglPengembalian");
String tglLamar = rs.getString("tgl_lamar");
String noHP = rs.getString("No_HP");
String test = rs.getString("tglTest");
String data[] = {
NIK, Nama, jenisKelamin, lulusan, jabatan, tglLamar,noHP,test
};
tabmode.addRow(data);
// jumdata++;
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
print();
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Laporan_Penerimaan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Laporan_Penerimaan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Laporan_Penerimaan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Laporan_Penerimaan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Laporan_Penerimaan().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private com.toedter.calendar.JDateChooser jDateChooser1;
private com.toedter.calendar.JDateChooser jDateChooser2;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}
|
[
"[email protected]"
] | |
eaaead89c2029e23b5e19493b1feeb6b4eea08a3
|
055cc8c6ece59ced27da73f8f19c64eac31d57b9
|
/core/src/com/theironyard/MyGdxGame.java
|
10c18e442a5481e5667e31b0b8c9c9d9eb9452ea
|
[] |
no_license
|
willriggins/HelloGame
|
7ea9b2519b416626d1f2b1c4504a0e6703730229
|
0b01692b97a2846e24867411eb77dd33eb4f942d
|
refs/heads/master
| 2021-01-09T20:47:04.085679 | 2016-06-02T15:00:26 | 2016-06-02T15:00:26 | 60,273,398 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,427 |
java
|
package com.theironyard;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class MyGdxGame extends ApplicationAdapter {
SpriteBatch batch;
Texture img;
float x,y, xv, yv;
static final float MAX_VELOCITY = 100;
static final float DECELERATION = 0.95f; // try 0.99 for skating on ice effect
@Override
public void create () {
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
}
@Override
public void render () {
move();
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(img, x, y);
batch.end();
}
public void move() {
if (Gdx.input.isKeyPressed(Input.Keys.UP)) {
yv = MAX_VELOCITY;
}
else if (Gdx.input.isKeyPressed(Input.Keys.DOWN)) {
yv = -MAX_VELOCITY;
}
if (Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
xv = MAX_VELOCITY;
}
else if (Gdx.input.isKeyPressed(Input.Keys.LEFT)) {
xv = -MAX_VELOCITY;
}
float delta = Gdx.graphics.getDeltaTime();
y+= yv * delta;
x+= xv * delta;
yv = decelerate(yv);
xv = decelerate(xv);
}
public float decelerate(float velocity) {
velocity *= DECELERATION; // could also cast as float.
if (Math.abs(velocity) < 1) {
velocity = 0;
}
return velocity;
}
}
|
[
"[email protected]"
] | |
39eb27d8e25c491427c5e4b47f20478718f1e573
|
d64a7174ca5979789e99dcf978d40727b9ea481a
|
/3.JavaMultithreading/src/com/javarush/task/task23/task2301/Solution.java
|
f95426896fd0dd7a3dff3700218810a714c0708a
|
[] |
no_license
|
KhannanovNiyaz/JavaRushTasks
|
0d8f370e490fd4302ffa0623eeb5bbe74a2080f9
|
c056d27b5ab09a82a67a4b21bb622fa64c671924
|
refs/heads/master
| 2020-04-20T13:33:55.955094 | 2019-02-13T20:06:49 | 2019-02-13T20:06:49 | 156,973,720 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 830 |
java
|
package com.javarush.task.task23.task2301;
/*
Запрети наследование от класса Listener.
Требования:
1. Класс Listener должен быть создан внутри класса Solution.
2. Класс Listener должен быть публичным.
3. Класс Listener должен быть статическим.
4. Должна быть запрещена возможность стать потомком класса Listener.
*/
public class Solution {
final public static class Listener {
public void onMouseDown(int x, int y) {
//do something on mouse down event
}
public void onMouseUp(int x, int y) {
//do something on mouse up event
}
}
public static void main(String[] args) {
}
}
|
[
"[email protected]"
] | |
b3d9741995b9a20b330ddf7301c7548efdbe50ac
|
632ffbc50af6949dbd2bf23ec069cf06ff5285c5
|
/src/com/example/myprodWeb/CameraActivity.java
|
146e11f0d0522a704b022538468c18d801cfb7fc
|
[] |
no_license
|
Moriarty123/MyProdWeb
|
e8db195a57743242ad31b6fa6036b4747cdd085b
|
7aa3f44951a1d45754b32a226df5ee049768bfda
|
refs/heads/master
| 2020-03-21T15:49:30.996930 | 2018-06-24T14:47:04 | 2018-06-24T14:47:04 | 138,735,169 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 344 |
java
|
package com.example.myprodWeb;
import android.app.Activity;
import android.os.Bundle;
public class CameraActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camera);
}
}
|
[
"[email protected]"
] | |
6287c1f0c0b07880a1f1e070eca9333824557627
|
f4a27d987c104778b193ef06869b1aa96a14f1b1
|
/app/src/main/java/br/com/belongapps/appdelivery/cardapioOnline/fragments/TabSucos.java
|
6b93ebda84f60656731803538bf9709ae1397d59
|
[] |
no_license
|
CETGNOLEB/RepositoryCode
|
b67bb316c9a54f1cf537ef860201788ba05ea0d5
|
58c53f51127b236ef69f3df928383790ac768367
|
refs/heads/master
| 2021-01-19T23:24:40.853444 | 2018-01-28T21:50:18 | 2018-01-28T21:50:18 | 88,975,127 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,877 |
java
|
package br.com.belongapps.appdelivery.cardapioOnline.fragments;
import android.content.Context;
import android.content.Intent;
import android.graphics.Paint;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Callback;
import com.squareup.picasso.NetworkPolicy;
import com.squareup.picasso.Picasso;
import br.com.belongapps.appdelivery.R;
import br.com.belongapps.appdelivery.cardapioOnline.activitys.DetalhesdoItemActivity;
import br.com.belongapps.appdelivery.cardapioOnline.model.ItemCardapio;
import br.com.belongapps.appdelivery.cardapioOnline.model.ItemPedido;
import br.com.belongapps.appdelivery.util.OpenDialogUtil;
import br.com.belongapps.appdelivery.util.StringUtil;
public class TabSucos extends Fragment {
private RecyclerView mSucosList;
private DatabaseReference mDatabaseReference;
private ProgressBar mProgressBar;
private ItemPedido itemPedido;
private boolean statusDelivery = true;
private boolean statusEstabelecimento = true;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.tab_sucos, container, false);
return rootView;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onStart() {
super.onStart();
mDatabaseReference = FirebaseDatabase.getInstance().getReference();
mDatabaseReference.child("configuracoes").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Boolean status = Boolean.parseBoolean(dataSnapshot.child("status_delivery").child("status").getValue().toString());
statusDelivery = status;
Boolean statusEstab = Boolean.parseBoolean(dataSnapshot.child("status_estabelecimento").child("status").getValue().toString());
statusEstabelecimento = statusEstab;
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
itemPedido = new ItemPedido();
mProgressBar = getActivity().findViewById(R.id.progressbar_escolher_suco);
mDatabaseReference = FirebaseDatabase.getInstance().getReference().child("itens_cardapio").child("8");
mDatabaseReference.keepSynced(true);
mSucosList = getView().findViewById(R.id.list_sucos);
mSucosList.setHasFixedSize(true);
mSucosList.setLayoutManager(new LinearLayoutManager(getActivity()));
openProgressBar();
final FirebaseRecyclerAdapter<ItemCardapio, SucosViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<ItemCardapio, SucosViewHolder>(
ItemCardapio.class, R.layout.card_sucos, SucosViewHolder.class, mDatabaseReference
) {
@Override
public void onBindViewHolder(final SucosViewHolder viewHolder, final int position) {
super.onBindViewHolder(viewHolder, position);
}
@Override
protected void populateViewHolder(SucosViewHolder viewHolder, final ItemCardapio model, int position) {
closeProgressBar();
final String key = getRef(position).getKey();
viewHolder.setNome(model.getNome());
viewHolder.setDescricao(model.getDescricao());
viewHolder.setValorUnitarioEPromocao(model.getValor_unit(), model.isStatus_promocao(), model.getPreco_promocional());
viewHolder.setImagem(getContext(), model.getRef_img());
viewHolder.setStatus(model.getStatus_item(), model.getPermite_entrega());
viewHolder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (model.getStatus_item() == 1) { //Se Disponível no Cardápio
if (statusEstabelecimento == false) {
OpenDialogUtil.openSimpleDialog("Estabelecimento Fechado",
"Desculpe, nosso estabelecimento não está recebendo pedidos pelo aplicativo no momento.",
getContext());
} else if (model.getPermite_entrega() == 2) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
AlertDialog.Builder mBilder = new AlertDialog.Builder(getContext(), R.style.MyDialogTheme);
View layoutDialog = inflater.inflate(R.layout.dialog_nao_permite_entrega, null);
Button btVoltar = layoutDialog.findViewById(R.id.bt_voltar_item_sem_entrega);
Button btContinuar = layoutDialog.findViewById(R.id.bt_continuar_item_sem_entrega);
mBilder.setView(layoutDialog);
final AlertDialog dialogDeliveryFechado = mBilder.create();
dialogDeliveryFechado.show();
btVoltar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialogDeliveryFechado.dismiss();
}
});
btContinuar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialogDeliveryFechado.dismiss();
selecionarItem(model, key);
}
});
} else if (statusDelivery == false) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
AlertDialog.Builder mBilder = new AlertDialog.Builder(getContext(), R.style.MyDialogTheme);
View layoutDialog = inflater.inflate(R.layout.dialog_delivery_fechado, null);
Button btVoltar = layoutDialog.findViewById(R.id.bt_voltar_delivery_fechado);
Button btContinuar = layoutDialog.findViewById(R.id.bt_continuar_delivery_fechado);
mBilder.setView(layoutDialog);
final AlertDialog dialogDeliveryFechado = mBilder.create();
dialogDeliveryFechado.show();
btVoltar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialogDeliveryFechado.dismiss();
}
});
btContinuar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialogDeliveryFechado.dismiss();
selecionarItem(model, key);
}
});
} else {
selecionarItem(model, key);
}
} else {
Toast.makeText(getContext(), "Produto Indisponível!", Toast.LENGTH_SHORT).show();
}
}
});
}
};
mSucosList.setAdapter(firebaseRecyclerAdapter);
}
public void selecionarItem(final ItemCardapio model, String key) {
itemPedido.setNome(model.getNome());
itemPedido.setDescricao(model.getDescricao());
itemPedido.setRef_img(model.getRef_img());
itemPedido.setCategoria(model.getCategoria_id());
itemPedido.setPermite_entrega(model.getPermite_entrega());
itemPedido.setEntrega_gratis(model.getEntrega_gratis());
if (model.isStatus_promocao() == true) {
itemPedido.setValor_unit(model.getPreco_promocional());
} else {
itemPedido.setValor_unit(model.getValor_unit());
}
itemPedido.setKeyItem(key);
Intent intent = new Intent(getActivity(), DetalhesdoItemActivity.class);
intent.putExtra("ItemPedido", itemPedido);
intent.putExtra("TelaAnterior", "TabSucos");
startActivity(intent);
getActivity().finish();
}
public static class SucosViewHolder extends RecyclerView.ViewHolder {
View mView;
CardView card_suco;
public SucosViewHolder(final View itemView) {
super(itemView);
mView = itemView;
card_suco = mView.findViewById(R.id.card_sucos);
}
public void setNome(String nome) {
TextView item_nome = mView.findViewById(R.id.item_nome_suco);
item_nome.setText(nome);
}
public void setDescricao(String descricao) {
TextView item_descricao = mView.findViewById(R.id.item_desc_suco);
item_descricao.setText(descricao);
}
public void setValorUnitarioEPromocao(double valor_unit, boolean status_promocao, double valor_promocional) {
TextView item_valor_promo = mView.findViewById(R.id.item_valor_promo_suco);
TextView item_valor_unit = mView.findViewById(R.id.item_valor_unit_suco);
if (status_promocao == true) {
item_valor_promo.setText(StringUtil.formatToMoeda(valor_promocional));
item_valor_unit.setText(StringUtil.formatToMoeda(valor_unit));
item_valor_unit.setPaintFlags(item_valor_unit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
item_valor_unit.setVisibility(View.VISIBLE);
} else {
item_valor_promo.setText(StringUtil.formatToMoeda(valor_unit));
item_valor_unit.setVisibility(View.INVISIBLE);
}
}
public void setImagem(final Context context, final String url) {
final ImageView item_ref_image = mView.findViewById(R.id.img_suco);
Picasso.with(context).load(url).networkPolicy(NetworkPolicy.OFFLINE).into(item_ref_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
Picasso.with(context).load(url).into(item_ref_image);
}
});
}
public void setStatus(int status, int permiteEntrega) {
TextView item_status = mView.findViewById(R.id.status_suco);
//Não permite entrega
if (permiteEntrega == 2){
item_status.setText("Não Entregamos");
}
if (status == 0 || permiteEntrega == 2) { //Se Indisponível ou nao faz entrega
item_status.setVisibility(View.VISIBLE);
if (status == 0){
item_status.setText("Produto Indisponível");
}
} else{
item_status.setVisibility(View.INVISIBLE);
}
}
}
private void openProgressBar() {
mProgressBar.setVisibility(View.VISIBLE);
}
private void closeProgressBar() {
mProgressBar.setVisibility(View.GONE);
}
}
|
[
"[email protected]"
] | |
3bb93ba9cde80c3c09705a5f8ebf52726587e080
|
72b0ee566a514788ba5b4ebe34aec6448007e352
|
/src/com/appxy/billkeeper/adapter/CategoryFragmentExpandableListviewAdapter.java
|
6d45946b7248630d7bbffd8f8786e97f0c2293a5
|
[] |
no_license
|
sadsunny/BillKeeperFree
|
84d23bad010948f773f0e920ddeafbfa3d1603e1
|
633ab6132bef70fb50b0c8903cf7982a406cf10b
|
refs/heads/master
| 2021-01-23T18:10:04.931632 | 2014-04-30T08:26:44 | 2014-04-30T08:26:44 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,605 |
java
|
package com.appxy.billkeeper.adapter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.appxy.billkeeper.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.TextView;
public class CategoryFragmentExpandableListviewAdapter extends BaseExpandableListAdapter{
private LayoutInflater inflater;
private List<Map<String, Object>> groupList;
private List<List<Map<String, Object>>> childList;
public CategoryFragmentExpandableListviewAdapter(Context context, List<Map<String, Object>> groupList, List<List<Map<String, Object>>> childList) {
inflater = LayoutInflater.from(context);
this.groupList = groupList;
this.childList = childList;
}
@Override
//gets the name of each item
public Object getChild(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return childPosition;
}
@Override
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
cViewHolder viewholder = null;
if (convertView == null) {
viewholder = new cViewHolder();
convertView = inflater.inflate(R.layout.fragment_category_expandablelistview_child_item, parent,false);
viewholder.billNaTextView = (TextView)convertView.findViewById(R.id.billTextView);
viewholder.overduePic = (ImageView)convertView.findViewById(R.id.overDueImageView);
convertView.setTag(viewholder);
}else
{
viewholder = (cViewHolder)convertView.getTag();
}
viewholder.billNaTextView.setText(childList.get(groupPosition).get(childPosition).get("zbillName")+"");
if ( (Integer)childList.get(groupPosition).get(childPosition).get("checkDot")==0) {
// viewholder.overduePic.setImageResource(R.drawable.overdue);
}else if ( (Integer)childList.get(groupPosition).get(childPosition).get("checkDot")==7){
// viewholder.overduePic.setImageResource(R.drawable.overdue7);
}else if ( (Integer)childList.get(groupPosition).get(childPosition).get("checkDot")==30){
// viewholder.overduePic.setImageResource(R.drawable.overdue30);
}
return convertView;
}
class cViewHolder {
public TextView billNaTextView;
public ImageView overduePic;
}
@Override
//counts the number of children items so the list knows how many times calls getChildView() method
public int getChildrenCount(int groupPosition) {
// TODO Auto-generated method stub
return childList.get(groupPosition).size();
}
@Override
//gets the title of each parent/group
public Object getGroup(int groupPosition) {
// TODO Auto-generated method stub
return null;
}
@Override
//counts the number of group/parent items so the list knows how many times calls getGroupView() method
public int getGroupCount() {
// TODO Auto-generated method stub
return groupList.size();
}
@Override
public long getGroupId(int groupPosition) {
// TODO Auto-generated method stub
return groupPosition;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
gViewHolder viewholder = null;
if (convertView == null) {
viewholder = new gViewHolder();
convertView = inflater.inflate(R.layout.fragment_category_expandablelistview_group_item, parent,false);
viewholder.categoryTextView = (TextView)convertView.findViewById(R.id.categoryTextView);
viewholder.totalTextView = (TextView)convertView.findViewById(R.id.totalTextView);
convertView.setTag(viewholder);
}else
{
viewholder = (gViewHolder)convertView.getTag();
}
viewholder.categoryTextView.setText(groupList.get(groupPosition).get("categoryName")+"");
viewholder.totalTextView.setText(groupList.get(groupPosition).get("categoryAmount")+"");
return convertView;
}
class gViewHolder {
public TextView categoryTextView;
public TextView totalTextView;
}
@Override
public boolean hasStableIds() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return true;
}
}
|
[
"[email protected]"
] | |
5b6696584442b370e787f9c0bd8a19e1c2e61b3a
|
0b0b461e2d9048564d30bfc6ebb38dce8375b6e5
|
/shopping/src/com/iotek/bean/Carts.java
|
9c3ac1499640b29bf4a7fb22d93aeda3786eb102
|
[] |
no_license
|
1252505845/ly1995
|
a2851bfabd650118f1aee1cc64bc5aa95ae9f823
|
22f2b873e0a598d52429c2d5b25ad7aef7c47a82
|
refs/heads/master
| 2021-08-07T22:39:34.030167 | 2020-04-10T03:49:55 | 2020-04-10T03:49:55 | 147,785,795 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 605 |
java
|
package com.iotek.bean;
import java.util.List;
public class Carts {
private int totalQty;
private double totalAmount;
private List<Cart> cartList;
public int getTotalQty() {
return totalQty;
}
public void setTotalQty(int totalQty) {
this.totalQty = totalQty;
}
public double getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(double totalAmount) {
this.totalAmount = totalAmount;
}
public List<Cart> getCartList() {
return cartList;
}
public void setCartList(List<Cart> cartList) {
this.cartList = cartList;
}
}
|
[
"Administrator@PC-20171221JWZQ"
] |
Administrator@PC-20171221JWZQ
|
372c590618f6a481917b8ee488278c7052be6784
|
04f1a14a5a60619f4d22f155fd3ba8a8cfc0eb27
|
/dragon-javaee-example/src/main/java/com/dragon/basic/java/lang/thread/volatilefield/Counter.java
|
f4508334a53849a45e6d019fda2d2bd34a9ded5a
|
[] |
no_license
|
ymzyf2007/dragon-master
|
9029a13641a05f542f1c27f93848646d91a8b296
|
5b246a9ed726185f7f337f476a5aadabcf8ab7dd
|
refs/heads/master
| 2021-08-14T08:02:04.820103 | 2017-11-15T02:07:32 | 2017-11-15T02:07:32 | 109,670,267 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,243 |
java
|
package com.dragon.basic.java.lang.thread.volatilefield;
/**
* 下面看一个例子,我们实现一个计数器,每次线程启动的时候,会调用计数器inc方法,对计数器进行加一
* 详细说明看CSDN博客:http://blog.csdn.net/ymzyf2007/article/details/50222767
*
*/
public class Counter {
// volatile只能保证可见性,不能保证原子性
public volatile static int count = 0;
public static void inc() {
// 这里延迟1毫秒,使得结果明显
try {
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
count++;
}
public static void main(String[] args) {
// 同时启动1000个线程,去进行i++运算,看看实际结果
for(int i = 0; i < 1000; i++) {
new Thread(new Runnable() {
// 执行完线程中的所有代码后,线程就自动结束并自我销毁
@Override
public void run() {
Counter.inc();
}
}).start();
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// 这里每次运行的值都有可能不同,可能为1000
System.out.println("运行结果:Counter.count=" + Counter.count);
}
}
|
[
"[email protected]"
] | |
73a3d6235163c77c2f60dbae7df135ed9850054b
|
d0cc9bd92b4d0057640ff3023a9394578a0b5f48
|
/Stacks_Lab_Students/src/MenuLab/menuClasses/ShowListAction.java
|
ce7d06293a4cdf5acecb2e120b8b8d57c4044245
|
[] |
no_license
|
yamilhernandez/StacksLab
|
ba344f487c02d3e42db241cbf48ae1d19523cef3
|
e1190b523b7dd320cc7287b4d8046c6eac3831f6
|
refs/heads/master
| 2020-04-27T22:52:28.781162 | 2019-03-11T18:10:02 | 2019-03-11T18:10:02 | 174,752,687 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 408 |
java
|
package MenuLab.menuClasses;
import MenuLab.dataManager.DMComponent;
import MenuLab.ioManagementClasses.IOComponent;
public class ShowListAction implements Action {
@Override
public void execute(Object arg) {
IOComponent io = IOComponent.getComponent();
DMComponent dm = (DMComponent) arg;
String name = io.getInput("Enter the name of the list to show: ");
dm.showListElements(name);
}
}
|
[
"[email protected]"
] | |
251099d6d0700ef7ec279b25bf75d5c14c4c64f1
|
7228e9bb643917fb3b2cc0af8a27fb18396112c3
|
/src/main/java/it/unicam/travisbug/c3/model/requests/EmployeeRequests.java
|
4637b1a4ad7ed6a314a80bc51b290edc5d87cc6d
|
[] |
no_license
|
Orthoepiccrown0/travisbug.c3
|
57475ecb587777023b0c6601f06656d35d89f960
|
21c4e6d40ba804a850c038bc7d5125e549d78c4b
|
refs/heads/master
| 2023-03-26T02:31:04.266968 | 2021-02-23T17:16:17 | 2021-02-23T17:16:17 | 324,797,198 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,095 |
java
|
package it.unicam.travisbug.c3.model.requests;
import it.unicam.travisbug.c3.model.shop.Shop;
import it.unicam.travisbug.c3.model.users.Employee;
import javax.persistence.*;
import java.util.Date;
@Entity
public class EmployeeRequests {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private Date date;
@OneToOne
@JoinColumn(name = "employee_id", referencedColumnName = "ID")
private Employee employee;
@OneToOne
@JoinColumn(name = "shop_id", referencedColumnName = "ID")
private Shop shop;
public Shop getShop() {
return shop;
}
public void setShop(Shop shop) {
this.shop = shop;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
|
[
"[email protected]"
] | |
ab072e18c33130fbf876e185d21cf7a4e8bcce07
|
38893aeeb1268b5fee7cb3b06f78a050e681e0b4
|
/ConveterApp2/ConverterFarainHeight/app/src/test/java/com/alamin/converterfarainheight/ExampleUnitTest.java
|
9f69a88f7674c814a3d771206c4b190b14bf939d
|
[] |
no_license
|
showdpro/Android-Works
|
1762b118bea00a7615e1b4cd7bd632139cc3189b
|
184e83cf577228de784fb4fdeba0ed5c92003ce1
|
refs/heads/master
| 2022-03-06T18:14:16.289397 | 2019-11-05T18:19:41 | 2019-11-05T18:19:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 393 |
java
|
package com.alamin.converterfarainheight;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
e21a44d5193079d67e910dd8c8512fc147b6897b
|
e68820efb01ee03bce3749187c73b266c94e4c9b
|
/app/src/main/java/net/betterbing/androidframworkstudy/net/TestService.java
|
737f35603573d62a4ba3cadd7a980eb4a1605869
|
[
"Apache-2.0"
] |
permissive
|
aibingbing/AndroidFramworkStudy
|
f9c1c754624a705c455f03df15785368e189e489
|
1535b10c2b6b23abaff79230bceb6acc254ae08e
|
refs/heads/master
| 2021-05-31T16:47:47.124363 | 2016-05-12T13:24:26 | 2016-05-12T13:24:26 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 451 |
java
|
package net.betterbing.androidframworkstudy.net;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
/**
* Copyright: Copyright (c) 2015年 Beijing Yunshan Information Technology Co., Ltd. All rights reserved.<br>
* Author: ABB <br>
* Date: 16/5/12 <br>
* Desc: <br>
* Edit History: <br>
*/
public interface TestService {
@POST("supplierapp/login")
Call<BaseResult<User>> login(@Body User user);
}
|
[
"aibingbing@kaladingcom"
] |
aibingbing@kaladingcom
|
dc8ad6ebae6c37276f914bef2d26041dbcbf6bab
|
e5fe7b9bc896101f91cb94199c8906859a6577fd
|
/src/main/java/com/dreamtale/ck/entity/param/CkUserListQueryParam.java
|
8918a4361269994cd496729b167d702d56ce9c14
|
[] |
no_license
|
OnMyHeart/dreamtale-ck
|
92c3467a2d829ec8353d63a68ec33def54b1bfc7
|
617122d164f2e60ab3fb80e12b496a919ff8b762
|
refs/heads/master
| 2020-03-27T15:14:58.710376 | 2019-04-27T04:24:26 | 2019-04-27T04:24:26 | 146,706,198 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 148 |
java
|
package com.dreamtale.ck.entity.param;
import com.dreamtale.ck.constant.common.BaseParam;
public class CkUserListQueryParam extends BaseParam {
}
|
[
"yingshuai"
] |
yingshuai
|
680a125a6f949b7ad0acdcffa74c67baf666fb0e
|
d74a81d9acfe340380fe5ddc473e72c2fd371ad7
|
/src/net/jrat/core/packet/server/S8PacketScreenshot.java
|
1507e6990d2025db34de7467cbde12e88901de1a
|
[] |
no_license
|
jratdev/client
|
16acd0276b426a62d6c4ea7f09d259d82d00d372
|
895e8e32fd10d9efe3c003dd8a9d00234fd0c9c5
|
refs/heads/master
| 2020-03-27T05:11:27.730610 | 2018-08-29T12:47:01 | 2018-08-29T12:47:01 | 146,000,456 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,179 |
java
|
package net.jrat.core.packet.server;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import javax.imageio.ImageIO;
import net.jrat.core.Client;
import net.jrat.core.packet.IPacket;
import net.jrat.core.packet.client.C2PacketSaveFile;
public class S8PacketScreenshot implements IPacket
{
private static final long serialVersionUID = 1L;
private String outputPath;
@Override
public void execute(Object object) throws Exception
{
final Robot robot = new Robot();
final Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
final int width = (int) screensize.getWidth();
final int height = (int) screensize.getHeight();
final BufferedImage image = robot.createScreenCapture(new Rectangle(0, 0, width, height));
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ImageIO.write(image, "jpg", outputStream);
Client.instance.outputStream.writeObject(new C2PacketSaveFile(outputStream.toByteArray(), this.outputPath));
outputStream.close();
}
}
|
[
"Paolo [email protected]"
] |
Paolo [email protected]
|
c114cf43fde3dffc16d45047895bad4a7f2b4e27
|
9462de38ac4bcd665b3b2207d5abc38ae4a92a90
|
/Module2/src/_3_Array_and_function_in_java/practise/th4/temperature.java
|
4990c366fe97f3598a107e19fd7ac00857a4d564
|
[] |
no_license
|
KhangNguyenKun/C0920G1_NguyenLePhucKhang
|
f77c302df7cd2bdb89e887acccbd88cc636937a8
|
eb570bf7adafccb5a3c4fba0805008f64143d368
|
refs/heads/master
| 2023-03-29T09:40:43.514780 | 2021-04-02T07:59:48 | 2021-04-02T07:59:48 | 295,315,448 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,503 |
java
|
package _3_Array_and_function_in_java.practise.th4;
import java.util.Scanner;
public class temperature {
//Bước 1: Xây dựng phương thức chuyển đổi từ độ C sang độ F
public static double changeFtoC(double fa) {
double cel;
cel = (5.0 / 9) * (fa - 32);
return cel;
}
//Bước 2: Xây dựng phương thức chuyển đổi từ độ F sang độ C
public static double changeCtoF(double cel) {
double fa;
fa = (5.0 / 9) / cel + 32;
return fa;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double fa;
double cel;
int choice;
do {
System.out.println("Menu");
System.out.println("Celcius to Fah");
System.out.println("Fah to Celcius");
System.out.println("Exit ");
choice = scanner.nextInt();
switch (choice) {
case 1:
System.out.println("Enter Cel :");
cel = scanner.nextDouble();
System.out.println(changeCtoF(cel));
break;
case 2:
System.out.println("Enter Fah : ");
fa = scanner.nextDouble();
System.out.println(changeFtoC(fa));
break;
case 3:
System.exit(0);
}
}
while (choice != 0);
}
}
|
[
"[email protected]"
] | |
40e47a274e4724ceadfc4835e2e91573699100ee
|
401df3643989ca5187a5625e16427605bd35b8b6
|
/tools/gradle-plugins/gradle-curiostack-plugin/src/main/java/org/curioswitch/gradle/plugins/pulumi/PulumiSetupPlugin.java
|
43f2b31f40c90d13fc49d4e8786eef2d1cf39b16
|
[
"MIT"
] |
permissive
|
curioswitch/curiostack
|
809366a290042ab9313dd78769c58ff1a801297e
|
af1a44909d9d29440f3d9f7a94aed58cad9567fc
|
refs/heads/master
| 2022-05-20T17:44:01.673204 | 2022-03-13T12:09:49 | 2022-03-13T12:09:49 | 83,122,389 | 78 | 17 |
MIT
| 2022-03-13T12:09:49 | 2017-02-25T09:52:08 |
Java
|
UTF-8
|
Java
| false | false | 2,774 |
java
|
/*
* MIT License
*
* Copyright (c) 2020 Choko ([email protected])
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.curioswitch.gradle.plugins.pulumi;
import static com.google.common.base.Preconditions.checkState;
import org.curioswitch.gradle.helpers.platform.PlatformHelper;
import org.curioswitch.gradle.plugins.curiostack.ToolDependencies;
import org.curioswitch.gradle.tooldownloader.ToolDownloaderPlugin;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
public class PulumiSetupPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
checkState(
project.getParent() == null, "PulumiSetupPlugin can only be applied to the root project.");
var toolDownloaderPlugin = project.getPlugins().apply(ToolDownloaderPlugin.class);
toolDownloaderPlugin.registerToolIfAbsent(
"pulumi",
tool -> {
tool.getVersion().set(ToolDependencies.getPulumiVersion(project));
tool.getBaseUrl().set("https://get.pulumi.com/releases/sdk/");
tool.getArtifactPattern().set("[artifact]-v[revision]-[classifier].[ext]");
var osClassifiers = tool.getOsClassifiers();
osClassifiers.getLinux().set("linux-x64");
osClassifiers.getMac().set("darwin-x64");
osClassifiers.getWindows().set("windows-x64");
switch (new PlatformHelper().getOs()) {
case LINUX:
case MAC_OSX:
tool.getPathSubDirs().add("pulumi");
break;
case WINDOWS:
tool.getPathSubDirs().add("Pulumi/bin");
break;
case UNKNOWN:
throw new IllegalStateException("Unsupported OS");
}
});
}
}
|
[
"[email protected]"
] | |
c563d9759a7ba12bec5551777e6221e78f88ca7a
|
c488d827bcea87945865813618439c1d9262ee60
|
/netty/netty-demo-c1000K/src/main/java/com/tony/edu/netty/push/server/handler/NewConnectHandler.java
|
6d011bfb7af5be7e3569240ab8a8ff2c552fc395
|
[] |
no_license
|
Mjsss/java3.0
|
a461563cea0a94c82b50921aa5f8e20b4fe8c5e8
|
0d071dbdc44860760a1d5727d13ba5cd86847be9
|
refs/heads/master
| 2023-01-10T21:03:12.097073 | 2020-11-19T12:27:17 | 2020-11-19T12:27:17 | 286,990,176 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,202 |
java
|
package com.tony.edu.netty.push.server.handler;
import com.tony.edu.netty.push.biz.UserInfoContext;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.QueryStringDecoder;
import io.netty.util.AttributeKey;
import java.util.List;
import java.util.Map;
// 新连接建立了
public class NewConnectHandler extends SimpleChannelInboundHandler<FullHttpRequest> {
@Override
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception {
// 解析请求,判断token,拿到用户ID。
Map<String, List<String>> parameters = new QueryStringDecoder(req.uri()).parameters();
// String token = parameters.get("token").get(0); 不是所有人都能连接,比如需要登录之后,发放一个推送的token
String userId = parameters.get("userId").get(0);
ctx.channel().attr(AttributeKey.valueOf("userId")).getAndSet(userId); // channel中保存userId
UserInfoContext.saveConnection(userId, ctx.channel()); // 保存连接 -- 测试方式保存下来
// 结束
}
}
|
[
"[email protected]"
] | |
e12c4c4ff52286e33ac48c874b1471f64f7bbb1d
|
d42fb18c8792ca0567d77473a6fd314fd512a99d
|
/LinearLayoutEjercicio1/app/src/androidTest/java/com/example/mati/linearlayoutejercicio1/ApplicationTest.java
|
967af3fd777c42d0a11db98067cbaf0b1708502b
|
[] |
no_license
|
susanajimenez15/PMM
|
1b4f710d3cd6286e40fc5ec668d4d9320867a07c
|
16c94377223add0951f4b51ac7459fb13e0d8069
|
refs/heads/master
| 2021-01-17T16:07:57.835296 | 2017-02-14T07:11:36 | 2017-02-14T07:11:36 | 70,775,748 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 370 |
java
|
package com.example.mati.linearlayoutejercicio1;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
|
[
"[email protected]"
] | |
b791a825424c35dcc6e38d8ecad748f6712e7ff3
|
a7e7e9d8a078feadfb901d9789f95d82ef19a7a1
|
/flightdetails/src/test/java/com/mindtree/learning/flightdetails/FlightdetailsApplicationTests.java
|
d1460afcbcef3ad8ddeb6be98471b9d97ce7f25a
|
[] |
no_license
|
rashigupta65/book-flight-microservices
|
22ad5d0e8542c7f3428fae8fb967cffe4ecc011f
|
8fee3764df9105ba4ba9206983ed999daa683021
|
refs/heads/master
| 2023-04-02T08:56:12.474916 | 2021-04-09T14:41:21 | 2021-04-09T14:41:21 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 234 |
java
|
package com.mindtree.learning.flightdetails;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class FlightdetailsApplicationTests {
@Test
void contextLoads() {
}
}
|
[
"[email protected]"
] | |
d286938ec7247de2a28f3983c82ae663efd7174f
|
c796230089b71e116050676580a8bf6687b05108
|
/src/main/java/com/fortunes/javamg/modules/gtxt/city/web/GtRoleController.java
|
fe4a7129a02116d2d18ff4b844ddfafbfc91ec14
|
[] |
no_license
|
yaoyuanloo/gdsb
|
3b0639df4f9a11fdd63ccecaa454c348b9aeb2e4
|
fd1a7f9f2e744717e03563ac808f6e8e7ef4f110
|
refs/heads/master
| 2020-03-26T10:32:05.244458 | 2018-08-15T03:56:45 | 2018-08-15T03:56:45 | 144,802,732 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,706 |
java
|
/**
*
*/
package com.fortunes.javamg.modules.gtxt.city.web;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.fortunes.javamg.common.config.Global;
import com.fortunes.javamg.common.persistence.Page;
import com.fortunes.javamg.common.web.BaseController;
import com.fortunes.javamg.common.utils.StringUtils;
import com.fortunes.javamg.modules.gtxt.city.entity.DYwinfo;
import com.fortunes.javamg.modules.gtxt.city.entity.GtRole;
import com.fortunes.javamg.modules.gtxt.city.entity.GtSlroleDjyw;
import com.fortunes.javamg.modules.gtxt.city.service.DYwinfoService;
import com.fortunes.javamg.modules.gtxt.city.service.GtRoleService;
import com.fortunes.javamg.modules.gtxt.city.service.GtSlroleDjywService;
import com.fortunes.javamg.modules.sys.entity.Office;
import com.fortunes.javamg.modules.sys.utils.UserUtils;
/**
* 柜台受理角色管理Controller
* @author 万
* @version 2016-09-07
*/
@Controller
@RequestMapping(value = "${adminPath}/city/gtRole")
public class GtRoleController extends BaseController {
@Autowired
private DYwinfoService dYwinfoService;
@Autowired
private GtRoleService gtRoleService;
@Autowired
private GtSlroleDjywService gtsolrdjywService;
@ModelAttribute
public GtRole get(@RequestParam(required=false) String id) {
GtRole entity = null;
if (StringUtils.isNotBlank(id)){
entity = gtRoleService.get(id);
}
if (entity == null){
entity = new GtRole();
}
return entity;
}
@RequiresPermissions("city:gtRole:view")
@RequestMapping(value = {"list", ""})
public String list(GtRole gtRole,String jsname,HttpServletRequest request, HttpServletResponse response, Model model) {
gtRole.setName(jsname);
Page<GtRole> page = gtRoleService.findPage(new Page<GtRole>(request, response), gtRole);
model.addAttribute("page", page);
model.addAttribute("jsname", jsname);
return "modules/gtxt/city/gtRoleList";
}
@RequiresPermissions("city:gtRole:view")
@RequestMapping(value = "form")
public String form(GtRole gtRole, Model model) {
gtRole.setZone(UserUtils.getUser().getCompany().getId());
model.addAttribute("gtRole", gtRole);
return "modules/gtxt/city/gtRoleForm";
}
@RequiresPermissions("city:gtRole:view")
@RequestMapping(value = "shouquan")
public String shouquan(Office office,GtRole gtrole, HttpServletRequest request,HttpServletResponse response,Model model) {
/* System.out.println("ssss"+gtrole);
office.setId(request.getParameter("office.id"));
office.setName(request.getParameter("office.name"));
*/
List<GtSlroleDjyw> getSlr=gtsolrdjywService.findYwListByRoleId(gtrole.getId());
StringBuffer sr=new StringBuffer();
for (GtSlroleDjyw gtSlroleDjyw : getSlr) {
sr.append(gtSlroleDjyw.getYwId().getId()+",");
}
model.addAttribute("ywIdsRole",sr);
model.addAttribute("gtrole", gtrole);
model.addAttribute("checked", true);
return "modules/gtxt/city/sysDefSlroleForm2";
}
@RequiresPermissions("city:gtRole:edit")
@RequestMapping(value = "save")
public String save(GtRole gtRole, Model model, RedirectAttributes redirectAttributes) {
if (!beanValidator(model, gtRole)){
return form(gtRole, model);
}
gtRoleService.save(gtRole);
addMessage(redirectAttributes, "保存柜台受理角色管理成功");
return "redirect:"+Global.getAdminPath()+"/city/gtRole/?repage";
}
@RequiresPermissions("city:gtRole:edit")
@RequestMapping(value = "delete")
public String delete(GtRole gtRole, RedirectAttributes redirectAttributes) {
gtRoleService.delete(gtRole);
addMessage(redirectAttributes, "删除柜台受理角色管理成功");
return "redirect:"+Global.getAdminPath()+"/city/gtRole/?repage";
}
/*
* 受理角色与业务关系表
*/
@RequiresPermissions("city:gtRole:edit")
@RequestMapping(value = "savedi")
public String savedi(GtRole gtrole,String id,String ywIds, Model model, RedirectAttributes redirectAttributes) {
//User user = UserUtils.getUser();
//sysDefSlrole.setQyId(user.getCompany().getId());
//sysDefSlrole.setQyId(UserUtils.getUser().getId());
//删除此角色下的所有业务ID。在重新添加
gtsolrdjywService.deleteYwInfoListByRoleId(gtrole.getId());
//添加
String ywid[] =gtrole.getYwIds().split(",");
for (String s : ywid) {
System.out.println(s);
GtSlroleDjyw ry=new GtSlroleDjyw();
ry.setRoleid(gtrole.getId());
DYwinfo dy=new DYwinfo();
dy.setId(s);
ry.setYwId(dy);
gtsolrdjywService.saveRoleidYwid(ry);
}
addMessage(redirectAttributes, "保存定制受理角色成功");
return "redirect:"+Global.getAdminPath()+"/city/gtRole/?repage";
}
/*@RequiresPermissions("user")---treedatacheckInfo 20160908
@ResponseBody
@RequestMapping(value = "treeDataCheckInfo")
public List<Map<String, Object>> treeDataCheckInfo(@RequestParam(required = false) String extId, @RequestParam(required = false) String type, HttpServletResponse response) {
List<Map<String, Object>> mapList = Lists.newArrayList();
Ywinfo y = new Ywinfo();
y.setType(type);
List<Ywinfo> list = ywinfoService.findList(y);
Organization organization = organizationService.search(UserUtils.getUser().getCompany());
if (organization != null && organization.getYwList() != null) {
List<Ywinfo> ywList = organization.getYwList();
String ids = "";
for (Ywinfo yw : ywList) {
ids += yw.getParentIds();
ids += yw.getId() + ",";
}
for (int i = 0; i < list.size(); i++) {
Ywinfo e = list.get(i);
if (ids.indexOf("," + e.getId() + ",") > -1 && (StringUtils.isBlank(extId) || (extId != null && !extId.equals(e.getId()) && e.getParentIds().indexOf("," + extId + ",") == -1))) {
Map<String, Object> map = Maps.newHashMap();
map.put("id", e.getId());
map.put("pId", e.getParentId());
//map.put("pIds", e.getParentIds());
map.put("name", e.getName());
mapList.add(map);
}
}
}
return mapList;
}*/
}
|
[
"[email protected]"
] | |
793ea9d9d3067df136c6a2934f10dbb01c97957f
|
044339836b614855d5b5444ff3b3c46da9379ddc
|
/api/src/main/java/com/waes/differ/api/configuration/SwaggerConfig.java
|
715c2b63883b1689f5c97933bb1817671b30d403
|
[] |
no_license
|
tomaskroth/assigment-1
|
5744489bb80ee76c3cd313e07ea96aa59aa292b8
|
35330713444875c18a6eb5d730236fe26a65b9f9
|
refs/heads/master
| 2020-03-25T23:33:26.337829 | 2018-08-07T05:02:04 | 2018-08-07T05:02:04 | 144,280,393 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 797 |
java
|
package com.waes.differ.api.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.waes.differ.api"))
.paths(PathSelectors.any())
.build();
}
}
|
[
"[email protected]"
] | |
8fefda14afe55a2dd54e4acd5c57b2142923981d
|
a484a3994e079fc2f340470a658e1797cd44e8de
|
/app/src/main/java/shangri/example/com/shangri/presenter/RegisterPresenter.java
|
50e992b0d265baa1990533f89c7f1332145010a5
|
[] |
no_license
|
nmbwq/newLiveHome
|
2c4bef9b2bc0b83038dd91c7bf7a6a6a2c987437
|
fde0011f14e17ade627426935cd514fcead5096c
|
refs/heads/master
| 2020-07-12T20:33:23.502494 | 2019-08-28T09:55:52 | 2019-08-28T09:55:52 | 204,899,192 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,305 |
java
|
package shangri.example.com.shangri.presenter;
import android.content.Context;
import shangri.example.com.shangri.UserConfig;
import shangri.example.com.shangri.api.RxHelper;
import shangri.example.com.shangri.api.RxObserver;
import shangri.example.com.shangri.base.BasePresenter;
import shangri.example.com.shangri.model.bean.request.BaseRequestEntity;
import shangri.example.com.shangri.model.bean.request.CheckCodeBean;
import shangri.example.com.shangri.model.bean.request.GetSMSVerificationCodeBean;
import shangri.example.com.shangri.model.bean.request.ResetPwdBean;
import shangri.example.com.shangri.model.bean.request.TelBean;
import shangri.example.com.shangri.model.bean.request.WeChatBean;
import shangri.example.com.shangri.model.bean.response.BaseResponseEntity;
import shangri.example.com.shangri.model.bean.response.TelResposeBean;
import shangri.example.com.shangri.model.bean.response.UserRegistrationNext;
import shangri.example.com.shangri.model.bean.response.WebBean;
import shangri.example.com.shangri.presenter.view.RegisterView;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
/**
* Created by chengaofu on 2017/6/27.
*/
public class RegisterPresenter extends BasePresenter<RegisterView> {
private RegisterView mRegisterView;
public RegisterPresenter(Context context, RegisterView view) {
super(context, view);
mRegisterView = view;
}
/**
* 注册获取短信验证码
*
* @param tel 手机
* @param type 类型
*/
public void getSMSVerificationCode(String tel, String type) {
RxObserver rxObserver = new RxObserver<Object>() {
@Override
public void onHandleSuccess(Object resultBean) {
}
@Override
public void onHandleComplete() {
mRegisterView.getSMSVerificationCode(); //成功获取验证码后
}
@Override
public void onHandleFailed(String message) {
mRegisterView.requestFailed(message);
}
};
GetSMSVerificationCodeBean codeBean = new GetSMSVerificationCodeBean();
codeBean.setTelephone(tel);
codeBean.setType(type);
Observable<BaseResponseEntity<Object>> observable = mRxSerivce.getSMSVerificationCode(codeBean);
Disposable disposable = observable
.compose(RxHelper.handleObservableResult())
.subscribeWith(rxObserver);
addSubscribe(disposable);
}
/**
* 注册下一步校验验证码
*
* @param tel 手机
* @param code 验证码
*/
public void checkCode(String tel, String code, String type) {
RxObserver rxObserver = new RxObserver<UserRegistrationNext>() {
@Override
public void onHandleSuccess(UserRegistrationNext resultBean) {
if (resultBean != null) {
//设置token值
// UserConfig.getInstance().setToken(resultBean.getToken().trim());
UserConfig.getInstance().setMobile(resultBean.getTelephone().trim());
}
mRegisterView.checkCode(resultBean); //检验校验码成功
}
@Override
public void onHandleComplete() {
mRegisterView.checkCode(null); //检验校验码成功
}
@Override
public void onHandleFailed(String message) {
mRegisterView.requestFailed(message); //检验校验码成功
}
};
CheckCodeBean codeBean = new CheckCodeBean();
codeBean.setTelephone(tel);
codeBean.setVerify_code(code);
codeBean.setType(type);
// BaseRequestEntity<CheckCodeBean> requestEntity =
// new BaseRequestEntity<CheckCodeBean>();
// requestEntity.setData(codeBean);
//
// //加密后的entity
// BaseRequestEntity<CheckCodeBean> entity =
// (BaseRequestEntity<CheckCodeBean>) KeytUtil.getRSAKeyt(requestEntity, null);
Observable<BaseResponseEntity<UserRegistrationNext>> observable = mRxSerivce.checkCode(codeBean);
Disposable disposable = observable
.compose(RxHelper.<UserRegistrationNext>handleObservableResult())
.subscribeWith(rxObserver);
addSubscribe(disposable);
}
/**
* 检测手机是否注册
*
* @param tel
*/
public void checkPhone(String tel) {
RxObserver rxObserver = new RxObserver<TelResposeBean>() {
@Override
public void onHandleSuccess(TelResposeBean resultBean) {
mRegisterView.checkPhone(resultBean.count);
}
@Override
public void onHandleComplete() {
}
@Override
public void onHandleFailed(String message) {
mRegisterView.requestFailed(message);
}
};
TelBean codeBean = new TelBean();
codeBean.telephone = tel;
Observable<BaseResponseEntity<TelResposeBean>> observable = mRxSerivce.checkPhone(codeBean);
Disposable disposable = observable
.compose(RxHelper.<TelResposeBean>handleObservableResult())
.subscribeWith(rxObserver);
addSubscribe(disposable);
}
public void weburl() {
RxObserver rxObserver = new RxObserver<WebBean>() {
@Override
public void onHandleSuccess(WebBean resultBean) {
mRegisterView.signProtocol(resultBean);
}
@Override
public void onHandleComplete() {
}
@Override
public void onHandleFailed(String message) {
mRegisterView.requestFailed(message);
}
};
BaseRequestEntity<WeChatBean> requestEntity =
new BaseRequestEntity<WeChatBean>();
WeChatBean weChatBean = new WeChatBean();
Observable<BaseResponseEntity<WebBean>> observable = mRxSerivce.signProtocol(weChatBean);
Disposable disposable = observable
.compose(RxHelper.<WebBean>handleObservableResult())
.subscribeWith(rxObserver);
addSubscribe(disposable);
}
}
|
[
"[email protected]"
] | |
538e7ed61c556d60575cee554176226b772ce114
|
7581ffde6c694c258d502339df3d5cb85c7b71f5
|
/android/androiddemo/app/src/main/java/com/zego/zegosdkdemo/Config.java
|
deb35715e051a591c26d138f1a8b783ed8fc858f
|
[] |
no_license
|
twstx/ZegoKitDemo
|
cd7d4bb0803284cc9c8e1162dad6db8694a5a8b7
|
83c0bc627f4eece993e4ae6f2a65fc8108c8a958
|
refs/heads/master
| 2020-12-31T07:41:41.368296 | 2016-12-20T08:08:27 | 2016-12-20T08:08:27 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,182 |
java
|
package com.zego.zegosdkdemo;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.TextView;
public class Config extends Activity{
static public final int ONLINE_ENV = 0;
static public final int TEST_ENV = 1;
static public final int DEMO_APP = 0;
static public final int CUSTOM_APP = 1;
private String[] szItem = {"正式环境","开发环境"};
private String[] szItemSign = {"Demo APPID","自定义APPID"};
private Spinner spinner;
private ArrayAdapter<String> adapter;
private Spinner spinnerAPP;
private ArrayAdapter<String> adapterAPP;
@SuppressLint("NewApi")
public void SetResult()
{
int nPos = spinner.getSelectedItemPosition();
Intent intent = new Intent();
intent.putExtra("Env", nPos);
if(nPos == TEST_ENV)
{
EditText edIP = (EditText)findViewById(R.id.editIP);
EditText edPort = (EditText)findViewById(R.id.editPort);
String strIP = edIP.getText().toString();
String strPort = edPort.getText().toString();
if(!strPort.isEmpty())
{
int nPort = Integer.parseInt(strPort);
intent.putExtra("Port", nPort);
}
intent.putExtra("IP", strIP);
}
int nPosApp = spinnerAPP.getSelectedItemPosition();
intent.putExtra("EnvAPP", nPosApp);
if(nPosApp == CUSTOM_APP)
{
EditText edAppID = (EditText)findViewById(R.id.editAppID);
EditText edSign = (EditText)findViewById(R.id.editSign);
String strAppID = edAppID.getText().toString();
String strSign = edSign.getText().toString();
if(!strAppID.isEmpty())
{
int nAppID = Integer.parseInt(strAppID);
intent.putExtra("AppID", nAppID);
}
if(!strSign.isEmpty())
{
byte[] szSign = ConvertStringToSign(strSign);
intent.putExtra("Sign", szSign);
}
}
setResult(RESULT_OK, intent);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
SetResult();
finish();
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.config);
Intent intent = getIntent();
int nEnv = intent.getIntExtra("Env", 0);
if(nEnv == TEST_ENV)
{
String strIP = intent.getStringExtra("IP");
int nPort = intent.getIntExtra("Port", 9001);
EditText edIP = (EditText)findViewById(R.id.editIP);
EditText edPort = (EditText)findViewById(R.id.editPort);
edIP.setText(strIP);
edPort.setText(Integer.toString(nPort));
}
//room list
spinner = (Spinner) findViewById(R.id.spinnerServer);
adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,szItem);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
//添加事件Spinner事件监听
spinner.setOnItemSelectedListener(new SpinnerSelectedListener());
spinner.setSelection(nEnv);
spinner.setVisibility(View.VISIBLE);
int nAPP = intent.getIntExtra("EnvAPP", 0);
if(nAPP == CUSTOM_APP)
{
int nAPPID = intent.getIntExtra("AppID", 0);
byte[] szTestSignkey = intent.getByteArrayExtra("Sign");
EditText edAppID = (EditText)findViewById(R.id.editAppID);
edAppID.setText(Integer.toString(nAPPID));
EditText edAppSign = (EditText)findViewById(R.id.editSign);
edAppSign.setText(ConvertSignToString(szTestSignkey));
}
spinnerAPP = (Spinner) findViewById(R.id.spinnerSign);
adapterAPP = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,szItemSign);
adapterAPP.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerAPP.setAdapter(adapterAPP);
//添加事件Spinner事件监听
spinnerAPP.setOnItemSelectedListener(new SpinnerSelectedListener());
spinnerAPP.setSelection(nAPP);
spinnerAPP.setVisibility(View.VISIBLE);
Button btnOK = (Button)findViewById(R.id.btnOK);
btnOK.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View arg0) {
SetResult();
finish();
}
});
}
//使用数组形式操作
class SpinnerSelectedListener implements OnItemSelectedListener{
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
if(arg0 == spinner)
ShowTestServerUI(arg2);
else if(arg0 == spinnerAPP)
SHowTestAppUI(arg2);
}
public void onNothingSelected(AdapterView<?> arg0) {
}
}
private void ShowTestServerUI(int nEnv)
{
TextView tvIP = (TextView)findViewById(R.id.tvIP);
TextView tvPort = (TextView)findViewById(R.id.tvPort);
EditText edIP = (EditText)findViewById(R.id.editIP);
EditText edPort = (EditText)findViewById(R.id.editPort);
if(nEnv == ONLINE_ENV)
{
tvIP.setVisibility(View.INVISIBLE);
tvPort.setVisibility(View.INVISIBLE);
edIP.setVisibility(View.INVISIBLE);
edPort.setVisibility(View.INVISIBLE);
}
else if(nEnv == TEST_ENV)
{
tvIP.setVisibility(View.VISIBLE);
tvPort.setVisibility(View.VISIBLE);
edIP.setVisibility(View.VISIBLE);
edPort.setVisibility(View.VISIBLE);
}
}
private void SHowTestAppUI(int nAPP)
{
TextView tvAppID = (TextView)findViewById(R.id.tvAppID);
TextView tvSign = (TextView)findViewById(R.id.tvSign);
EditText edAppID = (EditText)findViewById(R.id.editAppID);
EditText edSign = (EditText)findViewById(R.id.editSign);
if(nAPP == DEMO_APP)
{
tvAppID.setVisibility(View.INVISIBLE);
tvSign.setVisibility(View.INVISIBLE);
edAppID.setVisibility(View.INVISIBLE);
edSign.setVisibility(View.INVISIBLE);
}
else if(nAPP == CUSTOM_APP)
{
tvAppID.setVisibility(View.VISIBLE);
tvSign.setVisibility(View.VISIBLE);
edAppID.setVisibility(View.VISIBLE);
edSign.setVisibility(View.VISIBLE);
}
}
@SuppressLint("DefaultLocale")
private String ConvertSignToString(byte[] szSignkey)
{
String strRet = "";
if(szSignkey == null)
return strRet;
int nLen = szSignkey.length;
String strTemp = "";
for(int i = 0; i < nLen; i++)
{
strTemp = Integer.toHexString(szSignkey[i]);
if(strTemp.length() == 1)
strRet = strRet + "0x" + strTemp;
else
strRet = strRet + "0x" +strTemp.toLowerCase().substring(strTemp.length() - 2, strTemp.length());
if(i < (nLen-1))
strRet = strRet + ",";
}
return strRet;
}
@SuppressLint({ "DefaultLocale", "NewApi" })
private byte[] ConvertStringToSign(String strSign)
{
if(strSign == null || strSign.isEmpty())
return null;
String strTemp = strSign;
strTemp = strTemp.toLowerCase();
strTemp = strTemp.replaceAll(" ", "");
strTemp = strTemp.replaceAll("0x", "");
String[] szStrTemp = strTemp.split(",");
int nLen = szStrTemp.length;
byte[] szRet = new byte[nLen];
for(int i = 0; i < nLen; i++)
{
if(szStrTemp[i].length() == 1)
szRet[i] = (byte) (toByte(szStrTemp[i].charAt(0)));
else
szRet[i] = (byte) (toByte(szStrTemp[i].charAt(0)) << 4 | toByte(szStrTemp[i].charAt(1)));
}
return szRet;
}
private byte toByte(char c) {
byte b = (byte)"0123456789abcdef".indexOf(c);
return b;
}
}
|
[
"[email protected]"
] | |
e662b2ca8774829945bee20659d1cecbd0a2662d
|
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
|
/sources/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapPublisher.java
|
5e9296475d241d794ac3ef796aab023c3a69cc4c
|
[] |
no_license
|
Auch-Auch/avito_source
|
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
|
76fdcc5b7e036c57ecc193e790b0582481768cdc
|
refs/heads/master
| 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 807 |
java
|
package io.reactivex.rxjava3.internal.operators.flowable;
import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.operators.flowable.FlowableMap;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
public final class FlowableMapPublisher<T, U> extends Flowable<U> {
public final Publisher<T> b;
public final Function<? super T, ? extends U> c;
public FlowableMapPublisher(Publisher<T> publisher, Function<? super T, ? extends U> function) {
this.b = publisher;
this.c = function;
}
@Override // io.reactivex.rxjava3.core.Flowable
public void subscribeActual(Subscriber<? super U> subscriber) {
this.b.subscribe(new FlowableMap.b(subscriber, this.c));
}
}
|
[
"[email protected]"
] | |
d1df758277176ecc778383d31765f82fa15633e7
|
3aa62cf48d27d7ccf1d93424665d26d6fce57d08
|
/src/main/java/com/joo/s3/bankbook/BankBookController.java
|
2e664f39d49d72771a40e1fc81b6ed27846b8a9d
|
[] |
no_license
|
yunjoo11/Spring3_1
|
880fd864f364f052425eddc6c003165049eebbff
|
3c9fd9b2ba06c909c3a7eb74df7811316f4cd484
|
refs/heads/main
| 2023-04-26T16:28:34.036614 | 2021-03-26T08:04:54 | 2021-03-26T08:04:54 | 350,248,217 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,834 |
java
|
package com.joo.s3.bankbook;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping(value="/bankbook/**")
public class BankBookController {
@Autowired
private BankBookService bankBookService;
@RequestMapping("bankbookUpdate")
public void setUpdate(BankBookDTO bankBookDTO, Model model)throws Exception{
bankBookDTO= bankBookService.getSelect(bankBookDTO);
model.addAttribute("dto", bankBookDTO);
}
@RequestMapping(value="bankbookUpdate", method = RequestMethod.POST)
public String setUpdate(BankBookDTO bankBookDTO)throws Exception{
int result = bankBookService.setUpdate(bankBookDTO);
return "redirect:./bankbookList";
}
@RequestMapping(value="bankbookDelete")
public String setDelete(BankBookDTO bankBookDTO)throws Exception{
System.out.println("Delete~~!");
System.out.println(bankBookDTO.getBookNumber());
int result = bankBookService.setDelete(bankBookDTO);
System.out.println(result);
return "redirect:./bankbookList";
}
@RequestMapping(value="bankbookList")
public void getList(Model model) throws Exception{
List<BankBookDTO> ar= bankBookService.getList();
model.addAttribute("list", ar);
}
@RequestMapping(value="bankbookSelect")
public ModelAndView getSelect(BankBookDTO bankBookDTO)throws Exception{
ModelAndView mv= new ModelAndView();
bankBookDTO= bankBookService.getSelect(bankBookDTO);
mv.addObject("dto", bankBookDTO);
mv.setViewName("bankbook/bankbookSelect");
return mv;
}
}
|
[
"[email protected]"
] | |
8674de95f0f8448e3ea1bd014f3912429df1ef97
|
7f3e8a5ae3f78eb63e0f77184b7bd4f0c5c89b52
|
/MutualAid/src/com/four/dao/Users.java
|
dd028d2d237dccb275301bf4df80381bb6061ba1
|
[] |
no_license
|
BigPowerExcavator/GiveMeAHead
|
56b8b5f11add5d48ca0d42b9d39c10c1e54203a0
|
1b261cf2ac5a2adf9526020cf71fda96642a2c80
|
refs/heads/master
| 2020-04-05T14:48:08.235641 | 2018-11-17T03:26:05 | 2018-11-17T03:26:05 | 156,941,410 | 0 | 0 | null | null | null | null |
GB18030
|
Java
| false | false | 876 |
java
|
package com.four.dao;
import java.util.Map;
import com.four.javaBean.UserRegisterBean;
import com.four.javaBean.UsersBean;
public interface Users {
public abstract UsersBean getPasswd(int stuId) ;
public abstract boolean checkUserName(String userName);
public abstract boolean userRegister(UserRegisterBean user);
public abstract boolean changeUserHeadImg(String imgPart,String stuId);
//修改用户信息
public abstract boolean upadteInfo(int stuNum,String userName,String trueName,String sex,String dormitory,String phone,int stuId);
//判断该学号存不存在(相当于判断用户存不存在)
public abstract boolean ProveUser(int stuNum);
//修改密码
public abstract boolean updatePasswd(int stuNum,String passwd);
//返回个人中心所需要的信息
public abstract Map<String, String> Personal(String stuNum);
}
|
[
"[email protected]"
] | |
fee4607dd090a5586506f2cdbb41ce0cc9739d4f
|
256df6f7b35bdadcb447123b7b4c98044d9a42ec
|
/app/src/main/java/com/example/bbreda/cardmanager/presentation/login/LoginFragment.java
|
a8712d4383e15b394457bfa4ab9f7ac99442fe1d
|
[] |
no_license
|
bredaskt/CardManager
|
69e2cfd283c8f6edf1f34d6c8605892b232e1c34
|
685b625e6c64a37cc66a70dd7c8edd55413d4ec5
|
refs/heads/master
| 2020-03-28T07:13:43.920650 | 2019-02-07T16:26:01 | 2019-02-07T16:26:01 | 147,888,346 | 0 | 0 | null | 2018-09-09T22:05:53 | 2018-09-08T00:53:31 |
Java
|
UTF-8
|
Java
| false | false | 5,043 |
java
|
package com.example.bbreda.cardmanager.presentation.login;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.example.bbreda.cardmanager.R;
import com.example.bbreda.cardmanager.presentation.home.HomeActivity;
import com.example.bbreda.cardmanager.presentation.registration.RegistrationActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
public class LoginFragment extends Fragment implements LoginContract.View {
@BindView(R.id.btn_login)
Button mButtonLogin;
@BindView(R.id.btn_registration)
Button mButtonGoToRegistration;
@BindView(R.id.et_email_log)
EditText mEmail;
@BindView(R.id.et_senha)
EditText mPassword;
ProgressDialog progressDoalog;
private LoginContract.Presenter mPresenter;
public static LoginFragment newInstance() {
return new LoginFragment();
}
@Override
public void setPresenter(LoginContract.Presenter presenter) {
mPresenter = presenter;
}
// clique do botao (listener) para abrir a tela apos clicar em login
private View.OnClickListener mButtonLoginListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
mPresenter.onButtonClickLogin(mEmail.getText().toString(), mPassword.getText().toString());
showLoading();
};
};
// clique do botao (listener) para abrir a tela apos clicar em solicitar cadastro
private View.OnClickListener mButtonRegistrationListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
mPresenter.onButtonClickToRegistrationScreen();
}
};
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_login, container, false);
ButterKnife.bind(this, view);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mButtonLogin.setOnClickListener(mButtonLoginListener);
mButtonGoToRegistration.setOnClickListener(mButtonRegistrationListener);
}
@Override
public void onStart() {
super.onStart();
mPresenter.start();
}
@Override
public void showMessageErrorFilledFormLoginGeneric() {
Toast.makeText(getContext(), R.string.string_fields_error_login, Toast.LENGTH_SHORT).show();
}
@Override
public void showMessageNetworkError() {
Toast.makeText(getContext(), R.string.string_network_error, Toast.LENGTH_SHORT).show();
}
@Override
public void showLoading() {
progressDoalog = new ProgressDialog(getViewContext());
progressDoalog.setMax(100);
progressDoalog.setMessage("Verificando seus dados de acesso, aguarde por favor...");
progressDoalog.setTitle("CardManager");
progressDoalog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDoalog.show();
new Thread(new Runnable() {
@Override
public void run() {
try {
while (progressDoalog.getProgress() <= progressDoalog.getMax()) {
Thread.sleep(200);
handle.sendMessage(handle.obtainMessage());
if (progressDoalog.getProgress() == progressDoalog.getMax()) {
hideLoading();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
Handler handle = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
progressDoalog.incrementProgressBy(15);
};
};
@Override
public void hideLoading() {
//progressDoalog.dismiss();
}
@Override
public void goToHomeScreen() {
startActivity(new Intent(getContext(), HomeActivity.class));
getActivity().finish();
}
@Override
public void goToRegistrationScreen() {
startActivity(new Intent(getContext(), RegistrationActivity.class));
getActivity().finish();
}
@Override
public Context getViewContext() { return getContext(); }
}
|
[
"[email protected]"
] | |
4972325a575f679d6931b8e9e34f725536454822
|
dc83fa0feb09324e21c71fb5da270dec21c4492d
|
/MyBatis-3.1.1/test/driver/Test.java
|
4bbd4f2b2c2083484883dbb0b879017bccdf3450
|
[] |
no_license
|
lhw209/half-cms
|
51824b285b503324d442157553c00c2c488d71bb
|
47be78fc5f8d500a6419bbc0f27ea579fae6c12f
|
refs/heads/master
| 2020-06-05T08:22:03.874065 | 2013-01-29T15:55:13 | 2013-01-29T15:55:13 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,071 |
java
|
package driver;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.log4j.Logger;
public class Test {
private static Logger log = Logger.getLogger(Test.class);
public static void main(String args[]) throws IOException {
org.apache.ibatis.logging.LogFactory.useLog4JLogging();
String a = "test";
String resource = "mybatis-config.xml";
InputStream reader = Resources.getResourceAsStream(resource);
Properties prop = new Properties();
prop.load(Resources.getResourceAsReader("config.properties"));
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader, prop);
SqlSession session = sqlSessionFactory.openSession();
session.selectOne("mapper.UserMapper.selectByPrimaryKey", 101);
log.debug("over");
}
}
|
[
"[email protected]"
] | |
62fcdb3ce889dd031bd2ed502aa7640c00ef01e5
|
7194c655a2a33a1b17b49a17eb7023390d46cfd8
|
/src/com/pkq/firewallupdate/app/WindowsUpdater.java
|
3daf565c2e40da52f2118357129b801a3e87f5c9
|
[] |
no_license
|
xuanxuanfox/firewallupdate
|
78e0d72f5ec32cabc89a3b8878fefc1e16574afa
|
382c036fddbeb9725d134a18b446f1886806cb92
|
refs/heads/master
| 2021-01-09T21:52:20.092549 | 2015-06-02T13:01:10 | 2015-06-02T13:01:10 | 36,733,099 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 402 |
java
|
package com.pkq.firewallupdate.app;
public class WindowsUpdater extends Updater{
public WindowsUpdater(){
//updateShellFile = "..\\agentUpdate\\update.bat";
updateShellFile = new String[2];
updateShellFile[0] = "C:\\pkqfirewall\\agentUpdate\\update1.bat";
updateShellFile[1] = "C:\\pkqfirewall\\agentUpdate\\update2.bat";
versionFile = "C:\\pkqfirewall\\pkqfirewallAgent\\pf.version";
}
}
|
[
"[email protected]"
] | |
44c1943d7d3059d6fe6e85440c84fb2b83d35255
|
53073a648fc85aee29d3d3080a2cc87937eb8cd9
|
/src/com/iskyshop/foundation/domain/Area.java
|
3e9227bedb0a9913427193e06bfbccfea30a88f8
|
[] |
no_license
|
Arlinlol/UziShop
|
850e1ac3a156339d0b6914934813502406e423f8
|
0a1a112638ac15341502f78d124683d2699e6de7
|
refs/heads/master
| 2021-01-19T07:19:03.808599 | 2014-03-28T07:56:42 | 2014-03-28T07:56:42 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,958 |
java
|
package com.iskyshop.foundation.domain;
import com.iskyshop.core.domain.IdEntity;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Entity
@Table(name = "iskyshop_area")
public class Area extends IdEntity {
private String areaName;
@SuppressWarnings({ "unchecked", "rawtypes" })
@OneToMany(mappedBy = "parent", cascade = { javax.persistence.CascadeType.REMOVE })
private List<Area> childs = new ArrayList();
@ManyToOne(fetch = FetchType.LAZY)
private Area parent;
private int sequence;
private int level;
@Column(columnDefinition = "bit default false")
private boolean common;
public boolean isCommon() {
return this.common;
}
public void setCommon(boolean common) {
this.common = common;
}
public List<Area> getChilds() {
return this.childs;
}
public void setChilds(List<Area> childs) {
this.childs = childs;
}
public Area getParent() {
return this.parent;
}
public void setParent(Area parent) {
this.parent = parent;
}
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public int getLevel() {
return this.level;
}
public void setLevel(int level) {
this.level = level;
}
public int getSequence() {
return this.sequence;
}
public void setSequence(int sequence) {
this.sequence = sequence;
}
}
|
[
"[email protected]"
] | |
591365cea46ce508579ae341a842498b626840fd
|
4689952eaee715e4040873d2d54500cbb51c3e06
|
/src/chapter_4/java/ClassAverage.java
|
f48e32438da631a8411600def482de20149c80d2
|
[] |
no_license
|
MaryNSu/LearningJava
|
4b4d9d6a988ba7715ec7826bdf8316966b40f000
|
58b2404b943b11c2f534480ee52749820f520a91
|
refs/heads/master
| 2022-07-18T10:57:32.867535 | 2020-05-10T10:59:19 | 2020-05-10T10:59:19 | 262,763,392 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 817 |
java
|
package chapter_4.java;
import java.util.Scanner;
public class ClassAverage {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int total = 0; // initialize sum of grades entered by the user
int gradeCounter = 1; // initialize # of grade to be entered next
// processing phase uses counter-controlled repetition
while (gradeCounter <= 10) { // loop 10 times
System.out.print("Enter grade: "); // prompt
int grade = input.nextInt(); // input next grade
total = total + grade; // add grade to total
gradeCounter = gradeCounter + 1; // increment counter by 1
}
int average = total / 10; // integer division yields integer result
System.out.printf("%nTotal of all 10 grades is %d%n", total);
System.out.printf("Class average is %d%n", average);
}
}
|
[
"[email protected]"
] | |
11db6d9b527c02d3584005188469c4bd13e304c7
|
553a9715fd40ab7cc21c8b4844b382fd89045c23
|
/apps/xcchlib-core-sample/src/main/java/paper/java/core/StandardObjectsEqualChecker.java
|
d18826de0cd8ed3cd618415a59b3b97952dc73b4
|
[] |
no_license
|
cClaude/cchlib
|
bae0fa5fda8aa20ebb94ce5cf4d0d47ad8595b6a
|
f6437516f79b74617aaa05d97d74c0867f6617be
|
refs/heads/master
| 2020-05-21T14:04:57.480581 | 2017-05-01T19:29:58 | 2017-05-01T19:29:58 | 32,205,927 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,494 |
java
|
package paper.java.core;
public class StandardObjectsEqualChecker {
public static void main(final String...args)
{
checkInteger();
checkDouble();
checkString();
}
@SuppressWarnings("boxing")
private static void checkInteger()
{
final Integer i1 = 1;
final Integer i2 = 1;
final Integer i3 = Integer.valueOf( 1 );
final Integer i4 = Integer.valueOf( 1 );
final Integer i5 = new Integer( 1 );
final Integer i6 = new Integer( 1 );
display( "Integer", i1, i2, i3, i4, i5, i6 );
}
@SuppressWarnings("boxing")
private static void checkDouble()
{
final Double i1 = 1.0;
final Double i2 = 1.0;
final Double i3 = Double.valueOf( 1.0 );
final Double i4 = Double.valueOf( 1.0 );
final Double i5 = new Double( 1.0 );
final Double i6 = new Double( 1.0 );
display( "Double", i1, i2, i3, i4, i5, i6 );
}
private static void checkString()
{
final String i1 = "1.0";
final String i2 = "1.0";
final String i3 = new String( "1.0" );
final String i4 = new String( "1.0" );
final String i5 = "1.0".intern();
final String i6 = "1.0".intern();
display( "String", i1, i2, i3, i4, i5, i6 );
}
private static void display(
final String message,
final Object i1,
final Object i2,
final Object i3,
final Object i4,
final Object i5,
final Object i6 )
{
System.out.println(message);
System.out.println( "i1 == i2 : " + (i1 == i2) );
System.out.println( "i1 == i3 : " + (i1 == i3) );
System.out.println( "i1 == i4 : " + (i1 == i4) );
System.out.println( "i1 == i5 : " + (i1 == i5) );
System.out.println( "i1 == i6 : " + (i1 == i6) );
System.out.println( "i2 == i3 : " + (i2 == i3) );
System.out.println( "i2 == i4 : " + (i2 == i4) );
System.out.println( "i2 == i5 : " + (i2 == i5) );
System.out.println( "i2 == i6 : " + (i2 == i6) );
System.out.println( "i3 == i4 : " + (i3 == i4) );
System.out.println( "i3 == i5 : " + (i3 == i5) );
System.out.println( "i3 == i6 : " + (i3 == i6) );
System.out.println( "i4 == i5 : " + (i4 == i5) );
System.out.println( "i4 == i6 : " + (i4 == i6) );
System.out.println( "i5 == i6 : " + (i5 == i6) );
System.out.println();
}
}
|
[
"[email protected]"
] | |
3457844d67bed5374aaaf7d525d2b1bb4fec7e07
|
e89707a861d2f8976552b06fbe019c60a17d4366
|
/src/main/java/com/StudyBoardCRUD/firstBoard/normalboard/NormalBoardApplication.java
|
93632e032c5de0171c48a7de9ba3c5eae8b49838
|
[] |
no_license
|
kalkin2/FirstBoard
|
9181a38bd8394ea16ea59bb4869dbd07f63836ba
|
cf227109a023e8527dc1d848f9e20ddb033cb87c
|
refs/heads/master
| 2022-03-29T11:02:47.290387 | 2019-12-21T14:55:51 | 2019-12-21T14:55:51 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 344 |
java
|
package com.StudyBoardCRUD.firstBoard.normalboard;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class NormalBoardApplication {
public static void main(String[] args) {
SpringApplication.run(NormalBoardApplication.class, args);
}
}
|
[
"[email protected]"
] | |
ebeb528a0d44108f0c92545b0b368d34bab376de
|
e4f6153a8f238bda574299ba4b8fba710f6d02c4
|
/servletresponse/src/com/zzb/servlet/servlet05.java
|
91651c9f90dc8542682f4d9a04fc537e6e17010f
|
[] |
no_license
|
zzb011024/JAVA
|
757462f3b224b661857351772cdadf094eed4a2b
|
146b25d2fb21eb95137a396e0a6bef7219674c14
|
refs/heads/main
| 2023-04-16T01:59:38.608046 | 2021-04-01T11:51:08 | 2021-04-01T11:51:08 | 353,681,544 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 658 |
java
|
package com.zzb.servlet;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
*重定向
*
*/
@WebServlet("/ser05")
public class servlet05 extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println("Servlet05");
//接收参数
String uname=req.getParameter("uname");
System.out.println("servlet05"+uname);
}
}
|
[
"[email protected]"
] | |
fc0dbacee15e53bd675a0431537c53bf834e66a5
|
e98eda6e84e645d16e0a313151a474c61fd7bbef
|
/app/src/main/java/com/tars/sos/data/LoginRepository.java
|
9be33399612950cb97d0229228aa1f93357888e4
|
[] |
no_license
|
Khalid-Syfullah/SOS
|
0d2fcf33a33b4539bc6cfc3d56f3fd4623525532
|
76d941c08b723d451b8010c76477e9e0b8117720
|
refs/heads/main
| 2023-08-31T18:22:34.891406 | 2021-04-09T18:16:16 | 2021-04-09T18:16:16 | 356,361,355 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,694 |
java
|
package com.tars.sos.data;
import com.tars.sos.data.model.LoggedInUser;
/**
* Class that requests authentication and user information from the remote data source and
* maintains an in-memory cache of login status and user credentials information.
*/
public class LoginRepository {
private static volatile LoginRepository instance;
private LoginDataSource dataSource;
// If user credentials will be cached in local storage, it is recommended it be encrypted
// @see https://developer.android.com/training/articles/keystore
private LoggedInUser user = null;
// private constructor : singleton access
private LoginRepository(LoginDataSource dataSource) {
this.dataSource = dataSource;
}
public static LoginRepository getInstance(LoginDataSource dataSource) {
if (instance == null) {
instance = new LoginRepository(dataSource);
}
return instance;
}
public boolean isLoggedIn() {
return user != null;
}
public void logout() {
user = null;
dataSource.logout();
}
private void setLoggedInUser(LoggedInUser user) {
this.user = user;
// If user credentials will be cached in local storage, it is recommended it be encrypted
// @see https://developer.android.com/training/articles/keystore
}
public Result<LoggedInUser> login(String username, String password) {
// handle login
Result<LoggedInUser> result = dataSource.login(username, password);
if (result instanceof Result.Success) {
setLoggedInUser(((Result.Success<LoggedInUser>) result).getData());
}
return result;
}
}
|
[
"[email protected]"
] | |
699c19c4d58177a02a1717fafd32bc34c88f875e
|
95473636330f6fa9a873e07163de01389aa9b5ef
|
/src/main/java/lang/bogus/expression/MultiplicationOperationExpression.java
|
b0b43bdf9198f6b540d86d2c1a8948a991371965
|
[] |
no_license
|
juhofriman/bogus-lang-java
|
d3a65e22e08adab8026575f76091c5792aa49242
|
68617a5ec721a8e47a1d8516d8820106adb9fc91
|
refs/heads/master
| 2022-12-18T18:46:22.394233 | 2020-09-18T06:48:08 | 2020-09-18T06:48:08 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 537 |
java
|
package lang.bogus.expression;
import lang.bogus.runtime.BogusScope;
import lang.bogus.value.Value;
public class MultiplicationOperationExpression implements Expression {
private final Expression left;
private final Expression right;
public MultiplicationOperationExpression(Expression left, Expression right) {
this.left = left;
this.right = right;
}
@Override
public Value evaluate(BogusScope scope) {
return left.evaluate(scope).applyMultiplication(right.evaluate(scope));
}
}
|
[
"[email protected]"
] | |
46310f0a478f3c8c808167df19fc99492e9d7c63
|
20db8d9f5327f7d2a34a79b34eb70f97268c12d0
|
/java/java8/datetime/PeriodAndDurationDemo.java
|
3a1ffb85b3577ca062a2c4a4523263d8b45dff35
|
[
"MIT"
] |
permissive
|
GenweiWu/Blog
|
f0074fcd6aefcdfd65d30f349136652b8d00665a
|
8dcf1f75bbc014588ed1ff8a369977f5ffb18802
|
refs/heads/master
| 2023-09-01T12:43:31.951675 | 2023-08-25T01:50:18 | 2023-08-25T01:50:18 | 55,876,072 | 8 | 4 | null | null | null | null |
UTF-8
|
Java
| false | false | 843 |
java
|
package com.njust.test.java8;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.Period;
import org.junit.Test;
public class PeriodAndDurationDemo
{
/**
* 天数:30
* 分钟:40
*/
@Test
public void test01()
{
//1.Period对一个LocalDate
LocalDate localDate1 = LocalDate.now();
LocalDate localDate2 = LocalDate.of(2020, 11, 11);
Period period = Period.between(localDate1, localDate2);
System.out.println("天数:" + period.getDays());
//2.Duration对应LocalTIme
LocalTime localTime1 = LocalTime.now();
LocalTime localTime2 = LocalTime.of(12, 0);
Duration duration = Duration.between(localTime1, localTime2);
System.out.println("分钟:" + duration.toMinutes());
}
}
|
[
"[email protected]"
] | |
a18b6c621bc6f7904e7d5886bb1b496d49569561
|
1763ceaab49c4b54fe445f4b0e49b4ed3a176f5f
|
/app/src/main/java/com/br/ifpe/myapplication/PerfilProfActivity.java
|
dcc73786526bd834f8fbe8b9a6e8593bc334b9c7
|
[] |
no_license
|
adm24Help/rep24help
|
4d2b3ebff72b6bd169f4d26564e69f29927c08ad
|
036f36b3a44ebc2f48003d61eb441e7350e1f1f1
|
refs/heads/master
| 2020-06-22T06:57:17.187613 | 2020-01-18T21:05:28 | 2020-01-18T21:05:28 | 197,665,090 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 791 |
java
|
package com.br.ifpe.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.SupportMapFragment;
public class PerfilProfActivity extends Fragment {
/*
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.activity_perfil_prof, container, false);
return view;
}
}
|
[
"[email protected]"
] | |
82f7fb18d34a970167e8b187afd80ab80754c19c
|
c060815e570a8db619f17ef33299f111107f5eec
|
/blogPessoal/src/test/java/repository/TemaRepositoryTeste.java
|
e48267735adf731f8dab54729d15554d97afae0c
|
[] |
no_license
|
jessica-mss/generation_bloco2
|
8a6e3957266d0db6812a60fa89bfcdd4672e5736
|
f8676b1b577b801a383c9240f78eb6e16a42684f
|
refs/heads/main
| 2023-06-19T12:57:55.396017 | 2021-07-16T02:24:50 | 2021-07-16T02:24:50 | 378,749,115 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,731 |
java
|
package repository;
import static org.junit.jupiter.api.Assertions.assertFalse;
import java.util.List;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import org.generation.blogPessoal.model.Tema;
import org.generation.blogPessoal.repository.TemaRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class TemaRepositoryTeste {
@Autowired
public TemaRepository repositoryTestTema;
public Tema tema;
@Autowired
private ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
@BeforeEach
void start() {
tema = new Tema("ZikaF24");
if (repositoryTestTema.findAllByDescricaoContainingIgnoreCase(tema.getDescricao()) != null) {
repositoryTestTema.save(tema);
}
}
@Test
void testValidaAtributos() {
Boolean notOk = tema.getDescricao() == "oi";
Set<ConstraintViolation<Boolean>> violacao = validator.validate(notOk);
System.out.println(violacao.toString());
assertFalse(notOk);
}
@Test
void findAllByDescricaoContainingIgnoreCase() throws Exception {
List<Tema> okTheme = repositoryTestTema.findAllByDescricaoContainingIgnoreCase(tema.getDescricao());
Boolean ok = okTheme.equals(tema);
System.out.println(ok);
assertFalse(ok);
};
}
|
[
"[email protected]"
] | |
7e2c9822c2621ca3d82a671964a6b80bb09a12b8
|
d722db28279641cbbec837522a891de09c04d785
|
/src/test/java/arithmetic/ViolenceRecursionTest.java
|
99999ae55ac79945eb9c311f98bae6e6e93f42b3
|
[] |
no_license
|
yuexianbing/data_structure_test
|
c86bf53a4fffada8eb173a68bafdcf6cdbb12b6b
|
abf32147c630d8fd684a45795523b6e2cdcc0ff2
|
refs/heads/master
| 2021-06-19T02:15:47.047312 | 2021-02-20T11:50:43 | 2021-02-20T11:50:43 | 124,254,660 | 0 | 0 | null | 2020-10-27T03:15:45 | 2018-03-07T15:20:06 |
Java
|
UTF-8
|
Java
| false | false | 365 |
java
|
package arithmetic;
import com.ybin.arithmetic.leetcode.ViolenceRecursion;
import org.junit.Test;
/**
* @author : bing.yue001
* @version : 1.0
* @date : 2020-10-9 12:59
* @description :
*/
public class ViolenceRecursionTest {
@Test
public void pasterTest() {
new ViolenceRecursion().paster("babac", new String[]{"ba", "c", "abcd"});
}
}
|
[
"[email protected]"
] | |
60de7c7e5ff1ee3fbf1eef751c2d7d4dc8a08a4c
|
a4743b486ab123239861ad733257a6d9de92ac96
|
/src/Node.java
|
71e0a9ccb3d982d7b81b9cfdd642cb0762b4ca96
|
[
"MIT"
] |
permissive
|
marllonfrizzo/postfix-to-infix
|
48aace0a5dff5247e01466d954a91a7f73558592
|
f15b35df7f69f753d61694eb8e3c8916e5e19ea0
|
refs/heads/master
| 2021-01-20T13:41:27.274442 | 2018-09-03T18:59:34 | 2018-09-03T18:59:34 | 90,510,094 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 756 |
java
|
package Main;
public class Node {
private char valor;
private Node nodeEsquerda;
private Node nodeDireita;
public Node(){
}
public Node(char valor) {
this.valor = valor;
}
public char getValor() {
return valor;
}
public void setValor(char valor) {
this.valor = valor;
}
public Node getNoEsquerda() {
return nodeEsquerda;
}
public void setNoEsquerda(Node noEsquerda) {
this.nodeEsquerda = noEsquerda;
}
public Node getNoDireita() {
return nodeDireita;
}
public void setNoDireita(Node noDireita) {
this.nodeDireita = noDireita;
}
@Override
public String toString() {
return ""+valor;
}
}
|
[
"[email protected]"
] | |
33c09dc1fc5ac0f7eea30048b4ea739ba5b014ff
|
b92db1a3c7d81dd70d3ff5b97cf87ee2950611e5
|
/src/test/MyTest_Write_Maze.java
|
7ce7ccd9b19a39cb82ce9aa31433c08f0a7fa8a8
|
[] |
no_license
|
LIDORZ55/ATP-Project-PartB
|
56e7236255ff02a0ad84a9358d2a0ab8bb3332df
|
84ba43d9aecb5ae8644cb5bcc7810bb94992e125
|
refs/heads/master
| 2023-04-24T10:46:49.709502 | 2021-05-09T14:44:52 | 2021-05-09T14:44:52 | 362,173,569 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,717 |
java
|
package test;
import IO.SimpleCompressorOutputStream;
import algorithms.mazeGenerators.AMazeGenerator;
import algorithms.mazeGenerators.Maze;
import algorithms.mazeGenerators.MyMazeGenerator;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import File.Creating_File;
public class MyTest_Write_Maze {
public static void main(String[] args) {
/**Creating a new file in the existing tmpdir,And write to the the file **/
/*
//Creating a new file in the existing tmpdir,And write to the the file
try {
String tmpdir = System.getProperty("java.io.tmpdir");
System.out.println("Temp file path: " + tmpdir);
String S="NetaLavi6";
String z=tmpdir+S;
File file = new File(z);
OutputStream out = new FileOutputStream(file);
// Write your data
out.close();
} catch (IOException e) {
e.printStackTrace();
}
*/
Creating_File creating_file=new Creating_File();
AMazeGenerator mazeGenerator = new MyMazeGenerator();
Maze maze = null; //Generate new maze
try {
maze = mazeGenerator.generate(50, 50);
} catch (Exception e) {
e.printStackTrace();
}
//creating_file.Creating_2Files(maze);
//creating_file.Searching_File(maze);
creating_file.Creating_Solution_File(maze,0);
String tmpdir = System.getProperty("java.io.tmpdir");
String FileName_Part_2="charoncherry8_Solution";
String Full_FileName=tmpdir+FileName_Part_2;
creating_file.Read_Solution_File(Full_FileName);
}
}
|
[
"[email protected]"
] | |
ee1ad526d00f26ad5b4872f6b678892df39520e3
|
d700d8973c9eb33176ca399e09c669304e1da681
|
/Demo.SpringBootUsage-进阶二/demo-springboot-test/src/main/java/me/silentdoer/springboottest/service/impl/TestServiceImpl.java
|
3696a26ccf95a10d9a157be17730886db2c58fea
|
[] |
no_license
|
Silentdoer/demos
|
b0acb79d4f925ea66bed51d85a0868fd64abfda4
|
6f832d549458c05af831da5cce49c98ba8c562e7
|
refs/heads/master
| 2022-12-22T15:38:41.494276 | 2019-10-21T10:46:29 | 2019-10-21T10:46:29 | 118,134,224 | 1 | 0 | null | 2022-12-16T10:35:02 | 2018-01-19T14:22:06 |
Java
|
UTF-8
|
Java
| false | false | 2,559 |
java
|
package me.silentdoer.springboottest.service.impl;
import lombok.NonNull;
import me.silentdoer.springboottest.service.TestService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.remoting.RemoteAccessException;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Recover;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* @author silentdoer
* @version 1.0
*/
@Service("testService")
public class TestServiceImpl implements TestService {
private static int retryCount = 0;
private static int recoverCount = 0;
/**
* 若产生了@Retryable标注的异常那么会尝试重新执行,如果重新执行仍然抛出异常那么会执行@Recover注解的方法
* 这里maxAttempts的值是总共要尝试执行logicFunc多少次(包括第一次正常执行,默认是3),而delay则是每次尝试执行之间间隔多少毫秒
* multiplier的值是1表示每次重试不叠加等待时长,如果此值为2,那么第一次重试需要5秒,第二次要10秒,第三次要15秒以此类推。
*/
@Retryable(value= {RemoteAccessException.class},maxAttempts = 5, backoff = @Backoff(delay = 5000, multiplier = 1))
@Override
public void logicFunc() {
// 执行了5次,每次之间间隔了5秒
System.out.println("调用了retryable:" + (++TestServiceImpl.retryCount) + "次" + ",当前时间是:" + new Date());
throw new RemoteAccessException("手动产生RemoteAccessException异常");
}
/**
* 这个方法不应该由客户主动调用
* @param ex 这个异常要能够承载@Retryable抛出的异常
*/
@Recover
@Override
public void recover(@NonNull Exception ex) {
// 5
System.out.println("retryable未能重试成功,总共执行了:" + TestServiceImpl.retryCount + "次,异常信息为:" + ex.getMessage());
// 1
System.out.println(String.format("当前的recover执行了:%s次,当前时间是:%s", ++TestServiceImpl.recoverCount, new Date()));
}
private static int cacheCount = 0;
/**
* @Cacheable注解必须要有EnableCaching才能生效
* @return
*/
@Override
@Cacheable("cache0")
public String cacheReturnValue(){
cacheCount ++;
System.out.println("cacheReturnValue()方法执行了" + TestServiceImpl.cacheCount + "次");
return "缓存了返回值";
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.